@kazee-ds/react 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -31
- package/dist/index.js +2457 -620
- package/dist/index.js.map +1 -1
- package/dist/types/Alert.d.ts +20 -4
- package/dist/types/Badge.d.ts +2 -1
- package/dist/types/Breadcrumb.d.ts +24 -2
- package/dist/types/Button.d.ts +3 -2
- package/dist/types/ButtonGroup.d.ts +4 -3
- package/dist/types/Card.d.ts +27 -2
- package/dist/types/Chart.d.ts +13 -2
- package/dist/types/Checkbox.d.ts +11 -2
- package/dist/types/Combobox.d.ts +13 -3
- package/dist/types/DataTable.d.ts +23 -2
- package/dist/types/DateRangePicker.d.ts +20 -2
- package/dist/types/Dialog.d.ts +20 -2
- package/dist/types/DropdownMenu.d.ts +21 -2
- package/dist/types/Empty.d.ts +12 -2
- package/dist/types/FieldComponent.d.ts +3 -2
- package/dist/types/Form.d.ts +3 -2
- package/dist/types/Input.d.ts +12 -2
- package/dist/types/Label.d.ts +4 -3
- package/dist/types/Listbox.d.ts +11 -2
- package/dist/types/NumberField.d.ts +12 -2
- package/dist/types/Pagination.d.ts +29 -2
- package/dist/types/Popover.d.ts +19 -2
- package/dist/types/RadioGroup.d.ts +12 -2
- package/dist/types/Select.d.ts +17 -5
- package/dist/types/SelectGroup.d.ts +3 -2
- package/dist/types/Separator.d.ts +2 -1
- package/dist/types/Sidebar.d.ts +16 -2
- package/dist/types/Skeleton.d.ts +2 -1
- package/dist/types/Spinner.d.ts +3 -2
- package/dist/types/Switch.d.ts +11 -2
- package/dist/types/Table.d.ts +16 -2
- package/dist/types/Tabs.d.ts +36 -3
- package/dist/types/Textarea.d.ts +13 -2
- package/dist/types/Toast.d.ts +31 -7
- package/dist/types/ToggleButton.d.ts +3 -2
- package/dist/types/ToggleButtonGroup.d.ts +2 -1
- package/dist/types/ToggleGroup.d.ts +18 -3
- package/dist/types/Tooltip.d.ts +12 -2
- package/dist/types/choice-composition.d.ts +32 -0
- package/dist/types/combobox-composition.d.ts +22 -0
- package/dist/types/control-composition.d.ts +72 -0
- package/dist/types/date-range-composition.d.ts +46 -0
- package/dist/types/field.d.ts +6 -1
- package/dist/types/index.d.ts +27 -0
- package/dist/types/label-context.d.ts +8 -0
- package/dist/types/layout-parts.d.ts +44 -0
- package/dist/types/number-composition.d.ts +24 -0
- package/dist/types/structural-parts.d.ts +56 -0
- package/dist/types/styling.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button as Button$1, ButtonContext } from "react-aria-components/Button";
|
|
3
|
-
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { Children, Fragment, cloneElement, createContext, createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { ProgressBarContext } from "react-aria-components/ProgressBar";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { ToggleButton as ToggleButton$1 } from "react-aria-components/ToggleButton";
|
|
7
7
|
import { ToggleButtonGroup as ToggleButtonGroup$1 } from "react-aria-components/ToggleButtonGroup";
|
|
8
8
|
import { I18nProvider, useLocale } from "react-aria-components/I18nProvider";
|
|
9
|
-
import { Button as Button$2, Label as Label$1, ListBox, ListBoxItem, Popover as Popover$1, Select as Select$1, SelectValue } from "react-aria-components/Select";
|
|
10
|
-
import {
|
|
9
|
+
import { Button as Button$2, Label as Label$1, ListBox as ListBox$1, ListBoxItem, Popover as Popover$1, Select as Select$1, SelectStateContext, SelectValue } from "react-aria-components/Select";
|
|
10
|
+
import { Popover as Popover$2 } from "react-aria-components/Popover";
|
|
11
|
+
import { ListBox as ListBox$2, ListBoxItem as ListBoxItem$1, ListBoxSection } from "react-aria-components/ListBox";
|
|
12
|
+
import { Text } from "react-aria-components/Text";
|
|
13
|
+
import { Header, Header as Header$1 } from "react-aria-components/Header";
|
|
14
|
+
import { FieldError as FieldError$1 } from "react-aria-components/FieldError";
|
|
15
|
+
import { FieldError as FieldError$2, Input as Input$1, Label as Label$2, Text as Text$1, TextArea, TextField } from "react-aria-components/TextField";
|
|
16
|
+
import { Group } from "react-aria-components/Group";
|
|
11
17
|
import { Label as Label$3 } from "react-aria-components/Label";
|
|
12
18
|
import { Checkbox as Checkbox$1 } from "react-aria-components/Checkbox";
|
|
19
|
+
import { FieldError as FieldError$3, SwitchButton, SwitchField, Text as Text$2 } from "react-aria-components/Switch";
|
|
13
20
|
import { Label as Label$4, Radio, RadioGroup as RadioGroup$1 } from "react-aria-components/RadioGroup";
|
|
14
|
-
import { FieldError as FieldError$1,
|
|
15
|
-
import {
|
|
16
|
-
import { Button as Button$3, FieldError as FieldError$2, Group, Input as Input$2, Label as Label$5, NumberField as NumberField$1, Text as Text$2 } from "react-aria-components/NumberField";
|
|
21
|
+
import { Button as Button$3, FieldError as FieldError$4, Group as Group$1, Input as Input$2, Label as Label$5, NumberField as NumberField$1, Text as Text$3 } from "react-aria-components/NumberField";
|
|
22
|
+
import { Button as Button$4, I18nProvider as I18nProvider$1, Text as Text$4, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastList, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion, composeRenderProps } from "react-aria-components";
|
|
17
23
|
import { Tab, TabList, TabPanel, Tabs as Tabs$1 } from "react-aria-components/Tabs";
|
|
18
24
|
import { Dialog as Dialog$1, DialogTrigger, Heading } from "react-aria-components/Dialog";
|
|
19
25
|
import { Modal, ModalOverlay } from "react-aria-components/Modal";
|
|
26
|
+
import { Tooltip as Tooltip$1, TooltipTrigger } from "react-aria-components/Tooltip";
|
|
20
27
|
import { Menu, MenuItem, MenuSection, MenuTrigger, SubmenuTrigger } from "react-aria-components/Menu";
|
|
21
|
-
import { Header } from "react-aria-components/Header";
|
|
22
28
|
import { Separator as Separator$1 } from "react-aria-components/Separator";
|
|
23
|
-
import { Popover as Popover$
|
|
24
|
-
import { Tooltip as Tooltip$1, TooltipTrigger } from "react-aria-components/Tooltip";
|
|
25
|
-
import { Button as Button$4, ComboBox, Input as Input$3, Label as Label$6, ListBox as ListBox$2, ListBoxItem as ListBoxItem$2, Popover as Popover$3 } from "react-aria-components/ComboBox";
|
|
29
|
+
import { Button as Button$5, ComboBox, ComboBoxStateContext, Input as Input$3, Label as Label$6, ListBox as ListBox$3, ListBoxItem as ListBoxItem$2, Popover as Popover$3 } from "react-aria-components/ComboBox";
|
|
26
30
|
import { CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, CalendarHeading, RangeCalendar, RangeCalendarStateContext } from "react-aria-components/RangeCalendar";
|
|
27
31
|
import { GregorianCalendar, endOfMonth, getLocalTimeZone, parseDate, startOfMonth, startOfWeek, today } from "@internationalized/date";
|
|
28
|
-
import { Button as Button$5, I18nProvider as I18nProvider$1, Text as Text$3, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastList, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion } from "react-aria-components";
|
|
29
32
|
//#region src/Button.tsx
|
|
30
33
|
function PendingLabelAnchor() {
|
|
31
34
|
const context = useContext(ProgressBarContext);
|
|
@@ -36,9 +39,11 @@ function PendingLabelAnchor() {
|
|
|
36
39
|
"aria-hidden": "true"
|
|
37
40
|
}) : null;
|
|
38
41
|
}
|
|
39
|
-
function Button({ variant = "primary", size = "md", isIconOnly = false, isPending = false, isDisabled = false, fullWidth = false, type = "button", children, ...props }) {
|
|
42
|
+
function Button({ variant = "primary", size = "md", isIconOnly = false, isPending = false, isDisabled = false, fullWidth = false, type = "button", children, className: consumerClassName, classNames, style, ...props }) {
|
|
40
43
|
const className = [
|
|
41
44
|
"button",
|
|
45
|
+
classNames?.root,
|
|
46
|
+
consumerClassName,
|
|
42
47
|
`button--${variant}`,
|
|
43
48
|
size !== "md" && `button--${size}`,
|
|
44
49
|
isIconOnly && "button--icon-only",
|
|
@@ -48,6 +53,7 @@ function Button({ variant = "primary", size = "md", isIconOnly = false, isPendin
|
|
|
48
53
|
...props,
|
|
49
54
|
type: isPending ? "button" : type,
|
|
50
55
|
className,
|
|
56
|
+
style,
|
|
51
57
|
isDisabled,
|
|
52
58
|
isPending,
|
|
53
59
|
children: (state) => /* @__PURE__ */ jsxs(Fragment$1, { children: [typeof children === "function" ? children({
|
|
@@ -61,14 +67,20 @@ function Button({ variant = "primary", size = "md", isIconOnly = false, isPendin
|
|
|
61
67
|
});
|
|
62
68
|
}
|
|
63
69
|
//#endregion
|
|
70
|
+
//#region src/styling.ts
|
|
71
|
+
function partClass(base, override) {
|
|
72
|
+
return override ? `${base} ${override}` : base;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
64
75
|
//#region src/ButtonGroup.tsx
|
|
65
|
-
function ButtonGroupSeparator() {
|
|
76
|
+
function ButtonGroupSeparator({ className, style, classNames } = {}) {
|
|
66
77
|
return /* @__PURE__ */ jsx("span", {
|
|
67
|
-
className: "button-group__separator",
|
|
78
|
+
className: partClass(partClass("button-group__separator", classNames?.root), className),
|
|
79
|
+
style,
|
|
68
80
|
"aria-hidden": "true"
|
|
69
81
|
});
|
|
70
82
|
}
|
|
71
|
-
function Root$1({ children, label, variant, size, isDisabled, fullWidth, orientation = "horizontal", dir }) {
|
|
83
|
+
function Root$1({ children, label, variant, size, isDisabled, fullWidth, orientation = "horizontal", dir, className, style, classNames }) {
|
|
72
84
|
function defaults(nodes) {
|
|
73
85
|
return Children.map(nodes, (child) => {
|
|
74
86
|
if (!isValidElement(child)) return child;
|
|
@@ -87,7 +99,8 @@ function Root$1({ children, label, variant, size, isDisabled, fullWidth, orienta
|
|
|
87
99
|
"aria-label": label,
|
|
88
100
|
dir,
|
|
89
101
|
"data-orientation": orientation,
|
|
90
|
-
className: `button-group${fullWidth ? " button-group--full-width" : ""}`,
|
|
102
|
+
className: partClass(partClass(`button-group${fullWidth ? " button-group--full-width" : ""}`, classNames?.root), className),
|
|
103
|
+
style,
|
|
91
104
|
children: defaults(children)
|
|
92
105
|
});
|
|
93
106
|
}
|
|
@@ -95,13 +108,16 @@ var ButtonGroup = /* @__PURE__ */ Object.assign(Root$1, { Separator: ButtonGroup
|
|
|
95
108
|
//#endregion
|
|
96
109
|
//#region src/ToggleButton.tsx
|
|
97
110
|
var ToggleButtonSizeContext = createContext("md");
|
|
98
|
-
function ToggleButton({ children, variant = "default", size, isIconOnly, ...props }) {
|
|
111
|
+
function ToggleButton({ children, variant = "default", size, isIconOnly, className: consumerClassName, classNames, style, ...props }) {
|
|
99
112
|
const inheritedSize = useContext(ToggleButtonSizeContext);
|
|
100
113
|
const resolvedSize = size ?? inheritedSize;
|
|
101
114
|
return /* @__PURE__ */ jsx(ToggleButton$1, {
|
|
102
115
|
...props,
|
|
116
|
+
style,
|
|
103
117
|
className: [
|
|
104
118
|
"button",
|
|
119
|
+
classNames?.root,
|
|
120
|
+
consumerClassName,
|
|
105
121
|
"toggle-button",
|
|
106
122
|
`toggle-button--${variant}`,
|
|
107
123
|
resolvedSize !== "md" && `button--${resolvedSize}`,
|
|
@@ -138,10 +154,13 @@ function Root(props) {
|
|
|
138
154
|
dir: props.dir,
|
|
139
155
|
className: [
|
|
140
156
|
"button-group",
|
|
157
|
+
props.classNames?.root,
|
|
158
|
+
props.className,
|
|
141
159
|
"toggle-button-group",
|
|
142
160
|
props.isDetached && "button-group--detached",
|
|
143
161
|
props.fullWidth && "button-group--full-width"
|
|
144
162
|
].filter(Boolean).join(" "),
|
|
163
|
+
style: props.style,
|
|
145
164
|
orientation: props.orientation ?? "horizontal",
|
|
146
165
|
selectionMode: props.selectionMode ?? "single",
|
|
147
166
|
selectedKeys: props.value === void 0 ? void 0 : keys(props.value),
|
|
@@ -161,6 +180,12 @@ function Root(props) {
|
|
|
161
180
|
}
|
|
162
181
|
var ToggleButtonGroup = /* @__PURE__ */ Object.assign(Root, { Separator: ButtonGroupSeparator });
|
|
163
182
|
//#endregion
|
|
183
|
+
//#region src/label-context.ts
|
|
184
|
+
/** Item labels use Text slots rather than introducing native label elements. */
|
|
185
|
+
var ItemLabelContext = createContext(false);
|
|
186
|
+
/** Field feedback parts share styling without coupling labels to a specific control. */
|
|
187
|
+
var FieldPartClassesContext = createContext({});
|
|
188
|
+
//#endregion
|
|
164
189
|
//#region src/icons.tsx
|
|
165
190
|
function ChevronIcon({ className }) {
|
|
166
191
|
return /* @__PURE__ */ jsx("svg", {
|
|
@@ -202,8 +227,236 @@ function CloseIcon({ className }) {
|
|
|
202
227
|
});
|
|
203
228
|
}
|
|
204
229
|
//#endregion
|
|
230
|
+
//#region src/control-composition.tsx
|
|
231
|
+
var SelectPartsContext = createContext({
|
|
232
|
+
clearButtons: 0,
|
|
233
|
+
registerClear: () => () => {}
|
|
234
|
+
});
|
|
235
|
+
var InSelectTrigger = createContext(false);
|
|
236
|
+
function SelectComposition({ className, style, classNames, onClear, onChange, size = "md", variant = "primary", fullWidth = true, hideLabel = false, ...props }) {
|
|
237
|
+
const [clearButtons, setClearButtons] = useState(0);
|
|
238
|
+
const triggerRef = useRef(null);
|
|
239
|
+
const [registerClear] = useState(() => () => {
|
|
240
|
+
setClearButtons((count) => count + 1);
|
|
241
|
+
return () => setClearButtons((count) => count - 1);
|
|
242
|
+
});
|
|
243
|
+
return /* @__PURE__ */ jsx(SelectPartsContext.Provider, {
|
|
244
|
+
value: {
|
|
245
|
+
classNames,
|
|
246
|
+
onClear,
|
|
247
|
+
disabled: props.isDisabled,
|
|
248
|
+
clearButtons,
|
|
249
|
+
registerClear,
|
|
250
|
+
triggerRef
|
|
251
|
+
},
|
|
252
|
+
children: /* @__PURE__ */ jsx(FieldPartClassesContext.Provider, {
|
|
253
|
+
value: classNames ?? {},
|
|
254
|
+
children: /* @__PURE__ */ jsx(Select$1, {
|
|
255
|
+
...props,
|
|
256
|
+
"data-multiple": props.selectionMode === "multiple" || void 0,
|
|
257
|
+
className: partClass(partClass(`select select--${size} select--${variant}${fullWidth ? "" : " select--fit"}${hideLabel ? " select--label-hidden" : ""}`, classNames?.root), className),
|
|
258
|
+
style,
|
|
259
|
+
onChange: (value) => {
|
|
260
|
+
if (props.isDisabled) return;
|
|
261
|
+
if (Array.isArray(value)) onChange?.(value.map(String));
|
|
262
|
+
else onChange?.(value == null ? null : String(value));
|
|
263
|
+
}
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function SelectControl({ className, ...props }) {
|
|
269
|
+
const { classNames, clearButtons } = useContext(SelectPartsContext);
|
|
270
|
+
return /* @__PURE__ */ jsx("div", {
|
|
271
|
+
...props,
|
|
272
|
+
"data-clearable": clearButtons > 0 || void 0,
|
|
273
|
+
className: partClass(partClass("select__control", classNames?.control), className)
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function SelectTrigger({ ref, className, children, onKeyDown, ...props }) {
|
|
277
|
+
const state = useContext(SelectStateContext);
|
|
278
|
+
const context = useContext(SelectPartsContext);
|
|
279
|
+
const element = useRef(null);
|
|
280
|
+
useImperativeHandle(ref, () => element.current);
|
|
281
|
+
useImperativeHandle(context.triggerRef, () => element.current);
|
|
282
|
+
const clear = () => {
|
|
283
|
+
state?.setValue(Array.isArray(state.value) ? [] : null);
|
|
284
|
+
context.onClear?.();
|
|
285
|
+
};
|
|
286
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
287
|
+
...props,
|
|
288
|
+
ref: element,
|
|
289
|
+
className: partClass(partClass("select__trigger select__composed-trigger", context.classNames?.trigger), className),
|
|
290
|
+
onKeyDown: (event) => {
|
|
291
|
+
onKeyDown?.(event);
|
|
292
|
+
if (!event.defaultPrevented && !context.disabled && context.clearButtons > 0 && !state?.isOpen && (event.key === "Backspace" || event.key === "Delete") && state?.value != null && (!Array.isArray(state.value) || state.value.length > 0)) {
|
|
293
|
+
event.preventDefault();
|
|
294
|
+
clear();
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
children: (state) => /* @__PURE__ */ jsx(InSelectTrigger.Provider, {
|
|
298
|
+
value: true,
|
|
299
|
+
children: typeof children === "function" ? children(state) : children
|
|
300
|
+
})
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function SelectValuePart({ className, ...props }) {
|
|
304
|
+
const { classNames } = useContext(SelectPartsContext);
|
|
305
|
+
return /* @__PURE__ */ jsx(SelectValue, {
|
|
306
|
+
...props,
|
|
307
|
+
className: partClass(partClass("select__value", classNames?.value), className)
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function SelectIndicator({ className, children, ...props }) {
|
|
311
|
+
const { classNames } = useContext(SelectPartsContext);
|
|
312
|
+
return /* @__PURE__ */ jsx("span", {
|
|
313
|
+
...props,
|
|
314
|
+
className: partClass(partClass("select__icon", classNames?.indicator), className),
|
|
315
|
+
"aria-hidden": "true",
|
|
316
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronIcon, {})
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/** Nested clear is decorative to AT; Backspace/Delete on the trigger supplies keyboard clearing. Outside Trigger it is a named native button. */
|
|
320
|
+
function SelectClearButton({ className, children, "aria-label": label = "Hapus pilihan", ...props }) {
|
|
321
|
+
const state = useContext(SelectStateContext);
|
|
322
|
+
const context = useContext(SelectPartsContext);
|
|
323
|
+
const nested = useContext(InSelectTrigger);
|
|
324
|
+
const registerClear = context.registerClear;
|
|
325
|
+
useEffect(() => registerClear(), [registerClear]);
|
|
326
|
+
const empty = state?.value == null || Array.isArray(state.value) && state.value.length === 0;
|
|
327
|
+
const disabled = context.disabled || empty;
|
|
328
|
+
const classes = partClass(partClass("selection__clear", context.classNames?.clearButton), className);
|
|
329
|
+
const clear = () => {
|
|
330
|
+
if (disabled) return;
|
|
331
|
+
state?.setValue(Array.isArray(state.value) ? [] : null);
|
|
332
|
+
context.onClear?.();
|
|
333
|
+
context.triggerRef?.current?.focus();
|
|
334
|
+
};
|
|
335
|
+
const content = children ?? /* @__PURE__ */ jsx(CloseIcon, { className: "selection__close-icon" });
|
|
336
|
+
if (nested) return /* @__PURE__ */ jsx("span", {
|
|
337
|
+
...props,
|
|
338
|
+
className: classes,
|
|
339
|
+
"aria-hidden": "true",
|
|
340
|
+
"data-empty": empty || void 0,
|
|
341
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
342
|
+
onClick: (event) => {
|
|
343
|
+
event.stopPropagation();
|
|
344
|
+
if (event.button === 0) clear();
|
|
345
|
+
},
|
|
346
|
+
children: content
|
|
347
|
+
});
|
|
348
|
+
return /* @__PURE__ */ jsx("button", {
|
|
349
|
+
...props,
|
|
350
|
+
type: "button",
|
|
351
|
+
className: classes,
|
|
352
|
+
"aria-label": label,
|
|
353
|
+
disabled,
|
|
354
|
+
"data-empty": empty || void 0,
|
|
355
|
+
onClick: clear,
|
|
356
|
+
children: content
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function SelectPopover({ className, ...props }) {
|
|
360
|
+
const { classNames } = useContext(SelectPartsContext);
|
|
361
|
+
return /* @__PURE__ */ jsx(Popover$2, {
|
|
362
|
+
...props,
|
|
363
|
+
className: partClass(partClass("select__popover", classNames?.popover), className)
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
function ListBoxRoot({ className, ...props }) {
|
|
367
|
+
const { classNames } = useContext(SelectPartsContext);
|
|
368
|
+
return /* @__PURE__ */ jsx(ListBox$2, {
|
|
369
|
+
...props,
|
|
370
|
+
className: partClass(partClass("listbox__list select__list", classNames?.list), className)
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function ListBoxItemPart({ className, children, ...props }) {
|
|
374
|
+
const { classNames } = useContext(SelectPartsContext);
|
|
375
|
+
return /* @__PURE__ */ jsx(ListBoxItem$1, {
|
|
376
|
+
...props,
|
|
377
|
+
textValue: props.textValue ?? (typeof children === "string" || typeof children === "number" ? String(children) : void 0),
|
|
378
|
+
className: partClass(partClass("listbox__item select__item", classNames?.item), className),
|
|
379
|
+
children: (state) => /* @__PURE__ */ jsx(ItemLabelContext.Provider, {
|
|
380
|
+
value: true,
|
|
381
|
+
children: typeof children === "function" ? children(state) : children
|
|
382
|
+
})
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function ListBoxSectionPart({ className, ...props }) {
|
|
386
|
+
return /* @__PURE__ */ jsx(ListBoxSection, {
|
|
387
|
+
...props,
|
|
388
|
+
className: partClass("listbox__section", className)
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function ListBoxItemIndicator({ className, children, ...props }) {
|
|
392
|
+
const { classNames } = useContext(SelectPartsContext);
|
|
393
|
+
return /* @__PURE__ */ jsx("span", {
|
|
394
|
+
...props,
|
|
395
|
+
className: partClass(partClass("listbox__check select__check", classNames?.itemIndicator), className),
|
|
396
|
+
"aria-hidden": "true",
|
|
397
|
+
children: children ?? /* @__PURE__ */ jsx(CheckIcon, {})
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
var ListBox = /* @__PURE__ */ Object.assign(ListBoxRoot, {
|
|
401
|
+
Item: ListBoxItemPart,
|
|
402
|
+
Section: ListBoxSectionPart,
|
|
403
|
+
ItemIndicator: ListBoxItemIndicator
|
|
404
|
+
});
|
|
405
|
+
function Description({ className, ...props }) {
|
|
406
|
+
const fieldClasses = useContext(FieldPartClassesContext);
|
|
407
|
+
const inItem = useContext(ItemLabelContext);
|
|
408
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
409
|
+
slot: "description",
|
|
410
|
+
...props,
|
|
411
|
+
className: partClass(partClass("input__description", inItem ? void 0 : fieldClasses.description), className)
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function FieldError({ className, ...props }) {
|
|
415
|
+
const fieldClasses = useContext(FieldPartClassesContext);
|
|
416
|
+
return /* @__PURE__ */ jsx(FieldError$1, {
|
|
417
|
+
...props,
|
|
418
|
+
className: partClass(partClass("input__error", fieldClasses.error), className)
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function InputRoot({ className, ...props }) {
|
|
422
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
423
|
+
...props,
|
|
424
|
+
className: partClass("input", className)
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
var InputControlRefContext = createContext(void 0);
|
|
428
|
+
var InputControl = /* @__PURE__ */ forwardRef(function InputControl({ className, ...props }, ref) {
|
|
429
|
+
const inheritedRef = useContext(InputControlRefContext);
|
|
430
|
+
const control = useRef(null);
|
|
431
|
+
useImperativeHandle(ref, () => control.current);
|
|
432
|
+
useImperativeHandle(inheritedRef, () => control.current);
|
|
433
|
+
return /* @__PURE__ */ jsx(Input$1, {
|
|
434
|
+
...props,
|
|
435
|
+
ref: control,
|
|
436
|
+
className: partClass("input__control", className)
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
function InputGroup({ className, ...props }) {
|
|
440
|
+
return /* @__PURE__ */ jsx(Group, {
|
|
441
|
+
...props,
|
|
442
|
+
className: partClass("input__group", className)
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
function InputPrefix({ className, ...props }) {
|
|
446
|
+
return /* @__PURE__ */ jsx("span", {
|
|
447
|
+
...props,
|
|
448
|
+
className: partClass("input__prefix", className)
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function InputSuffix({ className, ...props }) {
|
|
452
|
+
return /* @__PURE__ */ jsx("span", {
|
|
453
|
+
...props,
|
|
454
|
+
className: partClass("input__suffix", className)
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
205
458
|
//#region src/field.tsx
|
|
206
|
-
function useFeedback({ description, errorMessage, isInvalid }) {
|
|
459
|
+
function useFeedback({ description, errorMessage, isInvalid, classNames }) {
|
|
207
460
|
const id = useId();
|
|
208
461
|
const descriptionId = `${id}-description`;
|
|
209
462
|
const errorId = `${id}-error`;
|
|
@@ -212,11 +465,11 @@ function useFeedback({ description, errorMessage, isInvalid }) {
|
|
|
212
465
|
describedBy: [description && descriptionId, showError && errorId].filter(Boolean).join(" ") || void 0,
|
|
213
466
|
feedback: /* @__PURE__ */ jsxs(Fragment$1, { children: [description && /* @__PURE__ */ jsx("span", {
|
|
214
467
|
id: descriptionId,
|
|
215
|
-
className: "input__description",
|
|
468
|
+
className: partClass("input__description", classNames?.description),
|
|
216
469
|
children: description
|
|
217
470
|
}), showError && /* @__PURE__ */ jsx("span", {
|
|
218
471
|
id: errorId,
|
|
219
|
-
className: "input__error",
|
|
472
|
+
className: partClass("input__error", classNames?.error),
|
|
220
473
|
children: errorMessage
|
|
221
474
|
})] })
|
|
222
475
|
};
|
|
@@ -265,7 +518,7 @@ function filterOptions(options, query) {
|
|
|
265
518
|
}
|
|
266
519
|
//#endregion
|
|
267
520
|
//#region src/Select.tsx
|
|
268
|
-
function
|
|
521
|
+
function SelectCompact(props) {
|
|
269
522
|
const { label, options, placeholder, isDisabled, isRequired, isClearable, clearLabel = "Hapus pilihan", dir } = props;
|
|
270
523
|
const multiple = props.selectionMode === "multiple";
|
|
271
524
|
const [local, setLocal] = useState(props.defaultValue);
|
|
@@ -276,6 +529,7 @@ function Select(props) {
|
|
|
276
529
|
const selected = options.filter((o) => ids.includes(o.id));
|
|
277
530
|
const invalid = props.isInvalid || tried && isRequired && ids.length === 0;
|
|
278
531
|
const { describedBy, feedback } = useFeedback({
|
|
532
|
+
classNames: props.classNames,
|
|
279
533
|
description: props.description,
|
|
280
534
|
isInvalid: invalid,
|
|
281
535
|
errorMessage: props.errorMessage ?? (isRequired && ids.length === 0 ? props.requiredMessage ?? "Pilihan wajib diisi." : void 0)
|
|
@@ -297,11 +551,14 @@ function Select(props) {
|
|
|
297
551
|
const select = /* @__PURE__ */ jsxs(Select$1, {
|
|
298
552
|
className: [
|
|
299
553
|
"select",
|
|
554
|
+
props.classNames?.root,
|
|
555
|
+
props.className,
|
|
300
556
|
`select--${props.size ?? "md"}`,
|
|
301
557
|
`select--${props.variant ?? "primary"}`,
|
|
302
558
|
props.hideLabel && "select--label-hidden",
|
|
303
559
|
props.fullWidth === false && "select--fit"
|
|
304
560
|
].filter(Boolean).join(" "),
|
|
561
|
+
style: props.style,
|
|
305
562
|
"data-multiple": multiple || void 0,
|
|
306
563
|
selectionMode: multiple ? "multiple" : "single",
|
|
307
564
|
value: multiple ? ids : ids[0] ?? null,
|
|
@@ -314,61 +571,61 @@ function Select(props) {
|
|
|
314
571
|
"aria-describedby": describedBy,
|
|
315
572
|
children: [
|
|
316
573
|
/* @__PURE__ */ jsxs(Label$1, {
|
|
317
|
-
className: "select__label",
|
|
574
|
+
className: partClass("select__label", props.classNames?.label),
|
|
318
575
|
children: [label, isRequired && /* @__PURE__ */ jsxs("span", {
|
|
319
|
-
className: "selection__required",
|
|
576
|
+
className: partClass("selection__required", props.classNames?.required),
|
|
320
577
|
"aria-hidden": "true",
|
|
321
578
|
children: [" ", "*"]
|
|
322
579
|
})]
|
|
323
580
|
}),
|
|
324
581
|
/* @__PURE__ */ jsxs("div", {
|
|
325
|
-
className: "select__control",
|
|
582
|
+
className: partClass("select__control", props.classNames?.control),
|
|
326
583
|
"data-clearable": isClearable || void 0,
|
|
327
584
|
children: [/* @__PURE__ */ jsxs(Button$2, {
|
|
328
585
|
ref: trigger,
|
|
329
|
-
className: "select__trigger",
|
|
586
|
+
className: partClass("select__trigger", props.classNames?.trigger),
|
|
330
587
|
"aria-describedby": describedBy,
|
|
331
588
|
children: [
|
|
332
589
|
props.startContent && /* @__PURE__ */ jsx("span", {
|
|
333
|
-
className: "selection__leading",
|
|
590
|
+
className: partClass("selection__leading", props.classNames?.leading),
|
|
334
591
|
"aria-hidden": "true",
|
|
335
592
|
children: props.startContent
|
|
336
593
|
}),
|
|
337
594
|
/* @__PURE__ */ jsx(SelectValue, {
|
|
338
|
-
className: "select__value",
|
|
595
|
+
className: partClass("select__value", props.classNames?.value),
|
|
339
596
|
children: () => selected.length ? props.renderValue?.(selected) ?? selected.map((o) => o.label).join(", ") : placeholder
|
|
340
597
|
}),
|
|
341
|
-
/* @__PURE__ */ jsx(ChevronIcon, { className: "select__icon" })
|
|
598
|
+
/* @__PURE__ */ jsx(ChevronIcon, { className: partClass("select__icon", props.classNames?.indicator) })
|
|
342
599
|
]
|
|
343
600
|
}), isClearable && /* @__PURE__ */ jsx("button", {
|
|
344
601
|
type: "button",
|
|
345
|
-
className: "selection__clear",
|
|
602
|
+
className: partClass("selection__clear", props.classNames?.clearButton),
|
|
346
603
|
"data-empty": ids.length === 0 || void 0,
|
|
347
604
|
"aria-hidden": ids.length === 0 || void 0,
|
|
348
605
|
tabIndex: ids.length === 0 ? -1 : void 0,
|
|
349
606
|
"aria-label": clearLabel,
|
|
350
607
|
disabled: isDisabled || ids.length === 0,
|
|
351
608
|
onClick: clear,
|
|
352
|
-
children: /* @__PURE__ */ jsx(CloseIcon, { className: "selection__close-icon" })
|
|
609
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: partClass("selection__close-icon", props.classNames?.clearIcon) })
|
|
353
610
|
})]
|
|
354
611
|
}),
|
|
355
612
|
/* @__PURE__ */ jsx(Popover$1, {
|
|
356
|
-
className: "select__popover",
|
|
357
|
-
children: /* @__PURE__ */ jsx(ListBox, {
|
|
358
|
-
className: "select__list",
|
|
613
|
+
className: partClass("select__popover", props.classNames?.popover),
|
|
614
|
+
children: /* @__PURE__ */ jsx(ListBox$1, {
|
|
615
|
+
className: partClass("select__list", props.classNames?.list),
|
|
359
616
|
children: options.map((option) => /* @__PURE__ */ jsxs(ListBoxItem, {
|
|
360
617
|
onPress: props.onAction ? () => props.onAction(option.id) : void 0,
|
|
361
618
|
id: option.id,
|
|
362
619
|
textValue: option.label,
|
|
363
620
|
isDisabled: option.isDisabled,
|
|
364
|
-
className: "select__item",
|
|
621
|
+
className: partClass("select__item", props.classNames?.item),
|
|
365
622
|
children: [/* @__PURE__ */ jsx("span", {
|
|
366
|
-
className: "select__item-label",
|
|
623
|
+
className: partClass("select__item-label", props.classNames?.itemLabel),
|
|
367
624
|
children: props.renderOption?.(option) ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [option.label, option.description && /* @__PURE__ */ jsx("span", {
|
|
368
|
-
className: "selection__description",
|
|
625
|
+
className: partClass("selection__description", props.classNames?.itemDescription),
|
|
369
626
|
children: option.description
|
|
370
627
|
})] })
|
|
371
|
-
}), /* @__PURE__ */ jsx(CheckIcon, { className: "select__check" })]
|
|
628
|
+
}), /* @__PURE__ */ jsx(CheckIcon, { className: partClass("select__check", props.classNames?.itemIndicator) })]
|
|
372
629
|
}, option.id))
|
|
373
630
|
})
|
|
374
631
|
}),
|
|
@@ -405,10 +662,24 @@ function Select(props) {
|
|
|
405
662
|
children: select
|
|
406
663
|
}) : select;
|
|
407
664
|
}
|
|
665
|
+
function SelectRoot(props) {
|
|
666
|
+
if (props.options) return props.selectionMode === "multiple" ? /* @__PURE__ */ jsx(SelectCompact, { ...props }) : /* @__PURE__ */ jsx(SelectCompact, { ...props });
|
|
667
|
+
if (props.selectionMode === "multiple") return /* @__PURE__ */ jsx(SelectComposition, { ...props });
|
|
668
|
+
return /* @__PURE__ */ jsx(SelectComposition, { ...props });
|
|
669
|
+
}
|
|
670
|
+
var Select = /* @__PURE__ */ Object.assign(SelectRoot, {
|
|
671
|
+
Root: SelectComposition,
|
|
672
|
+
Control: SelectControl,
|
|
673
|
+
Trigger: SelectTrigger,
|
|
674
|
+
Value: SelectValuePart,
|
|
675
|
+
Indicator: SelectIndicator,
|
|
676
|
+
ClearButton: SelectClearButton,
|
|
677
|
+
Popover: SelectPopover
|
|
678
|
+
});
|
|
408
679
|
//#endregion
|
|
409
680
|
//#region src/SelectGroup.tsx
|
|
410
681
|
/** Joins direct Select children. Each child retains its own value and accessible label. */
|
|
411
|
-
function SelectGroup({ label, children, size, variant, fullWidth = true, isDisabled, dir }) {
|
|
682
|
+
function SelectGroup({ label, children, size, variant, fullWidth = true, isDisabled, dir, className, style, classNames }) {
|
|
412
683
|
function defaults(nodes) {
|
|
413
684
|
return Children.map(nodes, (child) => {
|
|
414
685
|
if (!isValidElement(child)) return child;
|
|
@@ -426,27 +697,33 @@ function SelectGroup({ label, children, size, variant, fullWidth = true, isDisab
|
|
|
426
697
|
});
|
|
427
698
|
}
|
|
428
699
|
return /* @__PURE__ */ jsxs("fieldset", {
|
|
429
|
-
className: [
|
|
700
|
+
className: [
|
|
701
|
+
"select-group",
|
|
702
|
+
!fullWidth && "select-group--fit",
|
|
703
|
+
classNames?.root,
|
|
704
|
+
className
|
|
705
|
+
].filter(Boolean).join(" "),
|
|
706
|
+
style,
|
|
430
707
|
disabled: isDisabled,
|
|
431
708
|
dir,
|
|
432
709
|
children: [/* @__PURE__ */ jsx("legend", {
|
|
433
|
-
className: "select-group__legend",
|
|
710
|
+
className: partClass("select-group__legend", classNames?.label),
|
|
434
711
|
children: label
|
|
435
712
|
}), /* @__PURE__ */ jsx("div", {
|
|
436
|
-
className: "select-group__controls",
|
|
713
|
+
className: partClass("select-group__controls", classNames?.controls),
|
|
437
714
|
children: defaults(children)
|
|
438
715
|
})]
|
|
439
716
|
});
|
|
440
717
|
}
|
|
441
718
|
//#endregion
|
|
442
719
|
//#region src/Input.tsx
|
|
443
|
-
var
|
|
720
|
+
var CompactInput = /* @__PURE__ */ forwardRef(function Input({ label, value, defaultValue, onChange, description, errorMessage, isInvalid = false, isDisabled = false, isReadOnly = false, isRequired = false, placeholder, type = "text", size = "md", variant = "primary", fullWidth = true, prefix, suffix, name, id, autoComplete, maxLength, minLength, pattern, inputMode, enterKeyHint, autoFocus, spellCheck, form, onFocus, onBlur, onKeyDown, onKeyUp, dir, className, style, classNames }, ref) {
|
|
444
721
|
const control = useRef(null);
|
|
445
722
|
useImperativeHandle(ref, () => control.current);
|
|
446
723
|
const hasAdornment = prefix != null || suffix != null;
|
|
447
724
|
const input = /* @__PURE__ */ jsx(Input$1, {
|
|
448
725
|
ref: control,
|
|
449
|
-
className: "input__control",
|
|
726
|
+
className: partClass(partClass("input__control", classNames?.input), classNames?.control),
|
|
450
727
|
placeholder,
|
|
451
728
|
required: isRequired,
|
|
452
729
|
minLength,
|
|
@@ -462,7 +739,8 @@ var Input = /* @__PURE__ */ forwardRef(function Input({ label, value, defaultVal
|
|
|
462
739
|
onKeyUp
|
|
463
740
|
});
|
|
464
741
|
return /* @__PURE__ */ jsxs(TextField, {
|
|
465
|
-
className: `input input--${size} input--${variant}${fullWidth ? "" : " input--fit"}`,
|
|
742
|
+
className: partClass(partClass(`input input--${size} input--${variant}${fullWidth ? "" : " input--fit"}`, classNames?.root), className),
|
|
743
|
+
style,
|
|
466
744
|
value,
|
|
467
745
|
defaultValue,
|
|
468
746
|
onChange,
|
|
@@ -479,15 +757,15 @@ var Input = /* @__PURE__ */ forwardRef(function Input({ label, value, defaultVal
|
|
|
479
757
|
dir,
|
|
480
758
|
children: [
|
|
481
759
|
/* @__PURE__ */ jsx(Label$2, {
|
|
482
|
-
className: "input__label",
|
|
760
|
+
className: partClass("input__label", classNames?.label),
|
|
483
761
|
children: label
|
|
484
762
|
}),
|
|
485
763
|
/* @__PURE__ */ jsx("fieldset", {
|
|
486
|
-
className: "input__boundary",
|
|
764
|
+
className: partClass("input__boundary", classNames?.boundary),
|
|
487
765
|
role: "presentation",
|
|
488
766
|
disabled: isDisabled,
|
|
489
767
|
children: /* @__PURE__ */ jsxs("div", {
|
|
490
|
-
className: hasAdornment ? "input__group" : "input__plain",
|
|
768
|
+
className: partClass(hasAdornment ? "input__group" : "input__plain", classNames?.group),
|
|
491
769
|
"data-invalid": isInvalid || void 0,
|
|
492
770
|
"data-readonly": isReadOnly || void 0,
|
|
493
771
|
onPointerDown: (event) => {
|
|
@@ -498,34 +776,51 @@ var Input = /* @__PURE__ */ forwardRef(function Input({ label, value, defaultVal
|
|
|
498
776
|
},
|
|
499
777
|
children: [
|
|
500
778
|
prefix != null && /* @__PURE__ */ jsx("span", {
|
|
501
|
-
className: "input__prefix",
|
|
779
|
+
className: partClass("input__prefix", classNames?.prefix),
|
|
502
780
|
children: prefix
|
|
503
781
|
}),
|
|
504
782
|
input,
|
|
505
783
|
suffix != null && /* @__PURE__ */ jsx("span", {
|
|
506
|
-
className: "input__suffix",
|
|
784
|
+
className: partClass("input__suffix", classNames?.suffix),
|
|
507
785
|
children: suffix
|
|
508
786
|
})
|
|
509
787
|
]
|
|
510
788
|
})
|
|
511
789
|
}),
|
|
512
|
-
description && /* @__PURE__ */ jsx(Text, {
|
|
790
|
+
description && /* @__PURE__ */ jsx(Text$1, {
|
|
513
791
|
slot: "description",
|
|
514
|
-
className: "input__description",
|
|
792
|
+
className: partClass("input__description", classNames?.description),
|
|
515
793
|
children: description
|
|
516
794
|
}),
|
|
517
|
-
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError, {
|
|
518
|
-
className: "input__error",
|
|
795
|
+
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError$2, {
|
|
796
|
+
className: partClass("input__error", classNames?.error),
|
|
519
797
|
children: errorMessage
|
|
520
798
|
})
|
|
521
799
|
]
|
|
522
800
|
});
|
|
523
801
|
});
|
|
802
|
+
var Input = /* @__PURE__ */ Object.assign(/* @__PURE__ */ forwardRef(function InputWithComposition(props, ref) {
|
|
803
|
+
if ("label" in props && props.label !== void 0) return /* @__PURE__ */ jsx(CompactInput, {
|
|
804
|
+
...props,
|
|
805
|
+
ref
|
|
806
|
+
});
|
|
807
|
+
return /* @__PURE__ */ jsx(InputControlRefContext.Provider, {
|
|
808
|
+
value: ref,
|
|
809
|
+
children: /* @__PURE__ */ jsx(InputRoot, { ...props })
|
|
810
|
+
});
|
|
811
|
+
}), {
|
|
812
|
+
Root: InputRoot,
|
|
813
|
+
Control: InputControl,
|
|
814
|
+
Group: InputGroup,
|
|
815
|
+
Prefix: InputPrefix,
|
|
816
|
+
Suffix: InputSuffix
|
|
817
|
+
});
|
|
524
818
|
//#endregion
|
|
525
819
|
//#region src/Textarea.tsx
|
|
526
|
-
function
|
|
820
|
+
function CompactTextarea({ label, value, defaultValue, onChange, description, errorMessage, isInvalid = false, isDisabled = false, isReadOnly = false, isRequired = false, placeholder, rows = 3, resize = "vertical", name, id, autoComplete, maxLength, dir, className, style, classNames }) {
|
|
527
821
|
return /* @__PURE__ */ jsxs(TextField, {
|
|
528
|
-
className: "input textarea",
|
|
822
|
+
className: partClass(partClass("input textarea", classNames?.root), className),
|
|
823
|
+
style,
|
|
529
824
|
"data-resize": resize,
|
|
530
825
|
value,
|
|
531
826
|
defaultValue,
|
|
@@ -542,51 +837,189 @@ function Textarea({ label, value, defaultValue, onChange, description, errorMess
|
|
|
542
837
|
dir,
|
|
543
838
|
children: [
|
|
544
839
|
/* @__PURE__ */ jsx(Label$2, {
|
|
545
|
-
className: "input__label",
|
|
840
|
+
className: partClass("input__label", classNames?.label),
|
|
546
841
|
children: label
|
|
547
842
|
}),
|
|
548
843
|
/* @__PURE__ */ jsx(TextArea, {
|
|
549
|
-
className: "input__control textarea__control",
|
|
844
|
+
className: partClass("input__control textarea__control", classNames?.input),
|
|
550
845
|
rows,
|
|
551
846
|
placeholder,
|
|
552
847
|
required: isRequired
|
|
553
848
|
}),
|
|
554
|
-
description && /* @__PURE__ */ jsx(Text, {
|
|
849
|
+
description && /* @__PURE__ */ jsx(Text$1, {
|
|
555
850
|
slot: "description",
|
|
556
|
-
className: "input__description",
|
|
851
|
+
className: partClass("input__description", classNames?.description),
|
|
557
852
|
children: description
|
|
558
853
|
}),
|
|
559
|
-
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError, {
|
|
560
|
-
className: "input__error",
|
|
854
|
+
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError$2, {
|
|
855
|
+
className: partClass("input__error", classNames?.error),
|
|
561
856
|
children: errorMessage
|
|
562
857
|
})
|
|
563
858
|
]
|
|
564
859
|
});
|
|
565
860
|
}
|
|
861
|
+
function TextareaControl({ className, ...props }) {
|
|
862
|
+
return /* @__PURE__ */ jsx(TextArea, {
|
|
863
|
+
...props,
|
|
864
|
+
className: partClass("input__control textarea__control", className)
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
function TextareaRoot(props) {
|
|
868
|
+
if ("label" in props && props.label !== void 0) return /* @__PURE__ */ jsx(CompactTextarea, { ...props });
|
|
869
|
+
return /* @__PURE__ */ jsx(InputRoot, { ...props });
|
|
870
|
+
}
|
|
871
|
+
var Textarea = /* @__PURE__ */ Object.assign(TextareaRoot, {
|
|
872
|
+
Root: InputRoot,
|
|
873
|
+
Control: TextareaControl
|
|
874
|
+
});
|
|
566
875
|
//#endregion
|
|
567
876
|
//#region src/Label.tsx
|
|
568
877
|
/** Associates visible text with a separately rendered control. */
|
|
569
|
-
function Label({ children, htmlFor, id }) {
|
|
878
|
+
function Label({ children, htmlFor, id, className, style, classNames }) {
|
|
879
|
+
const inItem = useContext(ItemLabelContext);
|
|
880
|
+
const fieldClasses = useContext(FieldPartClassesContext);
|
|
881
|
+
if (inItem) return /* @__PURE__ */ jsx(Text, {
|
|
882
|
+
slot: "label",
|
|
883
|
+
id,
|
|
884
|
+
className: partClass(partClass("label", classNames?.root), className),
|
|
885
|
+
style,
|
|
886
|
+
children
|
|
887
|
+
});
|
|
570
888
|
return /* @__PURE__ */ jsx(Label$3, {
|
|
571
|
-
className: "label",
|
|
889
|
+
className: partClass(partClass(partClass("label", fieldClasses.label), classNames?.root), className),
|
|
890
|
+
style,
|
|
572
891
|
htmlFor,
|
|
573
892
|
id,
|
|
574
893
|
children
|
|
575
894
|
});
|
|
576
895
|
}
|
|
577
896
|
//#endregion
|
|
897
|
+
//#region src/choice-composition.tsx
|
|
898
|
+
var ChoiceStateContext = createContext({
|
|
899
|
+
isSelected: false,
|
|
900
|
+
isDisabled: false
|
|
901
|
+
});
|
|
902
|
+
function CheckboxComposition({ className, children, ...props }) {
|
|
903
|
+
return /* @__PURE__ */ jsx(Checkbox$1, {
|
|
904
|
+
...props,
|
|
905
|
+
className: partClass("choice", className),
|
|
906
|
+
children: (state) => /* @__PURE__ */ jsx(ChoiceStateContext.Provider, {
|
|
907
|
+
value: state,
|
|
908
|
+
children: /* @__PURE__ */ jsx(ItemLabelContext.Provider, {
|
|
909
|
+
value: true,
|
|
910
|
+
children: typeof children === "function" ? children(state) : children
|
|
911
|
+
})
|
|
912
|
+
})
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
function CheckboxControl({ className, ...props }) {
|
|
916
|
+
const state = useContext(ChoiceStateContext);
|
|
917
|
+
return /* @__PURE__ */ jsx("span", {
|
|
918
|
+
...props,
|
|
919
|
+
className: partClass("checkbox__control", className),
|
|
920
|
+
"aria-hidden": "true",
|
|
921
|
+
"data-state": state.isIndeterminate ? "indeterminate" : state.isSelected ? "checked" : "unchecked",
|
|
922
|
+
"data-disabled": state.isDisabled || void 0,
|
|
923
|
+
"data-invalid": state.isInvalid || void 0,
|
|
924
|
+
"data-focus-visible": state.isFocusVisible || void 0
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
function CheckboxIndicator({ className, children, ...props }) {
|
|
928
|
+
const state = useContext(ChoiceStateContext);
|
|
929
|
+
return /* @__PURE__ */ jsx("span", {
|
|
930
|
+
...props,
|
|
931
|
+
"aria-hidden": "true",
|
|
932
|
+
className,
|
|
933
|
+
children: children ?? (state.isIndeterminate ? /* @__PURE__ */ jsx("span", { className: "checkbox__dash" }) : /* @__PURE__ */ jsx(CheckIcon, { className: "checkbox__check" }))
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
function ChoiceContent({ className, ...props }) {
|
|
937
|
+
return /* @__PURE__ */ jsx("span", {
|
|
938
|
+
...props,
|
|
939
|
+
className: partClass("choice__label", className)
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
function SwitchComposition({ className, children, ...props }) {
|
|
943
|
+
return /* @__PURE__ */ jsx(SwitchField, {
|
|
944
|
+
...props,
|
|
945
|
+
className: partClass("input", className),
|
|
946
|
+
children: (fieldState) => /* @__PURE__ */ jsx(SwitchButton, {
|
|
947
|
+
className: "choice",
|
|
948
|
+
children: (state) => /* @__PURE__ */ jsx(ChoiceStateContext.Provider, {
|
|
949
|
+
value: state,
|
|
950
|
+
children: typeof children === "function" ? children(fieldState) : children
|
|
951
|
+
})
|
|
952
|
+
})
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
function SwitchControl({ className, ...props }) {
|
|
956
|
+
const state = useContext(ChoiceStateContext);
|
|
957
|
+
return /* @__PURE__ */ jsx("span", {
|
|
958
|
+
...props,
|
|
959
|
+
className: partClass("switch__control", className),
|
|
960
|
+
"aria-hidden": "true",
|
|
961
|
+
"data-state": state.isSelected ? "checked" : "unchecked",
|
|
962
|
+
"data-disabled": state.isDisabled || void 0,
|
|
963
|
+
"data-invalid": state.isInvalid || void 0,
|
|
964
|
+
"data-focus-visible": state.isFocusVisible || void 0
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
function SwitchThumb({ className, ...props }) {
|
|
968
|
+
return /* @__PURE__ */ jsx("span", {
|
|
969
|
+
...props,
|
|
970
|
+
className: partClass("switch__thumb", className),
|
|
971
|
+
"aria-hidden": "true"
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
function RadioGroupComposition({ className, ...props }) {
|
|
975
|
+
return /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
976
|
+
...props,
|
|
977
|
+
className: partClass("input radio-group", className)
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
function RadioItem({ className, children, ...props }) {
|
|
981
|
+
return /* @__PURE__ */ jsx(Radio, {
|
|
982
|
+
...props,
|
|
983
|
+
className: partClass("choice", className),
|
|
984
|
+
children: (state) => /* @__PURE__ */ jsx(ChoiceStateContext.Provider, {
|
|
985
|
+
value: state,
|
|
986
|
+
children: typeof children === "function" ? children(state) : children
|
|
987
|
+
})
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
function RadioControl({ className, ...props }) {
|
|
991
|
+
const state = useContext(ChoiceStateContext);
|
|
992
|
+
return /* @__PURE__ */ jsx("span", {
|
|
993
|
+
...props,
|
|
994
|
+
className: partClass("radio__control", className),
|
|
995
|
+
"aria-hidden": "true",
|
|
996
|
+
"data-state": state.isSelected ? "checked" : "unchecked",
|
|
997
|
+
"data-disabled": state.isDisabled || void 0,
|
|
998
|
+
"data-focus-visible": state.isFocusVisible || void 0
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
function RadioIndicator({ className, ...props }) {
|
|
1002
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1003
|
+
...props,
|
|
1004
|
+
className: partClass("radio__dot", className),
|
|
1005
|
+
"aria-hidden": "true"
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
//#endregion
|
|
578
1009
|
//#region src/Checkbox.tsx
|
|
579
|
-
function
|
|
1010
|
+
function CompactCheckbox({ label, description, errorMessage, isInvalid = false, isSelected, defaultSelected, onChange, isDisabled = false, isRequired = false, isIndeterminate = false, name, value = "on", id, dir, className, style, classNames }) {
|
|
580
1011
|
const { describedBy, feedback } = useFeedback({
|
|
1012
|
+
classNames,
|
|
581
1013
|
description,
|
|
582
1014
|
errorMessage,
|
|
583
1015
|
isInvalid
|
|
584
1016
|
});
|
|
585
1017
|
return /* @__PURE__ */ jsxs("div", {
|
|
586
|
-
className: "input",
|
|
1018
|
+
className: partClass(partClass("input", classNames?.root), className),
|
|
1019
|
+
style,
|
|
587
1020
|
dir,
|
|
588
1021
|
children: [/* @__PURE__ */ jsx(Checkbox$1, {
|
|
589
|
-
className: "choice",
|
|
1022
|
+
className: partClass("choice", classNames?.choice),
|
|
590
1023
|
isSelected,
|
|
591
1024
|
defaultSelected,
|
|
592
1025
|
onChange,
|
|
@@ -602,29 +1035,41 @@ function Checkbox({ label, description, errorMessage, isInvalid = false, isSelec
|
|
|
602
1035
|
"aria-invalid": isInvalid || void 0,
|
|
603
1036
|
children: ({ isSelected: selected, isDisabled: disabled, isFocusVisible }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
604
1037
|
"aria-hidden": "true",
|
|
605
|
-
className: "checkbox__control",
|
|
1038
|
+
className: partClass("checkbox__control", classNames?.control),
|
|
606
1039
|
"data-state": isIndeterminate ? "indeterminate" : selected ? "checked" : "unchecked",
|
|
607
1040
|
"data-disabled": disabled || void 0,
|
|
608
1041
|
"data-invalid": isInvalid || void 0,
|
|
609
1042
|
"data-focus-visible": isFocusVisible || void 0,
|
|
610
|
-
children: [/* @__PURE__ */ jsx(CheckIcon, { className: "checkbox__check" }), /* @__PURE__ */ jsx("span", { className: "checkbox__dash" })]
|
|
1043
|
+
children: [/* @__PURE__ */ jsx(CheckIcon, { className: partClass("checkbox__check", classNames?.indicator) }), /* @__PURE__ */ jsx("span", { className: partClass("checkbox__dash", classNames?.dash) })]
|
|
611
1044
|
}), /* @__PURE__ */ jsx("span", {
|
|
612
|
-
className: "choice__label",
|
|
1045
|
+
className: partClass("choice__label", classNames?.label),
|
|
613
1046
|
children: label
|
|
614
1047
|
})] })
|
|
615
1048
|
}), feedback]
|
|
616
1049
|
});
|
|
617
1050
|
}
|
|
1051
|
+
function CheckboxRoot(props) {
|
|
1052
|
+
if ("label" in props) return /* @__PURE__ */ jsx(CompactCheckbox, { ...props });
|
|
1053
|
+
return /* @__PURE__ */ jsx(CheckboxComposition, { ...props });
|
|
1054
|
+
}
|
|
1055
|
+
var Checkbox = /* @__PURE__ */ Object.assign(CheckboxRoot, {
|
|
1056
|
+
Root: CheckboxComposition,
|
|
1057
|
+
Control: CheckboxControl,
|
|
1058
|
+
Indicator: CheckboxIndicator,
|
|
1059
|
+
Content: ChoiceContent
|
|
1060
|
+
});
|
|
618
1061
|
//#endregion
|
|
619
1062
|
//#region src/RadioGroup.tsx
|
|
620
|
-
function
|
|
1063
|
+
function CompactRadioGroup({ label, options, value, defaultValue, onChange, description, errorMessage, isInvalid = false, isDisabled = false, isRequired = false, name, id, orientation = "vertical", dir, className, style, classNames }) {
|
|
621
1064
|
const { describedBy, feedback } = useFeedback({
|
|
1065
|
+
classNames,
|
|
622
1066
|
description,
|
|
623
1067
|
errorMessage,
|
|
624
1068
|
isInvalid
|
|
625
1069
|
});
|
|
626
1070
|
const group = /* @__PURE__ */ jsxs(RadioGroup$1, {
|
|
627
|
-
className: "input radio-group",
|
|
1071
|
+
className: partClass(partClass("input radio-group", classNames?.root), className),
|
|
1072
|
+
style,
|
|
628
1073
|
value,
|
|
629
1074
|
defaultValue,
|
|
630
1075
|
onChange,
|
|
@@ -639,26 +1084,26 @@ function RadioGroup({ label, options, value, defaultValue, onChange, description
|
|
|
639
1084
|
"aria-describedby": describedBy,
|
|
640
1085
|
children: [
|
|
641
1086
|
/* @__PURE__ */ jsx(Label$4, {
|
|
642
|
-
className: "label",
|
|
1087
|
+
className: partClass("label", classNames?.label),
|
|
643
1088
|
children: label
|
|
644
1089
|
}),
|
|
645
1090
|
/* @__PURE__ */ jsx("div", {
|
|
646
|
-
className: "radio-group__items",
|
|
1091
|
+
className: partClass("radio-group__items", classNames?.items),
|
|
647
1092
|
"data-orientation": orientation,
|
|
648
1093
|
children: options.map((option) => /* @__PURE__ */ jsx(Radio, {
|
|
649
1094
|
value: option.id,
|
|
650
1095
|
isDisabled: option.isDisabled,
|
|
651
|
-
className: "choice",
|
|
1096
|
+
className: partClass("choice", classNames?.item),
|
|
652
1097
|
children: ({ isSelected, isDisabled: disabled, isFocusVisible }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
653
1098
|
"aria-hidden": "true",
|
|
654
|
-
className: "radio__control",
|
|
1099
|
+
className: partClass("radio__control", classNames?.control),
|
|
655
1100
|
"data-state": isSelected ? "checked" : "unchecked",
|
|
656
1101
|
"data-disabled": disabled || void 0,
|
|
657
1102
|
"data-invalid": isInvalid || void 0,
|
|
658
1103
|
"data-focus-visible": isFocusVisible || void 0,
|
|
659
|
-
children: /* @__PURE__ */ jsx("span", { className: "radio__dot" })
|
|
1104
|
+
children: /* @__PURE__ */ jsx("span", { className: partClass("radio__dot", classNames?.indicator) })
|
|
660
1105
|
}), /* @__PURE__ */ jsx("span", {
|
|
661
|
-
className: "choice__label",
|
|
1106
|
+
className: partClass("choice__label", classNames?.itemLabel),
|
|
662
1107
|
children: option.label
|
|
663
1108
|
})] })
|
|
664
1109
|
}, option.id))
|
|
@@ -671,11 +1116,23 @@ function RadioGroup({ label, options, value, defaultValue, onChange, description
|
|
|
671
1116
|
children: group
|
|
672
1117
|
}) : group;
|
|
673
1118
|
}
|
|
1119
|
+
function RadioGroupRoot(props) {
|
|
1120
|
+
if ("options" in props && props.options) return /* @__PURE__ */ jsx(CompactRadioGroup, { ...props });
|
|
1121
|
+
return /* @__PURE__ */ jsx(RadioGroupComposition, { ...props });
|
|
1122
|
+
}
|
|
1123
|
+
var RadioGroup = /* @__PURE__ */ Object.assign(RadioGroupRoot, {
|
|
1124
|
+
Root: RadioGroupComposition,
|
|
1125
|
+
Item: RadioItem,
|
|
1126
|
+
Control: RadioControl,
|
|
1127
|
+
Indicator: RadioIndicator,
|
|
1128
|
+
Content: ChoiceContent
|
|
1129
|
+
});
|
|
674
1130
|
//#endregion
|
|
675
1131
|
//#region src/Switch.tsx
|
|
676
|
-
function
|
|
1132
|
+
function CompactSwitch({ label, description, errorMessage, isInvalid = false, isSelected, defaultSelected, onChange, isDisabled = false, name, value = "on", id, dir, className, style, classNames }) {
|
|
677
1133
|
return /* @__PURE__ */ jsxs(SwitchField, {
|
|
678
|
-
className: "input",
|
|
1134
|
+
className: partClass(partClass("input", classNames?.root), className),
|
|
1135
|
+
style,
|
|
679
1136
|
dir,
|
|
680
1137
|
isSelected,
|
|
681
1138
|
defaultSelected,
|
|
@@ -688,38 +1145,48 @@ function Switch({ label, description, errorMessage, isInvalid = false, isSelecte
|
|
|
688
1145
|
id,
|
|
689
1146
|
children: [
|
|
690
1147
|
/* @__PURE__ */ jsx(SwitchButton, {
|
|
691
|
-
className: "choice",
|
|
1148
|
+
className: partClass("choice", classNames?.choice),
|
|
692
1149
|
children: ({ isSelected: selected, isDisabled: disabled, isFocusVisible }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
693
1150
|
"aria-hidden": "true",
|
|
694
|
-
className: "switch__control",
|
|
1151
|
+
className: partClass("switch__control", classNames?.control),
|
|
695
1152
|
"data-state": selected ? "checked" : "unchecked",
|
|
696
1153
|
"data-disabled": disabled || void 0,
|
|
697
1154
|
"data-invalid": isInvalid || void 0,
|
|
698
1155
|
"data-focus-visible": isFocusVisible || void 0,
|
|
699
|
-
children: /* @__PURE__ */ jsx("span", { className: "switch__thumb" })
|
|
1156
|
+
children: /* @__PURE__ */ jsx("span", { className: partClass("switch__thumb", classNames?.thumb) })
|
|
700
1157
|
}), /* @__PURE__ */ jsx("span", {
|
|
701
|
-
className: "choice__label",
|
|
1158
|
+
className: partClass("choice__label", classNames?.label),
|
|
702
1159
|
children: label
|
|
703
1160
|
})] })
|
|
704
1161
|
}),
|
|
705
|
-
description && /* @__PURE__ */ jsx(Text$
|
|
1162
|
+
description && /* @__PURE__ */ jsx(Text$2, {
|
|
706
1163
|
slot: "description",
|
|
707
|
-
className: "input__description",
|
|
1164
|
+
className: partClass("input__description", classNames?.description),
|
|
708
1165
|
children: description
|
|
709
1166
|
}),
|
|
710
|
-
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError$
|
|
711
|
-
className: "input__error",
|
|
1167
|
+
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError$3, {
|
|
1168
|
+
className: partClass("input__error", classNames?.error),
|
|
712
1169
|
children: errorMessage
|
|
713
1170
|
})
|
|
714
1171
|
]
|
|
715
1172
|
});
|
|
716
1173
|
}
|
|
1174
|
+
function SwitchRoot(props) {
|
|
1175
|
+
if ("label" in props) return /* @__PURE__ */ jsx(CompactSwitch, { ...props });
|
|
1176
|
+
return /* @__PURE__ */ jsx(SwitchComposition, { ...props });
|
|
1177
|
+
}
|
|
1178
|
+
var Switch = /* @__PURE__ */ Object.assign(SwitchRoot, {
|
|
1179
|
+
Root: SwitchComposition,
|
|
1180
|
+
Control: SwitchControl,
|
|
1181
|
+
Thumb: SwitchThumb,
|
|
1182
|
+
Content: ChoiceContent
|
|
1183
|
+
});
|
|
717
1184
|
//#endregion
|
|
718
1185
|
//#region src/form-context.ts
|
|
719
1186
|
var FormErrorsContext = /* @__PURE__ */ createContext({});
|
|
720
1187
|
//#endregion
|
|
721
1188
|
//#region src/FieldComponent.tsx
|
|
722
|
-
function Field({ label, name, children, id, description, errorMessage, isInvalid = false, isDisabled = false, isReadOnly = false, isRequired = false, dir }) {
|
|
1189
|
+
function Field({ label, name, children, id, description, errorMessage, isInvalid = false, isDisabled = false, isReadOnly = false, isRequired = false, dir, className, style, classNames }) {
|
|
723
1190
|
const errors = useContext(FormErrorsContext);
|
|
724
1191
|
const error = Object.hasOwn(errors, name) && typeof errors[name] === "string" ? errors[name] || void 0 : void 0;
|
|
725
1192
|
const invalid = isInvalid || !!error;
|
|
@@ -727,30 +1194,34 @@ function Field({ label, name, children, id, description, errorMessage, isInvalid
|
|
|
727
1194
|
const generated = useId();
|
|
728
1195
|
const controlId = id ?? generated;
|
|
729
1196
|
const { describedBy, feedback } = useFeedback({
|
|
1197
|
+
classNames,
|
|
730
1198
|
description,
|
|
731
1199
|
isInvalid: invalid,
|
|
732
1200
|
errorMessage: message
|
|
733
1201
|
});
|
|
1202
|
+
const controlProps = {
|
|
1203
|
+
id: controlId,
|
|
1204
|
+
name,
|
|
1205
|
+
className: partClass("input__control field__control", classNames?.input),
|
|
1206
|
+
disabled: isDisabled,
|
|
1207
|
+
readOnly: isReadOnly,
|
|
1208
|
+
required: isRequired,
|
|
1209
|
+
"aria-required": isRequired || void 0,
|
|
1210
|
+
"aria-invalid": invalid || void 0,
|
|
1211
|
+
"aria-describedby": describedBy
|
|
1212
|
+
};
|
|
734
1213
|
return /* @__PURE__ */ jsxs("div", {
|
|
735
|
-
className: "input field",
|
|
1214
|
+
className: partClass(partClass("input field", classNames?.root), className),
|
|
1215
|
+
style,
|
|
736
1216
|
dir,
|
|
737
1217
|
children: [
|
|
738
1218
|
/* @__PURE__ */ jsx(Label, {
|
|
739
1219
|
htmlFor: controlId,
|
|
1220
|
+
className: classNames?.label,
|
|
740
1221
|
children: label
|
|
741
1222
|
}),
|
|
742
1223
|
children({
|
|
743
|
-
controlProps
|
|
744
|
-
id: controlId,
|
|
745
|
-
name,
|
|
746
|
-
className: "input__control field__control",
|
|
747
|
-
disabled: isDisabled,
|
|
748
|
-
readOnly: isReadOnly,
|
|
749
|
-
required: isRequired,
|
|
750
|
-
"aria-required": isRequired || void 0,
|
|
751
|
-
"aria-invalid": invalid || void 0,
|
|
752
|
-
"aria-describedby": describedBy
|
|
753
|
-
},
|
|
1224
|
+
controlProps,
|
|
754
1225
|
isInvalid: invalid,
|
|
755
1226
|
errorMessage: message
|
|
756
1227
|
}),
|
|
@@ -760,7 +1231,7 @@ function Field({ label, name, children, id, description, errorMessage, isInvalid
|
|
|
760
1231
|
}
|
|
761
1232
|
//#endregion
|
|
762
1233
|
//#region src/Form.tsx
|
|
763
|
-
function Form({ children, validationErrors = {}, onSubmit, onReset, noValidate = false, id, "aria-label": ariaLabel, "aria-labelledby": labelledBy, dir }) {
|
|
1234
|
+
function Form({ children, validationErrors = {}, onSubmit, onReset, noValidate = false, id, "aria-label": ariaLabel, "aria-labelledby": labelledBy, dir, className, style, classNames }) {
|
|
764
1235
|
function submit(event) {
|
|
765
1236
|
event.preventDefault();
|
|
766
1237
|
const form = event.currentTarget;
|
|
@@ -781,7 +1252,8 @@ function Form({ children, validationErrors = {}, onSubmit, onReset, noValidate =
|
|
|
781
1252
|
return /* @__PURE__ */ jsx(FormErrorsContext.Provider, {
|
|
782
1253
|
value: validationErrors,
|
|
783
1254
|
children: /* @__PURE__ */ jsx("form", {
|
|
784
|
-
className: "form",
|
|
1255
|
+
className: partClass(partClass("form", classNames?.root), className),
|
|
1256
|
+
style,
|
|
785
1257
|
id,
|
|
786
1258
|
dir,
|
|
787
1259
|
"aria-label": ariaLabel,
|
|
@@ -809,7 +1281,7 @@ function listboxSelection(value, options, mode) {
|
|
|
809
1281
|
}
|
|
810
1282
|
//#endregion
|
|
811
1283
|
//#region src/Listbox.tsx
|
|
812
|
-
function
|
|
1284
|
+
function CompactListbox({ label, options, value, defaultValue = [], onChange, selectionMode = "single", isDisabled = false, description, errorMessage, isInvalid = false, name, id, dir, emptyMessage = "Tidak ada pilihan.", className, style, classNames }) {
|
|
813
1285
|
const [local, setLocal] = useState(defaultValue);
|
|
814
1286
|
const selected = listboxSelection(value ?? local, options, selectionMode);
|
|
815
1287
|
const nodeRef = useRef(null);
|
|
@@ -836,6 +1308,7 @@ function Listbox({ label, options, value, defaultValue = [], onChange, selection
|
|
|
836
1308
|
const generated = useId();
|
|
837
1309
|
const labelId = `${id ?? generated}-label`;
|
|
838
1310
|
const { describedBy, feedback } = useFeedback({
|
|
1311
|
+
classNames,
|
|
839
1312
|
description,
|
|
840
1313
|
errorMessage,
|
|
841
1314
|
isInvalid
|
|
@@ -848,18 +1321,19 @@ function Listbox({ label, options, value, defaultValue = [], onChange, selection
|
|
|
848
1321
|
onChange?.(next);
|
|
849
1322
|
}
|
|
850
1323
|
const list = /* @__PURE__ */ jsxs("div", {
|
|
851
|
-
className: "input listbox",
|
|
1324
|
+
className: partClass(partClass("input listbox", classNames?.root), className),
|
|
1325
|
+
style,
|
|
852
1326
|
dir,
|
|
853
1327
|
children: [
|
|
854
1328
|
/* @__PURE__ */ jsx("span", {
|
|
855
1329
|
id: labelId,
|
|
856
|
-
className: "label",
|
|
1330
|
+
className: partClass("label", classNames?.label),
|
|
857
1331
|
children: label
|
|
858
1332
|
}),
|
|
859
|
-
/* @__PURE__ */ jsx(ListBox$
|
|
1333
|
+
/* @__PURE__ */ jsx(ListBox$2, {
|
|
860
1334
|
ref: listRef,
|
|
861
1335
|
id,
|
|
862
|
-
className: "listbox__list",
|
|
1336
|
+
className: partClass("listbox__list", classNames?.list),
|
|
863
1337
|
"aria-labelledby": labelId,
|
|
864
1338
|
"aria-describedby": describedBy,
|
|
865
1339
|
"aria-invalid": isInvalid || void 0,
|
|
@@ -871,18 +1345,18 @@ function Listbox({ label, options, value, defaultValue = [], onChange, selection
|
|
|
871
1345
|
onSelectionChange: change,
|
|
872
1346
|
disabledKeys: options.filter((option) => isDisabled || option.isDisabled).map((option) => option.id),
|
|
873
1347
|
renderEmptyState: () => /* @__PURE__ */ jsx("span", {
|
|
874
|
-
className: "listbox__empty",
|
|
1348
|
+
className: partClass("listbox__empty", classNames?.empty),
|
|
875
1349
|
children: emptyMessage
|
|
876
1350
|
}),
|
|
877
1351
|
children: options.map((option) => /* @__PURE__ */ jsxs(ListBoxItem$1, {
|
|
878
1352
|
id: option.id,
|
|
879
1353
|
textValue: option.label,
|
|
880
1354
|
isDisabled: isDisabled || option.isDisabled,
|
|
881
|
-
className: "listbox__item",
|
|
1355
|
+
className: partClass("listbox__item", classNames?.item),
|
|
882
1356
|
children: [/* @__PURE__ */ jsx("span", {
|
|
883
|
-
className: "listbox__text",
|
|
1357
|
+
className: partClass("listbox__text", classNames?.itemLabel),
|
|
884
1358
|
children: option.label
|
|
885
|
-
}), /* @__PURE__ */ jsx(CheckIcon, { className: "listbox__check" })]
|
|
1359
|
+
}), /* @__PURE__ */ jsx(CheckIcon, { className: partClass("listbox__check", classNames?.indicator) })]
|
|
886
1360
|
}, option.id))
|
|
887
1361
|
}),
|
|
888
1362
|
feedback,
|
|
@@ -899,12 +1373,66 @@ function Listbox({ label, options, value, defaultValue = [], onChange, selection
|
|
|
899
1373
|
children: list
|
|
900
1374
|
}) : list;
|
|
901
1375
|
}
|
|
1376
|
+
function ListboxRoot(props) {
|
|
1377
|
+
if ("options" in props) return /* @__PURE__ */ jsx(CompactListbox, { ...props });
|
|
1378
|
+
return /* @__PURE__ */ jsx(ListBoxRoot, { ...props });
|
|
1379
|
+
}
|
|
1380
|
+
var Listbox = /* @__PURE__ */ Object.assign(ListboxRoot, {
|
|
1381
|
+
Root: ListBoxRoot,
|
|
1382
|
+
Item: ListBoxItemPart,
|
|
1383
|
+
Section: ListBoxSectionPart,
|
|
1384
|
+
ItemIndicator: ListBoxItemIndicator
|
|
1385
|
+
});
|
|
1386
|
+
//#endregion
|
|
1387
|
+
//#region src/number-composition.tsx
|
|
1388
|
+
function NumberFieldComposition({ className, locale = "id-ID", value, defaultValue, onChange, min, max, ...props }) {
|
|
1389
|
+
return /* @__PURE__ */ jsx(I18nProvider, {
|
|
1390
|
+
locale,
|
|
1391
|
+
children: /* @__PURE__ */ jsx(NumberField$1, {
|
|
1392
|
+
...props,
|
|
1393
|
+
minValue: min,
|
|
1394
|
+
maxValue: max,
|
|
1395
|
+
value: value === void 0 ? void 0 : value ?? NaN,
|
|
1396
|
+
defaultValue: defaultValue ?? NaN,
|
|
1397
|
+
onChange: (next) => onChange?.(Number.isFinite(next) ? next : null),
|
|
1398
|
+
className: partClass("input number-field", className)
|
|
1399
|
+
})
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
function NumberFieldGroup({ className, ...props }) {
|
|
1403
|
+
return /* @__PURE__ */ jsx(Group$1, {
|
|
1404
|
+
...props,
|
|
1405
|
+
className: partClass("number-field__group", className)
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
function NumberFieldInput({ className, ...props }) {
|
|
1409
|
+
return /* @__PURE__ */ jsx(Input$2, {
|
|
1410
|
+
...props,
|
|
1411
|
+
className: partClass("number-field__control", className)
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
function NumberFieldIncrement({ className, ...props }) {
|
|
1415
|
+
return /* @__PURE__ */ jsx(Button$3, {
|
|
1416
|
+
"aria-label": "Tambah",
|
|
1417
|
+
...props,
|
|
1418
|
+
slot: "increment",
|
|
1419
|
+
className: partClass("number-field__step", className)
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
function NumberFieldDecrement({ className, ...props }) {
|
|
1423
|
+
return /* @__PURE__ */ jsx(Button$3, {
|
|
1424
|
+
"aria-label": "Kurangi",
|
|
1425
|
+
...props,
|
|
1426
|
+
slot: "decrement",
|
|
1427
|
+
className: partClass("number-field__step", className)
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
902
1430
|
//#endregion
|
|
903
1431
|
//#region src/NumberField.tsx
|
|
904
1432
|
function finite(value) {
|
|
905
1433
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
906
1434
|
}
|
|
907
|
-
function
|
|
1435
|
+
function CompactNumberField({ label, value, defaultValue = null, onChange, min, max, step = 1, locale = "id-ID", formatOptions, description, errorMessage, isInvalid = false, isDisabled = false, isReadOnly = false, isRequired = false, name, id, dir, incrementLabel, decrementLabel, className, style, classNames }) {
|
|
908
1436
|
const buttonId = useId();
|
|
909
1437
|
const inputRef = useRef(null);
|
|
910
1438
|
const [local, setLocal] = useState(() => finite(defaultValue));
|
|
@@ -918,7 +1446,8 @@ function NumberField({ label, value, defaultValue = null, onChange, min, max, st
|
|
|
918
1446
|
return /* @__PURE__ */ jsx(I18nProvider, {
|
|
919
1447
|
locale,
|
|
920
1448
|
children: /* @__PURE__ */ jsx(NumberField$1, {
|
|
921
|
-
className: "input number-field",
|
|
1449
|
+
className: partClass(partClass("input number-field", classNames?.root), className),
|
|
1450
|
+
style,
|
|
922
1451
|
id,
|
|
923
1452
|
dir,
|
|
924
1453
|
value: selected ?? NaN,
|
|
@@ -942,11 +1471,11 @@ function NumberField({ label, value, defaultValue = null, onChange, min, max, st
|
|
|
942
1471
|
}
|
|
943
1472
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
944
1473
|
/* @__PURE__ */ jsx(Label$5, {
|
|
945
|
-
className: "label",
|
|
1474
|
+
className: partClass("label", classNames?.label),
|
|
946
1475
|
children: label
|
|
947
1476
|
}),
|
|
948
|
-
/* @__PURE__ */ jsx(Group, {
|
|
949
|
-
className: "number-field__group",
|
|
1477
|
+
/* @__PURE__ */ jsx(Group$1, {
|
|
1478
|
+
className: partClass("number-field__group", classNames?.group),
|
|
950
1479
|
onKeyDownCapture: (event) => {
|
|
951
1480
|
if (isDisabled || isReadOnly || !empty || ![
|
|
952
1481
|
"ArrowUp",
|
|
@@ -966,7 +1495,7 @@ function NumberField({ label, value, defaultValue = null, onChange, min, max, st
|
|
|
966
1495
|
onPress: empty ? startEmpty : void 0,
|
|
967
1496
|
isDisabled: empty ? isDisabled || isReadOnly : void 0,
|
|
968
1497
|
preventFocusOnPress: true,
|
|
969
|
-
className: "number-field__step",
|
|
1498
|
+
className: partClass(partClass("number-field__step", classNames?.button), classNames?.decrementButton),
|
|
970
1499
|
"aria-label": decrementLabel ?? `Kurangi ${label}`,
|
|
971
1500
|
"aria-labelledby": `${buttonId}-decrement`,
|
|
972
1501
|
excludeFromTabOrder: true,
|
|
@@ -978,7 +1507,7 @@ function NumberField({ label, value, defaultValue = null, onChange, min, max, st
|
|
|
978
1507
|
}),
|
|
979
1508
|
/* @__PURE__ */ jsx(Input$2, {
|
|
980
1509
|
ref: inputRef,
|
|
981
|
-
className: "number-field__control",
|
|
1510
|
+
className: partClass("number-field__control", classNames?.input),
|
|
982
1511
|
required: isRequired
|
|
983
1512
|
}),
|
|
984
1513
|
/* @__PURE__ */ jsxs(Button$3, {
|
|
@@ -986,7 +1515,7 @@ function NumberField({ label, value, defaultValue = null, onChange, min, max, st
|
|
|
986
1515
|
onPress: empty ? startEmpty : void 0,
|
|
987
1516
|
isDisabled: empty ? isDisabled || isReadOnly : void 0,
|
|
988
1517
|
preventFocusOnPress: true,
|
|
989
|
-
className: "number-field__step",
|
|
1518
|
+
className: partClass(partClass("number-field__step", classNames?.button), classNames?.incrementButton),
|
|
990
1519
|
"aria-label": incrementLabel ?? `Tambah ${label}`,
|
|
991
1520
|
"aria-labelledby": `${buttonId}-increment`,
|
|
992
1521
|
excludeFromTabOrder: true,
|
|
@@ -999,13 +1528,13 @@ function NumberField({ label, value, defaultValue = null, onChange, min, max, st
|
|
|
999
1528
|
]
|
|
1000
1529
|
}) })
|
|
1001
1530
|
}),
|
|
1002
|
-
description && /* @__PURE__ */ jsx(Text$
|
|
1531
|
+
description && /* @__PURE__ */ jsx(Text$3, {
|
|
1003
1532
|
slot: "description",
|
|
1004
|
-
className: "input__description",
|
|
1533
|
+
className: partClass("input__description", classNames?.description),
|
|
1005
1534
|
children: description
|
|
1006
1535
|
}),
|
|
1007
|
-
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError$
|
|
1008
|
-
className: "input__error",
|
|
1536
|
+
isInvalid && errorMessage && /* @__PURE__ */ jsx(FieldError$4, {
|
|
1537
|
+
className: partClass("input__error", classNames?.error),
|
|
1009
1538
|
children: errorMessage
|
|
1010
1539
|
}),
|
|
1011
1540
|
name && /* @__PURE__ */ jsx("input", {
|
|
@@ -1019,65 +1548,142 @@ function NumberField({ label, value, defaultValue = null, onChange, min, max, st
|
|
|
1019
1548
|
})
|
|
1020
1549
|
});
|
|
1021
1550
|
}
|
|
1551
|
+
function NumberFieldRoot(props) {
|
|
1552
|
+
if ("label" in props) return /* @__PURE__ */ jsx(CompactNumberField, { ...props });
|
|
1553
|
+
return /* @__PURE__ */ jsx(NumberFieldComposition, { ...props });
|
|
1554
|
+
}
|
|
1555
|
+
var NumberField = /* @__PURE__ */ Object.assign(NumberFieldRoot, {
|
|
1556
|
+
Root: NumberFieldComposition,
|
|
1557
|
+
Group: NumberFieldGroup,
|
|
1558
|
+
Input: NumberFieldInput,
|
|
1559
|
+
IncrementButton: NumberFieldIncrement,
|
|
1560
|
+
DecrementButton: NumberFieldDecrement
|
|
1561
|
+
});
|
|
1022
1562
|
//#endregion
|
|
1023
1563
|
//#region src/Card.tsx
|
|
1024
1564
|
/** A content container; place links and buttons inside rather than making it clickable. */
|
|
1025
|
-
function
|
|
1565
|
+
function CompactCard({ title, description, headingLevel = 3, actions, header, titleExtras, footer, children, className, classNames, ...props }) {
|
|
1026
1566
|
const Heading = `h${headingLevel}`;
|
|
1027
1567
|
return /* @__PURE__ */ jsxs("div", {
|
|
1028
1568
|
...props,
|
|
1029
|
-
className:
|
|
1569
|
+
className: partClass(partClass("card", classNames?.root), className),
|
|
1030
1570
|
children: [
|
|
1031
1571
|
(title || description || actions || header || titleExtras) && /* @__PURE__ */ jsxs("div", {
|
|
1032
|
-
className: "card__header",
|
|
1572
|
+
className: partClass("card__header", classNames?.header),
|
|
1033
1573
|
children: [(title || description || header || titleExtras) && /* @__PURE__ */ jsx("div", {
|
|
1034
|
-
className: "card__heading",
|
|
1574
|
+
className: partClass("card__heading", classNames?.heading),
|
|
1035
1575
|
children: header ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [titleExtras ? /* @__PURE__ */ jsxs("div", {
|
|
1036
|
-
className: "card__title-row",
|
|
1576
|
+
className: partClass("card__title-row", classNames?.titleRow),
|
|
1037
1577
|
children: [title && /* @__PURE__ */ jsx(Heading, {
|
|
1038
|
-
className: "card__title",
|
|
1578
|
+
className: partClass("card__title", classNames?.title),
|
|
1039
1579
|
children: title
|
|
1040
1580
|
}), titleExtras]
|
|
1041
1581
|
}) : title && /* @__PURE__ */ jsx(Heading, {
|
|
1042
|
-
className: "card__title",
|
|
1582
|
+
className: partClass("card__title", classNames?.title),
|
|
1043
1583
|
children: title
|
|
1044
1584
|
}), description && /* @__PURE__ */ jsx("p", {
|
|
1045
|
-
className: "card__description",
|
|
1585
|
+
className: partClass("card__description", classNames?.description),
|
|
1046
1586
|
children: description
|
|
1047
1587
|
})] })
|
|
1048
1588
|
}), actions && /* @__PURE__ */ jsx("div", {
|
|
1049
|
-
className: "card__actions",
|
|
1589
|
+
className: partClass("card__actions", classNames?.actions),
|
|
1050
1590
|
children: actions
|
|
1051
1591
|
})]
|
|
1052
1592
|
}),
|
|
1053
1593
|
/* @__PURE__ */ jsx("div", {
|
|
1054
|
-
className: "card__content",
|
|
1594
|
+
className: partClass("card__content", classNames?.content),
|
|
1055
1595
|
children
|
|
1056
1596
|
}),
|
|
1057
1597
|
footer && /* @__PURE__ */ jsx("div", {
|
|
1058
|
-
className: "card__footer",
|
|
1598
|
+
className: partClass("card__footer", classNames?.footer),
|
|
1059
1599
|
children: footer
|
|
1060
1600
|
})
|
|
1061
1601
|
]
|
|
1062
1602
|
});
|
|
1063
1603
|
}
|
|
1604
|
+
function CardRoot({ className, ...props }) {
|
|
1605
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1606
|
+
...props,
|
|
1607
|
+
className: partClass("card", className)
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
function CardHeader({ className, ...props }) {
|
|
1611
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1612
|
+
...props,
|
|
1613
|
+
className: partClass("card__header", className)
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
function CardHeading({ className, ...props }) {
|
|
1617
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1618
|
+
...props,
|
|
1619
|
+
className: partClass("card__heading", className)
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
function CardTitleRow({ className, ...props }) {
|
|
1623
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1624
|
+
...props,
|
|
1625
|
+
className: partClass("card__title-row", className)
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
function CardTitle({ className, headingLevel = 3, ...props }) {
|
|
1629
|
+
const Heading = `h${headingLevel}`;
|
|
1630
|
+
return /* @__PURE__ */ jsx(Heading, {
|
|
1631
|
+
...props,
|
|
1632
|
+
className: partClass("card__title", className)
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
function CardDescription({ className, ...props }) {
|
|
1636
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1637
|
+
...props,
|
|
1638
|
+
className: partClass("card__description", className)
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
function CardActions({ className, ...props }) {
|
|
1642
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1643
|
+
...props,
|
|
1644
|
+
className: partClass("card__actions", className)
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
function CardContent({ className, ...props }) {
|
|
1648
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1649
|
+
...props,
|
|
1650
|
+
className: partClass("card__content", className)
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
function CardFooter({ className, ...props }) {
|
|
1654
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1655
|
+
...props,
|
|
1656
|
+
className: partClass("card__footer", className)
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
var Card = /* @__PURE__ */ Object.assign(CompactCard, {
|
|
1660
|
+
Root: CardRoot,
|
|
1661
|
+
Header: CardHeader,
|
|
1662
|
+
Heading: CardHeading,
|
|
1663
|
+
TitleRow: CardTitleRow,
|
|
1664
|
+
Title: CardTitle,
|
|
1665
|
+
Description: CardDescription,
|
|
1666
|
+
Actions: CardActions,
|
|
1667
|
+
Content: CardContent,
|
|
1668
|
+
Footer: CardFooter
|
|
1669
|
+
});
|
|
1064
1670
|
//#endregion
|
|
1065
1671
|
//#region src/Badge.tsx
|
|
1066
1672
|
/** Static status text. Dynamic announcements belong in an application-owned live region. */
|
|
1067
|
-
function Badge({ tone = "neutral", className, ...props }) {
|
|
1673
|
+
function Badge({ tone = "neutral", className, classNames, ...props }) {
|
|
1068
1674
|
return /* @__PURE__ */ jsx("span", {
|
|
1069
1675
|
...props,
|
|
1070
|
-
className:
|
|
1676
|
+
className: partClass(partClass("badge", classNames?.root), className),
|
|
1071
1677
|
"data-tone": tone
|
|
1072
1678
|
});
|
|
1073
1679
|
}
|
|
1074
1680
|
//#endregion
|
|
1075
1681
|
//#region src/Skeleton.tsx
|
|
1076
1682
|
/** Decorative placeholder. Set aria-busy and loading text on the surrounding content. */
|
|
1077
|
-
function Skeleton({ shape = "rectangle", animated = true, className, ...props }) {
|
|
1683
|
+
function Skeleton({ shape = "rectangle", animated = true, className, classNames, ...props }) {
|
|
1078
1684
|
return /* @__PURE__ */ jsx("span", {
|
|
1079
1685
|
...props,
|
|
1080
|
-
className:
|
|
1686
|
+
className: partClass(partClass("skeleton", classNames?.root), className),
|
|
1081
1687
|
"data-shape": shape,
|
|
1082
1688
|
"data-animated": animated ? "true" : void 0,
|
|
1083
1689
|
"aria-hidden": "true"
|
|
@@ -1085,10 +1691,10 @@ function Skeleton({ shape = "rectangle", animated = true, className, ...props })
|
|
|
1085
1691
|
}
|
|
1086
1692
|
//#endregion
|
|
1087
1693
|
//#region src/Separator.tsx
|
|
1088
|
-
function Separator({ orientation = "horizontal", decorative = true, className, ...props }) {
|
|
1694
|
+
function Separator({ orientation = "horizontal", decorative = true, className, classNames, ...props }) {
|
|
1089
1695
|
return /* @__PURE__ */ jsx("div", {
|
|
1090
1696
|
...props,
|
|
1091
|
-
className:
|
|
1697
|
+
className: partClass(partClass("separator", classNames?.root), className),
|
|
1092
1698
|
"data-orientation": orientation,
|
|
1093
1699
|
role: decorative ? "presentation" : "separator",
|
|
1094
1700
|
"aria-hidden": decorative ? "true" : void 0,
|
|
@@ -1194,19 +1800,19 @@ function mountTabsIndicator(container) {
|
|
|
1194
1800
|
}
|
|
1195
1801
|
//#endregion
|
|
1196
1802
|
//#region src/Tabs.tsx
|
|
1197
|
-
function
|
|
1803
|
+
function CompactTabs({ className, style, classNames, label, variant = "primary", size = "md", orientation = "horizontal", align = "center", fullWidth = false, inset = "default", showSeparators = false, renderIcon, previousLabel = "Tab sebelumnya / Previous tabs", nextLabel = "Tab berikutnya / Next tabs", extras, actions, items, value, defaultValue, onChange, renderPanel, activationMode = "manual", dir, id }) {
|
|
1198
1804
|
const container = useRef(null);
|
|
1199
1805
|
const hasToolbar = !!(extras || actions);
|
|
1200
1806
|
useEffect(() => container.current ? mountTabsIndicator(container.current) : void 0, [items.length, hasToolbar]);
|
|
1201
1807
|
const [local, setLocal] = useState(defaultValue);
|
|
1202
1808
|
const selected = items.find((item) => item.id === (value ?? local) && !item.isDisabled)?.id ?? items.find((item) => !item.isDisabled)?.id;
|
|
1203
1809
|
const list = items.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1204
|
-
className: "tabs__list-container",
|
|
1810
|
+
className: partClass("tabs__list-container", classNames?.listContainer),
|
|
1205
1811
|
ref: container,
|
|
1206
1812
|
children: [
|
|
1207
1813
|
/* @__PURE__ */ jsx("button", {
|
|
1208
1814
|
type: "button",
|
|
1209
|
-
className: "tabs__scroll-button tabs__scroll-button--prev",
|
|
1815
|
+
className: partClass("tabs__scroll-button tabs__scroll-button--prev", classNames?.scrollButton),
|
|
1210
1816
|
"data-tabs-scroll": "prev",
|
|
1211
1817
|
hidden: true,
|
|
1212
1818
|
"aria-label": previousLabel,
|
|
@@ -1217,24 +1823,24 @@ function Tabs({ label, variant = "primary", size = "md", orientation = "horizont
|
|
|
1217
1823
|
})
|
|
1218
1824
|
}),
|
|
1219
1825
|
/* @__PURE__ */ jsx(TabList, {
|
|
1220
|
-
className: "tabs__list",
|
|
1826
|
+
className: partClass("tabs__list", classNames?.list),
|
|
1221
1827
|
"aria-label": label,
|
|
1222
1828
|
children: items.map((item, index) => /* @__PURE__ */ jsxs(Tab, {
|
|
1223
|
-
className: "tabs__trigger",
|
|
1829
|
+
className: partClass("tabs__trigger", classNames?.tab),
|
|
1224
1830
|
id: item.id,
|
|
1225
1831
|
isDisabled: item.isDisabled,
|
|
1226
1832
|
children: [
|
|
1227
1833
|
showSeparators && index > 0 && /* @__PURE__ */ jsx("span", {
|
|
1228
|
-
className: "tabs__separator",
|
|
1834
|
+
className: partClass("tabs__separator", classNames?.separator),
|
|
1229
1835
|
"aria-hidden": "true"
|
|
1230
1836
|
}),
|
|
1231
1837
|
renderIcon && /* @__PURE__ */ jsx("span", {
|
|
1232
|
-
className: "tabs__icon",
|
|
1838
|
+
className: partClass("tabs__icon", classNames?.icon),
|
|
1233
1839
|
"aria-hidden": "true",
|
|
1234
1840
|
children: renderIcon(item)
|
|
1235
1841
|
}),
|
|
1236
1842
|
/* @__PURE__ */ jsx("span", {
|
|
1237
|
-
className: "tabs__label",
|
|
1843
|
+
className: partClass("tabs__label", classNames?.label),
|
|
1238
1844
|
children: item.label
|
|
1239
1845
|
})
|
|
1240
1846
|
]
|
|
@@ -1242,7 +1848,7 @@ function Tabs({ label, variant = "primary", size = "md", orientation = "horizont
|
|
|
1242
1848
|
}),
|
|
1243
1849
|
/* @__PURE__ */ jsx("button", {
|
|
1244
1850
|
type: "button",
|
|
1245
|
-
className: "tabs__scroll-button tabs__scroll-button--next",
|
|
1851
|
+
className: partClass("tabs__scroll-button tabs__scroll-button--next", classNames?.scrollButton),
|
|
1246
1852
|
"data-tabs-scroll": "next",
|
|
1247
1853
|
hidden: true,
|
|
1248
1854
|
"aria-label": nextLabel,
|
|
@@ -1257,12 +1863,15 @@ function Tabs({ label, variant = "primary", size = "md", orientation = "horizont
|
|
|
1257
1863
|
const content = /* @__PURE__ */ jsxs(Tabs$1, {
|
|
1258
1864
|
className: [
|
|
1259
1865
|
"tabs",
|
|
1866
|
+
classNames?.root,
|
|
1867
|
+
className,
|
|
1260
1868
|
`tabs--${variant === "default" ? "primary" : variant}`,
|
|
1261
1869
|
`tabs--align-${align}`,
|
|
1262
1870
|
fullWidth && "tabs--full-width",
|
|
1263
1871
|
inset === "none" && "tabs--flush",
|
|
1264
1872
|
size !== "md" && `tabs--${size}`
|
|
1265
1873
|
].filter(Boolean).join(" "),
|
|
1874
|
+
style,
|
|
1266
1875
|
id,
|
|
1267
1876
|
orientation,
|
|
1268
1877
|
dir,
|
|
@@ -1277,20 +1886,20 @@ function Tabs({ label, variant = "primary", size = "md", orientation = "horizont
|
|
|
1277
1886
|
}
|
|
1278
1887
|
},
|
|
1279
1888
|
children: [extras || actions ? /* @__PURE__ */ jsxs("div", {
|
|
1280
|
-
className: "tabs__toolbar",
|
|
1889
|
+
className: partClass("tabs__toolbar", classNames?.toolbar),
|
|
1281
1890
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1282
|
-
className: "tabs__navigation",
|
|
1891
|
+
className: partClass("tabs__navigation", classNames?.navigation),
|
|
1283
1892
|
children: [list, extras && /* @__PURE__ */ jsx("div", {
|
|
1284
|
-
className: "tabs__extras",
|
|
1893
|
+
className: partClass("tabs__extras", classNames?.extras),
|
|
1285
1894
|
children: extras
|
|
1286
1895
|
})]
|
|
1287
1896
|
}), actions && /* @__PURE__ */ jsx("div", {
|
|
1288
|
-
className: "tabs__actions",
|
|
1897
|
+
className: partClass("tabs__actions", classNames?.actions),
|
|
1289
1898
|
children: actions
|
|
1290
1899
|
})]
|
|
1291
1900
|
}) : list, items.map((item) => /* @__PURE__ */ jsx(TabPanel, {
|
|
1292
1901
|
id: item.id,
|
|
1293
|
-
className: "tabs__panel",
|
|
1902
|
+
className: partClass("tabs__panel", classNames?.panel),
|
|
1294
1903
|
children: renderPanel(item)
|
|
1295
1904
|
}, item.id))]
|
|
1296
1905
|
});
|
|
@@ -1299,16 +1908,113 @@ function Tabs({ label, variant = "primary", size = "md", orientation = "horizont
|
|
|
1299
1908
|
children: content
|
|
1300
1909
|
}) : content;
|
|
1301
1910
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1911
|
+
function TabsRoot({ className, classNames, value, defaultValue, onChange, variant = "primary", size = "md", align = "center", fullWidth, ...props }) {
|
|
1912
|
+
return /* @__PURE__ */ jsx(Tabs$1, {
|
|
1913
|
+
...props,
|
|
1914
|
+
selectedKey: value,
|
|
1915
|
+
defaultSelectedKey: defaultValue,
|
|
1916
|
+
onSelectionChange: onChange ? (key) => onChange(String(key)) : void 0,
|
|
1917
|
+
className: [
|
|
1918
|
+
"tabs",
|
|
1919
|
+
`tabs--${variant === "default" ? "primary" : variant}`,
|
|
1920
|
+
`tabs--align-${align}`,
|
|
1921
|
+
size !== "md" && `tabs--${size}`,
|
|
1922
|
+
fullWidth && "tabs--full-width",
|
|
1923
|
+
classNames?.root,
|
|
1924
|
+
className
|
|
1925
|
+
].filter(Boolean).join(" ")
|
|
1926
|
+
});
|
|
1927
|
+
}
|
|
1928
|
+
function TabsListContainer({ className, children, previousLabel = "Tab sebelumnya / Previous tabs", nextLabel = "Tab berikutnya / Next tabs", ...props }) {
|
|
1929
|
+
const ref = useRef(null);
|
|
1930
|
+
useEffect(() => ref.current ? mountTabsIndicator(ref.current) : void 0, []);
|
|
1931
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1932
|
+
...props,
|
|
1933
|
+
ref,
|
|
1934
|
+
className: partClass("tabs__list-container", className),
|
|
1935
|
+
children: [
|
|
1936
|
+
/* @__PURE__ */ jsx("button", {
|
|
1937
|
+
type: "button",
|
|
1938
|
+
className: "tabs__scroll-button tabs__scroll-button--prev",
|
|
1939
|
+
"data-tabs-scroll": "prev",
|
|
1940
|
+
hidden: true,
|
|
1941
|
+
"aria-label": previousLabel,
|
|
1942
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
1943
|
+
viewBox: "0 0 24 24",
|
|
1944
|
+
"aria-hidden": "true",
|
|
1945
|
+
children: /* @__PURE__ */ jsx("path", { d: "m14 6-6 6 6 6" })
|
|
1946
|
+
})
|
|
1947
|
+
}),
|
|
1948
|
+
children,
|
|
1949
|
+
/* @__PURE__ */ jsx("button", {
|
|
1950
|
+
type: "button",
|
|
1951
|
+
className: "tabs__scroll-button tabs__scroll-button--next",
|
|
1952
|
+
"data-tabs-scroll": "next",
|
|
1953
|
+
hidden: true,
|
|
1954
|
+
"aria-label": nextLabel,
|
|
1955
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
1956
|
+
viewBox: "0 0 24 24",
|
|
1957
|
+
"aria-hidden": "true",
|
|
1958
|
+
children: /* @__PURE__ */ jsx("path", { d: "m10 6 6 6-6 6" })
|
|
1959
|
+
})
|
|
1960
|
+
})
|
|
1961
|
+
]
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
function TabsList(props) {
|
|
1965
|
+
return /* @__PURE__ */ jsx(TabList, {
|
|
1966
|
+
...props,
|
|
1967
|
+
className: composeRenderProps(props.className, (value) => partClass("tabs__list", value))
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
function TabsTab(props) {
|
|
1971
|
+
return /* @__PURE__ */ jsx(Tab, {
|
|
1972
|
+
...props,
|
|
1973
|
+
className: composeRenderProps(props.className, (value) => partClass("tabs__trigger", value))
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
function TabsPanel(props) {
|
|
1977
|
+
return /* @__PURE__ */ jsx(TabPanel, {
|
|
1978
|
+
...props,
|
|
1979
|
+
className: composeRenderProps(props.className, (value) => partClass("tabs__panel", value))
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
function TabsIndicator({ className, ...props }) {
|
|
1983
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1984
|
+
...props,
|
|
1985
|
+
"aria-hidden": "true",
|
|
1986
|
+
className: partClass("tabs__indicator", className)
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
function TabsSeparator({ className, ...props }) {
|
|
1990
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1991
|
+
...props,
|
|
1992
|
+
"aria-hidden": "true",
|
|
1993
|
+
className: partClass("tabs__separator", className)
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
function TabsComponent(props) {
|
|
1997
|
+
return "items" in props ? /* @__PURE__ */ jsx(CompactTabs, { ...props }) : /* @__PURE__ */ jsx(TabsRoot, { ...props });
|
|
1998
|
+
}
|
|
1999
|
+
var Tabs = /* @__PURE__ */ Object.assign(TabsComponent, {
|
|
2000
|
+
Root: TabsRoot,
|
|
2001
|
+
ListContainer: TabsListContainer,
|
|
2002
|
+
List: TabsList,
|
|
2003
|
+
Tab: TabsTab,
|
|
2004
|
+
Panel: TabsPanel,
|
|
2005
|
+
Indicator: TabsIndicator,
|
|
2006
|
+
Separator: TabsSeparator
|
|
2007
|
+
});
|
|
2008
|
+
//#endregion
|
|
2009
|
+
//#region src/pagination-model.ts
|
|
2010
|
+
function paginationModel(totalItems, pageSize, value, siblingCount = 1) {
|
|
2011
|
+
const count = Math.max(1, Math.ceil((Number.isFinite(totalItems) ? Math.min(Number.MAX_SAFE_INTEGER, Math.max(0, Math.floor(totalItems))) : 0) / (Number.isFinite(pageSize) ? Math.max(1, Math.floor(pageSize)) : 10)));
|
|
2012
|
+
const current = Math.min(count, Math.max(1, Number.isFinite(value) ? Math.floor(value) : 1));
|
|
2013
|
+
const siblings = Number.isFinite(siblingCount) ? Math.min(2, Math.max(0, Math.floor(siblingCount))) : 1;
|
|
2014
|
+
const pages = /* @__PURE__ */ new Set([
|
|
2015
|
+
1,
|
|
2016
|
+
count,
|
|
2017
|
+
current
|
|
1312
2018
|
]);
|
|
1313
2019
|
for (let offset = 1; offset <= siblings; offset++) {
|
|
1314
2020
|
if (current - offset > 1) pages.add(current - offset);
|
|
@@ -1328,7 +2034,7 @@ function paginationModel(totalItems, pageSize, value, siblingCount = 1) {
|
|
|
1328
2034
|
}
|
|
1329
2035
|
//#endregion
|
|
1330
2036
|
//#region src/Pagination.tsx
|
|
1331
|
-
function
|
|
2037
|
+
function CompactPagination({ className, style, classNames, totalItems, pageSize = 10, value, defaultValue = 1, onChange, isDisabled = false, siblingCount = 1, label = "Navigasi halaman", previousLabel = "Sebelumnya", nextLabel = "Berikutnya", pageLabel = "Halaman", dir, id }) {
|
|
1332
2038
|
const [local, setLocal] = useState(defaultValue);
|
|
1333
2039
|
const { current, count, entries } = paginationModel(totalItems, pageSize, value ?? local, siblingCount);
|
|
1334
2040
|
function change(next) {
|
|
@@ -1337,25 +2043,26 @@ function Pagination({ totalItems, pageSize = 10, value, defaultValue = 1, onChan
|
|
|
1337
2043
|
onChange?.(next);
|
|
1338
2044
|
}
|
|
1339
2045
|
return /* @__PURE__ */ jsxs("nav", {
|
|
1340
|
-
className: "pagination",
|
|
2046
|
+
className: partClass(partClass("pagination", classNames?.root), className),
|
|
2047
|
+
style,
|
|
1341
2048
|
"aria-label": label,
|
|
1342
2049
|
dir,
|
|
1343
2050
|
id,
|
|
1344
2051
|
children: [
|
|
1345
2052
|
/* @__PURE__ */ jsx("button", {
|
|
1346
2053
|
type: "button",
|
|
1347
|
-
className: "pagination__button",
|
|
2054
|
+
className: partClass("pagination__button", classNames?.button),
|
|
1348
2055
|
disabled: isDisabled || current === 1,
|
|
1349
2056
|
onClick: () => change(current - 1),
|
|
1350
2057
|
children: previousLabel
|
|
1351
2058
|
}),
|
|
1352
2059
|
entries.map((entry) => typeof entry === "string" ? /* @__PURE__ */ jsx("span", {
|
|
1353
|
-
className: "pagination__gap",
|
|
2060
|
+
className: partClass("pagination__gap", classNames?.gap),
|
|
1354
2061
|
"aria-hidden": "true",
|
|
1355
2062
|
children: "..."
|
|
1356
2063
|
}, entry) : /* @__PURE__ */ jsx("button", {
|
|
1357
2064
|
type: "button",
|
|
1358
|
-
className: "pagination__button",
|
|
2065
|
+
className: partClass("pagination__button", classNames?.button),
|
|
1359
2066
|
"aria-label": `${pageLabel} ${entry}`,
|
|
1360
2067
|
"aria-current": entry === current ? "page" : void 0,
|
|
1361
2068
|
disabled: isDisabled,
|
|
@@ -1364,13 +2071,13 @@ function Pagination({ totalItems, pageSize = 10, value, defaultValue = 1, onChan
|
|
|
1364
2071
|
}, entry)),
|
|
1365
2072
|
/* @__PURE__ */ jsx("button", {
|
|
1366
2073
|
type: "button",
|
|
1367
|
-
className: "pagination__button",
|
|
2074
|
+
className: partClass("pagination__button", classNames?.button),
|
|
1368
2075
|
disabled: isDisabled || current === count,
|
|
1369
2076
|
onClick: () => change(current + 1),
|
|
1370
2077
|
children: nextLabel
|
|
1371
2078
|
}),
|
|
1372
2079
|
/* @__PURE__ */ jsxs("span", {
|
|
1373
|
-
className: "pagination__summary",
|
|
2080
|
+
className: partClass("pagination__summary", classNames?.summary),
|
|
1374
2081
|
"aria-live": "polite",
|
|
1375
2082
|
children: [
|
|
1376
2083
|
current,
|
|
@@ -1381,27 +2088,538 @@ function Pagination({ totalItems, pageSize = 10, value, defaultValue = 1, onChan
|
|
|
1381
2088
|
]
|
|
1382
2089
|
});
|
|
1383
2090
|
}
|
|
2091
|
+
var PaginationContext = createContext(null);
|
|
2092
|
+
function usePagination() {
|
|
2093
|
+
const context = useContext(PaginationContext);
|
|
2094
|
+
if (!context) throw new Error("Pagination parts must be used inside Pagination.Root.");
|
|
2095
|
+
return context;
|
|
2096
|
+
}
|
|
2097
|
+
function PaginationRoot({ totalItems, pageSize = 10, value, defaultValue = 1, onChange, isDisabled = false, siblingCount = 1, label = "Navigasi halaman / Pagination", className, classNames, style, dir, id, children }) {
|
|
2098
|
+
const [local, setLocal] = useState(defaultValue);
|
|
2099
|
+
const { current, count } = paginationModel(totalItems, pageSize, value ?? local, siblingCount);
|
|
2100
|
+
function change(page) {
|
|
2101
|
+
if (isDisabled || !Number.isInteger(page) || page < 1 || page > count || page === current) return;
|
|
2102
|
+
setLocal(page);
|
|
2103
|
+
onChange?.(page);
|
|
2104
|
+
}
|
|
2105
|
+
return /* @__PURE__ */ jsx(PaginationContext.Provider, {
|
|
2106
|
+
value: {
|
|
2107
|
+
current,
|
|
2108
|
+
count,
|
|
2109
|
+
disabled: isDisabled,
|
|
2110
|
+
change
|
|
2111
|
+
},
|
|
2112
|
+
children: /* @__PURE__ */ jsx("nav", {
|
|
2113
|
+
id,
|
|
2114
|
+
dir,
|
|
2115
|
+
style,
|
|
2116
|
+
"aria-label": label,
|
|
2117
|
+
className: partClass(partClass("pagination", classNames?.root), className),
|
|
2118
|
+
children
|
|
2119
|
+
})
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
function PaginationPageButton({ page, className, onClick, disabled, ...props }) {
|
|
2123
|
+
const state = usePagination();
|
|
2124
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2125
|
+
...props,
|
|
2126
|
+
type: "button",
|
|
2127
|
+
className: partClass("pagination__button", className),
|
|
2128
|
+
disabled: disabled || state.disabled || !Number.isInteger(page) || page < 1 || page > state.count,
|
|
2129
|
+
"aria-current": page === state.current ? "page" : void 0,
|
|
2130
|
+
onClick: (event) => {
|
|
2131
|
+
onClick?.(event);
|
|
2132
|
+
if (!event.defaultPrevented) state.change(page);
|
|
2133
|
+
}
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
function PaginationPrevious(props) {
|
|
2137
|
+
const state = usePagination();
|
|
2138
|
+
return /* @__PURE__ */ jsx(PaginationPageButton, {
|
|
2139
|
+
"aria-label": props.children ? void 0 : "Halaman sebelumnya / Previous page",
|
|
2140
|
+
...props,
|
|
2141
|
+
page: state.current - 1
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
function PaginationNext(props) {
|
|
2145
|
+
const state = usePagination();
|
|
2146
|
+
return /* @__PURE__ */ jsx(PaginationPageButton, {
|
|
2147
|
+
"aria-label": props.children ? void 0 : "Halaman berikutnya / Next page",
|
|
2148
|
+
...props,
|
|
2149
|
+
page: state.current + 1
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function PaginationSummary({ className, children, ...props }) {
|
|
2153
|
+
const state = usePagination();
|
|
2154
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2155
|
+
...props,
|
|
2156
|
+
"aria-live": "polite",
|
|
2157
|
+
className: partClass("pagination__summary", className),
|
|
2158
|
+
children: children ?? `${state.current} / ${state.count}`
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
function PaginationContent(props) {
|
|
2162
|
+
return /* @__PURE__ */ jsx("div", { ...props });
|
|
2163
|
+
}
|
|
2164
|
+
function PaginationItem(props) {
|
|
2165
|
+
return /* @__PURE__ */ jsx("span", { ...props });
|
|
2166
|
+
}
|
|
2167
|
+
function PaginationEllipsis({ className, children = "…", ...props }) {
|
|
2168
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2169
|
+
...props,
|
|
2170
|
+
"aria-hidden": "true",
|
|
2171
|
+
className: partClass("pagination__gap", className),
|
|
2172
|
+
children
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
function PaginationComponent(props) {
|
|
2176
|
+
return "children" in props ? /* @__PURE__ */ jsx(PaginationRoot, { ...props }) : /* @__PURE__ */ jsx(CompactPagination, { ...props });
|
|
2177
|
+
}
|
|
2178
|
+
var Pagination = /* @__PURE__ */ Object.assign(PaginationComponent, {
|
|
2179
|
+
Root: PaginationRoot,
|
|
2180
|
+
Content: PaginationContent,
|
|
2181
|
+
Item: PaginationItem,
|
|
2182
|
+
PageButton: PaginationPageButton,
|
|
2183
|
+
Previous: PaginationPrevious,
|
|
2184
|
+
Next: PaginationNext,
|
|
2185
|
+
Summary: PaginationSummary,
|
|
2186
|
+
Ellipsis: PaginationEllipsis
|
|
2187
|
+
});
|
|
2188
|
+
//#endregion
|
|
2189
|
+
//#region src/structural-parts.tsx
|
|
2190
|
+
/** Preserve the primitive's complete props, ref and state-based className contract. */
|
|
2191
|
+
function ariaPart(Component, base) {
|
|
2192
|
+
return function Part({ className, ...props }) {
|
|
2193
|
+
return createElement(Component, {
|
|
2194
|
+
...props,
|
|
2195
|
+
className: typeof className === "function" ? (state) => partClass(base, className(state)) : partClass(base, className)
|
|
2196
|
+
});
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
function divPart(base) {
|
|
2200
|
+
return function Part({ className, ...props }) {
|
|
2201
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2202
|
+
...props,
|
|
2203
|
+
className: partClass(base, className)
|
|
2204
|
+
});
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
function DialogRoot({ open, defaultOpen, ...props }) {
|
|
2208
|
+
return /* @__PURE__ */ jsx(DialogTrigger, {
|
|
2209
|
+
...props,
|
|
2210
|
+
isOpen: open,
|
|
2211
|
+
defaultOpen
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
var DialogTriggerPart = ariaPart(Button$1, "button button--secondary");
|
|
2215
|
+
var DialogBackdrop = ariaPart(ModalOverlay, "dialog__backdrop dialog__viewport");
|
|
2216
|
+
var DialogPanel = ariaPart(Modal, "dialog__panel");
|
|
2217
|
+
var OverlayDescriptionContext = createContext(null);
|
|
2218
|
+
function DescribedDialog({ base, ...props }) {
|
|
2219
|
+
const [descriptions, setDescriptions] = useState([]);
|
|
2220
|
+
const register = useCallback((id) => {
|
|
2221
|
+
setDescriptions((current) => current.includes(id) ? current : [...current, id]);
|
|
2222
|
+
return () => setDescriptions((current) => current.filter((value) => value !== id));
|
|
2223
|
+
}, []);
|
|
2224
|
+
const describedBy = [props["aria-describedby"], ...descriptions].filter(Boolean).join(" ") || void 0;
|
|
2225
|
+
return /* @__PURE__ */ jsx(OverlayDescriptionContext.Provider, {
|
|
2226
|
+
value: register,
|
|
2227
|
+
children: /* @__PURE__ */ jsx(Dialog$1, {
|
|
2228
|
+
...props,
|
|
2229
|
+
"aria-describedby": describedBy,
|
|
2230
|
+
className: partClass(base, props.className)
|
|
2231
|
+
})
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
function DialogContent(props) {
|
|
2235
|
+
return /* @__PURE__ */ jsx(DescribedDialog, {
|
|
2236
|
+
...props,
|
|
2237
|
+
base: "dialog__content"
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
var OverlayHeader = divPart("overlay__header");
|
|
2241
|
+
var OverlayBody = divPart("overlay__body");
|
|
2242
|
+
var OverlayFooter = divPart("overlay__footer");
|
|
2243
|
+
function OverlayHeading({ level = 2, slot = "title", ...props }) {
|
|
2244
|
+
return /* @__PURE__ */ jsx(Heading, {
|
|
2245
|
+
...props,
|
|
2246
|
+
level,
|
|
2247
|
+
slot,
|
|
2248
|
+
className: partClass("overlay__title", props.className)
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
function OverlayDescription({ className, slot = "description", id, ...props }) {
|
|
2252
|
+
const generated = useId();
|
|
2253
|
+
const descriptionId = id ?? generated;
|
|
2254
|
+
const register = useContext(OverlayDescriptionContext);
|
|
2255
|
+
useEffect(() => register?.(descriptionId), [descriptionId, register]);
|
|
2256
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
2257
|
+
...props,
|
|
2258
|
+
id: descriptionId,
|
|
2259
|
+
slot,
|
|
2260
|
+
className: partClass("overlay__description", className)
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
function DialogCloseButton({ slot = "close", ...props }) {
|
|
2264
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
2265
|
+
...props,
|
|
2266
|
+
slot,
|
|
2267
|
+
className: composeRenderProps(props.className, (value) => partClass("dialog__close", value))
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
var PopoverTrigger = DialogTriggerPart;
|
|
2271
|
+
var PopoverContent = ariaPart(Popover$2, "popover__panel");
|
|
2272
|
+
function PopoverDialog(props) {
|
|
2273
|
+
return /* @__PURE__ */ jsx(DescribedDialog, {
|
|
2274
|
+
...props,
|
|
2275
|
+
base: "popover__content"
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
function PopoverCloseButton({ slot = "close", ...props }) {
|
|
2279
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
2280
|
+
...props,
|
|
2281
|
+
slot,
|
|
2282
|
+
className: composeRenderProps(props.className, (value) => partClass("button button--secondary", value))
|
|
2283
|
+
});
|
|
2284
|
+
}
|
|
2285
|
+
function TooltipRoot({ open, defaultOpen, ...props }) {
|
|
2286
|
+
return /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
2287
|
+
...props,
|
|
2288
|
+
isOpen: open,
|
|
2289
|
+
defaultOpen
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
var TooltipTriggerPart = DialogTriggerPart;
|
|
2293
|
+
var TooltipContent = ariaPart(Tooltip$1, "tooltip__panel");
|
|
2294
|
+
function DropdownRoot({ open, defaultOpen, ...props }) {
|
|
2295
|
+
return /* @__PURE__ */ jsx(MenuTrigger, {
|
|
2296
|
+
...props,
|
|
2297
|
+
isOpen: open,
|
|
2298
|
+
defaultOpen
|
|
2299
|
+
});
|
|
2300
|
+
}
|
|
2301
|
+
var DropdownTrigger = DialogTriggerPart;
|
|
2302
|
+
var DropdownPopover = ariaPart(Popover$2, "menu__panel");
|
|
2303
|
+
function DropdownList(props) {
|
|
2304
|
+
return /* @__PURE__ */ jsx(Menu, {
|
|
2305
|
+
...props,
|
|
2306
|
+
className: composeRenderProps(props.className, (value) => partClass("menu__list", value))
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
var DropdownItem = ariaPart(MenuItem, "menu__item");
|
|
2310
|
+
var DropdownSection = MenuSection;
|
|
2311
|
+
var DropdownHeading = ariaPart(Header$1, "menu__heading");
|
|
2312
|
+
var DropdownSeparator = ariaPart(Separator$1, "menu__separator");
|
|
2313
|
+
var DropdownSubmenuTrigger = SubmenuTrigger;
|
|
2314
|
+
function DropdownItemIndicator({ className, children, ...props }) {
|
|
2315
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
2316
|
+
viewBox: "0 0 16 16",
|
|
2317
|
+
fill: "none",
|
|
2318
|
+
stroke: "currentColor",
|
|
2319
|
+
strokeWidth: "1.5",
|
|
2320
|
+
strokeLinecap: "round",
|
|
2321
|
+
strokeLinejoin: "round",
|
|
2322
|
+
...props,
|
|
2323
|
+
"aria-hidden": "true",
|
|
2324
|
+
className: partClass("menu__check", className),
|
|
2325
|
+
children: children ?? /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-6.5" })
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
function DropdownSubmenuIndicator({ className, children, ...props }) {
|
|
2329
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
2330
|
+
viewBox: "0 0 16 16",
|
|
2331
|
+
fill: "none",
|
|
2332
|
+
stroke: "currentColor",
|
|
2333
|
+
strokeWidth: "1.5",
|
|
2334
|
+
strokeLinecap: "round",
|
|
2335
|
+
strokeLinejoin: "round",
|
|
2336
|
+
...props,
|
|
2337
|
+
"aria-hidden": "true",
|
|
2338
|
+
className: partClass("menu__arrow", className),
|
|
2339
|
+
children: children ?? /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4" })
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
function TableRoot({ className, ...props }) {
|
|
2343
|
+
return /* @__PURE__ */ jsx("table", {
|
|
2344
|
+
...props,
|
|
2345
|
+
className: partClass("table", className)
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
function TableScrollContainer({ className, "aria-label": label = "Tabel / Table", ...props }) {
|
|
2349
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2350
|
+
...props,
|
|
2351
|
+
role: "region",
|
|
2352
|
+
tabIndex: 0,
|
|
2353
|
+
"aria-label": label,
|
|
2354
|
+
className: partClass("table__scroll", className)
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
function TableHeader(props) {
|
|
2358
|
+
return /* @__PURE__ */ jsx("thead", { ...props });
|
|
2359
|
+
}
|
|
2360
|
+
function TableBody(props) {
|
|
2361
|
+
return /* @__PURE__ */ jsx("tbody", { ...props });
|
|
2362
|
+
}
|
|
2363
|
+
function TableFooter(props) {
|
|
2364
|
+
return /* @__PURE__ */ jsx("tfoot", { ...props });
|
|
2365
|
+
}
|
|
2366
|
+
function TableRow(props) {
|
|
2367
|
+
return /* @__PURE__ */ jsx("tr", { ...props });
|
|
2368
|
+
}
|
|
2369
|
+
function TableColumn({ scope = "col", ...props }) {
|
|
2370
|
+
return /* @__PURE__ */ jsx("th", {
|
|
2371
|
+
...props,
|
|
2372
|
+
scope
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
function TableCell(props) {
|
|
2376
|
+
return /* @__PURE__ */ jsx("td", { ...props });
|
|
2377
|
+
}
|
|
2378
|
+
function TableCaption({ className, ...props }) {
|
|
2379
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
2380
|
+
...props,
|
|
2381
|
+
className: partClass("table__caption", className)
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
1384
2384
|
//#endregion
|
|
1385
2385
|
//#region src/Table.tsx
|
|
1386
|
-
function
|
|
2386
|
+
function CompactTable({ caption, children, className, classNames, ...props }) {
|
|
1387
2387
|
return /* @__PURE__ */ jsx("div", {
|
|
1388
|
-
className: "table__scroll",
|
|
2388
|
+
className: partClass("table__scroll", classNames?.scroll),
|
|
1389
2389
|
role: "region",
|
|
1390
2390
|
"aria-label": caption,
|
|
1391
2391
|
tabIndex: 0,
|
|
1392
2392
|
children: /* @__PURE__ */ jsxs("table", {
|
|
1393
2393
|
...props,
|
|
1394
|
-
className:
|
|
2394
|
+
className: partClass(partClass("table", classNames?.root), className),
|
|
1395
2395
|
children: [/* @__PURE__ */ jsx("caption", {
|
|
1396
|
-
className: "table__caption",
|
|
2396
|
+
className: partClass("table__caption", classNames?.caption),
|
|
1397
2397
|
children: caption
|
|
1398
2398
|
}), children]
|
|
1399
2399
|
})
|
|
1400
2400
|
});
|
|
1401
2401
|
}
|
|
2402
|
+
var Table = /* @__PURE__ */ Object.assign(CompactTable, {
|
|
2403
|
+
Root: TableRoot,
|
|
2404
|
+
ScrollContainer: TableScrollContainer,
|
|
2405
|
+
Header: TableHeader,
|
|
2406
|
+
Body: TableBody,
|
|
2407
|
+
Footer: TableFooter,
|
|
2408
|
+
Row: TableRow,
|
|
2409
|
+
Column: TableColumn,
|
|
2410
|
+
Cell: TableCell,
|
|
2411
|
+
Caption: TableCaption
|
|
2412
|
+
});
|
|
2413
|
+
//#endregion
|
|
2414
|
+
//#region src/useDisclosure.ts
|
|
2415
|
+
function useDisclosure(open, defaultOpen = false, onOpenChange) {
|
|
2416
|
+
const [local, setLocal] = useState(defaultOpen);
|
|
2417
|
+
const visible = open ?? local;
|
|
2418
|
+
function change(next) {
|
|
2419
|
+
if (next === visible) return;
|
|
2420
|
+
setLocal(next);
|
|
2421
|
+
onOpenChange?.(next);
|
|
2422
|
+
}
|
|
2423
|
+
return {
|
|
2424
|
+
visible,
|
|
2425
|
+
change
|
|
2426
|
+
};
|
|
2427
|
+
}
|
|
2428
|
+
//#endregion
|
|
2429
|
+
//#region src/layout-parts.tsx
|
|
2430
|
+
function EmptyRoot({ className, ...props }) {
|
|
2431
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2432
|
+
...props,
|
|
2433
|
+
className: partClass("empty", className)
|
|
2434
|
+
});
|
|
2435
|
+
}
|
|
2436
|
+
function EmptyTitle({ className, headingLevel = 3, ...props }) {
|
|
2437
|
+
const Heading = `h${headingLevel}`;
|
|
2438
|
+
return /* @__PURE__ */ jsx(Heading, {
|
|
2439
|
+
...props,
|
|
2440
|
+
className: partClass("empty__title", className)
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
function EmptyDescription({ className, ...props }) {
|
|
2444
|
+
return /* @__PURE__ */ jsx("p", {
|
|
2445
|
+
...props,
|
|
2446
|
+
className: partClass("empty__description", className)
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
function EmptyActions({ className, ...props }) {
|
|
2450
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2451
|
+
...props,
|
|
2452
|
+
className: partClass("empty__actions", className)
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
var SidebarContext = createContext(null);
|
|
2456
|
+
function useSidebar() {
|
|
2457
|
+
const state = useContext(SidebarContext);
|
|
2458
|
+
if (!state) throw new Error("Sidebar parts must be used inside Sidebar.Root.");
|
|
2459
|
+
return state;
|
|
2460
|
+
}
|
|
2461
|
+
function SidebarRoot({ label, open, defaultOpen = true, onOpenChange, id, className, ...props }) {
|
|
2462
|
+
const generated = useId();
|
|
2463
|
+
const { visible, change } = useDisclosure(open, defaultOpen, onOpenChange);
|
|
2464
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
2465
|
+
value: {
|
|
2466
|
+
visible,
|
|
2467
|
+
change,
|
|
2468
|
+
label,
|
|
2469
|
+
navId: `${id ?? generated}-nav`
|
|
2470
|
+
},
|
|
2471
|
+
children: /* @__PURE__ */ jsx("aside", {
|
|
2472
|
+
...props,
|
|
2473
|
+
id,
|
|
2474
|
+
className: partClass("sidebar", className)
|
|
2475
|
+
})
|
|
2476
|
+
});
|
|
2477
|
+
}
|
|
2478
|
+
function SidebarHeader({ className, ...props }) {
|
|
2479
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2480
|
+
...props,
|
|
2481
|
+
className: partClass("sidebar__header", className)
|
|
2482
|
+
});
|
|
2483
|
+
}
|
|
2484
|
+
function SidebarTitle({ className, ...props }) {
|
|
2485
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2486
|
+
...props,
|
|
2487
|
+
className: partClass("sidebar__title", className)
|
|
2488
|
+
});
|
|
2489
|
+
}
|
|
2490
|
+
function SidebarToggle({ className, onClick, ...props }) {
|
|
2491
|
+
const state = useSidebar();
|
|
2492
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2493
|
+
...props,
|
|
2494
|
+
type: "button",
|
|
2495
|
+
className: partClass("sidebar__toggle", className),
|
|
2496
|
+
"aria-expanded": state.visible,
|
|
2497
|
+
"aria-controls": state.navId,
|
|
2498
|
+
onClick: (event) => {
|
|
2499
|
+
onClick?.(event);
|
|
2500
|
+
if (!event.defaultPrevented) state.change(!state.visible);
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
function SidebarNavigation(props) {
|
|
2505
|
+
const state = useSidebar();
|
|
2506
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
2507
|
+
...props,
|
|
2508
|
+
id: state.navId,
|
|
2509
|
+
"aria-label": state.label,
|
|
2510
|
+
hidden: !state.visible
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
function SidebarList(props) {
|
|
2514
|
+
return /* @__PURE__ */ jsx("ul", { ...props });
|
|
2515
|
+
}
|
|
2516
|
+
function SidebarItem(props) {
|
|
2517
|
+
return /* @__PURE__ */ jsx("li", { ...props });
|
|
2518
|
+
}
|
|
2519
|
+
function SidebarLink({ className, isDisabled, href, onClick, children, ...props }) {
|
|
2520
|
+
return /* @__PURE__ */ jsx("a", {
|
|
2521
|
+
...props,
|
|
2522
|
+
href: isDisabled ? void 0 : href,
|
|
2523
|
+
"aria-disabled": isDisabled || props["aria-disabled"],
|
|
2524
|
+
tabIndex: isDisabled ? -1 : props.tabIndex,
|
|
2525
|
+
onClick: (event) => {
|
|
2526
|
+
if (isDisabled) event.preventDefault();
|
|
2527
|
+
else onClick?.(event);
|
|
2528
|
+
},
|
|
2529
|
+
className: partClass("sidebar__link", className),
|
|
2530
|
+
children
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
function ChartRoot({ className, ...props }) {
|
|
2534
|
+
return /* @__PURE__ */ jsx("figure", {
|
|
2535
|
+
...props,
|
|
2536
|
+
className: partClass("chart", className)
|
|
2537
|
+
});
|
|
2538
|
+
}
|
|
2539
|
+
function ChartTitle({ className, ...props }) {
|
|
2540
|
+
return /* @__PURE__ */ jsx("figcaption", {
|
|
2541
|
+
...props,
|
|
2542
|
+
className: partClass("chart__title", className)
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
function ChartDescription({ className, ...props }) {
|
|
2546
|
+
return /* @__PURE__ */ jsx("p", {
|
|
2547
|
+
...props,
|
|
2548
|
+
className: partClass("chart__description", className)
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
function ChartPlot({ className, ...props }) {
|
|
2552
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
2553
|
+
...props,
|
|
2554
|
+
"aria-hidden": "true",
|
|
2555
|
+
focusable: "false",
|
|
2556
|
+
className: partClass("chart__plot", className)
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
var DataTableContext = createContext(null);
|
|
2560
|
+
function DataTableRoot({ sort = null, onSortChange, isLoading, isDisabled, className, ...props }) {
|
|
2561
|
+
return /* @__PURE__ */ jsx(DataTableContext.Provider, {
|
|
2562
|
+
value: {
|
|
2563
|
+
sort,
|
|
2564
|
+
onSortChange,
|
|
2565
|
+
disabled: !!(isLoading || isDisabled)
|
|
2566
|
+
},
|
|
2567
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2568
|
+
...props,
|
|
2569
|
+
"aria-busy": isLoading || void 0,
|
|
2570
|
+
className: partClass("data-table", className)
|
|
2571
|
+
})
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
function DataTableSortButton({ columnId, className, onClick, disabled, ...props }) {
|
|
2575
|
+
const state = useContext(DataTableContext);
|
|
2576
|
+
if (!state) throw new Error("DataTable.SortButton must be used inside DataTable.Root.");
|
|
2577
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2578
|
+
...props,
|
|
2579
|
+
type: "button",
|
|
2580
|
+
disabled: disabled || state.disabled,
|
|
2581
|
+
className: partClass("table__sort", className),
|
|
2582
|
+
onClick: (event) => {
|
|
2583
|
+
onClick?.(event);
|
|
2584
|
+
if (!event.defaultPrevented && !state.disabled) state.onSortChange?.({
|
|
2585
|
+
columnId,
|
|
2586
|
+
direction: state.sort?.columnId === columnId && state.sort.direction === "ascending" ? "descending" : "ascending"
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
function DataTableColumn({ columnId, scope = "col", ...props }) {
|
|
2592
|
+
const state = useContext(DataTableContext);
|
|
2593
|
+
const sort = columnId && state ? state.sort?.columnId === columnId ? state.sort.direction : "none" : props["aria-sort"];
|
|
2594
|
+
return /* @__PURE__ */ jsx("th", {
|
|
2595
|
+
...props,
|
|
2596
|
+
scope,
|
|
2597
|
+
"aria-sort": sort
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
function DataTableEmpty({ className, ...props }) {
|
|
2601
|
+
return /* @__PURE__ */ jsx("td", {
|
|
2602
|
+
...props,
|
|
2603
|
+
className: partClass("table__empty", className)
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
function DataTableStatus({ className, ...props }) {
|
|
2607
|
+
return /* @__PURE__ */ jsx("p", {
|
|
2608
|
+
...props,
|
|
2609
|
+
role: "status",
|
|
2610
|
+
className: partClass("data-table__status", className)
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
function DataTableError({ className, ...props }) {
|
|
2614
|
+
return /* @__PURE__ */ jsx("p", {
|
|
2615
|
+
...props,
|
|
2616
|
+
role: "alert",
|
|
2617
|
+
className: partClass("input__error", className)
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
1402
2620
|
//#endregion
|
|
1403
2621
|
//#region src/DataTable.tsx
|
|
1404
|
-
function
|
|
2622
|
+
function CompactDataTable({ className, style, classNames, caption, columns, rows, sort = null, onSortChange, isLoading = false, isDisabled = false, emptyMessage = "Tidak ada data.", loadingMessage = "Memuat data...", errorMessage, renderCell, dir, id }) {
|
|
1405
2623
|
function requestSort(column) {
|
|
1406
2624
|
if (isLoading || isDisabled || !column.sortable) return;
|
|
1407
2625
|
onSortChange?.({
|
|
@@ -1410,147 +2628,277 @@ function DataTable({ caption, columns, rows, sort = null, onSortChange, isLoadin
|
|
|
1410
2628
|
});
|
|
1411
2629
|
}
|
|
1412
2630
|
return /* @__PURE__ */ jsxs("div", {
|
|
1413
|
-
className: "data-table",
|
|
2631
|
+
className: partClass(partClass("data-table", classNames?.root), className),
|
|
2632
|
+
style,
|
|
1414
2633
|
dir,
|
|
1415
2634
|
id,
|
|
1416
2635
|
children: [
|
|
1417
2636
|
/* @__PURE__ */ jsxs(Table, {
|
|
2637
|
+
className: classNames?.table,
|
|
2638
|
+
classNames: {
|
|
2639
|
+
scroll: classNames?.scroll,
|
|
2640
|
+
caption: classNames?.caption
|
|
2641
|
+
},
|
|
1418
2642
|
caption,
|
|
1419
2643
|
"aria-busy": isLoading || void 0,
|
|
1420
|
-
children: [/* @__PURE__ */ jsx("thead", {
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
2644
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
2645
|
+
className: classNames?.header,
|
|
2646
|
+
children: /* @__PURE__ */ jsx("tr", {
|
|
2647
|
+
className: classNames?.row,
|
|
2648
|
+
children: columns.map((column) => /* @__PURE__ */ jsx("th", {
|
|
2649
|
+
className: classNames?.column,
|
|
2650
|
+
scope: "col",
|
|
2651
|
+
"aria-sort": column.sortable ? sort?.columnId === column.id ? sort.direction : "none" : void 0,
|
|
2652
|
+
children: column.sortable ? /* @__PURE__ */ jsxs("button", {
|
|
2653
|
+
type: "button",
|
|
2654
|
+
className: partClass("table__sort", classNames?.sort),
|
|
2655
|
+
disabled: isLoading || isDisabled,
|
|
2656
|
+
onClick: () => requestSort(column),
|
|
2657
|
+
children: [column.label, /* @__PURE__ */ jsx("span", {
|
|
2658
|
+
"aria-hidden": "true",
|
|
2659
|
+
children: sort?.columnId === column.id ? sort.direction === "ascending" ? "↑" : "↓" : "↕"
|
|
2660
|
+
})]
|
|
2661
|
+
}) : column.label
|
|
2662
|
+
}, column.id))
|
|
2663
|
+
})
|
|
2664
|
+
}), /* @__PURE__ */ jsx("tbody", {
|
|
2665
|
+
className: classNames?.body,
|
|
2666
|
+
children: rows.length ? rows.map((row) => /* @__PURE__ */ jsx("tr", {
|
|
2667
|
+
className: classNames?.row,
|
|
2668
|
+
children: columns.map((column) => /* @__PURE__ */ jsx("td", {
|
|
2669
|
+
className: classNames?.cell,
|
|
2670
|
+
children: renderCell ? renderCell(row, column) : row.cells[column.id] ?? ""
|
|
2671
|
+
}, column.id))
|
|
2672
|
+
}, row.id)) : /* @__PURE__ */ jsx("tr", {
|
|
2673
|
+
className: classNames?.row,
|
|
2674
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
2675
|
+
colSpan: Math.max(1, columns.length),
|
|
2676
|
+
className: partClass("table__empty", classNames?.empty),
|
|
2677
|
+
children: isLoading ? loadingMessage : errorMessage || emptyMessage
|
|
2678
|
+
})
|
|
2679
|
+
})
|
|
2680
|
+
})]
|
|
1438
2681
|
}),
|
|
1439
2682
|
isLoading && /* @__PURE__ */ jsx("p", {
|
|
1440
|
-
className: "data-table__status",
|
|
2683
|
+
className: partClass("data-table__status", classNames?.status),
|
|
1441
2684
|
role: "status",
|
|
1442
2685
|
children: loadingMessage
|
|
1443
2686
|
}),
|
|
1444
2687
|
errorMessage && !isLoading && /* @__PURE__ */ jsx("p", {
|
|
1445
|
-
className: "input__error",
|
|
2688
|
+
className: partClass("input__error", classNames?.error),
|
|
1446
2689
|
role: "alert",
|
|
1447
2690
|
children: errorMessage
|
|
1448
2691
|
})
|
|
1449
2692
|
]
|
|
1450
2693
|
});
|
|
1451
2694
|
}
|
|
2695
|
+
function DataTableComponent(props) {
|
|
2696
|
+
return "columns" in props ? /* @__PURE__ */ jsx(CompactDataTable, { ...props }) : /* @__PURE__ */ jsx(DataTableRoot, { ...props });
|
|
2697
|
+
}
|
|
2698
|
+
var DataTable = /* @__PURE__ */ Object.assign(DataTableComponent, {
|
|
2699
|
+
Root: DataTableRoot,
|
|
2700
|
+
SortButton: DataTableSortButton,
|
|
2701
|
+
Status: DataTableStatus,
|
|
2702
|
+
Error: DataTableError,
|
|
2703
|
+
Table: TableRoot,
|
|
2704
|
+
Header: TableHeader,
|
|
2705
|
+
Body: TableBody,
|
|
2706
|
+
Footer: TableFooter,
|
|
2707
|
+
Row: TableRow,
|
|
2708
|
+
Column: DataTableColumn,
|
|
2709
|
+
Empty: DataTableEmpty,
|
|
2710
|
+
Cell: TableCell,
|
|
2711
|
+
Caption: TableCaption,
|
|
2712
|
+
ScrollContainer: TableScrollContainer
|
|
2713
|
+
});
|
|
1452
2714
|
//#endregion
|
|
1453
2715
|
//#region src/Alert.tsx
|
|
1454
|
-
function
|
|
2716
|
+
function AlertRoot({ className, style, classNames, title, description, tone = "info", announcement = "off", children, actions, id }) {
|
|
1455
2717
|
return /* @__PURE__ */ jsxs("div", {
|
|
1456
2718
|
id,
|
|
1457
|
-
className: "alert",
|
|
2719
|
+
className: partClass(partClass("alert", classNames?.root), className),
|
|
2720
|
+
style,
|
|
1458
2721
|
"data-tone": tone,
|
|
1459
2722
|
role: announcement === "polite" ? "status" : announcement === "assertive" ? "alert" : void 0,
|
|
1460
2723
|
children: [
|
|
1461
|
-
/* @__PURE__ */ jsx("p", {
|
|
1462
|
-
className: "alert__title",
|
|
2724
|
+
title && /* @__PURE__ */ jsx("p", {
|
|
2725
|
+
className: partClass("alert__title", classNames?.title),
|
|
1463
2726
|
children: title
|
|
1464
2727
|
}),
|
|
1465
2728
|
description && /* @__PURE__ */ jsx("p", {
|
|
1466
|
-
className: "alert__description",
|
|
2729
|
+
className: partClass("alert__description", classNames?.description),
|
|
1467
2730
|
children: description
|
|
1468
2731
|
}),
|
|
1469
2732
|
children,
|
|
1470
2733
|
actions && /* @__PURE__ */ jsx("div", {
|
|
1471
|
-
className: "alert__actions",
|
|
2734
|
+
className: partClass("alert__actions", classNames?.actions),
|
|
1472
2735
|
children: actions
|
|
1473
2736
|
})
|
|
1474
2737
|
]
|
|
1475
2738
|
});
|
|
1476
2739
|
}
|
|
2740
|
+
function AlertTitle({ className, ...props }) {
|
|
2741
|
+
return /* @__PURE__ */ jsx("p", {
|
|
2742
|
+
...props,
|
|
2743
|
+
className: partClass("alert__title", className)
|
|
2744
|
+
});
|
|
2745
|
+
}
|
|
2746
|
+
function AlertDescription({ className, ...props }) {
|
|
2747
|
+
return /* @__PURE__ */ jsx("p", {
|
|
2748
|
+
...props,
|
|
2749
|
+
className: partClass("alert__description", className)
|
|
2750
|
+
});
|
|
2751
|
+
}
|
|
2752
|
+
function AlertContent({ className, ...props }) {
|
|
2753
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2754
|
+
...props,
|
|
2755
|
+
className: partClass("alert__content", className)
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
function AlertActions({ className, ...props }) {
|
|
2759
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2760
|
+
...props,
|
|
2761
|
+
className: partClass("alert__actions", className)
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
function AlertIndicator({ className, ...props }) {
|
|
2765
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2766
|
+
...props,
|
|
2767
|
+
"aria-hidden": "true",
|
|
2768
|
+
className: partClass("alert__indicator", className)
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2771
|
+
var Alert = /* @__PURE__ */ Object.assign(AlertRoot, {
|
|
2772
|
+
Root: AlertRoot,
|
|
2773
|
+
Title: AlertTitle,
|
|
2774
|
+
Description: AlertDescription,
|
|
2775
|
+
Content: AlertContent,
|
|
2776
|
+
Actions: AlertActions,
|
|
2777
|
+
Indicator: AlertIndicator
|
|
2778
|
+
});
|
|
1477
2779
|
//#endregion
|
|
1478
2780
|
//#region src/Empty.tsx
|
|
1479
|
-
function
|
|
2781
|
+
function CompactEmpty({ className, style, classNames, title, description, headingLevel = 3, actions, children, id }) {
|
|
1480
2782
|
const Heading = `h${headingLevel}`;
|
|
1481
2783
|
return /* @__PURE__ */ jsxs("div", {
|
|
1482
2784
|
id,
|
|
1483
|
-
className: "empty",
|
|
2785
|
+
className: partClass(partClass("empty", classNames?.root), className),
|
|
2786
|
+
style,
|
|
1484
2787
|
children: [
|
|
1485
2788
|
/* @__PURE__ */ jsx(Heading, {
|
|
1486
|
-
className: "empty__title",
|
|
2789
|
+
className: partClass("empty__title", classNames?.title),
|
|
1487
2790
|
children: title
|
|
1488
2791
|
}),
|
|
1489
2792
|
description && /* @__PURE__ */ jsx("p", {
|
|
1490
|
-
className: "empty__description",
|
|
2793
|
+
className: partClass("empty__description", classNames?.description),
|
|
1491
2794
|
children: description
|
|
1492
2795
|
}),
|
|
1493
2796
|
children,
|
|
1494
2797
|
actions && /* @__PURE__ */ jsx("div", {
|
|
1495
|
-
className: "empty__actions",
|
|
2798
|
+
className: partClass("empty__actions", classNames?.actions),
|
|
1496
2799
|
children: actions
|
|
1497
2800
|
})
|
|
1498
2801
|
]
|
|
1499
2802
|
});
|
|
1500
2803
|
}
|
|
2804
|
+
var Empty = /* @__PURE__ */ Object.assign(CompactEmpty, {
|
|
2805
|
+
Root: EmptyRoot,
|
|
2806
|
+
Title: EmptyTitle,
|
|
2807
|
+
Description: EmptyDescription,
|
|
2808
|
+
Actions: EmptyActions
|
|
2809
|
+
});
|
|
1501
2810
|
//#endregion
|
|
1502
2811
|
//#region src/Breadcrumb.tsx
|
|
1503
|
-
function
|
|
2812
|
+
function CompactBreadcrumb({ className, style, classNames, items, label = "Jejak halaman", dir, id }) {
|
|
1504
2813
|
return /* @__PURE__ */ jsx("nav", {
|
|
1505
2814
|
id,
|
|
1506
|
-
className: "breadcrumb",
|
|
2815
|
+
className: partClass(partClass("breadcrumb", classNames?.root), className),
|
|
2816
|
+
style,
|
|
1507
2817
|
"aria-label": label,
|
|
1508
2818
|
dir,
|
|
1509
|
-
children: /* @__PURE__ */ jsx("ol", {
|
|
1510
|
-
className:
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
2819
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
2820
|
+
className: classNames?.list,
|
|
2821
|
+
children: items.map((item, index) => /* @__PURE__ */ jsxs("li", {
|
|
2822
|
+
className: classNames?.item,
|
|
2823
|
+
children: [index > 0 && /* @__PURE__ */ jsx("span", {
|
|
2824
|
+
className: partClass("breadcrumb__separator", classNames?.separator),
|
|
2825
|
+
"aria-hidden": "true",
|
|
2826
|
+
children: "/"
|
|
2827
|
+
}), index === items.length - 1 ? /* @__PURE__ */ jsx("span", {
|
|
2828
|
+
className: classNames?.current,
|
|
2829
|
+
"aria-current": "page",
|
|
2830
|
+
children: item.label
|
|
2831
|
+
}) : item.href ? /* @__PURE__ */ jsx("a", {
|
|
2832
|
+
className: classNames?.link,
|
|
2833
|
+
href: item.href,
|
|
2834
|
+
children: item.label
|
|
2835
|
+
}) : /* @__PURE__ */ jsx("span", { children: item.label })]
|
|
2836
|
+
}, index))
|
|
2837
|
+
})
|
|
1520
2838
|
});
|
|
1521
2839
|
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
2840
|
+
function BreadcrumbRoot({ className, label = "Jejak halaman / Breadcrumbs", ...props }) {
|
|
2841
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
2842
|
+
...props,
|
|
2843
|
+
"aria-label": label,
|
|
2844
|
+
className: partClass("breadcrumb", className)
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
function BreadcrumbList(props) {
|
|
2848
|
+
return /* @__PURE__ */ jsx("ol", { ...props });
|
|
2849
|
+
}
|
|
2850
|
+
function BreadcrumbItemPart(props) {
|
|
2851
|
+
return /* @__PURE__ */ jsx("li", { ...props });
|
|
2852
|
+
}
|
|
2853
|
+
function BreadcrumbLink({ children, ...props }) {
|
|
2854
|
+
return /* @__PURE__ */ jsx("a", {
|
|
2855
|
+
...props,
|
|
2856
|
+
children
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
function BreadcrumbCurrent(props) {
|
|
2860
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2861
|
+
...props,
|
|
2862
|
+
"aria-current": "page"
|
|
2863
|
+
});
|
|
1536
2864
|
}
|
|
2865
|
+
function BreadcrumbSeparator({ className, children = "/", ...props }) {
|
|
2866
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2867
|
+
...props,
|
|
2868
|
+
"aria-hidden": "true",
|
|
2869
|
+
className: partClass("breadcrumb__separator", className),
|
|
2870
|
+
children
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
function BreadcrumbComponent(props) {
|
|
2874
|
+
return "items" in props ? /* @__PURE__ */ jsx(CompactBreadcrumb, { ...props }) : /* @__PURE__ */ jsx(BreadcrumbRoot, { ...props });
|
|
2875
|
+
}
|
|
2876
|
+
var Breadcrumb = /* @__PURE__ */ Object.assign(BreadcrumbComponent, {
|
|
2877
|
+
Root: BreadcrumbRoot,
|
|
2878
|
+
List: BreadcrumbList,
|
|
2879
|
+
Item: BreadcrumbItemPart,
|
|
2880
|
+
Link: BreadcrumbLink,
|
|
2881
|
+
Current: BreadcrumbCurrent,
|
|
2882
|
+
Separator: BreadcrumbSeparator
|
|
2883
|
+
});
|
|
1537
2884
|
//#endregion
|
|
1538
2885
|
//#region src/Sidebar.tsx
|
|
1539
|
-
function
|
|
2886
|
+
function CompactSidebar({ className, style, classNames, label, items, currentId, open, defaultOpen = true, onOpenChange, toggleLabel = "Menu navigasi", dir, id }) {
|
|
1540
2887
|
const generated = useId(), navId = `${id ?? generated}-nav`;
|
|
1541
2888
|
const { visible, change } = useDisclosure(open, defaultOpen, onOpenChange);
|
|
1542
2889
|
return /* @__PURE__ */ jsxs("aside", {
|
|
1543
2890
|
id,
|
|
1544
|
-
className: "sidebar",
|
|
2891
|
+
className: partClass(partClass("sidebar", classNames?.root), className),
|
|
2892
|
+
style,
|
|
1545
2893
|
dir,
|
|
1546
2894
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1547
|
-
className: "sidebar__header",
|
|
2895
|
+
className: partClass("sidebar__header", classNames?.header),
|
|
1548
2896
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1549
|
-
className: "sidebar__title",
|
|
2897
|
+
className: partClass("sidebar__title", classNames?.title),
|
|
1550
2898
|
children: label
|
|
1551
2899
|
}), /* @__PURE__ */ jsx("button", {
|
|
1552
2900
|
type: "button",
|
|
1553
|
-
className: "sidebar__toggle",
|
|
2901
|
+
className: partClass("sidebar__toggle", classNames?.toggle),
|
|
1554
2902
|
"aria-label": toggleLabel,
|
|
1555
2903
|
"aria-expanded": visible,
|
|
1556
2904
|
"aria-controls": navId,
|
|
@@ -1561,22 +2909,42 @@ function Sidebar({ label, items, currentId, open, defaultOpen = true, onOpenChan
|
|
|
1561
2909
|
})
|
|
1562
2910
|
})]
|
|
1563
2911
|
}), /* @__PURE__ */ jsx("nav", {
|
|
2912
|
+
className: classNames?.navigation,
|
|
1564
2913
|
id: navId,
|
|
1565
2914
|
"aria-label": label,
|
|
1566
2915
|
hidden: !visible,
|
|
1567
|
-
children: /* @__PURE__ */ jsx("ul", {
|
|
1568
|
-
className:
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
2916
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
2917
|
+
className: classNames?.list,
|
|
2918
|
+
children: items.map((item) => /* @__PURE__ */ jsx("li", {
|
|
2919
|
+
className: classNames?.item,
|
|
2920
|
+
children: item.isDisabled ? /* @__PURE__ */ jsx("span", {
|
|
2921
|
+
className: partClass("sidebar__link", classNames?.link),
|
|
2922
|
+
"aria-disabled": "true",
|
|
2923
|
+
children: item.label
|
|
2924
|
+
}) : /* @__PURE__ */ jsx("a", {
|
|
2925
|
+
className: partClass("sidebar__link", classNames?.link),
|
|
2926
|
+
href: item.href,
|
|
2927
|
+
"aria-current": item.id === currentId ? "page" : void 0,
|
|
2928
|
+
children: item.label
|
|
2929
|
+
})
|
|
2930
|
+
}, item.id))
|
|
2931
|
+
})
|
|
1577
2932
|
})]
|
|
1578
2933
|
});
|
|
1579
2934
|
}
|
|
2935
|
+
function SidebarComponent(props) {
|
|
2936
|
+
return "items" in props ? /* @__PURE__ */ jsx(CompactSidebar, { ...props }) : /* @__PURE__ */ jsx(SidebarRoot, { ...props });
|
|
2937
|
+
}
|
|
2938
|
+
var Sidebar = /* @__PURE__ */ Object.assign(SidebarComponent, {
|
|
2939
|
+
Root: SidebarRoot,
|
|
2940
|
+
Header: SidebarHeader,
|
|
2941
|
+
Title: SidebarTitle,
|
|
2942
|
+
Toggle: SidebarToggle,
|
|
2943
|
+
Navigation: SidebarNavigation,
|
|
2944
|
+
List: SidebarList,
|
|
2945
|
+
Item: SidebarItem,
|
|
2946
|
+
Link: SidebarLink
|
|
2947
|
+
});
|
|
1580
2948
|
//#endregion
|
|
1581
2949
|
//#region src/chart-model.ts
|
|
1582
2950
|
function chartModel(data) {
|
|
@@ -1597,53 +2965,54 @@ function chartModel(data) {
|
|
|
1597
2965
|
}
|
|
1598
2966
|
//#endregion
|
|
1599
2967
|
//#region src/Chart.tsx
|
|
1600
|
-
function
|
|
2968
|
+
function CompactChart({ className, style, classNames, label, data, type = "bar", description, locale = "id-ID", formatOptions, categoryLabel = "Kategori", valueLabel = "Nilai", emptyMessage = "Belum ada data grafik.", id, dir }) {
|
|
1601
2969
|
const generated = useId(), labelId = `${id ?? generated}-label`, model = chartModel(data), format = new Intl.NumberFormat(locale, formatOptions);
|
|
1602
2970
|
return /* @__PURE__ */ jsxs("figure", {
|
|
1603
2971
|
id,
|
|
1604
|
-
className: "chart",
|
|
2972
|
+
className: partClass(partClass("chart", classNames?.root), className),
|
|
2973
|
+
style,
|
|
1605
2974
|
dir,
|
|
1606
2975
|
"aria-labelledby": labelId,
|
|
1607
2976
|
children: [
|
|
1608
2977
|
/* @__PURE__ */ jsx("figcaption", {
|
|
1609
2978
|
id: labelId,
|
|
1610
|
-
className: "chart__title",
|
|
2979
|
+
className: partClass("chart__title", classNames?.title),
|
|
1611
2980
|
children: label
|
|
1612
2981
|
}),
|
|
1613
2982
|
description && /* @__PURE__ */ jsx("p", {
|
|
1614
|
-
className: "chart__description",
|
|
2983
|
+
className: partClass("chart__description", classNames?.description),
|
|
1615
2984
|
children: description
|
|
1616
2985
|
}),
|
|
1617
2986
|
model.items.length ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("svg", {
|
|
1618
|
-
className: "chart__plot",
|
|
2987
|
+
className: partClass("chart__plot", classNames?.plot),
|
|
1619
2988
|
viewBox: "0 0 600 210",
|
|
1620
2989
|
"aria-hidden": "true",
|
|
1621
2990
|
focusable: "false",
|
|
1622
2991
|
children: [
|
|
1623
2992
|
/* @__PURE__ */ jsx("line", {
|
|
1624
|
-
className: "chart__axis",
|
|
2993
|
+
className: partClass("chart__axis", classNames?.axis),
|
|
1625
2994
|
x1: "20",
|
|
1626
2995
|
x2: "580",
|
|
1627
2996
|
y1: model.baseline,
|
|
1628
2997
|
y2: model.baseline
|
|
1629
2998
|
}),
|
|
1630
2999
|
type === "line" ? /* @__PURE__ */ jsx("polyline", {
|
|
1631
|
-
className: "chart__line",
|
|
3000
|
+
className: partClass("chart__line", classNames?.line),
|
|
1632
3001
|
points: model.items.map((item) => `${item.x},${item.y}`).join(" ")
|
|
1633
3002
|
}) : null,
|
|
1634
3003
|
model.items.map((item) => /* @__PURE__ */ jsxs("g", { children: [type === "bar" ? /* @__PURE__ */ jsx("rect", {
|
|
1635
|
-
className: "chart__bar",
|
|
3004
|
+
className: partClass("chart__bar", classNames?.bar),
|
|
1636
3005
|
x: item.x - model.barWidth / 2,
|
|
1637
3006
|
y: Math.min(item.y, model.baseline),
|
|
1638
3007
|
width: model.barWidth,
|
|
1639
3008
|
height: Math.abs(item.y - model.baseline)
|
|
1640
3009
|
}) : /* @__PURE__ */ jsx("circle", {
|
|
1641
|
-
className: "chart__bar",
|
|
3010
|
+
className: partClass("chart__bar", classNames?.bar),
|
|
1642
3011
|
cx: item.x,
|
|
1643
3012
|
cy: item.y,
|
|
1644
3013
|
r: "4"
|
|
1645
3014
|
}), model.items.length <= 12 && /* @__PURE__ */ jsx("text", {
|
|
1646
|
-
className: "chart__label",
|
|
3015
|
+
className: partClass("chart__label", classNames?.label),
|
|
1647
3016
|
x: item.x,
|
|
1648
3017
|
y: "202",
|
|
1649
3018
|
textAnchor: "middle",
|
|
@@ -1652,6 +3021,7 @@ function Chart({ label, data, type = "bar", description, locale = "id-ID", forma
|
|
|
1652
3021
|
]
|
|
1653
3022
|
}), /* @__PURE__ */ jsxs(Table, {
|
|
1654
3023
|
caption: label,
|
|
3024
|
+
className: classNames?.table,
|
|
1655
3025
|
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
1656
3026
|
scope: "col",
|
|
1657
3027
|
children: categoryLabel
|
|
@@ -1662,13 +3032,26 @@ function Chart({ label, data, type = "bar", description, locale = "id-ID", forma
|
|
|
1662
3032
|
scope: "row",
|
|
1663
3033
|
children: item.label
|
|
1664
3034
|
}), /* @__PURE__ */ jsx("td", { children: format.format(item.value) })] }, item.id)) })]
|
|
1665
|
-
})] }) : /* @__PURE__ */ jsx(Empty, {
|
|
3035
|
+
})] }) : /* @__PURE__ */ jsx(Empty, {
|
|
3036
|
+
title: emptyMessage,
|
|
3037
|
+
className: classNames?.empty
|
|
3038
|
+
})
|
|
1666
3039
|
]
|
|
1667
3040
|
});
|
|
1668
3041
|
}
|
|
3042
|
+
function ChartComponent(props) {
|
|
3043
|
+
return "data" in props ? /* @__PURE__ */ jsx(CompactChart, { ...props }) : /* @__PURE__ */ jsx(ChartRoot, { ...props });
|
|
3044
|
+
}
|
|
3045
|
+
var Chart = /* @__PURE__ */ Object.assign(ChartComponent, {
|
|
3046
|
+
Root: ChartRoot,
|
|
3047
|
+
Title: ChartTitle,
|
|
3048
|
+
Description: ChartDescription,
|
|
3049
|
+
Plot: ChartPlot
|
|
3050
|
+
});
|
|
1669
3051
|
//#endregion
|
|
1670
3052
|
//#region src/Dialog.tsx
|
|
1671
|
-
function
|
|
3053
|
+
function CompactDialog(props) {
|
|
3054
|
+
const { className, style, classNames } = props;
|
|
1672
3055
|
const { triggerLabel, title, description, children, footer, isDisabled = false, closeLabel = "Tutup", dir, size = "md", placement = "center", scroll = "outside", backdrop = "opaque", isDismissable = true, isKeyboardDismissDisabled = false, showCloseButton = true, showFooterClose = true } = props;
|
|
1673
3056
|
const { visible, change } = useDisclosure(props.open, props.defaultOpen ?? false, props.onOpenChange);
|
|
1674
3057
|
const descriptionId = useId();
|
|
@@ -1678,12 +3061,12 @@ function Dialog(props) {
|
|
|
1678
3061
|
isOpen: visible,
|
|
1679
3062
|
onOpenChange: change,
|
|
1680
3063
|
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
1681
|
-
className: `button button--${props.triggerVariant ?? "secondary"}${props.triggerIconOnly ? " button--icon-only" : ""}`,
|
|
3064
|
+
className: partClass(`button button--${props.triggerVariant ?? "secondary"}${props.triggerIconOnly ? " button--icon-only" : ""}`, classNames?.trigger),
|
|
1682
3065
|
"aria-label": triggerLabel,
|
|
1683
3066
|
isDisabled,
|
|
1684
3067
|
children: props.triggerContent ?? triggerLabel
|
|
1685
3068
|
}), /* @__PURE__ */ jsx(ModalOverlay, {
|
|
1686
|
-
className: "dialog__backdrop dialog__viewport",
|
|
3069
|
+
className: partClass("dialog__backdrop dialog__viewport", classNames?.backdrop),
|
|
1687
3070
|
"data-size": size,
|
|
1688
3071
|
"data-placement": placement,
|
|
1689
3072
|
"data-scroll": scroll,
|
|
@@ -1691,29 +3074,30 @@ function Dialog(props) {
|
|
|
1691
3074
|
isDismissable,
|
|
1692
3075
|
isKeyboardDismissDisabled,
|
|
1693
3076
|
children: /* @__PURE__ */ jsx(Modal, {
|
|
1694
|
-
className: "dialog__panel",
|
|
3077
|
+
className: partClass("dialog__panel", classNames?.panel),
|
|
1695
3078
|
dir,
|
|
1696
3079
|
children: /* @__PURE__ */ jsxs(Dialog$1, {
|
|
1697
|
-
className: "dialog__content",
|
|
3080
|
+
className: partClass(partClass(partClass("dialog__content", classNames?.content), classNames?.root), className),
|
|
3081
|
+
style,
|
|
1698
3082
|
"aria-describedby": description ? descriptionId : void 0,
|
|
1699
3083
|
children: [
|
|
1700
3084
|
/* @__PURE__ */ jsxs("div", {
|
|
1701
|
-
className: "overlay__header",
|
|
3085
|
+
className: partClass("overlay__header", classNames?.header),
|
|
1702
3086
|
"data-close-button": showCloseButton || void 0,
|
|
1703
3087
|
children: [
|
|
1704
3088
|
/* @__PURE__ */ jsx(Heading, {
|
|
1705
3089
|
level: 2,
|
|
1706
3090
|
slot: "title",
|
|
1707
|
-
className: "overlay__title",
|
|
3091
|
+
className: partClass("overlay__title", classNames?.title),
|
|
1708
3092
|
children: title
|
|
1709
3093
|
}),
|
|
1710
3094
|
description && /* @__PURE__ */ jsx("p", {
|
|
1711
3095
|
id: descriptionId,
|
|
1712
|
-
className: "overlay__description",
|
|
3096
|
+
className: partClass("overlay__description", classNames?.description),
|
|
1713
3097
|
children: description
|
|
1714
3098
|
}),
|
|
1715
3099
|
showCloseButton && /* @__PURE__ */ jsx(Button$1, {
|
|
1716
|
-
className: "dialog__close",
|
|
3100
|
+
className: partClass("dialog__close", classNames?.close),
|
|
1717
3101
|
"aria-label": props.closeIconLabel ?? `${closeLabel} dialog`,
|
|
1718
3102
|
onPress: () => change(false),
|
|
1719
3103
|
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
@@ -1721,13 +3105,13 @@ function Dialog(props) {
|
|
|
1721
3105
|
]
|
|
1722
3106
|
}),
|
|
1723
3107
|
/* @__PURE__ */ jsx("div", {
|
|
1724
|
-
className: "overlay__body",
|
|
3108
|
+
className: partClass("overlay__body", classNames?.body),
|
|
1725
3109
|
children
|
|
1726
3110
|
}),
|
|
1727
3111
|
(footer || showFooterClose) && /* @__PURE__ */ jsxs("div", {
|
|
1728
|
-
className: "overlay__footer",
|
|
3112
|
+
className: partClass("overlay__footer", classNames?.footer),
|
|
1729
3113
|
children: [footer, showFooterClose && /* @__PURE__ */ jsx(Button$1, {
|
|
1730
|
-
className: "button button--secondary",
|
|
3114
|
+
className: partClass("button button--secondary", classNames?.footerClose),
|
|
1731
3115
|
onPress: () => change(false),
|
|
1732
3116
|
children: closeLabel
|
|
1733
3117
|
})]
|
|
@@ -1739,6 +3123,22 @@ function Dialog(props) {
|
|
|
1739
3123
|
})
|
|
1740
3124
|
});
|
|
1741
3125
|
}
|
|
3126
|
+
function DialogComponent(props) {
|
|
3127
|
+
return "triggerLabel" in props ? /* @__PURE__ */ jsx(CompactDialog, { ...props }) : /* @__PURE__ */ jsx(DialogRoot, { ...props });
|
|
3128
|
+
}
|
|
3129
|
+
var Dialog = /* @__PURE__ */ Object.assign(DialogComponent, {
|
|
3130
|
+
Root: DialogRoot,
|
|
3131
|
+
Trigger: DialogTriggerPart,
|
|
3132
|
+
Backdrop: DialogBackdrop,
|
|
3133
|
+
Panel: DialogPanel,
|
|
3134
|
+
Content: DialogContent,
|
|
3135
|
+
Header: OverlayHeader,
|
|
3136
|
+
Heading: OverlayHeading,
|
|
3137
|
+
Description: OverlayDescription,
|
|
3138
|
+
Body: OverlayBody,
|
|
3139
|
+
Footer: OverlayFooter,
|
|
3140
|
+
CloseButton: DialogCloseButton
|
|
3141
|
+
});
|
|
1742
3142
|
//#endregion
|
|
1743
3143
|
//#region src/overlay-model.ts
|
|
1744
3144
|
function menuGroups(items) {
|
|
@@ -1767,7 +3167,8 @@ function menuSelection(keys, items, mode) {
|
|
|
1767
3167
|
}
|
|
1768
3168
|
//#endregion
|
|
1769
3169
|
//#region src/DropdownMenu.tsx
|
|
1770
|
-
function
|
|
3170
|
+
function CompactDropdownMenu(props) {
|
|
3171
|
+
const { className, style, classNames } = props;
|
|
1771
3172
|
const { triggerLabel, items, isDisabled = false, dir, selectionMode = "none", placement = "bottom-start" } = props;
|
|
1772
3173
|
const { visible, change } = useDisclosure(props.open, props.defaultOpen ?? false, props.onOpenChange);
|
|
1773
3174
|
const [local, setLocal] = useState(props.defaultSelectedKeys ?? []);
|
|
@@ -1790,30 +3191,30 @@ function DropdownMenu(props) {
|
|
|
1790
3191
|
function content(item) {
|
|
1791
3192
|
const icon = props.renderIcon?.(item);
|
|
1792
3193
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1793
|
-
selectionMode !== "none" && !item.children?.length && /* @__PURE__ */ jsx(CheckIcon, { className: "menu__check" }),
|
|
3194
|
+
selectionMode !== "none" && !item.children?.length && /* @__PURE__ */ jsx(CheckIcon, { className: partClass("menu__check", classNames?.check) }),
|
|
1794
3195
|
icon && /* @__PURE__ */ jsx("span", {
|
|
1795
|
-
className: "menu__icon",
|
|
3196
|
+
className: partClass("menu__icon", classNames?.icon),
|
|
1796
3197
|
"aria-hidden": "true",
|
|
1797
3198
|
children: icon
|
|
1798
3199
|
}),
|
|
1799
3200
|
/* @__PURE__ */ jsxs("span", {
|
|
1800
|
-
className: "menu__text",
|
|
3201
|
+
className: partClass("menu__text", classNames?.text),
|
|
1801
3202
|
children: [/* @__PURE__ */ jsx("span", { children: item.label }), item.description && /* @__PURE__ */ jsx("span", {
|
|
1802
|
-
className: "menu__description",
|
|
3203
|
+
className: partClass("menu__description", classNames?.description),
|
|
1803
3204
|
children: item.description
|
|
1804
3205
|
})]
|
|
1805
3206
|
}),
|
|
1806
3207
|
item.shortcut && /* @__PURE__ */ jsx("kbd", {
|
|
1807
|
-
className: "menu__shortcut",
|
|
3208
|
+
className: partClass("menu__shortcut", classNames?.shortcut),
|
|
1808
3209
|
"aria-hidden": "true",
|
|
1809
3210
|
children: item.shortcut
|
|
1810
3211
|
}),
|
|
1811
|
-
!!item.children?.length && /* @__PURE__ */ jsx(ChevronIcon, { className: "menu__arrow" })
|
|
3212
|
+
!!item.children?.length && /* @__PURE__ */ jsx(ChevronIcon, { className: partClass("menu__arrow", classNames?.arrow) })
|
|
1812
3213
|
] });
|
|
1813
3214
|
}
|
|
1814
3215
|
function renderMenu(level, label, blocked = false) {
|
|
1815
3216
|
return /* @__PURE__ */ jsx(Menu, {
|
|
1816
|
-
className: "menu__list",
|
|
3217
|
+
className: partClass("menu__list", classNames?.list),
|
|
1817
3218
|
"aria-label": label,
|
|
1818
3219
|
selectionMode,
|
|
1819
3220
|
selectedKeys: selected,
|
|
@@ -1827,24 +3228,24 @@ function DropdownMenu(props) {
|
|
|
1827
3228
|
const row = /* @__PURE__ */ jsx(MenuItem, {
|
|
1828
3229
|
id: item.id,
|
|
1829
3230
|
textValue: item.label,
|
|
1830
|
-
className: "menu__item",
|
|
3231
|
+
className: partClass("menu__item", classNames?.item),
|
|
1831
3232
|
isDisabled: disabled,
|
|
1832
3233
|
"data-tone": item.tone ?? "default",
|
|
1833
3234
|
shouldCloseOnSelect: closeOnSelect,
|
|
1834
3235
|
children: content(item)
|
|
1835
3236
|
}, item.id);
|
|
1836
3237
|
return item.children?.length ? /* @__PURE__ */ jsxs(SubmenuTrigger, { children: [row, /* @__PURE__ */ jsx(Popover$2, {
|
|
1837
|
-
className: "menu__panel",
|
|
3238
|
+
className: partClass("menu__panel", classNames?.panel),
|
|
1838
3239
|
offset: 4,
|
|
1839
3240
|
containerPadding: 16,
|
|
1840
3241
|
dir,
|
|
1841
3242
|
children: renderMenu(item.children, item.label, disabled)
|
|
1842
3243
|
})] }, item.id) : row;
|
|
1843
3244
|
});
|
|
1844
|
-
return [index > 0 ? /* @__PURE__ */ jsx(Separator$1, { className: "menu__separator" }, `${group.key}-separator`) : null, /* @__PURE__ */ jsxs(MenuSection, {
|
|
3245
|
+
return [index > 0 ? /* @__PURE__ */ jsx(Separator$1, { className: partClass("menu__separator", classNames?.separator) }, `${group.key}-separator`) : null, /* @__PURE__ */ jsxs(MenuSection, {
|
|
1845
3246
|
"aria-label": group.label,
|
|
1846
|
-
children: [group.label && /* @__PURE__ */ jsx(Header, {
|
|
1847
|
-
className: "menu__heading",
|
|
3247
|
+
children: [group.label && /* @__PURE__ */ jsx(Header$1, {
|
|
3248
|
+
className: partClass("menu__heading", classNames?.heading),
|
|
1848
3249
|
children: group.label
|
|
1849
3250
|
}), rows]
|
|
1850
3251
|
}, group.key)];
|
|
@@ -1857,12 +3258,13 @@ function DropdownMenu(props) {
|
|
|
1857
3258
|
isOpen: visible,
|
|
1858
3259
|
onOpenChange: change,
|
|
1859
3260
|
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
1860
|
-
|
|
3261
|
+
style,
|
|
3262
|
+
className: partClass(partClass(partClass(`button button--${props.triggerVariant ?? "secondary"}${props.triggerIconOnly ? " button--icon-only" : ""}`, classNames?.trigger), classNames?.root), className),
|
|
1861
3263
|
"aria-label": triggerLabel,
|
|
1862
3264
|
isDisabled: isDisabled || !items.length,
|
|
1863
3265
|
children: props.triggerContent ?? triggerLabel
|
|
1864
3266
|
}), /* @__PURE__ */ jsx(Popover$2, {
|
|
1865
|
-
className: "menu__panel",
|
|
3267
|
+
className: partClass("menu__panel", classNames?.panel),
|
|
1866
3268
|
placement: popoverPlacement,
|
|
1867
3269
|
offset: 8,
|
|
1868
3270
|
containerPadding: 16,
|
|
@@ -1872,9 +3274,25 @@ function DropdownMenu(props) {
|
|
|
1872
3274
|
})
|
|
1873
3275
|
});
|
|
1874
3276
|
}
|
|
3277
|
+
function DropdownMenuComponent(props) {
|
|
3278
|
+
return "triggerLabel" in props ? /* @__PURE__ */ jsx(CompactDropdownMenu, { ...props }) : /* @__PURE__ */ jsx(DropdownRoot, { ...props });
|
|
3279
|
+
}
|
|
3280
|
+
var DropdownMenu = /* @__PURE__ */ Object.assign(DropdownMenuComponent, {
|
|
3281
|
+
Root: DropdownRoot,
|
|
3282
|
+
Trigger: DropdownTrigger,
|
|
3283
|
+
Popover: DropdownPopover,
|
|
3284
|
+
Menu: DropdownList,
|
|
3285
|
+
Item: DropdownItem,
|
|
3286
|
+
Section: DropdownSection,
|
|
3287
|
+
Heading: DropdownHeading,
|
|
3288
|
+
Separator: DropdownSeparator,
|
|
3289
|
+
ItemIndicator: DropdownItemIndicator,
|
|
3290
|
+
SubmenuTrigger: DropdownSubmenuTrigger,
|
|
3291
|
+
SubmenuIndicator: DropdownSubmenuIndicator
|
|
3292
|
+
});
|
|
1875
3293
|
//#endregion
|
|
1876
3294
|
//#region src/Popover.tsx
|
|
1877
|
-
function
|
|
3295
|
+
function CompactPopover({ className, style, classNames, triggerLabel, title, description, children, open, defaultOpen = false, onOpenChange, isDisabled = false, closeLabel = "Tutup", dir }) {
|
|
1878
3296
|
const { visible, change } = useDisclosure(open, defaultOpen, onOpenChange), descriptionId = useId();
|
|
1879
3297
|
return /* @__PURE__ */ jsx(OverlayDirection, {
|
|
1880
3298
|
dir,
|
|
@@ -1882,39 +3300,40 @@ function Popover({ triggerLabel, title, description, children, open, defaultOpen
|
|
|
1882
3300
|
isOpen: visible,
|
|
1883
3301
|
onOpenChange: change,
|
|
1884
3302
|
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
1885
|
-
className: "button button--secondary",
|
|
3303
|
+
className: partClass("button button--secondary", classNames?.trigger),
|
|
1886
3304
|
isDisabled,
|
|
1887
3305
|
children: triggerLabel
|
|
1888
3306
|
}), /* @__PURE__ */ jsx(Popover$2, {
|
|
1889
|
-
className: "popover__panel",
|
|
3307
|
+
className: partClass(partClass(partClass("popover__panel", classNames?.panel), classNames?.root), className),
|
|
3308
|
+
style,
|
|
1890
3309
|
isNonModal: true,
|
|
1891
3310
|
placement: "bottom start",
|
|
1892
3311
|
offset: 8,
|
|
1893
3312
|
containerPadding: 16,
|
|
1894
3313
|
dir,
|
|
1895
3314
|
children: /* @__PURE__ */ jsxs(Dialog$1, {
|
|
1896
|
-
className: "popover__content",
|
|
3315
|
+
className: partClass("popover__content", classNames?.content),
|
|
1897
3316
|
"aria-describedby": description ? descriptionId : void 0,
|
|
1898
3317
|
children: [
|
|
1899
3318
|
/* @__PURE__ */ jsx(Heading, {
|
|
1900
3319
|
level: 2,
|
|
1901
3320
|
slot: "title",
|
|
1902
|
-
className: "overlay__title",
|
|
3321
|
+
className: partClass("overlay__title", classNames?.title),
|
|
1903
3322
|
children: title
|
|
1904
3323
|
}),
|
|
1905
3324
|
description && /* @__PURE__ */ jsx("p", {
|
|
1906
3325
|
id: descriptionId,
|
|
1907
|
-
className: "overlay__description",
|
|
3326
|
+
className: partClass("overlay__description", classNames?.description),
|
|
1908
3327
|
children: description
|
|
1909
3328
|
}),
|
|
1910
3329
|
/* @__PURE__ */ jsx("div", {
|
|
1911
|
-
className: "overlay__body",
|
|
3330
|
+
className: partClass("overlay__body", classNames?.body),
|
|
1912
3331
|
children
|
|
1913
3332
|
}),
|
|
1914
3333
|
/* @__PURE__ */ jsx("div", {
|
|
1915
|
-
className: "overlay__footer",
|
|
3334
|
+
className: partClass("overlay__footer", classNames?.footer),
|
|
1916
3335
|
children: /* @__PURE__ */ jsx(Button$1, {
|
|
1917
|
-
className: "button button--secondary",
|
|
3336
|
+
className: partClass("button button--secondary", classNames?.close),
|
|
1918
3337
|
onPress: () => change(false),
|
|
1919
3338
|
children: closeLabel
|
|
1920
3339
|
})
|
|
@@ -1925,9 +3344,24 @@ function Popover({ triggerLabel, title, description, children, open, defaultOpen
|
|
|
1925
3344
|
})
|
|
1926
3345
|
});
|
|
1927
3346
|
}
|
|
3347
|
+
function PopoverComponent(props) {
|
|
3348
|
+
return "triggerLabel" in props ? /* @__PURE__ */ jsx(CompactPopover, { ...props }) : /* @__PURE__ */ jsx(DialogRoot, { ...props });
|
|
3349
|
+
}
|
|
3350
|
+
var Popover = /* @__PURE__ */ Object.assign(PopoverComponent, {
|
|
3351
|
+
Root: DialogRoot,
|
|
3352
|
+
Trigger: PopoverTrigger,
|
|
3353
|
+
Content: PopoverContent,
|
|
3354
|
+
Dialog: PopoverDialog,
|
|
3355
|
+
Heading: OverlayHeading,
|
|
3356
|
+
Description: OverlayDescription,
|
|
3357
|
+
Header: OverlayHeader,
|
|
3358
|
+
Body: OverlayBody,
|
|
3359
|
+
Footer: OverlayFooter,
|
|
3360
|
+
CloseButton: PopoverCloseButton
|
|
3361
|
+
});
|
|
1928
3362
|
//#endregion
|
|
1929
3363
|
//#region src/Tooltip.tsx
|
|
1930
|
-
function
|
|
3364
|
+
function CompactTooltip({ className, style, classNames, triggerLabel, text, triggerContent, triggerIconOnly = false, triggerVariant = "secondary", triggerSize = "md", open, defaultOpen = false, onOpenChange, isDisabled = false, dir }) {
|
|
1931
3365
|
const { visible, change } = useDisclosure(open, defaultOpen, onOpenChange);
|
|
1932
3366
|
return /* @__PURE__ */ jsx(OverlayDirection, {
|
|
1933
3367
|
dir,
|
|
@@ -1940,6 +3374,7 @@ function Tooltip({ triggerLabel, text, triggerContent, triggerIconOnly = false,
|
|
|
1940
3374
|
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
1941
3375
|
className: [
|
|
1942
3376
|
"button",
|
|
3377
|
+
classNames?.trigger,
|
|
1943
3378
|
`button--${triggerVariant}`,
|
|
1944
3379
|
triggerSize !== "md" && `button--${triggerSize}`,
|
|
1945
3380
|
triggerIconOnly && "button--icon-only"
|
|
@@ -1948,7 +3383,8 @@ function Tooltip({ triggerLabel, text, triggerContent, triggerIconOnly = false,
|
|
|
1948
3383
|
isDisabled,
|
|
1949
3384
|
children: triggerContent ?? triggerLabel
|
|
1950
3385
|
}), /* @__PURE__ */ jsx(Tooltip$1, {
|
|
1951
|
-
className: "tooltip__panel",
|
|
3386
|
+
className: partClass(partClass(partClass("tooltip__panel", classNames?.panel), classNames?.root), className),
|
|
3387
|
+
style,
|
|
1952
3388
|
placement: "top",
|
|
1953
3389
|
offset: 8,
|
|
1954
3390
|
containerPadding: 16,
|
|
@@ -1958,13 +3394,22 @@ function Tooltip({ triggerLabel, text, triggerContent, triggerIconOnly = false,
|
|
|
1958
3394
|
})
|
|
1959
3395
|
});
|
|
1960
3396
|
}
|
|
3397
|
+
function TooltipComponent(props) {
|
|
3398
|
+
return "triggerLabel" in props ? /* @__PURE__ */ jsx(CompactTooltip, { ...props }) : /* @__PURE__ */ jsx(TooltipRoot, { ...props });
|
|
3399
|
+
}
|
|
3400
|
+
var Tooltip = /* @__PURE__ */ Object.assign(TooltipComponent, {
|
|
3401
|
+
Root: TooltipRoot,
|
|
3402
|
+
Trigger: TooltipTriggerPart,
|
|
3403
|
+
Content: TooltipContent
|
|
3404
|
+
});
|
|
1961
3405
|
//#endregion
|
|
1962
3406
|
//#region src/Spinner.tsx
|
|
1963
3407
|
/** Decorative by default. Use label for a standalone loading status; omit it inside a labeled Button. */
|
|
1964
|
-
function Spinner({ size = "md", color = "current", label, id }) {
|
|
3408
|
+
function Spinner({ size = "md", color = "current", label, id, className, style, classNames }) {
|
|
1965
3409
|
return /* @__PURE__ */ jsxs("span", {
|
|
1966
3410
|
id,
|
|
1967
|
-
className: `spinner spinner--${size}`,
|
|
3411
|
+
className: partClass(partClass(`spinner spinner--${size}`, classNames?.root), className),
|
|
3412
|
+
style,
|
|
1968
3413
|
"data-color": color,
|
|
1969
3414
|
role: label ? "status" : void 0,
|
|
1970
3415
|
"aria-label": label || void 0,
|
|
@@ -1975,12 +3420,12 @@ function Spinner({ size = "md", color = "current", label, id }) {
|
|
|
1975
3420
|
"aria-hidden": "true",
|
|
1976
3421
|
focusable: "false",
|
|
1977
3422
|
children: [/* @__PURE__ */ jsx("circle", {
|
|
1978
|
-
className: "spinner__track",
|
|
3423
|
+
className: partClass("spinner__track", classNames?.track),
|
|
1979
3424
|
cx: "10",
|
|
1980
3425
|
cy: "10",
|
|
1981
3426
|
r: "8"
|
|
1982
3427
|
}), /* @__PURE__ */ jsx("circle", {
|
|
1983
|
-
className: "spinner__arc",
|
|
3428
|
+
className: partClass("spinner__arc", classNames?.arc),
|
|
1984
3429
|
cx: "10",
|
|
1985
3430
|
cy: "10",
|
|
1986
3431
|
r: "8",
|
|
@@ -1988,15 +3433,70 @@ function Spinner({ size = "md", color = "current", label, id }) {
|
|
|
1988
3433
|
strokeDasharray: "36 64"
|
|
1989
3434
|
})]
|
|
1990
3435
|
}), label && /* @__PURE__ */ jsx("span", {
|
|
1991
|
-
className: "spinner__label",
|
|
3436
|
+
className: partClass("spinner__label", classNames?.label),
|
|
1992
3437
|
children: label
|
|
1993
3438
|
})]
|
|
1994
3439
|
});
|
|
1995
3440
|
}
|
|
1996
3441
|
//#endregion
|
|
3442
|
+
//#region src/combobox-composition.tsx
|
|
3443
|
+
var ComboboxDisabledContext = createContext(false);
|
|
3444
|
+
function ComboboxComposition({ className, onChange, ...props }) {
|
|
3445
|
+
return /* @__PURE__ */ jsx(ComboboxDisabledContext.Provider, {
|
|
3446
|
+
value: !!props.isDisabled,
|
|
3447
|
+
children: /* @__PURE__ */ jsx(ComboBox, {
|
|
3448
|
+
...props,
|
|
3449
|
+
onChange: (key) => onChange?.(key == null ? null : String(key)),
|
|
3450
|
+
className: partClass("select combobox", className)
|
|
3451
|
+
})
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
function ComboboxInputGroup({ className, ...props }) {
|
|
3455
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3456
|
+
...props,
|
|
3457
|
+
className: partClass("combobox__control", className)
|
|
3458
|
+
});
|
|
3459
|
+
}
|
|
3460
|
+
function ComboboxInput({ className, ...props }) {
|
|
3461
|
+
return /* @__PURE__ */ jsx(Input$3, {
|
|
3462
|
+
...props,
|
|
3463
|
+
className: partClass("combobox__input", className)
|
|
3464
|
+
});
|
|
3465
|
+
}
|
|
3466
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
3467
|
+
return /* @__PURE__ */ jsx(Button$5, {
|
|
3468
|
+
"aria-label": "Buka pilihan",
|
|
3469
|
+
...props,
|
|
3470
|
+
className: partClass("combobox__toggle", className),
|
|
3471
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronIcon, { className: "select__icon" })
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3474
|
+
function ComboboxPopover({ className, ...props }) {
|
|
3475
|
+
return /* @__PURE__ */ jsx(Popover$3, {
|
|
3476
|
+
...props,
|
|
3477
|
+
className: partClass("select__popover combobox__popover", className)
|
|
3478
|
+
});
|
|
3479
|
+
}
|
|
3480
|
+
function ComboboxClearButton({ className, children, "aria-label": label = "Hapus pilihan", ...props }) {
|
|
3481
|
+
const state = useContext(ComboBoxStateContext);
|
|
3482
|
+
const disabled = useContext(ComboboxDisabledContext);
|
|
3483
|
+
return /* @__PURE__ */ jsx("button", {
|
|
3484
|
+
...props,
|
|
3485
|
+
type: "button",
|
|
3486
|
+
className: partClass("combobox__clear", className),
|
|
3487
|
+
"aria-label": label,
|
|
3488
|
+
disabled: disabled || state?.value == null && !state?.inputValue,
|
|
3489
|
+
onClick: () => {
|
|
3490
|
+
state?.setValue(null);
|
|
3491
|
+
state?.setInputValue("");
|
|
3492
|
+
},
|
|
3493
|
+
children: children ?? /* @__PURE__ */ jsx(CloseIcon, { className: "selection__close-icon" })
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
//#endregion
|
|
1997
3497
|
//#region src/Combobox.tsx
|
|
1998
3498
|
/** Searchable single selection. Draft text is never submitted as a value. */
|
|
1999
|
-
function
|
|
3499
|
+
function CompactCombobox(props) {
|
|
2000
3500
|
const [local, setLocal] = useState(props.defaultValue ?? null);
|
|
2001
3501
|
const [draft, setDraft] = useState(null);
|
|
2002
3502
|
const [tried, setTried] = useState(false);
|
|
@@ -2012,6 +3512,7 @@ function Combobox(props) {
|
|
|
2012
3512
|
const text = draft ?? selected?.label ?? "";
|
|
2013
3513
|
const invalid = props.isInvalid || tried && props.isRequired && !id;
|
|
2014
3514
|
const { describedBy, feedback } = useFeedback({
|
|
3515
|
+
classNames: props.classNames,
|
|
2015
3516
|
description: props.description,
|
|
2016
3517
|
isInvalid: invalid,
|
|
2017
3518
|
errorMessage: props.errorMessage ?? (props.isRequired && !id ? props.requiredMessage ?? "Pilihan wajib diisi." : void 0)
|
|
@@ -2024,7 +3525,8 @@ function Combobox(props) {
|
|
|
2024
3525
|
setDraft(null);
|
|
2025
3526
|
}
|
|
2026
3527
|
const content = /* @__PURE__ */ jsxs(ComboBox, {
|
|
2027
|
-
className: "select combobox",
|
|
3528
|
+
className: partClass(partClass("select combobox", props.classNames?.root), props.className),
|
|
3529
|
+
style: props.style,
|
|
2028
3530
|
value: id,
|
|
2029
3531
|
onChange: change,
|
|
2030
3532
|
inputValue: text,
|
|
@@ -2046,32 +3548,32 @@ function Combobox(props) {
|
|
|
2046
3548
|
validationBehavior: "aria",
|
|
2047
3549
|
children: [
|
|
2048
3550
|
/* @__PURE__ */ jsxs(Label$6, {
|
|
2049
|
-
className: "select__label",
|
|
3551
|
+
className: partClass("select__label", props.classNames?.label),
|
|
2050
3552
|
children: [props.label, props.isRequired && /* @__PURE__ */ jsxs("span", {
|
|
2051
|
-
className: "selection__required",
|
|
3553
|
+
className: partClass("selection__required", props.classNames?.required),
|
|
2052
3554
|
"aria-hidden": "true",
|
|
2053
3555
|
children: [" ", "*"]
|
|
2054
3556
|
})]
|
|
2055
3557
|
}),
|
|
2056
3558
|
/* @__PURE__ */ jsxs("div", {
|
|
2057
|
-
className: "combobox__control",
|
|
3559
|
+
className: partClass("combobox__control", props.classNames?.control),
|
|
2058
3560
|
"data-invalid": invalid || void 0,
|
|
2059
3561
|
"data-disabled": props.isDisabled || void 0,
|
|
2060
3562
|
children: [
|
|
2061
3563
|
props.startContent && /* @__PURE__ */ jsx("span", {
|
|
2062
|
-
className: "selection__leading",
|
|
3564
|
+
className: partClass("selection__leading", props.classNames?.leading),
|
|
2063
3565
|
"aria-hidden": "true",
|
|
2064
3566
|
children: props.startContent
|
|
2065
3567
|
}),
|
|
2066
3568
|
/* @__PURE__ */ jsx(Input$3, {
|
|
2067
3569
|
ref: input,
|
|
2068
|
-
className: "combobox__input",
|
|
3570
|
+
className: partClass("combobox__input", props.classNames?.input),
|
|
2069
3571
|
placeholder: props.placeholder,
|
|
2070
3572
|
"aria-describedby": describedBy
|
|
2071
3573
|
}),
|
|
2072
3574
|
props.isClearable && /* @__PURE__ */ jsx("button", {
|
|
2073
3575
|
type: "button",
|
|
2074
|
-
className: "combobox__clear",
|
|
3576
|
+
className: partClass("combobox__clear", props.classNames?.clearButton),
|
|
2075
3577
|
"data-empty": !id && !text || void 0,
|
|
2076
3578
|
"aria-hidden": !id && !text || void 0,
|
|
2077
3579
|
tabIndex: !id && !text ? -1 : void 0,
|
|
@@ -2081,35 +3583,35 @@ function Combobox(props) {
|
|
|
2081
3583
|
change(null);
|
|
2082
3584
|
input.current?.focus();
|
|
2083
3585
|
},
|
|
2084
|
-
children: /* @__PURE__ */ jsx(CloseIcon, { className: "selection__close-icon" })
|
|
3586
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: partClass("selection__close-icon", props.classNames?.clearIcon) })
|
|
2085
3587
|
}),
|
|
2086
|
-
/* @__PURE__ */ jsx(Button$
|
|
2087
|
-
className: "combobox__toggle",
|
|
3588
|
+
/* @__PURE__ */ jsx(Button$5, {
|
|
3589
|
+
className: partClass("combobox__toggle", props.classNames?.trigger),
|
|
2088
3590
|
"aria-label": props.toggleLabel ?? "Buka pilihan",
|
|
2089
|
-
children: /* @__PURE__ */ jsx(ChevronIcon, { className: "select__icon" })
|
|
3591
|
+
children: /* @__PURE__ */ jsx(ChevronIcon, { className: partClass("select__icon", props.classNames?.indicator) })
|
|
2090
3592
|
})
|
|
2091
3593
|
]
|
|
2092
3594
|
}),
|
|
2093
3595
|
/* @__PURE__ */ jsx(Popover$3, {
|
|
2094
|
-
className: "select__popover combobox__popover",
|
|
2095
|
-
children: /* @__PURE__ */ jsx(ListBox$
|
|
2096
|
-
className: "select__list",
|
|
3596
|
+
className: partClass("select__popover combobox__popover", props.classNames?.popover),
|
|
3597
|
+
children: /* @__PURE__ */ jsx(ListBox$3, {
|
|
3598
|
+
className: partClass("select__list", props.classNames?.list),
|
|
2097
3599
|
renderEmptyState: () => /* @__PURE__ */ jsx("span", {
|
|
2098
|
-
className: "selection__empty",
|
|
3600
|
+
className: partClass("selection__empty", props.classNames?.empty),
|
|
2099
3601
|
children: props.emptyMessage ?? "Tidak ada pilihan."
|
|
2100
3602
|
}),
|
|
2101
3603
|
children: (option) => /* @__PURE__ */ jsxs(ListBoxItem$2, {
|
|
2102
3604
|
id: option.id,
|
|
2103
3605
|
textValue: option.label,
|
|
2104
3606
|
isDisabled: option.isDisabled,
|
|
2105
|
-
className: "select__item",
|
|
3607
|
+
className: partClass("select__item", props.classNames?.item),
|
|
2106
3608
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2107
|
-
className: "select__item-label",
|
|
3609
|
+
className: partClass("select__item-label", props.classNames?.itemLabel),
|
|
2108
3610
|
children: props.renderOption?.(option) ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [option.label, option.description && /* @__PURE__ */ jsx("span", {
|
|
2109
|
-
className: "selection__description",
|
|
3611
|
+
className: partClass("selection__description", props.classNames?.itemDescription),
|
|
2110
3612
|
children: option.description
|
|
2111
3613
|
})] })
|
|
2112
|
-
}), /* @__PURE__ */ jsx(CheckIcon, { className: "select__check" })]
|
|
3614
|
+
}), /* @__PURE__ */ jsx(CheckIcon, { className: partClass("select__check", props.classNames?.itemIndicator) })]
|
|
2113
3615
|
})
|
|
2114
3616
|
})
|
|
2115
3617
|
}),
|
|
@@ -2147,6 +3649,18 @@ function Combobox(props) {
|
|
|
2147
3649
|
children: content
|
|
2148
3650
|
}) : content;
|
|
2149
3651
|
}
|
|
3652
|
+
function ComboboxRoot(props) {
|
|
3653
|
+
if ("options" in props && props.options) return /* @__PURE__ */ jsx(CompactCombobox, { ...props });
|
|
3654
|
+
return /* @__PURE__ */ jsx(ComboboxComposition, { ...props });
|
|
3655
|
+
}
|
|
3656
|
+
var Combobox = /* @__PURE__ */ Object.assign(ComboboxRoot, {
|
|
3657
|
+
Root: ComboboxComposition,
|
|
3658
|
+
InputGroup: ComboboxInputGroup,
|
|
3659
|
+
Input: ComboboxInput,
|
|
3660
|
+
Trigger: ComboboxTrigger,
|
|
3661
|
+
Popover: ComboboxPopover,
|
|
3662
|
+
ClearButton: ComboboxClearButton
|
|
3663
|
+
});
|
|
2150
3664
|
//#endregion
|
|
2151
3665
|
//#region src/toggle-group-model.ts
|
|
2152
3666
|
/** Normalize IDs without discarding existing disabled selections. */
|
|
@@ -2157,7 +3671,7 @@ function toggleIds(value, items, multiple) {
|
|
|
2157
3671
|
}
|
|
2158
3672
|
//#endregion
|
|
2159
3673
|
//#region src/ToggleGroup.tsx
|
|
2160
|
-
function
|
|
3674
|
+
function CompactToggleGroup(props) {
|
|
2161
3675
|
const multiple = props.selectionMode === "multiple";
|
|
2162
3676
|
const [local, setLocal] = useState(props.defaultValue);
|
|
2163
3677
|
const ids = toggleIds(props.value !== void 0 ? props.value : local, props.items, multiple);
|
|
@@ -2177,7 +3691,8 @@ function ToggleGroup(props) {
|
|
|
2177
3691
|
return /* @__PURE__ */ jsx(OverlayDirection, {
|
|
2178
3692
|
dir: props.dir,
|
|
2179
3693
|
children: /* @__PURE__ */ jsx(ToggleButtonGroup$1, {
|
|
2180
|
-
className: "toggle-group",
|
|
3694
|
+
className: partClass(partClass("toggle-group", props.classNames?.root), props.className),
|
|
3695
|
+
style: props.style,
|
|
2181
3696
|
"aria-label": props.label,
|
|
2182
3697
|
dir: props.dir,
|
|
2183
3698
|
selectionMode: multiple ? "multiple" : "single",
|
|
@@ -2191,18 +3706,160 @@ function ToggleGroup(props) {
|
|
|
2191
3706
|
"data-icon-only": props.isIconOnly || void 0,
|
|
2192
3707
|
children: props.items.map((item) => /* @__PURE__ */ jsxs(ToggleButton$1, {
|
|
2193
3708
|
id: item.id,
|
|
2194
|
-
className: "toggle-group__item",
|
|
3709
|
+
className: partClass("toggle-group__item", props.classNames?.item),
|
|
2195
3710
|
"aria-label": item.label,
|
|
2196
3711
|
isDisabled: props.isDisabled || item.isDisabled,
|
|
2197
3712
|
children: [props.renderIcon && /* @__PURE__ */ jsx("span", {
|
|
2198
|
-
className: "toggle-group__icon",
|
|
3713
|
+
className: partClass("toggle-group__icon", props.classNames?.icon),
|
|
2199
3714
|
"aria-hidden": "true",
|
|
2200
3715
|
children: props.renderIcon(item)
|
|
2201
|
-
}), !props.isIconOnly && /* @__PURE__ */ jsx("span", {
|
|
3716
|
+
}), !props.isIconOnly && /* @__PURE__ */ jsx("span", {
|
|
3717
|
+
className: props.classNames?.label,
|
|
3718
|
+
children: item.label
|
|
3719
|
+
})]
|
|
2202
3720
|
}, item.id))
|
|
2203
3721
|
})
|
|
2204
3722
|
});
|
|
2205
3723
|
}
|
|
3724
|
+
function ToggleGroupRoot(props) {
|
|
3725
|
+
if ("items" in props) return props.selectionMode === "multiple" ? /* @__PURE__ */ jsx(CompactToggleGroup, { ...props }) : /* @__PURE__ */ jsx(CompactToggleGroup, { ...props });
|
|
3726
|
+
return /* @__PURE__ */ jsx(ToggleButtonGroup, { ...props });
|
|
3727
|
+
}
|
|
3728
|
+
var ToggleGroup = /* @__PURE__ */ Object.assign(ToggleGroupRoot, {
|
|
3729
|
+
Root: ToggleButtonGroup,
|
|
3730
|
+
Item: ToggleButton,
|
|
3731
|
+
Separator: ButtonGroupSeparator
|
|
3732
|
+
});
|
|
3733
|
+
//#endregion
|
|
3734
|
+
//#region src/date-range-composition.tsx
|
|
3735
|
+
var DateRangeCompositionContext = createContext(null);
|
|
3736
|
+
function useRange() {
|
|
3737
|
+
const context = useContext(DateRangeCompositionContext);
|
|
3738
|
+
if (!context) throw new Error("DateRangePicker parts must be used inside DateRangePicker.");
|
|
3739
|
+
return context;
|
|
3740
|
+
}
|
|
3741
|
+
function DateRangeTrigger({ className, children, ...props }) {
|
|
3742
|
+
const range = useRange();
|
|
3743
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
3744
|
+
"aria-labelledby": `${range.id}-label ${range.id}-value`,
|
|
3745
|
+
"aria-describedby": range.feedbackId,
|
|
3746
|
+
"aria-invalid": range.invalid || void 0,
|
|
3747
|
+
isDisabled: range.disabled,
|
|
3748
|
+
ref: range.trigger,
|
|
3749
|
+
...props,
|
|
3750
|
+
className: partClass("date-range__trigger", className),
|
|
3751
|
+
children: children ?? /* @__PURE__ */ jsx(DateRangeValue, {})
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3754
|
+
function DateRangeValue({ className, children, ...props }) {
|
|
3755
|
+
const range = useRange();
|
|
3756
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3757
|
+
id: `${range.id}-value`,
|
|
3758
|
+
...props,
|
|
3759
|
+
className: partClass("date-range__value", className),
|
|
3760
|
+
children: children ?? range.text
|
|
3761
|
+
});
|
|
3762
|
+
}
|
|
3763
|
+
function DateRangeIndicator({ className, children, ...props }) {
|
|
3764
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3765
|
+
...props,
|
|
3766
|
+
className: partClass("date-range__chevron", className),
|
|
3767
|
+
"aria-hidden": "true",
|
|
3768
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronIcon, {})
|
|
3769
|
+
});
|
|
3770
|
+
}
|
|
3771
|
+
function DateRangePopover({ className, children, ...props }) {
|
|
3772
|
+
const range = useRange();
|
|
3773
|
+
return /* @__PURE__ */ jsx(Popover$2, {
|
|
3774
|
+
placement: "bottom start",
|
|
3775
|
+
offset: 8,
|
|
3776
|
+
dir: range.dir,
|
|
3777
|
+
...props,
|
|
3778
|
+
className: partClass("date-range__panel", className),
|
|
3779
|
+
children: (state) => /* @__PURE__ */ jsx(Dialog$1, {
|
|
3780
|
+
"aria-labelledby": `${range.id}-label`,
|
|
3781
|
+
className: "date-range__dialog",
|
|
3782
|
+
children: typeof children === "function" ? children(state) : children ?? range.panel
|
|
3783
|
+
})
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
/** Render the standard model-bound panel, or compose a custom panel through children. */
|
|
3787
|
+
function DateRangeContent({ className, children, ...props }) {
|
|
3788
|
+
const range = useRange();
|
|
3789
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3790
|
+
...props,
|
|
3791
|
+
className,
|
|
3792
|
+
children: children ?? range.panel
|
|
3793
|
+
});
|
|
3794
|
+
}
|
|
3795
|
+
function DateRangeCalendar({ className, ...props }) {
|
|
3796
|
+
const range = useRange();
|
|
3797
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3798
|
+
...props,
|
|
3799
|
+
className,
|
|
3800
|
+
children: range.calendar
|
|
3801
|
+
});
|
|
3802
|
+
}
|
|
3803
|
+
function DateRangeInput({ part, className, onChange, ...props }) {
|
|
3804
|
+
const range = useRange();
|
|
3805
|
+
return /* @__PURE__ */ jsx("input", {
|
|
3806
|
+
type: "date",
|
|
3807
|
+
form: "",
|
|
3808
|
+
min: range.min,
|
|
3809
|
+
max: range.max,
|
|
3810
|
+
disabled: range.disabled,
|
|
3811
|
+
readOnly: range.readOnly,
|
|
3812
|
+
"aria-invalid": range.invalid || void 0,
|
|
3813
|
+
...props,
|
|
3814
|
+
className: partClass("input__control", className),
|
|
3815
|
+
value: range.draft[part],
|
|
3816
|
+
onChange: (event) => {
|
|
3817
|
+
onChange?.(event);
|
|
3818
|
+
if (!event.defaultPrevented) range.edit(part, event.target.value);
|
|
3819
|
+
}
|
|
3820
|
+
});
|
|
3821
|
+
}
|
|
3822
|
+
function DateRangeApplyButton({ className, onClick, children, ...props }) {
|
|
3823
|
+
const range = useRange();
|
|
3824
|
+
return /* @__PURE__ */ jsx("button", {
|
|
3825
|
+
type: "button",
|
|
3826
|
+
...props,
|
|
3827
|
+
className: partClass("button button--primary button--sm", className),
|
|
3828
|
+
disabled: range.disabled || range.readOnly || range.invalid || props.disabled,
|
|
3829
|
+
onClick: (event) => {
|
|
3830
|
+
onClick?.(event);
|
|
3831
|
+
if (!event.defaultPrevented) range.apply();
|
|
3832
|
+
},
|
|
3833
|
+
children: children ?? range.labels.apply
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3836
|
+
function DateRangeClearButton({ className, onClick, children, ...props }) {
|
|
3837
|
+
const range = useRange();
|
|
3838
|
+
return /* @__PURE__ */ jsx("button", {
|
|
3839
|
+
type: "button",
|
|
3840
|
+
...props,
|
|
3841
|
+
className: partClass("button button--ghost button--sm", className),
|
|
3842
|
+
disabled: range.disabled || range.readOnly || props.disabled,
|
|
3843
|
+
onClick: (event) => {
|
|
3844
|
+
onClick?.(event);
|
|
3845
|
+
if (!event.defaultPrevented) range.clear();
|
|
3846
|
+
},
|
|
3847
|
+
children: children ?? range.labels.clear
|
|
3848
|
+
});
|
|
3849
|
+
}
|
|
3850
|
+
function DateRangeCancelButton({ className, onClick, children, ...props }) {
|
|
3851
|
+
const range = useRange();
|
|
3852
|
+
return /* @__PURE__ */ jsx("button", {
|
|
3853
|
+
type: "button",
|
|
3854
|
+
...props,
|
|
3855
|
+
className: partClass("button button--secondary button--sm", className),
|
|
3856
|
+
onClick: (event) => {
|
|
3857
|
+
onClick?.(event);
|
|
3858
|
+
if (!event.defaultPrevented) range.cancel();
|
|
3859
|
+
},
|
|
3860
|
+
children: children ?? range.labels.cancel
|
|
3861
|
+
});
|
|
3862
|
+
}
|
|
2206
3863
|
//#endregion
|
|
2207
3864
|
//#region src/date-range-model.ts
|
|
2208
3865
|
function dateRangeLabels(locale = "id-ID") {
|
|
@@ -2353,7 +4010,7 @@ function CalendarContent({ onPending, dir, children }) {
|
|
|
2353
4010
|
children
|
|
2354
4011
|
});
|
|
2355
4012
|
}
|
|
2356
|
-
function
|
|
4013
|
+
function DateRangePickerRoot(props) {
|
|
2357
4014
|
const { label, locale = "id-ID", dir, size = "md", variant = "primary", fullWidth = true, hideLabel = false, visibleMonths = 2, weekStartsOn = 1, display = "popover", showInputs = true, presets = [], isDisabled = false, isReadOnly = false, isRequired = false } = props;
|
|
2358
4015
|
const labels = {
|
|
2359
4016
|
...dateRangeLabels(locale),
|
|
@@ -2428,30 +4085,92 @@ function DateRangePicker(props) {
|
|
|
2428
4085
|
start: asDate(draft.start),
|
|
2429
4086
|
end: asDate(draft.end)
|
|
2430
4087
|
} : null;
|
|
4088
|
+
const calendar = /* @__PURE__ */ jsx(RangeCalendar, {
|
|
4089
|
+
dir,
|
|
4090
|
+
className: partClass("date-range__calendar", props.classNames?.calendar),
|
|
4091
|
+
"aria-label": labels.title,
|
|
4092
|
+
value: calendarValue,
|
|
4093
|
+
focusedValue: focused,
|
|
4094
|
+
onFocusChange: setFocused,
|
|
4095
|
+
createCalendar: () => new GregorianCalendar(),
|
|
4096
|
+
onChange: (v) => {
|
|
4097
|
+
if (v) setDraft({
|
|
4098
|
+
start: v.start.toString(),
|
|
4099
|
+
end: v.end.toString()
|
|
4100
|
+
});
|
|
4101
|
+
},
|
|
4102
|
+
visibleDuration: { months: visibleMonths },
|
|
4103
|
+
firstDayOfWeek: weekStartsOn === 1 ? "mon" : "sun",
|
|
4104
|
+
pageBehavior: "single",
|
|
4105
|
+
minValue: asDate(props.minDate),
|
|
4106
|
+
maxValue: asDate(props.maxDate),
|
|
4107
|
+
isDisabled,
|
|
4108
|
+
isReadOnly,
|
|
4109
|
+
isDateUnavailable: props.isDateUnavailable ? (d) => props.isDateUnavailable(d.toString()) : void 0,
|
|
4110
|
+
children: /* @__PURE__ */ jsxs(CalendarContent, {
|
|
4111
|
+
onPending: setPending,
|
|
4112
|
+
dir,
|
|
4113
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4114
|
+
className: partClass("date-range__navigation", props.classNames?.navigation),
|
|
4115
|
+
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
4116
|
+
slot: "previous",
|
|
4117
|
+
className: partClass("date-range__nav date-range__nav--previous", props.classNames?.navigationButton),
|
|
4118
|
+
"aria-label": labels.previousMonth,
|
|
4119
|
+
children: /* @__PURE__ */ jsx(ChevronIcon, {})
|
|
4120
|
+
}), /* @__PURE__ */ jsx(Button$1, {
|
|
4121
|
+
slot: "next",
|
|
4122
|
+
className: partClass("date-range__nav date-range__nav--next", props.classNames?.navigationButton),
|
|
4123
|
+
"aria-label": labels.nextMonth,
|
|
4124
|
+
children: /* @__PURE__ */ jsx(ChevronIcon, {})
|
|
4125
|
+
})]
|
|
4126
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4127
|
+
className: partClass("date-range__months", props.classNames?.months),
|
|
4128
|
+
children: Array.from({ length: visibleMonths }, (_, i) => /* @__PURE__ */ jsxs("div", {
|
|
4129
|
+
className: partClass("date-range__month", props.classNames?.month),
|
|
4130
|
+
children: [/* @__PURE__ */ jsx(CalendarHeading, {
|
|
4131
|
+
offset: { months: i },
|
|
4132
|
+
className: partClass("date-range__heading", props.classNames?.heading)
|
|
4133
|
+
}), /* @__PURE__ */ jsxs(CalendarGrid, {
|
|
4134
|
+
offset: { months: i },
|
|
4135
|
+
className: partClass("date-range__grid", props.classNames?.grid),
|
|
4136
|
+
weekdayStyle: "short",
|
|
4137
|
+
children: [/* @__PURE__ */ jsx(CalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx(CalendarHeaderCell, {
|
|
4138
|
+
className: partClass("date-range__weekday", props.classNames?.weekday),
|
|
4139
|
+
children: day
|
|
4140
|
+
}) }), /* @__PURE__ */ jsx(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx(CalendarCell, {
|
|
4141
|
+
date,
|
|
4142
|
+
className: partClass("date-range__day", props.classNames?.day)
|
|
4143
|
+
}) })]
|
|
4144
|
+
})]
|
|
4145
|
+
}, i))
|
|
4146
|
+
})]
|
|
4147
|
+
})
|
|
4148
|
+
}, calendarKey);
|
|
2431
4149
|
const panel = /* @__PURE__ */ jsxs("div", {
|
|
2432
|
-
className: "date-range__content",
|
|
4150
|
+
className: partClass("date-range__content", props.classNames?.content),
|
|
2433
4151
|
"data-readonly": isReadOnly || void 0,
|
|
2434
4152
|
children: [
|
|
2435
4153
|
/* @__PURE__ */ jsxs("header", {
|
|
2436
|
-
className: "date-range__intro",
|
|
4154
|
+
className: partClass("date-range__intro", props.classNames?.intro),
|
|
2437
4155
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
2438
4156
|
id: `${id}-title`,
|
|
4157
|
+
className: props.classNames?.title,
|
|
2439
4158
|
children: labels.title
|
|
2440
4159
|
}), /* @__PURE__ */ jsx("p", {
|
|
2441
|
-
className: "date-range__summary",
|
|
4160
|
+
className: partClass("date-range__summary", props.classNames?.summary),
|
|
2442
4161
|
"aria-live": "polite",
|
|
2443
4162
|
children: pending ? labels.incomplete : rangeText(nullableDraft, locale) || labels.incomplete
|
|
2444
4163
|
})]
|
|
2445
4164
|
}),
|
|
2446
4165
|
/* @__PURE__ */ jsxs("div", {
|
|
2447
|
-
className: "date-range__body",
|
|
4166
|
+
className: partClass("date-range__body", props.classNames?.body),
|
|
2448
4167
|
children: [presets.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
2449
|
-
className: "date-range__presets",
|
|
4168
|
+
className: partClass("date-range__presets", props.classNames?.presets),
|
|
2450
4169
|
role: "group",
|
|
2451
4170
|
"aria-label": labels.presets,
|
|
2452
4171
|
children: presets.map((p) => /* @__PURE__ */ jsx("button", {
|
|
2453
4172
|
type: "button",
|
|
2454
|
-
className: "date-range__preset",
|
|
4173
|
+
className: partClass("date-range__preset", props.classNames?.preset),
|
|
2455
4174
|
disabled: isDisabled || isReadOnly || !!rangeError(p.value, props),
|
|
2456
4175
|
"aria-pressed": !pending && draft.start === p.value.start && draft.end === p.value.end,
|
|
2457
4176
|
onClick: () => {
|
|
@@ -2461,13 +4180,17 @@ function DateRangePicker(props) {
|
|
|
2461
4180
|
children: p.label
|
|
2462
4181
|
}, p.id))
|
|
2463
4182
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2464
|
-
className: "date-range__main",
|
|
4183
|
+
className: partClass("date-range__main", props.classNames?.main),
|
|
2465
4184
|
children: [
|
|
2466
4185
|
showInputs && /* @__PURE__ */ jsx("div", {
|
|
2467
|
-
className: "date-range__inputs",
|
|
4186
|
+
className: partClass("date-range__inputs", props.classNames?.inputs),
|
|
2468
4187
|
children: ["start", "end"].map((part) => /* @__PURE__ */ jsxs("label", {
|
|
2469
|
-
className: "date-range__field",
|
|
2470
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
4188
|
+
className: partClass("date-range__field", props.classNames?.field),
|
|
4189
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4190
|
+
className: props.classNames?.inputLabel,
|
|
4191
|
+
children: labels[part]
|
|
4192
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
4193
|
+
className: props.classNames?.input,
|
|
2471
4194
|
type: "date",
|
|
2472
4195
|
form: "",
|
|
2473
4196
|
value: draft[part],
|
|
@@ -2482,8 +4205,9 @@ function DateRangePicker(props) {
|
|
|
2482
4205
|
}, part))
|
|
2483
4206
|
}),
|
|
2484
4207
|
props.showMonthYearPicker && /* @__PURE__ */ jsxs("div", {
|
|
2485
|
-
className: "date-range__jump",
|
|
4208
|
+
className: partClass("date-range__jump", props.classNames?.jump),
|
|
2486
4209
|
children: [/* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: locale.startsWith("id") ? "Bulan" : "Month" }), /* @__PURE__ */ jsx("select", {
|
|
4210
|
+
className: props.classNames?.monthSelect,
|
|
2487
4211
|
form: "",
|
|
2488
4212
|
disabled: isDisabled,
|
|
2489
4213
|
"aria-label": locale.startsWith("id") ? "Bulan" : "Month",
|
|
@@ -2501,6 +4225,7 @@ function DateRangePicker(props) {
|
|
|
2501
4225
|
}).toDate("UTC"))
|
|
2502
4226
|
}, i))
|
|
2503
4227
|
})] }), /* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("span", { children: locale.startsWith("id") ? "Tahun" : "Year" }), /* @__PURE__ */ jsx("input", {
|
|
4228
|
+
className: props.classNames?.yearInput,
|
|
2504
4229
|
type: "number",
|
|
2505
4230
|
form: "",
|
|
2506
4231
|
disabled: isDisabled,
|
|
@@ -2514,73 +4239,14 @@ function DateRangePicker(props) {
|
|
|
2514
4239
|
}
|
|
2515
4240
|
}, focused.year)] })]
|
|
2516
4241
|
}),
|
|
2517
|
-
|
|
2518
|
-
dir,
|
|
2519
|
-
className: "date-range__calendar",
|
|
2520
|
-
"aria-label": labels.title,
|
|
2521
|
-
value: calendarValue,
|
|
2522
|
-
focusedValue: focused,
|
|
2523
|
-
onFocusChange: setFocused,
|
|
2524
|
-
createCalendar: () => new GregorianCalendar(),
|
|
2525
|
-
onChange: (v) => {
|
|
2526
|
-
if (v) setDraft({
|
|
2527
|
-
start: v.start.toString(),
|
|
2528
|
-
end: v.end.toString()
|
|
2529
|
-
});
|
|
2530
|
-
},
|
|
2531
|
-
visibleDuration: { months: visibleMonths },
|
|
2532
|
-
firstDayOfWeek: weekStartsOn === 1 ? "mon" : "sun",
|
|
2533
|
-
pageBehavior: "single",
|
|
2534
|
-
minValue: asDate(props.minDate),
|
|
2535
|
-
maxValue: asDate(props.maxDate),
|
|
2536
|
-
isDisabled,
|
|
2537
|
-
isReadOnly,
|
|
2538
|
-
isDateUnavailable: props.isDateUnavailable ? (d) => props.isDateUnavailable(d.toString()) : void 0,
|
|
2539
|
-
children: /* @__PURE__ */ jsxs(CalendarContent, {
|
|
2540
|
-
onPending: setPending,
|
|
2541
|
-
dir,
|
|
2542
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
2543
|
-
className: "date-range__navigation",
|
|
2544
|
-
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
2545
|
-
slot: "previous",
|
|
2546
|
-
className: "date-range__nav date-range__nav--previous",
|
|
2547
|
-
"aria-label": labels.previousMonth,
|
|
2548
|
-
children: /* @__PURE__ */ jsx(ChevronIcon, {})
|
|
2549
|
-
}), /* @__PURE__ */ jsx(Button$1, {
|
|
2550
|
-
slot: "next",
|
|
2551
|
-
className: "date-range__nav date-range__nav--next",
|
|
2552
|
-
"aria-label": labels.nextMonth,
|
|
2553
|
-
children: /* @__PURE__ */ jsx(ChevronIcon, {})
|
|
2554
|
-
})]
|
|
2555
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
2556
|
-
className: "date-range__months",
|
|
2557
|
-
children: Array.from({ length: visibleMonths }, (_, i) => /* @__PURE__ */ jsxs("div", {
|
|
2558
|
-
className: "date-range__month",
|
|
2559
|
-
children: [/* @__PURE__ */ jsx(CalendarHeading, {
|
|
2560
|
-
offset: { months: i },
|
|
2561
|
-
className: "date-range__heading"
|
|
2562
|
-
}), /* @__PURE__ */ jsxs(CalendarGrid, {
|
|
2563
|
-
offset: { months: i },
|
|
2564
|
-
className: "date-range__grid",
|
|
2565
|
-
weekdayStyle: "short",
|
|
2566
|
-
children: [/* @__PURE__ */ jsx(CalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx(CalendarHeaderCell, {
|
|
2567
|
-
className: "date-range__weekday",
|
|
2568
|
-
children: day
|
|
2569
|
-
}) }), /* @__PURE__ */ jsx(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx(CalendarCell, {
|
|
2570
|
-
date,
|
|
2571
|
-
className: "date-range__day"
|
|
2572
|
-
}) })]
|
|
2573
|
-
})]
|
|
2574
|
-
}, i))
|
|
2575
|
-
})]
|
|
2576
|
-
})
|
|
2577
|
-
}, calendarKey),
|
|
4242
|
+
calendar,
|
|
2578
4243
|
/* @__PURE__ */ jsx("div", {
|
|
2579
|
-
className: "date-range__validation",
|
|
4244
|
+
className: partClass("date-range__validation", props.classNames?.validation),
|
|
2580
4245
|
"aria-live": "polite",
|
|
2581
4246
|
children: error && /* @__PURE__ */ jsx("p", {
|
|
2582
4247
|
id: `${id}-draft-error`,
|
|
2583
4248
|
role: "alert",
|
|
4249
|
+
className: props.classNames?.draftError,
|
|
2584
4250
|
children: error
|
|
2585
4251
|
})
|
|
2586
4252
|
})
|
|
@@ -2588,21 +4254,21 @@ function DateRangePicker(props) {
|
|
|
2588
4254
|
})]
|
|
2589
4255
|
}),
|
|
2590
4256
|
/* @__PURE__ */ jsxs("footer", {
|
|
2591
|
-
className: "date-range__footer",
|
|
4257
|
+
className: partClass("date-range__footer", props.classNames?.footer),
|
|
2592
4258
|
children: [/* @__PURE__ */ jsx("button", {
|
|
2593
4259
|
type: "button",
|
|
2594
|
-
className: "button button--ghost button--sm",
|
|
4260
|
+
className: partClass("button button--ghost button--sm", props.classNames?.clearButton),
|
|
2595
4261
|
disabled: isDisabled || isReadOnly,
|
|
2596
4262
|
onClick: () => replaceDraft(empty()),
|
|
2597
4263
|
children: labels.clear
|
|
2598
4264
|
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("button", {
|
|
2599
4265
|
type: "button",
|
|
2600
|
-
className: "button button--secondary button--sm",
|
|
4266
|
+
className: partClass("button button--secondary button--sm", props.classNames?.cancelButton),
|
|
2601
4267
|
onClick: () => changeOpen(false),
|
|
2602
4268
|
children: labels.cancel
|
|
2603
4269
|
}), /* @__PURE__ */ jsx("button", {
|
|
2604
4270
|
type: "button",
|
|
2605
|
-
className: "button button--primary button--sm",
|
|
4271
|
+
className: partClass("button button--primary button--sm", props.classNames?.applyButton),
|
|
2606
4272
|
disabled: isDisabled || isReadOnly || !!errorCode,
|
|
2607
4273
|
onClick: apply,
|
|
2608
4274
|
children: labels.apply
|
|
@@ -2615,122 +4281,164 @@ function DateRangePicker(props) {
|
|
|
2615
4281
|
calendar: "gregory",
|
|
2616
4282
|
...dir ? { script: dir === "rtl" ? "Arab" : "Latn" } : {}
|
|
2617
4283
|
}).toString(),
|
|
2618
|
-
children: /* @__PURE__ */
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
}),
|
|
2670
|
-
/* @__PURE__ */ jsx("span", {
|
|
2671
|
-
id: `${id}-value`,
|
|
2672
|
-
className: "date-range__value",
|
|
2673
|
-
"data-placeholder": !committed || void 0,
|
|
2674
|
-
children: text
|
|
2675
|
-
}),
|
|
2676
|
-
/* @__PURE__ */ jsx(ChevronIcon, { className: "date-range__chevron" })
|
|
2677
|
-
]
|
|
2678
|
-
}), /* @__PURE__ */ jsx(Popover$2, {
|
|
2679
|
-
className: "date-range__panel",
|
|
2680
|
-
placement: "bottom start",
|
|
2681
|
-
offset: 8,
|
|
2682
|
-
containerPadding: 16,
|
|
4284
|
+
children: /* @__PURE__ */ jsx(DateRangeCompositionContext.Provider, {
|
|
4285
|
+
value: {
|
|
4286
|
+
id,
|
|
4287
|
+
text,
|
|
4288
|
+
labels,
|
|
4289
|
+
draft,
|
|
4290
|
+
disabled: isDisabled,
|
|
4291
|
+
readOnly: isReadOnly,
|
|
4292
|
+
invalid: !!errorCode,
|
|
4293
|
+
feedbackId,
|
|
4294
|
+
min: props.minDate,
|
|
4295
|
+
max: props.maxDate,
|
|
4296
|
+
dir,
|
|
4297
|
+
trigger,
|
|
4298
|
+
calendar,
|
|
4299
|
+
panel,
|
|
4300
|
+
edit,
|
|
4301
|
+
apply,
|
|
4302
|
+
clear: () => replaceDraft(empty()),
|
|
4303
|
+
cancel: () => changeOpen(false)
|
|
4304
|
+
},
|
|
4305
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4306
|
+
className: [
|
|
4307
|
+
"date-range",
|
|
4308
|
+
props.classNames?.root,
|
|
4309
|
+
props.className,
|
|
4310
|
+
`date-range--${size}`,
|
|
4311
|
+
`date-range--${variant}`,
|
|
4312
|
+
!fullWidth && "date-range--fit",
|
|
4313
|
+
hideLabel && "date-range--label-hidden",
|
|
4314
|
+
props.triggerDisplay === "icon" && "date-range--icon-trigger"
|
|
4315
|
+
].filter(Boolean).join(" "),
|
|
4316
|
+
style: props.style,
|
|
4317
|
+
dir,
|
|
4318
|
+
"data-disabled": isDisabled || void 0,
|
|
4319
|
+
children: [
|
|
4320
|
+
/* @__PURE__ */ jsxs("span", {
|
|
4321
|
+
id: `${id}-label`,
|
|
4322
|
+
className: partClass("date-range__label", props.classNames?.label),
|
|
4323
|
+
children: [label, isRequired && /* @__PURE__ */ jsx("span", {
|
|
4324
|
+
"aria-hidden": "true",
|
|
4325
|
+
children: " *"
|
|
4326
|
+
})]
|
|
4327
|
+
}),
|
|
4328
|
+
props.children ? /* @__PURE__ */ jsx(DialogTrigger, {
|
|
4329
|
+
isOpen: visible,
|
|
4330
|
+
onOpenChange: changeOpen,
|
|
4331
|
+
children: props.children
|
|
4332
|
+
}) : display === "inline" ? /* @__PURE__ */ jsx("section", {
|
|
4333
|
+
className: partClass("date-range__panel date-range__inline", props.classNames?.panel),
|
|
4334
|
+
"aria-labelledby": `${id}-title`,
|
|
2683
4335
|
dir,
|
|
2684
|
-
children:
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
4336
|
+
children: panel
|
|
4337
|
+
}) : /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
4338
|
+
isOpen: visible,
|
|
4339
|
+
onOpenChange: changeOpen,
|
|
4340
|
+
children: [/* @__PURE__ */ jsxs(Button$1, {
|
|
4341
|
+
ref: trigger,
|
|
4342
|
+
className: partClass("date-range__trigger", props.classNames?.trigger),
|
|
4343
|
+
isDisabled,
|
|
4344
|
+
"aria-labelledby": `${id}-label ${id}-value`,
|
|
4345
|
+
"aria-describedby": feedbackId,
|
|
4346
|
+
"aria-invalid": !!outerError,
|
|
4347
|
+
children: [
|
|
4348
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
4349
|
+
className: partClass("date-range__icon", props.classNames?.icon),
|
|
4350
|
+
"aria-hidden": "true",
|
|
4351
|
+
viewBox: "0 0 24 24",
|
|
4352
|
+
fill: "none",
|
|
4353
|
+
stroke: "currentColor",
|
|
4354
|
+
strokeWidth: "1.8",
|
|
4355
|
+
strokeLinecap: "round",
|
|
4356
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
4357
|
+
x: "3",
|
|
4358
|
+
y: "5",
|
|
4359
|
+
width: "18",
|
|
4360
|
+
height: "16",
|
|
4361
|
+
rx: "2"
|
|
4362
|
+
}), /* @__PURE__ */ jsx("path", { d: "M7 3v4m10-4v4M3 10h18" })]
|
|
4363
|
+
}),
|
|
4364
|
+
/* @__PURE__ */ jsx("span", {
|
|
4365
|
+
id: `${id}-value`,
|
|
4366
|
+
className: partClass("date-range__value", props.classNames?.value),
|
|
4367
|
+
"data-placeholder": !committed || void 0,
|
|
4368
|
+
children: text
|
|
4369
|
+
}),
|
|
4370
|
+
/* @__PURE__ */ jsx(ChevronIcon, { className: partClass("date-range__chevron", props.classNames?.chevron) })
|
|
4371
|
+
]
|
|
4372
|
+
}), /* @__PURE__ */ jsx(Popover$2, {
|
|
4373
|
+
className: partClass("date-range__panel", props.classNames?.panel),
|
|
4374
|
+
placement: "bottom start",
|
|
4375
|
+
offset: 8,
|
|
4376
|
+
containerPadding: 16,
|
|
4377
|
+
dir,
|
|
4378
|
+
children: /* @__PURE__ */ jsx(Dialog$1, {
|
|
4379
|
+
className: partClass("date-range__dialog", props.classNames?.dialog),
|
|
4380
|
+
"aria-labelledby": `${id}-title`,
|
|
4381
|
+
children: panel
|
|
4382
|
+
})
|
|
4383
|
+
})]
|
|
4384
|
+
}),
|
|
4385
|
+
props.description && /* @__PURE__ */ jsx("span", {
|
|
4386
|
+
id: `${id}-description`,
|
|
4387
|
+
className: partClass("input__description", props.classNames?.description),
|
|
4388
|
+
children: props.description
|
|
4389
|
+
}),
|
|
4390
|
+
outerError && /* @__PURE__ */ jsx("span", {
|
|
4391
|
+
id: `${id}-error`,
|
|
4392
|
+
className: partClass("input__error", props.classNames?.error),
|
|
4393
|
+
role: "alert",
|
|
4394
|
+
children: props.errorMessage ?? (committedError ? labels[committedError] : labels.required)
|
|
4395
|
+
}),
|
|
4396
|
+
props.name && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("input", {
|
|
4397
|
+
type: "hidden",
|
|
4398
|
+
name: `${props.name}.start`,
|
|
4399
|
+
value: start,
|
|
4400
|
+
disabled: isDisabled
|
|
4401
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
4402
|
+
type: "hidden",
|
|
4403
|
+
name: `${props.name}.end`,
|
|
4404
|
+
value: end,
|
|
4405
|
+
disabled: isDisabled
|
|
4406
|
+
})] }),
|
|
4407
|
+
/* @__PURE__ */ jsx(SelectionValidation, {
|
|
4408
|
+
hasValue: !!committed && !committedError,
|
|
4409
|
+
required: isRequired || !!committedError,
|
|
4410
|
+
disabled: isDisabled,
|
|
4411
|
+
onInvalid: () => {
|
|
4412
|
+
setFormError(true);
|
|
4413
|
+
trigger.current?.focus();
|
|
4414
|
+
},
|
|
4415
|
+
onResetStart: () => {},
|
|
4416
|
+
onReset: (cancelled) => {
|
|
4417
|
+
if (!cancelled) {
|
|
4418
|
+
if (props.value === void 0) setLocal(props.defaultValue ?? null);
|
|
4419
|
+
setFormError(false);
|
|
4420
|
+
changeOpen(false);
|
|
4421
|
+
}
|
|
2727
4422
|
}
|
|
2728
|
-
}
|
|
2729
|
-
|
|
2730
|
-
|
|
4423
|
+
})
|
|
4424
|
+
]
|
|
4425
|
+
})
|
|
2731
4426
|
})
|
|
2732
4427
|
});
|
|
2733
4428
|
}
|
|
4429
|
+
var DateRangePicker = /* @__PURE__ */ Object.assign(DateRangePickerRoot, {
|
|
4430
|
+
Root: DateRangePickerRoot,
|
|
4431
|
+
Trigger: DateRangeTrigger,
|
|
4432
|
+
Value: DateRangeValue,
|
|
4433
|
+
Indicator: DateRangeIndicator,
|
|
4434
|
+
Popover: DateRangePopover,
|
|
4435
|
+
Content: DateRangeContent,
|
|
4436
|
+
Calendar: DateRangeCalendar,
|
|
4437
|
+
Input: DateRangeInput,
|
|
4438
|
+
ApplyButton: DateRangeApplyButton,
|
|
4439
|
+
ClearButton: DateRangeClearButton,
|
|
4440
|
+
CancelButton: DateRangeCancelButton
|
|
4441
|
+
});
|
|
2734
4442
|
//#endregion
|
|
2735
4443
|
//#region src/toast-model.ts
|
|
2736
4444
|
var EMPTY = Object.freeze([]);
|
|
@@ -3056,7 +4764,7 @@ var QueueAdapter = class extends UNSTABLE_ToastQueue {
|
|
|
3056
4764
|
}
|
|
3057
4765
|
};
|
|
3058
4766
|
var ToastContext = createContext(null);
|
|
3059
|
-
function ToastProvider({ children, manager: suppliedManager, placement = "bottom-end", label = "Notifikasi / Notifications", closeLabel = "Tutup notifikasi / Close notification", hotkey = ["Alt", "t"], dir = "ltr", showProgress = false, showCloseButton = false, swipeThreshold = 50, renderToast }) {
|
|
4767
|
+
function ToastProvider({ className, classNames, style, children, manager: suppliedManager, placement = "bottom-end", label = "Notifikasi / Notifications", closeLabel = "Tutup notifikasi / Close notification", hotkey = ["Alt", "t"], dir = "ltr", showProgress = false, showCloseButton = false, swipeThreshold = 50, renderToast }) {
|
|
3060
4768
|
const [ownedManager] = useState(() => createToastManager());
|
|
3061
4769
|
const manager = suppliedManager ?? ownedManager;
|
|
3062
4770
|
const queue = useMemo(() => new QueueAdapter(manager), [manager]);
|
|
@@ -3201,12 +4909,13 @@ function ToastProvider({ children, manager: suppliedManager, placement = "bottom
|
|
|
3201
4909
|
children: /* @__PURE__ */ jsx(UNSTABLE_ToastRegion, {
|
|
3202
4910
|
queue,
|
|
3203
4911
|
ref: region,
|
|
3204
|
-
className: "toast-region",
|
|
4912
|
+
className: partClass(partClass("toast-region", classNames?.root), className),
|
|
4913
|
+
style,
|
|
3205
4914
|
"data-placement": placement,
|
|
3206
4915
|
"aria-label": label,
|
|
3207
4916
|
"aria-keyshortcuts": hotkey.length ? hotkey.join("+") : void 0,
|
|
3208
4917
|
children: /* @__PURE__ */ jsx(UNSTABLE_ToastList, {
|
|
3209
|
-
className: "toast-list",
|
|
4918
|
+
className: partClass("toast-list", classNames?.list),
|
|
3210
4919
|
children: ({ toast }) => /* @__PURE__ */ jsx(Fragment$1, { children: renderToast ? renderToast(toast.content) : /* @__PURE__ */ jsx(Toast, { entry: toast.content }) })
|
|
3211
4920
|
})
|
|
3212
4921
|
})
|
|
@@ -3218,6 +4927,122 @@ function useToast() {
|
|
|
3218
4927
|
if (!context) throw new Error("useToast must be used within a ToastProvider.");
|
|
3219
4928
|
return context.manager;
|
|
3220
4929
|
}
|
|
4930
|
+
var ToastPresentationContext = createContext(null);
|
|
4931
|
+
function useToastPresentation() {
|
|
4932
|
+
const state = useContext(ToastPresentationContext);
|
|
4933
|
+
if (!state) throw new Error("Toast parts must be used inside Toast.Root.");
|
|
4934
|
+
return state;
|
|
4935
|
+
}
|
|
4936
|
+
function ToastRoot(props) {
|
|
4937
|
+
return /* @__PURE__ */ jsx(ToastRenderer, {
|
|
4938
|
+
...props,
|
|
4939
|
+
composed: true
|
|
4940
|
+
});
|
|
4941
|
+
}
|
|
4942
|
+
function ToastIndicator({ className, children, ...props }) {
|
|
4943
|
+
const { entry } = useToastPresentation();
|
|
4944
|
+
return /* @__PURE__ */ jsx("span", {
|
|
4945
|
+
...props,
|
|
4946
|
+
"aria-hidden": "true",
|
|
4947
|
+
className: partClass("toast__indicator", className),
|
|
4948
|
+
children: children ?? /* @__PURE__ */ jsx(Indicator, { entry })
|
|
4949
|
+
});
|
|
4950
|
+
}
|
|
4951
|
+
function ToastBody({ className, ...props }) {
|
|
4952
|
+
return /* @__PURE__ */ jsx(UNSTABLE_ToastContent, {
|
|
4953
|
+
...props,
|
|
4954
|
+
role: "status",
|
|
4955
|
+
"aria-live": "polite",
|
|
4956
|
+
className: partClass("toast__body", className)
|
|
4957
|
+
});
|
|
4958
|
+
}
|
|
4959
|
+
function ToastTitle({ className, children, ...props }) {
|
|
4960
|
+
const { entry } = useToastPresentation();
|
|
4961
|
+
return /* @__PURE__ */ jsx(Text$4, {
|
|
4962
|
+
...props,
|
|
4963
|
+
slot: "title",
|
|
4964
|
+
className: partClass("toast__title", className),
|
|
4965
|
+
children: children ?? entry.title
|
|
4966
|
+
});
|
|
4967
|
+
}
|
|
4968
|
+
function ToastDescription({ className, children, ...props }) {
|
|
4969
|
+
const { entry } = useToastPresentation();
|
|
4970
|
+
if (!children && !entry.description) return null;
|
|
4971
|
+
return /* @__PURE__ */ jsx(Text$4, {
|
|
4972
|
+
...props,
|
|
4973
|
+
slot: "description",
|
|
4974
|
+
className: partClass("toast__description", className),
|
|
4975
|
+
children: children ?? entry.description
|
|
4976
|
+
});
|
|
4977
|
+
}
|
|
4978
|
+
function ToastActions({ className, ...props }) {
|
|
4979
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4980
|
+
...props,
|
|
4981
|
+
className: partClass("toast__actions", className)
|
|
4982
|
+
});
|
|
4983
|
+
}
|
|
4984
|
+
function ToastActionButton({ className, children, cancel = false, onPress, ...props }) {
|
|
4985
|
+
const state = useToastPresentation();
|
|
4986
|
+
const id = useId();
|
|
4987
|
+
const action = cancel ? state.entry.cancel : state.entry.action;
|
|
4988
|
+
if (!action) return null;
|
|
4989
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
4990
|
+
id,
|
|
4991
|
+
hidden: true,
|
|
4992
|
+
children: action.altText
|
|
4993
|
+
}), /* @__PURE__ */ jsx(Button$4, {
|
|
4994
|
+
...props,
|
|
4995
|
+
"aria-describedby": [props["aria-describedby"], id].filter(Boolean).join(" "),
|
|
4996
|
+
isDisabled: props.isDisabled || state.closing,
|
|
4997
|
+
className: typeof className === "function" ? (values) => partClass("toast__action", className(values)) : partClass("toast__action", className),
|
|
4998
|
+
onPress: (event) => {
|
|
4999
|
+
onPress?.(event);
|
|
5000
|
+
if (!state.closing) state.invoke(cancel);
|
|
5001
|
+
},
|
|
5002
|
+
children: children ?? action.label
|
|
5003
|
+
})] });
|
|
5004
|
+
}
|
|
5005
|
+
function ToastCloseButton({ className, children = "×", ...props }) {
|
|
5006
|
+
const state = useToastPresentation();
|
|
5007
|
+
return /* @__PURE__ */ jsx(Button$4, {
|
|
5008
|
+
...props,
|
|
5009
|
+
slot: "close",
|
|
5010
|
+
"aria-label": props["aria-label"] ?? state.closeLabel,
|
|
5011
|
+
isDisabled: props.isDisabled || state.closing,
|
|
5012
|
+
className: typeof className === "function" ? (values) => partClass("toast__close", className(values)) : partClass("toast__close", className),
|
|
5013
|
+
children
|
|
5014
|
+
});
|
|
5015
|
+
}
|
|
5016
|
+
function ToastProgress({ className, style, ...props }) {
|
|
5017
|
+
const { entry } = useToastPresentation();
|
|
5018
|
+
if (entry.duration <= 0 || entry.isLoading) return null;
|
|
5019
|
+
return /* @__PURE__ */ createElement("span", {
|
|
5020
|
+
...props,
|
|
5021
|
+
key: `${entry.generation}-${entry.remaining}-${entry.paused}`,
|
|
5022
|
+
className: partClass("toast__progress", className),
|
|
5023
|
+
"aria-hidden": "true",
|
|
5024
|
+
style: {
|
|
5025
|
+
...style,
|
|
5026
|
+
"--toast-progress": entry.remaining / entry.duration,
|
|
5027
|
+
"--toast-remaining": `${entry.remaining}ms`
|
|
5028
|
+
}
|
|
5029
|
+
});
|
|
5030
|
+
}
|
|
5031
|
+
function CompactToast(props) {
|
|
5032
|
+
return /* @__PURE__ */ jsx(ToastRenderer, { ...props });
|
|
5033
|
+
}
|
|
5034
|
+
var Toast = /* @__PURE__ */ Object.assign(CompactToast, {
|
|
5035
|
+
Root: ToastRoot,
|
|
5036
|
+
Provider: ToastProvider,
|
|
5037
|
+
Indicator: ToastIndicator,
|
|
5038
|
+
Content: ToastBody,
|
|
5039
|
+
Title: ToastTitle,
|
|
5040
|
+
Description: ToastDescription,
|
|
5041
|
+
Actions: ToastActions,
|
|
5042
|
+
ActionButton: ToastActionButton,
|
|
5043
|
+
CloseButton: ToastCloseButton,
|
|
5044
|
+
Progress: ToastProgress
|
|
5045
|
+
});
|
|
3221
5046
|
function Indicator({ entry }) {
|
|
3222
5047
|
return /* @__PURE__ */ jsx("svg", {
|
|
3223
5048
|
viewBox: "0 0 24 24",
|
|
@@ -3239,7 +5064,7 @@ function Indicator({ entry }) {
|
|
|
3239
5064
|
}), /* @__PURE__ */ jsx("path", { d: "M12 10v7m0-11v1" })] })
|
|
3240
5065
|
});
|
|
3241
5066
|
}
|
|
3242
|
-
function
|
|
5067
|
+
function ToastRenderer({ composed = false, style, classNames, entry, indicator, children, className, showCloseButton: closeOverride, showProgress: progressOverride }) {
|
|
3243
5068
|
const actionDescriptionId = useId();
|
|
3244
5069
|
const cancelDescriptionId = useId();
|
|
3245
5070
|
const context = useContext(ToastContext);
|
|
@@ -3332,109 +5157,121 @@ function Toast({ entry, indicator, children, className, showCloseButton: closeOv
|
|
|
3332
5157
|
if (active) manager.resume("swipe");
|
|
3333
5158
|
}
|
|
3334
5159
|
}, [manager]);
|
|
3335
|
-
return /* @__PURE__ */
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
"data-has-close": showCloseButton || void 0,
|
|
3345
|
-
"data-loading": entry.isLoading || void 0,
|
|
3346
|
-
"data-state": entry.state,
|
|
3347
|
-
"data-placement": placement,
|
|
3348
|
-
"data-paused": entry.paused || void 0,
|
|
3349
|
-
"data-swipe": swipe,
|
|
3350
|
-
inert: closing || void 0,
|
|
3351
|
-
"aria-hidden": closing || void 0,
|
|
3352
|
-
style: {
|
|
3353
|
-
"--toast-swipe-x": `${offset}px`,
|
|
3354
|
-
touchAction: "pan-y"
|
|
5160
|
+
return /* @__PURE__ */ jsx(ToastPresentationContext.Provider, {
|
|
5161
|
+
value: {
|
|
5162
|
+
entry,
|
|
5163
|
+
closing,
|
|
5164
|
+
closeLabel,
|
|
5165
|
+
invoke: (cancel) => {
|
|
5166
|
+
const item = cancel ? entry.cancel : entry.action;
|
|
5167
|
+
if (item) action(item, cancel ? "cancel" : "action");
|
|
5168
|
+
}
|
|
3355
5169
|
},
|
|
3356
|
-
children:
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
5170
|
+
children: /* @__PURE__ */ jsx(UNSTABLE_Toast, {
|
|
5171
|
+
toast: {
|
|
5172
|
+
key: entry.id,
|
|
5173
|
+
content: entry
|
|
5174
|
+
},
|
|
5175
|
+
ref,
|
|
5176
|
+
className: partClass(partClass("toast", classNames?.root), className),
|
|
5177
|
+
"data-toast-id": entry.id,
|
|
5178
|
+
"data-tone": entry.tone,
|
|
5179
|
+
"data-has-close": showCloseButton || void 0,
|
|
5180
|
+
"data-loading": entry.isLoading || void 0,
|
|
5181
|
+
"data-state": entry.state,
|
|
5182
|
+
"data-placement": placement,
|
|
5183
|
+
"data-paused": entry.paused || void 0,
|
|
5184
|
+
"data-swipe": swipe,
|
|
5185
|
+
inert: closing || void 0,
|
|
5186
|
+
"aria-hidden": closing || void 0,
|
|
5187
|
+
style: {
|
|
5188
|
+
...style,
|
|
5189
|
+
"--toast-swipe-x": `${offset}px`,
|
|
5190
|
+
touchAction: "pan-y"
|
|
5191
|
+
},
|
|
5192
|
+
children: composed ? children : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5193
|
+
/* @__PURE__ */ jsx("span", {
|
|
5194
|
+
className: partClass("toast__indicator", classNames?.indicator),
|
|
5195
|
+
"aria-hidden": "true",
|
|
5196
|
+
children: indicator ?? /* @__PURE__ */ jsx(Indicator, { entry })
|
|
5197
|
+
}),
|
|
5198
|
+
/* @__PURE__ */ jsxs(UNSTABLE_ToastContent, {
|
|
5199
|
+
className: partClass("toast__body", classNames?.body),
|
|
5200
|
+
role: "status",
|
|
5201
|
+
"aria-live": "polite",
|
|
5202
|
+
children: [
|
|
5203
|
+
/* @__PURE__ */ jsx(Text$4, {
|
|
5204
|
+
slot: "title",
|
|
5205
|
+
className: partClass("toast__title", classNames?.title),
|
|
5206
|
+
children: entry.title
|
|
5207
|
+
}),
|
|
5208
|
+
entry.description && /* @__PURE__ */ jsx(Text$4, {
|
|
5209
|
+
slot: "description",
|
|
5210
|
+
className: partClass("toast__description", classNames?.description),
|
|
5211
|
+
children: entry.description
|
|
5212
|
+
}),
|
|
5213
|
+
children,
|
|
5214
|
+
(entry.action || entry.cancel) && /* @__PURE__ */ jsxs("div", {
|
|
5215
|
+
className: partClass("toast__actions", classNames?.actions),
|
|
5216
|
+
children: [
|
|
5217
|
+
entry.action && /* @__PURE__ */ jsx("span", {
|
|
5218
|
+
id: actionDescriptionId,
|
|
5219
|
+
hidden: true,
|
|
5220
|
+
children: entry.action.altText
|
|
5221
|
+
}),
|
|
5222
|
+
entry.cancel && /* @__PURE__ */ jsx("span", {
|
|
5223
|
+
id: cancelDescriptionId,
|
|
5224
|
+
hidden: true,
|
|
5225
|
+
children: entry.cancel.altText
|
|
5226
|
+
}),
|
|
5227
|
+
entry.action && /* @__PURE__ */ jsx(Button$4, {
|
|
5228
|
+
className: partClass("toast__action", classNames?.action),
|
|
5229
|
+
"aria-describedby": actionDescriptionId,
|
|
5230
|
+
isDisabled: closing,
|
|
5231
|
+
onPress: () => action(entry.action, "action"),
|
|
5232
|
+
children: entry.action.label
|
|
5233
|
+
}),
|
|
5234
|
+
entry.cancel && /* @__PURE__ */ jsx(Button$4, {
|
|
5235
|
+
className: partClass("toast__action", classNames?.action),
|
|
5236
|
+
"data-cancel": true,
|
|
5237
|
+
"aria-describedby": cancelDescriptionId,
|
|
5238
|
+
isDisabled: closing,
|
|
5239
|
+
onPress: () => action(entry.cancel, "cancel"),
|
|
5240
|
+
children: entry.cancel.label
|
|
5241
|
+
})
|
|
5242
|
+
]
|
|
5243
|
+
})
|
|
5244
|
+
]
|
|
5245
|
+
}),
|
|
5246
|
+
showCloseButton && /* @__PURE__ */ jsx(Button$4, {
|
|
5247
|
+
slot: "close",
|
|
5248
|
+
className: partClass("toast__close", classNames?.close),
|
|
5249
|
+
"aria-label": closeLabel,
|
|
5250
|
+
isDisabled: closing,
|
|
5251
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
5252
|
+
viewBox: "0 0 24 24",
|
|
5253
|
+
width: "16",
|
|
5254
|
+
height: "16",
|
|
5255
|
+
fill: "none",
|
|
5256
|
+
stroke: "currentColor",
|
|
5257
|
+
strokeWidth: "2",
|
|
5258
|
+
"aria-hidden": "true",
|
|
5259
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 6 12 12M6 18 18 6" })
|
|
3407
5260
|
})
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
slot: "close",
|
|
3412
|
-
className: "toast__close",
|
|
3413
|
-
"aria-label": closeLabel,
|
|
3414
|
-
isDisabled: closing,
|
|
3415
|
-
children: /* @__PURE__ */ jsx("svg", {
|
|
3416
|
-
viewBox: "0 0 24 24",
|
|
3417
|
-
width: "16",
|
|
3418
|
-
height: "16",
|
|
3419
|
-
fill: "none",
|
|
3420
|
-
stroke: "currentColor",
|
|
3421
|
-
strokeWidth: "2",
|
|
5261
|
+
}),
|
|
5262
|
+
showProgress && entry.duration > 0 && !entry.isLoading && /* @__PURE__ */ jsx("span", {
|
|
5263
|
+
className: partClass("toast__progress", classNames?.progress),
|
|
3422
5264
|
"aria-hidden": "true",
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
"--toast-progress": entry.remaining / entry.duration,
|
|
3431
|
-
"--toast-remaining": `${entry.remaining}ms`
|
|
3432
|
-
}
|
|
3433
|
-
}, `${entry.generation}-${entry.remaining}-${entry.paused}`)
|
|
3434
|
-
]
|
|
5265
|
+
style: {
|
|
5266
|
+
"--toast-progress": entry.remaining / entry.duration,
|
|
5267
|
+
"--toast-remaining": `${entry.remaining}ms`
|
|
5268
|
+
}
|
|
5269
|
+
}, `${entry.generation}-${entry.remaining}-${entry.paused}`)
|
|
5270
|
+
] })
|
|
5271
|
+
})
|
|
3435
5272
|
});
|
|
3436
5273
|
}
|
|
3437
5274
|
//#endregion
|
|
3438
|
-
export { Alert, Badge, Breadcrumb, Button, ButtonGroup, ButtonGroupSeparator, Card, Chart, Checkbox, Combobox, DataTable, DateRangePicker, Dialog, DropdownMenu, Empty, Field, Form, Input, Label, Listbox, NumberField, Pagination, Popover, RadioGroup, Select, SelectGroup, Separator, Sidebar, Skeleton, Spinner, Switch, Table, Tabs, Textarea, Toast, ToastProvider, ToggleButton, ToggleButtonGroup, ToggleGroup, Tooltip, createDateRangePresets, createToastManager, rangeText as formatDateRange, useToast };
|
|
5275
|
+
export { Alert, AlertActions, AlertContent, AlertDescription, AlertIndicator, AlertTitle, Badge, Breadcrumb, BreadcrumbCurrent, BreadcrumbItemPart, BreadcrumbLink, BreadcrumbList, BreadcrumbRoot, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, Card, CardActions, CardContent, CardDescription, CardFooter, CardHeader, CardHeading, CardRoot, CardTitle, CardTitleRow, Chart, ChartDescription, ChartPlot, ChartRoot, ChartTitle, Checkbox, Combobox, DataTable, DataTableColumn as DataTableColumnPart, DataTableEmpty, DataTableError, DataTableRoot, DataTableSortButton, DataTableStatus, DateRangePicker, Description, Dialog, DialogBackdrop as DialogBackdropPart, DialogCloseButton, DialogContent, DialogPanel, DialogRoot, DialogTriggerPart, DropdownHeading, DropdownItem, DropdownItemIndicator, DropdownList, DropdownMenu, DropdownPopover, DropdownRoot, DropdownSection, DropdownSeparator, DropdownSubmenuIndicator, DropdownSubmenuTrigger, DropdownTrigger, Empty, EmptyActions, EmptyDescription, EmptyRoot, EmptyTitle, Field, FieldError, Form, Header, Input, Label, ListBox, Listbox, NumberField, OverlayBody, OverlayDescription, OverlayFooter, OverlayHeader, OverlayHeading, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPageButton, PaginationPrevious, PaginationRoot, PaginationSummary, Popover, PopoverCloseButton, PopoverContent, PopoverDialog, PopoverTrigger, RadioGroup, Select, SelectGroup, Separator, Sidebar, SidebarHeader, SidebarItem, SidebarLink, SidebarList, SidebarNavigation, SidebarRoot, SidebarTitle, SidebarToggle, Skeleton, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableColumn, TableFooter, TableHeader, TableRoot, TableRow, TableScrollContainer, Tabs, TabsIndicator, TabsList, TabsListContainer, TabsPanel, TabsRoot, TabsSeparator, TabsTab, Textarea, Toast, ToastActionButton, ToastActions, ToastBody, ToastCloseButton, ToastDescription, ToastIndicator, ToastProgress, ToastProvider, ToastRoot, ToastTitle, ToggleButton, ToggleButtonGroup, ToggleGroup, Tooltip, TooltipContent, TooltipRoot, TooltipTriggerPart, createDateRangePresets, createToastManager, rangeText as formatDateRange, useToast };
|
|
3439
5276
|
|
|
3440
5277
|
//# sourceMappingURL=index.js.map
|