@trsys-tech/matrix-library 0.6.0 → 1.0.0-canary.0
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/accordion.es.js +27 -27
- package/dist/accordion.es.js.map +1 -1
- package/dist/avatar.es.js +28 -14
- package/dist/avatar.es.js.map +1 -1
- package/dist/badge.es.js +24 -24
- package/dist/badge.es.js.map +1 -1
- package/dist/breadcrumb.es.js +34 -24
- package/dist/breadcrumb.es.js.map +1 -1
- package/dist/button.es.js +28 -28
- package/dist/button.es.js.map +1 -1
- package/dist/calendar.es.js +64 -61
- package/dist/calendar.es.js.map +1 -1
- package/dist/card.es.js +21 -21
- package/dist/card.es.js.map +1 -1
- package/dist/checkbox.es.js +15 -15
- package/dist/checkbox.es.js.map +1 -1
- package/dist/chip.es.js +24 -24
- package/dist/chip.es.js.map +1 -1
- package/dist/collapsible.es.js +17 -17
- package/dist/collapsible.es.js.map +1 -1
- package/dist/combobox.es.js +79 -70
- package/dist/combobox.es.js.map +1 -1
- package/dist/command.es.js +62 -59
- package/dist/command.es.js.map +1 -1
- package/dist/components/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.d.ts.map +1 -1
- package/dist/components/badge/Badge.d.ts +2 -2
- package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/components/button/Button.d.ts +2 -2
- package/dist/components/chip/Chip.d.ts +2 -2
- package/dist/components/combobox/Combobox.d.ts.map +1 -1
- package/dist/components/command/Command.d.ts.map +1 -1
- package/dist/components/confirm/Confirm.d.ts.map +1 -1
- package/dist/components/context-menu/ContextMenu.d.ts.map +1 -1
- package/dist/components/data-grid/DataGrid.d.ts.map +1 -1
- package/dist/components/date-picker/TimePickerContent.d.ts.map +1 -1
- package/dist/components/date-picker/calendar.d.ts.map +1 -1
- package/dist/components/dialog/Dialog.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/SwipableDrawer.d.ts.map +1 -1
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/components/icon-botton/IconButton.d.ts +2 -2
- package/dist/components/icon-botton/IconButton.d.ts.map +1 -1
- package/dist/components/label/Label.d.ts +1 -1
- package/dist/components/label/Label.d.ts.map +1 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.d.ts +2 -2
- package/dist/components/progress/Progress.d.ts.map +1 -1
- package/dist/components/rating/Rating.d.ts +2 -2
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/sheet/Sheet.d.ts +2 -2
- package/dist/components/sheet/Sheet.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/switch/Switch.d.ts +2 -2
- package/dist/components/text-field/TextField.d.ts.map +1 -1
- package/dist/components/toast/toast-components.d.ts +4 -4
- package/dist/components/toast/toast-components.d.ts.map +1 -1
- package/dist/confirm.es.js +18 -8
- package/dist/confirm.es.js.map +1 -1
- package/dist/contextmenu.es.js +77 -70
- package/dist/contextmenu.es.js.map +1 -1
- package/dist/datagrid.es.js +101 -97
- package/dist/datagrid.es.js.map +1 -1
- package/dist/desktopdatepicker.es.js +30 -30
- package/dist/desktopdatepicker.es.js.map +1 -1
- package/dist/desktopdaterangepicker.es.js +44 -44
- package/dist/desktopdaterangepicker.es.js.map +1 -1
- package/dist/desktoptimepicker.es.js +24 -24
- package/dist/desktoptimepicker.es.js.map +1 -1
- package/dist/dialog.es.js +43 -43
- package/dist/dialog.es.js.map +1 -1
- package/dist/drawer.es.js +27 -27
- package/dist/drawer.es.js.map +1 -1
- package/dist/duration.es.js +34 -34
- package/dist/duration.es.js.map +1 -1
- package/dist/form.es.js +20 -20
- package/dist/form.es.js.map +1 -1
- package/dist/formcheckbox.es.js +13 -13
- package/dist/formcheckbox.es.js.map +1 -1
- package/dist/formcombobox.es.js +17 -17
- package/dist/formcombobox.es.js.map +1 -1
- package/dist/formdatepicker.es.js +12 -12
- package/dist/formdatepicker.es.js.map +1 -1
- package/dist/formdaterangepicker.es.js +16 -16
- package/dist/formdaterangepicker.es.js.map +1 -1
- package/dist/formduration.es.js +13 -13
- package/dist/formduration.es.js.map +1 -1
- package/dist/forminput.es.js +10 -10
- package/dist/forminput.es.js.map +1 -1
- package/dist/formmultiselect.es.js +7 -7
- package/dist/formmultiselect.es.js.map +1 -1
- package/dist/formrating.es.js +21 -21
- package/dist/formrating.es.js.map +1 -1
- package/dist/formselect.es.js +28 -28
- package/dist/formselect.es.js.map +1 -1
- package/dist/formswitch.es.js +14 -14
- package/dist/formswitch.es.js.map +1 -1
- package/dist/formtextarea.es.js +12 -12
- package/dist/formtextarea.es.js.map +1 -1
- package/dist/formtimepicker.es.js +12 -12
- package/dist/formtimepicker.es.js.map +1 -1
- package/dist/iconbutton.es.js +22 -22
- package/dist/iconbutton.es.js.map +1 -1
- package/dist/label.es.js +6 -6
- package/dist/label.es.js.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/mobiledatepicker.es.js +42 -42
- package/dist/mobiledatepicker.es.js.map +1 -1
- package/dist/mobiledaterangepicker.es.js +50 -50
- package/dist/mobiledaterangepicker.es.js.map +1 -1
- package/dist/mobiletimepicker.es.js +30 -30
- package/dist/mobiletimepicker.es.js.map +1 -1
- package/dist/modal.es.js +48 -44
- package/dist/modal.es.js.map +1 -1
- package/dist/multiselect.es.js +120 -120
- package/dist/multiselect.es.js.map +1 -1
- package/dist/popover.es.js +16 -16
- package/dist/popover.es.js.map +1 -1
- package/dist/progress.es.js +29 -21
- package/dist/progress.es.js.map +1 -1
- package/dist/radiogroup.es.js +16 -16
- package/dist/radiogroup.es.js.map +1 -1
- package/dist/rating.es.js +76 -76
- package/dist/rating.es.js.map +1 -1
- package/dist/select.es.js +82 -63
- package/dist/select.es.js.map +1 -1
- package/dist/separator.es.js +13 -13
- package/dist/separator.es.js.map +1 -1
- package/dist/sheet.es.js +44 -44
- package/dist/sheet.es.js.map +1 -1
- package/dist/sidebar.es.js +245 -233
- package/dist/sidebar.es.js.map +1 -1
- package/dist/skeleton.es.js +6 -6
- package/dist/skeleton.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/swipabledrawer.es.js +41 -38
- package/dist/swipabledrawer.es.js.map +1 -1
- package/dist/switch.es.js +16 -16
- package/dist/switch.es.js.map +1 -1
- package/dist/tabs.es.js +22 -22
- package/dist/tabs.es.js.map +1 -1
- package/dist/textarea.es.js +12 -12
- package/dist/textarea.es.js.map +1 -1
- package/dist/textfield.es.js +37 -37
- package/dist/textfield.es.js.map +1 -1
- package/dist/timepickercontent.es.js +63 -56
- package/dist/timepickercontent.es.js.map +1 -1
- package/dist/toast-components.es.js +47 -44
- package/dist/toast-components.es.js.map +1 -1
- package/dist/toast.es.js +24 -24
- package/dist/toast.es.js.map +1 -1
- package/dist/tooltip.es.js +16 -16
- package/dist/tooltip.es.js.map +1 -1
- package/dist/utils.es.js +6 -5
- package/dist/utils.es.js.map +1 -1
- package/package.json +5 -5
package/dist/progress.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.es.js","sources":["../src/components/progress/Progress.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\r\nimport { cn } from \"../../lib/utils\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\n\r\nconst progressVariants = tv({\r\n base: \"\",\r\n variants: {\r\n variant: {\r\n primary: \"bg-primary\",\r\n info: \"bg-info\",\r\n success: \"bg-success\",\r\n warning: \"bg-warning\",\r\n danger: \"bg-danger\",\r\n },\r\n size: {\r\n sm: \"h-[3px]\",\r\n md: \"h-[4px]\",\r\n lg: \"h-[5px]\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"primary\",\r\n size: \"md\",\r\n },\r\n});\r\n\r\ntype ProgressProps = React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & {\r\n variant?: VariantProps<typeof progressVariants>[\"variant\"];\r\n size?: VariantProps<typeof progressVariants>[\"size\"];\r\n};\r\n\r\nconst Progress = React.forwardRef<React.ElementRef<typeof ProgressPrimitive.Root>, ProgressProps>(\r\n ({ className, value, variant, size, ...props }, ref) => (\r\n <ProgressPrimitive.Root
|
|
1
|
+
{"version":3,"file":"progress.es.js","sources":["../src/components/progress/Progress.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\r\nimport { cn } from \"../../lib/utils\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\n\r\nconst progressVariants = tv({\r\n base: \"\",\r\n variants: {\r\n variant: {\r\n primary: \"mtx-bg-primary\",\r\n info: \"mtx-bg-info\",\r\n success: \"mtx-bg-success\",\r\n warning: \"mtx-bg-warning\",\r\n danger: \"mtx-bg-danger\",\r\n },\r\n size: {\r\n sm: \"mtx-h-[3px]\",\r\n md: \"mtx-h-[4px]\",\r\n lg: \"mtx-h-[5px]\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"primary\",\r\n size: \"md\",\r\n },\r\n});\r\n\r\ntype ProgressProps = React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & {\r\n variant?: VariantProps<typeof progressVariants>[\"variant\"];\r\n size?: VariantProps<typeof progressVariants>[\"size\"];\r\n};\r\n\r\nconst Progress = React.forwardRef<React.ElementRef<typeof ProgressPrimitive.Root>, ProgressProps>(\r\n ({ className, value, variant, size, ...props }, ref) => (\r\n <ProgressPrimitive.Root\r\n ref={ref}\r\n className={cn(progressVariants({ size }), \"mtx-relative mtx-w-full mtx-overflow-hidden mtx-bg-gray-300\", className)}\r\n {...props}\r\n >\r\n <ProgressPrimitive.Indicator\r\n className={cn(\"mtx-h-full mtx-w-full mtx-flex-1 mtx-transition-all\", progressVariants({ variant }))}\r\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\r\n />\r\n </ProgressPrimitive.Root>\r\n ),\r\n);\r\nProgress.displayName = ProgressPrimitive.Root.displayName;\r\n\r\nexport { Progress, type ProgressProps };\r\n"],"names":["progressVariants","tv","Progress","React","className","value","variant","size","props","ref","jsx","ProgressPrimitive","cn"],"mappings":";;;;;AAOA,MAAMA,IAAmBC,EAAG;AAAA,EAC1B,MAAM;AAAA,EACN,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,IAAA;AAAA,IAEV,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IAAA;AAAA,EACN;AAAA,EAEF,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,MAAM;AAAA,EAAA;AAEV,CAAC,GAOKC,IAAWC,EAAM;AAAA,EACrB,CAAC,EAAE,WAAAC,GAAW,OAAAC,GAAO,SAAAC,GAAS,MAAAC,GAAM,GAAGC,EAAA,GAASC,MAC9C,gBAAAC;AAAA,IAACC,EAAkB;AAAA,IAAlB;AAAA,MACC,KAAAF;AAAA,MACA,WAAWG,EAAGZ,EAAiB,EAAE,MAAAO,GAAM,GAAG,+DAA+DH,CAAS;AAAA,MACjH,GAAGI;AAAA,MAEJ,UAAA,gBAAAE;AAAA,QAACC,EAAkB;AAAA,QAAlB;AAAA,UACC,WAAWC,EAAG,uDAAuDZ,EAAiB,EAAE,SAAAM,EAAA,CAAS,CAAC;AAAA,UAClG,OAAO,EAAE,WAAW,eAAe,OAAOD,KAAS,EAAE,KAAA;AAAA,QAAK;AAAA,MAAA;AAAA,IAC5D;AAAA,EAAA;AAGN;AACAH,EAAS,cAAcS,EAAkB,KAAK;"}
|
package/dist/radiogroup.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { Circle as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { Circle as d } from "@trsys-tech/matrix-icons";
|
|
4
4
|
import * as r from "@radix-ui/react-radio-group";
|
|
5
|
-
import { cn as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
5
|
+
import { cn as i } from "./utils.es.js";
|
|
6
|
+
const s = a.forwardRef(({ className: m, ...e }, o) => /* @__PURE__ */ t(r.Root, { className: i("mtx-grid mtx-gap-2", m), ...e, ref: o }));
|
|
7
|
+
s.displayName = r.Root.displayName;
|
|
8
|
+
const x = a.forwardRef(({ className: m, ...e }, o) => /* @__PURE__ */ t(
|
|
9
9
|
r.Item,
|
|
10
10
|
{
|
|
11
|
-
ref:
|
|
12
|
-
className:
|
|
13
|
-
"aspect-square h-4 w-4 rounded-full border border-gray-400 data-[state=checked]:border-primary hover:border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-muted disabled:border-muted",
|
|
14
|
-
|
|
11
|
+
ref: o,
|
|
12
|
+
className: i(
|
|
13
|
+
"mtx-aspect-square mtx-h-4 mtx-w-4 mtx-rounded-full mtx-border mtx-border-gray-400 data-[state=checked]:mtx-border-primary hover:mtx-border-primary mtx-text-primary mtx-shadow focus:mtx-outline-none focus-visible:mtx-ring-1 focus-visible:mtx-ring-ring disabled:mtx-cursor-not-allowed disabled:mtx-bg-muted disabled:mtx-border-muted",
|
|
14
|
+
m
|
|
15
15
|
),
|
|
16
|
-
...
|
|
17
|
-
children: /* @__PURE__ */
|
|
16
|
+
...e,
|
|
17
|
+
children: /* @__PURE__ */ t(r.Indicator, { className: "mtx-flex mtx-items-center mtx-justify-center", children: /* @__PURE__ */ t(d, { className: "mtx-h-2.5 mtx-w-2.5 mtx-fill-primary" }) })
|
|
18
18
|
}
|
|
19
19
|
));
|
|
20
|
-
|
|
20
|
+
x.displayName = r.Item.displayName;
|
|
21
21
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
s as RadioGroup,
|
|
23
|
+
x as RadioGroupItem
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=radiogroup.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radiogroup.es.js","sources":["../src/components/radio-group/RadioGroup.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Circle } from \"@trsys-tech/matrix-icons\";\r\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\r\nimport type { RadioGroupProps, RadioGroupItemProps } from \"@radix-ui/react-radio-group\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nconst RadioGroup = React.forwardRef<\r\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\r\n>(({ className, ...props }, ref) => {\r\n return <RadioGroupPrimitive.Root className={cn(\"grid gap-2\", className)} {...props} ref={ref} />;\r\n});\r\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName;\r\n\r\nconst RadioGroupItem = React.forwardRef<\r\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <RadioGroupPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n \"aspect-square h-4 w-4 rounded-full border border-gray-400 data-[state=checked]:border-primary hover:border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-muted disabled:border-muted\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\r\n <Circle className=\"h-2.5 w-2.5 fill-primary\" />\r\n </RadioGroupPrimitive.Indicator>\r\n </RadioGroupPrimitive.Item>\r\n );\r\n});\r\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;\r\n\r\nexport { RadioGroup, RadioGroupItem, type RadioGroupProps, type RadioGroupItemProps };\r\n"],"names":["RadioGroup","React","className","props","ref","jsx","RadioGroupPrimitive","cn","RadioGroupItem","Circle"],"mappings":";;;;;AASA,MAAMA,IAAaC,EAAM,WAGvB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MACnB,gBAAAC,EAACC,EAAoB,MAApB,EAAyB,WAAWC,EAAG,
|
|
1
|
+
{"version":3,"file":"radiogroup.es.js","sources":["../src/components/radio-group/RadioGroup.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Circle } from \"@trsys-tech/matrix-icons\";\r\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\r\nimport type { RadioGroupProps, RadioGroupItemProps } from \"@radix-ui/react-radio-group\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nconst RadioGroup = React.forwardRef<\r\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\r\n>(({ className, ...props }, ref) => {\r\n return <RadioGroupPrimitive.Root className={cn(\"mtx-grid mtx-gap-2\", className)} {...props} ref={ref} />;\r\n});\r\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName;\r\n\r\nconst RadioGroupItem = React.forwardRef<\r\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <RadioGroupPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n \"mtx-aspect-square mtx-h-4 mtx-w-4 mtx-rounded-full mtx-border mtx-border-gray-400 data-[state=checked]:mtx-border-primary hover:mtx-border-primary mtx-text-primary mtx-shadow focus:mtx-outline-none focus-visible:mtx-ring-1 focus-visible:mtx-ring-ring disabled:mtx-cursor-not-allowed disabled:mtx-bg-muted disabled:mtx-border-muted\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <RadioGroupPrimitive.Indicator className=\"mtx-flex mtx-items-center mtx-justify-center\">\r\n <Circle className=\"mtx-h-2.5 mtx-w-2.5 mtx-fill-primary\" />\r\n </RadioGroupPrimitive.Indicator>\r\n </RadioGroupPrimitive.Item>\r\n );\r\n});\r\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;\r\n\r\nexport { RadioGroup, RadioGroupItem, type RadioGroupProps, type RadioGroupItemProps };\r\n"],"names":["RadioGroup","React","className","props","ref","jsx","RadioGroupPrimitive","cn","RadioGroupItem","Circle"],"mappings":";;;;;AASA,MAAMA,IAAaC,EAAM,WAGvB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MACnB,gBAAAC,EAACC,EAAoB,MAApB,EAAyB,WAAWC,EAAG,sBAAsBL,CAAS,GAAI,GAAGC,GAAO,KAAAC,EAAA,CAAU,CACvG;AACDJ,EAAW,cAAcM,EAAoB,KAAK;AAElD,MAAME,IAAiBP,EAAM,WAG3B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAExB,gBAAAC;AAAA,EAACC,EAAoB;AAAA,EAApB;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,IAEJ,UAAA,gBAAAE,EAACC,EAAoB,WAApB,EAA8B,WAAU,gDACvC,UAAA,gBAAAD,EAACI,GAAA,EAAO,WAAU,uCAAA,CAAuC,EAAA,CAC3D;AAAA,EAAA;AAAA,CAGL;AACDD,EAAe,cAAcF,EAAoB,KAAK;"}
|
package/dist/rating.es.js
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as p, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import u from "react";
|
|
3
3
|
import { cn as a } from "./utils.es.js";
|
|
4
4
|
import { tv as $ } from "tailwind-variants";
|
|
5
5
|
import { Star as C } from "@trsys-tech/matrix-icons";
|
|
6
6
|
const E = $({
|
|
7
|
-
base: "flex items-center gap-0",
|
|
7
|
+
base: "mtx-flex mtx-items-center mtx-gap-0",
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
|
-
default: "text-yellow-400",
|
|
11
|
-
primary: "text-primary",
|
|
12
|
-
secondary: "text-secondary",
|
|
13
|
-
success: "text-success",
|
|
14
|
-
danger: "text-danger",
|
|
15
|
-
warning: "text-warning",
|
|
16
|
-
info: "text-info"
|
|
10
|
+
default: "mtx-text-yellow-400",
|
|
11
|
+
primary: "mtx-text-primary",
|
|
12
|
+
secondary: "mtx-text-secondary",
|
|
13
|
+
success: "mtx-text-success",
|
|
14
|
+
danger: "mtx-text-danger",
|
|
15
|
+
warning: "mtx-text-warning",
|
|
16
|
+
info: "mtx-text-info"
|
|
17
17
|
},
|
|
18
18
|
size: {
|
|
19
|
-
sm: "[&_*_svg]:h-5 [&_*_svg]:w-5",
|
|
20
|
-
md: "[&_*_svg]:h-6 [&_*_svg]:w-6",
|
|
21
|
-
lg: "[&_*_svg]:h-8 [&_*_svg]:w-8"
|
|
19
|
+
sm: "[&_*_svg]:mtx-h-5 [&_*_svg]:mtx-w-5",
|
|
20
|
+
md: "[&_*_svg]:mtx-h-6 [&_*_svg]:mtx-w-6",
|
|
21
|
+
lg: "[&_*_svg]:mtx-h-8 [&_*_svg]:mtx-w-8"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
defaultVariants: {
|
|
25
25
|
variant: "default",
|
|
26
26
|
size: "md"
|
|
27
27
|
}
|
|
28
|
-
}), P =
|
|
28
|
+
}), P = u.forwardRef((s, t) => {
|
|
29
29
|
const {
|
|
30
|
-
precision:
|
|
30
|
+
precision: l = "full",
|
|
31
31
|
variant: r,
|
|
32
|
-
size:
|
|
33
|
-
readOnly:
|
|
34
|
-
onValueChange:
|
|
32
|
+
size: n,
|
|
33
|
+
readOnly: x = !1,
|
|
34
|
+
onValueChange: o,
|
|
35
35
|
value: e = 0,
|
|
36
|
-
className:
|
|
37
|
-
children:
|
|
38
|
-
max:
|
|
39
|
-
Icon:
|
|
40
|
-
disabled:
|
|
41
|
-
...
|
|
42
|
-
} =
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
className: _,
|
|
37
|
+
children: k,
|
|
38
|
+
max: i = 5,
|
|
39
|
+
Icon: y = C,
|
|
40
|
+
disabled: b,
|
|
41
|
+
...d
|
|
42
|
+
} = s, [v, h] = u.useState(e), [w, N] = u.useState(null), f = w ?? v;
|
|
43
|
+
u.useEffect(() => {
|
|
44
|
+
h(e);
|
|
45
45
|
}, [e]);
|
|
46
|
-
const M = (
|
|
47
|
-
|
|
48
|
-
}, S = (
|
|
49
|
-
|
|
46
|
+
const M = (c) => {
|
|
47
|
+
x || (h(c), o?.(c));
|
|
48
|
+
}, S = (c) => {
|
|
49
|
+
x || N(c);
|
|
50
50
|
};
|
|
51
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ p(
|
|
52
52
|
"div",
|
|
53
53
|
{
|
|
54
|
-
className: a(E({ variant: r, size:
|
|
54
|
+
className: a(E({ variant: r, size: n, className: _ })),
|
|
55
55
|
role: "slider",
|
|
56
|
-
"data-value":
|
|
57
|
-
"aria-valuenow":
|
|
56
|
+
"data-value": v,
|
|
57
|
+
"aria-valuenow": f,
|
|
58
58
|
"aria-valuemin": 0,
|
|
59
|
-
"aria-valuemax":
|
|
60
|
-
"aria-valuetext": `${
|
|
61
|
-
...
|
|
59
|
+
"aria-valuemax": i,
|
|
60
|
+
"aria-valuetext": `${f} out of ${i}`,
|
|
61
|
+
...d,
|
|
62
62
|
ref: t,
|
|
63
63
|
children: [
|
|
64
|
-
Array.from({ length:
|
|
64
|
+
Array.from({ length: i }).map((c, g) => /* @__PURE__ */ m(
|
|
65
65
|
R,
|
|
66
66
|
{
|
|
67
|
-
Icon:
|
|
68
|
-
index:
|
|
69
|
-
displayedValue:
|
|
67
|
+
Icon: y,
|
|
68
|
+
index: g,
|
|
69
|
+
displayedValue: f,
|
|
70
70
|
onHover: S,
|
|
71
71
|
onValueChange: M,
|
|
72
|
-
precision:
|
|
73
|
-
readOnly:
|
|
74
|
-
disabled:
|
|
72
|
+
precision: l,
|
|
73
|
+
readOnly: x,
|
|
74
|
+
disabled: b
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
g
|
|
77
77
|
)),
|
|
78
|
-
|
|
78
|
+
k
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
|
-
}), R = ({ Icon:
|
|
82
|
+
}), R = ({ Icon: s, index: t, displayedValue: l, onHover: r, onValueChange: n, precision: x, readOnly: o, disabled: e }) => x === "half" ? /* @__PURE__ */ p(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
className: a(
|
|
86
|
-
"relative hover:scale-125 transition-transform px-0.5",
|
|
87
|
-
|
|
88
|
-
e && "hover:scale-100 opacity-70"
|
|
86
|
+
"mtx-relative hover:mtx-scale-125 mtx-transition-transform mtx-px-0.5",
|
|
87
|
+
o && "hover:mtx-scale-100",
|
|
88
|
+
e && "hover:mtx-scale-100 mtx-opacity-70"
|
|
89
89
|
),
|
|
90
90
|
children: [
|
|
91
|
-
/* @__PURE__ */ s
|
|
92
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ m(s, { className: a("mtx-stroke-gray-500") }),
|
|
92
|
+
/* @__PURE__ */ m(
|
|
93
93
|
"button",
|
|
94
94
|
{
|
|
95
95
|
type: "button",
|
|
96
96
|
className: a(
|
|
97
|
-
"absolute top-0 w-[calc(50%+2px)] left-0 overflow-hidden h-full",
|
|
98
|
-
|
|
99
|
-
e && "cursor-default hover:scale-100 opacity-70"
|
|
97
|
+
"mtx-absolute mtx-top-0 mtx-w-[calc(50%+2px)] mtx-left-0 mtx-overflow-hidden mtx-h-full",
|
|
98
|
+
o && "mtx-cursor-default",
|
|
99
|
+
e && "mtx-cursor-default hover:mtx-scale-100 mtx-opacity-70"
|
|
100
100
|
),
|
|
101
|
-
onClick: () =>
|
|
101
|
+
onClick: () => n(t + 0.5),
|
|
102
102
|
onMouseEnter: () => r(t + 0.5),
|
|
103
103
|
onMouseLeave: () => r(null),
|
|
104
104
|
disabled: e,
|
|
105
105
|
"aria-label": `Set rating to ${t + 0.5}`,
|
|
106
|
-
children: /* @__PURE__ */
|
|
107
|
-
|
|
106
|
+
children: /* @__PURE__ */ m(
|
|
107
|
+
s,
|
|
108
108
|
{
|
|
109
109
|
className: a(
|
|
110
|
-
"stroke-none absolute left-0.5 top-0 [mask-image:linear-gradient(to_right,_black_50%,_transparent_50%)]",
|
|
111
|
-
|
|
110
|
+
"mtx-stroke-none mtx-absolute mtx-left-0.5 mtx-top-0 mtx-[mask-image:linear-gradient(to_right,_black_50%,_transparent_50%)]",
|
|
111
|
+
l >= t + 0.5 && "mtx-stroke-current mtx-fill-current"
|
|
112
112
|
)
|
|
113
113
|
}
|
|
114
114
|
)
|
|
115
115
|
}
|
|
116
116
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ m(
|
|
118
118
|
"button",
|
|
119
119
|
{
|
|
120
120
|
type: "button",
|
|
121
121
|
className: a(
|
|
122
|
-
"absolute top-0 w-[calc(50%+2px)] right-0 overflow-hidden h-full",
|
|
123
|
-
|
|
124
|
-
e && "cursor-default hover:scale-100 opacity-70"
|
|
122
|
+
"mtx-absolute mtx-top-0 mtx-w-[calc(50%+2px)] mtx-right-0 mtx-overflow-hidden mtx-h-full",
|
|
123
|
+
o && "mtx-cursor-default",
|
|
124
|
+
e && "mtx-cursor-default hover:mtx-scale-100 mtx-opacity-70"
|
|
125
125
|
),
|
|
126
|
-
onClick: () =>
|
|
126
|
+
onClick: () => n(t + 1),
|
|
127
127
|
onMouseEnter: () => r(t + 1),
|
|
128
128
|
onMouseLeave: () => r(null),
|
|
129
129
|
disabled: e,
|
|
130
130
|
"aria-label": `Set rating to ${t + 1}`,
|
|
131
|
-
children: /* @__PURE__ */
|
|
132
|
-
|
|
131
|
+
children: /* @__PURE__ */ m(
|
|
132
|
+
s,
|
|
133
133
|
{
|
|
134
134
|
className: a(
|
|
135
|
-
"stroke-none absolute right-0.5 top-0 [mask-image:linear-gradient(to_left,_black_50%,_transparent_50%)]",
|
|
136
|
-
|
|
135
|
+
"mtx-stroke-none mtx-absolute mtx-right-0.5 mtx-top-0 mtx-[mask-image:linear-gradient(to_left,_black_50%,_transparent_50%)]",
|
|
136
|
+
l >= t + 1 && "mtx-stroke-current mtx-fill-current"
|
|
137
137
|
)
|
|
138
138
|
}
|
|
139
139
|
)
|
|
@@ -141,21 +141,21 @@ const E = $({
|
|
|
141
141
|
)
|
|
142
142
|
]
|
|
143
143
|
}
|
|
144
|
-
) : /* @__PURE__ */
|
|
144
|
+
) : /* @__PURE__ */ m(
|
|
145
145
|
"button",
|
|
146
146
|
{
|
|
147
147
|
type: "button",
|
|
148
|
-
onClick: () =>
|
|
148
|
+
onClick: () => n(t + 1),
|
|
149
149
|
onMouseEnter: () => r(t + 1),
|
|
150
150
|
onMouseLeave: () => r(null),
|
|
151
151
|
className: a(
|
|
152
|
-
"hover:scale-125 px-0.5 transition-transform",
|
|
153
|
-
|
|
154
|
-
e && "cursor-default hover:scale-100 opacity-70"
|
|
152
|
+
"hover:mtx-scale-125 mtx-px-0.5 mtx-transition-transform",
|
|
153
|
+
o && "mtx-cursor-default hover:mtx-scale-100",
|
|
154
|
+
e && "mtx-cursor-default hover:mtx-scale-100 mtx-opacity-70"
|
|
155
155
|
),
|
|
156
156
|
disabled: e,
|
|
157
157
|
"aria-label": `Set rating to ${t + 1}`,
|
|
158
|
-
children: /* @__PURE__ */ s
|
|
158
|
+
children: /* @__PURE__ */ m(s, { className: a("mtx-stroke-gray-500", l >= t + 1 && "mtx-stroke-current mtx-fill-current") })
|
|
159
159
|
}
|
|
160
160
|
);
|
|
161
161
|
export {
|
package/dist/rating.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rating.es.js","sources":["../src/components/rating/Rating.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\nimport { Star } from \"@trsys-tech/matrix-icons\";\r\n\r\nconst ratingVariants = tv({\r\n base: \"flex items-center gap-0\",\r\n variants: {\r\n variant: {\r\n default: \"text-yellow-400\",\r\n primary: \"text-primary\",\r\n secondary: \"text-secondary\",\r\n success: \"text-success\",\r\n danger: \"text-danger\",\r\n warning: \"text-warning\",\r\n info: \"text-info\",\r\n },\r\n size: {\r\n sm: \"[&_*_svg]:h-5 [&_*_svg]:w-5\",\r\n md: \"[&_*_svg]:h-6 [&_*_svg]:w-6\",\r\n lg: \"[&_*_svg]:h-8 [&_*_svg]:w-8\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"default\",\r\n size: \"md\",\r\n },\r\n});\r\n\r\ninterface RatingProps extends React.HTMLAttributes<HTMLDivElement> {\r\n precision?: \"half\" | \"full\";\r\n variant?: VariantProps<typeof ratingVariants>[\"variant\"];\r\n size?: VariantProps<typeof ratingVariants>[\"size\"];\r\n readOnly?: boolean;\r\n value?: number;\r\n onValueChange?: (value: number) => void;\r\n children?: React.ReactNode;\r\n disabled?: boolean;\r\n max?: number;\r\n Icon?: React.JSXElementConstructor<React.SVGProps<SVGSVGElement>>;\r\n}\r\n\r\nconst Rating = React.forwardRef<HTMLDivElement, RatingProps>((props, ref) => {\r\n const {\r\n precision = \"full\",\r\n variant,\r\n size,\r\n readOnly = false,\r\n onValueChange,\r\n value: _value = 0,\r\n className,\r\n children,\r\n max = 5,\r\n Icon = Star,\r\n disabled,\r\n ...restProps\r\n } = props;\r\n\r\n const [value, setValue] = React.useState(_value);\r\n const [hoveredValue, setHoveredValue] = React.useState<number | null>(null);\r\n\r\n const displayedValue = hoveredValue ?? value;\r\n\r\n React.useEffect(() => {\r\n setValue(_value);\r\n }, [_value]);\r\n\r\n const handleValueChange = (newValue: number) => {\r\n if (readOnly) return;\r\n setValue(newValue);\r\n onValueChange?.(newValue);\r\n };\r\n\r\n const handleHover = (newValue: number | null) => {\r\n if (readOnly) return;\r\n setHoveredValue(newValue);\r\n };\r\n\r\n return (\r\n <div\r\n className={cn(ratingVariants({ variant, size, className }))}\r\n role=\"slider\"\r\n data-value={value}\r\n aria-valuenow={displayedValue}\r\n aria-valuemin={0}\r\n aria-valuemax={max}\r\n aria-valuetext={`${displayedValue} out of ${max}`}\r\n {...restProps}\r\n ref={ref}\r\n >\r\n {Array.from({ length: max }).map((_, index) => (\r\n <RatingItem\r\n Icon={Icon}\r\n index={index}\r\n key={index}\r\n displayedValue={displayedValue}\r\n onHover={handleHover}\r\n onValueChange={handleValueChange}\r\n precision={precision}\r\n readOnly={readOnly}\r\n disabled={disabled}\r\n />\r\n ))}\r\n {children}\r\n </div>\r\n );\r\n});\r\n\r\ntype RatingItemProps = {\r\n Icon: React.JSXElementConstructor<React.SVGProps<SVGSVGElement>>;\r\n index: number;\r\n onHover: (value: number | null) => void;\r\n onValueChange: (value: number) => void;\r\n displayedValue: number;\r\n precision: \"half\" | \"full\";\r\n readOnly: boolean;\r\n disabled?: boolean;\r\n};\r\n\r\nconst RatingItem = ({ Icon, index, displayedValue, onHover, onValueChange, precision, readOnly, disabled }: RatingItemProps) => {\r\n if (precision === \"half\") {\r\n return (\r\n <div\r\n className={cn(\r\n \"relative hover:scale-125 transition-transform px-0.5\",\r\n readOnly && \"hover:scale-100\",\r\n disabled && \"hover:scale-100 opacity-70\",\r\n )}\r\n >\r\n <Icon className={cn(\"stroke-gray-500\")} />\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n \"absolute top-0 w-[calc(50%+2px)] left-0 overflow-hidden h-full\",\r\n readOnly && \"cursor-default\",\r\n disabled && \"cursor-default hover:scale-100 opacity-70\",\r\n )}\r\n onClick={() => onValueChange(index + 0.5)}\r\n onMouseEnter={() => onHover(index + 0.5)}\r\n onMouseLeave={() => onHover(null)}\r\n disabled={disabled}\r\n aria-label={`Set rating to ${index + 0.5}`}\r\n >\r\n <Icon\r\n className={cn(\r\n \"stroke-none absolute left-0.5 top-0 [mask-image:linear-gradient(to_right,_black_50%,_transparent_50%)]\",\r\n displayedValue >= index + 0.5 && \"stroke-current fill-current\",\r\n )}\r\n />\r\n </button>\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n \"absolute top-0 w-[calc(50%+2px)] right-0 overflow-hidden h-full\",\r\n readOnly && \"cursor-default\",\r\n disabled && \"cursor-default hover:scale-100 opacity-70\",\r\n )}\r\n onClick={() => onValueChange(index + 1)}\r\n onMouseEnter={() => onHover(index + 1)}\r\n onMouseLeave={() => onHover(null)}\r\n disabled={disabled}\r\n aria-label={`Set rating to ${index + 1}`}\r\n >\r\n <Icon\r\n className={cn(\r\n \"stroke-none absolute right-0.5 top-0 [mask-image:linear-gradient(to_left,_black_50%,_transparent_50%)]\",\r\n displayedValue >= index + 1 && \"stroke-current fill-current\",\r\n )}\r\n />\r\n </button>\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <button\r\n type=\"button\"\r\n onClick={() => onValueChange(index + 1)}\r\n onMouseEnter={() => onHover(index + 1)}\r\n onMouseLeave={() => onHover(null)}\r\n className={cn(\r\n \"hover:scale-125 px-0.5 transition-transform\",\r\n readOnly && \"cursor-default hover:scale-100\",\r\n disabled && \"cursor-default hover:scale-100 opacity-70\",\r\n )}\r\n disabled={disabled}\r\n aria-label={`Set rating to ${index + 1}`}\r\n >\r\n <Icon className={cn(\"stroke-gray-500\", displayedValue >= index + 1 && \"stroke-current fill-current\")} />\r\n </button>\r\n );\r\n};\r\n\r\nexport { Rating, type RatingProps };\r\n"],"names":["ratingVariants","tv","Rating","React","props","ref","precision","variant","size","readOnly","onValueChange","_value","className","children","max","Icon","Star","disabled","restProps","value","setValue","hoveredValue","setHoveredValue","displayedValue","handleValueChange","newValue","handleHover","jsxs","cn","_","index","jsx","RatingItem","onHover"],"mappings":";;;;;AAQA,MAAMA,IAAiBC,EAAG;AAAA,EACxB,MAAM;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esContent":["\"use client\";\r\n\r\nimport React from \"react\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { tv, VariantProps } from \"tailwind-variants\";\r\nimport { Star } from \"@trsys-tech/matrix-icons\";\r\n\r\nconst ratingVariants = tv({\r\n base: \"mtx-flex mtx-items-center mtx-gap-0\",\r\n variants: {\r\n variant: {\r\n default: \"mtx-text-yellow-400\",\r\n primary: \"mtx-text-primary\",\r\n secondary: \"mtx-text-secondary\",\r\n success: \"mtx-text-success\",\r\n danger: \"mtx-text-danger\",\r\n warning: \"mtx-text-warning\",\r\n info: \"mtx-text-info\",\r\n },\r\n size: {\r\n sm: \"[&_*_svg]:mtx-h-5 [&_*_svg]:mtx-w-5\",\r\n md: \"[&_*_svg]:mtx-h-6 [&_*_svg]:mtx-w-6\",\r\n lg: \"[&_*_svg]:mtx-h-8 [&_*_svg]:mtx-w-8\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"default\",\r\n size: \"md\",\r\n },\r\n});\r\n\r\ninterface RatingProps extends React.HTMLAttributes<HTMLDivElement> {\r\n precision?: \"half\" | \"full\";\r\n variant?: VariantProps<typeof ratingVariants>[\"variant\"];\r\n size?: VariantProps<typeof ratingVariants>[\"size\"];\r\n readOnly?: boolean;\r\n value?: number;\r\n onValueChange?: (value: number) => void;\r\n children?: React.ReactNode;\r\n disabled?: boolean;\r\n max?: number;\r\n Icon?: React.JSXElementConstructor<React.SVGProps<SVGSVGElement>>;\r\n}\r\n\r\nconst Rating = React.forwardRef<HTMLDivElement, RatingProps>((props, ref) => {\r\n const {\r\n precision = \"full\",\r\n variant,\r\n size,\r\n readOnly = false,\r\n onValueChange,\r\n value: _value = 0,\r\n className,\r\n children,\r\n max = 5,\r\n Icon = Star,\r\n disabled,\r\n ...restProps\r\n } = props;\r\n\r\n const [value, setValue] = React.useState(_value);\r\n const [hoveredValue, setHoveredValue] = React.useState<number | null>(null);\r\n\r\n const displayedValue = hoveredValue ?? value;\r\n\r\n React.useEffect(() => {\r\n setValue(_value);\r\n }, [_value]);\r\n\r\n const handleValueChange = (newValue: number) => {\r\n if (readOnly) return;\r\n setValue(newValue);\r\n onValueChange?.(newValue);\r\n };\r\n\r\n const handleHover = (newValue: number | null) => {\r\n if (readOnly) return;\r\n setHoveredValue(newValue);\r\n };\r\n\r\n return (\r\n <div\r\n className={cn(ratingVariants({ variant, size, className }))}\r\n role=\"slider\"\r\n data-value={value}\r\n aria-valuenow={displayedValue}\r\n aria-valuemin={0}\r\n aria-valuemax={max}\r\n aria-valuetext={`${displayedValue} out of ${max}`}\r\n {...restProps}\r\n ref={ref}\r\n >\r\n {Array.from({ length: max }).map((_, index) => (\r\n <RatingItem\r\n Icon={Icon}\r\n index={index}\r\n key={index}\r\n displayedValue={displayedValue}\r\n onHover={handleHover}\r\n onValueChange={handleValueChange}\r\n precision={precision}\r\n readOnly={readOnly}\r\n disabled={disabled}\r\n />\r\n ))}\r\n {children}\r\n </div>\r\n );\r\n});\r\n\r\ntype RatingItemProps = {\r\n Icon: React.JSXElementConstructor<React.SVGProps<SVGSVGElement>>;\r\n index: number;\r\n onHover: (value: number | null) => void;\r\n onValueChange: (value: number) => void;\r\n displayedValue: number;\r\n precision: \"half\" | \"full\";\r\n readOnly: boolean;\r\n disabled?: boolean;\r\n};\r\n\r\nconst RatingItem = ({ Icon, index, displayedValue, onHover, onValueChange, precision, readOnly, disabled }: RatingItemProps) => {\r\n if (precision === \"half\") {\r\n return (\r\n <div\r\n className={cn(\r\n \"mtx-relative hover:mtx-scale-125 mtx-transition-transform mtx-px-0.5\",\r\n readOnly && \"hover:mtx-scale-100\",\r\n disabled && \"hover:mtx-scale-100 mtx-opacity-70\",\r\n )}\r\n >\r\n <Icon className={cn(\"mtx-stroke-gray-500\")} />\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n \"mtx-absolute mtx-top-0 mtx-w-[calc(50%+2px)] mtx-left-0 mtx-overflow-hidden mtx-h-full\",\r\n readOnly && \"mtx-cursor-default\",\r\n disabled && \"mtx-cursor-default hover:mtx-scale-100 mtx-opacity-70\",\r\n )}\r\n onClick={() => onValueChange(index + 0.5)}\r\n onMouseEnter={() => onHover(index + 0.5)}\r\n onMouseLeave={() => onHover(null)}\r\n disabled={disabled}\r\n aria-label={`Set rating to ${index + 0.5}`}\r\n >\r\n <Icon\r\n className={cn(\r\n \"mtx-stroke-none mtx-absolute mtx-left-0.5 mtx-top-0 mtx-[mask-image:linear-gradient(to_right,_black_50%,_transparent_50%)]\",\r\n displayedValue >= index + 0.5 && \"mtx-stroke-current mtx-fill-current\",\r\n )}\r\n />\r\n </button>\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n \"mtx-absolute mtx-top-0 mtx-w-[calc(50%+2px)] mtx-right-0 mtx-overflow-hidden mtx-h-full\",\r\n readOnly && \"mtx-cursor-default\",\r\n disabled && \"mtx-cursor-default hover:mtx-scale-100 mtx-opacity-70\",\r\n )}\r\n onClick={() => onValueChange(index + 1)}\r\n onMouseEnter={() => onHover(index + 1)}\r\n onMouseLeave={() => onHover(null)}\r\n disabled={disabled}\r\n aria-label={`Set rating to ${index + 1}`}\r\n >\r\n <Icon\r\n className={cn(\r\n \"mtx-stroke-none mtx-absolute mtx-right-0.5 mtx-top-0 mtx-[mask-image:linear-gradient(to_left,_black_50%,_transparent_50%)]\",\r\n displayedValue >= index + 1 && \"mtx-stroke-current mtx-fill-current\",\r\n )}\r\n />\r\n </button>\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <button\r\n type=\"button\"\r\n onClick={() => onValueChange(index + 1)}\r\n onMouseEnter={() => onHover(index + 1)}\r\n onMouseLeave={() => onHover(null)}\r\n className={cn(\r\n \"hover:mtx-scale-125 mtx-px-0.5 mtx-transition-transform\",\r\n readOnly && \"mtx-cursor-default hover:mtx-scale-100\",\r\n disabled && \"mtx-cursor-default hover:mtx-scale-100 mtx-opacity-70\",\r\n )}\r\n disabled={disabled}\r\n aria-label={`Set rating to ${index + 1}`}\r\n >\r\n <Icon className={cn(\"mtx-stroke-gray-500\", displayedValue >= index + 1 && \"mtx-stroke-current mtx-fill-current\")} />\r\n </button>\r\n );\r\n};\r\n\r\nexport { Rating, type RatingProps };\r\n"],"names":["ratingVariants","tv","Rating","React","props","ref","precision","variant","size","readOnly","onValueChange","_value","className","children","max","Icon","Star","disabled","restProps","value","setValue","hoveredValue","setHoveredValue","displayedValue","handleValueChange","newValue","handleHover","jsxs","cn","_","index","jsx","RatingItem","onHover"],"mappings":";;;;;AAQA,MAAMA,IAAiBC,EAAG;AAAA,EACxB,MAAM;AAAA,EACN,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,IAER,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IAAA;AAAA,EACN;AAAA,EAEF,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,MAAM;AAAA,EAAA;AAEV,CAAC,GAeKC,IAASC,EAAM,WAAwC,CAACC,GAAOC,MAAQ;AAC3E,QAAM;AAAA,IACJ,WAAAC,IAAY;AAAA,IACZ,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,eAAAC;AAAA,IACA,OAAOC,IAAS;AAAA,IAChB,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,MAAAC,IAAOC;AAAA,IACP,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDd,GAEE,CAACe,GAAOC,CAAQ,IAAIjB,EAAM,SAASQ,CAAM,GACzC,CAACU,GAAcC,CAAe,IAAInB,EAAM,SAAwB,IAAI,GAEpEoB,IAAiBF,KAAgBF;AAEvChB,EAAAA,EAAM,UAAU,MAAM;AACpB,IAAAiB,EAAST,CAAM;AAAA,EACjB,GAAG,CAACA,CAAM,CAAC;AA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IAAI;AAAA,IAChC,WAAWL;AAAA,MACT;AAAA,MACAnB,KAAY;AAAA,MACZQ,KAAY;AAAA,IAAA;AAAA,IAEd,UAAAA;AAAA,IACA,cAAY,iBAAiBa,IAAQ,CAAC;AAAA,IAEtC,UAAA,gBAAAC,EAAChB,KAAK,WAAWa,EAAG,uBAAuBL,KAAkBO,IAAQ,KAAK,qCAAqC,EAAA,CAAG;AAAA,EAAA;AAAA;"}
|
package/dist/select.es.js
CHANGED
|
@@ -1,104 +1,123 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { Check as g, ChevronDown as
|
|
4
|
-
import * as
|
|
5
|
-
import { cn as
|
|
6
|
-
const
|
|
7
|
-
}, value: void 0 }), N = ({ onValueChange:
|
|
8
|
-
const
|
|
9
|
-
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { Check as g, ChevronDown as i, ChevronUp as b, XMark as w } from "@trsys-tech/matrix-icons";
|
|
4
|
+
import * as t from "@radix-ui/react-select";
|
|
5
|
+
import { cn as x } from "./utils.es.js";
|
|
6
|
+
const c = o.createContext({ onClear: () => {
|
|
7
|
+
}, value: void 0 }), N = ({ onValueChange: m, value: r, ...a }) => {
|
|
8
|
+
const l = () => {
|
|
9
|
+
m?.("");
|
|
10
10
|
};
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ e(c.Provider, { value: { onClear: l, value: r }, children: /* @__PURE__ */ e(t.Root, { ...a, value: r, onValueChange: m }) });
|
|
12
12
|
};
|
|
13
|
-
N.displayName =
|
|
14
|
-
const P =
|
|
15
|
-
({ className:
|
|
16
|
-
const { onClear:
|
|
13
|
+
N.displayName = t.Root.displayName;
|
|
14
|
+
const P = t.Group, k = t.Value, v = o.forwardRef(
|
|
15
|
+
({ className: m, children: r, clearable: a, ...l }, d) => {
|
|
16
|
+
const { onClear: u, value: n } = o.useContext(c), h = (y) => {
|
|
17
17
|
y.stopPropagation();
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
|
|
19
|
+
return /* @__PURE__ */ s(
|
|
20
|
+
t.Trigger,
|
|
21
21
|
{
|
|
22
|
-
ref:
|
|
23
|
-
className:
|
|
24
|
-
"group flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent px-3 py-2 text-xs ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-none [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300",
|
|
25
|
-
|
|
22
|
+
ref: d,
|
|
23
|
+
className: x(
|
|
24
|
+
"mtx-group mtx-flex mtx-h-8 mtx-w-full mtx-items-center mtx-justify-between mtx-whitespace-nowrap mtx-rounded-sm mtx-border mtx-border-input mtx-bg-transparent mtx-px-3 mtx-py-2 mtx-text-xs mtx-ring-offset-background data-[placeholder]:mtx-text-muted-foreground hover:mtx-border hover:mtx-border-primary focus:mtx-border focus:mtx-border-primary focus:mtx-outline-none focus:mtx-ring focus:mtx-ring-primary-100 disabled:mtx-cursor-not-allowed disabled:mtx-bg-gray-100 disabled:mtx-text-text-300 disabled:mtx-border-none [&>span]:mtx-line-clamp-1 [&_svg]:disabled:mtx-text-text-300",
|
|
25
|
+
m
|
|
26
26
|
),
|
|
27
|
-
"data-value":
|
|
28
|
-
...
|
|
27
|
+
"data-value": n,
|
|
28
|
+
...l,
|
|
29
29
|
children: [
|
|
30
|
-
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
a &&
|
|
33
|
-
/* @__PURE__ */ t
|
|
30
|
+
r,
|
|
31
|
+
/* @__PURE__ */ s("div", { className: "mtx-flex mtx-items-center mtx-gap-2", children: [
|
|
32
|
+
a && n ? /* @__PURE__ */ e(t.Icon, { asChild: !0, onPointerDown: h, onClickCapture: u, children: /* @__PURE__ */ e(w, { className: "mtx-h-4.5 mtx-w-4.5" }) }) : null,
|
|
33
|
+
/* @__PURE__ */ e(t.Icon, { asChild: !0, children: /* @__PURE__ */ e(i, { className: "mtx-h-4.5 mtx-w-4.5 mtx-text-primary group-data-[state=open]:mtx-rotate-180 mtx-transition-transform" }) })
|
|
34
34
|
] })
|
|
35
35
|
]
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
|
-
v.displayName =
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const u = l.forwardRef(({ className: r, ...o }, a) => /* @__PURE__ */ t(e.ScrollDownButton, { ref: a, className: s("flex cursor-default items-center justify-center py-1", r), ...o, children: /* @__PURE__ */ t(m, {}) }));
|
|
44
|
-
u.displayName = e.ScrollDownButton.displayName;
|
|
45
|
-
const S = l.forwardRef(({ className: r, children: o, position: a = "popper", ...d }, i) => /* @__PURE__ */ t(e.Portal, { children: /* @__PURE__ */ n(
|
|
46
|
-
e.Content,
|
|
40
|
+
v.displayName = t.Trigger.displayName;
|
|
41
|
+
const p = o.forwardRef(({ className: m, ...r }, a) => /* @__PURE__ */ e(
|
|
42
|
+
t.ScrollUpButton,
|
|
47
43
|
{
|
|
48
|
-
ref:
|
|
49
|
-
className:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
ref: a,
|
|
45
|
+
className: x("mtx-flex mtx-cursor-default mtx-items-center mtx-justify-center mtx-py-1", m),
|
|
46
|
+
...r,
|
|
47
|
+
children: /* @__PURE__ */ e(b, {})
|
|
48
|
+
}
|
|
49
|
+
));
|
|
50
|
+
p.displayName = t.ScrollUpButton.displayName;
|
|
51
|
+
const f = o.forwardRef(({ className: m, ...r }, a) => /* @__PURE__ */ e(
|
|
52
|
+
t.ScrollDownButton,
|
|
53
|
+
{
|
|
54
|
+
ref: a,
|
|
55
|
+
className: x("mtx-flex mtx-cursor-default mtx-items-center mtx-justify-center mtx-py-1", m),
|
|
56
|
+
...r,
|
|
57
|
+
children: /* @__PURE__ */ e(i, {})
|
|
58
|
+
}
|
|
59
|
+
));
|
|
60
|
+
f.displayName = t.ScrollDownButton.displayName;
|
|
61
|
+
const S = o.forwardRef(({ className: m, children: r, position: a = "popper", ...l }, d) => /* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ s(
|
|
62
|
+
t.Content,
|
|
63
|
+
{
|
|
64
|
+
ref: d,
|
|
65
|
+
className: x(
|
|
66
|
+
"mtx-relative mtx-z-50 mtx-max-h-96 mtx-min-w-[8rem] mtx-overflow-hidden mtx-rounded-md mtx-border mtx-bg-popover mtx-text-popover-foreground mtx-shadow-md data-[state=open]:mtx-animate-in data-[state=closed]:mtx-animate-out data-[state=closed]:mtx-fade-out-0 data-[state=open]:mtx-fade-in-0 data-[state=closed]:mtx-zoom-out-95 data-[state=open]:mtx-zoom-in-95 data-[side=bottom]:mtx-slide-in-from-top-2 data-[side=left]:mtx-slide-in-from-right-2 data-[side=right]:mtx-slide-in-from-left-2 data-[side=top]:mtx-slide-in-from-bottom-2",
|
|
67
|
+
a === "popper" && "data-[side=bottom]:mtx-translate-y-1 data-[side=left]:-mtx-translate-x-1 data-[side=right]:mtx-translate-x-1 data-[side=top]:-mtx-translate-y-1 mtx-max-h-[--radix-select-content-available-height]",
|
|
68
|
+
m
|
|
53
69
|
),
|
|
54
70
|
position: a,
|
|
55
|
-
...
|
|
71
|
+
...l,
|
|
56
72
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
73
|
+
/* @__PURE__ */ e(p, {}),
|
|
74
|
+
/* @__PURE__ */ e(
|
|
75
|
+
t.Viewport,
|
|
60
76
|
{
|
|
61
|
-
className:
|
|
62
|
-
|
|
77
|
+
className: x(
|
|
78
|
+
"mtx-p-1",
|
|
79
|
+
a === "popper" && "mtx-h-[var(--radix-select-trigger-height)] mtx-w-full mtx-min-w-[var(--radix-select-trigger-width)]"
|
|
80
|
+
),
|
|
81
|
+
children: r
|
|
63
82
|
}
|
|
64
83
|
),
|
|
65
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ e(f, {})
|
|
66
85
|
]
|
|
67
86
|
}
|
|
68
87
|
) }));
|
|
69
|
-
S.displayName =
|
|
70
|
-
const C =
|
|
71
|
-
({ className:
|
|
88
|
+
S.displayName = t.Content.displayName;
|
|
89
|
+
const C = o.forwardRef(
|
|
90
|
+
({ className: m, ...r }, a) => /* @__PURE__ */ e(t.Label, { ref: a, className: x("mtx-px-2 mtx-py-1.5 mtx-text-xs mtx-font-semibold", m), ...r })
|
|
72
91
|
);
|
|
73
|
-
C.displayName =
|
|
74
|
-
const R =
|
|
75
|
-
({ className:
|
|
76
|
-
|
|
92
|
+
C.displayName = t.Label.displayName;
|
|
93
|
+
const R = o.forwardRef(
|
|
94
|
+
({ className: m, children: r, ...a }, l) => /* @__PURE__ */ s(
|
|
95
|
+
t.Item,
|
|
77
96
|
{
|
|
78
|
-
ref:
|
|
79
|
-
className:
|
|
80
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-xs outline-none focus:bg-gray-200 data-[active=true]:bg-gray-300 data-[active=true]:font-bold data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
81
|
-
|
|
97
|
+
ref: l,
|
|
98
|
+
className: x(
|
|
99
|
+
"mtx-relative mtx-flex mtx-w-full mtx-cursor-default mtx-select-none mtx-items-center mtx-rounded-sm mtx-py-1.5 mtx-pl-2 mtx-pr-8 mtx-text-xs mtx-outline-none focus:mtx-bg-gray-200 data-[active=true]:mtx-bg-gray-300 data-[active=true]:mtx-font-bold data-[disabled]:mtx-pointer-events-none data-[disabled]:mtx-opacity-50",
|
|
100
|
+
m
|
|
82
101
|
),
|
|
83
102
|
...a,
|
|
84
103
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */ t
|
|
104
|
+
/* @__PURE__ */ e("span", { className: "mtx-absolute mtx-right-2 mtx-flex mtx-h-3.5 mtx-w-3.5 mtx-items-center mtx-justify-center", children: /* @__PURE__ */ e(t.ItemIndicator, { children: /* @__PURE__ */ e(g, { className: "mtx-h-4 mtx-w-4" }) }) }),
|
|
105
|
+
/* @__PURE__ */ e(t.ItemText, { children: r })
|
|
87
106
|
]
|
|
88
107
|
}
|
|
89
108
|
)
|
|
90
109
|
);
|
|
91
|
-
R.displayName =
|
|
92
|
-
const I =
|
|
93
|
-
I.displayName =
|
|
110
|
+
R.displayName = t.Item.displayName;
|
|
111
|
+
const I = o.forwardRef(({ className: m, ...r }, a) => /* @__PURE__ */ e(t.Separator, { ref: a, className: x("-mtx-mx-1 mtx-my-1 mtx-h-px mtx-bg-muted", m), ...r }));
|
|
112
|
+
I.displayName = t.Separator.displayName;
|
|
94
113
|
export {
|
|
95
114
|
N as Select,
|
|
96
115
|
S as SelectContent,
|
|
97
116
|
P as SelectGroup,
|
|
98
117
|
R as SelectItem,
|
|
99
118
|
C as SelectLabel,
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
f as SelectScrollDownButton,
|
|
120
|
+
p as SelectScrollUpButton,
|
|
102
121
|
I as SelectSeparator,
|
|
103
122
|
v as SelectTrigger,
|
|
104
123
|
k as SelectValue
|