@yenio-pld/blocks 1.2.0-rc.2 → 1.2.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5993 -2147
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +613 -86
- package/dist/index.d.ts +613 -86
- package/dist/index.js +5440 -1667
- package/dist/index.js.map +1 -1
- package/dist/theme-init.cjs +1 -1
- package/dist/theme-init.cjs.map +1 -1
- package/dist/theme-init.d.cts +1 -1
- package/dist/theme-init.d.ts +1 -1
- package/dist/theme-init.js +1 -1
- package/dist/theme-init.js.map +1 -1
- package/dist/ui/alert-dialog.js +4 -1
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.js +7 -1
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/checkbox.d.ts +16 -0
- package/dist/ui/checkbox.js +66 -0
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/combobox.d.ts +1 -0
- package/dist/ui/combobox.js +4 -0
- package/dist/ui/combobox.js.map +1 -0
- package/dist/ui/dialog.d.ts +4 -2
- package/dist/ui/dialog.js +61 -5
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/select.d.ts +5 -1
- package/dist/ui/select.js +137 -10
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sheet.js +3 -3
- package/dist/ui/sheet.js.map +1 -1
- package/package.json +10 -1
package/dist/ui/select.js
CHANGED
|
@@ -1,21 +1,148 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Select as Select$1 } from '@base-ui/react/select';
|
|
4
|
+
import { ChevronDownIcon, CheckIcon } from 'lucide-react';
|
|
2
5
|
import { clsx } from 'clsx';
|
|
3
6
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import {
|
|
7
|
+
import { useDialogPortalContainer } from './dialog.js';
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
9
|
|
|
6
10
|
function cn(...inputs) {
|
|
7
11
|
return twMerge(clsx(inputs));
|
|
8
12
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
function parseOptionChildren(children) {
|
|
14
|
+
const options = [];
|
|
15
|
+
React.Children.forEach(children, (child) => {
|
|
16
|
+
if (!React.isValidElement(child) || child.type !== "option") return;
|
|
17
|
+
const props = child.props;
|
|
18
|
+
if (props.value === void 0 || props.value === null) return;
|
|
19
|
+
options.push({
|
|
20
|
+
value: String(props.value),
|
|
21
|
+
label: props.children ?? String(props.value),
|
|
22
|
+
disabled: props.disabled
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return options;
|
|
26
|
+
}
|
|
27
|
+
var triggerClassName = "flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
|
|
28
|
+
var popupClassName = "pointer-events-auto z-[100] max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95";
|
|
29
|
+
var itemClassName = "relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none pointer-events-auto data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-accent data-highlighted:text-accent-foreground data-selected:bg-accent/50";
|
|
30
|
+
function optionsSignature(options) {
|
|
31
|
+
return options.map(
|
|
32
|
+
(option) => `${option.value}\0${option.disabled ? "1" : "0"}\0${typeof option.label === "string" ? option.label : ""}`
|
|
33
|
+
).join("\n");
|
|
34
|
+
}
|
|
35
|
+
function Select({
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
value,
|
|
39
|
+
defaultValue,
|
|
40
|
+
onChange,
|
|
41
|
+
disabled,
|
|
42
|
+
required,
|
|
43
|
+
name,
|
|
44
|
+
id,
|
|
45
|
+
autoFocus,
|
|
46
|
+
tabIndex,
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
"aria-labelledby": ariaLabelledby,
|
|
49
|
+
"aria-describedby": ariaDescribedby,
|
|
50
|
+
"aria-invalid": ariaInvalid
|
|
51
|
+
}) {
|
|
52
|
+
const dialogPortalContainer = useDialogPortalContainer();
|
|
53
|
+
const optionsRef = React.useRef([]);
|
|
54
|
+
const nextOptions = parseOptionChildren(children);
|
|
55
|
+
if (optionsSignature(optionsRef.current) !== optionsSignature(nextOptions)) {
|
|
56
|
+
optionsRef.current = nextOptions;
|
|
57
|
+
}
|
|
58
|
+
const options = optionsRef.current;
|
|
59
|
+
const items = React.useMemo(
|
|
60
|
+
() => options.map((option) => ({ value: option.value, label: option.label })),
|
|
61
|
+
[options]
|
|
62
|
+
);
|
|
63
|
+
const handleValueChange = React.useCallback(
|
|
64
|
+
(next) => {
|
|
65
|
+
if (!onChange) return;
|
|
66
|
+
const nextValue = next ?? "";
|
|
67
|
+
onChange({
|
|
68
|
+
target: { value: nextValue },
|
|
69
|
+
currentTarget: { value: nextValue }
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
[onChange]
|
|
73
|
+
);
|
|
74
|
+
const controlledValue = value === void 0 || value === null || value === "" ? null : String(value);
|
|
75
|
+
const uncontrolledDefault = defaultValue === void 0 || defaultValue === null || defaultValue === "" ? void 0 : String(defaultValue);
|
|
76
|
+
if (options.length === 0) {
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"select",
|
|
79
|
+
{
|
|
80
|
+
"data-slot": "select",
|
|
81
|
+
className: cn(triggerClassName, className),
|
|
82
|
+
disabled: true
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ jsxs(
|
|
87
|
+
Select$1.Root,
|
|
12
88
|
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
89
|
+
name,
|
|
90
|
+
required,
|
|
91
|
+
disabled,
|
|
92
|
+
items,
|
|
93
|
+
value: controlledValue,
|
|
94
|
+
defaultValue: uncontrolledDefault,
|
|
95
|
+
onValueChange: handleValueChange,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsxs(
|
|
98
|
+
Select$1.Trigger,
|
|
99
|
+
{
|
|
100
|
+
"data-slot": "select",
|
|
101
|
+
id,
|
|
102
|
+
autoFocus,
|
|
103
|
+
tabIndex,
|
|
104
|
+
"aria-label": ariaLabel,
|
|
105
|
+
"aria-labelledby": ariaLabelledby,
|
|
106
|
+
"aria-describedby": ariaDescribedby,
|
|
107
|
+
"aria-invalid": ariaInvalid,
|
|
108
|
+
className: cn(triggerClassName, className),
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx(Select$1.Value, { className: "truncate text-left" }),
|
|
111
|
+
/* @__PURE__ */ jsx(Select$1.Icon, { className: "pointer-events-none shrink-0 text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" }) })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(Select$1.Portal, { container: dialogPortalContainer ?? void 0, children: /* @__PURE__ */ jsx(
|
|
116
|
+
Select$1.Positioner,
|
|
117
|
+
{
|
|
118
|
+
alignItemWithTrigger: false,
|
|
119
|
+
"data-slot": "select-positioner",
|
|
120
|
+
className: "pointer-events-auto isolate z-[100] outline-none",
|
|
121
|
+
sideOffset: 4,
|
|
122
|
+
children: /* @__PURE__ */ jsx(
|
|
123
|
+
Select$1.Popup,
|
|
124
|
+
{
|
|
125
|
+
"data-slot": "select-popup",
|
|
126
|
+
className: popupClassName,
|
|
127
|
+
children: /* @__PURE__ */ jsx(Select$1.List, { onWheel: (event) => event.stopPropagation(), children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
128
|
+
Select$1.Item,
|
|
129
|
+
{
|
|
130
|
+
value: option.value,
|
|
131
|
+
label: typeof option.label === "string" ? option.label : option.value,
|
|
132
|
+
disabled: option.disabled,
|
|
133
|
+
className: itemClassName,
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, { children: option.label }),
|
|
136
|
+
/* @__PURE__ */ jsx(Select$1.ItemIndicator, { className: "pointer-events-none absolute right-1.5 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
option.value
|
|
140
|
+
)) })
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
) })
|
|
145
|
+
]
|
|
19
146
|
}
|
|
20
147
|
);
|
|
21
148
|
}
|
package/dist/ui/select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/select.tsx"],"names":[],"mappings":";;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACCA,SAAS,MAAA,CAAO,EAAE,SAAA,EAAW,GAAG,OAAM,EAAmC;AACxE,EAAA,uBACC,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACV,4fAAA;AAAA,QACA;AAAA,OACD;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF","file":"select.js","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\nfunction Select({ className, ...props }: React.ComponentProps<\"select\">) {\n\treturn (\n\t\t<select\n\t\t\tdata-slot=\"select\"\n\t\t\tclassName={cn(\n\t\t\t\t\"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Select };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/select.tsx"],"names":["SelectPrimitive"],"mappings":";;;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACUA,SAAS,oBAAoB,QAAA,EAA2C;AACvE,EAAA,MAAM,UAA0B,EAAC;AACjC,EAAM,KAAA,CAAA,QAAA,CAAS,OAAA,CAAQ,QAAA,EAAU,CAAC,KAAA,KAAU;AAC3C,IAAA,IAAI,CAAO,KAAA,CAAA,cAAA,CAAe,KAA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,EAAU,mBAAA;AAAA,YACV,SAAA,EAAU,kDAAA;AAAA,YACV,UAAA,EAAY,CAAA;AAAA,YAEZ,QAAA,kBAAA,GAAA;AAAA,cAACA,QAAA,CAAgB,KAAA;AAAA,cAAhB;AAAA,gBACA,WAAA,EAAU,cAAA;AAAA,gBACV,SAAA,EAAW,cAAA;AAAA,gBAEX,QAAA,kBAAA,GAAA,CAACA,QAAA,CAAgB,IAAA,EAAhB,EAAqB,OAAA,EAAS,CAAC,KAAA,KAAU,KAAA,CAAM,eAAA,EAAgB,EAC9D,QAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,qBACb,IAAA;AAAA,kBAACA,QAAA,CAAgB,IAAA;AAAA,kBAAhB;AAAA,oBAEA,OAAO,MAAA,CAAO,KAAA;AAAA,oBACd,OACC,OAAO,MAAA,CAAO,UAAU,QAAA,GACrB,MAAA,CAAO,QACP,MAAA,CAAO,KAAA;AAAA,oBAEX,UAAU,MAAA,CAAO,QAAA;AAAA,oBACjB,SAAA,EAAW,aAAA;AAAA,oBAEX,QAAA,EAAA;AAAA,sCAAA,GAAA,CAACA,QAAA,CAAgB,QAAA,EAAhB,EACC,QAAA,EAAA,MAAA,CAAO,KAAA,EACT,CAAA;AAAA,sCACA,GAAA,CAACA,QAAA,CAAgB,aAAA,EAAhB,EAA8B,SAAA,EAAU,kFACxC,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAU,QAAA,EAAS,CAAA,EAC/B;AAAA;AAAA,mBAAA;AAAA,kBAfK,MAAA,CAAO;AAAA,iBAiBb,CAAA,EACF;AAAA;AAAA;AACD;AAAA,SACD,EACD;AAAA;AAAA;AAAA,GACD;AAEF","file":"select.js","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport { CheckIcon, ChevronDownIcon } from \"lucide-react\";\n\nimport { cn } from \"../lib/utils\";\nimport { useDialogPortalContainer } from \"./dialog\";\n\ntype ParsedOption = {\n\tvalue: string;\n\tlabel: React.ReactNode;\n\tdisabled?: boolean;\n};\n\nfunction parseOptionChildren(children: React.ReactNode): ParsedOption[] {\n\tconst options: ParsedOption[] = [];\n\tReact.Children.forEach(children, (child) => {\n\t\tif (!React.isValidElement(child) || child.type !== \"option\") return;\n\t\tconst props = child.props as React.OptionHTMLAttributes<HTMLOptionElement>;\n\t\tif (props.value === undefined || props.value === null) return;\n\t\toptions.push({\n\t\t\tvalue: String(props.value),\n\t\t\tlabel: props.children ?? String(props.value),\n\t\t\tdisabled: props.disabled,\n\t\t});\n\t});\n\treturn options;\n}\n\nconst triggerClassName =\n\t\"flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\";\n\nconst popupClassName =\n\t\"pointer-events-auto z-[100] max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95\";\n\nconst itemClassName =\n\t\"relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none pointer-events-auto data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-accent data-highlighted:text-accent-foreground data-selected:bg-accent/50\";\n\ntype SelectProps = Omit<\n\tReact.ComponentProps<\"select\">,\n\t\"onChange\" | \"children\" | \"size\" | \"multiple\"\n> & {\n\tonChange?: React.ChangeEventHandler<HTMLSelectElement>;\n\tchildren?: React.ReactNode;\n};\n\nfunction optionsSignature(options: ParsedOption[]): string {\n\treturn options\n\t\t.map(\n\t\t\t(option) =>\n\t\t\t\t`${option.value}\\0${option.disabled ? \"1\" : \"0\"}\\0${\n\t\t\t\t\ttypeof option.label === \"string\" ? option.label : \"\"\n\t\t\t\t}`,\n\t\t)\n\t\t.join(\"\\n\");\n}\n\nfunction Select({\n\tclassName,\n\tchildren,\n\tvalue,\n\tdefaultValue,\n\tonChange,\n\tdisabled,\n\trequired,\n\tname,\n\tid,\n\tautoFocus,\n\ttabIndex,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledby,\n\t\"aria-describedby\": ariaDescribedby,\n\t\"aria-invalid\": ariaInvalid,\n}: SelectProps) {\n\tconst dialogPortalContainer = useDialogPortalContainer();\n\t// `children` is a new element tree every parent render; keep the same options\n\t// array when value/label/disabled are unchanged so an open list does not remount.\n\tconst optionsRef = React.useRef<ParsedOption[]>([]);\n\tconst nextOptions = parseOptionChildren(children);\n\tif (optionsSignature(optionsRef.current) !== optionsSignature(nextOptions)) {\n\t\toptionsRef.current = nextOptions;\n\t}\n\tconst options = optionsRef.current;\n\tconst items = React.useMemo(\n\t\t() =>\n\t\t\toptions.map((option) => ({ value: option.value, label: option.label })),\n\t\t[options],\n\t);\n\n\tconst handleValueChange = React.useCallback(\n\t\t(next: string | null) => {\n\t\t\tif (!onChange) return;\n\t\t\tconst nextValue = next ?? \"\";\n\t\t\tonChange({\n\t\t\t\ttarget: { value: nextValue },\n\t\t\t\tcurrentTarget: { value: nextValue },\n\t\t\t} as React.ChangeEvent<HTMLSelectElement>);\n\t\t},\n\t\t[onChange],\n\t);\n\n\t// Base UI rejects \"\" as a controlled value (throws → workspace error boundary).\n\tconst controlledValue =\n\t\tvalue === undefined || value === null || value === \"\"\n\t\t\t? null\n\t\t\t: String(value);\n\tconst uncontrolledDefault =\n\t\tdefaultValue === undefined || defaultValue === null || defaultValue === \"\"\n\t\t\t? undefined\n\t\t\t: String(defaultValue);\n\n\tif (options.length === 0) {\n\t\treturn (\n\t\t\t<select\n\t\t\t\tdata-slot=\"select\"\n\t\t\t\tclassName={cn(triggerClassName, className)}\n\t\t\t\tdisabled\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SelectPrimitive.Root\n\t\t\tname={name}\n\t\t\trequired={required}\n\t\t\tdisabled={disabled}\n\t\t\t// Keep the Base UI default (modal). `modal={false}` leaves the popup under\n\t\t\t// Radix Dialog's body `pointer-events: none`, so options cannot be clicked\n\t\t\t// and the list appears to blur/collapse immediately.\n\t\t\titems={items}\n\t\t\tvalue={controlledValue}\n\t\t\tdefaultValue={uncontrolledDefault}\n\t\t\tonValueChange={handleValueChange}\n\t\t>\n\t\t\t<SelectPrimitive.Trigger\n\t\t\t\tdata-slot=\"select\"\n\t\t\t\tid={id}\n\t\t\t\tautoFocus={autoFocus}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\taria-label={ariaLabel}\n\t\t\t\taria-labelledby={ariaLabelledby}\n\t\t\t\taria-describedby={ariaDescribedby}\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cn(triggerClassName, className)}\n\t\t\t>\n\t\t\t\t<SelectPrimitive.Value className=\"truncate text-left\" />\n\t\t\t\t<SelectPrimitive.Icon className=\"pointer-events-none shrink-0 text-muted-foreground\">\n\t\t\t\t\t<ChevronDownIcon className=\"size-4\" />\n\t\t\t\t</SelectPrimitive.Icon>\n\t\t\t</SelectPrimitive.Trigger>\n\t\t\t{/* Prefer Dialog content as portal root so Radix focus trap keeps the list\n\t\t\t open; fall back to body with pointer-events/z overrides. */}\n\t\t\t<SelectPrimitive.Portal container={dialogPortalContainer ?? undefined}>\n\t\t\t\t<SelectPrimitive.Positioner\n\t\t\t\t\talignItemWithTrigger={false}\n\t\t\t\t\tdata-slot=\"select-positioner\"\n\t\t\t\t\tclassName=\"pointer-events-auto isolate z-[100] outline-none\"\n\t\t\t\t\tsideOffset={4}\n\t\t\t\t>\n\t\t\t\t\t<SelectPrimitive.Popup\n\t\t\t\t\t\tdata-slot=\"select-popup\"\n\t\t\t\t\t\tclassName={popupClassName}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectPrimitive.List onWheel={(event) => event.stopPropagation()}>\n\t\t\t\t\t\t\t{options.map((option) => (\n\t\t\t\t\t\t\t\t<SelectPrimitive.Item\n\t\t\t\t\t\t\t\t\tkey={option.value}\n\t\t\t\t\t\t\t\t\tvalue={option.value}\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\ttypeof option.label === \"string\"\n\t\t\t\t\t\t\t\t\t\t\t? option.label\n\t\t\t\t\t\t\t\t\t\t\t: option.value\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisabled={option.disabled}\n\t\t\t\t\t\t\t\t\tclassName={itemClassName}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SelectPrimitive.ItemText>\n\t\t\t\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\t\t\t</SelectPrimitive.ItemText>\n\t\t\t\t\t\t\t\t\t<SelectPrimitive.ItemIndicator className=\"pointer-events-none absolute right-1.5 flex size-4 items-center justify-center\">\n\t\t\t\t\t\t\t\t\t\t<CheckIcon className=\"size-4\" />\n\t\t\t\t\t\t\t\t\t</SelectPrimitive.ItemIndicator>\n\t\t\t\t\t\t\t\t</SelectPrimitive.Item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SelectPrimitive.List>\n\t\t\t\t\t</SelectPrimitive.Popup>\n\t\t\t\t</SelectPrimitive.Positioner>\n\t\t\t</SelectPrimitive.Portal>\n\t\t</SelectPrimitive.Root>\n\t);\n}\n\nexport { Select };\n"]}
|
package/dist/ui/sheet.js
CHANGED
|
@@ -49,7 +49,7 @@ function SheetContent({
|
|
|
49
49
|
"data-slot": "sheet-content",
|
|
50
50
|
"data-side": side,
|
|
51
51
|
className: cn(
|
|
52
|
-
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
|
|
52
|
+
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding p-4 text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
|
|
53
53
|
className
|
|
54
54
|
),
|
|
55
55
|
...props,
|
|
@@ -83,7 +83,7 @@ function SheetHeader({ className, ...props }) {
|
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
"data-slot": "sheet-header",
|
|
86
|
-
className: cn("flex flex-col gap-0.5
|
|
86
|
+
className: cn("flex flex-col gap-0.5 pr-8", className),
|
|
87
87
|
...props
|
|
88
88
|
}
|
|
89
89
|
);
|
|
@@ -93,7 +93,7 @@ function SheetFooter({ className, ...props }) {
|
|
|
93
93
|
"div",
|
|
94
94
|
{
|
|
95
95
|
"data-slot": "sheet-footer",
|
|
96
|
-
className: cn("mt-auto flex flex-col gap-2
|
|
96
|
+
className: cn("mt-auto flex flex-col gap-2", className),
|
|
97
97
|
...props
|
|
98
98
|
}
|
|
99
99
|
);
|
package/dist/ui/sheet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/sheet.tsx"],"names":["SheetPrimitive"],"mappings":";;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CA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S,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AAC1E,EAAA,uBACC,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,6BAAA,EAA+B,SAAS,CAAA;AAAA,MACrD,GAAG;AAAA;AAAA,GACL;AAEF;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+B;AACxE,EAAA,uBACC,GAAA;AAAA,IAACA,MAAA,CAAe,KAAA;AAAA,IAAf;AAAA,MACA,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uCAAA,EAAyC,SAAS,CAAA;AAAA,MAC/D,GAAG;AAAA;AAAA,GACL;AAEF;AAEA,SAAS,gBAAA,CAAiB;AAAA,EACzB,SAAA;AAAA,EACA,GAAG;AACJ,CAAA,EAAqC;AACpC,EAAA,uBACC,GAAA;AAAA,IAACA,MAAA,CAAe,WAAA;AAAA,IAAf;AAAA,MACA,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,+BAAA,EAAiC,SAAS,CAAA;AAAA,MACvD,GAAG;AAAA;AAAA,GACL;AAEF","file":"sheet.js","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Dialog as SheetPrimitive } from \"@base-ui/react/dialog\";\n\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\nimport { XIcon } from \"lucide-react\";\n\nfunction Sheet({ ...props }: SheetPrimitive.Root.Props) {\n\treturn <SheetPrimitive.Root data-slot=\"sheet\" {...props} />;\n}\n\nfunction SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {\n\treturn <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />;\n}\n\nfunction SheetClose({ ...props }: SheetPrimitive.Close.Props) {\n\treturn <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />;\n}\n\nfunction SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {\n\treturn <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />;\n}\n\nfunction SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {\n\treturn (\n\t\t<SheetPrimitive.Backdrop\n\t\t\tdata-slot=\"sheet-overlay\"\n\t\t\tclassName={cn(\n\t\t\t\t\"fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetContent({\n\tclassName,\n\tchildren,\n\tside = \"right\",\n\tshowCloseButton = true,\n\t...props\n}: SheetPrimitive.Popup.Props & {\n\tside?: \"top\" | \"right\" | \"bottom\" | \"left\";\n\tshowCloseButton?: boolean;\n}) {\n\treturn (\n\t\t<SheetPortal>\n\t\t\t<SheetOverlay />\n\t\t\t<SheetPrimitive.Popup\n\t\t\t\tdata-slot=\"sheet-content\"\n\t\t\t\tdata-side={side}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding p-4 text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{showCloseButton && (\n\t\t\t\t\t<SheetPrimitive.Close\n\t\t\t\t\t\tdata-slot=\"sheet-close\"\n\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"absolute top-3 right-3\"\n\t\t\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<XIcon />\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</SheetPrimitive.Close>\n\t\t\t\t)}\n\t\t\t</SheetPrimitive.Popup>\n\t\t</SheetPortal>\n\t);\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sheet-header\"\n\t\t\tclassName={cn(\"flex flex-col gap-0.5 pr-8\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sheet-footer\"\n\t\t\tclassName={cn(\"mt-auto flex flex-col gap-2\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {\n\treturn (\n\t\t<SheetPrimitive.Title\n\t\t\tdata-slot=\"sheet-title\"\n\t\t\tclassName={cn(\"text-base font-medium text-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetDescription({\n\tclassName,\n\t...props\n}: SheetPrimitive.Description.Props) {\n\treturn (\n\t\t<SheetPrimitive.Description\n\t\t\tdata-slot=\"sheet-description\"\n\t\t\tclassName={cn(\"text-sm text-muted-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tSheet,\n\tSheetTrigger,\n\tSheetClose,\n\tSheetContent,\n\tSheetHeader,\n\tSheetFooter,\n\tSheetTitle,\n\tSheetDescription,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yenio-pld/blocks",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.20",
|
|
4
4
|
"description": "Shared UI components for Yenio applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -80,6 +80,14 @@
|
|
|
80
80
|
"types": "./dist/ui/card.d.ts",
|
|
81
81
|
"default": "./dist/ui/card.js"
|
|
82
82
|
},
|
|
83
|
+
"./ui/checkbox": {
|
|
84
|
+
"types": "./dist/ui/checkbox.d.ts",
|
|
85
|
+
"default": "./dist/ui/checkbox.js"
|
|
86
|
+
},
|
|
87
|
+
"./ui/combobox": {
|
|
88
|
+
"types": "./dist/ui/combobox.d.ts",
|
|
89
|
+
"default": "./dist/ui/combobox.js"
|
|
90
|
+
},
|
|
83
91
|
"./ui/collapsible": {
|
|
84
92
|
"types": "./dist/ui/collapsible.d.ts",
|
|
85
93
|
"default": "./dist/ui/collapsible.js"
|
|
@@ -246,6 +254,7 @@
|
|
|
246
254
|
"class-variance-authority": "^0.7.1",
|
|
247
255
|
"clsx": "^2.1.1",
|
|
248
256
|
"input-otp": "^1.5.0",
|
|
257
|
+
"libphonenumber-js": "^1.13.16",
|
|
249
258
|
"sonner": "^2.0.8",
|
|
250
259
|
"tailwind-merge": "^3.3.0",
|
|
251
260
|
"vaul": "^1.1.2"
|