@pure-ds/storybook 0.1.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/.storybook/addons/description/preview.js +15 -0
- package/.storybook/addons/description/register.js +60 -0
- package/.storybook/addons/html-preview/Panel.jsx +327 -0
- package/.storybook/addons/html-preview/constants.js +6 -0
- package/.storybook/addons/html-preview/preview.js +178 -0
- package/.storybook/addons/html-preview/register.js +16 -0
- package/.storybook/addons/pds-configurator/SearchTool.js +44 -0
- package/.storybook/addons/pds-configurator/Tool.js +30 -0
- package/.storybook/addons/pds-configurator/constants.js +9 -0
- package/.storybook/addons/pds-configurator/preview.js +159 -0
- package/.storybook/addons/pds-configurator/register.js +24 -0
- package/.storybook/docs.css +35 -0
- package/.storybook/htmlPreview.css +103 -0
- package/.storybook/htmlPreview.js +271 -0
- package/.storybook/main.js +160 -0
- package/.storybook/preview-body.html +48 -0
- package/.storybook/preview-head.html +11 -0
- package/.storybook/preview.js +1563 -0
- package/README.md +266 -0
- package/bin/index.js +40 -0
- package/dist/pds-reference.json +2101 -0
- package/package.json +45 -0
- package/pds.config.js +6 -0
- package/public/assets/css/app.css +1216 -0
- package/public/assets/data/auto-design-advanced.json +704 -0
- package/public/assets/data/auto-design-simple.json +123 -0
- package/public/assets/img/icon-512x512.png +0 -0
- package/public/assets/img/logo-trans.png +0 -0
- package/public/assets/img/logo.png +0 -0
- package/public/assets/js/app.js +15088 -0
- package/public/assets/js/app.js.map +7 -0
- package/public/assets/js/lit.js +1176 -0
- package/public/assets/js/lit.js.map +7 -0
- package/public/assets/js/pds.js +9801 -0
- package/public/assets/js/pds.js.map +7 -0
- package/public/assets/pds/components/pds-calendar.js +837 -0
- package/public/assets/pds/components/pds-drawer.js +857 -0
- package/public/assets/pds/components/pds-icon.js +338 -0
- package/public/assets/pds/components/pds-jsonform.js +1775 -0
- package/public/assets/pds/components/pds-richtext.js +1035 -0
- package/public/assets/pds/components/pds-scrollrow.js +331 -0
- package/public/assets/pds/components/pds-splitpanel.js +401 -0
- package/public/assets/pds/components/pds-tabstrip.js +251 -0
- package/public/assets/pds/components/pds-toaster.js +446 -0
- package/public/assets/pds/components/pds-upload.js +657 -0
- package/public/assets/pds/custom-elements.json +2003 -0
- package/public/assets/pds/icons/pds-icons.svg +498 -0
- package/public/assets/pds/pds-css-complete.json +1861 -0
- package/public/assets/pds/pds-runtime-config.json +11 -0
- package/public/assets/pds/pds.css-data.json +2152 -0
- package/public/assets/pds/styles/pds-components.css +1944 -0
- package/public/assets/pds/styles/pds-components.css.js +3895 -0
- package/public/assets/pds/styles/pds-primitives.css +352 -0
- package/public/assets/pds/styles/pds-primitives.css.js +711 -0
- package/public/assets/pds/styles/pds-styles.css +3761 -0
- package/public/assets/pds/styles/pds-styles.css.js +7529 -0
- package/public/assets/pds/styles/pds-tokens.css +699 -0
- package/public/assets/pds/styles/pds-tokens.css.js +1405 -0
- package/public/assets/pds/styles/pds-utilities.css +763 -0
- package/public/assets/pds/styles/pds-utilities.css.js +1533 -0
- package/public/assets/pds/vscode-custom-data.json +824 -0
- package/scripts/build-pds-reference.mjs +807 -0
- package/scripts/generate-stories.js +542 -0
- package/scripts/package-build.js +86 -0
- package/src/js/app.js +17 -0
- package/src/js/common/ask.js +208 -0
- package/src/js/common/common.js +20 -0
- package/src/js/common/font-loader.js +200 -0
- package/src/js/common/msg.js +90 -0
- package/src/js/lit.js +40 -0
- package/src/js/pds-core/pds-config.js +1162 -0
- package/src/js/pds-core/pds-enhancer-metadata.js +75 -0
- package/src/js/pds-core/pds-enhancers.js +357 -0
- package/src/js/pds-core/pds-enums.js +86 -0
- package/src/js/pds-core/pds-generator.js +5317 -0
- package/src/js/pds-core/pds-ontology.js +256 -0
- package/src/js/pds-core/pds-paths.js +109 -0
- package/src/js/pds-core/pds-query.js +571 -0
- package/src/js/pds-core/pds-registry.js +129 -0
- package/src/js/pds-core/pds.d.ts +129 -0
- package/src/js/pds.d.ts +408 -0
- package/src/js/pds.js +1579 -0
- package/src/pds-core/pds-api.js +105 -0
- package/stories/GettingStarted.md +96 -0
- package/stories/GettingStarted.stories.js +144 -0
- package/stories/WhatIsPDS.md +194 -0
- package/stories/WhatIsPDS.stories.js +144 -0
- package/stories/components/PdsCalendar.stories.js +263 -0
- package/stories/components/PdsDrawer.stories.js +623 -0
- package/stories/components/PdsIcon.stories.js +78 -0
- package/stories/components/PdsJsonform.stories.js +1444 -0
- package/stories/components/PdsRichtext.stories.js +367 -0
- package/stories/components/PdsScrollrow.stories.js +140 -0
- package/stories/components/PdsSplitpanel.stories.js +502 -0
- package/stories/components/PdsTabstrip.stories.js +442 -0
- package/stories/components/PdsToaster.stories.js +186 -0
- package/stories/components/PdsUpload.stories.js +66 -0
- package/stories/enhancements/Dropdowns.stories.js +185 -0
- package/stories/enhancements/InteractiveStates.stories.js +625 -0
- package/stories/enhancements/MeshGradients.stories.js +320 -0
- package/stories/enhancements/OpenGroups.stories.js +227 -0
- package/stories/enhancements/RangeSliders.stories.js +232 -0
- package/stories/enhancements/RequiredFields.stories.js +189 -0
- package/stories/enhancements/Toggles.stories.js +167 -0
- package/stories/foundations/Colors.stories.js +283 -0
- package/stories/foundations/Icons.stories.js +305 -0
- package/stories/foundations/SmartSurfaces.stories.js +367 -0
- package/stories/foundations/Spacing.stories.js +175 -0
- package/stories/foundations/Typography.stories.js +960 -0
- package/stories/foundations/ZIndex.stories.js +325 -0
- package/stories/patterns/BorderEffects.stories.js +72 -0
- package/stories/patterns/Layout.stories.js +99 -0
- package/stories/patterns/Utilities.stories.js +107 -0
- package/stories/primitives/Accordion.stories.js +359 -0
- package/stories/primitives/Alerts.stories.js +64 -0
- package/stories/primitives/Badges.stories.js +183 -0
- package/stories/primitives/Buttons.stories.js +229 -0
- package/stories/primitives/Cards.stories.js +353 -0
- package/stories/primitives/FormGroups.stories.js +569 -0
- package/stories/primitives/Forms.stories.js +131 -0
- package/stories/primitives/Media.stories.js +203 -0
- package/stories/primitives/Tables.stories.js +232 -0
- package/stories/reference/ReferenceCatalog.stories.js +28 -0
- package/stories/reference/reference-catalog.js +413 -0
- package/stories/reference/reference-docs.js +302 -0
- package/stories/reference/reference-helpers.js +310 -0
- package/stories/utilities/GridSystem.stories.js +208 -0
- package/stories/utils/PdsAsk.stories.js +420 -0
- package/stories/utils/toast-utils.js +148 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
|
|
3
|
+
const docsParameters = {
|
|
4
|
+
description: {
|
|
5
|
+
component: "Accessible tab interface with keyboard navigation",
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
if (typeof window !== 'undefined') {
|
|
10
|
+
import('../reference/reference-docs.js')
|
|
11
|
+
.then(({ createComponentDocsPage }) => {
|
|
12
|
+
docsParameters.page = createComponentDocsPage('pds-tabstrip');
|
|
13
|
+
})
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
console.warn('storybook: docs page failed to load for pds-tabstrip', error);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const tabstripStoryStyles = html`
|
|
20
|
+
<style>
|
|
21
|
+
.tabstrip-panel {
|
|
22
|
+
padding: var(--spacing-4);
|
|
23
|
+
display: grid;
|
|
24
|
+
gap: var(--spacing-4);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.tabstrip-panel__description {
|
|
28
|
+
margin-bottom: var(--spacing-4);
|
|
29
|
+
opacity: 0.9;
|
|
30
|
+
max-width: 60ch;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tabstrip-metrics-grid {
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
36
|
+
gap: var(--spacing-4);
|
|
37
|
+
margin-bottom: var(--spacing-6);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tabstrip-metric-card {
|
|
41
|
+
display: grid;
|
|
42
|
+
gap: var(--spacing-2);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.tabstrip-metric-value {
|
|
46
|
+
font-size: 2.5rem;
|
|
47
|
+
font-weight: 700;
|
|
48
|
+
margin: var(--spacing-2) 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.tabstrip-metric-value--primary {
|
|
52
|
+
color: var(--color-primary);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tabstrip-metric-value--secondary {
|
|
56
|
+
color: var(--color-secondary);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.tabstrip-metric-value--accent {
|
|
60
|
+
color: var(--color-accent);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tabstrip-metric-delta {
|
|
64
|
+
font-size: 0.85rem;
|
|
65
|
+
opacity: 0.7;
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.tabstrip-activity-card {
|
|
70
|
+
display: grid;
|
|
71
|
+
gap: var(--spacing-3);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.tabstrip-activity-list {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: var(--spacing-2);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tabstrip-activity-item {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: var(--spacing-3);
|
|
84
|
+
padding: var(--spacing-2);
|
|
85
|
+
border-radius: var(--radius-sm);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.tabstrip-activity-icon {
|
|
89
|
+
color: var(--color-primary);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.tabstrip-activity-content {
|
|
93
|
+
flex: 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tabstrip-activity-meta {
|
|
97
|
+
font-size: 0.85rem;
|
|
98
|
+
opacity: 0.7;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.tabstrip-activity-time {
|
|
102
|
+
font-size: 0.75rem;
|
|
103
|
+
opacity: 0.6;
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.tabstrip-analytics-card {
|
|
108
|
+
margin-bottom: var(--spacing-4);
|
|
109
|
+
display: grid;
|
|
110
|
+
gap: var(--spacing-3);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.tabstrip-traffic-list {
|
|
114
|
+
display: grid;
|
|
115
|
+
gap: var(--spacing-3);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.tabstrip-traffic-row {
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: space-between;
|
|
121
|
+
margin-bottom: var(--spacing-1);
|
|
122
|
+
align-items: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.tabstrip-traffic-bar-track {
|
|
126
|
+
height: 8px;
|
|
127
|
+
background: var(--surface-elevated);
|
|
128
|
+
border-radius: var(--radius-full);
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.tabstrip-traffic-bar-fill {
|
|
133
|
+
height: 100%;
|
|
134
|
+
border-radius: inherit;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.tabstrip-traffic-bar-fill--45 {
|
|
138
|
+
width: 45%;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.tabstrip-traffic-bar-fill--32 {
|
|
142
|
+
width: 32%;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.tabstrip-traffic-bar-fill--23 {
|
|
146
|
+
width: 23%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.tabstrip-traffic-bar-fill--primary {
|
|
150
|
+
background: var(--color-primary);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.tabstrip-traffic-bar-fill--secondary {
|
|
154
|
+
background: var(--color-secondary);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.tabstrip-traffic-bar-fill--accent {
|
|
158
|
+
background: var(--color-accent);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.tabstrip-features-card {
|
|
162
|
+
display: grid;
|
|
163
|
+
gap: var(--spacing-3);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.tabstrip-features-list {
|
|
167
|
+
margin: 0;
|
|
168
|
+
padding-left: var(--spacing-4);
|
|
169
|
+
display: grid;
|
|
170
|
+
gap: var(--spacing-2);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.tabstrip-settings-card,
|
|
174
|
+
.tabstrip-notifications-card {
|
|
175
|
+
margin-bottom: var(--spacing-4);
|
|
176
|
+
display: grid;
|
|
177
|
+
gap: var(--spacing-3);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.tabstrip-settings-fields {
|
|
181
|
+
display: grid;
|
|
182
|
+
gap: var(--spacing-3);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.tabstrip-form-label {
|
|
186
|
+
display: grid;
|
|
187
|
+
gap: var(--spacing-1);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.tabstrip-field-heading {
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.tabstrip-input,
|
|
195
|
+
.tabstrip-select {
|
|
196
|
+
width: 100%;
|
|
197
|
+
padding: var(--spacing-2);
|
|
198
|
+
border: 1px solid var(--color-border);
|
|
199
|
+
border-radius: var(--radius-sm);
|
|
200
|
+
font: inherit;
|
|
201
|
+
background: var(--color-surface);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.tabstrip-notification-group {
|
|
205
|
+
display: grid;
|
|
206
|
+
gap: var(--spacing-2);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.tabstrip-checkbox {
|
|
210
|
+
display: flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
gap: var(--spacing-2);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.tabstrip-actions {
|
|
216
|
+
display: flex;
|
|
217
|
+
gap: var(--spacing-2);
|
|
218
|
+
flex-wrap: wrap;
|
|
219
|
+
}
|
|
220
|
+
</style>
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
const tabstripMetrics = [
|
|
224
|
+
{
|
|
225
|
+
title: "Total Sales",
|
|
226
|
+
value: "$127.5K",
|
|
227
|
+
delta: "↑ 23% from last month",
|
|
228
|
+
valueClass: "tabstrip-metric-value--primary",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
title: "Active Users",
|
|
232
|
+
value: "8,432",
|
|
233
|
+
delta: "↑ 12% from last month",
|
|
234
|
+
valueClass: "tabstrip-metric-value--secondary",
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
title: "Conversion Rate",
|
|
238
|
+
value: "3.8%",
|
|
239
|
+
delta: "↑ 0.5% from last month",
|
|
240
|
+
valueClass: "tabstrip-metric-value--accent",
|
|
241
|
+
},
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
const tabstripActivityItems = Array.from({ length: 4 }, (_, index) => ({
|
|
245
|
+
orderId: 1000 + index,
|
|
246
|
+
amount: `$${(index + 1) * 150}`,
|
|
247
|
+
time: `${index + 1}h ago`,
|
|
248
|
+
}));
|
|
249
|
+
|
|
250
|
+
const tabstripTrafficSources = [
|
|
251
|
+
{
|
|
252
|
+
label: "Direct",
|
|
253
|
+
value: "45%",
|
|
254
|
+
fillClass: "tabstrip-traffic-bar-fill--45 tabstrip-traffic-bar-fill--primary",
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
label: "Search Engines",
|
|
258
|
+
value: "32%",
|
|
259
|
+
fillClass: "tabstrip-traffic-bar-fill--32 tabstrip-traffic-bar-fill--secondary",
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
label: "Social Media",
|
|
263
|
+
value: "23%",
|
|
264
|
+
fillClass: "tabstrip-traffic-bar-fill--23 tabstrip-traffic-bar-fill--accent",
|
|
265
|
+
},
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
const tabstripFeatures = [
|
|
269
|
+
"Deep linking with URL hashes for bookmarkable tabs",
|
|
270
|
+
"Keyboard navigation (Arrow keys, Home, End)",
|
|
271
|
+
"Accessible ARIA attributes for screen readers",
|
|
272
|
+
"Automatic focus management",
|
|
273
|
+
"Responsive design that adapts to mobile",
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
const tabstripNotificationOptions = [
|
|
277
|
+
{ label: "Email notifications for new orders", checked: true },
|
|
278
|
+
{ label: "Weekly performance reports", checked: true },
|
|
279
|
+
{ label: "Marketing updates", checked: false },
|
|
280
|
+
];
|
|
281
|
+
|
|
282
|
+
const tabstripCategories = [
|
|
283
|
+
"Electronics",
|
|
284
|
+
"Clothing",
|
|
285
|
+
"Home & Garden",
|
|
286
|
+
"Sports",
|
|
287
|
+
];
|
|
288
|
+
|
|
289
|
+
export default {
|
|
290
|
+
title: "Components/Pds Tabstrip",
|
|
291
|
+
tags: ['autodocs', 'grouping'],
|
|
292
|
+
parameters: {
|
|
293
|
+
pds: {
|
|
294
|
+
tags: ["navigation", "grouping", "layout"],
|
|
295
|
+
},
|
|
296
|
+
docs: docsParameters,
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export const Default = () => html`
|
|
301
|
+
${tabstripStoryStyles}
|
|
302
|
+
<pds-tabstrip label="Product Dashboard">
|
|
303
|
+
<pds-tabpanel id="overview" label="Overview">
|
|
304
|
+
<div class="tabstrip-panel">
|
|
305
|
+
<div>
|
|
306
|
+
<h3>Product Overview</h3>
|
|
307
|
+
<p class="tabstrip-panel__description">
|
|
308
|
+
Complete analytics and insights for your product performance.
|
|
309
|
+
</p>
|
|
310
|
+
</div>
|
|
311
|
+
|
|
312
|
+
<div class="tabstrip-metrics-grid">
|
|
313
|
+
${tabstripMetrics.map(
|
|
314
|
+
(metric) => html`
|
|
315
|
+
<article class="card surface-elevated tabstrip-metric-card">
|
|
316
|
+
<h4>${metric.title}</h4>
|
|
317
|
+
<div class="tabstrip-metric-value ${metric.valueClass}">
|
|
318
|
+
${metric.value}
|
|
319
|
+
</div>
|
|
320
|
+
<p class="tabstrip-metric-delta">${metric.delta}</p>
|
|
321
|
+
</article>
|
|
322
|
+
`
|
|
323
|
+
)}
|
|
324
|
+
</div>
|
|
325
|
+
|
|
326
|
+
<article class="card tabstrip-activity-card">
|
|
327
|
+
<h4>Recent Activity</h4>
|
|
328
|
+
<div class="tabstrip-activity-list">
|
|
329
|
+
${tabstripActivityItems.map(
|
|
330
|
+
(activity) => html`
|
|
331
|
+
<div class="tabstrip-activity-item">
|
|
332
|
+
<pds-icon class="tabstrip-activity-icon" icon="activity"></pds-icon>
|
|
333
|
+
<div class="tabstrip-activity-content">
|
|
334
|
+
<strong>New sale recorded</strong>
|
|
335
|
+
<div class="tabstrip-activity-meta">
|
|
336
|
+
Order #${activity.orderId} - ${activity.amount}
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
<span class="tabstrip-activity-time">${activity.time}</span>
|
|
340
|
+
</div>
|
|
341
|
+
`
|
|
342
|
+
)}
|
|
343
|
+
</div>
|
|
344
|
+
</article>
|
|
345
|
+
</div>
|
|
346
|
+
</pds-tabpanel>
|
|
347
|
+
|
|
348
|
+
<pds-tabpanel id="details" label="Analytics">
|
|
349
|
+
<div class="tabstrip-panel">
|
|
350
|
+
<div>
|
|
351
|
+
<h3>Detailed Analytics</h3>
|
|
352
|
+
<p class="tabstrip-panel__description">
|
|
353
|
+
Deep dive into your product metrics and user behavior.
|
|
354
|
+
</p>
|
|
355
|
+
</div>
|
|
356
|
+
|
|
357
|
+
<article class="card tabstrip-analytics-card">
|
|
358
|
+
<h4>Traffic Sources</h4>
|
|
359
|
+
<div class="tabstrip-traffic-list">
|
|
360
|
+
${tabstripTrafficSources.map(
|
|
361
|
+
(source) => html`
|
|
362
|
+
<div>
|
|
363
|
+
<div class="tabstrip-traffic-row">
|
|
364
|
+
<span>${source.label}</span>
|
|
365
|
+
<strong>${source.value}</strong>
|
|
366
|
+
</div>
|
|
367
|
+
<div class="tabstrip-traffic-bar-track">
|
|
368
|
+
<div class="tabstrip-traffic-bar-fill ${source.fillClass}"></div>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
`
|
|
372
|
+
)}
|
|
373
|
+
</div>
|
|
374
|
+
</article>
|
|
375
|
+
|
|
376
|
+
<article class="card surface-elevated tabstrip-features-card">
|
|
377
|
+
<h4>Top Features</h4>
|
|
378
|
+
<ul class="tabstrip-features-list">
|
|
379
|
+
${tabstripFeatures.map((feature) => html`<li>${feature}</li>`)}
|
|
380
|
+
</ul>
|
|
381
|
+
</article>
|
|
382
|
+
</div>
|
|
383
|
+
</pds-tabpanel>
|
|
384
|
+
|
|
385
|
+
<pds-tabpanel id="settings" label="Settings">
|
|
386
|
+
<div class="tabstrip-panel">
|
|
387
|
+
<div>
|
|
388
|
+
<h3>Product Settings</h3>
|
|
389
|
+
<p class="tabstrip-panel__description">
|
|
390
|
+
Configure your product preferences and options.
|
|
391
|
+
</p>
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<article class="card tabstrip-settings-card">
|
|
395
|
+
<h4>General Settings</h4>
|
|
396
|
+
<div class="tabstrip-settings-fields">
|
|
397
|
+
<label class="tabstrip-form-label">
|
|
398
|
+
<span class="tabstrip-field-heading">Product Name</span>
|
|
399
|
+
<input
|
|
400
|
+
class="tabstrip-input"
|
|
401
|
+
type="text"
|
|
402
|
+
value="My Awesome Product"
|
|
403
|
+
placeholder="Enter product name"
|
|
404
|
+
/>
|
|
405
|
+
</label>
|
|
406
|
+
|
|
407
|
+
<label class="tabstrip-form-label">
|
|
408
|
+
<span class="tabstrip-field-heading">Product Category</span>
|
|
409
|
+
<select class="tabstrip-select">
|
|
410
|
+
${tabstripCategories.map(
|
|
411
|
+
(category) => html`<option>${category}</option>`
|
|
412
|
+
)}
|
|
413
|
+
</select>
|
|
414
|
+
</label>
|
|
415
|
+
</div>
|
|
416
|
+
</article>
|
|
417
|
+
|
|
418
|
+
<article class="card surface-elevated tabstrip-notifications-card">
|
|
419
|
+
<h4>Notifications</h4>
|
|
420
|
+
<fieldset class="tabstrip-notification-group" role="radiogroup">
|
|
421
|
+
${tabstripNotificationOptions.map(
|
|
422
|
+
(option) => html`
|
|
423
|
+
<label class="tabstrip-checkbox">
|
|
424
|
+
<input type="checkbox" ?checked=${option.checked} />
|
|
425
|
+
<span>${option.label}</span>
|
|
426
|
+
</label>
|
|
427
|
+
`
|
|
428
|
+
)}
|
|
429
|
+
</fieldset>
|
|
430
|
+
</article>
|
|
431
|
+
|
|
432
|
+
<div class="tabstrip-actions">
|
|
433
|
+
<button class="btn-primary">
|
|
434
|
+
<pds-icon icon="check"></pds-icon>
|
|
435
|
+
Save Settings
|
|
436
|
+
</button>
|
|
437
|
+
<button class="btn-outline">Cancel</button>
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
</pds-tabpanel>
|
|
441
|
+
</pds-tabstrip>
|
|
442
|
+
`;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
|
|
3
|
+
const docsParameters = {
|
|
4
|
+
description: {
|
|
5
|
+
component: 'Toast notification system with auto-dismiss and stacking. Toast notifications appear in the top-right corner and auto-dismiss after a few seconds based on message length.'
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
if (typeof window !== 'undefined') {
|
|
10
|
+
import('../reference/reference-docs.js')
|
|
11
|
+
.then(({ createComponentDocsPage }) => {
|
|
12
|
+
docsParameters.page = createComponentDocsPage('pds-toaster');
|
|
13
|
+
})
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
console.warn('storybook: docs page failed to load for pds-toaster', error);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const toasterStoryStyles = html`
|
|
20
|
+
<style>
|
|
21
|
+
.toaster-story-description {
|
|
22
|
+
margin: 0 0 var(--spacing-4);
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
title: 'Components/Pds Toaster',
|
|
29
|
+
tags: ['autodocs'],
|
|
30
|
+
parameters: {
|
|
31
|
+
pds: {
|
|
32
|
+
tags: ['interaction', 'notifications']
|
|
33
|
+
},
|
|
34
|
+
docs: docsParameters
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Default = () => {
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
const toaster = document.getElementById('demo-toaster');
|
|
41
|
+
|
|
42
|
+
document.getElementById('toast-success')?.addEventListener('click', () => {
|
|
43
|
+
toaster?.toast('Your changes have been saved successfully!', {
|
|
44
|
+
type: 'success'
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
document.getElementById('toast-info')?.addEventListener('click', () => {
|
|
49
|
+
toaster?.toast('This is an informational message with helpful context.', {
|
|
50
|
+
type: 'info'
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
document.getElementById('toast-warning')?.addEventListener('click', () => {
|
|
55
|
+
toaster?.toast('Warning: This action cannot be undone!', {
|
|
56
|
+
type: 'warning'
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
document.getElementById('toast-error')?.addEventListener('click', () => {
|
|
61
|
+
toaster?.toast('Error: Something went wrong. Please try again.', {
|
|
62
|
+
type: 'error'
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
document.getElementById('toast-long')?.addEventListener('click', () => {
|
|
67
|
+
toaster?.toast(
|
|
68
|
+
'This is a longer toast notification message that demonstrates how the duration is automatically calculated based on the message length. The toast will stay visible longer to give you enough time to read the entire message.',
|
|
69
|
+
{ type: 'info' }
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
document.getElementById('toast-persistent')?.addEventListener('click', () => {
|
|
74
|
+
toaster?.toast(
|
|
75
|
+
'This is a persistent toast that won\'t auto-dismiss. Click the × to close it.',
|
|
76
|
+
{ type: 'info', persistent: true }
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
}, 0);
|
|
80
|
+
|
|
81
|
+
return html`
|
|
82
|
+
${toasterStoryStyles}
|
|
83
|
+
<pds-toaster id="demo-toaster"></pds-toaster>
|
|
84
|
+
|
|
85
|
+
<p class="toaster-story-description">
|
|
86
|
+
Toast notifications appear in the top-right corner and auto-dismiss after a few seconds. Click the buttons below to see them in action:
|
|
87
|
+
</p>
|
|
88
|
+
|
|
89
|
+
<div class="flex flex-wrap gap-md">
|
|
90
|
+
<button id="toast-success" class="btn-primary btn-sm">
|
|
91
|
+
<pds-icon icon="check-circle" size="sm"></pds-icon>
|
|
92
|
+
Success
|
|
93
|
+
</button>
|
|
94
|
+
<button id="toast-info" class="btn-secondary btn-sm">
|
|
95
|
+
<pds-icon icon="info" size="sm"></pds-icon>
|
|
96
|
+
Info
|
|
97
|
+
</button>
|
|
98
|
+
<button id="toast-warning" class="btn-warning btn-sm">
|
|
99
|
+
<pds-icon icon="warning" size="sm"></pds-icon>
|
|
100
|
+
Warning
|
|
101
|
+
</button>
|
|
102
|
+
<button id="toast-error" class="btn-danger btn-sm">
|
|
103
|
+
<pds-icon icon="x-circle" size="sm"></pds-icon>
|
|
104
|
+
Error
|
|
105
|
+
</button>
|
|
106
|
+
<button id="toast-long" class="btn-outline btn-sm">
|
|
107
|
+
<pds-icon icon="clock" size="sm"></pds-icon>
|
|
108
|
+
Long
|
|
109
|
+
</button>
|
|
110
|
+
<button id="toast-persistent" class="btn-outline btn-sm">
|
|
111
|
+
<pds-icon icon="bell" size="sm"></pds-icon>
|
|
112
|
+
Persistent
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
`;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const ViaEvents = () => {
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
const { PDS } = window;
|
|
121
|
+
|
|
122
|
+
document.getElementById('event-success')?.addEventListener('click', () => {
|
|
123
|
+
PDS?.dispatchEvent(new CustomEvent('pds:toast', {
|
|
124
|
+
detail: {
|
|
125
|
+
message: 'Operation completed successfully!',
|
|
126
|
+
type: 'success'
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
document.getElementById('event-info')?.addEventListener('click', () => {
|
|
132
|
+
PDS?.dispatchEvent(new CustomEvent('pds:toast', {
|
|
133
|
+
detail: {
|
|
134
|
+
message: 'New updates are available for your application.',
|
|
135
|
+
type: 'info'
|
|
136
|
+
}
|
|
137
|
+
}));
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
document.getElementById('event-warning')?.addEventListener('click', () => {
|
|
141
|
+
PDS?.dispatchEvent(new CustomEvent('pds:toast', {
|
|
142
|
+
detail: {
|
|
143
|
+
message: 'Please review your changes before continuing.',
|
|
144
|
+
type: 'warning'
|
|
145
|
+
}
|
|
146
|
+
}));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
document.getElementById('event-error')?.addEventListener('click', () => {
|
|
150
|
+
PDS?.dispatchEvent(new CustomEvent('pds:toast', {
|
|
151
|
+
detail: {
|
|
152
|
+
message: 'Failed to connect to server. Check your network connection.',
|
|
153
|
+
type: 'error'
|
|
154
|
+
}
|
|
155
|
+
}));
|
|
156
|
+
});
|
|
157
|
+
}, 0);
|
|
158
|
+
|
|
159
|
+
return html`
|
|
160
|
+
${toasterStoryStyles}
|
|
161
|
+
<pds-toaster id="event-toaster"></pds-toaster>
|
|
162
|
+
|
|
163
|
+
<p class="toaster-story-description">
|
|
164
|
+
Toast notifications can also be triggered via PDS events. This is useful for global notifications from anywhere in your application.
|
|
165
|
+
</p>
|
|
166
|
+
|
|
167
|
+
<div class="flex flex-wrap gap-md">
|
|
168
|
+
<button id="event-success" class="btn-primary btn-sm">
|
|
169
|
+
<pds-icon icon="check-circle" size="sm"></pds-icon>
|
|
170
|
+
Success Event
|
|
171
|
+
</button>
|
|
172
|
+
<button id="event-info" class="btn-secondary btn-sm">
|
|
173
|
+
<pds-icon icon="info" size="sm"></pds-icon>
|
|
174
|
+
Info Event
|
|
175
|
+
</button>
|
|
176
|
+
<button id="event-warning" class="btn-warning btn-sm">
|
|
177
|
+
<pds-icon icon="warning" size="sm"></pds-icon>
|
|
178
|
+
Warning Event
|
|
179
|
+
</button>
|
|
180
|
+
<button id="event-error" class="btn-danger btn-sm">
|
|
181
|
+
<pds-icon icon="x-circle" size="sm"></pds-icon>
|
|
182
|
+
Error Event
|
|
183
|
+
</button>
|
|
184
|
+
</div>
|
|
185
|
+
`;
|
|
186
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
|
|
3
|
+
const docsParameters = {
|
|
4
|
+
description: {
|
|
5
|
+
component: 'File upload with preview and validation'
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
if (typeof window !== 'undefined') {
|
|
10
|
+
import('../reference/reference-docs.js')
|
|
11
|
+
.then(({ createComponentDocsPage }) => {
|
|
12
|
+
docsParameters.page = createComponentDocsPage('pds-upload');
|
|
13
|
+
})
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
console.warn('storybook: docs page failed to load for pds-upload', error);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Components/Pds Upload',
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
parameters: {
|
|
23
|
+
pds: {
|
|
24
|
+
tags: ['forms']
|
|
25
|
+
},
|
|
26
|
+
docs: docsParameters
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
accept: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Accepted file types (MIME or extensions)'
|
|
32
|
+
},
|
|
33
|
+
multiple: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Allow multiple file selection'
|
|
36
|
+
},
|
|
37
|
+
maxSize: {
|
|
38
|
+
control: 'number',
|
|
39
|
+
description: 'Max file size in bytes'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Default = {
|
|
45
|
+
render: (args) => html`
|
|
46
|
+
<pds-upload
|
|
47
|
+
accept="${args.accept}"
|
|
48
|
+
?multiple="${args.multiple}"
|
|
49
|
+
max-size="${args.maxSize}"
|
|
50
|
+
@files-changed="${(e) => toastFormData(e.detail)}">
|
|
51
|
+
</pds-upload>
|
|
52
|
+
`,
|
|
53
|
+
args: {
|
|
54
|
+
accept: 'image/*',
|
|
55
|
+
multiple: true,
|
|
56
|
+
maxSize: 5000000
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const SingleFile = () => html`
|
|
61
|
+
<pds-upload accept="application/pdf" max-size="10000000"></pds-upload>
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export const WithPreview = () => html`
|
|
65
|
+
<pds-upload accept="image/*" multiple max-files="5"></pds-upload>
|
|
66
|
+
`;
|