@xjur-ui/react 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/.turbo/turbo-build.log +63 -57
  2. package/CHANGELOG.md +18 -0
  3. package/dist/components/avatar.d.ts +11 -0
  4. package/dist/components/avatar.js +58 -0
  5. package/dist/components/badge.d.ts +13 -0
  6. package/dist/components/{ui/input/message.js → badge.js} +30 -47
  7. package/dist/components/{ui/button.d.ts → button.d.ts} +2 -2
  8. package/dist/components/{ui/button.js → button.js} +9 -6
  9. package/dist/components/calendar.d.ts +11 -0
  10. package/dist/components/calendar.js +751 -0
  11. package/dist/components/checkbox.d.ts +8 -0
  12. package/dist/components/{ui/input/root.js → checkbox.js} +69 -79
  13. package/dist/components/chip.d.ts +24 -0
  14. package/dist/components/chip.js +255 -0
  15. package/dist/components/collapsible.d.ts +8 -0
  16. package/dist/components/collapsible.js +41 -0
  17. package/dist/components/date-picker.d.ts +20 -0
  18. package/dist/components/date-picker.js +232 -0
  19. package/dist/components/divider.d.ts +7 -0
  20. package/dist/components/divider.js +28 -0
  21. package/dist/components/dropdown-menu.d.ts +22 -0
  22. package/dist/components/dropdown-menu.js +294 -0
  23. package/dist/components/{resources/icons.d.ts → icon.d.ts} +11 -2
  24. package/dist/components/{ui/icon.js → icon.js} +20 -5
  25. package/dist/components/input.d.ts +32 -0
  26. package/dist/components/input.js +315 -0
  27. package/dist/components/list.d.ts +25 -0
  28. package/dist/components/{ui/input/content.js → list.js} +83 -87
  29. package/dist/components/{ui/logo.d.ts → logo.d.ts} +2 -2
  30. package/dist/components/{ui/logo.js → logo.js} +5 -5
  31. package/dist/components/{ui/otp-input.js → otp-input.js} +1 -1
  32. package/dist/components/radio.d.ts +10 -0
  33. package/dist/components/{ui/input/label.js → radio.js} +68 -77
  34. package/dist/components/search-input.d.ts +17 -0
  35. package/dist/components/search-input.js +274 -0
  36. package/dist/components/select.d.ts +33 -0
  37. package/dist/components/select.js +550 -0
  38. package/dist/components/sheet.d.ts +19 -0
  39. package/dist/components/sheet.js +251 -0
  40. package/dist/components/switch.d.ts +7 -0
  41. package/dist/components/switch.js +36 -0
  42. package/dist/components/tabs.d.ts +11 -0
  43. package/dist/components/tabs.js +54 -0
  44. package/dist/components/tag.d.ts +18 -0
  45. package/dist/components/tag.js +189 -0
  46. package/dist/components/{ui/typography.d.ts → typography.d.ts} +4 -4
  47. package/dist/components/{ui/typography.js → typography.js} +1 -1
  48. package/dist/index.css +1233 -62
  49. package/dist/index.d.ts +2 -17
  50. package/dist/index.js +0 -788
  51. package/eslint.config.js +8 -1
  52. package/package.json +41 -10
  53. package/src/components/avatar.tsx +53 -0
  54. package/src/components/badge.tsx +40 -0
  55. package/src/components/{ui/button.tsx → button.tsx} +7 -5
  56. package/src/components/calendar.tsx +123 -0
  57. package/src/components/checkbox.tsx +57 -0
  58. package/src/components/chip.tsx +109 -0
  59. package/src/components/collapsible.tsx +35 -0
  60. package/src/components/date-picker.tsx +160 -0
  61. package/src/components/divider.tsx +23 -0
  62. package/src/components/dropdown-menu.tsx +101 -0
  63. package/src/components/{ui/icon.tsx → icon.tsx} +1 -1
  64. package/src/components/input.tsx +256 -0
  65. package/src/components/list.tsx +111 -0
  66. package/src/components/radio.tsx +74 -0
  67. package/src/components/search-input.tsx +112 -0
  68. package/src/components/select.tsx +240 -0
  69. package/src/components/sheet.tsx +141 -0
  70. package/src/components/switch.tsx +31 -0
  71. package/src/components/tabs.tsx +53 -0
  72. package/src/components/tag.tsx +91 -0
  73. package/src/index.css +4 -1
  74. package/src/index.ts +0 -1
  75. package/src/{components/resources → resources}/icons.ts +16 -1
  76. package/src/resources/input-mask.ts +91 -0
  77. package/dist/components/resources/icons.js +0 -133
  78. package/dist/components/resources/logo/horizontal.d.ts +0 -12
  79. package/dist/components/resources/logo/horizontal.js +0 -107
  80. package/dist/components/resources/logo/icon.d.ts +0 -12
  81. package/dist/components/resources/logo/icon.js +0 -79
  82. package/dist/components/resources/logo/index.d.ts +0 -4
  83. package/dist/components/resources/logo/index.js +0 -291
  84. package/dist/components/resources/logo/vertical.d.ts +0 -12
  85. package/dist/components/resources/logo/vertical.js +0 -107
  86. package/dist/components/ui/accordion.d.ts +0 -5
  87. package/dist/components/ui/accordion.js +0 -8
  88. package/dist/components/ui/icon.d.ts +0 -12
  89. package/dist/components/ui/index.d.ts +0 -17
  90. package/dist/components/ui/index.js +0 -788
  91. package/dist/components/ui/input/content.d.ts +0 -9
  92. package/dist/components/ui/input/index.d.ts +0 -12
  93. package/dist/components/ui/input/index.js +0 -335
  94. package/dist/components/ui/input/label.d.ts +0 -12
  95. package/dist/components/ui/input/message.d.ts +0 -10
  96. package/dist/components/ui/input/root.d.ts +0 -18
  97. package/dist/components/ui/input/slot.d.ts +0 -10
  98. package/dist/components/ui/input/slot.js +0 -20
  99. package/dist/components/ui/input/text.d.ts +0 -10
  100. package/dist/components/ui/input/text.js +0 -195
  101. package/src/components/ui/accordion.tsx +0 -3
  102. package/src/components/ui/index.ts +0 -13
  103. package/src/components/ui/input/content.tsx +0 -59
  104. package/src/components/ui/input/index.ts +0 -6
  105. package/src/components/ui/input/label.tsx +0 -41
  106. package/src/components/ui/input/message.tsx +0 -37
  107. package/src/components/ui/input/root.tsx +0 -57
  108. package/src/components/ui/input/slot.tsx +0 -21
  109. package/src/components/ui/input/text.tsx +0 -69
  110. /package/dist/components/{ui/otp-input.d.ts → otp-input.d.ts} +0 -0
  111. /package/src/components/{ui/logo.tsx → logo.tsx} +0 -0
  112. /package/src/components/{ui/otp-input.tsx → otp-input.tsx} +0 -0
  113. /package/src/components/{ui/typography.tsx → typography.tsx} +0 -0
  114. /package/src/{components/resources → resources}/logo/horizontal.tsx +0 -0
  115. /package/src/{components/resources → resources}/logo/icon.tsx +0 -0
  116. /package/src/{components/resources → resources}/logo/index.ts +0 -0
  117. /package/src/{components/resources → resources}/logo/vertical.tsx +0 -0
@@ -1,9 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ComponentProps } from 'react';
3
-
4
- type InputContentProps = ComponentProps<'div'> & {
5
- children: ComponentProps<'div'>['children'];
6
- };
7
- declare function InputContent({ className, children, ...props }: InputContentProps): react_jsx_runtime.JSX.Element;
8
-
9
- export { InputContent, type InputContentProps };
@@ -1,12 +0,0 @@
1
- export { InputRoot, InputRootContext, InputRootProps, useInput } from './root.js';
2
- export { InputText, InputTextProps } from './text.js';
3
- export { InputContent, InputContentProps } from './content.js';
4
- export { InputSlot, InputSlotProps } from './slot.js';
5
- export { InputMessage, InputMessageProps } from './message.js';
6
- export { InputLabel, InputLabelProps } from './label.js';
7
- import 'react/jsx-runtime';
8
- import 'react';
9
- import '@react-input/mask';
10
- import '../typography.js';
11
- import 'class-variance-authority/types';
12
- import '@xjur-ui/util';
@@ -1,335 +0,0 @@
1
- // src/components/ui/input/root.tsx
2
- import { createContext, use } from "react";
3
- import { cx as cx2 } from "@xjur-ui/util";
4
-
5
- // src/components/ui/input/message.tsx
6
- import { memo as memo2 } from "react";
7
- import { cx } from "@xjur-ui/util";
8
-
9
- // src/components/ui/typography.tsx
10
- import { Slot } from "@radix-ui/react-slot";
11
- import { cva } from "@xjur-ui/util";
12
- import { memo } from "react";
13
- import { jsx } from "react/jsx-runtime";
14
- var typographyVariants = cva("", {
15
- variants: {
16
- variant: {
17
- body: "",
18
- label: "",
19
- title: "",
20
- headline: ""
21
- },
22
- size: {
23
- "sm-2x": "",
24
- "sm-1x": "",
25
- sm: "",
26
- md: "",
27
- lg: ""
28
- },
29
- weight: {
30
- thin: "font-thin",
31
- extraLight: "font-extralight",
32
- light: "font-light",
33
- normal: "font-normal",
34
- medium: "font-medium",
35
- semibold: "font-semibold",
36
- bold: "font-bold",
37
- extraBold: "font-extrabold",
38
- black: "font-black"
39
- }
40
- },
41
- compoundVariants: [
42
- { variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
43
- { variant: "body", size: "sm", class: "text-size-body-sm" },
44
- { variant: "body", size: "md", class: "text-size-body-md" },
45
- { variant: "body", size: "lg", class: "text-size-body-lg" },
46
- { variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
47
- { variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
48
- { variant: "label", size: "sm", class: "text-size-label-sm" },
49
- { variant: "label", size: "md", class: "text-size-label-md" },
50
- { variant: "label", size: "lg", class: "text-size-label-lg" },
51
- { variant: "title", size: "sm", class: "text-size-title-sm" },
52
- { variant: "title", size: "md", class: "text-size-title-md" },
53
- { variant: "title", size: "lg", class: "text-size-title-lg" },
54
- { variant: "headline", size: "sm", class: "text-size-headline-sm" },
55
- { variant: "headline", size: "md", class: "text-size-headline-md" },
56
- { variant: "headline", size: "lg", class: "text-size-headline-lg" }
57
- ],
58
- defaultVariants: {
59
- variant: "body",
60
- size: "md",
61
- weight: "normal"
62
- }
63
- });
64
- var Typography = memo(
65
- ({
66
- variant,
67
- size,
68
- weight,
69
- asChild,
70
- className,
71
- ...props
72
- }) => {
73
- const Component = asChild ? Slot : "span";
74
- return /* @__PURE__ */ jsx(
75
- Component,
76
- {
77
- className: typographyVariants({ variant, size, weight, className }),
78
- ...props
79
- }
80
- );
81
- }
82
- );
83
- Typography.displayName = "Typography";
84
-
85
- // src/components/ui/input/message.tsx
86
- import { jsx as jsx2 } from "react/jsx-runtime";
87
- var InputMessage = memo2(
88
- ({
89
- children,
90
- className,
91
- weight = "normal",
92
- variant = "body",
93
- size = "sm-1x",
94
- ...props
95
- }) => {
96
- const { errorMessage } = useInput();
97
- return /* @__PURE__ */ jsx2(
98
- Typography,
99
- {
100
- className: cx(
101
- "text-neutral-dark data-[error=true]:text-danger-idle",
102
- className
103
- ),
104
- "data-error": !!errorMessage,
105
- size,
106
- variant,
107
- weight,
108
- ...props,
109
- children
110
- }
111
- );
112
- }
113
- );
114
- InputMessage.displayName = "InputMessage";
115
-
116
- // src/components/ui/input/root.tsx
117
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
118
- var InputRootContext = createContext({});
119
- function useInput() {
120
- const context = use(InputRootContext);
121
- if (!context) {
122
- throw new Error(
123
- "useInput must be called within <Input.Root> or <Select.Root>"
124
- );
125
- }
126
- return context;
127
- }
128
- function InputRoot({
129
- children,
130
- className,
131
- errorMessage,
132
- size = "lg",
133
- rounded = false,
134
- disabled,
135
- ...props
136
- }) {
137
- return /* @__PURE__ */ jsx3(
138
- InputRootContext.Provider,
139
- {
140
- value: { errorMessage, disabled, size, rounded },
141
- children: /* @__PURE__ */ jsxs(
142
- "div",
143
- {
144
- ...props,
145
- className: cx2(
146
- "group gap-small relative flex flex-col data-[disabled=true]:opacity-60",
147
- className
148
- ),
149
- "data-disabled": disabled,
150
- children: [
151
- children,
152
- errorMessage && /* @__PURE__ */ jsx3(InputMessage, { children: errorMessage })
153
- ]
154
- }
155
- )
156
- }
157
- );
158
- }
159
-
160
- // src/components/ui/input/text.tsx
161
- import { InputMask } from "@react-input/mask";
162
- import { useCallback, useEffect, useRef } from "react";
163
- import { cx as cx3 } from "@xjur-ui/util";
164
- import { jsx as jsx4 } from "react/jsx-runtime";
165
- function InputText({
166
- className,
167
- value,
168
- mask,
169
- ...props
170
- }) {
171
- const { errorMessage } = useInput();
172
- const inputRef = useRef(null);
173
- const InputComponent = mask ? InputMask : "input";
174
- const onCheckInputFilled = useCallback(
175
- ({ shouldUnfill = false }) => {
176
- if (inputRef.current) {
177
- if (shouldUnfill) inputRef.current.dataset.filled = "false";
178
- else {
179
- const hasNotErrorAndHasValue = !errorMessage && !!inputRef.current.value;
180
- inputRef.current.dataset.filled = String(hasNotErrorAndHasValue);
181
- }
182
- }
183
- },
184
- [errorMessage]
185
- );
186
- function setRef(ref) {
187
- inputRef.current = ref;
188
- if (typeof props.ref === "function") {
189
- props.ref(ref);
190
- }
191
- }
192
- useEffect(() => {
193
- onCheckInputFilled({ shouldUnfill: false });
194
- }, [onCheckInputFilled]);
195
- return /* @__PURE__ */ jsx4(
196
- InputComponent,
197
- {
198
- ...props,
199
- ...mask && { ...mask },
200
- className: cx3(
201
- "h-full w-full bg-transparent",
202
- "border-hidden outline-hidden",
203
- "placeholder:text-placeholder-neutral font-normal",
204
- "text-neutral-dark text-size-body-md overflow-hidden text-ellipsis",
205
- className
206
- ),
207
- "data-filled": !!value && !errorMessage,
208
- readOnly: props.readOnly !== void 0 && props.readOnly,
209
- ref: setRef,
210
- value,
211
- onBlur: (event) => {
212
- props.onBlur?.(event);
213
- onCheckInputFilled({ shouldUnfill: false });
214
- },
215
- onFocus: (event) => {
216
- props.onFocus?.(event);
217
- onCheckInputFilled({ shouldUnfill: true });
218
- }
219
- }
220
- );
221
- }
222
-
223
- // src/components/ui/input/content.tsx
224
- import { cx as cx4, cva as cva2 } from "@xjur-ui/util";
225
- import { jsx as jsx5 } from "react/jsx-runtime";
226
- var variants = cva2(
227
- [
228
- "flex items-center gap-small py-small_1x-alt px-small",
229
- "border-1 border-border-layer-2",
230
- "bg-layer-2-idle",
231
- "group-hover:border-border-layer-3",
232
- "transition-[border-color] duration-100 ease",
233
- "data-[disabled=true]:pointer-events-none",
234
- "has-[input[data-filled=true]]:bg-layer-2-hover"
235
- ],
236
- {
237
- variants: {
238
- isError: {
239
- true: "border-1 border-danger-idle focus-within:border-danger-idle focus-within:shadow-focus-danger group-hover:border-danger-idle",
240
- false: "focus-within:border-primary-idle focus-within:shadow-focus-primary"
241
- },
242
- rounded: {
243
- true: "rounded-circle",
244
- false: "rounded-small-1x"
245
- }
246
- },
247
- defaultVariants: {
248
- rounded: false
249
- }
250
- }
251
- );
252
- function InputContent({
253
- className,
254
- children,
255
- ...props
256
- }) {
257
- const { errorMessage, rounded, disabled } = useInput();
258
- const classNames = variants({
259
- className,
260
- isError: !!errorMessage,
261
- rounded
262
- });
263
- return /* @__PURE__ */ jsx5(
264
- "div",
265
- {
266
- ...props,
267
- className: cx4("group", classNames),
268
- "data-disabled": disabled,
269
- children
270
- }
271
- );
272
- }
273
-
274
- // src/components/ui/input/slot.tsx
275
- import { memo as memo3 } from "react";
276
- import { cx as cx5 } from "@xjur-ui/util";
277
- import { jsx as jsx6 } from "react/jsx-runtime";
278
- var InputSlot = memo3(
279
- ({ children, className, ...props }) => {
280
- return /* @__PURE__ */ jsx6(
281
- "label",
282
- {
283
- ...props,
284
- className: cx5("flex items-center justify-center", className),
285
- children
286
- }
287
- );
288
- }
289
- );
290
- InputSlot.displayName = "InputSlot";
291
-
292
- // src/components/ui/input/label.tsx
293
- import { memo as memo4 } from "react";
294
- import { cx as cx6 } from "@xjur-ui/util";
295
- import { jsx as jsx7 } from "react/jsx-runtime";
296
- var InputLabel = memo4(
297
- ({
298
- children,
299
- htmlFor,
300
- variant = "label",
301
- weight = "medium",
302
- size = "sm",
303
- className,
304
- ...props
305
- }) => {
306
- const { errorMessage } = useInput();
307
- return /* @__PURE__ */ jsx7(
308
- Typography,
309
- {
310
- asChild: true,
311
- className: cx6(
312
- "text-title-neutral data-[error=true]:text-danger-label-active w-fit",
313
- className
314
- ),
315
- "data-error": !!errorMessage,
316
- size,
317
- variant,
318
- weight,
319
- ...props,
320
- children: /* @__PURE__ */ jsx7("label", { htmlFor, children })
321
- }
322
- );
323
- }
324
- );
325
- InputLabel.displayName = "InputLabel";
326
- export {
327
- InputContent,
328
- InputLabel,
329
- InputMessage,
330
- InputRoot,
331
- InputRootContext,
332
- InputSlot,
333
- InputText,
334
- useInput
335
- };
@@ -1,12 +0,0 @@
1
- import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { TypographyProps } from '../typography.js';
4
- import 'class-variance-authority/types';
5
- import '@xjur-ui/util';
6
-
7
- type InputLabelProps = TypographyProps & {
8
- htmlFor?: string;
9
- };
10
- declare const InputLabel: react.MemoExoticComponent<({ children, htmlFor, variant, weight, size, className, ...props }: InputLabelProps) => react_jsx_runtime.JSX.Element>;
11
-
12
- export { InputLabel, type InputLabelProps };
@@ -1,10 +0,0 @@
1
- import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { TypographyProps } from '../typography.js';
4
- import 'class-variance-authority/types';
5
- import '@xjur-ui/util';
6
-
7
- type InputMessageProps = TypographyProps;
8
- declare const InputMessage: react.MemoExoticComponent<({ children, className, weight, variant, size, ...props }: InputMessageProps) => react_jsx_runtime.JSX.Element>;
9
-
10
- export { InputMessage, type InputMessageProps };
@@ -1,18 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import { ComponentProps } from 'react';
4
-
5
- declare const InputRootContext: react.Context<InputRoot>;
6
- declare function useInput(): InputRoot;
7
- type InputRootProps = ComponentProps<'div'> & {
8
- children: ComponentProps<'div'>['children'];
9
- } & InputRoot;
10
- type InputRoot = {
11
- size?: 'md' | 'lg';
12
- rounded?: boolean;
13
- errorMessage?: string;
14
- disabled?: boolean;
15
- };
16
- declare function InputRoot({ children, className, errorMessage, size, rounded, disabled, ...props }: InputRootProps): react_jsx_runtime.JSX.Element;
17
-
18
- export { InputRoot, InputRootContext, type InputRootProps, useInput };
@@ -1,10 +0,0 @@
1
- import * as react from 'react';
2
- import { ComponentProps } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
-
5
- type InputSlotProps = ComponentProps<'label'> & {
6
- children: ComponentProps<'label'>['children'];
7
- };
8
- declare const InputSlot: react.MemoExoticComponent<({ children, className, ...props }: InputSlotProps) => react_jsx_runtime.JSX.Element>;
9
-
10
- export { InputSlot, type InputSlotProps };
@@ -1,20 +0,0 @@
1
- // src/components/ui/input/slot.tsx
2
- import { memo } from "react";
3
- import { cx } from "@xjur-ui/util";
4
- import { jsx } from "react/jsx-runtime";
5
- var InputSlot = memo(
6
- ({ children, className, ...props }) => {
7
- return /* @__PURE__ */ jsx(
8
- "label",
9
- {
10
- ...props,
11
- className: cx("flex items-center justify-center", className),
12
- children
13
- }
14
- );
15
- }
16
- );
17
- InputSlot.displayName = "InputSlot";
18
- export {
19
- InputSlot
20
- };
@@ -1,10 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { MaskOptions } from '@react-input/mask';
3
- import { ComponentProps } from 'react';
4
-
5
- type InputTextProps = ComponentProps<'input'> & {
6
- mask?: MaskOptions;
7
- };
8
- declare function InputText({ className, value, mask, ...props }: InputTextProps): react_jsx_runtime.JSX.Element;
9
-
10
- export { InputText, type InputTextProps };
@@ -1,195 +0,0 @@
1
- // src/components/ui/input/text.tsx
2
- import { InputMask } from "@react-input/mask";
3
- import { useCallback, useEffect, useRef } from "react";
4
- import { cx as cx3 } from "@xjur-ui/util";
5
-
6
- // src/components/ui/input/root.tsx
7
- import { createContext, use } from "react";
8
- import { cx as cx2 } from "@xjur-ui/util";
9
-
10
- // src/components/ui/input/message.tsx
11
- import { memo as memo2 } from "react";
12
- import { cx } from "@xjur-ui/util";
13
-
14
- // src/components/ui/typography.tsx
15
- import { Slot } from "@radix-ui/react-slot";
16
- import { cva } from "@xjur-ui/util";
17
- import { memo } from "react";
18
- import { jsx } from "react/jsx-runtime";
19
- var typographyVariants = cva("", {
20
- variants: {
21
- variant: {
22
- body: "",
23
- label: "",
24
- title: "",
25
- headline: ""
26
- },
27
- size: {
28
- "sm-2x": "",
29
- "sm-1x": "",
30
- sm: "",
31
- md: "",
32
- lg: ""
33
- },
34
- weight: {
35
- thin: "font-thin",
36
- extraLight: "font-extralight",
37
- light: "font-light",
38
- normal: "font-normal",
39
- medium: "font-medium",
40
- semibold: "font-semibold",
41
- bold: "font-bold",
42
- extraBold: "font-extrabold",
43
- black: "font-black"
44
- }
45
- },
46
- compoundVariants: [
47
- { variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
48
- { variant: "body", size: "sm", class: "text-size-body-sm" },
49
- { variant: "body", size: "md", class: "text-size-body-md" },
50
- { variant: "body", size: "lg", class: "text-size-body-lg" },
51
- { variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
52
- { variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
53
- { variant: "label", size: "sm", class: "text-size-label-sm" },
54
- { variant: "label", size: "md", class: "text-size-label-md" },
55
- { variant: "label", size: "lg", class: "text-size-label-lg" },
56
- { variant: "title", size: "sm", class: "text-size-title-sm" },
57
- { variant: "title", size: "md", class: "text-size-title-md" },
58
- { variant: "title", size: "lg", class: "text-size-title-lg" },
59
- { variant: "headline", size: "sm", class: "text-size-headline-sm" },
60
- { variant: "headline", size: "md", class: "text-size-headline-md" },
61
- { variant: "headline", size: "lg", class: "text-size-headline-lg" }
62
- ],
63
- defaultVariants: {
64
- variant: "body",
65
- size: "md",
66
- weight: "normal"
67
- }
68
- });
69
- var Typography = memo(
70
- ({
71
- variant,
72
- size,
73
- weight,
74
- asChild,
75
- className,
76
- ...props
77
- }) => {
78
- const Component = asChild ? Slot : "span";
79
- return /* @__PURE__ */ jsx(
80
- Component,
81
- {
82
- className: typographyVariants({ variant, size, weight, className }),
83
- ...props
84
- }
85
- );
86
- }
87
- );
88
- Typography.displayName = "Typography";
89
-
90
- // src/components/ui/input/message.tsx
91
- import { jsx as jsx2 } from "react/jsx-runtime";
92
- var InputMessage = memo2(
93
- ({
94
- children,
95
- className,
96
- weight = "normal",
97
- variant = "body",
98
- size = "sm-1x",
99
- ...props
100
- }) => {
101
- const { errorMessage } = useInput();
102
- return /* @__PURE__ */ jsx2(
103
- Typography,
104
- {
105
- className: cx(
106
- "text-neutral-dark data-[error=true]:text-danger-idle",
107
- className
108
- ),
109
- "data-error": !!errorMessage,
110
- size,
111
- variant,
112
- weight,
113
- ...props,
114
- children
115
- }
116
- );
117
- }
118
- );
119
- InputMessage.displayName = "InputMessage";
120
-
121
- // src/components/ui/input/root.tsx
122
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
123
- var InputRootContext = createContext({});
124
- function useInput() {
125
- const context = use(InputRootContext);
126
- if (!context) {
127
- throw new Error(
128
- "useInput must be called within <Input.Root> or <Select.Root>"
129
- );
130
- }
131
- return context;
132
- }
133
-
134
- // src/components/ui/input/text.tsx
135
- import { jsx as jsx4 } from "react/jsx-runtime";
136
- function InputText({
137
- className,
138
- value,
139
- mask,
140
- ...props
141
- }) {
142
- const { errorMessage } = useInput();
143
- const inputRef = useRef(null);
144
- const InputComponent = mask ? InputMask : "input";
145
- const onCheckInputFilled = useCallback(
146
- ({ shouldUnfill = false }) => {
147
- if (inputRef.current) {
148
- if (shouldUnfill) inputRef.current.dataset.filled = "false";
149
- else {
150
- const hasNotErrorAndHasValue = !errorMessage && !!inputRef.current.value;
151
- inputRef.current.dataset.filled = String(hasNotErrorAndHasValue);
152
- }
153
- }
154
- },
155
- [errorMessage]
156
- );
157
- function setRef(ref) {
158
- inputRef.current = ref;
159
- if (typeof props.ref === "function") {
160
- props.ref(ref);
161
- }
162
- }
163
- useEffect(() => {
164
- onCheckInputFilled({ shouldUnfill: false });
165
- }, [onCheckInputFilled]);
166
- return /* @__PURE__ */ jsx4(
167
- InputComponent,
168
- {
169
- ...props,
170
- ...mask && { ...mask },
171
- className: cx3(
172
- "h-full w-full bg-transparent",
173
- "border-hidden outline-hidden",
174
- "placeholder:text-placeholder-neutral font-normal",
175
- "text-neutral-dark text-size-body-md overflow-hidden text-ellipsis",
176
- className
177
- ),
178
- "data-filled": !!value && !errorMessage,
179
- readOnly: props.readOnly !== void 0 && props.readOnly,
180
- ref: setRef,
181
- value,
182
- onBlur: (event) => {
183
- props.onBlur?.(event);
184
- onCheckInputFilled({ shouldUnfill: false });
185
- },
186
- onFocus: (event) => {
187
- props.onFocus?.(event);
188
- onCheckInputFilled({ shouldUnfill: true });
189
- }
190
- }
191
- );
192
- }
193
- export {
194
- InputText
195
- };
@@ -1,3 +0,0 @@
1
- export function Accordion() {
2
- return <div>Accordion Test</div>
3
- }
@@ -1,13 +0,0 @@
1
- export { Button, type ButtonProps } from './button'
2
- export { Icon, type IconProps } from './icon'
3
- export { Typography, type TypographyProps } from './typography'
4
- export { Logo, type LogoProps } from './logo'
5
-
6
- export { InputRoot, type InputRootProps } from './input/root'
7
- export { InputText, type InputTextProps } from './input/text'
8
- export { InputContent, type InputContentProps } from './input/content'
9
- export { InputSlot, type InputSlotProps } from './input/slot'
10
-
11
- export { OTPInput } from './otp-input'
12
-
13
- export { Accordion } from './accordion'