@norges-domstoler/dds-components 20.1.0 → 20.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/dist/index.css +20 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +36 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1982,7 +1982,7 @@ type OverflowMenuListItemBaseProps<T extends 'span' | 'button' | 'a'> = {
|
|
|
1982
1982
|
*/
|
|
1983
1983
|
purpose?: 'default' | 'danger';
|
|
1984
1984
|
} & ComponentPropsWithRef<T>;
|
|
1985
|
-
type OverflowMenuButtonProps = OverflowMenuListItemBaseProps<'button'>;
|
|
1985
|
+
type OverflowMenuButtonProps = OverflowMenuListItemBaseProps<'button'> & Pick<ButtonProps, 'loading' | 'loadingTooltip'>;
|
|
1986
1986
|
type OverflowMenuLinkProps = OverflowMenuListItemBaseProps<'a'>;
|
|
1987
1987
|
type OverflowMenuSpanProps = OverflowMenuListItemBaseProps<'span'>;
|
|
1988
1988
|
type OverflowMenuProps = Omit<BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
@@ -1997,7 +1997,7 @@ type OverflowMenuProps = Omit<BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
1997
1997
|
}>, 'id'>;
|
|
1998
1998
|
|
|
1999
1999
|
declare const OverflowMenuButton: {
|
|
2000
|
-
({ id, icon, children, className, onClick, purpose, ref, ...rest }: OverflowMenuButtonProps): react_jsx_runtime.JSX.Element;
|
|
2000
|
+
({ id, icon, children, className, onClick, purpose, loading, loadingTooltip, "aria-disabled": ariaDisabled, ref, ...rest }: OverflowMenuButtonProps): react_jsx_runtime.JSX.Element;
|
|
2001
2001
|
displayName: string;
|
|
2002
2002
|
};
|
|
2003
2003
|
|
|
@@ -2164,6 +2164,14 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
2164
2164
|
* @default "bottom"
|
|
2165
2165
|
*/
|
|
2166
2166
|
placement?: Placement;
|
|
2167
|
+
/**Angir rotnode hvor popover skal rendres.
|
|
2168
|
+
* @default themeProviderRef
|
|
2169
|
+
*/
|
|
2170
|
+
parentElement?: HTMLElement;
|
|
2171
|
+
/**Angir om popover skal rendre i en portal eller ikke.
|
|
2172
|
+
* @default "false"
|
|
2173
|
+
*/
|
|
2174
|
+
portal?: boolean;
|
|
2167
2175
|
/**Avstand fra anchor-elementet i px.
|
|
2168
2176
|
* @default 8
|
|
2169
2177
|
*/
|
|
@@ -2184,7 +2192,7 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
2184
2192
|
onClose?: () => void;
|
|
2185
2193
|
}>;
|
|
2186
2194
|
declare const Popover: {
|
|
2187
|
-
({ id, header, withCloseButton, onBlur, children, placement, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
|
|
2195
|
+
({ id, header, withCloseButton, onBlur, children, placement, parentElement, portal, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
|
|
2188
2196
|
displayName: string;
|
|
2189
2197
|
};
|
|
2190
2198
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1982,7 +1982,7 @@ type OverflowMenuListItemBaseProps<T extends 'span' | 'button' | 'a'> = {
|
|
|
1982
1982
|
*/
|
|
1983
1983
|
purpose?: 'default' | 'danger';
|
|
1984
1984
|
} & ComponentPropsWithRef<T>;
|
|
1985
|
-
type OverflowMenuButtonProps = OverflowMenuListItemBaseProps<'button'>;
|
|
1985
|
+
type OverflowMenuButtonProps = OverflowMenuListItemBaseProps<'button'> & Pick<ButtonProps, 'loading' | 'loadingTooltip'>;
|
|
1986
1986
|
type OverflowMenuLinkProps = OverflowMenuListItemBaseProps<'a'>;
|
|
1987
1987
|
type OverflowMenuSpanProps = OverflowMenuListItemBaseProps<'span'>;
|
|
1988
1988
|
type OverflowMenuProps = Omit<BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
@@ -1997,7 +1997,7 @@ type OverflowMenuProps = Omit<BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
1997
1997
|
}>, 'id'>;
|
|
1998
1998
|
|
|
1999
1999
|
declare const OverflowMenuButton: {
|
|
2000
|
-
({ id, icon, children, className, onClick, purpose, ref, ...rest }: OverflowMenuButtonProps): react_jsx_runtime.JSX.Element;
|
|
2000
|
+
({ id, icon, children, className, onClick, purpose, loading, loadingTooltip, "aria-disabled": ariaDisabled, ref, ...rest }: OverflowMenuButtonProps): react_jsx_runtime.JSX.Element;
|
|
2001
2001
|
displayName: string;
|
|
2002
2002
|
};
|
|
2003
2003
|
|
|
@@ -2164,6 +2164,14 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
2164
2164
|
* @default "bottom"
|
|
2165
2165
|
*/
|
|
2166
2166
|
placement?: Placement;
|
|
2167
|
+
/**Angir rotnode hvor popover skal rendres.
|
|
2168
|
+
* @default themeProviderRef
|
|
2169
|
+
*/
|
|
2170
|
+
parentElement?: HTMLElement;
|
|
2171
|
+
/**Angir om popover skal rendre i en portal eller ikke.
|
|
2172
|
+
* @default "false"
|
|
2173
|
+
*/
|
|
2174
|
+
portal?: boolean;
|
|
2167
2175
|
/**Avstand fra anchor-elementet i px.
|
|
2168
2176
|
* @default 8
|
|
2169
2177
|
*/
|
|
@@ -2184,7 +2192,7 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
2184
2192
|
onClose?: () => void;
|
|
2185
2193
|
}>;
|
|
2186
2194
|
declare const Popover: {
|
|
2187
|
-
({ id, header, withCloseButton, onBlur, children, placement, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
|
|
2195
|
+
({ id, header, withCloseButton, onBlur, children, placement, parentElement, portal, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
|
|
2188
2196
|
displayName: string;
|
|
2189
2197
|
};
|
|
2190
2198
|
|
package/dist/index.js
CHANGED
|
@@ -444,7 +444,10 @@ var utilStyles_default = {
|
|
|
444
444
|
"visibility-transition--open": "utilStyles_visibility-transition--open",
|
|
445
445
|
"visibility-transition--closed": "utilStyles_visibility-transition--closed",
|
|
446
446
|
"visually-hidden": "utilStyles_visually-hidden",
|
|
447
|
-
invisible
|
|
447
|
+
invisible,
|
|
448
|
+
"center-absolute": "utilStyles_center-absolute",
|
|
449
|
+
"center-absolute-y": "utilStyles_center-absolute-y",
|
|
450
|
+
"center-absolute-x": "utilStyles_center-absolute-x"
|
|
448
451
|
};
|
|
449
452
|
|
|
450
453
|
// src/components/helpers/Backdrop/Backdrop.utils.tsx
|
|
@@ -3635,6 +3638,7 @@ var OverflowMenu_default = {
|
|
|
3635
3638
|
danger: "OverflowMenu_danger",
|
|
3636
3639
|
"list__item--link": "OverflowMenu_list__item--link",
|
|
3637
3640
|
icon: "OverflowMenu_icon",
|
|
3641
|
+
"button-loading": "OverflowMenu_button-loading",
|
|
3638
3642
|
divider: "OverflowMenu_divider",
|
|
3639
3643
|
"group-header": "OverflowMenu_group-header"
|
|
3640
3644
|
};
|
|
@@ -3690,6 +3694,9 @@ var OverflowMenuButton = ({
|
|
|
3690
3694
|
className,
|
|
3691
3695
|
onClick,
|
|
3692
3696
|
purpose = "default",
|
|
3697
|
+
loading,
|
|
3698
|
+
loadingTooltip,
|
|
3699
|
+
"aria-disabled": ariaDisabled,
|
|
3693
3700
|
ref,
|
|
3694
3701
|
...rest
|
|
3695
3702
|
}) => {
|
|
@@ -3712,17 +3719,33 @@ var OverflowMenuButton = ({
|
|
|
3712
3719
|
OverflowMenu_default[purpose],
|
|
3713
3720
|
typographyStyles_default["body-small"],
|
|
3714
3721
|
OverflowMenu_default["list__item--link"],
|
|
3715
|
-
focus_default["focusable--inset"]
|
|
3722
|
+
focus_default["focusable--inset"],
|
|
3723
|
+
loading && OverflowMenu_default["button-loading"]
|
|
3716
3724
|
),
|
|
3717
|
-
onClick: (e) => {
|
|
3725
|
+
onClick: loading ? void 0 : (e) => {
|
|
3718
3726
|
onClick == null ? void 0 : onClick(e);
|
|
3719
3727
|
onClose == null ? void 0 : onClose();
|
|
3720
3728
|
},
|
|
3729
|
+
"aria-disabled": loading ? true : ariaDisabled ? ariaDisabled : void 0,
|
|
3721
3730
|
...rest,
|
|
3722
3731
|
tabIndex: focusedRef === itemRef ? 0 : -1,
|
|
3723
3732
|
children: [
|
|
3724
|
-
|
|
3725
|
-
|
|
3733
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("span", { className: cn(utilStyles_default["center-absolute"]), children: /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
|
|
3734
|
+
Spinner,
|
|
3735
|
+
{
|
|
3736
|
+
size: "var(--dds-icon-size-medium)",
|
|
3737
|
+
tooltip: loadingTooltip
|
|
3738
|
+
}
|
|
3739
|
+
) }),
|
|
3740
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
|
|
3741
|
+
Icon,
|
|
3742
|
+
{
|
|
3743
|
+
className: cn(loading && invisible),
|
|
3744
|
+
iconSize: "inherit",
|
|
3745
|
+
icon
|
|
3746
|
+
}
|
|
3747
|
+
),
|
|
3748
|
+
/* @__PURE__ */ (0, import_jsx_runtime188.jsx)("span", { className: cn(loading && invisible), children })
|
|
3726
3749
|
]
|
|
3727
3750
|
}
|
|
3728
3751
|
) });
|
|
@@ -9606,6 +9629,7 @@ var getCallingCode = (s) => {
|
|
|
9606
9629
|
|
|
9607
9630
|
// src/components/Popover/Popover.tsx
|
|
9608
9631
|
var import_react61 = require("react");
|
|
9632
|
+
var import_react_dom5 = require("react-dom");
|
|
9609
9633
|
|
|
9610
9634
|
// src/components/Popover/Popover.module.css
|
|
9611
9635
|
var Popover_default = {
|
|
@@ -9629,6 +9653,8 @@ var Popover = ({
|
|
|
9629
9653
|
onBlur,
|
|
9630
9654
|
children,
|
|
9631
9655
|
placement = "bottom",
|
|
9656
|
+
parentElement,
|
|
9657
|
+
portal = false,
|
|
9632
9658
|
offset = 8,
|
|
9633
9659
|
sizeProps,
|
|
9634
9660
|
returnFocusOnBlur = true,
|
|
@@ -9645,6 +9671,8 @@ var Popover = ({
|
|
|
9645
9671
|
placement
|
|
9646
9672
|
});
|
|
9647
9673
|
const context = usePopoverContext();
|
|
9674
|
+
const themeContext = (0, import_react61.useContext)(ThemeContext);
|
|
9675
|
+
const portalTarget = parentElement != null ? parentElement : themeContext == null ? void 0 : themeContext.el;
|
|
9648
9676
|
const {
|
|
9649
9677
|
floatStyling: contextFloatStyling,
|
|
9650
9678
|
setFloatOptions,
|
|
@@ -9703,7 +9731,7 @@ var Popover = ({
|
|
|
9703
9731
|
});
|
|
9704
9732
|
const hasTitle = !!header;
|
|
9705
9733
|
const openCn = hasTransitionedIn && isOpen ? "open" : "closed";
|
|
9706
|
-
|
|
9734
|
+
const popover = /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
|
|
9707
9735
|
Paper,
|
|
9708
9736
|
{
|
|
9709
9737
|
...getBaseHTMLProps(
|
|
@@ -9750,7 +9778,8 @@ var Popover = ({
|
|
|
9750
9778
|
)
|
|
9751
9779
|
]
|
|
9752
9780
|
}
|
|
9753
|
-
)
|
|
9781
|
+
);
|
|
9782
|
+
return isOpen || hasTransitionedIn ? portal && portalTarget ? (0, import_react_dom5.createPortal)(popover, portalTarget) : popover : null;
|
|
9754
9783
|
};
|
|
9755
9784
|
Popover.displayName = "Popover";
|
|
9756
9785
|
|