@descope/web-components-ui 1.0.426 → 1.0.428

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.
Files changed (100) hide show
  1. package/README.md +0 -1
  2. package/dist/cjs/index.cjs.js +2520 -5270
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +2022 -4815
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +7 -15
  7. package/src/components/descope-apps-list/AppsListClass.js +1 -1
  8. package/src/components/descope-apps-list/index.js +2 -2
  9. package/src/components/descope-date-field/descope-calendar/index.js +1 -1
  10. package/src/components/descope-divider/DividerClass.js +1 -1
  11. package/src/components/descope-divider/index.js +1 -1
  12. package/src/components/descope-link/LinkClass.js +1 -1
  13. package/src/components/descope-link/index.js +1 -1
  14. package/src/components/descope-security-questions-setup/SecurityQuestionsSetupClass.js +1 -1
  15. package/src/components/descope-security-questions-setup/index.js +1 -1
  16. package/src/components/descope-security-questions-verify/SecurityQuestionsVerifyClass.js +1 -1
  17. package/src/components/descope-security-questions-verify/index.js +1 -1
  18. package/src/components/descope-user-attribute/UserAttributeClass.js +1 -1
  19. package/src/components/descope-user-attribute/index.js +1 -1
  20. package/src/components/descope-user-auth-method/UserAuthMethodClass.js +1 -1
  21. package/src/components/descope-user-auth-method/index.js +1 -1
  22. package/src/components/mapping-fields/descope-mappings-field/MappingsFieldClass.js +1 -1
  23. package/src/components/mapping-fields/descope-mappings-field/index.js +2 -2
  24. package/src/components/phone-fields/descope-phone-field/PhoneFieldClass.js +1 -1
  25. package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/index.js +1 -1
  26. package/src/components/phone-fields/descope-phone-field/index.js +1 -1
  27. package/src/components/phone-fields/descope-phone-input-box-field/index.js +1 -1
  28. package/src/helpers/themeHelpers/index.js +1 -1
  29. package/src/theme/components/alert.js +1 -1
  30. package/src/theme/components/enrichedText.js +1 -1
  31. package/src/theme/components/index.js +3 -3
  32. package/dist/index.d.ts +0 -72
  33. package/node_modules/common/.eslintrc.json +0 -18
  34. package/node_modules/common/README.md +0 -7
  35. package/node_modules/common/package.json +0 -37
  36. package/node_modules/common/project.json +0 -7
  37. package/node_modules/common/src/baseClasses/baseClasses/createBaseClass.js +0 -66
  38. package/node_modules/common/src/baseClasses/baseClasses/createBaseInputClass.js +0 -14
  39. package/node_modules/common/src/baseClasses/baseClasses/createCssVarImageClass.js +0 -55
  40. package/node_modules/common/src/baseClasses/index.js +0 -3
  41. package/node_modules/common/src/componentsHelpers/index.js +0 -95
  42. package/node_modules/common/src/componentsMixins/helpers/mixinsHelpers.js +0 -10
  43. package/node_modules/common/src/componentsMixins/index.js +0 -1
  44. package/node_modules/common/src/componentsMixins/mixins/activableMixin.js +0 -14
  45. package/node_modules/common/src/componentsMixins/mixins/changeMixin.js +0 -22
  46. package/node_modules/common/src/componentsMixins/mixins/componentNameValidationMixin.js +0 -23
  47. package/node_modules/common/src/componentsMixins/mixins/componentsContextMixin.js +0 -12
  48. package/node_modules/common/src/componentsMixins/mixins/createDynamicDataMixin.js +0 -100
  49. package/node_modules/common/src/componentsMixins/mixins/createProxy.js +0 -58
  50. package/node_modules/common/src/componentsMixins/mixins/createStyleMixin/helpers.js +0 -106
  51. package/node_modules/common/src/componentsMixins/mixins/createStyleMixin/index.js +0 -167
  52. package/node_modules/common/src/componentsMixins/mixins/draggableMixin.js +0 -62
  53. package/node_modules/common/src/componentsMixins/mixins/externalInputHelpers.js +0 -93
  54. package/node_modules/common/src/componentsMixins/mixins/externalInputMixin.js +0 -170
  55. package/node_modules/common/src/componentsMixins/mixins/hoverableMixin.js +0 -13
  56. package/node_modules/common/src/componentsMixins/mixins/index.js +0 -14
  57. package/node_modules/common/src/componentsMixins/mixins/inputEventsDispatchingMixin.js +0 -76
  58. package/node_modules/common/src/componentsMixins/mixins/inputValidationMixin.js +0 -210
  59. package/node_modules/common/src/componentsMixins/mixins/lifecycleEventsMixin.js +0 -23
  60. package/node_modules/common/src/componentsMixins/mixins/normalizeBooleanAttributesMixin.js +0 -59
  61. package/node_modules/common/src/componentsMixins/mixins/portalMixin.js +0 -112
  62. package/node_modules/common/src/componentsMixins/mixins/proxyInputMixin.js +0 -242
  63. package/node_modules/common/src/constants.js +0 -4
  64. package/node_modules/common/src/icons/errorMessageIconBase64.js +0 -1
  65. package/node_modules/common/src/sbControls.js +0 -302
  66. package/node_modules/common/src/sbHelpers.js +0 -53
  67. package/node_modules/common/src/themeHelpers/colorsHelpers.js +0 -94
  68. package/node_modules/common/src/themeHelpers/componentsThemeManager.js +0 -45
  69. package/node_modules/common/src/themeHelpers/index.js +0 -191
  70. package/node_modules/common/src/themeHelpers/resetHelpers.js +0 -144
  71. package/node_modules/common/src/utils/index.js +0 -68
  72. package/node_modules/descope-avatar/e2e/descope-avatar.spec.ts +0 -54
  73. package/node_modules/descope-avatar/package.json +0 -34
  74. package/node_modules/descope-avatar/project.json +0 -7
  75. package/node_modules/descope-avatar/src/component/AvatarClass.js +0 -109
  76. package/node_modules/descope-avatar/src/component/index.js +0 -8
  77. package/node_modules/descope-avatar/src/theme.js +0 -44
  78. package/node_modules/descope-avatar/stories/avatar.jpeg +0 -0
  79. package/node_modules/descope-avatar/stories/descope-avatar.stories.js +0 -32
  80. package/node_modules/descope-combo-box/e2e/descope-combo-box.spec.ts +0 -462
  81. package/node_modules/descope-combo-box/package.json +0 -34
  82. package/node_modules/descope-combo-box/project.json +0 -7
  83. package/node_modules/descope-combo-box/src/component/ComboBoxClass.js +0 -619
  84. package/node_modules/descope-combo-box/src/component/index.js +0 -6
  85. package/node_modules/descope-combo-box/src/theme.js +0 -93
  86. package/node_modules/descope-combo-box/stories/descope-combo-box.stories.js +0 -180
  87. package/node_modules/descope-text/e2e/descope-text.spec.ts +0 -35
  88. package/node_modules/descope-text/package.json +0 -31
  89. package/node_modules/descope-text/project.json +0 -7
  90. package/node_modules/descope-text/src/component/TextClass.js +0 -63
  91. package/node_modules/descope-text/src/component/index.js +0 -5
  92. package/node_modules/descope-text/src/theme.js +0 -91
  93. package/node_modules/descope-text/stories/descope-text.stories.js +0 -55
  94. package/node_modules/theme-globals/package.json +0 -16
  95. package/node_modules/theme-globals/project.json +0 -7
  96. package/node_modules/theme-globals/src/index.js +0 -180
  97. package/node_modules/theme-input-wrapper/package.json +0 -17
  98. package/node_modules/theme-input-wrapper/project.json +0 -7
  99. package/node_modules/theme-input-wrapper/src/index.js +0 -130
  100. package/src/index.d.ts +0 -72
@@ -1,7 +0,0 @@
1
- {
2
- "name": "descope-avatar",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/web-components/components/descope-avatar/src",
5
- "projectType": "library",
6
- "tags": []
7
- }
@@ -1,109 +0,0 @@
1
- import { createStyleMixin, draggableMixin, componentNameValidationMixin } from 'common/components-mixins';
2
- import { createBaseClass } from 'common/base-classes';
3
- import { compose } from 'common/utils';
4
- import { forwardAttrs, getComponentName, observeAttributes } from 'common/components-helpers';
5
-
6
- export const componentName = getComponentName('avatar');
7
- class RawAvatar extends createBaseClass({ componentName, baseSelector: ':host > .wrapper' }) {
8
- constructor() {
9
- super();
10
-
11
- this.attachShadow({ mode: 'open' }).innerHTML = `
12
- <style>
13
- :host {
14
- display: inline-flex;
15
- }
16
-
17
- .editableBadge {
18
- border: 1px solid;
19
- border-radius: 100%;
20
- height: fit-content;
21
- width: 25%;
22
- height: 25%;
23
- display: flex;
24
- justify-content: center;
25
- align-items: center;
26
- padding: 5%;
27
- box-sizing: border-box;
28
- position: absolute;
29
- bottom: 0;
30
- inset-inline-end: 0;
31
- }
32
-
33
- vaadin-icon {
34
- color: currentcolor;
35
- }
36
-
37
- vaadin-avatar {
38
- width: 100%;
39
- height: 100%;
40
- margin: 0;
41
- border: none
42
- }
43
-
44
- .wrapper {
45
- display: inline-flex;
46
- position: relative;
47
- width: 100%;
48
- height: 100%;
49
- }
50
- </style>
51
-
52
-
53
- <div class="wrapper">
54
- <vaadin-avatar></vaadin-avatar>
55
- <div class="editableBadge">
56
- <vaadin-icon icon="vaadin:pencil"></vaadin-icon>
57
- </div>
58
- </div>
59
- `;
60
-
61
- this.avatarComponent = this.shadowRoot.querySelector('vaadin-avatar');
62
-
63
- forwardAttrs(this, this.avatarComponent, {
64
- includeAttrs: ['display-name', 'img', 'abbr'],
65
- mapAttrs: { 'display-name': 'name' },
66
- });
67
-
68
- const editableIcon = this.shadowRoot.querySelector('.editableBadge');
69
-
70
- observeAttributes(
71
- this,
72
- () => {
73
- editableIcon.style.display = this.isEditable ? '' : 'none';
74
- },
75
- { includeAttrs: ['editable'] }
76
- );
77
- }
78
-
79
- get isEditable() {
80
- return this.getAttribute('editable') === 'true';
81
- }
82
- }
83
-
84
- const { host, editableBadge, avatar } = {
85
- host: { selector: () => ':host' },
86
- editableBadge: { selector: '> .editableBadge' },
87
- avatar: { selector: 'vaadin-avatar' },
88
- };
89
-
90
- export const AvatarClass = compose(
91
- createStyleMixin({
92
- mappings: {
93
- hostWidth: [
94
- { ...host, property: 'width' },
95
- { ...host, property: 'min-width' },
96
- ],
97
- hostHeight: { ...host, property: 'height' },
98
- cursor: [avatar, host],
99
- hostDirection: { ...host, property: 'direction' },
100
- avatarTextColor: { ...avatar, property: 'color' },
101
- avatarBackgroundColor: { ...avatar, property: 'background-color' },
102
- editableIconColor: { ...editableBadge, property: 'color' },
103
- editableBorderColor: { ...editableBadge, property: 'border-color' },
104
- editableBackgroundColor: { ...editableBadge, property: 'background-color' },
105
- },
106
- }),
107
- draggableMixin,
108
- componentNameValidationMixin
109
- )(RawAvatar);
@@ -1,8 +0,0 @@
1
- import { componentName, AvatarClass } from './AvatarClass';
2
- import '@vaadin/avatar';
3
- import '@vaadin/icon';
4
- import '@vaadin/icons';
5
-
6
- customElements.define(componentName, AvatarClass);
7
-
8
- export { AvatarClass };
@@ -1,44 +0,0 @@
1
- import globals from 'theme-globals';
2
- import { AvatarClass } from './component/AvatarClass';
3
- import { getThemeRefs } from 'common/theme-helpers';
4
-
5
- const globalRefs = getThemeRefs(globals);
6
- const compVars = AvatarClass.cssVarList;
7
-
8
- const avatar = {
9
- [compVars.hostDirection]: globalRefs.direction,
10
- [compVars.editableIconColor]: globalRefs.colors.surface.dark,
11
- [compVars.editableBorderColor]: globalRefs.colors.surface.dark,
12
- [compVars.editableBackgroundColor]: globalRefs.colors.surface.main,
13
- [compVars.avatarTextColor]: globalRefs.colors.surface.main,
14
- [compVars.avatarBackgroundColor]: globalRefs.colors.surface.dark,
15
-
16
- _editable: {
17
- [compVars.cursor]: 'pointer',
18
- },
19
-
20
- size: {
21
- xs: {
22
- [compVars.hostWidth]: '30px',
23
- [compVars.hostHeight]: '30px',
24
- },
25
- sm: {
26
- [compVars.hostWidth]: '40px',
27
- [compVars.hostHeight]: '40px',
28
- },
29
- md: {
30
- [compVars.hostWidth]: '60px',
31
- [compVars.hostHeight]: '60px',
32
- },
33
- lg: {
34
- [compVars.hostWidth]: '98px',
35
- [compVars.hostHeight]: '98px',
36
- },
37
- },
38
- };
39
-
40
- export default avatar;
41
-
42
- export const vars = {
43
- ...compVars,
44
- };
@@ -1,32 +0,0 @@
1
- import { componentName } from '../src/component/AvatarClass';
2
- import { directionControl, sizeControl } from 'common/sb-controls';
3
- import img from './avatar.jpeg'
4
-
5
- const Template = ({ 'display-name': displayName, img, size, editable, direction }) => `
6
- <descope-avatar
7
- display-name="${displayName || ''}"
8
- img="${img}"
9
- size="${size}"
10
- editable="${editable || ''}"
11
- st-host-direction="${direction ?? ''}">
12
- ></descope-avatar
13
- `;
14
-
15
- export default {
16
- component: componentName,
17
- title: 'descope-avatar',
18
- argTypes: {
19
- ...sizeControl,
20
- ...directionControl,
21
- },
22
- };
23
-
24
- export const Default = Template.bind({});
25
-
26
- Default.args = {
27
- img: img,
28
- 'display-name': 'John Doe',
29
- size: 'sm',
30
- editable: false,
31
- direction: ''
32
- };
@@ -1,462 +0,0 @@
1
- import { test, expect } from '@playwright/test';
2
- import { getStoryUrl, loopConfig, loopPresets } from 'e2e-utils';
3
- import { createComboBoxTestDriver } from 'test-drivers';
4
-
5
- const storyName = 'descope-combo-box';
6
- const componentName = 'descope-combo-box';
7
-
8
- const BooleanValues = ['true', 'false'];
9
-
10
- const componentAttributes = {
11
- label: 'Number field label',
12
- placeholder: 'Test placeholder',
13
- size: ['xs', 'sm', 'md', 'lg'],
14
- bordered: BooleanValues,
15
- readonly: BooleanValues,
16
- required: BooleanValues,
17
- 'full-width': BooleanValues,
18
- disabled: 'true',
19
- 'default-value': 'itemId2',
20
- };
21
-
22
- const presets = {
23
- 'Render with alt item renderer': {
24
- itemsSource: 'prop',
25
- overrideRenderItem: 'true',
26
- },
27
- 'Render with data property': { itemsSource: 'prop' },
28
- 'Render with data attribute': { itemsSource: 'attr' },
29
- 'Render with data property and default value': {
30
- itemsSource: 'prop',
31
- 'default-value': 'itemId2',
32
- },
33
- };
34
-
35
- const rtlPresets = {
36
- 'direction rtl': {
37
- direction: 'rtl',
38
- label: '-Test Label',
39
- placeholder: '-Test Placeholder',
40
- itemsSource: 'attr',
41
- 'data[0].displayName': '-Item 1',
42
- 'data[1].displayName': '-Item 2',
43
- 'data[1].label': '-Data Item 2',
44
- },
45
- 'direction rtl required': {
46
- direction: 'rtl',
47
- label: '-Test Label',
48
- placeholder: '-Test Placeholder',
49
- itemsSource: 'attr',
50
- 'data[0].displayName': '-Item 1',
51
- 'data[1].displayName': '-Item 2',
52
- 'data[1].label': '-Data Item 2',
53
- required: 'true',
54
- },
55
- };
56
-
57
- const floatingLabelProps = {
58
- 'label-type': 'floating',
59
- label: 'label-',
60
- placeholder: 'placeholder',
61
- };
62
-
63
- export const floatingLabelTypePresets = {
64
- 'floating label ltr': floatingLabelProps,
65
- 'floating label rtl': {
66
- ...floatingLabelProps,
67
- direction: 'rtl',
68
- },
69
- 'floating label ltr with value': {
70
- ...floatingLabelProps,
71
- 'default-value': 'itemId2',
72
- direction: 'ltr',
73
- },
74
- 'floating label rtl with value': {
75
- ...floatingLabelProps,
76
- 'default-value': 'itemId2',
77
- direction: 'rtl',
78
- },
79
- };
80
-
81
- test.describe('theme', () => {
82
- const { placeholder, ...restConfig } = componentAttributes;
83
-
84
- test.describe('with placeholder', () => {
85
- test.beforeEach(async ({ page }) => {
86
- await page.goto(getStoryUrl(storyName, { placeholder }), {
87
- waitUntil: 'networkidle',
88
- });
89
- await page.waitForSelector(componentName);
90
- const component = createComboBoxTestDriver(page.locator(componentName));
91
- await component.clear();
92
- });
93
-
94
- test('hover', async ({ page }) => {
95
- const component = createComboBoxTestDriver(page.locator(componentName));
96
- await component.hover();
97
- expect(await component.screenshot()).toMatchSnapshot();
98
- });
99
-
100
- test('focus', async ({ page }) => {
101
- const component = createComboBoxTestDriver(page.locator(componentName));
102
- await component.focus();
103
- expect(await component.screenshot()).toMatchSnapshot();
104
- });
105
- });
106
-
107
- loopPresets(presets, (preset, name) => {
108
- test.describe(name, () => {
109
- test.beforeEach(async ({ page }) => {
110
- await page.goto(getStoryUrl(storyName, preset), {
111
- waitUntil: 'networkidle',
112
- });
113
- });
114
-
115
- test('hover', async ({ page }) => {
116
- const component = createComboBoxTestDriver(page.locator(componentName));
117
- await component.hover();
118
- expect(
119
- await component.screenshot({ animations: 'disabled' }),
120
- ).toMatchSnapshot();
121
- });
122
-
123
- test('focus', async ({ page }) => {
124
- const component = createComboBoxTestDriver(page.locator(componentName));
125
- await component.focus();
126
- expect(
127
- await component.screenshot({ animations: 'disabled' }),
128
- ).toMatchSnapshot();
129
- });
130
- });
131
- });
132
-
133
- test.describe('with value', () => {
134
- loopConfig(restConfig, (attr, value) => {
135
- test.describe(`${attr}: ${value}`, () => {
136
- test.beforeEach(async ({ page }) => {
137
- await page.goto(getStoryUrl(storyName, { [attr]: value }), {
138
- waitUntil: 'networkidle',
139
- });
140
-
141
- const component = createComboBoxTestDriver(
142
- page.locator(componentName),
143
- );
144
- component.setValue('itemId4');
145
- });
146
-
147
- test('hover', async ({ page }) => {
148
- const component = createComboBoxTestDriver(
149
- page.locator(componentName),
150
- );
151
- await component.hover();
152
- expect(await component.screenshot()).toMatchSnapshot();
153
- });
154
-
155
- test('focus', async ({ page }) => {
156
- const component = createComboBoxTestDriver(
157
- page.locator(componentName),
158
- );
159
- await component.focus();
160
- expect(await component.screenshot()).toMatchSnapshot();
161
- });
162
- });
163
- });
164
- });
165
-
166
- test.describe('dropDown', () => {
167
- loopConfig(
168
- {
169
- size: componentAttributes.size,
170
- 'full-width': componentAttributes['full-width'],
171
- },
172
- (attr, value) => {
173
- test.describe(`${attr}: ${value}`, () => {
174
- test.beforeEach(async ({ page }) => {
175
- await page.goto(getStoryUrl(storyName, { [attr]: value }), {
176
- waitUntil: 'networkidle',
177
- });
178
-
179
- const component = createComboBoxTestDriver(
180
- page.locator(componentName),
181
- );
182
- await component.openDropdown();
183
- });
184
- test('visible', async ({ page }) => {
185
- const component = createComboBoxTestDriver(
186
- page.locator(componentName),
187
- );
188
- await component.hover();
189
- expect(await component.dropDown.screenshot()).toMatchSnapshot();
190
- });
191
- });
192
- },
193
- );
194
- });
195
-
196
- test.describe('direction rtl', () => {
197
- loopPresets(rtlPresets, (preset, name) => {
198
- test(name, async ({ page }) => {
199
- await page.goto(getStoryUrl(storyName, preset));
200
- await page.waitForSelector(componentName);
201
- const component = page.locator(componentName);
202
-
203
- expect(
204
- await component.screenshot({
205
- animations: 'disabled',
206
- timeout: 3000,
207
- caret: 'hide',
208
- }),
209
- ).toMatchSnapshot();
210
- });
211
- });
212
- test('with error', async ({ page }) => {
213
- await page.goto(getStoryUrl(storyName, Object.values(rtlPresets)[1]), {
214
- waitUntil: 'networkidle',
215
- });
216
- const component = createComboBoxTestDriver(page.locator(componentName));
217
- await page.getByRole('button').getByText('Submit').click();
218
- expect(await component.screenshot({ delay: 1000 })).toMatchSnapshot();
219
- });
220
-
221
- test('with open dropdown', async ({ page }) => {
222
- await page.goto(getStoryUrl(storyName, Object.values(rtlPresets)[1]), {
223
- waitUntil: 'networkidle',
224
- });
225
- const component = createComboBoxTestDriver(page.locator(componentName));
226
- await component.openDropdown();
227
- await component.hover();
228
- expect(await component.dropDown.screenshot()).toMatchSnapshot();
229
- });
230
-
231
- test('with open dropdown and value', async ({ page }) => {
232
- await page.goto(getStoryUrl(storyName, Object.values(rtlPresets)[1]), {
233
- waitUntil: 'networkidle',
234
- });
235
- const component = createComboBoxTestDriver(page.locator(componentName));
236
- await component.setValue('itemId2');
237
- await component.openDropdown();
238
- await component.hover();
239
- expect(await component.dropDown.screenshot()).toMatchSnapshot();
240
- });
241
-
242
- test('with value', async ({ page }) => {
243
- await page.goto(getStoryUrl(storyName, Object.values(rtlPresets)[1]), {
244
- waitUntil: 'networkidle',
245
- });
246
- const component = createComboBoxTestDriver(page.locator(componentName));
247
- await component.setValue('itemId2');
248
- expect(await component.screenshot()).toMatchSnapshot();
249
- });
250
- });
251
- });
252
-
253
- test.describe('logic', () => {
254
- test.beforeEach(async ({ page }) => {
255
- await page.goto(getStoryUrl(storyName, { 'full-width': true }), {
256
- waitUntil: 'networkidle',
257
- });
258
- });
259
-
260
- test('select item', async ({ page }) => {
261
- const component = createComboBoxTestDriver(page.locator(componentName));
262
- await component.openDropdown();
263
- await component.selectItem("Achilles' Fateful Wrath");
264
-
265
- expect(await component.getValue()).toBe('itemId2');
266
- });
267
-
268
- // 'required' - not working as expected
269
-
270
- test.describe('clear button', () => {
271
- test('clear button visible when has value', async ({ page }) => {
272
- await page.goto(getStoryUrl(storyName, { 'default-value': 'itemId2' }), {
273
- waitUntil: 'networkidle',
274
- });
275
- const component = createComboBoxTestDriver(page.locator(componentName));
276
- await component.clearSelection();
277
- expect(await component.getValue()).toBe('');
278
- });
279
- });
280
-
281
- test('loading state', async ({ page }) => {
282
- await page.goto(getStoryUrl(storyName, {}));
283
- const componentLocator = page.locator(componentName);
284
- const component = createComboBoxTestDriver(componentLocator);
285
-
286
- await componentLocator.evaluate((node: HTMLElement) => {
287
- node.setAttribute('loading', 'true');
288
- });
289
- await component.openDropdown();
290
- expect(
291
- await component.dropDown.screenshot({ animations: 'disabled' }),
292
- ).toMatchSnapshot();
293
-
294
- await componentLocator.evaluate((node: HTMLElement) => {
295
- node.removeAttribute('loading');
296
- });
297
- await page.waitForTimeout(1000);
298
- expect(
299
- await component.dropDown.screenshot({ animations: 'disabled' }),
300
- ).toMatchSnapshot();
301
- });
302
-
303
- test('allow custom value', async ({ page }) => {
304
- await page.goto(getStoryUrl(storyName, { 'allow-custom-value': true }));
305
- const component = createComboBoxTestDriver(page.locator(componentName));
306
- const value = 'new value';
307
- await component.setValue(value);
308
- expect(await component.screenshot()).toMatchSnapshot();
309
- expect(await component.getValue()).toBe(value);
310
- });
311
-
312
- test.describe('reset value', () => {
313
- const testResetValue = async (
314
- page: any,
315
- allowCustomValue: boolean,
316
- extraSteps?: (component: any) => Promise<void>,
317
- ) => {
318
- const urlParams = allowCustomValue ? { 'allow-custom-value': true } : {};
319
- await page.goto(getStoryUrl(storyName, urlParams));
320
- const component = createComboBoxTestDriver(page.locator(componentName));
321
- await component.setValue('itemId2');
322
- expect(await component.getValue()).toBe('itemId2');
323
- expect(await component.screenshot()).toMatchSnapshot();
324
- await component.setValue('');
325
- expect(await component.getValue()).toBe('');
326
- expect(await component.screenshot()).toMatchSnapshot();
327
-
328
- if (extraSteps) {
329
- await extraSteps(component);
330
- }
331
- };
332
-
333
- test('no custom value', async ({ page }) => {
334
- await testResetValue(page, false);
335
- });
336
-
337
- test('allow custom value', async ({ page }) => {
338
- await testResetValue(page, true, async (component) => {
339
- await component.setValue('new value');
340
- expect(await component.getValue()).toBe('new value');
341
- expect(await component.screenshot()).toMatchSnapshot();
342
- await component.setValue('');
343
- expect(await component.getValue()).toBe('');
344
- expect(await component.screenshot()).toMatchSnapshot();
345
- });
346
- });
347
- });
348
-
349
- test('error message with icon', async ({ page }) => {
350
- await page.goto(
351
- getStoryUrl(storyName, { required: true, errorMsgIcon: true }),
352
- );
353
-
354
- const component = createComboBoxTestDriver(page.locator(componentName));
355
-
356
- await page.getByRole('button').getByText('Submit').click();
357
-
358
- await component.blur();
359
-
360
- expect(
361
- await component.screenshot({
362
- animations: 'disabled',
363
- caret: 'hide',
364
- delay: 3000,
365
- }),
366
- ).toMatchSnapshot();
367
- });
368
- });
369
-
370
- test.describe('variants', () => {
371
- loopPresets(floatingLabelTypePresets, (preset, name) => {
372
- test.describe(name, () => {
373
- test.beforeEach(async ({ page }) => {
374
- await page.goto(getStoryUrl(storyName, preset), {
375
- waitUntil: 'networkidle',
376
- });
377
- });
378
-
379
- test('hover', async ({ page }) => {
380
- const component = createComboBoxTestDriver(page.locator(componentName));
381
- await component.setValue('itemId2');
382
- await component.hover();
383
- expect(
384
- await component.screenshot({ animations: 'disabled' }),
385
- ).toMatchSnapshot();
386
- });
387
- test('focus', async ({ page }) => {
388
- const component = createComboBoxTestDriver(page.locator(componentName));
389
- await component.focus();
390
- expect(
391
- await component.screenshot({ animations: 'disabled' }),
392
- ).toMatchSnapshot();
393
- });
394
- });
395
- });
396
- });
397
-
398
- test.describe('hide toggle button', () => {
399
- test('hide toggle button', async ({ page }) => {
400
- await page.goto(getStoryUrl(storyName, { 'hide-toggle-button': true }));
401
- const component = createComboBoxTestDriver(page.locator(componentName));
402
- expect(await component.screenshot()).toMatchSnapshot();
403
- await component.openDropdown();
404
- expect(await component.dropDown.screenshot()).toMatchSnapshot();
405
- await component.insertValue('itemname1');
406
- expect(await component.screenshot()).toMatchSnapshot();
407
- expect(await component.dropDown.screenshot()).toMatchSnapshot();
408
- });
409
- });
410
-
411
- test.describe('data attribute', () => {
412
- test('clear items', async ({ page }) => {
413
- await page.goto(getStoryUrl(storyName, { itemsSource: 'prop' }));
414
- const componentLocator = page.locator(componentName);
415
- const component = createComboBoxTestDriver(componentLocator);
416
- await component.openDropdown();
417
- let items = await component.getItems();
418
- expect(items).toHaveLength(4);
419
- // Reduce data items
420
- await componentLocator.evaluate((node: HTMLElement & { data: any[] }) => {
421
- node.data = [
422
- { displayName: 'Item1', value: '1', label: 'data item 1' },
423
- { displayName: 'Item2', value: '2', label: 'data item 2' },
424
- ];
425
- });
426
- items = await component.getItems();
427
- expect(items).toHaveLength(2);
428
- // Clear data items
429
- await componentLocator.evaluate((node: HTMLElement & { data: any[] }) => {
430
- node.data = [];
431
- });
432
- items = await component.getItems();
433
- expect(items).toHaveLength(0);
434
- });
435
-
436
- test('allow custom value with no items', async ({ page }) => {
437
- await page.goto(
438
- getStoryUrl(storyName, {
439
- itemsSource: 'prop',
440
- 'allow-custom-value': true,
441
- }),
442
- );
443
- const componentLocator = page.locator(componentName);
444
- const component = createComboBoxTestDriver(componentLocator);
445
- // Clear data items
446
- await componentLocator.evaluate((node: HTMLElement & { data: any[] }) => {
447
- node.data = [];
448
- });
449
- await component.setValue('new value');
450
- expect(await component.getValue()).toBe('new value');
451
- expect(await component.screenshot()).toMatchSnapshot();
452
- });
453
- });
454
-
455
- test.describe('override renderer', () => {
456
- test('custom background', async ({ page }) => {
457
- await page.goto(getStoryUrl(storyName, { overrideRenderer: true }));
458
- const component = createComboBoxTestDriver(page.locator(componentName));
459
- await component.openDropdown();
460
- expect(await component.dropDown.screenshot()).toMatchSnapshot();
461
- });
462
- });
@@ -1,34 +0,0 @@
1
- {
2
- "name": "descope-combo-box",
3
- "version": "0.0.1",
4
- "exports": {
5
- ".": {
6
- "import": "./src/component/index.js"
7
- },
8
- "./theme": {
9
- "import": "./src/theme.js"
10
- },
11
- "./class": {
12
- "import": "./src/component/ComboBoxClass.js"
13
- }
14
- },
15
- "scripts": {
16
- "test": "echo 'No tests defined' && exit 0",
17
- "test:e2e": "echo 'No e2e tests defined' && exit 0"
18
- },
19
- "devDependencies": {
20
- "e2e-utils": "workspace:*",
21
- "test-drivers": "workspace:*",
22
- "@playwright/test": "1.38.1"
23
- },
24
- "dependencies": {
25
- "@vaadin/combo-box": "24.3.4",
26
- "common": "0.0.1",
27
- "theme-globals": "0.0.1",
28
- "theme-input-wrapper": "0.0.1"
29
- },
30
- "private": true,
31
- "publishConfig": {
32
- "link-workspace-packages": false
33
- }
34
- }