@norges-domstoler/dds-components 22.8.2 → 22.10.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/README.md +17 -18
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +54 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -3537,9 +3537,11 @@ type HeadingProps = BaseComponentPropsWithChildren<HTMLHeadingElement, {
|
|
|
3537
3537
|
level: HeadingLevel;
|
|
3538
3538
|
/**Spesifiserer typografistil basert på utvalget for HTML heading elementer. */
|
|
3539
3539
|
typographyType?: TypographyHeadingType;
|
|
3540
|
+
/**Setter standard spacing for `<Heading>` som er over et inputelement. */
|
|
3541
|
+
withMarginsOverInput?: boolean;
|
|
3540
3542
|
} & BaseTypographyProps, Omit<HTMLAttributes<HTMLHeadingElement>, 'color'>>;
|
|
3541
3543
|
declare const Heading: {
|
|
3542
|
-
({ id, className, style, htmlProps, children, typographyType, level, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3544
|
+
({ id, className, style, htmlProps, children, typographyType, level, withMargins, withMarginsOverInput, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3543
3545
|
displayName: string;
|
|
3544
3546
|
};
|
|
3545
3547
|
|
|
@@ -3561,9 +3563,11 @@ declare const Label: {
|
|
|
3561
3563
|
type LegendProps = BaseComponentPropsWithChildren<HTMLLegendElement, BaseTypographyProps & {
|
|
3562
3564
|
/**Typografistil basert på utvalget for HTML heading elementer. */
|
|
3563
3565
|
typographyType?: TypographyHeadingType;
|
|
3566
|
+
/**Setter standard spacing for `<Legend>` som er over et inputelement. */
|
|
3567
|
+
withMarginsOverInput?: boolean;
|
|
3564
3568
|
}, Omit<HTMLAttributes<HTMLLegendElement>, 'color'>>;
|
|
3565
3569
|
declare const Legend: {
|
|
3566
|
-
({ id, className, style, htmlProps, typographyType, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3570
|
+
({ id, className, style, htmlProps, typographyType, withMarginsOverInput, withMargins, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3567
3571
|
displayName: string;
|
|
3568
3572
|
};
|
|
3569
3573
|
|
|
@@ -4594,7 +4598,7 @@ declare const ModalActions: {
|
|
|
4594
4598
|
};
|
|
4595
4599
|
|
|
4596
4600
|
declare const OverflowMenu: {
|
|
4597
|
-
({ placement, offset, className, htmlProps, ref, style, ...rest }: OverflowMenuProps): react_jsx_runtime.JSX.Element;
|
|
4601
|
+
({ placement, offset, parentElement, portal, className, htmlProps, ref, style, ...rest }: OverflowMenuProps): react_jsx_runtime.JSX.Element;
|
|
4598
4602
|
displayName: string;
|
|
4599
4603
|
};
|
|
4600
4604
|
|
|
@@ -4611,6 +4615,17 @@ type OverflowMenuProps = Omit<BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
4611
4615
|
* @default 2
|
|
4612
4616
|
*/
|
|
4613
4617
|
offset?: number;
|
|
4618
|
+
/**Angir rotnode hvor menyen skal rendres hvis portal=false.
|
|
4619
|
+
* Hvis parentElement ikke er satt vil menyen rendres i det elementet som OverflowMenu er plassert i.
|
|
4620
|
+
* Hvis portal er true, vil parentElement bli ignorert.
|
|
4621
|
+
* @default themeProviderRef
|
|
4622
|
+
*/
|
|
4623
|
+
parentElement?: HTMLElement;
|
|
4624
|
+
/**Angir om menyen skal rendres i en portal eller ikke.
|
|
4625
|
+
* Hvis portal er false, vil parentElement bli brukt hvis det er satt.
|
|
4626
|
+
* @default true
|
|
4627
|
+
*/
|
|
4628
|
+
portal?: boolean;
|
|
4614
4629
|
}>, 'id'>;
|
|
4615
4630
|
|
|
4616
4631
|
declare const OverflowMenuButton: {
|
package/dist/index.d.ts
CHANGED
|
@@ -3537,9 +3537,11 @@ type HeadingProps = BaseComponentPropsWithChildren<HTMLHeadingElement, {
|
|
|
3537
3537
|
level: HeadingLevel;
|
|
3538
3538
|
/**Spesifiserer typografistil basert på utvalget for HTML heading elementer. */
|
|
3539
3539
|
typographyType?: TypographyHeadingType;
|
|
3540
|
+
/**Setter standard spacing for `<Heading>` som er over et inputelement. */
|
|
3541
|
+
withMarginsOverInput?: boolean;
|
|
3540
3542
|
} & BaseTypographyProps, Omit<HTMLAttributes<HTMLHeadingElement>, 'color'>>;
|
|
3541
3543
|
declare const Heading: {
|
|
3542
|
-
({ id, className, style, htmlProps, children, typographyType, level, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3544
|
+
({ id, className, style, htmlProps, children, typographyType, level, withMargins, withMarginsOverInput, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3543
3545
|
displayName: string;
|
|
3544
3546
|
};
|
|
3545
3547
|
|
|
@@ -3561,9 +3563,11 @@ declare const Label: {
|
|
|
3561
3563
|
type LegendProps = BaseComponentPropsWithChildren<HTMLLegendElement, BaseTypographyProps & {
|
|
3562
3564
|
/**Typografistil basert på utvalget for HTML heading elementer. */
|
|
3563
3565
|
typographyType?: TypographyHeadingType;
|
|
3566
|
+
/**Setter standard spacing for `<Legend>` som er over et inputelement. */
|
|
3567
|
+
withMarginsOverInput?: boolean;
|
|
3564
3568
|
}, Omit<HTMLAttributes<HTMLLegendElement>, 'color'>>;
|
|
3565
3569
|
declare const Legend: {
|
|
3566
|
-
({ id, className, style, htmlProps, typographyType, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3570
|
+
({ id, className, style, htmlProps, typographyType, withMarginsOverInput, withMargins, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3567
3571
|
displayName: string;
|
|
3568
3572
|
};
|
|
3569
3573
|
|
|
@@ -4594,7 +4598,7 @@ declare const ModalActions: {
|
|
|
4594
4598
|
};
|
|
4595
4599
|
|
|
4596
4600
|
declare const OverflowMenu: {
|
|
4597
|
-
({ placement, offset, className, htmlProps, ref, style, ...rest }: OverflowMenuProps): react_jsx_runtime.JSX.Element;
|
|
4601
|
+
({ placement, offset, parentElement, portal, className, htmlProps, ref, style, ...rest }: OverflowMenuProps): react_jsx_runtime.JSX.Element;
|
|
4598
4602
|
displayName: string;
|
|
4599
4603
|
};
|
|
4600
4604
|
|
|
@@ -4611,6 +4615,17 @@ type OverflowMenuProps = Omit<BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
4611
4615
|
* @default 2
|
|
4612
4616
|
*/
|
|
4613
4617
|
offset?: number;
|
|
4618
|
+
/**Angir rotnode hvor menyen skal rendres hvis portal=false.
|
|
4619
|
+
* Hvis parentElement ikke er satt vil menyen rendres i det elementet som OverflowMenu er plassert i.
|
|
4620
|
+
* Hvis portal er true, vil parentElement bli ignorert.
|
|
4621
|
+
* @default themeProviderRef
|
|
4622
|
+
*/
|
|
4623
|
+
parentElement?: HTMLElement;
|
|
4624
|
+
/**Angir om menyen skal rendres i en portal eller ikke.
|
|
4625
|
+
* Hvis portal er false, vil parentElement bli brukt hvis det er satt.
|
|
4626
|
+
* @default true
|
|
4627
|
+
*/
|
|
4628
|
+
portal?: boolean;
|
|
4614
4629
|
}>, 'id'>;
|
|
4615
4630
|
|
|
4616
4631
|
declare const OverflowMenuButton: {
|
package/dist/index.js
CHANGED
|
@@ -469,9 +469,11 @@ var typographyStyles_default = {
|
|
|
469
469
|
"heading-xlarge--margins": "typographyStyles_heading-xlarge--margins",
|
|
470
470
|
"heading-xxlarge": "typographyStyles_heading-xxlarge",
|
|
471
471
|
"heading-xxlarge--margins": "typographyStyles_heading-xxlarge--margins",
|
|
472
|
+
"heading--margins-over-input": "typographyStyles_heading--margins-over-input",
|
|
472
473
|
"label-medium": "typographyStyles_label-medium",
|
|
473
474
|
"label-medium--margins": "typographyStyles_label-medium--margins",
|
|
474
475
|
legend: "typographyStyles_legend",
|
|
476
|
+
"legend--margins-over-input": "typographyStyles_legend--margins-over-input",
|
|
475
477
|
caption: "typographyStyles_caption",
|
|
476
478
|
"caption--withMargins": "typographyStyles_caption--withMargins",
|
|
477
479
|
bold: "typographyStyles_bold",
|
|
@@ -782,6 +784,12 @@ function cn(...classNames) {
|
|
|
782
784
|
function convertCamelToHyphen(value) {
|
|
783
785
|
return value.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([a-z])([0-9])/g, "$1-$2").toLowerCase();
|
|
784
786
|
}
|
|
787
|
+
function optAttr(value, keepZero) {
|
|
788
|
+
if (keepZero && value === 0) {
|
|
789
|
+
return value;
|
|
790
|
+
}
|
|
791
|
+
return value ? value : void 0;
|
|
792
|
+
}
|
|
785
793
|
|
|
786
794
|
// src/utils/getFocusableElements.ts
|
|
787
795
|
function getFocusableElements(elementRef) {
|
|
@@ -4325,6 +4333,8 @@ var Heading = ({
|
|
|
4325
4333
|
children,
|
|
4326
4334
|
typographyType,
|
|
4327
4335
|
level,
|
|
4336
|
+
withMargins,
|
|
4337
|
+
withMarginsOverInput,
|
|
4328
4338
|
...rest
|
|
4329
4339
|
}) => {
|
|
4330
4340
|
const headingElement = getHeadingElement(level);
|
|
@@ -4332,9 +4342,19 @@ var Heading = ({
|
|
|
4332
4342
|
return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
|
|
4333
4343
|
Typography,
|
|
4334
4344
|
{
|
|
4335
|
-
...getBaseHTMLProps(
|
|
4345
|
+
...getBaseHTMLProps(
|
|
4346
|
+
id,
|
|
4347
|
+
cn(
|
|
4348
|
+
className,
|
|
4349
|
+
withMarginsOverInput && typographyStyles_default["heading--margins-over-input"]
|
|
4350
|
+
),
|
|
4351
|
+
style,
|
|
4352
|
+
htmlProps,
|
|
4353
|
+
rest
|
|
4354
|
+
),
|
|
4336
4355
|
typographyType: standardTypographyType,
|
|
4337
4356
|
as: headingElement,
|
|
4357
|
+
withMargins: optAttr(withMargins || withMarginsOverInput),
|
|
4338
4358
|
children
|
|
4339
4359
|
}
|
|
4340
4360
|
);
|
|
@@ -4413,14 +4433,26 @@ var Legend = ({
|
|
|
4413
4433
|
style,
|
|
4414
4434
|
htmlProps,
|
|
4415
4435
|
typographyType = "headingLarge",
|
|
4436
|
+
withMarginsOverInput,
|
|
4437
|
+
withMargins,
|
|
4416
4438
|
...rest
|
|
4417
4439
|
}) => {
|
|
4418
4440
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
4419
4441
|
Typography,
|
|
4420
4442
|
{
|
|
4421
|
-
...getBaseHTMLProps(
|
|
4443
|
+
...getBaseHTMLProps(
|
|
4444
|
+
id,
|
|
4445
|
+
cn(
|
|
4446
|
+
className,
|
|
4447
|
+
withMarginsOverInput && typographyStyles_default["legend--margins-over-input"]
|
|
4448
|
+
),
|
|
4449
|
+
style,
|
|
4450
|
+
htmlProps,
|
|
4451
|
+
rest
|
|
4452
|
+
),
|
|
4422
4453
|
as: "legend",
|
|
4423
|
-
typographyType
|
|
4454
|
+
typographyType,
|
|
4455
|
+
withMargins: optAttr(withMargins || withMarginsOverInput)
|
|
4424
4456
|
}
|
|
4425
4457
|
);
|
|
4426
4458
|
};
|
|
@@ -4820,6 +4852,7 @@ var texts2 = createTexts({
|
|
|
4820
4852
|
|
|
4821
4853
|
// src/components/OverflowMenu/OverflowMenu.tsx
|
|
4822
4854
|
var import_react21 = require("react");
|
|
4855
|
+
var import_react_dom2 = require("react-dom");
|
|
4823
4856
|
|
|
4824
4857
|
// src/components/OverflowMenu/OverflowMenu.context.tsx
|
|
4825
4858
|
var import_react20 = require("react");
|
|
@@ -4869,6 +4902,8 @@ var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
|
4869
4902
|
var OverflowMenu = ({
|
|
4870
4903
|
placement = "bottom-end",
|
|
4871
4904
|
offset = 2,
|
|
4905
|
+
parentElement,
|
|
4906
|
+
portal = true,
|
|
4872
4907
|
className,
|
|
4873
4908
|
htmlProps = {},
|
|
4874
4909
|
ref,
|
|
@@ -4876,11 +4911,16 @@ var OverflowMenu = ({
|
|
|
4876
4911
|
...rest
|
|
4877
4912
|
}) => {
|
|
4878
4913
|
const { isOpen, floatStyling, setFloatOptions, menuRef, menuId } = useOverflowMenuContext();
|
|
4914
|
+
const themeContext = (0, import_react21.useContext)(ThemeContext);
|
|
4915
|
+
if (portal && !themeContext) {
|
|
4916
|
+
throw new Error("OverflowMenu must be used within a DdsProvider");
|
|
4917
|
+
}
|
|
4918
|
+
const portalTarget = parentElement != null ? parentElement : themeContext == null ? void 0 : themeContext.el;
|
|
4879
4919
|
(0, import_react21.useEffect)(() => {
|
|
4880
4920
|
setFloatOptions == null ? void 0 : setFloatOptions({ placement, offset });
|
|
4881
4921
|
}, [placement, offset]);
|
|
4882
4922
|
const openCn = isOpen ? "open" : "closed";
|
|
4883
|
-
|
|
4923
|
+
const menu = /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
|
|
4884
4924
|
Paper,
|
|
4885
4925
|
{
|
|
4886
4926
|
overflowY: "auto",
|
|
@@ -4907,6 +4947,7 @@ var OverflowMenu = ({
|
|
|
4907
4947
|
border: "border-default"
|
|
4908
4948
|
}
|
|
4909
4949
|
);
|
|
4950
|
+
return portal && portalTarget ? (0, import_react_dom2.createPortal)(menu, portalTarget) : menu;
|
|
4910
4951
|
};
|
|
4911
4952
|
OverflowMenu.displayName = "OverflowMenu";
|
|
4912
4953
|
|
|
@@ -5394,7 +5435,7 @@ var Breadcrumbs = ({
|
|
|
5394
5435
|
"aria-label": bChildrenTruncated.length > 1 ? t(texts3.showHiddenTo(bChildren.length - 1)) : t(texts3.showHidden)
|
|
5395
5436
|
}
|
|
5396
5437
|
),
|
|
5397
|
-
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(OverflowMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(OverflowMenuList, { children: bChildrenTruncated }) })
|
|
5438
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(OverflowMenu, { portal: false, children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(OverflowMenuList, { children: bChildrenTruncated }) })
|
|
5398
5439
|
] })
|
|
5399
5440
|
] }),
|
|
5400
5441
|
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(HStack, { ...responsiveLiProps, children: [
|
|
@@ -6778,7 +6819,7 @@ function isLeapYear(date) {
|
|
|
6778
6819
|
|
|
6779
6820
|
// src/components/date-inputs/DatePicker/CalendarPopover.tsx
|
|
6780
6821
|
var import_react41 = require("react");
|
|
6781
|
-
var
|
|
6822
|
+
var import_react_dom3 = require("react-dom");
|
|
6782
6823
|
var import_jsx_runtime242 = require("react/jsx-runtime");
|
|
6783
6824
|
var CalendarPopoverContext = (0, import_react41.createContext)({
|
|
6784
6825
|
anchorRef: null,
|
|
@@ -6860,7 +6901,7 @@ var CalendarPopoverContent = ({
|
|
|
6860
6901
|
padding: "x0.75"
|
|
6861
6902
|
};
|
|
6862
6903
|
return /* @__PURE__ */ (0, import_jsx_runtime242.jsxs)(import_jsx_runtime242.Fragment, { children: [
|
|
6863
|
-
portalTarget && hasBreakpoint && (0,
|
|
6904
|
+
portalTarget && hasBreakpoint && (0, import_react_dom3.createPortal)(
|
|
6864
6905
|
/* @__PURE__ */ (0, import_jsx_runtime242.jsx)(ShowHide, { showBelow: smallScreenBreakpoint, children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(Backdrop, { zIndex: "modal", isMounted, children: /* @__PURE__ */ (0, import_jsx_runtime242.jsxs)(
|
|
6865
6906
|
Paper,
|
|
6866
6907
|
{
|
|
@@ -8091,7 +8132,7 @@ DetailListTerm.displayName = "DetailListTerm";
|
|
|
8091
8132
|
|
|
8092
8133
|
// src/components/Drawer/Drawer.tsx
|
|
8093
8134
|
var import_react53 = require("react");
|
|
8094
|
-
var
|
|
8135
|
+
var import_react_dom4 = require("react-dom");
|
|
8095
8136
|
|
|
8096
8137
|
// src/components/Drawer/Drawer.module.css
|
|
8097
8138
|
var Drawer_default = {
|
|
@@ -8259,7 +8300,7 @@ var Drawer = ({
|
|
|
8259
8300
|
children: drawer
|
|
8260
8301
|
}
|
|
8261
8302
|
) : drawer;
|
|
8262
|
-
return (isOpen || hasTransitionedIn) && portalTarget ? (0,
|
|
8303
|
+
return (isOpen || hasTransitionedIn) && portalTarget ? (0, import_react_dom4.createPortal)(component, portalTarget) : null;
|
|
8263
8304
|
};
|
|
8264
8305
|
Drawer.displayName = "Drawer";
|
|
8265
8306
|
|
|
@@ -10853,7 +10894,7 @@ LocalMessage.displayName = "LocalMessage";
|
|
|
10853
10894
|
|
|
10854
10895
|
// src/components/Modal/Modal.tsx
|
|
10855
10896
|
var import_react72 = require("react");
|
|
10856
|
-
var
|
|
10897
|
+
var import_react_dom5 = require("react-dom");
|
|
10857
10898
|
|
|
10858
10899
|
// src/components/Modal/Modal.module.css
|
|
10859
10900
|
var Modal_default = {
|
|
@@ -10917,7 +10958,7 @@ var Modal = ({
|
|
|
10917
10958
|
};
|
|
10918
10959
|
useOnKeyDown(["Escape", "Esc"], () => handleClose());
|
|
10919
10960
|
const hasTransitionedIn = useMountTransition(isOpen, 200);
|
|
10920
|
-
return (isOpen || hasTransitionedIn) && portalTarget ? (0,
|
|
10961
|
+
return (isOpen || hasTransitionedIn) && portalTarget ? (0, import_react_dom5.createPortal)(
|
|
10921
10962
|
/* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
10922
10963
|
Backdrop,
|
|
10923
10964
|
{
|
|
@@ -12817,7 +12858,7 @@ var texts23 = createTexts({
|
|
|
12817
12858
|
|
|
12818
12859
|
// src/components/Popover/Popover.tsx
|
|
12819
12860
|
var import_react79 = require("react");
|
|
12820
|
-
var
|
|
12861
|
+
var import_react_dom6 = require("react-dom");
|
|
12821
12862
|
|
|
12822
12863
|
// src/components/Popover/Popover.module.css
|
|
12823
12864
|
var Popover_default = {
|
|
@@ -12975,7 +13016,7 @@ var Popover = ({
|
|
|
12975
13016
|
]
|
|
12976
13017
|
}
|
|
12977
13018
|
);
|
|
12978
|
-
return isOpen || hasTransitionedIn ? portal && portalTarget ? (0,
|
|
13019
|
+
return isOpen || hasTransitionedIn ? portal && portalTarget ? (0, import_react_dom6.createPortal)(popover, portalTarget) : popover : null;
|
|
12979
13020
|
};
|
|
12980
13021
|
Popover.displayName = "Popover";
|
|
12981
13022
|
|