@jobber/components 8.22.0 → 8.23.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 (72) hide show
  1. package/dist/CSPContext-cjs.js +69 -0
  2. package/dist/CSPContext-es.js +46 -0
  3. package/dist/Card/index.cjs +2 -0
  4. package/dist/Card/index.mjs +2 -0
  5. package/dist/ComboboxChipRemove-cjs.js +54 -211
  6. package/dist/ComboboxChipRemove-es.js +8 -164
  7. package/dist/DataDump/index.cjs +2 -0
  8. package/dist/DataDump/index.mjs +2 -0
  9. package/dist/Dialog/index.cjs +1 -0
  10. package/dist/Dialog/index.mjs +1 -0
  11. package/dist/DrawerDescription-cjs.js +2 -1
  12. package/dist/DrawerDescription-es.js +3 -2
  13. package/dist/DrawerTitle-es.js +1 -1
  14. package/dist/InputNumberExperimental-cjs.js +24 -23
  15. package/dist/InputNumberExperimental-es.js +3 -2
  16. package/dist/InternalBackdrop-es.js +3 -3
  17. package/dist/Menu/index.cjs +2 -0
  18. package/dist/Menu/index.mjs +2 -0
  19. package/dist/Menu-cjs.js +1 -1
  20. package/dist/Menu-es.js +1 -1
  21. package/dist/MenuSubmenuTrigger-cjs.js +5 -13
  22. package/dist/MenuSubmenuTrigger-es.js +8 -16
  23. package/dist/NumberFieldInput-cjs.js +9 -9
  24. package/dist/NumberFieldInput-es.js +3 -3
  25. package/dist/Page/index.cjs +2 -0
  26. package/dist/Page/index.mjs +2 -0
  27. package/dist/ScrollAreaViewport-cjs.js +5 -47
  28. package/dist/ScrollAreaViewport-es.js +5 -46
  29. package/dist/SelectGroupLabel-cjs.js +1924 -0
  30. package/dist/SelectGroupLabel-es.js +1888 -0
  31. package/dist/SelectPrimitive-cjs.js +112 -0
  32. package/dist/SelectPrimitive-es.js +110 -0
  33. package/dist/ToolbarRootContext-cjs.js +35 -0
  34. package/dist/ToolbarRootContext-es.js +14 -0
  35. package/dist/docs/SelectPrimitive/SelectPrimitive.md +326 -0
  36. package/dist/docs/index.md +1 -0
  37. package/dist/floating-ui.react-dom-cjs.js +1 -0
  38. package/dist/floating-ui.react-dom-es.js +2 -2
  39. package/dist/floating-ui.utils.dom-es.js +1 -1
  40. package/dist/index.cjs +2 -0
  41. package/dist/index.mjs +2 -0
  42. package/dist/primitives/BottomSheet/index.cjs +1 -0
  43. package/dist/primitives/BottomSheet/index.mjs +1 -0
  44. package/dist/primitives/ComboboxPrimitive/index.cjs +3 -1
  45. package/dist/primitives/ComboboxPrimitive/index.mjs +3 -1
  46. package/dist/primitives/InputNumberExperimental/index.cjs +2 -1
  47. package/dist/primitives/InputNumberExperimental/index.mjs +2 -1
  48. package/dist/primitives/SelectPrimitive/SelectPrimitive.d.ts +63 -0
  49. package/dist/primitives/SelectPrimitive/index.cjs +29 -0
  50. package/dist/primitives/SelectPrimitive/index.d.ts +2 -0
  51. package/dist/primitives/SelectPrimitive/index.mjs +23 -0
  52. package/dist/primitives/SelectPrimitive/types.d.ts +16 -0
  53. package/dist/primitives/index.cjs +8 -1
  54. package/dist/primitives/index.d.ts +1 -0
  55. package/dist/primitives/index.mjs +7 -1
  56. package/dist/primitives/mergeClassName.d.ts +12 -0
  57. package/dist/resolveAriaLabelledBy-cjs.js +195 -0
  58. package/dist/resolveAriaLabelledBy-es.js +162 -0
  59. package/dist/styles.css +325 -0
  60. package/dist/unstyledPrimitives/index.cjs +416 -24
  61. package/dist/unstyledPrimitives/index.d.ts +1 -0
  62. package/dist/unstyledPrimitives/index.mjs +417 -26
  63. package/dist/useButton-cjs.js +2 -0
  64. package/dist/useButton-es.js +3 -2
  65. package/dist/useCompositeListItem-es.js +3 -3
  66. package/dist/useLabel-cjs.js +3 -329
  67. package/dist/useLabel-es.js +4 -299
  68. package/dist/useLabelableId-cjs.js +332 -0
  69. package/dist/useLabelableId-es.js +300 -0
  70. package/dist/useRenderElement-cjs.js +3 -0
  71. package/dist/useRenderElement-es.js +4 -1
  72. package/package.json +2 -2
@@ -0,0 +1,162 @@
1
+ import * as React from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
5
+ function compareItemEquality(itemValue, selectedValue, comparer) {
6
+ if (itemValue == null || selectedValue == null) {
7
+ return Object.is(itemValue, selectedValue);
8
+ }
9
+ return comparer(itemValue, selectedValue);
10
+ }
11
+ function selectedValueIncludes(selectedValues, itemValue, comparer) {
12
+ if (!selectedValues || selectedValues.length === 0) {
13
+ return false;
14
+ }
15
+ return selectedValues.some(selectedValue => {
16
+ if (selectedValue === undefined) {
17
+ return false;
18
+ }
19
+ return compareItemEquality(itemValue, selectedValue, comparer);
20
+ });
21
+ }
22
+ function findItemIndex(itemValues, selectedValue, comparer) {
23
+ if (!itemValues || itemValues.length === 0) {
24
+ return -1;
25
+ }
26
+ return itemValues.findIndex(itemValue => {
27
+ if (itemValue === undefined) {
28
+ return false;
29
+ }
30
+ return compareItemEquality(itemValue, selectedValue, comparer);
31
+ });
32
+ }
33
+ function removeItem(selectedValues, itemValue, comparer) {
34
+ return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));
35
+ }
36
+
37
+ function serializeValue(value) {
38
+ if (value == null) {
39
+ return '';
40
+ }
41
+ if (typeof value === 'string') {
42
+ return value;
43
+ }
44
+ try {
45
+ return JSON.stringify(value);
46
+ } catch {
47
+ return String(value);
48
+ }
49
+ }
50
+
51
+ function isGroupedItems(items) {
52
+ return items != null && items.length > 0 && typeof items[0] === 'object' && items[0] != null && 'items' in items[0];
53
+ }
54
+
55
+ /**
56
+ * Checks if the items array contains an item with a null value that has a non-null label.
57
+ */
58
+ function hasNullItemLabel(items) {
59
+ if (!Array.isArray(items)) {
60
+ return items != null && 'null' in items;
61
+ }
62
+ const arrayItems = items;
63
+ if (isGroupedItems(arrayItems)) {
64
+ for (const group of arrayItems) {
65
+ for (const item of group.items) {
66
+ if (item && item.value == null && item.label != null) {
67
+ return true;
68
+ }
69
+ }
70
+ }
71
+ return false;
72
+ }
73
+ for (const item of arrayItems) {
74
+ if (item && item.value == null && item.label != null) {
75
+ return true;
76
+ }
77
+ }
78
+ return false;
79
+ }
80
+ function stringifyAsLabel(item, itemToStringLabel) {
81
+ if (itemToStringLabel && item != null) {
82
+ return itemToStringLabel(item) ?? '';
83
+ }
84
+ if (item && typeof item === 'object') {
85
+ if ('label' in item && item.label != null) {
86
+ return String(item.label);
87
+ }
88
+ if ('value' in item) {
89
+ return String(item.value);
90
+ }
91
+ }
92
+ return serializeValue(item);
93
+ }
94
+ function stringifyAsValue(item, itemToStringValue) {
95
+ if (itemToStringValue && item != null) {
96
+ return itemToStringValue(item) ?? '';
97
+ }
98
+ if (item && typeof item === 'object' && 'value' in item && 'label' in item) {
99
+ return serializeValue(item.value);
100
+ }
101
+ return serializeValue(item);
102
+ }
103
+ function resolveSelectedLabel(value, items, itemToStringLabel) {
104
+ function fallback() {
105
+ return stringifyAsLabel(value, itemToStringLabel);
106
+ }
107
+ if (itemToStringLabel && value != null) {
108
+ return itemToStringLabel(value);
109
+ }
110
+
111
+ // Custom object with explicit label takes precedence
112
+ if (value && typeof value === 'object' && 'label' in value && value.label != null) {
113
+ return value.label;
114
+ }
115
+
116
+ // Items provided as plain record map
117
+ if (items && !Array.isArray(items)) {
118
+ return items[value] ?? fallback();
119
+ }
120
+
121
+ // Items provided as array (flat or grouped)
122
+ if (Array.isArray(items)) {
123
+ const arrayItems = items;
124
+ const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap(group => group.items) : arrayItems;
125
+ if (value == null || typeof value !== 'object') {
126
+ const match = flatItems.find(item => item.value === value);
127
+ if (match && match.label != null) {
128
+ return match.label;
129
+ }
130
+ return fallback();
131
+ }
132
+
133
+ // Object without explicit label: try matching by its `value` property
134
+ if ('value' in value) {
135
+ const match = flatItems.find(item => item && item.value === value.value);
136
+ if (match && match.label != null) {
137
+ return match.label;
138
+ }
139
+ }
140
+ }
141
+ return fallback();
142
+ }
143
+ function resolveMultipleLabels(values, items, itemToStringLabel) {
144
+ return values.reduce((acc, value, index) => {
145
+ if (index > 0) {
146
+ acc.push(', ');
147
+ }
148
+ acc.push(/*#__PURE__*/jsx(React.Fragment, {
149
+ children: resolveSelectedLabel(value, items, itemToStringLabel)
150
+ }, index));
151
+ return acc;
152
+ }, []);
153
+ }
154
+
155
+ function getDefaultLabelId(id) {
156
+ return id == null ? undefined : `${id}-label`;
157
+ }
158
+ function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
159
+ return fieldLabelId ?? localLabelId;
160
+ }
161
+
162
+ export { resolveMultipleLabels as a, resolveSelectedLabel as b, compareItemEquality as c, defaultItemEquality as d, selectedValueIncludes as e, findItemIndex as f, removeItem as g, hasNullItemLabel as h, stringifyAsLabel as i, isGroupedItems as j, getDefaultLabelId as k, resolveAriaLabelledBy as r, stringifyAsValue as s };
package/dist/styles.css CHANGED
@@ -5504,6 +5504,331 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
5504
5504
  font-size: var(--typography--fontSize-small);
5505
5505
  }
5506
5506
 
5507
+ /* ============================================================
5508
+ SelectPrimitive
5509
+ Styled wrappers around BaseUI Select parts with Atlantis tokens.
5510
+ No field structure abstraction — consumers compose their own.
5511
+ ============================================================ */
5512
+
5513
+ /* ------ Trigger ------ */
5514
+
5515
+ .WQiJQH4jadQ- {
5516
+ /* Field tokens */
5517
+ --field--placeholder-color: var(--color-text--secondary);
5518
+ --field--value-color: var(--color-heading);
5519
+ --field--border-color: var(--color-border--interactive);
5520
+ --field--height: var(--space-largest);
5521
+ --field--padding-x: var(--space-base);
5522
+ --field--background-color: var(--color-surface);
5523
+ /* Space reserved on the right for the chevron icon */
5524
+ --field--icon-area: calc(
5525
+ var(--base-unit) * 1.25 + var(--field--padding-x) + var(--space-small)
5526
+ );
5527
+
5528
+ display: -ms-flexbox;
5529
+
5530
+ display: flex;
5531
+ position: relative;
5532
+ -ms-flex-align: center;
5533
+ align-items: center;
5534
+ width: 100%;
5535
+ height: 48px;
5536
+ height: var(--field--height);
5537
+ box-sizing: border-box;
5538
+ padding: 0 calc(
5539
+ 16px * 1.25 + 16px + 8px
5540
+ ) 0 16px;
5541
+ padding: 0 var(--field--icon-area) 0 var(--field--padding-x);
5542
+ border: 1px solid hsl(200, 13%, 87%);
5543
+ border: var(--border-base) solid var(--field--border-color);
5544
+ border-top-right-radius: 8px;
5545
+ border-top-right-radius: var(
5546
+ --public-field--top-right-radius,
5547
+ var(--radius-base)
5548
+ );
5549
+ border-bottom-right-radius: 8px;
5550
+ border-bottom-right-radius: var(
5551
+ --public-field--bottom-right-radius,
5552
+ var(--radius-base)
5553
+ );
5554
+ border-bottom-left-radius: 8px;
5555
+ border-bottom-left-radius: var(
5556
+ --public-field--bottom-left-radius,
5557
+ var(--radius-base)
5558
+ );
5559
+ border-top-left-radius: 8px;
5560
+ border-top-left-radius: var(
5561
+ --public-field--top-left-radius,
5562
+ var(--radius-base)
5563
+ );
5564
+ outline: none;
5565
+ color: hsl(197, 90%, 12%);
5566
+ color: var(--field--value-color);
5567
+ font-family: inherit;
5568
+ font-size: 14px;
5569
+ font-size: var(--typography--fontSize-base);
5570
+ text-align: left;
5571
+ background-color: rgba(255, 255, 255, 1);
5572
+ background-color: var(--field--background-color);
5573
+ cursor: pointer;
5574
+
5575
+ transition: box-shadow 200ms ease-out,
5576
+ border-color 200ms ease-out;
5577
+
5578
+ transition: box-shadow var(--timing-base) ease-out,
5579
+ border-color var(--timing-base) ease-out;
5580
+ -webkit-appearance: none;
5581
+ appearance: none;
5582
+ }
5583
+
5584
+ .WQiJQH4jadQ-:focus-visible,
5585
+ .WQiJQH4jadQ-[data-popup-open] {
5586
+ box-shadow: 0px 0px 0px 2px rgba(255, 255, 255, 1), 0px 0px 0px 4px hsl(198, 12%, 57%);
5587
+ box-shadow: var(--shadow-focus);
5588
+ }
5589
+
5590
+ .WQiJQH4jadQ-:disabled {
5591
+ --field--placeholder-color: var(--color-disabled);
5592
+ --field--value-color: var(--color-disabled);
5593
+ --field--background-color: var(--color-disabled--secondary);
5594
+ --field--border-color: var(--color-border);
5595
+ cursor: not-allowed;
5596
+ }
5597
+
5598
+ .WQiJQH4jadQ-[data-readonly] {
5599
+ --field--border-color: var(--color-border);
5600
+ --field--background-color: var(--color-disabled--secondary);
5601
+ pointer-events: none;
5602
+ cursor: default;
5603
+ }
5604
+
5605
+ .WQiJQH4jadQ-[data-invalid] {
5606
+ --field--border-color: var(--color-critical);
5607
+ }
5608
+
5609
+ /* ------ Value / placeholder text ------ */
5610
+
5611
+ .P2HhjOjxY34- {
5612
+ -ms-flex: 1;
5613
+ flex: 1;
5614
+ min-width: 0;
5615
+ overflow: hidden;
5616
+ color: var(--field--value-color);
5617
+ text-overflow: ellipsis;
5618
+ white-space: nowrap;
5619
+ pointer-events: none;
5620
+ }
5621
+
5622
+ .WQiJQH4jadQ-[data-placeholder] .P2HhjOjxY34- {
5623
+ color: var(--field--placeholder-color);
5624
+ }
5625
+
5626
+ /* ------ Chevron icon ------ */
5627
+
5628
+ .cxgFUCKcXcw- {
5629
+ display: -ms-flexbox;
5630
+ display: flex;
5631
+ position: absolute;
5632
+ top: 50%;
5633
+ right: var(--field--padding-x);
5634
+ pointer-events: none;
5635
+ -webkit-transform: translateY(-50%);
5636
+ transform: translateY(-50%);
5637
+ -ms-flex-align: center;
5638
+ align-items: center;
5639
+ }
5640
+
5641
+ ._3BEK4Z1gGis- {
5642
+ display: -ms-flexbox;
5643
+ display: flex;
5644
+ transition: -webkit-transform 100ms;
5645
+ transition: -webkit-transform var(--timing-quick);
5646
+ transition: transform 100ms;
5647
+ transition: transform var(--timing-quick);
5648
+ transition: transform 100ms, -webkit-transform 100ms;
5649
+ transition: transform var(--timing-quick), -webkit-transform var(--timing-quick);
5650
+ }
5651
+
5652
+ .WQiJQH4jadQ-[data-popup-open] ._3BEK4Z1gGis- {
5653
+ -webkit-transform: rotate(180deg);
5654
+ transform: rotate(180deg);
5655
+ }
5656
+
5657
+ /* ============================================================
5658
+ Popup / Dropdown — mirrors Menu dropdown styling
5659
+ ============================================================ */
5660
+
5661
+ .g221yZJtRrU- {
5662
+ z-index: 1001;
5663
+ z-index: var(--elevation-modal);
5664
+ }
5665
+
5666
+ .vifRnCQ18ss- {
5667
+ min-width: var(--anchor-width);
5668
+ box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1), 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
5669
+ box-shadow: var(--shadow-base);
5670
+ box-sizing: border-box;
5671
+ padding: 0;
5672
+ border: 1px solid hsl(200, 13%, 87%);
5673
+ border: var(--border-base) solid var(--color-border);
5674
+ border-radius: 8px;
5675
+ border-radius: var(--radius-base);
5676
+ outline: none;
5677
+ overflow: hidden;
5678
+ background-color: rgba(255, 255, 255, 1);
5679
+ background-color: var(--color-surface);
5680
+ }
5681
+
5682
+ .WsOmdkQ0SWU- {
5683
+ --menu-space: var(--space-small);
5684
+ --menu-item-min-height: calc(var(--base-unit) * 2.5);
5685
+ --menu-item-padding-y: var(--space-small);
5686
+ --menu-item-padding-x: var(--space-small);
5687
+ --menu-item-gap: var(--space-small);
5688
+
5689
+ display: -ms-flexbox;
5690
+
5691
+ display: flex;
5692
+ -ms-flex-direction: column;
5693
+ flex-direction: column;
5694
+ max-height: min(
5695
+ 72vh,
5696
+ max(0px, calc(var(--available-height) - 16px))
5697
+ );
5698
+ max-height: min(
5699
+ 72vh,
5700
+ max(0px, calc(var(--available-height) - var(--space-base)))
5701
+ );
5702
+ box-sizing: border-box;
5703
+ padding: 8px;
5704
+ padding: var(--menu-space);
5705
+ border-radius: inherit;
5706
+ overflow: auto;
5707
+ }
5708
+
5709
+ /* ------ Item ------ */
5710
+
5711
+ .wQ2wXu1YH-k- {
5712
+ display: -ms-flexbox;
5713
+ display: flex;
5714
+ -ms-flex-align: center;
5715
+ align-items: center;
5716
+ gap: var(--menu-item-gap);
5717
+ width: 100%;
5718
+ min-height: var(--menu-item-min-height);
5719
+ box-sizing: border-box;
5720
+ padding: var(--menu-item-padding-y) var(--menu-item-padding-x);
5721
+ border: none;
5722
+ border-radius: 4px;
5723
+ border-radius: var(--radius-small);
5724
+ outline: none;
5725
+ color: inherit;
5726
+ font-family: inherit;
5727
+ font-size: 14px;
5728
+ font-size: var(--typography--fontSize-base);
5729
+ text-align: left;
5730
+ -webkit-user-select: none;
5731
+ -ms-user-select: none;
5732
+ user-select: none;
5733
+ background: transparent;
5734
+ cursor: pointer;
5735
+
5736
+ transition: background-color 200ms ease-out;
5737
+
5738
+ transition: background-color var(--timing-base) ease-out;
5739
+ }
5740
+
5741
+ .wQ2wXu1YH-k-[data-highlighted] {
5742
+ background-color: hsl(43, 18%, 92%);
5743
+ background-color: var(--color-surface--hover);
5744
+ }
5745
+
5746
+ .wQ2wXu1YH-k-[data-disabled] {
5747
+ color: hsl(0, 0%, 58%);
5748
+ color: var(--color-disabled);
5749
+ cursor: not-allowed;
5750
+ }
5751
+
5752
+ /* ------ Item text ------ */
5753
+
5754
+ ._--Vi-17OUiU- {
5755
+ -ms-flex: 1;
5756
+ flex: 1;
5757
+ min-width: 0;
5758
+ overflow: hidden;
5759
+ text-overflow: ellipsis;
5760
+ white-space: nowrap;
5761
+ }
5762
+
5763
+ /* ------ Item indicator (checkmark) ------ */
5764
+
5765
+ .CfjooR3I8Jc- {
5766
+ display: -ms-inline-flexbox;
5767
+ display: inline-flex;
5768
+ /* Hidden by default; revealed via CSS when the item is selected.
5769
+ Using visibility (not display) so layout width is always reserved. */
5770
+ visibility: hidden;
5771
+ min-width: calc(16px * 1.5);
5772
+ min-width: calc(var(--base-unit) * 1.5);
5773
+ -ms-flex-negative: 0;
5774
+ flex-shrink: 0;
5775
+ -ms-flex-align: center;
5776
+ align-items: center;
5777
+ -ms-flex-pack: center;
5778
+ justify-content: center;
5779
+ }
5780
+
5781
+ .wQ2wXu1YH-k-[data-selected] .CfjooR3I8Jc- {
5782
+ visibility: visible;
5783
+ }
5784
+
5785
+ /* ------ Separator ------ */
5786
+
5787
+ .lI5-MyBERFY- {
5788
+ margin: 8px 0;
5789
+ margin: var(--space-small) 0;
5790
+ border: none;
5791
+ border-bottom: 1px solid hsl(200, 13%, 87%);
5792
+ border-bottom: var(--border-base) solid var(--color-border);
5793
+ }
5794
+
5795
+ /* ------ Group ------ */
5796
+
5797
+ ._21z9KBWR06w- {
5798
+ display: -ms-flexbox;
5799
+ display: flex;
5800
+ -ms-flex-direction: column;
5801
+ flex-direction: column;
5802
+ }
5803
+
5804
+ ._21z9KBWR06w-:not(:last-child) {
5805
+ padding-bottom: 8px;
5806
+ padding-bottom: var(--space-small);
5807
+ border-bottom: 1px solid hsl(200, 13%, 87%);
5808
+ border-bottom: var(--border-base) solid var(--color-border);
5809
+ }
5810
+
5811
+ ._21z9KBWR06w-:not(:first-child) {
5812
+ margin-top: 8px;
5813
+ margin-top: var(--space-small);
5814
+ }
5815
+
5816
+ /* ------ Group label ------ */
5817
+
5818
+ .ZhtKkgZiSQI- {
5819
+ display: -ms-flexbox;
5820
+ display: flex;
5821
+ -ms-flex-align: center;
5822
+ align-items: center;
5823
+ padding: 8px 8px 4px;
5824
+ padding: var(--space-small) var(--space-small) var(--space-smaller);
5825
+ color: hsl(197, 21%, 36%);
5826
+ color: var(--color-text--secondary);
5827
+ font-size: 14px;
5828
+ font-size: var(--typography--fontSize-base);
5829
+ font-weight: 400;
5830
+ }
5831
+
5507
5832
  .kub1yKbFFN0- {
5508
5833
  display: -ms-flexbox;
5509
5834
  display: flex;