@yenio-pld/blocks 1.2.0-rc.3 → 1.2.0-rc.5

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.
@@ -3,7 +3,7 @@
3
3
  // src/theme-init.ts
4
4
  var THEME_STORAGE_KEY = "theme";
5
5
  var THEME_INIT_SCRIPT_ID = "yenio-theme-init";
6
- var THEME_INIT_SCRIPT = `(function(){var t="light";var s;try{s=localStorage.getItem("${THEME_STORAGE_KEY}")}catch(e){}if(s==="dark"||s==="light"){t=s}else{try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)t="dark"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t})();`;
6
+ var THEME_INIT_SCRIPT = `(function(){var t="light";var s;try{s=localStorage.getItem("${THEME_STORAGE_KEY}")}catch(e){}if(s==="dark"||s==="light"){t=s}else{try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)t="dark"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t;var themeColors={light:null,dark:null};function captureThemeColors(){try{var metas=document.querySelectorAll('meta[name="theme-color"]');for(var i=0;i<metas.length;i++){var m=metas[i];var media=(m.getAttribute("media")||"").toLowerCase();var c=m.getAttribute("content");if(!c)continue;if(media.indexOf("dark")!==-1)themeColors.dark=c;else if(media.indexOf("light")!==-1)themeColors.light=c}}catch(e){}}function resolvedTheme(){if(r.classList.contains("dark"))return"dark";if(r.classList.contains("light"))return"light";return t}function syncThemeColor(){try{var metas=document.querySelectorAll('meta[name="theme-color"]');if(!metas.length)return;if(!themeColors.light&&!themeColors.dark)captureThemeColors();var theme=resolvedTheme();var color=themeColors[theme];if(!color){for(var i=0;i<metas.length;i++){var media=metas[i].getAttribute("media")||"";if(media.indexOf(theme)!==-1){color=metas[i].getAttribute("content");break}}}if(!color)return;for(var j=0;j<metas.length;j++){metas[j].setAttribute("content",color);metas[j].setAttribute("media","all")}}catch(e){}}syncThemeColor();try{new MutationObserver(function(){syncThemeColor()}).observe(r,{attributes:true,attributeFilter:["class"]})}catch(e){}})();`;
7
7
 
8
8
  exports.THEME_INIT_SCRIPT = THEME_INIT_SCRIPT;
9
9
  exports.THEME_INIT_SCRIPT_ID = THEME_INIT_SCRIPT_ID;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/theme-init.ts"],"names":[],"mappings":";;;AACO,IAAM,iBAAA,GAAoB;AAE1B,IAAM,oBAAA,GAAuB;AAO7B,IAAM,iBAAA,GAAoB,+DAA+D,iBAAiB,CAAA,mNAAA","file":"theme-init.cjs","sourcesContent":["/** Matches `next-themes` default `storageKey`. */\nexport const THEME_STORAGE_KEY = \"theme\";\n\nexport const THEME_INIT_SCRIPT_ID = \"yenio-theme-init\";\n\n/**\n * Blocking script for the root layout.\n * `next-themes` contract: `attribute=\"class\"`, `storageKey=\"theme\"`, default `system`.\n * The provider injects the class too late for first paint.\n */\nexport const THEME_INIT_SCRIPT = `(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"${THEME_STORAGE_KEY}\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t})();`;\n"]}
1
+ {"version":3,"sources":["../src/theme-init.ts"],"names":[],"mappings":";;;AACO,IAAM,iBAAA,GAAoB;AAE1B,IAAM,oBAAA,GAAuB;AAO7B,IAAM,iBAAA,GAAoB,+DAA+D,iBAAiB,CAAA,s4CAAA","file":"theme-init.cjs","sourcesContent":["/** Matches `next-themes` default `storageKey`. */\nexport const THEME_STORAGE_KEY = \"theme\";\n\nexport const THEME_INIT_SCRIPT_ID = \"yenio-theme-init\";\n\n/**\n * Blocking script for the root layout.\n * `next-themes` contract: `attribute=\"class\"`, `storageKey=\"theme\"`, default `system`.\n * The provider injects the class too late for first paint.\n */\nexport const THEME_INIT_SCRIPT = `(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"${THEME_STORAGE_KEY}\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t;var themeColors={light:null,dark:null};function captureThemeColors(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');for(var i=0;i<metas.length;i++){var m=metas[i];var media=(m.getAttribute(\"media\")||\"\").toLowerCase();var c=m.getAttribute(\"content\");if(!c)continue;if(media.indexOf(\"dark\")!==-1)themeColors.dark=c;else if(media.indexOf(\"light\")!==-1)themeColors.light=c}}catch(e){}}function resolvedTheme(){if(r.classList.contains(\"dark\"))return\"dark\";if(r.classList.contains(\"light\"))return\"light\";return t}function syncThemeColor(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');if(!metas.length)return;if(!themeColors.light&&!themeColors.dark)captureThemeColors();var theme=resolvedTheme();var color=themeColors[theme];if(!color){for(var i=0;i<metas.length;i++){var media=metas[i].getAttribute(\"media\")||\"\";if(media.indexOf(theme)!==-1){color=metas[i].getAttribute(\"content\");break}}}if(!color)return;for(var j=0;j<metas.length;j++){metas[j].setAttribute(\"content\",color);metas[j].setAttribute(\"media\",\"all\")}}catch(e){}}syncThemeColor();try{new MutationObserver(function(){syncThemeColor()}).observe(r,{attributes:true,attributeFilter:[\"class\"]})}catch(e){}})();`;\n"]}
@@ -6,6 +6,6 @@ declare const THEME_INIT_SCRIPT_ID = "yenio-theme-init";
6
6
  * `next-themes` contract: `attribute="class"`, `storageKey="theme"`, default `system`.
7
7
  * The provider injects the class too late for first paint.
8
8
  */
9
- declare const THEME_INIT_SCRIPT = "(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"theme\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t})();";
9
+ declare const THEME_INIT_SCRIPT = "(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"theme\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t;var themeColors={light:null,dark:null};function captureThemeColors(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');for(var i=0;i<metas.length;i++){var m=metas[i];var media=(m.getAttribute(\"media\")||\"\").toLowerCase();var c=m.getAttribute(\"content\");if(!c)continue;if(media.indexOf(\"dark\")!==-1)themeColors.dark=c;else if(media.indexOf(\"light\")!==-1)themeColors.light=c}}catch(e){}}function resolvedTheme(){if(r.classList.contains(\"dark\"))return\"dark\";if(r.classList.contains(\"light\"))return\"light\";return t}function syncThemeColor(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');if(!metas.length)return;if(!themeColors.light&&!themeColors.dark)captureThemeColors();var theme=resolvedTheme();var color=themeColors[theme];if(!color){for(var i=0;i<metas.length;i++){var media=metas[i].getAttribute(\"media\")||\"\";if(media.indexOf(theme)!==-1){color=metas[i].getAttribute(\"content\");break}}}if(!color)return;for(var j=0;j<metas.length;j++){metas[j].setAttribute(\"content\",color);metas[j].setAttribute(\"media\",\"all\")}}catch(e){}}syncThemeColor();try{new MutationObserver(function(){syncThemeColor()}).observe(r,{attributes:true,attributeFilter:[\"class\"]})}catch(e){}})();";
10
10
 
11
11
  export { THEME_INIT_SCRIPT, THEME_INIT_SCRIPT_ID, THEME_STORAGE_KEY };
@@ -6,6 +6,6 @@ declare const THEME_INIT_SCRIPT_ID = "yenio-theme-init";
6
6
  * `next-themes` contract: `attribute="class"`, `storageKey="theme"`, default `system`.
7
7
  * The provider injects the class too late for first paint.
8
8
  */
9
- declare const THEME_INIT_SCRIPT = "(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"theme\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t})();";
9
+ declare const THEME_INIT_SCRIPT = "(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"theme\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t;var themeColors={light:null,dark:null};function captureThemeColors(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');for(var i=0;i<metas.length;i++){var m=metas[i];var media=(m.getAttribute(\"media\")||\"\").toLowerCase();var c=m.getAttribute(\"content\");if(!c)continue;if(media.indexOf(\"dark\")!==-1)themeColors.dark=c;else if(media.indexOf(\"light\")!==-1)themeColors.light=c}}catch(e){}}function resolvedTheme(){if(r.classList.contains(\"dark\"))return\"dark\";if(r.classList.contains(\"light\"))return\"light\";return t}function syncThemeColor(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');if(!metas.length)return;if(!themeColors.light&&!themeColors.dark)captureThemeColors();var theme=resolvedTheme();var color=themeColors[theme];if(!color){for(var i=0;i<metas.length;i++){var media=metas[i].getAttribute(\"media\")||\"\";if(media.indexOf(theme)!==-1){color=metas[i].getAttribute(\"content\");break}}}if(!color)return;for(var j=0;j<metas.length;j++){metas[j].setAttribute(\"content\",color);metas[j].setAttribute(\"media\",\"all\")}}catch(e){}}syncThemeColor();try{new MutationObserver(function(){syncThemeColor()}).observe(r,{attributes:true,attributeFilter:[\"class\"]})}catch(e){}})();";
10
10
 
11
11
  export { THEME_INIT_SCRIPT, THEME_INIT_SCRIPT_ID, THEME_STORAGE_KEY };
@@ -1,7 +1,7 @@
1
1
  // src/theme-init.ts
2
2
  var THEME_STORAGE_KEY = "theme";
3
3
  var THEME_INIT_SCRIPT_ID = "yenio-theme-init";
4
- var THEME_INIT_SCRIPT = `(function(){var t="light";var s;try{s=localStorage.getItem("${THEME_STORAGE_KEY}")}catch(e){}if(s==="dark"||s==="light"){t=s}else{try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)t="dark"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t})();`;
4
+ var THEME_INIT_SCRIPT = `(function(){var t="light";var s;try{s=localStorage.getItem("${THEME_STORAGE_KEY}")}catch(e){}if(s==="dark"||s==="light"){t=s}else{try{if(window.matchMedia("(prefers-color-scheme: dark)").matches)t="dark"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t;var themeColors={light:null,dark:null};function captureThemeColors(){try{var metas=document.querySelectorAll('meta[name="theme-color"]');for(var i=0;i<metas.length;i++){var m=metas[i];var media=(m.getAttribute("media")||"").toLowerCase();var c=m.getAttribute("content");if(!c)continue;if(media.indexOf("dark")!==-1)themeColors.dark=c;else if(media.indexOf("light")!==-1)themeColors.light=c}}catch(e){}}function resolvedTheme(){if(r.classList.contains("dark"))return"dark";if(r.classList.contains("light"))return"light";return t}function syncThemeColor(){try{var metas=document.querySelectorAll('meta[name="theme-color"]');if(!metas.length)return;if(!themeColors.light&&!themeColors.dark)captureThemeColors();var theme=resolvedTheme();var color=themeColors[theme];if(!color){for(var i=0;i<metas.length;i++){var media=metas[i].getAttribute("media")||"";if(media.indexOf(theme)!==-1){color=metas[i].getAttribute("content");break}}}if(!color)return;for(var j=0;j<metas.length;j++){metas[j].setAttribute("content",color);metas[j].setAttribute("media","all")}}catch(e){}}syncThemeColor();try{new MutationObserver(function(){syncThemeColor()}).observe(r,{attributes:true,attributeFilter:["class"]})}catch(e){}})();`;
5
5
 
6
6
  export { THEME_INIT_SCRIPT, THEME_INIT_SCRIPT_ID, THEME_STORAGE_KEY };
7
7
  //# sourceMappingURL=theme-init.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/theme-init.ts"],"names":[],"mappings":";AACO,IAAM,iBAAA,GAAoB;AAE1B,IAAM,oBAAA,GAAuB;AAO7B,IAAM,iBAAA,GAAoB,+DAA+D,iBAAiB,CAAA,mNAAA","file":"theme-init.js","sourcesContent":["/** Matches `next-themes` default `storageKey`. */\nexport const THEME_STORAGE_KEY = \"theme\";\n\nexport const THEME_INIT_SCRIPT_ID = \"yenio-theme-init\";\n\n/**\n * Blocking script for the root layout.\n * `next-themes` contract: `attribute=\"class\"`, `storageKey=\"theme\"`, default `system`.\n * The provider injects the class too late for first paint.\n */\nexport const THEME_INIT_SCRIPT = `(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"${THEME_STORAGE_KEY}\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t})();`;\n"]}
1
+ {"version":3,"sources":["../src/theme-init.ts"],"names":[],"mappings":";AACO,IAAM,iBAAA,GAAoB;AAE1B,IAAM,oBAAA,GAAuB;AAO7B,IAAM,iBAAA,GAAoB,+DAA+D,iBAAiB,CAAA,s4CAAA","file":"theme-init.js","sourcesContent":["/** Matches `next-themes` default `storageKey`. */\nexport const THEME_STORAGE_KEY = \"theme\";\n\nexport const THEME_INIT_SCRIPT_ID = \"yenio-theme-init\";\n\n/**\n * Blocking script for the root layout.\n * `next-themes` contract: `attribute=\"class\"`, `storageKey=\"theme\"`, default `system`.\n * The provider injects the class too late for first paint.\n */\nexport const THEME_INIT_SCRIPT = `(function(){var t=\"light\";var s;try{s=localStorage.getItem(\"${THEME_STORAGE_KEY}\")}catch(e){}if(s===\"dark\"||s===\"light\"){t=s}else{try{if(window.matchMedia(\"(prefers-color-scheme: dark)\").matches)t=\"dark\"}catch(e){}}var r=document.documentElement;r.classList.add(t);r.style.colorScheme=t;var themeColors={light:null,dark:null};function captureThemeColors(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');for(var i=0;i<metas.length;i++){var m=metas[i];var media=(m.getAttribute(\"media\")||\"\").toLowerCase();var c=m.getAttribute(\"content\");if(!c)continue;if(media.indexOf(\"dark\")!==-1)themeColors.dark=c;else if(media.indexOf(\"light\")!==-1)themeColors.light=c}}catch(e){}}function resolvedTheme(){if(r.classList.contains(\"dark\"))return\"dark\";if(r.classList.contains(\"light\"))return\"light\";return t}function syncThemeColor(){try{var metas=document.querySelectorAll('meta[name=\"theme-color\"]');if(!metas.length)return;if(!themeColors.light&&!themeColors.dark)captureThemeColors();var theme=resolvedTheme();var color=themeColors[theme];if(!color){for(var i=0;i<metas.length;i++){var media=metas[i].getAttribute(\"media\")||\"\";if(media.indexOf(theme)!==-1){color=metas[i].getAttribute(\"content\");break}}}if(!color)return;for(var j=0;j<metas.length;j++){metas[j].setAttribute(\"content\",color);metas[j].setAttribute(\"media\",\"all\")}}catch(e){}}syncThemeColor();try{new MutationObserver(function(){syncThemeColor()}).observe(r,{attributes:true,attributeFilter:[\"class\"]})}catch(e){}})();`;\n"]}
@@ -0,0 +1 @@
1
+ export { Combobox } from '@base-ui/react/combobox';
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ export { Combobox } from '@base-ui/react/combobox';
3
+ //# sourceMappingURL=combobox.js.map
4
+ //# sourceMappingURL=combobox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"combobox.js","sourcesContent":[]}
@@ -1,5 +1,9 @@
1
1
  import * as React from 'react';
2
2
 
3
- declare function Select({ className, ...props }: React.ComponentProps<"select">): React.JSX.Element;
3
+ type SelectProps = Omit<React.ComponentProps<"select">, "onChange" | "children" | "size" | "multiple"> & {
4
+ onChange?: React.ChangeEventHandler<HTMLSelectElement>;
5
+ children?: React.ReactNode;
6
+ };
7
+ declare function Select({ className, children, value, defaultValue, onChange, disabled, required, name, id, autoFocus, tabIndex, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-invalid": ariaInvalid, }: SelectProps): React.JSX.Element;
4
8
 
5
9
  export { Select };
package/dist/ui/select.js CHANGED
@@ -1,21 +1,131 @@
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 { jsx } from 'react/jsx-runtime';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
8
 
6
9
  function cn(...inputs) {
7
10
  return twMerge(clsx(inputs));
8
11
  }
9
- function Select({ className, ...props }) {
10
- return /* @__PURE__ */ jsx(
11
- "select",
12
+ function parseOptionChildren(children) {
13
+ const options = [];
14
+ React.Children.forEach(children, (child) => {
15
+ if (!React.isValidElement(child) || child.type !== "option") return;
16
+ const props = child.props;
17
+ if (props.value === void 0 || props.value === null) return;
18
+ options.push({
19
+ value: String(props.value),
20
+ label: props.children ?? String(props.value),
21
+ disabled: props.disabled
22
+ });
23
+ });
24
+ return options;
25
+ }
26
+ 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";
27
+ var popupClassName = "z-50 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";
28
+ 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 data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-accent data-highlighted:text-accent-foreground data-selected:bg-accent/50";
29
+ function Select({
30
+ className,
31
+ children,
32
+ value,
33
+ defaultValue,
34
+ onChange,
35
+ disabled,
36
+ required,
37
+ name,
38
+ id,
39
+ autoFocus,
40
+ tabIndex,
41
+ "aria-label": ariaLabel,
42
+ "aria-labelledby": ariaLabelledby,
43
+ "aria-describedby": ariaDescribedby,
44
+ "aria-invalid": ariaInvalid
45
+ }) {
46
+ const options = React.useMemo(
47
+ () => parseOptionChildren(children),
48
+ [children]
49
+ );
50
+ const items = React.useMemo(
51
+ () => options.map((option) => ({ value: option.value, label: option.label })),
52
+ [options]
53
+ );
54
+ const handleValueChange = React.useCallback(
55
+ (next) => {
56
+ if (!onChange) return;
57
+ const nextValue = next ?? "";
58
+ onChange({
59
+ target: { value: nextValue },
60
+ currentTarget: { value: nextValue }
61
+ });
62
+ },
63
+ [onChange]
64
+ );
65
+ const controlledValue = value === void 0 || value === null ? void 0 : String(value);
66
+ const uncontrolledDefault = defaultValue === void 0 || defaultValue === null ? void 0 : String(defaultValue);
67
+ if (options.length === 0) {
68
+ return /* @__PURE__ */ jsx(
69
+ "select",
70
+ {
71
+ "data-slot": "select",
72
+ className: cn(triggerClassName, className),
73
+ disabled: true
74
+ }
75
+ );
76
+ }
77
+ return /* @__PURE__ */ jsxs(
78
+ Select$1.Root,
12
79
  {
13
- "data-slot": "select",
14
- className: cn(
15
- "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",
16
- className
17
- ),
18
- ...props
80
+ name,
81
+ required,
82
+ disabled,
83
+ modal: false,
84
+ items,
85
+ value: controlledValue,
86
+ defaultValue: uncontrolledDefault,
87
+ onValueChange: handleValueChange,
88
+ children: [
89
+ /* @__PURE__ */ jsxs(
90
+ Select$1.Trigger,
91
+ {
92
+ "data-slot": "select",
93
+ id,
94
+ autoFocus,
95
+ tabIndex,
96
+ "aria-label": ariaLabel,
97
+ "aria-labelledby": ariaLabelledby,
98
+ "aria-describedby": ariaDescribedby,
99
+ "aria-invalid": ariaInvalid,
100
+ className: cn(triggerClassName, className),
101
+ children: [
102
+ /* @__PURE__ */ jsx(Select$1.Value, { className: "truncate text-left" }),
103
+ /* @__PURE__ */ jsx(Select$1.Icon, { className: "pointer-events-none shrink-0 text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" }) })
104
+ ]
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
108
+ Select$1.Positioner,
109
+ {
110
+ className: "isolate z-[100] outline-none",
111
+ sideOffset: 4,
112
+ children: /* @__PURE__ */ jsx(Select$1.Popup, { className: popupClassName, children: /* @__PURE__ */ jsx(Select$1.List, { children: options.map((option) => /* @__PURE__ */ jsxs(
113
+ Select$1.Item,
114
+ {
115
+ value: option.value,
116
+ label: typeof option.label === "string" ? option.label : option.value,
117
+ disabled: option.disabled,
118
+ className: itemClassName,
119
+ children: [
120
+ /* @__PURE__ */ jsx(Select$1.ItemText, { children: option.label }),
121
+ /* @__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" }) })
122
+ ]
123
+ },
124
+ option.value
125
+ )) }) })
126
+ }
127
+ ) })
128
+ ]
19
129
  }
20
130
  );
21
131
  }
@@ -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,E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ACd,OACC,OAAO,MAAA,CAAO,UAAU,QAAA,GACrB,MAAA,CAAO,QACP,MAAA,CAAO,KAAA;AAAA,gBAEX,UAAU,MAAA,CAAO,QAAA;AAAA,gBACjB,SAAA,EAAW,aAAA;AAAA,gBAEX,QAAA,EAAA;AAAA,kCAAA,GAAA,CAACA,QAAA,CAAgB,QAAA,EAAhB,EACC,QAAA,EAAA,MAAA,CAAO,KAAA,EACT,CAAA;AAAA,kCACA,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,eAAA;AAAA,cAfK,MAAA,CAAO;AAAA,aAiBb,GACF,CAAA,EACD;AAAA;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\";\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\"z-50 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 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 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 options = React.useMemo(\n\t\t() => parseOptionChildren(children),\n\t\t[children],\n\t);\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\tconst controlledValue =\n\t\tvalue === undefined || value === null ? undefined : String(value);\n\tconst uncontrolledDefault =\n\t\tdefaultValue === undefined || defaultValue === null\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\tmodal={false}\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<SelectPrimitive.Portal>\n\t\t\t\t<SelectPrimitive.Positioner\n\t\t\t\t\tclassName=\"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 className={popupClassName}>\n\t\t\t\t\t\t<SelectPrimitive.List>\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yenio-pld/blocks",
3
- "version": "1.2.0-rc.3",
3
+ "version": "1.2.0-rc.5",
4
4
  "description": "Shared UI components for Yenio applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -80,6 +80,10 @@
80
80
  "types": "./dist/ui/card.d.ts",
81
81
  "default": "./dist/ui/card.js"
82
82
  },
83
+ "./ui/combobox": {
84
+ "types": "./dist/ui/combobox.d.ts",
85
+ "default": "./dist/ui/combobox.js"
86
+ },
83
87
  "./ui/collapsible": {
84
88
  "types": "./dist/ui/collapsible.d.ts",
85
89
  "default": "./dist/ui/collapsible.js"