@dnanpm/ui-components 0.0.5 → 0.2.0
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 +11 -42
- package/dist/components/Accordion/Accordion.cjs +32 -0
- package/dist/components/Accordion/Accordion.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.css +19 -0
- package/dist/components/Accordion/Accordion.d.ts +3 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +32 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/Accordion.module.css.cjs +12 -0
- package/dist/components/Accordion/Accordion.module.css.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.module.css.js +12 -0
- package/dist/components/Accordion/Accordion.module.css.js.map +1 -0
- package/dist/components/Accordion/Accordion.types.d.ts +21 -0
- package/dist/components/Accordion/Accordion.types.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.utils.cjs +8 -0
- package/dist/components/Accordion/Accordion.utils.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.utils.d.ts +8 -0
- package/dist/components/Accordion/Accordion.utils.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.utils.js +8 -0
- package/dist/components/Accordion/Accordion.utils.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +3 -0
- package/dist/components/Accordion/index.d.ts.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.cjs +57 -0
- package/dist/components/AccordionItem/AccordionItem.cjs.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.css +128 -0
- package/dist/components/AccordionItem/AccordionItem.d.ts +3 -0
- package/dist/components/AccordionItem/AccordionItem.d.ts.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.js +57 -0
- package/dist/components/AccordionItem/AccordionItem.js.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.cjs +17 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.cjs.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.js +18 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.js.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.types.d.ts +32 -0
- package/dist/components/AccordionItem/AccordionItem.types.d.ts.map +1 -0
- package/dist/components/AccordionItem/index.d.ts +3 -0
- package/dist/components/AccordionItem/index.d.ts.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs +72 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +73 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +72 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs +25 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js +25 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts +42 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts.map +1 -0
- package/dist/components/Breadcrumb/index.d.ts +3 -0
- package/dist/components/Breadcrumb/index.d.ts.map +1 -0
- package/dist/components/Button/Button.cjs +104 -0
- package/dist/components/Button/Button.cjs.map +1 -0
- package/dist/components/Button/Button.css +182 -0
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +104 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.module.css.cjs +24 -0
- package/dist/components/Button/Button.module.css.cjs.map +1 -0
- package/dist/components/Button/Button.module.css.js +24 -0
- package/dist/components/Button/Button.module.css.js.map +1 -0
- package/dist/components/Button/Button.types.d.ts +68 -35
- package/dist/components/Button/Button.types.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/ColorScheme/ColorScheme.cjs +9 -0
- package/dist/components/ColorScheme/ColorScheme.cjs.map +1 -0
- package/dist/components/ColorScheme/ColorScheme.d.ts +3 -0
- package/dist/components/ColorScheme/ColorScheme.d.ts.map +1 -0
- package/dist/components/ColorScheme/ColorScheme.js +9 -0
- package/dist/components/ColorScheme/ColorScheme.js.map +1 -0
- package/dist/components/ColorScheme/ColorScheme.types.d.ts +10 -0
- package/dist/components/ColorScheme/ColorScheme.types.d.ts.map +1 -0
- package/dist/components/ColorScheme/index.d.ts +3 -0
- package/dist/components/ColorScheme/index.d.ts.map +1 -0
- package/dist/components/Label/Label.cjs +18 -0
- package/dist/components/Label/Label.cjs.map +1 -0
- package/dist/components/Label/Label.css +38 -0
- package/dist/components/Label/Label.d.ts +3 -0
- package/dist/components/Label/Label.d.ts.map +1 -0
- package/dist/components/Label/Label.js +18 -0
- package/dist/components/Label/Label.js.map +1 -0
- package/dist/components/Label/Label.module.css.cjs +16 -0
- package/dist/components/Label/Label.module.css.cjs.map +1 -0
- package/dist/components/Label/Label.module.css.js +16 -0
- package/dist/components/Label/Label.module.css.js.map +1 -0
- package/dist/components/Label/Label.types.d.ts +24 -0
- package/dist/components/Label/Label.types.d.ts.map +1 -0
- package/dist/components/Label/index.d.ts +3 -0
- package/dist/components/Label/index.d.ts.map +1 -0
- package/dist/components/Notification/Notification.cjs +57 -0
- package/dist/components/Notification/Notification.cjs.map +1 -0
- package/dist/components/Notification/Notification.css +90 -0
- package/dist/components/Notification/Notification.d.ts +3 -0
- package/dist/components/Notification/Notification.d.ts.map +1 -0
- package/dist/components/Notification/Notification.js +57 -0
- package/dist/components/Notification/Notification.js.map +1 -0
- package/dist/components/Notification/Notification.module.css.cjs +24 -0
- package/dist/components/Notification/Notification.module.css.cjs.map +1 -0
- package/dist/components/Notification/Notification.module.css.js +24 -0
- package/dist/components/Notification/Notification.module.css.js.map +1 -0
- package/dist/components/Notification/Notification.types.d.ts +40 -0
- package/dist/components/Notification/Notification.types.d.ts.map +1 -0
- package/dist/components/Notification/index.d.ts +3 -0
- package/dist/components/Notification/index.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.cjs +62 -0
- package/dist/components/Spinner/Spinner.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.css +116 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -0
- package/dist/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.js +62 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/Spinner.module.css.cjs +26 -0
- package/dist/components/Spinner/Spinner.module.css.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.module.css.js +26 -0
- package/dist/components/Spinner/Spinner.module.css.js.map +1 -0
- package/dist/components/Spinner/Spinner.types.d.ts +41 -0
- package/dist/components/Spinner/Spinner.types.d.ts.map +1 -0
- package/dist/components/Spinner/index.d.ts +3 -0
- package/dist/components/{Tooltip → Spinner}/index.d.ts.map +1 -1
- package/dist/font-definitions.css +61 -0
- package/dist/index.cjs +19 -10027
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -10008
- package/dist/index.js.map +1 -1
- package/dist/styles/utils/elevation.css +28 -0
- package/dist/styles/utils/elevation.module.css.cjs +10 -0
- package/dist/styles/utils/elevation.module.css.cjs.map +1 -0
- package/dist/styles/utils/elevation.module.css.js +10 -0
- package/dist/styles/utils/elevation.module.css.js.map +1 -0
- package/dist/styles/utils/focus.css +80 -0
- package/dist/styles/utils/focus.module.css.cjs +16 -0
- package/dist/styles/utils/focus.module.css.cjs.map +1 -0
- package/dist/styles/utils/focus.module.css.js +16 -0
- package/dist/styles/utils/focus.module.css.js.map +1 -0
- package/dist/styles/utils/text-decoration.css +7 -0
- package/dist/styles/utils/text-decoration.module.css.cjs +10 -0
- package/dist/styles/utils/text-decoration.module.css.cjs.map +1 -0
- package/dist/styles/utils/text-decoration.module.css.js +10 -0
- package/dist/styles/utils/text-decoration.module.css.js.map +1 -0
- package/dist/styles.css +327 -466
- package/dist/utils/cn/cn.cjs +8 -0
- package/dist/utils/cn/cn.cjs.map +1 -0
- package/dist/utils/cn/cn.js +8 -0
- package/dist/utils/cn/cn.js.map +1 -0
- package/package.json +11 -9
- package/dist/components/Box/Box.d.ts +0 -2
- package/dist/components/Box/Box.d.ts.map +0 -1
- package/dist/components/Box/Box.types.d.ts +0 -24
- package/dist/components/Box/Box.types.d.ts.map +0 -1
- package/dist/components/Box/index.d.ts +0 -3
- package/dist/components/Box/index.d.ts.map +0 -1
- package/dist/components/Dialog/Dialog.d.ts +0 -3
- package/dist/components/Dialog/Dialog.d.ts.map +0 -1
- package/dist/components/Dialog/Dialog.types.d.ts +0 -45
- package/dist/components/Dialog/Dialog.types.d.ts.map +0 -1
- package/dist/components/Dialog/index.d.ts +0 -3
- package/dist/components/Dialog/index.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -3
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +0 -39
- package/dist/components/Tooltip/Tooltip.types.d.ts.map +0 -1
- package/dist/components/Tooltip/index.d.ts +0 -3
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.d.ts.map +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
@layer dna-design-system {._button_188fd_1 {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: var(--spacing-ui-xxs);
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
border: none;
|
|
8
|
+
border-radius: var(--radius-semantic-full);
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
position: relative;
|
|
12
|
+
transition:
|
|
13
|
+
color 0.2s ease-in-out,
|
|
14
|
+
background-color 0.2s ease-in-out,
|
|
15
|
+
border-color 0.2s ease-in-out;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
._button--full-width_188fd_18 {
|
|
19
|
+
width: 100%;
|
|
20
|
+
min-width: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* ─── Sizes ─── */
|
|
24
|
+
|
|
25
|
+
._button--normal_188fd_25 {
|
|
26
|
+
font: var(--typography-label-lg-bold);
|
|
27
|
+
height: 40px;
|
|
28
|
+
min-width: 128px;
|
|
29
|
+
padding: var(--spacing-ui-xs) var(--spacing-ui-lg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
._button--small_188fd_32 {
|
|
33
|
+
font: var(--typography-label-md-bold);
|
|
34
|
+
height: 32px;
|
|
35
|
+
min-width: 100px;
|
|
36
|
+
padding: var(--spacing-ui-xs) var(--spacing-ui-lg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* ─── Primary variant ─── */
|
|
40
|
+
|
|
41
|
+
._button--primary_188fd_41 {
|
|
42
|
+
background-color: var(--color-semantic-interactive-primary-default);
|
|
43
|
+
color: var(--color-semantic-foreground-inverse);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
._button--primary_188fd_41:hover {
|
|
47
|
+
background-color: var(--color-semantic-interactive-primary-hover);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
._button--primary_188fd_41:active {
|
|
51
|
+
background-color: var(--color-semantic-interactive-primary-active);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
._button--primary_188fd_41:focus-visible {
|
|
55
|
+
background-color: var(--color-semantic-interactive-primary-focus);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ─── Secondary variant ─── */
|
|
59
|
+
|
|
60
|
+
._button--secondary_188fd_60 {
|
|
61
|
+
background-color: transparent;
|
|
62
|
+
border: var(--borderwidth-semantic-sm) solid var(--color-semantic-interactive-secondary-default);
|
|
63
|
+
color: var(--color-semantic-foreground-secondary-strong);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
._button--secondary_188fd_60:hover {
|
|
67
|
+
background-color: var(--color-semantic-interactive-secondary-hover);
|
|
68
|
+
border-color: var(--color-semantic-interactive-secondary-hover);
|
|
69
|
+
color: var(--color-semantic-foreground-inverse);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
._button--secondary_188fd_60:active {
|
|
73
|
+
background-color: var(--color-semantic-interactive-secondary-active);
|
|
74
|
+
border-color: var(--color-semantic-interactive-secondary-active);
|
|
75
|
+
color: var(--color-semantic-foreground-inverse);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
._button--secondary_188fd_60:focus-visible {
|
|
79
|
+
background-color: var(--color-semantic-interactive-secondary-focus);
|
|
80
|
+
color: var(--color-semantic-foreground-inverse);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* ─── Tertiary variant ─── */
|
|
84
|
+
|
|
85
|
+
._button--tertiary_188fd_85 {
|
|
86
|
+
background-color: var(--color-semantic-interactive-neutral-default);
|
|
87
|
+
border: var(--borderwidth-semantic-sm) solid var(--color-semantic-border-neutral-mid);
|
|
88
|
+
color: var(--color-semantic-foreground-secondary-strong);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
._button--tertiary_188fd_85:hover {
|
|
92
|
+
background-color: var(--color-semantic-interactive-neutral-hover);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
._button--tertiary_188fd_85:active {
|
|
96
|
+
background-color: var(--color-semantic-interactive-neutral-active);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
._button--tertiary_188fd_85:focus-visible {
|
|
100
|
+
background-color: var(--color-semantic-interactive-neutral-focus);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ─── Disabled state ─── */
|
|
104
|
+
|
|
105
|
+
._button--disabled_188fd_105 {
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
._button--primary_188fd_41._button--disabled_188fd_105 {
|
|
110
|
+
background-color: var(--color-semantic-interactive-primary-disabled);
|
|
111
|
+
color: var(--color-semantic-foreground-muted);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
._button--secondary_188fd_60._button--disabled_188fd_105 {
|
|
115
|
+
border-color: var(--color-semantic-interactive-secondary-disabled);
|
|
116
|
+
color: var(--color-semantic-foreground-muted);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
._button--tertiary_188fd_85._button--disabled_188fd_105 {
|
|
120
|
+
background-color: var(--color-semantic-interactive-neutral-disabled);
|
|
121
|
+
color: var(--color-semantic-foreground-muted);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* ─── Dark color scheme ─── */
|
|
125
|
+
/* Styles apply from [data-color-scheme="dark"] down to (but not into) [data-color-scheme="light"]. */
|
|
126
|
+
|
|
127
|
+
@scope ([data-color-scheme='dark']) to ([data-color-scheme='light']) {
|
|
128
|
+
._button--primary_188fd_41._button--disabled_188fd_105 {
|
|
129
|
+
color: var(--color-semantic-foreground-inverse-muted);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
._button--secondary_188fd_60 {
|
|
133
|
+
border-color: var(--color-semantic-interactive-inverse-default);
|
|
134
|
+
color: var(--color-semantic-foreground-inverse);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
._button--secondary_188fd_60:hover {
|
|
138
|
+
background-color: var(--color-semantic-interactive-inverse-hover);
|
|
139
|
+
border-color: var(--color-semantic-interactive-inverse-hover);
|
|
140
|
+
color: var(--color-semantic-foreground-secondary-strong);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
._button--secondary_188fd_60:active {
|
|
144
|
+
background-color: var(--color-semantic-interactive-inverse-active);
|
|
145
|
+
border-color: var(--color-semantic-interactive-inverse-active);
|
|
146
|
+
color: var(--color-semantic-foreground-secondary-strong);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
._button--secondary_188fd_60:focus-visible {
|
|
150
|
+
background-color: var(--color-semantic-interactive-inverse-focus);
|
|
151
|
+
color: var(--color-semantic-foreground-secondary-strong);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
._button--secondary_188fd_60._button--disabled_188fd_105 {
|
|
155
|
+
border-color: var(--color-semantic-interactive-inverse-disabled);
|
|
156
|
+
color: var(--color-semantic-foreground-inverse-muted);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
._button--tertiary_188fd_85._button--disabled_188fd_105 {
|
|
160
|
+
border-color: var(--color-semantic-interactive-neutral-disabled);
|
|
161
|
+
color: var(--color-semantic-foreground-inverse-muted);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* ─── Loading state ─── */
|
|
166
|
+
|
|
167
|
+
._button--loading_188fd_167 {
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
._button__content_188fd_171 {
|
|
172
|
+
flex: 0 1 auto;
|
|
173
|
+
min-width: 0;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
text-overflow: ellipsis;
|
|
176
|
+
white-space: nowrap;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
._button__spinner_188fd_179 {
|
|
180
|
+
flex: 0 0 auto;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ButtonProps } from './Button.types';
|
|
2
|
-
export declare const Button:
|
|
2
|
+
export declare const Button: ({ variant, fullWidth, size, loading, className, children, ref, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,eAAO,MAAM,MAAM,GAAI,2EASpB,WAAW,4CA0Hb,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import focusStyles from "../../styles/utils/focus.module.css.js";
|
|
3
|
+
import styles from "./Button.module.css.js";
|
|
4
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
5
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
6
|
+
const Button = ({
|
|
7
|
+
variant = "primary",
|
|
8
|
+
fullWidth = false,
|
|
9
|
+
size = "normal",
|
|
10
|
+
loading = false,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
ref,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const isDisabled = "disabled" in props && props.disabled;
|
|
17
|
+
const isAnchor = "href" in props && props.href != null;
|
|
18
|
+
const classes = cn(
|
|
19
|
+
styles.button,
|
|
20
|
+
styles[`button--${variant}`],
|
|
21
|
+
{ [styles["button--full-width"]]: fullWidth },
|
|
22
|
+
styles[`button--${size}`],
|
|
23
|
+
focusStyles.focusable,
|
|
24
|
+
{ [styles["button--disabled"]]: isDisabled },
|
|
25
|
+
{ [styles["button--loading"]]: loading },
|
|
26
|
+
className
|
|
27
|
+
);
|
|
28
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: styles.button__content, children }),
|
|
30
|
+
loading && /* @__PURE__ */ jsx(
|
|
31
|
+
Spinner,
|
|
32
|
+
{
|
|
33
|
+
size: size === "small" ? "xs" : "s",
|
|
34
|
+
color: "inherit",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
"aria-label": void 0,
|
|
37
|
+
role: "presentation",
|
|
38
|
+
className: styles.button__spinner
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
42
|
+
if (isAnchor) {
|
|
43
|
+
const { href, renderLink, ...anchorProps } = props;
|
|
44
|
+
const {
|
|
45
|
+
disabled: _disabled,
|
|
46
|
+
type: _type,
|
|
47
|
+
name: _name,
|
|
48
|
+
...safeAnchorProps
|
|
49
|
+
} = anchorProps;
|
|
50
|
+
const target = safeAnchorProps.target;
|
|
51
|
+
const rel = safeAnchorProps.rel;
|
|
52
|
+
const shouldHardenRel = target === "_blank";
|
|
53
|
+
const relTokens = new Set((rel ?? "").split(/\s+/).filter(Boolean));
|
|
54
|
+
if (shouldHardenRel) {
|
|
55
|
+
relTokens.add("noopener");
|
|
56
|
+
relTokens.add("noreferrer");
|
|
57
|
+
}
|
|
58
|
+
const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(" ") : void 0;
|
|
59
|
+
const linkProps = {
|
|
60
|
+
...safeAnchorProps,
|
|
61
|
+
ref,
|
|
62
|
+
href,
|
|
63
|
+
rel: hardenedRel,
|
|
64
|
+
className: classes,
|
|
65
|
+
"aria-busy": loading || void 0,
|
|
66
|
+
"aria-disabled": loading || void 0,
|
|
67
|
+
tabIndex: loading ? -1 : void 0,
|
|
68
|
+
onClick: loading ? (e) => {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
} : safeAnchorProps.onClick,
|
|
72
|
+
children: content
|
|
73
|
+
};
|
|
74
|
+
if (renderLink) {
|
|
75
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderLink(linkProps) });
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx("a", { ...linkProps });
|
|
78
|
+
}
|
|
79
|
+
const {
|
|
80
|
+
type = "button",
|
|
81
|
+
disabled,
|
|
82
|
+
href: _href,
|
|
83
|
+
target: _target,
|
|
84
|
+
rel: _rel,
|
|
85
|
+
renderLink: _renderLink,
|
|
86
|
+
...buttonProps
|
|
87
|
+
} = props;
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
"button",
|
|
90
|
+
{
|
|
91
|
+
ref,
|
|
92
|
+
type,
|
|
93
|
+
disabled: disabled || loading,
|
|
94
|
+
className: classes,
|
|
95
|
+
"aria-busy": loading || void 0,
|
|
96
|
+
...buttonProps,
|
|
97
|
+
children: content
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
Button
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, MouseEvent, ReactNode, Ref } from 'react';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport styles from './Button.module.css';\nimport { Spinner } from '../Spinner';\nimport type { ButtonProps } from './Button.types';\n\nexport const Button = ({\n variant = 'primary',\n fullWidth = false,\n size = 'normal',\n loading = false,\n className,\n children,\n ref,\n ...props\n}: ButtonProps) => {\n const isDisabled = 'disabled' in props && props.disabled;\n const isAnchor = 'href' in props && props.href != null;\n\n const classes = cn(\n styles.button,\n styles[`button--${variant}`],\n { [styles['button--full-width']]: fullWidth },\n styles[`button--${size}`],\n focusStyles.focusable,\n { [styles['button--disabled']]: isDisabled },\n { [styles['button--loading']]: loading },\n className,\n );\n\n const content = (\n <>\n <span className={styles.button__content}>{children}</span>\n {loading && (\n <Spinner\n size={size === 'small' ? 'xs' : 's'}\n color=\"inherit\"\n aria-hidden=\"true\"\n aria-label={undefined}\n role=\"presentation\"\n className={styles.button__spinner}\n />\n )}\n </>\n );\n\n if (isAnchor) {\n const { href, renderLink, ...anchorProps } = props as Omit<\n typeof props,\n 'variant' | 'size' | 'loading'\n > & {\n href: string;\n renderLink?: (\n props: AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n children: ReactNode;\n },\n ) => ReactNode;\n };\n\n const {\n disabled: _disabled,\n type: _type,\n name: _name,\n ...safeAnchorProps\n } = anchorProps as typeof anchorProps & {\n disabled?: boolean;\n type?: 'button' | 'submit' | 'reset';\n name?: string;\n };\n\n const target = safeAnchorProps.target;\n const rel = safeAnchorProps.rel;\n const shouldHardenRel = target === '_blank';\n const relTokens = new Set((rel ?? '').split(/\\s+/).filter(Boolean));\n\n if (shouldHardenRel) {\n relTokens.add('noopener');\n relTokens.add('noreferrer');\n }\n\n const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(' ') : undefined;\n\n const linkProps = {\n ...safeAnchorProps,\n ref: ref as Ref<HTMLAnchorElement>,\n href,\n rel: hardenedRel,\n className: classes,\n 'aria-busy': loading || undefined,\n 'aria-disabled': loading || undefined,\n tabIndex: loading ? -1 : undefined,\n onClick: loading\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : safeAnchorProps.onClick,\n children: content,\n };\n\n if (renderLink) {\n return <>{renderLink(linkProps)}</>;\n }\n\n return <a {...linkProps} />;\n }\n\n const {\n type = 'button',\n disabled,\n href: _href,\n target: _target,\n rel: _rel,\n renderLink: _renderLink,\n ...buttonProps\n } = props as Omit<typeof props, 'variant' | 'size' | 'loading' | 'href'> & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean;\n href?: string;\n target?: string;\n rel?: string;\n renderLink?: unknown;\n };\n\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n type={type}\n disabled={disabled || loading}\n className={classes}\n aria-busy={loading || undefined}\n {...buttonProps}\n >\n {content}\n </button>\n );\n};\n"],"names":[],"mappings":";;;;;AAOO,MAAM,SAAS,CAAC;AAAA,EACnB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACP,MAAmB;AACf,QAAM,aAAa,cAAc,SAAS,MAAM;AAChD,QAAM,WAAW,UAAU,SAAS,MAAM,QAAQ;AAElD,QAAM,UAAU;AAAA,IACZ,OAAO;AAAA,IACP,OAAO,WAAW,OAAO,EAAE;AAAA,IAC3B,EAAE,CAAC,OAAO,oBAAoB,CAAC,GAAG,UAAA;AAAA,IAClC,OAAO,WAAW,IAAI,EAAE;AAAA,IACxB,YAAY;AAAA,IACZ,EAAE,CAAC,OAAO,kBAAkB,CAAC,GAAG,WAAA;AAAA,IAChC,EAAE,CAAC,OAAO,iBAAiB,CAAC,GAAG,QAAA;AAAA,IAC/B;AAAA,EAAA;AAGJ,QAAM,UACF,qBAAA,UAAA,EACI,UAAA;AAAA,IAAA,oBAAC,QAAA,EAAK,WAAW,OAAO,iBAAkB,UAAS;AAAA,IAClD,WACG;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAM,SAAS,UAAU,OAAO;AAAA,QAChC,OAAM;AAAA,QACN,eAAY;AAAA,QACZ,cAAY;AAAA,QACZ,MAAK;AAAA,QACL,WAAW,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EACtB,GAER;AAGJ,MAAI,UAAU;AACV,UAAM,EAAE,MAAM,YAAY,GAAG,gBAAgB;AAa7C,UAAM;AAAA,MACF,UAAU;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,MACN,GAAG;AAAA,IAAA,IACH;AAMJ,UAAM,SAAS,gBAAgB;AAC/B,UAAM,MAAM,gBAAgB;AAC5B,UAAM,kBAAkB,WAAW;AACnC,UAAM,YAAY,IAAI,KAAK,OAAO,IAAI,MAAM,KAAK,EAAE,OAAO,OAAO,CAAC;AAElE,QAAI,iBAAiB;AACjB,gBAAU,IAAI,UAAU;AACxB,gBAAU,IAAI,YAAY;AAAA,IAC9B;AAEA,UAAM,cAAc,UAAU,OAAO,IAAI,MAAM,KAAK,SAAS,EAAE,KAAK,GAAG,IAAI;AAE3E,UAAM,YAAY;AAAA,MACd,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL,WAAW;AAAA,MACX,aAAa,WAAW;AAAA,MACxB,iBAAiB,WAAW;AAAA,MAC5B,UAAU,UAAU,KAAK;AAAA,MACzB,SAAS,UACH,CAAC,MAAqC;AAClC,UAAE,eAAA;AACF,UAAE,gBAAA;AAAA,MACN,IACA,gBAAgB;AAAA,MACtB,UAAU;AAAA,IAAA;AAGd,QAAI,YAAY;AACZ,aAAO,oBAAA,UAAA,EAAG,UAAA,WAAW,SAAS,GAAE;AAAA,IACpC;AAEA,WAAO,oBAAC,KAAA,EAAG,GAAG,UAAA,CAAW;AAAA,EAC7B;AAEA,QAAM;AAAA,IACF,OAAO;AAAA,IACP;AAAA,IACA,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,IACH;AASJ,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,WAAW;AAAA,MACX,aAAW,WAAW;AAAA,MACrB,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require('./Button.css');
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
|
+
const button = "_button_188fd_1";
|
|
5
|
+
const button__content = "_button__content_188fd_171";
|
|
6
|
+
const button__spinner = "_button__spinner_188fd_179";
|
|
7
|
+
const styles = {
|
|
8
|
+
button,
|
|
9
|
+
"button--full-width": "_button--full-width_188fd_18",
|
|
10
|
+
"button--normal": "_button--normal_188fd_25",
|
|
11
|
+
"button--small": "_button--small_188fd_32",
|
|
12
|
+
"button--primary": "_button--primary_188fd_41",
|
|
13
|
+
"button--secondary": "_button--secondary_188fd_60",
|
|
14
|
+
"button--tertiary": "_button--tertiary_188fd_85",
|
|
15
|
+
"button--disabled": "_button--disabled_188fd_105",
|
|
16
|
+
"button--loading": "_button--loading_188fd_167",
|
|
17
|
+
button__content,
|
|
18
|
+
button__spinner
|
|
19
|
+
};
|
|
20
|
+
exports.button = button;
|
|
21
|
+
exports.button__content = button__content;
|
|
22
|
+
exports.button__spinner = button__spinner;
|
|
23
|
+
exports.default = styles;
|
|
24
|
+
//# sourceMappingURL=Button.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './Button.css';
|
|
2
|
+
const button = "_button_188fd_1";
|
|
3
|
+
const button__content = "_button__content_188fd_171";
|
|
4
|
+
const button__spinner = "_button__spinner_188fd_179";
|
|
5
|
+
const styles = {
|
|
6
|
+
button,
|
|
7
|
+
"button--full-width": "_button--full-width_188fd_18",
|
|
8
|
+
"button--normal": "_button--normal_188fd_25",
|
|
9
|
+
"button--small": "_button--small_188fd_32",
|
|
10
|
+
"button--primary": "_button--primary_188fd_41",
|
|
11
|
+
"button--secondary": "_button--secondary_188fd_60",
|
|
12
|
+
"button--tertiary": "_button--tertiary_188fd_85",
|
|
13
|
+
"button--disabled": "_button--disabled_188fd_105",
|
|
14
|
+
"button--loading": "_button--loading_188fd_167",
|
|
15
|
+
button__content,
|
|
16
|
+
button__spinner
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
button,
|
|
20
|
+
button__content,
|
|
21
|
+
button__spinner,
|
|
22
|
+
styles as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Button.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -1,51 +1,84 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Visual variant of the Button.
|
|
4
|
+
*
|
|
5
|
+
* - `primary` — Filled pink background. Main call-to-action.
|
|
6
|
+
* - `secondary` — Outlined with secondary (plum) border color.
|
|
7
|
+
* - `tertiary` — Filled neutral background with a neutral border.
|
|
8
|
+
*/
|
|
9
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
10
|
+
/**
|
|
11
|
+
* Size variant of the Button.
|
|
12
|
+
*
|
|
13
|
+
* - `normal` — 40px height, 16px bold text.
|
|
14
|
+
* - `small` — 32px height, 14px bold text.
|
|
15
|
+
*/
|
|
16
|
+
export type ButtonSize = 'normal' | 'small';
|
|
17
|
+
export interface ButtonLinkProps extends ComponentPropsWithRef<'a'> {
|
|
18
|
+
readonly href: string;
|
|
19
|
+
readonly children: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
interface ButtonBaseProps {
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
23
|
+
* Visual variant determining colors and border style.
|
|
24
|
+
* @default 'primary'
|
|
15
25
|
*/
|
|
16
|
-
readonly
|
|
26
|
+
readonly variant?: ButtonVariant;
|
|
17
27
|
/**
|
|
18
|
-
* Whether the button should
|
|
28
|
+
* Whether the button should stretch to fill the available width.
|
|
19
29
|
* @default false
|
|
20
30
|
*/
|
|
21
31
|
readonly fullWidth?: boolean;
|
|
22
32
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @default
|
|
25
|
-
*/
|
|
26
|
-
readonly loading?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Custom className to apply to the button
|
|
33
|
+
* Size variant controlling height and font size.
|
|
34
|
+
* @default 'normal'
|
|
29
35
|
*/
|
|
30
|
-
readonly
|
|
31
|
-
}
|
|
32
|
-
interface ButtonAsButton extends BaseButtonProps, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'className'> {
|
|
36
|
+
readonly size?: ButtonSize;
|
|
33
37
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* Whether the button is in a loading state.
|
|
39
|
+
* When true, the button content remains visible and a spinner is shown.
|
|
40
|
+
* The button remains non-interactive during loading.
|
|
41
|
+
* @default false
|
|
36
42
|
*/
|
|
37
|
-
readonly
|
|
43
|
+
readonly loading?: boolean;
|
|
38
44
|
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
readonly
|
|
45
|
+
export type ButtonAsButton = ButtonBaseProps & Omit<ComponentPropsWithRef<'button'>, keyof ButtonBaseProps> & {
|
|
46
|
+
/** When omitted, the element renders as a `<button>`. */
|
|
47
|
+
readonly href?: never;
|
|
48
|
+
/** Anchor-only props are intentionally unsupported in button mode. */
|
|
49
|
+
readonly target?: never;
|
|
50
|
+
readonly rel?: never;
|
|
51
|
+
readonly renderLink?: never;
|
|
52
|
+
};
|
|
53
|
+
export type ButtonAsAnchor = ButtonBaseProps & Omit<ComponentPropsWithRef<'a'>, keyof ButtonBaseProps> & {
|
|
54
|
+
/** When `href` is provided, the element renders as an `<a>`. */
|
|
55
|
+
readonly href: string;
|
|
56
|
+
/** Button-only props are intentionally unsupported in anchor mode. */
|
|
57
|
+
readonly disabled?: never;
|
|
58
|
+
readonly type?: never;
|
|
59
|
+
readonly name?: never;
|
|
44
60
|
/**
|
|
45
|
-
*
|
|
61
|
+
* Custom render function for the link element. Use this to integrate with
|
|
62
|
+
* client-side routing libraries like Next.js or React Router.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* // Next.js
|
|
66
|
+
* import Link from 'next/link';
|
|
67
|
+
* <Button href="/page" renderLink={(props) => <Link {...props} />}>Navigate</Button>
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // React Router
|
|
71
|
+
* import { Link } from 'react-router-dom';
|
|
72
|
+
* <Button href="/page" renderLink={({ href, ...props }) => <Link to={href} {...props} />}>Navigate</Button>
|
|
46
73
|
*/
|
|
47
|
-
readonly
|
|
48
|
-
}
|
|
74
|
+
readonly renderLink?: (props: ButtonLinkProps) => ReactNode;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Props for the Button component.
|
|
78
|
+
*
|
|
79
|
+
* When `href` is provided the component renders as an `<a>` element;
|
|
80
|
+
* otherwise it renders as a `<button>`.
|
|
81
|
+
*/
|
|
49
82
|
export type ButtonProps = ButtonAsButton | ButtonAsAnchor;
|
|
50
83
|
export {};
|
|
51
84
|
//# sourceMappingURL=Button.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,eAAgB,SAAQ,qBAAqB,CAAC,GAAG,CAAC;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAChC;AAED,UAAU,eAAe;IACrB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,eAAe,GACxC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,eAAe,CAAC,GAAG;IAC3D,yDAAyD;IACzD,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;CAC/B,CAAC;AAEN,MAAM,MAAM,cAAc,GAAG,eAAe,GACxC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,eAAe,CAAC,GAAG;IACtD,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAC;CAC/D,CAAC;AAEN;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
5
|
+
const ColorScheme = ({ scheme, className, children, ref, ...props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, ...props, "data-color-scheme": scheme, className: cn.cn(className), children });
|
|
7
|
+
};
|
|
8
|
+
exports.ColorScheme = ColorScheme;
|
|
9
|
+
//# sourceMappingURL=ColorScheme.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.cjs","sources":["../../../src/components/ColorScheme/ColorScheme.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport type { ColorSchemeProps } from './ColorScheme.types';\n\nexport const ColorScheme = ({ scheme, className, children, ref, ...props }: ColorSchemeProps) => {\n return (\n <div ref={ref} {...props} data-color-scheme={scheme} className={cn(className)}>\n {children}\n </div>\n );\n};\n"],"names":["jsx","cn"],"mappings":";;;;AAGO,MAAM,cAAc,CAAC,EAAE,QAAQ,WAAW,UAAU,KAAK,GAAG,YAA8B;AAC7F,SACIA,2BAAAA,IAAC,OAAA,EAAI,KAAW,GAAG,OAAO,qBAAmB,QAAQ,WAAWC,GAAAA,GAAG,SAAS,GACvE,SAAA,CACL;AAER;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.d.ts","sourceRoot":"","sources":["../../../src/components/ColorScheme/ColorScheme.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,GAAI,gDAAgD,gBAAgB,4CAM3F,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
3
|
+
const ColorScheme = ({ scheme, className, children, ref, ...props }) => {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { ref, ...props, "data-color-scheme": scheme, className: cn(className), children });
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
ColorScheme
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=ColorScheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.js","sources":["../../../src/components/ColorScheme/ColorScheme.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport type { ColorSchemeProps } from './ColorScheme.types';\n\nexport const ColorScheme = ({ scheme, className, children, ref, ...props }: ColorSchemeProps) => {\n return (\n <div ref={ref} {...props} data-color-scheme={scheme} className={cn(className)}>\n {children}\n </div>\n );\n};\n"],"names":[],"mappings":";;AAGO,MAAM,cAAc,CAAC,EAAE,QAAQ,WAAW,UAAU,KAAK,GAAG,YAA8B;AAC7F,SACI,oBAAC,OAAA,EAAI,KAAW,GAAG,OAAO,qBAAmB,QAAQ,WAAW,GAAG,SAAS,GACvE,SAAA,CACL;AAER;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export type ColorSchemeValue = 'light' | 'dark';
|
|
3
|
+
export interface ColorSchemeProps extends ComponentPropsWithRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* The color scheme to apply to children.
|
|
6
|
+
* Components within will adapt their colors accordingly.
|
|
7
|
+
*/
|
|
8
|
+
readonly scheme: ColorSchemeValue;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ColorScheme.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.types.d.ts","sourceRoot":"","sources":["../../../src/components/ColorScheme/ColorScheme.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhD,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB,CAAC,KAAK,CAAC;IAClE;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ColorScheme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const Label_module = require("./Label.module.css.cjs");
|
|
5
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
6
|
+
const Label = ({ variant = "default", className, children, ref, ...props }) => {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8
|
+
"span",
|
|
9
|
+
{
|
|
10
|
+
ref,
|
|
11
|
+
className: cn.cn(Label_module.default.label, Label_module.default[`label--${variant}`], className),
|
|
12
|
+
...props,
|
|
13
|
+
children
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
exports.Label = Label;
|
|
18
|
+
//# sourceMappingURL=Label.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.cjs","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport styles from './Label.module.css';\nimport type { LabelProps } from './Label.types';\n\nexport const Label = ({ variant = 'default', className, children, ref, ...props }: LabelProps) => {\n return (\n <span\n ref={ref}\n className={cn(styles.label, styles[`label--${variant}`], className)}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"names":["jsx","cn","styles"],"mappings":";;;;;AAIO,MAAM,QAAQ,CAAC,EAAE,UAAU,WAAW,WAAW,UAAU,KAAK,GAAG,YAAwB;AAC9F,SACIA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA,WAAWC,GAAAA,GAAGC,aAAAA,QAAO,OAAOA,aAAAA,QAAO,UAAU,OAAO,EAAE,GAAG,SAAS;AAAA,MACjE,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGb;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@layer dna-design-system {._label_1bsev_1 {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
padding: var(--spacing-ui-xxs) var(--spacing-ui-lg);
|
|
5
|
+
border-radius: var(--radius-semantic-full);
|
|
6
|
+
font: var(--typography-label-md-bold);
|
|
7
|
+
text-align: center;
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
text-overflow: ellipsis;
|
|
12
|
+
color: var(--color-semantic-foreground-default);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
._label--default_1bsev_15 {
|
|
16
|
+
background-color: var(--color-semantic-surface-base);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
._label--campaign_1bsev_19 {
|
|
20
|
+
background-color: var(--color-semantic-surface-primary-mid);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
._label--new_1bsev_23 {
|
|
24
|
+
background-color: var(--color-semantic-accent-lemon-strong);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
._label--presale_1bsev_27 {
|
|
28
|
+
background-color: var(--color-semantic-accent-orange-strong);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
._label--soldout_1bsev_31 {
|
|
32
|
+
background-color: var(--color-semantic-surface-neutral-strong);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
._label--other_1bsev_35 {
|
|
36
|
+
background-color: var(--color-semantic-accent-sky-strong);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/Label/Label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,KAAK,GAAI,iDAA6D,UAAU,4CAU5F,CAAC"}
|