@allxsmith/bestax-bulma 5.61.0 → 5.62.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.
Files changed (59) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/TreeView.js +14 -10
  4. package/dist/esm/components/TreeView.js.map +1 -1
  5. package/dist/esm/form/Combobox.js +8 -13
  6. package/dist/esm/form/Combobox.js.map +1 -1
  7. package/dist/esm/form/Field.js.map +1 -1
  8. package/dist/esm/form/TreeSelect.js +395 -0
  9. package/dist/esm/form/TreeSelect.js.map +1 -0
  10. package/dist/esm/form/_pickerInternals/PickerPopover.js +5 -1
  11. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  12. package/dist/esm/form/_selectInternals/DialogSelect.js +208 -0
  13. package/dist/esm/form/_selectInternals/DialogSelect.js.map +1 -0
  14. package/dist/esm/form/_selectInternals/ValueTags.js +28 -0
  15. package/dist/esm/form/_selectInternals/ValueTags.js.map +1 -0
  16. package/dist/esm/helpers/treeData.js +97 -0
  17. package/dist/esm/helpers/treeData.js.map +1 -0
  18. package/dist/esm/helpers/useComboboxEngine.js +2 -2
  19. package/dist/esm/helpers/useComboboxEngine.js.map +1 -1
  20. package/dist/esm/helpers/useControlled.js +30 -0
  21. package/dist/esm/helpers/useControlled.js.map +1 -0
  22. package/dist/esm/helpers/useTreeView.js +15 -13
  23. package/dist/esm/helpers/useTreeView.js.map +1 -1
  24. package/dist/extras.css +1 -1
  25. package/dist/extras.css.map +1 -1
  26. package/dist/index.cjs +1099 -392
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.esm.js +1 -0
  29. package/dist/index.esm.js.map +1 -1
  30. package/dist/types/form/Field.d.ts +1 -1
  31. package/dist/types/form/TreeSelect.d.ts +308 -0
  32. package/dist/types/form/_pickerInternals/PickerPopover.d.ts +8 -0
  33. package/dist/types/form/_selectInternals/DialogSelect.d.ts +86 -0
  34. package/dist/types/form/_selectInternals/ValueTags.d.ts +40 -0
  35. package/dist/types/helpers/treeData.d.ts +48 -0
  36. package/dist/types/helpers/useControlled.d.ts +14 -0
  37. package/dist/types/helpers/useTreeView.d.ts +30 -0
  38. package/dist/types/index.d.ts +1 -0
  39. package/dist/types-cjs/form/Field.d.ts +1 -1
  40. package/dist/types-cjs/form/TreeSelect.d.ts +308 -0
  41. package/dist/types-cjs/form/_pickerInternals/PickerPopover.d.ts +8 -0
  42. package/dist/types-cjs/form/_selectInternals/DialogSelect.d.ts +86 -0
  43. package/dist/types-cjs/form/_selectInternals/ValueTags.d.ts +40 -0
  44. package/dist/types-cjs/helpers/treeData.d.ts +48 -0
  45. package/dist/types-cjs/helpers/useControlled.d.ts +14 -0
  46. package/dist/types-cjs/helpers/useTreeView.d.ts +30 -0
  47. package/dist/types-cjs/index.d.ts +1 -0
  48. package/dist/versions/bestax-no-dark-mode.css +1 -1
  49. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  50. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  51. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  52. package/dist/versions/bestax-no-helpers.css +1 -1
  53. package/dist/versions/bestax-no-helpers.css.map +1 -1
  54. package/dist/versions/bestax-prefixed.css +1 -1
  55. package/dist/versions/bestax-prefixed.css.map +1 -1
  56. package/package.json +1 -1
  57. package/src/scss/form/_index.scss +1 -0
  58. package/src/scss/form/_picker-popover.scss +6 -0
  59. package/src/scss/form/_treeselect.scss +146 -0
@@ -62,6 +62,12 @@ $picker-trigger-hover-color: cv.getVar('text-strong') !default;
62
62
  right: 0;
63
63
  margin-bottom: cv.getVar('picker-popover-offset');
64
64
  }
65
+ // At least as wide as the anchor it's placed against, as a list under a
66
+ // field is. Portaled, the anchor's width comes inline instead, since 100%
67
+ // there would be the viewport's.
68
+ &.#{iv.$class-prefix}has-anchor-width:not(.#{iv.$class-prefix}is-portal) {
69
+ min-width: 100%;
70
+ }
65
71
  // Portaled: fixed to the viewport at the top and left the positioning hook
66
72
  // sets inline, so the corner's own right and bottom must not apply. Left
67
73
  // in, `right: 0` stretches the panel to the viewport's right edge and the
@@ -0,0 +1,146 @@
1
+ // Bestax Extras - TreeSelect Styles
2
+ // A form field whose options are a tree. The field is Bulma's input, the
3
+ // panel the pickers' popover (`--bulma-picker-popover-*`) and the tree
4
+ // TreeView's (`--bulma-tree-view-*`), so this draws what sits between them:
5
+ // the chevron and the clear button on the field, the panel's height, the
6
+ // search box over the tree and the message when a search finds nothing. The
7
+ // panel is at least as wide as the field through the picker popover's own
8
+ // `has-anchor-width` rule.
9
+
10
+ @use 'bulma/sass/utilities/initial-variables' as iv;
11
+ @use 'bulma/sass/utilities/css-variables' as cv;
12
+
13
+ // The tree scrolls past this, as Combobox's list does.
14
+ $tree-select-panel-max-height: 15rem !default;
15
+ $tree-select-search-gap: 0.5rem !default;
16
+ // The chevron's box at the field's inline end, drawn as a Control's icon is.
17
+ // Bulma registers its input variables on the field and its Control, which the
18
+ // root is outside, so these start from the tokens those start from.
19
+ $tree-select-chevron-width: cv.getVar('control-height') !default;
20
+ $tree-select-chevron-color: cv.getVar('text-light') !default;
21
+ $tree-select-chevron-hover-color: cv.getVar('text-weak') !default;
22
+ $tree-select-chevron-focus-color: cv.getVar('link') !default;
23
+ // Over the field, as Bulma stacks a Control's icon, and the clear button
24
+ // over the chevron.
25
+ $tree-select-chevron-z-index: 4 !default;
26
+ $tree-select-clear-z-index: 5 !default;
27
+ $tree-select-empty-color: cv.getVar('text-weak') !default;
28
+ $tree-select-empty-padding: 0.5em 0.75em !default;
29
+ // Room around the tree for the focus ring of a row at its edge, which the
30
+ // scrolling would cut off: the ring's width and its offset.
31
+ $tree-select-tree-inset: 4px !default;
32
+
33
+ // Registered on the root, which a panel in place sits inside and inherits
34
+ // from, so a value set on the root or through `className` reaches it, and on
35
+ // a portaled panel, which a portal puts outside the root, so it carries its
36
+ // own copy, as Combobox's menu does.
37
+ .#{iv.$class-prefix}tree-select,
38
+ .#{iv.$class-prefix}tree-select-panel.#{iv.$class-prefix}is-portal {
39
+ @include cv.register-vars(
40
+ (
41
+ 'tree-select-panel-max-height': #{$tree-select-panel-max-height},
42
+ 'tree-select-search-gap': #{$tree-select-search-gap},
43
+ 'tree-select-chevron-width': #{$tree-select-chevron-width},
44
+ 'tree-select-chevron-color': #{$tree-select-chevron-color},
45
+ 'tree-select-chevron-hover-color': #{$tree-select-chevron-hover-color},
46
+ 'tree-select-chevron-focus-color': #{$tree-select-chevron-focus-color},
47
+ 'tree-select-chevron-z-index': #{$tree-select-chevron-z-index},
48
+ 'tree-select-clear-z-index': #{$tree-select-clear-z-index},
49
+ 'tree-select-empty-color': #{$tree-select-empty-color},
50
+ 'tree-select-empty-padding': #{$tree-select-empty-padding},
51
+ 'tree-select-tree-inset': #{$tree-select-tree-inset},
52
+ )
53
+ );
54
+ }
55
+
56
+ // What the panel in place, the chevron and the clear button are placed
57
+ // against, when a Control around it holds no other field.
58
+ .#{iv.$class-prefix}tree-select {
59
+ position: relative;
60
+
61
+ .#{iv.$class-prefix}input {
62
+ cursor: pointer;
63
+ padding-inline-end: cv.getVar('tree-select-chevron-width');
64
+ }
65
+
66
+ &.#{iv.$class-prefix}has-clear .#{iv.$class-prefix}input {
67
+ padding-inline-end: calc(2 * #{cv.getVar('tree-select-chevron-width')});
68
+ }
69
+
70
+ .#{iv.$class-prefix}input[disabled] {
71
+ cursor: not-allowed;
72
+ }
73
+ }
74
+
75
+ // Bulma's Control icon, at the inline end, where a press goes to the field.
76
+ .#{iv.$class-prefix}tree-select-chevron {
77
+ align-items: center;
78
+ color: cv.getVar('tree-select-chevron-color');
79
+ display: flex;
80
+ height: 100%;
81
+ inset-block-start: 0;
82
+ inset-inline-end: 0;
83
+ justify-content: center;
84
+ pointer-events: none;
85
+ position: absolute;
86
+ width: cv.getVar('tree-select-chevron-width');
87
+ z-index: cv.getVar('tree-select-chevron-z-index');
88
+ }
89
+
90
+ .#{iv.$class-prefix}tree-select .#{iv.$class-prefix}input {
91
+ &:hover ~ .#{iv.$class-prefix}tree-select-chevron {
92
+ color: cv.getVar('tree-select-chevron-hover-color');
93
+ }
94
+
95
+ &:focus ~ .#{iv.$class-prefix}tree-select-chevron,
96
+ &.#{iv.$class-prefix}is-focused ~ .#{iv.$class-prefix}tree-select-chevron,
97
+ &[aria-expanded='true'] ~ .#{iv.$class-prefix}tree-select-chevron {
98
+ color: cv.getVar('tree-select-chevron-focus-color');
99
+ }
100
+
101
+ &[disabled] ~ .#{iv.$class-prefix}tree-select-chevron {
102
+ color: cv.getVar('input-disabled-color');
103
+ }
104
+
105
+ // The chevron's box is in em, so it follows the field's size.
106
+ &.#{iv.$class-prefix}is-small ~ * {
107
+ font-size: cv.getVar('size-small');
108
+ }
109
+
110
+ &.#{iv.$class-prefix}is-medium ~ * {
111
+ font-size: cv.getVar('size-medium');
112
+ }
113
+
114
+ &.#{iv.$class-prefix}is-large ~ * {
115
+ font-size: cv.getVar('size-large');
116
+ }
117
+ }
118
+
119
+ // Beside the chevron, centred on the field's height.
120
+ .#{iv.$class-prefix}tree-select-clear {
121
+ inset-block-start: 50%;
122
+ inset-inline-end: cv.getVar('tree-select-chevron-width');
123
+ position: absolute;
124
+ transform: translateY(-50%);
125
+ z-index: cv.getVar('tree-select-clear-z-index');
126
+ }
127
+
128
+ .#{iv.$class-prefix}tree-select-panel {
129
+ display: flex;
130
+ flex-direction: column;
131
+ gap: cv.getVar('tree-select-search-gap');
132
+
133
+ // The tree scrolls, with room for the focus ring of the row at its edge,
134
+ // and still lines up with the search box over it.
135
+ > .#{iv.$class-prefix}tree-view {
136
+ margin-inline: calc(-1 * #{cv.getVar('tree-select-tree-inset')});
137
+ max-height: cv.getVar('tree-select-panel-max-height');
138
+ overflow-y: auto;
139
+ padding: cv.getVar('tree-select-tree-inset');
140
+ }
141
+ }
142
+
143
+ .#{iv.$class-prefix}tree-select-empty {
144
+ color: cv.getVar('tree-select-empty-color');
145
+ padding: cv.getVar('tree-select-empty-padding');
146
+ }