@descope-ui/descope-combo-box 0.0.8 → 0.0.9
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.9](https://github.com/descope/web-components-ui/compare/@descope-ui/descope-combo-box-0.0.8...@descope-ui/descope-combo-box-0.0.9) (2025-03-06)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `test-drivers` updated to version `0.0.1`
|
|
10
|
+
* `@descope-ui/common` updated to version `0.0.9`
|
|
11
|
+
* `@descope-ui/theme-globals` updated to version `0.0.9`
|
|
12
|
+
* `@descope-ui/theme-input-wrapper` updated to version `0.0.9`
|
|
5
13
|
## [0.0.8](https://github.com/descope/web-components-ui/compare/@descope-ui/descope-combo-box-0.0.7...@descope-ui/descope-combo-box-0.0.8) (2025-03-05)
|
|
6
14
|
|
|
7
15
|
### Dependency Updates
|
|
@@ -355,13 +355,14 @@ test.describe('logic', () => {
|
|
|
355
355
|
|
|
356
356
|
await page.getByRole('button').getByText('Submit').click();
|
|
357
357
|
|
|
358
|
+
// we blur the input to remove the tooltip, so we can see the error message
|
|
358
359
|
await component.blur();
|
|
359
360
|
|
|
360
361
|
expect(
|
|
361
362
|
await component.screenshot({
|
|
362
363
|
animations: 'disabled',
|
|
363
364
|
caret: 'hide',
|
|
364
|
-
delay:
|
|
365
|
+
delay: 5000,
|
|
365
366
|
}),
|
|
366
367
|
).toMatchSnapshot();
|
|
367
368
|
});
|
|
@@ -457,6 +458,8 @@ test.describe('override renderer', () => {
|
|
|
457
458
|
await page.goto(getStoryUrl(storyName, { overrideRenderer: true }));
|
|
458
459
|
const component = createComboBoxTestDriver(page.locator(componentName));
|
|
459
460
|
await component.openDropdown();
|
|
460
|
-
expect(
|
|
461
|
+
expect(
|
|
462
|
+
await component.dropDown.screenshot({ delay: 1000 }),
|
|
463
|
+
).toMatchSnapshot();
|
|
461
464
|
});
|
|
462
465
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope-ui/descope-combo-box",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./src/component/index.js"
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@vaadin/combo-box": "24.3.4",
|
|
22
|
-
"@descope-ui/common": "0.0.
|
|
23
|
-
"@descope-ui/theme-globals": "0.0.
|
|
24
|
-
"@descope-ui/theme-input-wrapper": "0.0.
|
|
22
|
+
"@descope-ui/common": "0.0.9",
|
|
23
|
+
"@descope-ui/theme-globals": "0.0.9",
|
|
24
|
+
"@descope-ui/theme-input-wrapper": "0.0.9"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"link-workspace-packages": false
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
inputLabelTypeControl,
|
|
20
20
|
errorMessageIconControl,
|
|
21
21
|
errorMessageIconAttrs,
|
|
22
|
+
overrideRendererControl,
|
|
22
23
|
} from '@descope-ui/common/sb-controls';
|
|
23
24
|
|
|
24
25
|
const Template = ({
|
|
@@ -32,7 +33,6 @@ const Template = ({
|
|
|
32
33
|
direction,
|
|
33
34
|
disabled,
|
|
34
35
|
data,
|
|
35
|
-
overrideRenderItem,
|
|
36
36
|
itemsSource,
|
|
37
37
|
loading,
|
|
38
38
|
'default-value': defaultValue,
|
|
@@ -40,7 +40,6 @@ const Template = ({
|
|
|
40
40
|
'label-type': labelType,
|
|
41
41
|
'hide-toggle-button': hideToggleButton,
|
|
42
42
|
'allow-custom-value': allowCustomValue,
|
|
43
|
-
overrideRenderer,
|
|
44
43
|
errorMsgIcon,
|
|
45
44
|
}) => {
|
|
46
45
|
let serializedData;
|
|
@@ -51,42 +50,6 @@ const Template = ({
|
|
|
51
50
|
// do nothing
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
// this is another way to pass data to the component (prop instead of attr)
|
|
55
|
-
const dataFromPropScript = `
|
|
56
|
-
<script>
|
|
57
|
-
document.querySelector("descope-combo-box").data = ${serializedData.replace(
|
|
58
|
-
/\n/g,
|
|
59
|
-
'',
|
|
60
|
-
)}
|
|
61
|
-
</script>`;
|
|
62
|
-
|
|
63
|
-
// eslint-disable-next-line no-shadow
|
|
64
|
-
const altRenderItem = ({ displayName, label, value }) =>
|
|
65
|
-
`<span data-name="${displayName}" data-value="${value}">${label}</span>`;
|
|
66
|
-
|
|
67
|
-
// this allows us to update the render item function
|
|
68
|
-
const overrideRenderItemScript = `
|
|
69
|
-
<script>
|
|
70
|
-
document.querySelector("descope-combo-box").renderItem = ${altRenderItem
|
|
71
|
-
.toString()
|
|
72
|
-
.replace(/\n/g, '')}
|
|
73
|
-
</script>`;
|
|
74
|
-
|
|
75
|
-
const altRenderer = (root, combo, model) => {
|
|
76
|
-
if (model.index === 1) {
|
|
77
|
-
root.style.backgroundColor = '#008000';
|
|
78
|
-
root.style.color = '#ffffff';
|
|
79
|
-
}
|
|
80
|
-
root.innerHTML = model.item.outerHTML;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const overrideRendererScript = `
|
|
84
|
-
<script>
|
|
85
|
-
document.querySelector("descope-combo-box").renderer = ${altRenderer
|
|
86
|
-
.toString()
|
|
87
|
-
.replace(/\n/g, '')}
|
|
88
|
-
</script>`;
|
|
89
|
-
|
|
90
53
|
return `
|
|
91
54
|
<descope-combo-box
|
|
92
55
|
clear-button-visible
|
|
@@ -121,16 +84,46 @@ const Template = ({
|
|
|
121
84
|
<span data-name="ItemName9" data-id="itemId9">Achilles' Heel Weakness</span>
|
|
122
85
|
<span data-name="ItemName10" data-id="itemId10">Epic Poem of Ancient</span>
|
|
123
86
|
</descope-combo-box>
|
|
124
|
-
${itemsSource === 'prop' ? dataFromPropScript : ''}
|
|
125
|
-
${overrideRenderItem ? overrideRenderItemScript : ''}
|
|
126
|
-
${overrideRenderer ? overrideRendererScript : ''}
|
|
127
87
|
`;
|
|
128
88
|
};
|
|
129
89
|
|
|
130
90
|
export default {
|
|
131
91
|
component: componentName,
|
|
132
92
|
title: 'descope-combo-box',
|
|
133
|
-
decorators: [
|
|
93
|
+
decorators: [
|
|
94
|
+
(story, { args }) => {
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
const ele = document.querySelector('descope-combo-box');
|
|
97
|
+
if (!ele) return;
|
|
98
|
+
|
|
99
|
+
if (args.overrideRenderer) {
|
|
100
|
+
ele.renderer = (root, _combo, model) => {
|
|
101
|
+
if (model.index === 1) {
|
|
102
|
+
root.style.backgroundColor = '#008000';
|
|
103
|
+
root.style.color = '#ffffff';
|
|
104
|
+
}
|
|
105
|
+
root.innerHTML = model.item.outerHTML;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (args.overrideRenderItem) {
|
|
110
|
+
ele.renderItem = ({ displayName, label, value }) =>
|
|
111
|
+
`<span data-name="${displayName}" data-value="${value}">${label}</span>`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (args.itemsSource === 'prop') {
|
|
115
|
+
ele.data = args.data;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (args.itemsSource === 'attr') {
|
|
119
|
+
ele.setAttribute('data', JSON.stringify(args.data));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return story();
|
|
124
|
+
},
|
|
125
|
+
withForm,
|
|
126
|
+
],
|
|
134
127
|
argTypes: {
|
|
135
128
|
...labelControl,
|
|
136
129
|
...placeholderControl,
|
|
@@ -143,6 +136,7 @@ export default {
|
|
|
143
136
|
...borderedControl,
|
|
144
137
|
...errorMissingValueControl,
|
|
145
138
|
...overrideRenderItemControl,
|
|
139
|
+
...overrideRendererControl,
|
|
146
140
|
...itemsSourceControl,
|
|
147
141
|
...directionControl,
|
|
148
142
|
...loadingControl,
|
|
@@ -178,4 +172,5 @@ Default.args = {
|
|
|
178
172
|
{ displayName: 'Item3', value: '3', label: 'data item 3' },
|
|
179
173
|
{ displayName: 'Item4', value: '4', label: 'data item 4' },
|
|
180
174
|
],
|
|
175
|
+
itemsSource: 'children',
|
|
181
176
|
};
|