@techsio/ui-kit 0.0.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 (183) hide show
  1. package/README.md +165 -0
  2. package/dist/atoms/badge.js +66 -0
  3. package/dist/atoms/button.js +275 -0
  4. package/dist/atoms/error-text.js +38 -0
  5. package/dist/atoms/extra-text.js +27 -0
  6. package/dist/atoms/icon.js +42 -0
  7. package/dist/atoms/image.js +11 -0
  8. package/dist/atoms/input.js +83 -0
  9. package/dist/atoms/label.js +43 -0
  10. package/dist/atoms/link-button.js +51 -0
  11. package/dist/atoms/link.js +23 -0
  12. package/dist/atoms/numeric-input.js +221 -0
  13. package/dist/atoms/rating.js +117 -0
  14. package/dist/atoms/textarea.js +81 -0
  15. package/dist/atoms/tooltip.js +119 -0
  16. package/dist/molecules/accordion.js +245 -0
  17. package/dist/molecules/breadcrumb.js +168 -0
  18. package/dist/molecules/carousel.js +333 -0
  19. package/dist/molecules/checkbox.js +92 -0
  20. package/dist/molecules/color-select.js +159 -0
  21. package/dist/molecules/combobox.js +253 -0
  22. package/dist/molecules/dialog.js +313 -0
  23. package/dist/molecules/form-checkbox.js +59 -0
  24. package/dist/molecules/form-input.js +55 -0
  25. package/dist/molecules/form-numeric-input.js +47 -0
  26. package/dist/molecules/form-textarea.js +54 -0
  27. package/dist/molecules/menu.js +302 -0
  28. package/dist/molecules/pagination.js +184 -0
  29. package/dist/molecules/popover.js +152 -0
  30. package/dist/molecules/product-card.js +194 -0
  31. package/dist/molecules/search-form.js +106 -0
  32. package/dist/molecules/select.js +217 -0
  33. package/dist/molecules/slider.js +249 -0
  34. package/dist/molecules/steps.js +178 -0
  35. package/dist/molecules/switch.js +109 -0
  36. package/dist/molecules/tabs.js +211 -0
  37. package/dist/molecules/toast.js +126 -0
  38. package/dist/molecules/tree-view.js +451 -0
  39. package/dist/organisms/footer.js +209 -0
  40. package/dist/organisms/header.js +245 -0
  41. package/dist/organisms/table.js +233 -0
  42. package/dist/src/atoms/badge.d.ts +59 -0
  43. package/dist/src/atoms/badge.d.ts.map +1 -0
  44. package/dist/src/atoms/button.d.ts +97 -0
  45. package/dist/src/atoms/button.d.ts.map +1 -0
  46. package/dist/src/atoms/error-text.d.ts +29 -0
  47. package/dist/src/atoms/error-text.d.ts.map +1 -0
  48. package/dist/src/atoms/extra-text.d.ts +27 -0
  49. package/dist/src/atoms/extra-text.d.ts.map +1 -0
  50. package/dist/src/atoms/icon.d.ts +65 -0
  51. package/dist/src/atoms/icon.d.ts.map +1 -0
  52. package/dist/src/atoms/image.d.ts +17 -0
  53. package/dist/src/atoms/image.d.ts.map +1 -0
  54. package/dist/src/atoms/input.d.ts +78 -0
  55. package/dist/src/atoms/input.d.ts.map +1 -0
  56. package/dist/src/atoms/label.d.ts +41 -0
  57. package/dist/src/atoms/label.d.ts.map +1 -0
  58. package/dist/src/atoms/link-button.d.ts +129 -0
  59. package/dist/src/atoms/link-button.d.ts.map +1 -0
  60. package/dist/src/atoms/link.d.ts +17 -0
  61. package/dist/src/atoms/link.d.ts.map +1 -0
  62. package/dist/src/atoms/numeric-input.d.ts +64 -0
  63. package/dist/src/atoms/numeric-input.d.ts.map +1 -0
  64. package/dist/src/atoms/rating.d.ts +108 -0
  65. package/dist/src/atoms/rating.d.ts.map +1 -0
  66. package/dist/src/atoms/textarea.d.ts +81 -0
  67. package/dist/src/atoms/textarea.d.ts.map +1 -0
  68. package/dist/src/atoms/tooltip.d.ts +88 -0
  69. package/dist/src/atoms/tooltip.d.ts.map +1 -0
  70. package/dist/src/molecules/accordion.d.ts +182 -0
  71. package/dist/src/molecules/accordion.d.ts.map +1 -0
  72. package/dist/src/molecules/breadcrumb.d.ts +117 -0
  73. package/dist/src/molecules/breadcrumb.d.ts.map +1 -0
  74. package/dist/src/molecules/carousel.d.ts +261 -0
  75. package/dist/src/molecules/carousel.d.ts.map +1 -0
  76. package/dist/src/molecules/checkbox.d.ts +19 -0
  77. package/dist/src/molecules/checkbox.d.ts.map +1 -0
  78. package/dist/src/molecules/color-select.d.ts +20 -0
  79. package/dist/src/molecules/color-select.d.ts.map +1 -0
  80. package/dist/src/molecules/combobox.d.ts +141 -0
  81. package/dist/src/molecules/combobox.d.ts.map +1 -0
  82. package/dist/src/molecules/dialog.d.ts +234 -0
  83. package/dist/src/molecules/dialog.d.ts.map +1 -0
  84. package/dist/src/molecules/form-checkbox.d.ts +15 -0
  85. package/dist/src/molecules/form-checkbox.d.ts.map +1 -0
  86. package/dist/src/molecules/form-input.d.ts +14 -0
  87. package/dist/src/molecules/form-input.d.ts.map +1 -0
  88. package/dist/src/molecules/form-numeric-input.d.ts +14 -0
  89. package/dist/src/molecules/form-numeric-input.d.ts.map +1 -0
  90. package/dist/src/molecules/form-textarea.d.ts +14 -0
  91. package/dist/src/molecules/form-textarea.d.ts.map +1 -0
  92. package/dist/src/molecules/menu.d.ts +153 -0
  93. package/dist/src/molecules/menu.d.ts.map +1 -0
  94. package/dist/src/molecules/pagination.d.ts +123 -0
  95. package/dist/src/molecules/pagination.d.ts.map +1 -0
  96. package/dist/src/molecules/popover.d.ts +124 -0
  97. package/dist/src/molecules/popover.d.ts.map +1 -0
  98. package/dist/src/molecules/product-card.d.ts +160 -0
  99. package/dist/src/molecules/product-card.d.ts.map +1 -0
  100. package/dist/src/molecules/search-form.d.ts +39 -0
  101. package/dist/src/molecules/search-form.d.ts.map +1 -0
  102. package/dist/src/molecules/select.d.ts +126 -0
  103. package/dist/src/molecules/select.d.ts.map +1 -0
  104. package/dist/src/molecules/slider.d.ts +120 -0
  105. package/dist/src/molecules/slider.d.ts.map +1 -0
  106. package/dist/src/molecules/steps.d.ts +96 -0
  107. package/dist/src/molecules/steps.d.ts.map +1 -0
  108. package/dist/src/molecules/switch.d.ts +71 -0
  109. package/dist/src/molecules/switch.d.ts.map +1 -0
  110. package/dist/src/molecules/tabs.d.ts +207 -0
  111. package/dist/src/molecules/tabs.d.ts.map +1 -0
  112. package/dist/src/molecules/toast.d.ts +83 -0
  113. package/dist/src/molecules/toast.d.ts.map +1 -0
  114. package/dist/src/molecules/tree-view.d.ts +202 -0
  115. package/dist/src/molecules/tree-view.d.ts.map +1 -0
  116. package/dist/src/organisms/footer.d.ts +254 -0
  117. package/dist/src/organisms/footer.d.ts.map +1 -0
  118. package/dist/src/organisms/header.d.ts +186 -0
  119. package/dist/src/organisms/header.d.ts.map +1 -0
  120. package/dist/src/organisms/table.d.ts +250 -0
  121. package/dist/src/organisms/table.d.ts.map +1 -0
  122. package/dist/src/templates/accordion.d.ts +15 -0
  123. package/dist/src/templates/accordion.d.ts.map +1 -0
  124. package/dist/src/templates/carousel.d.ts +13 -0
  125. package/dist/src/templates/carousel.d.ts.map +1 -0
  126. package/dist/src/templates/numeric-input.d.ts +14 -0
  127. package/dist/src/templates/numeric-input.d.ts.map +1 -0
  128. package/dist/src/templates/product-card.d.ts +33 -0
  129. package/dist/src/templates/product-card.d.ts.map +1 -0
  130. package/dist/src/templates/tabs.d.ts +16 -0
  131. package/dist/src/templates/tabs.d.ts.map +1 -0
  132. package/dist/src/types/zag.d.ts +19 -0
  133. package/dist/src/types/zag.d.ts.map +1 -0
  134. package/dist/src/utils.d.ts +4 -0
  135. package/dist/src/utils.d.ts.map +1 -0
  136. package/dist/templates/accordion.js +37 -0
  137. package/dist/templates/carousel.js +55 -0
  138. package/dist/templates/numeric-input.js +49 -0
  139. package/dist/templates/product-card.js +92 -0
  140. package/dist/templates/tabs.js +34 -0
  141. package/dist/types/zag.js +0 -0
  142. package/dist/utils.js +20 -0
  143. package/package.json +126 -0
  144. package/src/tokens/_base.css +25 -0
  145. package/src/tokens/_colors.css +5 -0
  146. package/src/tokens/_layout.css +34 -0
  147. package/src/tokens/_semantic.css +360 -0
  148. package/src/tokens/_spacing.css +22 -0
  149. package/src/tokens/_typography.css +17 -0
  150. package/src/tokens/components/atoms/_badge.css +61 -0
  151. package/src/tokens/components/atoms/_button.css +215 -0
  152. package/src/tokens/components/atoms/_icon.css +122 -0
  153. package/src/tokens/components/atoms/_input.css +125 -0
  154. package/src/tokens/components/atoms/_numeric-input.css +57 -0
  155. package/src/tokens/components/atoms/_rating.css +33 -0
  156. package/src/tokens/components/atoms/_textarea.css +93 -0
  157. package/src/tokens/components/atoms/_tooltip.css +21 -0
  158. package/src/tokens/components/components.css +32 -0
  159. package/src/tokens/components/molecules/_accordion.css +85 -0
  160. package/src/tokens/components/molecules/_breadcrumb.css +44 -0
  161. package/src/tokens/components/molecules/_carousel.css +72 -0
  162. package/src/tokens/components/molecules/_checkbox.css +29 -0
  163. package/src/tokens/components/molecules/_color-select.css +61 -0
  164. package/src/tokens/components/molecules/_combobox.css +116 -0
  165. package/src/tokens/components/molecules/_dialog.css +75 -0
  166. package/src/tokens/components/molecules/_menu.css +48 -0
  167. package/src/tokens/components/molecules/_pagination.css +75 -0
  168. package/src/tokens/components/molecules/_popover.css +39 -0
  169. package/src/tokens/components/molecules/_product-card.css +85 -0
  170. package/src/tokens/components/molecules/_search-form.css +10 -0
  171. package/src/tokens/components/molecules/_select.css +88 -0
  172. package/src/tokens/components/molecules/_slider.css +75 -0
  173. package/src/tokens/components/molecules/_steps.css +54 -0
  174. package/src/tokens/components/molecules/_switch.css +62 -0
  175. package/src/tokens/components/molecules/_tabs.css +69 -0
  176. package/src/tokens/components/molecules/_toast.css +77 -0
  177. package/src/tokens/components/molecules/_tree-view.css +80 -0
  178. package/src/tokens/components/molecules/index.css +2 -0
  179. package/src/tokens/components/organisms/_footer.css +90 -0
  180. package/src/tokens/components/organisms/_header.css +86 -0
  181. package/src/tokens/components/organisms/_table.css +63 -0
  182. package/src/tokens/index.css +67 -0
  183. package/src/tokens/tokens-only.css +66 -0
@@ -0,0 +1,83 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { tv } from "../utils.js";
3
+ const inputVariants = tv({
4
+ base: [
5
+ 'block w-full',
6
+ 'bg-input',
7
+ 'text-input-fg',
8
+ 'placeholder:text-input-placeholder',
9
+ 'border border-input-border',
10
+ 'rounded-input',
11
+ 'transition-all duration-200',
12
+ 'hover:bg-input-hover hover:border-input-border-hover',
13
+ 'focus:outline-none focus:bg-input-focus focus:border-input-border-focus',
14
+ 'focus-visible:ring',
15
+ 'focus-visible:ring-input-ring',
16
+ 'disabled:pointer-events-none'
17
+ ],
18
+ variants: {
19
+ size: {
20
+ sm: 'p-input-sm text-input-sm',
21
+ md: 'p-input-md text-input-md',
22
+ lg: 'p-input-lg text-input-lg'
23
+ },
24
+ variant: {
25
+ default: '',
26
+ error: [
27
+ 'border-input-border-danger',
28
+ 'hover:border-input-border-danger-hover',
29
+ 'focus:border-input-border-danger-focus',
30
+ 'placeholder:text-input-placeholder-danger'
31
+ ],
32
+ success: [
33
+ 'border-input-border-success',
34
+ 'hover:border-input-border-success-hover',
35
+ 'focus:border-input-border-success-focus',
36
+ 'placeholder:text-input-placeholder-success'
37
+ ],
38
+ warning: [
39
+ 'border-input-border-warning',
40
+ 'hover:border-input-border-warning-hover',
41
+ 'focus:border-input-border-warning-focus',
42
+ 'placeholder:text-input-placeholder-warning'
43
+ ]
44
+ },
45
+ withButtonInside: {
46
+ false: '',
47
+ right: 'pe-with-button',
48
+ left: 'ps-with-button'
49
+ },
50
+ hideSearchClear: {
51
+ true: '[&::-webkit-search-cancel-button]:hidden [&::-ms-clear]:hidden'
52
+ },
53
+ disabled: {
54
+ true: [
55
+ 'bg-input-disabled',
56
+ 'border-input-border-disabled',
57
+ 'text-input-fg-disabled',
58
+ 'placeholder:text-input-placeholder-disabled'
59
+ ]
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ size: 'md',
64
+ variant: 'default',
65
+ hideSearchClear: true,
66
+ withIconInside: false
67
+ }
68
+ });
69
+ function Input({ size, variant, disabled, ref, withButtonInside, className, ...props }) {
70
+ return /*#__PURE__*/ jsx("input", {
71
+ className: inputVariants({
72
+ size,
73
+ variant,
74
+ disabled,
75
+ withButtonInside,
76
+ className
77
+ }),
78
+ disabled: disabled,
79
+ ref: ref,
80
+ ...props
81
+ });
82
+ }
83
+ export { Input };
@@ -0,0 +1,43 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { tv } from "../utils.js";
3
+ const labelVariants = tv({
4
+ base: [
5
+ 'block',
6
+ 'text-label-fg',
7
+ 'font-label'
8
+ ],
9
+ variants: {
10
+ size: {
11
+ sm: 'text-label-sm',
12
+ md: 'text-label-md',
13
+ lg: 'text-label-lg',
14
+ current: ''
15
+ },
16
+ disabled: {
17
+ true: 'text-label-disabled'
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ size: 'current',
22
+ disabled: false
23
+ }
24
+ });
25
+ function Label({ size, disabled, required, children, className, ...props }) {
26
+ return /*#__PURE__*/ jsxs("label", {
27
+ className: labelVariants({
28
+ size,
29
+ disabled,
30
+ className
31
+ }),
32
+ ...props,
33
+ htmlFor: props.htmlFor,
34
+ children: [
35
+ children,
36
+ required && /*#__PURE__*/ jsx("span", {
37
+ className: "ms-1 text-label-required",
38
+ children: "*"
39
+ })
40
+ ]
41
+ });
42
+ }
43
+ export { Label };
@@ -0,0 +1,51 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { tv } from "../utils.js";
3
+ import { buttonVariants } from "./button.js";
4
+ import { Icon } from "./icon.js";
5
+ import { Link } from "./link.js";
6
+ const linkButton = tv({
7
+ extend: buttonVariants,
8
+ base: 'cursor-pointer',
9
+ variants: {
10
+ size: {
11
+ current: ''
12
+ }
13
+ },
14
+ defaultVariants: {
15
+ size: 'current'
16
+ }
17
+ });
18
+ function LinkButton({ href, icon, as, iconPosition = 'left', children, variant, theme, size, block, uppercase, className, disabled, ref, ...props }) {
19
+ return /*#__PURE__*/ jsxs(Link, {
20
+ ref: ref,
21
+ as: as,
22
+ className: linkButton({
23
+ variant,
24
+ theme,
25
+ size,
26
+ block,
27
+ uppercase,
28
+ className
29
+ }),
30
+ href: disabled ? void 0 : href,
31
+ tabIndex: disabled ? -1 : 0,
32
+ "aria-disabled": disabled,
33
+ "data-disabled": disabled || void 0,
34
+ onClick: (e)=>{
35
+ if (disabled) e.preventDefault();
36
+ },
37
+ ...props,
38
+ children: [
39
+ icon && 'left' === iconPosition && /*#__PURE__*/ jsx(Icon, {
40
+ icon: icon,
41
+ size: size
42
+ }),
43
+ children,
44
+ icon && 'right' === iconPosition && /*#__PURE__*/ jsx(Icon, {
45
+ icon: icon,
46
+ size: size
47
+ })
48
+ ]
49
+ });
50
+ }
51
+ export { LinkButton };
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { tv } from "../utils.js";
3
+ const linkVariants = tv({
4
+ base: [],
5
+ variants: {},
6
+ defaultVariants: {}
7
+ });
8
+ function Link({ as, children, external = false, className, ...props }) {
9
+ const Component = as || 'a';
10
+ const externalProps = external && (!as || 'a' === as) ? {
11
+ target: '_blank',
12
+ rel: 'noopener noreferrer'
13
+ } : {};
14
+ return /*#__PURE__*/ jsx(Component, {
15
+ className: linkVariants({
16
+ className
17
+ }),
18
+ ...externalProps,
19
+ ...props,
20
+ children: children
21
+ });
22
+ }
23
+ export { Link };
@@ -0,0 +1,221 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { connect, machine } from "@zag-js/number-input";
3
+ import { normalizeProps, useMachine } from "@zag-js/react";
4
+ import { createContext, useContext, useId } from "react";
5
+ import { tv } from "../utils.js";
6
+ import { Button } from "./button.js";
7
+ import { Input } from "./input.js";
8
+ const numericInputVariants = tv({
9
+ slots: {
10
+ root: [
11
+ 'flex relative'
12
+ ],
13
+ container: [
14
+ 'group flex relative border-(length:--border-width-numeric-input)',
15
+ 'border-numeric-input-border rounded-numeric-input overflow-hidden items-center',
16
+ 'data-[invalid]:bg-numeric-input-invalid-bg',
17
+ 'data-[invalid]:border-numeric-input-invalid-border',
18
+ 'text-numeric-input-fg',
19
+ 'has-[input:hover]:bg-numeric-input-input-bg-hover',
20
+ 'has-[input:focus]:bg-numeric-input-input-bg-focus',
21
+ 'focus-within:ring',
22
+ 'focus-within:ring-numeric-input-ring'
23
+ ],
24
+ input: [
25
+ 'p-numeric-input-input border-none',
26
+ 'bg-numeric-input-input-bg',
27
+ 'focus:bg-numeric-input-input-bg-focus',
28
+ 'hover:bg-numeric-input-input-bg-hover',
29
+ 'focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0',
30
+ 'data-[invalid]:focus:border-input-border-danger-focus duration-0'
31
+ ],
32
+ triggerContainer: [
33
+ 'flex flex-col h-fit justify-center bg-numeric-input-trigger-container-bg'
34
+ ],
35
+ trigger: [
36
+ 'px-numeric-input-trigger-x py-numeric-input-trigger-y',
37
+ 'bg-numeric-input-trigger-bg hover:bg-numeric-input-trigger-bg-hover',
38
+ 'text-numeric-input-trigger-fg hover:text-numeric-input-trigger-fg-hover',
39
+ 'cursor-pointer'
40
+ ],
41
+ scrubber: 'absolute inset-0 cursor-ew-resize'
42
+ },
43
+ variants: {
44
+ size: {
45
+ sm: {
46
+ root: 'text-numeric-input-sm',
47
+ trigger: 'text-numeric-input-sm',
48
+ input: 'text-numeric-input-sm'
49
+ },
50
+ md: {
51
+ root: 'text-numeric-input-md',
52
+ trigger: 'text-numeric-input-md',
53
+ input: 'text-numeric-input-md'
54
+ },
55
+ lg: {
56
+ root: 'text-numeric-input-lg',
57
+ trigger: 'text-numeric-input-lg',
58
+ input: 'text-numeric-input-lg'
59
+ }
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ size: 'md'
64
+ }
65
+ });
66
+ const NumericInputContext = /*#__PURE__*/ createContext(null);
67
+ function useNumericInputContext() {
68
+ const context = useContext(NumericInputContext);
69
+ if (!context) throw new Error('NumericInput components must be used within NumericInput.Root');
70
+ return context;
71
+ }
72
+ function NumericInput({ id, name, size, disabled = false, required = false, pattern, readOnly, inputMode, value, defaultValue, onChange, dir = 'ltr', describedBy, min, max, step = 1, precision, allowMouseWheel = true, allowOverflow, clampValueOnBlur = true, spinOnPress = true, formatOptions, invalid, children, ref, className, ...props }) {
73
+ const generatedId = useId();
74
+ const uniqueId = id || generatedId;
75
+ const stringValue = void 0 !== value ? String(value) : void 0;
76
+ const stringDefaultValue = void 0 !== defaultValue ? String(defaultValue) : void 0;
77
+ const service = useMachine(machine, {
78
+ id: uniqueId,
79
+ min,
80
+ max,
81
+ step,
82
+ name,
83
+ disabled,
84
+ required,
85
+ pattern,
86
+ readOnly,
87
+ inputMode,
88
+ dir,
89
+ invalid,
90
+ value: stringValue,
91
+ defaultValue: stringDefaultValue,
92
+ allowMouseWheel,
93
+ allowOverflow,
94
+ clampValueOnBlur,
95
+ spinOnPress,
96
+ formatOptions: precision ? {
97
+ maximumFractionDigits: precision
98
+ } : formatOptions,
99
+ onValueChange: (details)=>{
100
+ onChange?.(details.valueAsNumber);
101
+ },
102
+ focusInputOnChange: true
103
+ });
104
+ const api = connect(service, normalizeProps);
105
+ const styles = numericInputVariants({
106
+ size
107
+ });
108
+ return /*#__PURE__*/ jsx(NumericInputContext.Provider, {
109
+ value: {
110
+ api,
111
+ size,
112
+ styles,
113
+ invalid,
114
+ describedBy
115
+ },
116
+ children: /*#__PURE__*/ jsx("div", {
117
+ ref: ref,
118
+ className: styles.root({
119
+ className
120
+ }),
121
+ ...api.getRootProps(),
122
+ ...props,
123
+ children: children
124
+ })
125
+ });
126
+ }
127
+ NumericInput.Control = function({ children, ref, className, ...props }) {
128
+ const { api, styles, invalid } = useNumericInputContext();
129
+ return /*#__PURE__*/ jsx("div", {
130
+ ref: ref,
131
+ className: styles.container({
132
+ className
133
+ }),
134
+ ...api.getControlProps(),
135
+ ...props,
136
+ "data-invalid": invalid || void 0,
137
+ children: children
138
+ });
139
+ };
140
+ NumericInput.Input = function({ ref, className, ...props }) {
141
+ const { api, styles, describedBy } = useNumericInputContext();
142
+ const ariaDescribedBy = [
143
+ props['aria-describedby'],
144
+ describedBy
145
+ ].filter(Boolean).join(' ') || void 0;
146
+ return /*#__PURE__*/ jsx(Input, {
147
+ ref: ref,
148
+ ...api.getInputProps(),
149
+ ...props,
150
+ className: styles.input({
151
+ className
152
+ }),
153
+ "aria-describedby": ariaDescribedBy
154
+ });
155
+ };
156
+ NumericInput.IncrementTrigger = function({ variant = 'primary', theme = 'borderless', size = 'sm', icon = 'token-icon-numeric-input-increment', iconPosition = 'left', uppercase, block, isLoading, loadingText, ref, className, children, ...props }) {
157
+ const { api, styles } = useNumericInputContext();
158
+ return /*#__PURE__*/ jsx(Button, {
159
+ ref: ref,
160
+ variant: variant,
161
+ theme: theme,
162
+ size: size,
163
+ icon: icon,
164
+ iconPosition: iconPosition,
165
+ uppercase: uppercase,
166
+ block: block,
167
+ isLoading: isLoading,
168
+ loadingText: loadingText,
169
+ className: styles.trigger({
170
+ className
171
+ }),
172
+ ...api.getIncrementTriggerProps(),
173
+ ...props,
174
+ children: children
175
+ });
176
+ };
177
+ NumericInput.DecrementTrigger = function({ variant = 'primary', theme = 'borderless', size = 'sm', icon = 'token-icon-numeric-input-decrement', iconPosition = 'left', uppercase, block, isLoading, loadingText, ref, className, children, ...props }) {
178
+ const { api, styles } = useNumericInputContext();
179
+ return /*#__PURE__*/ jsx(Button, {
180
+ ref: ref,
181
+ variant: variant,
182
+ theme: theme,
183
+ size: size,
184
+ icon: icon,
185
+ iconPosition: iconPosition,
186
+ uppercase: uppercase,
187
+ block: block,
188
+ isLoading: isLoading,
189
+ loadingText: loadingText,
190
+ className: styles.trigger({
191
+ className
192
+ }),
193
+ ...api.getDecrementTriggerProps(),
194
+ ...props,
195
+ children: children
196
+ });
197
+ };
198
+ NumericInput.Scrubber = function({ ref, className, ...props }) {
199
+ const { api, styles } = useNumericInputContext();
200
+ return /*#__PURE__*/ jsx("div", {
201
+ ref: ref,
202
+ className: styles.scrubber({
203
+ className
204
+ }),
205
+ ...api.getScrubberProps(),
206
+ ...props
207
+ });
208
+ };
209
+ NumericInput.TriggerContainer = function({ children, ref, className, ...props }) {
210
+ const { styles } = useNumericInputContext();
211
+ return /*#__PURE__*/ jsx("div", {
212
+ ref: ref,
213
+ className: styles.triggerContainer({
214
+ className
215
+ }),
216
+ ...props,
217
+ children: children
218
+ });
219
+ };
220
+ NumericInput.displayName = 'NumericInput';
221
+ export { NumericInput };
@@ -0,0 +1,117 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { connect, machine } from "@zag-js/rating-group";
3
+ import { normalizeProps, useMachine } from "@zag-js/react";
4
+ import { useId } from "react";
5
+ import { tv } from "../utils.js";
6
+ import { Label } from "./label.js";
7
+ const rating = tv({
8
+ slots: {
9
+ root: [
10
+ 'grid items-center'
11
+ ],
12
+ control: [
13
+ 'flex'
14
+ ],
15
+ itemWrapper: [
16
+ 'flex items-center',
17
+ 'has-[:focus-visible]:outline-none',
18
+ 'has-[:focus-visible]:ring',
19
+ 'has-[:focus-visible]:ring-rating-ring'
20
+ ],
21
+ item: [
22
+ 'cursor-pointer transition-colors duration-200',
23
+ 'text-rating-fg',
24
+ 'data-[checked]:text-rating-fg-active',
25
+ 'data-[highlighted]:text-rating-fg-active',
26
+ 'data-[disabled]:cursor-not-allowed',
27
+ 'data-[disabled]:data-[highlighted]:text-rating-fg-disabled',
28
+ 'token-icon-rating',
29
+ 'data-[half]:token-icon-rating-half'
30
+ ]
31
+ },
32
+ variants: {
33
+ size: {
34
+ sm: {
35
+ root: 'gap-rating-sm',
36
+ control: 'gap-rating-sm',
37
+ item: 'text-rating-sm'
38
+ },
39
+ md: {
40
+ root: 'gap-rating-md',
41
+ control: 'gap-rating-md',
42
+ item: 'text-rating-md'
43
+ },
44
+ lg: {
45
+ root: 'gap-rating-lg',
46
+ control: 'gap-rating-lg',
47
+ item: 'text-rating-lg'
48
+ }
49
+ },
50
+ isInteractive: {
51
+ true: {},
52
+ false: {
53
+ item: 'cursor-default'
54
+ }
55
+ }
56
+ },
57
+ defaultVariants: {
58
+ size: 'md'
59
+ }
60
+ });
61
+ function Rating({ value, defaultValue, count = 5, labelText, readOnly = false, disabled = false, allowHalf = true, name, dir = 'ltr', translations, onChange, onHoverChange, size = 'md', className, ...props }) {
62
+ const generatedId = useId();
63
+ const uniqueId = props.id || generatedId;
64
+ const service = useMachine(machine, {
65
+ id: uniqueId,
66
+ count,
67
+ value,
68
+ defaultValue,
69
+ disabled,
70
+ readOnly,
71
+ allowHalf,
72
+ name,
73
+ dir,
74
+ translations,
75
+ onValueChange: ({ value })=>{
76
+ onChange?.(value);
77
+ },
78
+ onHoverChange: ({ hoveredValue })=>{
79
+ onHoverChange?.(hoveredValue);
80
+ }
81
+ });
82
+ const api = connect(service, normalizeProps);
83
+ const { root, control, itemWrapper, item } = rating({
84
+ size,
85
+ isInteractive: !readOnly && !disabled
86
+ });
87
+ return /*#__PURE__*/ jsxs("div", {
88
+ className: root({
89
+ className
90
+ }),
91
+ ...api.getRootProps(),
92
+ ...props,
93
+ children: [
94
+ labelText && /*#__PURE__*/ jsx(Label, {
95
+ ...api.getLabelProps(),
96
+ children: labelText
97
+ }),
98
+ /*#__PURE__*/ jsx("input", {
99
+ ...api.getHiddenInputProps()
100
+ }),
101
+ /*#__PURE__*/ jsx("div", {
102
+ className: control(),
103
+ ...api.getControlProps(),
104
+ children: api.items.map((index)=>/*#__PURE__*/ jsx("div", {
105
+ className: itemWrapper(),
106
+ children: /*#__PURE__*/ jsx("span", {
107
+ className: item(),
108
+ ...api.getItemProps({
109
+ index
110
+ })
111
+ })
112
+ }, index))
113
+ })
114
+ ]
115
+ });
116
+ }
117
+ export { Rating };
@@ -0,0 +1,81 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { tv } from "../utils.js";
3
+ const textareaVariants = tv({
4
+ base: [
5
+ 'block w-full',
6
+ 'bg-textarea-bg',
7
+ 'text-textarea-fg',
8
+ 'placeholder:text-textarea-placeholder',
9
+ 'border-(length:--border-textarea-width) border-textarea-border',
10
+ 'rounded-textarea',
11
+ 'transition-all duration-200',
12
+ 'hover:bg-textarea-bg-hover hover:border-textarea-border-hover',
13
+ 'focus:outline-none focus:bg-textarea-bg-focus focus:border-textarea-border-focus',
14
+ 'focus-visible:ring',
15
+ 'focus-visible:ring-textarea-ring',
16
+ 'disabled:pointer-events-none disabled:bg-textarea-bg-disabled disabled:border-textarea-border-disabled disabled:text-textarea-fg-disabled'
17
+ ],
18
+ variants: {
19
+ variant: {
20
+ default: '',
21
+ error: [
22
+ 'border-textarea-border-danger',
23
+ 'hover:border-textarea-border-danger-hover',
24
+ 'focus:border-textarea-border-danger-focus',
25
+ 'placeholder:text-textarea-placeholder-danger'
26
+ ],
27
+ success: [
28
+ 'border-textarea-border-success',
29
+ 'hover:border-textarea-border-success-hover',
30
+ 'focus:border-textarea-border-success-focus'
31
+ ],
32
+ warning: [
33
+ 'border-textarea-border-warning',
34
+ 'hover:border-textarea-border-warning-hover',
35
+ 'focus:border-textarea-border-warning-focus'
36
+ ],
37
+ borderless: [
38
+ 'border-transparent',
39
+ 'bg-textarea-bg-borderless',
40
+ 'hover:bg-textarea-bg-borderless-hover',
41
+ 'focus:bg-textarea-bg-borderless-focus'
42
+ ]
43
+ },
44
+ size: {
45
+ sm: 'p-textarea-sm text-textarea-sm',
46
+ md: 'p-textarea-md text-textarea-md',
47
+ lg: 'p-textarea-lg text-textarea-lg'
48
+ },
49
+ resize: {
50
+ none: 'resize-none',
51
+ y: 'resize-y',
52
+ x: 'resize-x',
53
+ both: 'resize',
54
+ auto: 'resize-none field-sizing-content'
55
+ },
56
+ readonly: {
57
+ true: 'bg-textarea-bg-disabled cursor-default opacity-90 text-textarea-fg-disabled border-textarea-border-disabled'
58
+ }
59
+ },
60
+ defaultVariants: {
61
+ size: 'md',
62
+ resize: 'y',
63
+ variant: 'default'
64
+ }
65
+ });
66
+ function Textarea({ size, resize, variant, readonly, className, ref, ...props }) {
67
+ return /*#__PURE__*/ jsx("textarea", {
68
+ ref: ref,
69
+ readOnly: readonly,
70
+ className: textareaVariants({
71
+ size,
72
+ resize,
73
+ variant,
74
+ readonly,
75
+ className
76
+ }),
77
+ ...props
78
+ });
79
+ }
80
+ Textarea.displayName = 'Textarea';
81
+ export { Textarea };