@rinzai/zen 0.11.0 → 0.14.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 +37 -7
- package/dist/accordion/index.d.ts +41 -0
- package/dist/accordion/index.d.ts.map +1 -0
- package/dist/accordion/index.js +81 -0
- package/dist/animated-number/index.d.ts +3 -2
- package/dist/animated-number/index.d.ts.map +1 -1
- package/dist/animated-number/index.js +40 -38
- package/dist/avatar/index.d.ts +7 -2
- package/dist/avatar/index.d.ts.map +1 -1
- package/dist/avatar/index.js +17 -11
- package/dist/backdrop/index.d.ts +4 -4
- package/dist/backdrop/index.d.ts.map +1 -1
- package/dist/backdrop/index.js +41 -39
- package/dist/badge/index.d.ts +4 -2
- package/dist/badge/index.d.ts.map +1 -1
- package/dist/badge/index.js +20 -11
- package/dist/base.css +4 -0
- package/dist/breadcrumbs/index.d.ts +1 -1
- package/dist/breadcrumbs/index.d.ts.map +1 -1
- package/dist/breadcrumbs/index.js +25 -24
- package/dist/button/index.d.ts +3 -3
- package/dist/button/index.d.ts.map +1 -1
- package/dist/button/index.js +16 -11
- package/dist/button-group/index.d.ts +13 -0
- package/dist/button-group/index.d.ts.map +1 -0
- package/dist/button-group/index.js +14 -0
- package/dist/calendar/index.d.ts +15 -8
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +97 -91
- package/dist/calendar-heatmap/index.d.ts +7 -5
- package/dist/calendar-heatmap/index.d.ts.map +1 -1
- package/dist/calendar-heatmap/index.js +32 -30
- package/dist/canvas/geometry.js +0 -1
- package/dist/canvas/index.d.ts +6 -6
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js +135 -133
- package/dist/carousel/index.d.ts +27 -0
- package/dist/carousel/index.d.ts.map +1 -0
- package/dist/carousel/index.js +162 -0
- package/dist/chart/index.d.ts +5 -4
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.js +137 -135
- package/dist/chart/palette.js +0 -1
- package/dist/checkbox/index.d.ts +3 -3
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +33 -30
- package/dist/chip/index.js +1 -1
- package/dist/code-block/index.d.ts.map +1 -1
- package/dist/code-block/index.js +27 -25
- package/dist/code-input/index.d.ts.map +1 -1
- package/dist/code-input/index.js +30 -24
- package/dist/collapse/index.d.ts +4 -3
- package/dist/collapse/index.d.ts.map +1 -1
- package/dist/collapse/index.js +42 -39
- package/dist/color-picker/index.d.ts +14 -7
- package/dist/color-picker/index.d.ts.map +1 -1
- package/dist/color-picker/index.js +139 -128
- package/dist/combobox/index.d.ts +14 -6
- package/dist/combobox/index.d.ts.map +1 -1
- package/dist/combobox/index.js +158 -146
- package/dist/command-palette/index.d.ts +4 -3
- package/dist/command-palette/index.d.ts.map +1 -1
- package/dist/command-palette/index.js +60 -57
- package/dist/confirm-dialog/index.d.ts +6 -7
- package/dist/confirm-dialog/index.d.ts.map +1 -1
- package/dist/confirm-dialog/index.js +20 -16
- package/dist/date-picker/index.d.ts +23 -14
- package/dist/date-picker/index.d.ts.map +1 -1
- package/dist/date-picker/index.js +109 -93
- package/dist/dialog/index.d.ts +3 -4
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +58 -55
- package/dist/disclosure/index.d.ts +8 -0
- package/dist/disclosure/index.d.ts.map +1 -1
- package/dist/disclosure/index.js +31 -32
- package/dist/editable-cell/index.d.ts +4 -5
- package/dist/editable-cell/index.d.ts.map +1 -1
- package/dist/editable-cell/index.js +23 -22
- package/dist/field/index.d.ts +8 -8
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +20 -18
- package/dist/filter-bar/index.d.ts +2 -2
- package/dist/filter-bar/index.d.ts.map +1 -1
- package/dist/filter-bar/index.js +38 -36
- package/dist/header/index.d.ts +1 -1
- package/dist/header/index.d.ts.map +1 -1
- package/dist/header/index.js +13 -11
- package/dist/hover-card/index.d.ts +32 -0
- package/dist/hover-card/index.d.ts.map +1 -0
- package/dist/hover-card/index.js +84 -0
- package/dist/icon-picker/index.d.ts +16 -5
- package/dist/icon-picker/index.d.ts.map +1 -1
- package/dist/icon-picker/index.js +42 -47
- package/dist/icons/micro/plus.d.ts +3 -0
- package/dist/icons/micro/plus.d.ts.map +1 -0
- package/dist/icons/micro/plus.js +17 -0
- package/dist/index.d.ts +37 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/input/index.d.ts +5 -1
- package/dist/input/index.d.ts.map +1 -1
- package/dist/input/index.js +9 -9
- package/dist/input-group/index.d.ts +4 -1
- package/dist/input-group/index.d.ts.map +1 -1
- package/dist/input-group/index.js +14 -14
- package/dist/keypad/index.d.ts +9 -7
- package/dist/keypad/index.d.ts.map +1 -1
- package/dist/keypad/index.js +22 -19
- package/dist/lib.js +112 -97
- package/dist/load-more/index.d.ts +4 -2
- package/dist/load-more/index.d.ts.map +1 -1
- package/dist/load-more/index.js +26 -23
- package/dist/locale-provider/index.d.ts +23 -0
- package/dist/locale-provider/index.d.ts.map +1 -0
- package/dist/locale-provider/index.js +35 -0
- package/dist/menu/index.d.ts +62 -9
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +371 -128
- package/dist/meter/index.d.ts +2 -2
- package/dist/meter/index.d.ts.map +1 -1
- package/dist/meter/index.js +4 -4
- package/dist/money-input/index.d.ts +20 -10
- package/dist/money-input/index.d.ts.map +1 -1
- package/dist/money-input/index.js +199 -190
- package/dist/month-picker/index.d.ts +17 -10
- package/dist/month-picker/index.d.ts.map +1 -1
- package/dist/month-picker/index.js +97 -86
- package/dist/navigation-menu/index.d.ts +42 -0
- package/dist/navigation-menu/index.d.ts.map +1 -0
- package/dist/navigation-menu/index.js +144 -0
- package/dist/number-field/index.d.ts +50 -0
- package/dist/number-field/index.d.ts.map +1 -0
- package/dist/number-field/index.js +133 -0
- package/dist/page-header/index.d.ts +4 -3
- package/dist/page-header/index.d.ts.map +1 -1
- package/dist/page-header/index.js +2 -1
- package/dist/pagination/index.d.ts +1 -1
- package/dist/pagination/index.d.ts.map +1 -1
- package/dist/pagination/index.js +35 -33
- package/dist/progress-ring/index.d.ts +4 -3
- package/dist/progress-ring/index.d.ts.map +1 -1
- package/dist/progress-ring/index.js +11 -10
- package/dist/radio-cards/index.d.ts +9 -5
- package/dist/radio-cards/index.d.ts.map +1 -1
- package/dist/radio-cards/index.js +26 -24
- package/dist/radio-group/index.d.ts +9 -8
- package/dist/radio-group/index.d.ts.map +1 -1
- package/dist/radio-group/index.js +35 -34
- package/dist/range-slider/index.d.ts +10 -4
- package/dist/range-slider/index.d.ts.map +1 -1
- package/dist/range-slider/index.js +43 -31
- package/dist/repeat-picker/index.d.ts +13 -6
- package/dist/repeat-picker/index.d.ts.map +1 -1
- package/dist/repeat-picker/index.js +73 -61
- package/dist/resizable/index.d.ts +29 -0
- package/dist/resizable/index.d.ts.map +1 -0
- package/dist/resizable/index.js +135 -0
- package/dist/segmented/index.d.ts +8 -5
- package/dist/segmented/index.d.ts.map +1 -1
- package/dist/segmented/index.js +36 -34
- package/dist/select/index.d.ts +9 -3
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +99 -96
- package/dist/separator/index.d.ts +14 -0
- package/dist/separator/index.d.ts.map +1 -0
- package/dist/separator/index.js +15 -0
- package/dist/side-nav/index.js +1 -1
- package/dist/skeleton/index.d.ts +4 -4
- package/dist/skeleton/index.d.ts.map +1 -1
- package/dist/skeleton/index.js +4 -3
- package/dist/slider/index.d.ts +6 -3
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +29 -23
- package/dist/sortable/index.d.ts +10 -20
- package/dist/sortable/index.d.ts.map +1 -1
- package/dist/sortable/index.js +72 -134
- package/dist/sortable/shared.d.ts +56 -0
- package/dist/sortable/shared.d.ts.map +1 -0
- package/dist/sortable/shared.js +104 -0
- package/dist/sortable/tree-model.d.ts +46 -0
- package/dist/sortable/tree-model.d.ts.map +1 -0
- package/dist/sortable/tree-model.js +87 -0
- package/dist/sortable/tree.d.ts +31 -0
- package/dist/sortable/tree.d.ts.map +1 -0
- package/dist/sortable/tree.js +150 -0
- package/dist/sparkline/index.d.ts +1 -1
- package/dist/sparkline/index.d.ts.map +1 -1
- package/dist/sparkline/index.js +26 -25
- package/dist/spinner/index.d.ts +4 -3
- package/dist/spinner/index.d.ts.map +1 -1
- package/dist/spinner/index.js +2 -1
- package/dist/status-pill/index.d.ts.map +1 -1
- package/dist/status-pill/index.js +1 -1
- package/dist/stepper/index.d.ts +1 -1
- package/dist/stepper/index.d.ts.map +1 -1
- package/dist/stepper/index.js +31 -30
- package/dist/tab-bar/index.js +1 -1
- package/dist/table/index.d.ts +5 -5
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +66 -64
- package/dist/table/selection.d.ts +2 -2
- package/dist/table/selection.d.ts.map +1 -1
- package/dist/table/selection.js +41 -38
- package/dist/table/swipe.d.ts +1 -1
- package/dist/table/swipe.d.ts.map +1 -1
- package/dist/table/swipe.js +1 -1
- package/dist/table-of-contents/index.d.ts +4 -2
- package/dist/table-of-contents/index.d.ts.map +1 -1
- package/dist/table-of-contents/index.js +27 -25
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +90 -88
- package/dist/tag-input/index.d.ts +3 -1
- package/dist/tag-input/index.d.ts.map +1 -1
- package/dist/tag-input/index.js +61 -52
- package/dist/theme-toggle/index.d.ts +9 -8
- package/dist/theme-toggle/index.d.ts.map +1 -1
- package/dist/theme-toggle/index.js +30 -28
- package/dist/theme.css +90 -12
- package/dist/time-field/index.d.ts +31 -0
- package/dist/time-field/index.d.ts.map +1 -0
- package/dist/time-field/index.js +175 -0
- package/dist/timeline/index.js +1 -1
- package/dist/toast/index.d.ts +1 -1
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +127 -125
- package/dist/toggle/index.d.ts +2 -2
- package/dist/toggle/index.d.ts.map +1 -1
- package/dist/toggle/index.js +8 -6
- package/dist/toggle-group/index.d.ts +35 -0
- package/dist/toggle-group/index.d.ts.map +1 -0
- package/dist/toggle-group/index.js +53 -0
- package/dist/toolbar/index.d.ts +19 -0
- package/dist/toolbar/index.d.ts.map +1 -0
- package/dist/toolbar/index.js +36 -0
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +40 -74
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +105 -102
- package/dist/trend/index.d.ts +2 -2
- package/dist/trend/index.d.ts.map +1 -1
- package/dist/trend/index.js +20 -19
- package/dist/utils/color.js +0 -1
- package/dist/utils/cva.js +0 -1
- package/dist/utils/cx.js +0 -1
- package/dist/utils/date.d.ts +6 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +1 -2
- package/dist/utils/direction.d.ts +7 -0
- package/dist/utils/direction.d.ts.map +1 -0
- package/dist/utils/direction.js +6 -0
- package/dist/utils/form-value.d.ts +15 -0
- package/dist/utils/form-value.d.ts.map +1 -0
- package/dist/utils/form-value.js +29 -0
- package/dist/utils/fx.js +0 -1
- package/dist/utils/merge.js +0 -1
- package/dist/utils/messages.d.ts +137 -0
- package/dist/utils/messages.d.ts.map +1 -0
- package/dist/utils/messages.js +133 -0
- package/dist/utils/money.js +0 -1
- package/dist/utils/month.js +0 -1
- package/dist/utils/motion.js +0 -1
- package/dist/utils/refs.d.ts +6 -0
- package/dist/utils/refs.d.ts.map +1 -0
- package/dist/utils/refs.js +13 -0
- package/dist/utils/repeat.d.ts +3 -1
- package/dist/utils/repeat.d.ts.map +1 -1
- package/dist/utils/repeat.js +28 -25
- package/dist/utils/roving.d.ts +17 -0
- package/dist/utils/roving.d.ts.map +1 -0
- package/dist/utils/roving.js +35 -0
- package/dist/utils/section-link.js +0 -1
- package/dist/utils/slot.d.ts.map +1 -1
- package/dist/utils/slot.js +7 -11
- package/dist/utils/status-icons.js +7 -7
- package/dist/utils/styles.d.ts +9 -2
- package/dist/utils/styles.d.ts.map +1 -1
- package/dist/utils/styles.js +6 -3
- package/dist/utils/theme-wave.js +0 -1
- package/dist/utils/theme.js +0 -1
- package/dist/utils/useAnchoredPopup.d.ts +7 -4
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +18 -11
- package/dist/utils/useControllable.d.ts +9 -0
- package/dist/utils/useControllable.d.ts.map +1 -0
- package/dist/utils/useControllable.js +15 -0
- package/dist/utils/useHoverPopup.d.ts +39 -0
- package/dist/utils/useHoverPopup.d.ts.map +1 -0
- package/dist/utils/useHoverPopup.js +64 -0
- package/dist/zen.css +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DialogProps } from '../dialog';
|
|
2
2
|
/** Confirmation for destructive or irreversible actions. Cancel has focus, so Enter is the safe choice. */
|
|
3
|
-
export default function ConfirmDialog({ open, onOpenChange, title, description, confirmLabel, cancelLabel,
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export default function ConfirmDialog({ open, onOpenChange, title, description, confirmLabel, cancelLabel: cancelLabelProp, tone, onConfirm, className, ...rest }: ConfirmDialogProps): import('react').JSX.Element;
|
|
4
|
+
/** Other props (data-*, an id) go on the <dialog>. */
|
|
5
|
+
export interface ConfirmDialogProps extends Omit<DialogProps, 'children' | 'role' | 'onOpenChange'> {
|
|
6
6
|
onOpenChange: (open: boolean) => void;
|
|
7
|
-
title: ReactNode;
|
|
8
|
-
description?: ReactNode;
|
|
9
7
|
confirmLabel: string;
|
|
10
8
|
cancelLabel?: string;
|
|
11
|
-
destructive
|
|
9
|
+
/** `negative` for a destructive action: the confirm button is red. */
|
|
10
|
+
tone?: 'default' | 'negative';
|
|
12
11
|
onConfirm: () => void;
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/confirm-dialog/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/confirm-dialog/index.tsx"],"names":[],"mappings":"AAEA,OAAe,EAA6B,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAElF,2GAA2G;AAC3G,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAClC,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EAAE,eAAe,EAC5B,IAAgB,EAChB,SAAS,EACT,SAAS,EACT,GAAG,IAAI,EACV,EAAE,kBAAkB,+BAuBpB;AAED,sDAAsD;AACtD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,MAAM,GAAG,cAAc,CAAC;IAC/F,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { cx as e } from "../utils/cx.js";
|
|
3
|
+
import { useMessages as t } from "../locale-provider/index.js";
|
|
4
|
+
import n, { DialogClose as r, DialogFooter as i } from "../dialog/index.js";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
6
|
//#region packages/confirm-dialog/index.tsx
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
+
function s({ open: s, onOpenChange: c, title: l, description: u, confirmLabel: d, cancelLabel: f, tone: p = "default", onConfirm: m, className: h, ...g }) {
|
|
8
|
+
let _ = t(), v = f ?? _.cancel;
|
|
9
|
+
return /* @__PURE__ */ a(n, {
|
|
10
|
+
...g,
|
|
7
11
|
role: "alertdialog",
|
|
8
|
-
open:
|
|
9
|
-
onOpenChange:
|
|
10
|
-
title:
|
|
11
|
-
description:
|
|
12
|
-
className: "w-[26rem]",
|
|
13
|
-
children: /* @__PURE__ */ i
|
|
12
|
+
open: s,
|
|
13
|
+
onOpenChange: c,
|
|
14
|
+
title: l,
|
|
15
|
+
description: u,
|
|
16
|
+
className: e("w-[26rem]", h),
|
|
17
|
+
children: /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(r, {
|
|
14
18
|
variant: "outline",
|
|
15
19
|
autoFocus: !0,
|
|
16
|
-
children:
|
|
17
|
-
}), /* @__PURE__ */ r
|
|
18
|
-
|
|
19
|
-
onClick:
|
|
20
|
-
children:
|
|
20
|
+
children: v
|
|
21
|
+
}), /* @__PURE__ */ a(r, {
|
|
22
|
+
tone: p,
|
|
23
|
+
onClick: m,
|
|
24
|
+
children: d
|
|
21
25
|
})] })
|
|
22
26
|
});
|
|
23
27
|
}
|
|
24
28
|
//#endregion
|
|
25
|
-
export {
|
|
29
|
+
export { s as default };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DateRange, DateString } from '../utils/date';
|
|
2
|
+
import { FieldSize } from '../utils/styles';
|
|
2
3
|
import { ComponentProps } from 'react';
|
|
3
4
|
/**
|
|
4
5
|
* Date field: shows the date ("Sep 30, 2026" for the locale) and opens a
|
|
5
6
|
* Calendar to pick one, focused on the chosen date so the keyboard works at
|
|
6
|
-
* once. Dates are "YYYY-MM-DD" strings.
|
|
7
|
-
* `clearLabel` to empty it.
|
|
7
|
+
* once. Dates are "YYYY-MM-DD" strings. When `clearable`, the popup also offers
|
|
8
|
+
* `clearLabel` to empty it. With `name`, it's submitted with a form.
|
|
8
9
|
*/
|
|
9
|
-
export default function DatePicker({ value,
|
|
10
|
+
export default function DatePicker({ value: valueProp, defaultValue, onValueChange, locale: localeProp, min, max, isDisabled, weekStartsOn, placeholder: placeholderProp, clearable, clearLabel: clearLabelProp, ...rest }: DatePickerProps): import('react').JSX.Element;
|
|
10
11
|
/**
|
|
11
12
|
* Date range field: pick a start and then an end in a Calendar (the days
|
|
12
13
|
* between are previewed while pointing); it closes once the range is complete.
|
|
@@ -14,10 +15,10 @@ export default function DatePicker({ value, onChange, locale, min, max, isDisabl
|
|
|
14
15
|
* common ranges ("Last 30 days") sit beside the calendar, one tap each (see
|
|
15
16
|
* commonRanges).
|
|
16
17
|
*/
|
|
17
|
-
export declare function DateRangePicker({ value,
|
|
18
|
+
export declare function DateRangePicker({ value: valueProp, defaultValue, onValueChange, locale: localeProp, min, max, isDisabled, weekStartsOn, months, placeholder: placeholderProp, clearable, clearLabel: clearLabelProp, presets, ...rest }: DateRangePickerProps): import('react').JSX.Element;
|
|
18
19
|
interface PickerProps extends Omit<ComponentProps<'button'>, 'value' | 'onChange' | 'defaultValue'> {
|
|
19
|
-
/** Decides the date format, month and weekday names, and the first day of the week, e.g. "en-IN". */
|
|
20
|
-
locale
|
|
20
|
+
/** Decides the date format, month and weekday names, and the first day of the week, e.g. "en-IN". Defaults to the LocaleProvider's. */
|
|
21
|
+
locale?: string;
|
|
21
22
|
/** Earliest date that can be picked ("YYYY-MM-DD"). */
|
|
22
23
|
min?: DateString;
|
|
23
24
|
/** Latest date that can be picked. */
|
|
@@ -28,21 +29,29 @@ interface PickerProps extends Omit<ComponentProps<'button'>, 'value' | 'onChange
|
|
|
28
29
|
weekStartsOn?: number;
|
|
29
30
|
/** Classes for the trigger (e.g. a width, instead of the default full width). */
|
|
30
31
|
className?: string;
|
|
32
|
+
/** Height, matching Button's: sm (32px), default (40px) or lg (44px). */
|
|
33
|
+
size?: FieldSize;
|
|
31
34
|
placeholder?: string;
|
|
32
|
-
/** Offers a clear option in the popup (shown when a value is set). */
|
|
33
|
-
|
|
35
|
+
/** Offers a clear option in the popup (shown when a value is set); clearing reports null. */
|
|
36
|
+
clearable?: boolean;
|
|
34
37
|
clearLabel?: string;
|
|
38
|
+
/** Form field name: the value is submitted with the form ("YYYY-MM-DD", a range as "start/end"). */
|
|
39
|
+
name?: string;
|
|
35
40
|
}
|
|
36
41
|
/** Also takes the trigger button's props (aria-*, data-*, onBlur…), so Field can wire it up. */
|
|
37
42
|
export interface DatePickerProps extends PickerProps {
|
|
38
|
-
/** "YYYY-MM-DD", or null for none. */
|
|
39
|
-
value
|
|
40
|
-
|
|
43
|
+
/** "YYYY-MM-DD", or null for none, when you keep it. */
|
|
44
|
+
value?: DateString | null;
|
|
45
|
+
/** The first date, when the picker keeps its own. */
|
|
46
|
+
defaultValue?: DateString | null;
|
|
47
|
+
onValueChange?: (date: DateString | null) => void;
|
|
41
48
|
}
|
|
42
49
|
export interface DateRangePickerProps extends PickerProps {
|
|
43
|
-
/** The range; `end` is null while only the start is picked. */
|
|
44
|
-
value
|
|
45
|
-
|
|
50
|
+
/** The range when you keep it; `end` is null while only the start is picked. */
|
|
51
|
+
value?: DateRange | null;
|
|
52
|
+
/** The first range, when the picker keeps its own. */
|
|
53
|
+
defaultValue?: DateRange | null;
|
|
54
|
+
onValueChange?: (range: DateRange | null) => void;
|
|
46
55
|
/** Months shown side by side (2 suits wide screens). */
|
|
47
56
|
months?: number;
|
|
48
57
|
/** Ranges picked in one tap, beside the calendar. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/date-picker/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/date-picker/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAA+B,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAc,KAAK,SAAS,EAA6C,MAAM,mBAAmB,CAAC;AAG1G,OAAO,EAAE,cAAc,EAAa,MAAM,OAAO,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAC/B,KAAK,EAAE,SAAS,EAChB,YAAmB,EACnB,aAAa,EACb,MAAM,EAAE,UAAU,EAClB,GAAG,EACH,GAAG,EACH,UAAU,EACV,YAAY,EACZ,WAAW,EAAE,eAAe,EAC5B,SAAiB,EACjB,UAAU,EAAE,cAAc,EAC1B,GAAG,IAAI,EACV,EAAE,eAAe,+BA6BjB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC5B,KAAK,EAAE,SAAS,EAChB,YAAmB,EACnB,aAAa,EACb,MAAM,EAAE,UAAU,EAClB,GAAG,EACH,GAAG,EACH,UAAU,EACV,YAAY,EACZ,MAAU,EACV,WAAW,EAAE,eAAe,EAC5B,SAAiB,EACjB,UAAU,EAAE,cAAc,EAC1B,OAAO,EACP,GAAG,IAAI,EACV,EAAE,oBAAoB,+BAkEtB;AAkFD,UAAU,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IAC/F,uIAAuI;IACvI,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,sCAAsC;IACtC,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,gEAAgE;IAChE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;IAC3C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oGAAoG;IACpG,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,gGAAgG;AAChG,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAChD,wDAAwD;IACxD,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,qDAAqD;IACrD,YAAY,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACrD,gFAAgF;IAChF,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,sDAAsD;IACtD,YAAY,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;CACpB"}
|
|
@@ -1,120 +1,136 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import s from "../
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
3
|
+
import { useControllable as t } from "../utils/useControllable.js";
|
|
4
|
+
import { useAnchoredPopup as n } from "../utils/useAnchoredPopup.js";
|
|
5
|
+
import { useLocale as r, useMessages as i } from "../locale-provider/index.js";
|
|
6
|
+
import { useFieldProps as a } from "../field/index.js";
|
|
7
|
+
import { FIELD_SIZE as o, POPUP as s, TRIGGER as c } from "../utils/styles.js";
|
|
8
|
+
import { FormValue as l } from "../utils/form-value.js";
|
|
9
|
+
import { formatDate as u, formatDateRange as d } from "../utils/date.js";
|
|
10
|
+
import f from "../calendar/index.js";
|
|
11
|
+
import p from "../icons/micro/calendar.js";
|
|
12
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
13
|
//#region packages/date-picker/index.tsx
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
function _({ value: e, defaultValue: n = null, onValueChange: a, locale: o, min: s, max: c, isDisabled: l, weekStartsOn: d, placeholder: p, clearable: m = !1, clearLabel: g, ..._ }) {
|
|
15
|
+
let v = i(), b = p ?? v.pickDate, x = g ?? v.clear, S = r(o), [C, w, T] = t(e, n, a);
|
|
16
|
+
return /* @__PURE__ */ h(y, {
|
|
17
|
+
..._,
|
|
18
|
+
shown: C ? u(C, S) : null,
|
|
19
|
+
formValue: C ?? "",
|
|
20
|
+
onReset: T,
|
|
21
|
+
placeholder: b,
|
|
22
|
+
label: v.chooseDate,
|
|
23
|
+
onClear: m && C ? () => w(null) : void 0,
|
|
24
|
+
clearLabel: x,
|
|
25
|
+
calendar: (e) => /* @__PURE__ */ h(f, {
|
|
20
26
|
autoFocus: !0,
|
|
21
|
-
value:
|
|
22
|
-
|
|
23
|
-
t
|
|
27
|
+
value: C,
|
|
28
|
+
onValueChange: (t) => {
|
|
29
|
+
w(t), e();
|
|
24
30
|
},
|
|
25
|
-
locale:
|
|
26
|
-
min:
|
|
27
|
-
max:
|
|
28
|
-
isDisabled:
|
|
29
|
-
weekStartsOn:
|
|
31
|
+
locale: S,
|
|
32
|
+
min: s,
|
|
33
|
+
max: c,
|
|
34
|
+
isDisabled: l,
|
|
35
|
+
weekStartsOn: d
|
|
30
36
|
})
|
|
31
37
|
});
|
|
32
38
|
}
|
|
33
|
-
function
|
|
34
|
-
let
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
...
|
|
37
|
-
shown:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
function v({ value: e, defaultValue: n = null, onValueChange: a, locale: o, min: s, max: c, isDisabled: l, weekStartsOn: p, months: m = 1, placeholder: _, clearable: v = !1, clearLabel: b, presets: x, ...S }) {
|
|
40
|
+
let C = i(), w = _ ?? C.pickDates, T = b ?? C.clear, E = r(o), [D, O, k] = t(e, n, a), A = D ? D.end ? d(D.start, D.end, E) : `${u(D.start, E)} – …` : null;
|
|
41
|
+
return /* @__PURE__ */ h(y, {
|
|
42
|
+
...S,
|
|
43
|
+
shown: A,
|
|
44
|
+
formValue: D ? `${D.start}/${D.end ?? ""}` : "",
|
|
45
|
+
onReset: k,
|
|
46
|
+
placeholder: w,
|
|
47
|
+
label: C.chooseDates,
|
|
48
|
+
onClear: v && D ? () => O(null) : void 0,
|
|
49
|
+
clearLabel: T,
|
|
50
|
+
calendar: (e) => {
|
|
51
|
+
let t = /* @__PURE__ */ h(f, {
|
|
44
52
|
autoFocus: !0,
|
|
45
53
|
mode: "range",
|
|
46
|
-
value:
|
|
47
|
-
|
|
48
|
-
t
|
|
54
|
+
value: D,
|
|
55
|
+
onValueChange: (t) => {
|
|
56
|
+
O(t), t.end && e();
|
|
49
57
|
},
|
|
50
|
-
locale:
|
|
51
|
-
min:
|
|
52
|
-
max:
|
|
53
|
-
isDisabled:
|
|
54
|
-
weekStartsOn:
|
|
55
|
-
months:
|
|
58
|
+
locale: E,
|
|
59
|
+
min: s,
|
|
60
|
+
max: c,
|
|
61
|
+
isDisabled: l,
|
|
62
|
+
weekStartsOn: p,
|
|
63
|
+
months: m
|
|
56
64
|
});
|
|
57
|
-
return
|
|
65
|
+
return x?.length ? /* @__PURE__ */ g("div", {
|
|
58
66
|
className: "flex flex-col gap-3 sm:flex-row",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
67
|
+
children: [/* @__PURE__ */ h("div", {
|
|
60
68
|
role: "group",
|
|
61
|
-
"aria-label":
|
|
69
|
+
"aria-label": C.presets,
|
|
62
70
|
className: "border-tint/[0.06] flex flex-wrap gap-1 sm:flex-col sm:flex-nowrap sm:border-e sm:pe-3",
|
|
63
|
-
children:
|
|
64
|
-
let
|
|
65
|
-
return /* @__PURE__ */
|
|
71
|
+
children: x.map((t) => {
|
|
72
|
+
let n = D?.start === t.range.start && D?.end === t.range.end;
|
|
73
|
+
return /* @__PURE__ */ h("button", {
|
|
66
74
|
type: "button",
|
|
67
|
-
"aria-pressed":
|
|
75
|
+
"aria-pressed": n,
|
|
68
76
|
onClick: () => {
|
|
69
|
-
t
|
|
77
|
+
O(t.range), e();
|
|
70
78
|
},
|
|
71
|
-
className: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground aria-pressed:bg-primary/12 aria-pressed:text-foreground focus-
|
|
72
|
-
children:
|
|
73
|
-
},
|
|
79
|
+
className: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground aria-pressed:bg-primary/12 aria-pressed:text-foreground focus-ring cursor-pointer rounded-lg px-2.5 py-1.5 text-start text-sm whitespace-nowrap outline-hidden",
|
|
80
|
+
children: t.label
|
|
81
|
+
}, t.label);
|
|
74
82
|
})
|
|
75
|
-
}),
|
|
76
|
-
}) :
|
|
83
|
+
}), t]
|
|
84
|
+
}) : t;
|
|
77
85
|
}
|
|
78
86
|
});
|
|
79
87
|
}
|
|
80
|
-
function
|
|
81
|
-
let
|
|
82
|
-
...
|
|
83
|
-
id:
|
|
84
|
-
}),
|
|
85
|
-
return /* @__PURE__ */
|
|
86
|
-
|
|
87
|
-
...y,
|
|
88
|
-
...x,
|
|
89
|
-
id: m,
|
|
90
|
-
disabled: _,
|
|
91
|
-
...b.triggerProps,
|
|
92
|
-
style: {
|
|
93
|
-
...b.triggerProps.style,
|
|
94
|
-
...v
|
|
95
|
-
},
|
|
96
|
-
className: e("zen__date-picker group", i, "w-full", b.open && "border-glow/60 [--glow-border-color:transparent] shadow-glow-focus", g),
|
|
97
|
-
children: [/* @__PURE__ */ u("span", {
|
|
98
|
-
className: e("truncate", !a && "text-[color:oklch(var(--muted-foreground)/var(--zen-placeholder))]"),
|
|
99
|
-
children: a ?? o
|
|
100
|
-
}), /* @__PURE__ */ u(h, {})]
|
|
101
|
-
}), /* @__PURE__ */ d("div", {
|
|
102
|
-
...b.popupProps,
|
|
103
|
-
role: "dialog",
|
|
104
|
-
"aria-label": s,
|
|
105
|
-
className: e("zen__popover", r, "p-3"),
|
|
106
|
-
children: [b.open && c(S), f && /* @__PURE__ */ u("button", {
|
|
88
|
+
function y({ shown: t, placeholder: r, label: i, calendar: u, onClear: d, clearLabel: f, name: p, formValue: _, onReset: v, size: y = "default", id: x, className: S, disabled: C = !1, style: w, ...T }) {
|
|
89
|
+
let E = n(), D = a({
|
|
90
|
+
...T,
|
|
91
|
+
id: x
|
|
92
|
+
}), O = () => E.setOpen(!1);
|
|
93
|
+
return /* @__PURE__ */ g(m, { children: [
|
|
94
|
+
/* @__PURE__ */ g("button", {
|
|
107
95
|
type: "button",
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
...T,
|
|
97
|
+
...D,
|
|
98
|
+
id: x,
|
|
99
|
+
disabled: C,
|
|
100
|
+
...E.triggerProps,
|
|
101
|
+
style: {
|
|
102
|
+
...E.triggerProps.style,
|
|
103
|
+
...w
|
|
110
104
|
},
|
|
111
|
-
className: "
|
|
112
|
-
children:
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
className: e("zen__date-picker group", c, o[y], "w-full", E.open && "border-glow/60 [--glow-border-color:transparent] shadow-glow-focus", S),
|
|
106
|
+
children: [/* @__PURE__ */ h("span", {
|
|
107
|
+
className: e("truncate", !t && "text-[color:oklch(var(--muted-foreground)/var(--zen-placeholder))]"),
|
|
108
|
+
children: t ?? r
|
|
109
|
+
}), /* @__PURE__ */ h(b, {})]
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ h(l, {
|
|
112
|
+
name: p,
|
|
113
|
+
value: _,
|
|
114
|
+
onReset: v
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ g("div", {
|
|
117
|
+
...E.popupProps,
|
|
118
|
+
role: "dialog",
|
|
119
|
+
"aria-label": i,
|
|
120
|
+
className: e("zen__popover", s, "p-3"),
|
|
121
|
+
children: [E.open && u(O), d && /* @__PURE__ */ h("button", {
|
|
122
|
+
type: "button",
|
|
123
|
+
onClick: () => {
|
|
124
|
+
d(), O();
|
|
125
|
+
},
|
|
126
|
+
className: "border-tint/[0.06] text-muted-foreground hover:text-foreground focus-ring mt-2 w-full cursor-pointer rounded-lg border-t px-2 pt-2.5 pb-1.5 text-sm outline-hidden",
|
|
127
|
+
children: f
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
] });
|
|
115
131
|
}
|
|
116
|
-
function
|
|
117
|
-
return /* @__PURE__ */
|
|
132
|
+
function b() {
|
|
133
|
+
return /* @__PURE__ */ h(p, { className: "text-muted-foreground group-data-popup-open:text-foreground size-4 shrink-0 transition-colors" });
|
|
118
134
|
}
|
|
119
135
|
//#endregion
|
|
120
|
-
export {
|
|
136
|
+
export { v as DateRangePicker, _ as default };
|
package/dist/dialog/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ComponentProps, ReactNode, RefObject } from 'react';
|
|
|
7
7
|
* it's a sheet that slides in from that edge: a bottom sheet on phones, a side
|
|
8
8
|
* panel for filters or details. On touch, a sheet swipes back to its edge to close.
|
|
9
9
|
*/
|
|
10
|
-
export default function Dialog({ open, onOpenChange, title, description, children, dismissible, initialFocus, size, side, className, role, closeLabel, }: DialogProps): import('react').JSX.Element;
|
|
10
|
+
export default function Dialog({ open, onOpenChange, title, description, children, dismissible, initialFocus, size, side, className, role, closeLabel: closeLabelProp, ref: refProp, ...rest }: DialogProps): import('react').JSX.Element;
|
|
11
11
|
/**
|
|
12
12
|
* Opens and closes a <dialog> as a modal with `open`: focus moves in (to
|
|
13
13
|
* `initialFocus` if given) and back after, the page behind is inert and
|
|
@@ -23,7 +23,8 @@ export declare function DialogFooter({ className, ...rest }: ComponentProps<'div
|
|
|
23
23
|
* preventDefault). Takes every Button prop: variant, size, asChild…
|
|
24
24
|
*/
|
|
25
25
|
export declare function DialogClose({ onClick, ...rest }: ButtonProps): import('react').JSX.Element;
|
|
26
|
-
|
|
26
|
+
/** Other props (data-*, an id) go on the <dialog>. */
|
|
27
|
+
export interface DialogProps extends Omit<ComponentProps<'dialog'>, 'open' | 'title'> {
|
|
27
28
|
open: boolean;
|
|
28
29
|
onOpenChange?: (open: boolean) => void;
|
|
29
30
|
title: ReactNode;
|
|
@@ -36,8 +37,6 @@ export interface DialogProps {
|
|
|
36
37
|
size?: 'md' | 'lg';
|
|
37
38
|
/** Slide in from this edge as a sheet, instead of appearing in the middle. */
|
|
38
39
|
side?: 'bottom' | 'left' | 'right';
|
|
39
|
-
className?: string;
|
|
40
|
-
role?: ComponentProps<'dialog'>['role'];
|
|
41
40
|
/** The close button's accessible name. */
|
|
42
41
|
closeLabel?: string;
|
|
43
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/dialog/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/dialog/index.tsx"],"names":[],"mappings":"AAIA,OAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EACH,cAAc,EAGd,SAAS,EACT,SAAS,EAKZ,MAAM,OAAO,CAAC;AAKf;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,WAAkB,EAClB,YAAY,EACZ,IAAW,EACX,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,UAAU,EAAE,cAAc,EAC1B,GAAG,EAAE,OAAO,EACZ,GAAG,IAAI,EACV,EAAE,WAAW,+BA2Eb;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACpB,GAAG,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EACxC,IAAI,EAAE,OAAO,EACb,YAAY,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAC7C,IAAI,CA4BN;AAiCD,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAEzE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,+BAW5D;AAED,sDAAsD;AACtD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjF,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,YAAY,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC7C,sEAAsE;IACtE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/dist/dialog/index.js
CHANGED
|
@@ -1,64 +1,67 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "../utils/cx.js";
|
|
3
3
|
import { useGraphicsMode as t } from "../utils/graphics.js";
|
|
4
|
-
import n from "../
|
|
5
|
-
import r from "../
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { useMergedRefs as n } from "../utils/refs.js";
|
|
5
|
+
import { useMessages as r } from "../locale-provider/index.js";
|
|
6
|
+
import i from "../button/index.js";
|
|
7
|
+
import a from "../icons/micro/x-mark.js";
|
|
8
|
+
import { useToastHost as o } from "../toast/index.js";
|
|
9
|
+
import { useSwipe as s } from "../utils/swipe.js";
|
|
10
|
+
import { createContext as c, useContext as l, useEffect as u, useId as d, useRef as f } from "react";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
12
|
//#region packages/dialog/index.tsx
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"aria-
|
|
19
|
-
"
|
|
20
|
-
|
|
13
|
+
var h = c(() => {});
|
|
14
|
+
function g({ open: t, onOpenChange: i, title: o, description: s, children: c, dismissible: l = !0, initialFocus: u, size: g = "md", side: v, className: b, role: x, closeLabel: S, ref: C, ...w }) {
|
|
15
|
+
let T = r(), E = S ?? T.close, D = f(null), O = n(D, C), k = d(), A = d();
|
|
16
|
+
return y(D, l && t ? v : void 0, () => i?.(!1)), _(D, t, u), /* @__PURE__ */ m("dialog", {
|
|
17
|
+
...w,
|
|
18
|
+
ref: O,
|
|
19
|
+
role: x,
|
|
20
|
+
"aria-labelledby": k,
|
|
21
|
+
"aria-describedby": s ? A : void 0,
|
|
22
|
+
"data-side": v,
|
|
23
|
+
className: e("zen__dialog glass glass-blur glow-edge text-card-foreground bg-card/90! overflow-visible p-0", !v && "m-auto max-h-[calc(100dvh-2rem)] max-w-[calc(100vw-2rem)] rounded-xl", !v && (g === "lg" ? "w-[60rem]" : "w-[28rem]"), v === "bottom" && "mx-auto mt-auto mb-0 max-h-[85dvh] w-full max-w-2xl rounded-t-2xl", (v === "left" || v === "right") && "my-0 h-dvh max-h-dvh w-[24rem] max-w-[calc(100vw-2.5rem)]", v === "right" && "mr-0 ml-auto rounded-l-2xl", v === "left" && "mr-auto ml-0 rounded-r-2xl", "backdrop:bg-[color:var(--backdrop-scrim,oklch(0_0_0/0.5))] backdrop:backdrop-blur-sm pointer-coarse:backdrop:backdrop-blur-none", b),
|
|
21
24
|
onCancel: (e) => {
|
|
22
|
-
e.preventDefault(),
|
|
25
|
+
e.preventDefault(), l && i?.(!1);
|
|
23
26
|
},
|
|
24
27
|
onClick: (e) => {
|
|
25
|
-
e.target === e.currentTarget &&
|
|
28
|
+
e.target === e.currentTarget && l && i?.(!1);
|
|
26
29
|
},
|
|
27
|
-
children: [/* @__PURE__ */
|
|
28
|
-
className: e("flex flex-col gap-4 overflow-x-hidden overflow-y-auto p-6",
|
|
30
|
+
children: [/* @__PURE__ */ m("div", {
|
|
31
|
+
className: e("flex flex-col gap-4 overflow-x-hidden overflow-y-auto p-6", v ? v === "bottom" ? "max-h-[85dvh] pt-3" : "h-full" : "max-h-[calc(100dvh-2rem)]"),
|
|
29
32
|
children: [
|
|
30
|
-
|
|
33
|
+
v === "bottom" && /* @__PURE__ */ p("div", {
|
|
31
34
|
"aria-hidden": !0,
|
|
32
35
|
className: "bg-tint/20 mx-auto h-1 w-10 shrink-0 rounded-full"
|
|
33
36
|
}),
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
className: e("flex flex-col gap-2",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
37
|
-
id:
|
|
37
|
+
/* @__PURE__ */ m("div", {
|
|
38
|
+
className: e("flex flex-col gap-2", l && "pe-8"),
|
|
39
|
+
children: [/* @__PURE__ */ p("h2", {
|
|
40
|
+
id: k,
|
|
38
41
|
className: "text-lg font-semibold tracking-tight text-balance",
|
|
39
|
-
children:
|
|
40
|
-
}),
|
|
41
|
-
id:
|
|
42
|
+
children: o
|
|
43
|
+
}), s && /* @__PURE__ */ p("p", {
|
|
44
|
+
id: A,
|
|
42
45
|
className: "text-muted-foreground mt-0! text-sm leading-5",
|
|
43
|
-
children:
|
|
46
|
+
children: s
|
|
44
47
|
})]
|
|
45
48
|
}),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
value: () =>
|
|
48
|
-
children:
|
|
49
|
+
/* @__PURE__ */ p(h.Provider, {
|
|
50
|
+
value: () => i?.(!1),
|
|
51
|
+
children: c
|
|
49
52
|
})
|
|
50
53
|
]
|
|
51
|
-
}),
|
|
54
|
+
}), l && /* @__PURE__ */ p("button", {
|
|
52
55
|
type: "button",
|
|
53
|
-
"aria-label":
|
|
54
|
-
onClick: () =>
|
|
55
|
-
className: e("text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground
|
|
56
|
-
children: /* @__PURE__ */
|
|
56
|
+
"aria-label": E,
|
|
57
|
+
onClick: () => i?.(!1),
|
|
58
|
+
className: e("text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground absolute end-4 grid size-8 cursor-pointer place-items-center rounded-lg outline-hidden transition-colors focus-ring", v === "bottom" ? "top-7.5" : "top-5.5"),
|
|
59
|
+
children: /* @__PURE__ */ p(a, { className: "size-4" })
|
|
57
60
|
})]
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
|
-
function
|
|
61
|
-
t(),
|
|
63
|
+
function _(e, n, r) {
|
|
64
|
+
t(), u(() => {
|
|
62
65
|
let t = e.current;
|
|
63
66
|
if (t) {
|
|
64
67
|
if (n && !t.open) {
|
|
@@ -76,42 +79,42 @@ function h(e, n, r) {
|
|
|
76
79
|
e,
|
|
77
80
|
n,
|
|
78
81
|
r
|
|
79
|
-
]),
|
|
82
|
+
]), o(e, n);
|
|
80
83
|
}
|
|
81
|
-
var
|
|
82
|
-
function
|
|
83
|
-
let r = t === "bottom" ? "y" : "x", i = t === "left" ? -1 : 1,
|
|
84
|
+
var v = .3;
|
|
85
|
+
function y(e, t, n) {
|
|
86
|
+
let r = t === "bottom" ? "y" : "x", i = t === "left" ? -1 : 1, a = () => r === "y" ? e.current.offsetHeight : e.current.offsetWidth, o = () => {
|
|
84
87
|
e.current?.style.removeProperty("--zen-swipe"), e.current?.style.removeProperty("--zen-swipe-progress");
|
|
85
88
|
};
|
|
86
|
-
|
|
89
|
+
u(o, [e, t]), s(e, t ? {
|
|
87
90
|
axis: r,
|
|
88
91
|
sign: i
|
|
89
92
|
} : void 0, {
|
|
90
93
|
move: (t) => {
|
|
91
94
|
let n = t > 0 ? t : t / 6;
|
|
92
|
-
e.current.style.setProperty("--zen-swipe", r === "y" ? `0 ${n}px` : `${n * i}px 0`), e.current.style.setProperty("--zen-swipe-progress", String(Math.max(0, Math.min(1, t /
|
|
95
|
+
e.current.style.setProperty("--zen-swipe", r === "y" ? `0 ${n}px` : `${n * i}px 0`), e.current.style.setProperty("--zen-swipe-progress", String(Math.max(0, Math.min(1, t / a()))));
|
|
93
96
|
},
|
|
94
97
|
release: (e, t) => {
|
|
95
|
-
e >
|
|
98
|
+
e > a() * v || e > 0 && t > .5 ? n() : o();
|
|
96
99
|
},
|
|
97
|
-
cancel:
|
|
98
|
-
threshold: () =>
|
|
100
|
+
cancel: o,
|
|
101
|
+
threshold: () => a() * v
|
|
99
102
|
});
|
|
100
103
|
}
|
|
101
|
-
function
|
|
102
|
-
return /* @__PURE__ */
|
|
104
|
+
function b({ className: t, ...n }) {
|
|
105
|
+
return /* @__PURE__ */ p("div", {
|
|
103
106
|
className: e("flex justify-end gap-2", t),
|
|
104
107
|
...n
|
|
105
108
|
});
|
|
106
109
|
}
|
|
107
|
-
function
|
|
108
|
-
let
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
+
function x({ onClick: e, ...t }) {
|
|
111
|
+
let n = l(h);
|
|
112
|
+
return /* @__PURE__ */ p(i, {
|
|
110
113
|
...t,
|
|
111
114
|
onClick: (t) => {
|
|
112
|
-
e?.(t), t.defaultPrevented ||
|
|
115
|
+
e?.(t), t.defaultPrevented || n();
|
|
113
116
|
}
|
|
114
117
|
});
|
|
115
118
|
}
|
|
116
119
|
//#endregion
|
|
117
|
-
export {
|
|
120
|
+
export { x as DialogClose, b as DialogFooter, g as default, _ as useModal };
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
interface DisclosureContextValue {
|
|
3
|
+
open: boolean;
|
|
4
|
+
setOpen: (open: boolean) => void;
|
|
5
|
+
contentId: string;
|
|
6
|
+
}
|
|
7
|
+
/** The enclosing Disclosure's state, for building your own trigger or content. */
|
|
8
|
+
export declare function useDisclosure(part: string): DisclosureContextValue;
|
|
2
9
|
/**
|
|
3
10
|
* A section that a button shows and hides, e.g. "Past (3)" under a list. Put
|
|
4
11
|
* a DisclosureTrigger and a DisclosureContent inside (it adds no element of its
|
|
@@ -22,4 +29,5 @@ export interface DisclosureProps {
|
|
|
22
29
|
onOpenChange?: (open: boolean) => void;
|
|
23
30
|
children?: ReactNode;
|
|
24
31
|
}
|
|
32
|
+
export {};
|
|
25
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/disclosure/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/disclosure/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAiB,SAAS,EAAkD,MAAM,OAAO,CAAC;AAEjH,UAAU,sBAAsB;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACrB;AAID,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,0BAIzC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,WAAmB,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,eAAe,+BAMxG;AAED,sHAAsH;AACtH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,+BAwBpG;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,sCAuDxF;AAED,MAAM,WAAW,eAAe;IAC5B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB"}
|