@rovula/ui 0.1.3 → 0.1.5

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 (66) hide show
  1. package/dist/cjs/bundle.css +158 -42
  2. package/dist/cjs/bundle.js +4 -4
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +3 -0
  5. package/dist/cjs/types/components/InputFilter/InputFilter.stories.d.ts +3 -0
  6. package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.d.ts +3 -0
  7. package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +6 -0
  8. package/dist/cjs/types/components/PasswordInput/PasswordInput.stories.d.ts +3 -0
  9. package/dist/cjs/types/components/Search/Search.stories.d.ts +3 -0
  10. package/dist/cjs/types/components/Switch/Switch.d.ts +3 -1
  11. package/dist/cjs/types/components/Switch/Switch.stories.d.ts +12 -4
  12. package/dist/cjs/types/components/Switch/Switch.styles.d.ts +7 -0
  13. package/dist/cjs/types/components/TextInput/TextInput.d.ts +6 -0
  14. package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +9 -0
  15. package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +4 -0
  16. package/dist/cjs/types/components/Toast/Toast.d.ts +1 -0
  17. package/dist/cjs/types/components/Toast/Toast.stories.d.ts +14 -0
  18. package/dist/cjs/types/components/Toast/Toast.styles.d.ts +1 -0
  19. package/dist/components/PasswordInput/PasswordInput.js +2 -2
  20. package/dist/components/PasswordInput/PasswordInput.stories.js +1 -1
  21. package/dist/components/Switch/Switch.js +4 -17
  22. package/dist/components/Switch/Switch.stories.js +12 -2
  23. package/dist/components/Switch/Switch.styles.js +39 -0
  24. package/dist/components/TextInput/TextInput.js +28 -7
  25. package/dist/components/TextInput/TextInput.stories.js +13 -0
  26. package/dist/components/TextInput/TextInput.styles.js +26 -4
  27. package/dist/components/Toast/Toast.js +5 -5
  28. package/dist/components/Toast/Toast.stories.js +11 -2
  29. package/dist/components/Toast/Toast.styles.js +38 -6
  30. package/dist/components/Toast/Toaster.js +17 -1
  31. package/dist/esm/bundle.css +158 -42
  32. package/dist/esm/bundle.js +4 -4
  33. package/dist/esm/bundle.js.map +1 -1
  34. package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +3 -0
  35. package/dist/esm/types/components/InputFilter/InputFilter.stories.d.ts +3 -0
  36. package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.d.ts +3 -0
  37. package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +6 -0
  38. package/dist/esm/types/components/PasswordInput/PasswordInput.stories.d.ts +3 -0
  39. package/dist/esm/types/components/Search/Search.stories.d.ts +3 -0
  40. package/dist/esm/types/components/Switch/Switch.d.ts +3 -1
  41. package/dist/esm/types/components/Switch/Switch.stories.d.ts +12 -4
  42. package/dist/esm/types/components/Switch/Switch.styles.d.ts +7 -0
  43. package/dist/esm/types/components/TextInput/TextInput.d.ts +6 -0
  44. package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +9 -0
  45. package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +4 -0
  46. package/dist/esm/types/components/Toast/Toast.d.ts +1 -0
  47. package/dist/esm/types/components/Toast/Toast.stories.d.ts +14 -0
  48. package/dist/esm/types/components/Toast/Toast.styles.d.ts +1 -0
  49. package/dist/index.d.ts +13 -1
  50. package/dist/src/theme/global.css +208 -89
  51. package/package.json +1 -1
  52. package/src/components/PasswordInput/PasswordInput.stories.tsx +1 -1
  53. package/src/components/PasswordInput/PasswordInput.tsx +2 -2
  54. package/src/components/Switch/Switch.stories.tsx +33 -2
  55. package/src/components/Switch/Switch.styles.ts +48 -0
  56. package/src/components/Switch/Switch.tsx +68 -45
  57. package/src/components/TextInput/TextInput.stories.tsx +82 -0
  58. package/src/components/TextInput/TextInput.styles.ts +36 -17
  59. package/src/components/TextInput/TextInput.tsx +40 -11
  60. package/src/components/Toast/Toast.stories.tsx +12 -2
  61. package/src/components/Toast/Toast.styles.tsx +38 -6
  62. package/src/components/Toast/Toast.tsx +7 -7
  63. package/src/components/Toast/Toaster.tsx +26 -4
  64. package/src/theme/themes/xspector/baseline.css +0 -1
  65. package/src/theme/tokens/components/switch.css +10 -11
  66. package/src/theme/themes/xspector/components/switch.css +0 -30
@@ -37,6 +37,9 @@ export const inputVariant = cva([
37
37
  error: {
38
38
  true: "ring-input-error hover:ring-input-error focus:ring-input-error",
39
39
  },
40
+ warning: {
41
+ true: "ring-warning-stroke hover:ring-warning-stroke focus:ring-warning-stroke",
42
+ },
40
43
  hasClearIcon: {
41
44
  true: "",
42
45
  },
@@ -343,19 +346,23 @@ export const helperTextVariant = cva(["typography-small1 flex flex-row items-cen
343
346
  true: "text-input-error",
344
347
  false: "text-input-filled-text",
345
348
  },
349
+ warning: {
350
+ true: "text-warning",
351
+ },
346
352
  },
347
353
  defaultVariants: {
348
354
  size: "md",
349
355
  disabled: false,
350
356
  error: false,
357
+ warning: false,
351
358
  },
352
359
  });
353
360
  const iconInteractiveColorStateClasses = [
354
361
  "fill-input-default-text",
355
- "peer-hover:fill-input-filled-text peer-focus:fill-input-filled-text peer-active:fill-input-filled-text",
362
+ "hover:fill-input-filled-text peer-hover:fill-input-filled-text peer-focus:fill-input-filled-text peer-active:fill-input-filled-text",
356
363
  "peer-disabled:fill-input-disable-stroke",
357
364
  "[&_svg]:text-input-default-text",
358
- "peer-hover:[&_svg]:text-input-filled-text peer-focus:[&_svg]:text-input-filled-text peer-active:[&_svg]:text-input-filled-text",
365
+ "hover:[&_svg]:text-input-filled-text peer-hover:[&_svg]:text-input-filled-text peer-focus:[&_svg]:text-input-filled-text peer-active:[&_svg]:text-input-filled-text",
359
366
  "peer-disabled:[&_svg]:text-input-disable-stroke",
360
367
  ];
361
368
  export const inlineEndIconWrapperVariant = cva([
@@ -419,14 +426,17 @@ export const segmentedIconWrapperVariant = cva([
419
426
  error: {
420
427
  false: "",
421
428
  },
429
+ warning: {
430
+ false: "",
431
+ },
422
432
  position: {
423
433
  start: [
424
434
  "inset-y-0 left-0 ",
425
- "border-r border-r-input-default-stroke peer-hover:border-r-input-active-stroke peer-focus:border-r-input-active-stroke peer-disabled:border-r-input-disable-stroke",
435
+ "border-r border-r-input-default-stroke hover:border-r-input-active-stroke peer-hover:border-r-input-active-stroke peer-focus:border-r-input-active-stroke peer-disabled:border-r-input-disable-stroke",
426
436
  ],
427
437
  end: [
428
438
  "inset-y-0 right-0 ",
429
- "border-l border-l-input-default-stroke peer-hover:border-l-input-active-stroke peer-focus:border-l-input-active-stroke peer-disabled:border-l-input-disable-stroke",
439
+ "border-l border-l-input-default-stroke hover:border-l-input-active-stroke peer-hover:border-l-input-active-stroke peer-focus:border-l-input-active-stroke peer-disabled:border-l-input-disable-stroke",
430
440
  ],
431
441
  },
432
442
  },
@@ -473,11 +483,23 @@ export const segmentedIconWrapperVariant = cva([
473
483
  error: true,
474
484
  className: "border-l-input-error",
475
485
  },
486
+ // --- Warning start ---
487
+ {
488
+ position: "start",
489
+ warning: true,
490
+ className: "border-r-warning-stroke",
491
+ },
492
+ {
493
+ position: "end",
494
+ warning: true,
495
+ className: "border-l-warning-stroke",
496
+ },
476
497
  ],
477
498
  defaultVariants: {
478
499
  size: "md",
479
500
  rounded: "normal",
480
501
  error: false,
502
+ warning: false,
481
503
  position: "end",
482
504
  },
483
505
  });
@@ -25,18 +25,18 @@ const ToastViewport = React.forwardRef((_a, ref) => {
25
25
  });
26
26
  ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
27
27
  const Toast = React.forwardRef((_a, ref) => {
28
- var { className, variant } = _a, props = __rest(_a, ["className", "variant"]);
29
- return (_jsx(ToastPrimitives.Root, Object.assign({ ref: ref, className: cn(toastVariants({ variant }), className) }, props)));
28
+ var { className, variant, showBorder } = _a, props = __rest(_a, ["className", "variant", "showBorder"]);
29
+ return (_jsx(ToastPrimitives.Root, Object.assign({ ref: ref, className: cn(toastVariants({ variant, showBorder }), className) }, props)));
30
30
  });
31
31
  Toast.displayName = ToastPrimitives.Root.displayName;
32
32
  const ToastAction = React.forwardRef((_a, ref) => {
33
33
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
34
- return (_jsx(ToastPrimitives.Action, Object.assign({ ref: ref, className: cn("", className) }, props, { asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", children: children }) })));
34
+ return (_jsx(ToastPrimitives.Action, Object.assign({ ref: ref, className: cn("", className) }, props, { asChild: true, children: _jsx(Button, { variant: "outline", color: "secondary", size: "sm", children: children }) })));
35
35
  });
36
36
  ToastAction.displayName = ToastPrimitives.Action.displayName;
37
37
  const ToastClose = React.forwardRef((_a, ref) => {
38
38
  var { className } = _a, props = __rest(_a, ["className"]);
39
- return (_jsx(ToastPrimitives.Close, Object.assign({ ref: ref, className: cn("-mr-2 self-center text-input-default-text", className), "toast-close": "" }, props, { asChild: true, children: _jsx(ActionButton, { variant: "icon", size: "sm", children: _jsx(Icon, { type: "heroicons", name: "xmark" }) }) })));
39
+ return (_jsx(ToastPrimitives.Close, Object.assign({ ref: ref, className: cn("-mr-2 self-center text-grey-light", className), "toast-close": "" }, props, { asChild: true, children: _jsx(ActionButton, { variant: "icon", size: "sm", children: _jsx(Icon, { type: "heroicons", name: "xmark" }) }) })));
40
40
  });
41
41
  ToastClose.displayName = ToastPrimitives.Close.displayName;
42
42
  const ToastTitle = React.forwardRef((_a, ref) => {
@@ -46,7 +46,7 @@ const ToastTitle = React.forwardRef((_a, ref) => {
46
46
  ToastTitle.displayName = ToastPrimitives.Title.displayName;
47
47
  const ToastDescription = React.forwardRef((_a, ref) => {
48
48
  var { className } = _a, props = __rest(_a, ["className"]);
49
- return (_jsx(ToastPrimitives.Description, Object.assign({ ref: ref, className: cn("typography-subtitile5 text-input-default-text", className) }, props)));
49
+ return (_jsx(ToastPrimitives.Description, Object.assign({ ref: ref, className: cn("typography-subtitile4 text-grey-light", className) }, props)));
50
50
  });
51
51
  ToastDescription.displayName = ToastPrimitives.Description.displayName;
52
52
  export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
@@ -11,9 +11,13 @@ const meta = {
11
11
  tags: ["autodocs"],
12
12
  parameters: {
13
13
  layout: "fullscreen",
14
+ backgrounds: {
15
+ default: "white",
16
+ values: [{ name: "white", value: "#ffffff" }],
17
+ },
14
18
  },
15
19
  decorators: [
16
- (Story) => (_jsx("div", { className: "flex max-h-screen w-full", children: _jsx(Story, {}) })),
20
+ (Story) => (_jsx("div", { className: "flex max-h-screen w-full bg-white p-4", children: _jsx(Story, {}) })),
17
21
  ],
18
22
  };
19
23
  export default meta;
@@ -38,11 +42,15 @@ export const Simple = {
38
42
  "bottom-right",
39
43
  ],
40
44
  },
45
+ showBorder: {
46
+ control: "boolean",
47
+ },
41
48
  },
42
49
  args: {
43
50
  variant: "default",
44
51
  contentMode: "horizontal",
45
52
  position: "top-center",
53
+ showBorder: false,
46
54
  },
47
55
  render: (args) => {
48
56
  console.log("args ", args);
@@ -53,11 +61,12 @@ export const Simple = {
53
61
  useEffect(() => {
54
62
  toast({
55
63
  variant: props.variant,
64
+ showBorder: props.showBorder,
56
65
  title: "Success",
57
66
  description: "This is an Info alert — check it out!",
58
67
  contentMode: props.contentMode,
59
68
  });
60
- }, [props.variant, props.contentMode]);
69
+ }, [props.variant, props.contentMode, props.showBorder]);
61
70
  return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(Toaster, {}), _jsx(Button, { onClick: () => {
62
71
  toast({
63
72
  title: "Scheduled: Catch up",
@@ -1,21 +1,53 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  export const toastVariants = cva([
3
3
  "group pointer-events-auto relative flex w-full",
4
- "rounded-md shadow-lg px-4 py-3 gap-1",
4
+ "rounded-lg shadow-[0px_8px_16px_0px_rgba(0,0,0,0.12)] px-4 py-3 gap-1",
5
5
  "transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
6
6
  "bg-base-popup text-base-popup-foreground",
7
7
  ], {
8
8
  variants: {
9
9
  variant: {
10
- default: "border",
11
- success: "border border-success-stroke",
12
- info: "border border-info-stroke",
13
- warning: "border border-warning-stroke",
14
- error: "border border-error-stroke",
10
+ default: "",
11
+ success: "",
12
+ info: "",
13
+ warning: "",
14
+ error: "",
15
+ },
16
+ showBorder: {
17
+ true: "",
18
+ false: "border-transparent",
15
19
  },
16
20
  },
21
+ compoundVariants: [
22
+ {
23
+ variant: "default",
24
+ showBorder: true,
25
+ className: "border",
26
+ },
27
+ {
28
+ variant: "success",
29
+ showBorder: true,
30
+ className: "border border-success-stroke",
31
+ },
32
+ {
33
+ variant: "info",
34
+ showBorder: true,
35
+ className: "border border-info-stroke",
36
+ },
37
+ {
38
+ variant: "warning",
39
+ showBorder: true,
40
+ className: "border border-warning-stroke",
41
+ },
42
+ {
43
+ variant: "error",
44
+ showBorder: true,
45
+ className: "border border-error-stroke",
46
+ },
47
+ ],
17
48
  defaultVariants: {
18
49
  variant: "success",
50
+ showBorder: false,
19
51
  },
20
52
  });
21
53
  export const toastViewportVariants = cva(["fixed z-[1000] flex w-auto flex-col-reverse px-4"], {
@@ -21,6 +21,22 @@ export function Toaster(_a) {
21
21
  const { toasts, position } = useToast();
22
22
  return (_jsxs(ToastProvider, Object.assign({}, toastProviderProps, { children: [toasts.map(function (_a) {
23
23
  var { id, title, description, action, contentMode = "horizontal", iconProps, renderIcon } = _a, props = __rest(_a, ["id", "title", "description", "action", "contentMode", "iconProps", "renderIcon"]);
24
- return (_jsxs(Toast, Object.assign({}, props, { children: [_jsx("div", { className: cn(toastIconVariants({ variant: props.variant }), iconWrapperClassName), children: renderIcon ? (renderIcon === null || renderIcon === void 0 ? void 0 : renderIcon()) : (_jsx(Icon, Object.assign({ type: "heroicons", name: "check-circle", className: "size-6" }, iconProps))) }), _jsxs("div", { className: cn(toastContentVariants({ contentMode }), contentClassName), children: [title && (_jsx(ToastTitle, { className: titleClassName, children: title })), description && (_jsx(ToastDescription, { className: descriptionClassName, children: description }))] }), _jsx("div", { className: cn("self-center ml-[var(--spacing-spacing-xl)]", actionWrapperClassName), children: action }), _jsx(ToastClose, {})] }), id));
24
+ const defaultIconName = props.variant === "error"
25
+ ? "circle-x"
26
+ : props.variant === "warning"
27
+ ? "circle-alert"
28
+ : props.variant === "info"
29
+ ? "info"
30
+ : "circle-check";
31
+ const titleToneClass = props.variant === "error"
32
+ ? "text-error"
33
+ : props.variant === "warning"
34
+ ? "text-warning"
35
+ : props.variant === "info"
36
+ ? "text-info"
37
+ : props.variant === "success"
38
+ ? "text-success"
39
+ : "text-base-popup-foreground";
40
+ return (_jsxs(Toast, Object.assign({}, props, { children: [_jsx("div", { className: cn(toastIconVariants({ variant: props.variant }), iconWrapperClassName), children: renderIcon ? (renderIcon === null || renderIcon === void 0 ? void 0 : renderIcon()) : (_jsx(Icon, Object.assign({ type: "lucide", name: defaultIconName, className: "size-[22px]" }, iconProps))) }), _jsxs("div", { className: cn(toastContentVariants({ contentMode }), contentClassName), children: [title && (_jsx(ToastTitle, { className: cn(titleToneClass, titleClassName), children: title })), description && (_jsx(ToastDescription, { className: descriptionClassName, children: description }))] }), _jsx("div", { className: cn("self-center ml-[var(--spacing-spacing-xl)]", actionWrapperClassName), children: action }), _jsx(ToastClose, {})] }), id));
25
41
  }), _jsx(ToastViewport, { position: position, className: viewportClassName })] })));
26
42
  }