@neoptocom/neopto-ui 0.5.2 → 0.6.1

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.
package/dist/index.cjs CHANGED
@@ -3,7 +3,6 @@
3
3
  var React2 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var reactDom = require('react-dom');
6
- var tailwindVariants = require('tailwind-variants');
7
6
 
8
7
  function _interopNamespace(e) {
9
8
  if (e && e.__esModule) return e;
@@ -115,41 +114,40 @@ function Modal({
115
114
  const container = document.body;
116
115
  return reactDom.createPortal(overlay, container);
117
116
  }
118
- var styles = tailwindVariants.tv({
119
- base: "text-current",
120
- variants: {
121
- variant: {
122
- "display-lg": "text-5xl leading-tight",
123
- "display-md": "text-4xl leading-tight",
124
- "display-sm": "text-4xl leading-tight",
125
- "headline-lg": "text-3xl leading-tight",
126
- "headline-md": "text-3xl leading-tight",
127
- "headline-sm": "text-3xl leading-tight",
128
- "title-lg": "text-xl leading-tight",
129
- "title-md": "text-lg leading-tight",
130
- "title-sm": "text-base leading-tight",
131
- "label-lg": "text-sm leading-tight",
132
- "label-md": "text-xs leading-tight",
133
- "label-sm": "text-xs leading-tight",
134
- "body-lg": "text-base leading-relaxed",
135
- "body-md": "text-sm leading-relaxed",
136
- "body-sm": "text-xs leading-relaxed",
137
- "button": "text-base leading-normal"
138
- },
139
- weight: {
140
- normal: "font-normal",
141
- medium: "font-medium",
142
- semibold: "font-semibold",
143
- bold: "font-bold"
144
- },
145
- muted: {
146
- true: "text-[var(--muted-fg)]"
147
- }
148
- },
149
- defaultVariants: {
150
- weight: "normal"
151
- }
152
- });
117
+ function getTypoClasses(variant, weight = "normal", muted, className) {
118
+ const base = "text-current";
119
+ const variants = {
120
+ "display-lg": "text-5xl leading-tight",
121
+ "display-md": "text-4xl leading-tight",
122
+ "display-sm": "text-4xl leading-tight",
123
+ "headline-lg": "text-3xl leading-tight",
124
+ "headline-md": "text-3xl leading-tight",
125
+ "headline-sm": "text-3xl leading-tight",
126
+ "title-lg": "text-xl leading-tight",
127
+ "title-md": "text-lg leading-tight",
128
+ "title-sm": "text-base leading-tight",
129
+ "label-lg": "text-sm leading-tight",
130
+ "label-md": "text-xs leading-tight",
131
+ "label-sm": "text-xs leading-tight",
132
+ "body-lg": "text-base leading-relaxed",
133
+ "body-md": "text-sm leading-relaxed",
134
+ "body-sm": "text-xs leading-relaxed",
135
+ "button": "text-base leading-normal"
136
+ };
137
+ const weights = {
138
+ normal: "font-normal",
139
+ medium: "font-medium",
140
+ semibold: "font-semibold",
141
+ bold: "font-bold"
142
+ };
143
+ return [
144
+ base,
145
+ variants[variant],
146
+ weights[weight],
147
+ muted ? "text-[var(--muted-fg)]" : "",
148
+ className
149
+ ].filter(Boolean).join(" ");
150
+ }
153
151
  function Typo({
154
152
  variant,
155
153
  bold,
@@ -169,23 +167,21 @@ function Typo({
169
167
  return /* @__PURE__ */ jsxRuntime.jsx(
170
168
  Component,
171
169
  {
172
- className: styles({ variant, weight: bold, muted, className }),
170
+ className: getTypoClasses(variant, bold, muted, className),
173
171
  style: { fontFamily: getFontFamily(variant) },
174
172
  ...props,
175
173
  children
176
174
  }
177
175
  );
178
176
  }
179
- var avatarStyles = tailwindVariants.tv({
180
- base: "relative box-border flex items-center justify-center overflow-hidden rounded-full border border-[var(--border)] bg-[var(--muted)] text-[var(--fg)] select-none",
181
- variants: {
182
- size: {
183
- sm: "w-[28px] h-[28px]",
184
- md: "w-[60px] h-[60px]"
185
- }
186
- },
187
- defaultVariants: { size: "sm" }
188
- });
177
+ function getAvatarClasses(size = "md", className) {
178
+ const base = "relative box-border flex items-center justify-center overflow-hidden rounded-full border border-[var(--border)] bg-[var(--muted)] text-[var(--fg)] select-none";
179
+ const sizes = {
180
+ sm: "w-[28px] h-[28px]",
181
+ md: "w-[60px] h-[60px]"
182
+ };
183
+ return [base, sizes[size], className].filter(Boolean).join(" ");
184
+ }
189
185
  function getInitials(name) {
190
186
  if (!name) return "\u2026";
191
187
  const words = name.trim().split(/\s+/);
@@ -214,7 +210,7 @@ function Avatar({
214
210
  return /* @__PURE__ */ jsxRuntime.jsx(
215
211
  "div",
216
212
  {
217
- className: avatarStyles({ size, className }),
213
+ className: getAvatarClasses(size, className),
218
214
  "aria-label": alt ?? name,
219
215
  role: "img",
220
216
  ...props,
@@ -326,29 +322,20 @@ function Icon({
326
322
  }
327
323
  );
328
324
  }
329
- var iconButtonStyles = tailwindVariants.tv({
330
- base: [
331
- "flex items-center justify-center rounded-full flex-shrink-0",
332
- "transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
333
- "focus-visible:ring-cyan-500/40 disabled:cursor-not-allowed disabled:opacity-50"
334
- ].join(" "),
335
- variants: {
336
- variant: {
337
- ghost: "bg-transparent hover:bg-[var(--muted)] active:bg-[var(--muted)]",
338
- primary: "bg-cyan-500 text-white hover:bg-cyan-400 active:bg-cyan-600",
339
- secondary: "border border-[var(--border)] bg-[var(--surface)] hover:bg-[var(--muted)] active:bg-[var(--muted)]"
340
- },
341
- size: {
342
- sm: "w-8 h-8",
343
- md: "w-10 h-10",
344
- lg: "w-12 h-12"
345
- }
346
- },
347
- defaultVariants: {
348
- variant: "ghost",
349
- size: "md"
350
- }
351
- });
325
+ function getIconButtonClasses(variant = "ghost", size = "md", className) {
326
+ const base = "flex items-center justify-center rounded-full flex-shrink-0 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-cyan-500/40 disabled:cursor-not-allowed disabled:opacity-50";
327
+ const variants = {
328
+ ghost: "bg-transparent hover:bg-[var(--muted)] active:bg-[var(--muted)]",
329
+ primary: "bg-cyan-500 text-white hover:bg-cyan-400 active:bg-cyan-600",
330
+ secondary: "border border-[var(--border)] bg-[var(--surface)] hover:bg-[var(--muted)] active:bg-[var(--muted)]"
331
+ };
332
+ const sizes = {
333
+ sm: "w-8 h-8",
334
+ md: "w-10 h-10",
335
+ lg: "w-12 h-12"
336
+ };
337
+ return [base, variants[variant], sizes[size], className].filter(Boolean).join(" ");
338
+ }
352
339
  var IconButton = React2__namespace.forwardRef(
353
340
  ({
354
341
  variant,
@@ -368,7 +355,7 @@ var IconButton = React2__namespace.forwardRef(
368
355
  "button",
369
356
  {
370
357
  ref,
371
- className: iconButtonStyles({ variant, size, className }),
358
+ className: getIconButtonClasses(variant, size, className),
372
359
  ...props,
373
360
  children: /* @__PURE__ */ jsxRuntime.jsx(
374
361
  Icon,
@@ -782,35 +769,33 @@ function Search({
782
769
  }
783
770
  );
784
771
  }
785
- var buttonStyles = tailwindVariants.tv({
786
- base: "cursor-pointer inline-flex items-center justify-center gap-2 rounded-[var(--radius-2xl)] px-[18px] h-12 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-cyan-500/40 disabled:cursor-not-allowed disabled:opacity-50",
787
- variants: {
788
- variant: {
789
- primary: "bg-cyan-500 text-white hover:bg-cyan-400 active:bg-cyan-600 disabled:bg-neutral-400",
790
- secondary: "border border-cyan-500 text-cyan-500 bg-transparent hover:bg-cyan-50 active:bg-cyan-100 disabled:border-neutral-400 disabled:text-neutral-400",
791
- ghost: "bg-transparent text-cyan-500 hover:bg-cyan-50 active:bg-cyan-100 disabled:text-neutral-400"
792
- },
793
- size: {
794
- sm: "h-9 px-3",
795
- md: "h-12 px-[18px]",
796
- lg: "h-14 px-6"
797
- },
798
- fullWidth: {
799
- true: "w-full"
800
- }
801
- },
802
- defaultVariants: {
803
- variant: "primary",
804
- size: "md"
805
- }
806
- });
772
+ function getButtonClasses(variant = "primary", size = "md", fullWidth, className) {
773
+ const base = "cursor-pointer inline-flex items-center justify-center gap-2 rounded-[var(--radius-2xl)] transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-cyan-500/40 disabled:cursor-not-allowed disabled:opacity-50";
774
+ const variants = {
775
+ primary: "bg-cyan-500 text-white hover:bg-cyan-400 active:bg-cyan-600 disabled:bg-neutral-400",
776
+ secondary: "border border-cyan-500 text-cyan-500 bg-transparent hover:bg-cyan-50 active:bg-cyan-100 disabled:border-neutral-400 disabled:text-neutral-400",
777
+ ghost: "bg-transparent text-cyan-500 hover:bg-cyan-50 active:bg-cyan-100 disabled:text-neutral-400"
778
+ };
779
+ const sizes = {
780
+ sm: "h-9 px-3",
781
+ md: "h-12 px-[18px]",
782
+ lg: "h-14 px-6"
783
+ };
784
+ return [
785
+ base,
786
+ variants[variant],
787
+ sizes[size],
788
+ fullWidth ? "w-full" : "",
789
+ className
790
+ ].filter(Boolean).join(" ");
791
+ }
807
792
  var Button = React2__namespace.forwardRef(
808
793
  ({ variant, size, fullWidth, className, children, icon, ...props }, ref) => {
809
794
  return /* @__PURE__ */ jsxRuntime.jsx(
810
795
  "button",
811
796
  {
812
797
  ref,
813
- className: buttonStyles({ variant, size, fullWidth, className }),
798
+ className: getButtonClasses(variant, size, fullWidth, className),
814
799
  ...props,
815
800
  children
816
801
  }
package/dist/index.d.cts CHANGED
@@ -1,8 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import * as tailwind_variants from 'tailwind-variants';
4
- import { VariantProps } from 'tailwind-variants';
5
- import * as tailwind_variants_dist_config_js from 'tailwind-variants/dist/config.js';
6
3
 
7
4
  type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
8
5
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
@@ -44,43 +41,9 @@ type AvatarProps = {
44
41
  color?: string;
45
42
  /** Accessible alt text; defaults to the person's name */
46
43
  alt?: string;
47
- } & VariantProps<typeof avatarStyles> & Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
48
- declare const avatarStyles: tailwind_variants.TVReturnType<{
49
- size: {
50
- sm: string;
51
- md: string;
52
- };
53
- }, undefined, string, tailwind_variants_dist_config_js.TVConfig<{
54
- size: {
55
- sm: string;
56
- md: string;
57
- };
58
- }, {
59
- size: {
60
- sm: string;
61
- md: string;
62
- };
63
- }>, {
64
- size: {
65
- sm: string;
66
- md: string;
67
- };
68
- }, undefined, tailwind_variants.TVReturnType<{
69
- size: {
70
- sm: string;
71
- md: string;
72
- };
73
- }, undefined, string, tailwind_variants_dist_config_js.TVConfig<{
74
- size: {
75
- sm: string;
76
- md: string;
77
- };
78
- }, {
79
- size: {
80
- sm: string;
81
- md: string;
82
- };
83
- }>, unknown, unknown, undefined>>;
44
+ /** Avatar size */
45
+ size?: "sm" | "md";
46
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
84
47
  declare function Avatar({ name, src, color, size, alt, className, style, ...props }: AvatarProps): react_jsx_runtime.JSX.Element;
85
48
 
86
49
  type AvatarGroupProps = {
@@ -160,195 +123,32 @@ interface SearchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSele
160
123
  }
161
124
  declare function Search({ className, options, onSearch, selectedOption, onSelect, searchDelay, disabled, maxHeight, id, children, ...props }: SearchProps): react_jsx_runtime.JSX.Element;
162
125
 
163
- declare const buttonStyles: tailwind_variants.TVReturnType<{
164
- variant: {
165
- primary: string;
166
- secondary: string;
167
- ghost: string;
168
- };
169
- size: {
170
- sm: string;
171
- md: string;
172
- lg: string;
173
- };
174
- fullWidth: {
175
- true: string;
176
- };
177
- }, undefined, string, tailwind_variants_dist_config_js.TVConfig<{
178
- variant: {
179
- primary: string;
180
- secondary: string;
181
- ghost: string;
182
- };
183
- size: {
184
- sm: string;
185
- md: string;
186
- lg: string;
187
- };
188
- fullWidth: {
189
- true: string;
190
- };
191
- }, {
192
- variant: {
193
- primary: string;
194
- secondary: string;
195
- ghost: string;
196
- };
197
- size: {
198
- sm: string;
199
- md: string;
200
- lg: string;
201
- };
202
- fullWidth: {
203
- true: string;
204
- };
205
- }>, {
206
- variant: {
207
- primary: string;
208
- secondary: string;
209
- ghost: string;
210
- };
211
- size: {
212
- sm: string;
213
- md: string;
214
- lg: string;
215
- };
216
- fullWidth: {
217
- true: string;
218
- };
219
- }, undefined, tailwind_variants.TVReturnType<{
220
- variant: {
221
- primary: string;
222
- secondary: string;
223
- ghost: string;
224
- };
225
- size: {
226
- sm: string;
227
- md: string;
228
- lg: string;
229
- };
230
- fullWidth: {
231
- true: string;
232
- };
233
- }, undefined, string, tailwind_variants_dist_config_js.TVConfig<{
234
- variant: {
235
- primary: string;
236
- secondary: string;
237
- ghost: string;
238
- };
239
- size: {
240
- sm: string;
241
- md: string;
242
- lg: string;
243
- };
244
- fullWidth: {
245
- true: string;
246
- };
247
- }, {
248
- variant: {
249
- primary: string;
250
- secondary: string;
251
- ghost: string;
252
- };
253
- size: {
254
- sm: string;
255
- md: string;
256
- lg: string;
257
- };
258
- fullWidth: {
259
- true: string;
260
- };
261
- }>, unknown, unknown, undefined>>;
262
- type ButtonVariants = VariantProps<typeof buttonStyles>;
263
- type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & ButtonVariants & {
126
+ type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
127
+ /** Button visual variant */
128
+ variant?: "primary" | "secondary" | "ghost";
129
+ /** Button size */
130
+ size?: "sm" | "md" | "lg";
131
+ /** Make button full width */
132
+ fullWidth?: boolean;
264
133
  /** Icon component to display instead of text */
265
134
  icon?: React.ReactNode;
266
135
  };
267
- declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & ButtonVariants & {
136
+ declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
137
+ /** Button visual variant */
138
+ variant?: "primary" | "secondary" | "ghost";
139
+ /** Button size */
140
+ size?: "sm" | "md" | "lg";
141
+ /** Make button full width */
142
+ fullWidth?: boolean;
268
143
  /** Icon component to display instead of text */
269
144
  icon?: React.ReactNode;
270
145
  } & React.RefAttributes<HTMLButtonElement>>;
271
146
 
272
- declare const iconButtonStyles: tailwind_variants.TVReturnType<{
273
- variant: {
274
- ghost: string;
275
- primary: string;
276
- secondary: string;
277
- };
278
- size: {
279
- sm: string;
280
- md: string;
281
- lg: string;
282
- };
283
- }, undefined, string, tailwind_variants_dist_config_js.TVConfig<{
284
- variant: {
285
- ghost: string;
286
- primary: string;
287
- secondary: string;
288
- };
289
- size: {
290
- sm: string;
291
- md: string;
292
- lg: string;
293
- };
294
- }, {
295
- variant: {
296
- ghost: string;
297
- primary: string;
298
- secondary: string;
299
- };
300
- size: {
301
- sm: string;
302
- md: string;
303
- lg: string;
304
- };
305
- }>, {
306
- variant: {
307
- ghost: string;
308
- primary: string;
309
- secondary: string;
310
- };
311
- size: {
312
- sm: string;
313
- md: string;
314
- lg: string;
315
- };
316
- }, undefined, tailwind_variants.TVReturnType<{
317
- variant: {
318
- ghost: string;
319
- primary: string;
320
- secondary: string;
321
- };
322
- size: {
323
- sm: string;
324
- md: string;
325
- lg: string;
326
- };
327
- }, undefined, string, tailwind_variants_dist_config_js.TVConfig<{
328
- variant: {
329
- ghost: string;
330
- primary: string;
331
- secondary: string;
332
- };
333
- size: {
334
- sm: string;
335
- md: string;
336
- lg: string;
337
- };
338
- }, {
339
- variant: {
340
- ghost: string;
341
- primary: string;
342
- secondary: string;
343
- };
344
- size: {
345
- sm: string;
346
- md: string;
347
- lg: string;
348
- };
349
- }>, unknown, unknown, undefined>>;
350
- type IconButtonVariants = VariantProps<typeof iconButtonStyles>;
351
- type IconButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & IconButtonVariants & {
147
+ type IconButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
148
+ /** Button visual variant */
149
+ variant?: "ghost" | "primary" | "secondary";
150
+ /** Button size */
151
+ size?: "sm" | "md" | "lg";
352
152
  /** Material Symbols icon name */
353
153
  icon: string;
354
154
  /** Icon size (defaults to button size) */
@@ -358,7 +158,11 @@ type IconButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & IconButto
358
158
  /** Optional custom className for the icon */
359
159
  iconClassName?: string;
360
160
  };
361
- declare const IconButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & IconButtonVariants & {
161
+ declare const IconButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
162
+ /** Button visual variant */
163
+ variant?: "ghost" | "primary" | "secondary";
164
+ /** Button size */
165
+ size?: "sm" | "md" | "lg";
362
166
  /** Material Symbols icon name */
363
167
  icon: string;
364
168
  /** Icon size (defaults to button size) */