@usefui/components 1.6.0 → 1.7.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.d.mts +380 -52
  3. package/dist/index.d.ts +380 -52
  4. package/dist/index.js +2532 -511
  5. package/dist/index.mjs +2518 -508
  6. package/package.json +3 -3
  7. package/src/__tests__/Avatar.test.tsx +55 -55
  8. package/src/accordion/Accordion.stories.tsx +6 -4
  9. package/src/accordion/index.tsx +1 -2
  10. package/src/avatar/Avatar.stories.tsx +37 -7
  11. package/src/avatar/index.tsx +90 -19
  12. package/src/avatar/styles/index.ts +58 -12
  13. package/src/badge/Badge.stories.tsx +27 -5
  14. package/src/badge/index.tsx +21 -13
  15. package/src/badge/styles/index.ts +69 -40
  16. package/src/button/Button.stories.tsx +40 -27
  17. package/src/button/index.tsx +13 -9
  18. package/src/button/styles/index.ts +308 -47
  19. package/src/card/index.tsx +2 -4
  20. package/src/checkbox/Checkbox.stories.tsx +72 -33
  21. package/src/checkbox/index.tsx +8 -6
  22. package/src/checkbox/styles/index.ts +239 -19
  23. package/src/collapsible/Collapsible.stories.tsx +6 -4
  24. package/src/dialog/Dialog.stories.tsx +173 -31
  25. package/src/dialog/styles/index.ts +13 -8
  26. package/src/dropdown/Dropdown.stories.tsx +61 -23
  27. package/src/dropdown/index.tsx +42 -31
  28. package/src/dropdown/styles/index.ts +30 -19
  29. package/src/field/Field.stories.tsx +183 -24
  30. package/src/field/index.tsx +930 -13
  31. package/src/field/styles/index.ts +246 -14
  32. package/src/field/types/index.ts +31 -0
  33. package/src/field/utils/index.ts +201 -0
  34. package/src/index.ts +2 -1
  35. package/src/message-bubble/MessageBubble.stories.tsx +59 -12
  36. package/src/message-bubble/index.tsx +22 -4
  37. package/src/message-bubble/styles/index.ts +4 -7
  38. package/src/otp-field/OTPField.stories.tsx +22 -24
  39. package/src/otp-field/index.tsx +9 -0
  40. package/src/otp-field/styles/index.ts +114 -16
  41. package/src/otp-field/types/index.ts +9 -1
  42. package/src/overlay/styles/index.ts +1 -0
  43. package/src/ruler/Ruler.stories.tsx +43 -0
  44. package/src/ruler/constants/index.ts +3 -0
  45. package/src/ruler/hooks/index.tsx +53 -0
  46. package/src/ruler/index.tsx +239 -0
  47. package/src/ruler/styles/index.tsx +154 -0
  48. package/src/ruler/types/index.ts +17 -0
  49. package/src/select/Select.stories.tsx +91 -0
  50. package/src/select/hooks/index.tsx +71 -0
  51. package/src/select/index.tsx +331 -0
  52. package/src/select/styles/index.tsx +156 -0
  53. package/src/shimmer/Shimmer.stories.tsx +6 -4
  54. package/src/skeleton/index.tsx +7 -6
  55. package/src/spinner/Spinner.stories.tsx +29 -4
  56. package/src/spinner/index.tsx +16 -6
  57. package/src/spinner/styles/index.ts +41 -22
  58. package/src/switch/Switch.stories.tsx +46 -17
  59. package/src/switch/index.tsx +5 -8
  60. package/src/switch/styles/index.ts +45 -45
  61. package/src/tabs/Tabs.stories.tsx +43 -15
  62. package/src/text-area/Textarea.stories.tsx +45 -8
  63. package/src/text-area/index.tsx +9 -6
  64. package/src/text-area/styles/index.ts +1 -1
  65. package/src/toggle/Toggle.stories.tsx +6 -4
  66. package/src/tree/Tree.stories.tsx +6 -4
  67. package/src/privacy-field/PrivacyField.stories.tsx +0 -29
  68. package/src/privacy-field/index.tsx +0 -56
  69. package/src/privacy-field/styles/index.ts +0 -17
@@ -1,56 +0,0 @@
1
- "use client";
2
-
3
- import React from "react";
4
-
5
- import { Field } from "../";
6
- import { Wrapper, Trigger } from "./styles";
7
-
8
- import type { IField } from "../";
9
-
10
- type PrivacyType = "password" | "text";
11
- interface PrivacyFieldProps extends IField {
12
- defaultType?: PrivacyType;
13
- textIcon: React.ReactNode;
14
- passwordIcon: React.ReactNode;
15
- }
16
-
17
- /**
18
- * PrivacyFields are used to hide sensitive values typed by users.
19
- *
20
- * @param {PrivacyFieldProps} props - The props for the PrivacyField component.
21
- * @param {boolean} props.raw - Define whether the component is styled or not.
22
- * @param {ComponentSizeEnum} props.sizing - The size of the component. Defaults to `medium`.
23
- * @param {string} props.variant - The style definition used by the component.
24
- * @param {string} props.error - The error message to display.
25
- * @param {string} props.hint - The hint message to display.
26
- * @param {string} props.defaultType - The type of the PrivacyField when rendered.
27
- * @param {ReactElement} props.textIcon - The Icon used to convey the text type information.
28
- * @param {ReactElement} props.passwordIcon - The Icon used to convey the password type information.
29
- * @returns {ReactElement} The PrivacyField component.
30
- */
31
- export const PrivacyField = ({
32
- defaultType,
33
- textIcon,
34
- passwordIcon,
35
- ...restProps
36
- }: PrivacyFieldProps) => {
37
- const [type, setType] = React.useState<PrivacyType>(
38
- defaultType ?? "password"
39
- );
40
-
41
- const handleChangeType = React.useCallback(() => {
42
- if (type === "text") setType("password");
43
- if (type === "password") setType("text");
44
- }, [type, setType]);
45
-
46
- return (
47
- <Wrapper className="flex">
48
- <Field autoComplete="off" type={type} {...restProps} />
49
- <Trigger variant="ghost" sizing="small" onClick={handleChangeType}>
50
- {type === "text" && textIcon}
51
- {type === "password" && passwordIcon}
52
- </Trigger>
53
- </Wrapper>
54
- );
55
- };
56
- PrivacyField.displayName = "PrivacyField";
@@ -1,17 +0,0 @@
1
- "use client";
2
-
3
- import styled from "styled-components";
4
- import { Button, Field } from "../../";
5
-
6
- export const Wrapper = styled(Field.Wrapper)`
7
- position: relative;
8
-
9
- input {
10
- width: 100% !important;
11
- }
12
- `;
13
- export const Trigger = styled(Button)`
14
- position: absolute !important;
15
- right: var(--measurement-medium-50);
16
- top: calc(var(--measurement-medium-50));
17
- `;