@allxsmith/bestax-bulma 5.61.0 → 5.63.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 (100) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/EmptyState.js +2 -6
  4. package/dist/esm/components/EmptyState.js.map +1 -1
  5. package/dist/esm/components/Timeline.js +5 -9
  6. package/dist/esm/components/Timeline.js.map +1 -1
  7. package/dist/esm/components/TreeView.js +16 -16
  8. package/dist/esm/components/TreeView.js.map +1 -1
  9. package/dist/esm/elements/Buttons.js +2 -0
  10. package/dist/esm/elements/Buttons.js.map +1 -1
  11. package/dist/esm/elements/CopyButton.js +132 -0
  12. package/dist/esm/elements/CopyButton.js.map +1 -0
  13. package/dist/esm/elements/DescriptionList.js +1 -5
  14. package/dist/esm/elements/DescriptionList.js.map +1 -1
  15. package/dist/esm/elements/Stat.js +196 -0
  16. package/dist/esm/elements/Stat.js.map +1 -0
  17. package/dist/esm/elements/Stats.js +48 -0
  18. package/dist/esm/elements/Stats.js.map +1 -0
  19. package/dist/esm/elements/statContext.js +10 -0
  20. package/dist/esm/elements/statContext.js.map +1 -0
  21. package/dist/esm/form/Combobox.js +10 -14
  22. package/dist/esm/form/Combobox.js.map +1 -1
  23. package/dist/esm/form/Field.js.map +1 -1
  24. package/dist/esm/form/TreeSelect.js +395 -0
  25. package/dist/esm/form/TreeSelect.js.map +1 -0
  26. package/dist/esm/form/_pickerInternals/PickerPopover.js +5 -1
  27. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  28. package/dist/esm/form/_selectInternals/DialogSelect.js +208 -0
  29. package/dist/esm/form/_selectInternals/DialogSelect.js.map +1 -0
  30. package/dist/esm/form/_selectInternals/ValueTags.js +28 -0
  31. package/dist/esm/form/_selectInternals/ValueTags.js.map +1 -0
  32. package/dist/esm/helpers/checkIcon.js +20 -0
  33. package/dist/esm/helpers/checkIcon.js.map +1 -0
  34. package/dist/esm/helpers/isGiven.js +13 -0
  35. package/dist/esm/helpers/isGiven.js.map +1 -0
  36. package/dist/esm/helpers/statusRegion.js +3 -3
  37. package/dist/esm/helpers/treeData.js +97 -0
  38. package/dist/esm/helpers/treeData.js.map +1 -0
  39. package/dist/esm/helpers/useClipboard.js +176 -0
  40. package/dist/esm/helpers/useClipboard.js.map +1 -0
  41. package/dist/esm/helpers/useComboboxEngine.js +2 -2
  42. package/dist/esm/helpers/useComboboxEngine.js.map +1 -1
  43. package/dist/esm/helpers/useControlled.js +30 -0
  44. package/dist/esm/helpers/useControlled.js.map +1 -0
  45. package/dist/esm/helpers/useTreeView.js +15 -13
  46. package/dist/esm/helpers/useTreeView.js.map +1 -1
  47. package/dist/extras.css +1 -1
  48. package/dist/extras.css.map +1 -1
  49. package/dist/index.cjs +10605 -9380
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.esm.js +5 -0
  52. package/dist/index.esm.js.map +1 -1
  53. package/dist/types/elements/Buttons.d.ts +1 -0
  54. package/dist/types/elements/CopyButton.d.ts +105 -0
  55. package/dist/types/elements/Stat.d.ts +242 -0
  56. package/dist/types/elements/Stats.d.ts +40 -0
  57. package/dist/types/elements/statContext.d.ts +18 -0
  58. package/dist/types/form/Field.d.ts +1 -1
  59. package/dist/types/form/TreeSelect.d.ts +308 -0
  60. package/dist/types/form/_pickerInternals/PickerPopover.d.ts +8 -0
  61. package/dist/types/form/_selectInternals/DialogSelect.d.ts +86 -0
  62. package/dist/types/form/_selectInternals/ValueTags.d.ts +40 -0
  63. package/dist/types/helpers/checkIcon.d.ts +10 -0
  64. package/dist/types/helpers/isGiven.d.ts +7 -0
  65. package/dist/types/helpers/treeData.d.ts +48 -0
  66. package/dist/types/helpers/useClipboard.d.ts +65 -0
  67. package/dist/types/helpers/useControlled.d.ts +14 -0
  68. package/dist/types/helpers/useTreeView.d.ts +30 -0
  69. package/dist/types/index.d.ts +6 -0
  70. package/dist/types-cjs/elements/Buttons.d.ts +1 -0
  71. package/dist/types-cjs/elements/CopyButton.d.ts +105 -0
  72. package/dist/types-cjs/elements/Stat.d.ts +242 -0
  73. package/dist/types-cjs/elements/Stats.d.ts +40 -0
  74. package/dist/types-cjs/elements/statContext.d.ts +18 -0
  75. package/dist/types-cjs/form/Field.d.ts +1 -1
  76. package/dist/types-cjs/form/TreeSelect.d.ts +308 -0
  77. package/dist/types-cjs/form/_pickerInternals/PickerPopover.d.ts +8 -0
  78. package/dist/types-cjs/form/_selectInternals/DialogSelect.d.ts +86 -0
  79. package/dist/types-cjs/form/_selectInternals/ValueTags.d.ts +40 -0
  80. package/dist/types-cjs/helpers/checkIcon.d.ts +10 -0
  81. package/dist/types-cjs/helpers/isGiven.d.ts +7 -0
  82. package/dist/types-cjs/helpers/treeData.d.ts +48 -0
  83. package/dist/types-cjs/helpers/useClipboard.d.ts +65 -0
  84. package/dist/types-cjs/helpers/useControlled.d.ts +14 -0
  85. package/dist/types-cjs/helpers/useTreeView.d.ts +30 -0
  86. package/dist/types-cjs/index.d.ts +6 -0
  87. package/dist/versions/bestax-no-dark-mode.css +1 -1
  88. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  89. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  90. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  91. package/dist/versions/bestax-no-helpers.css +1 -1
  92. package/dist/versions/bestax-no-helpers.css.map +1 -1
  93. package/dist/versions/bestax-prefixed.css +1 -1
  94. package/dist/versions/bestax-prefixed.css.map +1 -1
  95. package/package.json +1 -1
  96. package/src/scss/elements/_index.scss +1 -0
  97. package/src/scss/elements/_stat.scss +153 -0
  98. package/src/scss/form/_index.scss +1 -0
  99. package/src/scss/form/_picker-popover.scss +6 -0
  100. package/src/scss/form/_treeselect.scss +146 -0
@@ -0,0 +1,153 @@
1
+ // Bestax Extras - Stat Styles
2
+ // A figure with its name, and often a change and a note, as a description
3
+ // list: a `<dt>` for the label and a `<dd>` each for the figure, the change
4
+ // and the note. A Stat is a `<div>` in a `Stats` row's `<dl>`, or a `<dl>` of
5
+ // its own. `Stats` is Bulma's `.grid`, which lays the row out, so all it
6
+ // needs here is the list's margins reset; this sets the type.
7
+ //
8
+ // Each part stacks under the one before, in the order it's written. The
9
+ // figure takes the Stat's color, so a `textColor` on the Stat colors it,
10
+ // while the label, the change and the note set their own. A `color` on the
11
+ // change sets its color to that color's `-on-scheme` variant, which Bulma
12
+ // darkens or lightens until it reads as text on the scheme's background. Forced colors replaces every color with the system's, which
13
+ // drops the tone, and the sign in the text and the arrow, drawn in
14
+ // `currentColor`, remain.
15
+
16
+ @use 'bulma/sass/utilities/initial-variables' as iv;
17
+ @use 'bulma/sass/utilities/css-variables' as cv;
18
+
19
+ $stat-label-color: cv.getVar('text-weak') !default;
20
+ $stat-label-size: cv.getVar('size-7') !default;
21
+ $stat-value-color: cv.getVar('text-strong') !default;
22
+ $stat-value-size: cv.getVar('size-3') !default;
23
+ $stat-value-size-small: cv.getVar('size-4') !default;
24
+ $stat-value-size-medium: cv.getVar('size-2') !default;
25
+ $stat-value-size-large: cv.getVar('size-1') !default;
26
+ $stat-value-weight: cv.getVar('weight-semibold') !default;
27
+ // Bulma's title line height, tight for large figures.
28
+ $stat-value-line-height: 1.125 !default;
29
+ $stat-change-color: cv.getVar('text') !default;
30
+ $stat-change-size: cv.getVar('size-7') !default;
31
+ // Between the arrow and the number.
32
+ $stat-change-gap: 0.25em !default;
33
+ $stat-description-color: cv.getVar('text-weak') !default;
34
+ $stat-description-size: cv.getVar('size-7') !default;
35
+
36
+ .#{iv.$class-prefix}stat {
37
+ @include cv.register-vars(
38
+ (
39
+ 'stat-label-color': #{$stat-label-color},
40
+ 'stat-label-size': #{$stat-label-size},
41
+ 'stat-value-color': #{$stat-value-color},
42
+ 'stat-value-size': #{$stat-value-size},
43
+ 'stat-value-weight': #{$stat-value-weight},
44
+ 'stat-value-line-height': #{$stat-value-line-height},
45
+ 'stat-change-color': #{$stat-change-color},
46
+ 'stat-change-size': #{$stat-change-size},
47
+ 'stat-change-gap': #{$stat-change-gap},
48
+ 'stat-description-color': #{$stat-description-color},
49
+ 'stat-description-size': #{$stat-description-size},
50
+ )
51
+ );
52
+ }
53
+
54
+ @each $size,
55
+ $value
56
+ in (
57
+ 'small': $stat-value-size-small,
58
+ 'medium': $stat-value-size-medium,
59
+ 'large': $stat-value-size-large
60
+ )
61
+ {
62
+ .#{iv.$class-prefix}stat.#{iv.$class-prefix}is-#{$size} {
63
+ @include cv.register-vars(
64
+ (
65
+ 'stat-value-size': #{$value},
66
+ )
67
+ );
68
+ }
69
+ }
70
+
71
+ // ---- The row and the Stat ----------------------------------------------------
72
+
73
+ .#{iv.$class-prefix}stats {
74
+ margin-inline: 0;
75
+ margin-block-start: 0;
76
+ }
77
+
78
+ .#{iv.$class-prefix}stat {
79
+ margin: 0;
80
+ // On the root, so a `textColor` helper's class outranks it and the figure
81
+ // inherits either.
82
+ color: cv.getVar('stat-value-color');
83
+
84
+ // A Stat on its own is a block, as Bulma spaces its blocks.
85
+ &:not(:last-child) {
86
+ margin-bottom: cv.getVar('block-spacing');
87
+ }
88
+ }
89
+
90
+ // In a row the grid's gap spaces the tiles.
91
+ .#{iv.$class-prefix}stats > .#{iv.$class-prefix}stat {
92
+ margin-bottom: 0;
93
+ }
94
+
95
+ // ---- The parts -------------------------------------------------------------------
96
+
97
+ // Each through the root, so it outranks Bulma's `.content dd` indent.
98
+ .#{iv.$class-prefix}stat .#{iv.$class-prefix}stat-label {
99
+ margin: 0;
100
+ color: cv.getVar('stat-label-color');
101
+ font-size: cv.getVar('stat-label-size');
102
+ }
103
+
104
+ .#{iv.$class-prefix}stat .#{iv.$class-prefix}stat-value {
105
+ margin: 0;
106
+ font-size: cv.getVar('stat-value-size');
107
+ font-weight: cv.getVar('stat-value-weight');
108
+ line-height: cv.getVar('stat-value-line-height');
109
+ // Digits of one width, so a figure that updates doesn't shift.
110
+ font-variant-numeric: tabular-nums;
111
+ // A long figure wraps rather than widen its tile.
112
+ overflow-wrap: anywhere;
113
+ }
114
+
115
+ // `loading`'s Skeleton, and a figure's `<dd>` still waiting for its value,
116
+ // are one line of the figure tall, so the tile is as tall as its neighbours
117
+ // and keeps its height when the figure arrives.
118
+ .#{iv.$class-prefix}stat .#{iv.$class-prefix}stat-value:empty,
119
+ .#{iv.$class-prefix}stat
120
+ .#{iv.$class-prefix}stat-value
121
+ > .#{iv.$class-prefix}skeleton-block {
122
+ min-height: 1lh;
123
+ }
124
+
125
+ .#{iv.$class-prefix}stat .#{iv.$class-prefix}stat-change {
126
+ display: flex;
127
+ align-items: center;
128
+ gap: cv.getVar('stat-change-gap');
129
+ margin: 0;
130
+ color: cv.getVar('stat-change-color');
131
+ font-size: cv.getVar('stat-change-size');
132
+ font-variant-numeric: tabular-nums;
133
+
134
+ > svg {
135
+ flex: none;
136
+ }
137
+ }
138
+
139
+ // The change's colors, set on the change itself, so `--bulma-stat-change-color`
140
+ // stays the uncolored change's. A theme moves these tones through Bulma's own
141
+ // `-on-scheme` colors.
142
+ @each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' {
143
+ .#{iv.$class-prefix}stat
144
+ .#{iv.$class-prefix}stat-change.#{iv.$class-prefix}is-#{$name} {
145
+ color: cv.getVar('#{$name}-on-scheme');
146
+ }
147
+ }
148
+
149
+ .#{iv.$class-prefix}stat .#{iv.$class-prefix}stat-description {
150
+ margin: 0;
151
+ color: cv.getVar('stat-description-color');
152
+ font-size: cv.getVar('stat-description-size');
153
+ }
@@ -13,6 +13,7 @@
13
13
  @use 'rate';
14
14
  @use 'autocomplete';
15
15
  @use 'combobox';
16
+ @use 'treeselect';
16
17
  @use 'taginput';
17
18
  @use 'picker-popover';
18
19
  @use 'dateinput';
@@ -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
+ }