ctc-component-library 0.3.0 → 1.0.0-alpha.4
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/DESIGN.md +408 -0
- package/MIGRATION.md +301 -0
- package/README.md +41 -72
- package/dist/components/Alert/Alert.d.ts +14 -0
- package/dist/components/Alert/Alert.js +73 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +5 -0
- package/dist/components/Avatar/Avatar.js +25 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +23 -0
- package/dist/components/Badge/Badge.js +159 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Button/Button.d.ts +7 -0
- package/dist/components/Button/Button.js +46 -0
- package/dist/components/Button/button.variants.d.ts +22 -0
- package/dist/components/Button/button.variants.js +61 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +9 -0
- package/dist/components/Checkbox/Checkbox.js +36 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Chip/Chip.d.ts +17 -0
- package/dist/components/Chip/Chip.js +59 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/Chip/index.js +2 -0
- package/dist/components/Combobox/Combobox.d.ts +31 -0
- package/dist/components/Combobox/Combobox.js +97 -0
- package/dist/components/Combobox/index.d.ts +1 -0
- package/dist/components/Combobox/index.js +2 -0
- package/dist/components/DataTable/DataTable.d.ts +24 -0
- package/dist/components/DataTable/DataTable.js +74 -0
- package/dist/components/DataTable/Table.d.ts +9 -0
- package/dist/components/DataTable/Table.js +57 -0
- package/dist/components/DataTable/index.d.ts +3 -0
- package/dist/components/DataTable/index.js +3 -0
- package/dist/components/DatePicker/DatePicker.d.ts +20 -0
- package/dist/components/DatePicker/DatePicker.js +73 -0
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/Dialog/Dialog.d.ts +21 -0
- package/dist/components/Dialog/Dialog.js +51 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Field/Field.d.ts +22 -0
- package/dist/components/Field/Field.js +43 -0
- package/dist/components/Field/index.d.ts +1 -0
- package/dist/components/Field/index.js +2 -0
- package/dist/components/Icon/Icon.d.ts +7 -0
- package/dist/components/Icon/Icon.js +13 -0
- package/dist/components/Icon/index.d.ts +13 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Input/Input.d.ts +41 -0
- package/dist/components/Input/Input.js +87 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Label/Label.d.ts +3 -0
- package/dist/components/Label/Label.js +13 -0
- package/dist/components/Label/index.js +2 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +23 -0
- package/dist/components/MultiSelect/MultiSelect.js +98 -0
- package/dist/components/MultiSelect/index.d.ts +1 -0
- package/dist/components/MultiSelect/index.js +2 -0
- package/dist/components/NumberInput/NumberInput.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.js +58 -0
- package/dist/components/NumberInput/index.d.ts +1 -0
- package/dist/components/NumberInput/index.js +2 -0
- package/dist/components/Popover/Popover.d.ts +12 -0
- package/dist/components/Popover/Popover.js +20 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.js +42 -0
- package/dist/components/RadioGroup/index.d.ts +1 -0
- package/dist/components/RadioGroup/index.js +2 -0
- package/dist/components/Select/Select.d.ts +15 -0
- package/dist/components/Select/Select.js +82 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Spinner/Spinner.d.ts +9 -0
- package/dist/components/Spinner/Spinner.js +24 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +7 -0
- package/dist/components/Switch/Switch.js +23 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Tabs/Tabs.d.ts +17 -0
- package/dist/components/Tabs/Tabs.js +78 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/TimePicker/TimePicker.d.ts +20 -0
- package/dist/components/TimePicker/TimePicker.js +62 -0
- package/dist/components/TimePicker/index.d.ts +1 -0
- package/dist/components/TimePicker/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +57 -0
- package/dist/components/Toast/Toast.js +40 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +12 -0
- package/dist/components/Tooltip/Tooltip.js +23 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Typography/Typography.d.ts +13 -0
- package/dist/components/Typography/Typography.js +63 -0
- package/dist/components/Typography/index.d.ts +1 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/cn.js +6 -0
- package/dist/presets/SelectCountry/SelectCountry.d.ts +16 -0
- package/dist/presets/SelectCountry/SelectCountry.js +21 -0
- package/dist/presets/SelectCountry/countries.d.ts +11 -0
- package/dist/presets/SelectCountry/countries.js +120 -0
- package/dist/presets/SelectCountry/index.d.ts +2 -0
- package/dist/presets/SelectCountry/index.js +3 -0
- package/dist/presets/SelectPhone/SelectPhone.d.ts +15 -0
- package/dist/presets/SelectPhone/SelectPhone.js +21 -0
- package/dist/presets/SelectPhone/index.d.ts +2 -0
- package/dist/presets/SelectPhone/index.js +3 -0
- package/dist/presets/SelectPhone/phoneCodes.d.ts +7 -0
- package/dist/presets/SelectPhone/phoneCodes.js +131 -0
- package/dist/tailwind-preset.d.ts +10 -0
- package/dist/tailwind-preset.js +4 -0
- package/dist/test-setup.d.ts +0 -0
- package/dist/theme/colors.d.ts +57 -0
- package/dist/theme/colors.js +59 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/shapes.d.ts +17 -0
- package/dist/theme/shapes.js +18 -0
- package/dist/theme/spacing.d.ts +18 -0
- package/dist/theme/spacing.js +19 -0
- package/dist/theme.css +2 -0
- package/llms.txt +310 -748
- package/package.json +193 -69
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.es.js +0 -45363
- package/dist/src/commons/colors.d.ts +0 -47
- package/dist/src/commons/colors.es.js +0 -50
- package/dist/src/commons/shapes.d.ts +0 -15
- package/dist/src/commons/shapes.es.js +0 -18
- package/dist/src/commons/spacing.d.ts +0 -15
- package/dist/src/commons/spacing.es.js +0 -18
- package/dist/src/components/atoms/Avatar/Avatar.d.ts +0 -2
- package/dist/src/components/atoms/Avatar/index.d.ts +0 -2
- package/dist/src/components/atoms/Avatar/types.d.ts +0 -7
- package/dist/src/components/atoms/Badge/Badge.d.ts +0 -3
- package/dist/src/components/atoms/Badge/index.d.ts +0 -2
- package/dist/src/components/atoms/Badge/types.d.ts +0 -18
- package/dist/src/components/atoms/Button/Button.d.ts +0 -3
- package/dist/src/components/atoms/Button/ButtonV2.d.ts +0 -4
- package/dist/src/components/atoms/Button/index.d.ts +0 -4
- package/dist/src/components/atoms/Button/types.d.ts +0 -35
- package/dist/src/components/atoms/Checkbox/Checkbox.d.ts +0 -3
- package/dist/src/components/atoms/Checkbox/index.d.ts +0 -2
- package/dist/src/components/atoms/Checkbox/types.d.ts +0 -18
- package/dist/src/components/atoms/Datepicker/Datepicker.d.ts +0 -3
- package/dist/src/components/atoms/Datepicker/index.d.ts +0 -2
- package/dist/src/components/atoms/Datepicker/types.d.ts +0 -9
- package/dist/src/components/atoms/Icon/Icon.d.ts +0 -3
- package/dist/src/components/atoms/Icon/index.d.ts +0 -3
- package/dist/src/components/atoms/Icon/types.d.ts +0 -11
- package/dist/src/components/atoms/InputNumber/InputNumber.d.ts +0 -3
- package/dist/src/components/atoms/InputNumber/index.d.ts +0 -2
- package/dist/src/components/atoms/InputNumber/types.d.ts +0 -7
- package/dist/src/components/atoms/Label/Label.d.ts +0 -9
- package/dist/src/components/atoms/Popover/Popover.d.ts +0 -2
- package/dist/src/components/atoms/Popover/index.d.ts +0 -2
- package/dist/src/components/atoms/Popover/types.d.ts +0 -8
- package/dist/src/components/atoms/RadioButton/RadioButton.d.ts +0 -3
- package/dist/src/components/atoms/RadioButton/index.d.ts +0 -2
- package/dist/src/components/atoms/RadioButton/types.d.ts +0 -20
- package/dist/src/components/atoms/TextInput/TextInput.d.ts +0 -12
- package/dist/src/components/atoms/TextInput/index.d.ts +0 -1
- package/dist/src/components/atoms/TextInput/types.d.ts +0 -5
- package/dist/src/components/atoms/Timepicker/TimePicker.d.ts +0 -3
- package/dist/src/components/atoms/Timepicker/index.d.ts +0 -2
- package/dist/src/components/atoms/Timepicker/types.d.ts +0 -15
- package/dist/src/components/atoms/Toast/Toast.d.ts +0 -20
- package/dist/src/components/atoms/Toast/index.d.ts +0 -1
- package/dist/src/components/atoms/Toggle/Toggle.d.ts +0 -3
- package/dist/src/components/atoms/Toggle/index.d.ts +0 -2
- package/dist/src/components/atoms/Toggle/types.d.ts +0 -6
- package/dist/src/components/atoms/Typography/Typography.d.ts +0 -7
- package/dist/src/components/atoms/Typography/index.d.ts +0 -2
- package/dist/src/components/atoms/Typography/types.d.ts +0 -38
- package/dist/src/components/atoms/index.d.ts +0 -16
- package/dist/src/components/atoms/tooltips/Tooltip/Tooltip.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/Tooltip/index.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/Tooltip/types.d.ts +0 -10
- package/dist/src/components/atoms/tooltips/TooltipWrapper/TooltipWrapper.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/TooltipWrapper/index.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/TooltipWrapper/types.d.ts +0 -11
- package/dist/src/components/atoms/tooltips/index.d.ts +0 -2
- package/dist/src/components/index.d.ts +0 -3
- package/dist/src/components/molecules/Table/Table.d.ts +0 -3
- package/dist/src/components/molecules/Table/index.d.ts +0 -2
- package/dist/src/components/molecules/Table/types.d.ts +0 -28
- package/dist/src/components/molecules/alert/Alert.d.ts +0 -15
- package/dist/src/components/molecules/alert/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/Dropdown/Dropdown.d.ts +0 -3
- package/dist/src/components/molecules/dropdowns/Dropdown/index.d.ts +0 -2
- package/dist/src/components/molecules/dropdowns/Dropdown/types.d.ts +0 -33
- package/dist/src/components/molecules/dropdowns/DropdownCountry/DropdownCountry.d.ts +0 -5
- package/dist/src/components/molecules/dropdowns/DropdownCountry/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/DropdownFilter/DropdownFilter.d.ts +0 -3
- package/dist/src/components/molecules/dropdowns/DropdownFilter/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/DropdownFilter/types.d.ts +0 -38
- package/dist/src/components/molecules/dropdowns/DropdownMultiple/DropdownMultiple.d.ts +0 -3
- package/dist/src/components/molecules/dropdowns/DropdownMultiple/index.d.ts +0 -2
- package/dist/src/components/molecules/dropdowns/DropdownMultiple/types.d.ts +0 -11
- package/dist/src/components/molecules/dropdowns/DropdownPhone/DropdownPhone.d.ts +0 -6
- package/dist/src/components/molecules/dropdowns/DropdownPhone/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/index.d.ts +0 -5
- package/dist/src/components/molecules/index.d.ts +0 -4
- package/dist/src/components/molecules/tabs/Tab/Tab.d.ts +0 -3
- package/dist/src/components/molecules/tabs/Tab/index.d.ts +0 -2
- package/dist/src/components/molecules/tabs/Tab/types.d.ts +0 -16
- package/dist/src/components/molecules/tabs/TabButton/TabButton.d.ts +0 -3
- package/dist/src/components/molecules/tabs/TabButton/index.d.ts +0 -2
- package/dist/src/components/molecules/tabs/TabButton/types.d.ts +0 -15
- package/dist/src/components/molecules/tabs/index.d.ts +0 -2
- package/dist/src/components/organisms/Modal/Modal.d.ts +0 -3
- package/dist/src/components/organisms/Modal/ModalV2.d.ts +0 -53
- package/dist/src/components/organisms/Modal/index.d.ts +0 -3
- package/dist/src/components/organisms/Modal/types.d.ts +0 -24
- package/dist/src/components/organisms/index.d.ts +0 -1
- package/dist/src/constants/countries.d.ts +0 -7
- package/dist/src/hooks/useClickOutside.d.ts +0 -2
- package/dist/src/vite-env.d.ts +0 -1
- /package/dist/{src/components/atoms → components}/Label/index.d.ts +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface MultiSelectOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface MultiSelectProps {
|
|
7
|
+
options: MultiSelectOption[];
|
|
8
|
+
value?: string[];
|
|
9
|
+
defaultValue?: string[];
|
|
10
|
+
onValueChange?: (value: string[]) => void;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
searchPlaceholder?: string;
|
|
13
|
+
emptyText?: string;
|
|
14
|
+
/** Max chips rendered in the trigger before collapsing to "+N more". */
|
|
15
|
+
maxTags?: number;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
size?: 'sm' | 'lg';
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const MultiSelect: {
|
|
21
|
+
({ options, value, defaultValue, onValueChange, placeholder, searchPlaceholder, emptyText, maxTags, disabled, size, className }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { inputVariants as t } from "../Input/Input.js";
|
|
3
|
+
import { Popover as n, PopoverContent as r, PopoverTrigger as i } from "../Popover/Popover.js";
|
|
4
|
+
import { Badge as a } from "../Badge/Badge.js";
|
|
5
|
+
import * as o from "react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { CaretDown as l, Check as u, MagnifyingGlass as d, X as f } from "@phosphor-icons/react";
|
|
8
|
+
import { Command as p } from "cmdk";
|
|
9
|
+
//#region src/components/MultiSelect/MultiSelect.tsx
|
|
10
|
+
var m = ({ options: m, value: h, defaultValue: g = [], onValueChange: _, placeholder: v = "Seleccionar opciones", searchPlaceholder: y = "Buscar...", emptyText: b = "Sin resultados", maxTags: x = 3, disabled: S, size: C = "sm", className: w }) => {
|
|
11
|
+
let [T, E] = o.useState(!1), [D, O] = o.useState(g), k = h !== void 0, A = k ? h : D, j = (e) => {
|
|
12
|
+
k || O(e), _?.(e);
|
|
13
|
+
}, M = (e) => {
|
|
14
|
+
j(A.includes(e) ? A.filter((t) => t !== e) : [...A, e]);
|
|
15
|
+
}, N = (e, t) => {
|
|
16
|
+
t.stopPropagation(), j(A.filter((t) => t !== e));
|
|
17
|
+
}, P = A.map((e) => m.find((t) => t.value === e)).filter(Boolean), F = P.slice(0, x), I = P.length - F.length;
|
|
18
|
+
return /* @__PURE__ */ c(n, {
|
|
19
|
+
open: T,
|
|
20
|
+
onOpenChange: E,
|
|
21
|
+
children: [/* @__PURE__ */ s(i, {
|
|
22
|
+
asChild: !0,
|
|
23
|
+
children: /* @__PURE__ */ c("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
role: "combobox",
|
|
26
|
+
"aria-expanded": T,
|
|
27
|
+
disabled: S,
|
|
28
|
+
className: e(t({ size: C }), "inline-flex items-center justify-between text-left h-auto min-h-10 py-x2 flex-wrap gap-x1", A.length === 0 && "text-gray-40", w),
|
|
29
|
+
children: [A.length === 0 ? /* @__PURE__ */ s("span", { children: v }) : /* @__PURE__ */ c("span", {
|
|
30
|
+
className: "flex flex-wrap items-center gap-x1",
|
|
31
|
+
children: [F.map((e) => /* @__PURE__ */ c(a, {
|
|
32
|
+
variant: "neutral",
|
|
33
|
+
className: "gap-x1 [animation:ctc-scale-in_var(--duration-fast)_var(--ease-out)]",
|
|
34
|
+
children: [e.label, /* @__PURE__ */ s("span", {
|
|
35
|
+
role: "button",
|
|
36
|
+
"aria-label": `Quitar ${e.label}`,
|
|
37
|
+
onClick: (t) => N(e.value, t),
|
|
38
|
+
className: "hover:text-error cursor-pointer",
|
|
39
|
+
children: /* @__PURE__ */ s(f, {
|
|
40
|
+
weight: "bold",
|
|
41
|
+
className: "size-3"
|
|
42
|
+
})
|
|
43
|
+
})]
|
|
44
|
+
}, e.value)), I > 0 && /* @__PURE__ */ c(a, {
|
|
45
|
+
variant: "outline",
|
|
46
|
+
children: ["+", I]
|
|
47
|
+
})]
|
|
48
|
+
}), /* @__PURE__ */ s(l, {
|
|
49
|
+
weight: "bold",
|
|
50
|
+
className: e("size-4 text-gray-60 shrink-0 ml-x2", "[transition:transform_var(--duration-fast)_var(--ease-out)]", "[[data-state=open]_&]:rotate-180")
|
|
51
|
+
})]
|
|
52
|
+
})
|
|
53
|
+
}), /* @__PURE__ */ s(r, {
|
|
54
|
+
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
55
|
+
align: "start",
|
|
56
|
+
children: /* @__PURE__ */ c(p, {
|
|
57
|
+
className: "flex flex-col",
|
|
58
|
+
children: [/* @__PURE__ */ c("div", {
|
|
59
|
+
className: "flex items-center border-b border-gray-20 px-x3",
|
|
60
|
+
children: [/* @__PURE__ */ s(d, {
|
|
61
|
+
weight: "regular",
|
|
62
|
+
className: "size-4 text-gray-60 mr-x2 shrink-0"
|
|
63
|
+
}), /* @__PURE__ */ s(p.Input, {
|
|
64
|
+
placeholder: y,
|
|
65
|
+
className: e("flex h-10 w-full bg-transparent py-x2 font-sans text-[14px] text-gray-80 outline-none", "placeholder:text-gray-40")
|
|
66
|
+
})]
|
|
67
|
+
}), /* @__PURE__ */ c(p.List, {
|
|
68
|
+
className: "max-h-64 overflow-y-auto p-x1",
|
|
69
|
+
children: [/* @__PURE__ */ s(p.Empty, {
|
|
70
|
+
className: "py-x6 text-center text-[14px] text-gray-60",
|
|
71
|
+
children: b
|
|
72
|
+
}), m.map((t) => {
|
|
73
|
+
let n = A.includes(t.value);
|
|
74
|
+
return /* @__PURE__ */ c(p.Item, {
|
|
75
|
+
value: t.value,
|
|
76
|
+
disabled: t.disabled,
|
|
77
|
+
onSelect: M,
|
|
78
|
+
className: e("relative flex cursor-default select-none items-center rounded-x1 py-x2 pl-x8 pr-x3", "text-[14px] text-gray-80 outline-none", "[transition:background-color_var(--duration-fast)_var(--ease-out)]", "data-[selected=true]:bg-gray-20 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50"),
|
|
79
|
+
children: [/* @__PURE__ */ s("span", {
|
|
80
|
+
className: e("absolute left-x3 size-4 rounded-x1 border-2 inline-flex items-center justify-center", n ? "bg-primary border-primary text-gray-00" : "border-gray-40"),
|
|
81
|
+
children: n && /* @__PURE__ */ s(u, {
|
|
82
|
+
weight: "bold",
|
|
83
|
+
className: "size-3"
|
|
84
|
+
})
|
|
85
|
+
}), /* @__PURE__ */ s("span", {
|
|
86
|
+
className: "truncate",
|
|
87
|
+
children: t.label
|
|
88
|
+
})]
|
|
89
|
+
}, t.value);
|
|
90
|
+
})]
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
m.displayName = "MultiSelect";
|
|
97
|
+
//#endregion
|
|
98
|
+
export { m as MultiSelect };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MultiSelect, type MultiSelectProps, type MultiSelectOption } from './MultiSelect';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputProps } from '../Input/Input';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface NumberInputProps extends Omit<InputProps, 'type' | 'value' | 'defaultValue' | 'onChange'> {
|
|
4
|
+
value?: number;
|
|
5
|
+
defaultValue?: number;
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
step?: number;
|
|
9
|
+
onValueChange?: (value: number | undefined) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { Input as t, inputVariants as n } from "../Input/Input.js";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { Minus as o, Plus as s } from "@phosphor-icons/react";
|
|
6
|
+
//#region src/components/NumberInput/NumberInput.tsx
|
|
7
|
+
var c = r.forwardRef(({ className: c, value: l, defaultValue: u, min: d, max: f, step: p = 1, disabled: m, onValueChange: h, size: g, ..._ }, v) => {
|
|
8
|
+
let [y, b] = r.useState(u), x = l !== void 0, S = x ? l : y, C = (e) => {
|
|
9
|
+
e !== void 0 && (d !== void 0 && e < d && (e = d), f !== void 0 && e > f && (e = f)), x || b(e), h?.(e);
|
|
10
|
+
}, w = (e) => {
|
|
11
|
+
C((S ?? 0) + e);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ a("div", {
|
|
14
|
+
className: "relative inline-flex w-full",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ i("button", {
|
|
17
|
+
type: "button",
|
|
18
|
+
onClick: () => w(-p),
|
|
19
|
+
disabled: m || d !== void 0 && (S ?? 0) <= d,
|
|
20
|
+
"aria-label": "Decrement",
|
|
21
|
+
"data-pressable": "",
|
|
22
|
+
className: e("absolute left-0 top-0 h-full px-x3 inline-flex items-center justify-center", "text-gray-80 hover:text-primary disabled:text-gray-40 disabled:cursor-not-allowed", "[transition:color_var(--duration-fast)_var(--ease-out),transform_var(--duration-fast)_var(--ease-out)]", "active:scale-[var(--press-scale)] disabled:active:transform-none"),
|
|
23
|
+
children: /* @__PURE__ */ i(o, {
|
|
24
|
+
weight: "bold",
|
|
25
|
+
className: "size-4"
|
|
26
|
+
})
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ i(t, {
|
|
29
|
+
ref: v,
|
|
30
|
+
type: "number",
|
|
31
|
+
value: S ?? "",
|
|
32
|
+
onChange: (e) => C(e.target.value === "" ? void 0 : Number(e.target.value)),
|
|
33
|
+
min: d,
|
|
34
|
+
max: f,
|
|
35
|
+
step: p,
|
|
36
|
+
disabled: m,
|
|
37
|
+
size: g,
|
|
38
|
+
className: e(n({ size: g }), "text-center tabular-nums", "[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", "[appearance:textfield]", c),
|
|
39
|
+
..._
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ i("button", {
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: () => w(p),
|
|
44
|
+
disabled: m || f !== void 0 && (S ?? 0) >= f,
|
|
45
|
+
"aria-label": "Increment",
|
|
46
|
+
"data-pressable": "",
|
|
47
|
+
className: e("absolute right-0 top-0 h-full px-x3 inline-flex items-center justify-center", "text-gray-80 hover:text-primary disabled:text-gray-40 disabled:cursor-not-allowed", "[transition:color_var(--duration-fast)_var(--ease-out),transform_var(--duration-fast)_var(--ease-out)]", "active:scale-[var(--press-scale)] disabled:active:transform-none"),
|
|
48
|
+
children: /* @__PURE__ */ i(s, {
|
|
49
|
+
weight: "bold",
|
|
50
|
+
className: "size-4"
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
c.displayName = "NumberInput";
|
|
57
|
+
//#endregion
|
|
58
|
+
export { c as NumberInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NumberInput, type NumberInputProps } from './NumberInput';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
export declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
|
+
export declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const PopoverClose: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
export declare const PopoverPortal: React.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
8
|
+
export interface PopoverContentProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
|
|
9
|
+
/** Render an arrow pointing to the anchor. */
|
|
10
|
+
arrow?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import * as i from "@radix-ui/react-popover";
|
|
5
|
+
//#region src/components/Popover/Popover.tsx
|
|
6
|
+
var a = i.Root, o = i.Trigger, s = i.Anchor, c = i.Close, l = i.Portal, u = t.forwardRef(({ className: t, align: a = "center", sideOffset: o = 8, arrow: s = !1, children: c, ...l }, u) => /* @__PURE__ */ n(i.Portal, { children: /* @__PURE__ */ r(i.Content, {
|
|
7
|
+
ref: u,
|
|
8
|
+
align: a,
|
|
9
|
+
sideOffset: o,
|
|
10
|
+
className: e("z-50 rounded-x4 border border-gray-20 bg-gray-00 p-x4 shadow-md outline-none", "[transform-origin:var(--radix-popover-content-transform-origin)]", "data-[state=open]:[animation:ctc-dropdown-in_var(--dropdown-open-dur)_var(--dropdown-ease)_both]", "data-[state=closed]:[animation:ctc-dropdown-out_var(--dropdown-close-dur)_var(--dropdown-ease)_both]", t),
|
|
11
|
+
...l,
|
|
12
|
+
children: [c, s && /* @__PURE__ */ n(i.Arrow, {
|
|
13
|
+
className: "fill-gray-00 stroke-gray-20",
|
|
14
|
+
width: 12,
|
|
15
|
+
height: 6
|
|
16
|
+
})]
|
|
17
|
+
}) }));
|
|
18
|
+
u.displayName = "PopoverContent";
|
|
19
|
+
//#endregion
|
|
20
|
+
export { a as Popover, s as PopoverAnchor, c as PopoverClose, u as PopoverContent, l as PopoverPortal, o as PopoverTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Popover, PopoverTrigger, PopoverAnchor, PopoverClose, PopoverPortal, PopoverContent, type PopoverContentProps } from './Popover';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
3
|
+
type RadioVariant = 'default' | 'skyblue';
|
|
4
|
+
export interface RadioGroupProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {
|
|
5
|
+
/** lg=22px (default), sm=16px */
|
|
6
|
+
size?: 'sm' | 'lg';
|
|
7
|
+
/** Selected color. default=gray-80, skyblue=B2C brand. */
|
|
8
|
+
variant?: RadioVariant;
|
|
9
|
+
}
|
|
10
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import * as r from "@radix-ui/react-radio-group";
|
|
5
|
+
//#region src/components/RadioGroup/RadioGroup.tsx
|
|
6
|
+
var i = t.createContext({
|
|
7
|
+
size: "lg",
|
|
8
|
+
variant: "default"
|
|
9
|
+
}), a = {
|
|
10
|
+
default: "data-[state=checked]:border-gray-80 hover:data-[state=checked]:border-gray-100",
|
|
11
|
+
skyblue: "data-[state=checked]:border-skyblue hover:data-[state=checked]:border-skyblue-hover"
|
|
12
|
+
}, o = {
|
|
13
|
+
default: "bg-gray-80 group-hover:bg-gray-100",
|
|
14
|
+
skyblue: "bg-skyblue group-hover:bg-skyblue-hover"
|
|
15
|
+
}, s = t.forwardRef(({ className: t, size: a = "lg", variant: o = "default", ...s }, c) => /* @__PURE__ */ n(i.Provider, {
|
|
16
|
+
value: {
|
|
17
|
+
size: a,
|
|
18
|
+
variant: o
|
|
19
|
+
},
|
|
20
|
+
children: /* @__PURE__ */ n(r.Root, {
|
|
21
|
+
ref: c,
|
|
22
|
+
className: e("grid gap-x2", t),
|
|
23
|
+
...s
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
s.displayName = "RadioGroup";
|
|
27
|
+
var c = t.forwardRef(({ className: s, ...c }, l) => {
|
|
28
|
+
let { size: u, variant: d } = t.useContext(i);
|
|
29
|
+
return /* @__PURE__ */ n(r.Item, {
|
|
30
|
+
ref: l,
|
|
31
|
+
"data-pressable": "",
|
|
32
|
+
className: e("group peer aspect-square shrink-0 rounded-full border bg-gray-00", "inline-flex items-center justify-center", "[transition:border-color_var(--duration-fast)_var(--ease-out),background-color_var(--duration-fast)_var(--ease-out),transform_var(--duration-fast)_var(--ease-out)]", "active:scale-[0.92]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "border-gray-80 hover:border-gray-100", a[d], "disabled:cursor-not-allowed disabled:border-gray-40 disabled:bg-gray-20 disabled:active:transform-none", "disabled:data-[state=checked]:border-gray-40", "aria-invalid:border-error", u === "lg" && "size-[22px]", u === "sm" && "size-[16px]", s),
|
|
33
|
+
...c,
|
|
34
|
+
children: /* @__PURE__ */ n(r.Indicator, {
|
|
35
|
+
className: "flex items-center justify-center",
|
|
36
|
+
children: /* @__PURE__ */ n("span", { className: e("block rounded-full", o[d], "[transition:background-color_var(--duration-fast)_var(--ease-out)]", "group-disabled:bg-gray-40", "[animation:ctc-scale-in_var(--duration-fast)_var(--ease-out)]", u === "lg" && "size-[10px]", u === "sm" && "size-[8px]") })
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
c.displayName = "RadioGroupItem";
|
|
41
|
+
//#endregion
|
|
42
|
+
export { s as RadioGroup, c as RadioGroupItem };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioGroup, RadioGroupItem } from './RadioGroup';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
export declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
4
|
+
export declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
export interface SelectTriggerProps extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> {
|
|
7
|
+
size?: 'sm' | 'lg';
|
|
8
|
+
}
|
|
9
|
+
export declare const SelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { inputVariants as t } from "../Input/Input.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { CaretDown as a, CaretUp as o, Check as s } from "@phosphor-icons/react";
|
|
6
|
+
import * as c from "@radix-ui/react-select";
|
|
7
|
+
//#region src/components/Select/Select.tsx
|
|
8
|
+
var l = c.Root, u = c.Group, d = c.Value, f = n.forwardRef(({ className: n, size: o = "sm", children: s, ...l }, u) => /* @__PURE__ */ i(c.Trigger, {
|
|
9
|
+
ref: u,
|
|
10
|
+
className: e(t({ size: o }), "inline-flex items-center justify-between", "data-[placeholder]:text-gray-40", n),
|
|
11
|
+
...l,
|
|
12
|
+
children: [s, /* @__PURE__ */ r(c.Icon, {
|
|
13
|
+
asChild: !0,
|
|
14
|
+
children: /* @__PURE__ */ r(a, {
|
|
15
|
+
weight: "bold",
|
|
16
|
+
className: e("size-4 text-gray-60 shrink-0 ml-x2", "[transition:transform_var(--duration-base)_var(--ease-out)]", "group-data-[state=open]/select:rotate-180", "[[data-state=open]_&]:rotate-180")
|
|
17
|
+
})
|
|
18
|
+
})]
|
|
19
|
+
}));
|
|
20
|
+
f.displayName = "SelectTrigger";
|
|
21
|
+
var p = n.forwardRef(({ className: t, ...n }, i) => /* @__PURE__ */ r(c.ScrollUpButton, {
|
|
22
|
+
ref: i,
|
|
23
|
+
className: e("flex cursor-default items-center justify-center py-x1", t),
|
|
24
|
+
...n,
|
|
25
|
+
children: /* @__PURE__ */ r(o, {
|
|
26
|
+
weight: "bold",
|
|
27
|
+
className: "size-4"
|
|
28
|
+
})
|
|
29
|
+
}));
|
|
30
|
+
p.displayName = "SelectScrollUpButton";
|
|
31
|
+
var m = n.forwardRef(({ className: t, ...n }, i) => /* @__PURE__ */ r(c.ScrollDownButton, {
|
|
32
|
+
ref: i,
|
|
33
|
+
className: e("flex cursor-default items-center justify-center py-x1", t),
|
|
34
|
+
...n,
|
|
35
|
+
children: /* @__PURE__ */ r(a, {
|
|
36
|
+
weight: "bold",
|
|
37
|
+
className: "size-4"
|
|
38
|
+
})
|
|
39
|
+
}));
|
|
40
|
+
m.displayName = "SelectScrollDownButton";
|
|
41
|
+
var h = n.forwardRef(({ className: t, children: n, position: a = "popper", ...o }, s) => /* @__PURE__ */ r(c.Portal, { children: /* @__PURE__ */ i(c.Content, {
|
|
42
|
+
ref: s,
|
|
43
|
+
position: a,
|
|
44
|
+
className: e("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-x2 border border-gray-20 bg-gray-00", "shadow-md text-gray-80", "[transform-origin:var(--radix-select-content-transform-origin)]", "data-[state=open]:[animation:ctc-dropdown-in_var(--dropdown-open-dur)_var(--dropdown-ease)_both]", "data-[state=closed]:[animation:ctc-dropdown-out_var(--dropdown-close-dur)_var(--dropdown-ease)_both]", t),
|
|
45
|
+
...o,
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ r(p, {}),
|
|
48
|
+
/* @__PURE__ */ r(c.Viewport, {
|
|
49
|
+
className: e("p-x1 ctc-stagger", a === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
|
|
50
|
+
children: n
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ r(m, {})
|
|
53
|
+
]
|
|
54
|
+
}) }));
|
|
55
|
+
h.displayName = "SelectContent";
|
|
56
|
+
var g = n.forwardRef(({ className: t, ...n }, i) => /* @__PURE__ */ r(c.Label, {
|
|
57
|
+
ref: i,
|
|
58
|
+
className: e("px-x3 py-x2 text-[12px] text-gray-60", t),
|
|
59
|
+
...n
|
|
60
|
+
}));
|
|
61
|
+
g.displayName = "SelectLabel";
|
|
62
|
+
var _ = n.forwardRef(({ className: t, children: n, ...a }, o) => /* @__PURE__ */ i(c.Item, {
|
|
63
|
+
ref: o,
|
|
64
|
+
className: e("relative flex w-full cursor-default select-none items-center rounded-x1 py-x2 pl-x3 pr-x8 text-[14px]", "outline-none hover:bg-gray-20 focus:bg-gray-20", "[transition:background-color_var(--duration-fast)_var(--ease-out),color_var(--duration-fast)_var(--ease-out)]", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", t),
|
|
65
|
+
...a,
|
|
66
|
+
children: [/* @__PURE__ */ r("span", {
|
|
67
|
+
className: "absolute right-x2 flex size-4 items-center justify-center",
|
|
68
|
+
children: /* @__PURE__ */ r(c.ItemIndicator, { children: /* @__PURE__ */ r(s, {
|
|
69
|
+
weight: "bold",
|
|
70
|
+
className: "size-4 text-primary"
|
|
71
|
+
}) })
|
|
72
|
+
}), /* @__PURE__ */ r(c.ItemText, { children: n })]
|
|
73
|
+
}));
|
|
74
|
+
_.displayName = "SelectItem";
|
|
75
|
+
var v = n.forwardRef(({ className: t, ...n }, i) => /* @__PURE__ */ r(c.Separator, {
|
|
76
|
+
ref: i,
|
|
77
|
+
className: e("-mx-1 my-x1 h-px bg-gray-20", t),
|
|
78
|
+
...n
|
|
79
|
+
}));
|
|
80
|
+
v.displayName = "SelectSeparator";
|
|
81
|
+
//#endregion
|
|
82
|
+
export { l as Select, h as SelectContent, u as SelectGroup, _ as SelectItem, g as SelectLabel, m as SelectScrollDownButton, p as SelectScrollUpButton, v as SelectSeparator, f as SelectTrigger, d as SelectValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, type SelectTriggerProps } from './Select';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Select as e, SelectContent as t, SelectGroup as n, SelectItem as r, SelectLabel as i, SelectScrollDownButton as a, SelectScrollUpButton as o, SelectSeparator as s, SelectTrigger as c, SelectValue as l } from "./Select.js";
|
|
2
|
+
export { e as Select, t as SelectContent, n as SelectGroup, r as SelectItem, i as SelectLabel, a as SelectScrollDownButton, o as SelectScrollUpButton, s as SelectSeparator, c as SelectTrigger, l as SelectValue };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const spinnerVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface SpinnerProps extends React.SVGAttributes<SVGSVGElement>, VariantProps<typeof spinnerVariants> {
|
|
7
|
+
}
|
|
8
|
+
export declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<SVGSVGElement>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { cva as n } from "class-variance-authority";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { CircleNotch as i } from "@phosphor-icons/react";
|
|
6
|
+
//#region src/components/Spinner/Spinner.tsx
|
|
7
|
+
var a = n("shrink-0 [animation:ctc-spin_700ms_linear_infinite]", {
|
|
8
|
+
variants: { size: {
|
|
9
|
+
sm: "size-4",
|
|
10
|
+
md: "size-5",
|
|
11
|
+
lg: "size-6"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { size: "md" }
|
|
14
|
+
}), o = t.forwardRef(({ className: t, size: n, ...o }, s) => /* @__PURE__ */ r(i, {
|
|
15
|
+
ref: s,
|
|
16
|
+
weight: "bold",
|
|
17
|
+
role: "status",
|
|
18
|
+
"aria-label": "Cargando",
|
|
19
|
+
className: e(a({ size: n }), t),
|
|
20
|
+
...o
|
|
21
|
+
}));
|
|
22
|
+
o.displayName = "Spinner";
|
|
23
|
+
//#endregion
|
|
24
|
+
export { o as Spinner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Spinner, type SpinnerProps } from './Spinner';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
|
+
export interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {
|
|
4
|
+
/** lg=40×22 (default), sm=30×16 */
|
|
5
|
+
size?: 'sm' | 'lg';
|
|
6
|
+
}
|
|
7
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import * as r from "@radix-ui/react-switch";
|
|
5
|
+
//#region src/components/Switch/Switch.tsx
|
|
6
|
+
var i = t.forwardRef(({ className: t, size: i = "lg", ...a }, o) => /* @__PURE__ */ n(r.Root, {
|
|
7
|
+
ref: o,
|
|
8
|
+
"data-pressable": "",
|
|
9
|
+
className: e("peer relative inline-flex shrink-0 cursor-pointer items-center rounded-full", "[transition:background-color_var(--duration-base)_var(--ease-out),transform_var(--duration-fast)_var(--ease-out)]", "active:scale-[0.95]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "data-[state=unchecked]:bg-gray-40", "data-[state=checked]:bg-gray-80", "hover:data-[state=checked]:bg-gray-100", "disabled:cursor-not-allowed disabled:active:transform-none", "disabled:data-[state=unchecked]:bg-gray-20", "disabled:data-[state=checked]:bg-gray-40", i === "lg" && "h-[22px] w-[40px]", i === "sm" && "h-[16px] w-[30px]", t),
|
|
10
|
+
...a,
|
|
11
|
+
children: /* @__PURE__ */ n(r.Thumb, { className: e("pointer-events-none block rounded-full bg-gray-00", "[transition:transform_var(--duration-switch)_var(--ease-back),background-color_var(--duration-fast)_var(--ease-out)]", "group-disabled:bg-gray-40 peer-disabled:bg-gray-40", i === "lg" && [
|
|
12
|
+
"size-[18px]",
|
|
13
|
+
"translate-x-[2px]",
|
|
14
|
+
"data-[state=checked]:translate-x-[20px]"
|
|
15
|
+
], i === "sm" && [
|
|
16
|
+
"size-[12px]",
|
|
17
|
+
"translate-x-[2px]",
|
|
18
|
+
"data-[state=checked]:translate-x-[16px]"
|
|
19
|
+
]) })
|
|
20
|
+
}));
|
|
21
|
+
i.displayName = "Switch";
|
|
22
|
+
//#endregion
|
|
23
|
+
export { i as Switch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch, type SwitchProps } from './Switch';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
|
+
type TabsVariant = 'segmented' | 'underline';
|
|
4
|
+
type TabsSize = 'sm' | 'lg';
|
|
5
|
+
type TabsSpacing = 'condensed' | 'expanded';
|
|
6
|
+
export interface TabsProps extends React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> {
|
|
7
|
+
variant?: TabsVariant;
|
|
8
|
+
/** Underline only. lg=Big (16px), sm=Small (12px). */
|
|
9
|
+
size?: TabsSize;
|
|
10
|
+
/** Underline only. condensed=tighter gaps, expanded=wider gaps. */
|
|
11
|
+
spacing?: TabsSpacing;
|
|
12
|
+
}
|
|
13
|
+
export declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
export declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import * as i from "@radix-ui/react-tabs";
|
|
5
|
+
//#region src/components/Tabs/Tabs.tsx
|
|
6
|
+
var a = t.createContext({
|
|
7
|
+
variant: "underline",
|
|
8
|
+
size: "lg",
|
|
9
|
+
spacing: "condensed"
|
|
10
|
+
}), o = t.forwardRef(({ className: t, variant: r = "underline", size: o = "lg", spacing: s = "condensed", ...c }, l) => /* @__PURE__ */ n(a.Provider, {
|
|
11
|
+
value: {
|
|
12
|
+
variant: r,
|
|
13
|
+
size: o,
|
|
14
|
+
spacing: s
|
|
15
|
+
},
|
|
16
|
+
children: /* @__PURE__ */ n(i.Root, {
|
|
17
|
+
ref: l,
|
|
18
|
+
className: e("flex flex-col gap-x4", t),
|
|
19
|
+
...c
|
|
20
|
+
})
|
|
21
|
+
}));
|
|
22
|
+
o.displayName = "Tabs";
|
|
23
|
+
var s = {
|
|
24
|
+
lg: {
|
|
25
|
+
condensed: "gap-x8",
|
|
26
|
+
expanded: "gap-x12"
|
|
27
|
+
},
|
|
28
|
+
sm: {
|
|
29
|
+
condensed: "gap-x4",
|
|
30
|
+
expanded: "gap-x8"
|
|
31
|
+
}
|
|
32
|
+
}, c = t.forwardRef(({ className: r, ...o }, c) => {
|
|
33
|
+
let { variant: l, size: u, spacing: d } = t.useContext(a);
|
|
34
|
+
return /* @__PURE__ */ n(i.List, {
|
|
35
|
+
ref: c,
|
|
36
|
+
className: e("inline-flex", l === "segmented" && "rounded-x2 bg-gray-20 p-x1 gap-x1", l === "underline" && [
|
|
37
|
+
"relative items-end",
|
|
38
|
+
s[u][d],
|
|
39
|
+
"after:absolute after:left-0 after:right-0 after:bottom-0 after:h-px after:bg-gray-80",
|
|
40
|
+
"after:[transition:background-color_var(--duration-fast)_var(--ease-out)]",
|
|
41
|
+
"has-[[data-state=active]:hover]:after:bg-gray-100",
|
|
42
|
+
"has-[:disabled]:after:bg-gray-40"
|
|
43
|
+
], r),
|
|
44
|
+
...o
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
c.displayName = "TabsList";
|
|
48
|
+
var l = t.forwardRef(({ className: o, children: s, ...c }, l) => {
|
|
49
|
+
let { variant: u, size: d } = t.useContext(a);
|
|
50
|
+
return u === "segmented" ? /* @__PURE__ */ n(i.Trigger, {
|
|
51
|
+
ref: l,
|
|
52
|
+
"data-pressable": "",
|
|
53
|
+
className: e("inline-flex items-center justify-center font-sans text-[14px] leading-[20px]", "rounded-x2 px-x4 py-x2 text-gray-60", "[transition:color_var(--duration-fast)_var(--ease-out),background-color_var(--duration-fast)_var(--ease-out),box-shadow_var(--duration-fast)_var(--ease-out),transform_var(--duration-fast)_var(--ease-out)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50", "data-[state=active]:bg-gray-00 data-[state=active]:text-gray-80 data-[state=active]:shadow-sm", o),
|
|
54
|
+
...c,
|
|
55
|
+
children: s
|
|
56
|
+
}) : /* @__PURE__ */ r(i.Trigger, {
|
|
57
|
+
ref: l,
|
|
58
|
+
"data-pressable": "",
|
|
59
|
+
className: e("group relative inline-flex flex-col items-stretch gap-x1 min-w-[100px] font-sans tracking-[-0.5px]", "text-center text-gray-80", "focus-visible:outline-none focus-visible:[&_span]:underline focus-visible:[&_span]:underline-offset-2", "[transition:color_var(--duration-fast)_var(--ease-out)]", "hover:text-gray-100", "disabled:text-gray-40 disabled:cursor-not-allowed", "data-[state=active]:font-bold", "data-[state=inactive]:font-normal", d === "lg" && "text-[16px] leading-[22px]", d === "sm" && "text-[12px] leading-[16px]", o),
|
|
60
|
+
...c,
|
|
61
|
+
children: [/* @__PURE__ */ n("span", {
|
|
62
|
+
className: "px-x1",
|
|
63
|
+
children: s
|
|
64
|
+
}), /* @__PURE__ */ n("span", {
|
|
65
|
+
"aria-hidden": !0,
|
|
66
|
+
className: e("self-stretch h-[4px] rounded-tl-x1 rounded-tr-x1", "[transition:background-color_var(--duration-fast)_var(--ease-out)]", "bg-transparent", "group-hover:group-data-[state=inactive]:bg-gray-20", "group-data-[state=active]:bg-gray-80", "group-hover:group-data-[state=active]:bg-gray-100", "group-disabled:group-data-[state=active]:bg-gray-40")
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
l.displayName = "TabsTrigger";
|
|
71
|
+
var u = t.forwardRef(({ className: t, ...r }, a) => /* @__PURE__ */ n(i.Content, {
|
|
72
|
+
ref: a,
|
|
73
|
+
className: e("focus-visible:outline-none", "data-[state=active]:[animation:ctc-fade-rise_var(--duration-base)_var(--ease-out)]", t),
|
|
74
|
+
...r
|
|
75
|
+
}));
|
|
76
|
+
u.displayName = "TabsContent";
|
|
77
|
+
//#endregion
|
|
78
|
+
export { o as Tabs, u as TabsContent, c as TabsList, l as TabsTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, type TabsProps } from './Tabs';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface TimeValue {
|
|
2
|
+
hours: number;
|
|
3
|
+
minutes: number;
|
|
4
|
+
}
|
|
5
|
+
export interface TimePickerProps {
|
|
6
|
+
value?: TimeValue;
|
|
7
|
+
defaultValue?: TimeValue;
|
|
8
|
+
onValueChange?: (value: TimeValue) => void;
|
|
9
|
+
/** Step in minutes for the minutes select. Default: 5. */
|
|
10
|
+
minuteStep?: number;
|
|
11
|
+
hour12?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
size?: 'sm' | 'lg';
|
|
14
|
+
className?: string;
|
|
15
|
+
'data-testid'?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const TimePicker: {
|
|
18
|
+
({ value, defaultValue, onValueChange, minuteStep, hour12, disabled, size, className, ...props }: TimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|