greenole-design-system 1.1.6 → 1.1.8

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 (88) hide show
  1. package/README.md +13 -1
  2. package/package.json +2 -4
  3. package/src/assets/react.svg +0 -1
  4. package/src/base-components/Button/Button.stories.tsx +0 -180
  5. package/src/base-components/Button/Button.tsx +0 -84
  6. package/src/base-components/Button/Button.types.ts +0 -18
  7. package/src/base-components/Button/index.ts +0 -5
  8. package/src/base-components/Dropdown/Dropdown.stories.tsx +0 -160
  9. package/src/base-components/Dropdown/Dropdown.tsx +0 -203
  10. package/src/base-components/Dropdown/Dropdown.types.ts +0 -23
  11. package/src/base-components/Dropdown/DropdownOptionItem.tsx +0 -59
  12. package/src/base-components/Dropdown/index.ts +0 -2
  13. package/src/base-components/Loading/Loading.stories.tsx +0 -43
  14. package/src/base-components/Loading/Loading.tsx +0 -44
  15. package/src/base-components/Loading/Loading.types.ts +0 -7
  16. package/src/base-components/Loading/index.ts +0 -2
  17. package/src/components/Accordion/Accordion.stories.tsx +0 -66
  18. package/src/components/Accordion/Accordion.tsx +0 -58
  19. package/src/components/Accordion/types.ts +0 -9
  20. package/src/components/Calendar/Calendar.stories.tsx +0 -86
  21. package/src/components/Calendar/Calendar.styles.ts +0 -11
  22. package/src/components/Calendar/Calendar.tsx +0 -27
  23. package/src/components/Calendar/Calendar.types.ts +0 -11
  24. package/src/components/Calendar/Calendar.utils.ts +0 -19
  25. package/src/components/Calendar/DateRangePicker.tsx +0 -113
  26. package/src/components/Calendar/Presets.tsx +0 -75
  27. package/src/components/Calendar/index.ts +0 -3
  28. package/src/components/Card/Card.stories.tsx +0 -111
  29. package/src/components/Card/Card.tsx +0 -26
  30. package/src/components/Card/Card.types.ts +0 -34
  31. package/src/components/Card/CardBody.tsx +0 -16
  32. package/src/components/Card/CardFooter.tsx +0 -26
  33. package/src/components/Card/CardHeader.tsx +0 -48
  34. package/src/components/Card/index.ts +0 -6
  35. package/src/components/Empty/Empty.stories.tsx +0 -34
  36. package/src/components/Empty/Empty.tsx +0 -23
  37. package/src/components/Icons/ArrowBack.tsx +0 -23
  38. package/src/components/Icons/ArrowForward.tsx +0 -23
  39. package/src/components/Icons/Campaing.tsx +0 -29
  40. package/src/components/Icons/Checkbox.tsx +0 -25
  41. package/src/components/Icons/ChevronDown.tsx +0 -16
  42. package/src/components/Icons/ChevronUp.tsx +0 -25
  43. package/src/components/Icons/DashEdit.tsx +0 -18
  44. package/src/components/Icons/Dashboard.tsx +0 -18
  45. package/src/components/Icons/Devices.tsx +0 -18
  46. package/src/components/Icons/FlagBR.tsx +0 -48
  47. package/src/components/Icons/FlagES.tsx +0 -575
  48. package/src/components/Icons/FlagPT.tsx +0 -157
  49. package/src/components/Icons/FlagUK.tsx +0 -26
  50. package/src/components/Icons/FlagUSA.tsx +0 -25
  51. package/src/components/Icons/HeaderSearch.tsx +0 -25
  52. package/src/components/Icons/HelpOutlined.tsx +0 -18
  53. package/src/components/Icons/History.tsx +0 -25
  54. package/src/components/Icons/Home.tsx +0 -25
  55. package/src/components/Icons/Icons.stories.tsx +0 -118
  56. package/src/components/Icons/Icons.tsx +0 -44
  57. package/src/components/Icons/Info.tsx +0 -34
  58. package/src/components/Icons/Language.tsx +0 -18
  59. package/src/components/Icons/Lock.tsx +0 -19
  60. package/src/components/Icons/Logout.tsx +0 -18
  61. package/src/components/Icons/Map.tsx +0 -18
  62. package/src/components/Icons/Moon.tsx +0 -25
  63. package/src/components/Icons/MoreHorizontal.tsx +0 -26
  64. package/src/components/Icons/Notification.tsx +0 -19
  65. package/src/components/Icons/PeopleAlt.tsx +0 -21
  66. package/src/components/Icons/PriorityHigh.tsx +0 -23
  67. package/src/components/Icons/Public.tsx +0 -26
  68. package/src/components/Icons/Search.tsx +0 -26
  69. package/src/components/Icons/Secutiry.tsx +0 -18
  70. package/src/components/Icons/Settings.tsx +0 -18
  71. package/src/components/Icons/Star.tsx +0 -30
  72. package/src/components/Icons/WBSunny.tsx +0 -25
  73. package/src/components/Icons/WarningAmber.tsx +0 -18
  74. package/src/components/Table/DataTable.stories.tsx +0 -233
  75. package/src/components/Table/DataTable.tsx +0 -103
  76. package/src/components/Table/Pagination.tsx +0 -92
  77. package/src/components/Table/types.tsx +0 -11
  78. package/src/components/Typography/Typography.stories.tsx +0 -274
  79. package/src/components/Typography/Typography.tsx +0 -256
  80. package/src/index.css +0 -15
  81. package/src/index.ts +0 -15
  82. package/src/main.jsx +0 -8
  83. package/src/theme.css +0 -156
  84. package/src/utils/i18n/i18n.ts +0 -32
  85. package/src/utils/i18n/locales/en.json +0 -5
  86. package/src/utils/i18n/locales/es.json +0 -5
  87. package/src/utils/i18n/locales/pt-br.json +0 -5
  88. package/src/utils/i18n/locales/pt.json +0 -5
package/README.md CHANGED
@@ -36,7 +36,19 @@ npm install greenole-design-system
36
36
 
37
37
  ## Usage
38
38
 
39
- After installation, you can import and use the library's components as follows:
39
+ After installation, you need to import both the CSS styles and the components:
40
+
41
+ ### 1. Import the CSS styles
42
+
43
+ First, import the CSS file in your main application file (usually `main.jsx`, `App.jsx`, or `index.js`):
44
+
45
+ ```jsx
46
+ import 'greenole-design-system/dist/greenole.css';
47
+ ```
48
+
49
+ ### 2. Import and use components
50
+
51
+ Then you can import and use the library's components:
40
52
 
41
53
  ```jsx
42
54
  import React from 'react';
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "greenole-design-system",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "type": "module",
5
5
  "main": "dist/greenole-design-system.cjs.js",
6
6
  "module": "dist/greenole-design-system.es.js",
7
7
  "types": "dist/index.d.ts",
8
- "style": "dist/greenole.css",
9
8
  "files": [
10
- "dist",
11
- "src"
9
+ "dist"
12
10
  ],
13
11
  "publishConfig": {
14
12
  "access": "public"
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -1,180 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import React from "react";
3
- import ChevronDown from "../../components/Icons/ChevronDown";
4
- import Info from "../../components/Icons/Info";
5
- import Lock from "../../components/Icons/Lock";
6
- import Star from "../../components/Icons/Star";
7
- import Button from "./Button";
8
-
9
- const iconOptions = {
10
- Nenhum: null,
11
- Lock: <Lock className="w-4 h-4" />,
12
- ChevronDown: <ChevronDown className="w-4 h-4" />,
13
- Info: <Info className="w-4 h-4" />,
14
- Star: <Star className="w-4 h-4" />,
15
- };
16
-
17
- const meta: Meta<typeof Button> = {
18
- title: "Base Components/Button",
19
- component: Button,
20
- tags: ["autodocs"],
21
- argTypes: {
22
- variant: {
23
- control: "select",
24
- options: ["primary", "secondary", "tertiary", "link"],
25
- description: "Tipo do botão",
26
- defaultValue: "primary",
27
- },
28
- size: {
29
- control: "select",
30
- options: ["sm", "md", "lg"],
31
- description: "Tamanho do botão",
32
- defaultValue: "md",
33
- },
34
- color: {
35
- control: "select",
36
- options: ["default", "danger"],
37
- description: "Cor do botão",
38
- defaultValue: "default",
39
- },
40
- typography: {
41
- control: "select",
42
- options: [
43
- "body-xl-bold",
44
- "body-xl-semibold",
45
- "body-xl-medium",
46
- "body-xl-regular",
47
- "body-lg-bold",
48
- "body-lg-semibold",
49
- "body-lg-medium",
50
- "body-lg-regular",
51
- "body-md-bold",
52
- "body-md-semibold",
53
- "body-md-medium",
54
- "body-md-regular",
55
- "body-sm-bold",
56
- "body-sm-semibold",
57
- "body-sm-medium",
58
- "body-sm-regular",
59
- ],
60
- description: "Tipografia do texto",
61
- defaultValue: "body-md-medium",
62
- },
63
- fullWidth: {
64
- control: "boolean",
65
- description: "Ocupa largura total",
66
- defaultValue: false,
67
- },
68
- loading: {
69
- control: "boolean",
70
- description: "Estado de carregando",
71
- defaultValue: false,
72
- },
73
- iconLeft: {
74
- name: "Ícone à esquerda",
75
- options: Object.keys(iconOptions),
76
- mapping: iconOptions,
77
- control: {
78
- type: "select",
79
- labels: {
80
- Nenhum: "Nenhum",
81
- Lock: "Lock",
82
- ChevronDown: "ChevronDown",
83
- Info: "Info",
84
- Star: "Star",
85
- },
86
- },
87
- },
88
- iconRight: {
89
- name: "Ícone à direita",
90
- options: Object.keys(iconOptions),
91
- mapping: iconOptions,
92
- control: {
93
- type: "select",
94
- labels: {
95
- Nenhum: "Nenhum",
96
- Lock: "Lock",
97
- ChevronDown: "ChevronDown",
98
- Info: "Info",
99
- Star: "Star",
100
- },
101
- },
102
- },
103
- disabled: {
104
- control: "boolean",
105
- description: "Desabilita o botão",
106
- defaultValue: false,
107
- },
108
- },
109
- parameters: {
110
- docs: {
111
- description: {
112
- component: `Botões interativos seguindo o Design System Greenole com variantes, tamanhos, tipografia, loading, disabled e ícones integrados.`,
113
- },
114
- },
115
- },
116
- };
117
-
118
- export default meta;
119
- type Story = StoryObj<typeof Button>;
120
-
121
- export const Primary: Story = {
122
- args: {
123
- children: "Primary Button",
124
- variant: "primary",
125
- },
126
- };
127
-
128
- export const Secondary: Story = {
129
- args: {
130
- children: "Secondary Button",
131
- variant: "secondary",
132
- },
133
- };
134
-
135
- export const Tertiary: Story = {
136
- args: {
137
- children: "Tertiary Button",
138
- variant: "tertiary",
139
- },
140
- };
141
-
142
- export const Link: Story = {
143
- args: {
144
- children: "Link Button",
145
- variant: "link",
146
- },
147
- };
148
-
149
- export const DangerPrimary: Story = {
150
- args: {
151
- children: "Danger Primary",
152
- variant: "primary",
153
- color: "danger",
154
- },
155
- };
156
-
157
- export const WithIcons: Story = {
158
- args: {
159
- children: "Button with Icons",
160
- variant: "primary",
161
- iconLeft: <Lock className="w-4 h-4" />,
162
- iconRight: <ChevronDown className="w-4 h-4" />,
163
- },
164
- };
165
-
166
- export const LoadingState: Story = {
167
- args: {
168
- children: "Loading",
169
- variant: "primary",
170
- loading: true,
171
- },
172
- };
173
-
174
- export const Disabled: Story = {
175
- args: {
176
- children: "Disabled Button",
177
- variant: "primary",
178
- disabled: true,
179
- },
180
- };
@@ -1,84 +0,0 @@
1
- import React from "react";
2
- import Typography from "../../components/Typography/Typography";
3
- import { Loading } from "../Loading";
4
- import { ButtonProps } from "./Button.types";
5
-
6
- const Button: React.FC<ButtonProps> = ({
7
- children,
8
- variant = "primary",
9
- size = "md",
10
- color = "default",
11
- typography = "body-md-medium",
12
- loading = false,
13
- fullWidth = false,
14
- iconLeft,
15
- iconRight,
16
- className = "",
17
- disabled = false,
18
- ...props
19
- }) => {
20
- const base =
21
- "inline-flex flex-row items-center justify-center rounded-[12px] transition-colors duration-200 gap-2";
22
-
23
- const sizes = {
24
- sm: "h-8 px-3",
25
- md: "h-9 px-4",
26
- lg: "h-10 px-4",
27
- };
28
-
29
- const variants = {
30
- primary:
31
- "bg-[var(--brandcolor-main)] text-white hover:bg-[var(--brandcolor-darkest)]",
32
- secondary:
33
- "border border-[var(--brandcolor-main)] text-[var(--brandcolor-main)] hover:bg-[var(--brandcolor-softest)]",
34
- tertiary:
35
- "border border-[var(--neutral-dark)] text-[var(--neutral-dark)] hover:bg-[var(--neutral-soft)]",
36
- link: "text-[var(--link-dark)] hover:underline",
37
- };
38
-
39
- const dangerVariants = {
40
- primary: "bg-[var(--danger)] text-white hover:bg-[var(--danger-dark)]",
41
- secondary:
42
- "border border-[var(--danger)] text-[var(--danger)] hover:bg-[var(--red-500)]",
43
- tertiary:
44
- "border border-[var(--danger)] text-[var(--danger)] hover:bg-[var(--red-500)]",
45
- link: "text-[var(--danger)] hover:underline",
46
- };
47
-
48
- const disabledClasses =
49
- "bg-[var(--neutral-soft)] text-[var(--neutral-grey)] border border-[var(--neutral-soft)] cursor-not-allowed";
50
-
51
- const colorClasses = disabled
52
- ? disabledClasses
53
- : color === "danger"
54
- ? dangerVariants[variant]
55
- : variants[variant];
56
-
57
- const isPrimary = variant === "primary" && color !== "danger";
58
- const isDangerPrimary = variant === "primary" && color === "danger";
59
-
60
- const loadingColor =
61
- isPrimary || isDangerPrimary ? "white" : "var(--brandcolor-main)";
62
-
63
- return (
64
- <button
65
- className={`${base} ${sizes[size]} ${colorClasses} ${
66
- fullWidth ? "w-full" : ""
67
- } ${className}`}
68
- disabled={disabled || loading}
69
- {...props}
70
- >
71
- {iconLeft && <span className="flex items-center">{iconLeft}</span>}
72
- <Typography variant={typography} className="whitespace-nowrap">
73
- {children}
74
- </Typography>
75
- {loading ? (
76
- <Loading size={16} color={loadingColor} />
77
- ) : (
78
- iconRight && <span className="flex items-center">{iconRight}</span>
79
- )}
80
- </button>
81
- );
82
- };
83
-
84
- export default Button;
@@ -1,18 +0,0 @@
1
- import { ButtonHTMLAttributes, ReactNode } from "react";
2
- import { TypographyVariant } from "../../components/Typography/Typography";
3
-
4
- export type ButtonVariant = "primary" | "secondary" | "tertiary" | "link";
5
- export type ButtonSize = "sm" | "md" | "lg";
6
- export type ButtonColor = "default" | "danger";
7
-
8
- export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
9
- children: ReactNode;
10
- variant?: ButtonVariant;
11
- size?: ButtonSize;
12
- color?: ButtonColor;
13
- fullWidth?: boolean;
14
- typography?: TypographyVariant;
15
- loading?: boolean;
16
- iconLeft?: ReactNode;
17
- iconRight?: ReactNode;
18
- }
@@ -1,5 +0,0 @@
1
- export { default as Button } from "./Button";
2
- export type {
3
- ButtonColor, ButtonProps, ButtonSize, ButtonVariant
4
- } from "./Button.types";
5
-
@@ -1,160 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import React, { useState } from "react";
3
- import HelpOutlined from "../../components/Icons/HelpOutlined";
4
- import Info from "../../components/Icons/Info";
5
- import Lock from "../../components/Icons/Lock";
6
- import Star from "../../components/Icons/Star";
7
- import { Dropdown } from "./";
8
- import { DropdownOption } from "./Dropdown.types";
9
-
10
- const iconOptions = {
11
- Nenhum: null,
12
- Info: <Info className="text-neutral-grey" />,
13
- Lock: <Lock className="text-neutral-grey" />,
14
- Star: <Star className="text-neutral-grey" />,
15
- Help: <HelpOutlined className="text-neutral-grey" />,
16
- };
17
-
18
- const meta: Meta<typeof Dropdown> = {
19
- title: "Base Components/Dropdown",
20
- component: Dropdown,
21
- tags: ["autodocs"],
22
- parameters: {
23
- docs: {
24
- description: {
25
- component: `Dropdown apresenta opções de escolha únicas de forma compacta, com suporte a input de busca opcional, label configurável (size/weight), subtitle e ícone no subtitle.`,
26
- },
27
- },
28
- },
29
- argTypes: {
30
- hasSearch: {
31
- control: "boolean",
32
- description: "Ativa input de busca",
33
- defaultValue: false,
34
- },
35
- width: {
36
- control: { type: "select" },
37
- options: ["w-48", "w-64", "w-80", "w-full"],
38
- description: "Classe Tailwind de largura do dropdown",
39
- defaultValue: "w-64",
40
- },
41
- label: {
42
- control: "text",
43
- description: "Label acima do dropdown",
44
- defaultValue: "Selecione uma opção",
45
- },
46
- labelSize: {
47
- control: { type: "select" },
48
- options: ["body-xl", "body-lg", "body-md", "body-sm", "caption"],
49
- description: "Tamanho da label",
50
- defaultValue: "body-md",
51
- },
52
- labelWeight: {
53
- control: { type: "select" },
54
- options: ["bold", "semibold", "medium", "regular"],
55
- description: "Peso da label",
56
- defaultValue: "regular",
57
- },
58
- subtitle: {
59
- control: "text",
60
- description: "Subtitle abaixo do dropdown",
61
- defaultValue: "Subtítulo opcional do dropdown",
62
- },
63
- subtitleIcon: {
64
- name: "Ícone do subtítulo",
65
- options: Object.keys(iconOptions),
66
- mapping: iconOptions,
67
- control: {
68
- type: "select",
69
- labels: {
70
- Nenhum: "Nenhum",
71
- Info: "Info",
72
- Lock: "Lock",
73
- Star: "Star",
74
- Help: "HelpOutlined",
75
- },
76
- },
77
- },
78
- theme: {
79
- table: { disable: true },
80
- },
81
- },
82
- };
83
-
84
- export default meta;
85
- type Story = StoryObj<typeof Dropdown>;
86
-
87
- const storesOptions: DropdownOption[] = [
88
- { value: "1234", label: "Loja 1234" },
89
- { value: "1334", label: "Loja 1334" },
90
- { value: "1434", label: "Loja 1434" },
91
- { value: "1534", label: "Loja 1534" },
92
- ];
93
-
94
- const containerStyle =
95
- "min-h-[200px] w-full p-4 rounded-md";
96
-
97
- export const Default: Story = {
98
- args: {
99
- hasSearch: false,
100
- width: "w-64",
101
- label: "Selecione uma loja",
102
- labelSize: "body-md",
103
- labelWeight: "regular",
104
- subtitle: "Lista de lojas disponíveis",
105
- subtitleIcon: "Info",
106
- },
107
- render: ({
108
- hasSearch,
109
- width,
110
- label,
111
- labelSize,
112
- labelWeight,
113
- subtitle,
114
- subtitleIcon,
115
- }) => {
116
- const [selected, setSelected] = useState<string>("");
117
- return (
118
- <div className={`${containerStyle} ${width} bg-[var(--background-soft)]`}>
119
- <Dropdown
120
- options={storesOptions}
121
- selectedValue={selected}
122
- onChange={setSelected}
123
- hasSearch={hasSearch}
124
- width={width}
125
- label={label}
126
- labelSize={labelSize}
127
- labelWeight={labelWeight}
128
- subtitle={subtitle}
129
- subtitleIcon={subtitleIcon}
130
- placeholder="Selecione a loja"
131
- />
132
- </div>
133
- );
134
- },
135
- };
136
-
137
- export const DarkTheme: Story = {
138
- name: "Dark Theme",
139
- render: () => {
140
- const [selected, setSelected] = useState<string>("1234");
141
- return (
142
- <div
143
- className={`${containerStyle} ${"bg-[var(--background-dark-hardest)]"} text-[var(--neutral-softest)]`}
144
- >
145
- <Dropdown
146
- options={storesOptions}
147
- theme="dark"
148
- selectedValue={selected}
149
- onChange={setSelected}
150
- label="Dropdown Dark"
151
- labelSize="body-md"
152
- labelWeight="semibold"
153
- subtitle="Subtítulo no tema escuro"
154
- subtitleIcon={<Info className="text-neutral-grey" />}
155
- placeholder="Selecione loja"
156
- />
157
- </div>
158
- );
159
- },
160
- };