@descope/web-components-ui 3.5.1 → 3.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/dist/cjs/index.cjs.js +58 -7
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +58 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/descope-user-attribute-index-js.js +4 -4
- package/dist/umd/descope-user-attribute-index-js.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +34 -33
- package/src/components/descope-user-attribute/UserAttributeClass.js +58 -7
- package/src/theme/components/userAttribute.js +1 -0
- package/stories/commonControls.js +359 -0
- package/stories/descope-alert.stories.js +102 -0
- package/stories/descope-button-multi-selection-group.stories.js +130 -0
- package/stories/descope-button-selection-group.stories.js +131 -0
- package/stories/descope-calendar.stories.js +115 -0
- package/stories/descope-checkbox.stories.js +74 -0
- package/stories/descope-code-snippet.stories.js +118 -0
- package/stories/descope-container.stories.js +96 -0
- package/stories/descope-date-field.stories.js +169 -0
- package/stories/descope-divider.stories.js +43 -0
- package/stories/descope-email-field.stories.js +109 -0
- package/stories/descope-grid.stories.js +218 -0
- package/stories/descope-hcaptcha.stories.js +29 -0
- package/stories/descope-hybrid-field.stories.js +151 -0
- package/stories/descope-loader-linear.stories.js +29 -0
- package/stories/descope-loader-radial.stories.js +29 -0
- package/stories/descope-logo.stories.js +40 -0
- package/stories/descope-mappings-field.stories.js +108 -0
- package/stories/descope-modal.stories.js +48 -0
- package/stories/descope-multi-select-combo-box.stories.js +183 -0
- package/stories/descope-new-password.stories.js +206 -0
- package/stories/descope-notification.stories.js +81 -0
- package/stories/descope-notp-image.stories.js +29 -0
- package/stories/descope-number-field.stories.js +83 -0
- package/stories/descope-passcode.stories.js +89 -0
- package/stories/descope-password.stories.js +89 -0
- package/stories/descope-phone-field.stories.js +137 -0
- package/stories/descope-phone-input-box-field.stories.js +128 -0
- package/stories/descope-policy-validation.stories.js +92 -0
- package/stories/descope-radio-group.stories.js +142 -0
- package/stories/descope-recaptcha.stories.js +38 -0
- package/stories/descope-saml-group-mappings.stories.js +109 -0
- package/stories/descope-scopes-list.stories.js +81 -0
- package/stories/descope-security-questions-setup.stories.js +125 -0
- package/stories/descope-security-questions-verify.stories.js +111 -0
- package/stories/descope-switch-toggle.stories.js +74 -0
- package/stories/descope-text-area.stories.js +77 -0
- package/stories/descope-text-field.stories.js +98 -0
- package/stories/descope-third-party-app-logo.stories.js +42 -0
- package/stories/descope-totp-image.stories.js +29 -0
- package/stories/descope-upload-file.stories.js +113 -0
- package/stories/descope-user-attribute.stories.js +103 -0
- package/stories/descope-user-auth-method.stories.js +77 -0
- package/stories/helpers.js +86 -0
- package/stories/icons/alert.svg +9 -0
- package/stories/icons/apple.svg +10 -0
- package/stories/icons/base64png.js +1 -0
- package/stories/icons/base64svg.js +1 -0
- package/stories/icons/button-icon.svg +3 -0
- package/stories/icons/errorMessageIconBase64.js +1 -0
- package/stories/icons/fulfilled-button-icon.svg +3 -0
- package/stories/icons/google.svg +25 -0
- package/stories/icons/method-icon.svg +3 -0
- package/stories/images/150x200.jpg +0 -0
- package/stories/images/800x150.jpg +0 -0
- package/stories/images/avatar.jpeg +0 -0
- package/stories/images/demo.jpg +0 -0
- package/stories/images/game.png +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TextClass } from '@descope-ui/descope-text/class';
|
|
2
2
|
import { ButtonClass } from '@descope-ui/descope-button/class';
|
|
3
3
|
import { BadgeClass } from '@descope-ui/descope-badge/class';
|
|
4
|
+
import { IconClass } from '@descope-ui/descope-icon/class';
|
|
4
5
|
import { injectStyle } from '@descope-ui/common/components-helpers';
|
|
5
6
|
import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';
|
|
6
7
|
import { createBaseClass } from '../../baseClasses/createBaseClass';
|
|
@@ -24,12 +25,12 @@ class RawUserAttribute extends createBaseClass({
|
|
|
24
25
|
<descope-text st-text-align="auto" data-id="value-text" variant="body1" mode="primary" class="value"></descope-text>
|
|
25
26
|
<div class="btn-wrapper">
|
|
26
27
|
<descope-badge mode="default" bordered="true" size="xs"></descope-badge>
|
|
27
|
-
<descope-button size="
|
|
28
|
-
<slot name="edit-icon"></slot>
|
|
29
|
-
</descope-button>
|
|
30
|
-
<descope-button size="xs" data-id="delete-btn" square="true" variant="link" mode="primary">
|
|
28
|
+
<descope-button size="sm" data-id="delete-btn" variant="link" mode="primary">
|
|
31
29
|
<slot name="delete-icon"></slot>
|
|
32
30
|
</descope-button>
|
|
31
|
+
<descope-button size="sm" data-id="edit-btn" variant="link" mode="primary">
|
|
32
|
+
<slot name="edit-icon"></slot>
|
|
33
|
+
</descope-button>
|
|
33
34
|
</div>
|
|
34
35
|
</div>
|
|
35
36
|
</div>
|
|
@@ -48,7 +49,7 @@ class RawUserAttribute extends createBaseClass({
|
|
|
48
49
|
height: 100%;
|
|
49
50
|
align-items: center;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
|
|
52
53
|
::slotted(*) {
|
|
53
54
|
display: flex;
|
|
54
55
|
align-items: center;
|
|
@@ -66,6 +67,14 @@ class RawUserAttribute extends createBaseClass({
|
|
|
66
67
|
justify-content: space-between;
|
|
67
68
|
align-items: center;
|
|
68
69
|
flex-grow: 0;
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
slot[name="edit-icon"],
|
|
74
|
+
slot[name="delete-icon"] {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
flex-shrink: 0;
|
|
77
|
+
align-items: center;
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
.content-wrapper {
|
|
@@ -102,6 +111,7 @@ class RawUserAttribute extends createBaseClass({
|
|
|
102
111
|
|
|
103
112
|
.hidden {
|
|
104
113
|
visibility: hidden;
|
|
114
|
+
width: 0;
|
|
105
115
|
}
|
|
106
116
|
|
|
107
117
|
descope-text[data-id="label-text"].required:after {
|
|
@@ -111,6 +121,7 @@ class RawUserAttribute extends createBaseClass({
|
|
|
111
121
|
|
|
112
122
|
:host([readonly="true"]) descope-button {
|
|
113
123
|
visibility: hidden;
|
|
124
|
+
width: 0;
|
|
114
125
|
}
|
|
115
126
|
`,
|
|
116
127
|
this
|
|
@@ -150,6 +161,21 @@ class RawUserAttribute extends createBaseClass({
|
|
|
150
161
|
this.badge.setAttribute('title', this.badgeTooltipText || this.badgeLabel);
|
|
151
162
|
}
|
|
152
163
|
|
|
164
|
+
updateButtonLabel(btnRef, label) {
|
|
165
|
+
let textSpanEle = btnRef.querySelector('span.btn-label');
|
|
166
|
+
|
|
167
|
+
if (label) {
|
|
168
|
+
if (!textSpanEle) {
|
|
169
|
+
textSpanEle = document.createElement('span');
|
|
170
|
+
textSpanEle.classList.add('btn-label');
|
|
171
|
+
btnRef.appendChild(textSpanEle);
|
|
172
|
+
}
|
|
173
|
+
textSpanEle.innerText = label;
|
|
174
|
+
} else {
|
|
175
|
+
textSpanEle?.remove();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
153
179
|
onIsRequiredChange() {
|
|
154
180
|
this.labelText.classList.toggle('required', this.isRequired);
|
|
155
181
|
}
|
|
@@ -178,12 +204,26 @@ class RawUserAttribute extends createBaseClass({
|
|
|
178
204
|
return this.getAttribute('badge-tooltip-text') || '';
|
|
179
205
|
}
|
|
180
206
|
|
|
207
|
+
get editButtonLabel() {
|
|
208
|
+
return this.getAttribute('edit-button-label') || '';
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
get deleteButtonLabel() {
|
|
212
|
+
return this.getAttribute('delete-button-label') || '';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
get isDeleteHidden() {
|
|
216
|
+
return this.getAttribute('hide-delete') === 'true';
|
|
217
|
+
}
|
|
218
|
+
|
|
181
219
|
init() {
|
|
182
220
|
this.onLabelChange();
|
|
183
221
|
this.onValueOrPlaceholderChange();
|
|
184
222
|
this.onIsRequiredChange();
|
|
185
223
|
this.onBadgeLabelChange();
|
|
186
224
|
this.onBadgeTooltipTextChange();
|
|
225
|
+
this.updateButtonLabel(this.editButton, this.editButtonLabel);
|
|
226
|
+
this.updateButtonLabel(this.deleteButton, this.deleteButtonLabel);
|
|
187
227
|
this.handleDeleteButtonVisibility();
|
|
188
228
|
|
|
189
229
|
this.deleteButton.addEventListener('click', () =>
|
|
@@ -219,11 +259,17 @@ class RawUserAttribute extends createBaseClass({
|
|
|
219
259
|
'required',
|
|
220
260
|
'badge-label',
|
|
221
261
|
'badge-tooltip-text',
|
|
262
|
+
'edit-button-label',
|
|
263
|
+
'delete-button-label',
|
|
264
|
+
'hide-delete',
|
|
222
265
|
].concat(super.observedAttributes);
|
|
223
266
|
}
|
|
224
267
|
|
|
225
268
|
handleDeleteButtonVisibility() {
|
|
226
|
-
this.deleteButton.classList.toggle(
|
|
269
|
+
this.deleteButton.classList.toggle(
|
|
270
|
+
'hidden',
|
|
271
|
+
this.isRequired || !this.value || this.isDeleteHidden
|
|
272
|
+
);
|
|
227
273
|
}
|
|
228
274
|
|
|
229
275
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -243,9 +289,13 @@ class RawUserAttribute extends createBaseClass({
|
|
|
243
289
|
this.onBadgeLabelChange();
|
|
244
290
|
} else if (name === 'badge-tooltip-text') {
|
|
245
291
|
this.onBadgeTooltipTextChange();
|
|
292
|
+
} else if (name === 'edit-button-label') {
|
|
293
|
+
this.updateButtonLabel(this.editButton, this.editButtonLabel);
|
|
294
|
+
} else if (name === 'delete-button-label') {
|
|
295
|
+
this.updateButtonLabel(this.deleteButton, this.deleteButtonLabel);
|
|
246
296
|
}
|
|
247
297
|
|
|
248
|
-
if (name === 'value' || name === 'required') {
|
|
298
|
+
if (name === 'value' || name === 'required' || name === 'hide-delete') {
|
|
249
299
|
this.handleDeleteButtonVisibility();
|
|
250
300
|
}
|
|
251
301
|
}
|
|
@@ -276,6 +326,7 @@ export const UserAttributeClass = compose(
|
|
|
276
326
|
contentMinWidth: { ...contentWrapper, property: 'min-width' },
|
|
277
327
|
badgeMaxWidth: { ...badge, property: 'max-width' },
|
|
278
328
|
itemsGap: [{ property: 'gap' }, { ...contentWrapper, property: 'gap' }],
|
|
329
|
+
iconColor: [{ selector: () => '::slotted(*)', property: IconClass.cssVarList.fill }],
|
|
279
330
|
},
|
|
280
331
|
}),
|
|
281
332
|
draggableMixin,
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import errorMessageIconBase64 from './icons/errorMessageIconBase64';
|
|
2
|
+
|
|
3
|
+
export const labelControl = {
|
|
4
|
+
label: {
|
|
5
|
+
name: 'Label',
|
|
6
|
+
control: { type: 'text' },
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const helperTextControl = {
|
|
11
|
+
'helper-text': {
|
|
12
|
+
name: 'Helper Text',
|
|
13
|
+
control: { type: 'text' },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const placeholderControl = {
|
|
18
|
+
placeholder: {
|
|
19
|
+
name: 'Placeholder',
|
|
20
|
+
control: { type: 'text' },
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const sizeControl = {
|
|
25
|
+
size: {
|
|
26
|
+
name: 'Size',
|
|
27
|
+
options: ['xs', 'sm', 'md', 'lg'],
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const loadingControl = {
|
|
33
|
+
loading: {
|
|
34
|
+
name: 'Loading',
|
|
35
|
+
control: { type: 'boolean' },
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const fullWidthControl = {
|
|
40
|
+
'full-width': {
|
|
41
|
+
name: 'Full Width',
|
|
42
|
+
control: { type: 'boolean' },
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const disabledControl = {
|
|
47
|
+
disabled: {
|
|
48
|
+
name: 'Disabled',
|
|
49
|
+
control: { type: 'boolean' },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const readOnlyControl = {
|
|
54
|
+
readonly: {
|
|
55
|
+
name: 'Read Only',
|
|
56
|
+
control: { type: 'boolean' },
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const requiredControl = {
|
|
61
|
+
required: {
|
|
62
|
+
name: 'Required',
|
|
63
|
+
control: { type: 'boolean' },
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const directionControl = {
|
|
68
|
+
direction: {
|
|
69
|
+
name: 'Direction',
|
|
70
|
+
options: ['ltr', 'rtl'],
|
|
71
|
+
control: { type: 'select' },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const borderedControl = {
|
|
76
|
+
bordered: {
|
|
77
|
+
name: 'Bordered',
|
|
78
|
+
control: { type: 'boolean' },
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const minLengthControl = {
|
|
83
|
+
minlength: {
|
|
84
|
+
name: 'Min. Length',
|
|
85
|
+
control: { type: 'number' },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const maxLengthControl = {
|
|
90
|
+
maxlength: {
|
|
91
|
+
name: 'Max. Length',
|
|
92
|
+
control: { type: 'number' },
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const textContentControl = {
|
|
97
|
+
text: {
|
|
98
|
+
name: 'Content',
|
|
99
|
+
control: { type: 'text' },
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const modeControl = {
|
|
104
|
+
mode: {
|
|
105
|
+
name: 'Mode',
|
|
106
|
+
options: ['none', 'primary', 'secondary', 'success', 'error'],
|
|
107
|
+
control: { type: 'select' },
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const textAlignControl = {
|
|
112
|
+
'text-align': {
|
|
113
|
+
name: 'Text Align',
|
|
114
|
+
options: ['left', 'center', 'right'],
|
|
115
|
+
control: { type: 'select' },
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const errorMissingValueControl = {
|
|
120
|
+
'data-errormessage-value-missing': {
|
|
121
|
+
name: 'Custom Error: Mandatory',
|
|
122
|
+
control: { type: 'text' },
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const errorPatternMismatchControl = {
|
|
127
|
+
'data-errormessage-pattern-mismatch': {
|
|
128
|
+
name: 'Custom Error: Pattern Mismatch',
|
|
129
|
+
control: { type: 'text' },
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const errorTypeMismatchControl = {
|
|
134
|
+
'data-errormessage-type-mismatch': {
|
|
135
|
+
name: 'Custom Error: Type Mismatch',
|
|
136
|
+
control: { type: 'text' },
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const errorBadInputControl = {
|
|
141
|
+
'data-errormessage-bad-input': {
|
|
142
|
+
name: 'Custom Error: Bad Input',
|
|
143
|
+
control: { type: 'text' },
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const errorRangeUnderflowControl = {
|
|
148
|
+
'data-errormessage-range-underflow': {
|
|
149
|
+
name: 'Custom Error: Below minimum value',
|
|
150
|
+
control: { type: 'text' },
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const errorRangeOverflowControl = {
|
|
155
|
+
'data-errormessage-range-overflow': {
|
|
156
|
+
name: 'Custom Error: Exceeds maximum value',
|
|
157
|
+
control: { type: 'text' },
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const fillControl = {
|
|
162
|
+
'st-fill': {
|
|
163
|
+
name: 'Fill',
|
|
164
|
+
control: { type: 'color' },
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const customHeightControl = {
|
|
169
|
+
'st-host-height': {
|
|
170
|
+
name: 'Custom Height',
|
|
171
|
+
control: { type: 'text' },
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const customWidthControl = {
|
|
176
|
+
'st-host-width': {
|
|
177
|
+
name: 'Custom Width',
|
|
178
|
+
control: { type: 'text' },
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const checkboxValueControl = {
|
|
183
|
+
checked: {
|
|
184
|
+
name: 'Checked',
|
|
185
|
+
control: { type: 'boolean' },
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const buttonVariantControl = {
|
|
190
|
+
variant: {
|
|
191
|
+
name: 'Button Variant',
|
|
192
|
+
options: ['contained', 'outline', 'link'],
|
|
193
|
+
control: { type: 'select' },
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const boxShadowControl = {
|
|
198
|
+
shadow: {
|
|
199
|
+
name: 'Shadow',
|
|
200
|
+
options: ['sm', 'md', 'lg', 'xl', '2xl'],
|
|
201
|
+
control: { type: 'select' },
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const borderRadiusControl = {
|
|
206
|
+
'border-radius': {
|
|
207
|
+
name: 'Radius',
|
|
208
|
+
options: ['sm', 'md', 'lg', 'xl', '2xl', '3xl'],
|
|
209
|
+
control: { type: 'select' },
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const imgSrcControl = {
|
|
214
|
+
src: {
|
|
215
|
+
name: 'Image Source',
|
|
216
|
+
control: { type: 'text' },
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export const typographyVariantControl = {
|
|
221
|
+
variant: {
|
|
222
|
+
name: 'Variant',
|
|
223
|
+
options: ['h1', 'h2', 'h3', 'subtitle1', 'subtitle2', 'body1', 'body2'],
|
|
224
|
+
control: { type: 'select' },
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const overrideRenderItemControl = {
|
|
229
|
+
overrideRenderItem: {
|
|
230
|
+
name: 'Override the default item renderer function',
|
|
231
|
+
control: { type: 'boolean' },
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export const itemsSourceControl = {
|
|
236
|
+
itemsSource: {
|
|
237
|
+
name: 'Where to take the items from',
|
|
238
|
+
control: {
|
|
239
|
+
type: 'select',
|
|
240
|
+
labels: {
|
|
241
|
+
children: 'Children',
|
|
242
|
+
attr: '"data" attribute',
|
|
243
|
+
prop: '"data" property',
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
options: ['children', 'attr', 'prop'],
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export const minItemsSelectionControl = {
|
|
251
|
+
minItemsSelection: {
|
|
252
|
+
name: 'Min Items Selection',
|
|
253
|
+
control: { type: 'number' },
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const maxItemsSelectionControl = {
|
|
258
|
+
maxItemsSelection: {
|
|
259
|
+
name: 'Max Items Selection',
|
|
260
|
+
control: { type: 'number' },
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const labelSpacingControl = {
|
|
265
|
+
'label-spacing': {
|
|
266
|
+
name: 'Label Spacing',
|
|
267
|
+
control: { type: 'range', min: 0, max: 200, step: 1 },
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export const inputLabelTypeControl = {
|
|
272
|
+
'label-type': {
|
|
273
|
+
name: 'Label Type',
|
|
274
|
+
control: {
|
|
275
|
+
type: 'select',
|
|
276
|
+
},
|
|
277
|
+
options: ['static', 'floating'],
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export const inputCopyToClipboardControl = {
|
|
282
|
+
'copy-to-clipboard': {
|
|
283
|
+
name: 'Copy to clipboard',
|
|
284
|
+
control: {
|
|
285
|
+
type: 'boolean',
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
export const errorMessageIconControl = {
|
|
291
|
+
errorMsgIcon: {
|
|
292
|
+
name: 'Error Message Icon',
|
|
293
|
+
control: {
|
|
294
|
+
type: 'boolean',
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const defaultValueMissingControl = {
|
|
300
|
+
defaultErrorMessageValueMissing: {
|
|
301
|
+
name: 'Default error-message: Value missing',
|
|
302
|
+
control: {
|
|
303
|
+
type: 'boolean',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const defaultPatternMismatchControl = {
|
|
309
|
+
defaultErrorMessagePatternMismatch: {
|
|
310
|
+
name: 'Default error-message: Pattern mismatch',
|
|
311
|
+
control: {
|
|
312
|
+
type: 'boolean',
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export const errorMessageIconAttrs = `
|
|
318
|
+
st-error-message-icon="url(${errorMessageIconBase64})"
|
|
319
|
+
st-error-message-icon-size="14px"
|
|
320
|
+
st-error-message-icon-padding="1.5em"
|
|
321
|
+
`;
|
|
322
|
+
|
|
323
|
+
export const tooltipPositionControl = {
|
|
324
|
+
tooltipPosition: {
|
|
325
|
+
control: { type: 'select' },
|
|
326
|
+
options: [
|
|
327
|
+
'top',
|
|
328
|
+
'top-start',
|
|
329
|
+
'top-end',
|
|
330
|
+
'bottom',
|
|
331
|
+
'bottom-start',
|
|
332
|
+
'bottom-end',
|
|
333
|
+
'start',
|
|
334
|
+
'start-top',
|
|
335
|
+
'start-bottom',
|
|
336
|
+
'end',
|
|
337
|
+
'end-top',
|
|
338
|
+
'end-bottom',
|
|
339
|
+
],
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export const obfuscatedControl = {
|
|
344
|
+
obfuscated: {
|
|
345
|
+
name: 'Toggle input obfuscation',
|
|
346
|
+
control: {
|
|
347
|
+
type: 'boolean',
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export const valueControl = {
|
|
353
|
+
value: {
|
|
354
|
+
name: 'Input Value',
|
|
355
|
+
control: {
|
|
356
|
+
type: 'text',
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { componentName } from '../src/components/descope-alert';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
fullWidthControl,
|
|
5
|
+
directionControl,
|
|
6
|
+
borderRadiusControl,
|
|
7
|
+
borderedControl,
|
|
8
|
+
typographyVariantControl,
|
|
9
|
+
} from './commonControls';
|
|
10
|
+
|
|
11
|
+
import icon from './icons/alert.svg?no-inline';
|
|
12
|
+
|
|
13
|
+
const iconAttrs = `st-icon="url(${icon})"`;
|
|
14
|
+
|
|
15
|
+
const Template = ({
|
|
16
|
+
text,
|
|
17
|
+
direction,
|
|
18
|
+
mode,
|
|
19
|
+
variant,
|
|
20
|
+
spacing,
|
|
21
|
+
bordered,
|
|
22
|
+
'text-align': textAlign,
|
|
23
|
+
'link-target-blank': linkTargetBlank,
|
|
24
|
+
'full-width': fullWidth,
|
|
25
|
+
'background-color': backgroundColor,
|
|
26
|
+
'border-color': borderColor,
|
|
27
|
+
'border-radius': radius,
|
|
28
|
+
'border-width': borderWidth,
|
|
29
|
+
hasIcon,
|
|
30
|
+
}) =>
|
|
31
|
+
`
|
|
32
|
+
<descope-alert
|
|
33
|
+
bordered="${bordered || false}"
|
|
34
|
+
full-width="${fullWidth || false}"
|
|
35
|
+
spacing="${spacing || ''}"
|
|
36
|
+
mode="${mode || ''}"
|
|
37
|
+
variant="${variant || ''}"
|
|
38
|
+
border-radius="${radius || ''}"
|
|
39
|
+
border-width="${borderWidth || ''}"
|
|
40
|
+
link-target-blank="${linkTargetBlank || false}"
|
|
41
|
+
text-align="${textAlign || ''}"
|
|
42
|
+
st-background-color="${backgroundColor || ''}"
|
|
43
|
+
st-border-color="${borderColor || ''}"
|
|
44
|
+
st-host-direction="${direction ?? ''}"
|
|
45
|
+
${hasIcon ? iconAttrs : ''}
|
|
46
|
+
>
|
|
47
|
+
${text}
|
|
48
|
+
</descope-alert>
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
component: componentName,
|
|
53
|
+
title: 'descope-alert',
|
|
54
|
+
argTypes: {
|
|
55
|
+
...fullWidthControl,
|
|
56
|
+
...directionControl,
|
|
57
|
+
...borderRadiusControl,
|
|
58
|
+
...borderedControl,
|
|
59
|
+
...typographyVariantControl,
|
|
60
|
+
mode: {
|
|
61
|
+
name: 'Mode',
|
|
62
|
+
options: ['success', 'error'],
|
|
63
|
+
control: { type: 'select' },
|
|
64
|
+
},
|
|
65
|
+
hasIcon: {
|
|
66
|
+
name: 'Has Icon',
|
|
67
|
+
control: { type: 'boolean' },
|
|
68
|
+
},
|
|
69
|
+
'border-width': {
|
|
70
|
+
name: 'Border Width',
|
|
71
|
+
control: { type: 'select' },
|
|
72
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
73
|
+
},
|
|
74
|
+
'background-color': {
|
|
75
|
+
name: 'Background Color',
|
|
76
|
+
control: { type: 'color' },
|
|
77
|
+
},
|
|
78
|
+
'border-color': {
|
|
79
|
+
name: 'Border Color',
|
|
80
|
+
control: { type: 'color' },
|
|
81
|
+
},
|
|
82
|
+
spacing: {
|
|
83
|
+
name: 'Spacing',
|
|
84
|
+
control: { type: 'select' },
|
|
85
|
+
options: ['', 'xs', 'sm', 'md', 'lg', 'xl'],
|
|
86
|
+
},
|
|
87
|
+
'text-align': {
|
|
88
|
+
name: 'Text Align',
|
|
89
|
+
control: { type: 'select' },
|
|
90
|
+
options: ['left', 'center', 'right'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Default = Template.bind({});
|
|
96
|
+
|
|
97
|
+
Default.args = {
|
|
98
|
+
text: 'Alert text ([link](https://descope.com))',
|
|
99
|
+
mode: 'error',
|
|
100
|
+
variant: 'body1',
|
|
101
|
+
'link-target-blank': true,
|
|
102
|
+
};
|