@rovula/ui 0.0.7 → 0.0.9

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 (37) hide show
  1. package/dist/cjs/bundle.css +136 -33
  2. package/dist/cjs/bundle.js +1 -1
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +26 -0
  5. package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +367 -0
  6. package/dist/cjs/types/components/Dropdown/Dropdown.styles.d.ts +11 -0
  7. package/dist/cjs/types/components/TextInput/TextInput.d.ts +3 -2
  8. package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +2 -16
  9. package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +0 -1
  10. package/dist/cjs/types/index.d.ts +1 -0
  11. package/dist/components/Dropdown/Dropdown.js +58 -0
  12. package/dist/components/Dropdown/Dropdown.stories.js +43 -0
  13. package/dist/components/Dropdown/Dropdown.styles.js +47 -0
  14. package/dist/components/TextInput/TextInput.js +3 -5
  15. package/dist/components/TextInput/TextInput.stories.js +1 -1
  16. package/dist/components/TextInput/TextInput.styles.js +13 -21
  17. package/dist/esm/bundle.css +136 -33
  18. package/dist/esm/bundle.js +1 -1
  19. package/dist/esm/bundle.js.map +1 -1
  20. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +26 -0
  21. package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +367 -0
  22. package/dist/esm/types/components/Dropdown/Dropdown.styles.d.ts +11 -0
  23. package/dist/esm/types/components/TextInput/TextInput.d.ts +3 -2
  24. package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +2 -16
  25. package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +0 -1
  26. package/dist/esm/types/index.d.ts +1 -0
  27. package/dist/index.d.ts +29 -2
  28. package/dist/index.js +1 -0
  29. package/dist/src/theme/global.css +170 -38
  30. package/package.json +1 -1
  31. package/src/components/Dropdown/Dropdown.stories.tsx +49 -0
  32. package/src/components/Dropdown/Dropdown.styles.ts +54 -0
  33. package/src/components/Dropdown/Dropdown.tsx +151 -0
  34. package/src/components/TextInput/TextInput.stories.tsx +3 -3
  35. package/src/components/TextInput/TextInput.styles.ts +13 -21
  36. package/src/components/TextInput/TextInput.tsx +14 -5
  37. package/src/index.ts +1 -0
@@ -3,7 +3,7 @@ import { cva } from "class-variance-authority";
3
3
  export const inputVariant = cva(
4
4
  [
5
5
  "border-0 outline-none",
6
- "p-1 flex",
6
+ "p-1 flex w-auto box-border",
7
7
  "peer text-black placeholder:text-transparent",
8
8
  ],
9
9
  {
@@ -21,7 +21,7 @@ export const inputVariant = cva(
21
21
  variant: {
22
22
  flat: "",
23
23
  outline:
24
- "ring-1 ring-inset ring-input-stroke hover:ring-input-active focus:ring-2 focus:ring-inset focus:ring-input-active",
24
+ "ring-1 ring-inset ring-input-stroke hover:ring-input-active focus:ring-1 focus:ring-inset focus:ring-input-stroke-active",
25
25
  underline:
26
26
  "border-b-2 border-input-stroke transition-colors hover:border-input-stroke-active focus:border-input-stroke",
27
27
  },
@@ -32,7 +32,7 @@ export const inputVariant = cva(
32
32
  true: "text-input-text-disabled ring-input-stroke-disabled placeholder:text-input-text-disabled",
33
33
  },
34
34
  error: {
35
- true: "ring-error",
35
+ true: "ring-error focus:ring-error",
36
36
  },
37
37
  hasClearIcon: {
38
38
  true: "",
@@ -73,22 +73,25 @@ export const inputVariant = cva(
73
73
 
74
74
  export const labelVariant = cva(
75
75
  [
76
- "absolute block transition-all px-[2px] text-input-text peer-focus:text-input-text-active peer-focus:bg-input-label-background",
76
+ "absolute block duration-450 transition-all px-[2px] text-input-text peer-focus:text-input-text-active peer-focus:bg-input-label-background",
77
77
  ],
78
78
  {
79
79
  variants: {
80
80
  size: {
81
81
  sm: [
82
- "left-3 top-2 typography-small1 peer-focus:-top-1.5 peer-focus:typography-label2",
83
- "bg-input-label-background peer-[:not(:placeholder-shown)]:-top-1.5 peer-[:not(:placeholder-shown)]:typography-label2",
82
+ "left-3 -top-1.5 typography-label2 bg-input-label-background",
83
+ "peer-placeholder-shown:top-2 peer-placeholder-shown:typography-small1 peer-placeholder-shown:bg-transparent",
84
+ "peer-focus:-top-1.5 peer-focus:typography-label2",
84
85
  ],
85
86
  md: [
86
- "left-3 top-2 typography-subtitile4 peer-focus:-top-1.5 peer-focus:typography-label1",
87
- "bg-input-label-background peer-[:not(:placeholder-shown)]:-top-1.5 peer-[:not(:placeholder-shown)]:typography-label1",
87
+ "left-3 -top-1.5 typography-label1 bg-input-label-background",
88
+ "peer-placeholder-shown:top-2 peer-placeholder-shown:typography-subtitile4 peer-placeholder-shown:bg-transparent",
89
+ "peer-focus:-top-1.5 peer-focus:typography-label1",
88
90
  ],
89
91
  lg: [
90
- "left-4 top-4 typography-subtitile1 peer-focus:-top-1.5 peer-focus:typography-label1",
91
- "bg-input-label-background peer-[:not(:placeholder-shown)]:-top-1.5 peer-[:not(:placeholder-shown)]:typography-label1",
92
+ "left-4 -top-1.5 typography-label1 bg-input-label-background",
93
+ "peer-placeholder-shown:top-4 peer-placeholder-shown:typography-subtitile1 peer-placeholder-shown:bg-transparent",
94
+ "peer-focus:-top-1.5 peer-focus:typography-label1",
92
95
  ],
93
96
  },
94
97
  disabled: {
@@ -97,22 +100,11 @@ export const labelVariant = cva(
97
100
  error: {
98
101
  true: "ring-error",
99
102
  },
100
- isFloating: {
101
- true: "-top-1.5 typography-label1 bg-input-label-background",
102
- },
103
103
  },
104
- compoundVariants: [
105
- {
106
- size: "sm",
107
- isFloating: true,
108
- class: "-top-1.5 typography-label2 bg-input-label-background",
109
- },
110
- ],
111
104
  defaultVariants: {
112
105
  size: "md",
113
106
  disabled: false,
114
107
  error: false,
115
- isFloating: false,
116
108
  },
117
109
  }
118
110
  );
@@ -1,4 +1,10 @@
1
- import React, { FC, forwardRef, useImperativeHandle, useRef } from "react";
1
+ import React, {
2
+ FC,
3
+ ReactNode,
4
+ forwardRef,
5
+ useImperativeHandle,
6
+ useRef,
7
+ } from "react";
2
8
  import {
3
9
  helperTextVariant,
4
10
  iconVariant,
@@ -9,7 +15,7 @@ import {
9
15
  import { twMerge } from "tailwind-merge";
10
16
  import { XCircleIcon, ExclamationCircleIcon } from "@heroicons/react/16/solid";
11
17
 
12
- type InputProps = {
18
+ export type InputProps = {
13
19
  id?: string;
14
20
  label?: string;
15
21
  size?: "sm" | "md" | "lg";
@@ -23,6 +29,7 @@ type InputProps = {
23
29
  error?: boolean;
24
30
  required?: boolean;
25
31
  hasClearIcon?: boolean;
32
+ endIcon?: ReactNode;
26
33
  className?: string;
27
34
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">;
28
35
 
@@ -37,11 +44,12 @@ const TextInput: FC<InputProps> = forwardRef(
37
44
  type = "text",
38
45
  helperText,
39
46
  errorMessage,
40
- fullwidth = false,
47
+ fullwidth = true,
41
48
  disabled = false,
42
49
  error = false,
43
50
  required = true,
44
51
  hasClearIcon = true,
52
+ endIcon,
45
53
  ...props
46
54
  },
47
55
  ref
@@ -61,7 +69,6 @@ const TextInput: FC<InputProps> = forwardRef(
61
69
  size,
62
70
  disabled,
63
71
  error,
64
- isFloating: !!props.value ?? false,
65
72
  });
66
73
  const helperTextClassname = helperTextVariant({ size, error, disabled });
67
74
  const iconWrapperClassname = iconWrapperVariant({ size });
@@ -78,10 +85,11 @@ const TextInput: FC<InputProps> = forwardRef(
78
85
  };
79
86
 
80
87
  return (
81
- <div className={`flex flex-col ${fullwidth ? "w-full" : ""}`}>
88
+ <div className={`inline-flex flex-col ${fullwidth ? "w-full" : ""}`}>
82
89
  <div className="relative">
83
90
  <input
84
91
  {...props}
92
+ placeholder=" "
85
93
  ref={inputRef}
86
94
  type={type}
87
95
  id={_id}
@@ -97,6 +105,7 @@ const TextInput: FC<InputProps> = forwardRef(
97
105
  />
98
106
  </div>
99
107
  )}
108
+ {endIcon}
100
109
  <label htmlFor={_id} className={labelClassname}>
101
110
  {label} {required && <span className="text-error">*</span>}
102
111
  </label>
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export { default as Table } from "./components/Table/Table";
6
6
  export { default as TextInput } from "./components/TextInput/TextInput";
7
7
  export { default as Text } from "./components/Text/Text";
8
8
  export { default as Tabs } from "./components/Tabs/Tabs";
9
+ export { default as Dropdown } from "./components/Dropdown/Dropdown";
9
10
 
10
11
  // UTILS
11
12
  export {