@yenio-pld/blocks 1.1.0 → 1.2.0-rc.10
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/consent.cjs +2 -2
- package/dist/consent.cjs.map +1 -1
- package/dist/consent.js +2 -2
- package/dist/consent.js.map +1 -1
- package/dist/index.cjs +5563 -2101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +656 -64
- package/dist/index.d.ts +656 -64
- package/dist/index.js +5462 -2073
- 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/button.d.ts +2 -2
- 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 +1 -1
- package/dist/ui/dialog.js +27 -1
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/select.d.ts +5 -1
- package/dist/ui/select.js +127 -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/dist/ui/table.js +1 -1
- package/dist/ui/table.js.map +1 -1
- package/package.json +9 -1
- package/src/theme.css +2 -2
package/dist/theme-init.cjs
CHANGED
|
@@ -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;
|
package/dist/theme-init.cjs.map
CHANGED
|
@@ -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,
|
|
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"]}
|
package/dist/theme-init.d.cts
CHANGED
|
@@ -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 };
|
package/dist/theme-init.d.ts
CHANGED
|
@@ -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 };
|
package/dist/theme-init.js
CHANGED
|
@@ -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
|
package/dist/theme-init.js.map
CHANGED
|
@@ -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,
|
|
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"]}
|
package/dist/ui/button.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { Button as Button$1 } from '@base-ui/react/button';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" |
|
|
8
|
-
size?: "default" | "
|
|
7
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
8
|
+
size?: "default" | "sm" | "xs" | "lg" | "touch" | "xl" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-touch" | "icon-xl" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): React.JSX.Element;
|
|
11
11
|
|
package/dist/ui/button.js
CHANGED
|
@@ -26,10 +26,16 @@ var buttonVariants = cva(
|
|
|
26
26
|
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
27
27
|
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
28
28
|
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
29
|
+
/** 44px touch target for POS register controls (WCAG AAA aim). */
|
|
30
|
+
touch: "h-11 gap-2 px-4 text-base has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg:not([class*='size-'])]:size-5",
|
|
31
|
+
/** 56px primary till actions (Charge, Exact cash). */
|
|
32
|
+
xl: "h-14 gap-2 px-5 text-base has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4 [&_svg:not([class*='size-'])]:size-5",
|
|
29
33
|
icon: "size-8",
|
|
30
34
|
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
31
35
|
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
32
|
-
"icon-lg": "size-9"
|
|
36
|
+
"icon-lg": "size-9",
|
|
37
|
+
"icon-touch": "size-11 [&_svg:not([class*='size-'])]:size-5",
|
|
38
|
+
"icon-xl": "size-14 [&_svg:not([class*='size-'])]:size-6"
|
|
33
39
|
}
|
|
34
40
|
},
|
|
35
41
|
defaultVariants: {
|
package/dist/ui/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/button.tsx"],"names":["ButtonPrimitive"],"mappings":";;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACAA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACtB,4lBAAA;AAAA,EACA;AAAA,IACC,QAAA,EAAU;AAAA,MACT,OAAA,EAAS;AAAA,QACR,OAAA,EAAS,wDAAA;AAAA,QACT,OAAA,EACC,iLAAA;AAAA,QACD,SAAA,EACC,gLAAA;AAAA,QACD,KAAA,EACC,kHAAA;AAAA,QACD,WAAA,EACC,6NAAA;AAAA,QACD,IAAA,EAAM;AAAA,OACP;AAAA,MACA,IAAA,EAAM;AAAA,QACL,OAAA,EACC,sFAAA;AAAA,QACD,EAAA,EAAI,+MAAA;AAAA,QACJ,EAAA,EAAI,yNAAA;AAAA,QACJ,EAAA,EAAI,sFAAA;AAAA,QACJ,IAAA,EAAM,QAAA;AAAA,QACN,SAAA,EACC,yHAAA;AAAA,QACD,SAAA,EACC,oFAAA;AAAA,QACD,SAAA,EAAW;AAAA;AACZ,KACD;AAAA,IACA,eAAA,EAAiB;AAAA,MAChB,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACP;AAEF;AAEA,SAAS,MAAA,CAAO;AAAA,EACf,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACJ,CAAA,EAAgE;AAC/D,EAAA,uBACC,GAAA;AAAA,IAACA,QAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACL;AAEF","file":"button.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","import { Button as ButtonPrimitive } from \"@base-ui/react/button\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../lib/utils\";\n\nconst buttonVariants = cva(\n\t\"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n\t\t\t\toutline:\n\t\t\t\t\t\"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n\t\t\t\tsecondary:\n\t\t\t\t\t\"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n\t\t\t\tghost:\n\t\t\t\t\t\"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n\t\t\t\tdestructive:\n\t\t\t\t\t\"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n\t\t\t\tlink: \"text-primary underline-offset-4 hover:underline\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault:\n\t\t\t\t\t\"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\txs: \"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t\tsm: \"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n\t\t\t\tlg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\ticon: \"size-8\",\n\t\t\t\t\"icon-xs\":\n\t\t\t\t\t\"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t\t\"icon-sm\":\n\t\t\t\t\t\"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg\",\n\t\t\t\t\"icon-lg\": \"size-9\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t\tsize: \"default\",\n\t\t},\n\t},\n);\n\nfunction Button({\n\tclassName,\n\tvariant = \"default\",\n\tsize = \"default\",\n\t...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n\treturn (\n\t\t<ButtonPrimitive\n\t\t\tdata-slot=\"button\"\n\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Button, buttonVariants };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/button.tsx"],"names":["ButtonPrimitive"],"mappings":";;;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACAA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACtB,4lBAAA;AAAA,EACA;AAAA,IACC,QAAA,EAAU;AAAA,MACT,OAAA,EAAS;AAAA,QACR,OAAA,EAAS,wDAAA;AAAA,QACT,OAAA,EACC,iLAAA;AAAA,QACD,SAAA,EACC,gLAAA;AAAA,QACD,KAAA,EACC,kHAAA;AAAA,QACD,WAAA,EACC,6NAAA;AAAA,QACD,IAAA,EAAM;AAAA,OACP;AAAA,MACA,IAAA,EAAM;AAAA,QACL,OAAA,EACC,sFAAA;AAAA,QACD,EAAA,EAAI,+MAAA;AAAA,QACJ,EAAA,EAAI,yNAAA;AAAA,QACJ,EAAA,EAAI,sFAAA;AAAA;AAAA,QAEJ,KAAA,EACC,kIAAA;AAAA;AAAA,QAED,EAAA,EAAI,kIAAA;AAAA,QACJ,IAAA,EAAM,QAAA;AAAA,QACN,SAAA,EACC,yHAAA;AAAA,QACD,SAAA,EACC,oFAAA;AAAA,QACD,SAAA,EAAW,QAAA;AAAA,QACX,YAAA,EAAc,8CAAA;AAAA,QACd,SAAA,EAAW;AAAA;AACZ,KACD;AAAA,IACA,eAAA,EAAiB;AAAA,MAChB,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACP;AAEF;AAEA,SAAS,MAAA,CAAO;AAAA,EACf,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACJ,CAAA,EAAgE;AAC/D,EAAA,uBACC,GAAA;AAAA,IAACA,QAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACL;AAEF","file":"button.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","import { Button as ButtonPrimitive } from \"@base-ui/react/button\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../lib/utils\";\n\nconst buttonVariants = cva(\n\t\"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n\t\t\t\toutline:\n\t\t\t\t\t\"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n\t\t\t\tsecondary:\n\t\t\t\t\t\"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n\t\t\t\tghost:\n\t\t\t\t\t\"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n\t\t\t\tdestructive:\n\t\t\t\t\t\"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n\t\t\t\tlink: \"text-primary underline-offset-4 hover:underline\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault:\n\t\t\t\t\t\"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\txs: \"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t\tsm: \"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n\t\t\t\tlg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n\t\t\t\t/** 44px touch target for POS register controls (WCAG AAA aim). */\n\t\t\t\ttouch:\n\t\t\t\t\t\"h-11 gap-2 px-4 text-base has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg:not([class*='size-'])]:size-5\",\n\t\t\t\t/** 56px primary till actions (Charge, Exact cash). */\n\t\t\t\txl: \"h-14 gap-2 px-5 text-base has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4 [&_svg:not([class*='size-'])]:size-5\",\n\t\t\t\ticon: \"size-8\",\n\t\t\t\t\"icon-xs\":\n\t\t\t\t\t\"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3\",\n\t\t\t\t\"icon-sm\":\n\t\t\t\t\t\"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg\",\n\t\t\t\t\"icon-lg\": \"size-9\",\n\t\t\t\t\"icon-touch\": \"size-11 [&_svg:not([class*='size-'])]:size-5\",\n\t\t\t\t\"icon-xl\": \"size-14 [&_svg:not([class*='size-'])]:size-6\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t\tsize: \"default\",\n\t\t},\n\t},\n);\n\nfunction Button({\n\tclassName,\n\tvariant = \"default\",\n\tsize = \"default\",\n\t...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n\treturn (\n\t\t<ButtonPrimitive\n\t\t\tdata-slot=\"button\"\n\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Button, buttonVariants };\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "onChange" | "checked" | "defaultChecked"> & {
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
defaultChecked?: boolean;
|
|
7
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Accessible checkbox. Native input (not Base UI) so jsdom / Playwright
|
|
11
|
+
* `getByRole('checkbox')` and `.check()` work without PointerEvent polyfills.
|
|
12
|
+
*/
|
|
13
|
+
declare function Checkbox({ className, checked, defaultChecked, onCheckedChange, disabled, id, ...props }: CheckboxProps): React.JSX.Element;
|
|
14
|
+
declare function CheckboxLabel({ className, ...props }: ComponentProps<"label">): React.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { Checkbox, CheckboxLabel };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CheckIcon } from 'lucide-react';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
function Checkbox({
|
|
11
|
+
className,
|
|
12
|
+
checked,
|
|
13
|
+
defaultChecked,
|
|
14
|
+
onCheckedChange,
|
|
15
|
+
disabled,
|
|
16
|
+
id,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
19
|
+
return /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex size-4 shrink-0", className), children: [
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
"input",
|
|
22
|
+
{
|
|
23
|
+
...props,
|
|
24
|
+
checked,
|
|
25
|
+
className: "peer absolute inset-0 z-10 size-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
26
|
+
"data-slot": "checkbox",
|
|
27
|
+
defaultChecked,
|
|
28
|
+
disabled,
|
|
29
|
+
id,
|
|
30
|
+
onChange: (event) => onCheckedChange?.(event.target.checked),
|
|
31
|
+
type: "checkbox"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
className: cn(
|
|
39
|
+
"pointer-events-none flex size-4 items-center justify-center rounded-[4px] border border-input bg-background text-primary-foreground transition-colors",
|
|
40
|
+
"peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-ring/50",
|
|
41
|
+
"peer-checked:border-primary peer-checked:bg-primary peer-checked:[&_svg]:opacity-100",
|
|
42
|
+
"peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
43
|
+
"peer-aria-invalid:border-destructive peer-aria-invalid:ring-3 peer-aria-invalid:ring-destructive/20"
|
|
44
|
+
),
|
|
45
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3 opacity-0", strokeWidth: 3 })
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
function CheckboxLabel({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"label",
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "checkbox-label",
|
|
55
|
+
className: cn(
|
|
56
|
+
"text-sm leading-5 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
57
|
+
className
|
|
58
|
+
),
|
|
59
|
+
...props
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { Checkbox, CheckboxLabel };
|
|
65
|
+
//# sourceMappingURL=checkbox.js.map
|
|
66
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/checkbox.tsx"],"names":[],"mappings":";;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACeA,SAAS,QAAA,CAAS;AAAA,EACjB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,QAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAG;AACJ,CAAA,EAAkB;AACjB,EAAA,4BACE,MAAA,EAAA,EAAK,SAAA,EAAW,EAAA,CAAG,sCAAA,EAAwC,SAAS,CAAA,EACpE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,GAAG,KAAA;AAAA,QACJ,OAAA;AAAA,QACA,SAAA,EAAU,2FAAA;AAAA,QACV,WAAA,EAAU,UAAA;AAAA,QACV,cAAA;AAAA,QACA,QAAA;AAAA,QACA,EAAA;AAAA,QACA,UAAU,CAAC,KAAA,KAAU,eAAA,GAAkB,KAAA,CAAM,OAAO,OAAO,CAAA;AAAA,QAC3D,IAAA,EAAK;AAAA;AAAA,KACN;AAAA,oBACA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACA,aAAA,EAAW,IAAA;AAAA,QACX,SAAA,EAAW,EAAA;AAAA,UACV,uJAAA;AAAA,UACA,0FAAA;AAAA,UACA,sFAAA;AAAA,UACA,2DAAA;AAAA,UACA;AAAA,SACD;AAAA,QAEA,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAU,kBAAA,EAAmB,aAAa,CAAA,EAAG;AAAA;AAAA;AACzD,GAAA,EACD,CAAA;AAEF;AAEA,SAAS,aAAA,CAAc,EAAE,SAAA,EAAW,GAAG,OAAM,EAA4B;AACxE,EAAA,uBACC,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,gBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACV,6EAAA;AAAA,QACA;AAAA,OACD;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF","file":"checkbox.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 { CheckIcon } from \"lucide-react\";\nimport type { ComponentProps, InputHTMLAttributes } from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\ntype CheckboxProps = Omit<\n\tInputHTMLAttributes<HTMLInputElement>,\n\t\"type\" | \"onChange\" | \"checked\" | \"defaultChecked\"\n> & {\n\tchecked?: boolean;\n\tdefaultChecked?: boolean;\n\tonCheckedChange?: (checked: boolean) => void;\n};\n\n/**\n * Accessible checkbox. Native input (not Base UI) so jsdom / Playwright\n * `getByRole('checkbox')` and `.check()` work without PointerEvent polyfills.\n */\nfunction Checkbox({\n\tclassName,\n\tchecked,\n\tdefaultChecked,\n\tonCheckedChange,\n\tdisabled,\n\tid,\n\t...props\n}: CheckboxProps) {\n\treturn (\n\t\t<span className={cn(\"relative inline-flex size-4 shrink-0\", className)}>\n\t\t\t<input\n\t\t\t\t{...props}\n\t\t\t\tchecked={checked}\n\t\t\t\tclassName=\"peer absolute inset-0 z-10 size-full cursor-pointer opacity-0 disabled:cursor-not-allowed\"\n\t\t\t\tdata-slot=\"checkbox\"\n\t\t\t\tdefaultChecked={defaultChecked}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={id}\n\t\t\t\tonChange={(event) => onCheckedChange?.(event.target.checked)}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t/>\n\t\t\t<span\n\t\t\t\taria-hidden\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"pointer-events-none flex size-4 items-center justify-center rounded-[4px] border border-input bg-background text-primary-foreground transition-colors\",\n\t\t\t\t\t\"peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-ring/50\",\n\t\t\t\t\t\"peer-checked:border-primary peer-checked:bg-primary peer-checked:[&_svg]:opacity-100\",\n\t\t\t\t\t\"peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n\t\t\t\t\t\"peer-aria-invalid:border-destructive peer-aria-invalid:ring-3 peer-aria-invalid:ring-destructive/20\",\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<CheckIcon className=\"size-3 opacity-0\" strokeWidth={3} />\n\t\t\t</span>\n\t\t</span>\n\t);\n}\n\nfunction CheckboxLabel({ className, ...props }: ComponentProps<\"label\">) {\n\treturn (\n\t\t<label\n\t\t\tdata-slot=\"checkbox-label\"\n\t\t\tclassName={cn(\n\t\t\t\t\"text-sm leading-5 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Checkbox, CheckboxLabel };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Combobox } from '@base-ui/react/combobox';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"combobox.js","sourcesContent":[]}
|
package/dist/ui/dialog.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
|
5
5
|
declare function Dialog({ ...props }: ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
6
6
|
declare function DialogTrigger({ ...props }: ComponentProps<typeof DialogPrimitive.Trigger>): React.JSX.Element;
|
|
7
7
|
declare function DialogClose({ ...props }: ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
|
|
8
|
-
declare function DialogContent({ className, children, showCloseButton, ...props }: ComponentProps<typeof DialogPrimitive.Content> & {
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, onPointerDownOutside, onInteractOutside, onFocusOutside, ...props }: ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
}): React.JSX.Element;
|
|
11
11
|
declare function DialogHeader({ className, ...props }: ComponentProps<"div">): React.JSX.Element;
|
package/dist/ui/dialog.js
CHANGED
|
@@ -42,10 +42,21 @@ function DialogOverlay({
|
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
|
+
function isPortaledOverlayTarget(target) {
|
|
46
|
+
if (!(target instanceof Element)) return false;
|
|
47
|
+
return Boolean(
|
|
48
|
+
target.closest(
|
|
49
|
+
'[data-slot="select-positioner"], [data-slot="select-popup"], [data-slot="combobox-positioner"], [role="listbox"], [role="option"]'
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
45
53
|
function DialogContent({
|
|
46
54
|
className,
|
|
47
55
|
children,
|
|
48
56
|
showCloseButton = true,
|
|
57
|
+
onPointerDownOutside,
|
|
58
|
+
onInteractOutside,
|
|
59
|
+
onFocusOutside,
|
|
49
60
|
...props
|
|
50
61
|
}) {
|
|
51
62
|
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
@@ -55,10 +66,25 @@ function DialogContent({
|
|
|
55
66
|
{
|
|
56
67
|
"data-slot": "dialog-content",
|
|
57
68
|
className: cn(
|
|
58
|
-
|
|
69
|
+
// Center with inset + margin, not translate. Translate (and zoom
|
|
70
|
+
// scale) create a containing block that misaligns Google Places
|
|
71
|
+
// PlaceAutocompleteElement prediction lists and other fixed UI.
|
|
72
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 m-auto grid h-fit w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
59
73
|
className
|
|
60
74
|
),
|
|
61
75
|
...props,
|
|
76
|
+
onPointerDownOutside: (event) => {
|
|
77
|
+
if (isPortaledOverlayTarget(event.target)) event.preventDefault();
|
|
78
|
+
onPointerDownOutside?.(event);
|
|
79
|
+
},
|
|
80
|
+
onInteractOutside: (event) => {
|
|
81
|
+
if (isPortaledOverlayTarget(event.target)) event.preventDefault();
|
|
82
|
+
onInteractOutside?.(event);
|
|
83
|
+
},
|
|
84
|
+
onFocusOutside: (event) => {
|
|
85
|
+
if (isPortaledOverlayTarget(event.target)) event.preventDefault();
|
|
86
|
+
onFocusOutside?.(event);
|
|
87
|
+
},
|
|
62
88
|
children: [
|
|
63
89
|
children,
|
|
64
90
|
showCloseButton ? /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
package/dist/ui/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts","../../src/ui/dialog.tsx"],"names":[],"mappings":";;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MA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IAAiB,eAAA,CAAA,WAAA;AAAA,IAAhB;AAAA,MACA,WAAA,EAAU,oBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,+BAAA,EAAiC,SAAS,CAAA;AAAA,MACvD,GAAG;AAAA;AAAA,GACL;AAEF","file":"dialog.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 DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { XIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nfunction Dialog({ ...props }: ComponentProps<typeof DialogPrimitive.Root>) {\n\treturn <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n\t...props\n}: ComponentProps<typeof DialogPrimitive.Trigger>) {\n\treturn <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n\t...props\n}: ComponentProps<typeof DialogPrimitive.Portal>) {\n\treturn <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n\t...props\n}: ComponentProps<typeof DialogPrimitive.Close>) {\n\treturn <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n\tclassName,\n\t...props\n}: ComponentProps<typeof DialogPrimitive.Overlay>) {\n\treturn (\n\t\t<DialogPrimitive.Overlay\n\t\t\tdata-slot=\"dialog-overlay\"\n\t\t\tclassName={cn(\n\t\t\t\t\"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/** Portaled Base UI Select / Combobox popups sit outside Dialog Content in the DOM. */\nfunction isPortaledOverlayTarget(target: EventTarget | null): boolean {\n\tif (!(target instanceof Element)) return false;\n\treturn Boolean(\n\t\ttarget.closest(\n\t\t\t'[data-slot=\"select-positioner\"], [data-slot=\"select-popup\"], [data-slot=\"combobox-positioner\"], [role=\"listbox\"], [role=\"option\"]',\n\t\t),\n\t);\n}\n\nfunction DialogContent({\n\tclassName,\n\tchildren,\n\tshowCloseButton = true,\n\tonPointerDownOutside,\n\tonInteractOutside,\n\tonFocusOutside,\n\t...props\n}: ComponentProps<typeof DialogPrimitive.Content> & {\n\tshowCloseButton?: boolean;\n}) {\n\treturn (\n\t\t<DialogPortal>\n\t\t\t<DialogOverlay />\n\t\t\t<DialogPrimitive.Content\n\t\t\t\tdata-slot=\"dialog-content\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t// Center with inset + margin, not translate. Translate (and zoom\n\t\t\t\t\t// scale) create a containing block that misaligns Google Places\n\t\t\t\t\t// PlaceAutocompleteElement prediction lists and other fixed UI.\n\t\t\t\t\t\"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 m-auto grid h-fit w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\tif (isPortaledOverlayTarget(event.target)) event.preventDefault();\n\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t}}\n\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\tif (isPortaledOverlayTarget(event.target)) event.preventDefault();\n\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t}}\n\t\t\t\tonFocusOutside={(event) => {\n\t\t\t\t\tif (isPortaledOverlayTarget(event.target)) event.preventDefault();\n\t\t\t\t\tonFocusOutside?.(event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{showCloseButton ? (\n\t\t\t\t\t<DialogPrimitive.Close className=\"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none\">\n\t\t\t\t\t\t<XIcon className=\"size-4\" />\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</DialogPrimitive.Close>\n\t\t\t\t) : null}\n\t\t\t</DialogPrimitive.Content>\n\t\t</DialogPortal>\n\t);\n}\n\nfunction DialogHeader({ className, ...props }: ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"dialog-header\"\n\t\t\tclassName={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DialogFooter({ className, ...props }: ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"dialog-footer\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DialogTitle({\n\tclassName,\n\t...props\n}: ComponentProps<typeof DialogPrimitive.Title>) {\n\treturn (\n\t\t<DialogPrimitive.Title\n\t\t\tdata-slot=\"dialog-title\"\n\t\t\tclassName={cn(\"text-lg leading-none font-semibold\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DialogDescription({\n\tclassName,\n\t...props\n}: ComponentProps<typeof DialogPrimitive.Description>) {\n\treturn (\n\t\t<DialogPrimitive.Description\n\t\t\tdata-slot=\"dialog-description\"\n\t\t\tclassName={cn(\"text-muted-foreground text-sm\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tDialog,\n\tDialogClose,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogTitle,\n\tDialogTrigger,\n};\n"]}
|
package/dist/ui/select.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
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,138 @@
|
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
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 = "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";
|
|
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 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";
|
|
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 || value === "" ? null : String(value);
|
|
66
|
+
const uncontrolledDefault = defaultValue === void 0 || defaultValue === null || defaultValue === "" ? 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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
80
|
+
name,
|
|
81
|
+
required,
|
|
82
|
+
disabled,
|
|
83
|
+
items,
|
|
84
|
+
value: controlledValue,
|
|
85
|
+
defaultValue: uncontrolledDefault,
|
|
86
|
+
onValueChange: handleValueChange,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxs(
|
|
89
|
+
Select$1.Trigger,
|
|
90
|
+
{
|
|
91
|
+
"data-slot": "select",
|
|
92
|
+
id,
|
|
93
|
+
autoFocus,
|
|
94
|
+
tabIndex,
|
|
95
|
+
"aria-label": ariaLabel,
|
|
96
|
+
"aria-labelledby": ariaLabelledby,
|
|
97
|
+
"aria-describedby": ariaDescribedby,
|
|
98
|
+
"aria-invalid": ariaInvalid,
|
|
99
|
+
className: cn(triggerClassName, className),
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx(Select$1.Value, { className: "truncate text-left" }),
|
|
102
|
+
/* @__PURE__ */ jsx(Select$1.Icon, { className: "pointer-events-none shrink-0 text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" }) })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
107
|
+
Select$1.Positioner,
|
|
108
|
+
{
|
|
109
|
+
"data-slot": "select-positioner",
|
|
110
|
+
className: "pointer-events-auto isolate z-[100] outline-none",
|
|
111
|
+
sideOffset: 4,
|
|
112
|
+
children: /* @__PURE__ */ jsx(
|
|
113
|
+
Select$1.Popup,
|
|
114
|
+
{
|
|
115
|
+
"data-slot": "select-popup",
|
|
116
|
+
className: popupClassName,
|
|
117
|
+
children: /* @__PURE__ */ jsx(Select$1.List, { onWheel: (event) => event.stopPropagation(), children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
118
|
+
Select$1.Item,
|
|
119
|
+
{
|
|
120
|
+
value: option.value,
|
|
121
|
+
label: typeof option.label === "string" ? option.label : option.value,
|
|
122
|
+
disabled: option.disabled,
|
|
123
|
+
className: itemClassName,
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, { children: option.label }),
|
|
126
|
+
/* @__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" }) })
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
option.value
|
|
130
|
+
)) })
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
) })
|
|
135
|
+
]
|
|
19
136
|
}
|
|
20
137
|
);
|
|
21
138
|
}
|
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}\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B;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\";\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 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\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<SelectPrimitive.Portal>\n\t\t\t\t{/* pointer-events-auto + high z: Radix Dialog overlay otherwise steals\n\t\t\t\t clicks/focus from this portaled popup (same pattern as CountryPicker). */}\n\t\t\t\t<SelectPrimitive.Positioner\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,CAAA;AAC5B;ACIA,SAAS,KAAA,CAAM,EAAE,GAAG,KAAA,EAAM,EAA8B;AACvD,EAAA,2BAAQA,MAAA,CAAe,IAAA,EAAf,EAAoB,WAAA,EAAU,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC1D;AAEA,SAAS,YAAA,CAAa,EAAE,GAAG,KAAA,EAAM,EAAiC;AACjE,EAAA,2BAAQA,MAAA,CAAe,OAAA,EAAf,EAAuB,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAAO,CAAA;AACrE;AAEA,SAAS,UAAA,CAAW,EAAE,GAAG,KAAA,EAAM,EAA+B;AAC7D,EAAA,2BAAQA,MAAA,CAAe,KAAA,EAAf,EAAqB,WAAA,EAAU,aAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AACjE;AAEA,SAAS,WAAA,CAAY,EAAE,GAAG,KAAA,EAAM,EAAgC;AAC/D,EAAA,2BAAQA,MAAA,CAAe,MAAA,EAAf,EAAsB,WAAA,EAAU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AA,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"]}
|