@getflip/swirl-components 0.49.2 → 0.50.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.
- package/components.json +109 -1
- package/dist/cjs/{floating-ui.dom.esm-35943202.js → floating-ui.dom.esm-39236b6a.js} +130 -117
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-autocomplete.cjs.entry.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-icon-lock-person.cjs.entry.js +23 -0
- package/dist/cjs/swirl-icon-unlock-person.cjs.entry.js +23 -0
- package/dist/cjs/swirl-popover.cjs.entry.js +1 -1
- package/dist/cjs/swirl-tooltip.cjs.entry.js +1 -1
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +22 -0
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/swirl-icon/icons/swirl-icon-lock-person.js +52 -0
- package/dist/collection/components/swirl-icon/icons/swirl-icon-unlock-person.js +52 -0
- package/dist/components/assets/pdfjs/pdf.worker.min.js +22 -0
- package/dist/components/floating-ui.dom.esm.js +130 -117
- package/dist/components/swirl-icon-lock-person.d.ts +11 -0
- package/dist/components/swirl-icon-lock-person.js +40 -0
- package/dist/components/swirl-icon-unlock-person.d.ts +11 -0
- package/dist/components/swirl-icon-unlock-person.js +40 -0
- package/dist/esm/{floating-ui.dom.esm-b9f28f6d.js → floating-ui.dom.esm-ac7cc24e.js} +130 -117
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-autocomplete.entry.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-icon-lock-person.entry.js +19 -0
- package/dist/esm/swirl-icon-unlock-person.entry.js +19 -0
- package/dist/esm/swirl-popover.entry.js +1 -1
- package/dist/esm/swirl-tooltip.entry.js +1 -1
- package/dist/swirl-components/{p-b76df929.entry.js → p-063afb09.entry.js} +1 -1
- package/dist/swirl-components/p-3c9f6731.entry.js +1 -0
- package/dist/swirl-components/p-530a0003.entry.js +1 -0
- package/dist/swirl-components/{p-5526e2c9.entry.js → p-dc67a056.entry.js} +1 -1
- package/dist/swirl-components/{p-13376409.entry.js → p-dec381b9.entry.js} +1 -1
- package/dist/swirl-components/p-ecb8b7f5.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-icon/icons/swirl-icon-lock-person.d.ts +5 -0
- package/dist/types/components/swirl-icon/icons/swirl-icon-unlock-person.d.ts +5 -0
- package/dist/types/components.d.ts +30 -0
- package/package.json +3 -3
- package/vscode-data.json +26 -0
- package/dist/swirl-components/p-6526bf3e.js +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function getSide(placement) {
|
|
2
|
-
return placement.split('-')[0];
|
|
3
|
-
}
|
|
4
|
-
|
|
5
1
|
function getAlignment(placement) {
|
|
6
2
|
return placement.split('-')[1];
|
|
7
3
|
}
|
|
8
4
|
|
|
9
|
-
function getMainAxisFromPlacement(placement) {
|
|
10
|
-
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
5
|
function getLengthFromAxis(axis) {
|
|
14
6
|
return axis === 'y' ? 'height' : 'width';
|
|
15
7
|
}
|
|
16
8
|
|
|
9
|
+
function getSide(placement) {
|
|
10
|
+
return placement.split('-')[0];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getMainAxisFromPlacement(placement) {
|
|
14
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
17
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
18
18
|
let {
|
|
19
19
|
reference,
|
|
@@ -27,7 +27,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
27
27
|
const side = getSide(placement);
|
|
28
28
|
const isVertical = mainAxis === 'x';
|
|
29
29
|
let coords;
|
|
30
|
-
|
|
31
30
|
switch (side) {
|
|
32
31
|
case 'top':
|
|
33
32
|
coords = {
|
|
@@ -35,45 +34,38 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
35
34
|
y: reference.y - floating.height
|
|
36
35
|
};
|
|
37
36
|
break;
|
|
38
|
-
|
|
39
37
|
case 'bottom':
|
|
40
38
|
coords = {
|
|
41
39
|
x: commonX,
|
|
42
40
|
y: reference.y + reference.height
|
|
43
41
|
};
|
|
44
42
|
break;
|
|
45
|
-
|
|
46
43
|
case 'right':
|
|
47
44
|
coords = {
|
|
48
45
|
x: reference.x + reference.width,
|
|
49
46
|
y: commonY
|
|
50
47
|
};
|
|
51
48
|
break;
|
|
52
|
-
|
|
53
49
|
case 'left':
|
|
54
50
|
coords = {
|
|
55
51
|
x: reference.x - floating.width,
|
|
56
52
|
y: commonY
|
|
57
53
|
};
|
|
58
54
|
break;
|
|
59
|
-
|
|
60
55
|
default:
|
|
61
56
|
coords = {
|
|
62
57
|
x: reference.x,
|
|
63
58
|
y: reference.y
|
|
64
59
|
};
|
|
65
60
|
}
|
|
66
|
-
|
|
67
61
|
switch (getAlignment(placement)) {
|
|
68
62
|
case 'start':
|
|
69
63
|
coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
70
64
|
break;
|
|
71
|
-
|
|
72
65
|
case 'end':
|
|
73
66
|
coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
74
67
|
break;
|
|
75
68
|
}
|
|
76
|
-
|
|
77
69
|
return coords;
|
|
78
70
|
}
|
|
79
71
|
|
|
@@ -84,7 +76,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
84
76
|
* This export does not have any `platform` interface logic. You will need to
|
|
85
77
|
* write one for the platform you are using Floating UI with.
|
|
86
78
|
*/
|
|
87
|
-
|
|
88
79
|
const computePosition$1 = async (reference, floating, config) => {
|
|
89
80
|
const {
|
|
90
81
|
placement = 'bottom',
|
|
@@ -92,8 +83,8 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
92
83
|
middleware = [],
|
|
93
84
|
platform
|
|
94
85
|
} = config;
|
|
86
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
95
87
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
96
|
-
|
|
97
88
|
let rects = await platform.getElementRects({
|
|
98
89
|
reference,
|
|
99
90
|
floating,
|
|
@@ -106,12 +97,11 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
106
97
|
let statefulPlacement = placement;
|
|
107
98
|
let middlewareData = {};
|
|
108
99
|
let resetCount = 0;
|
|
109
|
-
|
|
110
|
-
for (let i = 0; i < middleware.length; i++) {
|
|
100
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
111
101
|
const {
|
|
112
102
|
name,
|
|
113
103
|
fn
|
|
114
|
-
} =
|
|
104
|
+
} = validMiddleware[i];
|
|
115
105
|
const {
|
|
116
106
|
x: nextX,
|
|
117
107
|
y: nextY,
|
|
@@ -133,20 +123,19 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
133
123
|
});
|
|
134
124
|
x = nextX != null ? nextX : x;
|
|
135
125
|
y = nextY != null ? nextY : y;
|
|
136
|
-
middlewareData = {
|
|
137
|
-
|
|
126
|
+
middlewareData = {
|
|
127
|
+
...middlewareData,
|
|
128
|
+
[name]: {
|
|
129
|
+
...middlewareData[name],
|
|
138
130
|
...data
|
|
139
131
|
}
|
|
140
132
|
};
|
|
141
|
-
|
|
142
133
|
if (reset && resetCount <= 50) {
|
|
143
134
|
resetCount++;
|
|
144
|
-
|
|
145
135
|
if (typeof reset === 'object') {
|
|
146
136
|
if (reset.placement) {
|
|
147
137
|
statefulPlacement = reset.placement;
|
|
148
138
|
}
|
|
149
|
-
|
|
150
139
|
if (reset.rects) {
|
|
151
140
|
rects = reset.rects === true ? await platform.getElementRects({
|
|
152
141
|
reference,
|
|
@@ -154,18 +143,15 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
154
143
|
strategy
|
|
155
144
|
}) : reset.rects;
|
|
156
145
|
}
|
|
157
|
-
|
|
158
146
|
({
|
|
159
147
|
x,
|
|
160
148
|
y
|
|
161
149
|
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
162
150
|
}
|
|
163
|
-
|
|
164
151
|
i = -1;
|
|
165
152
|
continue;
|
|
166
153
|
}
|
|
167
154
|
}
|
|
168
|
-
|
|
169
155
|
return {
|
|
170
156
|
x,
|
|
171
157
|
y,
|
|
@@ -195,7 +181,8 @@ function getSideObjectFromPadding(padding) {
|
|
|
195
181
|
}
|
|
196
182
|
|
|
197
183
|
function rectToClientRect(rect) {
|
|
198
|
-
return {
|
|
184
|
+
return {
|
|
185
|
+
...rect,
|
|
199
186
|
top: rect.y,
|
|
200
187
|
left: rect.x,
|
|
201
188
|
right: rect.x + rect.width,
|
|
@@ -205,19 +192,17 @@ function rectToClientRect(rect) {
|
|
|
205
192
|
|
|
206
193
|
/**
|
|
207
194
|
* Resolves with an object of overflow side offsets that determine how much the
|
|
208
|
-
* element is overflowing a given clipping boundary.
|
|
195
|
+
* element is overflowing a given clipping boundary on each side.
|
|
209
196
|
* - positive = overflowing the boundary by that number of pixels
|
|
210
197
|
* - negative = how many pixels left before it will overflow
|
|
211
198
|
* - 0 = lies flush with the boundary
|
|
212
199
|
* @see https://floating-ui.com/docs/detectOverflow
|
|
213
200
|
*/
|
|
214
|
-
async function detectOverflow(
|
|
201
|
+
async function detectOverflow(state, options) {
|
|
215
202
|
var _await$platform$isEle;
|
|
216
|
-
|
|
217
203
|
if (options === void 0) {
|
|
218
204
|
options = {};
|
|
219
205
|
}
|
|
220
|
-
|
|
221
206
|
const {
|
|
222
207
|
x,
|
|
223
208
|
y,
|
|
@@ -225,7 +210,7 @@ async function detectOverflow(middlewareArguments, options) {
|
|
|
225
210
|
rects,
|
|
226
211
|
elements,
|
|
227
212
|
strategy
|
|
228
|
-
} =
|
|
213
|
+
} = state;
|
|
229
214
|
const {
|
|
230
215
|
boundary = 'clippingAncestors',
|
|
231
216
|
rootBoundary = 'viewport',
|
|
@@ -242,19 +227,29 @@ async function detectOverflow(middlewareArguments, options) {
|
|
|
242
227
|
rootBoundary,
|
|
243
228
|
strategy
|
|
244
229
|
}));
|
|
230
|
+
const rect = elementContext === 'floating' ? {
|
|
231
|
+
...rects.floating,
|
|
232
|
+
x,
|
|
233
|
+
y
|
|
234
|
+
} : rects.reference;
|
|
235
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
236
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
237
|
+
x: 1,
|
|
238
|
+
y: 1
|
|
239
|
+
} : {
|
|
240
|
+
x: 1,
|
|
241
|
+
y: 1
|
|
242
|
+
};
|
|
245
243
|
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
246
|
-
rect
|
|
247
|
-
|
|
248
|
-
y
|
|
249
|
-
} : rects.reference,
|
|
250
|
-
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
244
|
+
rect,
|
|
245
|
+
offsetParent,
|
|
251
246
|
strategy
|
|
252
|
-
}) :
|
|
247
|
+
}) : rect);
|
|
253
248
|
return {
|
|
254
|
-
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
255
|
-
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
256
|
-
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
257
|
-
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
249
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
250
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
251
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
252
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
258
253
|
};
|
|
259
254
|
}
|
|
260
255
|
|
|
@@ -265,42 +260,39 @@ function within(min$1$1, value, max$1$1) {
|
|
|
265
260
|
return max$1(min$1$1, min$1(value, max$1$1));
|
|
266
261
|
}
|
|
267
262
|
|
|
268
|
-
const
|
|
263
|
+
const oppositeSideMap = {
|
|
269
264
|
left: 'right',
|
|
270
265
|
right: 'left',
|
|
271
266
|
bottom: 'top',
|
|
272
267
|
top: 'bottom'
|
|
273
268
|
};
|
|
274
269
|
function getOppositePlacement(placement) {
|
|
275
|
-
return placement.replace(/left|right|bottom|top/g,
|
|
270
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
276
271
|
}
|
|
277
272
|
|
|
278
273
|
function getAlignmentSides(placement, rects, rtl) {
|
|
279
274
|
if (rtl === void 0) {
|
|
280
275
|
rtl = false;
|
|
281
276
|
}
|
|
282
|
-
|
|
283
277
|
const alignment = getAlignment(placement);
|
|
284
278
|
const mainAxis = getMainAxisFromPlacement(placement);
|
|
285
279
|
const length = getLengthFromAxis(mainAxis);
|
|
286
280
|
let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
287
|
-
|
|
288
281
|
if (rects.reference[length] > rects.floating[length]) {
|
|
289
282
|
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
290
283
|
}
|
|
291
|
-
|
|
292
284
|
return {
|
|
293
285
|
main: mainAlignmentSide,
|
|
294
286
|
cross: getOppositePlacement(mainAlignmentSide)
|
|
295
287
|
};
|
|
296
288
|
}
|
|
297
289
|
|
|
298
|
-
const
|
|
290
|
+
const oppositeAlignmentMap = {
|
|
299
291
|
start: 'end',
|
|
300
292
|
end: 'start'
|
|
301
293
|
};
|
|
302
294
|
function getOppositeAlignmentPlacement(placement) {
|
|
303
|
-
return placement.replace(/start|end/g,
|
|
295
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
304
296
|
}
|
|
305
297
|
|
|
306
298
|
function getExpandedPlacements(placement) {
|
|
@@ -308,23 +300,50 @@ function getExpandedPlacements(placement) {
|
|
|
308
300
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
309
301
|
}
|
|
310
302
|
|
|
303
|
+
function getSideList(side, isStart, rtl) {
|
|
304
|
+
const lr = ['left', 'right'];
|
|
305
|
+
const rl = ['right', 'left'];
|
|
306
|
+
const tb = ['top', 'bottom'];
|
|
307
|
+
const bt = ['bottom', 'top'];
|
|
308
|
+
switch (side) {
|
|
309
|
+
case 'top':
|
|
310
|
+
case 'bottom':
|
|
311
|
+
if (rtl) return isStart ? rl : lr;
|
|
312
|
+
return isStart ? lr : rl;
|
|
313
|
+
case 'left':
|
|
314
|
+
case 'right':
|
|
315
|
+
return isStart ? tb : bt;
|
|
316
|
+
default:
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
321
|
+
const alignment = getAlignment(placement);
|
|
322
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
323
|
+
if (alignment) {
|
|
324
|
+
list = list.map(side => side + "-" + alignment);
|
|
325
|
+
if (flipAlignment) {
|
|
326
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return list;
|
|
330
|
+
}
|
|
331
|
+
|
|
311
332
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
333
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
334
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
335
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
314
336
|
* @see https://floating-ui.com/docs/flip
|
|
315
337
|
*/
|
|
316
338
|
const flip = function (options) {
|
|
317
339
|
if (options === void 0) {
|
|
318
340
|
options = {};
|
|
319
341
|
}
|
|
320
|
-
|
|
321
342
|
return {
|
|
322
343
|
name: 'flip',
|
|
323
344
|
options,
|
|
324
|
-
|
|
325
|
-
async fn(middlewareArguments) {
|
|
345
|
+
async fn(state) {
|
|
326
346
|
var _middlewareData$flip;
|
|
327
|
-
|
|
328
347
|
const {
|
|
329
348
|
placement,
|
|
330
349
|
middlewareData,
|
|
@@ -332,48 +351,49 @@ const flip = function (options) {
|
|
|
332
351
|
initialPlacement,
|
|
333
352
|
platform,
|
|
334
353
|
elements
|
|
335
|
-
} =
|
|
354
|
+
} = state;
|
|
336
355
|
const {
|
|
337
356
|
mainAxis: checkMainAxis = true,
|
|
338
357
|
crossAxis: checkCrossAxis = true,
|
|
339
358
|
fallbackPlacements: specifiedFallbackPlacements,
|
|
340
359
|
fallbackStrategy = 'bestFit',
|
|
360
|
+
fallbackAxisSideDirection = 'none',
|
|
341
361
|
flipAlignment = true,
|
|
342
362
|
...detectOverflowOptions
|
|
343
363
|
} = options;
|
|
344
364
|
const side = getSide(placement);
|
|
345
|
-
const isBasePlacement =
|
|
365
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
366
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
346
367
|
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
368
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
|
|
369
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
370
|
+
}
|
|
347
371
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
348
|
-
const overflow = await detectOverflow(
|
|
372
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
349
373
|
const overflows = [];
|
|
350
374
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
351
|
-
|
|
352
375
|
if (checkMainAxis) {
|
|
353
376
|
overflows.push(overflow[side]);
|
|
354
377
|
}
|
|
355
|
-
|
|
356
378
|
if (checkCrossAxis) {
|
|
357
379
|
const {
|
|
358
380
|
main,
|
|
359
381
|
cross
|
|
360
|
-
} = getAlignmentSides(placement, rects,
|
|
382
|
+
} = getAlignmentSides(placement, rects, rtl);
|
|
361
383
|
overflows.push(overflow[main], overflow[cross]);
|
|
362
384
|
}
|
|
363
|
-
|
|
364
385
|
overflowsData = [...overflowsData, {
|
|
365
386
|
placement,
|
|
366
387
|
overflows
|
|
367
|
-
}];
|
|
388
|
+
}];
|
|
368
389
|
|
|
390
|
+
// One or more sides is overflowing.
|
|
369
391
|
if (!overflows.every(side => side <= 0)) {
|
|
370
|
-
var _middlewareData$
|
|
371
|
-
|
|
372
|
-
const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
|
|
392
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
393
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
373
394
|
const nextPlacement = placements[nextIndex];
|
|
374
|
-
|
|
375
395
|
if (nextPlacement) {
|
|
376
|
-
// Try next placement and re-run the lifecycle
|
|
396
|
+
// Try next placement and re-run the lifecycle.
|
|
377
397
|
return {
|
|
378
398
|
data: {
|
|
379
399
|
index: nextIndex,
|
|
@@ -385,27 +405,27 @@ const flip = function (options) {
|
|
|
385
405
|
};
|
|
386
406
|
}
|
|
387
407
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
408
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
409
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
410
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
411
|
+
|
|
412
|
+
// Otherwise fallback.
|
|
413
|
+
if (!resetPlacement) {
|
|
414
|
+
switch (fallbackStrategy) {
|
|
415
|
+
case 'bestFit':
|
|
416
|
+
{
|
|
417
|
+
var _overflowsData$map$so;
|
|
418
|
+
const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
|
|
419
|
+
if (placement) {
|
|
420
|
+
resetPlacement = placement;
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
399
423
|
}
|
|
400
|
-
|
|
424
|
+
case 'initialPlacement':
|
|
425
|
+
resetPlacement = initialPlacement;
|
|
401
426
|
break;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
case 'initialPlacement':
|
|
405
|
-
resetPlacement = initialPlacement;
|
|
406
|
-
break;
|
|
427
|
+
}
|
|
407
428
|
}
|
|
408
|
-
|
|
409
429
|
if (placement !== resetPlacement) {
|
|
410
430
|
return {
|
|
411
431
|
reset: {
|
|
@@ -414,27 +434,26 @@ const flip = function (options) {
|
|
|
414
434
|
};
|
|
415
435
|
}
|
|
416
436
|
}
|
|
417
|
-
|
|
418
437
|
return {};
|
|
419
438
|
}
|
|
420
|
-
|
|
421
439
|
};
|
|
422
440
|
};
|
|
423
441
|
|
|
424
|
-
async function convertValueToCoords(
|
|
442
|
+
async function convertValueToCoords(state, value) {
|
|
425
443
|
const {
|
|
426
444
|
placement,
|
|
427
445
|
platform,
|
|
428
446
|
elements
|
|
429
|
-
} =
|
|
447
|
+
} = state;
|
|
430
448
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
431
449
|
const side = getSide(placement);
|
|
432
450
|
const alignment = getAlignment(placement);
|
|
433
451
|
const isVertical = getMainAxisFromPlacement(placement) === 'x';
|
|
434
452
|
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
435
453
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
436
|
-
const rawValue = typeof value === 'function' ? value(
|
|
454
|
+
const rawValue = typeof value === 'function' ? value(state) : value;
|
|
437
455
|
|
|
456
|
+
// eslint-disable-next-line prefer-const
|
|
438
457
|
let {
|
|
439
458
|
mainAxis,
|
|
440
459
|
crossAxis,
|
|
@@ -449,11 +468,9 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
449
468
|
alignmentAxis: null,
|
|
450
469
|
...rawValue
|
|
451
470
|
};
|
|
452
|
-
|
|
453
471
|
if (alignment && typeof alignmentAxis === 'number') {
|
|
454
472
|
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
455
473
|
}
|
|
456
|
-
|
|
457
474
|
return isVertical ? {
|
|
458
475
|
x: crossAxis * crossAxisMulti,
|
|
459
476
|
y: mainAxis * mainAxisMulti
|
|
@@ -462,33 +479,33 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
462
479
|
y: crossAxis * crossAxisMulti
|
|
463
480
|
};
|
|
464
481
|
}
|
|
482
|
+
|
|
465
483
|
/**
|
|
466
|
-
*
|
|
484
|
+
* Modifies the placement by translating the floating element along the
|
|
485
|
+
* specified axes.
|
|
486
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
487
|
+
* object may be passed.
|
|
467
488
|
* @see https://floating-ui.com/docs/offset
|
|
468
489
|
*/
|
|
469
|
-
|
|
470
490
|
const offset = function (value) {
|
|
471
491
|
if (value === void 0) {
|
|
472
492
|
value = 0;
|
|
473
493
|
}
|
|
474
|
-
|
|
475
494
|
return {
|
|
476
495
|
name: 'offset',
|
|
477
496
|
options: value,
|
|
478
|
-
|
|
479
|
-
async fn(middlewareArguments) {
|
|
497
|
+
async fn(state) {
|
|
480
498
|
const {
|
|
481
499
|
x,
|
|
482
500
|
y
|
|
483
|
-
} =
|
|
484
|
-
const diffCoords = await convertValueToCoords(
|
|
501
|
+
} = state;
|
|
502
|
+
const diffCoords = await convertValueToCoords(state, value);
|
|
485
503
|
return {
|
|
486
504
|
x: x + diffCoords.x,
|
|
487
505
|
y: y + diffCoords.y,
|
|
488
506
|
data: diffCoords
|
|
489
507
|
};
|
|
490
508
|
}
|
|
491
|
-
|
|
492
509
|
};
|
|
493
510
|
};
|
|
494
511
|
|
|
@@ -497,25 +514,23 @@ function getCrossAxis(axis) {
|
|
|
497
514
|
}
|
|
498
515
|
|
|
499
516
|
/**
|
|
500
|
-
*
|
|
501
|
-
*
|
|
517
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
518
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
502
519
|
* @see https://floating-ui.com/docs/shift
|
|
503
520
|
*/
|
|
504
521
|
const shift = function (options) {
|
|
505
522
|
if (options === void 0) {
|
|
506
523
|
options = {};
|
|
507
524
|
}
|
|
508
|
-
|
|
509
525
|
return {
|
|
510
526
|
name: 'shift',
|
|
511
527
|
options,
|
|
512
|
-
|
|
513
|
-
async fn(middlewareArguments) {
|
|
528
|
+
async fn(state) {
|
|
514
529
|
const {
|
|
515
530
|
x,
|
|
516
531
|
y,
|
|
517
532
|
placement
|
|
518
|
-
} =
|
|
533
|
+
} = state;
|
|
519
534
|
const {
|
|
520
535
|
mainAxis: checkMainAxis = true,
|
|
521
536
|
crossAxis: checkCrossAxis = false,
|
|
@@ -537,12 +552,11 @@ const shift = function (options) {
|
|
|
537
552
|
x,
|
|
538
553
|
y
|
|
539
554
|
};
|
|
540
|
-
const overflow = await detectOverflow(
|
|
555
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
541
556
|
const mainAxis = getMainAxisFromPlacement(getSide(placement));
|
|
542
557
|
const crossAxis = getCrossAxis(mainAxis);
|
|
543
558
|
let mainAxisCoord = coords[mainAxis];
|
|
544
559
|
let crossAxisCoord = coords[crossAxis];
|
|
545
|
-
|
|
546
560
|
if (checkMainAxis) {
|
|
547
561
|
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
548
562
|
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
@@ -550,7 +564,6 @@ const shift = function (options) {
|
|
|
550
564
|
const max = mainAxisCoord - overflow[maxSide];
|
|
551
565
|
mainAxisCoord = within(min, mainAxisCoord, max);
|
|
552
566
|
}
|
|
553
|
-
|
|
554
567
|
if (checkCrossAxis) {
|
|
555
568
|
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
556
569
|
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
@@ -558,19 +571,19 @@ const shift = function (options) {
|
|
|
558
571
|
const max = crossAxisCoord - overflow[maxSide];
|
|
559
572
|
crossAxisCoord = within(min, crossAxisCoord, max);
|
|
560
573
|
}
|
|
561
|
-
|
|
562
|
-
|
|
574
|
+
const limitedCoords = limiter.fn({
|
|
575
|
+
...state,
|
|
563
576
|
[mainAxis]: mainAxisCoord,
|
|
564
577
|
[crossAxis]: crossAxisCoord
|
|
565
578
|
});
|
|
566
|
-
return {
|
|
579
|
+
return {
|
|
580
|
+
...limitedCoords,
|
|
567
581
|
data: {
|
|
568
582
|
x: limitedCoords.x - x,
|
|
569
583
|
y: limitedCoords.y - y
|
|
570
584
|
}
|
|
571
585
|
};
|
|
572
586
|
}
|
|
573
|
-
|
|
574
587
|
};
|
|
575
588
|
};
|
|
576
589
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SwirlIconLockPerson extends Components.SwirlIconLockPerson, HTMLElement {}
|
|
4
|
+
export const SwirlIconLockPerson: {
|
|
5
|
+
prototype: SwirlIconLockPerson;
|
|
6
|
+
new (): SwirlIconLockPerson;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Fragment } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
|
|
4
|
+
const swirlIconCss = ":host{display:inline-flex}";
|
|
5
|
+
|
|
6
|
+
const SwirlIconLockPerson$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.size = 24;
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const viewBoxSize = this.size === 20 ? 24 : this.size;
|
|
15
|
+
const className = classnames("swirl-icon", `swirl-icon--size-${this.size}`);
|
|
16
|
+
return (h("svg", { class: className, fill: "none", height: this.size, part: "icon", viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`, width: this.size, xmlns: "http://www.w3.org/2000/svg" }, this.size === 16 && (h(Fragment, null, h("path", { d: "M12 11.9998C12.2777 11.9998 12.5138 11.9026 12.7083 11.7082C12.9027 11.5137 13 11.2776 13 10.9998C13 10.7221 12.9027 10.4859 12.7083 10.2915C12.5138 10.0971 12.2777 9.99984 12 9.99984C11.7222 9.99984 11.4861 10.0971 11.2916 10.2915C11.0972 10.4859 11 10.7221 11 10.9998C11 11.2776 11.0972 11.5137 11.2916 11.7082C11.4861 11.9026 11.7222 11.9998 12 11.9998ZM12 13.9998C12.3333 13.9998 12.6444 13.9221 12.9333 13.7665C13.2222 13.6109 13.4611 13.3943 13.65 13.1165C13.3944 12.9609 13.1277 12.8471 12.85 12.7748C12.5722 12.7026 12.2888 12.6665 12 12.6665C11.7111 12.6665 11.4277 12.7026 11.15 12.7748C10.8722 12.8471 10.6055 12.9609 10.35 13.1165C10.5388 13.3943 10.7777 13.6109 11.0666 13.7665C11.3555 13.9221 11.6666 13.9998 12 13.9998ZM5.99996 5.33317H9.99996V3.99984C9.99996 3.44428 9.80552 2.97206 9.41663 2.58317C9.02774 2.19428 8.55552 1.99984 7.99996 1.99984C7.4444 1.99984 6.97218 2.19428 6.58329 2.58317C6.1944 2.97206 5.99996 3.44428 5.99996 3.99984V5.33317ZM8.16663 14.6665H3.99996C3.63329 14.6665 3.3194 14.5359 3.05829 14.2748C2.79718 14.0137 2.66663 13.6998 2.66663 13.3332V6.6665C2.66663 6.29984 2.79718 5.98595 3.05829 5.72484C3.3194 5.46373 3.63329 5.33317 3.99996 5.33317H4.66663V3.99984C4.66663 3.07762 4.99163 2.2915 5.64163 1.6415C6.29163 0.991504 7.07774 0.666504 7.99996 0.666504C8.92218 0.666504 9.70829 0.991504 10.3583 1.6415C11.0083 2.2915 11.3333 3.07762 11.3333 3.99984V5.33317H12C12.3666 5.33317 12.6805 5.46373 12.9416 5.72484C13.2027 5.98595 13.3333 6.29984 13.3333 6.6665V7.53317C13.1333 7.4665 12.925 7.4165 12.7083 7.38317C12.4916 7.34984 12.2555 7.33317 12 7.33317V6.6665H3.99996V13.3332H7.53329C7.62218 13.5998 7.71107 13.8304 7.79996 14.0248C7.88885 14.2193 8.01107 14.4332 8.16663 14.6665ZM12 15.3332C11.0777 15.3332 10.2916 15.0082 9.64163 14.3582C8.99163 13.7082 8.66663 12.9221 8.66663 11.9998C8.66663 11.0776 8.99163 10.2915 9.64163 9.6415C10.2916 8.9915 11.0777 8.6665 12 8.6665C12.9222 8.6665 13.7083 8.9915 14.3583 9.6415C15.0083 10.2915 15.3333 11.0776 15.3333 11.9998C15.3333 12.9221 15.0083 13.7082 14.3583 14.3582C13.7083 15.0082 12.9222 15.3332 12 15.3332Z", fill: "currentColor" }))), (this.size === 20 || this.size === 24) && (h(Fragment, null, h("path", { d: "M18 18C18.4167 18 18.7708 17.8542 19.0625 17.5625C19.3542 17.2708 19.5 16.9167 19.5 16.5C19.5 16.0833 19.3542 15.7292 19.0625 15.4375C18.7708 15.1458 18.4167 15 18 15C17.5833 15 17.2292 15.1458 16.9375 15.4375C16.6458 15.7292 16.5 16.0833 16.5 16.5C16.5 16.9167 16.6458 17.2708 16.9375 17.5625C17.2292 17.8542 17.5833 18 18 18ZM18 21C18.5 21 18.9667 20.8833 19.4 20.65C19.8333 20.4167 20.1917 20.0917 20.475 19.675C20.0917 19.4417 19.6917 19.2708 19.275 19.1625C18.8583 19.0542 18.4333 19 18 19C17.5667 19 17.1417 19.0542 16.725 19.1625C16.3083 19.2708 15.9083 19.4417 15.525 19.675C15.8083 20.0917 16.1667 20.4167 16.6 20.65C17.0333 20.8833 17.5 21 18 21ZM9 8H15V6C15 5.16667 14.7083 4.45833 14.125 3.875C13.5417 3.29167 12.8333 3 12 3C11.1667 3 10.4583 3.29167 9.875 3.875C9.29167 4.45833 9 5.16667 9 6V8ZM12.25 22H6C5.45 22 4.97917 21.8042 4.5875 21.4125C4.19583 21.0208 4 20.55 4 20V10C4 9.45 4.19583 8.97917 4.5875 8.5875C4.97917 8.19583 5.45 8 6 8H7V6C7 4.61667 7.4875 3.4375 8.4625 2.4625C9.4375 1.4875 10.6167 1 12 1C13.3833 1 14.5625 1.4875 15.5375 2.4625C16.5125 3.4375 17 4.61667 17 6V8H18C18.55 8 19.0208 8.19583 19.4125 8.5875C19.8042 8.97917 20 9.45 20 10V11.3C19.7 11.2 19.3875 11.125 19.0625 11.075C18.7375 11.025 18.3833 11 18 11V10H6V20H11.3C11.4333 20.4 11.5667 20.7458 11.7 21.0375C11.8333 21.3292 12.0167 21.65 12.25 22ZM18 23C16.6167 23 15.4375 22.5125 14.4625 21.5375C13.4875 20.5625 13 19.3833 13 18C13 16.6167 13.4875 15.4375 14.4625 14.4625C15.4375 13.4875 16.6167 13 18 13C19.3833 13 20.5625 13.4875 21.5375 14.4625C22.5125 15.4375 23 16.6167 23 18C23 19.3833 22.5125 20.5625 21.5375 21.5375C20.5625 22.5125 19.3833 23 18 23Z", fill: "currentColor" }))), this.size === 28 && (h(Fragment, null, h("path", { d: "M21 20.9998C21.4861 20.9998 21.8993 20.8297 22.2395 20.4894C22.5798 20.1491 22.75 19.7359 22.75 19.2498C22.75 18.7637 22.5798 18.3505 22.2395 18.0103C21.8993 17.67 21.4861 17.4998 21 17.4998C20.5138 17.4998 20.1007 17.67 19.7604 18.0103C19.4201 18.3505 19.25 18.7637 19.25 19.2498C19.25 19.7359 19.4201 20.1491 19.7604 20.4894C20.1007 20.8297 20.5138 20.9998 21 20.9998ZM21 24.4998C21.5833 24.4998 22.1277 24.3637 22.6333 24.0915C23.1388 23.8193 23.5569 23.4401 23.8875 22.954C23.4402 22.6818 22.9736 22.4825 22.4875 22.3561C22.0013 22.2297 21.5055 22.1665 21 22.1665C20.4944 22.1665 19.9986 22.2297 19.5125 22.3561C19.0263 22.4825 18.5597 22.6818 18.1125 22.954C18.443 23.4401 18.8611 23.8193 19.3666 24.0915C19.8722 24.3637 20.4166 24.4998 21 24.4998ZM10.5 9.33317H17.5V6.99984C17.5 6.02761 17.1597 5.20123 16.4791 4.52067C15.7986 3.84011 14.9722 3.49984 14 3.49984C13.0277 3.49984 12.2013 3.84011 11.5208 4.52067C10.8402 5.20123 10.5 6.02761 10.5 6.99984V9.33317ZM14.2916 25.6665H6.99996C6.35829 25.6665 5.80899 25.438 5.35204 24.9811C4.8951 24.5241 4.66663 23.9748 4.66663 23.3332V11.6665C4.66663 11.0248 4.8951 10.4755 5.35204 10.0186C5.80899 9.56164 6.35829 9.33317 6.99996 9.33317H8.16663V6.99984C8.16663 5.38595 8.73538 4.01025 9.87288 2.87275C11.0104 1.73525 12.3861 1.1665 14 1.1665C15.6138 1.1665 16.9895 1.73525 18.127 2.87275C19.2645 4.01025 19.8333 5.38595 19.8333 6.99984V9.33317H21C21.6416 9.33317 22.1909 9.56164 22.6479 10.0186C23.1048 10.4755 23.3333 11.0248 23.3333 11.6665V13.1832C22.9833 13.0665 22.6187 12.979 22.2395 12.9207C21.8604 12.8623 21.4472 12.8332 21 12.8332V11.6665H6.99996V23.3332H13.1833C13.3388 23.7998 13.4944 24.2033 13.65 24.5436C13.8055 24.8839 14.0194 25.2582 14.2916 25.6665ZM21 26.8332C19.3861 26.8332 18.0104 26.2644 16.8729 25.1269C15.7354 23.9894 15.1666 22.6137 15.1666 20.9998C15.1666 19.3859 15.7354 18.0103 16.8729 16.8728C18.0104 15.7353 19.3861 15.1665 21 15.1665C22.6138 15.1665 23.9895 15.7353 25.127 16.8728C26.2645 18.0103 26.8333 19.3859 26.8333 20.9998C26.8333 22.6137 26.2645 23.9894 25.127 25.1269C23.9895 26.2644 22.6138 26.8332 21 26.8332Z", fill: "currentColor" })))));
|
|
17
|
+
}
|
|
18
|
+
static get style() { return swirlIconCss; }
|
|
19
|
+
}, [1, "swirl-icon-lock-person", {
|
|
20
|
+
"size": [2]
|
|
21
|
+
}]);
|
|
22
|
+
function defineCustomElement$1() {
|
|
23
|
+
if (typeof customElements === "undefined") {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const components = ["swirl-icon-lock-person"];
|
|
27
|
+
components.forEach(tagName => { switch (tagName) {
|
|
28
|
+
case "swirl-icon-lock-person":
|
|
29
|
+
if (!customElements.get(tagName)) {
|
|
30
|
+
customElements.define(tagName, SwirlIconLockPerson$1);
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
} });
|
|
34
|
+
}
|
|
35
|
+
defineCustomElement$1();
|
|
36
|
+
|
|
37
|
+
const SwirlIconLockPerson = SwirlIconLockPerson$1;
|
|
38
|
+
const defineCustomElement = defineCustomElement$1;
|
|
39
|
+
|
|
40
|
+
export { SwirlIconLockPerson, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SwirlIconUnlockPerson extends Components.SwirlIconUnlockPerson, HTMLElement {}
|
|
4
|
+
export const SwirlIconUnlockPerson: {
|
|
5
|
+
prototype: SwirlIconUnlockPerson;
|
|
6
|
+
new (): SwirlIconUnlockPerson;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|