mirror of
https://github.com/navikt/aksel.git
synced 2026-11-27 15:14:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fc7d0ff19 | ||
|
|
aaef3332ab | ||
|
|
52960fc4ff | ||
|
|
bcb3db8213 | ||
|
|
b5620a7fd7 | ||
|
|
0055f3c056 | ||
|
|
359c1cc32f |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@navikt/ds-css": patch
|
||||
---
|
||||
|
||||
ActionMenu: Use `rem` instead of `px` for indicator icon.
|
||||
@@ -20,7 +20,7 @@ body {
|
||||
}
|
||||
|
||||
.storyheading {
|
||||
font-size: 18px;
|
||||
font-size: 1.125rem;
|
||||
background: lightblue;
|
||||
color: #23262a;
|
||||
padding: 2px 4px;
|
||||
|
||||
@@ -96,6 +96,6 @@
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "6.0.3",
|
||||
"unified": "11.0.5",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@
|
||||
"@types/lodash": "4.17.25",
|
||||
"rimraf": "6.1.4",
|
||||
"typescript": "6.0.3",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
border-radius: var(--ax-radius-12);
|
||||
border: 1px solid var(--ax-border-neutral-subtleA);
|
||||
box-shadow: var(--ax-shadow-dialog);
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
transform-origin: var(--__axc-action-menu-content-transform-origin);
|
||||
transition:
|
||||
transform 100ms cubic-bezier(0.25, 0.46, 0.45, 0.94) allow-discrete,
|
||||
@@ -45,7 +44,6 @@
|
||||
padding-block: var(--__axc-action-menu-content-p-block);
|
||||
padding-inline: var(--__axc-action-menu-content-p-inline);
|
||||
overflow: auto;
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
max-height: var(--__axc-action-menu-content-available-height);
|
||||
}
|
||||
|
||||
@@ -217,5 +215,5 @@
|
||||
}
|
||||
|
||||
.aksel-action-menu__indicator-icon {
|
||||
font-size: 14px;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
font-style: italic;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-italic-cyrillic_ext.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-italic-cyrillic_ext.woff2") format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
font-style: italic;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-italic-cyrillic.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-italic-cyrillic.woff2") format("woff2");
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
font-style: italic;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-italic-latin_ext.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-italic-latin_ext.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
||||
U+A720-A7FF;
|
||||
@@ -36,7 +36,7 @@
|
||||
font-style: italic;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-italic.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-italic.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
|
||||
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
@@ -48,7 +48,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-normal-cyrillic_ext.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-normal-cyrillic_ext.woff2") format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-normal-cyrillic.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-normal-cyrillic.woff2") format("woff2");
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-normal-latin_ext.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-normal-latin_ext.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
||||
U+A720-A7FF;
|
||||
@@ -80,7 +80,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-normal.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-normal.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
|
||||
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
@@ -94,7 +94,7 @@
|
||||
font-style: italic;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-italic-latin_ext.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-italic-latin_ext.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
||||
U+A720-A7FF;
|
||||
@@ -106,7 +106,7 @@
|
||||
font-style: italic;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-italic.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-italic.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
|
||||
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
@@ -118,7 +118,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-normal-latin_ext.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-normal-latin_ext.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
||||
U+A720-A7FF;
|
||||
@@ -130,7 +130,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 400 650;
|
||||
font-display: swap;
|
||||
src: url(https://cdn.nav.no/aksel/fonts/SourceSans3-normal.woff2) format("woff2");
|
||||
src: url("https://cdn.nav.no/aksel/fonts/SourceSans3-normal.woff2") format("woff2");
|
||||
unicode-range:
|
||||
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
|
||||
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
/* stylelint-disable no-duplicate-selectors */
|
||||
/* stylelint-disable no-duplicate-selectors -- Preview stylesheet groups rules by feature section */
|
||||
|
||||
.aksel-data-grid {
|
||||
flex-grow: 1;
|
||||
@@ -734,6 +733,7 @@ html[data-dragging-cursor="true"] *::after {
|
||||
inset-inline-start: 1px;
|
||||
|
||||
/* 3px magic number: Avoids content from overflowing when scrolling all the way to the right */
|
||||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features -- Container query units require Safari 16+; WIP preview component */
|
||||
max-inline-size: calc(100cqi - 3px);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
border-radius: var(--ax-radius-8);
|
||||
border: 1px solid var(--ax-border-neutral-subtleA);
|
||||
box-shadow: var(--ax-shadow-dialog);
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
transform-origin: var(--__axc-floating-transform-origin);
|
||||
transition: opacity 150ms ease allow-discrete;
|
||||
|
||||
@@ -30,7 +29,6 @@
|
||||
max-width: min(95vw, 640px);
|
||||
animation-duration: 160ms;
|
||||
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
max-height: calc(var(--__axc-floating-available-height) - 4px);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 360px) {
|
||||
@media (width <= 360px) {
|
||||
.aksel-date__modal-body > & {
|
||||
margin-inline: -12px;
|
||||
}
|
||||
@@ -327,7 +327,7 @@
|
||||
gap: var(--ax-space-8);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-date {
|
||||
--__axc-date-button-size: 3rem;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
/* Needed to accommodate 400% zoom */
|
||||
@media (max-height: 400px) {
|
||||
@media (height <= 400px) {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@@ -92,11 +92,10 @@
|
||||
}
|
||||
|
||||
&[data-nested-dialog-open="true"] {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
transform: translateY(calc(1rem * var(--__axc-nested-level) * -1)) scale(calc(1 - 0.02 * var(--__axc-nested-level)));
|
||||
}
|
||||
|
||||
@media (max-width: 480px) or (max-height: 479px) {
|
||||
@media (width <= 480px) or (height <= 479px) {
|
||||
--__axc-dialog-transform: translateY(35%);
|
||||
|
||||
max-height: calc(100dvh - max(16px, 10dvh));
|
||||
@@ -109,7 +108,7 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
|
||||
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties -- Explicit sides keep top: auto override clear */
|
||||
top: auto;
|
||||
margin-block: 0;
|
||||
}
|
||||
@@ -162,7 +161,6 @@
|
||||
height: auto;
|
||||
|
||||
&[data-nested-dialog-open="true"] {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
transform: translateY(calc(1rem * var(--__axc-nested-level) * -1)) scale(calc(1 - 0.02 * var(--__axc-nested-level)));
|
||||
}
|
||||
}
|
||||
@@ -238,7 +236,7 @@
|
||||
background-repeat: no-repeat;
|
||||
|
||||
/* Needed to accommodate 400% zoom */
|
||||
@media (max-height: 400px) {
|
||||
@media (height <= 400px) {
|
||||
overflow: unset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,9 +130,7 @@
|
||||
************************************************/
|
||||
|
||||
.aksel-combo-box__popup {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
min-width: var(--__axc-floating-anchor-width);
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
max-height: calc(var(--__axc-floating-available-height) - 4px);
|
||||
background-color: var(--ax-bg-raised);
|
||||
padding: 1px;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* stylelint-disable aksel/design-token-exists */
|
||||
.aksel-combobox__wrapper {
|
||||
--__axc-combobox-icon-size: 1.5rem;
|
||||
--__axc-combobox-wrapper-inner-padding: var(--ax-space-8);
|
||||
@@ -242,7 +241,6 @@
|
||||
/* dropdown & non selectable dropdown items */
|
||||
|
||||
.aksel-combobox__list {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
width: var(--__axc-floating-anchor-width);
|
||||
overflow: clip;
|
||||
border: 1px solid var(--ax-border-neutral-subtleA);
|
||||
@@ -384,7 +382,7 @@
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media (max-width: 479px) {
|
||||
@media (width <= 479px) {
|
||||
.aksel-combobox__button-toggle-list {
|
||||
right: 0.5rem;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
gap: 0 var(--ax-space-12);
|
||||
}
|
||||
|
||||
@media (max-width: 479px) {
|
||||
@media (width <= 479px) {
|
||||
.aksel-form-summary__header {
|
||||
padding: var(--ax-space-12) var(--ax-space-16);
|
||||
flex-direction: column;
|
||||
@@ -34,7 +34,7 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 479px) {
|
||||
@media (width <= 479px) {
|
||||
.aksel-form-summary__answers {
|
||||
padding: var(--ax-space-12) var(--ax-space-16) var(--ax-space-16) var(--ax-space-16);
|
||||
}
|
||||
@@ -54,7 +54,7 @@
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 479px) {
|
||||
@media (width <= 479px) {
|
||||
.aksel-form-summary__answer:not(:last-child) {
|
||||
margin-bottom: var(--ax-space-12);
|
||||
padding-bottom: var(--ax-space-12);
|
||||
@@ -88,7 +88,7 @@
|
||||
border-top: 1px solid var(--ax-border-neutral-subtleA);
|
||||
}
|
||||
|
||||
@media (max-width: 479px) {
|
||||
@media (width <= 479px) {
|
||||
.aksel-form-summary__footer {
|
||||
padding: var(--ax-space-12) var(--ax-space-16);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.aksel-textarea__input {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
height: var(--__axc-textarea-height);
|
||||
appearance: none;
|
||||
padding: var(--ax-space-8);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
--__axc-guide-panel-guide-size: 3.75rem;
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
&[data-poster="false"][data-responsive="false"] {
|
||||
--__axc-guide-panel-guide-size: 5rem;
|
||||
}
|
||||
@@ -62,7 +62,7 @@
|
||||
margin-left: var(--ax-space-20);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-guide-panel[data-responsive="true"] > & {
|
||||
margin-top: 0;
|
||||
margin-left: var(--ax-space-20);
|
||||
@@ -81,7 +81,7 @@
|
||||
min-height: var(--__axc-guide-panel-guide-size);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
padding: var(--ax-space-16) var(--ax-space-20);
|
||||
|
||||
.aksel-guide-panel[data-responsive="true"] & {
|
||||
@@ -106,7 +106,7 @@
|
||||
transform: translateY(-15%) rotateZ(-90deg) scaleX(-1);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-guide-panel[data-responsive="true"] & {
|
||||
top: calc(var(--__axc-guide-panel-guide-size) / 2);
|
||||
left: calc(var(--ax-space-20) * -1 - 2px);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
display: inline;
|
||||
|
||||
& > svg {
|
||||
/* stylelint-disable-next-line plugin/declaration-block-no-ignored-properties */
|
||||
/* stylelint-disable-next-line plugin/declaration-block-no-ignored-properties -- <svg> is a replaced element so vertical margin applies with display: inline */
|
||||
margin: 0.1em 0.1em -0.1em;
|
||||
transform: translateY(0.05em);
|
||||
display: inline;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
margin-bottom: var(--ax-space-2);
|
||||
}
|
||||
|
||||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features -- :nth-child(of S) in WIP preview component */
|
||||
.aksel-listbox__group:first-child &:nth-child(1 of &) {
|
||||
/* When we scroll to the first option, and that option is in a group,
|
||||
scroll to the very top so that the group label is visible as well.
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
|
||||
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties -- Preserves dialog-polyfill longhand side declarations */
|
||||
left: 0;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
width: 450px;
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-modal {
|
||||
max-width: calc(100% - 2em);
|
||||
}
|
||||
@@ -82,7 +82,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-height: 480px) {
|
||||
@media (height >= 480px) {
|
||||
.aksel-modal {
|
||||
max-height: calc(100% - 2em);
|
||||
}
|
||||
@@ -110,7 +110,7 @@
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
|
||||
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties -- Preserves dialog-polyfill longhand side declarations */
|
||||
left: 0;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
background-repeat: no-repeat;
|
||||
|
||||
/* Needed to accommodate 400% zoom */
|
||||
@media (max-height: 400px) {
|
||||
@media (height <= 400px) {
|
||||
overflow: unset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
padding: var(--ax-space-12) var(--ax-space-16);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-popover__content {
|
||||
padding: var(--ax-space-16) var(--ax-space-20);
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
grid-column: var(--__axc-r-grid-column);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-r-p {
|
||||
--__axc-r-padding: var(--__axc-r-p-sm);
|
||||
}
|
||||
@@ -400,7 +400,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.aksel-r-p {
|
||||
--__axc-r-padding: var(--__axc-r-p-md);
|
||||
}
|
||||
@@ -502,7 +502,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.aksel-r-p {
|
||||
--__axc-r-padding: var(--__axc-r-p-lg);
|
||||
}
|
||||
@@ -604,7 +604,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.aksel-r-p {
|
||||
--__axc-r-padding: var(--__axc-r-p-xl);
|
||||
}
|
||||
@@ -706,7 +706,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (width >= 1440px) {
|
||||
.aksel-r-p {
|
||||
--__axc-r-padding: var(--__axc-r-p-2xl);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
padding-block: var(--__axc-bleed-padding-block);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-bleed {
|
||||
--__axc-bleed-margin-inline: var(--__axc-bleed-margin-inline-sm);
|
||||
--__axc-bleed-margin-block: var(--__axc-bleed-margin-block-sm);
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.aksel-bleed {
|
||||
--__axc-bleed-margin-inline: var(--__axc-bleed-margin-inline-md);
|
||||
--__axc-bleed-margin-block: var(--__axc-bleed-margin-block-md);
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.aksel-bleed {
|
||||
--__axc-bleed-margin-inline: var(--__axc-bleed-margin-inline-lg);
|
||||
--__axc-bleed-margin-block: var(--__axc-bleed-margin-block-lg);
|
||||
@@ -78,7 +78,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.aksel-bleed {
|
||||
--__axc-bleed-margin-inline: var(--__axc-bleed-margin-inline-xl);
|
||||
--__axc-bleed-margin-block: var(--__axc-bleed-margin-block-xl);
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (width >= 1440px) {
|
||||
.aksel-bleed {
|
||||
--__axc-bleed-margin-inline: var(--__axc-bleed-margin-inline-2xl);
|
||||
--__axc-bleed-margin-block: var(--__axc-bleed-margin-block-2xl);
|
||||
|
||||
@@ -35,31 +35,31 @@
|
||||
box-shadow: var(--__axc-box-shadow);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-box-radius {
|
||||
--__axc-box-radius: var(--__axc-box-radius-sm);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.aksel-box-radius {
|
||||
--__axc-box-radius: var(--__axc-box-radius-md);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.aksel-box-radius {
|
||||
--__axc-box-radius: var(--__axc-box-radius-lg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.aksel-box-radius {
|
||||
--__axc-box-radius: var(--__axc-box-radius-xl);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (width >= 1440px) {
|
||||
.aksel-box-radius {
|
||||
--__axc-box-radius: var(--__axc-box-radius-2xl);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
align-items: var(--__axc-hgrid-align);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-hgrid {
|
||||
--__axc-hgrid-columns: var(--__axc-hgrid-columns-sm);
|
||||
}
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.aksel-hgrid {
|
||||
--__axc-hgrid-columns: var(--__axc-hgrid-columns-md);
|
||||
}
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.aksel-hgrid {
|
||||
--__axc-hgrid-columns: var(--__axc-hgrid-columns-lg);
|
||||
}
|
||||
@@ -59,7 +59,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.aksel-hgrid {
|
||||
--__axc-hgrid-columns: var(--__axc-hgrid-columns-xl);
|
||||
}
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (width >= 1440px) {
|
||||
.aksel-hgrid {
|
||||
--__axc-hgrid-columns: var(--__axc-hgrid-columns-2xl);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
padding-inline: var(--__axc-page-padding-inline);
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.aksel-pageblock--gutters {
|
||||
--__axc-page-padding-inline: var(--ax-space-48);
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-responsive__below--sm {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 479px) {
|
||||
@media (width <= 479px) {
|
||||
.aksel-responsive__above--sm {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.aksel-responsive__below--md {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
@media (width <= 767px) {
|
||||
.aksel-responsive__above--md {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.aksel-responsive__below--lg {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1023px) {
|
||||
@media (width <= 1023px) {
|
||||
.aksel-responsive__above--lg {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.aksel-responsive__below--xl {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1279px) {
|
||||
@media (width <= 1279px) {
|
||||
.aksel-responsive__above--xl {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (width >= 1440px) {
|
||||
.aksel-responsive__below--2xl {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1439px) {
|
||||
@media (width <= 1439px) {
|
||||
.aksel-responsive__above--2xl {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
margin-inline-start: calc(var(--__axc-stack-gap) * -1);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.aksel-stack-gap {
|
||||
--__axc-stack-gap: var(--__axc-stack-gap-sm);
|
||||
}
|
||||
@@ -82,7 +82,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.aksel-stack-gap {
|
||||
--__axc-stack-gap: var(--__axc-stack-gap-md);
|
||||
}
|
||||
@@ -100,7 +100,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.aksel-stack-gap {
|
||||
--__axc-stack-gap: var(--__axc-stack-gap-lg);
|
||||
}
|
||||
@@ -118,7 +118,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.aksel-stack-gap {
|
||||
--__axc-stack-gap: var(--__axc-stack-gap-xl);
|
||||
}
|
||||
@@ -136,7 +136,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (width >= 1440px) {
|
||||
.aksel-stack-gap {
|
||||
--__axc-stack-gap: var(--__axc-stack-gap-2xl);
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
}
|
||||
|
||||
.aksel-timeline__period--inner {
|
||||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features -- Container query units require Safari 16+, we assume most use will be modern browsers */
|
||||
margin: 0 clamp(var(--ax-space-4), 17cqi, var(--ax-space-8));
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
@@ -124,8 +125,10 @@
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
||||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features -- Container queries require Safari 16+, we assume most use will be modern browsers */
|
||||
@container (inline-size < 1.4rem) {
|
||||
.aksel-timeline__period--inner {
|
||||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features -- Container query units require Safari 16+, we assume most use will be modern browsers */
|
||||
margin: 0 10cqi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
/* Mobile scale */
|
||||
@media (max-width: 480px) {
|
||||
@media (width <= 480px) {
|
||||
.aksel-heading--xlarge {
|
||||
font-size: var(--ax-font-size-heading-xlarge);
|
||||
letter-spacing: -0.008em;
|
||||
|
||||
@@ -814,7 +814,7 @@
|
||||
"tsc-alias": "1.9.10",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "6.0.3",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^17.0.30 || ^18 || ^19",
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { DataGrid } from "..";
|
||||
import { Pagination } from "../../pagination";
|
||||
import { HStack, VStack } from "../../primitives/stack";
|
||||
import { Detail } from "../../typography";
|
||||
import {
|
||||
type DataGridPlugin,
|
||||
type DataGridPlugins,
|
||||
applyTableContext,
|
||||
resolveDataGridPlugins,
|
||||
} from "./dataGridPlugins";
|
||||
|
||||
type InvoiceRow = {
|
||||
id: string;
|
||||
invoiceNumber: string;
|
||||
category: string;
|
||||
status: string;
|
||||
amount: string;
|
||||
};
|
||||
|
||||
const DEMO_ROWS: InvoiceRow[] = [
|
||||
{
|
||||
id: "1",
|
||||
invoiceNumber: "INV-2026-001",
|
||||
category: "Cloud Hosting",
|
||||
status: "Paid",
|
||||
amount: "12 400 kr",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
invoiceNumber: "INV-2026-002",
|
||||
category: "Software License",
|
||||
status: "Pending",
|
||||
amount: "4 850 kr",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
invoiceNumber: "INV-2026-003",
|
||||
category: "Office Supplies",
|
||||
status: "Paid",
|
||||
amount: "1 290 kr",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
invoiceNumber: "INV-2026-004",
|
||||
category: "Security Audit",
|
||||
status: "Overdue",
|
||||
amount: "28 000 kr",
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
invoiceNumber: "INV-2026-005",
|
||||
category: "Hardware",
|
||||
status: "Paid",
|
||||
amount: "19 990 kr",
|
||||
},
|
||||
{
|
||||
id: "6",
|
||||
invoiceNumber: "INV-2026-006",
|
||||
category: "Training",
|
||||
status: "Pending",
|
||||
amount: "7 500 kr",
|
||||
},
|
||||
{
|
||||
id: "7",
|
||||
invoiceNumber: "INV-2026-007",
|
||||
category: "Domain Renewal",
|
||||
status: "Paid",
|
||||
amount: "640 kr",
|
||||
},
|
||||
{
|
||||
id: "8",
|
||||
invoiceNumber: "INV-2026-008",
|
||||
category: "Monitoring",
|
||||
status: "Pending",
|
||||
amount: "3 200 kr",
|
||||
},
|
||||
];
|
||||
|
||||
const DEMO_COLUMNS: DataGrid.Columns<InvoiceRow> = [
|
||||
{
|
||||
id: "invoiceNumber",
|
||||
header: "Invoice",
|
||||
isRowHeader: true,
|
||||
bodyCell: (row) => row.invoiceNumber,
|
||||
},
|
||||
{ id: "category", header: "Category", bodyCell: (row) => row.category },
|
||||
{ id: "status", header: "Status", bodyCell: (row) => row.status },
|
||||
{ id: "amount", header: "Amount", bodyCell: (row) => row.amount },
|
||||
];
|
||||
|
||||
/**
|
||||
* Preview of how `DataGrid` will integrate the plugin API.
|
||||
* Only two lines are added around `DataGrid`'s children:
|
||||
* 1. `resolveDataGridPlugins(userPlugins)` to order and stabilize plugins
|
||||
* 2. `applyTableContext(plugins, children)` to wrap the grid output
|
||||
*/
|
||||
function PluginAwareDataGrid<RowT>({
|
||||
plugins: userPlugins,
|
||||
children,
|
||||
...dataGridProps
|
||||
}: DataGrid.Props<RowT> & { plugins?: DataGridPlugins }) {
|
||||
const plugins = resolveDataGridPlugins(userPlugins);
|
||||
|
||||
return (
|
||||
<DataGrid {...dataGridProps}>
|
||||
{applyTableContext(plugins, children)}
|
||||
</DataGrid>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Example first-party plugin hook.
|
||||
* The consumer owns pagination state; the hook returns a memoized `DataGridPlugin`
|
||||
* that wraps the table with Aksel's `<Pagination />`.
|
||||
*/
|
||||
function useDummyPaginationPlugin({
|
||||
page,
|
||||
pageSize,
|
||||
totalItems,
|
||||
onPageChange,
|
||||
}: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
totalItems: number;
|
||||
onPageChange: (nextPage: number) => void;
|
||||
}): DataGridPlugin {
|
||||
return useMemo(() => {
|
||||
const pageCount = Math.max(1, Math.ceil(totalItems / pageSize));
|
||||
const start = (page - 1) * pageSize + 1;
|
||||
const end = Math.min(page * pageSize, totalItems);
|
||||
|
||||
return {
|
||||
transformTableContext: (children) => (
|
||||
<VStack gap="space-12" data-plugin="pagination">
|
||||
{children}
|
||||
<HStack align="center" justify="space-between" gap="space-16" wrap>
|
||||
<Detail>
|
||||
Showing {start}–{end} of {totalItems}
|
||||
</Detail>
|
||||
<Pagination
|
||||
page={page}
|
||||
count={pageCount}
|
||||
onPageChange={onPageChange}
|
||||
size="small"
|
||||
/>
|
||||
</HStack>
|
||||
</VStack>
|
||||
),
|
||||
};
|
||||
}, [page, pageSize, totalItems, onPageChange]);
|
||||
}
|
||||
|
||||
const meta: Meta = {
|
||||
title: "ds-react/DataGrid/Plugins",
|
||||
parameters: {
|
||||
chromatic: { disable: true },
|
||||
layout: "padded",
|
||||
},
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj;
|
||||
|
||||
/**
|
||||
* Shows the intended consumer API for a first-party plugin hook:
|
||||
* state stays in consumer code, the hook returns a memoized `DataGridPlugin`,
|
||||
* and `DataGrid` renders it through `plugins={{ pagination }}`.
|
||||
*/
|
||||
export const PaginationPlugin: Story = {
|
||||
render: function PaginationPluginDemo() {
|
||||
const [page, setPage] = useState(1);
|
||||
const pageSize = 3;
|
||||
|
||||
const paginationPlugin = useDummyPaginationPlugin({
|
||||
page,
|
||||
pageSize,
|
||||
totalItems: DEMO_ROWS.length,
|
||||
onPageChange: setPage,
|
||||
});
|
||||
|
||||
const pageRows = useMemo(
|
||||
() => DEMO_ROWS.slice((page - 1) * pageSize, page * pageSize),
|
||||
[page],
|
||||
);
|
||||
|
||||
return (
|
||||
<PluginAwareDataGrid
|
||||
columns={DEMO_COLUMNS}
|
||||
data={pageRows}
|
||||
getRowId={(row) => row.id}
|
||||
plugins={{ pagination: paginationPlugin }}
|
||||
>
|
||||
<DataGrid.Table />
|
||||
</PluginAwareDataGrid>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,119 @@
|
||||
import { afterEach, describe, expect, test, vi } from "vitest";
|
||||
import * as consoleWarningModule from "../../utils/helpers/consoleWarning";
|
||||
import {
|
||||
type DataGridPlugin,
|
||||
type DataGridPlugins,
|
||||
applyTableContext,
|
||||
resolveDataGridPlugins,
|
||||
} from "./dataGridPlugins";
|
||||
|
||||
const createTestPlugin = (label: string): DataGridPlugin => ({
|
||||
transformTableContext: (children) => `${label}(${children})`,
|
||||
});
|
||||
|
||||
describe("resolveDataGridPlugins", () => {
|
||||
test("returns a stable empty array when plugins are undefined or empty", () => {
|
||||
const initialResult = resolveDataGridPlugins(undefined);
|
||||
expect(initialResult).toEqual([]);
|
||||
expect(resolveDataGridPlugins({})).toBe(initialResult);
|
||||
});
|
||||
|
||||
test("orders known plugins before unknown plugins, ignores prototype keys, and skips non-object entries", () => {
|
||||
const customFirst = createTestPlugin("first");
|
||||
const customSecond = createTestPlugin("second");
|
||||
const pagination = createTestPlugin("pagination");
|
||||
|
||||
expect(
|
||||
resolveDataGridPlugins({
|
||||
zCustom: customFirst,
|
||||
aCustom: customSecond,
|
||||
pagination,
|
||||
}),
|
||||
).toEqual([pagination, customFirst, customSecond]);
|
||||
|
||||
const inherited = Object.create({ pagination }) as DataGridPlugins;
|
||||
inherited.custom = customFirst;
|
||||
expect(resolveDataGridPlugins(inherited)).toEqual([customFirst]);
|
||||
});
|
||||
|
||||
test("interns array reference by plugin identity and order across inline objects", () => {
|
||||
const pagination = createTestPlugin("pagination");
|
||||
const customA = createTestPlugin("a");
|
||||
const customB = createTestPlugin("b");
|
||||
|
||||
const first = resolveDataGridPlugins({ customA, pagination });
|
||||
expect(Object.isFrozen(first)).toBe(true);
|
||||
|
||||
// New inline object with same plugin instances (even in different key order)
|
||||
expect(resolveDataGridPlugins({ pagination, customA })).toBe(first);
|
||||
|
||||
// Removing a plugin returns a new array; restoring it returns the interned array
|
||||
const paginationOnly = resolveDataGridPlugins({ pagination });
|
||||
expect(paginationOnly).not.toBe(first);
|
||||
expect(paginationOnly).toEqual([pagination]);
|
||||
|
||||
expect(resolveDataGridPlugins({ pagination, customA })).toBe(first);
|
||||
|
||||
// Changing plugin order or replacing an instance produces a new array
|
||||
const ab = resolveDataGridPlugins({ customA, customB });
|
||||
const ba = resolveDataGridPlugins({ customB, customA });
|
||||
expect(ba).not.toBe(ab);
|
||||
expect(ba).toEqual([customB, customA]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyTableContext", () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
test("wraps children in reverse plugin order and skips plugins without a valid transform", () => {
|
||||
const pagination = createTestPlugin("pagination");
|
||||
const custom = createTestPlugin("custom");
|
||||
const noopPlugin = {} as DataGridPlugin;
|
||||
const invalidPlugin = {
|
||||
transformTableContext: "not-a-function",
|
||||
} as unknown as DataGridPlugin;
|
||||
|
||||
expect(applyTableContext([], "table")).toBe("table");
|
||||
expect(
|
||||
applyTableContext(
|
||||
[pagination, noopPlugin, invalidPlugin, custom],
|
||||
"table",
|
||||
),
|
||||
).toBe("pagination(custom(table))");
|
||||
});
|
||||
|
||||
test("preserves previous content and warns when transformTableContext returns a falsy value", () => {
|
||||
const warnSpy = vi
|
||||
.spyOn(consoleWarningModule, "consoleWarning")
|
||||
.mockImplementation(() => {});
|
||||
const outer = createTestPlugin("outer");
|
||||
const returnsUndefined: DataGridPlugin = {
|
||||
transformTableContext: () => undefined,
|
||||
};
|
||||
const returnsNull: DataGridPlugin = {
|
||||
transformTableContext: () => null,
|
||||
};
|
||||
const returnsFalse: DataGridPlugin = {
|
||||
transformTableContext: () => false,
|
||||
};
|
||||
const inner = createTestPlugin("inner");
|
||||
|
||||
expect(
|
||||
applyTableContext(
|
||||
[outer, returnsUndefined, returnsNull, returnsFalse, inner],
|
||||
"table",
|
||||
),
|
||||
).toBe("outer(inner(table))");
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining('transformTableContext returned "undefined"'),
|
||||
);
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining('transformTableContext returned "null"'),
|
||||
);
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining('transformTableContext returned "false"'),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,184 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { consoleWarning } from "../../utils/helpers/consoleWarning";
|
||||
|
||||
/**
|
||||
* Plugin that extends DataGrid rendering (e.g. wrapping the table in providers
|
||||
* or extra UI). Remember to memoize the plugin object (with `useMemo`) so
|
||||
* DataGrid can skip unnecessary re-renders.
|
||||
*/
|
||||
interface DataGridPlugin {
|
||||
/**
|
||||
* Wraps the table output in context providers or surrounding UI (e.g. pagination).
|
||||
* Runs as a plain function during render. Do not call React hooks directly
|
||||
* inside this function; render a component or provider that calls hooks instead.
|
||||
*/
|
||||
transformTableContext: (children: ReactNode) => ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixed order for built-in plugins so behavior doesn't depend on key order
|
||||
* in `plugins={{ ... }}`. Custom plugins are placed after these, in their
|
||||
* original order.
|
||||
*/
|
||||
const PLUGIN_ORDER = ["pagination"] as const;
|
||||
const KNOWN_PLUGINS = new Set<string>(PLUGIN_ORDER);
|
||||
|
||||
type BuiltInDataGridPluginKey = (typeof PLUGIN_ORDER)[number];
|
||||
|
||||
/**
|
||||
* Named plugins passed to DataGrid.
|
||||
*
|
||||
* Keep plugins always present rather than toggling entries conditionally:
|
||||
* adding or removing a plugin that wraps children changes React's tree depth and remounts the grid.
|
||||
* Control active/visible state inside the plugin instead.
|
||||
*/
|
||||
type DataGridPlugins = Partial<
|
||||
Record<BuiltInDataGridPluginKey, DataGridPlugin>
|
||||
> &
|
||||
Record<string, DataGridPlugin>;
|
||||
|
||||
const EMPTY_PLUGINS: readonly never[] = [];
|
||||
|
||||
/**
|
||||
* Turns a `plugins={{ ... }}` object into an ordered, stable plugin array.
|
||||
*
|
||||
* - Orders built-in plugins consistently (`orderPlugins`).
|
||||
* - Keeps the same array reference even when the consumer passes an inline
|
||||
* `plugins={{ pagination }}` object on every render (`internByIdentity`).
|
||||
*/
|
||||
function resolveDataGridPlugins(
|
||||
userPlugins?: DataGridPlugins,
|
||||
): readonly DataGridPlugin[] {
|
||||
return internByIdentity(orderPlugins(userPlugins));
|
||||
}
|
||||
|
||||
/**
|
||||
* Places known plugins first (in `PLUGIN_ORDER`), then unknown plugins in
|
||||
* insertion order.
|
||||
*/
|
||||
function orderPlugins(
|
||||
userPlugins?: DataGridPlugins,
|
||||
): readonly DataGridPlugin[] {
|
||||
if (!userPlugins) {
|
||||
return EMPTY_PLUGINS;
|
||||
}
|
||||
|
||||
const keys = Object.keys(userPlugins);
|
||||
if (keys.length === 0) {
|
||||
return EMPTY_PLUGINS;
|
||||
}
|
||||
|
||||
const ordered: DataGridPlugin[] = [];
|
||||
|
||||
for (const name of PLUGIN_ORDER) {
|
||||
/* TS target does not support Object.hasOwn */
|
||||
if (Object.prototype.hasOwnProperty.call(userPlugins, name)) {
|
||||
const plugin = userPlugins[name];
|
||||
plugin && ordered.push(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
for (const name of keys) {
|
||||
if (!KNOWN_PLUGINS.has(name)) {
|
||||
const plugin = userPlugins[name];
|
||||
plugin && ordered.push(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
return ordered;
|
||||
}
|
||||
|
||||
interface InternNode {
|
||||
readonly next: WeakMap<DataGridPlugin, InternNode>;
|
||||
array?: readonly DataGridPlugin[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tree of WeakMaps where each path represents a sequence of plugin objects.
|
||||
* WeakMap lets unused paths be garbage-collected when plugins go away.
|
||||
*/
|
||||
const internRoot: InternNode = { next: new WeakMap() };
|
||||
|
||||
/**
|
||||
* Returns the same array instance whenever given the same objects in the same order
|
||||
* using a WeakMap trie (prefix tree keyed by object identity).
|
||||
*
|
||||
* Solves inline `plugins={{ pagination }}` props: `useMemo` on the outer object
|
||||
* would miss every render, and mutating a `useRef` during render is unsafe in
|
||||
* StrictMode / concurrent React.
|
||||
*
|
||||
* Each item walks one step down `internRoot`:
|
||||
* ```text
|
||||
* internRoot
|
||||
* └─ [pluginA] ──▶ nodeA (array: [pluginA])
|
||||
* └─ [pluginB] ──▶ nodeAB (array: [pluginA, pluginB])
|
||||
* └─ [pluginB] ──▶ nodeB
|
||||
* └─ [pluginA] ──▶ nodeBA (array: [pluginB, pluginA])
|
||||
* ```
|
||||
*
|
||||
* 1. Walk `internRoot` using each item as a `WeakMap` key, creating nodes as needed.
|
||||
* 2. Cache a copy at the terminal node so future calls with the same sequence return the exact same (`===`) array.
|
||||
* 3. Unused branches are garbage-collected automatically once any plugin object in the path is no longer referenced.
|
||||
*/
|
||||
function internByIdentity(
|
||||
items: readonly DataGridPlugin[],
|
||||
): readonly DataGridPlugin[] {
|
||||
if (items.length === 0) {
|
||||
return EMPTY_PLUGINS;
|
||||
}
|
||||
|
||||
let node = internRoot;
|
||||
for (const item of items) {
|
||||
let child = node.next.get(item);
|
||||
if (child === undefined) {
|
||||
child = { next: new WeakMap() };
|
||||
node.next.set(item, child);
|
||||
}
|
||||
node = child;
|
||||
}
|
||||
|
||||
if (node.array === undefined) {
|
||||
const copy = items.slice();
|
||||
/* Freeze in dev so accidental mutation fails fast instead of corrupting the shared cache. */
|
||||
node.array =
|
||||
process.env.NODE_ENV !== "production" ? Object.freeze(copy) : copy;
|
||||
}
|
||||
return node.array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps `children` with each plugin's `transformTableContext`.
|
||||
* Runs in reverse so the first plugin wraps outermost.
|
||||
* A falsy return (`undefined`, `null`, `false`, etc.) preserves the previous
|
||||
* content so one broken plugin doesn't accidentally blank the grid.
|
||||
*
|
||||
* TODO: Consier returning plugin name with plugin for better debugging and error messages.
|
||||
*/
|
||||
function applyTableContext(
|
||||
plugins: readonly DataGridPlugin[],
|
||||
children: ReactNode,
|
||||
): ReactNode {
|
||||
let content = children;
|
||||
|
||||
for (let i = plugins.length - 1; i >= 0; i--) {
|
||||
const transform = plugins[i].transformTableContext;
|
||||
|
||||
if (typeof transform !== "function") {
|
||||
continue;
|
||||
}
|
||||
|
||||
const next = transform(content);
|
||||
if (!next) {
|
||||
consoleWarning(
|
||||
`DataGrid: A plugin's transformTableContext returned "${String(next)}". Preserving previous content.`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
content = next;
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
export { applyTableContext, resolveDataGridPlugins };
|
||||
export type { DataGridPlugin, DataGridPlugins };
|
||||
@@ -33,7 +33,7 @@
|
||||
"tailwindcss": "^4.3.3",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "6.0.3",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
"style-dictionary": "^5.5.5",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "6.0.3",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
"@sanity/client": "7.27.0",
|
||||
"@sanity/code-input": "7.3.16",
|
||||
"@sanity/color-input": "6.1.10",
|
||||
"@sanity/image-url": "2.1.1",
|
||||
"@sanity/image-url": "2.2.0",
|
||||
"@sanity/locale-nb-no": "1.1.39",
|
||||
"@sanity/preview-url-secret": "4.1.5",
|
||||
"@sanity/table": "3.1.21",
|
||||
"@sanity/vision": "6.17.0",
|
||||
"@sanity/vision": "6.24.0",
|
||||
"date-fns": "^4.0.0",
|
||||
"lodash": "4.18.1",
|
||||
"react": "19.3.1",
|
||||
"react-dom": "19.3.1",
|
||||
"react-rx": "^5.1.1",
|
||||
"react-rx": "7.1.0",
|
||||
"rxjs": "^7.8.2",
|
||||
"sanity": "6.17.0",
|
||||
"sanity": "6.24.0",
|
||||
"sanity-plugin-iframe-pane": "5.0.43",
|
||||
"sanity-plugin-media": "6.6.3",
|
||||
"sanity-plugin-references": "1.2.0",
|
||||
@@ -41,12 +41,12 @@
|
||||
"@sanity/blueprints": "0.34.1",
|
||||
"@sanity/export": "7.1.1",
|
||||
"@sanity/functions": "1.11.0",
|
||||
"@sanity/schema": "6.17.0",
|
||||
"@sanity/schema": "6.24.0",
|
||||
"@types/lodash": "4.17.25",
|
||||
"@types/react": "19.2.14",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "6.0.3",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
},
|
||||
"exports": {
|
||||
"./schema": {
|
||||
|
||||
@@ -13,12 +13,10 @@
|
||||
z-index: 0;
|
||||
position: relative;
|
||||
max-width: 1920px;
|
||||
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
min-height: calc(100vh - var(--website-header-sticky-height));
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.pageLayout {
|
||||
grid-template-columns: min-content 1fr;
|
||||
}
|
||||
@@ -46,13 +44,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.pageLayoutMain {
|
||||
padding-inline: var(--ax-space-40);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.pageLayoutMain[data-layout="with-toc"] {
|
||||
grid-template-areas:
|
||||
"intro aside"
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
}
|
||||
|
||||
.iconPageSidebar {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
top: calc(var(--website-header-sticky-height) + var(--ax-space-24));
|
||||
position: sticky;
|
||||
height: min-content;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
.navList {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
@@ -20,7 +19,6 @@
|
||||
max-height: calc(100vh - var(--website-header-sticky-height));
|
||||
overscroll-behavior: contain;
|
||||
|
||||
/* stylelint-disable-next-line media-feature-range-notation */
|
||||
@media (width < 1024px) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
+3
-8
@@ -83,14 +83,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
&:not(:last-of-type) {
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
& + .akselLayersLink {
|
||||
.akselLayersDottedLine {
|
||||
border-bottom-width: 3px;
|
||||
}
|
||||
}
|
||||
&:not(:last-of-type):is(:hover, :focus-visible) + .akselLayersLink {
|
||||
.akselLayersDottedLine {
|
||||
border-bottom-width: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 768px) {
|
||||
@media screen and (width >= 768px) {
|
||||
.AkselPageTitle {
|
||||
font-size: 3.5rem;
|
||||
line-height: 4.1875rem;
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
.monthSpacer {
|
||||
height: var(--ax-space-12);
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
.showMoreCollapsed {
|
||||
margin-bottom: 0;
|
||||
mask-image: linear-gradient(rgba(0 0 0/1), rgba(0 0 0/1) 30%, rgba(0 0 0/ 0) calc(100% - var(--ax-space-16)));
|
||||
mask-image: linear-gradient(rgb(0 0 0 / 1), rgb(0 0 0 / 1) 30%, rgb(0 0 0 / 0) calc(100% - var(--ax-space-16)));
|
||||
}
|
||||
|
||||
.showMoreExpanded {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties -- Uses --website-hero-selector-x/y set inline by Hero provider */
|
||||
.godPraksisHero {
|
||||
border-radius: var(--ax-radius-12);
|
||||
border: 1px solid var(--ax-border-brand-blue-subtleA);
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
"content";
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
.pageArticle {
|
||||
grid-template-areas:
|
||||
"intro aside"
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
.overviewTitle {
|
||||
font-size: 48px;
|
||||
font-size: 3rem;
|
||||
color: var(--ax-text-brand-blue);
|
||||
text-align: center;
|
||||
}
|
||||
@@ -112,14 +112,14 @@
|
||||
}
|
||||
|
||||
/* sm */
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.bloggPosts {
|
||||
padding-inline: var(--ax-space-24);
|
||||
}
|
||||
}
|
||||
|
||||
/* md */
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.latestBloggPosts {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
@@ -131,7 +131,7 @@
|
||||
}
|
||||
|
||||
/* lg */
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
.remainingPosts {
|
||||
gap: var(--ax-space-40);
|
||||
}
|
||||
@@ -175,7 +175,7 @@
|
||||
color: var(--ax-text-brand-blue);
|
||||
hyphens: auto;
|
||||
|
||||
@media (max-width: 480px) {
|
||||
@media (width <= 480px) {
|
||||
font-size: 2.5rem;
|
||||
line-height: var(--ax-font-line-height-heading-2xlarge);
|
||||
}
|
||||
@@ -248,7 +248,7 @@
|
||||
|
||||
/* 480 === sm
|
||||
min-width: X == X is the minimum width needed before styles apply */
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.intro {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
/* animation added here to both light & dark, to keep them "in sync" */
|
||||
animation: 60s ease infinite rainbow-hype;
|
||||
color: var(--aksel-brand-logo);
|
||||
font-size: 40px;
|
||||
font-size: 2.5rem;
|
||||
line-height: 52px;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
left: var(--ax-space-8);
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.hero {
|
||||
max-width: 632px;
|
||||
}
|
||||
@@ -246,13 +246,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
.highlightCompact {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (width >= 1440px) {
|
||||
.forsidePageWrapper {
|
||||
margin-inline: var(--ax-space-72);
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
.godPraksisPictogramSvg {
|
||||
height: 48px;
|
||||
width: 48px;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
pointer-events: none;
|
||||
|
||||
& svg {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
color: var(--cube-stroke-color-light);
|
||||
|
||||
& path {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties -- Uses --line set inline by CodeBlock */
|
||||
|
||||
.codeBlock {
|
||||
background: var(--ax-bg-default);
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
background-color: var(--image-bg, transparent);
|
||||
|
||||
&[data-position="left"] {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties -- Set at runtime by CompareImages provider */
|
||||
clip-path: inset(0 var(--image-clip-1) 0 0);
|
||||
}
|
||||
|
||||
&[data-position="right"] {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties -- Set at runtime by CompareImages provider */
|
||||
clip-path: inset(0 0 0 var(--image-clip-2));
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
transform: translate3d(-50%, 0, 0);
|
||||
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties -- Set at runtime by CompareImages provider */
|
||||
left: var(--image-clip-2);
|
||||
|
||||
&[data-dragging="true"] {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* stylelint-disable media-feature-range-notation */
|
||||
.searchForm {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
.header {
|
||||
background-color: var(--ax-bg-default);
|
||||
top: 0;
|
||||
@@ -6,7 +5,7 @@
|
||||
border-bottom: 1px solid var(--ax-border-neutral-subtleA);
|
||||
|
||||
/* NB: Keep the min-height in sync with corresponding media query in globals.css */
|
||||
@media (min-height: 500px) {
|
||||
@media (height >= 500px) {
|
||||
position: sticky;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +22,7 @@
|
||||
max-width: 1920px;
|
||||
margin-inline: auto;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
@media (width >= 1024px) {
|
||||
padding-inline: 0 var(--ax-space-24);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties -- --website-svg-size is set inline by ImageAsSvg */
|
||||
.imageAsModule {
|
||||
width: var(--website-svg-size);
|
||||
height: var(--website-svg-size);
|
||||
|
||||
@@ -25,10 +25,8 @@
|
||||
.kodeExampleIframe {
|
||||
display: block;
|
||||
width: 100%;
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
max-height: calc(100vh - var(--website-header-sticky-height) - 20px);
|
||||
background-color: var(--ax-bg-default);
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
scroll-margin-block-start: calc(var(--website-header-sticky-height) + 3rem);
|
||||
|
||||
/* Prevent the iframe from covering up the resize handle in Safari */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
padding-inline: var(--ax-space-12);
|
||||
font-size: var(--ax-font-size-medium);
|
||||
|
||||
@media (min-width: 768px) {
|
||||
@media (width >= 768px) {
|
||||
flex-direction: row;
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,5 @@
|
||||
}
|
||||
|
||||
.propsSeksjonCode {
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
font-family: var(--website-font-mono);
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
/* stylelint-disable csstools/value-no-unknown-custom-properties */
|
||||
.promoTag {
|
||||
border-radius: var(--ax-radius-12);
|
||||
width: fit-content;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
display: none;
|
||||
min-width: 12.5rem;
|
||||
height: fit-content;
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
top: calc(var(--website-header-sticky-height) + var(--ax-space-24));
|
||||
|
||||
&[data-variant="subtle"] {
|
||||
@@ -15,7 +14,7 @@
|
||||
--aksel-toc-fade-shadow-color: var(--ax-bg-default);
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
@media (width >= 1280px) {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@@ -50,13 +49,11 @@
|
||||
|
||||
.tocShadowTop {
|
||||
top: 0;
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
background: linear-gradient(180deg, var(--aksel-toc-fade-shadow-color), transparent);
|
||||
}
|
||||
|
||||
.tocShadowBottom {
|
||||
bottom: 0;
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
background: linear-gradient(0deg, var(--aksel-toc-fade-shadow-color), transparent);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
border-radius: var(--ax-radius-2);
|
||||
background-color: var(--ax-bg-neutral-softA);
|
||||
padding: var(--ax-space-2) var(--ax-space-4);
|
||||
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
||||
font-family: var(--website-font-mono);
|
||||
display: inline;
|
||||
box-shadow: inset 0 0 0 1px var(--ax-border-neutral-subtleA);
|
||||
@@ -22,6 +21,7 @@
|
||||
.typoList {
|
||||
max-width: 600px;
|
||||
|
||||
/* stylelint-disable-next-line aksel/no-class-override -- Adjacent sibling selector adjusts .typoList margin, not Aksel classes */
|
||||
:global(.aksel-body-long.aksel-typo--spacing) + & {
|
||||
margin-top: -1rem;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
& [data-hide="sm"] {
|
||||
display: none;
|
||||
|
||||
@media (min-width: 640px) {
|
||||
@media (width >= 640px) {
|
||||
display: table-cell;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* stylelint-disable aksel/design-token-no-global-override */
|
||||
/* stylelint-disable aksel/design-token-no-global-override -- Defines custom aksel.nav.no brand theme overrides */
|
||||
|
||||
@import "./layer-order.css";
|
||||
@import "../tailwind-snapshot.css" layer(tw-snapshot);
|
||||
@@ -12,7 +12,7 @@
|
||||
"Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
|
||||
|
||||
/* NB: Keep the min-height in sync with corresponding media query in Header.module.css */
|
||||
@media (min-height: 500px) {
|
||||
@media (height >= 500px) {
|
||||
--website-header-sticky-height: calc(var(--website-header-height) + 1px);
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ body {
|
||||
}
|
||||
|
||||
/* Stops skiplink from setting focus */
|
||||
/* stylelint-disable-next-line selector-max-id -- Targets main content skip-link anchor */
|
||||
#hovedinnhold:focus {
|
||||
outline: none;
|
||||
}
|
||||
@@ -73,7 +74,7 @@ body {
|
||||
|
||||
/* 480 === sm
|
||||
min-width: X == X is the minimum width needed before styles apply */
|
||||
@media (min-width: 480px) {
|
||||
@media (width >= 480px) {
|
||||
[data-wrapper-prose] {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ import { ExampleThemingSwitch } from "./withDsExample.theme";
|
||||
|
||||
type withDsT = {
|
||||
/**
|
||||
* Full: No horizontal centering (i.e. full width with padding).
|
||||
* Static: No vertical centering and static (but responsive) width. Used for dynamic-height examples like ExpansionCard.
|
||||
* Static-full: No centering in any direction.
|
||||
* Fullscreen: No centering and no padding.
|
||||
* - `full` = No horizontal centering (i.e. full width with padding).
|
||||
* - `static` = No vertical centering and static (but responsive) width. Used for dynamic-height examples like ExpansionCard.
|
||||
* - `static-full` = No centering in any direction.
|
||||
* - `fullscreen` = No centering and no padding.
|
||||
*/
|
||||
variant?: "full" | "static" | "static-full" | "fullscreen";
|
||||
background?: "inverted" | "subtle";
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"@navikt/oasis": "4.2.2",
|
||||
"@portabletext/react": "^8.0.1",
|
||||
"@sanity/client": "7.27.0",
|
||||
"@sanity/image-url": "2.1.1",
|
||||
"@sanity/image-url": "2.2.0",
|
||||
"@slack/web-api": "^8.0.0",
|
||||
"aksel-sanity-studio": "workspace:*",
|
||||
"codesandbox-import-utils": "^2.2.3",
|
||||
@@ -75,9 +75,9 @@
|
||||
"@babel/traverse": "^7.27.4",
|
||||
"@google-cloud/bigquery": "^9.6.1",
|
||||
"@playwright/test": "1.61.1",
|
||||
"@portabletext/block-tools": "^6.0.7",
|
||||
"@portabletext/block-tools": "^6.0.8",
|
||||
"@portabletext/markdown": "^2.5.1",
|
||||
"@sanity/schema": "6.17.0",
|
||||
"@sanity/schema": "6.24.0",
|
||||
"@types/jscodeshift": "17.3.0",
|
||||
"@types/jsdom": "^27.0.0",
|
||||
"@types/lodash": "4.17.25",
|
||||
@@ -98,6 +98,6 @@
|
||||
"sitemapper": "^4.1.6",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "6.0.3",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ object {
|
||||
display: block;
|
||||
|
||||
/* 2 */
|
||||
/* stylelint-disable-next-line plugin/declaration-block-no-ignored-properties */
|
||||
/* stylelint-disable-next-line plugin/declaration-block-no-ignored-properties -- Kept from Tailwind Preflight snapshot for replaced elements */
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"prom-client": "^15.1.3",
|
||||
"tsdown": "^0.23.0",
|
||||
"typescript": "6.0.3",
|
||||
"vitest": "5.1.0",
|
||||
"vitest": "5.1.1",
|
||||
"zod": "^4.6.5"
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -11,7 +11,7 @@
|
||||
"dev": "yarn workspace aksel.nav.no dev",
|
||||
"lint": "yarn lint:oxlint && yarn lint:css && yarn lint:versions",
|
||||
"lint:oxlint": "yarn oxlint --deny-warnings",
|
||||
"lint:css": "yarn stylelint '@navikt/**/*.css'",
|
||||
"lint:css": "yarn stylelint '**/*.css' '**/.storybook/**/*.css'",
|
||||
"lint:versions": "node tooling/scripts/in-sync-versions.mts",
|
||||
"storybook": "WITH_WEBSITE=true storybook dev -p 6006",
|
||||
"storybook:aksel": "WITH_WEBSITE=true storybook dev -c aksel.nav.no/website/.storybook -p 6007",
|
||||
@@ -87,9 +87,9 @@
|
||||
"@types/node": "^24.10.9",
|
||||
"@types/react": "19.2.14",
|
||||
"@types/react-dom": "19.2.3",
|
||||
"@vitest/browser": "5.1.0",
|
||||
"@vitest/browser-playwright": "5.1.0",
|
||||
"@vitest/coverage-v8": "5.1.0",
|
||||
"@vitest/browser": "5.1.1",
|
||||
"@vitest/browser-playwright": "5.1.1",
|
||||
"@vitest/coverage-v8": "5.1.1",
|
||||
"chromatic": "18.0.1",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.39.2",
|
||||
@@ -109,12 +109,13 @@
|
||||
"stylelint": "^17.15.0",
|
||||
"stylelint-config-standard": "^40.0.0",
|
||||
"stylelint-declaration-block-no-ignored-properties": "^3.0.0",
|
||||
"stylelint-no-unsupported-browser-features": "8.1.2",
|
||||
"stylelint-value-no-unknown-custom-properties": "^6.1.1",
|
||||
"typescript": "6.0.3",
|
||||
"typescript-language-server": "6.0.3",
|
||||
"vite": "^8.3.5",
|
||||
"vite-plugin-turbosnap": "^1.0.3",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
},
|
||||
"packageManager": "yarn@4.18.0"
|
||||
}
|
||||
+91
-6
@@ -1,3 +1,4 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -13,7 +14,38 @@ const tokensPath = resolve(
|
||||
"tokens.css",
|
||||
);
|
||||
|
||||
const websiteGlobalsPath = resolve(
|
||||
__dirname,
|
||||
"aksel.nav.no",
|
||||
"website",
|
||||
"app",
|
||||
"globals.css",
|
||||
);
|
||||
|
||||
const dsCssBrowserslist = JSON.parse(
|
||||
readFileSync(
|
||||
resolve(__dirname, "@navikt", "core", "css", "package.json"),
|
||||
"utf8",
|
||||
),
|
||||
).browserslist;
|
||||
|
||||
/** Runtime custom properties injected via inline styles by `@navikt/ds-react`. */
|
||||
const dsCssRuntimeCustomProperties = {
|
||||
"--__axc-action-menu-content-available-height": "initial",
|
||||
"--__axc-action-menu-content-transform-origin": "initial",
|
||||
"--__axc-data-table-nested-depth": "initial",
|
||||
"--__axc-floating-anchor-width": "initial",
|
||||
"--__axc-floating-available-height": "initial",
|
||||
"--__axc-floating-transform-origin": "initial",
|
||||
"--__axc-nested-level": "initial",
|
||||
"--__axc-textarea-height": "initial",
|
||||
};
|
||||
|
||||
export default {
|
||||
reportNeedlessDisables: true,
|
||||
reportInvalidScopeDisables: true,
|
||||
reportDescriptionlessDisables: true,
|
||||
reportUnscopedDisables: true,
|
||||
overrides: [
|
||||
{
|
||||
files: ["@navikt/core/css/**/*"],
|
||||
@@ -21,6 +53,51 @@ export default {
|
||||
"aksel/design-token-no-global-override": null,
|
||||
"aksel/no-internal-tokens": null,
|
||||
"aksel/no-class-override": null,
|
||||
"custom-property-pattern": "^(?:ax|__axc)-[a-zA-Z0-9-]+$",
|
||||
"csstools/value-no-unknown-custom-properties": [
|
||||
true,
|
||||
{
|
||||
importFrom: [
|
||||
tokensPath,
|
||||
{ customProperties: dsCssRuntimeCustomProperties },
|
||||
],
|
||||
},
|
||||
],
|
||||
"plugin/no-unsupported-browser-features": [
|
||||
true,
|
||||
{
|
||||
browsers: dsCssBrowserslist,
|
||||
ignorePartialSupport: true,
|
||||
ignore: [
|
||||
/* Lowered by LightningCSS in @navikt/core/css/config/bundle.ts */
|
||||
"css-nesting",
|
||||
"css-media-range-syntax",
|
||||
"css-rrggbbaa",
|
||||
/* Progressive enhancements */
|
||||
"css3-cursors",
|
||||
"css3-cursors-grab",
|
||||
"css-resize",
|
||||
"css-scrollbar",
|
||||
"css-overscroll-behavior",
|
||||
"css-grid-animation",
|
||||
"css-marker-pseudo",
|
||||
"css-touch-action",
|
||||
"css-widows-orphans",
|
||||
"extended-system-fonts",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["aksel.nav.no/website/**/*"],
|
||||
rules: {
|
||||
"csstools/value-no-unknown-custom-properties": [
|
||||
true,
|
||||
{
|
||||
importFrom: [tokensPath, websiteGlobalsPath],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -42,20 +119,28 @@ export default {
|
||||
plugins: [
|
||||
"stylelint-value-no-unknown-custom-properties",
|
||||
"stylelint-declaration-block-no-ignored-properties",
|
||||
"stylelint-no-unsupported-browser-features",
|
||||
],
|
||||
rules: {
|
||||
"declaration-property-value-no-unknown": true,
|
||||
"plugin/declaration-block-no-ignored-properties": true,
|
||||
"no-unknown-animations": true,
|
||||
"no-unknown-custom-media": true,
|
||||
"function-no-unknown": true,
|
||||
"unit-no-unknown": true,
|
||||
"selector-no-deprecated": true,
|
||||
"selector-max-id": 0,
|
||||
"max-nesting-depth": 3,
|
||||
"selector-max-compound-selectors": 4,
|
||||
"no-descending-specificity": null,
|
||||
"selector-class-pattern": null,
|
||||
"custom-property-pattern": null,
|
||||
"keyframes-name-pattern": null,
|
||||
"function-url-quotes": null,
|
||||
"property-no-vendor-prefix": null,
|
||||
"comment-empty-line-before": null,
|
||||
"alpha-value-notation": "number",
|
||||
"media-feature-range-notation": "prefix",
|
||||
"import-notation": "string",
|
||||
"declaration-property-unit-disallowed-list": {
|
||||
"font-size": ["px"],
|
||||
},
|
||||
"declaration-block-no-redundant-longhand-properties": [
|
||||
true,
|
||||
{
|
||||
@@ -81,10 +166,10 @@ export default {
|
||||
},
|
||||
ignoreFiles: [
|
||||
"**/dist/**",
|
||||
"**/@navikt/codemod/**",
|
||||
"**/.next/**",
|
||||
"**/storybook-static/**",
|
||||
"**/@navikt/aksel/**",
|
||||
"**/examples/**",
|
||||
"plugin.js",
|
||||
"**/tailwind4.css",
|
||||
],
|
||||
};
|
||||
@@ -14,7 +14,7 @@
|
||||
"flat": "6.0.1",
|
||||
"mlly": "1.8.2",
|
||||
"tar": "^7.5.22",
|
||||
"vitest": "5.1.0"
|
||||
"vitest": "5.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"run:analyze-npm-action": "yarn clean && concurrently \"yarn pack-remote && tsx ./src/runners/analyze-package.ts --remote --out trunk-results.json\" \"yarn pack-local && tsx ./src/runners/analyze-package.ts --out branch-results.json\"",
|
||||
|
||||
Reference in new issue
Block a user