@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,320 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
|
|
3
|
+
const meshGradientStoryStyles = html`
|
|
4
|
+
<style>
|
|
5
|
+
.mesh-story {
|
|
6
|
+
padding: var(--spacing-4);
|
|
7
|
+
display: grid;
|
|
8
|
+
gap: var(--spacing-6);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.mesh-story__intro {
|
|
12
|
+
margin: 0 0 var(--spacing-6);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mesh-story__grid {
|
|
16
|
+
display: grid;
|
|
17
|
+
gap: var(--spacing-6);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.mesh-story__grid--featured {
|
|
21
|
+
grid-template-columns: repeat(auto-fit, minmax(18.75rem, 1fr));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.mesh-story__grid--tiles {
|
|
25
|
+
grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
|
|
26
|
+
gap: var(--spacing-4);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.mesh-story__panel,
|
|
30
|
+
.mesh-story__surface {
|
|
31
|
+
border-radius: var(--radius-lg);
|
|
32
|
+
border: 1px solid var(--color-border);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.mesh-story__panel {
|
|
36
|
+
position: relative;
|
|
37
|
+
padding: var(--spacing-6);
|
|
38
|
+
min-height: 12.5rem;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.mesh-story__panel--mesh-01 {
|
|
45
|
+
background: var(--background-mesh-01);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.mesh-story__panel--mesh-02 {
|
|
49
|
+
background: var(--background-mesh-02);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.mesh-story__inner {
|
|
53
|
+
background: var(--color-surface-base);
|
|
54
|
+
padding: var(--spacing-4);
|
|
55
|
+
border-radius: var(--radius-md);
|
|
56
|
+
box-shadow: var(--shadow-md);
|
|
57
|
+
text-align: center;
|
|
58
|
+
display: grid;
|
|
59
|
+
gap: var(--spacing-2);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.mesh-story__inner-heading {
|
|
63
|
+
margin: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.mesh-story__inner-subtitle {
|
|
67
|
+
margin: 0;
|
|
68
|
+
opacity: 0.7;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.mesh-story__tile {
|
|
72
|
+
position: relative;
|
|
73
|
+
padding: var(--spacing-5);
|
|
74
|
+
border-radius: var(--radius-md);
|
|
75
|
+
min-height: 9.375rem;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
text-align: center;
|
|
81
|
+
border: 1px solid var(--color-border);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.mesh-story__tile--mesh-03 {
|
|
85
|
+
background: var(--background-mesh-03);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.mesh-story__tile--mesh-04 {
|
|
89
|
+
background: var(--background-mesh-04);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.mesh-story__tile--mesh-05 {
|
|
93
|
+
background: var(--background-mesh-05);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.mesh-story__tile-icon {
|
|
97
|
+
opacity: 0.9;
|
|
98
|
+
margin-bottom: var(--spacing-2);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.mesh-story__tile-code {
|
|
102
|
+
font-size: 0.75rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.mesh-story__subheading {
|
|
106
|
+
margin: var(--spacing-6) 0 var(--spacing-2);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.mesh-story__hero {
|
|
110
|
+
background: var(--background-mesh-01);
|
|
111
|
+
padding: var(--spacing-8);
|
|
112
|
+
text-align: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.mesh-story__hero-text {
|
|
116
|
+
font-size: 1.25rem;
|
|
117
|
+
margin-top: var(--spacing-3);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.mesh-story__hero-actions {
|
|
121
|
+
display: flex;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
gap: var(--spacing-3);
|
|
124
|
+
margin-top: var(--spacing-4);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.mesh-story__card-surface {
|
|
128
|
+
background: var(--background-mesh-03);
|
|
129
|
+
padding: var(--spacing-6);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.mesh-story__card-overlay {
|
|
133
|
+
padding: var(--spacing-6);
|
|
134
|
+
max-width: 31.25rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.mesh-story__action-button {
|
|
138
|
+
margin-top: var(--spacing-3);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.mesh-story__grid-surface {
|
|
142
|
+
background: var(--background-mesh-05);
|
|
143
|
+
padding: var(--spacing-6);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.mesh-story__feature-card {
|
|
147
|
+
padding: var(--spacing-5);
|
|
148
|
+
text-align: center;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.mesh-story__feature-heading {
|
|
152
|
+
margin-top: var(--spacing-2);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.mesh-story__code-block {
|
|
156
|
+
background: var(--color-surface-subtle);
|
|
157
|
+
padding: var(--spacing-4);
|
|
158
|
+
border-radius: var(--radius-md);
|
|
159
|
+
overflow-x: auto;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.mesh-story__list {
|
|
163
|
+
list-style: none;
|
|
164
|
+
margin: 0;
|
|
165
|
+
padding: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.mesh-story__list-item {
|
|
169
|
+
padding: var(--spacing-2);
|
|
170
|
+
border-bottom: 1px solid var(--color-border);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.mesh-story__list-item:last-child {
|
|
174
|
+
border-bottom: 0;
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
const featuredMeshCards = [
|
|
180
|
+
{
|
|
181
|
+
key: 'mesh-01',
|
|
182
|
+
title: 'Mesh 01',
|
|
183
|
+
description: 'Subtle radial blend'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
key: 'mesh-02',
|
|
187
|
+
title: 'Mesh 02',
|
|
188
|
+
description: 'Corner accents'
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
|
|
192
|
+
const meshTileBackgrounds = ['mesh-03', 'mesh-04', 'mesh-05'];
|
|
193
|
+
|
|
194
|
+
const meshVariableList = ['mesh-01', 'mesh-02', 'mesh-03', 'mesh-04', 'mesh-05'];
|
|
195
|
+
|
|
196
|
+
export default {
|
|
197
|
+
title: 'Enhancements/Mesh Gradients',
|
|
198
|
+
parameters: {
|
|
199
|
+
pds: {
|
|
200
|
+
tags: ['colors']
|
|
201
|
+
},
|
|
202
|
+
docs: {
|
|
203
|
+
description: {
|
|
204
|
+
component: 'Beautiful mesh gradient backgrounds generated from your color palette. Automatically adapts to light and dark modes with 5 different variations.'
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const AllMeshGradients = () => html`
|
|
211
|
+
${meshGradientStoryStyles}
|
|
212
|
+
<section class="mesh-story">
|
|
213
|
+
<h2>Mesh Gradient Backgrounds</h2>
|
|
214
|
+
<p class="mesh-story__intro">
|
|
215
|
+
Subtle, beautiful mesh gradient backgrounds using <code>--background-mesh-01</code> through <code>--background-mesh-05</code>. Toggle dark mode to see automatic adaptation.
|
|
216
|
+
</p>
|
|
217
|
+
<div class="mesh-story__grid mesh-story__grid--featured">
|
|
218
|
+
${featuredMeshCards.map(({ key, title, description }) => html`
|
|
219
|
+
<div class="mesh-story__panel mesh-story__panel--${key}">
|
|
220
|
+
<div class="mesh-story__inner">
|
|
221
|
+
<h4 class="mesh-story__inner-heading">${title}</h4>
|
|
222
|
+
<p class="mesh-story__inner-subtitle">${description}</p>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
`)}
|
|
226
|
+
</div>
|
|
227
|
+
<div class="mesh-story__grid mesh-story__grid--tiles">
|
|
228
|
+
${meshTileBackgrounds.map((meshKey) => html`
|
|
229
|
+
<div class="mesh-story__tile mesh-story__tile--${meshKey}">
|
|
230
|
+
<pds-icon icon="sparkle" size="xl" class="mesh-story__tile-icon"></pds-icon>
|
|
231
|
+
<code class="mesh-story__tile-code">${meshKey}</code>
|
|
232
|
+
</div>
|
|
233
|
+
`)}
|
|
234
|
+
</div>
|
|
235
|
+
</section>
|
|
236
|
+
`;
|
|
237
|
+
|
|
238
|
+
AllMeshGradients.storyName = 'All Mesh Gradients';
|
|
239
|
+
|
|
240
|
+
export const MeshUsageExamples = () => html`
|
|
241
|
+
${meshGradientStoryStyles}
|
|
242
|
+
<section class="mesh-story">
|
|
243
|
+
<h2>Usage Examples</h2>
|
|
244
|
+
|
|
245
|
+
<h3 class="mesh-story__subheading">Hero Section</h3>
|
|
246
|
+
<div class="mesh-story__surface mesh-story__hero">
|
|
247
|
+
<h1>Welcome to Pure Design System</h1>
|
|
248
|
+
<p class="mesh-story__hero-text">
|
|
249
|
+
Beautiful backgrounds generated from your color palette
|
|
250
|
+
</p>
|
|
251
|
+
<div class="mesh-story__hero-actions">
|
|
252
|
+
<button class="btn-primary btn-lg">Get Started</button>
|
|
253
|
+
<button class="btn-secondary btn-lg">Learn More</button>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
<h3 class="mesh-story__subheading">Card with Mesh Background</h3>
|
|
258
|
+
<div class="mesh-story__surface mesh-story__card-surface">
|
|
259
|
+
<div class="card surface-elevated mesh-story__card-overlay">
|
|
260
|
+
<h4>Layered Design</h4>
|
|
261
|
+
<p>Mesh gradients work beautifully as backgrounds with overlaid content using surface tokens.</p>
|
|
262
|
+
<button class="btn-primary mesh-story__action-button">
|
|
263
|
+
<pds-icon icon="rocket"></pds-icon>
|
|
264
|
+
Take Action
|
|
265
|
+
</button>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
<h3 class="mesh-story__subheading">Grid Layout with Mesh</h3>
|
|
270
|
+
<div class="mesh-story__surface mesh-story__grid-surface">
|
|
271
|
+
<div class="grid grid-cols-3 gap-md">
|
|
272
|
+
${Array.from({ length: 3 }, (_, index) => html`
|
|
273
|
+
<div class="card surface-base mesh-story__feature-card">
|
|
274
|
+
<pds-icon icon="star" size="xl" class="icon-accent"></pds-icon>
|
|
275
|
+
<h5 class="mesh-story__feature-heading">Feature ${index + 1}</h5>
|
|
276
|
+
<p>Mesh backgrounds create visual interest without overwhelming content</p>
|
|
277
|
+
</div>
|
|
278
|
+
`)}
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
</section>
|
|
282
|
+
`;
|
|
283
|
+
|
|
284
|
+
MeshUsageExamples.storyName = 'Usage Examples';
|
|
285
|
+
|
|
286
|
+
export const CodeSamples = () => html`
|
|
287
|
+
${meshGradientStoryStyles}
|
|
288
|
+
<section class="mesh-story">
|
|
289
|
+
<h2>Code Samples</h2>
|
|
290
|
+
|
|
291
|
+
<h3 class="mesh-story__subheading">Apply as Background</h3>
|
|
292
|
+
<pre class="mesh-story__code-block"><code>/* Use CSS custom properties */
|
|
293
|
+
.hero-section {
|
|
294
|
+
background: var(--background-mesh-01);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Combine with surface colors */
|
|
298
|
+
.card {
|
|
299
|
+
background: var(--background-mesh-03);
|
|
300
|
+
backdrop-filter: blur(10px);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* Layer over solid colors */
|
|
304
|
+
.container {
|
|
305
|
+
background-color: var(--color-surface-base);
|
|
306
|
+
background-image: var(--background-mesh-02);
|
|
307
|
+
}</code></pre>
|
|
308
|
+
|
|
309
|
+
<h3 class="mesh-story__subheading">Available Variables</h3>
|
|
310
|
+
<ul class="mesh-story__list">
|
|
311
|
+
${meshVariableList.map((meshKey) => html`
|
|
312
|
+
<li class="mesh-story__list-item">
|
|
313
|
+
<code>--background-${meshKey}</code>
|
|
314
|
+
</li>
|
|
315
|
+
`)}
|
|
316
|
+
</ul>
|
|
317
|
+
</section>
|
|
318
|
+
`;
|
|
319
|
+
|
|
320
|
+
CodeSamples.storyName = 'Code Samples';
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
|
|
3
|
+
const openGroupsStoryStyles = html`
|
|
4
|
+
<style>
|
|
5
|
+
.open-groups-container {
|
|
6
|
+
max-width: 37.5rem;
|
|
7
|
+
display: grid;
|
|
8
|
+
gap: var(--spacing-4);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.open-groups-description {
|
|
12
|
+
color: var(--surface-text-secondary);
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.open-groups-description + .open-groups-fieldset,
|
|
17
|
+
.open-groups-description + .open-groups-form-fieldset {
|
|
18
|
+
margin-top: var(--spacing-4);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.open-groups-fieldset {
|
|
22
|
+
display: grid;
|
|
23
|
+
gap: var(--spacing-3);
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.open-groups-form {
|
|
28
|
+
max-width: 37.5rem;
|
|
29
|
+
display: grid;
|
|
30
|
+
gap: var(--spacing-4);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.open-groups-form-fieldset {
|
|
34
|
+
display: grid;
|
|
35
|
+
gap: var(--spacing-3);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.open-groups-actions {
|
|
39
|
+
display: flex;
|
|
40
|
+
gap: var(--spacing-3);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.open-groups-card {
|
|
44
|
+
max-width: 37.5rem;
|
|
45
|
+
display: grid;
|
|
46
|
+
gap: var(--spacing-4);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.open-groups-card-actions {
|
|
50
|
+
margin-top: var(--spacing-4);
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
title: 'Enhancements/Open Groups',
|
|
57
|
+
tags: ['forms', 'interaction'],
|
|
58
|
+
parameters: {
|
|
59
|
+
pds: {
|
|
60
|
+
tags: ['forms', 'interaction']
|
|
61
|
+
},
|
|
62
|
+
docs: {
|
|
63
|
+
description: {
|
|
64
|
+
component:
|
|
65
|
+
'Dynamic checkbox/radio groups that allow users to add custom options at runtime using the data-open attribute'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const RadioGroupOpen = () => html`
|
|
72
|
+
${openGroupsStoryStyles}
|
|
73
|
+
<section class="open-groups-container">
|
|
74
|
+
<h3>Select Your Preferences</h3>
|
|
75
|
+
<p class="open-groups-description">
|
|
76
|
+
Choose from existing options or add your own
|
|
77
|
+
</p>
|
|
78
|
+
<fieldset role="group" data-open >
|
|
79
|
+
<legend>Favorite Programming Language</legend>
|
|
80
|
+
<label>
|
|
81
|
+
<span data-label>JavaScript</span>
|
|
82
|
+
<input value="javascript" name="language" type="radio">
|
|
83
|
+
</label>
|
|
84
|
+
<label>
|
|
85
|
+
<span data-label>Python</span>
|
|
86
|
+
<input value="python" name="language" type="radio">
|
|
87
|
+
</label>
|
|
88
|
+
<label>
|
|
89
|
+
<span data-label>TypeScript</span>
|
|
90
|
+
<input value="typescript" name="language" type="radio">
|
|
91
|
+
</label>
|
|
92
|
+
</fieldset>
|
|
93
|
+
</section>
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
export const CheckboxGroupOpen = () => html`
|
|
97
|
+
${openGroupsStoryStyles}
|
|
98
|
+
<section class="open-groups-container">
|
|
99
|
+
<h3>Select Features</h3>
|
|
100
|
+
<p class="open-groups-description">
|
|
101
|
+
Select multiple features and add custom ones
|
|
102
|
+
</p>
|
|
103
|
+
<fieldset role="group" data-open>
|
|
104
|
+
<legend>Desired Features</legend>
|
|
105
|
+
<label>
|
|
106
|
+
<span data-label>Dark Mode</span>
|
|
107
|
+
<input value="dark-mode" name="features" type="checkbox">
|
|
108
|
+
</label>
|
|
109
|
+
<label>
|
|
110
|
+
<span data-label>Notifications</span>
|
|
111
|
+
<input value="notifications" name="features" type="checkbox">
|
|
112
|
+
</label>
|
|
113
|
+
<label>
|
|
114
|
+
<span data-label>Analytics</span>
|
|
115
|
+
<input value="analytics" name="features" type="checkbox">
|
|
116
|
+
</label>
|
|
117
|
+
</fieldset>
|
|
118
|
+
</section>
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
export const InForm = () => html`
|
|
122
|
+
${openGroupsStoryStyles}
|
|
123
|
+
<form
|
|
124
|
+
class="open-groups-form"
|
|
125
|
+
@submit="${(event) => {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
window.toastFormData(new FormData(event.target));
|
|
128
|
+
}}"
|
|
129
|
+
>
|
|
130
|
+
<h3>Survey Form</h3>
|
|
131
|
+
|
|
132
|
+
<fieldset role="group" data-open>
|
|
133
|
+
<legend>How did you hear about us?</legend>
|
|
134
|
+
<label>
|
|
135
|
+
<span data-label>Social Media</span>
|
|
136
|
+
<input value="social" name="source" type="radio">
|
|
137
|
+
</label>
|
|
138
|
+
<label>
|
|
139
|
+
<span data-label>Search Engine</span>
|
|
140
|
+
<input value="search" name="source" type="radio">
|
|
141
|
+
</label>
|
|
142
|
+
<label>
|
|
143
|
+
<span data-label>Friend</span>
|
|
144
|
+
<input value="friend" name="source" type="radio">
|
|
145
|
+
</label>
|
|
146
|
+
</fieldset>
|
|
147
|
+
|
|
148
|
+
<fieldset role="group" data-open>
|
|
149
|
+
<legend>Interests (select all that apply)</legend>
|
|
150
|
+
<label>
|
|
151
|
+
<span data-label>Web Development</span>
|
|
152
|
+
<input value="webdev" name="interests" type="checkbox">
|
|
153
|
+
</label>
|
|
154
|
+
<label>
|
|
155
|
+
<span data-label>Design</span>
|
|
156
|
+
<input value="design" name="interests" type="checkbox">
|
|
157
|
+
</label>
|
|
158
|
+
<label>
|
|
159
|
+
<span data-label>Marketing</span>
|
|
160
|
+
<input value="marketing" name="interests" type="checkbox">
|
|
161
|
+
</label>
|
|
162
|
+
</fieldset>
|
|
163
|
+
|
|
164
|
+
<div class="open-groups-actions">
|
|
165
|
+
<button type="submit" class="btn-primary">Submit Survey</button>
|
|
166
|
+
</div>
|
|
167
|
+
</form>
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
export const PrefilledValues = () => html`
|
|
171
|
+
${openGroupsStoryStyles}
|
|
172
|
+
<section class="open-groups-container">
|
|
173
|
+
<h3>Tag Editor</h3>
|
|
174
|
+
<p class="open-groups-description">
|
|
175
|
+
Select existing tags or create new ones by typing and pressing Enter
|
|
176
|
+
</p>
|
|
177
|
+
<fieldset role="group" data-open >
|
|
178
|
+
<legend>Article Tags</legend>
|
|
179
|
+
<label>
|
|
180
|
+
<span data-label>JavaScript</span>
|
|
181
|
+
<input value="javascript" name="tags" type="checkbox" checked>
|
|
182
|
+
</label>
|
|
183
|
+
<label>
|
|
184
|
+
<span data-label>Tutorial</span>
|
|
185
|
+
<input value="tutorial" name="tags" type="checkbox" checked>
|
|
186
|
+
</label>
|
|
187
|
+
<label>
|
|
188
|
+
<span data-label>Beginner</span>
|
|
189
|
+
<input value="beginner" name="tags" type="checkbox">
|
|
190
|
+
</label>
|
|
191
|
+
<label>
|
|
192
|
+
<span data-label>Advanced</span>
|
|
193
|
+
<input value="advanced" name="tags" type="checkbox">
|
|
194
|
+
</label>
|
|
195
|
+
</fieldset>
|
|
196
|
+
</section>
|
|
197
|
+
`;
|
|
198
|
+
|
|
199
|
+
export const InCard = () => html`
|
|
200
|
+
${openGroupsStoryStyles}
|
|
201
|
+
<article class="card open-groups-card">
|
|
202
|
+
<h3>Customize Your Experience</h3>
|
|
203
|
+
<p class="open-groups-description">
|
|
204
|
+
Choose your preferences and add custom options as needed
|
|
205
|
+
</p>
|
|
206
|
+
|
|
207
|
+
<fieldset role="group" data-open>
|
|
208
|
+
<legend>Notification Channels</legend>
|
|
209
|
+
<label>
|
|
210
|
+
<span data-label>Email</span>
|
|
211
|
+
<input value="email" name="channels" type="checkbox" checked>
|
|
212
|
+
</label>
|
|
213
|
+
<label>
|
|
214
|
+
<span data-label>SMS</span>
|
|
215
|
+
<input value="sms" name="channels" type="checkbox">
|
|
216
|
+
</label>
|
|
217
|
+
<label>
|
|
218
|
+
<span data-label>Push</span>
|
|
219
|
+
<input value="push" name="channels" type="checkbox" checked>
|
|
220
|
+
</label>
|
|
221
|
+
</fieldset>
|
|
222
|
+
|
|
223
|
+
<div class="open-groups-card-actions">
|
|
224
|
+
<button class="btn-primary">Save Preferences</button>
|
|
225
|
+
</div>
|
|
226
|
+
</article>
|
|
227
|
+
`;
|