@smilodon/core 1.4.13 → 1.5.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 +108 -0
- package/dist/index.cjs +907 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +907 -52
- 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 +907 -52
- 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 +23 -0
- package/dist/types/src/components/select-option.d.ts +2 -0
- package/dist/types/src/config/global-config.d.ts +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -750,6 +750,85 @@ enhanced-select {
|
|
|
750
750
|
**Gradient Dropdown + Hover/Selected States**
|
|
751
751
|
If your dropdown uses a gradient background (for example via `--select-dropdown-bg`), option hover/selected colors still work as expected. The component intentionally uses the `background` shorthand for hover/selected option states so any inherited `background-image` layers are cleared correctly.
|
|
752
752
|
|
|
753
|
+
**Closed Input Value + Dropdown Option Alignment**
|
|
754
|
+
You can switch alignment and inspect both the selected value in the closed input and the dropdown options with matching tokens:
|
|
755
|
+
|
|
756
|
+
```css
|
|
757
|
+
enhanced-select.align-center {
|
|
758
|
+
--select-input-text-align: center;
|
|
759
|
+
--select-option-text-align: center;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
enhanced-select.align-right {
|
|
763
|
+
--select-input-text-align: right;
|
|
764
|
+
--select-option-text-align: right;
|
|
765
|
+
}
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
Useful related hooks:
|
|
769
|
+
|
|
770
|
+
- `--select-input-text-align`
|
|
771
|
+
- `--select-input-justify-content`
|
|
772
|
+
- `--select-option-text-align`
|
|
773
|
+
- `--select-group-header-text-align`
|
|
774
|
+
|
|
775
|
+
This is especially useful when testing centered or right-aligned UI layouts, because you can verify the closed state and open dropdown state together.
|
|
776
|
+
|
|
777
|
+
**Dropdown Placement: Bottom / Top / Automatic**
|
|
778
|
+
The dropdown can be opened in three modes:
|
|
779
|
+
|
|
780
|
+
- `bottom` — always below the select
|
|
781
|
+
- `top` — always above the select
|
|
782
|
+
- `auto` — below if there is enough room below, otherwise above
|
|
783
|
+
|
|
784
|
+
Per-instance:
|
|
785
|
+
|
|
786
|
+
```ts
|
|
787
|
+
select.updateConfig({
|
|
788
|
+
dropdownPlacement: {
|
|
789
|
+
mode: 'auto',
|
|
790
|
+
},
|
|
791
|
+
});
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
Global default:
|
|
795
|
+
|
|
796
|
+
```ts
|
|
797
|
+
configureSelect({
|
|
798
|
+
dropdownPlacement: {
|
|
799
|
+
mode: 'top',
|
|
800
|
+
},
|
|
801
|
+
});
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
Related styling hooks:
|
|
805
|
+
|
|
806
|
+
- `--select-dropdown-top`
|
|
807
|
+
- `--select-dropdown-bottom`
|
|
808
|
+
- `--select-dropdown-transform-origin`
|
|
809
|
+
- `--select-dropdown-top-transform-origin`
|
|
810
|
+
|
|
811
|
+
**Direction: LTR / RTL**
|
|
812
|
+
The select supports both `ltr` and `rtl` directions. The default is `ltr`.
|
|
813
|
+
|
|
814
|
+
Global default:
|
|
815
|
+
|
|
816
|
+
```ts
|
|
817
|
+
configureSelect({
|
|
818
|
+
direction: 'rtl',
|
|
819
|
+
});
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
Per-instance:
|
|
823
|
+
|
|
824
|
+
```ts
|
|
825
|
+
select.updateConfig({
|
|
826
|
+
direction: 'rtl',
|
|
827
|
+
});
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
RTL support mirrors the shell and dropdown layout, including arrow placement, clear control placement, separator side, selected indicator side, and chip remove spacing. The host `dir` attribute is kept in sync automatically.
|
|
831
|
+
|
|
753
832
|
**Badge Remove/Delete Button (Multi-Select)**
|
|
754
833
|
The × button that removes selected items in multi-select mode is fully customizable:
|
|
755
834
|
|
|
@@ -762,10 +841,15 @@ enhanced-select {
|
|
|
762
841
|
/* Customize badge appearance */
|
|
763
842
|
--select-badge-bg: #10b981; /* Badge background */
|
|
764
843
|
--select-badge-color: white; /* Badge text color */
|
|
844
|
+
--select-badge-width: auto; /* Explicit badge width */
|
|
845
|
+
--select-badge-height: 32px; /* Explicit badge height */
|
|
765
846
|
--select-badge-padding: 6px 10px; /* Badge spacing */
|
|
847
|
+
--select-badge-margin: 4px; /* Badge outer spacing */
|
|
848
|
+
--select-badge-border-radius: 10px; /* Badge radius */
|
|
766
849
|
|
|
767
850
|
/* Customize the × (remove/delete) button */
|
|
768
851
|
--select-badge-remove-size: 18px; /* Button size */
|
|
852
|
+
--select-badge-remove-icon-size: 12px; /* Icon glyph / SVG size */
|
|
769
853
|
--select-badge-remove-bg: rgba(255, 255, 255, 0.3); /* Button background */
|
|
770
854
|
--select-badge-remove-color: white; /* × symbol color */
|
|
771
855
|
--select-badge-remove-font-size: 18px; /* × symbol size */
|
|
@@ -773,6 +857,30 @@ enhanced-select {
|
|
|
773
857
|
}
|
|
774
858
|
```
|
|
775
859
|
|
|
860
|
+
You can also replace the default `×` with custom SVG or text:
|
|
861
|
+
|
|
862
|
+
```ts
|
|
863
|
+
select.updateConfig({
|
|
864
|
+
selection: {
|
|
865
|
+
removeButtonIcon: '<svg viewBox="0 0 16 16" fill="none"><path d="M4 4L12 12M12 4L4 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round"/></svg>'
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
Runtime style config now also supports higher-level sections for:
|
|
871
|
+
|
|
872
|
+
- `badge`
|
|
873
|
+
- `badgeHover`
|
|
874
|
+
- `badgeActive`
|
|
875
|
+
- `badgeLabel`
|
|
876
|
+
- `badgeRemove`
|
|
877
|
+
- `badgeRemoveHover`
|
|
878
|
+
- `badgeRemoveActive`
|
|
879
|
+
- `groupHeader`
|
|
880
|
+
- `activeOption`
|
|
881
|
+
|
|
882
|
+
This means badge size, badge radius, remove-button size, group-header layout, and active-option border/radius can be controlled either with CSS tokens or with `updateConfig({ styles: ... })`.
|
|
883
|
+
|
|
776
884
|
#### Real-World Customization Examples
|
|
777
885
|
|
|
778
886
|
**Example 1: Bootstrap-style Select**
|