@helsenorge/designsystem-react 16.0.0 → 16.2.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/lib/Button.js +8 -9
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +24 -0
- package/lib/Checkbox.js +0 -2
- package/lib/Checkbox.js.map +1 -1
- package/lib/Drawer.js +30 -30
- package/lib/Drawer.js.map +1 -1
- package/lib/Expander.js +1 -0
- package/lib/Expander.js.map +1 -1
- package/lib/HorizontalScroll.js +6 -10
- package/lib/HorizontalScroll.js.map +1 -1
- package/lib/PopOver.js +2 -3
- package/lib/PopOver.js.map +1 -1
- package/lib/Radio.js +0 -2
- package/lib/Radio.js.map +1 -1
- package/lib/StackedCellContent.js +15 -0
- package/lib/StackedCellContent.js.map +1 -0
- package/lib/TabPanel.js +1 -0
- package/lib/TabPanel.js.map +1 -1
- package/lib/TableContext.js +26 -0
- package/lib/TableContext.js.map +1 -0
- package/lib/UNSAFE_TableBody.js +22 -0
- package/lib/UNSAFE_TableBody.js.map +1 -0
- package/lib/UNSAFE_TableCell.js +26 -0
- package/lib/UNSAFE_TableCell.js.map +1 -0
- package/lib/UNSAFE_TableDetail.js +17 -0
- package/lib/UNSAFE_TableDetail.js.map +1 -0
- package/lib/UNSAFE_TableExpandedRow.js +46 -0
- package/lib/UNSAFE_TableExpandedRow.js.map +1 -0
- package/lib/UNSAFE_TableHead.js +25 -0
- package/lib/UNSAFE_TableHead.js.map +1 -0
- package/lib/UNSAFE_TableHeadCell.js +182 -0
- package/lib/UNSAFE_TableHeadCell.js.map +1 -0
- package/lib/UNSAFE_TableRow.js +130 -0
- package/lib/UNSAFE_TableRow.js.map +1 -0
- package/lib/__mocks__/ResizeObserver.js +4 -1
- package/lib/__mocks__/ResizeObserver.js.map +1 -1
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/styles.module.scss +0 -4
- package/lib/components/Button/styles.module.scss.d.ts +0 -1
- package/lib/components/Checkbox/styles.module.scss +5 -5
- package/lib/components/Checkbox/styles.module.scss.d.ts +12 -1
- package/lib/components/Drawer/DrawerHeaderContent.module.scss +10 -1
- package/lib/components/Drawer/styles.module.scss +6 -2
- package/lib/components/Duolist/styles.module.scss +3 -7
- package/lib/components/Expander/styles.module.scss.d.ts +0 -1
- package/lib/components/ExpanderHierarchy/index.js +1 -0
- package/lib/components/ExpanderHierarchy/index.js.map +1 -1
- package/lib/components/ExpanderList/index.js +1 -0
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/ExpanderList/styles.module.scss +1 -0
- package/lib/components/HorizontalScroll/HorizontalScroll.d.ts +0 -4
- package/lib/components/HorizontalScroll/styles.module.scss +1 -4
- package/lib/components/HorizontalScroll/styles.module.scss.d.ts +0 -1
- package/lib/components/Label/Label.d.ts +2 -0
- package/lib/components/Label/styles.module.scss +16 -0
- package/lib/components/Label/utils.d.ts +0 -1
- package/lib/components/Modal/index.js +5 -2
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/Panel/styles.module.scss.d.ts +0 -1
- package/lib/components/PopMenu/PopMenu.d.ts +4 -0
- package/lib/components/PopMenu/index.js +3 -1
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/Radio/styles.module.scss +6 -6
- package/lib/components/Radio/styles.module.scss.d.ts +12 -1
- package/lib/components/Table/index.js +0 -1
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/UNSAFE_Table/StackedCellContent.d.ts +9 -0
- package/lib/components/UNSAFE_Table/TableCaption.d.ts +10 -0
- package/lib/components/UNSAFE_Table/TableContext.d.ts +22 -0
- package/lib/components/UNSAFE_Table/UNSAFE_Table.d.ts +37 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/UNSAFE_TableBody.d.ts +10 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.js +2 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/UNSAFE_TableCell.d.ts +15 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/UNSAFE_TableDetail.d.ts +12 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/UNSAFE_TableExpandedRow.d.ts +17 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpanderCell/UNSAFE_TableExpanderCellMobile.d.ts +4 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/UNSAFE_TableHead.d.ts +8 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/UNSAFE_TableHeadCell.d.ts +15 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.js +2 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TablePopMenuCell/UNSAFE_TablePopMenuCell.d.ts +8 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/UNSAFE_TableRow.d.ts +20 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.js +2 -0
- package/lib/components/UNSAFE_Table/constants.d.ts +29 -0
- package/lib/components/UNSAFE_Table/index.d.ts +19 -0
- package/lib/components/UNSAFE_Table/index.js +182 -0
- package/lib/components/UNSAFE_Table/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/resourceHelper.d.ts +3 -0
- package/lib/components/UNSAFE_Table/styles.module.scss +621 -0
- package/lib/components/UNSAFE_Table/styles.module.scss.d.ts +62 -0
- package/lib/components/UNSAFE_Table/useTableExpandedRows.d.ts +12 -0
- package/lib/components/UNSAFE_Table/useTableShowMore.d.ts +25 -0
- package/lib/components/UNSAFE_Table/utils.d.ts +47 -0
- package/lib/constants3.js +42 -0
- package/lib/constants3.js.map +1 -0
- package/lib/floating-ui.react.js +2 -2
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/hooks/useSort.d.ts +88 -0
- package/lib/hooks/useSort.js +91 -0
- package/lib/hooks/useSort.js.map +1 -0
- package/lib/hooks/useSort.test.js +11739 -0
- package/lib/hooks/useSort.test.js.map +1 -0
- package/lib/hooks/useSynchronousResizeObserver.d.ts +11 -0
- package/lib/hooks/useSynchronousResizeObserver.js +29 -0
- package/lib/hooks/useSynchronousResizeObserver.js.map +1 -0
- package/lib/resources/HN.Designsystem.Table.nb-NO.json.d.ts +9 -0
- package/lib/resources/Resources.d.ts +19 -0
- package/lib/rolldown-runtime.js +33 -0
- package/lib/scss/_font-mixins.scss +28 -1
- package/lib/scss/typography.module.scss +8 -0
- package/lib/scss/typography.module.scss.d.ts +2 -0
- package/lib/scss/typography.stories.tsx +8 -0
- package/lib/utils/uuid.js +1 -12
- package/lib/utils/uuid.js.map +1 -1
- package/lib/utils2.js +18 -14
- package/lib/utils2.js.map +1 -1
- package/package.json +54 -2
- package/scss/_font-mixins.scss +28 -1
- package/scss/typography.module.scss +8 -0
- package/scss/typography.module.scss.d.ts +2 -0
- package/scss/typography.stories.tsx +8 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Kjører measure før første paint og hver gang elementet eller dets overordnede element endrer størrelse.
|
|
4
|
+
* State-oppdateringer i measure rendres synkront, slik at elementet ikke vises en frame med utdatert layout
|
|
5
|
+
* (for eksempel når en overordnet komponent åpnes).
|
|
6
|
+
*
|
|
7
|
+
* @param ref Elementet som observeres, sammen med dets overordnede element
|
|
8
|
+
* @param measure Leser størrelser og setter state
|
|
9
|
+
* @param deps Når disse endres settes observeren opp på nytt
|
|
10
|
+
*/
|
|
11
|
+
export declare const useSynchronousResizeObserver: <T extends HTMLElement>(ref: RefObject<T | null>, measure: (element: T, parentElement: HTMLElement) => void, deps?: ReadonlyArray<unknown>) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import { flushSync } from "react-dom";
|
|
3
|
+
//#region src/hooks/useSynchronousResizeObserver.ts
|
|
4
|
+
/**
|
|
5
|
+
* Kjører measure før første paint og hver gang elementet eller dets overordnede element endrer størrelse.
|
|
6
|
+
* State-oppdateringer i measure rendres synkront, slik at elementet ikke vises en frame med utdatert layout
|
|
7
|
+
* (for eksempel når en overordnet komponent åpnes).
|
|
8
|
+
*
|
|
9
|
+
* @param ref Elementet som observeres, sammen med dets overordnede element
|
|
10
|
+
* @param measure Leser størrelser og setter state
|
|
11
|
+
* @param deps Når disse endres settes observeren opp på nytt
|
|
12
|
+
*/
|
|
13
|
+
var useSynchronousResizeObserver = (ref, measure, deps = []) => {
|
|
14
|
+
useLayoutEffect(() => {
|
|
15
|
+
const element = ref.current;
|
|
16
|
+
const parentElement = element?.parentElement;
|
|
17
|
+
if (!element || !parentElement) return;
|
|
18
|
+
const run = () => flushSync(() => measure(element, parentElement));
|
|
19
|
+
run();
|
|
20
|
+
const observer = new ResizeObserver(run);
|
|
21
|
+
observer.observe(element, { box: "border-box" });
|
|
22
|
+
observer.observe(parentElement, { box: "border-box" });
|
|
23
|
+
return () => observer.disconnect();
|
|
24
|
+
}, deps);
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useSynchronousResizeObserver };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=useSynchronousResizeObserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSynchronousResizeObserver.js","names":[],"sources":["../../src/hooks/useSynchronousResizeObserver.ts"],"sourcesContent":["import { useLayoutEffect, type RefObject } from 'react';\n\nimport { flushSync } from 'react-dom';\n\n/**\n * Kjører measure før første paint og hver gang elementet eller dets overordnede element endrer størrelse.\n * State-oppdateringer i measure rendres synkront, slik at elementet ikke vises en frame med utdatert layout\n * (for eksempel når en overordnet komponent åpnes).\n *\n * @param ref Elementet som observeres, sammen med dets overordnede element\n * @param measure Leser størrelser og setter state\n * @param deps Når disse endres settes observeren opp på nytt\n */\nexport const useSynchronousResizeObserver = <T extends HTMLElement>(\n ref: RefObject<T | null>,\n measure: (element: T, parentElement: HTMLElement) => void,\n deps: ReadonlyArray<unknown> = []\n): void => {\n useLayoutEffect(() => {\n const element = ref.current;\n const parentElement = element?.parentElement;\n if (!element || !parentElement) {\n return;\n }\n\n const run = (): void => flushSync(() => measure(element, parentElement));\n\n run();\n const observer = new ResizeObserver(run);\n observer.observe(element, { box: 'border-box' });\n observer.observe(parentElement, { box: 'border-box' });\n return (): void => observer.disconnect();\n }, deps);\n};\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,gCACX,KACA,SACA,OAA+B,CAAC,MACvB;CACT,sBAAsB;EACpB,MAAM,UAAU,IAAI;EACpB,MAAM,gBAAgB,SAAS;EAC/B,IAAI,CAAC,WAAW,CAAC,eACf;EAGF,MAAM,YAAkB,gBAAgB,QAAQ,SAAS,aAAa,CAAC;EAEvE,IAAI;EACJ,MAAM,WAAW,IAAI,eAAe,GAAG;EACvC,SAAS,QAAQ,SAAS,EAAE,KAAK,aAAa,CAAC;EAC/C,SAAS,QAAQ,eAAe,EAAE,KAAK,aAAa,CAAC;EACrD,aAAmB,SAAS,WAAW;CACzC,GAAG,IAAI;AACT"}
|
|
@@ -200,4 +200,23 @@ export type HNDesignsystemChip = {
|
|
|
200
200
|
removeAriaLabel: string;
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
+
export type HNDesignsystemTable = {
|
|
204
|
+
/**
|
|
205
|
+
* Vis mer
|
|
206
|
+
*/
|
|
207
|
+
showMoreButton: string;
|
|
208
|
+
/**
|
|
209
|
+
* Valg
|
|
210
|
+
*/
|
|
211
|
+
menuHeadCell: string;
|
|
212
|
+
/**
|
|
213
|
+
* Vis detaljer
|
|
214
|
+
*/
|
|
215
|
+
expandRowButton: string;
|
|
216
|
+
/**
|
|
217
|
+
* Skjul detaljer
|
|
218
|
+
*/
|
|
219
|
+
collapseRowButton: string;
|
|
220
|
+
};
|
|
221
|
+
|
|
203
222
|
/* eslint:enable */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __exportAll = (all, no_symbols) => {
|
|
10
|
+
let target = {};
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
20
|
+
key = keys[i];
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
22
|
+
get: ((k) => from[k]).bind(null, key),
|
|
23
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: true
|
|
31
|
+
}) : target, mod));
|
|
32
|
+
//#endregion
|
|
33
|
+
export { __exportAll as n, __toESM as r, __commonJSMin as t };
|
|
@@ -170,8 +170,35 @@
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
@mixin table-cell {
|
|
173
|
+
font-size: 1rem;
|
|
174
|
+
line-height: 1.28rem;
|
|
175
|
+
|
|
176
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
177
|
+
font-size: 1.125rem;
|
|
178
|
+
line-height: 1.463rem;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@mixin table-header {
|
|
173
183
|
font-size: 1.125rem;
|
|
174
|
-
line-height: 1.
|
|
184
|
+
line-height: 1.375rem;
|
|
185
|
+
font-weight: 600;
|
|
186
|
+
|
|
187
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
188
|
+
font-size: 1.25rem;
|
|
189
|
+
line-height: 1.625rem;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@mixin table-header-stack {
|
|
194
|
+
font-size: 1rem;
|
|
195
|
+
line-height: 1.28rem;
|
|
196
|
+
font-weight: 600;
|
|
197
|
+
|
|
198
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
199
|
+
font-size: 1.125rem;
|
|
200
|
+
line-height: 1.463rem;
|
|
201
|
+
}
|
|
175
202
|
}
|
|
176
203
|
|
|
177
204
|
@mixin image-caption {
|
|
@@ -81,6 +81,14 @@ import designsystemtypography from './scss/typography.scss'
|
|
|
81
81
|
@include fonts.table-cell;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
.table-header {
|
|
85
|
+
@include fonts.table-header;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.table-header-stack {
|
|
89
|
+
@include fonts.table-header-stack;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
.strong {
|
|
85
93
|
font-size: font-settings.$font-size-sm;
|
|
86
94
|
line-height: font-settings.$lineheight-size-sm;
|
|
@@ -83,6 +83,14 @@ export const TableCell: Story = {
|
|
|
83
83
|
render: args => <div className={designsystemtypography['table-cell']}>{args.tekst}</div>,
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
+
export const TableHeader: Story = {
|
|
87
|
+
render: args => <div className={designsystemtypography['table-header']}>{args.tekst}</div>,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const TableHeaderStack: Story = {
|
|
91
|
+
render: args => <div className={designsystemtypography['table-header-stack']}>{args.tekst}</div>,
|
|
92
|
+
};
|
|
93
|
+
|
|
86
94
|
export const Strong: Story = {
|
|
87
95
|
render: args => <div className={designsystemtypography.strong}>{args.tekst}</div>,
|
|
88
96
|
};
|
package/lib/utils/uuid.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
+
import { n as __exportAll } from "../rolldown-runtime.js";
|
|
1
2
|
import { isTest } from "./environment.js";
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __exportAll = (all, no_symbols) => {
|
|
5
|
-
let target = {};
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
3
|
//#region src/utils/uuid.ts
|
|
15
4
|
var uuid_exports = /* @__PURE__ */ __exportAll({
|
|
16
5
|
default: () => uuid,
|
package/lib/utils/uuid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","names":[],"sources":["../../src/utils/uuid.ts"],"sourcesContent":["import { isTest } from './environment';\n\nexport const uuid = (): string => {\n if (isTest()) {\n return 'test';\n }\n return 'bxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function (c) {\n const r = (Math.random() * 16) | 0,\n v = c == 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n};\n\nexport default uuid;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uuid.js","names":[],"sources":["../../src/utils/uuid.ts"],"sourcesContent":["import { isTest } from './environment';\n\nexport const uuid = (): string => {\n if (isTest()) {\n return 'test';\n }\n return 'bxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function (c) {\n const r = (Math.random() * 16) | 0,\n v = c == 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n};\n\nexport default uuid;\n"],"mappings":";;;;;;;AAEA,IAAa,aAAqB;CAChC,IAAI,OAAO,GACT,OAAO;CAET,OAAO,uCAAuC,QAAQ,QAAQ,SAAU,GAAG;EACzE,MAAM,IAAK,KAAK,OAAO,IAAI,KAAM;EAEjC,QADM,KAAK,MAAM,IAAK,IAAI,IAAO,EAAA,CACxB,SAAS,EAAE;CACtB,CAAC;AACH"}
|
package/lib/utils2.js
CHANGED
|
@@ -41,7 +41,7 @@ var Sublabel = ({ children, className, id, onColor, sublabelTexts, testId }) =>
|
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/components/Label/Label.tsx
|
|
44
|
-
var Label = ({ afterLabelChildren, children, className, formFieldTag, htmlFor, htmlMarkup = "label", labelClassName, labelTextClassName, labelId, labelTexts, onColor = FormOnColor.onwhite, statusDot, sublabel, sublabelWrapperClassName, testId, afterLabelChildrenClassName }) => {
|
|
44
|
+
var Label = ({ afterLabelChildren, children, className, formFieldTag, htmlFor, htmlMarkup = "label", labelClassName, labelTextClassName, labelId, labelTexts, onColor = FormOnColor.onwhite, statusDot, sublabel, sublabelWrapperClassName, testId, afterLabelChildrenClassName, sublabelInsideLabel }) => {
|
|
45
45
|
const hasChildren = children && typeof children !== "undefined";
|
|
46
46
|
const labelWrapperClasses = classNames(styles["label-wrapper"], { [styles["label-wrapper--no-bottom-margin"]]: hasChildren }, className);
|
|
47
47
|
const mainLabelWrapperClasses = classNames({ [styles["label-wrapper--after-label-children"]]: afterLabelChildren });
|
|
@@ -60,11 +60,20 @@ var Label = ({ afterLabelChildren, children, className, formFieldTag, htmlFor, h
|
|
|
60
60
|
}, index);
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
+
const CustomTag = htmlMarkup;
|
|
64
|
+
const renderSublabels = () => (sublabel || statusDot || formFieldTag) && /* @__PURE__ */ jsxs("div", {
|
|
65
|
+
className: sublabelWrapperClassName,
|
|
66
|
+
children: [
|
|
67
|
+
formFieldTag && isComponent(formFieldTag, FormFieldTag_default) && React.cloneElement(formFieldTag),
|
|
68
|
+
sublabel && isComponent(sublabel, Sublabel) && React.cloneElement(sublabel, { onColor }),
|
|
69
|
+
statusDot && isComponent(statusDot, StatusDot_default) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Spacer_default, { size: "3xs" }), React.cloneElement(statusDot, { onColor: onColor === FormOnColor.ondark ? "ondark" : "onwhite" })] })
|
|
70
|
+
]
|
|
71
|
+
});
|
|
63
72
|
return /* @__PURE__ */ jsxs("div", {
|
|
64
73
|
className: labelWrapperClasses,
|
|
65
74
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
66
75
|
className: mainLabelWrapperClasses,
|
|
67
|
-
children: [/* @__PURE__ */ jsx(
|
|
76
|
+
children: [/* @__PURE__ */ jsx(CustomTag, {
|
|
68
77
|
className: labelClassName,
|
|
69
78
|
id: labelId,
|
|
70
79
|
htmlFor,
|
|
@@ -72,23 +81,16 @@ var Label = ({ afterLabelChildren, children, className, formFieldTag, htmlFor, h
|
|
|
72
81
|
"data-analyticsid": AnalyticsId.Label,
|
|
73
82
|
children: /* @__PURE__ */ jsxs("span", {
|
|
74
83
|
className: styles["label-content-wrapper"],
|
|
75
|
-
children: [children, /* @__PURE__ */
|
|
84
|
+
children: [children, /* @__PURE__ */ jsxs("span", {
|
|
76
85
|
className: styles.label__texts,
|
|
77
|
-
children: mapLabels()
|
|
86
|
+
children: [mapLabels(), sublabelInsideLabel && renderSublabels()]
|
|
78
87
|
})]
|
|
79
88
|
})
|
|
80
89
|
}), afterLabelChildren && /* @__PURE__ */ jsx("div", {
|
|
81
90
|
className: afterLabelChildrenClasses,
|
|
82
91
|
children: afterLabelChildren
|
|
83
92
|
})]
|
|
84
|
-
}),
|
|
85
|
-
className: sublabelWrapperClassName,
|
|
86
|
-
children: [
|
|
87
|
-
formFieldTag && isComponent(formFieldTag, FormFieldTag_default) && React.cloneElement(formFieldTag),
|
|
88
|
-
sublabel && isComponent(sublabel, Sublabel) && React.cloneElement(sublabel, { onColor }),
|
|
89
|
-
statusDot && isComponent(statusDot, StatusDot_default) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Spacer_default, { size: "3xs" }), React.cloneElement(statusDot, { onColor: onColor === FormOnColor.ondark ? "ondark" : "onwhite" })] })
|
|
90
|
-
]
|
|
91
|
-
})]
|
|
93
|
+
}), !sublabelInsideLabel && renderSublabels()]
|
|
92
94
|
});
|
|
93
95
|
};
|
|
94
96
|
//#endregion
|
|
@@ -125,8 +127,9 @@ var renderLabelAsParent = (props) => {
|
|
|
125
127
|
labelTextClassName: props.labelTextClassName,
|
|
126
128
|
htmlMarkup: props.markup || "label",
|
|
127
129
|
sublabelWrapperClassName: props.sublabelWrapperClassName,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
sublabelInsideLabel: true,
|
|
131
|
+
sublabel: props.label.props.sublabel,
|
|
132
|
+
statusDot: props.label.props.statusDot,
|
|
130
133
|
afterLabelChildrenClassName: props.afterLabelChildrenClassName
|
|
131
134
|
}) : typeof props.label === "string" && /* @__PURE__ */ jsx(Label, {
|
|
132
135
|
labelTexts: [{
|
|
@@ -139,6 +142,7 @@ var renderLabelAsParent = (props) => {
|
|
|
139
142
|
labelClassName: props.labelClassName,
|
|
140
143
|
labelTextClassName: props.labelTextClassName,
|
|
141
144
|
sublabelWrapperClassName: props.sublabelWrapperClassName,
|
|
145
|
+
sublabelInsideLabel: true,
|
|
142
146
|
afterLabelChildrenClassName: props.afterLabelChildrenClassName,
|
|
143
147
|
children: props.children
|
|
144
148
|
}) });
|
package/lib/utils2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils2.js","names":[],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/utils.tsx"],"sourcesContent":["import cn from 'classnames';\n\nimport type { LabelText } from './Label';\n\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import type { FunctionComponent } from 'react';\nimport React from 'react';\n\nimport cn from 'classnames';\n\nimport type { SublabelProps } from './SubLabel';\nimport type { FormFieldTagProps } from '../FormFieldTag';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport { Sublabel } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Gives a custom classname to the afterLabelChildren wrapper. Used in checkbox and radiobutton */\n afterLabelChildrenClassName?: string;\n}\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n afterLabelChildrenClassName,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(styles['label-wrapper'], { [styles['label-wrapper--no-bottom-margin']]: hasChildren }, className);\n const mainLabelWrapperClasses = cn({\n [styles['label-wrapper--after-label-children']]: afterLabelChildren,\n });\n const afterLabelChildrenClasses = cn(styles['after-label-children'], afterLabelChildrenClassName);\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n return (\n <div className={labelWrapperClasses}>\n <div className={mainLabelWrapperClasses}>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>{mapLabels()}</span>\n </span>\n </CustomTag>\n {afterLabelChildren && <div className={afterLabelChildrenClasses}>{afterLabelChildren}</div>}\n </div>\n {(sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default Label;\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { LabelProps, LabelTags } from './Label';\nimport type { FormOnColor } from '../../constants';\n\nimport Label from './Label';\nimport { isComponent } from '../../utils/component';\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\ninterface RenderLabelProps {\n label: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n markup?: LabelTags;\n className?: string;\n}\n\nexport const renderLabel = (props: RenderLabelProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n htmlMarkup: props.markup || 'label',\n onColor: props.onColor,\n className: props.className,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'normal' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n className={props.className}\n />\n )}\n </>\n );\n};\n\ninterface RenderLabelAsParentProps {\n label: React.ReactNode;\n children: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n labelClassName?: string;\n labelTextClassName?: string;\n sublabelWrapperClassName?: string;\n large?: boolean;\n markup?: LabelTags;\n afterLabelChildrenClassName?: string;\n}\n\nexport const renderLabelAsParent = (props: RenderLabelAsParentProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n onColor: props.onColor,\n children: props.children,\n labelClassName: cn(props.labelClassName, props.label.props.labelClassName),\n labelTextClassName: props.labelTextClassName,\n htmlMarkup: props.markup || 'label',\n sublabelWrapperClassName: props.sublabelWrapperClassName,\n sublabel: props.large ? undefined : props.label.props.sublabel,\n statusDot: props.large ? undefined : props.label.props.statusDot,\n afterLabelChildrenClassName: props.afterLabelChildrenClassName,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'subdued' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n htmlMarkup={props.markup || 'label'}\n labelClassName={props.labelClassName}\n labelTextClassName={props.labelTextClassName}\n sublabelWrapperClassName={props.sublabelWrapperClassName}\n afterLabelChildrenClassName={props.afterLabelChildrenClassName}\n >\n {props.children}\n </Label>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;AAwBA,IAAa,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;EACxE,OACE,iBACA,cAAc,KAAK,cAAc,UAAU;GACzC,MAAM,eAAe,WAAG,OAAO,OAAO,OAAO,aAAa;KACvD,OAAO,uBAAuB,aAAa,SAAS;KACpD,OAAO,uBAAuB,YAAY,YAAY;GACzD,CAAC;GACD,OACE,yBAAyB,aAAa,wBACpC,oBAAC,QAAD;IAAM,WAAW;IACd,UAAA,aAAa;GACV,GAF8B,KAE9B;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AAeA,IAAa,uBAAuB,UAAqD;CACvF,OACE,oBAAA,UAAA,EAAA,UACG,MAAM,SAAS,YAAwB,MAAM,OAAO,KAAK,IACtD,MAAM,aAAa,MAAM,OAAO;EAC9B,SAAS,MAAM;EACf,SAAS,MAAM;EACf,UAAU,MAAM;EAChB,gBAAgB,WAAG,MAAM,gBAAgB,MAAM,MAAM,MAAM,cAAc;EACzE,oBAAoB,MAAM;EAC1B,YAAY,MAAM,UAAU;EAC5B,0BAA0B,MAAM;EAChC,UAAU,MAAM,QAAQ,KAAA,IAAY,MAAM,MAAM,MAAM;EACtD,WAAW,MAAM,QAAQ,KAAA,IAAY,MAAM,MAAM,MAAM;EACvD,6BAA6B,MAAM;CACrC,CAAC,IACD,OAAO,MAAM,UAAU,YACrB,oBAAC,OAAD;EACE,YAAY,CAAC;GAAE,MAAM,MAAM;GAAO,MAAM;EAAU,CAAC;EACnD,SAAS,MAAM;EACf,SAAS,MAAM;EACf,YAAY,MAAM,UAAU;EAC5B,gBAAgB,MAAM;EACtB,oBAAoB,MAAM;EAC1B,0BAA0B,MAAM;EAChC,6BAA6B,MAAM;EAElC,UAAA,MAAM;CACF,CAAA,EAEb,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"utils2.js","names":[],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/utils.tsx"],"sourcesContent":["import cn from 'classnames';\n\nimport type { LabelText } from './Label';\n\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import type { FunctionComponent } from 'react';\nimport React from 'react';\n\nimport cn from 'classnames';\n\nimport type { SublabelProps } from './SubLabel';\nimport type { FormFieldTagProps } from '../FormFieldTag';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport { Sublabel } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Gives a custom classname to the afterLabelChildren wrapper. Used in checkbox and radiobutton */\n afterLabelChildrenClassName?: string;\n /** Renders formFieldTag, sublabel and statusDot inside the label element, underneath the label texts. Used by Checkbox and Radio. */\n sublabelInsideLabel?: boolean;\n}\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n afterLabelChildrenClassName,\n sublabelInsideLabel,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(styles['label-wrapper'], { [styles['label-wrapper--no-bottom-margin']]: hasChildren }, className);\n const mainLabelWrapperClasses = cn({\n [styles['label-wrapper--after-label-children']]: afterLabelChildren,\n });\n const afterLabelChildrenClasses = cn(styles['after-label-children'], afterLabelChildrenClassName);\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n const renderSublabels = (): React.ReactNode =>\n (sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n );\n\n return (\n <div className={labelWrapperClasses}>\n <div className={mainLabelWrapperClasses}>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>\n {mapLabels()}\n {sublabelInsideLabel && renderSublabels()}\n </span>\n </span>\n </CustomTag>\n {afterLabelChildren && <div className={afterLabelChildrenClasses}>{afterLabelChildren}</div>}\n </div>\n {!sublabelInsideLabel && renderSublabels()}\n </div>\n );\n};\n\nexport default Label;\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { LabelProps, LabelTags } from './Label';\nimport type { FormOnColor } from '../../constants';\n\nimport Label from './Label';\nimport { isComponent } from '../../utils/component';\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\ninterface RenderLabelProps {\n label: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n markup?: LabelTags;\n className?: string;\n}\n\nexport const renderLabel = (props: RenderLabelProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n htmlMarkup: props.markup || 'label',\n onColor: props.onColor,\n className: props.className,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'normal' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n className={props.className}\n />\n )}\n </>\n );\n};\n\ninterface RenderLabelAsParentProps {\n label: React.ReactNode;\n children: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n labelClassName?: string;\n labelTextClassName?: string;\n sublabelWrapperClassName?: string;\n markup?: LabelTags;\n afterLabelChildrenClassName?: string;\n}\n\nexport const renderLabelAsParent = (props: RenderLabelAsParentProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n onColor: props.onColor,\n children: props.children,\n labelClassName: cn(props.labelClassName, props.label.props.labelClassName),\n labelTextClassName: props.labelTextClassName,\n htmlMarkup: props.markup || 'label',\n sublabelWrapperClassName: props.sublabelWrapperClassName,\n sublabelInsideLabel: true,\n sublabel: props.label.props.sublabel,\n statusDot: props.label.props.statusDot,\n afterLabelChildrenClassName: props.afterLabelChildrenClassName,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'subdued' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n htmlMarkup={props.markup || 'label'}\n labelClassName={props.labelClassName}\n labelTextClassName={props.labelTextClassName}\n sublabelWrapperClassName={props.sublabelWrapperClassName}\n sublabelInsideLabel\n afterLabelChildrenClassName={props.afterLabelChildrenClassName}\n >\n {props.children}\n </Label>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;AAwBA,IAAa,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;EACxE,OACE,iBACA,cAAc,KAAK,cAAc,UAA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K,IACtD,MAAM,aAAa,MAAM,OAAO;EAC9B,SAAS,MAAM;EACf,YAAY,MAAM,UAAU;EAC5B,SAAS,MAAM;EACf,WAAW,MAAM;CACnB,CAAC,IACD,OAAO,MAAM,UAAU,YACrB,oBAAC,OAAD;EACE,YAAY,CAAC;GAAE,MAAM,MAAM;GAAO,MAAM;EAAS,CAAC;EAClD,SAAS,MAAM;EACf,SAAS,MAAM;EACf,WAAW,MAAM;CAClB,CAAA,EAEP,CAAA;AAEN;AAcA,IAAa,uBAAuB,UAAqD;CACvF,OACE,oBAAA,UAAA,EAAA,UACG,MAAM,SAAS,YAAwB,MAAM,OAAO,KAAK,IACtD,MAAM,aAAa,MAAM,OAAO;EAC9B,SAAS,MAAM;EACf,SAAS,MAAM;EACf,UAAU,MAAM;EAChB,gBAAgB,WAAG,MAAM,gBAAgB,MAAM,MAAM,MAAM,cAAc;EACzE,oBAAoB,MAAM;EAC1B,YAAY,MAAM,UAAU;EAC5B,0BAA0B,MAAM;EAChC,qBAAqB;EACrB,UAAU,MAAM,MAAM,MAAM;EAC5B,WAAW,MAAM,MAAM,MAAM;EAC7B,6BAA6B,MAAM;CACrC,CAAC,IACD,OAAO,MAAM,UAAU,YACrB,oBAAC,OAAD;EACE,YAAY,CAAC;GAAE,MAAM,MAAM;GAAO,MAAM;EAAU,CAAC;EACnD,SAAS,MAAM;EACf,SAAS,MAAM;EACf,YAAY,MAAM,UAAU;EAC5B,gBAAgB,MAAM;EACtB,oBAAoB,MAAM;EAC1B,0BAA0B,MAAM;EAChC,qBAAA;EACA,6BAA6B,MAAM;EAElC,UAAA,MAAM;CACF,CAAA,EAEb,CAAA;AAEN"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@helsenorge/designsystem-react",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "16.
|
|
5
|
+
"version": "16.2.0",
|
|
6
6
|
"description": "The official design system for Helsenorge built with React.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -843,7 +843,58 @@
|
|
|
843
843
|
"./scss/reset": "./scss/_reset.scss",
|
|
844
844
|
"./scss/screen-reader": "./scss/_screen-reader.scss",
|
|
845
845
|
"./scss/spacers": "./scss/_spacers.scss",
|
|
846
|
-
"./scss/visual-form": "./scss/_visual-form.scss"
|
|
846
|
+
"./scss/visual-form": "./scss/_visual-form.scss",
|
|
847
|
+
"./components/Drawer/DrawerBackButton": {
|
|
848
|
+
"types": "./lib/components/Drawer/DrawerBackButton.d.ts",
|
|
849
|
+
"import": "./lib/components/Drawer/index.js",
|
|
850
|
+
"require": "./lib/components/Drawer/index.js",
|
|
851
|
+
"default": "./lib/components/Drawer/index.js"
|
|
852
|
+
},
|
|
853
|
+
"./components/Drawer/DrawerHeaderContent": {
|
|
854
|
+
"types": "./lib/components/Drawer/DrawerHeaderContent.d.ts",
|
|
855
|
+
"import": "./lib/components/Drawer/index.js",
|
|
856
|
+
"require": "./lib/components/Drawer/index.js",
|
|
857
|
+
"default": "./lib/components/Drawer/index.js"
|
|
858
|
+
},
|
|
859
|
+
"./components/UNSAFE_Table/TableCaption": {
|
|
860
|
+
"types": "./lib/components/UNSAFE_Table/TableCaption.d.ts",
|
|
861
|
+
"import": "./lib/components/UNSAFE_Table/index.js",
|
|
862
|
+
"require": "./lib/components/UNSAFE_Table/index.js",
|
|
863
|
+
"default": "./lib/components/UNSAFE_Table/index.js"
|
|
864
|
+
},
|
|
865
|
+
"./components/UNSAFE_Table/TableContext": {
|
|
866
|
+
"types": "./lib/components/UNSAFE_Table/TableContext.d.ts",
|
|
867
|
+
"import": "./lib/components/UNSAFE_Table/index.js",
|
|
868
|
+
"require": "./lib/components/UNSAFE_Table/index.js",
|
|
869
|
+
"default": "./lib/components/UNSAFE_Table/index.js"
|
|
870
|
+
},
|
|
871
|
+
"./components/UNSAFE_Table/UNSAFE_Table": {
|
|
872
|
+
"types": "./lib/components/UNSAFE_Table/UNSAFE_Table.d.ts"
|
|
873
|
+
},
|
|
874
|
+
"./components/UNSAFE_Table/constants": {
|
|
875
|
+
"types": "./lib/components/UNSAFE_Table/constants.d.ts"
|
|
876
|
+
},
|
|
877
|
+
"./components/UNSAFE_Table/useTableExpandedRows": {
|
|
878
|
+
"types": "./lib/components/UNSAFE_Table/useTableExpandedRows.d.ts"
|
|
879
|
+
},
|
|
880
|
+
"./components/UNSAFE_Table/useTableShowMore": {
|
|
881
|
+
"types": "./lib/components/UNSAFE_Table/useTableShowMore.d.ts"
|
|
882
|
+
},
|
|
883
|
+
"./components/UNSAFE_Table/utils": {
|
|
884
|
+
"types": "./lib/components/UNSAFE_Table/utils.d.ts"
|
|
885
|
+
},
|
|
886
|
+
"./components/VisualContentgroupWithImage/VisualContentgroupWithImage": {
|
|
887
|
+
"types": "./lib/components/VisualContentgroupWithImage/VisualContentgroupWithImage.d.ts",
|
|
888
|
+
"import": "./lib/components/VisualContentgroupWithImage/index.js",
|
|
889
|
+
"require": "./lib/components/VisualContentgroupWithImage/index.js",
|
|
890
|
+
"default": "./lib/components/VisualContentgroupWithImage/index.js"
|
|
891
|
+
},
|
|
892
|
+
"./components/UNSAFE_Table/StackLabelledContent": {
|
|
893
|
+
"types": "./lib/components/UNSAFE_Table/StackLabelledContent.d.ts",
|
|
894
|
+
"import": "./lib/components/UNSAFE_Table/index.js",
|
|
895
|
+
"require": "./lib/components/UNSAFE_Table/index.js",
|
|
896
|
+
"default": "./lib/components/UNSAFE_Table/index.js"
|
|
897
|
+
}
|
|
847
898
|
},
|
|
848
899
|
"scripts": {
|
|
849
900
|
"start": "storybook dev -p 3000",
|
|
@@ -861,6 +912,7 @@
|
|
|
861
912
|
"generate:illustrationnames": "node __scripts__/generateIllustrationNames.mjs",
|
|
862
913
|
"generate:cssdefinitions": "typed-scss-modules \"src/**/*.module.scss\" --nameFormat none --exportType default --includePaths node_modules ../../node_modules",
|
|
863
914
|
"generate:scssexports": "node __scripts__/gen-scss-exports.mjs",
|
|
915
|
+
"generate:deepexports": "node __scripts__/gen-deep-exports.mjs",
|
|
864
916
|
"eslint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
865
917
|
"eslint:fix": "npm run eslint -- --fix",
|
|
866
918
|
"stylelint": "stylelint \"src/**/*.{css,scss}\"",
|
package/scss/_font-mixins.scss
CHANGED
|
@@ -170,8 +170,35 @@
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
@mixin table-cell {
|
|
173
|
+
font-size: 1rem;
|
|
174
|
+
line-height: 1.28rem;
|
|
175
|
+
|
|
176
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
177
|
+
font-size: 1.125rem;
|
|
178
|
+
line-height: 1.463rem;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@mixin table-header {
|
|
173
183
|
font-size: 1.125rem;
|
|
174
|
-
line-height: 1.
|
|
184
|
+
line-height: 1.375rem;
|
|
185
|
+
font-weight: 600;
|
|
186
|
+
|
|
187
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
188
|
+
font-size: 1.25rem;
|
|
189
|
+
line-height: 1.625rem;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@mixin table-header-stack {
|
|
194
|
+
font-size: 1rem;
|
|
195
|
+
line-height: 1.28rem;
|
|
196
|
+
font-weight: 600;
|
|
197
|
+
|
|
198
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
199
|
+
font-size: 1.125rem;
|
|
200
|
+
line-height: 1.463rem;
|
|
201
|
+
}
|
|
175
202
|
}
|
|
176
203
|
|
|
177
204
|
@mixin image-caption {
|
|
@@ -81,6 +81,14 @@ import designsystemtypography from './scss/typography.scss'
|
|
|
81
81
|
@include fonts.table-cell;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
.table-header {
|
|
85
|
+
@include fonts.table-header;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.table-header-stack {
|
|
89
|
+
@include fonts.table-header-stack;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
.strong {
|
|
85
93
|
font-size: font-settings.$font-size-sm;
|
|
86
94
|
line-height: font-settings.$lineheight-size-sm;
|
|
@@ -83,6 +83,14 @@ export const TableCell: Story = {
|
|
|
83
83
|
render: args => <div className={designsystemtypography['table-cell']}>{args.tekst}</div>,
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
+
export const TableHeader: Story = {
|
|
87
|
+
render: args => <div className={designsystemtypography['table-header']}>{args.tekst}</div>,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const TableHeaderStack: Story = {
|
|
91
|
+
render: args => <div className={designsystemtypography['table-header-stack']}>{args.tekst}</div>,
|
|
92
|
+
};
|
|
93
|
+
|
|
86
94
|
export const Strong: Story = {
|
|
87
95
|
render: args => <div className={designsystemtypography.strong}>{args.tekst}</div>,
|
|
88
96
|
};
|