art-bd-ui 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/buttons/button/button.js +4 -1
- package/dist/cjs/components/buttons/icon-button/icon-button.js +1 -1
- package/dist/cjs/components/buttons/toggle/toggle.js +6 -1
- package/dist/cjs/components/forms/checkbox/checkbox.js +4 -5
- package/dist/cjs/components/forms/form/form.js +2 -2
- package/dist/cjs/components/forms/input/input.js +8 -21
- package/dist/cjs/components/forms/input-number/input-number.js +88 -0
- package/dist/cjs/components/forms/input-number/step-buttons.js +13 -0
- package/dist/cjs/components/forms/input-number/utils.js +64 -0
- package/dist/cjs/components/forms/radio/radio.js +3 -3
- package/dist/cjs/components/forms/select/select.js +26 -5
- package/dist/cjs/components/forms/switch/switch.js +4 -4
- package/dist/cjs/components/forms/textarea/textarea.js +2 -3
- package/dist/cjs/components/popovers/dialog/dialog.js +4 -16
- package/dist/cjs/components/popovers/drawer/drawer.js +6 -6
- package/dist/cjs/components/popovers/popover/popover.js +5 -19
- package/dist/cjs/components/popovers/shared/icon-close.js +14 -0
- package/dist/cjs/components/popovers/sheet/sheet.js +8 -15
- package/dist/cjs/components/popovers/tooltip/tooltip.js +2 -6
- package/dist/cjs/components/quiz/question/question.js +14 -0
- package/dist/cjs/components/quiz/question-renderer/question-renderer.js +14 -0
- package/dist/cjs/components/quiz/quiz-runner/quiz-runner.js +34 -0
- package/dist/cjs/components/quiz/registry.js +11 -0
- package/dist/cjs/components/quiz/renderers/multi-choice-renderer/multi-choice-renderer.js +47 -0
- package/dist/cjs/components/quiz/renderers/single-choice-renderer/single-choice-renderer.js +41 -0
- package/dist/cjs/components/selectors/multiselect/components/badge-list.js +1 -1
- package/dist/cjs/components/selectors/multiselect/multiselect.js +3 -3
- package/dist/cjs/components/selectors/shared/container.js +17 -0
- package/dist/cjs/components/selectors/single-select/single-select.js +3 -3
- package/dist/cjs/components/typography/heading/heading.js +18 -10
- package/dist/cjs/components/typography/text/text.js +11 -5
- package/dist/cjs/components/ui/accordion/accordion.js +2 -2
- package/dist/cjs/components/ui/badge/badge.js +4 -1
- package/dist/cjs/components/ui/calendar/calendar.js +2 -2
- package/dist/cjs/components/ui/command/command.js +1 -1
- package/dist/cjs/components/ui/data-table/components/table-body.js +1 -1
- package/dist/cjs/components/ui/data-table/components/table-head.js +1 -1
- package/dist/cjs/components/ui/data-table/data-table.js +2 -2
- package/dist/cjs/components/ui/data-table/hooks/useStickyColumns.js +1 -1
- package/dist/cjs/components/ui/dropdown-menu/dropdown-menu.js +34 -5
- package/dist/cjs/components/ui/tabs/tabs.js +9 -1
- package/dist/cjs/components/utility/empty-state/empty-state.js +2 -2
- package/dist/cjs/components/utility/input-container/input-container.js +73 -0
- package/dist/cjs/hooks/{useForkRef.js → use-fork-ref.js} +1 -1
- package/dist/cjs/hooks/{useUpdateEffect.js → use-update-effect.js} +1 -1
- package/dist/cjs/index.js +20 -12
- package/dist/cjs/node_modules/vaul/dist/index.js +1 -0
- package/dist/esm/components/buttons/button/button.js +4 -1
- package/dist/esm/components/buttons/icon-button/icon-button.js +1 -1
- package/dist/esm/components/buttons/toggle/toggle.js +6 -1
- package/dist/esm/components/forms/checkbox/checkbox.js +4 -5
- package/dist/esm/components/forms/form/form.js +2 -2
- package/dist/esm/components/forms/input/input.js +8 -21
- package/dist/esm/components/forms/input-number/input-number.js +86 -0
- package/dist/esm/components/forms/input-number/step-buttons.js +11 -0
- package/dist/esm/components/forms/input-number/utils.js +59 -0
- package/dist/esm/components/forms/radio/radio.js +3 -3
- package/dist/esm/components/forms/select/select.js +26 -5
- package/dist/esm/components/forms/switch/switch.js +4 -4
- package/dist/esm/components/forms/textarea/textarea.js +2 -3
- package/dist/esm/components/popovers/dialog/dialog.js +4 -16
- package/dist/esm/components/popovers/drawer/drawer.js +6 -7
- package/dist/esm/components/popovers/popover/popover.js +5 -19
- package/dist/esm/components/popovers/shared/icon-close.js +12 -0
- package/dist/esm/components/popovers/sheet/sheet.js +9 -17
- package/dist/esm/components/popovers/tooltip/tooltip.js +2 -6
- package/dist/esm/components/quiz/question/question.js +12 -0
- package/dist/esm/components/quiz/question-renderer/question-renderer.js +12 -0
- package/dist/esm/components/quiz/quiz-runner/quiz-runner.js +32 -0
- package/dist/esm/components/quiz/registry.js +9 -0
- package/dist/esm/components/quiz/renderers/multi-choice-renderer/multi-choice-renderer.js +45 -0
- package/dist/esm/components/quiz/renderers/single-choice-renderer/single-choice-renderer.js +39 -0
- package/dist/esm/components/selectors/multiselect/components/badge-list.js +1 -1
- package/dist/esm/components/selectors/multiselect/multiselect.js +3 -3
- package/dist/esm/components/selectors/shared/container.js +15 -0
- package/dist/esm/components/selectors/single-select/single-select.js +3 -3
- package/dist/esm/components/typography/heading/heading.js +18 -10
- package/dist/esm/components/typography/text/text.js +11 -5
- package/dist/esm/components/ui/accordion/accordion.js +2 -2
- package/dist/esm/components/ui/badge/badge.js +4 -1
- package/dist/esm/components/ui/calendar/calendar.js +2 -2
- package/dist/esm/components/ui/command/command.js +1 -1
- package/dist/esm/components/ui/data-table/components/table-body.js +1 -1
- package/dist/esm/components/ui/data-table/components/table-head.js +1 -1
- package/dist/esm/components/ui/data-table/data-table.js +2 -2
- package/dist/esm/components/ui/data-table/hooks/useStickyColumns.js +1 -1
- package/dist/esm/components/ui/dropdown-menu/dropdown-menu.js +34 -5
- package/dist/esm/components/ui/tabs/tabs.js +9 -1
- package/dist/esm/components/utility/empty-state/empty-state.js +2 -2
- package/dist/esm/components/utility/input-container/input-container.js +71 -0
- package/dist/esm/hooks/{useForkRef.js → use-fork-ref.js} +1 -1
- package/dist/esm/hooks/{useUpdateEffect.js → use-update-effect.js} +1 -1
- package/dist/esm/index.js +17 -14
- package/dist/esm/node_modules/vaul/dist/index.js +2 -1
- package/dist/styles.css +368 -272
- package/dist/types/index.d.ts +109 -30
- package/package.json +8 -8
- package/dist/cjs/components/selectors/shared/input-container.js +0 -17
- package/dist/esm/components/selectors/shared/input-container.js +0 -15
- /package/dist/cjs/hooks/{useControlled.js → use-controlled.js} +0 -0
- /package/dist/cjs/hooks/{useFirstMountState.js → use-first-mount-state.js} +0 -0
- /package/dist/cjs/hooks/{useLatest.js → use-latest.js} +0 -0
- /package/dist/cjs/hooks/{usePrevious.js → use-previous.js} +0 -0
- /package/dist/cjs/hooks/{useScrollState.js → use-scroll-state.js} +0 -0
- /package/dist/cjs/hooks/{useStateRef.js → use-state-ref.js} +0 -0
- /package/dist/cjs/utils/{addIf.js → add-if.js} +0 -0
- /package/dist/cjs/utils/{getBoundingRect.js → get-bounding-rect.js} +0 -0
- /package/dist/cjs/utils/{mergeProps.js → merge-props.js} +0 -0
- /package/dist/cjs/utils/{mergeRefs.js → merge-refs.js} +0 -0
- /package/dist/esm/hooks/{useControlled.js → use-controlled.js} +0 -0
- /package/dist/esm/hooks/{useFirstMountState.js → use-first-mount-state.js} +0 -0
- /package/dist/esm/hooks/{useLatest.js → use-latest.js} +0 -0
- /package/dist/esm/hooks/{usePrevious.js → use-previous.js} +0 -0
- /package/dist/esm/hooks/{useScrollState.js → use-scroll-state.js} +0 -0
- /package/dist/esm/hooks/{useStateRef.js → use-state-ref.js} +0 -0
- /package/dist/esm/utils/{addIf.js → add-if.js} +0 -0
- /package/dist/esm/utils/{getBoundingRect.js → get-bounding-rect.js} +0 -0
- /package/dist/esm/utils/{mergeProps.js → merge-props.js} +0 -0
- /package/dist/esm/utils/{mergeRefs.js → merge-refs.js} +0 -0
|
@@ -8,7 +8,10 @@ var index$1 = require('../../../node_modules/class-variance-authority/dist/index
|
|
|
8
8
|
var utils = require('../../../lib/utils.js');
|
|
9
9
|
var icon = require('../../media/icon/icon.js');
|
|
10
10
|
|
|
11
|
-
const buttonVariants = index$1.cva(
|
|
11
|
+
const buttonVariants = index$1.cva([
|
|
12
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 shrink-0 ",
|
|
13
|
+
"focusable aria-invalid-state non-interactive-inner-svg",
|
|
14
|
+
], {
|
|
12
15
|
variants: {
|
|
13
16
|
variant: {
|
|
14
17
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
@@ -10,7 +10,7 @@ var icon = require('../../media/icon/icon.js');
|
|
|
10
10
|
var button = require('../button/button.js');
|
|
11
11
|
var tooltip = require('../../popovers/tooltip/tooltip.js');
|
|
12
12
|
|
|
13
|
-
const iconButtonVariants = index.cva("", {
|
|
13
|
+
const iconButtonVariants = index.cva("cursor-pointer", {
|
|
14
14
|
variants: {
|
|
15
15
|
radius: {
|
|
16
16
|
none: "rounded-none",
|
|
@@ -7,7 +7,12 @@ var index$1 = require('../../../node_modules/@radix-ui/react-toggle/dist/index.j
|
|
|
7
7
|
var index = require('../../../node_modules/class-variance-authority/dist/index.js');
|
|
8
8
|
var utils = require('../../../lib/utils.js');
|
|
9
9
|
|
|
10
|
-
const toggleVariants = index.cva(
|
|
10
|
+
const toggleVariants = index.cva([
|
|
11
|
+
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 whitespace-nowrap",
|
|
12
|
+
"data-[state=on]:bg-accent",
|
|
13
|
+
"data-[state=on]:text-accent-foreground",
|
|
14
|
+
"focusable aria-invalid-state non-interactive-inner-svg",
|
|
15
|
+
], {
|
|
11
16
|
variants: {
|
|
12
17
|
variant: {
|
|
13
18
|
default: "bg-transparent",
|
|
@@ -9,11 +9,10 @@ var utils = require('../../../lib/utils.js');
|
|
|
9
9
|
var icon = require('../../media/icon/icon.js');
|
|
10
10
|
|
|
11
11
|
const checkboxVariants = index$1.cva([
|
|
12
|
-
"peer shrink-0 rounded-[4px] border shadow-xs transition-shadow
|
|
12
|
+
"peer shrink-0 rounded-[4px] border shadow-xs transition-shadow",
|
|
13
13
|
"border-input dark:bg-input/30",
|
|
14
|
-
"
|
|
14
|
+
"focusable aria-invalid-state",
|
|
15
15
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
17
16
|
], {
|
|
18
17
|
variants: {
|
|
19
18
|
size: {
|
|
@@ -39,8 +38,8 @@ const checkboxIndicatorVariants = index$1.cva(["flex items-center justify-center
|
|
|
39
38
|
},
|
|
40
39
|
});
|
|
41
40
|
const Checkbox = React.forwardRef((_a, ref) => {
|
|
42
|
-
var { className, checked, indeterminate = false, size } = _a, props = tslib_es6.__rest(_a, ["className", "checked", "indeterminate", "size"]);
|
|
43
|
-
return (jsxRuntime.jsx(index.Checkbox, Object.assign({ ref: ref, "data-slot": "checkbox", checked: checked, className: utils.cn(checkboxVariants({ size }), [
|
|
41
|
+
var { className, checked, onChange, onCheckedChange, indeterminate = false, size } = _a, props = tslib_es6.__rest(_a, ["className", "checked", "onChange", "onCheckedChange", "indeterminate", "size"]);
|
|
42
|
+
return (jsxRuntime.jsx(index.Checkbox, Object.assign({ ref: ref, "data-slot": "checkbox", checked: checked, onCheckedChange: onCheckedChange || onChange, className: utils.cn(checkboxVariants({ size }), [
|
|
44
43
|
"data-[state=checked]:bg-primary",
|
|
45
44
|
"data-[state=checked]:text-primary-foreground",
|
|
46
45
|
"dark:data-[state=checked]:bg-primary",
|
|
@@ -33,9 +33,9 @@ function FormItem(_a) {
|
|
|
33
33
|
return (jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: jsxRuntime.jsx("div", Object.assign({ "data-slot": "form-item", className: utils.cn("grid gap-2", className) }, props)) }));
|
|
34
34
|
}
|
|
35
35
|
function FormLabel(_a) {
|
|
36
|
-
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
36
|
+
var { className, weight = "bold" } = _a, props = tslib_es6.__rest(_a, ["className", "weight"]);
|
|
37
37
|
const { error, formItemId } = useFormField();
|
|
38
|
-
return (jsxRuntime.jsx(label.Label, Object.assign({ "data-slot": "form-label", "data-error": !!error, className: utils.cn("data-[error=true]:text-destructive", className), htmlFor: formItemId }, props)));
|
|
38
|
+
return (jsxRuntime.jsx(label.Label, Object.assign({ "data-slot": "form-label", "data-error": !!error, className: utils.cn("data-[error=true]:text-destructive", className), htmlFor: formItemId, weight: weight }, props)));
|
|
39
39
|
}
|
|
40
40
|
function FormFieldControl(_a) {
|
|
41
41
|
var props = tslib_es6.__rest(_a, []);
|
|
@@ -5,33 +5,20 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var index = require('../../../node_modules/class-variance-authority/dist/index.js');
|
|
7
7
|
var utils = require('../../../lib/utils.js');
|
|
8
|
+
var inputContainer = require('../../utility/input-container/input-container.js');
|
|
8
9
|
|
|
9
10
|
const inputVariants = index.cva([
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"border-input dark:bg-input/30",
|
|
11
|
+
"min-w-0 bg-transparent rounded-[inherit]",
|
|
12
|
+
"outline-none",
|
|
13
13
|
"placeholder:text-muted-foreground",
|
|
14
14
|
"selection:bg-primary selection:text-primary-foreground",
|
|
15
|
-
"disabled:pointer-events-none
|
|
16
|
-
"
|
|
17
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
15
|
+
"disabled:pointer-events-none",
|
|
16
|
+
"aria-invalid-state",
|
|
18
17
|
"file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
|
|
19
|
-
|
|
20
|
-
], {
|
|
21
|
-
variants: {
|
|
22
|
-
size: {
|
|
23
|
-
default: "h-9 px-3 py-1",
|
|
24
|
-
sm: "h-8 px-2.5 py-0.5 text-sm",
|
|
25
|
-
lg: "h-10 px-4 py-2 text-base",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
defaultVariants: {
|
|
29
|
-
size: "default",
|
|
30
|
-
},
|
|
31
|
-
});
|
|
18
|
+
]);
|
|
32
19
|
const Input = React.forwardRef((_a, ref) => {
|
|
33
|
-
var { className, type, size } = _a, props = tslib_es6.__rest(_a, ["className", "type", "size"]);
|
|
34
|
-
return (jsxRuntime.jsx("input", Object.assign({ ref: ref, type: type, "data-slot": "input", className: utils.cn(inputVariants(
|
|
20
|
+
var { className, type, size, disabled, prefix, suffix, prefixStyling, suffixStyling } = _a, props = tslib_es6.__rest(_a, ["className", "type", "size", "disabled", "prefix", "suffix", "prefixStyling", "suffixStyling"]);
|
|
21
|
+
return (jsxRuntime.jsx(inputContainer.InputContainer, { size: size, disabled: disabled, prefix: prefix, suffix: suffix, prefixStyling: prefixStyling, suffixStyling: suffixStyling, children: jsxRuntime.jsx("input", Object.assign({ ref: ref, type: type, "data-slot": "input", className: utils.cn(inputVariants(), className), disabled: disabled }, props)) }));
|
|
35
22
|
});
|
|
36
23
|
Input.displayName = "Input";
|
|
37
24
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var utils = require('./utils.js');
|
|
8
|
+
var stepButtons = require('./step-buttons.js');
|
|
9
|
+
var input = require('../input/input.js');
|
|
10
|
+
var useUpdateEffect = require('../../../hooks/use-update-effect.js');
|
|
11
|
+
require('../../../_virtual/throttle.js');
|
|
12
|
+
|
|
13
|
+
const noop = () => { };
|
|
14
|
+
const getFormatter = (decimalScale, locale) => new Intl.NumberFormat(locale, {
|
|
15
|
+
useGrouping: false,
|
|
16
|
+
minimumFractionDigits: 0,
|
|
17
|
+
maximumFractionDigits: decimalScale,
|
|
18
|
+
});
|
|
19
|
+
const InputNumber = (_a) => {
|
|
20
|
+
var { value, onChange = noop, step = 1, min = -Infinity, max = Infinity, precision = 0, withControls = true, suffix, suffixStyling, readOnly = false, disabled = false } = _a, rest = tslib_es6.__rest(_a, ["value", "onChange", "step", "min", "max", "precision", "withControls", "suffix", "suffixStyling", "readOnly", "disabled"]);
|
|
21
|
+
// caret tracking
|
|
22
|
+
const cursorPosition = React.useRef(0);
|
|
23
|
+
const inputRef = React.useRef(null);
|
|
24
|
+
const saveCursor = (pos) => {
|
|
25
|
+
if (pos != null)
|
|
26
|
+
cursorPosition.current = pos;
|
|
27
|
+
};
|
|
28
|
+
const fmtRef = React.useRef(getFormatter(precision));
|
|
29
|
+
useUpdateEffect.useUpdateEffect(() => {
|
|
30
|
+
fmtRef.current = getFormatter(precision);
|
|
31
|
+
}, [precision]);
|
|
32
|
+
const fmt = fmtRef.current;
|
|
33
|
+
const [display, setDisplay] = React.useState(() => (value !== undefined ? fmt.format(value) : ""));
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
setDisplay(value !== undefined ? fmt.format(value) : "");
|
|
36
|
+
}, [value, fmt]);
|
|
37
|
+
const commit = React.useCallback((raw) => {
|
|
38
|
+
const parsed = utils.parseDisplay(raw, precision);
|
|
39
|
+
if (parsed === undefined) {
|
|
40
|
+
setDisplay("");
|
|
41
|
+
onChange(undefined);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let normalized = utils.clamp(parsed, min, max);
|
|
45
|
+
normalized = utils.toFixedSafe(normalized, precision);
|
|
46
|
+
setDisplay(fmt.format(normalized));
|
|
47
|
+
onChange(normalized);
|
|
48
|
+
}, [precision, fmt, min, max, onChange]);
|
|
49
|
+
const handleChange = React.useCallback((e) => {
|
|
50
|
+
const raw = e.target.value;
|
|
51
|
+
saveCursor(e.target.selectionStart);
|
|
52
|
+
const clean = utils.sanitizeInput(raw, precision);
|
|
53
|
+
setDisplay(clean);
|
|
54
|
+
requestAnimationFrame(() => {
|
|
55
|
+
const el = inputRef.current;
|
|
56
|
+
if (el) {
|
|
57
|
+
el.selectionStart = el.selectionEnd = cursorPosition.current;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}, [precision]);
|
|
61
|
+
const handleBlur = React.useCallback(() => commit(display), [commit, display]);
|
|
62
|
+
const base = React.useMemo(() => { var _a; return (Number.isFinite(value) ? value : ((_a = utils.parseDisplay(display, precision)) !== null && _a !== void 0 ? _a : 0)); }, [value, display, precision]);
|
|
63
|
+
const next = React.useCallback((delta) => utils.clamp(utils.toFixedSafe(base + delta * step, precision), min, max), [base, step, precision, min, max]);
|
|
64
|
+
const stepUp = () => commit(String(next(1)));
|
|
65
|
+
const stepDown = () => commit(String(next(-1)));
|
|
66
|
+
// keyboard support
|
|
67
|
+
const handleKeyDown = (e) => {
|
|
68
|
+
saveCursor(e.currentTarget.selectionStart);
|
|
69
|
+
if (!withControls || Boolean(suffix) || disabled)
|
|
70
|
+
return;
|
|
71
|
+
if (e.key === "ArrowUp") {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
stepUp();
|
|
74
|
+
}
|
|
75
|
+
if (e.key === "ArrowDown") {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
stepDown();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// controls visibility and disabled state
|
|
81
|
+
const showControls = withControls && !suffix;
|
|
82
|
+
const disableUp = disabled || next(1) === utils.clamp(base, min, max);
|
|
83
|
+
const disableDown = disabled || next(-1) === utils.clamp(base, min, max);
|
|
84
|
+
return (jsxRuntime.jsx(input.Input, Object.assign({}, rest, { ref: inputRef, type: "text", inputMode: precision > 0 ? "decimal" : "numeric", pattern: "[0-9]*(\\.[0-9]+)?", readOnly: readOnly || false, disabled: disabled, value: display, onChange: handleChange, onBlur: handleBlur, onKeyDown: handleKeyDown, suffix: suffix !== null && suffix !== void 0 ? suffix : (showControls && (jsxRuntime.jsx(stepButtons.StepButtons, { onIncrease: stepUp, onDecrease: stepDown, disableUp: disableUp, disableDown: disableDown }))), suffixStyling: showControls ? false : suffixStyling })));
|
|
85
|
+
};
|
|
86
|
+
InputNumber.displayName = "InputNumber";
|
|
87
|
+
|
|
88
|
+
exports.InputNumber = InputNumber;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var icon = require('../../media/icon/icon.js');
|
|
5
|
+
var separator = require('../../utility/separator/separator.js');
|
|
6
|
+
var utils = require('../../../lib/utils.js');
|
|
7
|
+
|
|
8
|
+
const StepButton = ({ direction, disabled = false, onClick }) => (jsxRuntime.jsx("div", { role: "button", tabIndex: -1, "aria-hidden": true, className: utils.cn("flex items-center justify-center w-8 h-1/2 hover:bg-accent cursor-pointer", disabled && "opacity-40 cursor-not-allowed"), onClick: disabled ? undefined : onClick, children: jsxRuntime.jsx(icon.Icon, { name: direction === "down" ? "chevron-down" : "chevron-up", size: 16 }) }));
|
|
9
|
+
StepButton.displayName = "StepButton";
|
|
10
|
+
const StepButtons = ({ onIncrease, onDecrease, disableUp, disableDown }) => (jsxRuntime.jsxs("div", { className: "flex flex-col items-center h-full select-none border-l", children: [jsxRuntime.jsx(StepButton, { direction: "up", disabled: disableUp, onClick: onIncrease }), jsxRuntime.jsx(separator.Separator, {}), jsxRuntime.jsx(StepButton, { direction: "down", disabled: disableDown, onClick: onDecrease })] }));
|
|
11
|
+
StepButtons.displayName = "StepButtons";
|
|
12
|
+
|
|
13
|
+
exports.StepButtons = StepButtons;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// clamp to [min, max]
|
|
4
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
5
|
+
// round to fixed precision, handling exponential notation
|
|
6
|
+
const toFixedSafe = (value, precision) => {
|
|
7
|
+
const str = value.toString();
|
|
8
|
+
if (str.includes("e"))
|
|
9
|
+
return value;
|
|
10
|
+
return Number(Number(Math.round(Number(value + "e" + precision)) + "e-" + precision).toFixed(precision));
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Parse a raw display string into a number (or undefined if it’s not valid).
|
|
14
|
+
* Respects decimalScale for how many digits to read after the dot.
|
|
15
|
+
*/
|
|
16
|
+
const parseDisplay = (raw, decimalScale) => {
|
|
17
|
+
if (!raw)
|
|
18
|
+
return undefined;
|
|
19
|
+
// split into int/dec parts
|
|
20
|
+
const [intPart, decPart = ""] = raw.split(".");
|
|
21
|
+
const truncatedDec = decimalScale > 0 ? decPart.slice(0, decimalScale) : "";
|
|
22
|
+
const candidate = truncatedDec.length > 0 ? `${intPart}.${truncatedDec}` : intPart;
|
|
23
|
+
const newNumber = Number(candidate);
|
|
24
|
+
return Number.isFinite(newNumber) ? newNumber : undefined;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Sanitize a typed value on each keystroke:
|
|
28
|
+
* - allow leading “-”
|
|
29
|
+
* - strip any non-digit/non-dot
|
|
30
|
+
* - only one dot
|
|
31
|
+
* - limit decimals
|
|
32
|
+
* - drop leading zeros
|
|
33
|
+
*/
|
|
34
|
+
const sanitizeInput = (raw, decimalScale) => {
|
|
35
|
+
let sign = "";
|
|
36
|
+
if (raw.startsWith("-")) {
|
|
37
|
+
sign = "-";
|
|
38
|
+
raw = raw.slice(1);
|
|
39
|
+
}
|
|
40
|
+
// strip non-digits/dots
|
|
41
|
+
raw = raw.replace(/[^\d.]/g, "");
|
|
42
|
+
// collapse extra dots
|
|
43
|
+
const firstDot = raw.indexOf(".");
|
|
44
|
+
if (firstDot >= 0) {
|
|
45
|
+
const [before, afterAll] = [raw.slice(0, firstDot), raw.slice(firstDot + 1)];
|
|
46
|
+
raw = before + "." + afterAll.replace(/\./g, "");
|
|
47
|
+
}
|
|
48
|
+
// limit decimals
|
|
49
|
+
if (decimalScale === 0) {
|
|
50
|
+
raw = raw.split(".")[0];
|
|
51
|
+
}
|
|
52
|
+
else if (raw.includes(".")) {
|
|
53
|
+
const [i, d] = raw.split(".");
|
|
54
|
+
raw = i + "." + d.slice(0, decimalScale);
|
|
55
|
+
}
|
|
56
|
+
// strip leading zeros (but allow “0” or “0.xxx”)
|
|
57
|
+
raw = raw.replace(/^0+(?=\d)/, "");
|
|
58
|
+
return sign + raw;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.clamp = clamp;
|
|
62
|
+
exports.parseDisplay = parseDisplay;
|
|
63
|
+
exports.sanitizeInput = sanitizeInput;
|
|
64
|
+
exports.toFixedSafe = toFixedSafe;
|
|
@@ -8,13 +8,13 @@ var utils = require('../../../lib/utils.js');
|
|
|
8
8
|
var icon = require('../../media/icon/icon.js');
|
|
9
9
|
|
|
10
10
|
const RadioGroup = (_a) => {
|
|
11
|
-
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
12
|
-
return jsxRuntime.jsx(index.Root, Object.assign({ "data-slot": "radio-group", className: utils.cn("grid gap-3", className) }, props));
|
|
11
|
+
var { className, onChange, onValueChange } = _a, props = tslib_es6.__rest(_a, ["className", "onChange", "onValueChange"]);
|
|
12
|
+
return (jsxRuntime.jsx(index.Root, Object.assign({ "data-slot": "radio-group", className: utils.cn("grid gap-3", className), onValueChange: onValueChange || onChange }, props)));
|
|
13
13
|
};
|
|
14
14
|
RadioGroup.displayName = "RadioGroup";
|
|
15
15
|
const RadioGroupItem = (_a) => {
|
|
16
16
|
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
17
|
-
return (jsxRuntime.jsx(index.Item, Object.assign({ "data-slot": "radio-group-item", className: utils.cn("
|
|
17
|
+
return (jsxRuntime.jsx(index.Item, Object.assign({ "data-slot": "radio-group-item", className: utils.cn(["focusable aria-invalid-state"], "border border-input text-primary dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full shadow-xs disabled:cursor-not-allowed disabled:opacity-50", className) }, props, { children: jsxRuntime.jsx(index.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: jsxRuntime.jsx(icon.Icon, { name: "circle", className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" }) }) })));
|
|
18
18
|
};
|
|
19
19
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
20
20
|
|
|
@@ -8,8 +8,8 @@ var utils = require('../../../lib/utils.js');
|
|
|
8
8
|
var icon = require('../../media/icon/icon.js');
|
|
9
9
|
|
|
10
10
|
const Select = (_a) => {
|
|
11
|
-
var props = tslib_es6.__rest(_a, []);
|
|
12
|
-
return jsxRuntime.jsx(index.Root, Object.assign({ "data-slot": "select" }, props));
|
|
11
|
+
var { onChange, onValueChange } = _a, props = tslib_es6.__rest(_a, ["onChange", "onValueChange"]);
|
|
12
|
+
return (jsxRuntime.jsx(index.Root, Object.assign({ "data-slot": "select", onValueChange: onValueChange || onChange }, props)));
|
|
13
13
|
};
|
|
14
14
|
Select.displayName = "Select";
|
|
15
15
|
const SelectGroup = (_a) => {
|
|
@@ -24,7 +24,14 @@ const SelectValue = (_a) => {
|
|
|
24
24
|
SelectValue.displayName = "SelectValue";
|
|
25
25
|
const SelectTrigger = (_a) => {
|
|
26
26
|
var { className, size = "default", children } = _a, props = tslib_es6.__rest(_a, ["className", "size", "children"]);
|
|
27
|
-
return (jsxRuntime.jsxs(index.Trigger, Object.assign({ "data-slot": "select-trigger", "data-size": size, className: utils.cn(
|
|
27
|
+
return (jsxRuntime.jsxs(index.Trigger, Object.assign({ "data-slot": "select-trigger", "data-size": size, className: utils.cn([
|
|
28
|
+
"data-[placeholder]:text-muted-foreground",
|
|
29
|
+
"data-[size=default]:h-9 data-[size=sm]:h-8",
|
|
30
|
+
"*:data-[slot=select-value]:line-clamp-1",
|
|
31
|
+
"*:data-[slot=select-value]:flex",
|
|
32
|
+
"*:data-[slot=select-value]:items-center",
|
|
33
|
+
"*:data-[slot=select-value]:gap-2",
|
|
34
|
+
], "border border-input dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs", "focusable aria-invalid-state disabled-form-element", "non-interactive-inner-svg [&_svg:not([class*='text-'])]:text-muted-foreground", className) }, props, { children: [children, jsxRuntime.jsx(index.Icon, { asChild: true, children: jsxRuntime.jsx(icon.Icon, { name: "chevron-down", className: "size-4 opacity-50" }) })] })));
|
|
28
35
|
};
|
|
29
36
|
SelectTrigger.displayName = "SelectTrigger";
|
|
30
37
|
const SelectScrollUpButton = (_a) => {
|
|
@@ -39,7 +46,13 @@ const SelectScrollDownButton = (_a) => {
|
|
|
39
46
|
SelectScrollDownButton.displayName = "SelectScrollDownButton";
|
|
40
47
|
const SelectContent = (_a) => {
|
|
41
48
|
var { className, children, position = "popper" } = _a, props = tslib_es6.__rest(_a, ["className", "children", "position"]);
|
|
42
|
-
return (jsxRuntime.jsx(index.Portal, { children: jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "select-content", className: utils.cn(
|
|
49
|
+
return (jsxRuntime.jsx(index.Portal, { children: jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "select-content", className: utils.cn([
|
|
50
|
+
"overlay-appearance-animation",
|
|
51
|
+
"overlay-zoom-animation",
|
|
52
|
+
"overlay-slide-animation",
|
|
53
|
+
"max-h-(--radix-select-content-available-height)",
|
|
54
|
+
"origin-(--radix-select-content-transform-origin)",
|
|
55
|
+
], "relative z-50 min-w-[8rem] bg-popover text-popover-foreground overflow-x-hidden overflow-y-auto rounded-md border shadow-md", position === "popper" &&
|
|
43
56
|
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position }, props, { children: [jsxRuntime.jsx(SelectScrollUpButton, {}), jsxRuntime.jsx(index.Viewport, { className: utils.cn("p-1", position === "popper" &&
|
|
44
57
|
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"), children: children }), jsxRuntime.jsx(SelectScrollDownButton, {})] })) }));
|
|
45
58
|
};
|
|
@@ -51,7 +64,15 @@ const SelectLabel = (_a) => {
|
|
|
51
64
|
SelectLabel.displayName = "SelectLabel";
|
|
52
65
|
const SelectItem = (_a) => {
|
|
53
66
|
var { className, children } = _a, props = tslib_es6.__rest(_a, ["className", "children"]);
|
|
54
|
-
return (jsxRuntime.jsxs(index.Item, Object.assign({ "data-slot": "select-item", className: utils.cn(
|
|
67
|
+
return (jsxRuntime.jsxs(index.Item, Object.assign({ "data-slot": "select-item", className: utils.cn([
|
|
68
|
+
"data-[disabled]:pointer-events-none",
|
|
69
|
+
"data-[disabled]:opacity-50",
|
|
70
|
+
"*:[span]:last:flex",
|
|
71
|
+
"*:[span]:last:items-center",
|
|
72
|
+
"*:[span]:last:gap-2",
|
|
73
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
74
|
+
"non-interactive-inner-svg [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
75
|
+
], "relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none", className) }, props, { children: [jsxRuntime.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: jsxRuntime.jsx(index.ItemIndicator, { children: jsxRuntime.jsx(icon.Icon, { name: "check", className: "size-4" }) }) }), jsxRuntime.jsx(index.ItemText, { children: children })] })));
|
|
55
76
|
};
|
|
56
77
|
SelectItem.displayName = "SelectItem";
|
|
57
78
|
const SelectSeparator = (_a) => {
|
|
@@ -7,9 +7,9 @@ var index$1 = require('../../../node_modules/class-variance-authority/dist/index
|
|
|
7
7
|
var utils = require('../../../lib/utils.js');
|
|
8
8
|
|
|
9
9
|
const switchVariants = index$1.cva([
|
|
10
|
-
"peer inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all
|
|
10
|
+
"peer inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all",
|
|
11
11
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
12
|
-
"
|
|
12
|
+
"focusable",
|
|
13
13
|
"data-[state=checked]:bg-primary",
|
|
14
14
|
"data-[state=unchecked]:bg-input",
|
|
15
15
|
"dark:data-[state=unchecked]:bg-input/80",
|
|
@@ -43,8 +43,8 @@ const switchThumbVariants = index$1.cva([
|
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
const Switch = (_a) => {
|
|
46
|
-
var { className, thumbClassName, size } = _a, props = tslib_es6.__rest(_a, ["className", "thumbClassName", "size"]);
|
|
47
|
-
return (jsxRuntime.jsx(index.Root, Object.assign({ "data-slot": "switch", className: utils.cn(switchVariants({ size }), className) }, props, { children: jsxRuntime.jsx(index.Thumb, { "data-slot": "switch-thumb", className: utils.cn(switchThumbVariants({ size }), thumbClassName) }) })));
|
|
46
|
+
var { className, thumbClassName, size, onChange, onCheckedChange } = _a, props = tslib_es6.__rest(_a, ["className", "thumbClassName", "size", "onChange", "onCheckedChange"]);
|
|
47
|
+
return (jsxRuntime.jsx(index.Root, Object.assign({ "data-slot": "switch", className: utils.cn(switchVariants({ size }), className), onCheckedChange: onCheckedChange || onChange }, props, { children: jsxRuntime.jsx(index.Thumb, { "data-slot": "switch-thumb", className: utils.cn(switchThumbVariants({ size }), thumbClassName) }) })));
|
|
48
48
|
};
|
|
49
49
|
Switch.displayName = "Switch";
|
|
50
50
|
|
|
@@ -9,12 +9,11 @@ var utils = require('../../../lib/utils.js');
|
|
|
9
9
|
const textareaVariants = index.cva([
|
|
10
10
|
"flex w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs",
|
|
11
11
|
"min-h-16 field-sizing-content",
|
|
12
|
-
"transition-[color,box-shadow] outline-none",
|
|
13
12
|
"border-input dark:bg-input/30",
|
|
14
13
|
"placeholder:text-muted-foreground",
|
|
15
14
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
-
"
|
|
17
|
-
"aria-invalid
|
|
15
|
+
"focusable",
|
|
16
|
+
"aria-invalid-state",
|
|
18
17
|
"md:text-sm",
|
|
19
18
|
], {
|
|
20
19
|
variants: {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var index = require('../../../node_modules/@radix-ui/react-dialog/dist/index.js');
|
|
6
|
+
var iconClose = require('../shared/icon-close.js');
|
|
6
7
|
var utils = require('../../../lib/utils.js');
|
|
7
|
-
var icon = require('../../media/icon/icon.js');
|
|
8
8
|
|
|
9
9
|
const Dialog = (_a) => {
|
|
10
10
|
var props = tslib_es6.__rest(_a, []);
|
|
@@ -16,7 +16,7 @@ const DialogPortal = (_a) => {
|
|
|
16
16
|
};
|
|
17
17
|
const DialogTrigger = (_a) => {
|
|
18
18
|
var props = tslib_es6.__rest(_a, []);
|
|
19
|
-
return jsxRuntime.jsx(index.Trigger, Object.assign({ "data-slot": "dialog-
|
|
19
|
+
return jsxRuntime.jsx(index.Trigger, Object.assign({ "data-slot": "dialog-trigger" }, props));
|
|
20
20
|
};
|
|
21
21
|
const DialogClose = (_a) => {
|
|
22
22
|
var props = tslib_es6.__rest(_a, []);
|
|
@@ -24,23 +24,11 @@ const DialogClose = (_a) => {
|
|
|
24
24
|
};
|
|
25
25
|
const DialogOverlay = (_a) => {
|
|
26
26
|
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
27
|
-
return (jsxRuntime.jsx(index.Overlay, Object.assign({ "data-slot": "dialog-overlay", className: utils.cn("fixed inset-0 z-50 bg-black/50",
|
|
28
|
-
"data-[state=open]:animate-in",
|
|
29
|
-
"data-[state=open]:fade-in-0",
|
|
30
|
-
"data-[state=closed]:animate-out",
|
|
31
|
-
"data-[state=closed]:fade-out-0",
|
|
32
|
-
], className) }, props)));
|
|
27
|
+
return (jsxRuntime.jsx(index.Overlay, Object.assign({ "data-slot": "dialog-overlay", className: utils.cn("fixed inset-0 z-50 bg-black/50 overlay-appearance-animation", className) }, props)));
|
|
33
28
|
};
|
|
34
29
|
const DialogContent = (_a) => {
|
|
35
30
|
var { className, children } = _a, props = tslib_es6.__rest(_a, ["className", "children"]);
|
|
36
|
-
return (jsxRuntime.jsxs(DialogPortal, { children: [jsxRuntime.jsx(DialogOverlay, {}), jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "dialog-content", className: utils.cn("bg-background grid gap-4 w-full max-w-[calc(100%-2rem)] rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", "fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50", [
|
|
37
|
-
"data-[state=open]:animate-in",
|
|
38
|
-
"data-[state=open]:fade-in-0",
|
|
39
|
-
"data-[state=open]:zoom-in-95",
|
|
40
|
-
"data-[state=closed]:animate-out",
|
|
41
|
-
"data-[state=closed]:fade-out-0",
|
|
42
|
-
"data-[state=closed]:zoom-out-95",
|
|
43
|
-
], className) }, props, { children: [children, jsxRuntime.jsxs(index.Close, { className: utils.cn("ring-offset-background rounded-xs opacity-70 hover:opacity-100 transition-opacity disabled:pointer-events-none", "absolute top-4 right-4", "data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", "focus:ring-ring focus:ring-2 focus:ring-offset-2 focus:outline-hidden", ["[&_svg]:pointer-events-none", "[&_svg]:shrink-0", "[&_svg:not([class*='size-'])]:size-4"]), children: [jsxRuntime.jsx(icon.Icon, { name: "x", size: 16 }), jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })] })] }))] }));
|
|
31
|
+
return (jsxRuntime.jsxs(DialogPortal, { children: [jsxRuntime.jsx(DialogOverlay, {}), jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "dialog-content", className: utils.cn("bg-background grid gap-4 w-full max-w-[calc(100%-2rem)] rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", "fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] z-50", "overlay-appearance-animation overlay-zoom-animation", className) }, props, { children: [children, jsxRuntime.jsx(index.Close, { className: "data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", asChild: true, children: jsxRuntime.jsx(iconClose.IconClose, {}) })] }))] }));
|
|
44
32
|
};
|
|
45
33
|
const DialogHeader = (_a) => {
|
|
46
34
|
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
@@ -13,18 +13,17 @@ const DrawerPortal = (_a) => {
|
|
|
13
13
|
var props = tslib_es6.__rest(_a, []);
|
|
14
14
|
return jsxRuntime.jsx(index.Drawer.Portal, Object.assign({ "data-slot": "drawer-portal" }, props));
|
|
15
15
|
};
|
|
16
|
+
const DrawerTrigger = (_a) => {
|
|
17
|
+
var props = tslib_es6.__rest(_a, []);
|
|
18
|
+
return jsxRuntime.jsx(index.Drawer.Trigger, Object.assign({ "data-slot": "drawer-trigger" }, props));
|
|
19
|
+
};
|
|
16
20
|
const DrawerClose = (_a) => {
|
|
17
21
|
var props = tslib_es6.__rest(_a, []);
|
|
18
22
|
return jsxRuntime.jsx(index.Drawer.Close, Object.assign({ "data-slot": "drawer-close" }, props));
|
|
19
23
|
};
|
|
20
24
|
const DrawerOverlay = (_a) => {
|
|
21
25
|
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
22
|
-
return (jsxRuntime.jsx(index.Drawer.Overlay, Object.assign({ "data-slot": "drawer-overlay", className: utils.cn("fixed inset-0 z-50 bg-black/50",
|
|
23
|
-
"data-[state=open]:animate-in",
|
|
24
|
-
"data-[state=open]:fade-in-0",
|
|
25
|
-
"data-[state=closed]:animate-out",
|
|
26
|
-
"data-[state=closed]:fade-out-0",
|
|
27
|
-
], className) }, props)));
|
|
26
|
+
return (jsxRuntime.jsx(index.Drawer.Overlay, Object.assign({ "data-slot": "drawer-overlay", className: utils.cn("fixed inset-0 z-50 bg-black/50 overlay-appearance-animation", className) }, props)));
|
|
28
27
|
};
|
|
29
28
|
const DrawerContent = (_a) => {
|
|
30
29
|
var { children, className } = _a, props = tslib_es6.__rest(_a, ["children", "className"]);
|
|
@@ -80,3 +79,4 @@ exports.DrawerDescription = DrawerDescription;
|
|
|
80
79
|
exports.DrawerFooter = DrawerFooter;
|
|
81
80
|
exports.DrawerHeader = DrawerHeader;
|
|
82
81
|
exports.DrawerTitle = DrawerTitle;
|
|
82
|
+
exports.DrawerTrigger = DrawerTrigger;
|
|
@@ -4,12 +4,15 @@ var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var index = require('../../../node_modules/@radix-ui/react-popover/dist/index.js');
|
|
6
6
|
var index$1 = require('../../../node_modules/class-variance-authority/dist/index.js');
|
|
7
|
+
var iconClose = require('../shared/icon-close.js');
|
|
7
8
|
var utils = require('../../../lib/utils.js');
|
|
8
|
-
var icon = require('../../media/icon/icon.js');
|
|
9
9
|
|
|
10
10
|
const popoverContentVariants = index$1.cva([
|
|
11
11
|
"bg-popover text-popover-foreground z-50 w-72 rounded-md border p-4 shadow-md outline-hidden",
|
|
12
12
|
"origin-(--radix-popover-content-transform-origin)",
|
|
13
|
+
"overlay-appearance-animation",
|
|
14
|
+
"overlay-zoom-animation",
|
|
15
|
+
"overlay-slide-animation",
|
|
13
16
|
], {
|
|
14
17
|
variants: {
|
|
15
18
|
size: {
|
|
@@ -33,12 +36,6 @@ const popoverContentVariants = index$1.cva([
|
|
|
33
36
|
size: "default",
|
|
34
37
|
},
|
|
35
38
|
});
|
|
36
|
-
const popoverCloseVariants = index$1.cva([
|
|
37
|
-
"ring-offset-background rounded-xs opacity-70 hover:opacity-100 transition-opacity",
|
|
38
|
-
"disabled:pointer-events-none",
|
|
39
|
-
"absolute top-4 right-4",
|
|
40
|
-
"focus:ring-ring focus:ring-2 focus:ring-offset-2 focus:outline-hidden",
|
|
41
|
-
]);
|
|
42
39
|
const Popover = (_a) => {
|
|
43
40
|
var props = tslib_es6.__rest(_a, []);
|
|
44
41
|
return jsxRuntime.jsx(index.Root, Object.assign({ "data-slot": "popover" }, props));
|
|
@@ -49,18 +46,7 @@ const PopoverTrigger = (_a) => {
|
|
|
49
46
|
};
|
|
50
47
|
const PopoverContent = (_a) => {
|
|
51
48
|
var { className, align = "center", arrow = false, withClose = false, sideOffset = 4, size, matchTriggerWidth = false, children } = _a, props = tslib_es6.__rest(_a, ["className", "align", "arrow", "withClose", "sideOffset", "size", "matchTriggerWidth", "children"]);
|
|
52
|
-
return (jsxRuntime.jsx(index.Portal, { children: jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: utils.cn(popoverContentVariants({ size, matchTriggerWidth }), [
|
|
53
|
-
"data-[state=open]:animate-in",
|
|
54
|
-
"data-[state=open]:fade-in-0",
|
|
55
|
-
"data-[state=open]:zoom-in-95",
|
|
56
|
-
"data-[state=closed]:animate-out",
|
|
57
|
-
"data-[state=closed]:fade-out-0",
|
|
58
|
-
"data-[state=closed]:zoom-out-95",
|
|
59
|
-
"data-[side=top]:slide-in-from-bottom-2",
|
|
60
|
-
"data-[side=right]:slide-in-from-left-2",
|
|
61
|
-
"data-[side=bottom]:slide-in-from-top-2",
|
|
62
|
-
"data-[side=left]:slide-in-from-right-2",
|
|
63
|
-
], className) }, props, { children: [children, withClose && (jsxRuntime.jsx(index.Close, { className: utils.cn(popoverCloseVariants), "aria-label": "Close", children: jsxRuntime.jsx(icon.Icon, { name: "x", size: 16 }) })), arrow && jsxRuntime.jsx(index.Arrow, { className: "fill-popover" })] })) }));
|
|
49
|
+
return (jsxRuntime.jsx(index.Portal, { children: jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: utils.cn(popoverContentVariants({ size, matchTriggerWidth }), className) }, props, { children: [children, withClose && (jsxRuntime.jsx(index.Close, { asChild: true, children: jsxRuntime.jsx(iconClose.IconClose, {}) })), arrow && jsxRuntime.jsx(index.Arrow, { className: "fill-popover" })] })) }));
|
|
64
50
|
};
|
|
65
51
|
const PopoverAnchor = (_a) => {
|
|
66
52
|
var props = tslib_es6.__rest(_a, []);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var icon = require('../../media/icon/icon.js');
|
|
6
|
+
var utils = require('../../../lib/utils.js');
|
|
7
|
+
|
|
8
|
+
const IconClose = (_a) => {
|
|
9
|
+
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
10
|
+
return (jsxRuntime.jsx(icon.Icon, Object.assign({ name: "x", size: 16, className: utils.cn("absolute top-4 right-4", "focusable disabled:pointer-events-none ring-offset-background rounded-xs", "opacity-70 hover:opacity-100 transition-opacity", className), "aria-label": "Close" }, props)));
|
|
11
|
+
};
|
|
12
|
+
IconClose.displayName = "IconClose";
|
|
13
|
+
|
|
14
|
+
exports.IconClose = IconClose;
|
|
@@ -4,8 +4,8 @@ var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var index = require('../../../node_modules/@radix-ui/react-dialog/dist/index.js');
|
|
6
6
|
var index$1 = require('../../../node_modules/class-variance-authority/dist/index.js');
|
|
7
|
+
var iconClose = require('../shared/icon-close.js');
|
|
7
8
|
var utils = require('../../../lib/utils.js');
|
|
8
|
-
var icon = require('../../media/icon/icon.js');
|
|
9
9
|
|
|
10
10
|
const Sheet = (_a) => {
|
|
11
11
|
var props = tslib_es6.__rest(_a, []);
|
|
@@ -15,18 +15,17 @@ const SheetPortal = (_a) => {
|
|
|
15
15
|
var props = tslib_es6.__rest(_a, []);
|
|
16
16
|
return jsxRuntime.jsx(index.Portal, Object.assign({ "data-slot": "sheet-portal" }, props));
|
|
17
17
|
};
|
|
18
|
+
const SheetTrigger = (_a) => {
|
|
19
|
+
var props = tslib_es6.__rest(_a, []);
|
|
20
|
+
return jsxRuntime.jsx(index.Trigger, Object.assign({ "data-slot": "sheet-trigger" }, props));
|
|
21
|
+
};
|
|
18
22
|
const SheetClose = (_a) => {
|
|
19
23
|
var props = tslib_es6.__rest(_a, []);
|
|
20
24
|
return jsxRuntime.jsx(index.Close, Object.assign({ "data-slot": "sheet-close" }, props));
|
|
21
25
|
};
|
|
22
26
|
const SheetOverlay = (_a) => {
|
|
23
27
|
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
24
|
-
return (jsxRuntime.jsx(index.Overlay, Object.assign({ "data-slot": "sheet-overlay", className: utils.cn("fixed inset-0 z-50 bg-black/50",
|
|
25
|
-
"data-[state=open]:animate-in",
|
|
26
|
-
"data-[state=open]:fade-in-0",
|
|
27
|
-
"data-[state=closed]:animate-out",
|
|
28
|
-
"data-[state=closed]:fade-out-0",
|
|
29
|
-
], className) }, props)));
|
|
28
|
+
return (jsxRuntime.jsx(index.Overlay, Object.assign({ "data-slot": "sheet-overlay", className: utils.cn("fixed inset-0 z-50 bg-black/50 overlay-appearance-animation", className) }, props)));
|
|
30
29
|
};
|
|
31
30
|
const contentVariants = index$1.cva([
|
|
32
31
|
"bg-background fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out",
|
|
@@ -57,16 +56,9 @@ const contentVariants = index$1.cva([
|
|
|
57
56
|
side: "right",
|
|
58
57
|
},
|
|
59
58
|
});
|
|
60
|
-
const closeVariants = index$1.cva([
|
|
61
|
-
"ring-offset-background absolute top-4 right-4 rounded-xs",
|
|
62
|
-
"opacity-70 transition-opacity hover:opacity-100",
|
|
63
|
-
"disabled:pointer-events-none",
|
|
64
|
-
"data-[state=open]:bg-secondary",
|
|
65
|
-
"focus:ring-ring focus:ring-2 focus:ring-offset-2 focus:outline-hidden",
|
|
66
|
-
]);
|
|
67
59
|
const SheetContent = (_a) => {
|
|
68
60
|
var { className, children, side = "right" } = _a, props = tslib_es6.__rest(_a, ["className", "children", "side"]);
|
|
69
|
-
return (jsxRuntime.jsxs(SheetPortal, { children: [jsxRuntime.jsx(SheetOverlay, {}), jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "sheet-content", className: utils.cn(contentVariants({ side }), className) }, props, { children: [children, jsxRuntime.
|
|
61
|
+
return (jsxRuntime.jsxs(SheetPortal, { children: [jsxRuntime.jsx(SheetOverlay, {}), jsxRuntime.jsxs(index.Content, Object.assign({ "data-slot": "sheet-content", className: utils.cn(contentVariants({ side }), className) }, props, { children: [children, jsxRuntime.jsx(index.Close, { className: "data-[state=open]:bg-secondary", asChild: true, children: jsxRuntime.jsx(iconClose.IconClose, {}) })] }))] }));
|
|
70
62
|
};
|
|
71
63
|
const SheetHeader = (_a) => {
|
|
72
64
|
var { className } = _a, props = tslib_es6.__rest(_a, ["className"]);
|
|
@@ -92,3 +84,4 @@ exports.SheetDescription = SheetDescription;
|
|
|
92
84
|
exports.SheetFooter = SheetFooter;
|
|
93
85
|
exports.SheetHeader = SheetHeader;
|
|
94
86
|
exports.SheetTitle = SheetTitle;
|
|
87
|
+
exports.SheetTrigger = SheetTrigger;
|