@1doc/1ds-react 0.0.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/README.md +34 -0
- package/dist/components/Alert/Alert.css +188 -0
- package/dist/components/Alert/Alert.d.ts +65 -0
- package/dist/components/Alert/Alert.js +56 -0
- package/dist/components/Avatar/Avatar.css +88 -0
- package/dist/components/Avatar/Avatar.d.ts +34 -0
- package/dist/components/Avatar/Avatar.js +16 -0
- package/dist/components/Avatar/AvatarGroup.d.ts +12 -0
- package/dist/components/Avatar/AvatarGroup.js +8 -0
- package/dist/components/Badge/Badge.css +155 -0
- package/dist/components/Badge/Badge.d.ts +46 -0
- package/dist/components/Badge/Badge.js +17 -0
- package/dist/components/Button/Button.css +199 -0
- package/dist/components/Button/Button.d.ts +23 -0
- package/dist/components/Button/Button.js +62 -0
- package/dist/components/Checkbox/Checkbox.css +122 -0
- package/dist/components/Checkbox/Checkbox.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.js +49 -0
- package/dist/components/Divider/Divider.css +81 -0
- package/dist/components/Divider/Divider.d.ts +18 -0
- package/dist/components/Divider/Divider.js +26 -0
- package/dist/components/Grid/Grid.css +154 -0
- package/dist/components/Grid/Grid.d.ts +21 -0
- package/dist/components/Grid/Grid.js +53 -0
- package/dist/components/Icon/Icon.css +41 -0
- package/dist/components/Icon/Icon.d.ts +12 -0
- package/dist/components/Icon/Icon.js +29 -0
- package/dist/components/Input/Input.css +190 -0
- package/dist/components/Input/Input.d.ts +32 -0
- package/dist/components/Input/Input.js +58 -0
- package/dist/components/Link/Link.css +76 -0
- package/dist/components/Link/Link.d.ts +15 -0
- package/dist/components/Link/Link.js +19 -0
- package/dist/components/Logo/Logo.css +32 -0
- package/dist/components/Logo/Logo.d.ts +10 -0
- package/dist/components/Logo/Logo.js +16 -0
- package/dist/components/Modal/Modal.css +155 -0
- package/dist/components/Modal/Modal.d.ts +36 -0
- package/dist/components/Modal/Modal.js +55 -0
- package/dist/components/Radio/Radio.css +114 -0
- package/dist/components/Radio/Radio.d.ts +19 -0
- package/dist/components/Radio/Radio.js +39 -0
- package/dist/components/Select/Select.css +291 -0
- package/dist/components/Select/Select.d.ts +38 -0
- package/dist/components/Select/Select.js +246 -0
- package/dist/components/Spinner/Spinner.css +60 -0
- package/dist/components/Spinner/Spinner.d.ts +16 -0
- package/dist/components/Spinner/Spinner.js +16 -0
- package/dist/components/Switch/Switch.css +127 -0
- package/dist/components/Switch/Switch.d.ts +18 -0
- package/dist/components/Switch/Switch.js +57 -0
- package/dist/components/Tabs/Tab.d.ts +19 -0
- package/dist/components/Tabs/Tab.js +76 -0
- package/dist/components/Tabs/TabContent.d.ts +15 -0
- package/dist/components/Tabs/TabContent.js +11 -0
- package/dist/components/Tabs/Tabs.css +124 -0
- package/dist/components/Tabs/Tabs.d.ts +20 -0
- package/dist/components/Tabs/Tabs.js +14 -0
- package/dist/components/Tabs/TabsContent.d.ts +16 -0
- package/dist/components/Tabs/TabsContent.js +12 -0
- package/dist/components/Tabs/tabs.context.d.ts +2 -0
- package/dist/components/Tabs/tabs.context.js +2 -0
- package/dist/components/Tag/Tag.css +140 -0
- package/dist/components/Tag/Tag.d.ts +63 -0
- package/dist/components/Tag/Tag.js +48 -0
- package/dist/components/Text/Text.css +1213 -0
- package/dist/components/Text/Text.d.ts +70 -0
- package/dist/components/Text/Text.js +89 -0
- package/dist/components/Textarea/Textarea.css +133 -0
- package/dist/components/Textarea/Textarea.d.ts +28 -0
- package/dist/components/Textarea/Textarea.js +72 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +27 -0
- package/dist/utils/theme.d.ts +30 -0
- package/dist/utils/theme.js +106 -0
- package/package.json +26 -0
- package/scripts/postbuild.js +21 -0
- package/src/index.ts +28 -0
- package/src/utils/theme.ts +136 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import './Badge.css';
|
|
2
|
+
/**
|
|
3
|
+
* Componente Badge para exibir status, rótulos e contagens.
|
|
4
|
+
* Suporta múltiplas variantes de cor, tamanhos e estilos.
|
|
5
|
+
*/
|
|
6
|
+
export interface BadgeProps {
|
|
7
|
+
/**
|
|
8
|
+
* Variação de cor semântica.
|
|
9
|
+
* @default 'neutral'
|
|
10
|
+
*/
|
|
11
|
+
variant?: "neutral" | "positive" | "negative" | "info" | "primary";
|
|
12
|
+
/**
|
|
13
|
+
* Tamanho do badge.
|
|
14
|
+
* LG: 3rem, MD: 2rem, SM: 1.5rem, XS: 1rem, PILL: 0.75rem.
|
|
15
|
+
* @default 'md'
|
|
16
|
+
*/
|
|
17
|
+
size?: "sm" | "md" | "lg" | "xs" | "pill";
|
|
18
|
+
/**
|
|
19
|
+
* Estilo visual do badge.
|
|
20
|
+
* @default 'soft'
|
|
21
|
+
*/
|
|
22
|
+
type?: "solid" | "soft" | "outlined";
|
|
23
|
+
/**
|
|
24
|
+
* Conteúdo do ícone à esquerda.
|
|
25
|
+
* - React: Passe um elemento React (ex: `<Icon />`).
|
|
26
|
+
* - Vue: Utilize o slot `#iconLeft`.
|
|
27
|
+
*/
|
|
28
|
+
iconLeft?: any;
|
|
29
|
+
/**
|
|
30
|
+
* Conteúdo do ícone à direita.
|
|
31
|
+
* - React: Passe um elemento React (ex: `<Icon />`).
|
|
32
|
+
* - Vue: Utilize o slot `#iconRight`.
|
|
33
|
+
*/
|
|
34
|
+
iconRight?: any;
|
|
35
|
+
/**
|
|
36
|
+
* Classes CSS adicionais.
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Conteúdo textual do badge.
|
|
41
|
+
*/
|
|
42
|
+
children?: any;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}
|
|
45
|
+
declare function Badge(props: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export default Badge;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './Badge.css';
|
|
3
|
+
function Badge(props) {
|
|
4
|
+
function classes() {
|
|
5
|
+
return [
|
|
6
|
+
"umds-badge",
|
|
7
|
+
`umds-badge--${props.variant || "neutral"}`,
|
|
8
|
+
`umds-badge--${props.size || "md"}`,
|
|
9
|
+
`umds-badge--${props.type || "soft"}`,
|
|
10
|
+
props.className,
|
|
11
|
+
]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(" ");
|
|
14
|
+
}
|
|
15
|
+
return (_jsxs("span", { ...props, className: classes(), children: [_jsx("span", { className: "umds-badge__icon", children: _jsx(_Fragment, { children: props.iconLeft }) }), _jsx(_Fragment, { children: props.children || "{props.children}" }), _jsx("span", { className: "umds-badge__icon", children: _jsx(_Fragment, { children: props.iconRight }) })] }));
|
|
16
|
+
}
|
|
17
|
+
export default Badge;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
.umds-button {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: var(--umds-primitive-spacing-nano);
|
|
6
|
+
border-radius: var(--umds-primitive-border-radius-sm);
|
|
7
|
+
/* Updated from 4px to match Figma */
|
|
8
|
+
padding: 0 var(--umds-primitive-spacing-xxxs);
|
|
9
|
+
height: var(--umds-primitive-spacing-sm);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
border: 1px solid transparent;
|
|
12
|
+
font-family: var(--umds-semantic-font-family-base, inherit);
|
|
13
|
+
font-weight: var(--umds-primitive-font-weight-semibold);
|
|
14
|
+
/* Updated from 500 to match Figma (Semibold) */
|
|
15
|
+
transition: all 0.2s;
|
|
16
|
+
font-size: var(--umds-primitive-font-size-xxs);
|
|
17
|
+
line-height: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/* Focus States */
|
|
22
|
+
.umds-button:focus-visible {
|
|
23
|
+
outline: 2px solid var(--umds-semantic-color-neutral-dark-down);
|
|
24
|
+
outline-offset: 2px;
|
|
25
|
+
box-shadow: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Primary */
|
|
29
|
+
.umds-button--primary {
|
|
30
|
+
background-color: var(--umds-semantic-color-primary-pure);
|
|
31
|
+
color: var(--umds-semantic-color-neutral-light-pure);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.umds-button--primary:hover:not(:disabled) {
|
|
35
|
+
background-color: var(--umds-semantic-color-primary-dark);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.umds-button--primary:disabled {
|
|
39
|
+
background-color: var(--umds-semantic-color-neutral-light-medium);
|
|
40
|
+
cursor: not-allowed;
|
|
41
|
+
color: var(--umds-semantic-color-neutral-dark-medium);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Secondary */
|
|
45
|
+
.umds-button--secondary {
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
border-color: var(--umds-semantic-color-primary-pure);
|
|
48
|
+
color: var(--umds-semantic-color-primary-pure);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.umds-button--secondary:hover:not(:disabled) {
|
|
52
|
+
background-color: var(--umds-semantic-color-primary-light);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.umds-button--secondary:disabled {
|
|
56
|
+
border-color: var(--umds-semantic-color-neutral-light-medium);
|
|
57
|
+
color: var(--umds-semantic-color-neutral-dark-medium);
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Sizes */
|
|
62
|
+
.umds-button--sm {
|
|
63
|
+
height: var(--umds-primitive-spacing-xs);
|
|
64
|
+
padding: 0 12px;
|
|
65
|
+
font-size: var(--umds-primitive-font-size-xxxs);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.umds-button--md {
|
|
69
|
+
height: var(--umds-primitive-spacing-sm);
|
|
70
|
+
padding: 0 var(--umds-primitive-spacing-xxxs);
|
|
71
|
+
font-size: var(--umds-primitive-font-size-xxs);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.umds-button--lg {
|
|
75
|
+
height: var(--umds-primitive-spacing-md);
|
|
76
|
+
padding: 0 var(--umds-primitive-spacing-xxs);
|
|
77
|
+
font-size: var(--umds-primitive-font-size-xs);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Neutral */
|
|
81
|
+
.umds-button--neutral {
|
|
82
|
+
background-color: var(--umds-semantic-color-neutral-light-pure);
|
|
83
|
+
border-color: var(--umds-semantic-color-neutral-dark-up);
|
|
84
|
+
color: var(--umds-semantic-color-neutral-dark-down);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.umds-button--neutral:hover:not(:disabled) {
|
|
88
|
+
background-color: var(--umds-semantic-color-neutral-light-medium);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.umds-button--neutral:disabled {
|
|
92
|
+
background-color: var(--umds-semantic-color-neutral-light-pure);
|
|
93
|
+
border-color: var(--umds-semantic-color-neutral-light-down);
|
|
94
|
+
color: var(--umds-semantic-color-neutral-light-down);
|
|
95
|
+
cursor: not-allowed;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Text */
|
|
99
|
+
.umds-button--text {
|
|
100
|
+
background-color: transparent;
|
|
101
|
+
border-color: transparent;
|
|
102
|
+
color: var(--umds-semantic-color-primary-pure);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.umds-button--text:hover:not(:disabled) {
|
|
106
|
+
background-color: var(--umds-semantic-color-primary-light);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.umds-button--text:disabled {
|
|
110
|
+
color: var(--umds-semantic-color-neutral-dark-medium);
|
|
111
|
+
cursor: not-allowed;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Danger */
|
|
115
|
+
.umds-button--danger {
|
|
116
|
+
background-color: var(--umds-semantic-color-feedback-negative-pure);
|
|
117
|
+
color: var(--umds-semantic-color-neutral-light-pure);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.umds-button--danger:hover:not(:disabled) {
|
|
121
|
+
background-color: var(--umds-semantic-color-feedback-negative-dark);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.umds-button--danger:disabled {
|
|
125
|
+
background-color: var(--umds-semantic-color-neutral-light-medium);
|
|
126
|
+
color: var(--umds-semantic-color-neutral-dark-medium);
|
|
127
|
+
cursor: not-allowed;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Danger Outlined */
|
|
131
|
+
.umds-button--danger-outlined {
|
|
132
|
+
background-color: transparent;
|
|
133
|
+
border-color: var(--umds-semantic-color-feedback-negative-pure);
|
|
134
|
+
color: var(--umds-semantic-color-feedback-negative-dark);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.umds-button--danger-outlined:hover:not(:disabled) {
|
|
138
|
+
background-color: var(--umds-semantic-color-feedback-negative-light);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.umds-button--danger-outlined:disabled {
|
|
142
|
+
border-color: var(--umds-semantic-color-neutral-light-medium);
|
|
143
|
+
color: var(--umds-semantic-color-neutral-dark-medium);
|
|
144
|
+
cursor: not-allowed;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Icon */
|
|
148
|
+
.umds-button--icon {
|
|
149
|
+
background-color: transparent;
|
|
150
|
+
color: var(--umds-semantic-color-neutral-dark-down);
|
|
151
|
+
padding: 0;
|
|
152
|
+
min-width: unset;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.umds-button--icon:hover:not(:disabled) {
|
|
156
|
+
background-color: var(--umds-semantic-color-neutral-light-medium);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.umds-button--icon.umds-button--sm {
|
|
160
|
+
width: 32px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.umds-button--icon.umds-button--md {
|
|
164
|
+
width: 40px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.umds-button--icon.umds-button--lg {
|
|
168
|
+
width: 48px;
|
|
169
|
+
/* Assuming 48px for large icon button, Figma said 40 but text buttons are 48? Need to double check, keeping consistent with height for now */
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.umds-button--icon:disabled {
|
|
173
|
+
color: var(--umds-semantic-color-neutral-light-down);
|
|
174
|
+
cursor: not-allowed;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* Full Width */
|
|
178
|
+
.umds-button--full-width {
|
|
179
|
+
width: 100%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Loading */
|
|
183
|
+
.umds-button__loading {
|
|
184
|
+
animation: spin 1s linear infinite;
|
|
185
|
+
height: 1em;
|
|
186
|
+
width: 1em;
|
|
187
|
+
min-width: 1em;
|
|
188
|
+
/* Ensure it doesn't shrink */
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@keyframes spin {
|
|
192
|
+
from {
|
|
193
|
+
transform: rotate(0deg);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
to {
|
|
197
|
+
transform: rotate(360deg);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import './Button.css';
|
|
2
|
+
/**
|
|
3
|
+
* Button component properties
|
|
4
|
+
* @property {string} [aria-label] - Descrição acessível do botão. OBRIGATÓRIO se o botão não possuir texto visível (ex: icon-only). Caso não fornecido, o texto interno será usado.
|
|
5
|
+
*/
|
|
6
|
+
export interface ButtonProps {
|
|
7
|
+
variant?: "primary" | "secondary" | "neutral" | "text" | "danger" | "danger-outlined" | "icon";
|
|
8
|
+
size?: "sm" | "md" | "lg";
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
type?: "button" | "submit" | "reset";
|
|
11
|
+
children?: any;
|
|
12
|
+
onClick?: (event: any) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
startIcon?: any;
|
|
15
|
+
endIcon?: any;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
loadingIcon?: any;
|
|
18
|
+
loadingPosition?: "start" | "end" | "center";
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
declare function Button(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default Button;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './Button.css';
|
|
3
|
+
"use client";
|
|
4
|
+
import Icon from "../Icon/Icon";
|
|
5
|
+
function Button(props) {
|
|
6
|
+
function classes() {
|
|
7
|
+
return [
|
|
8
|
+
"umds-button",
|
|
9
|
+
`umds-button--${props.variant || "primary"}`,
|
|
10
|
+
`umds-button--${props.size || "md"}`,
|
|
11
|
+
props.fullWidth ? "umds-button--full-width" : "",
|
|
12
|
+
props.className,
|
|
13
|
+
]
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.join(" ");
|
|
16
|
+
}
|
|
17
|
+
function showStartIcon() {
|
|
18
|
+
const isLoading = props.loading;
|
|
19
|
+
const position = props.loadingPosition || "center";
|
|
20
|
+
return !isLoading || (isLoading && position === "end");
|
|
21
|
+
}
|
|
22
|
+
function showEndIcon() {
|
|
23
|
+
const isLoading = props.loading;
|
|
24
|
+
const position = props.loadingPosition || "center";
|
|
25
|
+
return !isLoading || (isLoading && position === "start");
|
|
26
|
+
}
|
|
27
|
+
function showLoadingAtStart() {
|
|
28
|
+
return props.loading && props.loadingPosition === "start";
|
|
29
|
+
}
|
|
30
|
+
function showLoadingAtEnd() {
|
|
31
|
+
return props.loading && props.loadingPosition === "end";
|
|
32
|
+
}
|
|
33
|
+
function showLoadingAtCenter() {
|
|
34
|
+
return (props.loading &&
|
|
35
|
+
(props.loadingPosition === "center" || !props.loadingPosition));
|
|
36
|
+
}
|
|
37
|
+
function showChildren() {
|
|
38
|
+
const isLoading = props.loading;
|
|
39
|
+
const position = props.loadingPosition || "center";
|
|
40
|
+
return !isLoading || (isLoading && position !== "center");
|
|
41
|
+
}
|
|
42
|
+
return (_jsxs("button", { ...props, type: props.type || "button", disabled: props.disabled, onClick: (event) => props.onClick?.(event), className: classes(), children: [showLoadingAtStart() ? (_jsx(Icon, { className: "umds-button__loading", variant: "inherit", name: typeof props.loadingIcon === "string"
|
|
43
|
+
? props.loadingIcon
|
|
44
|
+
: props.loadingIcon
|
|
45
|
+
? undefined
|
|
46
|
+
: "refresh", component: typeof props.loadingIcon !== "string"
|
|
47
|
+
? props.loadingIcon
|
|
48
|
+
: undefined, size: props.size })) : null, showStartIcon() ? (_jsx(_Fragment, { children: typeof props.startIcon === "string" ? (_jsx(Icon, { variant: "inherit", name: props.startIcon, size: props.size })) : (_jsx(_Fragment, { children: _jsx(_Fragment, { children: props.startIcon }) })) })) : null, showLoadingAtCenter() ? (_jsx(Icon, { className: "umds-button__loading", variant: "inherit", name: typeof props.loadingIcon === "string"
|
|
49
|
+
? props.loadingIcon
|
|
50
|
+
: props.loadingIcon
|
|
51
|
+
? undefined
|
|
52
|
+
: "refresh", component: typeof props.loadingIcon !== "string"
|
|
53
|
+
? props.loadingIcon
|
|
54
|
+
: undefined, size: props.size })) : null, showChildren() ? _jsx(_Fragment, { children: props.children }) : null, showEndIcon() ? (_jsx(_Fragment, { children: typeof props.endIcon === "string" ? (_jsx(Icon, { variant: "inherit", name: props.endIcon, size: props.size })) : (_jsx(_Fragment, { children: _jsx(_Fragment, { children: props.endIcon }) })) })) : null, showLoadingAtEnd() ? (_jsx(Icon, { className: "umds-button__loading", variant: "inherit", name: typeof props.loadingIcon === "string"
|
|
55
|
+
? props.loadingIcon
|
|
56
|
+
: props.loadingIcon
|
|
57
|
+
? undefined
|
|
58
|
+
: "refresh", component: typeof props.loadingIcon !== "string"
|
|
59
|
+
? props.loadingIcon
|
|
60
|
+
: undefined, size: props.size })) : null] }));
|
|
61
|
+
}
|
|
62
|
+
export default Button;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* Main Container */
|
|
2
|
+
.umds-checkbox {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
position: relative;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
font-family: var(--umds-semantic-font-family-base, inherit);
|
|
8
|
+
gap: var(--umds-primitive-spacing-nano);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.umds-checkbox--disabled {
|
|
12
|
+
cursor: not-allowed;
|
|
13
|
+
opacity: 0.6;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Input (Hidden visually but accessible) */
|
|
17
|
+
.umds-checkbox__input {
|
|
18
|
+
position: absolute;
|
|
19
|
+
opacity: 0;
|
|
20
|
+
width: 0;
|
|
21
|
+
height: 0;
|
|
22
|
+
margin: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Control (Box) */
|
|
26
|
+
.umds-checkbox__control {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
border: 1px solid var(--umds-semantic-color-neutral-dark-up);
|
|
31
|
+
border-radius: var(--umds-primitive-border-radius-xxs);
|
|
32
|
+
background-color: var(--umds-semantic-color-background-white);
|
|
33
|
+
transition: all 0.2s ease-in-out;
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Sizes */
|
|
38
|
+
.umds-checkbox--small .umds-checkbox__control {
|
|
39
|
+
width: var(--umds-primitive-spacing-xxxs);
|
|
40
|
+
height: var(--umds-primitive-spacing-xxxs);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.umds-checkbox--medium .umds-checkbox__control {
|
|
44
|
+
width: 20px;
|
|
45
|
+
height: 20px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.umds-checkbox--large .umds-checkbox__control {
|
|
49
|
+
width: var(--umds-primitive-spacing-xxs);
|
|
50
|
+
height: var(--umds-primitive-spacing-xxs);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Checked State */
|
|
54
|
+
.umds-checkbox--checked .umds-checkbox__control,
|
|
55
|
+
.umds-checkbox--indeterminate .umds-checkbox__control {
|
|
56
|
+
background-color: var(--umds-semantic-color-primary-pure);
|
|
57
|
+
border-color: var(--umds-semantic-color-primary-dark);
|
|
58
|
+
color: var(--umds-semantic-color-neutral-light-pure);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Hover State (not disabled) - Default (Unchecked) */
|
|
62
|
+
.umds-checkbox:not(.umds-checkbox--disabled):hover .umds-checkbox__control {
|
|
63
|
+
border-color: var(--umds-semantic-color-neutral-dark-down);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Hover State - Checked/Indeterminate */
|
|
67
|
+
.umds-checkbox--checked:not(.umds-checkbox--disabled):hover .umds-checkbox__control,
|
|
68
|
+
.umds-checkbox--indeterminate:not(.umds-checkbox--disabled):hover .umds-checkbox__control {
|
|
69
|
+
background-color: var(--umds-semantic-color-primary-dark);
|
|
70
|
+
border-color: var(--umds-semantic-color-primary-dark);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Focus State */
|
|
74
|
+
.umds-checkbox__input:focus+.umds-checkbox__control {
|
|
75
|
+
/* Using primary medium for focus ring as per standard, unless specified otherwise */
|
|
76
|
+
box-shadow: 0 0 0 2px var(--umds-semantic-color-background-white), 0 0 0 4px var(--umds-semantic-color-primary-medium);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Invalid/Error State */
|
|
80
|
+
.umds-checkbox--invalid .umds-checkbox__control {
|
|
81
|
+
border-color: var(--umds-semantic-color-feedback-negative-pure);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.umds-checkbox--invalid.umds-checkbox--checked .umds-checkbox__control,
|
|
85
|
+
.umds-checkbox--invalid.umds-checkbox--indeterminate .umds-checkbox__control {
|
|
86
|
+
background-color: var(--umds-semantic-color-feedback-negative-pure);
|
|
87
|
+
border-color: var(--umds-semantic-color-feedback-negative-pure);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Content (Label + Description) */
|
|
91
|
+
.umds-checkbox__content {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Adjust top padding if needed to align with box */
|
|
98
|
+
.umds-checkbox--small .umds-checkbox__content {
|
|
99
|
+
padding-top: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.umds-checkbox__label {
|
|
103
|
+
/* Styles handled by Text component */
|
|
104
|
+
display: inline-block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.umds-checkbox__description {
|
|
108
|
+
/* Styles handled by Text component */
|
|
109
|
+
margin-top: 2px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Icon Color Override because Icon component might set its own */
|
|
113
|
+
.umds-checkbox--checked .umds-checkbox__control .umds-icon,
|
|
114
|
+
.umds-checkbox--indeterminate .umds-checkbox__control .umds-icon {
|
|
115
|
+
color: currentColor;
|
|
116
|
+
/* Inherit white */
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* CheckButton Variant */
|
|
120
|
+
.umds-checkbox--button {
|
|
121
|
+
gap: 0;
|
|
122
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './Checkbox.css';
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
checked?: any;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
indeterminate?: boolean;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
size?: "small" | "medium" | "large";
|
|
10
|
+
variant?: "default" | "button";
|
|
11
|
+
name?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
onChange?: (checked: boolean) => void;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
declare function Checkbox(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default Checkbox;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './Checkbox.css';
|
|
3
|
+
"use client";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import Icon from "../Icon/Icon";
|
|
6
|
+
import Text from "../Text/Text";
|
|
7
|
+
function Checkbox(props) {
|
|
8
|
+
const [internalChecked, setInternalChecked] = useState(() => props.defaultChecked || false);
|
|
9
|
+
function isChecked() {
|
|
10
|
+
return props.checked !== undefined ? props.checked : internalChecked;
|
|
11
|
+
}
|
|
12
|
+
function handleChange(event) {
|
|
13
|
+
if (props.disabled)
|
|
14
|
+
return;
|
|
15
|
+
const newValue = event.target.checked;
|
|
16
|
+
setInternalChecked(newValue);
|
|
17
|
+
if (typeof props.onChange === "function") {
|
|
18
|
+
props.onChange(newValue);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function classes() {
|
|
22
|
+
const checkedValue = props.checked !== undefined ? props.checked : internalChecked;
|
|
23
|
+
return [
|
|
24
|
+
"umds-checkbox",
|
|
25
|
+
`umds-checkbox--${props.size || "medium"}`,
|
|
26
|
+
props.variant === "button" ? "umds-checkbox--button" : "",
|
|
27
|
+
props.disabled ? "umds-checkbox--disabled" : "",
|
|
28
|
+
props.invalid ? "umds-checkbox--invalid" : "",
|
|
29
|
+
checkedValue ? "umds-checkbox--checked" : "",
|
|
30
|
+
props.indeterminate ? "umds-checkbox--indeterminate" : "",
|
|
31
|
+
props.className,
|
|
32
|
+
]
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join(" ");
|
|
35
|
+
}
|
|
36
|
+
function iconSize() {
|
|
37
|
+
if (props.size === "small")
|
|
38
|
+
return "sm";
|
|
39
|
+
if (props.size === "large")
|
|
40
|
+
return "lg";
|
|
41
|
+
return "md";
|
|
42
|
+
}
|
|
43
|
+
return (_jsxs("label", { className: classes(), children: [_jsx("input", { type: "checkbox", className: "umds-checkbox__input", checked: isChecked(), disabled: props.disabled, required: props.required, name: props.name, value: props.value, id: props.id, onChange: (event) => handleChange(event) }), _jsxs("span", { className: "umds-checkbox__control", children: [isChecked() && !props.indeterminate ? (_jsx(Icon, { name: "check", size: iconSize() })) : null, props.indeterminate ? _jsx(Icon, { name: "minus", size: iconSize() }) : null] }), (props.label || props.description) && props.variant !== "button" ? (_jsxs("span", { className: "umds-checkbox__content", children: [props.label ? (_jsx(Text, { as: "span", className: "umds-checkbox__label", variant: props.size === "small"
|
|
44
|
+
? "caption"
|
|
45
|
+
: props.size === "large"
|
|
46
|
+
? "body1"
|
|
47
|
+
: "body2", children: props.label })) : null, props.description ? (_jsx(Text, { as: "span", variant: "caption", color: "secondary", className: "umds-checkbox__description", children: props.description })) : null] })) : null] }));
|
|
48
|
+
}
|
|
49
|
+
export default Checkbox;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.umds-divider {
|
|
2
|
+
border: none;
|
|
3
|
+
background-color: transparent;
|
|
4
|
+
margin: 0;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Orientation */
|
|
10
|
+
.umds-divider--horizontal {
|
|
11
|
+
display: block;
|
|
12
|
+
width: 100%;
|
|
13
|
+
border-top: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-down);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.umds-divider--vertical {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
height: 100%;
|
|
19
|
+
min-height: 1em;
|
|
20
|
+
border-left: var(--umds-primitive-border-width-hairline) solid var(--umds-semantic-color-neutral-light-down);
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Variants */
|
|
25
|
+
.umds-divider--dashed.umds-divider--horizontal {
|
|
26
|
+
border-top-style: dashed;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.umds-divider--dashed.umds-divider--vertical {
|
|
30
|
+
border-left-style: dashed;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.umds-divider--dotted.umds-divider--horizontal {
|
|
34
|
+
border-top-style: dotted;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.umds-divider--dotted.umds-divider--vertical {
|
|
38
|
+
border-left-style: dotted;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Spacing */
|
|
42
|
+
|
|
43
|
+
/* Sem espaçamento explícito */
|
|
44
|
+
.umds-divider--spacing-none {
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Horizontal Spacing */
|
|
49
|
+
.umds-divider--horizontal.umds-divider--spacing-sm {
|
|
50
|
+
margin-top: var(--umds-primitive-spacing-xs);
|
|
51
|
+
/* 8px */
|
|
52
|
+
margin-bottom: var(--umds-primitive-spacing-xs);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.umds-divider--horizontal.umds-divider--spacing-md {
|
|
56
|
+
margin-top: var(--umds-primitive-spacing-md);
|
|
57
|
+
/* 16px */
|
|
58
|
+
margin-bottom: var(--umds-primitive-spacing-md);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.umds-divider--horizontal.umds-divider--spacing-lg {
|
|
62
|
+
margin-top: var(--umds-primitive-spacing-xl);
|
|
63
|
+
/* 24px */
|
|
64
|
+
margin-bottom: var(--umds-primitive-spacing-xl);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Vertical Spacing */
|
|
68
|
+
.umds-divider--vertical.umds-divider--spacing-sm {
|
|
69
|
+
margin-left: var(--umds-primitive-spacing-xs);
|
|
70
|
+
margin-right: var(--umds-primitive-spacing-xs);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.umds-divider--vertical.umds-divider--spacing-md {
|
|
74
|
+
margin-left: var(--umds-primitive-spacing-md);
|
|
75
|
+
margin-right: var(--umds-primitive-spacing-md);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.umds-divider--vertical.umds-divider--spacing-lg {
|
|
79
|
+
margin-left: var(--umds-primitive-spacing-xl);
|
|
80
|
+
margin-right: var(--umds-primitive-spacing-xl);
|
|
81
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import './Divider.css';
|
|
2
|
+
/**
|
|
3
|
+
* Divider component to separate content
|
|
4
|
+
* @property {string} orientation - Orientação do divider: 'horizontal' ou 'vertical'
|
|
5
|
+
* @property {string} variant - Estilo da linha: 'solid', 'dashed', 'dotted'
|
|
6
|
+
* @property {string} spacing - Espaçamento ao redor: 'none', 'sm', 'md', 'lg'
|
|
7
|
+
* @property {string | number} thickness - Espessura da linha
|
|
8
|
+
*/
|
|
9
|
+
export interface DividerProps {
|
|
10
|
+
orientation?: "horizontal" | "vertical";
|
|
11
|
+
variant?: "solid" | "dashed" | "dotted";
|
|
12
|
+
spacing?: "none" | "sm" | "md" | "lg";
|
|
13
|
+
thickness?: string | number;
|
|
14
|
+
className?: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
declare function Divider(props: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default Divider;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './Divider.css';
|
|
3
|
+
function Divider(props) {
|
|
4
|
+
function classes() {
|
|
5
|
+
return [
|
|
6
|
+
"umds-divider",
|
|
7
|
+
`umds-divider--${props.orientation || "horizontal"}`,
|
|
8
|
+
`umds-divider--${props.variant || "solid"}`,
|
|
9
|
+
props.spacing ? `umds-divider--spacing-${props.spacing}` : "",
|
|
10
|
+
props.className,
|
|
11
|
+
]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(" ");
|
|
14
|
+
}
|
|
15
|
+
function dividerStyle() {
|
|
16
|
+
const thickness = props.thickness;
|
|
17
|
+
if (!thickness)
|
|
18
|
+
return {};
|
|
19
|
+
const value = typeof thickness === "number" ? `${thickness}px` : thickness;
|
|
20
|
+
return {
|
|
21
|
+
"--divider-size": value,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return (_jsx("hr", { style: dividerStyle(), "aria-orientation": props.orientation || "horizontal", className: classes() }));
|
|
25
|
+
}
|
|
26
|
+
export default Divider;
|