@designa8/vibedesign-figma-deepseek-image-v1-2-176b 0.2.1 → 0.2.2
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 +1 -1
- package/dist/index.cjs +21 -8
- package/dist/index.js +21 -8
- package/dist/styles.css +0 -10
- package/package.json +1 -1
- package/src/atoms/Button/Button.tsx +77 -13
- package/src/atoms/Button/preview.tsx +98 -73
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-figma-deepseek-image-v1-2-176b
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.2.
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.2.2**.
|
|
4
4
|
Tokens, atoms, molecules, organisms, and templates — import from the package root;
|
|
5
5
|
never hardcode visual values in consumer code.
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -744,8 +744,12 @@ var React7 = __toESM(require("react"));
|
|
|
744
744
|
// virtual-pkg:src/atoms/Button/Button.tsx
|
|
745
745
|
var React6 = __toESM(require("react"));
|
|
746
746
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
747
|
-
var BASE = "relative inline-flex items-center
|
|
748
|
-
var BARE_BASE = "relative inline-flex items-center gap-sm select-none cursor-pointer transition duration-150 ease-out disabled:cursor-not-allowed disabled:opacity-50";
|
|
747
|
+
var BASE = "relative inline-flex items-center gap-sm whitespace-nowrap select-none cursor-pointer transition duration-150 ease-out active:scale-100 disabled:cursor-not-allowed disabled:opacity-50";
|
|
748
|
+
var BARE_BASE = "relative inline-flex items-center gap-sm select-none cursor-pointer transition duration-150 ease-out active:scale-100 disabled:cursor-not-allowed disabled:opacity-50";
|
|
749
|
+
var ALIGN = {
|
|
750
|
+
center: "justify-center",
|
|
751
|
+
start: "justify-start text-left"
|
|
752
|
+
};
|
|
749
753
|
var FOCUS_RING = {
|
|
750
754
|
outer: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue focus-visible:ring-offset-2 focus-visible:ring-offset-canvas",
|
|
751
755
|
inset: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue focus-visible:ring-inset"
|
|
@@ -867,6 +871,7 @@ function forcedRing(variant, visualState, focusRing) {
|
|
|
867
871
|
const color = variant === "quiet" || variant === "ghost" ? "ring-primary/30" : "ring-focus-blue";
|
|
868
872
|
return focusRing === "inset" ? `ring-2 ${color} ring-inset` : `ring-2 ${color} ring-offset-2 ring-offset-canvas`;
|
|
869
873
|
}
|
|
874
|
+
var ICON_SLOT = "inline-flex shrink-0 items-center justify-center";
|
|
870
875
|
var Button = React6.forwardRef(
|
|
871
876
|
({
|
|
872
877
|
variant = "primary",
|
|
@@ -879,6 +884,9 @@ var Button = React6.forwardRef(
|
|
|
879
884
|
visualState = "rest",
|
|
880
885
|
fullWidth = false,
|
|
881
886
|
iconOnly = false,
|
|
887
|
+
align = "center",
|
|
888
|
+
iconLeft,
|
|
889
|
+
iconRight,
|
|
882
890
|
disabled = false,
|
|
883
891
|
className,
|
|
884
892
|
children,
|
|
@@ -891,12 +899,15 @@ var Button = React6.forwardRef(
|
|
|
891
899
|
chromeLess ? BARE_BASE : BASE,
|
|
892
900
|
chromeLess ? "" : RADIUS[shape],
|
|
893
901
|
chromeLess ? "" : iconOnly ? ICON_ONLY_SIZE[size] : SIZE[size],
|
|
902
|
+
chromeLess ? "" : iconOnly ? ALIGN.center : ALIGN[align],
|
|
894
903
|
chromeLess ? "" : SURFACE[variant][visualState],
|
|
895
904
|
chromeLess && visualState === "rest" ? "" : forcedRing(variant, visualState, focusRing),
|
|
896
905
|
FOCUS_RING[focusRing],
|
|
897
906
|
fullWidth ? "w-full" : "",
|
|
898
907
|
className
|
|
899
908
|
].filter(Boolean).join(" ");
|
|
909
|
+
const leading = iconLeft ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", className: ICON_SLOT, children: iconLeft }) : null;
|
|
910
|
+
const trailing = iconRight ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", className: ICON_SLOT, children: iconRight }) : null;
|
|
900
911
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
901
912
|
"button",
|
|
902
913
|
{
|
|
@@ -904,7 +915,7 @@ var Button = React6.forwardRef(
|
|
|
904
915
|
type,
|
|
905
916
|
disabled,
|
|
906
917
|
"aria-busy": loading || void 0,
|
|
907
|
-
className: classes
|
|
918
|
+
className: `${classes} cursor-pointer transition duration-150 ease-out active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50`,
|
|
908
919
|
...rest,
|
|
909
920
|
children: [
|
|
910
921
|
loading ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
@@ -914,7 +925,9 @@ var Button = React6.forwardRef(
|
|
|
914
925
|
className: "inline-block size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
915
926
|
}
|
|
916
927
|
) : null,
|
|
917
|
-
|
|
928
|
+
leading,
|
|
929
|
+
chromeLess || iconOnly ? content : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate", children: content }),
|
|
930
|
+
trailing
|
|
918
931
|
]
|
|
919
932
|
}
|
|
920
933
|
);
|
|
@@ -2296,7 +2309,7 @@ var PADDING = {
|
|
|
2296
2309
|
sm: "gap-md px-base py-sm",
|
|
2297
2310
|
md: "gap-lg px-lg py-base"
|
|
2298
2311
|
};
|
|
2299
|
-
var
|
|
2312
|
+
var ALIGN2 = {
|
|
2300
2313
|
start: "items-start",
|
|
2301
2314
|
center: "items-center"
|
|
2302
2315
|
};
|
|
@@ -2325,7 +2338,7 @@ var CardFooter = React16.forwardRef(
|
|
|
2325
2338
|
className: cx3(
|
|
2326
2339
|
"flex w-full flex-wrap rounded-lg",
|
|
2327
2340
|
separated ? "border-t border-hairline-soft" : "",
|
|
2328
|
-
|
|
2341
|
+
ALIGN2[align],
|
|
2329
2342
|
PADDING[size],
|
|
2330
2343
|
className
|
|
2331
2344
|
),
|
|
@@ -2366,7 +2379,7 @@ var PADDING2 = {
|
|
|
2366
2379
|
sm: "gap-md px-base py-sm",
|
|
2367
2380
|
md: "gap-lg px-lg py-base"
|
|
2368
2381
|
};
|
|
2369
|
-
var
|
|
2382
|
+
var ALIGN3 = {
|
|
2370
2383
|
start: "items-start",
|
|
2371
2384
|
center: "items-center"
|
|
2372
2385
|
};
|
|
@@ -2393,7 +2406,7 @@ var CardHeader = React17.forwardRef(
|
|
|
2393
2406
|
ref,
|
|
2394
2407
|
className: cx4(
|
|
2395
2408
|
"flex w-full flex-wrap rounded-lg",
|
|
2396
|
-
|
|
2409
|
+
ALIGN3[align],
|
|
2397
2410
|
PADDING2[size],
|
|
2398
2411
|
className
|
|
2399
2412
|
),
|
package/dist/index.js
CHANGED
|
@@ -625,8 +625,12 @@ import * as React7 from "react";
|
|
|
625
625
|
// virtual-pkg:src/atoms/Button/Button.tsx
|
|
626
626
|
import * as React6 from "react";
|
|
627
627
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
628
|
-
var BASE = "relative inline-flex items-center
|
|
629
|
-
var BARE_BASE = "relative inline-flex items-center gap-sm select-none cursor-pointer transition duration-150 ease-out disabled:cursor-not-allowed disabled:opacity-50";
|
|
628
|
+
var BASE = "relative inline-flex items-center gap-sm whitespace-nowrap select-none cursor-pointer transition duration-150 ease-out active:scale-100 disabled:cursor-not-allowed disabled:opacity-50";
|
|
629
|
+
var BARE_BASE = "relative inline-flex items-center gap-sm select-none cursor-pointer transition duration-150 ease-out active:scale-100 disabled:cursor-not-allowed disabled:opacity-50";
|
|
630
|
+
var ALIGN = {
|
|
631
|
+
center: "justify-center",
|
|
632
|
+
start: "justify-start text-left"
|
|
633
|
+
};
|
|
630
634
|
var FOCUS_RING = {
|
|
631
635
|
outer: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue focus-visible:ring-offset-2 focus-visible:ring-offset-canvas",
|
|
632
636
|
inset: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue focus-visible:ring-inset"
|
|
@@ -748,6 +752,7 @@ function forcedRing(variant, visualState, focusRing) {
|
|
|
748
752
|
const color = variant === "quiet" || variant === "ghost" ? "ring-primary/30" : "ring-focus-blue";
|
|
749
753
|
return focusRing === "inset" ? `ring-2 ${color} ring-inset` : `ring-2 ${color} ring-offset-2 ring-offset-canvas`;
|
|
750
754
|
}
|
|
755
|
+
var ICON_SLOT = "inline-flex shrink-0 items-center justify-center";
|
|
751
756
|
var Button = React6.forwardRef(
|
|
752
757
|
({
|
|
753
758
|
variant = "primary",
|
|
@@ -760,6 +765,9 @@ var Button = React6.forwardRef(
|
|
|
760
765
|
visualState = "rest",
|
|
761
766
|
fullWidth = false,
|
|
762
767
|
iconOnly = false,
|
|
768
|
+
align = "center",
|
|
769
|
+
iconLeft,
|
|
770
|
+
iconRight,
|
|
763
771
|
disabled = false,
|
|
764
772
|
className,
|
|
765
773
|
children,
|
|
@@ -772,12 +780,15 @@ var Button = React6.forwardRef(
|
|
|
772
780
|
chromeLess ? BARE_BASE : BASE,
|
|
773
781
|
chromeLess ? "" : RADIUS[shape],
|
|
774
782
|
chromeLess ? "" : iconOnly ? ICON_ONLY_SIZE[size] : SIZE[size],
|
|
783
|
+
chromeLess ? "" : iconOnly ? ALIGN.center : ALIGN[align],
|
|
775
784
|
chromeLess ? "" : SURFACE[variant][visualState],
|
|
776
785
|
chromeLess && visualState === "rest" ? "" : forcedRing(variant, visualState, focusRing),
|
|
777
786
|
FOCUS_RING[focusRing],
|
|
778
787
|
fullWidth ? "w-full" : "",
|
|
779
788
|
className
|
|
780
789
|
].filter(Boolean).join(" ");
|
|
790
|
+
const leading = iconLeft ? /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", className: ICON_SLOT, children: iconLeft }) : null;
|
|
791
|
+
const trailing = iconRight ? /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", className: ICON_SLOT, children: iconRight }) : null;
|
|
781
792
|
return /* @__PURE__ */ jsxs5(
|
|
782
793
|
"button",
|
|
783
794
|
{
|
|
@@ -785,7 +796,7 @@ var Button = React6.forwardRef(
|
|
|
785
796
|
type,
|
|
786
797
|
disabled,
|
|
787
798
|
"aria-busy": loading || void 0,
|
|
788
|
-
className: classes
|
|
799
|
+
className: `${classes} cursor-pointer transition duration-150 ease-out active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50`,
|
|
789
800
|
...rest,
|
|
790
801
|
children: [
|
|
791
802
|
loading ? /* @__PURE__ */ jsx6(
|
|
@@ -795,7 +806,9 @@ var Button = React6.forwardRef(
|
|
|
795
806
|
className: "inline-block size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
796
807
|
}
|
|
797
808
|
) : null,
|
|
798
|
-
|
|
809
|
+
leading,
|
|
810
|
+
chromeLess || iconOnly ? content : /* @__PURE__ */ jsx6("span", { className: "truncate", children: content }),
|
|
811
|
+
trailing
|
|
799
812
|
]
|
|
800
813
|
}
|
|
801
814
|
);
|
|
@@ -2177,7 +2190,7 @@ var PADDING = {
|
|
|
2177
2190
|
sm: "gap-md px-base py-sm",
|
|
2178
2191
|
md: "gap-lg px-lg py-base"
|
|
2179
2192
|
};
|
|
2180
|
-
var
|
|
2193
|
+
var ALIGN2 = {
|
|
2181
2194
|
start: "items-start",
|
|
2182
2195
|
center: "items-center"
|
|
2183
2196
|
};
|
|
@@ -2206,7 +2219,7 @@ var CardFooter = React16.forwardRef(
|
|
|
2206
2219
|
className: cx3(
|
|
2207
2220
|
"flex w-full flex-wrap rounded-lg",
|
|
2208
2221
|
separated ? "border-t border-hairline-soft" : "",
|
|
2209
|
-
|
|
2222
|
+
ALIGN2[align],
|
|
2210
2223
|
PADDING[size],
|
|
2211
2224
|
className
|
|
2212
2225
|
),
|
|
@@ -2247,7 +2260,7 @@ var PADDING2 = {
|
|
|
2247
2260
|
sm: "gap-md px-base py-sm",
|
|
2248
2261
|
md: "gap-lg px-lg py-base"
|
|
2249
2262
|
};
|
|
2250
|
-
var
|
|
2263
|
+
var ALIGN3 = {
|
|
2251
2264
|
start: "items-start",
|
|
2252
2265
|
center: "items-center"
|
|
2253
2266
|
};
|
|
@@ -2274,7 +2287,7 @@ var CardHeader = React17.forwardRef(
|
|
|
2274
2287
|
ref,
|
|
2275
2288
|
className: cx4(
|
|
2276
2289
|
"flex w-full flex-wrap rounded-lg",
|
|
2277
|
-
|
|
2290
|
+
ALIGN3[align],
|
|
2278
2291
|
PADDING2[size],
|
|
2279
2292
|
className
|
|
2280
2293
|
),
|
package/dist/styles.css
CHANGED
|
@@ -2862,16 +2862,6 @@
|
|
|
2862
2862
|
}
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
|
-
.disabled\:active\:scale-100 {
|
|
2866
|
-
&:disabled {
|
|
2867
|
-
&:active {
|
|
2868
|
-
--tw-scale-x: 100%;
|
|
2869
|
-
--tw-scale-y: 100%;
|
|
2870
|
-
--tw-scale-z: 100%;
|
|
2871
|
-
scale: var(--tw-scale-x) var(--tw-scale-y);
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
2865
|
.motion-reduce\:animate-none {
|
|
2876
2866
|
@media (prefers-reduced-motion: reduce) {
|
|
2877
2867
|
animation: none;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designa8/vibedesign-figma-deepseek-image-v1-2-176b",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Complete design system \"My Project figma-deepseek-image-v1\" generated by Atoms Design.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -23,6 +23,12 @@ export type ButtonShape = "rect" | "pill" | "flat";
|
|
|
23
23
|
* which already owns the outer stroke (a segmented control, a toolbar).
|
|
24
24
|
*/
|
|
25
25
|
export type ButtonFocusRing = "outer" | "inset";
|
|
26
|
+
/**
|
|
27
|
+
* Horizontal content alignment for a wide button. "center" is the default and
|
|
28
|
+
* keeps the historical look; "start" left-aligns the icon and label, which is
|
|
29
|
+
* what a full-width header or sidebar action needs.
|
|
30
|
+
*/
|
|
31
|
+
export type ButtonAlign = "center" | "start";
|
|
26
32
|
/**
|
|
27
33
|
* Documentation/demo hook: pins the button to a single visual state so a
|
|
28
34
|
* state board can render rest, hover, pressed and focus side by side.
|
|
@@ -32,9 +38,9 @@ export type ButtonFocusRing = "outer" | "inset";
|
|
|
32
38
|
export type ButtonVisualState = "rest" | "hover" | "pressed" | "focus";
|
|
33
39
|
/**
|
|
34
40
|
* Chrome. "default" is the styled button. "none" strips every visual decision
|
|
35
|
-
* (surface, border, radius, size, padding, typography and press
|
|
36
|
-
* caller's container owns the look, for a full-width row trigger such as a
|
|
37
|
-
* menu row, a list row or a table row
|
|
41
|
+
* (surface, border, radius, size, padding, typography and press feedback) so
|
|
42
|
+
* the caller's container owns the look, for a full-width row trigger such as a
|
|
43
|
+
* menu row, a list row or a table row.
|
|
38
44
|
*/
|
|
39
45
|
export type ButtonChrome = "default" | "none";
|
|
40
46
|
|
|
@@ -51,22 +57,47 @@ export interface ButtonProps
|
|
|
51
57
|
fullWidth?: boolean;
|
|
52
58
|
/** Square, padding-less treatment for a control whose only content is a glyph. */
|
|
53
59
|
iconOnly?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Glyph rendered before the label, outside the truncating label span so the
|
|
62
|
+
* button's gap-sm is preserved. Renders shrink-0.
|
|
63
|
+
*/
|
|
64
|
+
iconLeft?: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Glyph rendered after the label, outside the truncating label span so the
|
|
67
|
+
* button's gap-sm is preserved (a chevron on a select-like trigger).
|
|
68
|
+
* Renders shrink-0.
|
|
69
|
+
*/
|
|
70
|
+
iconRight?: React.ReactNode;
|
|
71
|
+
/** Horizontal alignment of the label and icon slots. Defaults to "center". */
|
|
72
|
+
align?: ButtonAlign;
|
|
54
73
|
}
|
|
55
74
|
|
|
75
|
+
/*
|
|
76
|
+
* Layout only. No width and no justification, so a consumer className can own
|
|
77
|
+
* width (w-full) and `align` can own justification without competing against a
|
|
78
|
+
* forced utility. Press feedback is the token tint baked into each variant's
|
|
79
|
+
* active:bg-* rule; active:scale-100 states explicitly that the button holds
|
|
80
|
+
* its size on press, so a row of toolbar buttons never jumps.
|
|
81
|
+
*/
|
|
56
82
|
const BASE =
|
|
57
|
-
"relative inline-flex items-center
|
|
58
|
-
"cursor-pointer transition duration-150 ease-out active:scale-
|
|
59
|
-
"disabled:cursor-not-allowed disabled:opacity-50
|
|
83
|
+
"relative inline-flex items-center gap-sm whitespace-nowrap select-none " +
|
|
84
|
+
"cursor-pointer transition duration-150 ease-out active:scale-100 " +
|
|
85
|
+
"disabled:cursor-not-allowed disabled:opacity-50";
|
|
60
86
|
|
|
61
87
|
/**
|
|
62
|
-
* Chrome-less base: layout only. No size, padding, radius, surface, typography
|
|
63
|
-
* or press
|
|
88
|
+
* Chrome-less base: layout only. No size, padding, radius, surface, typography,
|
|
89
|
+
* justification or press feedback, so a row trigger can own its own visual.
|
|
64
90
|
*/
|
|
65
91
|
const BARE_BASE =
|
|
66
92
|
"relative inline-flex items-center gap-sm select-none " +
|
|
67
|
-
"cursor-pointer transition duration-150 ease-out " +
|
|
93
|
+
"cursor-pointer transition duration-150 ease-out active:scale-100 " +
|
|
68
94
|
"disabled:cursor-not-allowed disabled:opacity-50";
|
|
69
95
|
|
|
96
|
+
const ALIGN: Record<ButtonAlign, string> = {
|
|
97
|
+
center: "justify-center",
|
|
98
|
+
start: "justify-start text-left",
|
|
99
|
+
};
|
|
100
|
+
|
|
70
101
|
const FOCUS_RING: Record<ButtonFocusRing, string> = {
|
|
71
102
|
outer:
|
|
72
103
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue " +
|
|
@@ -240,6 +271,12 @@ function forcedRing(
|
|
|
240
271
|
: `ring-2 ${color} ring-offset-2 ring-offset-canvas`;
|
|
241
272
|
}
|
|
242
273
|
|
|
274
|
+
/*
|
|
275
|
+
* Icon slots sit OUTSIDE the truncating label span, so the button's gap-sm is
|
|
276
|
+
* the only space between glyph and text and the glyph never shrinks.
|
|
277
|
+
*/
|
|
278
|
+
const ICON_SLOT = "inline-flex shrink-0 items-center justify-center";
|
|
279
|
+
|
|
243
280
|
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
244
281
|
(
|
|
245
282
|
{
|
|
@@ -253,6 +290,9 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
253
290
|
visualState = "rest",
|
|
254
291
|
fullWidth = false,
|
|
255
292
|
iconOnly = false,
|
|
293
|
+
align = "center",
|
|
294
|
+
iconLeft,
|
|
295
|
+
iconRight,
|
|
256
296
|
disabled = false,
|
|
257
297
|
className,
|
|
258
298
|
children,
|
|
@@ -268,6 +308,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
268
308
|
chromeLess ? BARE_BASE : BASE,
|
|
269
309
|
chromeLess ? "" : RADIUS[shape],
|
|
270
310
|
chromeLess ? "" : iconOnly ? ICON_ONLY_SIZE[size] : SIZE[size],
|
|
311
|
+
chromeLess ? "" : iconOnly ? ALIGN.center : ALIGN[align],
|
|
271
312
|
chromeLess ? "" : SURFACE[variant][visualState],
|
|
272
313
|
chromeLess && visualState === "rest" ? "" : forcedRing(variant, visualState, focusRing),
|
|
273
314
|
FOCUS_RING[focusRing],
|
|
@@ -277,13 +318,32 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
277
318
|
.filter(Boolean)
|
|
278
319
|
.join(" ");
|
|
279
320
|
|
|
321
|
+
const leading = iconLeft ? (
|
|
322
|
+
<span aria-hidden="true" className={ICON_SLOT}>
|
|
323
|
+
{iconLeft}
|
|
324
|
+
</span>
|
|
325
|
+
) : null;
|
|
326
|
+
|
|
327
|
+
const trailing = iconRight ? (
|
|
328
|
+
<span aria-hidden="true" className={ICON_SLOT}>
|
|
329
|
+
{iconRight}
|
|
330
|
+
</span>
|
|
331
|
+
) : null;
|
|
332
|
+
|
|
280
333
|
return (
|
|
281
334
|
<button
|
|
282
335
|
ref={ref}
|
|
283
336
|
type={type}
|
|
284
337
|
disabled={disabled}
|
|
285
338
|
aria-busy={loading || undefined}
|
|
286
|
-
|
|
339
|
+
/*
|
|
340
|
+
* The interactive contract repeated on the element itself: pointer,
|
|
341
|
+
* a 150ms ease-out transition, focus ring, disabled cursor/opacity.
|
|
342
|
+
* active:scale-100 holds the pressed button at its own size so a
|
|
343
|
+
* toolbar row does not jump; the press feedback is the variant's
|
|
344
|
+
* token-backed active:bg-* tint.
|
|
345
|
+
*/
|
|
346
|
+
className={`${classes} cursor-pointer transition duration-150 ease-out active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50`}
|
|
287
347
|
{...rest}
|
|
288
348
|
>
|
|
289
349
|
{loading ? (
|
|
@@ -292,13 +352,17 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
292
352
|
className="inline-block size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
293
353
|
/>
|
|
294
354
|
) : null}
|
|
295
|
-
{
|
|
296
|
-
|
|
297
|
-
|
|
355
|
+
{leading}
|
|
356
|
+
{/*
|
|
357
|
+
* Only a label truncates. A glyph-only button renders its child at its
|
|
358
|
+
* natural size, centred, with no truncation span to stretch it.
|
|
359
|
+
*/}
|
|
360
|
+
{chromeLess || iconOnly ? (
|
|
298
361
|
content
|
|
299
362
|
) : (
|
|
300
363
|
<span className="truncate">{content}</span>
|
|
301
364
|
)}
|
|
365
|
+
{trailing}
|
|
302
366
|
</button>
|
|
303
367
|
);
|
|
304
368
|
},
|
|
@@ -1,96 +1,121 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Button } from "./Button";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A toolbar/header row of buttons with leading icons — the case this update
|
|
7
|
+
* exists for. Every button is clickable so the press tint (no scale jump) is
|
|
8
|
+
* visible while they sit side by side.
|
|
9
|
+
*/
|
|
4
10
|
export default function ButtonPreview() {
|
|
5
|
-
const [
|
|
6
|
-
const [
|
|
11
|
+
const [shared, setShared] = React.useState(false);
|
|
12
|
+
const [mode, setMode] = React.useState<"edit" | "view">("edit");
|
|
7
13
|
|
|
8
14
|
return (
|
|
9
|
-
<div className="w-full max-w-3xl mx-auto p-lg space-y-xl
|
|
10
|
-
<section className="space-y-
|
|
11
|
-
<h2 className="text-label-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<div className="flex flex-col items-center gap-md">
|
|
41
|
-
<Button variant="primary" loading loadingLabel="Sharing…" />
|
|
42
|
-
<span className="text-caption text-muted">Loading</span>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div className="flex flex-col items-center gap-md">
|
|
46
|
-
<Button variant="primary" disabled>
|
|
47
|
-
Share
|
|
48
|
-
</Button>
|
|
49
|
-
<span className="text-caption text-muted">Disabled</span>
|
|
50
|
-
</div>
|
|
15
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
|
|
16
|
+
<section className="space-y-sm">
|
|
17
|
+
<h2 className="text-label-sm text-muted">Toolbar with leading icons</h2>
|
|
18
|
+
<div className="flex flex-wrap items-center gap-sm rounded-lg border border-hairline bg-surface p-sm shadow-sm">
|
|
19
|
+
<Button
|
|
20
|
+
variant="primary"
|
|
21
|
+
size="sm"
|
|
22
|
+
iconLeft={<Icon name="plus" className="size-4" />}
|
|
23
|
+
onClick={() => setMode("edit")}
|
|
24
|
+
>
|
|
25
|
+
New file
|
|
26
|
+
</Button>
|
|
27
|
+
<Button
|
|
28
|
+
variant="outline"
|
|
29
|
+
size="sm"
|
|
30
|
+
iconLeft={<Icon name="share" className="size-4" />}
|
|
31
|
+
onClick={() => setShared((v) => !v)}
|
|
32
|
+
>
|
|
33
|
+
{shared ? "Link copied" : "Share"}
|
|
34
|
+
</Button>
|
|
35
|
+
<Button
|
|
36
|
+
variant="ghost"
|
|
37
|
+
size="sm"
|
|
38
|
+
iconLeft={<Icon name="filter-x" className="size-4" />}
|
|
39
|
+
onClick={() => setMode("view")}
|
|
40
|
+
>
|
|
41
|
+
Filter
|
|
42
|
+
</Button>
|
|
43
|
+
<span className="text-caption text-muted">
|
|
44
|
+
{mode === "edit" ? "Editing" : "Filtering"}
|
|
45
|
+
</span>
|
|
51
46
|
</div>
|
|
52
47
|
</section>
|
|
53
48
|
|
|
54
|
-
<section className="space-y-
|
|
55
|
-
<h2 className="text-label-
|
|
56
|
-
<div className="flex flex-wrap items-center gap-
|
|
57
|
-
<Button
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
<section className="space-y-sm">
|
|
50
|
+
<h2 className="text-label-sm text-muted">Trailing icon and icon-only</h2>
|
|
51
|
+
<div className="flex flex-wrap items-center gap-sm">
|
|
52
|
+
<Button
|
|
53
|
+
variant="outline"
|
|
54
|
+
iconRight={<Icon name="chevron-down" className="size-4" />}
|
|
55
|
+
onClick={() => setShared((v) => !v)}
|
|
56
|
+
>
|
|
57
|
+
Sort options
|
|
62
58
|
</Button>
|
|
63
|
-
<Button
|
|
64
|
-
|
|
59
|
+
<Button
|
|
60
|
+
variant="soft"
|
|
61
|
+
iconOnly
|
|
62
|
+
aria-label="Add a file"
|
|
63
|
+
onClick={() => setShared((v) => !v)}
|
|
64
|
+
>
|
|
65
|
+
<Icon name="plus" className="size-4" />
|
|
65
66
|
</Button>
|
|
66
|
-
<Button
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
<Button
|
|
68
|
+
variant="primary"
|
|
69
|
+
iconOnly
|
|
70
|
+
aria-label="Share this document"
|
|
71
|
+
onClick={() => setShared((v) => !v)}
|
|
72
|
+
>
|
|
73
|
+
<Icon name="share" className="size-4" />
|
|
69
74
|
</Button>
|
|
70
75
|
</div>
|
|
71
76
|
</section>
|
|
72
77
|
|
|
73
|
-
<section className="space-y-
|
|
74
|
-
<h2 className="text-label-
|
|
75
|
-
|
|
78
|
+
<section className="space-y-sm">
|
|
79
|
+
<h2 className="text-label-sm text-muted">
|
|
80
|
+
Full width, align start vs center
|
|
81
|
+
</h2>
|
|
82
|
+
<div className="space-y-sm">
|
|
76
83
|
<Button
|
|
77
|
-
variant="
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
window.setTimeout(() => setLoading(false), 1400);
|
|
83
|
-
}}
|
|
84
|
+
variant="outline"
|
|
85
|
+
fullWidth
|
|
86
|
+
align="start"
|
|
87
|
+
iconLeft={<Icon name="plus" className="size-4" />}
|
|
88
|
+
onClick={() => setShared((v) => !v)}
|
|
84
89
|
>
|
|
85
|
-
|
|
90
|
+
New file in this workspace
|
|
86
91
|
</Button>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
<Button
|
|
93
|
+
variant="outline"
|
|
94
|
+
fullWidth
|
|
95
|
+
align="center"
|
|
96
|
+
iconLeft={<Icon name="plus" className="size-4" />}
|
|
97
|
+
onClick={() => setShared((v) => !v)}
|
|
98
|
+
>
|
|
99
|
+
New file in this workspace
|
|
90
100
|
</Button>
|
|
101
|
+
</div>
|
|
102
|
+
</section>
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
<section className="space-y-sm">
|
|
105
|
+
<h2 className="text-label-sm text-muted">States with icons</h2>
|
|
106
|
+
<div className="flex flex-wrap items-center gap-sm">
|
|
107
|
+
<Button
|
|
108
|
+
variant="primary"
|
|
109
|
+
iconLeft={<Icon name="share" className="size-4" />}
|
|
110
|
+
loading
|
|
111
|
+
loadingLabel="Sharing…"
|
|
112
|
+
/>
|
|
113
|
+
<Button
|
|
114
|
+
variant="primary"
|
|
115
|
+
iconLeft={<Icon name="plus" className="size-4" />}
|
|
116
|
+
disabled
|
|
117
|
+
>
|
|
118
|
+
New file
|
|
94
119
|
</Button>
|
|
95
120
|
</div>
|
|
96
121
|
</section>
|