@navikt/ds-react 6.7.0 → 6.7.1
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/chat/Chat.d.ts +2 -1
- package/cjs/chat/Chat.js +2 -1
- package/cjs/chat/Chat.js.map +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/cjs/date/monthpicker/MonthCaption.js +1 -1
- package/cjs/date/utils/labels.d.ts +2 -2
- package/cjs/form/ReadOnlyIcon.d.ts +2 -2
- package/cjs/form/combobox/Combobox.js +7 -22
- package/cjs/form/combobox/Combobox.js.map +1 -1
- package/cjs/form/combobox/ComboboxProvider.js +2 -2
- package/cjs/form/combobox/ComboboxProvider.js.map +1 -1
- package/cjs/form/combobox/ComboboxWrapper.d.ts +1 -2
- package/cjs/form/combobox/ComboboxWrapper.js +4 -2
- package/cjs/form/combobox/ComboboxWrapper.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +13 -15
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/{inputContext.d.ts → Input.context.d.ts} +7 -5
- package/cjs/form/combobox/Input/{inputContext.js → Input.context.js} +22 -22
- package/cjs/form/combobox/Input/Input.context.js.map +1 -0
- package/cjs/form/combobox/Input/Input.js +2 -2
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +3 -0
- package/cjs/form/combobox/Input/InputController.js +70 -0
- package/cjs/form/combobox/Input/InputController.js.map +1 -0
- package/cjs/form/combobox/{ToggleListButton.js → Input/ToggleListButton.js} +1 -1
- package/cjs/form/combobox/Input/ToggleListButton.js.map +1 -0
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +2 -2
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +7 -13
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/customOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/customOptionsContext.js +10 -13
- package/cjs/form/combobox/customOptionsContext.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +1 -1
- package/cjs/help-text/HelpTextIcon.d.ts +1 -1
- package/cjs/overlay/dismiss/DismissableLayer.d.ts +70 -0
- package/cjs/overlay/dismiss/DismissableLayer.js +253 -0
- package/cjs/overlay/dismiss/DismissableLayer.js.map +1 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.d.ts +50 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.js +65 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.js.map +1 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.d.ts +1 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.js +19 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.js.map +1 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.d.ts +8 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.js +42 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.js.map +1 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.d.ts +10 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.js +84 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.js.map +1 -0
- package/cjs/overlays/floating/Floating.d.ts +53 -0
- package/cjs/overlays/floating/Floating.js +215 -0
- package/cjs/overlays/floating/Floating.js.map +1 -0
- package/cjs/overlays/floating/Floating.utils.d.ts +18 -0
- package/cjs/overlays/floating/Floating.utils.js +52 -0
- package/cjs/overlays/floating/Floating.utils.js.map +1 -0
- package/cjs/popover/Popover.js +13 -28
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/progress-bar/ProgressBar.d.ts +20 -8
- package/cjs/progress-bar/ProgressBar.js +19 -9
- package/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +7 -3
- package/cjs/tabs/Tabs.context.js +1 -0
- package/cjs/tabs/Tabs.context.js.map +1 -1
- package/cjs/timeline/AxisLabels.d.ts +1 -1
- package/cjs/toggle-group/ToggleGroup.context.d.ts +7 -3
- package/cjs/toggle-group/ToggleGroup.context.js +1 -0
- package/cjs/toggle-group/ToggleGroup.context.js.map +1 -1
- package/cjs/util/hooks/descendants/useDescendant.d.ts +2 -2
- package/cjs/util/hooks/descendants/useDescendant.js +49 -52
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/types/AsChild.d.ts +14 -0
- package/cjs/util/types/AsChild.js +3 -0
- package/cjs/util/types/AsChild.js.map +1 -0
- package/esm/chat/Chat.d.ts +2 -1
- package/esm/chat/Chat.js +1 -0
- package/esm/chat/Chat.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +1 -1
- package/esm/date/utils/labels.d.ts +2 -2
- package/esm/form/ReadOnlyIcon.d.ts +2 -2
- package/esm/form/combobox/Combobox.js +8 -23
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/ComboboxProvider.js +1 -1
- package/esm/form/combobox/ComboboxProvider.js.map +1 -1
- package/esm/form/combobox/ComboboxWrapper.d.ts +1 -2
- package/esm/form/combobox/ComboboxWrapper.js +4 -2
- package/esm/form/combobox/ComboboxWrapper.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +3 -3
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +4 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +15 -16
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/{inputContext.d.ts → Input.context.d.ts} +7 -5
- package/esm/form/combobox/Input/{inputContext.js → Input.context.js} +22 -21
- package/esm/form/combobox/Input/Input.context.js.map +1 -0
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +3 -0
- package/esm/form/combobox/Input/InputController.js +41 -0
- package/esm/form/combobox/Input/InputController.js.map +1 -0
- package/esm/form/combobox/{ToggleListButton.js → Input/ToggleListButton.js} +1 -1
- package/esm/form/combobox/Input/ToggleListButton.js.map +1 -0
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +4 -4
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +9 -14
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/customOptionsContext.d.ts +4 -4
- package/esm/form/combobox/customOptionsContext.js +10 -12
- package/esm/form/combobox/customOptionsContext.js.map +1 -1
- package/esm/form/combobox/types.d.ts +1 -1
- package/esm/help-text/HelpTextIcon.d.ts +1 -1
- package/esm/overlay/dismiss/DismissableLayer.d.ts +70 -0
- package/esm/overlay/dismiss/DismissableLayer.js +226 -0
- package/esm/overlay/dismiss/DismissableLayer.js.map +1 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.d.ts +50 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.js +58 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.js.map +1 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.d.ts +1 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.js +15 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.js.map +1 -0
- package/esm/overlay/dismiss/util/useFocusOutside.d.ts +8 -0
- package/esm/overlay/dismiss/util/useFocusOutside.js +38 -0
- package/esm/overlay/dismiss/util/useFocusOutside.js.map +1 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.d.ts +10 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.js +80 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.js.map +1 -0
- package/esm/overlays/floating/Floating.d.ts +53 -0
- package/esm/overlays/floating/Floating.js +188 -0
- package/esm/overlays/floating/Floating.js.map +1 -0
- package/esm/overlays/floating/Floating.utils.d.ts +18 -0
- package/esm/overlays/floating/Floating.utils.js +48 -0
- package/esm/overlays/floating/Floating.utils.js.map +1 -0
- package/esm/popover/Popover.js +16 -31
- package/esm/popover/Popover.js.map +1 -1
- package/esm/progress-bar/ProgressBar.d.ts +20 -8
- package/esm/progress-bar/ProgressBar.js +20 -10
- package/esm/progress-bar/ProgressBar.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +7 -3
- package/esm/tabs/Tabs.context.js +1 -0
- package/esm/tabs/Tabs.context.js.map +1 -1
- package/esm/timeline/AxisLabels.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.context.d.ts +7 -3
- package/esm/toggle-group/ToggleGroup.context.js +1 -0
- package/esm/toggle-group/ToggleGroup.context.js.map +1 -1
- package/esm/util/hooks/descendants/useDescendant.d.ts +2 -2
- package/esm/util/hooks/descendants/useDescendant.js +49 -52
- package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
- package/esm/util/types/AsChild.d.ts +14 -0
- package/esm/util/types/AsChild.js +2 -0
- package/esm/util/types/AsChild.js.map +1 -0
- package/package.json +6 -5
- package/src/chat/Chat.tsx +2 -1
- package/src/date/datepicker/parts/DropdownCaption.tsx +5 -1
- package/src/date/monthpicker/MonthCaption.tsx +1 -1
- package/src/form/combobox/Combobox.tsx +6 -76
- package/src/form/combobox/ComboboxProvider.tsx +1 -1
- package/src/form/combobox/ComboboxWrapper.tsx +4 -3
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +3 -3
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +19 -29
- package/src/form/combobox/Input/{inputContext.tsx → Input.context.tsx} +30 -33
- package/src/form/combobox/Input/Input.tsx +1 -1
- package/src/form/combobox/Input/InputController.tsx +102 -0
- package/src/form/combobox/{ToggleListButton.tsx → Input/ToggleListButton.tsx} +1 -1
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +1 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +12 -26
- package/src/form/combobox/{combobox-utils.test.ts → __tests__/combobox-utils.test.ts} +1 -1
- package/src/form/combobox/{combobox.test.tsx → __tests__/combobox.test.tsx} +2 -3
- package/src/form/combobox/customOptionsContext.tsx +14 -18
- package/src/form/combobox/types.ts +3 -1
- package/src/overlay/README.md +5 -0
- package/src/overlay/dismiss/DismissableLayer.tsx +368 -0
- package/src/overlay/dismiss/util/dispatchCustomEvent.ts +77 -0
- package/src/overlay/dismiss/util/useEscapeKeydown.ts +21 -0
- package/src/overlay/dismiss/util/useFocusOutside.ts +52 -0
- package/src/overlay/dismiss/util/usePointerDownOutside.ts +95 -0
- package/src/overlays/floating/Floating.tsx +399 -0
- package/src/overlays/floating/Floating.utils.ts +63 -0
- package/src/popover/Popover.tsx +38 -70
- package/src/progress-bar/ProgressBar.tsx +45 -20
- package/src/tabs/Tabs.context.ts +2 -0
- package/src/toggle-group/ToggleGroup.context.ts +1 -0
- package/src/util/hooks/descendants/useDescendant.tsx +55 -68
- package/src/util/types/AsChild.ts +15 -0
- package/cjs/form/combobox/ClearButton.d.ts +0 -7
- package/cjs/form/combobox/ClearButton.js +0 -28
- package/cjs/form/combobox/ClearButton.js.map +0 -1
- package/cjs/form/combobox/FilteredOptions/CheckIcon.d.ts +0 -3
- package/cjs/form/combobox/FilteredOptions/CheckIcon.js +0 -12
- package/cjs/form/combobox/FilteredOptions/CheckIcon.js.map +0 -1
- package/cjs/form/combobox/Input/inputContext.js.map +0 -1
- package/cjs/form/combobox/ToggleListButton.js.map +0 -1
- package/esm/form/combobox/ClearButton.d.ts +0 -7
- package/esm/form/combobox/ClearButton.js +0 -21
- package/esm/form/combobox/ClearButton.js.map +0 -1
- package/esm/form/combobox/FilteredOptions/CheckIcon.d.ts +0 -3
- package/esm/form/combobox/FilteredOptions/CheckIcon.js +0 -7
- package/esm/form/combobox/FilteredOptions/CheckIcon.js.map +0 -1
- package/esm/form/combobox/Input/inputContext.js.map +0 -1
- package/esm/form/combobox/ToggleListButton.js.map +0 -1
- package/src/form/combobox/ClearButton.tsx +0 -29
- package/src/form/combobox/FilteredOptions/CheckIcon.tsx +0 -23
- /package/cjs/form/combobox/{ToggleListButton.d.ts → Input/ToggleListButton.d.ts} +0 -0
- /package/esm/form/combobox/{ToggleListButton.d.ts → Input/ToggleListButton.d.ts} +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformOrigin = exports.getSideAndAlignFromPlacement = void 0;
|
|
4
|
+
const SIDE_OPTIONS = ["top", "right", "bottom", "left"];
|
|
5
|
+
const ALIGN_OPTIONS = ["start", "center", "end"];
|
|
6
|
+
/**
|
|
7
|
+
* `transformOrigin` is a custom middleware for floating-ui that calculates the transform origin of the floating-element.
|
|
8
|
+
*/
|
|
9
|
+
function transformOrigin(options) {
|
|
10
|
+
return {
|
|
11
|
+
name: "transformOrigin",
|
|
12
|
+
options,
|
|
13
|
+
fn(data) {
|
|
14
|
+
var _a, _b, _c, _d, _e;
|
|
15
|
+
const { placement, rects, middlewareData } = data;
|
|
16
|
+
const cannotCenterArrow = ((_a = middlewareData.arrow) === null || _a === void 0 ? void 0 : _a.centerOffset) !== 0;
|
|
17
|
+
const isArrowHidden = cannotCenterArrow;
|
|
18
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
19
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
20
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
21
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
22
|
+
const arrowXCenter = ((_c = (_b = middlewareData.arrow) === null || _b === void 0 ? void 0 : _b.x) !== null && _c !== void 0 ? _c : 0) + arrowWidth / 2;
|
|
23
|
+
const arrowYCenter = ((_e = (_d = middlewareData.arrow) === null || _d === void 0 ? void 0 : _d.y) !== null && _e !== void 0 ? _e : 0) + arrowHeight / 2;
|
|
24
|
+
let x = "";
|
|
25
|
+
let y = "";
|
|
26
|
+
if (placedSide === "bottom") {
|
|
27
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
28
|
+
y = `${-arrowHeight}px`;
|
|
29
|
+
}
|
|
30
|
+
else if (placedSide === "top") {
|
|
31
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
32
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
33
|
+
}
|
|
34
|
+
else if (placedSide === "right") {
|
|
35
|
+
x = `${-arrowHeight}px`;
|
|
36
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
37
|
+
}
|
|
38
|
+
else if (placedSide === "left") {
|
|
39
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
40
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
41
|
+
}
|
|
42
|
+
return { data: { x, y } };
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.transformOrigin = transformOrigin;
|
|
47
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
48
|
+
const [side, align = "center"] = placement.split("-");
|
|
49
|
+
return [side, align];
|
|
50
|
+
}
|
|
51
|
+
exports.getSideAndAlignFromPlacement = getSideAndAlignFromPlacement;
|
|
52
|
+
//# source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Y,EAAE,KAAc,CAAU,CAAC;AACjD,CAAC;AAEQ,oEAA4B"}
|
package/cjs/popover/Popover.js
CHANGED
|
@@ -43,6 +43,7 @@ const clsx_1 = __importDefault(require("clsx"));
|
|
|
43
43
|
const react_2 = __importStar(require("react"));
|
|
44
44
|
const context_1 = require("../date/context");
|
|
45
45
|
const Modal_context_1 = require("../modal/Modal.context");
|
|
46
|
+
const DismissableLayer_1 = require("../overlay/dismiss/DismissableLayer");
|
|
46
47
|
const hooks_1 = require("../util/hooks");
|
|
47
48
|
const useMergeRefs_1 = require("../util/hooks/useMergeRefs");
|
|
48
49
|
const PopoverContent_1 = __importDefault(require("./PopoverContent"));
|
|
@@ -73,11 +74,10 @@ exports.Popover = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
73
74
|
const isInDatepicker = (0, react_2.useContext)(context_1.DateContext) !== null;
|
|
74
75
|
const chosenStrategy = userStrategy !== null && userStrategy !== void 0 ? userStrategy : (isInModal ? "fixed" : "absolute");
|
|
75
76
|
const chosenFlip = isInDatepicker ? false : _flip;
|
|
76
|
-
const {
|
|
77
|
+
const { update, refs, placement: flPlacement, middlewareData: { arrow: { x: arrowX, y: arrowY } = {} }, floatingStyles, } = (0, react_1.useFloating)({
|
|
77
78
|
strategy: chosenStrategy,
|
|
78
79
|
placement,
|
|
79
80
|
open,
|
|
80
|
-
onOpenChange: () => onClose(),
|
|
81
81
|
middleware: [
|
|
82
82
|
(0, react_1.offset)(offset !== null && offset !== void 0 ? offset : (arrow ? 16 : 4)),
|
|
83
83
|
chosenFlip &&
|
|
@@ -86,10 +86,6 @@ exports.Popover = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
86
86
|
(0, react_1.arrow)({ element: arrowRef, padding: 8 }),
|
|
87
87
|
],
|
|
88
88
|
});
|
|
89
|
-
const { getFloatingProps } = (0, react_1.useInteractions)([
|
|
90
|
-
(0, react_1.useClick)(context),
|
|
91
|
-
(0, react_1.useDismiss)(context),
|
|
92
|
-
]);
|
|
93
89
|
(0, hooks_1.useClientLayoutEffect)(() => {
|
|
94
90
|
refs.setReference(anchorEl);
|
|
95
91
|
}, [anchorEl]);
|
|
@@ -100,34 +96,23 @@ exports.Popover = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
100
96
|
const cleanup = (0, react_1.autoUpdate)(refs.reference.current, refs.floating.current, update);
|
|
101
97
|
return () => cleanup();
|
|
102
98
|
}, [refs.floating, refs.reference, update, open, anchorEl]);
|
|
103
|
-
(0, hooks_1.useEventListener)("focusin", (0, react_2.useCallback)((e) => {
|
|
104
|
-
if (e.target instanceof HTMLElement &&
|
|
105
|
-
![anchorEl, refs.floating.current].some((element) => element === null || element === void 0 ? void 0 : element.contains(e.target)) &&
|
|
106
|
-
!e.target.contains(refs.floating.current)) {
|
|
107
|
-
open && onClose();
|
|
108
|
-
}
|
|
109
|
-
}, [anchorEl, refs, open, onClose]));
|
|
110
99
|
const staticSide = {
|
|
111
100
|
top: "bottom",
|
|
112
101
|
right: "left",
|
|
113
102
|
bottom: "top",
|
|
114
103
|
left: "right",
|
|
115
104
|
}[flPlacement.split("-")[0]];
|
|
116
|
-
return (react_2.default.createElement(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
children,
|
|
128
|
-
arrow && (react_2.default.createElement("div", { ref: (node) => {
|
|
129
|
-
arrowRef.current = node;
|
|
130
|
-
}, style: Object.assign(Object.assign(Object.assign({}, (arrowX != null ? { left: arrowX } : {})), (arrowY != null ? { top: arrowY } : {})), (staticSide ? { [staticSide]: "-0.5rem" } : {})), className: "navds-popover__arrow" }))));
|
|
105
|
+
return (react_2.default.createElement(DismissableLayer_1.DismissableLayer, { asChild: true, safeZone: {
|
|
106
|
+
anchor: anchorEl,
|
|
107
|
+
dismissable: refs.floating.current,
|
|
108
|
+
}, onDismiss: () => open && (onClose === null || onClose === void 0 ? void 0 : onClose()), enabled: open },
|
|
109
|
+
react_2.default.createElement("div", Object.assign({ ref: floatingRef }, rest, { className: (0, clsx_1.default)("navds-popover", className, {
|
|
110
|
+
"navds-popover--hidden": !open || !anchorEl,
|
|
111
|
+
}), style: Object.assign(Object.assign({}, rest.style), floatingStyles), "data-placement": flPlacement, "aria-hidden": !open || !anchorEl }),
|
|
112
|
+
children,
|
|
113
|
+
arrow && (react_2.default.createElement("div", { ref: (node) => {
|
|
114
|
+
arrowRef.current = node;
|
|
115
|
+
}, style: Object.assign(Object.assign(Object.assign({}, (arrowX != null ? { left: arrowX } : {})), (arrowY != null ? { top: arrowY } : {})), (staticSide ? { [staticSide]: "-0.5rem" } : {})), className: "navds-popover__arrow" })))));
|
|
131
116
|
});
|
|
132
117
|
exports.Popover.Content = PopoverContent_1.default;
|
|
133
118
|
exports.default = exports.Popover;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAO4B;AAC5B,gDAAsB;AACtB,+CAA8E;AAC9E,6CAA8C;AAC9C,0DAAyD;AACzD,0EAAuE;AACvE,yCAAsD;AACtD,6DAA0D;AAC1D,sEAAsE;AAoEtE;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,OAAO,GAAG,IAAA,kBAAU,EAC/B,CACE,EAYC,EACD,GAAG,EACH,EAAE;QAdF,EACE,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,IAAI,EACZ,IAAI,EACJ,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,MAAM,EACN,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,KA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,CAAC,QAAQ;aAC5C,CAAC,EACF,KAAK,kCAAO,IAAI,CAAC,KAAK,GAAK,cAAc,qBACzB,WAAW,iBACd,CAAC,IAAI,IAAI,CAAC,QAAQ;YAE9B,QAAQ;YACR,KAAK,IAAI,CACR,uCACE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;oBACZ,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;gBAC1B,CAAC,EACD,KAAK,gDACA,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACxC,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACvC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAEpD,SAAS,EAAC,sBAAsB,GAChC,CACH,CACG,CACW,CACpB,CAAC;AACJ,CAAC,CACkB,CAAC;AAEtB,eAAO,CAAC,OAAO,GAAG,wBAAc,CAAC;AAEjC,kBAAe,eAAO,CAAC"}
|
|
@@ -6,7 +6,7 @@ interface ProgressBarPropsBase extends Omit<HTMLAttributes<HTMLDivElement>, "rol
|
|
|
6
6
|
*/
|
|
7
7
|
size?: "large" | "medium" | "small";
|
|
8
8
|
/**
|
|
9
|
-
* Current progress.
|
|
9
|
+
* Current progress. If set, the `simulated` prop overrides `value`.
|
|
10
10
|
*/
|
|
11
11
|
value?: number;
|
|
12
12
|
/**
|
|
@@ -15,12 +15,20 @@ interface ProgressBarPropsBase extends Omit<HTMLAttributes<HTMLDivElement>, "rol
|
|
|
15
15
|
*/
|
|
16
16
|
valueMax?: number;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* ProgressBar grows with a preset animation for
|
|
20
|
-
*
|
|
21
|
-
* A duration of 0 will show an indeterminate animation immediately.
|
|
22
|
-
* Temporary removed to avoid conflicts when updating API
|
|
18
|
+
* Visually simulates loading.
|
|
19
|
+
* ProgressBar grows with a preset animation for set number of seconds,
|
|
20
|
+
* then shows an indeterminate animation on timeout.
|
|
23
21
|
*/
|
|
22
|
+
simulated?: {
|
|
23
|
+
/**
|
|
24
|
+
* Duration in seconds.
|
|
25
|
+
*/
|
|
26
|
+
seconds: number;
|
|
27
|
+
/**
|
|
28
|
+
* Callback function when progress is indeterminate.
|
|
29
|
+
*/
|
|
30
|
+
onTimeout: () => void;
|
|
31
|
+
};
|
|
24
32
|
/**
|
|
25
33
|
* String ID of the element that labels the progress bar.
|
|
26
34
|
* Not needed if `aria-label` is used.
|
|
@@ -33,7 +41,7 @@ interface ProgressBarPropsBase extends Omit<HTMLAttributes<HTMLDivElement>, "rol
|
|
|
33
41
|
"aria-label"?: string;
|
|
34
42
|
}
|
|
35
43
|
export type ProgressBarProps = ProgressBarPropsBase & ({
|
|
36
|
-
"aria-hidden":
|
|
44
|
+
"aria-hidden": true;
|
|
37
45
|
} | {
|
|
38
46
|
"aria-labelledby": string;
|
|
39
47
|
"aria-label"?: never;
|
|
@@ -50,7 +58,11 @@ export type ProgressBarProps = ProgressBarPropsBase & ({
|
|
|
50
58
|
*
|
|
51
59
|
* @example
|
|
52
60
|
* // For loading content with an approximate duration in sec.
|
|
53
|
-
* <ProgressBar
|
|
61
|
+
* <ProgressBar simulated={{
|
|
62
|
+
* seconds: 30,
|
|
63
|
+
* onTimeout: () => console.log("Oops, this is taking more time than expected!")
|
|
64
|
+
* }}
|
|
65
|
+
* />
|
|
54
66
|
*
|
|
55
67
|
* @example
|
|
56
68
|
* // As a step indicator for forms, questionnaires, etc.
|
|
@@ -49,26 +49,36 @@ const react_1 = __importStar(require("react"));
|
|
|
49
49
|
*
|
|
50
50
|
* @example
|
|
51
51
|
* // For loading content with an approximate duration in sec.
|
|
52
|
-
* <ProgressBar
|
|
52
|
+
* <ProgressBar simulated={{
|
|
53
|
+
* seconds: 30,
|
|
54
|
+
* onTimeout: () => console.log("Oops, this is taking more time than expected!")
|
|
55
|
+
* }}
|
|
56
|
+
* />
|
|
53
57
|
*
|
|
54
58
|
* @example
|
|
55
59
|
* // As a step indicator for forms, questionnaires, etc.
|
|
56
60
|
* <ProgressBar value={2} valueMax={7} />
|
|
57
61
|
*/
|
|
58
62
|
exports.ProgressBar = (0, react_1.forwardRef)((_a, ref) => {
|
|
59
|
-
var { size = "medium", value = 0, valueMax = 100, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, className } = _a, rest = __rest(_a, ["size", "value", "valueMax", "aria-labelledby", "aria-label", "className"]);
|
|
63
|
+
var { size = "medium", value = 0, valueMax = 100, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, className, simulated } = _a, rest = __rest(_a, ["size", "value", "valueMax", "aria-labelledby", "aria-label", "className", "simulated"]);
|
|
60
64
|
const translate = 100 - (Math.round(value) / valueMax) * 100;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
const onTimeoutRef = (0, react_1.useRef)();
|
|
66
|
+
onTimeoutRef.current = simulated === null || simulated === void 0 ? void 0 : simulated.onTimeout;
|
|
67
|
+
react_1.default.useEffect(() => {
|
|
68
|
+
if ((simulated === null || simulated === void 0 ? void 0 : simulated.seconds) && onTimeoutRef.current) {
|
|
69
|
+
const timeout = setTimeout(onTimeoutRef.current, simulated.seconds * 1000);
|
|
70
|
+
return () => clearTimeout(timeout);
|
|
71
|
+
}
|
|
72
|
+
}, [simulated === null || simulated === void 0 ? void 0 : simulated.seconds]);
|
|
73
|
+
return (react_1.default.createElement("div", Object.assign({ ref: ref, className: (0, clsx_1.default)("navds-progress-bar", `navds-progress-bar--${size}`, className), "aria-valuemax": (simulated === null || simulated === void 0 ? void 0 : simulated.seconds) ? 0 : Math.round(valueMax), "aria-valuenow": (simulated === null || simulated === void 0 ? void 0 : simulated.seconds) ? 0 : Math.round(value), "aria-valuetext": (simulated === null || simulated === void 0 ? void 0 : simulated.seconds)
|
|
74
|
+
? `Fremdrift kan ikke beregnes, antatt tid er: ${simulated === null || simulated === void 0 ? void 0 : simulated.seconds} sekunder`
|
|
64
75
|
: `${Math.round(value)} av ${Math.round(valueMax)}`, role: "progressbar", "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel }, rest),
|
|
65
76
|
react_1.default.createElement("div", { className: (0, clsx_1.default)("navds-progress-bar__foreground", {
|
|
66
|
-
"navds-progress-bar__foreground--indeterminate": Number.isInteger(
|
|
77
|
+
"navds-progress-bar__foreground--indeterminate": Number.isInteger(simulated === null || simulated === void 0 ? void 0 : simulated.seconds),
|
|
67
78
|
}), style: {
|
|
68
|
-
"--__ac-progress-bar-
|
|
69
|
-
? `${
|
|
79
|
+
"--__ac-progress-bar-simulated": Number.isInteger(simulated === null || simulated === void 0 ? void 0 : simulated.seconds)
|
|
80
|
+
? `${simulated === null || simulated === void 0 ? void 0 : simulated.seconds}s`
|
|
70
81
|
: undefined,
|
|
71
|
-
"--__ac-progress-bar-delay": `${duration === 0 ? 0 : 4}s`,
|
|
72
82
|
"--__ac-progress-bar-translate": `-${translate}%`,
|
|
73
83
|
} })));
|
|
74
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/progress-bar/ProgressBar.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/progress-bar/ProgressBar.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+CAAkE;AA4DlE;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,CACE,EASC,EACD,GAAG,EACH,EAAE;QAXF,EACE,IAAI,GAAG,QAAQ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AAT,SAAS,CAAE,OAAO;YAChB,CAAC,CAAC,+CAA+C,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,WAAW;YAC9E,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAEvD,IAAI,EAAC,aAAa,qBACD,cAAc,gBACnB,SAAS,IACjB,IAAI;QAER,uCACE,SAAS,EAAE,IAAA,cAAE,EAAC,gCAAgC,EAAE;gBAC9C,+CAA+C,EAAE,MAAM,CAAC,SAAS,CAC/D,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,CACnB;aACF,CAAC,EACF,KAAK,EAAE;gBACL,+BAA+B,EAAE,MAAM,CAAC,SAAS,CAC/C,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,CACnB;oBACC,CAAC,CAAC,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,GAAG;oBAC1B,CAAC,CAAC,SAAS;gBACb,+BAA+B,EAAE,IAAI,SAAS,GAAG;aAClD,GACD,CACE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAe,mBAAW,CAAC"}
|
|
@@ -3,14 +3,18 @@ import { TabsProps } from "./Tabs.types";
|
|
|
3
3
|
import { useTabs } from "./useTabs";
|
|
4
4
|
export declare const TabsDescendantsProvider: import("react").Provider<import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
5
5
|
value: string;
|
|
6
|
-
}>>, useTabsDescendantsContext: () => import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
6
|
+
}>>, useTabsDescendantsContext: <S extends boolean = true>(strict?: S) => S extends true ? import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
7
7
|
value: string;
|
|
8
|
-
}
|
|
8
|
+
}> : import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
9
|
+
value: string;
|
|
10
|
+
}> | undefined, useTabsDescendants: () => import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
9
11
|
value: string;
|
|
10
12
|
}>, useTabsDescendant: (options?: import("../util/hooks/descendants/descendant").DescendantOptions<{
|
|
11
13
|
value: string;
|
|
12
14
|
}> | undefined) => {
|
|
13
|
-
descendants: import("../util/hooks/descendants/descendant").DescendantsManager<
|
|
15
|
+
descendants: import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
16
|
+
value: string;
|
|
17
|
+
}>;
|
|
14
18
|
index: number;
|
|
15
19
|
enabledIndex: number;
|
|
16
20
|
register: (instance: HTMLButtonElement | null) => void;
|
package/cjs/tabs/Tabs.context.js
CHANGED
|
@@ -10,5 +10,6 @@ _b = (0, create_context_1.createContext)({
|
|
|
10
10
|
name: "TabsContext",
|
|
11
11
|
hookName: "useTabsContext",
|
|
12
12
|
providerName: "TabsProvider",
|
|
13
|
+
errorMessage: "Tabs.List, Tabs.Tag and Tabs.Panel needs to be wrapped within <Tabs>",
|
|
13
14
|
}), exports.TabsProvider = _b[0], exports.useTabsContext = _b[1];
|
|
14
15
|
//# sourceMappingURL=Tabs.context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.context.js","sourceRoot":"","sources":["../../src/tabs/Tabs.context.ts"],"names":[],"mappings":";;;;AAAA,2DAAuD;AACvD,2EAAkF;AAIrE,KAKT,IAAA,uCAAuB,GAAwC,EAJjE,+BAAuB,UACvB,iCAAyB,UACzB,0BAAkB,UAClB,yBAAiB,SACiD;AAQpE,mBAAmB;AACN,KAAiC,IAAA,8BAAa,EAAoB;IAC7E,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,gBAAgB;IAC1B,YAAY,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"Tabs.context.js","sourceRoot":"","sources":["../../src/tabs/Tabs.context.ts"],"names":[],"mappings":";;;;AAAA,2DAAuD;AACvD,2EAAkF;AAIrE,KAKT,IAAA,uCAAuB,GAAwC,EAJjE,+BAAuB,UACvB,iCAAyB,UACzB,0BAAkB,UAClB,yBAAiB,SACiD;AAQpE,mBAAmB;AACN,KAAiC,IAAA,8BAAa,EAAoB;IAC7E,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,gBAAgB;IAC1B,YAAY,EAAE,cAAc;IAC5B,YAAY,EACV,sEAAsE;CACzE,CAAC,EANY,oBAAY,UAAE,sBAAc,SAMvC"}
|
|
@@ -4,5 +4,5 @@ export declare const dayLabels: (start: Date, end: Date, totalDays: number, dire
|
|
|
4
4
|
export declare const monthLabels: (start: Date, end: Date, direction: "left" | "right", template?: string) => AxisLabel[];
|
|
5
5
|
export declare const yearLabels: (start: Date, end: Date, direction: "left" | "right", template?: string) => AxisLabel[];
|
|
6
6
|
export declare const AxisLabels: ({ templates, }: {
|
|
7
|
-
templates?: AxisLabelTemplates
|
|
7
|
+
templates?: AxisLabelTemplates;
|
|
8
8
|
}) => React.JSX.Element;
|
|
@@ -7,14 +7,18 @@ interface ToggleContextProps {
|
|
|
7
7
|
export declare const ToggleGroupContext: import("react").Context<ToggleContextProps | null>;
|
|
8
8
|
export declare const ToggleGroupDescendantsProvider: import("react").Provider<import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
9
9
|
value: string;
|
|
10
|
-
}>>, useToggleGroupDescendantsContext: () => import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
10
|
+
}>>, useToggleGroupDescendantsContext: <S extends boolean = true>(strict?: S) => S extends true ? import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
11
11
|
value: string;
|
|
12
|
-
}
|
|
12
|
+
}> : import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
13
|
+
value: string;
|
|
14
|
+
}> | undefined, useToggleGroupDescendants: () => import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
13
15
|
value: string;
|
|
14
16
|
}>, useToggleGroupDescendant: (options?: import("../util/hooks/descendants/descendant").DescendantOptions<{
|
|
15
17
|
value: string;
|
|
16
18
|
}> | undefined) => {
|
|
17
|
-
descendants: import("../util/hooks/descendants/descendant").DescendantsManager<
|
|
19
|
+
descendants: import("../util/hooks/descendants/descendant").DescendantsManager<HTMLButtonElement, {
|
|
20
|
+
value: string;
|
|
21
|
+
}>;
|
|
18
22
|
index: number;
|
|
19
23
|
enabledIndex: number;
|
|
20
24
|
register: (instance: HTMLButtonElement | null) => void;
|
|
@@ -12,5 +12,6 @@ _b = (0, create_context_1.createContext)({
|
|
|
12
12
|
name: "ToggleGroupContext",
|
|
13
13
|
hookName: "useToggleGroupContext",
|
|
14
14
|
providerName: "ToggleGroupProvider",
|
|
15
|
+
errorMessage: "<ToggleGroup.Item> needs to be wrapped within <ToggleGroup>",
|
|
15
16
|
}), exports.ToggleGroupProvider = _b[0], exports.useToggleGroupContext = _b[1];
|
|
16
17
|
//# sourceMappingURL=ToggleGroup.context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleGroup.context.js","sourceRoot":"","sources":["../../src/toggle-group/ToggleGroup.context.ts"],"names":[],"mappings":";;;;AAAA,iCAA4D;AAC5D,2DAAuD;AACvD,2EAAkF;AAQrE,QAAA,kBAAkB,GAAG,IAAA,qBAAkB,EAClD,IAAI,CACL,CAAC;AAEW,KAKT,IAAA,uCAAuB,GAAwC,EAJjE,sCAA8B,UAC9B,wCAAgC,UAChC,iCAAyB,UACzB,gCAAwB,SAC0C;AAKpE,mBAAmB;AACN,KACX,IAAA,8BAAa,EAA2B;IACtC,IAAI,EAAE,oBAAoB;IAC1B,QAAQ,EAAE,uBAAuB;IACjC,YAAY,EAAE,qBAAqB;
|
|
1
|
+
{"version":3,"file":"ToggleGroup.context.js","sourceRoot":"","sources":["../../src/toggle-group/ToggleGroup.context.ts"],"names":[],"mappings":";;;;AAAA,iCAA4D;AAC5D,2DAAuD;AACvD,2EAAkF;AAQrE,QAAA,kBAAkB,GAAG,IAAA,qBAAkB,EAClD,IAAI,CACL,CAAC;AAEW,KAKT,IAAA,uCAAuB,GAAwC,EAJjE,sCAA8B,UAC9B,wCAAgC,UAChC,iCAAyB,UACzB,gCAAwB,SAC0C;AAKpE,mBAAmB;AACN,KACX,IAAA,8BAAa,EAA2B;IACtC,IAAI,EAAE,oBAAoB;IAC1B,QAAQ,EAAE,uBAAuB;IACjC,YAAY,EAAE,qBAAqB;IACnC,YAAY,EAAE,6DAA6D;CAC5E,CAAC,EANU,2BAAmB,UAAE,6BAAqB,SAMnD"}
|
|
@@ -6,8 +6,8 @@ import { DescendantOptions, DescendantsManager } from "./descendant";
|
|
|
6
6
|
/**
|
|
7
7
|
* Provides strongly typed versions of the context provider and hooks above.
|
|
8
8
|
*/
|
|
9
|
-
export declare function createDescendantContext<T extends HTMLElement = HTMLElement, K extends Record<string, any> = object>(): readonly [React.Provider<DescendantsManager<T, K>>, () => DescendantsManager<T, K
|
|
10
|
-
descendants: DescendantsManager<
|
|
9
|
+
export declare function createDescendantContext<T extends HTMLElement = HTMLElement, K extends Record<string, any> = object>(): readonly [React.Provider<DescendantsManager<T, K>>, <S extends boolean = true>(strict?: S) => S extends true ? DescendantsManager<T, K> : DescendantsManager<T, K> | undefined, () => DescendantsManager<T, K>, (options?: DescendantOptions<K>) => {
|
|
10
|
+
descendants: DescendantsManager<T, K>;
|
|
11
11
|
index: number;
|
|
12
12
|
enabledIndex: number;
|
|
13
13
|
register: (instance: T | null) => void;
|
|
@@ -33,67 +33,64 @@ const useClientLayoutEffect_1 = require("../useClientLayoutEffect");
|
|
|
33
33
|
const useMergeRefs_1 = require("../useMergeRefs");
|
|
34
34
|
const descendant_1 = require("./descendant");
|
|
35
35
|
const utils_1 = require("./utils");
|
|
36
|
-
/**
|
|
37
|
-
* @internal
|
|
38
|
-
* Initializing DescendantsManager
|
|
39
|
-
*/
|
|
40
|
-
function useDescendants() {
|
|
41
|
-
const descendants = (0, react_1.useRef)(new descendant_1.DescendantsManager()).current;
|
|
42
|
-
return descendants;
|
|
43
|
-
}
|
|
44
|
-
const [DescendantsContextProvider, useDescendantsContext] = (0, create_context_1.createContext)({
|
|
45
|
-
name: "DescendantsProvider",
|
|
46
|
-
errorMessage: "useDescendantsContext must be used within DescendantsProvider",
|
|
47
|
-
});
|
|
48
|
-
/**
|
|
49
|
-
* @internal
|
|
50
|
-
* This hook provides information to descendant component:
|
|
51
|
-
* - Index compared to other descendants
|
|
52
|
-
* - ref callback to register the descendant
|
|
53
|
-
* - Its enabled index compared to other enabled descendants
|
|
54
|
-
*/
|
|
55
|
-
function useDescendant(options) {
|
|
56
|
-
const descendants = useDescendantsContext();
|
|
57
|
-
const [index, setIndex] = (0, react_1.useState)(-1);
|
|
58
|
-
const ref = (0, react_1.useRef)(null);
|
|
59
|
-
(0, useClientLayoutEffect_1.useClientLayoutEffect)(() => {
|
|
60
|
-
return () => {
|
|
61
|
-
if (!ref.current)
|
|
62
|
-
return;
|
|
63
|
-
descendants.unregister(ref.current);
|
|
64
|
-
};
|
|
65
|
-
}, []);
|
|
66
|
-
(0, useClientLayoutEffect_1.useClientLayoutEffect)(() => {
|
|
67
|
-
if (!ref.current)
|
|
68
|
-
return;
|
|
69
|
-
const dataIndex = Number(ref.current.dataset["index"]);
|
|
70
|
-
if (index != dataIndex && !Number.isNaN(dataIndex)) {
|
|
71
|
-
setIndex(dataIndex);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
const refCallback = options
|
|
75
|
-
? (0, utils_1.cast)(descendants.register(options))
|
|
76
|
-
: (0, utils_1.cast)(descendants.register);
|
|
77
|
-
return {
|
|
78
|
-
descendants,
|
|
79
|
-
index,
|
|
80
|
-
enabledIndex: descendants.enabledIndexOf(ref.current),
|
|
81
|
-
register: (0, useMergeRefs_1.mergeRefs)([refCallback, ref]),
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
36
|
/**
|
|
85
37
|
* Provides strongly typed versions of the context provider and hooks above.
|
|
86
38
|
*/
|
|
87
39
|
function createDescendantContext() {
|
|
40
|
+
const [DescendantsContextProvider, useDescendantsContext] = (0, create_context_1.createContext)({
|
|
41
|
+
name: "DescendantsProvider",
|
|
42
|
+
errorMessage: "useDescendantsContext must be used within DescendantsProvider",
|
|
43
|
+
});
|
|
88
44
|
const ContextProvider = (0, utils_1.cast)((props) => (react_1.default.createElement(DescendantsContextProvider, Object.assign({}, props.value), props.children)));
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
* This hook provides information to descendant component:
|
|
48
|
+
* - Index compared to other descendants
|
|
49
|
+
* - ref callback to register the descendant
|
|
50
|
+
* - Its enabled index compared to other enabled descendants
|
|
51
|
+
*/
|
|
52
|
+
function _useDescendant(options) {
|
|
53
|
+
const descendants = useDescendantsContext();
|
|
54
|
+
const [index, setIndex] = (0, react_1.useState)(-1);
|
|
55
|
+
const ref = (0, react_1.useRef)(null);
|
|
56
|
+
(0, useClientLayoutEffect_1.useClientLayoutEffect)(() => {
|
|
57
|
+
return () => {
|
|
58
|
+
if (!ref.current)
|
|
59
|
+
return;
|
|
60
|
+
descendants.unregister(ref.current);
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
63
|
+
(0, useClientLayoutEffect_1.useClientLayoutEffect)(() => {
|
|
64
|
+
if (!ref.current)
|
|
65
|
+
return;
|
|
66
|
+
const dataIndex = Number(ref.current.dataset["index"]);
|
|
67
|
+
if (index != dataIndex && !Number.isNaN(dataIndex)) {
|
|
68
|
+
setIndex(dataIndex);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const refCallback = options
|
|
72
|
+
? (0, utils_1.cast)(descendants.register(options))
|
|
73
|
+
: (0, utils_1.cast)(descendants.register);
|
|
74
|
+
return {
|
|
75
|
+
descendants,
|
|
76
|
+
index,
|
|
77
|
+
enabledIndex: descendants.enabledIndexOf(ref.current),
|
|
78
|
+
register: (0, useMergeRefs_1.mergeRefs)([refCallback, ref]),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
* Initializing DescendantsManager
|
|
84
|
+
*/
|
|
85
|
+
function _useDescendants() {
|
|
86
|
+
const descendants = (0, react_1.useRef)(new descendant_1.DescendantsManager()).current;
|
|
87
|
+
return descendants;
|
|
88
|
+
}
|
|
92
89
|
return [
|
|
93
90
|
// context provider
|
|
94
91
|
ContextProvider,
|
|
95
92
|
// call this when you need to read from context
|
|
96
|
-
|
|
93
|
+
useDescendantsContext,
|
|
97
94
|
// descendants state information, to be called and passed to `ContextProvider`
|
|
98
95
|
_useDescendants,
|
|
99
96
|
// descendant index information
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDescendant.js","sourceRoot":"","sources":["../../../../src/util/hooks/descendants/useDescendant.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,+CAAgD;AAChD,yDAAqD;AACrD,oEAAiE;AACjE,kDAA4C;AAC5C,6CAAqE;AACrE,mCAA+B;AAE/B
|
|
1
|
+
{"version":3,"file":"useDescendant.js","sourceRoot":"","sources":["../../../../src/util/hooks/descendants/useDescendant.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,+CAAgD;AAChD,yDAAqD;AACrD,oEAAiE;AACjE,kDAA4C;AAC5C,6CAAqE;AACrE,mCAA+B;AAE/B;;GAEG;AACH,SAAgB,uBAAuB;IAIrC,MAAM,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,GAAG,IAAA,8BAAa,EAEvE;QACA,IAAI,EAAE,qBAAqB;QAC3B,YAAY,EACV,+DAA+D;KAClE,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,IAAA,YAAI,EAC1B,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,8BAAC,0BAA0B,oBAAK,KAAK,CAAC,KAAK,GAC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AC;IACJ,CAAC;IAED;;;OAGG;IACH,SAAS,eAAe;QACtB,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,IAAI,+BAAkB,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,eAAe;QACf,+BAA+B;QAC/B,cAAc;KACN,CAAC;AACb,CAAC;AA/ED,0DA+EC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type AsChild = {
|
|
3
|
+
children: React.ReactElement;
|
|
4
|
+
/**
|
|
5
|
+
* Renders the children as a child of the component. Merges the props of the component with the props of the child.
|
|
6
|
+
*/
|
|
7
|
+
asChild: true;
|
|
8
|
+
} | {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Renders the children as a child of the component. Merges the props of the component with the props of the child.
|
|
12
|
+
*/
|
|
13
|
+
asChild?: false;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsChild.js","sourceRoot":"","sources":["../../../src/util/types/AsChild.ts"],"names":[],"mappings":""}
|
package/esm/chat/Chat.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
2
|
import Bubble from "./Bubble.js";
|
|
3
|
+
export declare const VARIANTS: readonly ["subtle", "info", "neutral"];
|
|
3
4
|
export declare const POSITIONS: readonly ["left", "right"];
|
|
4
5
|
export declare const SIZES: readonly ["medium", "small"];
|
|
5
6
|
export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -24,7 +25,7 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
25
|
* Avoid using the same background as the surface behind Chat.
|
|
25
26
|
* @default "neutral"
|
|
26
27
|
*/
|
|
27
|
-
variant?:
|
|
28
|
+
variant?: (typeof VARIANTS)[number];
|
|
28
29
|
/**
|
|
29
30
|
* Positions avatar and bubbles.
|
|
30
31
|
* @default "left"
|
package/esm/chat/Chat.js
CHANGED
|
@@ -13,6 +13,7 @@ import cl from "clsx";
|
|
|
13
13
|
import React, { forwardRef } from "react";
|
|
14
14
|
import { BodyLong } from "../typography/index.js";
|
|
15
15
|
import Bubble from "./Bubble.js";
|
|
16
|
+
export const VARIANTS = ["subtle", "info", "neutral"];
|
|
16
17
|
export const POSITIONS = ["left", "right"];
|
|
17
18
|
export const SIZES = ["medium", "small"];
|
|
18
19
|
/**
|
package/esm/chat/Chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../src/chat/Chat.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAkB,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AACpD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAC;AAoDlD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC5B,CACE,EAWY,EACZ,GAAG,EACH,EAAE;QAbF,EACE,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,GAAG,MAAM,EACjB,OAAO,GAAG,SAAS,EACnB,eAAe,EACf,IAAI,GAAG,QAAQ,OAEL,EADP,IAAI,cAVT,0GAWC,CADQ;IAGN,OAAA,CACH,2CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,Y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,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IACpD,KAAK,CAAC,KAAK,EACd,CACO,CACZ,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CACC,CACD,CACP,CAAA;CAAA,CACe,CAAC;AAEnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAErB,eAAe,IAAI,CAAC"}
|
|
@@ -22,7 +22,7 @@ export const DropdownCaption = ({ displayMonth, id }) => {
|
|
|
22
22
|
goToMonth(startOfMonth(min([max([newMonth, fromDate]), toDate])));
|
|
23
23
|
};
|
|
24
24
|
const handleMonthChange = (e) => goToMonth(setMonth(startOfMonth(displayMonth), Number(e.target.value)));
|
|
25
|
-
const years = getYears(fromDate, toDate, displayMonth.getFullYear());
|
|
25
|
+
const years = getYears(fromDate, toDate, displayMonth.getFullYear()).reverse();
|
|
26
26
|
const months = getMonths(fromDate, toDate, displayMonth);
|
|
27
27
|
const previousLabel = labelPrevious(previousMonth, { locale });
|
|
28
28
|
const nextLabel = labelNext(nextMonth, { locale });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownCaption.js","sourceRoot":"","sources":["../../../../src/date/datepicker/parts/DropdownCaption.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAgB,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAA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,CAAC"}
|
|
@@ -19,7 +19,7 @@ export const MonthCaption = () => {
|
|
|
19
19
|
if (!years.map((x) => x.getFullYear()).includes(year.getFullYear())) {
|
|
20
20
|
years.push(setYear(startOfYear(new Date()), year.getFullYear()));
|
|
21
21
|
}
|
|
22
|
-
years.sort((a, b) =>
|
|
22
|
+
years.sort((a, b) => b.getFullYear() - a.getFullYear());
|
|
23
23
|
}
|
|
24
24
|
const handleYearChange = (e) => toYear(setYear(startOfMonth(new Date()), Number(e.target.value)));
|
|
25
25
|
const handleButtonClick = (val) => {
|