@haiilo/catalyst 10.5.0 → 10.7.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/dist/catalyst/catalyst.css +2 -2
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.esm.js +1 -1
- package/dist/catalyst/{p-54544546.js → p-2c8ac8cf.js} +1 -1
- package/dist/catalyst/p-2c8ac8cf.js.map +1 -0
- package/dist/catalyst/p-b2ec6eb3.entry.js +10 -0
- package/dist/catalyst/p-b2ec6eb3.entry.js.map +1 -0
- package/dist/catalyst/scss/_variables.scss +0 -1
- package/dist/catalyst/scss/core/_form.scss +2 -2
- package/dist/cjs/cat-alert_29.cjs.entry.js +125 -49
- package/dist/cjs/cat-alert_29.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{of-8163b41f.js → of-f2844da8.js} +2 -2
- package/dist/cjs/of-f2844da8.js.map +1 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +2 -1
- package/dist/collection/components/cat-date/cat-date.js +41 -1
- package/dist/collection/components/cat-date/cat-date.js.map +1 -1
- package/dist/collection/components/cat-date-inline/cat-date-inline.js +1 -1
- package/dist/collection/components/cat-date-inline/cat-date-inline.js.map +1 -1
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +25 -2
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.css +1 -1
- package/dist/collection/components/cat-select/cat-select.js +5 -5
- package/dist/collection/components/cat-time/cat-time-locale.js +3 -0
- package/dist/collection/components/cat-time/cat-time-locale.js.map +1 -1
- package/dist/collection/components/cat-time/cat-time.js +36 -8
- package/dist/collection/components/cat-time/cat-time.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.css +1 -1
- package/dist/collection/scss/_variables.scss +0 -1
- package/dist/collection/scss/core/_form.scss +2 -2
- package/dist/components/cat-checkbox2.js +1 -1
- package/dist/components/cat-checkbox2.js.map +1 -1
- package/dist/components/cat-date-inline2.js +1 -1
- package/dist/components/cat-date-inline2.js.map +1 -1
- package/dist/components/cat-date.js +39 -1
- package/dist/components/cat-date.js.map +1 -1
- package/dist/components/cat-dropdown2.js +8 -2
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-radio.js +1 -1
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable2.js +5 -3
- package/dist/components/cat-scrollable2.js.map +1 -1
- package/dist/components/cat-select-demo.js +2 -2
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-time.js +37 -8
- package/dist/components/cat-time.js.map +1 -1
- package/dist/components/cat-toggle.js +1 -1
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js +38 -30
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/components/from.js +1 -1
- package/dist/components/from.js.map +1 -1
- package/dist/components/of.js.map +1 -1
- package/dist/esm/cat-alert_29.entry.js +125 -49
- package/dist/esm/cat-alert_29.entry.js.map +1 -1
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{of-f4b9a3ca.js → of-53334b95.js} +2 -2
- package/dist/esm/of-53334b95.js.map +1 -0
- package/dist/types/components/cat-date/cat-date.d.ts +3 -0
- package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +5 -0
- package/dist/types/components/cat-time/cat-time-locale.d.ts +1 -0
- package/dist/types/components/cat-time/cat-time.d.ts +3 -1
- package/dist/types/components.d.ts +8 -0
- package/package.json +2 -2
- package/dist/catalyst/p-54544546.js.map +0 -1
- package/dist/catalyst/p-66b41008.entry.js +0 -10
- package/dist/catalyst/p-66b41008.entry.js.map +0 -1
- package/dist/cjs/of-8163b41f.js.map +0 -1
- package/dist/esm/of-f4b9a3ca.js.map +0 -1
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
cat-date,
|
|
16
16
|
cat-time
|
|
17
17
|
):not(:last-child) {
|
|
18
|
-
margin-bottom: calc(
|
|
18
|
+
margin-bottom: calc(1rem * var(--cat-form-spacer, 1));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
cat-radio:not(:last-child) {
|
|
22
|
-
margin-bottom: 0.
|
|
22
|
+
margin-bottom: 0.75rem;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-13aff0b4.js');
|
|
6
|
-
const of = require('./of-
|
|
6
|
+
const of = require('./of-f2844da8.js');
|
|
7
7
|
|
|
8
8
|
const ObjectUnsubscribedError = of.createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
|
|
9
9
|
_super(this);
|
|
@@ -179,6 +179,7 @@ class AsyncAction extends Action {
|
|
|
179
179
|
this.pending = false;
|
|
180
180
|
}
|
|
181
181
|
schedule(state, delay = 0) {
|
|
182
|
+
var _a;
|
|
182
183
|
if (this.closed) {
|
|
183
184
|
return this;
|
|
184
185
|
}
|
|
@@ -190,7 +191,7 @@ class AsyncAction extends Action {
|
|
|
190
191
|
}
|
|
191
192
|
this.pending = true;
|
|
192
193
|
this.delay = delay;
|
|
193
|
-
this.id = this.id
|
|
194
|
+
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
|
|
194
195
|
return this;
|
|
195
196
|
}
|
|
196
197
|
requestAsyncId(scheduler, _id, delay = 0) {
|
|
@@ -200,7 +201,9 @@ class AsyncAction extends Action {
|
|
|
200
201
|
if (delay != null && this.delay === delay && this.pending === false) {
|
|
201
202
|
return id;
|
|
202
203
|
}
|
|
203
|
-
|
|
204
|
+
if (id != null) {
|
|
205
|
+
intervalProvider.clearInterval(id);
|
|
206
|
+
}
|
|
204
207
|
return undefined;
|
|
205
208
|
}
|
|
206
209
|
execute(state, delay) {
|
|
@@ -263,7 +266,6 @@ class AsyncScheduler extends Scheduler {
|
|
|
263
266
|
super(SchedulerAction, now);
|
|
264
267
|
this.actions = [];
|
|
265
268
|
this._active = false;
|
|
266
|
-
this._scheduled = undefined;
|
|
267
269
|
}
|
|
268
270
|
flush(action) {
|
|
269
271
|
const { actions } = this;
|
|
@@ -653,7 +655,7 @@ function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
|
653
655
|
if (subscriptionDelay) {
|
|
654
656
|
return (source) => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
655
657
|
}
|
|
656
|
-
return mergeMap((value, index) => delayDurationSelector(value, index).pipe(take(1), mapTo(value)));
|
|
658
|
+
return mergeMap((value, index) => of.innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));
|
|
657
659
|
}
|
|
658
660
|
|
|
659
661
|
function delay$1(due, scheduler = asyncScheduler) {
|
|
@@ -1265,7 +1267,7 @@ const CatFormHint = props => {
|
|
|
1265
1267
|
]));
|
|
1266
1268
|
};
|
|
1267
1269
|
|
|
1268
|
-
const catCheckboxCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}:host{display:flex;flex-direction:column;gap:0.
|
|
1270
|
+
const catCheckboxCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}:host{display:flex;flex-direction:column;gap:0.25rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;position:relative}.label-left{flex-direction:row-reverse}.label-left input{right:1px;left:unset}input{position:absolute;width:1.25rem;height:1.25rem;margin:0;opacity:0;cursor:inherit;left:1px;top:0.5px}.box-placeholder{width:calc(1.25rem + 2px);flex-shrink:0}.box{flex:0 0 auto;display:flex;position:relative;height:1.25rem;width:1.25rem;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:var(--cat-border-radius-s, 0.125rem);transition:background-color 125ms ease, border-color 125ms ease;pointer-events:none;box-sizing:border-box}.box svg{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all 125ms ease;width:50%;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.99)}:checked+.box{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-color:rgb(var(--cat-primary-bg, 0, 129, 148));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:checked+.box .check{stroke-dashoffset:0}:indeterminate+.box{background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-color:rgb(var(--cat-primary-bg, 0, 129, 148));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:indeterminate+.box .check{stroke-dashoffset:16px}:indeterminate+.box .dash{stroke-dashoffset:0}:focus-visible+.box{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.is-disabled .box{background-color:#f2f4f7;border-color:rgb(var(--cat-border-color-dark, 215, 219, 224));stroke:rgb(var(--cat-font-color-muted, 81, 92, 108))}:host(.cat-error) .box{border:1px solid rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) :checked+.box,:host(.cat-error) :indeterminate+.box{background-color:rgb(var(--cat-danger-bg, 217, 52, 13));border-color:rgb(var(--cat-danger-bg, 217, 52, 13));stroke:rgb(var(--cat-danger-fill, 255, 255, 255))}.label{flex:1 1 auto;min-width:0}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
|
|
1269
1271
|
const CatCheckboxStyle0 = catCheckboxCss;
|
|
1270
1272
|
|
|
1271
1273
|
let nextUniqueId$8 = 0;
|
|
@@ -1488,6 +1490,16 @@ const CatDate = class {
|
|
|
1488
1490
|
this.nativeAttributes = undefined;
|
|
1489
1491
|
this.placement = 'bottom-end';
|
|
1490
1492
|
}
|
|
1493
|
+
onMinChanged(min, oldMin) {
|
|
1494
|
+
if (min !== oldMin) {
|
|
1495
|
+
this.reclamp('min', min);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
onMaxChanged(max, oldMax) {
|
|
1499
|
+
if (max !== oldMax) {
|
|
1500
|
+
this.reclamp('max', max);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1491
1503
|
get inputValue() {
|
|
1492
1504
|
const [match, year, month, day] = this.value?.match(/^(\d{4})-(\d{2})-(\d{2})/) ?? [];
|
|
1493
1505
|
if (match) {
|
|
@@ -1536,7 +1548,13 @@ const CatDate = class {
|
|
|
1536
1548
|
this.input?.clear();
|
|
1537
1549
|
}
|
|
1538
1550
|
render() {
|
|
1539
|
-
return (index.h(index.Host, { key: '
|
|
1551
|
+
return (index.h(index.Host, { key: 'd588c96f031fc8ab9518d13dfaac730a0d424caa' }, index.h("cat-input", { key: 'f49f0682e2f2fe3dfcd89477bda91fe46ed44dfa', class: "cat-date-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, value: this.inputValue, onCatFocus: e => {
|
|
1552
|
+
e.stopPropagation();
|
|
1553
|
+
this.catFocus.emit(e.detail);
|
|
1554
|
+
}, onCatBlur: e => {
|
|
1555
|
+
e.stopPropagation();
|
|
1556
|
+
this.onInputBlur(e.detail);
|
|
1557
|
+
} }, index.h("span", { key: '68ef0708d25128b9a52d60c5b1a7b34e0ffb2ef1', slot: "label" }, this.label, index.h("span", { key: 'ac017335567a4e0059631e7535455d52f61f2e43', class: "label-aria" }, " (", this.locale.formatStr, ")")), index.h("cat-dropdown", { key: '16a6e95f6e4f6a9b0ddd7716f0b713c8fac3fdff', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, index.h("cat-button", { key: 'cf7f2aaa2c5775b23f3e8826e9b0e722c4ce8be6', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), index.h("div", { key: 'f90eef976a3102855801df5ffeee770d45e7eaba', slot: "content" }, index.h("cat-date-inline", { key: '853b3adee0ea8f9c9b2a1276a10fcaa299044b42', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
|
|
1540
1558
|
}
|
|
1541
1559
|
getTriggerA11yLabel() {
|
|
1542
1560
|
const date = this.locale.fromLocalISO(this.value);
|
|
@@ -1565,6 +1583,7 @@ const CatDate = class {
|
|
|
1565
1583
|
this.catBlur.emit(e);
|
|
1566
1584
|
}
|
|
1567
1585
|
onDateChange(e) {
|
|
1586
|
+
e.stopPropagation();
|
|
1568
1587
|
const oldValue = this.value;
|
|
1569
1588
|
const date = e.detail ? new Date(e.detail) : null;
|
|
1570
1589
|
this.value = date ? this.locale.toLocalISO(date) : undefined;
|
|
@@ -1587,7 +1606,25 @@ const CatDate = class {
|
|
|
1587
1606
|
}
|
|
1588
1607
|
return new Date(year, month - 1, day);
|
|
1589
1608
|
}
|
|
1609
|
+
reclamp(mode, limit) {
|
|
1610
|
+
const oldValue = this.value;
|
|
1611
|
+
const oldDate = this.locale.fromLocalISO(oldValue);
|
|
1612
|
+
const limitDate = this.locale.fromLocalISO(limit);
|
|
1613
|
+
if (!oldDate || !limitDate) {
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
const newDate = clampDate(mode === 'min' ? limitDate : null, oldDate, mode === 'max' ? limitDate : null);
|
|
1617
|
+
const newValue = this.locale.toLocalISO(newDate);
|
|
1618
|
+
if (oldValue !== newValue) {
|
|
1619
|
+
this.value = newValue;
|
|
1620
|
+
this.catChange.emit(newValue);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1590
1623
|
get hostElement() { return index.getElement(this); }
|
|
1624
|
+
static get watchers() { return {
|
|
1625
|
+
"min": ["onMinChanged"],
|
|
1626
|
+
"max": ["onMaxChanged"]
|
|
1627
|
+
}; }
|
|
1591
1628
|
};
|
|
1592
1629
|
CatDate.style = CatDateStyle0;
|
|
1593
1630
|
|
|
@@ -1631,7 +1668,7 @@ const CatDateInline = class {
|
|
|
1631
1668
|
if (this.focusDate) {
|
|
1632
1669
|
// re-focus the previously focused date after re-render
|
|
1633
1670
|
this.hostElement.shadowRoot
|
|
1634
|
-
?.querySelector(`[data-date="${this.locale.
|
|
1671
|
+
?.querySelector(`[data-date="${this.locale.toLocalISO(this.focusDate)}"]`)
|
|
1635
1672
|
?.doFocus();
|
|
1636
1673
|
this.focusDate = null;
|
|
1637
1674
|
}
|
|
@@ -4633,8 +4670,18 @@ function getLocale$1(language) {
|
|
|
4633
4670
|
};
|
|
4634
4671
|
}
|
|
4635
4672
|
|
|
4636
|
-
|
|
4637
|
-
|
|
4673
|
+
/**
|
|
4674
|
+
* Custom positioning reference element.
|
|
4675
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
4676
|
+
*/
|
|
4677
|
+
const min = Math.min;
|
|
4678
|
+
const max = Math.max;
|
|
4679
|
+
const round = Math.round;
|
|
4680
|
+
const floor = Math.floor;
|
|
4681
|
+
const createCoords = v => ({
|
|
4682
|
+
x: v,
|
|
4683
|
+
y: v
|
|
4684
|
+
});
|
|
4638
4685
|
const oppositeSideMap = {
|
|
4639
4686
|
left: 'right',
|
|
4640
4687
|
right: 'left',
|
|
@@ -4646,7 +4693,7 @@ const oppositeAlignmentMap = {
|
|
|
4646
4693
|
end: 'start'
|
|
4647
4694
|
};
|
|
4648
4695
|
function clamp(start, value, end) {
|
|
4649
|
-
return max
|
|
4696
|
+
return max(start, min(value, end));
|
|
4650
4697
|
}
|
|
4651
4698
|
function evaluate(value, param) {
|
|
4652
4699
|
return typeof value === 'function' ? value(param) : value;
|
|
@@ -4805,7 +4852,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
4805
4852
|
|
|
4806
4853
|
/**
|
|
4807
4854
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
4808
|
-
* next to a reference element
|
|
4855
|
+
* next to a given reference element.
|
|
4809
4856
|
*
|
|
4810
4857
|
* This export does not have any `platform` interface logic. You will need to
|
|
4811
4858
|
* write one for the platform you are using Floating UI with.
|
|
@@ -4883,7 +4930,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
4883
4930
|
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
4884
4931
|
}
|
|
4885
4932
|
i = -1;
|
|
4886
|
-
continue;
|
|
4887
4933
|
}
|
|
4888
4934
|
}
|
|
4889
4935
|
return {
|
|
@@ -4946,6 +4992,7 @@ async function detectOverflow(state, options) {
|
|
|
4946
4992
|
y: 1
|
|
4947
4993
|
};
|
|
4948
4994
|
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4995
|
+
elements,
|
|
4949
4996
|
rect,
|
|
4950
4997
|
offsetParent,
|
|
4951
4998
|
strategy
|
|
@@ -5075,6 +5122,7 @@ const flip$1 = function (options) {
|
|
|
5075
5122
|
|
|
5076
5123
|
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
5077
5124
|
// Derivable.
|
|
5125
|
+
|
|
5078
5126
|
async function convertValueToCoords(state, options) {
|
|
5079
5127
|
const {
|
|
5080
5128
|
placement,
|
|
@@ -5088,8 +5136,6 @@ async function convertValueToCoords(state, options) {
|
|
|
5088
5136
|
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
5089
5137
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
5090
5138
|
const rawValue = evaluate(options, state);
|
|
5091
|
-
|
|
5092
|
-
// eslint-disable-next-line prefer-const
|
|
5093
5139
|
let {
|
|
5094
5140
|
mainAxis,
|
|
5095
5141
|
crossAxis,
|
|
@@ -5131,15 +5177,27 @@ const offset = function (options) {
|
|
|
5131
5177
|
name: 'offset',
|
|
5132
5178
|
options,
|
|
5133
5179
|
async fn(state) {
|
|
5180
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
5134
5181
|
const {
|
|
5135
5182
|
x,
|
|
5136
|
-
y
|
|
5183
|
+
y,
|
|
5184
|
+
placement,
|
|
5185
|
+
middlewareData
|
|
5137
5186
|
} = state;
|
|
5138
5187
|
const diffCoords = await convertValueToCoords(state, options);
|
|
5188
|
+
|
|
5189
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
5190
|
+
// then we don't need to change the positioning coordinates.
|
|
5191
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
5192
|
+
return {};
|
|
5193
|
+
}
|
|
5139
5194
|
return {
|
|
5140
5195
|
x: x + diffCoords.x,
|
|
5141
5196
|
y: y + diffCoords.y,
|
|
5142
|
-
data:
|
|
5197
|
+
data: {
|
|
5198
|
+
...diffCoords,
|
|
5199
|
+
placement
|
|
5200
|
+
}
|
|
5143
5201
|
};
|
|
5144
5202
|
}
|
|
5145
5203
|
};
|
|
@@ -5267,20 +5325,20 @@ const size$1 = function (options) {
|
|
|
5267
5325
|
let availableWidth = overflowAvailableWidth;
|
|
5268
5326
|
if (isYAxis) {
|
|
5269
5327
|
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
5270
|
-
availableWidth = alignment || noShift ? min
|
|
5328
|
+
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
5271
5329
|
} else {
|
|
5272
5330
|
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
5273
|
-
availableHeight = alignment || noShift ? min
|
|
5331
|
+
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
5274
5332
|
}
|
|
5275
5333
|
if (noShift && !alignment) {
|
|
5276
|
-
const xMin = max
|
|
5277
|
-
const xMax = max
|
|
5278
|
-
const yMin = max
|
|
5279
|
-
const yMax = max
|
|
5334
|
+
const xMin = max(overflow.left, 0);
|
|
5335
|
+
const xMax = max(overflow.right, 0);
|
|
5336
|
+
const yMin = max(overflow.top, 0);
|
|
5337
|
+
const yMax = max(overflow.bottom, 0);
|
|
5280
5338
|
if (isYAxis) {
|
|
5281
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max
|
|
5339
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
5282
5340
|
} else {
|
|
5283
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max
|
|
5341
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
5284
5342
|
}
|
|
5285
5343
|
}
|
|
5286
5344
|
await apply({
|
|
@@ -5301,19 +5359,6 @@ const size$1 = function (options) {
|
|
|
5301
5359
|
};
|
|
5302
5360
|
};
|
|
5303
5361
|
|
|
5304
|
-
/**
|
|
5305
|
-
* Custom positioning reference element.
|
|
5306
|
-
* @see https://floating-ui.com/docs/virtual-elements
|
|
5307
|
-
*/
|
|
5308
|
-
const min = Math.min;
|
|
5309
|
-
const max = Math.max;
|
|
5310
|
-
const round = Math.round;
|
|
5311
|
-
const floor = Math.floor;
|
|
5312
|
-
const createCoords = v => ({
|
|
5313
|
-
x: v,
|
|
5314
|
-
y: v
|
|
5315
|
-
});
|
|
5316
|
-
|
|
5317
5362
|
function getNodeName(node) {
|
|
5318
5363
|
if (isNode(node)) {
|
|
5319
5364
|
return (node.nodeName || '').toLowerCase();
|
|
@@ -7856,6 +7901,7 @@ const CatDropdown = class {
|
|
|
7856
7901
|
this.arrowNavigation = 'vertical';
|
|
7857
7902
|
this.noResize = false;
|
|
7858
7903
|
this.overflow = false;
|
|
7904
|
+
this.noInitialFocus = false;
|
|
7859
7905
|
}
|
|
7860
7906
|
clickHandler(event) {
|
|
7861
7907
|
// we need to delay the initialization of the trigger until first
|
|
@@ -7887,6 +7933,9 @@ const CatDropdown = class {
|
|
|
7887
7933
|
* Opens the dropdown.
|
|
7888
7934
|
*/
|
|
7889
7935
|
async open() {
|
|
7936
|
+
if (!this.trigger) {
|
|
7937
|
+
this.initTrigger();
|
|
7938
|
+
}
|
|
7890
7939
|
if (this.isOpen === null || this.isOpen) {
|
|
7891
7940
|
return; // busy or open
|
|
7892
7941
|
}
|
|
@@ -7927,7 +7976,8 @@ const CatDropdown = class {
|
|
|
7927
7976
|
return true;
|
|
7928
7977
|
}
|
|
7929
7978
|
return event.key === 'Tab' && event.shiftKey;
|
|
7930
|
-
}
|
|
7979
|
+
},
|
|
7980
|
+
initialFocus: () => (this.noInitialFocus ? false : undefined)
|
|
7931
7981
|
});
|
|
7932
7982
|
this.trap.activate();
|
|
7933
7983
|
});
|
|
@@ -7952,7 +8002,7 @@ const CatDropdown = class {
|
|
|
7952
8002
|
}, timeTransitionS);
|
|
7953
8003
|
}
|
|
7954
8004
|
render() {
|
|
7955
|
-
return (index.h(index.Host, { key: '
|
|
8005
|
+
return (index.h(index.Host, { key: '6cde42e7f7bfc2df858b7179157a1f52e0c23e0e' }, index.h("slot", { key: '91633464f448a8142f52b6e1e62420974a929e84', name: "trigger", ref: el => (this.triggerSlot = el) }), index.h("div", { key: '2ed9bd2dcc58b83ec1e7781959456e67d9397c48', id: this.contentId, class: { content: true, 'overflow-auto': !this.overflow }, ref: el => (this.content = el) }, index.h("slot", { key: 'a91710cd8455cb006f60e48dd49aee7f6d114877', name: "content" }))));
|
|
7956
8006
|
}
|
|
7957
8007
|
get contentId() {
|
|
7958
8008
|
return `cat-dropdown-${this.id}`;
|
|
@@ -9895,7 +9945,7 @@ const CatPagination = class {
|
|
|
9895
9945
|
};
|
|
9896
9946
|
CatPagination.style = CatPaginationStyle0;
|
|
9897
9947
|
|
|
9898
|
-
const catRadioCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}:host{display:flex;flex-direction:column;gap:0.
|
|
9948
|
+
const catRadioCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}:host{display:flex;flex-direction:column;gap:0.25rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);cursor:pointer}.label-left{flex-direction:row-reverse}.radio{display:flex;position:relative;align-self:flex-start}.circle-placeholder{width:calc(1.25rem + 1px);flex-shrink:0}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 0, 129, 148));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden;pointer-events:none}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 0, 129, 148))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host(.cat-error) input{border-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) .circle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}.is-disabled input{background-color:#f2f4f7}.is-disabled input:checked{border-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}.is-disabled .circle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}";
|
|
9899
9949
|
const CatRadioStyle0 = catRadioCss;
|
|
9900
9950
|
|
|
9901
9951
|
let nextUniqueId$5 = 0;
|
|
@@ -12660,6 +12710,9 @@ function getLocale(language) {
|
|
|
12660
12710
|
timeFormat: getHour12(language) ? '12' : '24'
|
|
12661
12711
|
};
|
|
12662
12712
|
}
|
|
12713
|
+
function formatIso(date) {
|
|
12714
|
+
return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
|
|
12715
|
+
}
|
|
12663
12716
|
|
|
12664
12717
|
function clampTime(min, date, max) {
|
|
12665
12718
|
const [, hhMin, mmMin] = min?.match(/(\d{2}):(\d{2})/)?.map(Number) ?? [];
|
|
@@ -12730,6 +12783,16 @@ const CatTime = class {
|
|
|
12730
12783
|
this.placement = 'bottom-end';
|
|
12731
12784
|
this.step = 30;
|
|
12732
12785
|
}
|
|
12786
|
+
onMinChanged(min, oldMin) {
|
|
12787
|
+
if (min !== oldMin) {
|
|
12788
|
+
this.reclamp('min', min);
|
|
12789
|
+
}
|
|
12790
|
+
}
|
|
12791
|
+
onMaxChanged(max, oldMax) {
|
|
12792
|
+
if (max !== oldMax) {
|
|
12793
|
+
this.reclamp('max', max);
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12733
12796
|
componentWillLoad() {
|
|
12734
12797
|
this.syncValue(this.value ?? '');
|
|
12735
12798
|
}
|
|
@@ -12747,9 +12810,9 @@ const CatTime = class {
|
|
|
12747
12810
|
onOpen() {
|
|
12748
12811
|
const query = (selector) => this.hostElement.shadowRoot?.querySelector(selector);
|
|
12749
12812
|
const time = clampTime(this.min ?? null, this.selectionTime ?? new Date(2000, 5, 1, 8), this.max ?? null);
|
|
12750
|
-
const elem1 = query(`[data-time="${
|
|
12813
|
+
const elem1 = query(`[data-time="${formatIso(time)}"]`);
|
|
12751
12814
|
time.setMinutes(Math.floor(time.getMinutes() / this.step) * this.step);
|
|
12752
|
-
const elem2 = query(`[data-time="${
|
|
12815
|
+
const elem2 = query(`[data-time="${formatIso(time)}"]`);
|
|
12753
12816
|
setTimeout(() => {
|
|
12754
12817
|
(elem2 ?? elem1)?.doFocus();
|
|
12755
12818
|
(elem2 ?? elem1)?.scrollIntoView(this.selectionTime ? { block: 'center' } : undefined);
|
|
@@ -12770,7 +12833,7 @@ const CatTime = class {
|
|
|
12770
12833
|
const time = clampTime(this.min ?? null, date, this.max ?? null);
|
|
12771
12834
|
this.isAm = this.format(time).toLowerCase().includes('am');
|
|
12772
12835
|
this.selectionTime = time;
|
|
12773
|
-
this.value =
|
|
12836
|
+
this.value = formatIso(time);
|
|
12774
12837
|
}
|
|
12775
12838
|
// we need to set the input explicitly to sync the input even without a
|
|
12776
12839
|
// rerender (if the value is not changed)
|
|
@@ -12805,8 +12868,8 @@ const CatTime = class {
|
|
|
12805
12868
|
this.input?.clear();
|
|
12806
12869
|
}
|
|
12807
12870
|
render() {
|
|
12808
|
-
return (index.h(index.Host, { key: '
|
|
12809
|
-
const isoTime =
|
|
12871
|
+
return (index.h(index.Host, { key: 'c7ebe7c00d372720ce9c34907438f47150df0820' }, index.h("cat-input", { key: 'e83d9bddbdff4d1e0c97531f3684618e0f4251a8', class: "cat-time-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, value: this.format(this.selectionTime, false), errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, onCatFocus: e => this.catFocus.emit(e.detail), onCatBlur: e => this.onInputBlur(e.detail) }, index.h("span", { key: '504e24bcf7d7fa3e0eddb7df91261778e720cc87', slot: "label" }, this.hasSlottedLabel && index.h("slot", { name: "label" }), !this.hasSlottedLabel && this.label, index.h("span", { key: 'c617e13394f44bd851beae13e809f791a56dfa42', class: "label-aria" }, " (HH:mm)")), index.h("div", { key: '601bd57b6137a44901a3d32ce10f881aae67a2a8', slot: "addon", class: "cat-time-addon" }, this.locale.timeFormat === '12' && (index.h("cat-button", { class: "cat-time-format", disabled: this.disabled || this.readonly, onCatClick: () => this.toggleAm() }, this.isAm ? 'AM' : 'PM')), index.h("cat-dropdown", { key: 'ecdd2fb5987eb30890c9258ece4bd1e176b2d6c6', slot: "addon", placement: this.placement }, index.h("cat-button", { key: 'a38158d199940ff276b5263833c39cdbea04d194', slot: "trigger", class: "cat-time-toggle", disabled: this.disabled || this.readonly, icon: "$cat:timepicker-clock", iconOnly: true, a11yLabel: this.selectionTime ? `${this.locale.change}, ${this.format(this.selectionTime)}` : this.locale.choose }), index.h("nav", { key: 'e2e77112f74467cc2db37d24f38165389888978a', slot: "content", class: "cat-nav" }, index.h("ul", { key: 'c005ac2b43037f3e5953117e968a967ce60be477' }, this.timeArray().map(time => {
|
|
12872
|
+
const isoTime = formatIso(time);
|
|
12810
12873
|
const disabled = isBefore(time, this.min ?? null) || isAfter(time, this.max ?? null);
|
|
12811
12874
|
return (index.h("li", null, index.h("cat-button", { class: {
|
|
12812
12875
|
'cat-nav-item': true,
|
|
@@ -12855,14 +12918,27 @@ const CatTime = class {
|
|
|
12855
12918
|
: '';
|
|
12856
12919
|
return includeAmPm ? str : str.replace(/\s?(am|pm)/i, '');
|
|
12857
12920
|
}
|
|
12858
|
-
|
|
12859
|
-
|
|
12921
|
+
reclamp(mode, limit) {
|
|
12922
|
+
if (!this.value)
|
|
12923
|
+
return;
|
|
12924
|
+
const min = (mode === 'min' ? limit : this.min) ?? null;
|
|
12925
|
+
const max = (mode === 'max' ? limit : this.max) ?? null;
|
|
12926
|
+
const [match, hh, mm] = this.value.match(/(\d{2}):(\d{2})/) ?? [];
|
|
12927
|
+
const newValue = match ? formatIso(clampTime(min, new Date(2000, 5, 1, Number(hh), Number(mm)), max)) : undefined;
|
|
12928
|
+
if (this.value !== newValue) {
|
|
12929
|
+
this.syncValue(newValue ?? '');
|
|
12930
|
+
this.catChange.emit(newValue);
|
|
12931
|
+
}
|
|
12860
12932
|
}
|
|
12861
12933
|
get hostElement() { return index.getElement(this); }
|
|
12934
|
+
static get watchers() { return {
|
|
12935
|
+
"min": ["onMinChanged"],
|
|
12936
|
+
"max": ["onMaxChanged"]
|
|
12937
|
+
}; }
|
|
12862
12938
|
};
|
|
12863
12939
|
CatTime.style = CatTimeStyle0;
|
|
12864
12940
|
|
|
12865
|
-
const catToggleCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}:host{display:flex;flex-direction:column;gap:0.
|
|
12941
|
+
const catToggleCss = ".hint-wrapper{flex:0 1 auto;display:flex;gap:0.5rem}.hint-section{flex:1 1 auto;display:flex;flex-direction:column;gap:0.25rem;color:rgb(var(--cat-font-color-muted, 81, 92, 108));font-size:0.875rem;line-height:1.125rem}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){margin:0 !important}:host{display:flex;flex-direction:column;gap:0.25rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;font-weight:var(--cat-font-weight-body, 400);-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.label-left{flex-direction:row-reverse}input{position:absolute;margin:0;width:2rem;height:1.25rem;opacity:0;cursor:inherit}.toggle-placeholder{width:calc(2rem + 1px);flex-shrink:0}.toggle{flex:0 0 auto;display:flex;align-items:center;justify-content:center;position:relative;width:2rem;height:1.25rem;border-radius:10rem;background-color:rgb(var(--cat-border-color-dark, 215, 219, 224));transition:background-color 125ms ease;pointer-events:none}:checked+.toggle{background-color:rgb(var(--cat-primary-bg, 0, 129, 148))}:focus-visible+.toggle{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.toggle::after{content:\"\";position:absolute;width:1rem;height:1rem;background:#fff;border-radius:10rem;transform:translateX(calc(2px - 0.5rem));transition:transform 125ms linear;box-shadow:0 1px 2px rgba(27, 31, 38, 0.06), 0 1px 3px rgba(27, 31, 38, 0.1)}:checked+.toggle::after{transform:translateX(calc(-2px + 0.5rem));background:rgb(var(--cat-primary-fill, 255, 255, 255))}.is-disabled .toggle{background-color:rgb(var(--cat-border-color-dark, 215, 219, 224))}:host(.cat-error) .toggle{background-color:rgba(var(--cat-danger-bg, 217, 52, 13), 0.2)}:host(.cat-error) :checked+.toggle{background-color:rgb(var(--cat-danger-bg, 217, 52, 13))}:host(.cat-error) :checked+.toggle::after{background:rgb(var(--cat-danger-fill, 255, 255, 255))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 81, 92, 108))}";
|
|
12866
12942
|
const CatToggleStyle0 = catToggleCss;
|
|
12867
12943
|
|
|
12868
12944
|
let nextUniqueId$1 = 0;
|