@smilodon/core 1.5.4 → 1.6.0-debug.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/README.md +146 -8
- package/dist/index.cjs +532 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +532 -117
- 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 +532 -117
- 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/dist/types/src/components/enhanced-select.d.ts +16 -0
- package/dist/types/src/components/select-option.d.ts +5 -0
- package/dist/types/src/config/global-config.d.ts +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,6 +131,12 @@ See the [main documentation](https://github.com/navidrezadoost/smilodon#readme)
|
|
|
131
131
|
- **Full keyboard navigation**: Enter/Space, Arrows, Home/End, PageUp/Down, Escape
|
|
132
132
|
- **Multi-select modes**: wrap, horizontal, vertical, both (with drag-scroll)
|
|
133
133
|
|
|
134
|
+
### 🎨 CSS Framework Compatibility (`1.5.5`)
|
|
135
|
+
- **Scoped mirrored styles**: class-based framework styles used by custom renderers are mirrored only into the options subtree, not the whole shadow root.
|
|
136
|
+
- **Dark variant support**: `.dark`, `.dark-mode`, and theme-attribute variants propagate into custom-rendered option content.
|
|
137
|
+
- **Stable state hooks**: `classMap`, `data-sm-state`, and Smilodon state classes stay available on custom option roots for hover, active, selected, and disabled styling.
|
|
138
|
+
- **Accessible custom renderers**: nested interactive descendants are normalized by default so option renderers stay compatible with listbox semantics.
|
|
139
|
+
|
|
134
140
|
### 🔒 Enterprise Grade
|
|
135
141
|
- **SOC2 Compliant**: Audit-ready security controls
|
|
136
142
|
- **CSP Compatible**: No eval(), no inline scripts
|
|
@@ -747,20 +753,106 @@ Control badge scrolling behavior in multi-select mode with `multiSelectDisplay`
|
|
|
747
753
|
```javascript
|
|
748
754
|
{
|
|
749
755
|
multiSelectDisplay: {
|
|
750
|
-
mode: 'wrap', // 'wrap' | 'horizontal' | 'vertical'
|
|
751
|
-
maxHeight: '160px',
|
|
752
|
-
overflowX: '
|
|
753
|
-
overflowY: '
|
|
756
|
+
mode: 'wrap', // 'wrap' | 'horizontal' | 'vertical'
|
|
757
|
+
maxHeight: '160px', // used by vertical / horizontal modes
|
|
758
|
+
overflowX: 'hidden',
|
|
759
|
+
overflowY: 'hidden',
|
|
754
760
|
dragScroll: true // Enable drag-to-scroll (horizontal mode)
|
|
755
761
|
}
|
|
756
762
|
}
|
|
757
763
|
```
|
|
758
764
|
|
|
759
765
|
**Display Modes:**
|
|
760
|
-
- **`wrap`** (default) - Badges wrap
|
|
761
|
-
- **`horizontal`** - Single row, horizontal scroll, drag-to-scroll enabled
|
|
762
|
-
- **`vertical`** -
|
|
763
|
-
|
|
766
|
+
- **`wrap`** (default) - Badges wrap naturally and the input shell grows with them; no internal chip scrollbar by default
|
|
767
|
+
- **`horizontal`** - Single row, stable trigger height, horizontal scroll, drag-to-scroll enabled, and action-area spacing reserved automatically
|
|
768
|
+
- **`vertical`** - Wrapped badges inside a constrained chip area with vertical scrolling that stops before the arrow / clear-control region
|
|
769
|
+
|
|
770
|
+
> **Important:** setting only overflow CSS variables is not the full mode contract. Use `multiSelectDisplay.mode` so Smilodon can switch wrapping, scroll direction, input sizing, and reserved arrow/clear-control spacing correctly.
|
|
771
|
+
|
|
772
|
+
#### Disabled / dimmed option behavior
|
|
773
|
+
|
|
774
|
+
Items with `disabled: true` are dimmed and non-selectable by default.
|
|
775
|
+
|
|
776
|
+
- no click selection
|
|
777
|
+
- no keyboard selection
|
|
778
|
+
- no hover affordance by default
|
|
779
|
+
- skipped by default keyboard navigation and range-selection helpers
|
|
780
|
+
|
|
781
|
+
If you need a dimmed option to remain hoverable, focusable, or selectable, configure it explicitly:
|
|
782
|
+
|
|
783
|
+
```javascript
|
|
784
|
+
{
|
|
785
|
+
selection: {
|
|
786
|
+
disabledOptionBehavior: {
|
|
787
|
+
hoverable: true,
|
|
788
|
+
focusable: true,
|
|
789
|
+
selectable: false
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
Styling hooks:
|
|
796
|
+
|
|
797
|
+
- `styles.disabledOption`
|
|
798
|
+
- `classMap.disabled`
|
|
799
|
+
- `--select-option-disabled-bg`
|
|
800
|
+
- `--select-option-disabled-color`
|
|
801
|
+
- `--select-option-disabled-border`
|
|
802
|
+
- `--select-option-disabled-opacity`
|
|
803
|
+
- `--select-option-disabled-cursor`
|
|
804
|
+
|
|
805
|
+
### Selected + active state tokens
|
|
806
|
+
|
|
807
|
+
When keyboard focus lands on an already selected option, Smilodon now keeps the selected surface and layers the active affordance on top of it.
|
|
808
|
+
|
|
809
|
+
Use these tokens to customize that combined state:
|
|
810
|
+
|
|
811
|
+
- `--select-option-selected-active-bg`
|
|
812
|
+
- `--select-option-selected-active-color`
|
|
813
|
+
- `--select-option-selected-active-border`
|
|
814
|
+
- `--select-option-selected-active-shadow`
|
|
815
|
+
- `--select-option-selected-active-outline`
|
|
816
|
+
- `--select-option-selected-active-outline-offset`
|
|
817
|
+
|
|
818
|
+
### Selected indicator controls
|
|
819
|
+
|
|
820
|
+
Smilodon exposes the selected side indicator directly now, so you do not need to rely on custom `::before` overrides.
|
|
821
|
+
|
|
822
|
+
Runtime control:
|
|
823
|
+
|
|
824
|
+
- `selection.showSelectedIndicator` - quickly show / hide the indicator
|
|
825
|
+
- `styles.selectedIndicator` - configure width, height, placement, background, radius, transform, and animation
|
|
826
|
+
|
|
827
|
+
Related CSS variables:
|
|
828
|
+
|
|
829
|
+
- `--select-option-selected-indicator-display`
|
|
830
|
+
- `--select-option-selected-indicator-width`
|
|
831
|
+
- `--select-option-selected-indicator-height`
|
|
832
|
+
- `--select-option-selected-indicator-bg`
|
|
833
|
+
- `--select-option-selected-indicator-left`
|
|
834
|
+
- `--select-option-selected-indicator-right`
|
|
835
|
+
- `--select-option-selected-indicator-top`
|
|
836
|
+
- `--select-option-selected-indicator-transform`
|
|
837
|
+
- `--select-option-selected-indicator-animation`
|
|
838
|
+
|
|
839
|
+
Example:
|
|
840
|
+
|
|
841
|
+
```javascript
|
|
842
|
+
{
|
|
843
|
+
selection: {
|
|
844
|
+
showSelectedIndicator: false
|
|
845
|
+
},
|
|
846
|
+
styles: {
|
|
847
|
+
selectedIndicator: {
|
|
848
|
+
width: '4px',
|
|
849
|
+
background: '#2563eb',
|
|
850
|
+
right: '0',
|
|
851
|
+
left: 'auto'
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
```
|
|
764
856
|
|
|
765
857
|
---
|
|
766
858
|
|
|
@@ -778,6 +870,19 @@ enhanced-select {
|
|
|
778
870
|
}
|
|
779
871
|
```
|
|
780
872
|
|
|
873
|
+
#### Removing Option Press Animation / Active Border
|
|
874
|
+
|
|
875
|
+
Smilodon now ships without the old pressed transform and active outline by default. If you want to enforce a flat option surface explicitly:
|
|
876
|
+
|
|
877
|
+
```css
|
|
878
|
+
enhanced-select {
|
|
879
|
+
--select-option-pressed-transform: none;
|
|
880
|
+
--select-option-selected-pressed-transform: none;
|
|
881
|
+
--select-option-active-outline: none;
|
|
882
|
+
--select-option-selected-active-outline: none;
|
|
883
|
+
}
|
|
884
|
+
```
|
|
885
|
+
|
|
781
886
|
#### Multi-Select Container & Badge Padding
|
|
782
887
|
|
|
783
888
|
Control container padding separately from badge padding:
|
|
@@ -986,6 +1091,36 @@ select.updateConfig({
|
|
|
986
1091
|
});
|
|
987
1092
|
```
|
|
988
1093
|
|
|
1094
|
+
If you want to style the icon itself separately from the circular button shell, use the dedicated icon hooks:
|
|
1095
|
+
|
|
1096
|
+
- `styles.badgeRemoveIcon`
|
|
1097
|
+
- `classNames.badgeRemoveIcon`
|
|
1098
|
+
- `::part(chip-remove-icon)`
|
|
1099
|
+
- `--select-badge-remove-icon-size`
|
|
1100
|
+
- `--select-badge-remove-icon-color`
|
|
1101
|
+
- `--select-badge-remove-icon-font-size`
|
|
1102
|
+
- `--select-badge-remove-icon-line-height`
|
|
1103
|
+
- `--select-badge-remove-icon-transform`
|
|
1104
|
+
- `--select-badge-remove-icon-opacity`
|
|
1105
|
+
|
|
1106
|
+
Example:
|
|
1107
|
+
|
|
1108
|
+
```ts
|
|
1109
|
+
select.updateConfig({
|
|
1110
|
+
selection: {
|
|
1111
|
+
removeButtonIcon: '<svg viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>'
|
|
1112
|
+
},
|
|
1113
|
+
styles: {
|
|
1114
|
+
badgeRemoveIcon: {
|
|
1115
|
+
width: '12px',
|
|
1116
|
+
height: '12px',
|
|
1117
|
+
color: '#ffffff',
|
|
1118
|
+
transform: 'scale(0.95)'
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
```
|
|
1123
|
+
|
|
989
1124
|
Runtime style config now also supports higher-level sections for:
|
|
990
1125
|
|
|
991
1126
|
- `badge`
|
|
@@ -993,6 +1128,7 @@ Runtime style config now also supports higher-level sections for:
|
|
|
993
1128
|
- `badgeActive`
|
|
994
1129
|
- `badgeLabel`
|
|
995
1130
|
- `badgeRemove`
|
|
1131
|
+
- `badgeRemoveIcon`
|
|
996
1132
|
- `badgeRemoveHover`
|
|
997
1133
|
- `badgeRemoveActive`
|
|
998
1134
|
- `groupHeader`
|
|
@@ -1047,6 +1183,8 @@ enhanced-select {
|
|
|
1047
1183
|
|
|
1048
1184
|
Framework compatibility guidance also lives in [../../docs/CSS-FRAMEWORK-COMPATIBILITY.md](../../docs/CSS-FRAMEWORK-COMPATIBILITY.md).
|
|
1049
1185
|
|
|
1186
|
+
When using Tailwind-style custom renderers, remember that `optionRenderer` may return the option root itself. In that case, put the utility classes and hover/active/selected styling on the returned root element instead of assuming there is a nested wrapper.
|
|
1187
|
+
|
|
1050
1188
|
**Example 4: Custom Brand Colors**
|
|
1051
1189
|
```css
|
|
1052
1190
|
enhanced-select {
|