@clicktap/ui 0.14.19 → 0.14.26

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 (205) hide show
  1. package/components/Avatar/Avatar.d.ts +5 -1
  2. package/components/Avatar/Avatar.js +1 -1
  3. package/components/Avatar/Avatar.types.d.ts +28 -2
  4. package/components/Avatar/AvatarGroup/AvatarGroup.d.ts +5 -1
  5. package/components/Avatar/AvatarGroup/AvatarGroup.js +1 -1
  6. package/components/Avatar/AvatarGroup/AvatarGroup.types.d.ts +7 -2
  7. package/components/Avatar/index.js +1 -1
  8. package/components/ContextMenu/ContextMenu.js +1 -1
  9. package/components/Dialog/Dialog.js +1 -1
  10. package/components/DialogTrigger/DialogTrigger.js +1 -1
  11. package/components/Drawer/Drawer.js +1 -1
  12. package/components/ModalOverlay/ModalOverlay.js +1 -1
  13. package/components/PinInput/PinInput.js +1 -1
  14. package/components/Select/Select.js +1 -1
  15. package/components/Tabs/Tabs.context.d.ts +3 -0
  16. package/package.json +1 -2
  17. package/components/Accordion/Accordion.tsx +0 -82
  18. package/components/Accordion/index.ts +0 -3
  19. package/components/Avatar/Avatar.stories.tsx +0 -99
  20. package/components/Avatar/Avatar.tsx +0 -120
  21. package/components/Avatar/Avatar.types.ts +0 -3
  22. package/components/Avatar/AvatarGroup/AvatarGroup.tsx +0 -32
  23. package/components/Avatar/AvatarGroup/AvatarGroup.types.ts +0 -8
  24. package/components/Avatar/index.ts +0 -4
  25. package/components/Badge/Badge.stories.tsx +0 -72
  26. package/components/Badge/Badge.tsx +0 -169
  27. package/components/Badge/Badge.types.ts +0 -3
  28. package/components/Badge/index.ts +0 -2
  29. package/components/Breadcrumbs/BreadcrumbEllipsis.tsx +0 -47
  30. package/components/Breadcrumbs/BreadcrumbEllipsis.types.ts +0 -5
  31. package/components/Breadcrumbs/BreadcrumbItem.tsx +0 -23
  32. package/components/Breadcrumbs/BreadcrumbItem.types.ts +0 -3
  33. package/components/Breadcrumbs/BreadcrumbLink.tsx +0 -30
  34. package/components/Breadcrumbs/BreadcrumbLink.types.ts +0 -3
  35. package/components/Breadcrumbs/BreadcrumbSeparator.tsx +0 -41
  36. package/components/Breadcrumbs/BreadcrumbSeparator.types.ts +0 -9
  37. package/components/Breadcrumbs/Breadcrumbs.tsx +0 -28
  38. package/components/Breadcrumbs/Breadcrumbs.types.ts +0 -6
  39. package/components/Breadcrumbs/index.ts +0 -10
  40. package/components/Button/Button.tsx +0 -72
  41. package/components/Button/Button.types.ts +0 -7
  42. package/components/Button/index.ts +0 -2
  43. package/components/Card/Card.tsx +0 -15
  44. package/components/Card/Card.types.ts +0 -3
  45. package/components/Card/index.ts +0 -2
  46. package/components/Checkbox/Checkbox.tsx +0 -122
  47. package/components/Checkbox/Checkbox.types.ts +0 -15
  48. package/components/Checkbox/index.ts +0 -2
  49. package/components/Collapsible/Collapsible.tsx +0 -34
  50. package/components/Collapsible/Collapsible.types.ts +0 -5
  51. package/components/Collapsible/CollapsibleTrigger.tsx +0 -57
  52. package/components/Collapsible/CollapsibleTrigger.types.ts +0 -14
  53. package/components/Collapsible/index.ts +0 -10
  54. package/components/Container/Container.tsx +0 -26
  55. package/components/Container/Container.types.ts +0 -3
  56. package/components/Container/index.ts +0 -2
  57. package/components/ContextMenu/ContextMenu.tsx +0 -74
  58. package/components/ContextMenu/ContextMenu.types.ts +0 -17
  59. package/components/ContextMenu/index.ts +0 -2
  60. package/components/CreditCardExpirationInput/CreditCardExpirationInput.tsx +0 -115
  61. package/components/CreditCardExpirationInput/CreditCardExpirationInput.types.ts +0 -10
  62. package/components/CreditCardExpirationInput/index.ts +0 -2
  63. package/components/CreditCardInput/CreditCardInput.tsx +0 -147
  64. package/components/CreditCardInput/CreditCardInput.types.ts +0 -12
  65. package/components/CreditCardInput/index.ts +0 -2
  66. package/components/DateInput/DateInput.tsx +0 -81
  67. package/components/DateInput/DateInput.types.ts +0 -15
  68. package/components/DateInput/index.ts +0 -2
  69. package/components/DateTimeFormat/DateTimeFormat.tsx +0 -16
  70. package/components/DateTimeFormat/DateTimeFormat.types.ts +0 -7
  71. package/components/DateTimeFormat/index.ts +0 -2
  72. package/components/Dialog/Dialog.tsx +0 -65
  73. package/components/Dialog/Dialog.types.ts +0 -9
  74. package/components/Dialog/index.ts +0 -2
  75. package/components/DialogTrigger/DialogTrigger.tsx +0 -45
  76. package/components/DialogTrigger/DialogTrigger.types.ts +0 -6
  77. package/components/DialogTrigger/index.ts +0 -5
  78. package/components/Divider/Divider.stories.tsx +0 -37
  79. package/components/Divider/Divider.tsx +0 -34
  80. package/components/Divider/Divider.types.ts +0 -5
  81. package/components/Divider/index.ts +0 -2
  82. package/components/DobInput/DobInput.tsx +0 -120
  83. package/components/DobInput/index.ts +0 -2
  84. package/components/Drawer/Drawer.tsx +0 -126
  85. package/components/Drawer/Drawer.types.ts +0 -11
  86. package/components/Drawer/index.ts +0 -2
  87. package/components/Icon/Account.tsx +0 -50
  88. package/components/Icon/Cart.tsx +0 -43
  89. package/components/Icon/Checkmark.tsx +0 -34
  90. package/components/Icon/Cross.tsx +0 -36
  91. package/components/Icon/DownArrow.tsx +0 -23
  92. package/components/Icon/Hamburger.tsx +0 -23
  93. package/components/Icon/Icon.types.ts +0 -8
  94. package/components/Icon/LinkArrow.tsx +0 -32
  95. package/components/Icon/Minus.tsx +0 -20
  96. package/components/Icon/Plus.tsx +0 -20
  97. package/components/Icon/Search.tsx +0 -36
  98. package/components/Icon/Trash.tsx +0 -27
  99. package/components/Icon/Verified.tsx +0 -20
  100. package/components/Icon/index.ts +0 -14
  101. package/components/Image/Image.tsx +0 -32
  102. package/components/Image/index.ts +0 -2
  103. package/components/Input/Input.tsx +0 -109
  104. package/components/Input/Input.types.ts +0 -17
  105. package/components/Input/index.ts +0 -2
  106. package/components/Link/Link.stories.tsx +0 -96
  107. package/components/Link/Link.tsx +0 -39
  108. package/components/Link/Link.types.ts +0 -3
  109. package/components/Link/index.ts +0 -2
  110. package/components/Loader/CircularEasing.tsx +0 -66
  111. package/components/Loader/CircularEasing.types.ts +0 -8
  112. package/components/Loader/Pulse.tsx +0 -45
  113. package/components/Loader/Pulse.types.ts +0 -5
  114. package/components/Loader/index.ts +0 -4
  115. package/components/Menu/ContextMenu.tsx +0 -83
  116. package/components/Menu/Menu.tsx +0 -143
  117. package/components/Menu/Menu.types.ts +0 -44
  118. package/components/Menu/index.ts +0 -4
  119. package/components/Meter/Meter.stories.tsx +0 -111
  120. package/components/Meter/Meter.tsx +0 -68
  121. package/components/Meter/Meter.types.ts +0 -10
  122. package/components/Meter/index.ts +0 -2
  123. package/components/Modal/Modal.tsx +0 -16
  124. package/components/Modal/Modal.types.ts +0 -6
  125. package/components/Modal/index.ts +0 -2
  126. package/components/ModalOverlay/ModalOverlay.tsx +0 -121
  127. package/components/ModalOverlay/ModalOverlay.types.ts +0 -18
  128. package/components/ModalOverlay/index.ts +0 -2
  129. package/components/NumberFormat/NumberFormat.tsx +0 -19
  130. package/components/NumberFormat/NumberFormat.types.ts +0 -8
  131. package/components/NumberFormat/index.ts +0 -2
  132. package/components/NumberInput/NumberInput.tsx +0 -164
  133. package/components/NumberInput/NumberInput.types.ts +0 -22
  134. package/components/NumberInput/index.ts +0 -2
  135. package/components/NumberTicker/DigitResolver.tsx +0 -119
  136. package/components/NumberTicker/DigitResolver.types.ts +0 -18
  137. package/components/NumberTicker/NumberTicker.tsx +0 -56
  138. package/components/NumberTicker/NumberTicker.types.ts +0 -96
  139. package/components/NumberTicker/hooks/useColumnTransition.ts +0 -36
  140. package/components/NumberTicker/hooks/useNumberDelta.ts +0 -19
  141. package/components/NumberTicker/hooks/useNumberTicker.ts +0 -36
  142. package/components/NumberTicker/index.ts +0 -10
  143. package/components/Pagination/Pagination.tsx +0 -44
  144. package/components/Pagination/index.ts +0 -2
  145. package/components/PasswordCheck/PasswordCheck.tsx +0 -59
  146. package/components/PasswordCheck/PasswordCheck.types.ts +0 -4
  147. package/components/PasswordCheck/PasswordCheck.utils.ts +0 -47
  148. package/components/PasswordCheck/index.ts +0 -2
  149. package/components/PhoneInput/PhoneInput.tsx +0 -191
  150. package/components/PhoneInput/index.ts +0 -2
  151. package/components/PinInput/PinInput.tsx +0 -318
  152. package/components/PinInput/PinInput.types.ts +0 -21
  153. package/components/PinInput/index.ts +0 -2
  154. package/components/Progressbar/CircularProgressbar.tsx +0 -71
  155. package/components/Progressbar/CircularProgressbar.types.ts +0 -10
  156. package/components/Progressbar/LinearProgressbar.tsx +0 -75
  157. package/components/Progressbar/LinearProgressbar.types.ts +0 -11
  158. package/components/Progressbar/index.ts +0 -4
  159. package/components/Radio/Radio.tsx +0 -88
  160. package/components/Radio/Radio.types.ts +0 -16
  161. package/components/Radio/index.ts +0 -2
  162. package/components/RadioGroup/RadioGroup.tsx +0 -49
  163. package/components/RadioGroup/RadioGroup.types.ts +0 -7
  164. package/components/RadioGroup/index.ts +0 -2
  165. package/components/Select/Option.tsx +0 -32
  166. package/components/Select/Option.types.ts +0 -3
  167. package/components/Select/Select.tsx +0 -272
  168. package/components/Select/Select.types.ts +0 -48
  169. package/components/Select/index.ts +0 -8
  170. package/components/Skeleton/Skeleton.tsx +0 -15
  171. package/components/Skeleton/Skeleton.types.ts +0 -3
  172. package/components/Skeleton/index.ts +0 -2
  173. package/components/Slider/Slider.tsx +0 -110
  174. package/components/Slider/Slider.types.ts +0 -11
  175. package/components/Slider/index.ts +0 -2
  176. package/components/Switch/Switch.tsx +0 -63
  177. package/components/Switch/Switch.types.ts +0 -8
  178. package/components/Switch/index.ts +0 -2
  179. package/components/Table/Table.tsx +0 -52
  180. package/components/Table/Table.types.ts +0 -22
  181. package/components/Table/index.ts +0 -2
  182. package/components/Tabs/Tab.tsx +0 -118
  183. package/components/Tabs/Tab.types.ts +0 -10
  184. package/components/Tabs/TabList.tsx +0 -51
  185. package/components/Tabs/TabList.types.ts +0 -12
  186. package/components/Tabs/TabPanel.tsx +0 -19
  187. package/components/Tabs/TabPanel.types.ts +0 -3
  188. package/components/Tabs/Tabs.context.tsx +0 -9
  189. package/components/Tabs/Tabs.tsx +0 -39
  190. package/components/Tabs/Tabs.types.ts +0 -3
  191. package/components/Tabs/index.ts +0 -9
  192. package/components/TimeInput/TimeInput.stories.tsx +0 -125
  193. package/components/TimeInput/TimeInput.tsx +0 -81
  194. package/components/TimeInput/TimeInput.types.ts +0 -15
  195. package/components/TimeInput/index.ts +0 -2
  196. package/components/ToggleButton/ToggleButton.stories.tsx +0 -89
  197. package/components/ToggleButton/ToggleButton.tsx +0 -69
  198. package/components/ToggleButton/ToggleButton.types.ts +0 -6
  199. package/components/ToggleButton/index.ts +0 -2
  200. package/components/Tooltip/Tooltip.tsx +0 -59
  201. package/components/Tooltip/Tooltip.types.ts +0 -3
  202. package/components/Tooltip/index.ts +0 -2
  203. package/components/UploadImage/UploadImage.tsx +0 -206
  204. package/components/UploadImage/UploadImage.types.ts +0 -15
  205. package/components/UploadImage/index.ts +0 -2
@@ -1,32 +0,0 @@
1
- 'use client';
2
-
3
- import { ListBoxItem } from 'react-aria-components';
4
- import { cn } from '../../utils/cn';
5
- import type { OptionProps } from './Option.types';
6
-
7
- export function Option({ className, ...props }: OptionProps) {
8
- return (
9
- <ListBoxItem
10
- // eslint-disable-next-line react/jsx-props-no-spreading
11
- {...props}
12
- className={cn(
13
- 'flex flex-auto items-center',
14
- 'rounded-md',
15
- 'p-2.5 mx-1.5',
16
- 'text-sm',
17
- 'cursor-default',
18
- 'outline-none',
19
- 'text-slate-900',
20
- 'transition-all ease-in-out duration-300',
21
- 'data-[hovered]:bg-slate-100 data-[hovered]:text-slate-900',
22
- 'data-[focused]:bg-slate-100 data-[hovered]:text-slate-900',
23
- 'data-[pressed]:bg-slate-200 data-[hovered]:text-slate-900',
24
- 'data-[selected]:bg-none data-[selected]:text-slate-900 data-[selected]:font-semibold data-[selected]:data-[focused]:bg-slate-100',
25
- 'data-[disabled]:bg-none data-[disabled]:text-slate-500',
26
- className
27
- )}
28
- />
29
- );
30
- }
31
-
32
- export default Option;
@@ -1,3 +0,0 @@
1
- import type { ListBoxItemProps } from 'react-aria-components';
2
-
3
- export type OptionProps = ListBoxItemProps;
@@ -1,272 +0,0 @@
1
- 'use client';
2
-
3
- import {
4
- ListBox,
5
- ComboBox,
6
- Label,
7
- Input,
8
- Button,
9
- Text,
10
- FieldError,
11
- Popover,
12
- } from 'react-aria-components';
13
- import type { ComboBoxRenderProps, ListBoxProps } from 'react-aria-components';
14
- import { forwardRef, useState } from 'react';
15
- import type { ForwardedRef, Ref } from 'react';
16
- import { motion } from 'framer-motion';
17
- import { cn } from '../../utils/cn';
18
- import { Pulse } from '../Loader';
19
- import type {
20
- ComboBoxPopoverAnimationState,
21
- SelectProps,
22
- SelectSlots,
23
- } from './Select.types';
24
-
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- const ForwardedPopover = forwardRef<HTMLElement, any>(
27
- (props, ref: Ref<HTMLElement>) => (
28
- // eslint-disable-next-line react/jsx-props-no-spreading
29
- <Popover {...props} ref={ref} />
30
- )
31
- );
32
-
33
- // Now use motion with ForwardedPopover
34
- const MotionPopover = motion.create(ForwardedPopover);
35
-
36
- function ButtonIconSlot<T extends object>({
37
- buttonIcon,
38
- ...props
39
- }: ComboBoxRenderProps & Pick<SelectSlots<T>, 'buttonIcon'>) {
40
- if (!buttonIcon) {
41
- return (
42
- <svg
43
- width="24"
44
- height="24"
45
- viewBox="0 0 24 24"
46
- fill="none"
47
- xmlns="http://www.w3.org/2000/svg"
48
- className={cn(
49
- 'transition-all ease-in-out duration-200',
50
- props.isOpen ? 'rotate-180' : 'rotate-0'
51
- )}
52
- >
53
- <path
54
- d="M6 9L12 15L18 9"
55
- strokeWidth="2"
56
- strokeLinecap="round"
57
- strokeLinejoin="round"
58
- className={cn([
59
- 'stroke-slate-900',
60
- props.isDisabled && 'stroke-slate-400',
61
- props.isInvalid && 'stroke-red-500',
62
- ])}
63
- />
64
- </svg>
65
- );
66
- }
67
-
68
- return typeof buttonIcon === 'function' ? buttonIcon(props) : buttonIcon;
69
- }
70
-
71
- function ListBoxSlot<T extends object>({
72
- listBoxComponent,
73
- children,
74
- ...props
75
- }: ListBoxProps<T> & Pick<SelectSlots<T>, 'listBoxComponent'>) {
76
- const Component = listBoxComponent || ListBox;
77
-
78
- return (
79
- <Component
80
- // eslint-disable-next-line react/jsx-props-no-spreading
81
- {...props}
82
- >
83
- {children}
84
- </Component>
85
- );
86
- }
87
-
88
- // Internal component - necessary to preserve generics in children
89
- // i.e. <Select items={[{id: 'test', value: 'test'}]}.../> won't reference "any"
90
- function SelectInner<T extends object>(
91
- {
92
- label,
93
- description,
94
- errorMessage,
95
- children,
96
- placeholder,
97
- key,
98
- isLoading,
99
- slots,
100
- popoverPortalContainer,
101
- popoverOffset,
102
- selectedKey,
103
- className,
104
- classNames,
105
- autoComplete,
106
- ...props
107
- }: SelectProps<T>,
108
- ref: ForwardedRef<HTMLInputElement>
109
- ) {
110
- const [animation, setAnimation] =
111
- useState<ComboBoxPopoverAnimationState>('unmounted');
112
- const [isComboOpen, setIsComboOpen] = useState<boolean>(false);
113
-
114
- return (
115
- <ComboBox
116
- onOpenChange={() => {
117
- setAnimation(animation === 'visible' ? 'hidden' : 'visible');
118
- setIsComboOpen(!isComboOpen);
119
- }}
120
- isDisabled={props.isDisabled || isLoading}
121
- data-has-value={!!selectedKey}
122
- selectedKey={selectedKey}
123
- // eslint-disable-next-line react/jsx-props-no-spreading
124
- {...props}
125
- className={cn('flex flex-col', 'w-full', className)}
126
- >
127
- {(renderProps) => (
128
- <>
129
- <Label
130
- className={cn('flex', 'text-xs text-slate-500', classNames?.label)}
131
- >
132
- {label}
133
- </Label>
134
- <div
135
- className={cn(
136
- 'flex',
137
- 'relative',
138
- 'w-full',
139
- classNames?.comboBoxContainer
140
- )}
141
- >
142
- <Input
143
- placeholder={placeholder}
144
- className={cn(
145
- 'border border-solid border-slate-300',
146
- 'text-sm text-slate-900',
147
- 'py-0 px-2',
148
- 'h-10 w-full',
149
- 'm-0',
150
- 'rounded-md',
151
- 'bg-white',
152
- 'transition-all ease-in-out duration-200',
153
- 'data-[hovered]:border-slate-400',
154
- 'data-[focused]:border-slate-400 data-[focused]:outline data-[focused]:outline-2 data-[focused]:outline-slate-200',
155
- ' data-[disabled]:bg-slate-100 data-[disabled]:border-slate-300',
156
- isLoading
157
- ? 'data-[disabled]:text-slate-900'
158
- : 'data-[disabled]:text-slate-500',
159
- 'data-[invalid]:border-red-500 data-[invalid]:bg-red-100 data-[invalid]:text-red-600',
160
- 'data-[invalid]:data-[hovered]:border-red-600',
161
- 'data-[invalid]:data-[focused]:border-red-600 data-[invalid]:data-[focused]:outline data-[invalid]:data-[focused]:outline-2 data-[invalid]:data-[focused]:outline-red-200',
162
- 'data-[invalid]:placeholder:text-slate-400',
163
- classNames?.input
164
- )}
165
- ref={ref}
166
- autoComplete={autoComplete}
167
- />
168
- {isLoading ? (
169
- <div
170
- className={cn(
171
- 'absolute top-2 right-2',
172
- 'block',
173
- classNames?.loader
174
- )}
175
- >
176
- {slots?.loadingIcon || <Pulse />}
177
- </div>
178
- ) : (
179
- <Button
180
- className={cn(
181
- 'absolute top-2 right-0',
182
- 'block',
183
- 'border-none',
184
- 'bg-none',
185
- classNames?.arrowButton
186
- )}
187
- >
188
- <ButtonIconSlot
189
- buttonIcon={slots?.buttonIcon}
190
- // eslint-disable-next-line react/jsx-props-no-spreading
191
- {...renderProps}
192
- />
193
- </Button>
194
- )}
195
- </div>
196
- {description && (
197
- <Text
198
- slot="description"
199
- className={cn(
200
- 'flex',
201
- 'text-xs',
202
- 'text-slate-500',
203
- classNames?.description
204
- )}
205
- >
206
- {description}
207
- </Text>
208
- )}
209
- <FieldError
210
- className={cn(
211
- 'flex',
212
- 'text-xs',
213
- 'text-red-500',
214
- classNames?.errorMessage
215
- )}
216
- >
217
- {errorMessage}
218
- </FieldError>
219
- <MotionPopover
220
- key={key}
221
- isOpen={isComboOpen}
222
- isExiting={animation === 'hidden'}
223
- offset={popoverOffset}
224
- UNSTABLE_portalContainer={popoverPortalContainer}
225
- onAnimationComplete={(completedAnimation: string) => {
226
- setAnimation((a) =>
227
- completedAnimation === 'hidden' && a === 'hidden'
228
- ? 'unmounted'
229
- : a
230
- );
231
- }}
232
- variants={{
233
- hidden: { opacity: 0, y: -10 },
234
- visible: { opacity: 1, y: 0 },
235
- }}
236
- initial="hidden"
237
- animate={animation}
238
- className={cn(
239
- 'px-0 py-1.5',
240
- 'shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]',
241
- 'rounded-md',
242
- 'w-[var(--trigger-width)]',
243
- 'bg-white',
244
- 'border border-solid border-slate-300',
245
- classNames?.listContainer
246
- )}
247
- >
248
- <ListBoxSlot
249
- listBoxComponent={slots?.listBoxComponent}
250
- className={cn('max-h-80', 'overflow-y-scroll', classNames?.list)}
251
- >
252
- {children}
253
- </ListBoxSlot>
254
- </MotionPopover>
255
- </>
256
- )}
257
- </ComboBox>
258
- );
259
- }
260
-
261
- // Type for the exported component that preserves generics
262
- interface SelectComponent {
263
- <T extends object>(
264
- props: SelectProps<T> & { ref?: ForwardedRef<HTMLInputElement> }
265
- ): JSX.Element;
266
- }
267
-
268
- // Create the forwarded component with proper typing
269
- export const Select = forwardRef(SelectInner) as SelectComponent;
270
-
271
- export default Select;
272
-
@@ -1,48 +0,0 @@
1
- import type {
2
- ComboBoxRenderProps,
3
- ComboBoxProps as AriaComboBoxProps,
4
- ValidationResult,
5
- ListBoxProps,
6
- } from 'react-aria-components';
7
- import type {
8
- ComponentType,
9
- HTMLInputAutoCompleteAttribute,
10
- Key,
11
- ReactNode,
12
- } from 'react';
13
- import type { SlotsToClasses } from '../../types/SlotsToClasses';
14
-
15
- export type ComboBoxPopoverAnimationState = 'unmounted' | 'hidden' | 'visible';
16
-
17
- export type SelectSlots<T extends object> = {
18
- buttonIcon?: ReactNode | ((values: ComboBoxRenderProps) => ReactNode);
19
- loadingIcon?: ReactNode;
20
- listBoxComponent?: ComponentType<ListBoxProps<T>>;
21
- };
22
-
23
- export interface SelectProps<T extends object>
24
- extends Omit<AriaComboBoxProps<T>, 'children'> {
25
- label?: string;
26
- description?: string | null;
27
- errorMessage?: string | ((validation: ValidationResult) => string);
28
- placeholder?: string;
29
- key?: Key | null;
30
- isLoading?: boolean;
31
- children: ReactNode | ((item: T) => ReactNode);
32
- slots?: SelectSlots<T>;
33
- popoverOffset?: number;
34
- popoverPortalContainer?: Element;
35
- classNames?: SlotsToClasses<
36
- | 'label'
37
- | 'name'
38
- | 'comboBoxContainer'
39
- | 'input'
40
- | 'loader'
41
- | 'arrowButton'
42
- | 'description'
43
- | 'errorMessage'
44
- | 'listContainer'
45
- | 'list'
46
- >;
47
- autoComplete?: HTMLInputAutoCompleteAttribute;
48
- }
@@ -1,8 +0,0 @@
1
- export { Option } from './Option';
2
- export { Select } from './Select';
3
- export type { OptionProps } from './Option.types';
4
- export type {
5
- ComboBoxPopoverAnimationState,
6
- SelectProps,
7
- SelectSlots,
8
- } from './Select.types';
@@ -1,15 +0,0 @@
1
- import { cn } from '../../utils/cn';
2
- import type { SkeletonProps } from './Skeleton.types';
3
-
4
- export function Skeleton({ className }: SkeletonProps) {
5
- return (
6
- <div
7
- className={cn(
8
- 'relative rounded-md animate-pulse bg-slate-200',
9
- className
10
- )}
11
- />
12
- );
13
- }
14
-
15
- export default Skeleton;
@@ -1,3 +0,0 @@
1
- export type SkeletonProps = {
2
- className?: string;
3
- };
@@ -1,2 +0,0 @@
1
- export { Skeleton } from './Skeleton';
2
- export type { SkeletonProps } from './Skeleton.types';
@@ -1,110 +0,0 @@
1
- 'use client';
2
-
3
- import {
4
- Label,
5
- Slider as AriaSlider,
6
- SliderOutput,
7
- SliderTrack,
8
- SliderThumb,
9
- } from 'react-aria-components';
10
- import { cn } from '../../utils/cn';
11
- import type { SliderProps } from './Slider.types';
12
-
13
- export function Slider({
14
- label,
15
- showOutput = true,
16
- thumbLabels,
17
- classNames,
18
- orientation,
19
- isDisabled,
20
- children,
21
- ...props
22
- }: SliderProps) {
23
- return (
24
- <AriaSlider
25
- orientation={orientation}
26
- isDisabled={isDisabled}
27
- className={cn(
28
- 'data-[orientation="horizontal"]:w-full data-[orientation="horizontal"]:flex data-[orientation="horizontal"]:flex-wrap',
29
- 'data-[orientation="vertical"]:w-8 data-[orientation="vertical"]:block data-[orientation="vertical"]:h-full',
30
- classNames?.base
31
- )}
32
- // eslint-disable-next-line react/jsx-props-no-spreading
33
- {...props}
34
- >
35
- {children || (
36
- <>
37
- {(label || showOutput) && (
38
- <div
39
- className={cn(
40
- 'w-full flex justify-between items-center',
41
- orientation === 'vertical' && 'gap-2 w-max mb-2',
42
- classNames?.outputWrapper
43
- )}
44
- >
45
- <Label
46
- className={cn(
47
- 'flex-1 text-sm',
48
- isDisabled && 'opacity-50',
49
- classNames?.label
50
- )}
51
- >
52
- {label}
53
- </Label>
54
-
55
- {showOutput && (
56
- <SliderOutput
57
- className={cn(
58
- 'flex flex-initial ml-auto justify-end text-sm',
59
- isDisabled && 'opacity-50',
60
- classNames?.output
61
- )}
62
- >
63
- {({ state }) =>
64
- state.values
65
- .map((_, i) => state.getThumbValueLabel(i))
66
- .join(' – ')
67
- }
68
- </SliderOutput>
69
- )}
70
- </div>
71
- )}
72
-
73
- <SliderTrack
74
- className={cn(
75
- 'data-[orientation="horizontal"]:w-full data-[orientation="horizontal"]:h-8',
76
- 'data-[orientation="vertical"]:w-8 data-[orientation="vertical"]:h-full',
77
- 'transition-all duration-200 ease',
78
- 'before:bg-slate-300 before:block before:absolute cursor-pointer',
79
- 'data-[orientation="horizontal"]:before:w-full data-[orientation="horizontal"]:before:h-0.5',
80
- 'data-[orientation="horizontal"]:before:top-1/2 data-[orientation="horizontal"]:before:-translate-y-1/2',
81
- 'data-[orientation="vertical"]:before:w-0.5 data-[orientation="vertical"]:before:h-full data-[orientation="vertical"]:before:left-1/2 data-[orientation="vertical"]:before:-translate-y-1/2 data-[orientation="vertical"]:before:-translate-x-1/2',
82
- isDisabled && 'opacity-50 before:cursor-default',
83
- classNames?.track
84
- )}
85
- >
86
- {({ state }) =>
87
- state.values.map((_, i) => (
88
- <SliderThumb
89
- // eslint-disable-next-line react/no-array-index-key
90
- key={i}
91
- index={i}
92
- aria-label={thumbLabels?.[i]}
93
- className={cn(
94
- 'w-6 h-6 bg-slate-300 forced-color-adjust-none cursor-pointer top-1/2',
95
- 'border-2 border-slate-400 rounded-full',
96
- isDisabled && 'cursor-default',
97
- orientation === 'vertical' && 'left-1/2',
98
- classNames?.thumb
99
- )}
100
- />
101
- ))
102
- }
103
- </SliderTrack>
104
- </>
105
- )}
106
- </AriaSlider>
107
- );
108
- }
109
-
110
- export default Slider;
@@ -1,11 +0,0 @@
1
- import type { SliderProps as AriaSliderProps } from 'react-aria-components';
2
- import type { SlotsToClasses } from '../../types/SlotsToClasses';
3
-
4
- export type SliderProps = AriaSliderProps & {
5
- label?: string;
6
- showOutput?: boolean;
7
- thumbLabels?: string[];
8
- classNames?: SlotsToClasses<
9
- 'base' | 'label' | 'output' | 'outputWrapper' | 'track' | 'thumb'
10
- >;
11
- };
@@ -1,2 +0,0 @@
1
- export { Slider } from './Slider';
2
- export type { SliderProps } from './Slider.types';
@@ -1,63 +0,0 @@
1
- 'use client';
2
-
3
- import { Switch as AriaSwitch } from 'react-aria-components';
4
- import { cn } from '../../utils/cn';
5
- import type { SlotsToClasses } from '../../types/SlotsToClasses';
6
- import type { SwitchProps, SwitchRenderProps } from './Switch.types';
7
-
8
- export function Switch({
9
- children,
10
- className,
11
- classNames,
12
- ...props
13
- }: SwitchProps & {
14
- classNames?: SlotsToClasses<'indicator'>;
15
- }) {
16
- return (
17
- <AriaSwitch
18
- className={cn(
19
- 'flex items-center gap-2 text-sm text-slate-500 forced-color-adjust-none group',
20
- '',
21
- className
22
- )}
23
- // eslint-disable-next-line react/jsx-props-no-spreading
24
- {...props}
25
- >
26
- {(renderProps: SwitchRenderProps) => {
27
- const { isSelected, isHovered, isFocused, isPressed, isDisabled } =
28
- renderProps;
29
- return (
30
- <>
31
- <div
32
- className={cn(
33
- 'w-12 h-7 bg-transparent border-solid border border-slate-300 rounded-3xl transition-all duration-200 ease-in-out',
34
- 'before:block before:w-5 before:h-5 before:m-[3px] before:bg-slate-300 before:rounded-full',
35
- 'before:transition-all before:duration-200 before:ease-in-out',
36
- [
37
- isHovered && 'border-slate-400',
38
- isSelected && [
39
- ' bg-slate-300 before:translate-x-full before:bg-white',
40
- (isHovered || isFocused) && 'border-slate-400',
41
- ],
42
- isFocused && ['outline outline-2 outline-slate-200'],
43
- isPressed && 'before:bg-slate-400',
44
- isDisabled && 'bg-slate-100',
45
- classNames?.indicator,
46
- ]
47
- )}
48
- />
49
-
50
- {typeof children === 'function'
51
- ? children({
52
- defaultChildren: undefined,
53
- ...renderProps,
54
- })
55
- : children}
56
- </>
57
- );
58
- }}
59
- </AriaSwitch>
60
- );
61
- }
62
-
63
- export default Switch;
@@ -1,8 +0,0 @@
1
- import type {
2
- SwitchProps as UISwitchProps,
3
- SwitchRenderProps as UISwitchRenderProps,
4
- } from 'react-aria-components';
5
-
6
- export type SwitchProps = UISwitchProps;
7
-
8
- export type SwitchRenderProps = UISwitchRenderProps;
@@ -1,2 +0,0 @@
1
- export { Switch } from './Switch';
2
- export type { SwitchProps, SwitchRenderProps } from './Switch.types';
@@ -1,52 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '../../utils/cn';
4
- import type { TableProps } from './Table.types';
5
-
6
- export function Table<T>({
7
- columns,
8
- rows,
9
- onRowClick = () => {},
10
- classNames,
11
- }: TableProps<T>) {
12
- return (
13
- <table className={cn(classNames?.table)}>
14
- <thead className={cn(classNames?.thead)}>
15
- <tr className={cn(classNames?.theadTr)}>
16
- {columns.map((column) => (
17
- <th
18
- key={String(column.id)}
19
- className={cn(classNames?.th)}
20
- data-th-header={column.label.toLowerCase()}
21
- >
22
- {column.label}
23
- </th>
24
- ))}
25
- </tr>
26
- </thead>
27
- <tbody className={cn(classNames?.tbody)}>
28
- {Object.entries(rows).map(([key, row]) => (
29
- <tr
30
- key={key}
31
- onClick={() => onRowClick(row)}
32
- className={cn(classNames?.tbodyTr)}
33
- >
34
- {columns.map((column) => (
35
- <td
36
- key={`${String(column.id)}_${key}`}
37
- data-th={column.label.toLowerCase()}
38
- className={cn(classNames?.td)}
39
- >
40
- {column.renderer
41
- ? column.renderer(row)
42
- : String(row[column.id as keyof T])}
43
- </td>
44
- ))}
45
- </tr>
46
- ))}
47
- </tbody>
48
- </table>
49
- );
50
- }
51
-
52
- export default Table;
@@ -1,22 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { SlotsToClasses } from '../../types/SlotsToClasses';
3
-
4
- export type TableProps<T> = {
5
- columns: (
6
- | {
7
- id: keyof T;
8
- label: string;
9
- renderer?: (props: T) => ReactNode;
10
- }
11
- | {
12
- id: string;
13
- label: string;
14
- renderer: (props: T) => ReactNode;
15
- }
16
- )[];
17
- rows: T[];
18
- onRowClick?: (row: T) => void;
19
- classNames?: SlotsToClasses<
20
- 'table' | 'thead' | 'tbody' | 'theadTr' | 'tbodyTr' | 'th' | 'td'
21
- >;
22
- };
@@ -1,2 +0,0 @@
1
- export { Table } from './Table';
2
- export type { TableProps } from './Table.types';