@jobber/components 8.23.0 → 8.23.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/dist/Autocomplete/index.cjs +1 -1
- package/dist/Autocomplete/index.mjs +1 -1
- package/dist/Card/index.cjs +4 -4
- package/dist/Card/index.mjs +4 -4
- package/dist/Chip/index.cjs +1 -1
- package/dist/Chip/index.mjs +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -1
- package/dist/Chips/InternalChipDismissible/index.cjs +1 -1
- package/dist/Chips/InternalChipDismissible/index.mjs +1 -1
- package/dist/Chips/index.cjs +1 -1
- package/dist/Chips/index.mjs +1 -1
- package/dist/ComboboxChipRemove-cjs.js +668 -379
- package/dist/ComboboxChipRemove-es.js +508 -219
- package/dist/ConfirmationModal/index.cjs +1 -1
- package/dist/ConfirmationModal/index.mjs +1 -1
- package/dist/DataDump/index.cjs +4 -4
- package/dist/DataDump/index.mjs +4 -4
- package/dist/DataList/components/DataListActions/index.cjs +1 -1
- package/dist/DataList/components/DataListActions/index.mjs +1 -1
- package/dist/DataList/components/DataListBulkActions/index.cjs +1 -1
- package/dist/DataList/components/DataListBulkActions/index.mjs +1 -1
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -1
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -1
- package/dist/DataList/components/DataListFilters/index.cjs +1 -1
- package/dist/DataList/components/DataListFilters/index.mjs +1 -1
- package/dist/DataList/components/DataListHeader/index.cjs +1 -1
- package/dist/DataList/components/DataListHeader/index.mjs +1 -1
- package/dist/DataList/components/DataListItem/index.cjs +1 -1
- package/dist/DataList/components/DataListItem/index.mjs +1 -1
- package/dist/DataList/components/DataListItemActions/index.cjs +1 -1
- package/dist/DataList/components/DataListItemActions/index.mjs +1 -1
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +1 -1
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +1 -1
- package/dist/DataList/components/DataListItems/index.cjs +1 -1
- package/dist/DataList/components/DataListItems/index.mjs +1 -1
- package/dist/DataList/components/DataListLayout/index.cjs +1 -1
- package/dist/DataList/components/DataListLayout/index.mjs +1 -1
- package/dist/DataList/components/DataListLayoutActions/index.cjs +1 -1
- package/dist/DataList/components/DataListLayoutActions/index.mjs +1 -1
- package/dist/DataList/index.cjs +1 -1
- package/dist/DataList/index.mjs +1 -1
- package/dist/DatePicker/index.cjs +1 -1
- package/dist/DatePicker/index.mjs +1 -1
- package/dist/Dialog/index.cjs +3 -3
- package/dist/Dialog/index.mjs +3 -3
- package/dist/DrawerDescription-cjs.js +32 -33
- package/dist/DrawerDescription-es.js +19 -20
- package/dist/DrawerTitle-cjs.js +7 -5
- package/dist/DrawerTitle-es.js +7 -5
- package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +1 -1
- package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +1 -1
- package/dist/FilterPicker/components/FilterPickerContent/index.cjs +1 -1
- package/dist/FilterPicker/components/FilterPickerContent/index.mjs +1 -1
- package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +1 -1
- package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +1 -1
- package/dist/FilterPicker/index.cjs +1 -1
- package/dist/FilterPicker/index.mjs +1 -1
- package/dist/FormFieldWrapper-cjs.js +2 -2
- package/dist/FormFieldWrapper-es.js +2 -2
- package/dist/FormatFile/index.cjs +1 -1
- package/dist/FormatFile/index.mjs +1 -1
- package/dist/Gallery/index.cjs +1 -1
- package/dist/Gallery/index.mjs +1 -1
- package/dist/InputDate/index.cjs +1 -1
- package/dist/InputDate/index.mjs +1 -1
- package/dist/InputNumberExperimental-cjs.js +319 -102
- package/dist/InputNumberExperimental-es.js +321 -104
- package/dist/LightBox/index.cjs +1 -1
- package/dist/LightBox/index.mjs +1 -1
- package/dist/Menu/index.cjs +4 -4
- package/dist/Menu/index.mjs +4 -4
- package/dist/MenuSubmenuTrigger-cjs.js +545 -498
- package/dist/MenuSubmenuTrigger-es.js +490 -443
- package/dist/Modal/index.cjs +1 -1
- package/dist/Modal/index.mjs +1 -1
- package/dist/NumberFieldInput-cjs.js +609 -496
- package/dist/NumberFieldInput-es.js +612 -498
- package/dist/Page/index.cjs +4 -4
- package/dist/Page/index.mjs +4 -4
- package/dist/Popover/index.cjs +1 -1
- package/dist/Popover/index.mjs +1 -1
- package/dist/ScrollAreaViewport-cjs.js +326 -601
- package/dist/ScrollAreaViewport-es.js +278 -548
- package/dist/SelectGroupLabel-cjs.js +494 -528
- package/dist/SelectGroupLabel-es.js +411 -445
- package/dist/Separator-cjs.js +1 -0
- package/dist/Separator-es.js +1 -0
- package/dist/Tooltip/index.cjs +1 -1
- package/dist/Tooltip/index.mjs +1 -1
- package/dist/docs/InputTime/InputTime.md +8 -0
- package/dist/docs/SelectPrimitive/SelectPrimitive.md +38 -25
- package/dist/floating-ui.react-cjs.js +586 -10
- package/dist/floating-ui.react-dom-cjs.js +92 -92
- package/dist/floating-ui.react-dom-es.js +1 -1
- package/dist/floating-ui.react-es.js +580 -4
- package/dist/floating-ui.utils-cjs.js +159 -0
- package/dist/floating-ui.utils-es.js +136 -0
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{ToolbarRootContext-cjs.js → isElementDisabled-cjs.js} +5 -0
- package/dist/{ToolbarRootContext-es.js → isElementDisabled-es.js} +5 -1
- package/dist/primitives/BottomSheet/index.cjs +3 -3
- package/dist/primitives/BottomSheet/index.mjs +3 -3
- package/dist/primitives/ComboboxPrimitive/index.cjs +2 -2
- package/dist/primitives/ComboboxPrimitive/index.mjs +2 -2
- package/dist/primitives/InputNumberExperimental/index.cjs +1 -1
- package/dist/primitives/InputNumberExperimental/index.mjs +1 -1
- package/dist/primitives/SelectPrimitive/index.cjs +5 -5
- package/dist/primitives/SelectPrimitive/index.mjs +5 -5
- package/dist/primitives/index.cjs +4 -4
- package/dist/primitives/index.mjs +4 -4
- package/dist/resolveAriaLabelledBy-cjs.js +5 -0
- package/dist/resolveAriaLabelledBy-es.js +5 -1
- package/dist/{CSPContext-cjs.js → scrollEdges-cjs.js} +30 -2
- package/dist/{CSPContext-es.js → scrollEdges-es.js} +28 -3
- package/dist/styles.css +9 -3
- package/dist/unstyledPrimitives/index.cjs +1217 -639
- package/dist/unstyledPrimitives/index.mjs +1163 -585
- package/dist/useButton-cjs.js +283 -317
- package/dist/useButton-es.js +277 -298
- package/dist/useCompositeListItem-cjs.js +328 -279
- package/dist/useCompositeListItem-es.js +293 -246
- package/dist/useLabel-cjs.js +11 -1
- package/dist/useLabel-es.js +11 -2
- package/dist/useLabelableId-cjs.js +37 -91
- package/dist/useLabelableId-es.js +37 -90
- package/dist/useRenderElement-cjs.js +81 -26
- package/dist/useRenderElement-es.js +81 -27
- package/dist/{InternalBackdrop-cjs.js → useScrollLock-cjs.js} +1286 -1220
- package/dist/{InternalBackdrop-es.js → useScrollLock-es.js} +1250 -1207
- package/package.json +3 -3
- package/dist/index.esm-cjs.js +0 -738
- package/dist/index.esm-es.js +0 -712
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom positioning reference element.
|
|
5
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
9
|
+
const alignments = ['start', 'end'];
|
|
10
|
+
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
11
|
+
const min = Math.min;
|
|
12
|
+
const max = Math.max;
|
|
13
|
+
const round = Math.round;
|
|
14
|
+
const floor = Math.floor;
|
|
15
|
+
const createCoords = v => ({
|
|
16
|
+
x: v,
|
|
17
|
+
y: v
|
|
18
|
+
});
|
|
19
|
+
const oppositeSideMap = {
|
|
20
|
+
left: 'right',
|
|
21
|
+
right: 'left',
|
|
22
|
+
bottom: 'top',
|
|
23
|
+
top: 'bottom'
|
|
24
|
+
};
|
|
25
|
+
function clamp(start, value, end) {
|
|
26
|
+
return max(start, min(value, end));
|
|
27
|
+
}
|
|
28
|
+
function evaluate(value, param) {
|
|
29
|
+
return typeof value === 'function' ? value(param) : value;
|
|
30
|
+
}
|
|
31
|
+
function getSide(placement) {
|
|
32
|
+
return placement.split('-')[0];
|
|
33
|
+
}
|
|
34
|
+
function getAlignment(placement) {
|
|
35
|
+
return placement.split('-')[1];
|
|
36
|
+
}
|
|
37
|
+
function getOppositeAxis(axis) {
|
|
38
|
+
return axis === 'x' ? 'y' : 'x';
|
|
39
|
+
}
|
|
40
|
+
function getAxisLength(axis) {
|
|
41
|
+
return axis === 'y' ? 'height' : 'width';
|
|
42
|
+
}
|
|
43
|
+
function getSideAxis(placement) {
|
|
44
|
+
const firstChar = placement[0];
|
|
45
|
+
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
|
46
|
+
}
|
|
47
|
+
function getAlignmentAxis(placement) {
|
|
48
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
49
|
+
}
|
|
50
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
51
|
+
if (rtl === void 0) {
|
|
52
|
+
rtl = false;
|
|
53
|
+
}
|
|
54
|
+
const alignment = getAlignment(placement);
|
|
55
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
56
|
+
const length = getAxisLength(alignmentAxis);
|
|
57
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
58
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
59
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
60
|
+
}
|
|
61
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
62
|
+
}
|
|
63
|
+
function getExpandedPlacements(placement) {
|
|
64
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
65
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
66
|
+
}
|
|
67
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
68
|
+
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
|
69
|
+
}
|
|
70
|
+
const lrPlacement = ['left', 'right'];
|
|
71
|
+
const rlPlacement = ['right', 'left'];
|
|
72
|
+
const tbPlacement = ['top', 'bottom'];
|
|
73
|
+
const btPlacement = ['bottom', 'top'];
|
|
74
|
+
function getSideList(side, isStart, rtl) {
|
|
75
|
+
switch (side) {
|
|
76
|
+
case 'top':
|
|
77
|
+
case 'bottom':
|
|
78
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
79
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
80
|
+
case 'left':
|
|
81
|
+
case 'right':
|
|
82
|
+
return isStart ? tbPlacement : btPlacement;
|
|
83
|
+
default:
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
88
|
+
const alignment = getAlignment(placement);
|
|
89
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
90
|
+
if (alignment) {
|
|
91
|
+
list = list.map(side => side + "-" + alignment);
|
|
92
|
+
if (flipAlignment) {
|
|
93
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return list;
|
|
97
|
+
}
|
|
98
|
+
function getOppositePlacement(placement) {
|
|
99
|
+
const side = getSide(placement);
|
|
100
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
101
|
+
}
|
|
102
|
+
function expandPaddingObject(padding) {
|
|
103
|
+
return {
|
|
104
|
+
top: 0,
|
|
105
|
+
right: 0,
|
|
106
|
+
bottom: 0,
|
|
107
|
+
left: 0,
|
|
108
|
+
...padding
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function getPaddingObject(padding) {
|
|
112
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
113
|
+
top: padding,
|
|
114
|
+
right: padding,
|
|
115
|
+
bottom: padding,
|
|
116
|
+
left: padding
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function rectToClientRect(rect) {
|
|
120
|
+
const {
|
|
121
|
+
x,
|
|
122
|
+
y,
|
|
123
|
+
width,
|
|
124
|
+
height
|
|
125
|
+
} = rect;
|
|
126
|
+
return {
|
|
127
|
+
width,
|
|
128
|
+
height,
|
|
129
|
+
top: y,
|
|
130
|
+
left: x,
|
|
131
|
+
right: x + width,
|
|
132
|
+
bottom: y + height,
|
|
133
|
+
x,
|
|
134
|
+
y
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
exports.clamp = clamp;
|
|
139
|
+
exports.createCoords = createCoords;
|
|
140
|
+
exports.evaluate = evaluate;
|
|
141
|
+
exports.floor = floor;
|
|
142
|
+
exports.getAlignment = getAlignment;
|
|
143
|
+
exports.getAlignmentAxis = getAlignmentAxis;
|
|
144
|
+
exports.getAlignmentSides = getAlignmentSides;
|
|
145
|
+
exports.getAxisLength = getAxisLength;
|
|
146
|
+
exports.getExpandedPlacements = getExpandedPlacements;
|
|
147
|
+
exports.getOppositeAlignmentPlacement = getOppositeAlignmentPlacement;
|
|
148
|
+
exports.getOppositeAxis = getOppositeAxis;
|
|
149
|
+
exports.getOppositeAxisPlacements = getOppositeAxisPlacements;
|
|
150
|
+
exports.getOppositePlacement = getOppositePlacement;
|
|
151
|
+
exports.getPaddingObject = getPaddingObject;
|
|
152
|
+
exports.getSide = getSide;
|
|
153
|
+
exports.getSideAxis = getSideAxis;
|
|
154
|
+
exports.max = max;
|
|
155
|
+
exports.min = min;
|
|
156
|
+
exports.placements = placements;
|
|
157
|
+
exports.rectToClientRect = rectToClientRect;
|
|
158
|
+
exports.round = round;
|
|
159
|
+
exports.sides = sides;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom positioning reference element.
|
|
3
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
7
|
+
const alignments = ['start', 'end'];
|
|
8
|
+
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
9
|
+
const min = Math.min;
|
|
10
|
+
const max = Math.max;
|
|
11
|
+
const round = Math.round;
|
|
12
|
+
const floor = Math.floor;
|
|
13
|
+
const createCoords = v => ({
|
|
14
|
+
x: v,
|
|
15
|
+
y: v
|
|
16
|
+
});
|
|
17
|
+
const oppositeSideMap = {
|
|
18
|
+
left: 'right',
|
|
19
|
+
right: 'left',
|
|
20
|
+
bottom: 'top',
|
|
21
|
+
top: 'bottom'
|
|
22
|
+
};
|
|
23
|
+
function clamp(start, value, end) {
|
|
24
|
+
return max(start, min(value, end));
|
|
25
|
+
}
|
|
26
|
+
function evaluate(value, param) {
|
|
27
|
+
return typeof value === 'function' ? value(param) : value;
|
|
28
|
+
}
|
|
29
|
+
function getSide(placement) {
|
|
30
|
+
return placement.split('-')[0];
|
|
31
|
+
}
|
|
32
|
+
function getAlignment(placement) {
|
|
33
|
+
return placement.split('-')[1];
|
|
34
|
+
}
|
|
35
|
+
function getOppositeAxis(axis) {
|
|
36
|
+
return axis === 'x' ? 'y' : 'x';
|
|
37
|
+
}
|
|
38
|
+
function getAxisLength(axis) {
|
|
39
|
+
return axis === 'y' ? 'height' : 'width';
|
|
40
|
+
}
|
|
41
|
+
function getSideAxis(placement) {
|
|
42
|
+
const firstChar = placement[0];
|
|
43
|
+
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
|
44
|
+
}
|
|
45
|
+
function getAlignmentAxis(placement) {
|
|
46
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
47
|
+
}
|
|
48
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
49
|
+
if (rtl === void 0) {
|
|
50
|
+
rtl = false;
|
|
51
|
+
}
|
|
52
|
+
const alignment = getAlignment(placement);
|
|
53
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
54
|
+
const length = getAxisLength(alignmentAxis);
|
|
55
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
56
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
57
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
58
|
+
}
|
|
59
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
60
|
+
}
|
|
61
|
+
function getExpandedPlacements(placement) {
|
|
62
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
63
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
64
|
+
}
|
|
65
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
66
|
+
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
|
67
|
+
}
|
|
68
|
+
const lrPlacement = ['left', 'right'];
|
|
69
|
+
const rlPlacement = ['right', 'left'];
|
|
70
|
+
const tbPlacement = ['top', 'bottom'];
|
|
71
|
+
const btPlacement = ['bottom', 'top'];
|
|
72
|
+
function getSideList(side, isStart, rtl) {
|
|
73
|
+
switch (side) {
|
|
74
|
+
case 'top':
|
|
75
|
+
case 'bottom':
|
|
76
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
77
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
78
|
+
case 'left':
|
|
79
|
+
case 'right':
|
|
80
|
+
return isStart ? tbPlacement : btPlacement;
|
|
81
|
+
default:
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
86
|
+
const alignment = getAlignment(placement);
|
|
87
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
88
|
+
if (alignment) {
|
|
89
|
+
list = list.map(side => side + "-" + alignment);
|
|
90
|
+
if (flipAlignment) {
|
|
91
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return list;
|
|
95
|
+
}
|
|
96
|
+
function getOppositePlacement(placement) {
|
|
97
|
+
const side = getSide(placement);
|
|
98
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
99
|
+
}
|
|
100
|
+
function expandPaddingObject(padding) {
|
|
101
|
+
return {
|
|
102
|
+
top: 0,
|
|
103
|
+
right: 0,
|
|
104
|
+
bottom: 0,
|
|
105
|
+
left: 0,
|
|
106
|
+
...padding
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function getPaddingObject(padding) {
|
|
110
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
111
|
+
top: padding,
|
|
112
|
+
right: padding,
|
|
113
|
+
bottom: padding,
|
|
114
|
+
left: padding
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function rectToClientRect(rect) {
|
|
118
|
+
const {
|
|
119
|
+
x,
|
|
120
|
+
y,
|
|
121
|
+
width,
|
|
122
|
+
height
|
|
123
|
+
} = rect;
|
|
124
|
+
return {
|
|
125
|
+
width,
|
|
126
|
+
height,
|
|
127
|
+
top: y,
|
|
128
|
+
left: x,
|
|
129
|
+
right: x + width,
|
|
130
|
+
bottom: y + height,
|
|
131
|
+
x,
|
|
132
|
+
y
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { getAlignmentAxis as a, getSide as b, getAlignment as c, getPaddingObject as d, evaluate as e, floor as f, getSideAxis as g, getOppositePlacement as h, getExpandedPlacements as i, getOppositeAxisPlacements as j, getAlignmentSides as k, clamp as l, min as m, max as n, getAxisLength as o, getOppositeAxis as p, placements as q, rectToClientRect as r, sides as s, getOppositeAlignmentPlacement as t, createCoords as u, round as v };
|
package/dist/index.cjs
CHANGED
|
@@ -102,7 +102,7 @@ require('./_isIterateeCall-cjs.js');
|
|
|
102
102
|
require('./_setToString-cjs.js');
|
|
103
103
|
require('./floating-ui.react-cjs.js');
|
|
104
104
|
require('./floating-ui.utils.dom-cjs.js');
|
|
105
|
-
require('./
|
|
105
|
+
require('./floating-ui.utils-cjs.js');
|
|
106
106
|
require('react/jsx-runtime');
|
|
107
107
|
require('react-dom');
|
|
108
108
|
require('./floating-ui.react-dom-cjs.js');
|
|
@@ -173,9 +173,9 @@ require('./clsx-cjs.js');
|
|
|
173
173
|
require('./buttonRenderAdapter-cjs.js');
|
|
174
174
|
require('./useRenderElement-cjs.js');
|
|
175
175
|
require('./ScrollAreaViewport-cjs.js');
|
|
176
|
-
require('./
|
|
176
|
+
require('./useScrollLock-cjs.js');
|
|
177
177
|
require('./useButton-cjs.js');
|
|
178
|
-
require('./
|
|
178
|
+
require('./scrollEdges-cjs.js');
|
|
179
179
|
require('./clamp-cjs.js');
|
|
180
180
|
require('./BottomSheet-cjs.js');
|
|
181
181
|
require('./DrawerTitle-cjs.js');
|
|
@@ -189,7 +189,7 @@ require('./OverlaySeparator-cjs.js');
|
|
|
189
189
|
require('./Separator-cjs.js');
|
|
190
190
|
require('./MenuSubmenuTrigger-cjs.js');
|
|
191
191
|
require('./useCompositeListItem-cjs.js');
|
|
192
|
-
require('./
|
|
192
|
+
require('./isElementDisabled-cjs.js');
|
|
193
193
|
require('./AtlantisPortalContent-cjs.js');
|
|
194
194
|
require('@jobber/formatters');
|
|
195
195
|
require('react-dom/client');
|
package/dist/index.mjs
CHANGED
|
@@ -100,7 +100,7 @@ import './_isIterateeCall-es.js';
|
|
|
100
100
|
import './_setToString-es.js';
|
|
101
101
|
import './floating-ui.react-es.js';
|
|
102
102
|
import './floating-ui.utils.dom-es.js';
|
|
103
|
-
import './
|
|
103
|
+
import './floating-ui.utils-es.js';
|
|
104
104
|
import 'react/jsx-runtime';
|
|
105
105
|
import 'react-dom';
|
|
106
106
|
import './floating-ui.react-dom-es.js';
|
|
@@ -171,9 +171,9 @@ import './clsx-es.js';
|
|
|
171
171
|
import './buttonRenderAdapter-es.js';
|
|
172
172
|
import './useRenderElement-es.js';
|
|
173
173
|
import './ScrollAreaViewport-es.js';
|
|
174
|
-
import './
|
|
174
|
+
import './useScrollLock-es.js';
|
|
175
175
|
import './useButton-es.js';
|
|
176
|
-
import './
|
|
176
|
+
import './scrollEdges-es.js';
|
|
177
177
|
import './clamp-es.js';
|
|
178
178
|
import './BottomSheet-es.js';
|
|
179
179
|
import './DrawerTitle-es.js';
|
|
@@ -187,7 +187,7 @@ import './OverlaySeparator-es.js';
|
|
|
187
187
|
import './Separator-es.js';
|
|
188
188
|
import './MenuSubmenuTrigger-es.js';
|
|
189
189
|
import './useCompositeListItem-es.js';
|
|
190
|
-
import './
|
|
190
|
+
import './isElementDisabled-es.js';
|
|
191
191
|
import './AtlantisPortalContent-es.js';
|
|
192
192
|
import '@jobber/formatters';
|
|
193
193
|
import 'react-dom/client';
|
|
@@ -32,4 +32,9 @@ function useToolbarRootContext(optional) {
|
|
|
32
32
|
return context;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function isElementDisabled(element) {
|
|
36
|
+
return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.isElementDisabled = isElementDisabled;
|
|
35
40
|
exports.useToolbarRootContext = useToolbarRootContext;
|
|
@@ -11,4 +11,8 @@ function useToolbarRootContext(optional) {
|
|
|
11
11
|
return context;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
function isElementDisabled(element) {
|
|
15
|
+
return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { isElementDisabled as i, useToolbarRootContext as u };
|
|
@@ -12,13 +12,13 @@ require('@jobber/design');
|
|
|
12
12
|
require('../../Typography-cjs.js');
|
|
13
13
|
require('../../useRenderElement-cjs.js');
|
|
14
14
|
require('../../ScrollAreaViewport-cjs.js');
|
|
15
|
-
require('../../
|
|
16
|
-
require('../../index.esm-cjs.js');
|
|
15
|
+
require('../../useScrollLock-cjs.js');
|
|
17
16
|
require('../../floating-ui.utils.dom-cjs.js');
|
|
18
17
|
require('../../useButton-cjs.js');
|
|
19
18
|
require('react-dom');
|
|
20
19
|
require('react/jsx-runtime');
|
|
21
|
-
require('../../
|
|
20
|
+
require('../../floating-ui.utils-cjs.js');
|
|
21
|
+
require('../../scrollEdges-cjs.js');
|
|
22
22
|
require('../../clamp-cjs.js');
|
|
23
23
|
|
|
24
24
|
|
|
@@ -10,11 +10,11 @@ import '@jobber/design';
|
|
|
10
10
|
import '../../Typography-es.js';
|
|
11
11
|
import '../../useRenderElement-es.js';
|
|
12
12
|
import '../../ScrollAreaViewport-es.js';
|
|
13
|
-
import '../../
|
|
14
|
-
import '../../index.esm-es.js';
|
|
13
|
+
import '../../useScrollLock-es.js';
|
|
15
14
|
import '../../floating-ui.utils.dom-es.js';
|
|
16
15
|
import '../../useButton-es.js';
|
|
17
16
|
import 'react-dom';
|
|
18
17
|
import 'react/jsx-runtime';
|
|
19
|
-
import '../../
|
|
18
|
+
import '../../floating-ui.utils-es.js';
|
|
19
|
+
import '../../scrollEdges-es.js';
|
|
20
20
|
import '../../clamp-es.js';
|
|
@@ -17,9 +17,9 @@ require('../../floating-ui.utils.dom-cjs.js');
|
|
|
17
17
|
require('react-dom');
|
|
18
18
|
require('../../useLabelableId-cjs.js');
|
|
19
19
|
require('../../useCompositeListItem-cjs.js');
|
|
20
|
-
require('../../
|
|
21
|
-
require('../../index.esm-cjs.js');
|
|
20
|
+
require('../../useScrollLock-cjs.js');
|
|
22
21
|
require('react/jsx-runtime');
|
|
22
|
+
require('../../floating-ui.utils-cjs.js');
|
|
23
23
|
require('../../floating-ui.react-dom-cjs.js');
|
|
24
24
|
require('../../resolveAriaLabelledBy-cjs.js');
|
|
25
25
|
require('../../useLabel-cjs.js');
|
|
@@ -15,9 +15,9 @@ import '../../floating-ui.utils.dom-es.js';
|
|
|
15
15
|
import 'react-dom';
|
|
16
16
|
import '../../useLabelableId-es.js';
|
|
17
17
|
import '../../useCompositeListItem-es.js';
|
|
18
|
-
import '../../
|
|
19
|
-
import '../../index.esm-es.js';
|
|
18
|
+
import '../../useScrollLock-es.js';
|
|
20
19
|
import 'react/jsx-runtime';
|
|
20
|
+
import '../../floating-ui.utils-es.js';
|
|
21
21
|
import '../../floating-ui.react-dom-es.js';
|
|
22
22
|
import '../../resolveAriaLabelledBy-es.js';
|
|
23
23
|
import '../../useLabel-es.js';
|
|
@@ -13,16 +13,16 @@ require('../../SelectGroupLabel-cjs.js');
|
|
|
13
13
|
require('../../useButton-cjs.js');
|
|
14
14
|
require('../../floating-ui.utils.dom-cjs.js');
|
|
15
15
|
require('react-dom');
|
|
16
|
-
require('../../
|
|
17
|
-
require('../../index.esm-cjs.js');
|
|
16
|
+
require('../../useScrollLock-cjs.js');
|
|
18
17
|
require('react/jsx-runtime');
|
|
18
|
+
require('../../floating-ui.utils-cjs.js');
|
|
19
|
+
require('../../isElementDisabled-cjs.js');
|
|
19
20
|
require('../../useLabelableId-cjs.js');
|
|
20
21
|
require('../../resolveAriaLabelledBy-cjs.js');
|
|
22
|
+
require('../../scrollEdges-cjs.js');
|
|
23
|
+
require('../../clamp-cjs.js');
|
|
21
24
|
require('../../useCompositeListItem-cjs.js');
|
|
22
25
|
require('../../floating-ui.react-dom-cjs.js');
|
|
23
|
-
require('../../CSPContext-cjs.js');
|
|
24
|
-
require('../../ToolbarRootContext-cjs.js');
|
|
25
|
-
require('../../clamp-cjs.js');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
@@ -11,13 +11,13 @@ import '../../SelectGroupLabel-es.js';
|
|
|
11
11
|
import '../../useButton-es.js';
|
|
12
12
|
import '../../floating-ui.utils.dom-es.js';
|
|
13
13
|
import 'react-dom';
|
|
14
|
-
import '../../
|
|
15
|
-
import '../../index.esm-es.js';
|
|
14
|
+
import '../../useScrollLock-es.js';
|
|
16
15
|
import 'react/jsx-runtime';
|
|
16
|
+
import '../../floating-ui.utils-es.js';
|
|
17
|
+
import '../../isElementDisabled-es.js';
|
|
17
18
|
import '../../useLabelableId-es.js';
|
|
18
19
|
import '../../resolveAriaLabelledBy-es.js';
|
|
20
|
+
import '../../scrollEdges-es.js';
|
|
21
|
+
import '../../clamp-es.js';
|
|
19
22
|
import '../../useCompositeListItem-es.js';
|
|
20
23
|
import '../../floating-ui.react-dom-es.js';
|
|
21
|
-
import '../../CSPContext-es.js';
|
|
22
|
-
import '../../ToolbarRootContext-es.js';
|
|
23
|
-
import '../../clamp-es.js';
|
|
@@ -18,13 +18,13 @@ require('../Icon-cjs.js');
|
|
|
18
18
|
require('@jobber/design');
|
|
19
19
|
require('../Typography-cjs.js');
|
|
20
20
|
require('../ScrollAreaViewport-cjs.js');
|
|
21
|
-
require('../
|
|
22
|
-
require('../index.esm-cjs.js');
|
|
21
|
+
require('../useScrollLock-cjs.js');
|
|
23
22
|
require('../floating-ui.utils.dom-cjs.js');
|
|
24
23
|
require('../useButton-cjs.js');
|
|
25
24
|
require('react-dom');
|
|
26
25
|
require('react/jsx-runtime');
|
|
27
|
-
require('../
|
|
26
|
+
require('../floating-ui.utils-cjs.js');
|
|
27
|
+
require('../scrollEdges-cjs.js');
|
|
28
28
|
require('../clamp-cjs.js');
|
|
29
29
|
require('../Text-cjs.js');
|
|
30
30
|
require('../ComboboxChipRemove-cjs.js');
|
|
@@ -36,7 +36,7 @@ require('../useLabel-cjs.js');
|
|
|
36
36
|
require('../ActivityIndicator-cjs.js');
|
|
37
37
|
require('../NumberFieldInput-cjs.js');
|
|
38
38
|
require('../SelectGroupLabel-cjs.js');
|
|
39
|
-
require('../
|
|
39
|
+
require('../isElementDisabled-cjs.js');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
@@ -16,13 +16,13 @@ import '../Icon-es.js';
|
|
|
16
16
|
import '@jobber/design';
|
|
17
17
|
import '../Typography-es.js';
|
|
18
18
|
import '../ScrollAreaViewport-es.js';
|
|
19
|
-
import '../
|
|
20
|
-
import '../index.esm-es.js';
|
|
19
|
+
import '../useScrollLock-es.js';
|
|
21
20
|
import '../floating-ui.utils.dom-es.js';
|
|
22
21
|
import '../useButton-es.js';
|
|
23
22
|
import 'react-dom';
|
|
24
23
|
import 'react/jsx-runtime';
|
|
25
|
-
import '../
|
|
24
|
+
import '../floating-ui.utils-es.js';
|
|
25
|
+
import '../scrollEdges-es.js';
|
|
26
26
|
import '../clamp-es.js';
|
|
27
27
|
import '../Text-es.js';
|
|
28
28
|
import '../ComboboxChipRemove-es.js';
|
|
@@ -34,4 +34,4 @@ import '../useLabel-es.js';
|
|
|
34
34
|
import '../ActivityIndicator-es.js';
|
|
35
35
|
import '../NumberFieldInput-es.js';
|
|
36
36
|
import '../SelectGroupLabel-es.js';
|
|
37
|
-
import '../
|
|
37
|
+
import '../isElementDisabled-es.js';
|
|
@@ -173,6 +173,10 @@ function resolveMultipleLabels(values, items, itemToStringLabel) {
|
|
|
173
173
|
}, []);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
|
|
177
|
+
return array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index]));
|
|
178
|
+
}
|
|
179
|
+
|
|
176
180
|
function getDefaultLabelId(id) {
|
|
177
181
|
return id == null ? undefined : `${id}-label`;
|
|
178
182
|
}
|
|
@@ -180,6 +184,7 @@ function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
|
|
|
180
184
|
return fieldLabelId ?? localLabelId;
|
|
181
185
|
}
|
|
182
186
|
|
|
187
|
+
exports.areArraysEqual = areArraysEqual;
|
|
183
188
|
exports.compareItemEquality = compareItemEquality;
|
|
184
189
|
exports.defaultItemEquality = defaultItemEquality;
|
|
185
190
|
exports.findItemIndex = findItemIndex;
|
|
@@ -152,6 +152,10 @@ function resolveMultipleLabels(values, items, itemToStringLabel) {
|
|
|
152
152
|
}, []);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
|
|
156
|
+
return array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index]));
|
|
157
|
+
}
|
|
158
|
+
|
|
155
159
|
function getDefaultLabelId(id) {
|
|
156
160
|
return id == null ? undefined : `${id}-label`;
|
|
157
161
|
}
|
|
@@ -159,4 +163,4 @@ function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
|
|
|
159
163
|
return fieldLabelId ?? localLabelId;
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
export {
|
|
166
|
+
export { stringifyAsLabel as a, areArraysEqual as b, compareItemEquality as c, defaultItemEquality as d, resolveMultipleLabels as e, findItemIndex as f, resolveSelectedLabel as g, hasNullItemLabel as h, selectedValueIncludes as i, removeItem as j, isGroupedItems as k, getDefaultLabelId as l, resolveAriaLabelledBy as r, stringifyAsValue as s };
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var clamp = require('./clamp-cjs.js');
|
|
5
6
|
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
var n = Object.create(null);
|
|
@@ -31,8 +32,7 @@ const END = 'End';
|
|
|
31
32
|
const HORIZONTAL_KEYS = new Set([ARROW_LEFT, ARROW_RIGHT]);
|
|
32
33
|
const VERTICAL_KEYS = new Set([ARROW_UP, ARROW_DOWN]);
|
|
33
34
|
const ARROW_KEYS = new Set([...HORIZONTAL_KEYS, ...VERTICAL_KEYS]);
|
|
34
|
-
new Set([...ARROW_KEYS, HOME, END]);
|
|
35
|
-
const COMPOSITE_KEYS = new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]);
|
|
35
|
+
const COMPOSITE_KEYS = new Set([...ARROW_KEYS, HOME, END]);
|
|
36
36
|
|
|
37
37
|
const DISABLE_SCROLLBAR_CLASS_NAME = 'base-ui-disable-scrollbar';
|
|
38
38
|
const styleDisableScrollbar = {
|
|
@@ -64,6 +64,34 @@ function useCSPContext() {
|
|
|
64
64
|
return React__namespace.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
const SCROLL_EDGE_TOLERANCE_PX = 1;
|
|
68
|
+
function getMaxScrollOffset(scrollSize, clientSize) {
|
|
69
|
+
return Math.max(0, scrollSize - clientSize);
|
|
70
|
+
}
|
|
71
|
+
function normalizeScrollOffset(value, max) {
|
|
72
|
+
if (max <= 0) {
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
const clamped = clamp.clamp(value, 0, max);
|
|
76
|
+
const startDistance = clamped;
|
|
77
|
+
const endDistance = max - clamped;
|
|
78
|
+
const withinStartTolerance = startDistance <= SCROLL_EDGE_TOLERANCE_PX;
|
|
79
|
+
const withinEndTolerance = endDistance <= SCROLL_EDGE_TOLERANCE_PX;
|
|
80
|
+
if (withinStartTolerance && withinEndTolerance) {
|
|
81
|
+
return startDistance <= endDistance ? 0 : max;
|
|
82
|
+
}
|
|
83
|
+
if (withinStartTolerance) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
if (withinEndTolerance) {
|
|
87
|
+
return max;
|
|
88
|
+
}
|
|
89
|
+
return clamped;
|
|
90
|
+
}
|
|
91
|
+
|
|
67
92
|
exports.COMPOSITE_KEYS = COMPOSITE_KEYS;
|
|
93
|
+
exports.SCROLL_EDGE_TOLERANCE_PX = SCROLL_EDGE_TOLERANCE_PX;
|
|
94
|
+
exports.getMaxScrollOffset = getMaxScrollOffset;
|
|
95
|
+
exports.normalizeScrollOffset = normalizeScrollOffset;
|
|
68
96
|
exports.styleDisableScrollbar = styleDisableScrollbar;
|
|
69
97
|
exports.useCSPContext = useCSPContext;
|