@scaleflex/ui-tw 0.0.29 → 0.0.31

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 (48) hide show
  1. package/button/button.component.js +4 -3
  2. package/button/button.constants.d.ts +1 -0
  3. package/button/button.constants.js +1 -0
  4. package/combobox/combobox-multi-inline/combobox-multi-inline.component.d.ts +3 -0
  5. package/combobox/combobox-multi-inline/combobox-multi-inline.component.js +68 -0
  6. package/combobox/combobox-multi-tag/combobox-multi-tag.component.d.ts +3 -0
  7. package/combobox/combobox-multi-tag/combobox-multi-tag.component.js +117 -0
  8. package/combobox/combobox-single/combobox-single.component.d.ts +3 -0
  9. package/combobox/combobox-single/combobox-single.component.js +61 -0
  10. package/combobox/combobox.component.d.ts +4 -0
  11. package/combobox/combobox.component.js +137 -0
  12. package/combobox/combobox.constants.d.ts +15 -0
  13. package/combobox/combobox.constants.js +5 -0
  14. package/combobox/combobox.types.d.ts +65 -0
  15. package/combobox/combobox.types.js +1 -0
  16. package/combobox/combobox.utils.d.ts +7 -0
  17. package/combobox/combobox.utils.js +28 -0
  18. package/combobox/index.d.ts +5 -0
  19. package/combobox/index.js +5 -0
  20. package/command/command.component.d.ts +18 -0
  21. package/command/command.component.js +150 -0
  22. package/command/command.utils.d.ts +5 -0
  23. package/command/command.utils.js +3 -0
  24. package/command/index.d.ts +1 -0
  25. package/command/index.js +1 -0
  26. package/dialog/dialog.component.d.ts +22 -0
  27. package/dialog/dialog.component.js +192 -0
  28. package/dialog/index.d.ts +1 -0
  29. package/dialog/index.js +1 -0
  30. package/form/components/form-select-field.component.d.ts +1 -1
  31. package/form/components/form-select-field.component.js +23 -52
  32. package/form/form.types.d.ts +2 -0
  33. package/package.json +4 -2
  34. package/pill/pill.types.d.ts +2 -2
  35. package/popover/index.d.ts +1 -0
  36. package/popover/index.js +1 -0
  37. package/popover/popover.component.d.ts +7 -0
  38. package/popover/popover.component.js +40 -0
  39. package/select/components/select-icon.js +4 -2
  40. package/select/components/selector.d.ts +3 -0
  41. package/select/components/selector.js +66 -0
  42. package/select/index.d.ts +1 -0
  43. package/select/index.js +2 -1
  44. package/select/select.component.d.ts +3 -0
  45. package/select/select.component.js +9 -8
  46. package/select/select.constants.d.ts +5 -3
  47. package/select/select.constants.js +5 -1
  48. package/select/select.types.d.ts +15 -0
@@ -0,0 +1,150 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["className"],
4
+ _excluded2 = ["title", "description", "children"],
5
+ _excluded3 = ["className", "size"],
6
+ _excluded4 = ["className"],
7
+ _excluded5 = ["className"],
8
+ _excluded6 = ["className", "size"],
9
+ _excluded7 = ["className"],
10
+ _excluded8 = ["className", "size", "isGroup", "icon", "tooltip", "children", "selectedValue", "multiple", "value", "shortcut"],
11
+ _excluded9 = ["className"];
12
+ import { Dialog, DialogFormDescription, DialogFormHeader, DialogFormTitle, DialogWideContent } from '@scaleflex/ui-tw/dialog';
13
+ import { LabelIcon } from '@scaleflex/ui-tw/label/components/label-icon';
14
+ import { SelectIcon } from '@scaleflex/ui-tw/select/components/select-icon';
15
+ import { selectTriggerVariants } from '@scaleflex/ui-tw/select/select.component';
16
+ import { getOptionInGroupPaddingLeft } from '@scaleflex/ui-tw/select/select.utils';
17
+ import { switchThumbSizeOptions } from '@scaleflex/ui-tw/switch/switch.constants';
18
+ import { FormSize } from '@scaleflex/ui-tw/types/form-size';
19
+ import { cn } from '@scaleflex/ui-tw/utils/cn';
20
+ import { cva } from 'class-variance-authority';
21
+ import { Command as CommandPrimitive } from 'cmdk';
22
+ import { CheckIcon, SearchIcon } from 'lucide-react';
23
+ import React from 'react';
24
+ import { selectCommandHeadingOptions } from './command.utils';
25
+ function Command(_ref) {
26
+ var className = _ref.className,
27
+ props = _objectWithoutProperties(_ref, _excluded);
28
+ return /*#__PURE__*/React.createElement(CommandPrimitive, _extends({
29
+ "data-slot": "command",
30
+ className: cn('text-popover-foreground flex h-full w-full flex-col overflow-hidden', className)
31
+ }, props));
32
+ }
33
+ function CommandDialog(_ref2) {
34
+ var _ref2$title = _ref2.title,
35
+ title = _ref2$title === void 0 ? 'Command Palette' : _ref2$title,
36
+ _ref2$description = _ref2.description,
37
+ description = _ref2$description === void 0 ? 'Search for a command to run...' : _ref2$description,
38
+ children = _ref2.children,
39
+ props = _objectWithoutProperties(_ref2, _excluded2);
40
+ return /*#__PURE__*/React.createElement(Dialog, props, /*#__PURE__*/React.createElement(DialogFormHeader, {
41
+ className: "sr-only"
42
+ }, /*#__PURE__*/React.createElement(DialogFormTitle, null, title), /*#__PURE__*/React.createElement(DialogFormDescription, null, description)), /*#__PURE__*/React.createElement(DialogWideContent, {
43
+ className: "overflow-hidden p-0"
44
+ }, /*#__PURE__*/React.createElement(Command, {
45
+ className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"
46
+ }, children)));
47
+ }
48
+ function CommandInput(_ref3) {
49
+ var className = _ref3.className,
50
+ _ref3$size = _ref3.size,
51
+ size = _ref3$size === void 0 ? FormSize.Md : _ref3$size,
52
+ props = _objectWithoutProperties(_ref3, _excluded3);
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ "data-slot": "command-input-wrapper",
55
+ className: cn('border-border flex h-10 items-center gap-2 border-b px-4', selectTriggerVariants({
56
+ size: size
57
+ }))
58
+ }, /*#__PURE__*/React.createElement(SearchIcon, {
59
+ className: cn('shrink-0 opacity-50', switchThumbSizeOptions[size])
60
+ }), /*#__PURE__*/React.createElement(CommandPrimitive.Input, _extends({
61
+ "data-slot": "command-input",
62
+ className: cn('placeholder:text-muted-foreground flex w-full rounded-md bg-transparent py-3 outline-hidden disabled:cursor-not-allowed disabled:opacity-50', className)
63
+ }, props)));
64
+ }
65
+ function CommandList(_ref4) {
66
+ var className = _ref4.className,
67
+ props = _objectWithoutProperties(_ref4, _excluded4);
68
+ return /*#__PURE__*/React.createElement(CommandPrimitive.List, _extends({
69
+ "data-slot": "command-list",
70
+ className: cn('max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto', className)
71
+ }, props));
72
+ }
73
+ function CommandEmpty(_ref5) {
74
+ var className = _ref5.className,
75
+ rest = _objectWithoutProperties(_ref5, _excluded5);
76
+ return /*#__PURE__*/React.createElement(CommandPrimitive.Empty, _extends({
77
+ "data-slot": "command-empty",
78
+ className: cn('text-muted-foreground py-6 text-center text-sm', className)
79
+ }, rest));
80
+ }
81
+ var selectCommandHeadingVariants = cva('', {
82
+ variants: {
83
+ size: selectCommandHeadingOptions
84
+ },
85
+ defaultVariants: {
86
+ size: FormSize.Md
87
+ }
88
+ });
89
+ function CommandGroup(_ref6) {
90
+ var className = _ref6.className,
91
+ size = _ref6.size,
92
+ props = _objectWithoutProperties(_ref6, _excluded6);
93
+ return /*#__PURE__*/React.createElement(CommandPrimitive.Group, _extends({
94
+ "data-slot": "command-group",
95
+ className: cn('[&_[cmdk-group-heading]]:text-secondary-foreground [&_[cmdk-group-heading]]:pointer-events-none', 'text-foreground overflow-hidden', selectCommandHeadingVariants({
96
+ size: size
97
+ }), className)
98
+ }, props));
99
+ }
100
+ function CommandSeparator(_ref7) {
101
+ var className = _ref7.className,
102
+ props = _objectWithoutProperties(_ref7, _excluded7);
103
+ return /*#__PURE__*/React.createElement(CommandPrimitive.Separator, _extends({
104
+ "data-slot": "command-separator",
105
+ className: cn('bg-border -mx-1 h-px', className)
106
+ }, props));
107
+ }
108
+ function CommandItem(_ref8) {
109
+ var className = _ref8.className,
110
+ size = _ref8.size,
111
+ isGroup = _ref8.isGroup,
112
+ icon = _ref8.icon,
113
+ tooltip = _ref8.tooltip,
114
+ children = _ref8.children,
115
+ selectedValue = _ref8.selectedValue,
116
+ multiple = _ref8.multiple,
117
+ value = _ref8.value,
118
+ shortcut = _ref8.shortcut,
119
+ props = _objectWithoutProperties(_ref8, _excluded8);
120
+ var selected = value && (multiple ? selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.includes(value) : value === selectedValue);
121
+ return /*#__PURE__*/React.createElement(CommandPrimitive.Item, _extends({
122
+ "data-slot": "command-item",
123
+ className: cn('relative flex w-full cursor-pointer items-center justify-between gap-2 outline-hidden select-none', '*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2', 'data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground', 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50', "[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", selectTriggerVariants({
124
+ size: size,
125
+ className: className
126
+ }), isGroup && getOptionInGroupPaddingLeft(size), selected && 'text-primary', className)
127
+ }, props), /*#__PURE__*/React.createElement("div", {
128
+ className: "flex items-center"
129
+ }, icon && /*#__PURE__*/React.createElement(SelectIcon, {
130
+ size: size,
131
+ icon: icon,
132
+ className: cn('text-muted-foreground hover:text-primary', selected && 'text-primary')
133
+ }), /*#__PURE__*/React.createElement("span", null, children), tooltip && /*#__PURE__*/React.createElement(LabelIcon, {
134
+ size: size,
135
+ tooltip: tooltip
136
+ })), shortcut && /*#__PURE__*/React.createElement(CommandShortcut, null, shortcut), /*#__PURE__*/React.createElement("span", {
137
+ className: "absolute right-2 flex size-3.5 items-center justify-center"
138
+ }, /*#__PURE__*/React.createElement(CheckIcon, {
139
+ className: cn('text-primary ml-auto h-4 w-4', selected ? 'opacity-100' : 'opacity-0')
140
+ })));
141
+ }
142
+ function CommandShortcut(_ref9) {
143
+ var className = _ref9.className,
144
+ props = _objectWithoutProperties(_ref9, _excluded9);
145
+ return /*#__PURE__*/React.createElement("span", _extends({
146
+ "data-slot": "command-shortcut",
147
+ className: cn('text-muted-foreground ml-auto text-xs tracking-widest', className)
148
+ }, props));
149
+ }
150
+ export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator };
@@ -0,0 +1,5 @@
1
+ export declare const selectCommandHeadingOptions: {
2
+ readonly sm: "[&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:h-8 [&_[cmdk-group-heading]]:text-xs";
3
+ readonly md: "[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:h-10 [&_[cmdk-group-heading]]:text-sm ";
4
+ readonly lg: "[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:h-12 [&_[cmdk-group-heading]]:text-base ";
5
+ };
@@ -0,0 +1,3 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { FormSize } from '@scaleflex/ui-tw/types/form-size';
3
+ export var selectCommandHeadingOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, '[&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:h-8 [&_[cmdk-group-heading]]:text-xs'), FormSize.Md, '[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:h-10 [&_[cmdk-group-heading]]:text-sm '), FormSize.Lg, '[&_[cmdk-group-heading]]:py-3 [&_[cmdk-group-heading]]:px-4 [&_[cmdk-group-heading]]:h-12 [&_[cmdk-group-heading]]:text-base ');
@@ -0,0 +1 @@
1
+ export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, } from './command.component';
@@ -0,0 +1 @@
1
+ export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './command.component';
@@ -0,0 +1,22 @@
1
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
2
+ import React, { ComponentProps } from 'react';
3
+ declare function Dialog({ ...props }: ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
4
+ declare function DialogTrigger({ ...props }: ComponentProps<typeof DialogPrimitive.Trigger>): React.JSX.Element;
5
+ declare function DialogPortal({ ...props }: ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element;
6
+ declare function DialogClose({ ...props }: ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
7
+ declare function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
8
+ declare function DialogWideContent({ className, children, ...props }: ComponentProps<typeof DialogPrimitive.Content>): React.JSX.Element;
9
+ declare function DialogFormContent({ className, children, ...props }: ComponentProps<typeof DialogPrimitive.Content>): React.JSX.Element;
10
+ declare function DialogWideHeader({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
11
+ declare function DialogFormHeader({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
12
+ declare function DialogWideBody({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
13
+ declare function DialogFormBody({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
14
+ declare function DialogWideTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
15
+ declare function DialogFormTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
16
+ declare function DialogFormDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
17
+ declare function DialogFormIcon({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
18
+ declare function DialogFormWarningIcon({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
19
+ declare function DialogFormErrorIcon({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
20
+ declare function DialogWideFooter({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
21
+ declare function DialogFormFooter({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
22
+ export { Dialog, DialogClose, DialogWideFooter, DialogOverlay, DialogPortal, DialogTrigger, DialogWideTitle, DialogWideHeader, DialogWideContent, DialogWideBody, DialogFormContent, DialogFormDescription, DialogFormIcon, DialogFormWarningIcon, DialogFormErrorIcon, DialogFormHeader, DialogFormTitle, DialogFormBody, DialogFormFooter, };
@@ -0,0 +1,192 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ var _excluded = ["className"],
5
+ _excluded2 = ["className", "children"],
6
+ _excluded3 = ["className", "children"],
7
+ _excluded4 = ["className"],
8
+ _excluded5 = ["className"],
9
+ _excluded6 = ["className"],
10
+ _excluded7 = ["className"],
11
+ _excluded8 = ["className"],
12
+ _excluded9 = ["className"],
13
+ _excluded10 = ["className"],
14
+ _excluded11 = ["className"],
15
+ _excluded12 = ["className"],
16
+ _excluded13 = ["className"],
17
+ _excluded14 = ["className"],
18
+ _excluded15 = ["className"];
19
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
20
+ import { Button } from '@scaleflex/ui-tw/button';
21
+ import { focusRingClassNames } from '@scaleflex/ui-tw/styles/shared-classes';
22
+ import { cn } from '@scaleflex/ui-tw/utils/cn';
23
+ import { CircleAlertIcon, XIcon } from 'lucide-react';
24
+ import React from 'react';
25
+ function Dialog(_ref) {
26
+ var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
27
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Root, _extends({
28
+ "data-slot": "dialog"
29
+ }, props));
30
+ }
31
+ function DialogTrigger(_ref2) {
32
+ var props = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
33
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Trigger, _extends({
34
+ "data-slot": "dialog-trigger"
35
+ }, props));
36
+ }
37
+ function DialogPortal(_ref3) {
38
+ var props = _extends({}, (_objectDestructuringEmpty(_ref3), _ref3));
39
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Portal, _extends({
40
+ "data-slot": "dialog-portal"
41
+ }, props));
42
+ }
43
+ function DialogClose(_ref4) {
44
+ var props = _extends({}, (_objectDestructuringEmpty(_ref4), _ref4));
45
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Close, _extends({
46
+ "data-slot": "dialog-close"
47
+ }, props));
48
+ }
49
+ function DialogOverlay(_ref5) {
50
+ var className = _ref5.className,
51
+ props = _objectWithoutProperties(_ref5, _excluded);
52
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Overlay, _extends({
53
+ "data-slot": "dialog-overlay",
54
+ className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className)
55
+ }, props));
56
+ }
57
+ function DialogWideContent(_ref6) {
58
+ var className = _ref6.className,
59
+ children = _ref6.children,
60
+ props = _objectWithoutProperties(_ref6, _excluded2);
61
+ return /*#__PURE__*/React.createElement(DialogPortal, {
62
+ "data-slot": "dialog-portal"
63
+ }, /*#__PURE__*/React.createElement(DialogOverlay, null), /*#__PURE__*/React.createElement(DialogPrimitive.Content, _extends({
64
+ "data-slot": "dialog-content",
65
+ className: cn('bg-background border-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border shadow-lg duration-200 lg:max-w-[62rem] xl:max-w-5xl', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95', className)
66
+ }, props), children, /*#__PURE__*/React.createElement(DialogPrimitive.Close, {
67
+ "data-state": "open",
68
+ className: cn('text-muted-foreground absolute top-3 right-3 cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 disabled:pointer-events-none', "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-6", focusRingClassNames)
69
+ }, /*#__PURE__*/React.createElement(Button, {
70
+ variant: "ghost-secondary",
71
+ size: "icon-md"
72
+ }, /*#__PURE__*/React.createElement(XIcon, null)), /*#__PURE__*/React.createElement("span", {
73
+ className: "sr-only"
74
+ }, "Close"))));
75
+ }
76
+ function DialogFormContent(_ref7) {
77
+ var className = _ref7.className,
78
+ children = _ref7.children,
79
+ props = _objectWithoutProperties(_ref7, _excluded3);
80
+ return /*#__PURE__*/React.createElement(DialogPortal, {
81
+ "data-slot": "dialog-portal"
82
+ }, /*#__PURE__*/React.createElement(DialogOverlay, null), /*#__PURE__*/React.createElement(DialogPrimitive.Content, _extends({
83
+ "data-slot": "dialog-content",
84
+ className: cn('bg-background border-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-md translate-x-[-50%] translate-y-[-50%] rounded-lg border shadow-lg duration-200', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95', className)
85
+ }, props), children, /*#__PURE__*/React.createElement(DialogPrimitive.Close, {
86
+ "data-state": "open",
87
+ className: cn('text-muted-foreground absolute top-3 right-3 cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 disabled:pointer-events-none', "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-6", focusRingClassNames)
88
+ }, /*#__PURE__*/React.createElement(Button, {
89
+ variant: "ghost-secondary",
90
+ size: "icon-md"
91
+ }, /*#__PURE__*/React.createElement(XIcon, null)), /*#__PURE__*/React.createElement("span", {
92
+ className: "sr-only"
93
+ }, "Close"))));
94
+ }
95
+ function DialogWideHeader(_ref8) {
96
+ var className = _ref8.className,
97
+ props = _objectWithoutProperties(_ref8, _excluded4);
98
+ return /*#__PURE__*/React.createElement("div", _extends({
99
+ "data-slot": "dialog-header",
100
+ className: cn('border-border flex h-16 items-center justify-center border-b', className)
101
+ }, props));
102
+ }
103
+ function DialogFormHeader(_ref9) {
104
+ var className = _ref9.className,
105
+ props = _objectWithoutProperties(_ref9, _excluded5);
106
+ return /*#__PURE__*/React.createElement("div", _extends({
107
+ "data-slot": "dialog-header",
108
+ className: cn('flex flex-col items-center justify-center p-6 pt-8 text-center', className)
109
+ }, props));
110
+ }
111
+ function DialogWideBody(_ref10) {
112
+ var className = _ref10.className,
113
+ props = _objectWithoutProperties(_ref10, _excluded6);
114
+ return /*#__PURE__*/React.createElement("div", _extends({
115
+ "data-slot": "dialog-body",
116
+ className: cn('p-6', className)
117
+ }, props));
118
+ }
119
+ function DialogFormBody(_ref11) {
120
+ var className = _ref11.className,
121
+ props = _objectWithoutProperties(_ref11, _excluded7);
122
+ return /*#__PURE__*/React.createElement("div", _extends({
123
+ "data-slot": "dialog-body",
124
+ className: cn('px-6', className)
125
+ }, props));
126
+ }
127
+ function DialogWideTitle(_ref12) {
128
+ var className = _ref12.className,
129
+ props = _objectWithoutProperties(_ref12, _excluded8);
130
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Title, _extends({
131
+ "data-slot": "dialog-title",
132
+ className: cn('text-lg leading-7', className)
133
+ }, props));
134
+ }
135
+ function DialogFormTitle(_ref13) {
136
+ var className = _ref13.className,
137
+ props = _objectWithoutProperties(_ref13, _excluded9);
138
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Title, _extends({
139
+ "data-slot": "dialog-title",
140
+ className: cn('text-lg leading-7 font-medium', className)
141
+ }, props));
142
+ }
143
+ function DialogFormDescription(_ref14) {
144
+ var className = _ref14.className,
145
+ props = _objectWithoutProperties(_ref14, _excluded10);
146
+ return /*#__PURE__*/React.createElement(DialogPrimitive.Description, _extends({
147
+ "data-slot": "dialog-description",
148
+ className: cn('text-muted-foreground text-sm', className)
149
+ }, props));
150
+ }
151
+ function DialogFormIcon(_ref15) {
152
+ var className = _ref15.className,
153
+ props = _objectWithoutProperties(_ref15, _excluded11);
154
+ return /*#__PURE__*/React.createElement("div", _extends({
155
+ className: cn('bg-accent mb-2 flex h-16 w-16 items-center justify-center rounded-full', "[&_svg:not([class*='text-'])]:text-primary [&_svg:not([class*='size-'])]:size-10", className)
156
+ }, props));
157
+ }
158
+ function DialogFormWarningIcon(_ref16) {
159
+ var className = _ref16.className,
160
+ props = _objectWithoutProperties(_ref16, _excluded12);
161
+ return /*#__PURE__*/React.createElement(DialogFormIcon, _extends({
162
+ className: cn(className, 'bg-warning-10')
163
+ }, props), /*#__PURE__*/React.createElement(CircleAlertIcon, {
164
+ className: "text-warning"
165
+ }));
166
+ }
167
+ function DialogFormErrorIcon(_ref17) {
168
+ var className = _ref17.className,
169
+ props = _objectWithoutProperties(_ref17, _excluded13);
170
+ return /*#__PURE__*/React.createElement(DialogFormIcon, _extends({
171
+ className: cn(className, 'bg-destructive-10')
172
+ }, props), /*#__PURE__*/React.createElement(CircleAlertIcon, {
173
+ className: "text-destructive"
174
+ }));
175
+ }
176
+ function DialogWideFooter(_ref18) {
177
+ var className = _ref18.className,
178
+ props = _objectWithoutProperties(_ref18, _excluded14);
179
+ return /*#__PURE__*/React.createElement("div", _extends({
180
+ "data-slot": "dialog-footer",
181
+ className: cn('border-border flex flex-col-reverse gap-3 border-t p-6 sm:flex-row sm:justify-end', className)
182
+ }, props));
183
+ }
184
+ function DialogFormFooter(_ref19) {
185
+ var className = _ref19.className,
186
+ props = _objectWithoutProperties(_ref19, _excluded15);
187
+ return /*#__PURE__*/React.createElement("div", _extends({
188
+ "data-slot": "dialog-footer",
189
+ className: cn('flex justify-end gap-3 p-6', className)
190
+ }, props));
191
+ }
192
+ export { Dialog, DialogClose, DialogWideFooter, DialogOverlay, DialogPortal, DialogTrigger, DialogWideTitle, DialogWideHeader, DialogWideContent, DialogWideBody, DialogFormContent, DialogFormDescription, DialogFormIcon, DialogFormWarningIcon, DialogFormErrorIcon, DialogFormHeader, DialogFormTitle, DialogFormBody, DialogFormFooter };
@@ -0,0 +1 @@
1
+ export { Dialog, DialogClose, DialogWideFooter, DialogOverlay, DialogPortal, DialogTrigger, DialogWideTitle, DialogWideHeader, DialogWideContent, DialogWideBody, DialogFormContent, DialogFormDescription, DialogFormIcon, DialogFormWarningIcon, DialogFormErrorIcon, DialogFormHeader, DialogFormTitle, DialogFormBody, DialogFormFooter, } from './dialog.component';
@@ -0,0 +1 @@
1
+ export { Dialog, DialogClose, DialogWideFooter, DialogOverlay, DialogPortal, DialogTrigger, DialogWideTitle, DialogWideHeader, DialogWideContent, DialogWideBody, DialogFormContent, DialogFormDescription, DialogFormIcon, DialogFormWarningIcon, DialogFormErrorIcon, DialogFormHeader, DialogFormTitle, DialogFormBody, DialogFormFooter } from './dialog.component';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { FieldValues, Path } from 'react-hook-form';
3
3
  import { FormSelectFieldProps } from '../form.types';
4
- declare function FormSelectField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>({ selectProps, ...rest }: FormSelectFieldProps<TFieldValues, TName>): React.JSX.Element;
4
+ declare function FormSelectField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>({ selectProps, showGroupSeparator, ...rest }: FormSelectFieldProps<TFieldValues, TName>): React.JSX.Element;
5
5
  export { FormSelectField };
@@ -1,10 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["icon", "placeholder", "options"],
4
- _excluded2 = ["selectProps"];
5
- import { isOptionGroup, useFormField } from '@scaleflex/ui-tw/form';
4
+ _excluded2 = ["selectProps", "showGroupSeparator"];
5
+ import { useFormField } from '@scaleflex/ui-tw/form';
6
6
  import { FormFieldGroup } from '@scaleflex/ui-tw/form';
7
- import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from '@scaleflex/ui-tw/select';
7
+ import { Selector } from '@scaleflex/ui-tw/select';
8
8
  import React from 'react';
9
9
  function FormSelectInner(_ref) {
10
10
  var field = _ref.field,
@@ -12,7 +12,8 @@ function FormSelectInner(_ref) {
12
12
  selectProps = _ref.selectProps,
13
13
  readOnly = _ref.readOnly,
14
14
  disabled = _ref.disabled,
15
- className = _ref.className;
15
+ className = _ref.className,
16
+ showGroupSeparator = _ref.showGroupSeparator;
16
17
  var _useFormField = useFormField(),
17
18
  error = _useFormField.error,
18
19
  formItemId = _useFormField.formItemId;
@@ -21,56 +22,25 @@ function FormSelectInner(_ref) {
21
22
  placeholder = _ref2.placeholder,
22
23
  options = _ref2.options,
23
24
  restSelectProps = _objectWithoutProperties(_ref2, _excluded);
24
- return /*#__PURE__*/React.createElement(Select, _extends({
25
- onValueChange: readOnly ? undefined : field.onChange,
26
- defaultValue: field.value,
27
- disabled: disabled || readOnly
28
- }, restSelectProps), /*#__PURE__*/React.createElement(SelectTrigger, {
29
- id: formItemId,
30
- "aria-invalid": !!error,
31
- size: args === null || args === void 0 ? void 0 : args.size,
25
+ return /*#__PURE__*/React.createElement(Selector, _extends({
26
+ value: field.value,
27
+ onChange: field.onChange,
28
+ placeholder: placeholder,
29
+ disabled: disabled,
32
30
  readOnly: readOnly,
31
+ size: args === null || args === void 0 ? void 0 : args.size,
33
32
  className: className,
34
- icon: icon
35
- }, /*#__PURE__*/React.createElement(SelectValue, {
36
- placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Select'
37
- })), /*#__PURE__*/React.createElement(SelectContent, null, options === null || options === void 0 ? void 0 : options.map(function (option, groupIndex) {
38
- if (isOptionGroup(option)) {
39
- return /*#__PURE__*/React.createElement(SelectGroup, {
40
- key: groupIndex
41
- }, option.label && /*#__PURE__*/React.createElement(SelectLabel, {
42
- size: args === null || args === void 0 ? void 0 : args.size
43
- }, option.label), option.options.map(function (_ref3) {
44
- var label = _ref3.label,
45
- value = _ref3.value,
46
- disabled = _ref3.disabled,
47
- icon = _ref3.icon,
48
- tooltip = _ref3.tooltip;
49
- return /*#__PURE__*/React.createElement(SelectItem, {
50
- key: value,
51
- value: value,
52
- disabled: disabled,
53
- size: args === null || args === void 0 ? void 0 : args.size,
54
- icon: icon,
55
- tooltip: tooltip,
56
- isGroup: !!option.label
57
- }, label);
58
- }), groupIndex !== options.length - 1 && /*#__PURE__*/React.createElement(SelectSeparator, null));
59
- }
60
- return /*#__PURE__*/React.createElement(SelectGroup, {
61
- key: "default"
62
- }, /*#__PURE__*/React.createElement(SelectItem, {
63
- value: option.value,
64
- disabled: option.disabled,
65
- size: args === null || args === void 0 ? void 0 : args.size,
66
- icon: option.icon,
67
- tooltip: option.tooltip
68
- }, option.label));
69
- })));
33
+ icon: icon,
34
+ options: options || [],
35
+ showGroupSeparator: showGroupSeparator,
36
+ formItemId: formItemId,
37
+ "aria-invalid": !!error
38
+ }, restSelectProps));
70
39
  }
71
- function FormSelectField(_ref4) {
72
- var selectProps = _ref4.selectProps,
73
- rest = _objectWithoutProperties(_ref4, _excluded2);
40
+ function FormSelectField(_ref3) {
41
+ var selectProps = _ref3.selectProps,
42
+ showGroupSeparator = _ref3.showGroupSeparator,
43
+ rest = _objectWithoutProperties(_ref3, _excluded2);
74
44
  var readOnly = rest.readOnly,
75
45
  disabled = rest.disabled;
76
46
  return /*#__PURE__*/React.createElement(FormFieldGroup, rest, function (field, args) {
@@ -79,7 +49,8 @@ function FormSelectField(_ref4) {
79
49
  args: args,
80
50
  selectProps: selectProps,
81
51
  readOnly: readOnly,
82
- disabled: disabled
52
+ disabled: disabled,
53
+ showGroupSeparator: showGroupSeparator
83
54
  });
84
55
  });
85
56
  }
@@ -65,6 +65,7 @@ export type FormSelectProps = SelectProps & {
65
65
  };
66
66
  export type FormSelectFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = Omit<FormFieldGroupProps<TFieldValues, TName>, 'children'> & {
67
67
  icon?: ReactElement;
68
+ showGroupSeparator?: boolean;
68
69
  selectProps?: FormSelectProps;
69
70
  };
70
71
  export interface FormSelectInnerProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> {
@@ -72,6 +73,7 @@ export interface FormSelectInnerProps<TFieldValues extends FieldValues, TName ex
72
73
  args: FormFieldArgs | undefined;
73
74
  selectProps?: FormSelectProps;
74
75
  readOnly?: boolean;
76
+ showGroupSeparator?: boolean;
75
77
  disabled?: boolean;
76
78
  className?: string;
77
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleflex/ui-tw",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "author": "scaleflex",
5
5
  "repository": "github:scaleflex/ui",
6
6
  "homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
@@ -14,14 +14,16 @@
14
14
  "dependencies": {
15
15
  "@popperjs/core": "^2.6.0",
16
16
  "@radix-ui/react-label": "^2.1.6",
17
+ "@radix-ui/react-popover": "^1.0.2",
17
18
  "@radix-ui/react-select": "^2.2.4",
18
19
  "@radix-ui/react-separator": "^1.1.6",
19
20
  "@radix-ui/react-slot": "^1.1.2",
20
21
  "@radix-ui/react-switch": "^1.0.1",
21
22
  "@radix-ui/react-tooltip": "^1.2.6",
22
- "@scaleflex/icons-tw": "^0.0.29",
23
+ "@scaleflex/icons-tw": "^0.0.31",
23
24
  "@types/lodash.merge": "^4.6.9",
24
25
  "class-variance-authority": "^0.7.1",
26
+ "cmdk": "^1.1.1",
25
27
  "lodash.merge": "^4.6.2",
26
28
  "lucide-react": "^0.487.0",
27
29
  "prop-types": "^15.7.2",
@@ -1,7 +1,7 @@
1
1
  import { pillVariants } from '@scaleflex/ui-tw/pill/pill.component';
2
2
  import type { VariantProps } from 'class-variance-authority';
3
- import { ComponentProps } from 'react';
3
+ import { ComponentProps, MouseEvent } from 'react';
4
4
  export interface PillProps extends ComponentProps<'div'>, VariantProps<typeof pillVariants> {
5
5
  removable?: boolean;
6
- onRemove?: () => void;
6
+ onRemove?: (event: MouseEvent<HTMLButtonElement>) => void;
7
7
  }
@@ -0,0 +1 @@
1
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './popover.component';
@@ -0,0 +1 @@
1
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './popover.component';
@@ -0,0 +1,7 @@
1
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
2
+ import React, { ComponentProps } from 'react';
3
+ declare function Popover({ ...props }: ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
4
+ declare function PopoverTrigger({ ...props }: ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
5
+ declare function PopoverContent({ className, align, sideOffset, ...props }: ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
6
+ declare function PopoverAnchor({ ...props }: ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
7
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
@@ -0,0 +1,40 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ var _excluded = ["className", "align", "sideOffset"];
5
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
6
+ import { cn } from '@scaleflex/ui-tw/utils/cn';
7
+ import React from 'react';
8
+ function Popover(_ref) {
9
+ var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
10
+ return /*#__PURE__*/React.createElement(PopoverPrimitive.Root, _extends({
11
+ "data-slot": "popover"
12
+ }, props));
13
+ }
14
+ function PopoverTrigger(_ref2) {
15
+ var props = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
16
+ return /*#__PURE__*/React.createElement(PopoverPrimitive.Trigger, _extends({
17
+ "data-slot": "popover-trigger"
18
+ }, props));
19
+ }
20
+ function PopoverContent(_ref3) {
21
+ var className = _ref3.className,
22
+ _ref3$align = _ref3.align,
23
+ align = _ref3$align === void 0 ? 'start' : _ref3$align,
24
+ _ref3$sideOffset = _ref3.sideOffset,
25
+ sideOffset = _ref3$sideOffset === void 0 ? 4 : _ref3$sideOffset,
26
+ props = _objectWithoutProperties(_ref3, _excluded);
27
+ return /*#__PURE__*/React.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React.createElement(PopoverPrimitive.Content, _extends({
28
+ "data-slot": "popover-content",
29
+ align: align,
30
+ sideOffset: sideOffset,
31
+ className: cn('bg-popover text-popover-foreground border-border z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-sm outline-hidden', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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', className)
32
+ }, props)));
33
+ }
34
+ function PopoverAnchor(_ref4) {
35
+ var props = _extends({}, (_objectDestructuringEmpty(_ref4), _ref4));
36
+ return /*#__PURE__*/React.createElement(PopoverPrimitive.Anchor, _extends({
37
+ "data-slot": "popover-anchor"
38
+ }, props));
39
+ }
40
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
@@ -3,7 +3,8 @@ import { getIconMarginRightInRem } from '@scaleflex/ui-tw/select/select.utils';
3
3
  import { cloneElement, useMemo } from 'react';
4
4
  export var SelectIcon = function SelectIcon(props) {
5
5
  var size = props.size,
6
- icon = props.icon;
6
+ icon = props.icon,
7
+ className = props.className;
7
8
  var sizeInRem = useMemo(function () {
8
9
  return getIconSizeInRem(size);
9
10
  }, [size]);
@@ -17,6 +18,7 @@ export var SelectIcon = function SelectIcon(props) {
17
18
  width: sizeInRem,
18
19
  height: sizeInRem,
19
20
  marginRight: marginRight
20
- }
21
+ },
22
+ className: className
21
23
  });
22
24
  };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { SelectorProps } from '../select.types';
3
+ export declare function Selector({ value, onChange, placeholder, disabled, readOnly, size, className, icon, options, showGroupSeparator, formItemId, ...rest }: SelectorProps): React.JSX.Element;