@pure-ds/storybook 0.3.19 → 0.4.1
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/pds-configurator/SearchTool.js +44 -44
- package/.storybook/preview.js +6 -2
- package/dist/pds-reference.json +65 -13
- package/package.json +50 -50
- package/stories/components/PdsCalendar.stories.js +266 -263
- package/stories/components/PdsDrawer.stories.js +2 -2
- package/stories/components/PdsIcon.stories.js +2 -2
- package/stories/components/PdsJsonform.stories.js +2 -2
- package/stories/components/PdsRichtext.stories.js +367 -367
- package/stories/components/PdsScrollrow.stories.js +140 -140
- package/stories/components/PdsSplitpanel.stories.js +502 -502
- package/stories/components/PdsTabstrip.stories.js +2 -2
- package/stories/components/PdsToaster.stories.js +186 -186
- package/stories/components/PdsUpload.stories.js +66 -66
- package/stories/enhancements/Dropdowns.stories.js +185 -185
- package/stories/enhancements/InteractiveStates.stories.js +625 -625
- package/stories/enhancements/MeshGradients.stories.js +321 -320
- package/stories/enhancements/OpenGroups.stories.js +227 -227
- package/stories/enhancements/RangeSliders.stories.js +232 -232
- package/stories/enhancements/RequiredFields.stories.js +189 -189
- package/stories/enhancements/Toggles.stories.js +167 -167
- package/stories/foundations/Colors.stories.js +2 -1
- package/stories/foundations/Icons.stories.js +4 -0
- package/stories/foundations/SmartSurfaces.stories.js +485 -367
- package/stories/foundations/Spacing.stories.js +5 -1
- package/stories/foundations/Typography.stories.js +4 -0
- package/stories/foundations/ZIndex.stories.js +329 -325
- package/stories/layout/LayoutOverview.stories.js +247 -0
- package/stories/layout/LayoutSystem.stories.js +852 -0
- package/stories/patterns/BorderEffects.stories.js +74 -72
- package/stories/primitives/Accordion.stories.js +5 -3
- package/stories/primitives/Alerts.stories.js +261 -46
- package/stories/primitives/Badges.stories.js +4 -0
- package/stories/primitives/Buttons.stories.js +2 -2
- package/stories/primitives/Cards.stories.js +98 -170
- package/stories/primitives/Media.stories.js +442 -203
- package/stories/primitives/Tables.stories.js +358 -232
- package/stories/utilities/Backdrop.stories.js +197 -0
- package/stories/patterns/Layout.stories.js +0 -99
- package/stories/utilities/GridSystem.stories.js +0 -208
|
@@ -288,10 +288,10 @@ const tabstripCategories = [
|
|
|
288
288
|
|
|
289
289
|
export default {
|
|
290
290
|
title: "Components/Pds Tabstrip",
|
|
291
|
-
tags: ['autodocs', 'grouping'],
|
|
291
|
+
tags: ['autodocs', 'tab', 'tabs', 'tabstrip', 'navigation', 'panels', 'grouping'],
|
|
292
292
|
parameters: {
|
|
293
293
|
pds: {
|
|
294
|
-
tags: [
|
|
294
|
+
tags: ['tab', 'tabs', 'tabstrip', 'navigation', 'panels', 'grouping', 'layout', 'pds-tabstrip']
|
|
295
295
|
},
|
|
296
296
|
docs: docsParameters,
|
|
297
297
|
},
|
|
@@ -1,186 +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: ['
|
|
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
|
-
};
|
|
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', 'toast', 'toaster', 'notification', 'alert', 'message', 'feedback'],
|
|
30
|
+
parameters: {
|
|
31
|
+
pds: {
|
|
32
|
+
tags: ['toast', 'toaster', 'notification', 'alert', 'message', 'feedback', 'pds-toaster', 'interaction']
|
|
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
|
+
};
|
|
@@ -1,66 +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
|
-
`;
|
|
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', 'upload', 'file', 'dropzone', 'input', 'forms'],
|
|
22
|
+
parameters: {
|
|
23
|
+
pds: {
|
|
24
|
+
tags: ['upload', 'file', 'dropzone', 'input', 'pds-upload', '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
|
+
`;
|