@pixpilot/shadcn 0.3.1 → 0.3.2

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.
Files changed (72) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +25 -1
  2. package/dist/components/index.cjs +30 -1
  3. package/dist/components/index.js +30 -1
  4. package/dist/components/ui/OrContinueWithSeparator.cjs +30 -1
  5. package/dist/components/ui/OrContinueWithSeparator.js +27 -1
  6. package/dist/components/ui/alert-dialog.cjs +101 -1
  7. package/dist/components/ui/alert-dialog.js +87 -1
  8. package/dist/components/ui/alert.cjs +45 -1
  9. package/dist/components/ui/alert.d.cts +4 -4
  10. package/dist/components/ui/alert.js +39 -1
  11. package/dist/components/ui/avatar.cjs +37 -1
  12. package/dist/components/ui/avatar.js +31 -1
  13. package/dist/components/ui/badge.cjs +33 -1
  14. package/dist/components/ui/badge.js +27 -1
  15. package/dist/components/ui/button.cjs +52 -1
  16. package/dist/components/ui/button.js +46 -1
  17. package/dist/components/ui/calendar.cjs +113 -1
  18. package/dist/components/ui/calendar.js +107 -1
  19. package/dist/components/ui/card.cjs +67 -1
  20. package/dist/components/ui/card.js +58 -1
  21. package/dist/components/ui/checkbox.cjs +31 -1
  22. package/dist/components/ui/checkbox.js +26 -1
  23. package/dist/components/ui/command.cjs +104 -1
  24. package/dist/components/ui/command.js +91 -1
  25. package/dist/components/ui/dialog.cjs +102 -1
  26. package/dist/components/ui/dialog.js +88 -1
  27. package/dist/components/ui/dropdown-menu.cjs +144 -1
  28. package/dist/components/ui/dropdown-menu.js +125 -1
  29. package/dist/components/ui/file-upload.cjs +926 -1
  30. package/dist/components/ui/file-upload.js +910 -1
  31. package/dist/components/ui/form.cjs +101 -1
  32. package/dist/components/ui/form.js +89 -1
  33. package/dist/components/ui/index.cjs +29 -1
  34. package/dist/components/ui/index.js +29 -1
  35. package/dist/components/ui/input.cjs +20 -1
  36. package/dist/components/ui/input.js +17 -1
  37. package/dist/components/ui/label.cjs +21 -1
  38. package/dist/components/ui/label.js +17 -1
  39. package/dist/components/ui/pagination.cjs +92 -1
  40. package/dist/components/ui/pagination.js +82 -1
  41. package/dist/components/ui/popover.cjs +44 -1
  42. package/dist/components/ui/popover.js +37 -1
  43. package/dist/components/ui/radio-group.cjs +36 -1
  44. package/dist/components/ui/radio-group.js +30 -1
  45. package/dist/components/ui/select.cjs +116 -1
  46. package/dist/components/ui/select.js +102 -1
  47. package/dist/components/ui/separator.cjs +23 -1
  48. package/dist/components/ui/separator.js +19 -1
  49. package/dist/components/ui/shadcn-io/tags/index.cjs +146 -1
  50. package/dist/components/ui/shadcn-io/tags/index.js +134 -1
  51. package/dist/components/ui/shadcn-io/tags-input-inline/index.cjs +66 -1
  52. package/dist/components/ui/shadcn-io/tags-input-inline/index.js +57 -1
  53. package/dist/components/ui/sheet.cjs +96 -1
  54. package/dist/components/ui/sheet.js +84 -1
  55. package/dist/components/ui/slider.cjs +42 -1
  56. package/dist/components/ui/slider.js +38 -1
  57. package/dist/components/ui/switch.cjs +28 -1
  58. package/dist/components/ui/switch.js +24 -1
  59. package/dist/components/ui/tabs.cjs +45 -1
  60. package/dist/components/ui/tabs.js +38 -1
  61. package/dist/components/ui/textarea.cjs +19 -1
  62. package/dist/components/ui/textarea.js +16 -1
  63. package/dist/components/ui/tooltip.cjs +45 -1
  64. package/dist/components/ui/tooltip.d.cts +5 -5
  65. package/dist/components/ui/tooltip.js +38 -1
  66. package/dist/index.cjs +189 -1
  67. package/dist/index.js +34 -1
  68. package/dist/lib/index.cjs +1 -1
  69. package/dist/lib/index.js +1 -1
  70. package/dist/lib/utils.cjs +13 -1
  71. package/dist/lib/utils.js +10 -1
  72. package/package.json +1 -1
@@ -1 +1,36 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../lib/utils.cjs`);require(`../../lib/index.cjs`);let n=require(`react`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);r=e.__toESM(r);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`@radix-ui/react-radio-group`);a=e.__toESM(a);function o({className:e,...n}){return(0,r.jsx)(a.Root,{"data-slot":`radio-group`,className:t.cn(`grid gap-3`,e),...n})}function s({className:e,...n}){return(0,r.jsx)(a.Item,{"data-slot":`radio-group-item`,className:t.cn(`border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:(0,r.jsx)(a.Indicator,{"data-slot":`radio-group-indicator`,className:`relative flex items-center justify-center`,children:(0,r.jsx)(i.CircleIcon,{className:`fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2`})})})}exports.RadioGroup=o,exports.RadioGroupItem=s;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_utils = require('../../lib/utils.cjs');
3
+ require('../../lib/index.cjs');
4
+ let react = require("react");
5
+ react = require_rolldown_runtime.__toESM(react);
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
+ let lucide_react = require("lucide-react");
9
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
10
+ let __radix_ui_react_radio_group = require("@radix-ui/react-radio-group");
11
+ __radix_ui_react_radio_group = require_rolldown_runtime.__toESM(__radix_ui_react_radio_group);
12
+
13
+ //#region src/components/ui/radio-group.tsx
14
+ function RadioGroup({ className,...props }) {
15
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_radio_group.Root, {
16
+ "data-slot": "radio-group",
17
+ className: require_utils.cn("grid gap-3", className),
18
+ ...props
19
+ });
20
+ }
21
+ function RadioGroupItem({ className,...props }) {
22
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_radio_group.Item, {
23
+ "data-slot": "radio-group-item",
24
+ className: require_utils.cn("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
25
+ ...props,
26
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_radio_group.Indicator, {
27
+ "data-slot": "radio-group-indicator",
28
+ className: "relative flex items-center justify-center",
29
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleIcon, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
30
+ })
31
+ });
32
+ }
33
+
34
+ //#endregion
35
+ exports.RadioGroup = RadioGroup;
36
+ exports.RadioGroupItem = RadioGroupItem;
@@ -1 +1,30 @@
1
- import{cn as e}from"../../lib/utils.js";import"../../lib/index.js";import"react";import{jsx as t}from"react/jsx-runtime";import{CircleIcon as n}from"lucide-react";import*as r from"@radix-ui/react-radio-group";function i({className:n,...i}){return t(r.Root,{"data-slot":`radio-group`,className:e(`grid gap-3`,n),...i})}function a({className:i,...a}){return t(r.Item,{"data-slot":`radio-group-item`,className:e(`border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,i),...a,children:t(r.Indicator,{"data-slot":`radio-group-indicator`,className:`relative flex items-center justify-center`,children:t(n,{className:`fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2`})})})}export{i as RadioGroup,a as RadioGroupItem};
1
+ import { cn } from "../../lib/utils.js";
2
+ import "../../lib/index.js";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { CircleIcon } from "lucide-react";
6
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
7
+
8
+ //#region src/components/ui/radio-group.tsx
9
+ function RadioGroup({ className,...props }) {
10
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, {
11
+ "data-slot": "radio-group",
12
+ className: cn("grid gap-3", className),
13
+ ...props
14
+ });
15
+ }
16
+ function RadioGroupItem({ className,...props }) {
17
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Item, {
18
+ "data-slot": "radio-group-item",
19
+ className: cn("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
20
+ ...props,
21
+ children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, {
22
+ "data-slot": "radio-group-indicator",
23
+ className: "relative flex items-center justify-center",
24
+ children: /* @__PURE__ */ jsx(CircleIcon, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
25
+ })
26
+ });
27
+ }
28
+
29
+ //#endregion
30
+ export { RadioGroup, RadioGroupItem };
@@ -1 +1,116 @@
1
- "use client";const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../lib/utils.cjs`);require(`../../lib/index.cjs`);let n=require(`react`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);r=e.__toESM(r);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`@radix-ui/react-select`);a=e.__toESM(a);function o({...e}){return(0,r.jsx)(a.Root,{"data-slot":`select`,...e})}function s({...e}){return(0,r.jsx)(a.Group,{"data-slot":`select-group`,...e})}function c({...e}){return(0,r.jsx)(a.Value,{"data-slot":`select-value`,...e})}function l({className:e,size:n=`default`,children:o,...s}){return(0,r.jsxs)(a.Trigger,{"data-slot":`select-trigger`,"data-size":n,className:t.cn(`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...s,children:[o,(0,r.jsx)(a.Icon,{asChild:!0,children:(0,r.jsx)(i.ChevronDownIcon,{className:`size-4 opacity-50`})})]})}function u({className:e,children:n,position:i=`popper`,align:o=`center`,...s}){return(0,r.jsx)(a.Portal,{children:(0,r.jsxs)(a.Content,{"data-slot":`select-content`,className:t.cn(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md`,i===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:i,align:o,...s,children:[(0,r.jsx)(m,{}),(0,r.jsx)(a.Viewport,{className:t.cn(`p-1`,i===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:n}),(0,r.jsx)(h,{})]})})}function d({className:e,...n}){return(0,r.jsx)(a.Label,{"data-slot":`select-label`,className:t.cn(`text-muted-foreground px-2 py-1.5 text-xs`,e),...n})}function f({className:e,children:n,...o}){return(0,r.jsxs)(a.Item,{"data-slot":`select-item`,className:t.cn(`focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...o,children:[(0,r.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,r.jsx)(a.ItemIndicator,{children:(0,r.jsx)(i.CheckIcon,{className:`size-4`})})}),(0,r.jsx)(a.ItemText,{children:n})]})}function p({className:e,...n}){return(0,r.jsx)(a.Separator,{"data-slot":`select-separator`,className:t.cn(`bg-border pointer-events-none -mx-1 my-1 h-px`,e),...n})}function m({className:e,...n}){return(0,r.jsx)(a.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:t.cn(`flex cursor-default items-center justify-center py-1`,e),...n,children:(0,r.jsx)(i.ChevronUpIcon,{className:`size-4`})})}function h({className:e,...n}){return(0,r.jsx)(a.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:t.cn(`flex cursor-default items-center justify-center py-1`,e),...n,children:(0,r.jsx)(i.ChevronDownIcon,{className:`size-4`})})}exports.Select=o,exports.SelectContent=u,exports.SelectGroup=s,exports.SelectItem=f,exports.SelectLabel=d,exports.SelectScrollDownButton=h,exports.SelectScrollUpButton=m,exports.SelectSeparator=p,exports.SelectTrigger=l,exports.SelectValue=c;
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
5
+ const require_utils = require('../../lib/utils.cjs');
6
+ require('../../lib/index.cjs');
7
+ let react = require("react");
8
+ react = require_rolldown_runtime.__toESM(react);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
+ let lucide_react = require("lucide-react");
12
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
13
+ let __radix_ui_react_select = require("@radix-ui/react-select");
14
+ __radix_ui_react_select = require_rolldown_runtime.__toESM(__radix_ui_react_select);
15
+
16
+ //#region src/components/ui/select.tsx
17
+ function Select({ ...props }) {
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Root, {
19
+ "data-slot": "select",
20
+ ...props
21
+ });
22
+ }
23
+ function SelectGroup({ ...props }) {
24
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Group, {
25
+ "data-slot": "select-group",
26
+ ...props
27
+ });
28
+ }
29
+ function SelectValue({ ...props }) {
30
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Value, {
31
+ "data-slot": "select-value",
32
+ ...props
33
+ });
34
+ }
35
+ function SelectTrigger({ className, size = "default", children,...props }) {
36
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__radix_ui_react_select.Trigger, {
37
+ "data-slot": "select-trigger",
38
+ "data-size": size,
39
+ className: require_utils.cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
40
+ ...props,
41
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Icon, {
42
+ asChild: true,
43
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, { className: "size-4 opacity-50" })
44
+ })]
45
+ });
46
+ }
47
+ function SelectContent({ className, children, position = "popper", align = "center",...props }) {
48
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__radix_ui_react_select.Content, {
49
+ "data-slot": "select-content",
50
+ className: require_utils.cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
51
+ position,
52
+ align,
53
+ ...props,
54
+ children: [
55
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectScrollUpButton, {}),
56
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Viewport, {
57
+ className: require_utils.cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
58
+ children
59
+ }),
60
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectScrollDownButton, {})
61
+ ]
62
+ }) });
63
+ }
64
+ function SelectLabel({ className,...props }) {
65
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Label, {
66
+ "data-slot": "select-label",
67
+ className: require_utils.cn("text-muted-foreground px-2 py-1.5 text-xs", className),
68
+ ...props
69
+ });
70
+ }
71
+ function SelectItem({ className, children,...props }) {
72
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__radix_ui_react_select.Item, {
73
+ "data-slot": "select-item",
74
+ className: require_utils.cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
75
+ ...props,
76
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
77
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
78
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, { className: "size-4" }) })
79
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.ItemText, { children })]
80
+ });
81
+ }
82
+ function SelectSeparator({ className,...props }) {
83
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.Separator, {
84
+ "data-slot": "select-separator",
85
+ className: require_utils.cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
86
+ ...props
87
+ });
88
+ }
89
+ function SelectScrollUpButton({ className,...props }) {
90
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.ScrollUpButton, {
91
+ "data-slot": "select-scroll-up-button",
92
+ className: require_utils.cn("flex cursor-default items-center justify-center py-1", className),
93
+ ...props,
94
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronUpIcon, { className: "size-4" })
95
+ });
96
+ }
97
+ function SelectScrollDownButton({ className,...props }) {
98
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_select.ScrollDownButton, {
99
+ "data-slot": "select-scroll-down-button",
100
+ className: require_utils.cn("flex cursor-default items-center justify-center py-1", className),
101
+ ...props,
102
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, { className: "size-4" })
103
+ });
104
+ }
105
+
106
+ //#endregion
107
+ exports.Select = Select;
108
+ exports.SelectContent = SelectContent;
109
+ exports.SelectGroup = SelectGroup;
110
+ exports.SelectItem = SelectItem;
111
+ exports.SelectLabel = SelectLabel;
112
+ exports.SelectScrollDownButton = SelectScrollDownButton;
113
+ exports.SelectScrollUpButton = SelectScrollUpButton;
114
+ exports.SelectSeparator = SelectSeparator;
115
+ exports.SelectTrigger = SelectTrigger;
116
+ exports.SelectValue = SelectValue;
@@ -1 +1,102 @@
1
- "use client";import{cn as e}from"../../lib/utils.js";import"../../lib/index.js";import"react";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{CheckIcon as r,ChevronDownIcon as i,ChevronUpIcon as a}from"lucide-react";import*as o from"@radix-ui/react-select";function s({...e}){return t(o.Root,{"data-slot":`select`,...e})}function c({...e}){return t(o.Group,{"data-slot":`select-group`,...e})}function l({...e}){return t(o.Value,{"data-slot":`select-value`,...e})}function u({className:r,size:a=`default`,children:s,...c}){return n(o.Trigger,{"data-slot":`select-trigger`,"data-size":a,className:e(`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),...c,children:[s,t(o.Icon,{asChild:!0,children:t(i,{className:`size-4 opacity-50`})})]})}function d({className:r,children:i,position:a=`popper`,align:s=`center`,...c}){return t(o.Portal,{children:n(o.Content,{"data-slot":`select-content`,className:e(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md`,a===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,r),position:a,align:s,...c,children:[t(h,{}),t(o.Viewport,{className:e(`p-1`,a===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:i}),t(g,{})]})})}function f({className:n,...r}){return t(o.Label,{"data-slot":`select-label`,className:e(`text-muted-foreground px-2 py-1.5 text-xs`,n),...r})}function p({className:i,children:a,...s}){return n(o.Item,{"data-slot":`select-item`,className:e(`focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,i),...s,children:[t(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:t(o.ItemIndicator,{children:t(r,{className:`size-4`})})}),t(o.ItemText,{children:a})]})}function m({className:n,...r}){return t(o.Separator,{"data-slot":`select-separator`,className:e(`bg-border pointer-events-none -mx-1 my-1 h-px`,n),...r})}function h({className:n,...r}){return t(o.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:e(`flex cursor-default items-center justify-center py-1`,n),...r,children:t(a,{className:`size-4`})})}function g({className:n,...r}){return t(o.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:e(`flex cursor-default items-center justify-center py-1`,n),...r,children:t(i,{className:`size-4`})})}export{s as Select,d as SelectContent,c as SelectGroup,p as SelectItem,f as SelectLabel,g as SelectScrollDownButton,h as SelectScrollUpButton,m as SelectSeparator,u as SelectTrigger,l as SelectValue};
1
+ 'use client';
2
+
3
+
4
+ import { cn } from "../../lib/utils.js";
5
+ import "../../lib/index.js";
6
+ import "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
9
+ import * as SelectPrimitive from "@radix-ui/react-select";
10
+
11
+ //#region src/components/ui/select.tsx
12
+ function Select({ ...props }) {
13
+ return /* @__PURE__ */ jsx(SelectPrimitive.Root, {
14
+ "data-slot": "select",
15
+ ...props
16
+ });
17
+ }
18
+ function SelectGroup({ ...props }) {
19
+ return /* @__PURE__ */ jsx(SelectPrimitive.Group, {
20
+ "data-slot": "select-group",
21
+ ...props
22
+ });
23
+ }
24
+ function SelectValue({ ...props }) {
25
+ return /* @__PURE__ */ jsx(SelectPrimitive.Value, {
26
+ "data-slot": "select-value",
27
+ ...props
28
+ });
29
+ }
30
+ function SelectTrigger({ className, size = "default", children,...props }) {
31
+ return /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
32
+ "data-slot": "select-trigger",
33
+ "data-size": size,
34
+ className: cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
35
+ ...props,
36
+ children: [children, /* @__PURE__ */ jsx(SelectPrimitive.Icon, {
37
+ asChild: true,
38
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" })
39
+ })]
40
+ });
41
+ }
42
+ function SelectContent({ className, children, position = "popper", align = "center",...props }) {
43
+ return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
44
+ "data-slot": "select-content",
45
+ className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
46
+ position,
47
+ align,
48
+ ...props,
49
+ children: [
50
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
51
+ /* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
52
+ className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
53
+ children
54
+ }),
55
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
56
+ ]
57
+ }) });
58
+ }
59
+ function SelectLabel({ className,...props }) {
60
+ return /* @__PURE__ */ jsx(SelectPrimitive.Label, {
61
+ "data-slot": "select-label",
62
+ className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
63
+ ...props
64
+ });
65
+ }
66
+ function SelectItem({ className, children,...props }) {
67
+ return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
68
+ "data-slot": "select-item",
69
+ className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
70
+ ...props,
71
+ children: [/* @__PURE__ */ jsx("span", {
72
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
73
+ children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
74
+ }), /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })]
75
+ });
76
+ }
77
+ function SelectSeparator({ className,...props }) {
78
+ return /* @__PURE__ */ jsx(SelectPrimitive.Separator, {
79
+ "data-slot": "select-separator",
80
+ className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
81
+ ...props
82
+ });
83
+ }
84
+ function SelectScrollUpButton({ className,...props }) {
85
+ return /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, {
86
+ "data-slot": "select-scroll-up-button",
87
+ className: cn("flex cursor-default items-center justify-center py-1", className),
88
+ ...props,
89
+ children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
90
+ });
91
+ }
92
+ function SelectScrollDownButton({ className,...props }) {
93
+ return /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, {
94
+ "data-slot": "select-scroll-down-button",
95
+ className: cn("flex cursor-default items-center justify-center py-1", className),
96
+ ...props,
97
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
98
+ });
99
+ }
100
+
101
+ //#endregion
102
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
@@ -1 +1,23 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../lib/utils.cjs`);require(`../../lib/index.cjs`);let n=require(`react`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);r=e.__toESM(r);let i=require(`@radix-ui/react-separator`);i=e.__toESM(i);function a({className:e,orientation:n=`horizontal`,decorative:a=!0,...o}){return(0,r.jsx)(i.Root,{"data-slot":`separator`,decorative:a,orientation:n,className:t.cn(`bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...o})}exports.Separator=a;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_utils = require('../../lib/utils.cjs');
3
+ require('../../lib/index.cjs');
4
+ let react = require("react");
5
+ react = require_rolldown_runtime.__toESM(react);
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
+ let __radix_ui_react_separator = require("@radix-ui/react-separator");
9
+ __radix_ui_react_separator = require_rolldown_runtime.__toESM(__radix_ui_react_separator);
10
+
11
+ //#region src/components/ui/separator.tsx
12
+ function Separator({ className, orientation = "horizontal", decorative = true,...props }) {
13
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_separator.Root, {
14
+ "data-slot": "separator",
15
+ decorative,
16
+ orientation,
17
+ className: require_utils.cn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className),
18
+ ...props
19
+ });
20
+ }
21
+
22
+ //#endregion
23
+ exports.Separator = Separator;
@@ -1 +1,19 @@
1
- import{cn as e}from"../../lib/utils.js";import"../../lib/index.js";import"react";import{jsx as t}from"react/jsx-runtime";import*as n from"@radix-ui/react-separator";function r({className:r,orientation:i=`horizontal`,decorative:a=!0,...o}){return t(n.Root,{"data-slot":`separator`,decorative:a,orientation:i,className:e(`bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,r),...o})}export{r as Separator};
1
+ import { cn } from "../../lib/utils.js";
2
+ import "../../lib/index.js";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
6
+
7
+ //#region src/components/ui/separator.tsx
8
+ function Separator({ className, orientation = "horizontal", decorative = true,...props }) {
9
+ return /* @__PURE__ */ jsx(SeparatorPrimitive.Root, {
10
+ "data-slot": "separator",
11
+ decorative,
12
+ orientation,
13
+ className: cn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className),
14
+ ...props
15
+ });
16
+ }
17
+
18
+ //#endregion
19
+ export { Separator };
@@ -1 +1,146 @@
1
- "use client";const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../../lib/utils.cjs`);require(`../../../../lib/index.cjs`);const n=require(`../../badge.cjs`),r=require(`../../button.cjs`),i=require(`../../command.cjs`),a=require(`../../popover.cjs`);let o=require(`react`);o=e.__toESM(o);let s=require(`react/jsx-runtime`);s=e.__toESM(s);let c=require(`lucide-react`);c=e.__toESM(c);const l=(0,o.createContext)({value:void 0,setValue:void 0,open:!1,onOpenChange:()=>{},width:void 0,setWidth:void 0});function u(){let e=(0,o.use)(l);if(!e)throw Error(`useTagsContext must be used within a TagsProvider`);return e}function d({value:e,setValue:n,open:r,onOpenChange:i,children:c,className:u}){let[d,f]=(0,o.useState)(!1),[p,m]=(0,o.useState)(),h=(0,o.useRef)(null),g=r??d,_=i??f;return(0,o.useEffect)(()=>{if(!h.current)return;let e=new ResizeObserver(e=>{e[0]&&m(e[0].contentRect.width)});return e.observe(h.current),()=>{e.disconnect()}},[]),(0,s.jsx)(l.Provider,{value:{value:e,setValue:n,open:g,onOpenChange:_,width:p,setWidth:m},children:(0,s.jsx)(a.Popover,{onOpenChange:_,open:g,children:(0,s.jsx)(`div`,{className:t.cn(`relative w-full`,u),ref:h,children:c})})})}function f({className:e,children:n,...i}){return(0,s.jsx)(a.PopoverTrigger,{asChild:!0,children:(0,s.jsx)(r.Button,{className:t.cn(`h-auto w-full justify-between p-2`,e),role:`combobox`,variant:`outline`,...i,children:(0,s.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[n,(0,s.jsx)(`span`,{className:`px-2 py-px text-muted-foreground`,children:`Select a tag...`})]})})})}function p({className:e,children:r,onRemove:i,...a}){let o=e=>{e.preventDefault(),e.stopPropagation(),i?.()};return(0,s.jsxs)(n.Badge,{className:t.cn(`flex items-center gap-2`,e),...a,children:[r,i&&(0,s.jsx)(`div`,{className:`size-auto cursor-pointer hover:text-muted-foreground`,onClick:o,children:(0,s.jsx)(c.XIcon,{size:12})})]})}function m({className:e,children:n,...r}){let{width:o}=u();return(0,s.jsx)(a.PopoverContent,{className:t.cn(`p-0`,e),style:{width:o},...r,children:(0,s.jsx)(i.Command,{children:n})})}function h({className:e,...n}){return(0,s.jsx)(i.CommandInput,{className:t.cn(`h-9`,e),...n})}function g({className:e,...n}){return(0,s.jsx)(i.CommandList,{className:t.cn(`max-h-[200px]`,e),...n})}function _({children:e,className:t,...n}){return(0,s.jsx)(i.CommandEmpty,{...n,children:e??`No tags found.`})}const v=i.CommandGroup;function y({className:e,...n}){return(0,s.jsx)(i.CommandItem,{className:t.cn(`cursor-pointer items-center justify-between`,e),...n})}exports.Tags=d,exports.TagsContent=m,exports.TagsEmpty=_,exports.TagsGroup=v,exports.TagsInput=h,exports.TagsItem=y,exports.TagsList=g,exports.TagsTrigger=f,exports.TagsValue=p;
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
5
+ const require_utils = require('../../../../lib/utils.cjs');
6
+ require('../../../../lib/index.cjs');
7
+ const require_badge = require('../../badge.cjs');
8
+ const require_button = require('../../button.cjs');
9
+ const require_command = require('../../command.cjs');
10
+ const require_popover = require('../../popover.cjs');
11
+ let react = require("react");
12
+ react = require_rolldown_runtime.__toESM(react);
13
+ let react_jsx_runtime = require("react/jsx-runtime");
14
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
15
+ let lucide_react = require("lucide-react");
16
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
17
+
18
+ //#region src/components/ui/shadcn-io/tags/index.tsx
19
+ const TagsContext = (0, react.createContext)({
20
+ value: void 0,
21
+ setValue: void 0,
22
+ open: false,
23
+ onOpenChange: () => {},
24
+ width: void 0,
25
+ setWidth: void 0
26
+ });
27
+ function useTagsContext() {
28
+ const context = (0, react.use)(TagsContext);
29
+ if (!context) throw new Error("useTagsContext must be used within a TagsProvider");
30
+ return context;
31
+ }
32
+ function Tags({ value, setValue, open: controlledOpen, onOpenChange: controlledOnOpenChange, children, className }) {
33
+ const [uncontrolledOpen, setUncontrolledOpen] = (0, react.useState)(false);
34
+ const [width, setWidth] = (0, react.useState)();
35
+ const ref = (0, react.useRef)(null);
36
+ const open = controlledOpen ?? uncontrolledOpen;
37
+ const onOpenChange = controlledOnOpenChange ?? setUncontrolledOpen;
38
+ (0, react.useEffect)(() => {
39
+ if (!ref.current) return;
40
+ const resizeObserver = new ResizeObserver((entries) => {
41
+ if (entries[0]) setWidth(entries[0].contentRect.width);
42
+ });
43
+ resizeObserver.observe(ref.current);
44
+ return () => {
45
+ resizeObserver.disconnect();
46
+ };
47
+ }, []);
48
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TagsContext.Provider, {
49
+ value: {
50
+ value,
51
+ setValue,
52
+ open,
53
+ onOpenChange,
54
+ width,
55
+ setWidth
56
+ },
57
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_popover.Popover, {
58
+ onOpenChange,
59
+ open,
60
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61
+ className: require_utils.cn("relative w-full", className),
62
+ ref,
63
+ children
64
+ })
65
+ })
66
+ });
67
+ }
68
+ function TagsTrigger({ className, children,...props }) {
69
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_popover.PopoverTrigger, {
70
+ asChild: true,
71
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
72
+ className: require_utils.cn("h-auto w-full justify-between p-2", className),
73
+ role: "combobox",
74
+ variant: "outline",
75
+ ...props,
76
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
77
+ className: "flex flex-wrap items-center gap-1",
78
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
79
+ className: "px-2 py-px text-muted-foreground",
80
+ children: "Select a tag..."
81
+ })]
82
+ })
83
+ })
84
+ });
85
+ }
86
+ function TagsValue({ className, children, onRemove,...props }) {
87
+ const handleRemove = (event) => {
88
+ event.preventDefault();
89
+ event.stopPropagation();
90
+ onRemove?.();
91
+ };
92
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_badge.Badge, {
93
+ className: require_utils.cn("flex items-center gap-2", className),
94
+ ...props,
95
+ children: [children, onRemove && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
96
+ className: "size-auto cursor-pointer hover:text-muted-foreground",
97
+ onClick: handleRemove,
98
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XIcon, { size: 12 })
99
+ })]
100
+ });
101
+ }
102
+ function TagsContent({ className, children,...props }) {
103
+ const { width } = useTagsContext();
104
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_popover.PopoverContent, {
105
+ className: require_utils.cn("p-0", className),
106
+ style: { width },
107
+ ...props,
108
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_command.Command, { children })
109
+ });
110
+ }
111
+ function TagsInput({ className,...props }) {
112
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_command.CommandInput, {
113
+ className: require_utils.cn("h-9", className),
114
+ ...props
115
+ });
116
+ }
117
+ function TagsList({ className,...props }) {
118
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_command.CommandList, {
119
+ className: require_utils.cn("max-h-[200px]", className),
120
+ ...props
121
+ });
122
+ }
123
+ function TagsEmpty({ children, className,...props }) {
124
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_command.CommandEmpty, {
125
+ ...props,
126
+ children: children ?? "No tags found."
127
+ });
128
+ }
129
+ const TagsGroup = require_command.CommandGroup;
130
+ function TagsItem({ className,...props }) {
131
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_command.CommandItem, {
132
+ className: require_utils.cn("cursor-pointer items-center justify-between", className),
133
+ ...props
134
+ });
135
+ }
136
+
137
+ //#endregion
138
+ exports.Tags = Tags;
139
+ exports.TagsContent = TagsContent;
140
+ exports.TagsEmpty = TagsEmpty;
141
+ exports.TagsGroup = TagsGroup;
142
+ exports.TagsInput = TagsInput;
143
+ exports.TagsItem = TagsItem;
144
+ exports.TagsList = TagsList;
145
+ exports.TagsTrigger = TagsTrigger;
146
+ exports.TagsValue = TagsValue;
@@ -1 +1,134 @@
1
- "use client";import{cn as e}from"../../../../lib/utils.js";import"../../../../lib/index.js";import{Badge as t}from"../../badge.js";import{Button as n}from"../../button.js";import{Command as r,CommandEmpty as i,CommandGroup as a,CommandInput as o,CommandItem as s,CommandList as c}from"../../command.js";import{Popover as l,PopoverContent as u,PopoverTrigger as d}from"../../popover.js";import{createContext as f,use as p,useEffect as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{XIcon as y}from"lucide-react";const b=f({value:void 0,setValue:void 0,open:!1,onOpenChange:()=>{},width:void 0,setWidth:void 0});function x(){let e=p(b);if(!e)throw Error(`useTagsContext must be used within a TagsProvider`);return e}function S({value:t,setValue:n,open:r,onOpenChange:i,children:a,className:o}){let[s,c]=g(!1),[u,d]=g(),f=h(null),p=r??s,v=i??c;return m(()=>{if(!f.current)return;let e=new ResizeObserver(e=>{e[0]&&d(e[0].contentRect.width)});return e.observe(f.current),()=>{e.disconnect()}},[]),_(b.Provider,{value:{value:t,setValue:n,open:p,onOpenChange:v,width:u,setWidth:d},children:_(l,{onOpenChange:v,open:p,children:_(`div`,{className:e(`relative w-full`,o),ref:f,children:a})})})}function C({className:t,children:r,...i}){return _(d,{asChild:!0,children:_(n,{className:e(`h-auto w-full justify-between p-2`,t),role:`combobox`,variant:`outline`,...i,children:v(`div`,{className:`flex flex-wrap items-center gap-1`,children:[r,_(`span`,{className:`px-2 py-px text-muted-foreground`,children:`Select a tag...`})]})})})}function w({className:n,children:r,onRemove:i,...a}){let o=e=>{e.preventDefault(),e.stopPropagation(),i?.()};return v(t,{className:e(`flex items-center gap-2`,n),...a,children:[r,i&&_(`div`,{className:`size-auto cursor-pointer hover:text-muted-foreground`,onClick:o,children:_(y,{size:12})})]})}function T({className:t,children:n,...i}){let{width:a}=x();return _(u,{className:e(`p-0`,t),style:{width:a},...i,children:_(r,{children:n})})}function E({className:t,...n}){return _(o,{className:e(`h-9`,t),...n})}function D({className:t,...n}){return _(c,{className:e(`max-h-[200px]`,t),...n})}function O({children:e,className:t,...n}){return _(i,{...n,children:e??`No tags found.`})}const k=a;function A({className:t,...n}){return _(s,{className:e(`cursor-pointer items-center justify-between`,t),...n})}export{S as Tags,T as TagsContent,O as TagsEmpty,k as TagsGroup,E as TagsInput,A as TagsItem,D as TagsList,C as TagsTrigger,w as TagsValue};
1
+ 'use client';
2
+
3
+
4
+ import { cn } from "../../../../lib/utils.js";
5
+ import "../../../../lib/index.js";
6
+ import { Badge } from "../../badge.js";
7
+ import { Button } from "../../button.js";
8
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../../command.js";
9
+ import { Popover, PopoverContent, PopoverTrigger } from "../../popover.js";
10
+ import { createContext, use, useEffect, useRef, useState } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { XIcon } from "lucide-react";
13
+
14
+ //#region src/components/ui/shadcn-io/tags/index.tsx
15
+ const TagsContext = createContext({
16
+ value: void 0,
17
+ setValue: void 0,
18
+ open: false,
19
+ onOpenChange: () => {},
20
+ width: void 0,
21
+ setWidth: void 0
22
+ });
23
+ function useTagsContext() {
24
+ const context = use(TagsContext);
25
+ if (!context) throw new Error("useTagsContext must be used within a TagsProvider");
26
+ return context;
27
+ }
28
+ function Tags({ value, setValue, open: controlledOpen, onOpenChange: controlledOnOpenChange, children, className }) {
29
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
30
+ const [width, setWidth] = useState();
31
+ const ref = useRef(null);
32
+ const open = controlledOpen ?? uncontrolledOpen;
33
+ const onOpenChange = controlledOnOpenChange ?? setUncontrolledOpen;
34
+ useEffect(() => {
35
+ if (!ref.current) return;
36
+ const resizeObserver = new ResizeObserver((entries) => {
37
+ if (entries[0]) setWidth(entries[0].contentRect.width);
38
+ });
39
+ resizeObserver.observe(ref.current);
40
+ return () => {
41
+ resizeObserver.disconnect();
42
+ };
43
+ }, []);
44
+ return /* @__PURE__ */ jsx(TagsContext.Provider, {
45
+ value: {
46
+ value,
47
+ setValue,
48
+ open,
49
+ onOpenChange,
50
+ width,
51
+ setWidth
52
+ },
53
+ children: /* @__PURE__ */ jsx(Popover, {
54
+ onOpenChange,
55
+ open,
56
+ children: /* @__PURE__ */ jsx("div", {
57
+ className: cn("relative w-full", className),
58
+ ref,
59
+ children
60
+ })
61
+ })
62
+ });
63
+ }
64
+ function TagsTrigger({ className, children,...props }) {
65
+ return /* @__PURE__ */ jsx(PopoverTrigger, {
66
+ asChild: true,
67
+ children: /* @__PURE__ */ jsx(Button, {
68
+ className: cn("h-auto w-full justify-between p-2", className),
69
+ role: "combobox",
70
+ variant: "outline",
71
+ ...props,
72
+ children: /* @__PURE__ */ jsxs("div", {
73
+ className: "flex flex-wrap items-center gap-1",
74
+ children: [children, /* @__PURE__ */ jsx("span", {
75
+ className: "px-2 py-px text-muted-foreground",
76
+ children: "Select a tag..."
77
+ })]
78
+ })
79
+ })
80
+ });
81
+ }
82
+ function TagsValue({ className, children, onRemove,...props }) {
83
+ const handleRemove = (event) => {
84
+ event.preventDefault();
85
+ event.stopPropagation();
86
+ onRemove?.();
87
+ };
88
+ return /* @__PURE__ */ jsxs(Badge, {
89
+ className: cn("flex items-center gap-2", className),
90
+ ...props,
91
+ children: [children, onRemove && /* @__PURE__ */ jsx("div", {
92
+ className: "size-auto cursor-pointer hover:text-muted-foreground",
93
+ onClick: handleRemove,
94
+ children: /* @__PURE__ */ jsx(XIcon, { size: 12 })
95
+ })]
96
+ });
97
+ }
98
+ function TagsContent({ className, children,...props }) {
99
+ const { width } = useTagsContext();
100
+ return /* @__PURE__ */ jsx(PopoverContent, {
101
+ className: cn("p-0", className),
102
+ style: { width },
103
+ ...props,
104
+ children: /* @__PURE__ */ jsx(Command, { children })
105
+ });
106
+ }
107
+ function TagsInput({ className,...props }) {
108
+ return /* @__PURE__ */ jsx(CommandInput, {
109
+ className: cn("h-9", className),
110
+ ...props
111
+ });
112
+ }
113
+ function TagsList({ className,...props }) {
114
+ return /* @__PURE__ */ jsx(CommandList, {
115
+ className: cn("max-h-[200px]", className),
116
+ ...props
117
+ });
118
+ }
119
+ function TagsEmpty({ children, className,...props }) {
120
+ return /* @__PURE__ */ jsx(CommandEmpty, {
121
+ ...props,
122
+ children: children ?? "No tags found."
123
+ });
124
+ }
125
+ const TagsGroup = CommandGroup;
126
+ function TagsItem({ className,...props }) {
127
+ return /* @__PURE__ */ jsx(CommandItem, {
128
+ className: cn("cursor-pointer items-center justify-between", className),
129
+ ...props
130
+ });
131
+ }
132
+
133
+ //#endregion
134
+ export { Tags, TagsContent, TagsEmpty, TagsGroup, TagsInput, TagsItem, TagsList, TagsTrigger, TagsValue };