@smilodon/core 1.4.13 → 1.5.1

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 CHANGED
@@ -128,6 +128,8 @@ See the [main documentation](https://github.com/navidrezadoost/smilodon#readme)
128
128
  - **Zero Dependencies**: 6.6 KB gzipped runtime
129
129
  - **Framework Agnostic**: Works with React, Vue, Svelte, or vanilla JS
130
130
  - **Accessibility**: WCAG 2.2 AA compliant with ARIA 1.2
131
+ - **Full keyboard navigation**: Enter/Space, Arrows, Home/End, PageUp/Down, Escape
132
+ - **Multi-select modes**: wrap, horizontal, vertical, both (with drag-scroll)
131
133
 
132
134
  ### 🔒 Enterprise Grade
133
135
  - **SOC2 Compliant**: Audit-ready security controls
@@ -701,6 +703,117 @@ enhanced-select.dark-mode {
701
703
  --select-dark-option-selected-bg /* Dark selected bg (#3730a3) */
702
704
  --select-dark-group-header-color /* Dark header text */
703
705
  --select-dark-group-header-bg /* Dark header background */
706
+ --select-dark-badge-bg /* Dark badge background */
707
+ --select-dark-badge-color /* Dark badge text */
708
+ --select-dark-arrow-color /* Dark arrow icon color */
709
+ --select-dark-arrow-bg /* Dark arrow background */
710
+ --select-dark-arrow-hover-bg /* Dark arrow hover background */
711
+ --select-dark-separator-bg /* Dark separator color */
712
+ --select-dark-separator-width /* Dark separator width */
713
+ --select-dark-empty-color /* Dark empty state text */
714
+ ```
715
+
716
+ ---
717
+
718
+ ### Keyboard Navigation & Accessibility
719
+
720
+ Smilodon provides full keyboard accessibility (WCAG 2.2 AA compliant):
721
+
722
+ | Key | Action |
723
+ |-----|--------|
724
+ | `Enter` / `Space` | Open dropdown or select focused option |
725
+ | `↑` / `↓` | Navigate through options |
726
+ | `Home` / `End` | Jump to first/last option |
727
+ | `PageUp` / `PageDown` | Jump 10 options up/down |
728
+ | `Escape` | Close dropdown |
729
+ | `Tab` | Close dropdown and move focus |
730
+ | `Ctrl+A` (multi-select) | Select all options |
731
+ | Type characters | Type-ahead search |
732
+
733
+ **Multi-Select Range Selection:**
734
+ - `Shift + ↑/↓` - Range selection
735
+ - `Ctrl/Cmd + Click` - Toggle individual items
736
+ - `Shift + Home/End` - Select from current to first/last
737
+
738
+ ---
739
+
740
+ ### Multi-Select Display Modes
741
+
742
+ Control badge scrolling behavior in multi-select mode with `multiSelectDisplay` config:
743
+
744
+ ```javascript
745
+ {
746
+ multiSelectDisplay: {
747
+ mode: 'wrap', // 'wrap' | 'horizontal' | 'vertical' | 'both'
748
+ maxHeight: '160px',
749
+ overflowX: 'auto',
750
+ overflowY: 'auto',
751
+ dragScroll: true // Enable drag-to-scroll (horizontal mode)
752
+ }
753
+ }
754
+ ```
755
+
756
+ **Display Modes:**
757
+ - **`wrap`** (default) - Badges wrap to new lines, vertical scroll when needed
758
+ - **`horizontal`** - Single row, horizontal scroll, drag-to-scroll enabled
759
+ - **`vertical`** - Single column, vertical scroll only
760
+ - **`both`** - Both horizontal and vertical scroll, dense packing
761
+
762
+ ---
763
+
764
+ ### Advanced Styling Controls
765
+
766
+ #### Disabling Hover Animation
767
+
768
+ To remove hover effects on options:
769
+
770
+ ```css
771
+ enhanced-select {
772
+ --select-option-hover-bg: transparent;
773
+ --select-option-hover-color: inherit;
774
+ --select-option-hover-transform: none;
775
+ }
776
+ ```
777
+
778
+ #### Multi-Select Container & Badge Padding
779
+
780
+ Control container padding separately from badge padding:
781
+
782
+ ```css
783
+ enhanced-select {
784
+ --select-multi-container-padding: 8px; /* Container internal padding */
785
+ --select-badge-padding: 4px 8px; /* Individual badge padding */
786
+ --select-input-gap: 6px; /* Gap between badges */
787
+ }
788
+ ```
789
+
790
+ #### Separator Dimension Controls
791
+
792
+ Full control over the vertical separator line (works in all modes):
793
+
794
+ ```css
795
+ enhanced-select {
796
+ --select-separator-width: 2px; /* Line thickness */
797
+ --select-separator-height: 60%; /* Line height (% of container) */
798
+ --select-separator-display: none; /* Hide separator completely */
799
+ --select-separator-bg: #e5e7eb; /* Custom color/gradient */
800
+ --select-separator-opacity: 0.8; /* Line opacity */
801
+ }
802
+ ```
803
+
804
+ #### Input & Badge Typography
805
+
806
+ ```css
807
+ enhanced-select {
808
+ /* Input field text */
809
+ --select-input-font-size: 14px;
810
+ --select-input-font-weight: 400;
811
+
812
+ /* Badge text */
813
+ --select-badge-font-size: 13px;
814
+ --select-badge-font-weight: 500;
815
+ --select-badge-line-height: 1.2;
816
+ }
704
817
  ```
705
818
 
706
819
  **Complete CSS Variables Reference**
@@ -750,6 +863,85 @@ enhanced-select {
750
863
  **Gradient Dropdown + Hover/Selected States**
751
864
  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
865
 
866
+ **Closed Input Value + Dropdown Option Alignment**
867
+ You can switch alignment and inspect both the selected value in the closed input and the dropdown options with matching tokens:
868
+
869
+ ```css
870
+ enhanced-select.align-center {
871
+ --select-input-text-align: center;
872
+ --select-option-text-align: center;
873
+ }
874
+
875
+ enhanced-select.align-right {
876
+ --select-input-text-align: right;
877
+ --select-option-text-align: right;
878
+ }
879
+ ```
880
+
881
+ Useful related hooks:
882
+
883
+ - `--select-input-text-align`
884
+ - `--select-input-justify-content`
885
+ - `--select-option-text-align`
886
+ - `--select-group-header-text-align`
887
+
888
+ This is especially useful when testing centered or right-aligned UI layouts, because you can verify the closed state and open dropdown state together.
889
+
890
+ **Dropdown Placement: Bottom / Top / Automatic**
891
+ The dropdown can be opened in three modes:
892
+
893
+ - `bottom` — always below the select
894
+ - `top` — always above the select
895
+ - `auto` — below if there is enough room below, otherwise above
896
+
897
+ Per-instance:
898
+
899
+ ```ts
900
+ select.updateConfig({
901
+ dropdownPlacement: {
902
+ mode: 'auto',
903
+ },
904
+ });
905
+ ```
906
+
907
+ Global default:
908
+
909
+ ```ts
910
+ configureSelect({
911
+ dropdownPlacement: {
912
+ mode: 'top',
913
+ },
914
+ });
915
+ ```
916
+
917
+ Related styling hooks:
918
+
919
+ - `--select-dropdown-top`
920
+ - `--select-dropdown-bottom`
921
+ - `--select-dropdown-transform-origin`
922
+ - `--select-dropdown-top-transform-origin`
923
+
924
+ **Direction: LTR / RTL**
925
+ The select supports both `ltr` and `rtl` directions. The default is `ltr`.
926
+
927
+ Global default:
928
+
929
+ ```ts
930
+ configureSelect({
931
+ direction: 'rtl',
932
+ });
933
+ ```
934
+
935
+ Per-instance:
936
+
937
+ ```ts
938
+ select.updateConfig({
939
+ direction: 'rtl',
940
+ });
941
+ ```
942
+
943
+ 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.
944
+
753
945
  **Badge Remove/Delete Button (Multi-Select)**
754
946
  The × button that removes selected items in multi-select mode is fully customizable:
755
947
 
@@ -762,10 +954,15 @@ enhanced-select {
762
954
  /* Customize badge appearance */
763
955
  --select-badge-bg: #10b981; /* Badge background */
764
956
  --select-badge-color: white; /* Badge text color */
957
+ --select-badge-width: auto; /* Explicit badge width */
958
+ --select-badge-height: 32px; /* Explicit badge height */
765
959
  --select-badge-padding: 6px 10px; /* Badge spacing */
960
+ --select-badge-margin: 4px; /* Badge outer spacing */
961
+ --select-badge-border-radius: 10px; /* Badge radius */
766
962
 
767
963
  /* Customize the × (remove/delete) button */
768
964
  --select-badge-remove-size: 18px; /* Button size */
965
+ --select-badge-remove-icon-size: 12px; /* Icon glyph / SVG size */
769
966
  --select-badge-remove-bg: rgba(255, 255, 255, 0.3); /* Button background */
770
967
  --select-badge-remove-color: white; /* × symbol color */
771
968
  --select-badge-remove-font-size: 18px; /* × symbol size */
@@ -773,6 +970,30 @@ enhanced-select {
773
970
  }
774
971
  ```
775
972
 
973
+ You can also replace the default `×` with custom SVG or text:
974
+
975
+ ```ts
976
+ select.updateConfig({
977
+ selection: {
978
+ 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>'
979
+ }
980
+ });
981
+ ```
982
+
983
+ Runtime style config now also supports higher-level sections for:
984
+
985
+ - `badge`
986
+ - `badgeHover`
987
+ - `badgeActive`
988
+ - `badgeLabel`
989
+ - `badgeRemove`
990
+ - `badgeRemoveHover`
991
+ - `badgeRemoveActive`
992
+ - `groupHeader`
993
+ - `activeOption`
994
+
995
+ 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: ... })`.
996
+
776
997
  #### Real-World Customization Examples
777
998
 
778
999
  **Example 1: Bootstrap-style Select**