@smilodon/core 1.9.1 → 1.9.2
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/README.md +14 -0
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +7 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -170,10 +170,24 @@ select.addEventListener('clear', (e) => {
|
|
|
170
170
|
});
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
+
`hideWhenEmpty` defaults to `true`. In that mode, the button and the action-area layout are hidden when neither an enabled selection nor an enabled search action has content to clear. Selecting a value or typing a searchable query reveals the control; clearing both restores the normal input padding and arrow/separator position. This behavior is the same for single select, multi-select, LTR, and RTL.
|
|
174
|
+
|
|
175
|
+
Set `hideWhenEmpty: false` when the control must remain visible while empty. It will be disabled until an enabled clear target exists. The target flags are independent:
|
|
176
|
+
|
|
177
|
+
| Configuration | Button becomes actionable when |
|
|
178
|
+
|---|---|
|
|
179
|
+
| `clearSelection: true`, `clearSearch: false` | At least one value is selected |
|
|
180
|
+
| `clearSelection: false`, `clearSearch: true` | Search text is present |
|
|
181
|
+
| Both `true` | Either selection or search text is present |
|
|
182
|
+
|
|
183
|
+
The `clear` event reports what actually changed. Programmatic `clear()` and `clearSearch()` remain available when no visible control is desired.
|
|
184
|
+
|
|
173
185
|
Style hooks:
|
|
174
186
|
- Parts: `::part(clear-button)`, `::part(clear-icon)`
|
|
175
187
|
- Tokens: `--select-clear-button-*`, `--select-clear-icon-*`, `--select-input-padding-with-clear`
|
|
176
188
|
|
|
189
|
+
The `--select-input-padding-with-clear` token applies only while the clear control is visible; keep ordinary empty-state spacing in the normal input padding tokens.
|
|
190
|
+
|
|
177
191
|
### Properties
|
|
178
192
|
|
|
179
193
|
```typescript
|
package/dist/index.cjs
CHANGED
|
@@ -6073,6 +6073,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6073
6073
|
continue;
|
|
6074
6074
|
const sourceValue = source[key];
|
|
6075
6075
|
const targetValue = result[key];
|
|
6076
|
+
// Optional adapter props are commonly forwarded as undefined. Preserve
|
|
6077
|
+
// the existing/default config in that case instead of erasing a section.
|
|
6078
|
+
if (sourceValue === undefined)
|
|
6079
|
+
continue;
|
|
6076
6080
|
if (sourceValue && typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {
|
|
6077
6081
|
result[key] = this._mergeConfig(targetValue && typeof targetValue === 'object' ? targetValue : {}, sourceValue);
|
|
6078
6082
|
}
|
|
@@ -6114,8 +6118,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6114
6118
|
const hasSomethingToClear = (clearSelection && hasSelection) || (clearSearch && hasSearch);
|
|
6115
6119
|
const hideWhenEmpty = this._config.clearControl.hideWhenEmpty !== false;
|
|
6116
6120
|
const visible = enabled && (!hideWhenEmpty || hasSomethingToClear);
|
|
6117
|
-
|
|
6118
|
-
this.
|
|
6121
|
+
// Reserve the action area only while the clear control is actually visible.
|
|
6122
|
+
this._inputContainer.classList.toggle('has-clear-control', visible);
|
|
6123
|
+
this._arrowContainer.classList.toggle('with-clear-control', visible);
|
|
6119
6124
|
this._clearControl.hidden = !visible;
|
|
6120
6125
|
this._clearControl.disabled = !hasSomethingToClear;
|
|
6121
6126
|
this._clearControl.setAttribute('aria-hidden', String(!visible));
|