@pismo/marola 1.2.0 → 2.0.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/dist/{Button-BAljjMv3.js → Button-cCziLrIy.js} +2 -2
- package/dist/{ClickAwayListener-DbEYZpyh.js → ClickAwayListener-CUayzVlD.js} +3 -3
- package/dist/Dialog.module-BtKUNFVu.js +13 -0
- package/dist/{Group-BKXO7GzU.js → Group-Cyc1W1kV.js} +1 -1
- package/dist/{Popup-Ck3XlWMq.js → Popup-C7AXLoP0.js} +5 -7
- package/dist/{Portal-oY3enyAm.js → Portal-CYV5TK_i.js} +2 -2
- package/dist/RadioButton.module-B4kmS66R.js +292 -0
- package/dist/SelectButton-k61YYjLu.js +58 -0
- package/dist/Tabs.module-DyJgAZt8.js +28 -0
- package/dist/{Toggle-Bkf8bKbA.js → Toggle-DEVeyo2f.js} +3 -3
- package/dist/assets/RadioButton.css +1 -1
- package/dist/assets/Tabs.css +1 -1
- package/dist/assets/Tooltip.css +1 -1
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/{combineHooksSlotProps-C-zYvfnF.js → combineHooksSlotProps-BCXoX9Nx.js} +20 -21
- package/dist/components/Adornment/Adornment.d.ts +2 -3
- package/dist/components/Adornment/Adornment.js +1 -1
- package/dist/components/Adornment/Adornment.stories.d.ts +0 -1
- package/dist/components/Advice/Advice.d.ts +2 -3
- package/dist/components/Advice/Advice.js +1 -1
- package/dist/components/Advice/Advice.stories.d.ts +0 -1
- package/dist/components/Alert/Alert.d.ts +0 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/Alert.stories.d.ts +0 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +1 -2
- package/dist/components/Autocomplete/Autocomplete.js +282 -298
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +0 -1
- package/dist/components/Avatar/Avatar.d.ts +0 -1
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +0 -1
- package/dist/components/Badge/Badge.d.ts +0 -1
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/Badge.stories.d.ts +1 -2
- package/dist/components/BankCard/BankCard.js +1 -1
- package/dist/components/BankCard/BankCard.stories.d.ts +0 -1
- package/dist/components/Button/Button.d.ts +2 -3
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Button/Button.stories.d.ts +1 -2
- package/dist/components/Calendar/Calendar.js +1 -1
- package/dist/components/Calendar/Calendar.stories.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -1
- package/dist/components/Chip/Chip.d.ts +1 -2
- package/dist/components/Chip/Chip.js +4 -4
- package/dist/components/Chip/Chip.stories.d.ts +0 -1
- package/dist/components/ConfirmationDialog/ConfirmationDialog.d.ts +0 -1
- package/dist/components/ConfirmationDialog/ConfirmationDialog.stories.d.ts +1 -2
- package/dist/components/Description/Description.d.ts +0 -1
- package/dist/components/Description/Description.js +27 -42
- package/dist/components/Description/Description.stories.d.ts +0 -1
- package/dist/components/Dialog/Actions.d.ts +0 -1
- package/dist/components/Dialog/Actions.js +1 -1
- package/dist/components/Dialog/Backdrop.d.ts +0 -1
- package/dist/components/Dialog/Backdrop.js +2 -2
- package/dist/components/Dialog/CloseIconButton.js +2 -2
- package/dist/components/Dialog/Content.d.ts +0 -1
- package/dist/components/Dialog/Dialog.d.ts +5 -6
- package/dist/components/Dialog/Dialog.js +6 -6
- package/dist/components/Dialog/Dialog.stories.d.ts +0 -1
- package/dist/components/Dialog/DialogTitle.d.ts +1 -2
- package/dist/components/Dialog/DialogTitle.js +1 -1
- package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +0 -1
- package/dist/components/EllipsisTooltip/EllipsisTooltip.js +1 -1
- package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +9 -5
- package/dist/components/Icon/Icon.d.ts +0 -1
- package/dist/components/Icon/Icon.stories.d.ts +1 -2
- package/dist/components/IconButton/Icon.stories.d.ts +0 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -2
- package/dist/components/IconButton/IconButton.js +2 -2
- package/dist/components/Input/Input.d.ts +0 -1
- package/dist/components/Input/Input.js +259 -274
- package/dist/components/Input/Input.stories.d.ts +0 -1
- package/dist/components/InputSearch/InputSearch.d.ts +0 -1
- package/dist/components/InputSearch/InputSearch.js +1 -1
- package/dist/components/InputSearch/InputSearch.stories.d.ts +0 -1
- package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +0 -1
- package/dist/components/PageHeader/PageHeader.d.ts +1 -2
- package/dist/components/PageHeader/PageHeader.js +65 -80
- package/dist/components/PageHeader/PageHeader.stories.d.ts +0 -1
- package/dist/components/Pagination/Pagination.d.ts +0 -1
- package/dist/components/Pagination/Pagination.js +43 -58
- package/dist/components/Pagination/Pagination.stories.d.ts +1 -2
- package/dist/components/Popover/Popover.d.ts +0 -1
- package/dist/components/Popover/Popover.js +3 -3
- package/dist/components/Popover/Popover.stories.d.ts +1 -2
- package/dist/components/RadioButton/RadioButton.d.ts +7 -4
- package/dist/components/RadioButton/RadioButton.js +911 -33
- package/dist/components/RadioButton/RadioButton.stories.d.ts +7 -13
- package/dist/components/RadioButton/RadioOption.d.ts +13 -0
- package/dist/components/RadioButton/RadioOption.js +438 -0
- package/dist/components/ResultWithChips/ResultWithChips.d.ts +0 -1
- package/dist/components/ResultWithChips/ResultWithChips.js +1 -1
- package/dist/components/RowItem/RowItem.d.ts +2 -3
- package/dist/components/RowItem/RowItem.js +3 -3
- package/dist/components/RowItem/RowItem.stories.d.ts +0 -1
- package/dist/components/Select/Select.d.ts +0 -1
- package/dist/components/Select/Select.js +21 -21
- package/dist/components/Select/Select.stories.d.ts +1 -2
- package/dist/components/Select/SelectButton.d.ts +0 -1
- package/dist/components/Select/SelectButton.js +2 -2
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -1
- package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +0 -1
- package/dist/components/Skeleton/SkeletonTable.stories.d.ts +0 -1
- package/dist/components/Snackbar/Snackbar.d.ts +0 -1
- package/dist/components/Snackbar/Snackbar.js +7 -8
- package/dist/components/Snackbar/Snackbar.stories.d.ts +1 -2
- package/dist/components/SortTooltip/SortTooltip.d.ts +0 -1
- package/dist/components/SortTooltip/SortTooltip.js +34 -51
- package/dist/components/Stepper/Stepper.d.ts +0 -1
- package/dist/components/Stepper/Stepper.js +19 -34
- package/dist/components/Stepper/Stepper.stories.d.ts +1 -2
- package/dist/components/StepperNavigator/StepperNavigator.js +1 -1
- package/dist/components/StepperNavigator/StepperNavigator.stories.d.ts +0 -1
- package/dist/components/Table/Table.d.ts +3 -4
- package/dist/components/Table/Table.js +1 -1
- package/dist/components/Table/Table.stories.d.ts +0 -1
- package/dist/components/Table/TableContext.d.ts +2 -3
- package/dist/components/Table/TableContext.js +4 -4
- package/dist/components/Table/_Table.TBody.stories.d.ts +1 -2
- package/dist/components/Table/_Table.THead.stories.d.ts +1 -2
- package/dist/components/Table/_Table.Td.stories.d.ts +1 -2
- package/dist/components/Table/_Table.Th.stories.d.ts +1 -2
- package/dist/components/Table/_Table.Tr.stories.d.ts +1 -2
- package/dist/components/Tabs/Tab.d.ts +1 -2
- package/dist/components/Tabs/Tab.js +5 -5
- package/dist/components/Tabs/Tab.stories.d.ts +1 -2
- package/dist/components/Tabs/TabPanel.d.ts +0 -1
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/TabPanel.stories.d.ts +1 -2
- package/dist/components/Tabs/Tabs.d.ts +0 -1
- package/dist/components/Tabs/Tabs.js +5 -5
- package/dist/components/Tabs/Tabs.stories.d.ts +1 -2
- package/dist/components/Tag/Tag.d.ts +0 -1
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Tag/Tag.stories.d.ts +1 -2
- package/dist/components/TextDisplay/TextDisplay.d.ts +1 -2
- package/dist/components/TextDisplay/TextDisplay.js +1 -1
- package/dist/components/TextDisplay/TextDisplay.stories.d.ts +0 -1
- package/dist/components/ToastCard/ToastCard.d.ts +0 -1
- package/dist/components/ToastCard/ToastCard.js +1 -1
- package/dist/components/ToastCard/ToastCard.stories.d.ts +0 -1
- package/dist/components/Toggle/Toggle.d.ts +0 -1
- package/dist/components/Toggle/Toggle.js +102 -117
- package/dist/components/Toggle/Toggle.stories.d.ts +0 -1
- package/dist/components/ToggleGroup/Group.d.ts +1 -2
- package/dist/components/ToggleGroup/Group.js +2 -2
- package/dist/components/ToggleGroup/Toggle.js +3 -3
- package/dist/components/ToggleGroup/ToggleGroup.js +2 -2
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +2 -3
- package/dist/components/Tooltip/Tooltip.d.ts +13 -9
- package/dist/components/Tooltip/Tooltip.js +146 -105
- package/dist/components/Tooltip/Tooltip.stories.d.ts +18 -10
- package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/components/TransactionRow/TransactionRow.d.ts +0 -1
- package/dist/components/TransactionRow/TransactionRow.stories.d.ts +0 -1
- package/dist/components/Typography/Typography.d.ts +0 -1
- package/dist/components/Typography/Typography.js +1 -1
- package/dist/components/Typography/Typography.stories.d.ts +0 -1
- package/dist/contexts/SnackbarProvider/SnackbarProvider.d.ts +0 -1
- package/dist/contexts/SnackbarProvider/SnackbarProvider.js +5 -5
- package/dist/contexts/SnackbarProvider/SnackbarProvider.stories.d.ts +1 -2
- package/dist/{index-bQFToy-I.js → index-CATDT7fJ.js} +7927 -8368
- package/dist/main.js +2 -2
- package/dist/{ownerDocument-YGhwAnr1.js → ownerDocument-CAHSRRik.js} +1 -1
- package/dist/{useButton-DcihopJG.js → useButton-eF8MXAli.js} +1 -1
- package/dist/{useList-B9C55YB7.js → useList-CPY2roI7.js} +3 -4
- package/dist/{useSlotProps-C_I1kEHr.js → useSlotProps-DSnfx453.js} +123 -126
- package/dist/utils/inputNumberAsText.d.ts +0 -1
- package/dist/utils/inputNumberAsText.js +2 -4
- package/dist/utils/styleStrings.d.ts +0 -1
- package/package.json +2 -1
- package/dist/Dialog.module-CE1Q-5tJ.js +0 -28
- package/dist/SelectButton-DbiTJagF.js +0 -74
- package/dist/Tabs.module-CF9eCJzU.js +0 -28
- package/dist/clsx-DB4S2d7J.js +0 -22
|
@@ -1,40 +1,918 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsx as V, jsxs as le, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
+
import * as f from "react";
|
|
3
|
+
import { useState as Ve, useEffect as Se } from "react";
|
|
4
|
+
import { c as Q } from "../../clsx-OuTLNxxd.js";
|
|
5
|
+
import { Icon as De } from "../Icon/Icon.js";
|
|
6
|
+
import { Typography as Me } from "../Typography/Typography.js";
|
|
7
|
+
import "../Input/Input.js";
|
|
8
|
+
import "../Avatar/Avatar.js";
|
|
9
|
+
import "../Button/Button.js";
|
|
10
|
+
import "../../Toggle-DEVeyo2f.js";
|
|
11
|
+
import "../Dialog/Dialog.js";
|
|
12
|
+
import "../IconButton/IconButton.js";
|
|
13
|
+
import "../InputSearch/InputSearch.js";
|
|
14
|
+
import "../Select/Select.js";
|
|
15
|
+
import "../Popover/Popover.js";
|
|
16
|
+
import "../Table/Table.js";
|
|
17
|
+
import "../Tabs/Tabs.js";
|
|
18
|
+
import "../../Group-Cyc1W1kV.js";
|
|
19
|
+
import "../../contexts/SnackbarProvider/SnackbarProvider.js";
|
|
20
|
+
import { u as ne, C as Te, e as Y, b as oe, m as G, D as xe, c as _e, g as Ae, h as ce, j as Pe, r as ke, R as ve, i as He, s as P } from "../../RadioButton.module-B4kmS66R.js";
|
|
21
|
+
import { P as d } from "../../useSlotProps-DSnfx453.js";
|
|
22
|
+
import { r as Ke } from "../../index-CATDT7fJ.js";
|
|
23
|
+
const Le = Object.is;
|
|
24
|
+
function Ge(e, t) {
|
|
25
|
+
if (e === t)
|
|
26
|
+
return !0;
|
|
27
|
+
if (!(e instanceof Object) || !(t instanceof Object))
|
|
28
|
+
return !1;
|
|
29
|
+
let o = 0, r = 0;
|
|
30
|
+
for (const n in e)
|
|
31
|
+
if (o += 1, !Le(e[n], t[n]) || !(n in t))
|
|
32
|
+
return !1;
|
|
33
|
+
for (const n in t)
|
|
34
|
+
r += 1;
|
|
35
|
+
return o === r;
|
|
36
|
+
}
|
|
37
|
+
function ze(e, t) {
|
|
38
|
+
const o = e.compareDocumentPosition(t);
|
|
39
|
+
return o & Node.DOCUMENT_POSITION_FOLLOWING || o & Node.DOCUMENT_POSITION_CONTAINED_BY ? -1 : o & Node.DOCUMENT_POSITION_PRECEDING || o & Node.DOCUMENT_POSITION_CONTAINS ? 1 : 0;
|
|
40
|
+
}
|
|
41
|
+
function Fe(e, t) {
|
|
42
|
+
if (e.size !== t.size)
|
|
43
|
+
return !1;
|
|
44
|
+
for (const [o, r] of e.entries()) {
|
|
45
|
+
const n = t.get(o);
|
|
46
|
+
if ((r == null ? void 0 : r.index) !== (n == null ? void 0 : n.index) || n !== void 0 && !Ge(r, n))
|
|
47
|
+
return !1;
|
|
48
|
+
}
|
|
49
|
+
return !0;
|
|
50
|
+
}
|
|
51
|
+
function de(e) {
|
|
52
|
+
const {
|
|
53
|
+
children: t,
|
|
54
|
+
elementsRef: o,
|
|
55
|
+
labelsRef: r,
|
|
56
|
+
onMapChange: n
|
|
57
|
+
} = e, [u, l] = f.useState(() => /* @__PURE__ */ new Map()), g = f.useCallback((s, i) => {
|
|
58
|
+
l((c) => new Map(c).set(s, i ?? null));
|
|
59
|
+
}, []), a = f.useCallback((s) => {
|
|
60
|
+
l((i) => {
|
|
61
|
+
const c = new Map(i);
|
|
62
|
+
return c.delete(s), c;
|
|
63
|
+
});
|
|
64
|
+
}, []);
|
|
65
|
+
ne(() => {
|
|
66
|
+
const s = new Map(u);
|
|
67
|
+
Array.from(s.keys()).sort(ze).forEach((c, m) => {
|
|
68
|
+
const y = u.get(c) ?? {};
|
|
69
|
+
s.set(c, {
|
|
70
|
+
...y,
|
|
71
|
+
index: m
|
|
72
|
+
});
|
|
73
|
+
}), Fe(u, s) || (l(s), n == null || n(s));
|
|
74
|
+
}, [u, n]);
|
|
75
|
+
const p = f.useMemo(() => ({
|
|
76
|
+
register: g,
|
|
77
|
+
unregister: a,
|
|
78
|
+
map: u,
|
|
79
|
+
elementsRef: o,
|
|
80
|
+
labelsRef: r
|
|
81
|
+
}), [g, a, u, o, r]);
|
|
82
|
+
return /* @__PURE__ */ V(Te.Provider, {
|
|
83
|
+
value: p,
|
|
84
|
+
children: t
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
process.env.NODE_ENV !== "production" && (de.propTypes = {
|
|
88
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
89
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
90
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
91
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
92
|
+
/**
|
|
93
|
+
* @ignore
|
|
94
|
+
*/
|
|
95
|
+
children: d.node,
|
|
96
|
+
/**
|
|
97
|
+
* A ref to the list of HTML elements, ordered by their index.
|
|
98
|
+
* `useListNavigation`'s `listRef` prop.
|
|
99
|
+
*/
|
|
100
|
+
elementsRef: d.any,
|
|
101
|
+
/**
|
|
102
|
+
* A ref to the list of element labels, ordered by their index.
|
|
103
|
+
* `useTypeahead`'s `listRef` prop.
|
|
104
|
+
*/
|
|
105
|
+
labelsRef: d.shape({
|
|
106
|
+
current: d.arrayOf(d.string).isRequired
|
|
107
|
+
}),
|
|
108
|
+
/**
|
|
109
|
+
* @ignore
|
|
110
|
+
*/
|
|
111
|
+
onMapChange: d.func
|
|
112
|
+
});
|
|
113
|
+
const fe = /* @__PURE__ */ f.createContext(void 0);
|
|
114
|
+
process.env.NODE_ENV !== "production" && (fe.displayName = "DirectionContext");
|
|
115
|
+
function je(e = !0) {
|
|
116
|
+
const t = f.useContext(fe);
|
|
117
|
+
if (t === void 0 && !e)
|
|
118
|
+
throw new Error("Base UI: DirectionContext is missing.");
|
|
119
|
+
return (t == null ? void 0 : t.direction) ?? "ltr";
|
|
120
|
+
}
|
|
121
|
+
function Ue({
|
|
122
|
+
controlled: e,
|
|
123
|
+
default: t,
|
|
124
|
+
name: o,
|
|
125
|
+
state: r = "value"
|
|
126
|
+
}) {
|
|
127
|
+
const {
|
|
128
|
+
current: n
|
|
129
|
+
} = f.useRef(e !== void 0), [u, l] = f.useState(t), g = n ? e : u;
|
|
130
|
+
if (process.env.NODE_ENV !== "production") {
|
|
131
|
+
f.useEffect(() => {
|
|
132
|
+
n !== (e !== void 0) && console.error([`Base UI: A component is changing the ${n ? "" : "un"}controlled ${r} state of ${o} to be ${n ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
|
|
133
|
+
`));
|
|
134
|
+
}, [r, o, e]);
|
|
135
|
+
const {
|
|
136
|
+
current: p
|
|
137
|
+
} = f.useRef(t);
|
|
138
|
+
f.useEffect(() => {
|
|
139
|
+
!n && !Object.is(p, t) && console.error([`Base UI: A component is changing the default ${r} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
|
|
140
|
+
`));
|
|
141
|
+
}, [JSON.stringify(t)]);
|
|
142
|
+
}
|
|
143
|
+
const a = f.useCallback((p) => {
|
|
144
|
+
n || l(p);
|
|
145
|
+
}, []);
|
|
146
|
+
return [g, a];
|
|
147
|
+
}
|
|
148
|
+
let ee = null, te;
|
|
149
|
+
function $e() {
|
|
150
|
+
return ee == null && (ee = document.createElement("div")), te === void 0 && (te = ee.computedStyleMap !== void 0), te;
|
|
151
|
+
}
|
|
152
|
+
function We(e) {
|
|
153
|
+
return e && e.ownerDocument || document;
|
|
154
|
+
}
|
|
155
|
+
function Be(e) {
|
|
156
|
+
return We(e).defaultView || window;
|
|
157
|
+
}
|
|
158
|
+
const z = "ArrowUp", k = "ArrowDown", v = "ArrowLeft", x = "ArrowRight", q = "Home", J = "End", ge = [v, x], Ye = [v, x, q, J], he = [z, k], qe = [z, k, q, J], me = [...ge, ...he], Je = [...me, q, J];
|
|
159
|
+
function U(e) {
|
|
160
|
+
e.preventDefault(), e.stopPropagation();
|
|
161
|
+
}
|
|
162
|
+
function $(e, t, o) {
|
|
163
|
+
return Math.floor(e / t) !== o;
|
|
164
|
+
}
|
|
165
|
+
function W(e, t) {
|
|
166
|
+
return t < 0 || t >= e.current.length;
|
|
167
|
+
}
|
|
168
|
+
function Xe(e, t) {
|
|
169
|
+
return N(e, {
|
|
170
|
+
disabledIndices: t
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function Ze(e, t) {
|
|
174
|
+
return N(e, {
|
|
175
|
+
decrement: !0,
|
|
176
|
+
startingIndex: e.current.length,
|
|
177
|
+
disabledIndices: t
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function N(e, {
|
|
181
|
+
startingIndex: t = -1,
|
|
182
|
+
decrement: o = !1,
|
|
183
|
+
disabledIndices: r,
|
|
184
|
+
amount: n = 1
|
|
185
|
+
} = {}) {
|
|
186
|
+
const u = e.current;
|
|
187
|
+
let l = t;
|
|
188
|
+
do
|
|
189
|
+
l += o ? -n : n;
|
|
190
|
+
while (l >= 0 && l <= u.length - 1 && B(u, l, r));
|
|
191
|
+
return l;
|
|
192
|
+
}
|
|
193
|
+
function Qe(e, {
|
|
194
|
+
event: t,
|
|
195
|
+
orientation: o,
|
|
196
|
+
loop: r,
|
|
197
|
+
cols: n,
|
|
198
|
+
disabledIndices: u,
|
|
199
|
+
minIndex: l,
|
|
200
|
+
maxIndex: g,
|
|
201
|
+
prevIndex: a,
|
|
202
|
+
rtl: p,
|
|
203
|
+
stopEvent: s = !1
|
|
204
|
+
}) {
|
|
205
|
+
let i = a;
|
|
206
|
+
if (t.key === z) {
|
|
207
|
+
if (s && U(t), a === -1)
|
|
208
|
+
i = g;
|
|
209
|
+
else if (i = N(e, {
|
|
210
|
+
startingIndex: i,
|
|
211
|
+
amount: n,
|
|
212
|
+
decrement: !0,
|
|
213
|
+
disabledIndices: u
|
|
214
|
+
}), r && (a - n < l || i < 0)) {
|
|
215
|
+
const c = a % n, m = g % n, y = g - (m - c);
|
|
216
|
+
m === c ? i = g : i = m > c ? y : y - n;
|
|
217
|
+
}
|
|
218
|
+
W(e, i) && (i = a);
|
|
219
|
+
}
|
|
220
|
+
if (t.key === k && (s && U(t), a === -1 ? i = l : (i = N(e, {
|
|
221
|
+
startingIndex: a,
|
|
222
|
+
amount: n,
|
|
223
|
+
disabledIndices: u
|
|
224
|
+
}), r && a + n > g && (i = N(e, {
|
|
225
|
+
startingIndex: a % n - n,
|
|
226
|
+
amount: n,
|
|
227
|
+
disabledIndices: u
|
|
228
|
+
}))), W(e, i) && (i = a)), o === "both") {
|
|
229
|
+
const c = p ? v : x, m = p ? x : v, y = Math.floor(a / n);
|
|
230
|
+
t.key === c && (s && U(t), a % n !== n - 1 ? (i = N(e, {
|
|
231
|
+
startingIndex: a,
|
|
232
|
+
disabledIndices: u
|
|
233
|
+
}), r && $(i, n, y) && (i = N(e, {
|
|
234
|
+
startingIndex: a - a % n - 1,
|
|
235
|
+
disabledIndices: u
|
|
236
|
+
}))) : r && (i = N(e, {
|
|
237
|
+
startingIndex: a - a % n - 1,
|
|
238
|
+
disabledIndices: u
|
|
239
|
+
})), $(i, n, y) && (i = a)), t.key === m && (s && U(t), a % n !== 0 ? (i = N(e, {
|
|
240
|
+
startingIndex: a,
|
|
241
|
+
decrement: !0,
|
|
242
|
+
disabledIndices: u
|
|
243
|
+
}), r && $(i, n, y) && (i = N(e, {
|
|
244
|
+
startingIndex: a + (n - a % n),
|
|
245
|
+
decrement: !0,
|
|
246
|
+
disabledIndices: u
|
|
247
|
+
}))) : r && (i = N(e, {
|
|
248
|
+
startingIndex: a + (n - a % n),
|
|
249
|
+
decrement: !0,
|
|
250
|
+
disabledIndices: u
|
|
251
|
+
})), $(i, n, y) && (i = a));
|
|
252
|
+
const C = Math.floor(g / n) === y;
|
|
253
|
+
W(e, i) && (r && C ? i = t.key === m ? g : N(e, {
|
|
254
|
+
startingIndex: a - a % n - 1,
|
|
255
|
+
disabledIndices: u
|
|
256
|
+
}) : i = a);
|
|
257
|
+
}
|
|
258
|
+
return i;
|
|
259
|
+
}
|
|
260
|
+
function et(e, t, o) {
|
|
261
|
+
const r = [];
|
|
262
|
+
let n = 0;
|
|
263
|
+
return e.forEach(({
|
|
264
|
+
width: u,
|
|
265
|
+
height: l
|
|
266
|
+
}, g) => {
|
|
267
|
+
if (u > t && process.env.NODE_ENV !== "production")
|
|
268
|
+
throw new Error(`[Base UI]: Invalid grid - item width at index ${g} is greater than grid columns`);
|
|
269
|
+
let a = !1;
|
|
270
|
+
for (o && (n = 0); !a; ) {
|
|
271
|
+
const p = [];
|
|
272
|
+
for (let s = 0; s < u; s += 1)
|
|
273
|
+
for (let i = 0; i < l; i += 1)
|
|
274
|
+
p.push(n + s + i * t);
|
|
275
|
+
n % t + u <= t && p.every((s) => r[s] == null) ? (p.forEach((s) => {
|
|
276
|
+
r[s] = g;
|
|
277
|
+
}), a = !0) : n += 1;
|
|
278
|
+
}
|
|
279
|
+
}), [...r];
|
|
280
|
+
}
|
|
281
|
+
function tt(e, t, o, r, n) {
|
|
282
|
+
if (e === -1)
|
|
283
|
+
return -1;
|
|
284
|
+
const u = o.indexOf(e), l = t[e];
|
|
285
|
+
switch (n) {
|
|
286
|
+
case "tl":
|
|
287
|
+
return u;
|
|
288
|
+
case "tr":
|
|
289
|
+
return l ? u + l.width - 1 : u;
|
|
290
|
+
case "bl":
|
|
291
|
+
return l ? u + (l.height - 1) * r : u;
|
|
292
|
+
case "br":
|
|
293
|
+
return o.lastIndexOf(e);
|
|
294
|
+
default:
|
|
295
|
+
return -1;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function nt(e, t) {
|
|
299
|
+
return t.flatMap((o, r) => e.includes(o) ? [r] : []);
|
|
300
|
+
}
|
|
301
|
+
function B(e, t, o) {
|
|
302
|
+
if (o)
|
|
303
|
+
return o.includes(t);
|
|
304
|
+
const r = e[t];
|
|
305
|
+
return r == null || r.hasAttribute("disabled") || r.getAttribute("aria-disabled") === "true";
|
|
306
|
+
}
|
|
307
|
+
function ot(e) {
|
|
308
|
+
if ($e()) {
|
|
309
|
+
const t = e.computedStyleMap().get("direction");
|
|
310
|
+
return t == null ? void 0 : t.value;
|
|
311
|
+
}
|
|
312
|
+
return Be(e).getComputedStyle(e).direction;
|
|
313
|
+
}
|
|
314
|
+
let se = 0;
|
|
315
|
+
function rt(e, t = "mui") {
|
|
316
|
+
const [o, r] = f.useState(e), n = e || o;
|
|
317
|
+
return f.useEffect(() => {
|
|
318
|
+
o == null && (se += 1, r(`${t}-${se}`));
|
|
319
|
+
}, [o, t]), n;
|
|
320
|
+
}
|
|
321
|
+
const it = {
|
|
322
|
+
...f
|
|
323
|
+
}, ue = it.useId;
|
|
324
|
+
function at(e, t) {
|
|
325
|
+
if (ue !== void 0) {
|
|
326
|
+
const o = ue();
|
|
327
|
+
return `${t}-${o}`;
|
|
328
|
+
}
|
|
329
|
+
return rt(e, t);
|
|
330
|
+
}
|
|
331
|
+
function st(e) {
|
|
332
|
+
return at(e, "base-ui");
|
|
333
|
+
}
|
|
334
|
+
function ut() {
|
|
335
|
+
return typeof window < "u";
|
|
336
|
+
}
|
|
337
|
+
function lt(e) {
|
|
338
|
+
var t;
|
|
339
|
+
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
340
|
+
}
|
|
341
|
+
function ct(e) {
|
|
342
|
+
return !ut() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof lt(e).ShadowRoot;
|
|
343
|
+
}
|
|
344
|
+
function dt(e, t) {
|
|
345
|
+
if (!e || !t)
|
|
346
|
+
return !1;
|
|
347
|
+
const o = t.getRootNode == null ? void 0 : t.getRootNode();
|
|
348
|
+
if (e.contains(t))
|
|
349
|
+
return !0;
|
|
350
|
+
if (o && ct(o)) {
|
|
351
|
+
let r = t;
|
|
352
|
+
for (; r; ) {
|
|
353
|
+
if (e === r)
|
|
354
|
+
return !0;
|
|
355
|
+
r = r.parentNode || r.host;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return !1;
|
|
359
|
+
}
|
|
360
|
+
const pe = /* @__PURE__ */ f.createContext({
|
|
361
|
+
formRef: {
|
|
362
|
+
current: {
|
|
363
|
+
fields: /* @__PURE__ */ new Map()
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
errors: {},
|
|
367
|
+
onClearErrors: () => {
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
process.env.NODE_ENV !== "production" && (pe.displayName = "FormContext");
|
|
371
|
+
function ye() {
|
|
372
|
+
return f.useContext(pe);
|
|
373
|
+
}
|
|
374
|
+
function Ce(e, t) {
|
|
375
|
+
return {
|
|
376
|
+
...e,
|
|
377
|
+
state: {
|
|
378
|
+
...e.state,
|
|
379
|
+
valid: !t && e.state.valid
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
const ft = Object.keys(xe);
|
|
384
|
+
function gt() {
|
|
385
|
+
const {
|
|
386
|
+
setValidityData: e,
|
|
387
|
+
validate: t,
|
|
388
|
+
messageIds: o,
|
|
389
|
+
validityData: r,
|
|
390
|
+
validationMode: n,
|
|
391
|
+
validationDebounceTime: u,
|
|
392
|
+
invalid: l,
|
|
393
|
+
markedDirtyRef: g,
|
|
394
|
+
controlId: a,
|
|
395
|
+
state: p
|
|
396
|
+
} = Y(), {
|
|
397
|
+
formRef: s
|
|
398
|
+
} = ye(), i = f.useRef(-1), c = f.useRef(null);
|
|
399
|
+
f.useEffect(() => () => {
|
|
400
|
+
window.clearTimeout(i.current);
|
|
401
|
+
}, []);
|
|
402
|
+
const m = oe(async (R) => {
|
|
403
|
+
const E = c.current;
|
|
404
|
+
if (!E)
|
|
405
|
+
return;
|
|
406
|
+
function O(S) {
|
|
407
|
+
return ft.reduce((T, b) => (T[b] = S.validity[b], !S.validity.customError && !g.current && (T[b] = b === "valid"), T), {});
|
|
408
|
+
}
|
|
409
|
+
window.clearTimeout(i.current);
|
|
410
|
+
const I = t(R);
|
|
411
|
+
let h = null;
|
|
412
|
+
typeof I == "object" && I !== null && "then" in I ? h = await I : h = I;
|
|
413
|
+
let M = "";
|
|
414
|
+
h !== null && (M = Array.isArray(h) ? h.join(`
|
|
415
|
+
`) : h), E.setCustomValidity(M);
|
|
416
|
+
const X = O(E);
|
|
417
|
+
let w = [];
|
|
418
|
+
Array.isArray(h) ? w = h : h ? w = [h] : E.validationMessage && (w = [E.validationMessage]);
|
|
419
|
+
const _ = {
|
|
420
|
+
value: R,
|
|
421
|
+
state: X,
|
|
422
|
+
error: Array.isArray(h) ? h[0] : h ?? E.validationMessage,
|
|
423
|
+
errors: w,
|
|
424
|
+
initialValue: r.initialValue
|
|
425
|
+
};
|
|
426
|
+
if (a) {
|
|
427
|
+
const S = s.current.fields.get(a);
|
|
428
|
+
S && s.current.fields.set(a, {
|
|
429
|
+
...S,
|
|
430
|
+
...Ce(_, l)
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
e(_);
|
|
434
|
+
}), y = f.useCallback((R = {}) => G(R, {
|
|
435
|
+
...o.length && {
|
|
436
|
+
"aria-describedby": o.join(" ")
|
|
437
|
+
},
|
|
438
|
+
...p.valid === !1 && {
|
|
439
|
+
"aria-invalid": !0
|
|
440
|
+
}
|
|
441
|
+
}), [o, p.valid]), C = f.useCallback((R = {}) => G(y(R), {
|
|
442
|
+
onChange(E) {
|
|
443
|
+
if (E.nativeEvent.defaultPrevented || l || n !== "onChange")
|
|
444
|
+
return;
|
|
445
|
+
const O = E.currentTarget;
|
|
446
|
+
if (O.value === "") {
|
|
447
|
+
m(O.value);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
window.clearTimeout(i.current), u ? i.current = window.setTimeout(() => {
|
|
451
|
+
m(O.value);
|
|
452
|
+
}, u) : m(O.value);
|
|
453
|
+
}
|
|
454
|
+
}), [y, l, n, u, m]);
|
|
455
|
+
return f.useMemo(() => ({
|
|
456
|
+
getValidationProps: y,
|
|
457
|
+
getInputValidationProps: C,
|
|
458
|
+
inputRef: c,
|
|
459
|
+
commitValidation: m
|
|
460
|
+
}), [y, C, m]);
|
|
461
|
+
}
|
|
462
|
+
function ht(e) {
|
|
463
|
+
const {
|
|
464
|
+
formRef: t
|
|
465
|
+
} = ye(), {
|
|
466
|
+
invalid: o,
|
|
467
|
+
markedDirtyRef: r,
|
|
468
|
+
validityData: n,
|
|
469
|
+
setValidityData: u
|
|
470
|
+
} = Y(), {
|
|
471
|
+
value: l,
|
|
472
|
+
id: g,
|
|
473
|
+
controlRef: a,
|
|
474
|
+
commitValidation: p
|
|
475
|
+
} = e, s = _e(e.getValue);
|
|
476
|
+
ne(() => {
|
|
477
|
+
var c;
|
|
478
|
+
let i = l;
|
|
479
|
+
i === void 0 && (i = (c = s.current) == null ? void 0 : c.call(s)), n.initialValue === null && i !== n.initialValue && u((m) => ({
|
|
480
|
+
...m,
|
|
481
|
+
initialValue: i
|
|
482
|
+
}));
|
|
483
|
+
}, [u, l, n.initialValue, s]), ne(() => {
|
|
484
|
+
g && t.current.fields.set(g, {
|
|
485
|
+
controlRef: a,
|
|
486
|
+
validityData: Ce(n, o),
|
|
487
|
+
validate() {
|
|
488
|
+
var c;
|
|
489
|
+
let i = l;
|
|
490
|
+
i === void 0 && (i = (c = s.current) == null ? void 0 : c.call(s)), r.current = !0, Ke.flushSync(() => p(i));
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}, [p, a, t, s, g, o, r, n, l]);
|
|
494
|
+
}
|
|
495
|
+
const L = void 0;
|
|
496
|
+
function mt(e) {
|
|
497
|
+
const {
|
|
498
|
+
itemSizes: t,
|
|
499
|
+
cols: o = 1,
|
|
500
|
+
loop: r = !0,
|
|
501
|
+
dense: n = !1,
|
|
502
|
+
orientation: u = "both",
|
|
503
|
+
direction: l,
|
|
504
|
+
highlightedIndex: g,
|
|
505
|
+
onHighlightedIndexChange: a,
|
|
506
|
+
rootRef: p,
|
|
507
|
+
enableHomeAndEndKeys: s = !1,
|
|
508
|
+
stopEventPropagation: i = !1
|
|
509
|
+
} = e, [c, m] = f.useState(0), y = o > 1, C = g ?? c, R = oe(a ?? m), E = f.useRef(l ?? null), O = f.useRef(null), I = Ae(O, p), h = f.useRef([]), M = f.useCallback((X = {}) => G(X, {
|
|
510
|
+
"aria-orientation": u === "both" ? void 0 : u,
|
|
511
|
+
ref: I,
|
|
512
|
+
onKeyDown(w) {
|
|
513
|
+
const _ = s ? Je : me;
|
|
514
|
+
if (!_.includes(w.key))
|
|
515
|
+
return;
|
|
516
|
+
const S = O.current;
|
|
517
|
+
if (!S)
|
|
518
|
+
return;
|
|
519
|
+
(E == null ? void 0 : E.current) == null && (E.current = ot(S));
|
|
520
|
+
const T = E.current === "rtl";
|
|
521
|
+
let b = C;
|
|
522
|
+
const F = Xe(h, L), j = Ze(h, L);
|
|
523
|
+
if (y) {
|
|
524
|
+
const H = t || Array.from({
|
|
525
|
+
length: h.current.length
|
|
526
|
+
}, () => ({
|
|
527
|
+
width: 1,
|
|
528
|
+
height: 1
|
|
529
|
+
})), A = et(H, o, n), we = A.findIndex((D) => D != null && !B(h.current, D, L)), Oe = A.reduce((D, K, Ie) => K != null && !B(h.current, K, L) ? Ie : D, -1);
|
|
530
|
+
b = A[Qe({
|
|
531
|
+
current: A.map((D) => D ? h.current[D] : null)
|
|
532
|
+
}, {
|
|
533
|
+
event: w,
|
|
534
|
+
orientation: u,
|
|
535
|
+
loop: r,
|
|
536
|
+
cols: o,
|
|
537
|
+
// treat undefined (empty grid spaces) as disabled indices so we
|
|
538
|
+
// don't end up in them
|
|
539
|
+
disabledIndices: nt([...h.current.map((D, K) => B(h.current, K) ? K : void 0), void 0], A),
|
|
540
|
+
minIndex: we,
|
|
541
|
+
maxIndex: Oe,
|
|
542
|
+
prevIndex: tt(
|
|
543
|
+
C > j ? F : C,
|
|
544
|
+
H,
|
|
545
|
+
A,
|
|
546
|
+
o,
|
|
547
|
+
// use a corner matching the edge closest to the direction we're
|
|
548
|
+
// moving in so we don't end up in the same item. Prefer
|
|
549
|
+
// top/left over bottom/right.
|
|
550
|
+
// eslint-disable-next-line no-nested-ternary
|
|
551
|
+
w.key === k ? "bl" : w.key === x ? "tr" : "tl"
|
|
552
|
+
),
|
|
553
|
+
rtl: T
|
|
554
|
+
})];
|
|
555
|
+
}
|
|
556
|
+
const re = T ? v : x, ie = {
|
|
557
|
+
horizontal: [re],
|
|
558
|
+
vertical: [k],
|
|
559
|
+
both: [re, k]
|
|
560
|
+
}[u], ae = T ? x : v, Z = {
|
|
561
|
+
horizontal: [ae],
|
|
562
|
+
vertical: [z],
|
|
563
|
+
both: [ae, z]
|
|
564
|
+
}[u], be = y ? _ : {
|
|
565
|
+
horizontal: s ? Ye : ge,
|
|
566
|
+
vertical: s ? qe : he,
|
|
567
|
+
both: _
|
|
568
|
+
}[u];
|
|
569
|
+
s && (w.key === q ? b = F : w.key === J && (b = j)), b === C && [...ie, ...Z].includes(w.key) && (r && b === j && ie.includes(w.key) ? b = F : r && b === F && Z.includes(w.key) ? b = j : b = N(h, {
|
|
570
|
+
startingIndex: b,
|
|
571
|
+
decrement: Z.includes(w.key),
|
|
572
|
+
disabledIndices: L
|
|
573
|
+
})), b !== C && !W(h, b) && (i && w.stopPropagation(), be.includes(w.key) && w.preventDefault(), R(b), queueMicrotask(() => {
|
|
574
|
+
var H;
|
|
575
|
+
(H = h.current[b]) == null || H.focus();
|
|
576
|
+
}));
|
|
577
|
+
}
|
|
578
|
+
}), [C, i, o, n, h, y, t, r, I, R, u, s]);
|
|
579
|
+
return f.useMemo(() => ({
|
|
580
|
+
getRootProps: M,
|
|
581
|
+
highlightedIndex: C,
|
|
582
|
+
onHighlightedIndexChange: R,
|
|
583
|
+
elementsRef: h
|
|
584
|
+
}), [M, C, R, h]);
|
|
585
|
+
}
|
|
586
|
+
function Ee(e) {
|
|
587
|
+
const {
|
|
588
|
+
render: t,
|
|
589
|
+
className: o,
|
|
590
|
+
highlightedIndex: r,
|
|
591
|
+
onHighlightedIndexChange: n,
|
|
592
|
+
orientation: u,
|
|
593
|
+
dense: l,
|
|
594
|
+
itemSizes: g,
|
|
595
|
+
loop: a,
|
|
596
|
+
cols: p,
|
|
597
|
+
direction: s,
|
|
598
|
+
enableHomeAndEndKeys: i,
|
|
599
|
+
onMapChange: c,
|
|
600
|
+
stopEventPropagation: m,
|
|
601
|
+
rootRef: y,
|
|
602
|
+
...C
|
|
603
|
+
} = e, {
|
|
604
|
+
getRootProps: R,
|
|
605
|
+
highlightedIndex: E,
|
|
606
|
+
onHighlightedIndexChange: O,
|
|
607
|
+
elementsRef: I
|
|
608
|
+
} = mt({
|
|
609
|
+
itemSizes: g,
|
|
610
|
+
cols: p,
|
|
611
|
+
loop: a,
|
|
612
|
+
dense: l,
|
|
613
|
+
orientation: u,
|
|
614
|
+
highlightedIndex: r,
|
|
615
|
+
onHighlightedIndexChange: n,
|
|
616
|
+
rootRef: y,
|
|
617
|
+
stopEventPropagation: m,
|
|
618
|
+
enableHomeAndEndKeys: i,
|
|
619
|
+
direction: s
|
|
620
|
+
}), {
|
|
621
|
+
renderElement: h
|
|
622
|
+
} = ce({
|
|
623
|
+
propGetter: R,
|
|
624
|
+
render: t ?? "div",
|
|
625
|
+
state: {},
|
|
626
|
+
className: o,
|
|
627
|
+
extraProps: C
|
|
628
|
+
}), M = f.useMemo(() => ({
|
|
629
|
+
highlightedIndex: E,
|
|
630
|
+
onHighlightedIndexChange: O
|
|
631
|
+
}), [E, O]);
|
|
632
|
+
return /* @__PURE__ */ V(Pe.Provider, {
|
|
633
|
+
value: M,
|
|
634
|
+
children: /* @__PURE__ */ V(de, {
|
|
635
|
+
elementsRef: I,
|
|
636
|
+
onMapChange: c,
|
|
637
|
+
children: h()
|
|
638
|
+
})
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
process.env.NODE_ENV !== "production" && (Ee.propTypes = {
|
|
642
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
643
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
644
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
645
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
646
|
+
/**
|
|
647
|
+
* @ignore
|
|
648
|
+
*/
|
|
649
|
+
children: d.node,
|
|
650
|
+
/**
|
|
651
|
+
* CSS class applied to the element, or a function that
|
|
652
|
+
* returns a class based on the component’s state.
|
|
653
|
+
*/
|
|
654
|
+
className: d.oneOfType([d.func, d.string]),
|
|
655
|
+
/**
|
|
656
|
+
* @ignore
|
|
657
|
+
*/
|
|
658
|
+
cols: d.number,
|
|
659
|
+
/**
|
|
660
|
+
* @ignore
|
|
661
|
+
*/
|
|
662
|
+
dense: d.bool,
|
|
663
|
+
/**
|
|
664
|
+
* @ignore
|
|
665
|
+
*/
|
|
666
|
+
direction: d.oneOf(["ltr", "rtl"]),
|
|
667
|
+
/**
|
|
668
|
+
* @ignore
|
|
669
|
+
*/
|
|
670
|
+
enableHomeAndEndKeys: d.bool,
|
|
671
|
+
/**
|
|
672
|
+
* @ignore
|
|
673
|
+
*/
|
|
674
|
+
highlightedIndex: d.number,
|
|
675
|
+
/**
|
|
676
|
+
* @ignore
|
|
677
|
+
*/
|
|
678
|
+
itemSizes: d.arrayOf(d.shape({
|
|
679
|
+
height: d.number.isRequired,
|
|
680
|
+
width: d.number.isRequired
|
|
681
|
+
})),
|
|
682
|
+
/**
|
|
683
|
+
* @ignore
|
|
684
|
+
*/
|
|
685
|
+
loop: d.bool,
|
|
686
|
+
/**
|
|
687
|
+
* @ignore
|
|
688
|
+
*/
|
|
689
|
+
onHighlightedIndexChange: d.func,
|
|
690
|
+
/**
|
|
691
|
+
* @ignore
|
|
692
|
+
*/
|
|
693
|
+
onMapChange: d.func,
|
|
694
|
+
/**
|
|
695
|
+
* @ignore
|
|
696
|
+
*/
|
|
697
|
+
orientation: d.oneOf(["both", "horizontal", "vertical"]),
|
|
698
|
+
/**
|
|
699
|
+
* Allows you to replace the component’s HTML element
|
|
700
|
+
* with a different tag, or compose it with another component.
|
|
701
|
+
*
|
|
702
|
+
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
703
|
+
*/
|
|
704
|
+
render: d.oneOfType([d.element, d.func]),
|
|
705
|
+
/**
|
|
706
|
+
* @ignore
|
|
707
|
+
*/
|
|
708
|
+
rootRef: ke,
|
|
709
|
+
/**
|
|
710
|
+
* @ignore
|
|
711
|
+
*/
|
|
712
|
+
stopEventPropagation: d.bool
|
|
713
|
+
});
|
|
714
|
+
function pt(e) {
|
|
715
|
+
const {
|
|
716
|
+
disabled: t = !1,
|
|
717
|
+
name: o,
|
|
718
|
+
defaultValue: r,
|
|
719
|
+
readOnly: n,
|
|
720
|
+
value: u
|
|
721
|
+
} = e, {
|
|
722
|
+
labelId: l,
|
|
723
|
+
setTouched: g,
|
|
724
|
+
setFocused: a,
|
|
725
|
+
validationMode: p
|
|
726
|
+
} = Y(), s = gt(), i = st(), [c, m] = Ue({
|
|
727
|
+
controlled: u,
|
|
728
|
+
default: r,
|
|
729
|
+
name: "RadioGroup",
|
|
730
|
+
state: "value"
|
|
731
|
+
});
|
|
732
|
+
ht({
|
|
733
|
+
id: i,
|
|
734
|
+
commitValidation: s.commitValidation,
|
|
735
|
+
value: c,
|
|
736
|
+
controlRef: s.inputRef
|
|
737
|
+
});
|
|
738
|
+
const [y, C] = f.useState(!1), R = f.useCallback((I = {}) => G(s.getValidationProps(I), {
|
|
739
|
+
role: "radiogroup",
|
|
740
|
+
"aria-disabled": t || void 0,
|
|
741
|
+
"aria-readonly": n || void 0,
|
|
742
|
+
"aria-labelledby": l,
|
|
743
|
+
onFocus() {
|
|
744
|
+
a(!0);
|
|
745
|
+
},
|
|
746
|
+
onBlur(h) {
|
|
747
|
+
dt(h.currentTarget, h.relatedTarget) || (g(!0), a(!1), p === "onBlur" && s.commitValidation(c));
|
|
748
|
+
},
|
|
749
|
+
onKeyDownCapture(h) {
|
|
750
|
+
h.key.startsWith("Arrow") && (g(!0), C(!0), a(!0));
|
|
751
|
+
}
|
|
752
|
+
}), [s, t, n, l, a, g, p, c]), E = f.useMemo(() => c == null ? "" : typeof c == "string" ? c : JSON.stringify(c), [c]), O = f.useCallback((I = {}) => G(s.getInputValidationProps(I), {
|
|
753
|
+
type: "hidden",
|
|
754
|
+
value: E,
|
|
755
|
+
ref: s.inputRef,
|
|
756
|
+
id: i,
|
|
757
|
+
name: o,
|
|
758
|
+
disabled: t,
|
|
759
|
+
readOnly: n
|
|
760
|
+
}), [s, E, i, o, t, n]);
|
|
761
|
+
return f.useMemo(() => ({
|
|
762
|
+
getRootProps: R,
|
|
763
|
+
getInputProps: O,
|
|
764
|
+
checkedValue: c,
|
|
765
|
+
setCheckedValue: m,
|
|
766
|
+
touched: y,
|
|
767
|
+
setTouched: C,
|
|
768
|
+
fieldControlValidation: s
|
|
769
|
+
}), [R, O, c, m, y, s]);
|
|
770
|
+
}
|
|
771
|
+
const Re = /* @__PURE__ */ f.forwardRef(function(t, o) {
|
|
772
|
+
const {
|
|
773
|
+
render: r,
|
|
774
|
+
className: n,
|
|
775
|
+
disabled: u,
|
|
776
|
+
readOnly: l,
|
|
777
|
+
required: g,
|
|
778
|
+
onValueChange: a,
|
|
779
|
+
name: p,
|
|
780
|
+
...s
|
|
781
|
+
} = t, i = je(), c = pt(t), {
|
|
782
|
+
state: m,
|
|
783
|
+
disabled: y
|
|
784
|
+
} = Y(), C = y || u, R = oe(a ?? (() => {
|
|
785
|
+
})), E = f.useMemo(() => ({
|
|
786
|
+
...m,
|
|
787
|
+
disabled: C ?? !1,
|
|
788
|
+
required: g ?? !1,
|
|
789
|
+
readOnly: l ?? !1
|
|
790
|
+
}), [m, C, l, g]), O = f.useMemo(() => ({
|
|
791
|
+
...m,
|
|
792
|
+
...c,
|
|
793
|
+
onValueChange: R,
|
|
794
|
+
disabled: C,
|
|
795
|
+
readOnly: l,
|
|
796
|
+
required: g
|
|
797
|
+
}), [m, C, R, c, l, g]), {
|
|
798
|
+
renderElement: I
|
|
799
|
+
} = ce({
|
|
800
|
+
propGetter: c.getRootProps,
|
|
801
|
+
render: r ?? "div",
|
|
802
|
+
ref: o,
|
|
803
|
+
className: n,
|
|
804
|
+
state: E,
|
|
805
|
+
extraProps: s,
|
|
806
|
+
customStyleHookMapping: He
|
|
807
|
+
});
|
|
808
|
+
return /* @__PURE__ */ le(ve.Provider, {
|
|
809
|
+
value: O,
|
|
810
|
+
children: [/* @__PURE__ */ V(Ee, {
|
|
811
|
+
direction: i,
|
|
812
|
+
enableHomeAndEndKeys: !1,
|
|
813
|
+
render: I()
|
|
814
|
+
}), /* @__PURE__ */ V("input", {
|
|
815
|
+
...c.getInputProps()
|
|
816
|
+
})]
|
|
817
|
+
});
|
|
818
|
+
});
|
|
819
|
+
process.env.NODE_ENV !== "production" && (Re.propTypes = {
|
|
820
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
821
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
822
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
823
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
824
|
+
/**
|
|
825
|
+
* @ignore
|
|
826
|
+
*/
|
|
827
|
+
children: d.node,
|
|
828
|
+
/**
|
|
829
|
+
* CSS class applied to the element, or a function that
|
|
830
|
+
* returns a class based on the component’s state.
|
|
831
|
+
*/
|
|
832
|
+
className: d.oneOfType([d.func, d.string]),
|
|
833
|
+
/**
|
|
834
|
+
* The uncontrolled value of the radio button that should be initially selected.
|
|
835
|
+
*
|
|
836
|
+
* To render a controlled radio group, use the `value` prop instead.
|
|
837
|
+
*/
|
|
838
|
+
defaultValue: d.any,
|
|
839
|
+
/**
|
|
840
|
+
* Whether the component should ignore user interaction.
|
|
841
|
+
* @default false
|
|
842
|
+
*/
|
|
843
|
+
disabled: d.bool,
|
|
844
|
+
/**
|
|
845
|
+
* Identifies the field when a form is submitted.
|
|
846
|
+
*/
|
|
847
|
+
name: d.string,
|
|
848
|
+
/**
|
|
849
|
+
* Callback fired when the value changes.
|
|
850
|
+
*/
|
|
851
|
+
onValueChange: d.func,
|
|
852
|
+
/**
|
|
853
|
+
* Whether the user should be unable to select a different radio button in the group.
|
|
854
|
+
* @default false
|
|
855
|
+
*/
|
|
856
|
+
readOnly: d.bool,
|
|
857
|
+
/**
|
|
858
|
+
* Allows you to replace the component’s HTML element
|
|
859
|
+
* with a different tag, or compose it with another component.
|
|
860
|
+
*
|
|
861
|
+
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
862
|
+
*/
|
|
863
|
+
render: d.oneOfType([d.element, d.func]),
|
|
864
|
+
/**
|
|
865
|
+
* Whether the user must choose a value before submitting a form.
|
|
866
|
+
* @default false
|
|
867
|
+
*/
|
|
868
|
+
required: d.bool,
|
|
869
|
+
/**
|
|
870
|
+
* The controlled value of the radio item that should be currently selected.
|
|
871
|
+
*
|
|
872
|
+
* To render an uncontrolled radio group, use the `defaultValue` prop instead.
|
|
873
|
+
*/
|
|
874
|
+
value: d.any
|
|
875
|
+
});
|
|
876
|
+
const Kt = ({
|
|
877
|
+
className: e,
|
|
878
|
+
name: t,
|
|
879
|
+
label: o,
|
|
880
|
+
disabled: r,
|
|
881
|
+
defaultValue: n,
|
|
882
|
+
checked: u,
|
|
883
|
+
"data-testid": l = "radio-button-group",
|
|
884
|
+
onChange: g,
|
|
885
|
+
children: a
|
|
21
886
|
}) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
887
|
+
a || console.error(
|
|
888
|
+
"[Marola - Radio Button component]A new component version using RadioGroup is available. Please use that instead."
|
|
889
|
+
);
|
|
890
|
+
const [p, s] = Ve(u), i = Q(P["legacy-radio--input"], r && P["legacy-radio--input__disabled"]), c = Q(P["legacy-radio--label"], r && P["legacy-radio--label__disabled"]), m = Q(P["legacy-radio"], r && P["legacy-radio--disabled"], e);
|
|
891
|
+
Se(() => {
|
|
892
|
+
s(u);
|
|
893
|
+
}, [u]);
|
|
894
|
+
const y = () => {
|
|
895
|
+
if (r)
|
|
28
896
|
return;
|
|
29
|
-
const
|
|
30
|
-
|
|
897
|
+
const C = !p;
|
|
898
|
+
s(C), g(C);
|
|
31
899
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
900
|
+
return a ? /* @__PURE__ */ V(Ne, { children: /* @__PURE__ */ V(
|
|
901
|
+
Re,
|
|
902
|
+
{
|
|
903
|
+
"data-testid": l,
|
|
904
|
+
onValueChange: g,
|
|
905
|
+
name: t,
|
|
906
|
+
defaultValue: n,
|
|
907
|
+
className: e,
|
|
908
|
+
children: a
|
|
909
|
+
}
|
|
910
|
+
) }) : /* @__PURE__ */ le("div", { "data-testid": l, onClick: () => y(), className: m, children: [
|
|
911
|
+
/* @__PURE__ */ V("input", { name: t, type: "radio", checked: p, readOnly: !0 }),
|
|
912
|
+
/* @__PURE__ */ V("span", { className: i, children: p && /* @__PURE__ */ V(De, { icon: "circle", color: "var(--accent)", size: 8 }) }),
|
|
913
|
+
/* @__PURE__ */ V(Me, { className: c, variant: "base-lg", children: o })
|
|
36
914
|
] });
|
|
37
915
|
};
|
|
38
916
|
export {
|
|
39
|
-
|
|
917
|
+
Kt as RadioButton
|
|
40
918
|
};
|