@taiv/ui 1.3.2 → 1.4.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.
Files changed (205) hide show
  1. package/dist/components/Data/Cards/ChartCard.d.ts +2 -1
  2. package/dist/components/Data/Cards/ChartCard.d.ts.map +1 -1
  3. package/dist/components/Data/Cards/ChartCard.js +6 -4
  4. package/dist/components/Data/Cards/PieChartCard.d.ts +2 -1
  5. package/dist/components/Data/Cards/PieChartCard.d.ts.map +1 -1
  6. package/dist/components/Data/Cards/PieChartCard.js +6 -4
  7. package/dist/components/Data/Cards/StatsCard.d.ts +1 -1
  8. package/dist/components/Data/Cards/StatsCard.d.ts.map +1 -1
  9. package/dist/components/Data/Cards/StatsCard.js +4 -4
  10. package/dist/components/Data/Chart.js +4 -4
  11. package/dist/components/Data/CheckboxTable.d.ts +1 -1
  12. package/dist/components/Data/CheckboxTable.d.ts.map +1 -1
  13. package/dist/components/Data/CheckboxTable.js +6 -6
  14. package/dist/components/Data/PieChart.js +4 -4
  15. package/dist/components/Info/InfoCard.d.ts +1 -1
  16. package/dist/components/Info/InfoCard.d.ts.map +1 -1
  17. package/dist/components/Info/InfoCard.js +2 -2
  18. package/dist/components/Info/Modals/Modal.js +2 -2
  19. package/dist/components/Info/Notifications/variants.js +1 -1
  20. package/dist/components/Info/Tooltips/FormulaTooltip.js +3 -3
  21. package/dist/components/Info/Tooltips/InfoTooltip.d.ts +16 -1
  22. package/dist/components/Info/Tooltips/InfoTooltip.d.ts.map +1 -1
  23. package/dist/components/Info/Tooltips/InfoTooltip.js +18 -4
  24. package/dist/components/Inputs/Buttons/Button/Button.d.ts +12 -0
  25. package/dist/components/Inputs/Buttons/Button/Button.d.ts.map +1 -0
  26. package/dist/components/Inputs/Buttons/Button/Button.js +37 -0
  27. package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts +11 -0
  28. package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts.map +1 -0
  29. package/dist/components/Inputs/Buttons/Button/Button.stories.js +176 -0
  30. package/dist/components/Inputs/Buttons/Button/sizes.d.ts +25 -0
  31. package/dist/components/Inputs/Buttons/Button/sizes.d.ts.map +1 -0
  32. package/dist/components/Inputs/Buttons/Button/sizes.js +7 -0
  33. package/dist/components/Inputs/Buttons/Button/variants.d.ts +191 -0
  34. package/dist/components/Inputs/Buttons/Button/variants.d.ts.map +1 -0
  35. package/dist/components/Inputs/Buttons/Button/variants.js +191 -0
  36. package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.d.ts +10 -0
  37. package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.d.ts.map +1 -0
  38. package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.js +6 -0
  39. package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.stories.d.ts +8 -0
  40. package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.stories.d.ts.map +1 -0
  41. package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.stories.js +97 -0
  42. package/dist/components/Inputs/Controls/Checkbox/Checkbox.d.ts +27 -0
  43. package/dist/components/Inputs/Controls/Checkbox/Checkbox.d.ts.map +1 -0
  44. package/dist/components/Inputs/Controls/Checkbox/Checkbox.js +55 -0
  45. package/dist/components/Inputs/Controls/Checkbox/Checkbox.stories.d.ts +10 -0
  46. package/dist/components/Inputs/Controls/Checkbox/Checkbox.stories.d.ts.map +1 -0
  47. package/dist/components/Inputs/Controls/Checkbox/Checkbox.stories.js +154 -0
  48. package/dist/components/Inputs/Controls/Radio/Radio.d.ts +8 -0
  49. package/dist/components/Inputs/Controls/Radio/Radio.d.ts.map +1 -0
  50. package/dist/components/Inputs/Controls/Radio/Radio.js +43 -0
  51. package/dist/components/Inputs/Controls/Radio/Radio.stories.d.ts +10 -0
  52. package/dist/components/Inputs/Controls/Radio/Radio.stories.d.ts.map +1 -0
  53. package/dist/components/Inputs/Controls/Radio/Radio.stories.js +143 -0
  54. package/dist/components/Inputs/Controls/RadioList/RadioList.d.ts +16 -0
  55. package/dist/components/Inputs/Controls/RadioList/RadioList.d.ts.map +1 -0
  56. package/dist/components/Inputs/Controls/RadioList/RadioList.js +24 -0
  57. package/dist/components/Inputs/Controls/RadioList/RadioList.stories.d.ts +11 -0
  58. package/dist/components/Inputs/Controls/RadioList/RadioList.stories.d.ts.map +1 -0
  59. package/dist/components/Inputs/Controls/RadioList/RadioList.stories.js +138 -0
  60. package/dist/components/Inputs/Controls/Toggle/Toggle.d.ts +29 -0
  61. package/dist/components/Inputs/Controls/Toggle/Toggle.d.ts.map +1 -0
  62. package/dist/components/Inputs/Controls/Toggle/Toggle.js +40 -0
  63. package/dist/components/Inputs/Controls/Toggle/Toggle.stories.d.ts +11 -0
  64. package/dist/components/Inputs/Controls/Toggle/Toggle.stories.d.ts.map +1 -0
  65. package/dist/components/Inputs/Controls/Toggle/Toggle.stories.js +179 -0
  66. package/dist/components/Inputs/Dates/DatePicker/DatePicker.d.ts +12 -0
  67. package/dist/components/Inputs/Dates/DatePicker/DatePicker.d.ts.map +1 -0
  68. package/dist/components/Inputs/Dates/DatePicker/DatePicker.js +74 -0
  69. package/dist/components/Inputs/Dates/DatePicker/DatePicker.stories.d.ts +12 -0
  70. package/dist/components/Inputs/Dates/DatePicker/DatePicker.stories.d.ts.map +1 -0
  71. package/dist/components/Inputs/Dates/DatePicker/DatePicker.stories.js +203 -0
  72. package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.d.ts +17 -0
  73. package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.d.ts.map +1 -0
  74. package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.js +70 -0
  75. package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.stories.d.ts +14 -0
  76. package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.stories.d.ts.map +1 -0
  77. package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.stories.js +362 -0
  78. package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.d.ts +11 -0
  79. package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.d.ts.map +1 -0
  80. package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.js +48 -0
  81. package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.stories.d.ts +12 -0
  82. package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.stories.d.ts.map +1 -0
  83. package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.stories.js +215 -0
  84. package/dist/components/Inputs/Dropdowns/FontSelect/font-options.d.ts +9 -0
  85. package/dist/components/Inputs/Dropdowns/FontSelect/font-options.d.ts.map +1 -0
  86. package/dist/components/Inputs/Dropdowns/FontSelect/font-options.js +65 -0
  87. package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.d.ts +12 -0
  88. package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.d.ts.map +1 -0
  89. package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.js +94 -0
  90. package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.stories.d.ts +12 -0
  91. package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.stories.d.ts.map +1 -0
  92. package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.stories.js +260 -0
  93. package/dist/components/Inputs/Dropdowns/Select/Select.d.ts +11 -0
  94. package/dist/components/Inputs/Dropdowns/Select/Select.d.ts.map +1 -0
  95. package/dist/components/Inputs/Dropdowns/Select/Select.js +62 -0
  96. package/dist/components/Inputs/Dropdowns/Select/Select.stories.d.ts +12 -0
  97. package/dist/components/Inputs/Dropdowns/Select/Select.stories.d.ts.map +1 -0
  98. package/dist/components/Inputs/Dropdowns/Select/Select.stories.js +242 -0
  99. package/dist/components/Inputs/Sliders/Slider/Slider.d.ts +16 -0
  100. package/dist/components/Inputs/Sliders/Slider/Slider.d.ts.map +1 -0
  101. package/dist/components/Inputs/Sliders/Slider/Slider.js +91 -0
  102. package/dist/components/Inputs/Sliders/VolumeSlider/VolumeSlider.d.ts +6 -0
  103. package/dist/components/Inputs/Sliders/VolumeSlider/VolumeSlider.d.ts.map +1 -0
  104. package/dist/components/Inputs/Sliders/VolumeSlider/VolumeSlider.js +37 -0
  105. package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.d.ts +11 -0
  106. package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.d.ts.map +1 -0
  107. package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.js +57 -0
  108. package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.stories.d.ts +12 -0
  109. package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.stories.d.ts.map +1 -0
  110. package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.stories.js +218 -0
  111. package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.d.ts +12 -0
  112. package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.d.ts.map +1 -0
  113. package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.js +52 -0
  114. package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.stories.d.ts +12 -0
  115. package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.stories.d.ts.map +1 -0
  116. package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.stories.js +235 -0
  117. package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.d.ts +7 -0
  118. package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.d.ts.map +1 -0
  119. package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.js +23 -0
  120. package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.stories.d.ts +12 -0
  121. package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.stories.d.ts.map +1 -0
  122. package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.stories.js +202 -0
  123. package/dist/components/Inputs/TextInputs/TextArea/TextArea.d.ts +12 -0
  124. package/dist/components/Inputs/TextInputs/TextArea/TextArea.d.ts.map +1 -0
  125. package/dist/components/Inputs/TextInputs/TextArea/TextArea.js +33 -0
  126. package/dist/components/Inputs/TextInputs/TextArea/TextArea.stories.d.ts +12 -0
  127. package/dist/components/Inputs/TextInputs/TextArea/TextArea.stories.d.ts.map +1 -0
  128. package/dist/components/Inputs/TextInputs/TextArea/TextArea.stories.js +231 -0
  129. package/dist/components/Inputs/TextInputs/TextInput/TextInput.d.ts +12 -0
  130. package/dist/components/Inputs/TextInputs/TextInput/TextInput.d.ts.map +1 -0
  131. package/dist/components/Inputs/TextInputs/TextInput/TextInput.js +32 -0
  132. package/dist/components/Inputs/TextInputs/TextInput/TextInput.stories.d.ts +12 -0
  133. package/dist/components/Inputs/TextInputs/TextInput/TextInput.stories.d.ts.map +1 -0
  134. package/dist/components/Inputs/TextInputs/TextInput/TextInput.stories.js +219 -0
  135. package/dist/components/Layout/AutoGrid/AutoGrid.d.ts +8 -0
  136. package/dist/components/Layout/AutoGrid/AutoGrid.d.ts.map +1 -0
  137. package/dist/components/Layout/AutoGrid/AutoGrid.js +6 -0
  138. package/dist/components/Layout/Box/Box.d.ts +10 -0
  139. package/dist/components/Layout/Box/Box.d.ts.map +1 -0
  140. package/dist/components/Layout/Box/Box.js +6 -0
  141. package/dist/components/Layout/Box/Box.stories.d.ts +9 -0
  142. package/dist/components/Layout/Box/Box.stories.d.ts.map +1 -0
  143. package/dist/components/Layout/Box/Box.stories.js +121 -0
  144. package/dist/components/Layout/Card/Card.d.ts +8 -0
  145. package/dist/components/Layout/Card/Card.d.ts.map +1 -0
  146. package/dist/components/Layout/Card/Card.js +16 -0
  147. package/dist/components/Layout/Center/Center.d.ts +9 -0
  148. package/dist/components/Layout/Center/Center.d.ts.map +1 -0
  149. package/dist/components/Layout/Center/Center.js +6 -0
  150. package/dist/components/Layout/Divider/Divider.d.ts +10 -0
  151. package/dist/components/Layout/Divider/Divider.d.ts.map +1 -0
  152. package/dist/components/Layout/Divider/Divider.js +7 -0
  153. package/dist/components/Layout/Frame/Frame.d.ts +12 -0
  154. package/dist/components/Layout/Frame/Frame.d.ts.map +1 -0
  155. package/dist/components/Layout/Frame/Frame.js +7 -0
  156. package/dist/components/Layout/Grid/Grid.d.ts +10 -0
  157. package/dist/components/Layout/Grid/Grid.d.ts.map +1 -0
  158. package/dist/components/Layout/Grid/Grid.js +9 -0
  159. package/dist/components/Layout/Group/Group.d.ts +10 -0
  160. package/dist/components/Layout/Group/Group.d.ts.map +1 -0
  161. package/dist/components/Layout/Group/Group.js +6 -0
  162. package/dist/components/Layout/Loader/Loader.d.ts +8 -0
  163. package/dist/components/Layout/Loader/Loader.d.ts.map +1 -0
  164. package/dist/components/Layout/Loader/Loader.js +6 -0
  165. package/dist/components/Layout/SectionCard/SectionCard.d.ts +11 -0
  166. package/dist/components/Layout/SectionCard/SectionCard.d.ts.map +1 -0
  167. package/dist/components/Layout/SectionCard/SectionCard.js +13 -0
  168. package/dist/components/Layout/Stack/Stack.d.ts +10 -0
  169. package/dist/components/Layout/Stack/Stack.d.ts.map +1 -0
  170. package/dist/components/Layout/Stack/Stack.js +6 -0
  171. package/dist/components/Layout/Stack/Stack.stories.d.ts +9 -0
  172. package/dist/components/Layout/Stack/Stack.stories.d.ts.map +1 -0
  173. package/dist/components/Layout/Stack/Stack.stories.js +108 -0
  174. package/dist/components/Layout/Tabs/Tabs.d.ts +17 -0
  175. package/dist/components/Layout/Tabs/Tabs.d.ts.map +1 -0
  176. package/dist/components/Layout/Tabs/Tabs.js +48 -0
  177. package/dist/components/Misc/IconBadge/IconBadge.d.ts +8 -0
  178. package/dist/components/Misc/IconBadge/IconBadge.d.ts.map +1 -0
  179. package/dist/components/Misc/IconBadge/IconBadge.js +28 -0
  180. package/dist/components/Misc/Transition/Transition.d.ts +4 -0
  181. package/dist/components/Misc/Transition/Transition.d.ts.map +1 -0
  182. package/dist/components/Misc/Transition/Transition.js +6 -0
  183. package/dist/components/Typography/CollapsibleText.js +4 -4
  184. package/dist/components/Typography/Formula.d.ts.map +1 -1
  185. package/dist/components/Typography/Formula.js +2 -6
  186. package/dist/components/Typography/Fraction.js +2 -2
  187. package/dist/components/Typography/Text.d.ts.map +1 -1
  188. package/dist/components/Typography/Text.js +0 -2
  189. package/dist/components/index.d.ts +32 -32
  190. package/dist/components/index.d.ts.map +1 -1
  191. package/dist/components/index.js +32 -32
  192. package/dist/constants/index.d.ts +1 -0
  193. package/dist/constants/index.d.ts.map +1 -1
  194. package/dist/constants/index.js +1 -0
  195. package/dist/hooks/useConfirmationModal.d.ts.map +1 -1
  196. package/dist/hooks/useConfirmationModal.js +6 -6
  197. package/dist/hooks/useInfoModal.d.ts.map +1 -1
  198. package/dist/hooks/useInfoModal.js +4 -4
  199. package/dist/utils/index.d.ts +1 -1
  200. package/dist/utils/index.d.ts.map +1 -1
  201. package/dist/utils/index.js +1 -1
  202. package/dist/utils/select.d.ts +1 -0
  203. package/dist/utils/select.d.ts.map +1 -1
  204. package/dist/utils/select.js +18 -0
  205. package/package.json +10 -2
@@ -0,0 +1,179 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Toggle } from './Toggle';
3
+ import { Group } from '../../../Layout/Group/Group';
4
+ const meta = {
5
+ title: 'Components/Inputs/Controls/Toggle',
6
+ component: Toggle,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ argTypes: {
11
+ size: {
12
+ control: { type: 'select' },
13
+ options: ['sm', 'md'],
14
+ description: 'Controls the toggle size and label font size',
15
+ table: {
16
+ type: { summary: "'sm' | 'md'" },
17
+ defaultValue: { summary: "'md'" },
18
+ },
19
+ },
20
+ checked: {
21
+ control: { type: 'boolean' },
22
+ description: 'Controlled checked state',
23
+ table: {
24
+ type: { summary: 'boolean' },
25
+ },
26
+ },
27
+ label: {
28
+ control: { type: 'text' },
29
+ description: 'Toggle label displayed next to the switch',
30
+ table: {
31
+ type: { summary: 'string' },
32
+ },
33
+ },
34
+ description: {
35
+ control: { type: 'text' },
36
+ description: 'Description, displayed after label',
37
+ table: {
38
+ type: { summary: 'ReactNode' },
39
+ },
40
+ },
41
+ error: {
42
+ control: { type: 'text' },
43
+ description: 'Displays error message after input',
44
+ table: {
45
+ type: { summary: 'ReactNode' },
46
+ },
47
+ },
48
+ disabled: {
49
+ control: { type: 'boolean' },
50
+ description: 'Disabled state',
51
+ table: {
52
+ type: { summary: 'boolean' },
53
+ defaultValue: { summary: 'false' },
54
+ },
55
+ },
56
+ labelPosition: {
57
+ control: { type: 'select' },
58
+ options: ['left', 'right'],
59
+ description: 'Position of label',
60
+ table: {
61
+ type: { summary: '"left" | "right"' },
62
+ defaultValue: { summary: '"left"' },
63
+ },
64
+ },
65
+ onLabel: {
66
+ control: { type: 'text' },
67
+ description: 'Inner label when Switch is in checked state',
68
+ table: {
69
+ type: { summary: 'ReactNode' },
70
+ },
71
+ },
72
+ offLabel: {
73
+ control: { type: 'text' },
74
+ description: 'Inner label when Switch is in unchecked state',
75
+ table: {
76
+ type: { summary: 'ReactNode' },
77
+ },
78
+ },
79
+ styles: {
80
+ control: { type: 'object' },
81
+ description: 'Custom styles object',
82
+ table: {
83
+ type: { summary: 'Record<string, CSSObject>' },
84
+ },
85
+ },
86
+ onChange: {
87
+ action: 'changed',
88
+ description: 'Change handler function',
89
+ table: {
90
+ type: { summary: '(event: ChangeEvent<HTMLInputElement>) => void' },
91
+ },
92
+ },
93
+ },
94
+ };
95
+ export default meta;
96
+ export const Default = {
97
+ args: {
98
+ label: 'Enable notifications',
99
+ checked: false,
100
+ size: 'md',
101
+ disabled: false,
102
+ labelPosition: 'left',
103
+ },
104
+ parameters: {
105
+ docs: {
106
+ source: {
107
+ code: `<Toggle
108
+ label="Enable notifications"
109
+ checked={isEnabled}
110
+ onChange={(event) => setIsEnabled(event.currentTarget.checked)}
111
+ />`,
112
+ },
113
+ },
114
+ },
115
+ };
116
+ export const Sizes = {
117
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(Toggle, { size: "sm", label: "Small Toggle", checked: true }), _jsx(Toggle, { size: "md", label: "Medium Toggle (Default)", checked: false })] })),
118
+ parameters: {
119
+ docs: {
120
+ source: {
121
+ code: false,
122
+ },
123
+ },
124
+ },
125
+ };
126
+ export const States = {
127
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(Toggle, { label: "Normal Toggle", checked: true }), _jsx(Toggle, { label: "Disabled Toggle", checked: false, disabled: true }), _jsx(Toggle, { label: "Toggle with Description", description: "This is a description that provides additional context", checked: true }), _jsx(Toggle, { label: "Toggle with Error", error: "This field is required", checked: false })] })),
128
+ parameters: {
129
+ docs: {
130
+ source: {
131
+ code: false,
132
+ },
133
+ },
134
+ },
135
+ };
136
+ export const WithoutLabel = {
137
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(Toggle, { checked: true }), _jsx(Toggle, { checked: false })] })),
138
+ parameters: {
139
+ docs: {
140
+ source: {
141
+ code: false,
142
+ },
143
+ },
144
+ },
145
+ };
146
+ export const CustomStyles = {
147
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(Toggle, { label: "Custom Styled Toggle", checked: true, styles: {
148
+ track: {
149
+ backgroundColor: '#ff6b6b',
150
+ },
151
+ thumb: {
152
+ backgroundColor: '#ffffff',
153
+ border: '2px solid #dee2e6',
154
+ },
155
+ label: {
156
+ fontWeight: 600,
157
+ color: '#495057',
158
+ },
159
+ } }), _jsx(Toggle, { label: "Another Custom Style", checked: false, styles: {
160
+ track: {
161
+ backgroundColor: '#4CAF50',
162
+ },
163
+ thumb: {
164
+ backgroundColor: '#ffffff',
165
+ border: '2px solid #2E7D32',
166
+ },
167
+ label: {
168
+ color: '#4CAF50',
169
+ fontSize: '16px',
170
+ },
171
+ } })] })),
172
+ parameters: {
173
+ docs: {
174
+ source: {
175
+ code: false,
176
+ },
177
+ },
178
+ },
179
+ };
@@ -0,0 +1,12 @@
1
+ import { DatePickerInputProps as MantineDatePickerInputProps } from '@mantine/dates';
2
+ import { CSSObject } from '@mantine/styles';
3
+ import { componentSizes } from '../../Dropdowns/shared/sizes';
4
+ export interface DatePickerProps<T extends 'default' | 'multiple' | 'range' = 'default'> extends Omit<MantineDatePickerInputProps<T>, 'styles'> {
5
+ size?: keyof typeof componentSizes;
6
+ width?: string | number;
7
+ fullWidth?: boolean;
8
+ styles?: Record<string, CSSObject>;
9
+ showIcon?: boolean;
10
+ }
11
+ export declare const DatePicker: <T extends "default" | "multiple" | "range" = "default">({ size, width, fullWidth, placeholder, showIcon, styles, ...props }: DatePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=DatePicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Dates/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6C,oBAAoB,IAAI,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAEhI,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAE,SAAQ,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;IAC7I,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,EAAE,qEAQhF,eAAe,CAAC,CAAC,CAAC,4CA+EpB,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DatePickerInput as MantineDatePickerInput } from '@mantine/dates';
3
+ import { createStyles } from '@mantine/core';
4
+ import { neutral } from '../../../../constants/colors';
5
+ import { fontBase } from '../../../../constants/font';
6
+ import { componentSizes } from '../../Dropdowns/shared/sizes';
7
+ export const DatePicker = ({ size = 'md', width, fullWidth = false, placeholder = 'Pick Date', showIcon = true, styles, ...props }) => {
8
+ const selectedSize = componentSizes[size];
9
+ const { classes } = createStyles(() => ({
10
+ root: {
11
+ width: fullWidth ? '100%' : width || (props.type === 'range' ? `${selectedSize.minWidth * 1.2}rem` : `${selectedSize.minWidth}rem`), // Range inputs are slightly wider than regular inputs
12
+ },
13
+ input: {
14
+ height: `${selectedSize.height}rem`,
15
+ paddingRight: selectedSize.inputPadding,
16
+ ...fontBase,
17
+ fontSize: selectedSize.fontSize,
18
+ color: neutral[300],
19
+ borderRadius: '8px',
20
+ border: `1px solid ${neutral[100]}`,
21
+ transition: 'all 200ms ease-in-out',
22
+ whiteSpace: 'nowrap',
23
+ overflow: 'hidden',
24
+ textOverflow: 'ellipsis',
25
+ },
26
+ placeholder: {
27
+ ...fontBase,
28
+ fontSize: selectedSize.fontSize,
29
+ color: neutral[200],
30
+ },
31
+ label: {
32
+ ...fontBase,
33
+ fontSize: `calc(${selectedSize.fontSize} - 0.1rem)`,
34
+ color: neutral[200],
35
+ },
36
+ calendar: {
37
+ '& .mantine-UnstyledButton-root': {
38
+ borderRadius: '8px',
39
+ fontFamily: 'Poppins, sans-serif',
40
+ },
41
+ '& .mantine-Day-day': {
42
+ borderRadius: '50%',
43
+ },
44
+ '& .mantine-Day-day[data-selected="true"]': {
45
+ fontFamily: 'Poppins, sans-serif',
46
+ borderRadius: '50%',
47
+ },
48
+ '& .mantine-Day-day[data-in-range="true"]': {
49
+ fontFamily: 'Poppins, sans-serif',
50
+ borderRadius: '50%',
51
+ },
52
+ '& .mantine-Day-day[data-first-in-range="true"]': {
53
+ fontFamily: 'Poppins, sans-serif',
54
+ borderRadius: '50%',
55
+ },
56
+ '& .mantine-Day-day[data-last-in-range="true"]': {
57
+ fontFamily: 'Poppins, sans-serif',
58
+ borderRadius: '50%',
59
+ },
60
+ '& .mantine-WeekdaysRow-weekday': {
61
+ textAlign: 'center',
62
+ fontFamily: 'Poppins, sans-serif',
63
+ },
64
+ },
65
+ ...styles,
66
+ }))();
67
+ return (_jsx(MantineDatePickerInput, { icon: showIcon ? _jsx("i", { className: "far fa-calendar", style: { fontSize: 14, marginLeft: '0.25rem' } }) : undefined, radius: "lg", size: "xl", classNames: {
68
+ root: classes.root,
69
+ input: classes.input,
70
+ placeholder: classes.placeholder,
71
+ label: classes.label,
72
+ calendar: classes.calendar,
73
+ }, placeholder: placeholder, popoverProps: { radius: 'lg' }, ...props }));
74
+ };
@@ -0,0 +1,12 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { DatePicker } from './DatePicker';
3
+ declare const meta: Meta<typeof DatePicker>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Sizes: Story;
8
+ export declare const States: Story;
9
+ export declare const WithAndWithoutIcon: Story;
10
+ export declare const FullWidth: Story;
11
+ export declare const CustomStyles: Story;
12
+ //# sourceMappingURL=DatePicker.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Dates/DatePicker/DatePicker.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAmGjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KA2BrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAenB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAiBpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAchC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAavB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KA+C1B,CAAC"}
@@ -0,0 +1,203 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DatePicker } from './DatePicker';
3
+ import { Group } from '../../../Layout/Group/Group';
4
+ const meta = {
5
+ title: 'Components/Inputs/Dates/DatePicker',
6
+ component: DatePicker,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ argTypes: {
11
+ size: {
12
+ control: { type: 'select' },
13
+ options: ['sm', 'md', 'lg'],
14
+ description: 'Controls the date picker size',
15
+ table: {
16
+ type: { summary: "'sm' | 'md' | 'lg'" },
17
+ defaultValue: { summary: "'md'" },
18
+ },
19
+ },
20
+ placeholder: {
21
+ control: { type: 'text' },
22
+ description: 'Placeholder text',
23
+ table: {
24
+ type: { summary: 'string' },
25
+ defaultValue: { summary: "'Pick a date'" },
26
+ },
27
+ },
28
+ label: {
29
+ control: { type: 'text' },
30
+ description: 'Date picker label',
31
+ table: {
32
+ type: { summary: 'string' },
33
+ },
34
+ },
35
+ description: {
36
+ control: { type: 'text' },
37
+ description: 'Description text',
38
+ table: {
39
+ type: { summary: 'string' },
40
+ },
41
+ },
42
+ error: {
43
+ control: { type: 'text' },
44
+ description: 'Error message',
45
+ table: {
46
+ type: { summary: 'string' },
47
+ },
48
+ },
49
+ disabled: {
50
+ control: { type: 'boolean' },
51
+ description: 'Disabled state',
52
+ table: {
53
+ type: { summary: 'boolean' },
54
+ defaultValue: { summary: 'false' },
55
+ },
56
+ },
57
+ required: {
58
+ control: { type: 'boolean' },
59
+ description: 'Required field',
60
+ table: {
61
+ type: { summary: 'boolean' },
62
+ defaultValue: { summary: 'false' },
63
+ },
64
+ },
65
+ fullWidth: {
66
+ control: { type: 'boolean' },
67
+ description: 'Full width of container',
68
+ table: {
69
+ type: { summary: 'boolean' },
70
+ defaultValue: { summary: 'false' },
71
+ },
72
+ },
73
+ showIcon: {
74
+ control: { type: 'boolean' },
75
+ description: 'Show calendar icon',
76
+ table: {
77
+ type: { summary: 'boolean' },
78
+ defaultValue: { summary: 'true' },
79
+ },
80
+ },
81
+ width: {
82
+ control: { type: 'text' },
83
+ description: 'Custom width',
84
+ table: {
85
+ type: { summary: 'string | number' },
86
+ },
87
+ },
88
+ styles: {
89
+ control: { type: 'object' },
90
+ description: 'Custom styles object',
91
+ table: {
92
+ type: { summary: 'Record<string, CSSObject>' },
93
+ },
94
+ },
95
+ onChange: {
96
+ action: 'changed',
97
+ description: 'Change handler function',
98
+ table: {
99
+ type: { summary: '(value: Date | null) => void' },
100
+ },
101
+ },
102
+ },
103
+ };
104
+ export default meta;
105
+ export const Default = {
106
+ args: {
107
+ placeholder: 'Pick Date',
108
+ size: 'md',
109
+ disabled: false,
110
+ required: false,
111
+ fullWidth: false,
112
+ showIcon: true,
113
+ },
114
+ decorators: [
115
+ (Story) => (_jsx("div", { style: { height: '220px' }, children: _jsx(Story, {}) })),
116
+ ],
117
+ parameters: {
118
+ docs: {
119
+ source: {
120
+ code: `<DatePicker
121
+ placeholder="Pick Date"
122
+ value={selectedDate}
123
+ onChange={(value) => setSelectedDate(value)}
124
+ />`,
125
+ },
126
+ },
127
+ },
128
+ };
129
+ export const Sizes = {
130
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(DatePicker, { size: "sm" }), _jsx(DatePicker, {}), _jsx(DatePicker, { size: "lg" })] })),
131
+ parameters: {
132
+ docs: {
133
+ source: {
134
+ code: false,
135
+ },
136
+ },
137
+ },
138
+ };
139
+ export const States = {
140
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(DatePicker, { label: "Normal DatePicker" }), _jsx(DatePicker, { label: "Disabled DatePicker", disabled: true }), _jsx(DatePicker, { label: "Required DatePicker", required: true }), _jsx(DatePicker, { label: "DatePicker with Description", description: "Please select your preferred date" }), _jsx(DatePicker, { label: "DatePicker with Error", error: "This field is required" })] })),
141
+ parameters: {
142
+ docs: {
143
+ source: {
144
+ code: false,
145
+ },
146
+ },
147
+ },
148
+ };
149
+ export const WithAndWithoutIcon = {
150
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(DatePicker, { label: "With Icon", placeholder: "Select date", showIcon: true }), _jsx(DatePicker, { label: "Without Icon", placeholder: "Select date", showIcon: false })] })),
151
+ parameters: {
152
+ docs: {
153
+ source: {
154
+ code: false,
155
+ },
156
+ },
157
+ },
158
+ };
159
+ export const FullWidth = {
160
+ render: () => (_jsx("div", { style: { width: '400px' }, children: _jsx(DatePicker, { label: "Full Width DatePicker", placeholder: "Select date", fullWidth: true }) })),
161
+ parameters: {
162
+ docs: {
163
+ source: {
164
+ code: false,
165
+ },
166
+ },
167
+ },
168
+ };
169
+ export const CustomStyles = {
170
+ render: () => (_jsxs(Group, { gap: "2rem", children: [_jsx(DatePicker, { label: "Custom Styled DatePicker", placeholder: "Select date", styles: {
171
+ input: {
172
+ borderColor: '#ff6b6b',
173
+ '&:focus': {
174
+ borderColor: '#ff6b6b',
175
+ boxShadow: '0 0 0 2px rgba(255, 107, 107, 0.2)',
176
+ },
177
+ },
178
+ label: {
179
+ color: '#ff6b6b',
180
+ fontWeight: 600,
181
+ },
182
+ } }), _jsx(DatePicker, { label: "Another Custom Style", placeholder: "Select date", styles: {
183
+ input: {
184
+ backgroundColor: '#f8f9fa',
185
+ borderColor: '#4CAF50',
186
+ '&:focus': {
187
+ borderColor: '#4CAF50',
188
+ boxShadow: '0 0 0 2px rgba(76, 175, 80, 0.2)',
189
+ },
190
+ },
191
+ label: {
192
+ color: '#4CAF50',
193
+ fontSize: '16px',
194
+ },
195
+ } })] })),
196
+ parameters: {
197
+ docs: {
198
+ source: {
199
+ code: false,
200
+ },
201
+ },
202
+ },
203
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { SelectProps } from '../Select/Select';
3
+ import { SelectOption } from '../../../../utils/select';
4
+ export type CascadingSelectItemProps = {
5
+ option: SelectOption;
6
+ icon?: React.ReactNode;
7
+ children?: CascadingSelectItemProps[];
8
+ };
9
+ export interface CascadingSelectProps extends Omit<SelectProps, 'value' | 'data'> {
10
+ data?: CascadingSelectItemProps[];
11
+ value?: string | null;
12
+ width?: string | number;
13
+ fullWidth?: boolean;
14
+ }
15
+ declare const CascadingSelect: ({ data, value, placeholder, size, width, fullWidth, styles, ...props }: CascadingSelectProps) => import("react/jsx-runtime").JSX.Element;
16
+ export { CascadingSelect };
17
+ //# sourceMappingURL=CascadingSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CascadingSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAU,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACvC,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/E,IAAI,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,GAAI,wEAAiH,oBAAoB,4CA+E7J,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Group } from '@mantine/core';
3
+ import { neutral } from '../../../../constants/colors';
4
+ import { componentSizes } from '../shared/sizes';
5
+ import { Select } from '../Select/Select';
6
+ import { Text } from '../../../Typography/Text';
7
+ import { fontBase } from '../../../../constants/font';
8
+ const CascadingSelect = ({ data = [], value, placeholder = 'Select an option', size = 'md', width, fullWidth = false, styles, ...props }) => {
9
+ const selectedSize = componentSizes[size];
10
+ const computedWidth = fullWidth ? '100%' : width || `${selectedSize.minWidth}rem`;
11
+ // Flatten the hierarchy into a flat array with depth information
12
+ const flattenHierarchy = (items, depth = 0) => {
13
+ const result = [];
14
+ items.forEach((item) => {
15
+ result.push({ ...item.option, depth, icon: item.icon });
16
+ if (item.children && item.children.length > 0) {
17
+ result.push(...flattenHierarchy(item.children, depth + 1));
18
+ }
19
+ });
20
+ return result;
21
+ };
22
+ const flattenedData = flattenHierarchy(data);
23
+ const DropdownItem = ({ value, label, icon, depth, ...others }) => {
24
+ const indentLevel = depth * 0.8;
25
+ return (_jsx(Box, { sx: {
26
+ display: 'flex',
27
+ alignItems: 'center',
28
+ padding: selectedSize.dropdownPadding,
29
+ borderRadius: '8px',
30
+ transition: 'background-color 200ms ease-in-out',
31
+ cursor: 'pointer',
32
+ }, ...others, children: _jsxs(Group, { spacing: "0.5rem", sx: { marginLeft: `${indentLevel}rem` }, children: [icon && _jsx(Box, { sx: { display: 'flex', alignItems: 'center', color: neutral[200], fontSize: selectedSize.fontSize }, children: icon }), _jsx(Text, { style: { ...fontBase, color: neutral[200], fontSize: selectedSize.fontSize }, children: label })] }) }));
33
+ };
34
+ const style = {
35
+ input: {
36
+ color: neutral[300],
37
+ border: `1px solid ${neutral[100]}`,
38
+ borderRadius: '8px',
39
+ transition: 'all 200ms ease-in-out',
40
+ height: `${selectedSize.height}rem`,
41
+ ...fontBase,
42
+ fontSize: selectedSize.fontSize,
43
+ padding: selectedSize.inputPadding,
44
+ },
45
+ item: {
46
+ color: neutral[200],
47
+ borderRadius: '8px',
48
+ transition: 'background-color 200ms ease-in-out',
49
+ padding: 0,
50
+ fontSize: selectedSize.fontSize,
51
+ marginBottom: '0.2rem',
52
+ '&[data-selected]': {
53
+ backgroundColor: neutral[50],
54
+ color: neutral[200],
55
+ },
56
+ '&[data-hovered]': {
57
+ backgroundColor: neutral[50],
58
+ },
59
+ '&:not(:hover):not([data-selected])': {
60
+ backgroundColor: 'white',
61
+ },
62
+ '&[data-selected]:hover': {
63
+ backgroundColor: neutral[50],
64
+ },
65
+ ...styles,
66
+ },
67
+ };
68
+ return _jsx(Select, { placeholder: placeholder, width: computedWidth, value: value, size: size, styles: style, itemComponent: DropdownItem, data: flattenedData, ...props });
69
+ };
70
+ export { CascadingSelect };
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { CascadingSelect } from './CascadingSelect';
3
+ declare const meta: Meta<typeof CascadingSelect>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Sizes: Story;
8
+ export declare const WithIcons: Story;
9
+ export declare const States: Story;
10
+ export declare const WithFeatures: Story;
11
+ export declare const FullWidth: Story;
12
+ export declare const DeepHierarchy: Story;
13
+ export declare const CustomStyles: Story;
14
+ //# sourceMappingURL=CascadingSelect.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CascadingSelect.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,eAAe,CA2GtC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAgFnC,eAAO,MAAM,OAAO,EAAE,KA4CrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAenB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAcvB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAiBpB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAc1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAavB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAgD3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAiD1B,CAAC"}