@navikt/ds-react 7.37.0 → 7.39.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/cjs/alert/global-alert/root/GlobalAlertRoot.d.ts +5 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.js +14 -2
- package/cjs/alert/global-alert/root/GlobalAlertRoot.js.map +1 -1
- package/cjs/date/Date.Dialog.js +5 -1
- package/cjs/date/Date.Dialog.js.map +1 -1
- package/cjs/dialog/index.d.ts +1 -1
- package/cjs/dialog/index.js +4 -1
- package/cjs/dialog/index.js.map +1 -1
- package/cjs/dialog/popup/DialogPopup.js +6 -1
- package/cjs/dialog/popup/DialogPopup.js.map +1 -1
- package/cjs/dialog/root/DialogRoot.d.ts +5 -5
- package/cjs/dialog/root/DialogRoot.js +12 -11
- package/cjs/dialog/root/DialogRoot.js.map +1 -1
- package/cjs/expansion-card/ExpansionCardContent.js +3 -3
- package/cjs/expansion-card/ExpansionCardContent.js.map +1 -1
- package/cjs/form/combobox/Combobox.d.ts +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +1 -1
- package/cjs/form/file-upload/useFileUpload.d.ts +1 -1
- package/cjs/layout/base/BasePrimitive.d.ts +4 -4
- package/cjs/layout/base/BasePrimitive.js +0 -1
- package/cjs/layout/base/BasePrimitive.js.map +1 -1
- package/cjs/layout/base/PrimitiveAsChildProps.d.ts +1 -4
- package/cjs/layout/box/Box.darkside.js.map +1 -1
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/modal/Modal.js +9 -2
- package/cjs/modal/Modal.js.map +1 -1
- package/cjs/overlays/action-menu/ActionMenu.js +3 -1
- package/cjs/overlays/action-menu/ActionMenu.js.map +1 -1
- package/cjs/overlays/dismissablelayer/DismissableLayer.d.ts +1 -0
- package/cjs/overlays/dismissablelayer/DismissableLayer.js +33 -14
- package/cjs/overlays/dismissablelayer/DismissableLayer.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/useEscapeKeydown.js +7 -2
- package/cjs/overlays/dismissablelayer/util/useEscapeKeydown.js.map +1 -1
- package/cjs/provider/Provider.d.ts +1 -5
- package/cjs/provider/Provider.js +0 -2
- package/cjs/provider/Provider.js.map +1 -1
- package/cjs/read-more/ReadMore.js +1 -1
- package/cjs/read-more/ReadMore.js.map +1 -1
- package/cjs/slot/Slot.js +12 -5
- package/cjs/slot/Slot.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +1 -1
- package/cjs/tabs/parts/tab/useTab.d.ts +1 -1
- package/cjs/tabs/parts/tab/useTab.js +2 -1
- package/cjs/tabs/parts/tab/useTab.js.map +1 -1
- package/cjs/toggle-group/ToggleGroup.context.d.ts +1 -1
- package/cjs/toggle-group/parts/useToggleItem.d.ts +1 -1
- package/cjs/toggle-group/parts/useToggleItem.js +2 -1
- package/cjs/toggle-group/parts/useToggleItem.js.map +1 -1
- package/cjs/util/hooks/descendants/useDescendant.d.ts +1 -1
- package/cjs/util/hooks/descendants/useDescendant.js +2 -1
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/hooks/useMergeRefs.d.ts +15 -9
- package/cjs/util/hooks/useMergeRefs.js +94 -29
- package/cjs/util/hooks/useMergeRefs.js.map +1 -1
- package/cjs/util/types/AsChildProps.d.ts +0 -4
- package/cjs/util/virtualfocus/Context.d.ts +1 -1
- package/esm/alert/global-alert/root/GlobalAlertRoot.d.ts +5 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.js +14 -2
- package/esm/alert/global-alert/root/GlobalAlertRoot.js.map +1 -1
- package/esm/date/Date.Dialog.js +5 -1
- package/esm/date/Date.Dialog.js.map +1 -1
- package/esm/dialog/index.d.ts +1 -1
- package/esm/dialog/index.js +1 -1
- package/esm/dialog/index.js.map +1 -1
- package/esm/dialog/popup/DialogPopup.js +6 -1
- package/esm/dialog/popup/DialogPopup.js.map +1 -1
- package/esm/dialog/root/DialogRoot.d.ts +5 -5
- package/esm/dialog/root/DialogRoot.js +5 -5
- package/esm/dialog/root/DialogRoot.js.map +1 -1
- package/esm/expansion-card/ExpansionCardContent.js +3 -3
- package/esm/expansion-card/ExpansionCardContent.js.map +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +1 -1
- package/esm/form/file-upload/useFileUpload.d.ts +1 -1
- package/esm/layout/base/BasePrimitive.d.ts +4 -4
- package/esm/layout/base/BasePrimitive.js +0 -1
- package/esm/layout/base/BasePrimitive.js.map +1 -1
- package/esm/layout/base/PrimitiveAsChildProps.d.ts +1 -4
- package/esm/layout/box/Box.darkside.js.map +1 -1
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/modal/Modal.js +9 -2
- package/esm/modal/Modal.js.map +1 -1
- package/esm/overlays/action-menu/ActionMenu.js +3 -1
- package/esm/overlays/action-menu/ActionMenu.js.map +1 -1
- package/esm/overlays/dismissablelayer/DismissableLayer.d.ts +1 -0
- package/esm/overlays/dismissablelayer/DismissableLayer.js +34 -15
- package/esm/overlays/dismissablelayer/DismissableLayer.js.map +1 -1
- package/esm/overlays/dismissablelayer/util/useEscapeKeydown.js +7 -2
- package/esm/overlays/dismissablelayer/util/useEscapeKeydown.js.map +1 -1
- package/esm/provider/Provider.d.ts +1 -5
- package/esm/provider/Provider.js +0 -2
- package/esm/provider/Provider.js.map +1 -1
- package/esm/read-more/ReadMore.js +1 -1
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/slot/Slot.js +12 -5
- package/esm/slot/Slot.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +1 -1
- package/esm/tabs/parts/tab/useTab.d.ts +1 -1
- package/esm/tabs/parts/tab/useTab.js +3 -2
- package/esm/tabs/parts/tab/useTab.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.context.d.ts +1 -1
- package/esm/toggle-group/parts/useToggleItem.d.ts +1 -1
- package/esm/toggle-group/parts/useToggleItem.js +3 -2
- package/esm/toggle-group/parts/useToggleItem.js.map +1 -1
- package/esm/util/hooks/descendants/useDescendant.d.ts +1 -1
- package/esm/util/hooks/descendants/useDescendant.js +3 -2
- package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
- package/esm/util/hooks/useMergeRefs.d.ts +15 -9
- package/esm/util/hooks/useMergeRefs.js +93 -25
- package/esm/util/hooks/useMergeRefs.js.map +1 -1
- package/esm/util/types/AsChildProps.d.ts +0 -4
- package/esm/util/virtualfocus/Context.d.ts +1 -1
- package/package.json +5 -5
- package/src/alert/global-alert/root/GlobalAlertRoot.tsx +8 -2
- package/src/date/Date.Dialog.tsx +6 -1
- package/src/dialog/index.ts +1 -1
- package/src/dialog/popup/DialogPopup.tsx +7 -1
- package/src/dialog/root/DialogRoot.tsx +5 -5
- package/src/expansion-card/ExpansionCardContent.tsx +7 -3
- package/src/layout/base/BasePrimitive.tsx +4 -5
- package/src/layout/base/PrimitiveAsChildProps.ts +1 -4
- package/src/layout/box/Box.darkside.tsx +1 -1
- package/src/layout/box/Box.tsx +1 -1
- package/src/modal/Modal.tsx +9 -1
- package/src/overlays/action-menu/ActionMenu.tsx +3 -2
- package/src/overlays/dismissablelayer/DismissableLayer.tsx +52 -16
- package/src/overlays/dismissablelayer/util/useEscapeKeydown.ts +7 -2
- package/src/provider/Provider.tsx +1 -5
- package/src/read-more/ReadMore.tsx +0 -1
- package/src/slot/Slot.tsx +14 -9
- package/src/tabs/parts/tab/useTab.ts +4 -2
- package/src/toggle-group/parts/useToggleItem.ts +4 -2
- package/src/util/__tests__/useMergeRefs.test.ts +92 -0
- package/src/util/hooks/descendants/useDescendant.tsx +4 -2
- package/src/util/hooks/useMergeRefs.ts +147 -24
- package/src/util/types/AsChildProps.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../src/provider/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAQzC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAsB;IAChE,MAAM,EAAE,EAAE;CACX,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../src/provider/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAQzC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAsB;IAChE,MAAM,EAAE,EAAE;CACX,CAAC,CAAC;AAiCH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,QAAQ,EACR,WAAW,EACX,MAAM,EACN,YAAY,GACE,EAAE,EAAE;IAClB,MAAM,aAAa,GAAG,WAAW,EAAE,CAAC;IACpC,OAAO,CACL,oBAAC,eAAe,CAAC,QAAQ,IACvB,KAAK,EAAE;YACL,WAAW,EAAE,WAAW,IAAI,aAAa,CAAC,WAAW;YACrD,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,IAAI,EAAE;YAC5C,YAAY,EAAE,YAAY,IAAI,aAAa,CAAC,YAAY;SACzD,IAEA,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -40,7 +40,7 @@ export const ReadMore = forwardRef((_a, ref) => {
|
|
|
40
40
|
}), onClick: composeEventHandlers(onClick, () => _setOpen((x) => !x)), "aria-expanded": _open, "data-state": _open ? "open" : "closed" }),
|
|
41
41
|
React.createElement(ChevronDownIcon, { className: cn("navds-read-more__expand-icon"), "aria-hidden": true }),
|
|
42
42
|
React.createElement("span", null, header)),
|
|
43
|
-
React.createElement(BodyLong, { as: "div",
|
|
43
|
+
React.createElement(BodyLong, { as: "div", className: cn("navds-read-more__content", {
|
|
44
44
|
"navds-read-more__content--closed": !_open,
|
|
45
45
|
}), size: typoSize, "data-state": _open ? "open" : "closed" }, children)));
|
|
46
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadMore.js","sourceRoot":"","sources":["../../src/read-more/ReadMore.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAiC1E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EAUgB,EAChB,GAAG,EACH,EAAE;QAZF,EACE,SAAS,EACT,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,GAAG,KAAK,EACnB,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,YAAY,OAEE,EADX,IAAI,cATT,6FAUC,CADQ;IAIT,MAAM,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,oBAAoB,CAAC;QAC7C,YAAY,EAAE,WAAW;QACzB,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,YAAY;KACvB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEvD,OAAO,CACL,6BACE,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,oBAAoB,IA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A,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/esm/slot/Slot.js
CHANGED
|
@@ -10,16 +10,23 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React from "react";
|
|
13
|
-
import {
|
|
13
|
+
import { useMergeRefs } from "../util/hooks/index.js";
|
|
14
14
|
import { mergeProps } from "./merge-props.js";
|
|
15
|
+
function getChildRef(children) {
|
|
16
|
+
if (!React.isValidElement(children)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return Object.prototype.propertyIsEnumerable.call(children.props, "ref")
|
|
20
|
+
? children.props.ref // React 19 (children.ref still works, but gives a warning)
|
|
21
|
+
: children.ref; // React <19
|
|
22
|
+
}
|
|
15
23
|
const Slot = React.forwardRef((props, forwardedRef) => {
|
|
16
24
|
var _a;
|
|
17
25
|
const { children } = props, slotProps = __rest(props, ["children"]);
|
|
26
|
+
const childRef = getChildRef(children);
|
|
27
|
+
const mergedRef = useMergeRefs(forwardedRef, childRef);
|
|
18
28
|
if (React.isValidElement(children)) {
|
|
19
|
-
|
|
20
|
-
? children.props.ref // React 19 (children.ref still works, but gives a warning)
|
|
21
|
-
: children.ref; // React <19
|
|
22
|
-
return React.cloneElement(children, Object.assign(Object.assign({}, mergeProps(slotProps, children.props)), { ref: forwardedRef ? mergeRefs([forwardedRef, childRef]) : childRef }));
|
|
29
|
+
return React.cloneElement(children, Object.assign(Object.assign({}, mergeProps(slotProps, children.props)), { ref: mergedRef }));
|
|
23
30
|
}
|
|
24
31
|
if (React.Children.count(children) > 1) {
|
|
25
32
|
const error = new Error("Aksel: Components using 'asChild' expects to recieve a single React element child.");
|
package/esm/slot/Slot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slot.js","sourceRoot":"","sources":["../../src/slot/Slot.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OA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CAAC;QACvC,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,oFAAoF,CACrF,CAAC;QACF,KAAK,CAAC,IAAI,GAAG,WAAW,CAAC;QACzB,MAAA,KAAK,CAAC,iBAAiB,sDAAG,KAAK,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,IAAI,EAAkB,CAAC"}
|
|
@@ -16,7 +16,7 @@ export declare const TabsDescendantsProvider: import("react").Provider<import(".
|
|
|
16
16
|
}>;
|
|
17
17
|
index: number;
|
|
18
18
|
enabledIndex: number;
|
|
19
|
-
register: (instance: HTMLButtonElement | null) => void;
|
|
19
|
+
register: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
20
20
|
};
|
|
21
21
|
type TabsProviderProps = ReturnType<typeof useTabs> & Pick<TabsProps, "selectionFollowsFocus" | "loop" | "size" | "iconPosition" | "fill">;
|
|
22
22
|
export declare const TabsProvider: import("react").FC<{
|
|
@@ -9,7 +9,7 @@ export interface UseTabProps {
|
|
|
9
9
|
value: string;
|
|
10
10
|
}
|
|
11
11
|
export declare function useTab<P extends UseTabProps>({ value, disabled, onFocus: _onFocus, onClick }: P, ref: React.ForwardedRef<HTMLButtonElement>): {
|
|
12
|
-
ref: (instance: HTMLButtonElement | null) => void;
|
|
12
|
+
ref: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
13
13
|
isSelected: boolean;
|
|
14
14
|
isFocused: boolean;
|
|
15
15
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { composeEventHandlers } from "../../../util/composeEventHandlers.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useMergeRefs } from "../../../util/hooks/useMergeRefs.js";
|
|
3
3
|
import { useTabsContext, useTabsDescendant } from "../../Tabs.context.js";
|
|
4
4
|
export function useTab({ value, disabled = false, onFocus: _onFocus, onClick }, ref) {
|
|
5
5
|
const { id, setSelectedValue, selectionFollowsFocus, focusedValue, setFocusedValue, selectedValue, makeTabId, makeTabPanelId, } = useTabsContext();
|
|
@@ -12,8 +12,9 @@ export function useTab({ value, disabled = false, onFocus: _onFocus, onClick },
|
|
|
12
12
|
setFocusedValue(value);
|
|
13
13
|
selectionFollowsFocus && setSelectedValue(value);
|
|
14
14
|
};
|
|
15
|
+
const refs = useMergeRefs(register, ref);
|
|
15
16
|
return {
|
|
16
|
-
ref:
|
|
17
|
+
ref: refs,
|
|
17
18
|
isSelected,
|
|
18
19
|
isFocused: focusedValue === value,
|
|
19
20
|
id: makeTabId(id, value),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTab.js","sourceRoot":"","sources":["../../../../src/tabs/parts/tab/useTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useTab.js","sourceRoot":"","sources":["../../../../src/tabs/parts/tab/useTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAavE,MAAM,UAAU,MAAM,CACpB,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAK,EAC1D,GAA0C;IAE1C,MAAM,EACJ,EAAE,EACF,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,SAAS,EACT,cAAc,GACf,GAAG,cAAc,EAAE,CAAC;IAErB,MAAM,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAAC;QACrC,QAAQ;QACR,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,KAAK,KAAK,aAAa,CAAC;IAE3C,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,eAAe,CAAC,KAAK,CAAC,CAAC;QACvB,qBAAqB,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAEzC,OAAO;QACL,GAAG,EAAE,IAAI;QACT,UAAU;QACV,SAAS,EAAE,YAAY,KAAK,KAAK;QACjC,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,CAAC;QACxB,UAAU,EAAE,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC;QACrC,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -20,7 +20,7 @@ export declare const ToggleGroupDescendantsProvider: import("react").Provider<im
|
|
|
20
20
|
}>;
|
|
21
21
|
index: number;
|
|
22
22
|
enabledIndex: number;
|
|
23
|
-
register: (instance: HTMLButtonElement | null) => void;
|
|
23
|
+
register: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
24
24
|
};
|
|
25
25
|
type ToggleGroupProviderProps = ReturnType<typeof useToggleGroup> & Pick<ToggleGroupProps, "size">;
|
|
26
26
|
export declare const ToggleGroupProvider: import("react").FC<{
|
|
@@ -10,7 +10,7 @@ export interface UseToggleItemProps {
|
|
|
10
10
|
value: string;
|
|
11
11
|
}
|
|
12
12
|
export declare function useToggleItem<P extends UseToggleItemProps>({ value, disabled, onFocus: _onFocus, onClick, onKeyDown: _onKeyDown, }: P, ref: React.ForwardedRef<HTMLButtonElement>): {
|
|
13
|
-
ref: (instance: HTMLButtonElement | null) => void;
|
|
13
|
+
ref: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
14
14
|
isSelected: boolean;
|
|
15
15
|
isFocused: boolean;
|
|
16
16
|
onClick: (event: import("react").MouseEvent<Element, MouseEvent>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
2
|
import { composeEventHandlers } from "../../util/composeEventHandlers.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useMergeRefs } from "../../util/hooks/useMergeRefs.js";
|
|
4
4
|
import { useToggleGroupContext, useToggleGroupDescendant, } from "../ToggleGroup.context.js";
|
|
5
5
|
export function useToggleItem({ value, disabled = false, onFocus: _onFocus, onClick, onKeyDown: _onKeyDown, }, ref) {
|
|
6
6
|
const { setSelectedValue, setFocusedValue, selectedValue, focusedValue } = useToggleGroupContext();
|
|
@@ -61,8 +61,9 @@ export function useToggleItem({ value, disabled = false, onFocus: _onFocus, onCl
|
|
|
61
61
|
selectedValue && setTimeout(() => setFocusedValue(selectedValue));
|
|
62
62
|
}
|
|
63
63
|
}, [descendants, focusedValue, selectedValue, setFocusedValue]);
|
|
64
|
+
const refs = useMergeRefs(register, ref);
|
|
64
65
|
return {
|
|
65
|
-
ref:
|
|
66
|
+
ref: refs,
|
|
66
67
|
isSelected,
|
|
67
68
|
isFocused: focusedValue === value,
|
|
68
69
|
onClick: composeEventHandlers(onClick, () => selectedValue !== value && setSelectedValue(value)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggleItem.js","sourceRoot":"","sources":["../../../src/toggle-group/parts/useToggleItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useToggleItem.js","sourceRoot":"","sources":["../../../src/toggle-group/parts/useToggleItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAchC,MAAM,UAAU,aAAa,CAC3B,EACE,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,OAAO,EAAE,QAAQ,EACjB,OAAO,EACP,SAAS,EAAE,UAAU,GACnB,EACJ,GAA0C;IAE1C,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,GACtE,qBAAqB,EAAE,CAAC;IAE1B,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,wBAAwB,CAAC;QACzD,QAAQ;QACR,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,KAAK,KAAK,aAAa,CAAC;IAE3C,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAE7C;;OAEG;IACH,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,KAA0B,EAAE,EA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AAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEjC,IAAI,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAC5B,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;aAAM,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC;YAC/B;;;eAGG;YACH,aAAa,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,EACD,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,CAAC,CAC5D,CAAC;IAEF,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAEzC,OAAO;QACL,GAAG,EAAE,IAAI;QACT,UAAU;QACV,SAAS,EAAE,YAAY,KAAK,KAAK;QACjC,OAAO,EAAE,oBAAoB,CAC3B,OAAO,EACP,GAAG,EAAE,CAAC,aAAa,KAAK,KAAK,IAAI,gBAAgB,CAAC,KAAK,CAAC,CACzD;QACD,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;QACvE,SAAS,EAAE,oBAAoB,CAAC,UAAU,EAAE,SAAS,CAAC;KACvD,CAAC;AACJ,CAAC"}
|
|
@@ -10,5 +10,5 @@ export declare function createDescendantContext<T extends HTMLElement = HTMLElem
|
|
|
10
10
|
descendants: DescendantsManager<T, K>;
|
|
11
11
|
index: number;
|
|
12
12
|
enabledIndex: number;
|
|
13
|
-
register: (instance: T | null) => void;
|
|
13
|
+
register: ((instance: T | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
14
14
|
}];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React, { useRef, useState } from "react";
|
|
5
5
|
import { createStrictContext } from "../../create-strict-context.js";
|
|
6
6
|
import { useClientLayoutEffect } from "../useClientLayoutEffect.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useMergeRefs } from "../useMergeRefs.js";
|
|
8
8
|
import { DescendantsManager } from "./descendant.js";
|
|
9
9
|
import { cast } from "./utils.js";
|
|
10
10
|
/**
|
|
@@ -48,11 +48,12 @@ export function createDescendantContext() {
|
|
|
48
48
|
const refCallback = options
|
|
49
49
|
? cast(descendants.register(options))
|
|
50
50
|
: cast(descendants.register);
|
|
51
|
+
const refs = useMergeRefs(refCallback, ref);
|
|
51
52
|
return {
|
|
52
53
|
descendants,
|
|
53
54
|
index,
|
|
54
55
|
enabledIndex: descendants.enabledIndexOf(ref.current),
|
|
55
|
-
register:
|
|
56
|
+
register: refs,
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDescendant.js","sourceRoot":"","sources":["../../../../src/util/hooks/descendants/useDescendant.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useDescendant.js","sourceRoot":"","sources":["../../../../src/util/hooks/descendants/useDescendant.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;A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MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;gBACpD,QAAQ,CAAC,SAAS,CAAC,CAAC;YACtB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,OAAO;YACzB,CAAC,CAAC,IAAI,CAAuB,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAC,IAAI,CAAuB,WAAW,CAAC,QAAQ,CAAC,CAAC;QAErD,MAAM,IAAI,GAAG,YAAY,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAE5C,OAAO;YACL,WAAW;YACX,KAAK;YACL,YAAY,EAAE,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,SAAS,cAAc;QACrB,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,kBAAkB,EAAQ,CAAC,CAAC,OAAO,CAAC;QAEnE,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO;QACL,mBAAmB;QACnB,eAAe;QACf,+CAA+C;QAC/C,qBAAqB;QACrB,8EAA8E;QAC9E,cAAc;QACd,+BAA+B;QAC/B,aAAa;KACL,CAAC;AACb,CAAC"}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type
|
|
2
|
+
type Empty = null | undefined;
|
|
3
|
+
type InputRef<I> = React.Ref<I> | Empty;
|
|
4
|
+
type Result<I> = React.RefCallback<I> | null;
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
+
* Merges refs into a single memoized callback ref or `null`.
|
|
7
|
+
* This makes sure multiple refs are updated together and have the same value.
|
|
8
|
+
*
|
|
9
|
+
* This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,
|
|
10
|
+
* use `useMergeRefsN` instead.
|
|
6
11
|
*/
|
|
7
|
-
export declare function
|
|
12
|
+
export declare function useMergeRefs<I>(a: InputRef<I>, b: InputRef<I>): Result<I>;
|
|
13
|
+
export declare function useMergeRefs<I>(a: InputRef<I>, b: InputRef<I>, c: InputRef<I>): Result<I>;
|
|
14
|
+
export declare function useMergeRefs<I>(a: InputRef<I>, b: InputRef<I>, c: InputRef<I>, d: InputRef<I>): Result<I>;
|
|
8
15
|
/**
|
|
9
|
-
* Merges refs
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @returns React.useCallback(mergeRefs(refs), refs)
|
|
16
|
+
* Merges an array of refs into a single memoized callback ref or `null`.
|
|
17
|
+
*
|
|
18
|
+
* If you need to merge a fixed number (up to four) of refs, use `useMergeRefs` instead for better performance.
|
|
13
19
|
*/
|
|
14
|
-
export declare function
|
|
20
|
+
export declare function useMergeRefsN<I>(refs: InputRef<I>[]): Result<I>;
|
|
15
21
|
export {};
|
|
@@ -1,31 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useRefWithInit } from "./useRefWithInit.js";
|
|
2
|
+
export function useMergeRefs(a, b, c, d) {
|
|
3
|
+
const forkRef = useRefWithInit((createForkRef)).current;
|
|
4
|
+
if (didChange(forkRef, a, b, c, d)) {
|
|
5
|
+
update(forkRef, [a, b, c, d]);
|
|
6
|
+
}
|
|
7
|
+
return forkRef.callback;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
10
|
+
* Merges an array of refs into a single memoized callback ref or `null`.
|
|
11
|
+
*
|
|
12
|
+
* If you need to merge a fixed number (up to four) of refs, use `useMergeRefs` instead for better performance.
|
|
8
13
|
*/
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export function useMergeRefsN(refs) {
|
|
15
|
+
const forkRef = useRefWithInit((createForkRef)).current;
|
|
16
|
+
if (didChangeN(forkRef, refs)) {
|
|
17
|
+
update(forkRef, refs);
|
|
18
|
+
}
|
|
19
|
+
return forkRef.callback;
|
|
20
|
+
}
|
|
21
|
+
function createForkRef() {
|
|
22
|
+
return {
|
|
23
|
+
callback: null,
|
|
24
|
+
cleanup: null,
|
|
25
|
+
refs: [],
|
|
19
26
|
};
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
function didChange(forkRef, a, b, c, d) {
|
|
29
|
+
return (forkRef.refs[0] !== a ||
|
|
30
|
+
forkRef.refs[1] !== b ||
|
|
31
|
+
forkRef.refs[2] !== c ||
|
|
32
|
+
forkRef.refs[3] !== d);
|
|
33
|
+
}
|
|
34
|
+
function didChangeN(forkRef, newRefs) {
|
|
35
|
+
return (forkRef.refs.length !== newRefs.length ||
|
|
36
|
+
forkRef.refs.some((ref, index) => ref !== newRefs[index]));
|
|
37
|
+
}
|
|
38
|
+
function update(forkRef, refs) {
|
|
39
|
+
forkRef.refs = refs;
|
|
40
|
+
if (refs.every((ref) => ref == null)) {
|
|
41
|
+
forkRef.callback = null;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
forkRef.callback = (instance) => {
|
|
45
|
+
if (forkRef.cleanup) {
|
|
46
|
+
forkRef.cleanup();
|
|
47
|
+
forkRef.cleanup = null;
|
|
48
|
+
}
|
|
49
|
+
if (instance != null) {
|
|
50
|
+
const cleanupCallbacks = Array(refs.length).fill(null);
|
|
51
|
+
for (let i = 0; i < refs.length; i += 1) {
|
|
52
|
+
const ref = refs[i];
|
|
53
|
+
if (ref == null) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
switch (typeof ref) {
|
|
57
|
+
case "function": {
|
|
58
|
+
const refCleanup = ref(instance);
|
|
59
|
+
if (typeof refCleanup === "function") {
|
|
60
|
+
cleanupCallbacks[i] = refCleanup;
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "object": {
|
|
65
|
+
ref.current = instance;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
default:
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
forkRef.cleanup = () => {
|
|
72
|
+
for (let i = 0; i < refs.length; i += 1) {
|
|
73
|
+
const ref = refs[i];
|
|
74
|
+
if (ref == null) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
switch (typeof ref) {
|
|
78
|
+
case "function": {
|
|
79
|
+
const cleanupCallback = cleanupCallbacks[i];
|
|
80
|
+
if (typeof cleanupCallback === "function") {
|
|
81
|
+
cleanupCallback();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
ref(null);
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "object": {
|
|
89
|
+
ref.current = null;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
default:
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
30
98
|
}
|
|
31
99
|
//# sourceMappingURL=useMergeRefs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergeRefs.js","sourceRoot":"","sources":["../../../src/util/hooks/useMergeRefs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMergeRefs.js","sourceRoot":"","sources":["../../../src/util/hooks/useMergeRefs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgClD,MAAM,UAAU,YAAY,CAC1B,CAAc,EACd,CAAc,EACd,CAAe,EACf,CAAe;IAEf,MAAM,OAAO,GAAG,cAAc,CAAC,CAAA,aAAgB,CAAA,CAAC,CAAC,OAAQ,CAAC;IAC1D,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,CA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CAAC,OAAO,GAAG,GAAG,EAAE;gBACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;oBACxC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;oBACpB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;wBAChB,SAAS;oBACX,CAAC;oBACD,QAAQ,OAAO,GAAG,EAAE,CAAC;wBACnB,KAAK,UAAU,CAAC,CAAC,CAAC;4BAChB,MAAM,eAAe,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;4BAC5C,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE,CAAC;gCAC1C,eAAe,EAAE,CAAC;4BACpB,CAAC;iCAAM,CAAC;gCACN,GAAG,CAAC,IAAI,CAAC,CAAC;4BACZ,CAAC;4BACD,MAAM;wBACR,CAAC;wBACD,KAAK,QAAQ,CAAC,CAAC,CAAC;4BACb,GAAwC,CAAC,OAAO,GAAG,IAAI,CAAC;4BACzD,MAAM;wBACR,CAAC;wBACD,QAAQ;oBACV,CAAC;gBACH,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -5,14 +5,12 @@ export type AsChildProps = {
|
|
|
5
5
|
* merging the props of the component with the props of the child.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* ```
|
|
9
8
|
* <Component asChild data-prop>
|
|
10
9
|
* <ChildComponent data-child />
|
|
11
10
|
* </Component>
|
|
12
11
|
*
|
|
13
12
|
* Out:
|
|
14
13
|
* <MergedComponent data-prop data-child />
|
|
15
|
-
* ```
|
|
16
14
|
*/
|
|
17
15
|
asChild: true;
|
|
18
16
|
as?: never;
|
|
@@ -23,14 +21,12 @@ export type AsChildProps = {
|
|
|
23
21
|
* merging the props of the component with the props of the child.
|
|
24
22
|
*
|
|
25
23
|
* @example
|
|
26
|
-
* ```
|
|
27
24
|
* <Component asChild data-prop>
|
|
28
25
|
* <ChildComponent data-child />
|
|
29
26
|
* </Component>
|
|
30
27
|
*
|
|
31
28
|
* Out:
|
|
32
29
|
* <MergedComponent data-prop data-child />
|
|
33
|
-
* ```
|
|
34
30
|
*/
|
|
35
31
|
asChild?: false;
|
|
36
32
|
};
|
|
@@ -21,7 +21,7 @@ export declare const VirtualFocusDescendantsProvider: import("react").Provider<i
|
|
|
21
21
|
}>;
|
|
22
22
|
index: number;
|
|
23
23
|
enabledIndex: number;
|
|
24
|
-
register: (instance: HTMLDivElement | null) => void;
|
|
24
|
+
register: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
25
25
|
};
|
|
26
26
|
export declare const VirtualFocusInternalContextProvider: import("react").FC<{
|
|
27
27
|
virtualFocusIdx: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.39.0",
|
|
4
4
|
"description": "React components from the Norwegian Labour and Welfare Administration.",
|
|
5
5
|
"author": "Aksel, a team part of the Norwegian Labour and Welfare Administration.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -705,8 +705,8 @@
|
|
|
705
705
|
"dependencies": {
|
|
706
706
|
"@floating-ui/react": "0.27.8",
|
|
707
707
|
"@floating-ui/react-dom": "^2.1.6",
|
|
708
|
-
"@navikt/aksel-icons": "^7.
|
|
709
|
-
"@navikt/ds-tokens": "^7.
|
|
708
|
+
"@navikt/aksel-icons": "^7.39.0",
|
|
709
|
+
"@navikt/ds-tokens": "^7.39.0",
|
|
710
710
|
"clsx": "^2.1.0",
|
|
711
711
|
"date-fns": "^4.0.0",
|
|
712
712
|
"react-day-picker": "9.7.0"
|
|
@@ -721,10 +721,10 @@
|
|
|
721
721
|
"concurrently": "9.2.1",
|
|
722
722
|
"copyfiles": "^2.4.1",
|
|
723
723
|
"fast-glob": "3.2.11",
|
|
724
|
-
"jscodeshift": "
|
|
724
|
+
"jscodeshift": "0.15.2",
|
|
725
725
|
"jsdom": "27.1.0",
|
|
726
726
|
"react-dom": "^18.0.0",
|
|
727
|
-
"react-router": "^7.
|
|
727
|
+
"react-router": "^7.12.0",
|
|
728
728
|
"rimraf": "6.0.1",
|
|
729
729
|
"swr": "^2.3.6",
|
|
730
730
|
"tsc-alias": "1.8.16",
|
|
@@ -20,6 +20,11 @@ import {
|
|
|
20
20
|
interface GlobalAlertProps
|
|
21
21
|
extends Omit<BaseAlert.RootProps, "type" | "global" | "data-color"> {
|
|
22
22
|
status: Exclude<BaseAlert.RootProps["status"], undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Whether title and content are centered or not.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
centered?: boolean;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
interface GlobalAlertComponent
|
|
@@ -98,14 +103,15 @@ interface GlobalAlertComponent
|
|
|
98
103
|
* ```
|
|
99
104
|
*/
|
|
100
105
|
export const GlobalAlert = forwardRef<HTMLDivElement, GlobalAlertProps>(
|
|
101
|
-
(
|
|
106
|
+
({ centered = true, ...rest }: GlobalAlertProps, forwardedRef) => {
|
|
102
107
|
return (
|
|
103
108
|
<BaseAlert.Root
|
|
104
109
|
ref={forwardedRef}
|
|
105
110
|
role="alert"
|
|
106
|
-
{...
|
|
111
|
+
{...rest}
|
|
107
112
|
type="strong"
|
|
108
113
|
global
|
|
114
|
+
data-centered={centered}
|
|
109
115
|
/>
|
|
110
116
|
);
|
|
111
117
|
},
|
package/src/date/Date.Dialog.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
2
|
import { Button } from "../button";
|
|
3
|
+
import { useDialogContext } from "../dialog/root/DialogRoot.context";
|
|
3
4
|
import { Modal } from "../modal";
|
|
4
5
|
import { useModalContext } from "../modal/Modal.context";
|
|
5
6
|
import { Popover } from "../popover";
|
|
@@ -45,9 +46,13 @@ const DateDialog = ({
|
|
|
45
46
|
const { cn } = useRenameCSS();
|
|
46
47
|
|
|
47
48
|
const modalRef = useRef<HTMLDialogElement>(null);
|
|
49
|
+
|
|
48
50
|
const isInModal = useModalContext(false) !== undefined;
|
|
51
|
+
const isInDialog = useDialogContext(false) !== undefined;
|
|
49
52
|
const hideModal =
|
|
50
|
-
useMedia("screen and (min-width: 768px)", true) &&
|
|
53
|
+
useMedia("screen and (min-width: 768px)", true) &&
|
|
54
|
+
!isInModal &&
|
|
55
|
+
!isInDialog;
|
|
51
56
|
|
|
52
57
|
if (!open) {
|
|
53
58
|
return null;
|
package/src/dialog/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Dialog } from "./root/DialogRoot";
|
|
2
|
+
export { default as Dialog } from "./root/DialogRoot";
|
|
3
3
|
export type { DialogProps } from "./root/DialogRoot";
|
|
4
4
|
export { DialogTrigger } from "./trigger/DialogTrigger";
|
|
5
5
|
export type { DialogTriggerProps } from "./trigger/DialogTrigger";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
+
import { useModalContext } from "../../modal/Modal.context";
|
|
2
3
|
import { Portal, type PortalProps } from "../../portal";
|
|
3
4
|
import { DialogBackdropInternal } from "../backdrop/DialogBackdropInternal";
|
|
4
5
|
import { useDialogContext } from "../root/DialogRoot.context";
|
|
@@ -28,7 +29,7 @@ const DialogPopup = forwardRef<HTMLDivElement, DialogPopupProps>(
|
|
|
28
29
|
{
|
|
29
30
|
modal = true,
|
|
30
31
|
withBackdrop = modal === true,
|
|
31
|
-
rootElement,
|
|
32
|
+
rootElement: rootElementProp,
|
|
32
33
|
position,
|
|
33
34
|
...restProps
|
|
34
35
|
},
|
|
@@ -36,6 +37,11 @@ const DialogPopup = forwardRef<HTMLDivElement, DialogPopupProps>(
|
|
|
36
37
|
) => {
|
|
37
38
|
const { mounted, nested } = useDialogContext();
|
|
38
39
|
|
|
40
|
+
const modalContext = useModalContext(false);
|
|
41
|
+
const rootElement = modalContext
|
|
42
|
+
? modalContext.modalRef.current
|
|
43
|
+
: rootElementProp;
|
|
44
|
+
|
|
39
45
|
if (!mounted) {
|
|
40
46
|
return null;
|
|
41
47
|
}
|
|
@@ -179,15 +179,15 @@ interface DialogComponent extends React.FC<DialogProps> {
|
|
|
179
179
|
* Dialog body content
|
|
180
180
|
* </Dialog.Body>
|
|
181
181
|
* <Dialog.Footer>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
* <Dialog.CloseTrigger>
|
|
183
|
+
* <Button>Close dialog</Button>
|
|
184
|
+
* </Dialog.CloseTrigger>
|
|
185
185
|
* </Dialog.Footer>
|
|
186
186
|
* </Dialog.Popup>
|
|
187
187
|
* </Dialog>
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
190
|
-
const Dialog: DialogComponent = (props: DialogProps) => {
|
|
190
|
+
export const Dialog: DialogComponent = (props: DialogProps) => {
|
|
191
191
|
const {
|
|
192
192
|
children,
|
|
193
193
|
defaultOpen = false,
|
|
@@ -292,5 +292,5 @@ Dialog.Body = DialogBody;
|
|
|
292
292
|
Dialog.Footer = DialogFooter;
|
|
293
293
|
Dialog.Popup = DialogPopup;
|
|
294
294
|
|
|
295
|
-
export
|
|
295
|
+
export default Dialog;
|
|
296
296
|
export type { DialogProps };
|
|
@@ -11,7 +11,7 @@ export interface ExpansionCardContentProps
|
|
|
11
11
|
const ExpansionCardContent = forwardRef<
|
|
12
12
|
HTMLDivElement,
|
|
13
13
|
ExpansionCardContentProps
|
|
14
|
-
>(({ children, className, ...rest }, ref) => {
|
|
14
|
+
>(({ children, className, "data-color": dataColor, ...rest }, ref) => {
|
|
15
15
|
const { cn } = useRenameCSS();
|
|
16
16
|
const panelContext = useContext(ExpansionCardContext);
|
|
17
17
|
const themeContext = useThemeInternal();
|
|
@@ -25,7 +25,6 @@ const ExpansionCardContent = forwardRef<
|
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<BodyLong
|
|
28
|
-
data-color={themeContext?.color}
|
|
29
28
|
{...rest}
|
|
30
29
|
ref={ref}
|
|
31
30
|
as="div"
|
|
@@ -36,7 +35,12 @@ const ExpansionCardContent = forwardRef<
|
|
|
36
35
|
size={panelContext.size}
|
|
37
36
|
data-open={panelContext.open}
|
|
38
37
|
>
|
|
39
|
-
<div
|
|
38
|
+
<div
|
|
39
|
+
className={cn("navds-expansioncard__content-inner")}
|
|
40
|
+
data-color={dataColor ?? themeContext?.color}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
40
44
|
</BodyLong>
|
|
41
45
|
);
|
|
42
46
|
});
|