@navikt/ds-react 4.10.2 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_docs.json +145 -63
- package/cjs/form/combobox/Input/Input.js +5 -2
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +3 -0
- package/cjs/grid/Cell.js +4 -0
- package/cjs/grid/Grid.js +4 -0
- package/cjs/grid/index.js +1 -3
- package/cjs/index.js +2 -0
- package/cjs/layout/content-container/index.js +8 -0
- package/cjs/layout/content-container/package.json +6 -0
- package/cjs/layout/grid/HGrid.js +92 -0
- package/cjs/layout/grid/index.js +8 -0
- package/cjs/layout/grid/package.json +6 -0
- package/cjs/layout/stack/Stack.js +1 -1
- package/cjs/layout/utilities/css.js +20 -4
- package/esm/form/combobox/Input/Input.js +5 -2
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +3 -0
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/esm/grid/Cell.d.ts +4 -0
- package/esm/grid/Cell.js +4 -0
- package/esm/grid/Cell.js.map +1 -1
- package/esm/grid/Grid.d.ts +4 -0
- package/esm/grid/Grid.js +4 -0
- package/esm/grid/Grid.js.map +1 -1
- package/esm/grid/index.d.ts +0 -1
- package/esm/grid/index.js +0 -1
- package/esm/grid/index.js.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -1
- package/esm/layout/content-container/ContentContainer.js.map +1 -0
- package/esm/layout/content-container/index.d.ts +1 -0
- package/esm/layout/content-container/index.js +2 -0
- package/esm/layout/content-container/index.js.map +1 -0
- package/esm/layout/grid/HGrid.d.ts +49 -0
- package/esm/layout/grid/HGrid.js +64 -0
- package/esm/layout/grid/HGrid.js.map +1 -0
- package/esm/layout/grid/index.d.ts +1 -0
- package/esm/layout/grid/index.js +2 -0
- package/esm/layout/grid/index.js.map +1 -0
- package/esm/layout/stack/Stack.js +1 -1
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/utilities/css.d.ts +8 -4
- package/esm/layout/utilities/css.js +18 -3
- package/esm/layout/utilities/css.js.map +1 -1
- package/package.json +2 -2
- package/src/form/combobox/Input/Input.tsx +6 -0
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +3 -0
- package/src/form/combobox/combobox.stories.tsx +10 -2
- package/src/grid/Cell.tsx +4 -0
- package/src/grid/Grid.tsx +4 -0
- package/src/grid/index.ts +0 -4
- package/src/index.ts +2 -0
- package/src/layout/content-container/index.ts +4 -0
- package/src/layout/grid/HGrid.tsx +101 -0
- package/src/layout/grid/h-grid.stories.tsx +102 -0
- package/src/layout/grid/index.ts +1 -0
- package/src/layout/stack/Stack.tsx +5 -5
- package/src/layout/utilities/css.ts +38 -16
- package/esm/grid/ContentContainer.js.map +0 -1
- /package/cjs/{grid → layout/content-container}/ContentContainer.js +0 -0
- /package/esm/{grid → layout/content-container}/ContentContainer.d.ts +0 -0
- /package/esm/{grid → layout/content-container}/ContentContainer.js +0 -0
- /package/src/{grid → layout/content-container}/ContentContainer.tsx +0 -0
|
@@ -21,36 +21,58 @@ export type SpacingScale =
|
|
|
21
21
|
| "24"
|
|
22
22
|
| "32";
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
type ResponsivePropConfig<T = string> = {
|
|
25
|
+
// eslint-disable-next-line no-unused-vars
|
|
26
|
+
[Breakpoint in BreakpointsAlias]?: T;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type ResponsiveProp<T> = T | ResponsivePropConfig<T>;
|
|
30
|
+
|
|
31
|
+
export type ResponsiveValue<T = string> = undefined | ResponsiveProp<T>;
|
|
30
32
|
|
|
31
|
-
export function getResponsiveProps(
|
|
33
|
+
export function getResponsiveProps<T = string>(
|
|
32
34
|
componentName: string,
|
|
33
35
|
componentProp: string,
|
|
34
36
|
tokenSubgroup: string,
|
|
35
|
-
responsiveProp?:
|
|
36
|
-
| string
|
|
37
|
-
| {
|
|
38
|
-
// eslint-disable-next-line no-unused-vars
|
|
39
|
-
[Breakpoint in BreakpointsAlias]?: string;
|
|
40
|
-
}
|
|
37
|
+
responsiveProp?: ResponsiveProp<T>
|
|
41
38
|
) {
|
|
42
|
-
if (!responsiveProp)
|
|
39
|
+
if (!responsiveProp) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
43
42
|
|
|
44
43
|
if (typeof responsiveProp === "string") {
|
|
45
44
|
return {
|
|
46
|
-
[`--
|
|
45
|
+
[`--__ac-${componentName}-${componentProp}-xs`]: `var(--a-${tokenSubgroup}-${responsiveProp})`,
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
return Object.fromEntries(
|
|
51
50
|
Object.entries(responsiveProp).map(([breakpointAlias, aliasOrScale]) => [
|
|
52
|
-
`--
|
|
51
|
+
`--__ac-${componentName}-${componentProp}-${breakpointAlias}`,
|
|
53
52
|
`var(--a-${tokenSubgroup}-${aliasOrScale})`,
|
|
54
53
|
])
|
|
55
54
|
);
|
|
56
55
|
}
|
|
56
|
+
|
|
57
|
+
export function getResponsiveValue<T = string>(
|
|
58
|
+
componentName: string,
|
|
59
|
+
componentProp: string,
|
|
60
|
+
responsiveProp?: ResponsiveValue<T>
|
|
61
|
+
) {
|
|
62
|
+
if (!responsiveProp) {
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (typeof responsiveProp === "string") {
|
|
67
|
+
return {
|
|
68
|
+
[`--__ac-${componentName}-${componentProp}-xs`]: responsiveProp,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return Object.fromEntries(
|
|
73
|
+
Object.entries(responsiveProp).map(([breakpointAlias, responsiveValue]) => [
|
|
74
|
+
`--__ac-${componentName}-${componentProp}-${breakpointAlias}`,
|
|
75
|
+
responsiveValue,
|
|
76
|
+
])
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContentContainer.js","sourceRoot":"","sources":["../../src/grid/ContentContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,MAAM,CAAC;AAStB,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAGxC,CAAC,EAAsB,EAAE,GAAG,EAAE,EAAE;QAA/B,EAAE,SAAS,OAAW,EAAN,IAAI,cAApB,aAAsB,CAAF;IAAY,OAAA,CACjC,2CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,IAC/C,IAAI,EACR,CACH,CAAA;CAAA,CAAC,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|