@dillingerstaffing/strand-ui 0.5.1 → 0.7.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/HTML_REFERENCE.md +79 -3
- package/README.md +1 -1
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/InstrumentViewport/InstrumentViewport.d.ts +10 -0
- package/dist/components/InstrumentViewport/InstrumentViewport.d.ts.map +1 -0
- package/dist/components/InstrumentViewport/index.d.ts +3 -0
- package/dist/components/InstrumentViewport/index.d.ts.map +1 -0
- package/dist/components/ScrollReveal/ScrollReveal.d.ts +12 -0
- package/dist/components/ScrollReveal/ScrollReveal.d.ts.map +1 -0
- package/dist/components/ScrollReveal/index.d.ts +3 -0
- package/dist/components/ScrollReveal/index.d.ts.map +1 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/css/strand-ui.css +145 -54
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +578 -534
- package/package.json +2 -2
- package/src/__tests__/build-output.test.ts +1 -0
- package/src/components/Alert/Alert.css +24 -13
- package/src/components/Alert/Alert.test.tsx +30 -0
- package/src/components/Alert/Alert.tsx +4 -0
- package/src/components/Avatar/Avatar.css +2 -2
- package/src/components/Button/Button.css +4 -4
- package/src/components/Checkbox/Checkbox.css +3 -2
- package/src/components/CodeBlock/CodeBlock.css +1 -1
- package/src/components/FormField/FormField.css +5 -3
- package/src/components/InstrumentViewport/InstrumentViewport.css +36 -0
- package/src/components/InstrumentViewport/InstrumentViewport.test.tsx +70 -0
- package/src/components/InstrumentViewport/InstrumentViewport.tsx +31 -0
- package/src/components/InstrumentViewport/index.ts +2 -0
- package/src/components/Nav/Nav.css +2 -2
- package/src/components/Radio/Radio.css +3 -2
- package/src/components/ScrollReveal/ScrollReveal.css +29 -0
- package/src/components/ScrollReveal/ScrollReveal.test.tsx +68 -0
- package/src/components/ScrollReveal/ScrollReveal.tsx +64 -0
- package/src/components/ScrollReveal/index.ts +2 -0
- package/src/components/Slider/Slider.css +10 -4
- package/src/components/Switch/Switch.css +1 -0
- package/src/components/Tabs/Tabs.css +1 -1
- package/src/components/Tag/Tag.css +3 -3
- package/src/components/Toast/Toast.css +15 -17
- package/src/components/Toast/Toast.test.tsx +28 -0
- package/src/components/Toast/Toast.tsx +8 -0
- package/src/index.ts +8 -0
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.strand-tag--solid.strand-tag--teal {
|
|
25
|
-
background:
|
|
25
|
+
background: var(--strand-surface-recessed);
|
|
26
26
|
color: var(--strand-on-teal-tint);
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.strand-tag--solid.strand-tag--amber {
|
|
35
|
-
background:
|
|
35
|
+
background: var(--strand-surface-recessed);
|
|
36
36
|
color: var(--strand-on-amber-tint);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.strand-tag--solid.strand-tag--red {
|
|
40
|
-
background:
|
|
40
|
+
background: var(--strand-surface-recessed);
|
|
41
41
|
color: var(--strand-on-red-tint);
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
padding: var(--strand-space-4) var(--strand-space-5);
|
|
23
23
|
background: var(--strand-surface-elevated);
|
|
24
24
|
border-radius: var(--strand-radius-lg);
|
|
25
|
-
border-left: 4px solid transparent;
|
|
26
25
|
box-shadow: var(--strand-elevation-3);
|
|
27
26
|
font-family: var(--strand-font-sans);
|
|
28
27
|
font-size: var(--strand-text-sm);
|
|
@@ -30,22 +29,21 @@
|
|
|
30
29
|
animation: strand-toast-in var(--strand-duration-normal) var(--strand-ease-out-expo);
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
/* ── Status
|
|
34
|
-
.strand-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.strand-toast--warning {
|
|
43
|
-
border-left-color: var(--strand-amber-caution);
|
|
32
|
+
/* ── Status prefix ── */
|
|
33
|
+
.strand-toast__status {
|
|
34
|
+
font-family: var(--strand-font-mono);
|
|
35
|
+
font-size: var(--strand-text-xs);
|
|
36
|
+
font-weight: var(--strand-weight-semibold);
|
|
37
|
+
letter-spacing: var(--strand-tracking-wider);
|
|
38
|
+
text-transform: uppercase;
|
|
39
|
+
margin-right: var(--strand-space-3);
|
|
40
|
+
flex-shrink: 0;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
.strand-toast--
|
|
47
|
-
|
|
48
|
-
}
|
|
43
|
+
.strand-toast--info .strand-toast__status { color: var(--strand-blue-primary); }
|
|
44
|
+
.strand-toast--success .strand-toast__status { color: var(--strand-teal-vital); }
|
|
45
|
+
.strand-toast--warning .strand-toast__status { color: var(--strand-amber-caution); }
|
|
46
|
+
.strand-toast--error .strand-toast__status { color: var(--strand-red-alert); }
|
|
49
47
|
|
|
50
48
|
/* ── Message ── */
|
|
51
49
|
.strand-toast__message {
|
|
@@ -60,8 +58,8 @@
|
|
|
60
58
|
display: inline-flex;
|
|
61
59
|
align-items: center;
|
|
62
60
|
justify-content: center;
|
|
63
|
-
width:
|
|
64
|
-
height:
|
|
61
|
+
width: var(--strand-space-6);
|
|
62
|
+
height: var(--strand-space-6);
|
|
65
63
|
margin-left: var(--strand-space-3);
|
|
66
64
|
padding: 0;
|
|
67
65
|
border: none;
|
|
@@ -87,6 +87,34 @@ describe("Toast", () => {
|
|
|
87
87
|
container.querySelector(".strand-toast--info"),
|
|
88
88
|
).toBeTruthy();
|
|
89
89
|
});
|
|
90
|
+
|
|
91
|
+
it("renders status prefix for info", () => {
|
|
92
|
+
const { container } = render(<Toast message="Note" status="info" />);
|
|
93
|
+
const status = container.querySelector(".strand-toast__status");
|
|
94
|
+
expect(status).toBeTruthy();
|
|
95
|
+
expect(status!.textContent).toBe("INFO");
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("renders status prefix for success as COMPLETE", () => {
|
|
99
|
+
const { container } = render(<Toast message="OK" status="success" />);
|
|
100
|
+
const status = container.querySelector(".strand-toast__status");
|
|
101
|
+
expect(status).toBeTruthy();
|
|
102
|
+
expect(status!.textContent).toBe("COMPLETE");
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("renders status prefix for warning", () => {
|
|
106
|
+
const { container } = render(<Toast message="Warn" status="warning" />);
|
|
107
|
+
const status = container.querySelector(".strand-toast__status");
|
|
108
|
+
expect(status).toBeTruthy();
|
|
109
|
+
expect(status!.textContent).toBe("WARNING");
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("renders status prefix for error", () => {
|
|
113
|
+
const { container } = render(<Toast message="Fail" status="error" />);
|
|
114
|
+
const status = container.querySelector(".strand-toast__status");
|
|
115
|
+
expect(status).toBeTruthy();
|
|
116
|
+
expect(status!.textContent).toBe("ERROR");
|
|
117
|
+
});
|
|
90
118
|
});
|
|
91
119
|
|
|
92
120
|
describe("ToastProvider + useToast", () => {
|
|
@@ -107,12 +107,16 @@ function ToastItem({ entry, onDismiss }: ToastItemProps) {
|
|
|
107
107
|
.filter(Boolean)
|
|
108
108
|
.join(" ");
|
|
109
109
|
|
|
110
|
+
const statusLabel =
|
|
111
|
+
entry.status === "success" ? "COMPLETE" : entry.status.toUpperCase();
|
|
112
|
+
|
|
110
113
|
return (
|
|
111
114
|
<div
|
|
112
115
|
className={classes}
|
|
113
116
|
role="status"
|
|
114
117
|
aria-live={isUrgent ? "assertive" : "polite"}
|
|
115
118
|
>
|
|
119
|
+
<span className="strand-toast__status">{statusLabel}</span>
|
|
116
120
|
<span className="strand-toast__message">{entry.message}</span>
|
|
117
121
|
<button
|
|
118
122
|
type="button"
|
|
@@ -150,6 +154,9 @@ export const Toast = forwardRef<HTMLDivElement, ToastProps>(
|
|
|
150
154
|
.filter(Boolean)
|
|
151
155
|
.join(" ");
|
|
152
156
|
|
|
157
|
+
const statusLabel =
|
|
158
|
+
status === "success" ? "COMPLETE" : status.toUpperCase();
|
|
159
|
+
|
|
153
160
|
return (
|
|
154
161
|
<div
|
|
155
162
|
ref={ref}
|
|
@@ -158,6 +165,7 @@ export const Toast = forwardRef<HTMLDivElement, ToastProps>(
|
|
|
158
165
|
aria-live={isUrgent ? "assertive" : "polite"}
|
|
159
166
|
{...rest}
|
|
160
167
|
>
|
|
168
|
+
<span className="strand-toast__status">{statusLabel}</span>
|
|
161
169
|
<span className="strand-toast__message">{message}</span>
|
|
162
170
|
{onDismiss && (
|
|
163
171
|
<button
|
package/src/index.ts
CHANGED
|
@@ -100,3 +100,11 @@ export type { SpinnerProps } from "./components/Spinner/index.js";
|
|
|
100
100
|
|
|
101
101
|
export { Skeleton } from "./components/Skeleton/index.js";
|
|
102
102
|
export type { SkeletonProps } from "./components/Skeleton/index.js";
|
|
103
|
+
|
|
104
|
+
// Surfaces
|
|
105
|
+
export { InstrumentViewport } from "./components/InstrumentViewport/index.js";
|
|
106
|
+
export type { InstrumentViewportProps } from "./components/InstrumentViewport/index.js";
|
|
107
|
+
|
|
108
|
+
// Animation
|
|
109
|
+
export { ScrollReveal } from "./components/ScrollReveal/index.js";
|
|
110
|
+
export type { ScrollRevealProps } from "./components/ScrollReveal/index.js";
|