tw-react-components 0.0.161 → 0.0.164
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/index.esm.js +206 -219
- package/package.json +1 -1
- package/src/components/Badge/index.d.ts +2 -3
- package/src/components/Block/index.d.ts +4 -10
- package/src/components/Button/index.d.ts +3 -11
- package/src/components/Card/index.d.ts +3 -7
- package/src/components/Dialog/Dialog.d.ts +5 -5
- package/src/components/DropdownMenu/index.d.ts +18 -17
- package/src/components/Flex/index.d.ts +2 -13
- package/src/components/Form/controls/custom/date-time/index.d.ts +3 -12
- package/src/components/Form/controls/custom/file.d.ts +2 -5
- package/src/components/Form/controls/custom/select/index.d.ts +4 -8
- package/src/components/Form/controls/primitive/BasicInput.d.ts +2 -14
- package/src/components/Form/controls/primitive/CheckBoxInput.d.ts +2 -1
- package/src/components/Form/controls/primitive/EmailInput.d.ts +2 -1
- package/src/components/Form/controls/primitive/NumberInput.d.ts +2 -4
- package/src/components/Form/controls/primitive/PasswordInput.d.ts +2 -1
- package/src/components/Form/controls/primitive/TextInput.d.ts +2 -1
- package/src/components/Form/controls/primitive/TextareaInput.d.ts +2 -1
- package/src/components/Form/controls/with-form.d.ts +11 -47
- package/src/components/Hint/index.d.ts +7 -9
- package/src/components/List/index.d.ts +12 -10
- package/src/components/Popover/index.d.ts +4 -3
- package/src/components/Separator/index.d.ts +2 -1
- package/src/components/Sheet/index.d.ts +6 -6
- package/src/components/Sidebar/index.d.ts +35 -35
- package/src/components/Switch/index.d.ts +3 -5
- package/src/components/Tabs/index.d.ts +4 -3
- package/src/helpers/index.d.ts +0 -1
- package/src/hooks/useOnSwipe.d.ts +1 -1
- package/src/hooks/useOutsideClick.d.ts +1 -1
- package/src/helpers/mergeRefs.d.ts +0 -2
package/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useMemo, useState, useEffect, useId, useCallback, useRef, createContext, useContext } from 'react';
|
|
3
2
|
import { clsx } from 'clsx';
|
|
4
3
|
import { twMerge } from 'tailwind-merge';
|
|
5
4
|
import dayjs from 'dayjs';
|
|
6
5
|
import advancedFormat from 'dayjs/plugin/advancedFormat.js';
|
|
7
6
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
8
7
|
import { HelpCircle, XIcon, AtSignIcon, EyeIcon, EyeOffIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronDownIcon, CalendarIcon, ClockIcon, CheckIcon, CircleIcon, CloudUploadIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, ArrowUpDownIcon, SortAscIcon, SortDescIcon, MinusIcon, PlusIcon, PanelLeft, MoonIcon, SunIcon, MonitorIcon } from 'lucide-react';
|
|
8
|
+
import { useMemo, useState, useEffect, useId, useCallback, useRef, createContext, useContext } from 'react';
|
|
9
9
|
import localeData from 'dayjs/plugin/localeData.js';
|
|
10
10
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
11
11
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -115,19 +115,6 @@ function isEmpty(s) {
|
|
|
115
115
|
return [null, undefined, ''].includes(s);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
function mergeRefs(refs) {
|
|
119
|
-
return (value) => {
|
|
120
|
-
refs.forEach((ref) => {
|
|
121
|
-
if (typeof ref === 'function') {
|
|
122
|
-
ref(value);
|
|
123
|
-
}
|
|
124
|
-
else if (ref != null) {
|
|
125
|
-
ref.current = value;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
118
|
function resolveTargetObject(payload, fieldChain, defaultValue) {
|
|
132
119
|
if (!fieldChain.length) {
|
|
133
120
|
return payload === null ? payload : payload || defaultValue;
|
|
@@ -573,29 +560,29 @@ const sizeClassNames = {
|
|
|
573
560
|
},
|
|
574
561
|
},
|
|
575
562
|
};
|
|
576
|
-
const Button =
|
|
563
|
+
const Button = (_a) => {
|
|
577
564
|
var { children, className, size = 'medium', color = 'slate', variant = 'filled', rounded, prefixIcon: PrefixIcon, suffixIcon: SuffixIcon, unstyled } = _a, props = __rest(_a, ["children", "className", "size", "color", "variant", "rounded", "prefixIcon", "suffixIcon", "unstyled"]);
|
|
578
565
|
return (jsxs("button", Object.assign({ className: cn('relative flex aspect-square items-center font-medium duration-200', sizeClassNames[size].base, variantClassNames[variant][color].base, rounded ? 'rounded-full' : 'rounded-md', props.disabled
|
|
579
566
|
? 'cursor-not-allowed opacity-50'
|
|
580
567
|
: !unstyled
|
|
581
568
|
? `${variantClassNames[variant][color].hover} ${variantClassNames[variant][color].focus} ${variantClassNames[variant][color].active}`
|
|
582
|
-
: 'cursor-default', children ? `${sizeClassNames[size].withChildren} aspect-[initial]` : 'justify-center', className), type: "button" }, props, {
|
|
583
|
-
}
|
|
569
|
+
: 'cursor-default', children ? `${sizeClassNames[size].withChildren} aspect-[initial]` : 'justify-center', className), type: "button" }, props, { children: [PrefixIcon && (jsx(PrefixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base })), children, SuffixIcon && (jsx(SuffixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base }))] })));
|
|
570
|
+
};
|
|
584
571
|
|
|
585
|
-
const Badge =
|
|
572
|
+
const Badge = (_a) => {
|
|
586
573
|
var { size = 'small' } = _a, props = __rest(_a, ["size"]);
|
|
587
|
-
return jsx(Button, Object.assign({ size: size }, props
|
|
588
|
-
}
|
|
574
|
+
return (jsx(Button, Object.assign({ size: size }, props)));
|
|
575
|
+
};
|
|
589
576
|
|
|
590
|
-
const Block =
|
|
577
|
+
const Block = (_a) => {
|
|
591
578
|
var { children, className, centered, container, fullWidth, fullHeight } = _a, props = __rest(_a, ["children", "className", "centered", "container", "fullWidth", "fullHeight"]);
|
|
592
|
-
return (jsx("div", Object.assign({ className: cn(centered && 'mx-auto', container && 'container', fullWidth && 'w-full', fullHeight && 'h-full', className) }, props, {
|
|
593
|
-
}
|
|
579
|
+
return (jsx("div", Object.assign({ className: cn(centered && 'mx-auto', container && 'container', fullWidth && 'w-full', fullHeight && 'h-full', className) }, props, { children: children })));
|
|
580
|
+
};
|
|
594
581
|
|
|
595
|
-
const Card =
|
|
582
|
+
const Card = (_a) => {
|
|
596
583
|
var { children, className } = _a, blockProps = __rest(_a, ["children", "className"]);
|
|
597
|
-
return (jsx(Block, Object.assign({ className: cn('rounded-lg border p-2 dark:border-slate-700 dark:bg-slate-900', className) }, blockProps, {
|
|
598
|
-
}
|
|
584
|
+
return (jsx(Block, Object.assign({ className: cn('rounded-lg border p-2 dark:border-slate-700 dark:bg-slate-900', className) }, blockProps, { children: children })));
|
|
585
|
+
};
|
|
599
586
|
|
|
600
587
|
const $Collapsible = CollapsiblePrimitive.Root;
|
|
601
588
|
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
@@ -626,10 +613,10 @@ const justifyClasses = {
|
|
|
626
613
|
between: 'justify-between',
|
|
627
614
|
end: 'justify-end',
|
|
628
615
|
};
|
|
629
|
-
const Flex =
|
|
616
|
+
const Flex = (_a) => {
|
|
630
617
|
var { children, className, reverse, wrap, direction = 'row', align = 'start', justify = 'start' } = _a, blockProps = __rest(_a, ["children", "className", "reverse", "wrap", "direction", "align", "justify"]);
|
|
631
|
-
return (jsx(Block, Object.assign({ className: cn('flex gap-2', wrap && 'flex-wrap', directionClasses[direction][reverse ? 'reverse' : 'normal'], alignClasses[align], justifyClasses[justify], className) }, blockProps, {
|
|
632
|
-
}
|
|
618
|
+
return (jsx(Block, Object.assign({ className: cn('flex gap-2', wrap && 'flex-wrap', directionClasses[direction][reverse ? 'reverse' : 'normal'], alignClasses[align], justifyClasses[justify], className) }, blockProps, { children: children })));
|
|
619
|
+
};
|
|
633
620
|
|
|
634
621
|
dayjs.extend(localeData);
|
|
635
622
|
function useDays(locale = 'en') {
|
|
@@ -836,7 +823,7 @@ const sizeClasses = {
|
|
|
836
823
|
},
|
|
837
824
|
},
|
|
838
825
|
};
|
|
839
|
-
const BasicInput =
|
|
826
|
+
const BasicInput = (_a) => {
|
|
840
827
|
var { className, inputClassName, extensionClassName, type = 'text', label, description, size = 'medium', hasErrors, clearable, suffixIcon: SuffixIcon, onClear, onSuffixIconClick } = _a, props = __rest(_a, ["className", "inputClassName", "extensionClassName", "type", "label", "description", "size", "hasErrors", "clearable", "suffixIcon", "onClear", "onSuffixIconClick"]);
|
|
841
828
|
const id = useId();
|
|
842
829
|
const memoLabel = useMemo(() => label && (jsx(Label, { className: sizeClasses[size].label, htmlFor: id, description: description, required: props.required, hasErrors: hasErrors, children: label })), [description, hasErrors, id, label, props.required, size]);
|
|
@@ -854,18 +841,18 @@ const BasicInput = forwardRef(function BasicInput(_a, ref) {
|
|
|
854
841
|
[inputClasses.withoutErrors.input]: !hasErrors,
|
|
855
842
|
[inputClasses.withErrors.input]: hasErrors,
|
|
856
843
|
'rounded-r-none border-r-0': SuffixIcon,
|
|
857
|
-
}, inputClassName) }, props, { value: props.value
|
|
844
|
+
}, inputClassName) }, props, { value: props.value }))) : type === 'checkbox' ? (jsx("input", Object.assign({ id: id, className: cn('rounded border-slate-300 text-blue-600', sizeClasses[size].checkbox.input, {
|
|
858
845
|
[inputClasses.base.disabled]: props.disabled,
|
|
859
846
|
'bg-red-100': hasErrors,
|
|
860
|
-
}, inputClassName), type: type, checked: Boolean(props.value) }, props
|
|
847
|
+
}, inputClassName), type: type, checked: Boolean(props.value) }, props))) : (jsx("input", Object.assign({ id: id, className: cn(inputClasses.base.input, sizeClasses[size].input, {
|
|
861
848
|
[inputClasses.base.disabled]: props.disabled,
|
|
862
849
|
[inputClasses.withoutErrors.input]: !hasErrors,
|
|
863
850
|
[inputClasses.withErrors.input]: hasErrors,
|
|
864
851
|
'rounded-r-none border-r-0': SuffixIcon,
|
|
865
|
-
}, inputClassName), type: type !== null && type !== void 0 ? type : 'text' }, props, { value: props.value
|
|
852
|
+
}, inputClassName), type: type !== null && type !== void 0 ? type : 'text' }, props, { value: props.value }))), type === 'checkbox' && memoLabel, clearable && (onClear || !!props.value) && !props.disabled && (jsx(XIcon, { className: cn('absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full bg-white p-0.5 opacity-0 duration-200 hover:bg-slate-200 group-hover:opacity-100 dark:bg-slate-700 dark:hover:bg-slate-800', sizeClasses[size].clearButton.base, {
|
|
866
853
|
[sizeClasses[size].clearButton.withSuffixIcon]: SuffixIcon,
|
|
867
854
|
}), onClick: handleClear, onPointerDown: (event) => event.stopPropagation() })), type !== 'checkbox' && SuffixIcon && (jsx(BasicInputExtension, { className: extensionClassName, hasErrors: hasErrors, size: size, disabled: props.disabled, onClick: onSuffixIconClick, children: jsx(SuffixIcon, { className: sizeClasses[size].suffix.icon }) }))] })] }));
|
|
868
|
-
}
|
|
855
|
+
};
|
|
869
856
|
const BasicInputExtension = ({ children, className, size, hasErrors, disabled, onClick }) => (jsx("div", { className: cn('flex aspect-square items-center justify-center rounded-r-md border border-l-0', sizeClasses[size].suffix.wrapper, {
|
|
870
857
|
[inputClasses.base.disabled]: disabled,
|
|
871
858
|
[inputClasses.withoutErrors.extension]: !hasErrors,
|
|
@@ -873,26 +860,26 @@ const BasicInputExtension = ({ children, className, size, hasErrors, disabled, o
|
|
|
873
860
|
'cursor-pointer': onClick,
|
|
874
861
|
}, className), onClick: !disabled ? onClick : undefined, onPointerDown: (event) => event.stopPropagation(), children: children }));
|
|
875
862
|
|
|
876
|
-
const CheckboxInput =
|
|
863
|
+
const CheckboxInput = (props) => (jsx(BasicInput, Object.assign({ type: "checkbox" }, props)));
|
|
877
864
|
|
|
878
|
-
const EmailInput =
|
|
865
|
+
const EmailInput = (props) => (jsx(BasicInput, Object.assign({ type: "email" }, props, { suffixIcon: AtSignIcon })));
|
|
879
866
|
|
|
880
|
-
const NumberInput =
|
|
867
|
+
const NumberInput = (_a) => {
|
|
881
868
|
var { unit } = _a, props = __rest(_a, ["unit"]);
|
|
882
869
|
return (jsx(BasicInput, Object.assign({ type: "number", inputClassName: cn(props.clearable && !!props.value && 'pr-8', props.className) }, props, { suffixIcon: unit
|
|
883
870
|
? ({ className }) => (jsx("div", { className: cn(className, 'flex w-min items-center'), onClick: props.onSuffixIconClick, children: unit }))
|
|
884
|
-
: props.suffixIcon
|
|
885
|
-
}
|
|
871
|
+
: props.suffixIcon })));
|
|
872
|
+
};
|
|
886
873
|
|
|
887
|
-
const PasswordInput =
|
|
874
|
+
const PasswordInput = (props) => {
|
|
888
875
|
const [type, setType] = useState('password');
|
|
889
876
|
const toggleType = () => setType((type) => (type === 'text' ? 'password' : 'text'));
|
|
890
|
-
return (jsx(BasicInput, Object.assign({ type: type }, props, { suffixIcon: type === 'password' ? EyeIcon : EyeOffIcon, onSuffixIconClick: toggleType
|
|
891
|
-
}
|
|
877
|
+
return (jsx(BasicInput, Object.assign({ type: type }, props, { suffixIcon: type === 'password' ? EyeIcon : EyeOffIcon, onSuffixIconClick: toggleType })));
|
|
878
|
+
};
|
|
892
879
|
|
|
893
|
-
const TextareaInput =
|
|
880
|
+
const TextareaInput = (props) => (jsx(BasicInput, Object.assign({ type: "textarea" }, props)));
|
|
894
881
|
|
|
895
|
-
const TextInput =
|
|
882
|
+
const TextInput = (props) => jsx(BasicInput, Object.assign({ type: "text" }, props));
|
|
896
883
|
|
|
897
884
|
const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDate, }) => {
|
|
898
885
|
const days = useDays(locale);
|
|
@@ -1084,8 +1071,8 @@ const TimeSelector = ({ date, step = 1, minDate, maxDate, setNewDate, }) => {
|
|
|
1084
1071
|
return (jsxs(Fragment, { children: [jsx("label", { className: "text-sm text-slate-700 dark:text-slate-300", children: "Time" }), jsxs("div", { className: "flex flex-grow justify-center gap-2", children: [jsxs("div", { className: "flex flex-col items-center justify-center", children: [jsx(ChevronUpIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('hours', 1) }, increaseHours)), jsx(ChevronDownIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('hours', -1) }, decreaseHours))] }), jsxs("div", { className: "flex items-center rounded-lg border border-slate-100 bg-slate-100 text-right dark:border-slate-700 dark:bg-slate-800", children: [jsx("span", { className: "flex px-2", onWheel: onWheel('hours'), children: date.getHours().toString().padStart(2, '0') }), jsx("span", { children: ":" }), jsx("span", { className: "flex px-2", onWheel: onWheel('minutes'), children: date.getMinutes().toString().padStart(2, '0') })] }), jsxs("div", { className: "flex flex-col items-center justify-center", children: [jsx(ChevronUpIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('minutes', step) }, increaseMinutes)), jsx(ChevronDownIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('minutes', -step) }, decreaseMinutes))] })] })] }));
|
|
1085
1072
|
};
|
|
1086
1073
|
|
|
1087
|
-
const DateTimeInput =
|
|
1088
|
-
var { className, value, clearable, type = 'datetime-local', step = 1, minDate, maxDate, hasErrors, onChange, onBlur, displayFormat = 'dddd, MMMM Do YYYY, HH:mm:ss', displayLocale = 'en' } = _a, props = __rest(_a, ["className", "value", "clearable", "type", "step", "minDate", "maxDate", "hasErrors", "onChange", "onBlur", "displayFormat", "displayLocale"]);
|
|
1074
|
+
const DateTimeInput = (_a) => {
|
|
1075
|
+
var { className, value, clearable, type = 'datetime-local', step = 1, minDate, maxDate, hasErrors, onChange, onBlur, displayFormat = 'dddd, MMMM Do YYYY, HH:mm:ss', displayLocale = 'en', ref } = _a, props = __rest(_a, ["className", "value", "clearable", "type", "step", "minDate", "maxDate", "hasErrors", "onChange", "onBlur", "displayFormat", "displayLocale", "ref"]);
|
|
1089
1076
|
const [isOpen, setIsOpen] = useState();
|
|
1090
1077
|
const [calendarView, setCalendarView] = useState('days');
|
|
1091
1078
|
const date = useMemo(() => {
|
|
@@ -1138,33 +1125,33 @@ const DateTimeInput = forwardRef((_a, ref) => {
|
|
|
1138
1125
|
}
|
|
1139
1126
|
};
|
|
1140
1127
|
return (jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsx(BasicInput, Object.assign({}, props, { type: "text", readOnly: true, value: displayDate !== null && displayDate !== void 0 ? displayDate : '', hasErrors: hasErrors, onClick: handleOnClick, onKeyUp: handleOnKeyUp, clearable: clearable && !!displayDate, onClear: clearDate, suffixIcon: (type === null || type === void 0 ? void 0 : type.includes('date')) ? CalendarIcon : ClockIcon, onSuffixIconClick: handleOnClick })), isOpen && (jsxs("div", { className: "absolute z-20 mt-2 flex origin-top-left flex-col rounded-md border bg-white shadow duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-white", tabIndex: 0, onBlur: handleOnBlur, ref: calendarRef, children: [(type === null || type === void 0 ? void 0 : type.includes('date')) && (jsx(DateSelector, { date: date, value: value, minDate: minDate, maxDate: maxDate, locale: displayLocale, calendarView: calendarView, setCalendarView: setCalendarView, setNewDate: setNewDate })), calendarView === 'days' && (jsxs("div", { className: "flex select-none items-center justify-end gap-2 px-3 py-2", children: [(type === null || type === void 0 ? void 0 : type.includes('time')) && (jsx(TimeSelector, { date: date, step: step, minDate: minDate, maxDate: maxDate, setNewDate: setNewDate })), jsx("div", { className: "cursor-pointer rounded-lg border border-transparent p-1 text-sm font-bold uppercase text-blue-600 transition duration-100 ease-in-out hover:bg-slate-100 dark:text-blue-500 dark:hover:bg-slate-700", onClick: () => setIsOpen(false), children: "OK" })] }))] }))] }));
|
|
1141
|
-
}
|
|
1128
|
+
};
|
|
1142
1129
|
|
|
1143
|
-
const ListContent =
|
|
1130
|
+
const ListContent = (_a) => {
|
|
1144
1131
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1145
|
-
return (jsx(Block, Object.assign({ className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-100 bg-white p-1 text-slate-700 shadow-md dark:border-slate-700 dark:bg-slate-900 dark:text-white', className)
|
|
1146
|
-
}
|
|
1132
|
+
return (jsx(Block, Object.assign({ className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-100 bg-white p-1 text-slate-700 shadow-md dark:border-slate-700 dark:bg-slate-900 dark:text-white', className) }, props)));
|
|
1133
|
+
};
|
|
1147
1134
|
const labelSizeClasses = {
|
|
1148
1135
|
small: 'p-1 text-sm',
|
|
1149
1136
|
medium: 'px-2 py-1.5',
|
|
1150
1137
|
};
|
|
1151
|
-
const ListItem =
|
|
1138
|
+
const ListItem = (_a) => {
|
|
1152
1139
|
var { className, size = 'medium', inset } = _a, props = __rest(_a, ["className", "size", "inset"]);
|
|
1153
|
-
return (jsx(Flex, Object.assign({ className: cn(labelSizeClasses[size], 'relative cursor-default select-none gap-2 rounded-md outline-none focus:bg-slate-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-700', inset && 'pl-8', className), align: "center"
|
|
1154
|
-
}
|
|
1155
|
-
const ListLabel =
|
|
1140
|
+
return (jsx(Flex, Object.assign({ className: cn(labelSizeClasses[size], 'relative cursor-default select-none gap-2 rounded-md outline-none focus:bg-slate-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-700', inset && 'pl-8', className), align: "center" }, props)));
|
|
1141
|
+
};
|
|
1142
|
+
const ListLabel = (_a) => {
|
|
1156
1143
|
var { className, size = 'medium', inset } = _a, props = __rest(_a, ["className", "size", "inset"]);
|
|
1157
|
-
return (jsx(Block, Object.assign({ className: cn(labelSizeClasses[size], 'font-semibold text-slate-900 dark:text-slate-300', inset && 'pl-8', className)
|
|
1158
|
-
}
|
|
1159
|
-
const ListIndicator =
|
|
1144
|
+
return (jsx(Block, Object.assign({ className: cn(labelSizeClasses[size], 'font-semibold text-slate-900 dark:text-slate-300', inset && 'pl-8', className) }, props)));
|
|
1145
|
+
};
|
|
1146
|
+
const ListIndicator = (_a) => {
|
|
1160
1147
|
var { className, icon: Icon, iconClassName } = _a, props = __rest(_a, ["className", "icon", "iconClassName"]);
|
|
1161
|
-
return (jsx(Flex, Object.assign({ className: cn('absolute left-2 h-3.5 w-3.5', className), align: "center", justify: "center"
|
|
1162
|
-
}
|
|
1163
|
-
const ListIcon =
|
|
1164
|
-
const ListSeparator =
|
|
1148
|
+
return (jsx(Flex, Object.assign({ className: cn('absolute left-2 h-3.5 w-3.5', className), align: "center", justify: "center" }, props, { children: jsx(Icon, { className: iconClassName }) })));
|
|
1149
|
+
};
|
|
1150
|
+
const ListIcon = ({ className, icon: Icon, ref, }) => jsx(Icon, { className: cn('h-4 w-4', className), ref: ref });
|
|
1151
|
+
const ListSeparator = (_a) => {
|
|
1165
1152
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1166
|
-
return (jsx(Block, Object.assign({ className: cn('-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-700', className)
|
|
1167
|
-
}
|
|
1153
|
+
return (jsx(Block, Object.assign({ className: cn('-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-700', className) }, props)));
|
|
1154
|
+
};
|
|
1168
1155
|
const List = Object.assign(ListContent, {
|
|
1169
1156
|
Item: ListItem,
|
|
1170
1157
|
Label: ListLabel,
|
|
@@ -1178,45 +1165,45 @@ const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
|
1178
1165
|
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
1179
1166
|
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
1180
1167
|
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
1181
|
-
const DropdownMenuSubTrigger =
|
|
1168
|
+
const DropdownMenuSubTrigger = (_a) => {
|
|
1182
1169
|
var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
|
|
1183
|
-
return (jsx(DropdownMenuPrimitive.SubTrigger, Object.assign({
|
|
1184
|
-
}
|
|
1170
|
+
return (jsx(DropdownMenuPrimitive.SubTrigger, Object.assign({}, props, { asChild: true, children: jsxs(List.Item, { className: className, inset: inset, children: [children, jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })] }) })));
|
|
1171
|
+
};
|
|
1185
1172
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
1186
|
-
const DropdownMenuSubContent =
|
|
1173
|
+
const DropdownMenuSubContent = (_a) => {
|
|
1187
1174
|
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
1188
|
-
return (jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.SubContent, Object.assign({
|
|
1189
|
-
}
|
|
1175
|
+
return (jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.SubContent, Object.assign({}, props, { asChild: true, children: jsx(List, { className: className, children: children }) })) }));
|
|
1176
|
+
};
|
|
1190
1177
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
1191
|
-
const DropdownMenuContent =
|
|
1178
|
+
const DropdownMenuContent = (_a) => {
|
|
1192
1179
|
var { className, children, sideOffset = 4 } = _a, props = __rest(_a, ["className", "children", "sideOffset"]);
|
|
1193
|
-
return (jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.Content, Object.assign({
|
|
1194
|
-
}
|
|
1180
|
+
return (jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.Content, Object.assign({ sideOffset: sideOffset }, props, { asChild: true, children: jsx(List, { className: className, children: children }) })) }));
|
|
1181
|
+
};
|
|
1195
1182
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
1196
|
-
const DropdownMenuItem =
|
|
1183
|
+
const DropdownMenuItem = (_a) => {
|
|
1197
1184
|
var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
|
|
1198
|
-
return (jsx(DropdownMenuPrimitive.Item, Object.assign({
|
|
1199
|
-
}
|
|
1185
|
+
return (jsx(DropdownMenuPrimitive.Item, Object.assign({}, props, { asChild: true, children: jsx(List.Item, { inset: inset, className: className, children: children }) })));
|
|
1186
|
+
};
|
|
1200
1187
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
1201
|
-
const DropdownMenuCheckboxItem =
|
|
1188
|
+
const DropdownMenuCheckboxItem = (_a) => {
|
|
1202
1189
|
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
1203
|
-
return (jsx(DropdownMenuPrimitive.CheckboxItem, Object.assign({
|
|
1204
|
-
}
|
|
1190
|
+
return (jsx(DropdownMenuPrimitive.CheckboxItem, Object.assign({}, props, { asChild: true, children: jsxs(List.Item, { inset: true, className: className, children: [jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: jsx(List.Indicator, { icon: CheckIcon, iconClassName: "h-4 w-4" }) }), children] }) })));
|
|
1191
|
+
};
|
|
1205
1192
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
1206
|
-
const DropdownMenuRadioItem =
|
|
1193
|
+
const DropdownMenuRadioItem = (_a) => {
|
|
1207
1194
|
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
1208
|
-
return (jsx(DropdownMenuPrimitive.RadioItem, Object.assign({
|
|
1209
|
-
}
|
|
1195
|
+
return (jsx(DropdownMenuPrimitive.RadioItem, Object.assign({}, props, { asChild: true, children: jsxs(List.Item, { inset: true, className: className, children: [jsx(DropdownMenuPrimitive.ItemIndicator, { asChild: true, children: jsx(List.Indicator, { icon: CircleIcon, iconClassName: "h-2 w-2 fill-current" }) }), children] }) })));
|
|
1196
|
+
};
|
|
1210
1197
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
1211
|
-
const DropdownMenuLabel =
|
|
1198
|
+
const DropdownMenuLabel = (_a) => {
|
|
1212
1199
|
var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
|
|
1213
|
-
return (jsx(DropdownMenuPrimitive.Label, Object.assign({
|
|
1214
|
-
}
|
|
1200
|
+
return (jsx(DropdownMenuPrimitive.Label, Object.assign({}, props, { asChild: true, children: jsx(List.Label, { className: className, inset: inset, children: children }) })));
|
|
1201
|
+
};
|
|
1215
1202
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
1216
|
-
const DropdownMenuSeparator =
|
|
1203
|
+
const DropdownMenuSeparator = (_a) => {
|
|
1217
1204
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1218
|
-
return (jsx(DropdownMenuPrimitive.Separator, Object.assign({
|
|
1219
|
-
}
|
|
1205
|
+
return (jsx(DropdownMenuPrimitive.Separator, Object.assign({}, props, { asChild: true, children: jsx(List.Separator, { className: className }) })));
|
|
1206
|
+
};
|
|
1220
1207
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
1221
1208
|
const DropdownMenuShortcut = (_a) => {
|
|
1222
1209
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
@@ -1244,7 +1231,7 @@ const DropdownMenu = Object.assign(DropdownMenuPrimitive.Root, {
|
|
|
1244
1231
|
const defaultRenderItem = (item, selected) => item.label;
|
|
1245
1232
|
const defaultSearchPredicate = (item, searchValue) => item.label.toLowerCase().includes(searchValue.toLowerCase());
|
|
1246
1233
|
const defaultSelectPredicate = (a, b) => a === b;
|
|
1247
|
-
const SelectInput =
|
|
1234
|
+
const SelectInput = (_a) => {
|
|
1248
1235
|
var { className, items, renderItem = defaultRenderItem, value, multiple, clearable, allowAddition, onNewItemAdded, search, searchPredicate = defaultSearchPredicate, selectPredicate = defaultSelectPredicate, onChange, readOnly, parentRef } = _a, props = __rest(_a, ["className", "items", "renderItem", "value", "multiple", "clearable", "allowAddition", "onNewItemAdded", "search", "searchPredicate", "selectPredicate", "onChange", "readOnly", "parentRef"]);
|
|
1249
1236
|
const [open, setOpen] = useState(false);
|
|
1250
1237
|
const [searchValue, setSearchValue] = useState('');
|
|
@@ -1324,32 +1311,32 @@ const SelectInput = forwardRef((_a, ref) => {
|
|
|
1324
1311
|
handleOnSelect(option.id);
|
|
1325
1312
|
}, children: jsx("span", { children: renderItem(option, isNotNullOrUndefined(selectedMap[option.id])) }) }));
|
|
1326
1313
|
}, [ItemComponent, handleOnSelect, multiple, renderItem, selectedMap]);
|
|
1327
|
-
return (jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenu.Trigger, { className: cn('w-full', className), children: jsx(TextInput, Object.assign({ className: "[&>div>*]:cursor-pointer", inputClassName: "text-left" }, props, { value: text !== null && text !== void 0 ? text : '', clearable: clearable && !!selectedItems.length, onClear: handleOnClear, suffixIcon: ChevronDownIcon, onSuffixIconClick: () => setOpen((open) => !open),
|
|
1314
|
+
return (jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenu.Trigger, { className: cn('w-full', className), children: jsx(TextInput, Object.assign({ className: "[&>div>*]:cursor-pointer", inputClassName: "text-left" }, props, { value: text !== null && text !== void 0 ? text : '', clearable: clearable && !!selectedItems.length, onClear: handleOnClear, suffixIcon: ChevronDownIcon, onSuffixIconClick: () => setOpen((open) => !open), readOnly: true })) }), jsxs(DropdownMenu.Content, { className: "flex max-h-80 w-[calc(var(--radix-popper-anchor-width))] flex-col overflow-hidden", children: [search && (jsxs(Fragment, { children: [jsx(TextInput, { value: searchValue, placeholder: "Search...", size: props.size, onChange: handleOnSearchValueChange, onKeyUp: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), clearable: !!searchValue.length, onClear: clearSearchValue }), jsx(DropdownMenu.Separator, { className: "w-full" })] })), filteredItems.length === 0 &&
|
|
1328
1315
|
(allowAddition && searchValue ? (jsxs("button", { className: "rounded bg-slate-100 py-1.5 text-center hover:bg-slate-200 dark:bg-slate-900/30 dark:hover:bg-slate-700/30", onClick: handleOnAddItemClicked, children: ["Add '", searchValue, "'"] })) : (jsx("div", { className: "py-1.5 text-center text-slate-500", children: "No items." }))), jsx(GroupComponent, { className: "flex flex-col gap-1 overflow-auto", value: !multiple && selectedItems.length ? String(selectedItems[0].id) : undefined, children: filteredItems.map((item, index) => item.group ? (jsxs(Flex, { className: "gap-1", direction: "column", fullWidth: true, children: [jsx(DropdownMenu.Label, { className: "sticky top-0 z-[51] w-full rounded-md border bg-white py-1 dark:bg-slate-900", children: item.label }), item.items.map((subItem) => (jsx(RenderOption, Object.assign({}, subItem), subItem.id))), index < filteredItems.length - 1 && (jsx("div", { className: "mb-1 h-px w-full bg-slate-200 dark:bg-slate-700" }))] }, item.id)) : (jsx(RenderOption, Object.assign({}, item), item.id))) })] })] }));
|
|
1329
|
-
}
|
|
1316
|
+
};
|
|
1330
1317
|
function isNotNullOrUndefined(value) {
|
|
1331
1318
|
return value !== null && value !== undefined;
|
|
1332
1319
|
}
|
|
1333
1320
|
|
|
1334
|
-
const FileInput =
|
|
1321
|
+
const FileInput = (_a) => {
|
|
1335
1322
|
var { className, value, onChange, onFileChange, accept } = _a, props = __rest(_a, ["className", "value", "onChange", "onFileChange", "accept"]);
|
|
1336
1323
|
const fileInputRef = useRef(null);
|
|
1337
1324
|
const handleFileChange = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target: { files } }) {
|
|
1338
|
-
console.log(files);
|
|
1339
1325
|
if (files && files.length > 0) {
|
|
1340
1326
|
const file = files[0];
|
|
1341
|
-
console.log(file, file.name, onChange, onFileChange);
|
|
1342
1327
|
onChange === null || onChange === void 0 ? void 0 : onChange(file.name);
|
|
1343
1328
|
onFileChange === null || onFileChange === void 0 ? void 0 : onFileChange(file);
|
|
1344
1329
|
}
|
|
1345
1330
|
});
|
|
1346
|
-
return (jsxs(Fragment, { children: [jsx(TextInput, Object.assign({ className: cn('[&>div>*]:cursor-pointer', className), inputClassName: "text-left" }, props, { value: value !== null && value !== void 0 ? value : '', onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, suffixIcon: CloudUploadIcon, onSuffixIconClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); },
|
|
1347
|
-
|
|
1331
|
+
return (jsxs(Fragment, { children: [jsx(TextInput, Object.assign({ className: cn('[&>div>*]:cursor-pointer', className), inputClassName: "text-left" }, props, { value: value !== null && value !== void 0 ? value : '', onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, suffixIcon: CloudUploadIcon, onSuffixIconClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, readOnly: true })), jsx("input", { ref: (ref) => {
|
|
1332
|
+
fileInputRef.current = ref;
|
|
1333
|
+
}, type: "file", hidden: true, accept: accept, onChange: handleFileChange })] }));
|
|
1334
|
+
};
|
|
1348
1335
|
|
|
1349
1336
|
const FormGroup = ({ className, label, children }) => (jsxs(Flex, { className: cn('relative !gap-4 rounded-lg border p-4 dark:border-slate-700', className), direction: "column", fullWidth: true, children: [jsx("div", { className: "absolute right-0 top-0 rounded-bl-lg rounded-tr-lg bg-slate-500 px-2 py-1 font-medium text-white dark:bg-slate-900 dark:text-white", children: label }), children] }));
|
|
1350
1337
|
|
|
1351
1338
|
function withForm(Component) {
|
|
1352
|
-
return
|
|
1339
|
+
return (props) => {
|
|
1353
1340
|
const _a = props, { name, pattern, validate } = _a, restProps = __rest(_a, ["name", "pattern", "validate"]);
|
|
1354
1341
|
const { control, formState } = useFormContext();
|
|
1355
1342
|
return (jsx(Controller, { name: name, control: control, rules: {
|
|
@@ -1363,9 +1350,9 @@ function withForm(Component) {
|
|
|
1363
1350
|
}, render: ({ field, fieldState }) => {
|
|
1364
1351
|
var _a, _b;
|
|
1365
1352
|
return (jsx(Component, Object.assign({}, restProps, field, { value: (_a = field.value) !== null && _a !== void 0 ? _a : '', disabled: ((_b = field.disabled) !== null && _b !== void 0 ? _b : restProps.disabled) ||
|
|
1366
|
-
formState.isSubmitting, hasErrors: fieldState.error
|
|
1353
|
+
formState.isSubmitting, hasErrors: fieldState.error })));
|
|
1367
1354
|
} }));
|
|
1368
|
-
}
|
|
1355
|
+
};
|
|
1369
1356
|
}
|
|
1370
1357
|
const FormInputs = {
|
|
1371
1358
|
Text: withForm(TextInput),
|
|
@@ -1379,7 +1366,7 @@ const FormInputs = {
|
|
|
1379
1366
|
File: withForm(FileInput),
|
|
1380
1367
|
};
|
|
1381
1368
|
|
|
1382
|
-
const HintRoot =
|
|
1369
|
+
const HintRoot = ({ children, ref }) => (jsx(Block, { className: "relative", ref: ref, children: children }));
|
|
1383
1370
|
HintRoot.displayName = 'HintRoot';
|
|
1384
1371
|
const dotSizeClassNames = {
|
|
1385
1372
|
small: {
|
|
@@ -1421,7 +1408,7 @@ const colorClassNames = {
|
|
|
1421
1408
|
pink: 'bg-pink-500 dark:bg-pink-600',
|
|
1422
1409
|
rose: 'bg-rose-500 dark:bg-rose-600',
|
|
1423
1410
|
};
|
|
1424
|
-
const HintDot =
|
|
1411
|
+
const HintDot = ({ size = 'medium', placement = 'top-right', color = 'green', ping, ref, }) => (jsxs(Fragment, { children: [jsx(Block, { className: cn('absolute rounded-full', colorClassNames[color], dotSizeClassNames[size].base, {
|
|
1425
1412
|
[`${dotSizeClassNames[size].top} ${dotSizeClassNames[size].left}`]: placement === 'top-left',
|
|
1426
1413
|
[`${dotSizeClassNames[size].top} ${dotSizeClassNames[size].right}`]: placement === 'top-right',
|
|
1427
1414
|
[`${dotSizeClassNames[size].bottom} ${dotSizeClassNames[size].right}`]: placement === 'bottom-right',
|
|
@@ -1431,7 +1418,7 @@ const HintDot = forwardRef(({ size = 'medium', placement = 'top-right', color =
|
|
|
1431
1418
|
[`${dotSizeClassNames[size].top} ${dotSizeClassNames[size].right}`]: placement === 'top-right',
|
|
1432
1419
|
[`${dotSizeClassNames[size].bottom} ${dotSizeClassNames[size].right}`]: placement === 'bottom-right',
|
|
1433
1420
|
[`${dotSizeClassNames[size].bottom} ${dotSizeClassNames[size].left}`]: placement === 'bottom-left',
|
|
1434
|
-
}) }))] }))
|
|
1421
|
+
}) }))] }));
|
|
1435
1422
|
HintDot.displayName = 'HintDot';
|
|
1436
1423
|
const badgeSizeClassNames = {
|
|
1437
1424
|
top: 'top-0 -translate-y-1/2',
|
|
@@ -1439,15 +1426,15 @@ const badgeSizeClassNames = {
|
|
|
1439
1426
|
bottom: 'bottom-0 translate-y-1/2',
|
|
1440
1427
|
left: 'left-2 -translate-x-full',
|
|
1441
1428
|
};
|
|
1442
|
-
const HintBadge =
|
|
1429
|
+
const HintBadge = (_a) => {
|
|
1443
1430
|
var { className, size = 'small', placement = 'top-right' } = _a, props = __rest(_a, ["className", "size", "placement"]);
|
|
1444
1431
|
return (jsx(Badge, Object.assign({ className: cn('absolute z-10 px-1', size === 'small' ? 'h-4' : 'h-5', {
|
|
1445
1432
|
[`${badgeSizeClassNames.top} ${badgeSizeClassNames.left}`]: placement === 'top-left',
|
|
1446
1433
|
[`${badgeSizeClassNames.top} ${badgeSizeClassNames.right}`]: placement === 'top-right',
|
|
1447
1434
|
[`${badgeSizeClassNames.bottom} ${badgeSizeClassNames.right}`]: placement === 'bottom-right',
|
|
1448
1435
|
[`${badgeSizeClassNames.bottom} ${badgeSizeClassNames.left}`]: placement === 'bottom-left',
|
|
1449
|
-
}, className), size: size }, props
|
|
1450
|
-
}
|
|
1436
|
+
}, className), size: size }, props)));
|
|
1437
|
+
};
|
|
1451
1438
|
HintBadge.displayName = 'HintBadge';
|
|
1452
1439
|
const Hint = Object.assign(HintRoot, { Dot: HintDot, Badge: HintBadge });
|
|
1453
1440
|
|
|
@@ -1607,15 +1594,15 @@ $Dialog.displayName = DialogPrimitive.Root.displayName;
|
|
|
1607
1594
|
const DialogTrigger = DialogPrimitive.Trigger;
|
|
1608
1595
|
const DialogPortal = DialogPrimitive.Portal;
|
|
1609
1596
|
const DialogClose = DialogPrimitive.Close;
|
|
1610
|
-
const DialogOverlay =
|
|
1597
|
+
const DialogOverlay = (_a) => {
|
|
1611
1598
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1612
|
-
return (jsx(DialogPrimitive.Overlay, Object.assign({
|
|
1613
|
-
}
|
|
1599
|
+
return (jsx(DialogPrimitive.Overlay, Object.assign({ className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', className) }, props)));
|
|
1600
|
+
};
|
|
1614
1601
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
1615
|
-
const DialogContent =
|
|
1602
|
+
const DialogContent = (_a) => {
|
|
1616
1603
|
var { className, fullScreen, children } = _a, props = __rest(_a, ["className", "fullScreen", "children"]);
|
|
1617
|
-
return (jsxs(DialogPortal, { children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, Object.assign({
|
|
1618
|
-
}
|
|
1604
|
+
return (jsxs(DialogPortal, { children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, Object.assign({ className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]', 'fixed left-[50%] top-[50%] z-50 flex max-h-[95dvh] w-full max-w-lg translate-x-[-50%] translate-y-[-50%] flex-col gap-4 rounded-lg border p-4 shadow-lg duration-200', className, fullScreen && 'h-full max-h-none w-full max-w-none rounded-none'), "aria-describedby": "dialog-content" }, props, { children: [children, jsx(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-2 top-2 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", asChild: true, children: jsx(Button, { prefixIcon: XIcon, size: "small", variant: "text" }) }), jsx(DialogPrimitive.Description, { className: "hidden" })] }))] }));
|
|
1605
|
+
};
|
|
1619
1606
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
1620
1607
|
const DialogHeader = (_a) => {
|
|
1621
1608
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
@@ -1627,15 +1614,15 @@ const DialogFooter = (_a) => {
|
|
|
1627
1614
|
return (jsx("div", Object.assign({ className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className) }, props)));
|
|
1628
1615
|
};
|
|
1629
1616
|
DialogFooter.displayName = 'DialogFooter';
|
|
1630
|
-
const DialogTitle =
|
|
1617
|
+
const DialogTitle = (_a) => {
|
|
1631
1618
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1632
|
-
return (jsx(DialogPrimitive.Title, Object.assign({
|
|
1633
|
-
}
|
|
1619
|
+
return (jsx(DialogPrimitive.Title, Object.assign({ className: cn('text-foreground text-lg font-semibold', className) }, props)));
|
|
1620
|
+
};
|
|
1634
1621
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1635
|
-
const DialogDescription =
|
|
1622
|
+
const DialogDescription = (_a) => {
|
|
1636
1623
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1637
|
-
return (jsx(DialogPrimitive.Description, Object.assign({
|
|
1638
|
-
}
|
|
1624
|
+
return (jsx(DialogPrimitive.Description, Object.assign({ className: cn('text-muted-foreground text-sm', className) }, props)));
|
|
1625
|
+
};
|
|
1639
1626
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
1640
1627
|
const Dialog = Object.assign($Dialog, {
|
|
1641
1628
|
Portal: DialogPortal,
|
|
@@ -1656,10 +1643,10 @@ $Sheet.displayName = DialogPrimitive.Root.displayName;
|
|
|
1656
1643
|
const SheetTrigger = DialogPrimitive.Trigger;
|
|
1657
1644
|
const SheetClose = DialogPrimitive.Close;
|
|
1658
1645
|
const SheetPortal = DialogPrimitive.Portal;
|
|
1659
|
-
const SheetOverlay =
|
|
1646
|
+
const SheetOverlay = (_a) => {
|
|
1660
1647
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1661
|
-
return (jsx(DialogPrimitive.Overlay, Object.assign({ className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', className) }, props
|
|
1662
|
-
}
|
|
1648
|
+
return (jsx(DialogPrimitive.Overlay, Object.assign({ className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', className) }, props)));
|
|
1649
|
+
};
|
|
1663
1650
|
SheetOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
1664
1651
|
const sheetVariants = cva('fixed flex flex-col z-50 gap-4 bg-background p-4 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', {
|
|
1665
1652
|
variants: {
|
|
@@ -1674,10 +1661,10 @@ const sheetVariants = cva('fixed flex flex-col z-50 gap-4 bg-background p-4 shad
|
|
|
1674
1661
|
side: 'right',
|
|
1675
1662
|
},
|
|
1676
1663
|
});
|
|
1677
|
-
const SheetContent =
|
|
1664
|
+
const SheetContent = (_a) => {
|
|
1678
1665
|
var { side = 'right', className, children } = _a, props = __rest(_a, ["side", "className", "children"]);
|
|
1679
|
-
return (jsxs(SheetPortal, { children: [jsx(SheetOverlay, {}), jsxs(DialogPrimitive.Content, Object.assign({
|
|
1680
|
-
}
|
|
1666
|
+
return (jsxs(SheetPortal, { children: [jsx(SheetOverlay, {}), jsxs(DialogPrimitive.Content, Object.assign({ className: cn(sheetVariants({ side }), className) }, props, { children: [children, jsx(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-2 top-2 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", asChild: true, children: jsx(Button, { prefixIcon: XIcon, size: "small", variant: "text" }) }), jsx(DialogPrimitive.Description, { className: "hidden" })] }))] }));
|
|
1667
|
+
};
|
|
1681
1668
|
SheetContent.displayName = DialogPrimitive.Content.displayName;
|
|
1682
1669
|
const SheetHeader = (_a) => {
|
|
1683
1670
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
@@ -1689,15 +1676,15 @@ const SheetFooter = (_a) => {
|
|
|
1689
1676
|
return (jsx("div", Object.assign({ className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className) }, props)));
|
|
1690
1677
|
};
|
|
1691
1678
|
SheetFooter.displayName = 'SheetFooter';
|
|
1692
|
-
const SheetTitle =
|
|
1679
|
+
const SheetTitle = (_a) => {
|
|
1693
1680
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1694
|
-
return (jsx(DialogPrimitive.Title, Object.assign({
|
|
1695
|
-
}
|
|
1681
|
+
return (jsx(DialogPrimitive.Title, Object.assign({ className: cn('text-foreground text-lg font-semibold', className) }, props)));
|
|
1682
|
+
};
|
|
1696
1683
|
SheetTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1697
|
-
const SheetDescription =
|
|
1684
|
+
const SheetDescription = (_a) => {
|
|
1698
1685
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1699
|
-
return (jsx(DialogPrimitive.Description, Object.assign({
|
|
1700
|
-
}
|
|
1686
|
+
return (jsx(DialogPrimitive.Description, Object.assign({ className: cn('text-muted-foreground text-sm', className) }, props)));
|
|
1687
|
+
};
|
|
1701
1688
|
SheetDescription.displayName = DialogPrimitive.Description.displayName;
|
|
1702
1689
|
const Sheet = Object.assign($Sheet, {
|
|
1703
1690
|
Portal: SheetPortal,
|
|
@@ -1766,10 +1753,10 @@ const PdfViewerDialog = ({ open, title, url, data, onClose }) => {
|
|
|
1766
1753
|
return !(url || data) ? null : (jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxs(Dialog.Content, { className: "h-[95dvh] max-w-[95dvw]", children: [jsx(Dialog.Header, { children: jsx(Dialog.Title, { children: title }) }), (url || data) && (jsx("embed", { className: "rounded-lg", src: url !== null && url !== void 0 ? url : `data:application/pdf;base64,${data}`, type: "application/pdf", width: "100%", height: "100%" }))] }) }));
|
|
1767
1754
|
};
|
|
1768
1755
|
|
|
1769
|
-
const Separator =
|
|
1756
|
+
const Separator = (_a) => {
|
|
1770
1757
|
var { className, orientation = 'horizontal', decorative = true } = _a, props = __rest(_a, ["className", "orientation", "decorative"]);
|
|
1771
|
-
return (jsx(SeparatorPrimitive.Root, Object.assign({
|
|
1772
|
-
}
|
|
1758
|
+
return (jsx(SeparatorPrimitive.Root, Object.assign({ decorative: decorative, orientation: orientation, className: cn('bg-border shrink-0', orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]', className) }, props)));
|
|
1759
|
+
};
|
|
1773
1760
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
1774
1761
|
|
|
1775
1762
|
const Skeleton = (_a) => {
|
|
@@ -1792,7 +1779,7 @@ function useSidebar() {
|
|
|
1792
1779
|
}
|
|
1793
1780
|
return context;
|
|
1794
1781
|
}
|
|
1795
|
-
const SidebarContextProvider =
|
|
1782
|
+
const SidebarContextProvider = (_a) => {
|
|
1796
1783
|
var { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = _a, props = __rest(_a, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
|
|
1797
1784
|
const isMobile = useIsMobile();
|
|
1798
1785
|
const [openMobile, setOpenMobile] = useState(false);
|
|
@@ -1839,21 +1826,21 @@ const SidebarContextProvider = forwardRef((_a, ref) => {
|
|
|
1839
1826
|
setOpenMobile,
|
|
1840
1827
|
toggleSidebar,
|
|
1841
1828
|
}), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
|
|
1842
|
-
return (jsx(SidebarContext.Provider, { value: contextValue, children: jsx("div", Object.assign({ style: Object.assign({ '--sidebar-width': SIDEBAR_WIDTH, '--sidebar-width-icon': SIDEBAR_WIDTH_ICON }, style), className: cn('group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex min-h-svh w-full', className)
|
|
1843
|
-
}
|
|
1829
|
+
return (jsx(SidebarContext.Provider, { value: contextValue, children: jsx("div", Object.assign({ style: Object.assign({ '--sidebar-width': SIDEBAR_WIDTH, '--sidebar-width-icon': SIDEBAR_WIDTH_ICON }, style), className: cn('group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex min-h-svh w-full', className) }, props, { children: children })) }));
|
|
1830
|
+
};
|
|
1844
1831
|
SidebarContextProvider.displayName = 'SidebarContextProvider';
|
|
1845
|
-
const
|
|
1832
|
+
const SidebarComp = (_a) => {
|
|
1846
1833
|
var { side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children } = _a, props = __rest(_a, ["side", "variant", "collapsible", "className", "children"]);
|
|
1847
1834
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1848
1835
|
if (collapsible === 'none') {
|
|
1849
|
-
return (jsx("div", Object.assign({ className: cn('bg-sidebar text-sidebar-foreground flex h-full w-[--sidebar-width] flex-col', className)
|
|
1836
|
+
return (jsx("div", Object.assign({ className: cn('bg-sidebar text-sidebar-foreground flex h-full w-[--sidebar-width] flex-col', className) }, props, { children: children })));
|
|
1850
1837
|
}
|
|
1851
1838
|
if (isMobile) {
|
|
1852
1839
|
return (jsx(Sheet, Object.assign({ open: openMobile, onOpenChange: setOpenMobile }, props, { children: jsx(Sheet.Content, { "data-sidebar": "sidebar", "data-mobile": "true", className: "bg-sidebar text-sidebar-foreground w-[--sidebar-width] p-0 [&>button]:hidden", style: {
|
|
1853
1840
|
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
1854
1841
|
}, side: side, children: jsx("div", { className: "flex h-full w-full flex-col", children: children }) }) })));
|
|
1855
1842
|
}
|
|
1856
|
-
return (jsxs("div", {
|
|
1843
|
+
return (jsxs("div", { className: "text-sidebar-foreground group peer hidden md:block", "data-state": state, "data-collapsible": state === 'collapsed' ? collapsible : '', "data-variant": variant, "data-side": side, children: [jsx("div", { className: cn('relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear', 'group-data-[collapsible=offcanvas]:w-0', 'group-data-[side=right]:rotate-180', variant === 'floating' || variant === 'inset'
|
|
1857
1844
|
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'
|
|
1858
1845
|
: 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]') }), jsx("div", Object.assign({ className: cn('fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex', side === 'left'
|
|
1859
1846
|
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
@@ -1862,86 +1849,86 @@ const $Sidebar = forwardRef((_a, ref) => {
|
|
|
1862
1849
|
variant === 'floating' || variant === 'inset'
|
|
1863
1850
|
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
|
|
1864
1851
|
: 'border-sidebar-border group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l', className) }, props, { children: jsx("div", { "data-sidebar": "sidebar", className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow", children: children }) }))] }));
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
const SidebarTrigger =
|
|
1852
|
+
};
|
|
1853
|
+
SidebarComp.displayName = 'Sidebar';
|
|
1854
|
+
const SidebarTrigger = (_a) => {
|
|
1868
1855
|
var { className, onClick } = _a, props = __rest(_a, ["className", "onClick"]);
|
|
1869
1856
|
const { toggleSidebar } = useSidebar();
|
|
1870
|
-
return (jsx(Button, Object.assign({
|
|
1857
|
+
return (jsx(Button, Object.assign({ "data-sidebar": "trigger", variant: "text", suffixIcon: PanelLeft, className: className, onClick: (event) => {
|
|
1871
1858
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
1872
1859
|
toggleSidebar();
|
|
1873
1860
|
} }, props)));
|
|
1874
|
-
}
|
|
1861
|
+
};
|
|
1875
1862
|
SidebarTrigger.displayName = 'SidebarTrigger';
|
|
1876
|
-
const SidebarRail =
|
|
1863
|
+
const SidebarRail = (_a) => {
|
|
1877
1864
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1878
1865
|
const { toggleSidebar } = useSidebar();
|
|
1879
|
-
return (jsx("button", Object.assign({
|
|
1880
|
-
}
|
|
1866
|
+
return (jsx("button", Object.assign({ "data-sidebar": "rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: cn('hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex', '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize', '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize', 'group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full', '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2', '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2', className) }, props)));
|
|
1867
|
+
};
|
|
1881
1868
|
SidebarRail.displayName = 'SidebarRail';
|
|
1882
|
-
const SidebarInset =
|
|
1869
|
+
const SidebarInset = (_a) => {
|
|
1883
1870
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1884
|
-
return (jsx("main", Object.assign({
|
|
1885
|
-
}
|
|
1871
|
+
return (jsx("main", Object.assign({ className: cn('bg-background relative flex min-h-svh flex-1 flex-col', 'peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow', className) }, props)));
|
|
1872
|
+
};
|
|
1886
1873
|
SidebarInset.displayName = 'SidebarInset';
|
|
1887
|
-
const SidebarInput =
|
|
1874
|
+
const SidebarInput = (_a) => {
|
|
1888
1875
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1889
|
-
return (jsx(BasicInput, Object.assign({
|
|
1890
|
-
}
|
|
1876
|
+
return (jsx(BasicInput, Object.assign({ "data-sidebar": "input", className: cn('focus-visible:ring-sidebar-ring focus-visible:ring-2', className) }, props)));
|
|
1877
|
+
};
|
|
1891
1878
|
SidebarInput.displayName = 'SidebarInput';
|
|
1892
|
-
const SidebarHeader =
|
|
1879
|
+
const SidebarHeader = (_a) => {
|
|
1893
1880
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1894
|
-
return (jsx("div", Object.assign({
|
|
1895
|
-
}
|
|
1881
|
+
return (jsx("div", Object.assign({ "data-sidebar": "header", className: cn('flex flex-col gap-2 p-2', className) }, props)));
|
|
1882
|
+
};
|
|
1896
1883
|
SidebarHeader.displayName = 'SidebarHeader';
|
|
1897
|
-
const SidebarFooter =
|
|
1884
|
+
const SidebarFooter = (_a) => {
|
|
1898
1885
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1899
|
-
return (jsx("div", Object.assign({
|
|
1900
|
-
}
|
|
1886
|
+
return (jsx("div", Object.assign({ "data-sidebar": "footer", className: cn('flex flex-col gap-2 p-2', className) }, props)));
|
|
1887
|
+
};
|
|
1901
1888
|
SidebarFooter.displayName = 'SidebarFooter';
|
|
1902
|
-
const SidebarSeparator =
|
|
1889
|
+
const SidebarSeparator = (_a) => {
|
|
1903
1890
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1904
|
-
return (jsx(Separator, Object.assign({
|
|
1905
|
-
}
|
|
1891
|
+
return (jsx(Separator, Object.assign({ "data-sidebar": "separator", className: cn('bg-sidebar-border mx-2 w-auto', className) }, props)));
|
|
1892
|
+
};
|
|
1906
1893
|
SidebarSeparator.displayName = 'SidebarSeparator';
|
|
1907
|
-
const SidebarContent =
|
|
1894
|
+
const SidebarContent = (_a) => {
|
|
1908
1895
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1909
|
-
return (jsx("div", Object.assign({
|
|
1910
|
-
}
|
|
1896
|
+
return (jsx("div", Object.assign({ "data-sidebar": "content", className: cn('flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden', className) }, props)));
|
|
1897
|
+
};
|
|
1911
1898
|
SidebarContent.displayName = 'SidebarContent';
|
|
1912
|
-
const SidebarGroup =
|
|
1899
|
+
const SidebarGroup = (_a) => {
|
|
1913
1900
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1914
|
-
return (jsx("div", Object.assign({
|
|
1915
|
-
}
|
|
1901
|
+
return (jsx("div", Object.assign({ "data-sidebar": "group", className: cn('relative flex w-full min-w-0 flex-col p-2', className) }, props)));
|
|
1902
|
+
};
|
|
1916
1903
|
SidebarGroup.displayName = 'SidebarGroup';
|
|
1917
|
-
const SidebarGroupLabel =
|
|
1904
|
+
const SidebarGroupLabel = (_a) => {
|
|
1918
1905
|
var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
|
|
1919
1906
|
const Comp = asChild ? Slot : 'div';
|
|
1920
|
-
return (jsx(Comp, Object.assign({
|
|
1921
|
-
}
|
|
1907
|
+
return (jsx(Comp, Object.assign({ "data-sidebar": "group-label", className: cn('text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0', className) }, props)));
|
|
1908
|
+
};
|
|
1922
1909
|
SidebarGroupLabel.displayName = 'SidebarGroupLabel';
|
|
1923
|
-
const SidebarGroupAction =
|
|
1910
|
+
const SidebarGroupAction = (_a) => {
|
|
1924
1911
|
var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
|
|
1925
1912
|
const Comp = asChild ? Slot : 'button';
|
|
1926
|
-
return (jsx(Comp, Object.assign({
|
|
1913
|
+
return (jsx(Comp, Object.assign({ "data-sidebar": "group-action", className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
1927
1914
|
// Increases the hit area of the button on mobile.
|
|
1928
1915
|
'after:absolute after:-inset-2 after:md:hidden', 'group-data-[collapsible=icon]:hidden', className) }, props)));
|
|
1929
|
-
}
|
|
1916
|
+
};
|
|
1930
1917
|
SidebarGroupAction.displayName = 'SidebarGroupAction';
|
|
1931
|
-
const SidebarGroupContent =
|
|
1918
|
+
const SidebarGroupContent = (_a) => {
|
|
1932
1919
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1933
|
-
return (jsx("div", Object.assign({
|
|
1934
|
-
}
|
|
1920
|
+
return (jsx("div", Object.assign({ "data-sidebar": "group-content", className: cn('w-full text-sm', className) }, props)));
|
|
1921
|
+
};
|
|
1935
1922
|
SidebarGroupContent.displayName = 'SidebarGroupContent';
|
|
1936
|
-
const SidebarMenu =
|
|
1923
|
+
const SidebarMenu = (_a) => {
|
|
1937
1924
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1938
|
-
return (jsx("ul", Object.assign({
|
|
1939
|
-
}
|
|
1925
|
+
return (jsx("ul", Object.assign({ "data-sidebar": "menu", className: cn('flex w-full min-w-0 flex-col gap-1', className) }, props)));
|
|
1926
|
+
};
|
|
1940
1927
|
SidebarMenu.displayName = 'SidebarMenu';
|
|
1941
|
-
const SidebarMenuItem =
|
|
1928
|
+
const SidebarMenuItem = (_a) => {
|
|
1942
1929
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1943
|
-
return (jsx("li", Object.assign({
|
|
1944
|
-
}
|
|
1930
|
+
return (jsx("li", Object.assign({ "data-sidebar": "menu-item", className: cn('group/menu-item relative', className) }, props)));
|
|
1931
|
+
};
|
|
1945
1932
|
SidebarMenuItem.displayName = 'SidebarMenuItem';
|
|
1946
1933
|
const sidebarMenuButtonVariants = cva('peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', {
|
|
1947
1934
|
variants: {
|
|
@@ -1960,11 +1947,11 @@ const sidebarMenuButtonVariants = cva('peer/menu-button flex w-full items-center
|
|
|
1960
1947
|
size: 'default',
|
|
1961
1948
|
},
|
|
1962
1949
|
});
|
|
1963
|
-
const SidebarMenuButton =
|
|
1950
|
+
const SidebarMenuButton = (_a) => {
|
|
1964
1951
|
var { asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className } = _a, props = __rest(_a, ["asChild", "isActive", "variant", "size", "tooltip", "className"]);
|
|
1965
1952
|
const Comp = asChild ? Slot : 'button';
|
|
1966
1953
|
const { isMobile, state } = useSidebar();
|
|
1967
|
-
const button = (jsx(Comp, Object.assign({
|
|
1954
|
+
const button = (jsx(Comp, Object.assign({ "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className) }, props)));
|
|
1968
1955
|
if (!tooltip || state !== 'collapsed' || isMobile) {
|
|
1969
1956
|
return button;
|
|
1970
1957
|
}
|
|
@@ -1974,50 +1961,50 @@ const SidebarMenuButton = forwardRef((_a, ref) => {
|
|
|
1974
1961
|
};
|
|
1975
1962
|
}
|
|
1976
1963
|
return (jsx(Tooltip, Object.assign({ asChild: true, placement: "right" }, tooltip, { children: button })));
|
|
1977
|
-
}
|
|
1964
|
+
};
|
|
1978
1965
|
SidebarMenuButton.displayName = 'SidebarMenuButton';
|
|
1979
|
-
const SidebarMenuAction =
|
|
1966
|
+
const SidebarMenuAction = (_a) => {
|
|
1980
1967
|
var { className, asChild = false, showOnHover = false } = _a, props = __rest(_a, ["className", "asChild", "showOnHover"]);
|
|
1981
1968
|
const Comp = asChild ? Slot : 'button';
|
|
1982
|
-
return (jsx(Comp, Object.assign({
|
|
1969
|
+
return (jsx(Comp, Object.assign({ "data-sidebar": "menu-action", className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
1983
1970
|
// Increases the hit area of the button on mobile.
|
|
1984
1971
|
'after:absolute after:-inset-2 after:md:hidden', 'peer-data-[size=sm]/menu-button:top-1', 'peer-data-[size=default]/menu-button:top-1.5', 'peer-data-[size=lg]/menu-button:top-2.5', 'group-data-[collapsible=icon]:hidden', showOnHover &&
|
|
1985
1972
|
'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0', className) }, props)));
|
|
1986
|
-
}
|
|
1973
|
+
};
|
|
1987
1974
|
SidebarMenuAction.displayName = 'SidebarMenuAction';
|
|
1988
|
-
const SidebarMenuBadge =
|
|
1975
|
+
const SidebarMenuBadge = (_a) => {
|
|
1989
1976
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
1990
|
-
return (jsx("div", Object.assign({
|
|
1991
|
-
}
|
|
1977
|
+
return (jsx("div", Object.assign({ "data-sidebar": "menu-badge", className: cn('text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums', 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground', 'peer-data-[size=sm]/menu-button:top-1', 'peer-data-[size=default]/menu-button:top-1.5', 'peer-data-[size=lg]/menu-button:top-2.5', 'group-data-[collapsible=icon]:hidden', className) }, props)));
|
|
1978
|
+
};
|
|
1992
1979
|
SidebarMenuBadge.displayName = 'SidebarMenuBadge';
|
|
1993
|
-
const SidebarMenuSkeleton =
|
|
1980
|
+
const SidebarMenuSkeleton = (_a) => {
|
|
1994
1981
|
var { className, showIcon = false } = _a, props = __rest(_a, ["className", "showIcon"]);
|
|
1995
1982
|
// Random width between 50 to 90%.
|
|
1996
1983
|
const width = useMemo(() => {
|
|
1997
1984
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
1998
1985
|
}, []);
|
|
1999
|
-
return (jsxs("div", Object.assign({
|
|
1986
|
+
return (jsxs("div", Object.assign({ "data-sidebar": "menu-skeleton", className: cn('flex h-8 items-center gap-2 rounded-md px-2', className) }, props, { children: [showIcon && jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }), jsx(Skeleton, { className: "h-4 max-w-[--skeleton-width] flex-1", "data-sidebar": "menu-skeleton-text", style: {
|
|
2000
1987
|
'--skeleton-width': width,
|
|
2001
1988
|
} })] })));
|
|
2002
|
-
}
|
|
1989
|
+
};
|
|
2003
1990
|
SidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton';
|
|
2004
|
-
const SidebarMenuSub =
|
|
1991
|
+
const SidebarMenuSub = (_a) => {
|
|
2005
1992
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
2006
|
-
return (jsx("ul", Object.assign({
|
|
2007
|
-
}
|
|
1993
|
+
return (jsx("ul", Object.assign({ "data-sidebar": "menu-sub", className: cn('border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5', 'group-data-[collapsible=icon]:hidden', className) }, props)));
|
|
1994
|
+
};
|
|
2008
1995
|
SidebarMenuSub.displayName = 'SidebarMenuSub';
|
|
2009
|
-
const SidebarMenuSubItem =
|
|
1996
|
+
const SidebarMenuSubItem = (_a) => {
|
|
2010
1997
|
var props = __rest(_a, []);
|
|
2011
|
-
return
|
|
2012
|
-
}
|
|
1998
|
+
return jsx("li", Object.assign({}, props));
|
|
1999
|
+
};
|
|
2013
2000
|
SidebarMenuSubItem.displayName = 'SidebarMenuSubItem';
|
|
2014
|
-
const SidebarMenuSubButton =
|
|
2001
|
+
const SidebarMenuSubButton = (_a) => {
|
|
2015
2002
|
var { asChild = false, size = 'md', isActive, className } = _a, props = __rest(_a, ["asChild", "size", "isActive", "className"]);
|
|
2016
2003
|
const Comp = asChild ? Slot : 'button';
|
|
2017
|
-
return (jsx(Comp, Object.assign({
|
|
2018
|
-
}
|
|
2004
|
+
return (jsx(Comp, Object.assign({ "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 w-full min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground', size === 'sm' && 'text-xs', size === 'md' && 'text-sm', 'group-data-[collapsible=icon]:hidden', className) }, props)));
|
|
2005
|
+
};
|
|
2019
2006
|
SidebarMenuSubButton.displayName = 'SidebarMenuSubButton';
|
|
2020
|
-
const Sidebar = Object.assign(
|
|
2007
|
+
const Sidebar = Object.assign(SidebarComp, {
|
|
2021
2008
|
Content: SidebarContent,
|
|
2022
2009
|
Footer: SidebarFooter,
|
|
2023
2010
|
Group: SidebarGroup,
|
|
@@ -2069,36 +2056,36 @@ function isLinkStartsWithPathname(link, pathname) {
|
|
|
2069
2056
|
|
|
2070
2057
|
const $Popover = PopoverPrimitive.Root;
|
|
2071
2058
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
2072
|
-
const PopoverContent =
|
|
2059
|
+
const PopoverContent = (_a) => {
|
|
2073
2060
|
var { className, align = 'center', sideOffset = 4, container } = _a, props = __rest(_a, ["className", "align", "sideOffset", "container"]);
|
|
2074
|
-
return (jsx(PopoverPrimitive.Portal, { container: container, children: jsx(PopoverPrimitive.Content, Object.assign({
|
|
2075
|
-
}
|
|
2061
|
+
return (jsx(PopoverPrimitive.Portal, { container: container, children: jsx(PopoverPrimitive.Content, Object.assign({ align: align, sideOffset: sideOffset, className: cn('z-50 rounded-md border bg-white p-1 shadow-md outline-none dark:border-slate-700 dark:bg-slate-900 dark:text-white', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95', 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className) }, props)) }));
|
|
2062
|
+
};
|
|
2076
2063
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2077
2064
|
const Popover = Object.assign($Popover, {
|
|
2078
2065
|
Trigger: PopoverTrigger,
|
|
2079
2066
|
Content: PopoverContent,
|
|
2080
2067
|
});
|
|
2081
2068
|
|
|
2082
|
-
const Switch =
|
|
2069
|
+
const Switch = (_a) => {
|
|
2083
2070
|
var { className } = _a, _b = _a.thumbProps, _c = _b === void 0 ? {} : _b, { className: thumbClassName } = _c, thumbProps = __rest(_c, ["className"]), props = __rest(_a, ["className", "thumbProps"]);
|
|
2084
|
-
return (jsx(SwitchPrimitives.Root, Object.assign({ className: cn('peer inline-flex h-[calc(1.5rem+6px)] w-[calc(3rem+6px)] shrink-0 cursor-pointer items-center rounded-full border-[3px] border-transparent', 'transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-600 focus-visible:ring-offset-2', 'focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-slate-300', 'dark:focus-visible:ring-slate-200 dark:focus-visible:ring-offset-slate-800 dark:data-[state=checked]:bg-blue-700 dark:data-[state=unchecked]:bg-slate-700', className) }, props, {
|
|
2085
|
-
}
|
|
2071
|
+
return (jsx(SwitchPrimitives.Root, Object.assign({ className: cn('peer inline-flex h-[calc(1.5rem+6px)] w-[calc(3rem+6px)] shrink-0 cursor-pointer items-center rounded-full border-[3px] border-transparent', 'transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-600 focus-visible:ring-offset-2', 'focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-slate-300', 'dark:focus-visible:ring-slate-200 dark:focus-visible:ring-offset-slate-800 dark:data-[state=checked]:bg-blue-700 dark:data-[state=unchecked]:bg-slate-700', className) }, props, { children: jsx(SwitchPrimitives.Thumb, Object.assign({ className: cn('pointer-events-none block h-6 w-6 rounded-full bg-white shadow-lg ring-0 transition-transform', 'data-[state=checked]:translate-x-6 data-[state=unchecked]:translate-x-0 dark:bg-slate-900', thumbClassName) }, thumbProps)) })));
|
|
2072
|
+
};
|
|
2086
2073
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
2087
2074
|
|
|
2088
|
-
const $Tabs =
|
|
2075
|
+
const $Tabs = (_a) => {
|
|
2089
2076
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
2090
|
-
return (jsx(TabsPrimitive.Root, Object.assign({
|
|
2091
|
-
}
|
|
2077
|
+
return (jsx(TabsPrimitive.Root, Object.assign({ className: cn('flex flex-col gap-2', className) }, props)));
|
|
2078
|
+
};
|
|
2092
2079
|
$Tabs.displayName = TabsPrimitive.Root.displayName;
|
|
2093
|
-
const TabsList =
|
|
2080
|
+
const TabsList = (_a) => {
|
|
2094
2081
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
2095
|
-
return (jsx(TabsPrimitive.List, Object.assign({
|
|
2096
|
-
}
|
|
2082
|
+
return (jsx(TabsPrimitive.List, Object.assign({ className: cn('inline-flex w-full items-center justify-center gap-1 rounded-lg border bg-slate-100 p-1 text-slate-400 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-500', className) }, props)));
|
|
2083
|
+
};
|
|
2097
2084
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
2098
|
-
const TabsTrigger =
|
|
2085
|
+
const TabsTrigger = (_a) => {
|
|
2099
2086
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
2100
|
-
return (jsx(TabsPrimitive.Trigger, Object.assign({
|
|
2101
|
-
}
|
|
2087
|
+
return (jsx(TabsPrimitive.Trigger, Object.assign({ className: cn('inline-flex w-full items-center justify-center whitespace-nowrap rounded-md px-2 py-1.5 font-medium transition-all hover:bg-slate-200 disabled:pointer-events-none disabled:opacity-50 dark:hover:bg-slate-800', 'data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow dark:data-[state=active]:bg-slate-700 dark:data-[state=active]:text-white', className) }, props)));
|
|
2088
|
+
};
|
|
2102
2089
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
2103
2090
|
const TabsContent = TabsPrimitive.Content;
|
|
2104
2091
|
const Tabs = Object.assign($Tabs, {
|
|
@@ -2169,4 +2156,4 @@ const ThemeSelector = ({ className }) => {
|
|
|
2169
2156
|
return (jsxs(DropdownMenu, { children: [jsx(DropdownMenu.Trigger, { asChild: true, children: jsx(Button, { prefixIcon: resolvedTheme === 'dark' ? MoonIcon : SunIcon, className: className, variant: "text" }) }), jsxs(DropdownMenu.Content, { children: [jsxs(DropdownMenu.Item, { onClick: () => setTheme('light'), children: [jsx(DropdownMenu.Icon, { icon: SunIcon }), "Light"] }), jsxs(DropdownMenu.Item, { onClick: () => setTheme('dark'), children: [jsx(DropdownMenu.Icon, { icon: MoonIcon }), "Dark"] }), jsxs(DropdownMenu.Item, { onClick: () => setTheme('system'), children: [jsx(DropdownMenu.Icon, { icon: MonitorIcon }), "System"] })] })] }));
|
|
2170
2157
|
};
|
|
2171
2158
|
|
|
2172
|
-
export { Badge, BasicInput, BasicInputExtension, Block, Button, Card, CheckboxInput, Collapsible, ConfirmDialog, DataTable, DateTimeInput, Dialog, DropdownMenu, EmailInput, FileInput, Flex, FormDialog, FormGroup, FormInputs, Hint, Label, Layout, LayoutContext, LayoutContextProvider, List, ListSorter, ListSorterDialog, Navbar, NumberInput, Pagination, PasswordInput, PdfViewerDialog, Popover, SHOW_IDS_COOKIE_MAX_AGE, SHOW_IDS_COOKIE_NAME, SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON, SIDEBAR_WIDTH_MOBILE, SelectInput, Separator, Sheet, Sidebar, SidebarContext, SidebarContextProvider, Skeleton, Spinner, Switch, THEME_COOKIE_MAX_AGE, THEME_COOKIE_NAME, THEME_MEDIA_QUERY, Table, Tabs, TextInput, TextareaInput, ThemeSelector, Tooltip, cn, compareDates, generalComparator, getDisplayDate, getValueFromCookie, isEmpty,
|
|
2159
|
+
export { Badge, BasicInput, BasicInputExtension, Block, Button, Card, CheckboxInput, Collapsible, ConfirmDialog, DataTable, DateTimeInput, Dialog, DropdownMenu, EmailInput, FileInput, Flex, FormDialog, FormGroup, FormInputs, Hint, Label, Layout, LayoutContext, LayoutContextProvider, List, ListSorter, ListSorterDialog, Navbar, NumberInput, Pagination, PasswordInput, PdfViewerDialog, Popover, SHOW_IDS_COOKIE_MAX_AGE, SHOW_IDS_COOKIE_NAME, SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON, SIDEBAR_WIDTH_MOBILE, SelectInput, Separator, Sheet, Sidebar, SidebarContext, SidebarContextProvider, Skeleton, Spinner, Switch, THEME_COOKIE_MAX_AGE, THEME_COOKIE_NAME, THEME_MEDIA_QUERY, Table, Tabs, TextInput, TextareaInput, ThemeSelector, Tooltip, cn, compareDates, generalComparator, getDisplayDate, getValueFromCookie, isEmpty, resolveTargetObject, useDays, useIsMobile, useLayoutContext, useLongPress, useMonths, useOnSwipe, useOutsideClick, usePagination, useSidebar };
|