@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-ecb4a974.js';
|
|
2
|
-
import { e as createErrorClass, O as Observable, f as errorContext, E as EMPTY_SUBSCRIPTION, S as Subscription, g as arrRemove, h as operate, i as createOperatorSubscriber, j as innerFrom, k as executeSchedule, l as isFunction, m as identity, n as from, p as popScheduler, q as isArrayLike, r as isScheduler, s as popNumber, t as noop, u as log, a as catI18nRegistry, c as commonjsGlobal$1, d as catIconRegistry, o as of } from './of-
|
|
2
|
+
import { e as createErrorClass, O as Observable, f as errorContext, E as EMPTY_SUBSCRIPTION, S as Subscription, g as arrRemove, h as operate, i as createOperatorSubscriber, j as innerFrom, k as executeSchedule, l as isFunction, m as identity, n as from, p as popScheduler, q as isArrayLike, r as isScheduler, s as popNumber, t as noop, u as log, a as catI18nRegistry, c as commonjsGlobal$1, d as catIconRegistry, o as of } from './of-53334b95.js';
|
|
3
3
|
|
|
4
4
|
const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
|
|
5
5
|
_super(this);
|
|
@@ -175,6 +175,7 @@ class AsyncAction extends Action {
|
|
|
175
175
|
this.pending = false;
|
|
176
176
|
}
|
|
177
177
|
schedule(state, delay = 0) {
|
|
178
|
+
var _a;
|
|
178
179
|
if (this.closed) {
|
|
179
180
|
return this;
|
|
180
181
|
}
|
|
@@ -186,7 +187,7 @@ class AsyncAction extends Action {
|
|
|
186
187
|
}
|
|
187
188
|
this.pending = true;
|
|
188
189
|
this.delay = delay;
|
|
189
|
-
this.id = this.id
|
|
190
|
+
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
|
|
190
191
|
return this;
|
|
191
192
|
}
|
|
192
193
|
requestAsyncId(scheduler, _id, delay = 0) {
|
|
@@ -196,7 +197,9 @@ class AsyncAction extends Action {
|
|
|
196
197
|
if (delay != null && this.delay === delay && this.pending === false) {
|
|
197
198
|
return id;
|
|
198
199
|
}
|
|
199
|
-
|
|
200
|
+
if (id != null) {
|
|
201
|
+
intervalProvider.clearInterval(id);
|
|
202
|
+
}
|
|
200
203
|
return undefined;
|
|
201
204
|
}
|
|
202
205
|
execute(state, delay) {
|
|
@@ -259,7 +262,6 @@ class AsyncScheduler extends Scheduler {
|
|
|
259
262
|
super(SchedulerAction, now);
|
|
260
263
|
this.actions = [];
|
|
261
264
|
this._active = false;
|
|
262
|
-
this._scheduled = undefined;
|
|
263
265
|
}
|
|
264
266
|
flush(action) {
|
|
265
267
|
const { actions } = this;
|
|
@@ -649,7 +651,7 @@ function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
|
649
651
|
if (subscriptionDelay) {
|
|
650
652
|
return (source) => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
651
653
|
}
|
|
652
|
-
return mergeMap((value, index) => delayDurationSelector(value, index).pipe(take(1), mapTo(value)));
|
|
654
|
+
return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));
|
|
653
655
|
}
|
|
654
656
|
|
|
655
657
|
function delay$1(due, scheduler = asyncScheduler) {
|
|
@@ -1261,7 +1263,7 @@ const CatFormHint = props => {
|
|
|
1261
1263
|
]));
|
|
1262
1264
|
};
|
|
1263
1265
|
|
|
1264
|
-
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.
|
|
1266
|
+
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))}";
|
|
1265
1267
|
const CatCheckboxStyle0 = catCheckboxCss;
|
|
1266
1268
|
|
|
1267
1269
|
let nextUniqueId$8 = 0;
|
|
@@ -1484,6 +1486,16 @@ const CatDate = class {
|
|
|
1484
1486
|
this.nativeAttributes = undefined;
|
|
1485
1487
|
this.placement = 'bottom-end';
|
|
1486
1488
|
}
|
|
1489
|
+
onMinChanged(min, oldMin) {
|
|
1490
|
+
if (min !== oldMin) {
|
|
1491
|
+
this.reclamp('min', min);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
onMaxChanged(max, oldMax) {
|
|
1495
|
+
if (max !== oldMax) {
|
|
1496
|
+
this.reclamp('max', max);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1487
1499
|
get inputValue() {
|
|
1488
1500
|
const [match, year, month, day] = this.value?.match(/^(\d{4})-(\d{2})-(\d{2})/) ?? [];
|
|
1489
1501
|
if (match) {
|
|
@@ -1532,7 +1544,13 @@ const CatDate = class {
|
|
|
1532
1544
|
this.input?.clear();
|
|
1533
1545
|
}
|
|
1534
1546
|
render() {
|
|
1535
|
-
return (h(Host, { key: '
|
|
1547
|
+
return (h(Host, { key: 'd588c96f031fc8ab9518d13dfaac730a0d424caa' }, 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 => {
|
|
1548
|
+
e.stopPropagation();
|
|
1549
|
+
this.catFocus.emit(e.detail);
|
|
1550
|
+
}, onCatBlur: e => {
|
|
1551
|
+
e.stopPropagation();
|
|
1552
|
+
this.onInputBlur(e.detail);
|
|
1553
|
+
} }, h("span", { key: '68ef0708d25128b9a52d60c5b1a7b34e0ffb2ef1', slot: "label" }, this.label, h("span", { key: 'ac017335567a4e0059631e7535455d52f61f2e43', class: "label-aria" }, " (", this.locale.formatStr, ")")), h("cat-dropdown", { key: '16a6e95f6e4f6a9b0ddd7716f0b713c8fac3fdff', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, h("cat-button", { key: 'cf7f2aaa2c5775b23f3e8826e9b0e722c4ce8be6', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), h("div", { key: 'f90eef976a3102855801df5ffeee770d45e7eaba', slot: "content" }, 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) }))))));
|
|
1536
1554
|
}
|
|
1537
1555
|
getTriggerA11yLabel() {
|
|
1538
1556
|
const date = this.locale.fromLocalISO(this.value);
|
|
@@ -1561,6 +1579,7 @@ const CatDate = class {
|
|
|
1561
1579
|
this.catBlur.emit(e);
|
|
1562
1580
|
}
|
|
1563
1581
|
onDateChange(e) {
|
|
1582
|
+
e.stopPropagation();
|
|
1564
1583
|
const oldValue = this.value;
|
|
1565
1584
|
const date = e.detail ? new Date(e.detail) : null;
|
|
1566
1585
|
this.value = date ? this.locale.toLocalISO(date) : undefined;
|
|
@@ -1583,7 +1602,25 @@ const CatDate = class {
|
|
|
1583
1602
|
}
|
|
1584
1603
|
return new Date(year, month - 1, day);
|
|
1585
1604
|
}
|
|
1605
|
+
reclamp(mode, limit) {
|
|
1606
|
+
const oldValue = this.value;
|
|
1607
|
+
const oldDate = this.locale.fromLocalISO(oldValue);
|
|
1608
|
+
const limitDate = this.locale.fromLocalISO(limit);
|
|
1609
|
+
if (!oldDate || !limitDate) {
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
const newDate = clampDate(mode === 'min' ? limitDate : null, oldDate, mode === 'max' ? limitDate : null);
|
|
1613
|
+
const newValue = this.locale.toLocalISO(newDate);
|
|
1614
|
+
if (oldValue !== newValue) {
|
|
1615
|
+
this.value = newValue;
|
|
1616
|
+
this.catChange.emit(newValue);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1586
1619
|
get hostElement() { return getElement(this); }
|
|
1620
|
+
static get watchers() { return {
|
|
1621
|
+
"min": ["onMinChanged"],
|
|
1622
|
+
"max": ["onMaxChanged"]
|
|
1623
|
+
}; }
|
|
1587
1624
|
};
|
|
1588
1625
|
CatDate.style = CatDateStyle0;
|
|
1589
1626
|
|
|
@@ -1627,7 +1664,7 @@ const CatDateInline = class {
|
|
|
1627
1664
|
if (this.focusDate) {
|
|
1628
1665
|
// re-focus the previously focused date after re-render
|
|
1629
1666
|
this.hostElement.shadowRoot
|
|
1630
|
-
?.querySelector(`[data-date="${this.locale.
|
|
1667
|
+
?.querySelector(`[data-date="${this.locale.toLocalISO(this.focusDate)}"]`)
|
|
1631
1668
|
?.doFocus();
|
|
1632
1669
|
this.focusDate = null;
|
|
1633
1670
|
}
|
|
@@ -4629,8 +4666,18 @@ function getLocale$1(language) {
|
|
|
4629
4666
|
};
|
|
4630
4667
|
}
|
|
4631
4668
|
|
|
4632
|
-
|
|
4633
|
-
|
|
4669
|
+
/**
|
|
4670
|
+
* Custom positioning reference element.
|
|
4671
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
4672
|
+
*/
|
|
4673
|
+
const min = Math.min;
|
|
4674
|
+
const max = Math.max;
|
|
4675
|
+
const round = Math.round;
|
|
4676
|
+
const floor = Math.floor;
|
|
4677
|
+
const createCoords = v => ({
|
|
4678
|
+
x: v,
|
|
4679
|
+
y: v
|
|
4680
|
+
});
|
|
4634
4681
|
const oppositeSideMap = {
|
|
4635
4682
|
left: 'right',
|
|
4636
4683
|
right: 'left',
|
|
@@ -4642,7 +4689,7 @@ const oppositeAlignmentMap = {
|
|
|
4642
4689
|
end: 'start'
|
|
4643
4690
|
};
|
|
4644
4691
|
function clamp(start, value, end) {
|
|
4645
|
-
return max
|
|
4692
|
+
return max(start, min(value, end));
|
|
4646
4693
|
}
|
|
4647
4694
|
function evaluate(value, param) {
|
|
4648
4695
|
return typeof value === 'function' ? value(param) : value;
|
|
@@ -4801,7 +4848,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
4801
4848
|
|
|
4802
4849
|
/**
|
|
4803
4850
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
4804
|
-
* next to a reference element
|
|
4851
|
+
* next to a given reference element.
|
|
4805
4852
|
*
|
|
4806
4853
|
* This export does not have any `platform` interface logic. You will need to
|
|
4807
4854
|
* write one for the platform you are using Floating UI with.
|
|
@@ -4879,7 +4926,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
4879
4926
|
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
4880
4927
|
}
|
|
4881
4928
|
i = -1;
|
|
4882
|
-
continue;
|
|
4883
4929
|
}
|
|
4884
4930
|
}
|
|
4885
4931
|
return {
|
|
@@ -4942,6 +4988,7 @@ async function detectOverflow(state, options) {
|
|
|
4942
4988
|
y: 1
|
|
4943
4989
|
};
|
|
4944
4990
|
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4991
|
+
elements,
|
|
4945
4992
|
rect,
|
|
4946
4993
|
offsetParent,
|
|
4947
4994
|
strategy
|
|
@@ -5071,6 +5118,7 @@ const flip$1 = function (options) {
|
|
|
5071
5118
|
|
|
5072
5119
|
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
5073
5120
|
// Derivable.
|
|
5121
|
+
|
|
5074
5122
|
async function convertValueToCoords(state, options) {
|
|
5075
5123
|
const {
|
|
5076
5124
|
placement,
|
|
@@ -5084,8 +5132,6 @@ async function convertValueToCoords(state, options) {
|
|
|
5084
5132
|
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
5085
5133
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
5086
5134
|
const rawValue = evaluate(options, state);
|
|
5087
|
-
|
|
5088
|
-
// eslint-disable-next-line prefer-const
|
|
5089
5135
|
let {
|
|
5090
5136
|
mainAxis,
|
|
5091
5137
|
crossAxis,
|
|
@@ -5127,15 +5173,27 @@ const offset = function (options) {
|
|
|
5127
5173
|
name: 'offset',
|
|
5128
5174
|
options,
|
|
5129
5175
|
async fn(state) {
|
|
5176
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
5130
5177
|
const {
|
|
5131
5178
|
x,
|
|
5132
|
-
y
|
|
5179
|
+
y,
|
|
5180
|
+
placement,
|
|
5181
|
+
middlewareData
|
|
5133
5182
|
} = state;
|
|
5134
5183
|
const diffCoords = await convertValueToCoords(state, options);
|
|
5184
|
+
|
|
5185
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
5186
|
+
// then we don't need to change the positioning coordinates.
|
|
5187
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
5188
|
+
return {};
|
|
5189
|
+
}
|
|
5135
5190
|
return {
|
|
5136
5191
|
x: x + diffCoords.x,
|
|
5137
5192
|
y: y + diffCoords.y,
|
|
5138
|
-
data:
|
|
5193
|
+
data: {
|
|
5194
|
+
...diffCoords,
|
|
5195
|
+
placement
|
|
5196
|
+
}
|
|
5139
5197
|
};
|
|
5140
5198
|
}
|
|
5141
5199
|
};
|
|
@@ -5263,20 +5321,20 @@ const size$1 = function (options) {
|
|
|
5263
5321
|
let availableWidth = overflowAvailableWidth;
|
|
5264
5322
|
if (isYAxis) {
|
|
5265
5323
|
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
5266
|
-
availableWidth = alignment || noShift ? min
|
|
5324
|
+
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
5267
5325
|
} else {
|
|
5268
5326
|
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
5269
|
-
availableHeight = alignment || noShift ? min
|
|
5327
|
+
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
5270
5328
|
}
|
|
5271
5329
|
if (noShift && !alignment) {
|
|
5272
|
-
const xMin = max
|
|
5273
|
-
const xMax = max
|
|
5274
|
-
const yMin = max
|
|
5275
|
-
const yMax = max
|
|
5330
|
+
const xMin = max(overflow.left, 0);
|
|
5331
|
+
const xMax = max(overflow.right, 0);
|
|
5332
|
+
const yMin = max(overflow.top, 0);
|
|
5333
|
+
const yMax = max(overflow.bottom, 0);
|
|
5276
5334
|
if (isYAxis) {
|
|
5277
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max
|
|
5335
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
5278
5336
|
} else {
|
|
5279
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max
|
|
5337
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
5280
5338
|
}
|
|
5281
5339
|
}
|
|
5282
5340
|
await apply({
|
|
@@ -5297,19 +5355,6 @@ const size$1 = function (options) {
|
|
|
5297
5355
|
};
|
|
5298
5356
|
};
|
|
5299
5357
|
|
|
5300
|
-
/**
|
|
5301
|
-
* Custom positioning reference element.
|
|
5302
|
-
* @see https://floating-ui.com/docs/virtual-elements
|
|
5303
|
-
*/
|
|
5304
|
-
const min = Math.min;
|
|
5305
|
-
const max = Math.max;
|
|
5306
|
-
const round = Math.round;
|
|
5307
|
-
const floor = Math.floor;
|
|
5308
|
-
const createCoords = v => ({
|
|
5309
|
-
x: v,
|
|
5310
|
-
y: v
|
|
5311
|
-
});
|
|
5312
|
-
|
|
5313
5358
|
function getNodeName(node) {
|
|
5314
5359
|
if (isNode(node)) {
|
|
5315
5360
|
return (node.nodeName || '').toLowerCase();
|
|
@@ -7852,6 +7897,7 @@ const CatDropdown = class {
|
|
|
7852
7897
|
this.arrowNavigation = 'vertical';
|
|
7853
7898
|
this.noResize = false;
|
|
7854
7899
|
this.overflow = false;
|
|
7900
|
+
this.noInitialFocus = false;
|
|
7855
7901
|
}
|
|
7856
7902
|
clickHandler(event) {
|
|
7857
7903
|
// we need to delay the initialization of the trigger until first
|
|
@@ -7883,6 +7929,9 @@ const CatDropdown = class {
|
|
|
7883
7929
|
* Opens the dropdown.
|
|
7884
7930
|
*/
|
|
7885
7931
|
async open() {
|
|
7932
|
+
if (!this.trigger) {
|
|
7933
|
+
this.initTrigger();
|
|
7934
|
+
}
|
|
7886
7935
|
if (this.isOpen === null || this.isOpen) {
|
|
7887
7936
|
return; // busy or open
|
|
7888
7937
|
}
|
|
@@ -7923,7 +7972,8 @@ const CatDropdown = class {
|
|
|
7923
7972
|
return true;
|
|
7924
7973
|
}
|
|
7925
7974
|
return event.key === 'Tab' && event.shiftKey;
|
|
7926
|
-
}
|
|
7975
|
+
},
|
|
7976
|
+
initialFocus: () => (this.noInitialFocus ? false : undefined)
|
|
7927
7977
|
});
|
|
7928
7978
|
this.trap.activate();
|
|
7929
7979
|
});
|
|
@@ -7948,7 +7998,7 @@ const CatDropdown = class {
|
|
|
7948
7998
|
}, timeTransitionS);
|
|
7949
7999
|
}
|
|
7950
8000
|
render() {
|
|
7951
|
-
return (h(Host, { key: '
|
|
8001
|
+
return (h(Host, { key: '6cde42e7f7bfc2df858b7179157a1f52e0c23e0e' }, h("slot", { key: '91633464f448a8142f52b6e1e62420974a929e84', name: "trigger", ref: el => (this.triggerSlot = el) }), h("div", { key: '2ed9bd2dcc58b83ec1e7781959456e67d9397c48', id: this.contentId, class: { content: true, 'overflow-auto': !this.overflow }, ref: el => (this.content = el) }, h("slot", { key: 'a91710cd8455cb006f60e48dd49aee7f6d114877', name: "content" }))));
|
|
7952
8002
|
}
|
|
7953
8003
|
get contentId() {
|
|
7954
8004
|
return `cat-dropdown-${this.id}`;
|
|
@@ -9891,7 +9941,7 @@ const CatPagination = class {
|
|
|
9891
9941
|
};
|
|
9892
9942
|
CatPagination.style = CatPaginationStyle0;
|
|
9893
9943
|
|
|
9894
|
-
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.
|
|
9944
|
+
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))}";
|
|
9895
9945
|
const CatRadioStyle0 = catRadioCss;
|
|
9896
9946
|
|
|
9897
9947
|
let nextUniqueId$5 = 0;
|
|
@@ -12656,6 +12706,9 @@ function getLocale(language) {
|
|
|
12656
12706
|
timeFormat: getHour12(language) ? '12' : '24'
|
|
12657
12707
|
};
|
|
12658
12708
|
}
|
|
12709
|
+
function formatIso(date) {
|
|
12710
|
+
return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
|
|
12711
|
+
}
|
|
12659
12712
|
|
|
12660
12713
|
function clampTime(min, date, max) {
|
|
12661
12714
|
const [, hhMin, mmMin] = min?.match(/(\d{2}):(\d{2})/)?.map(Number) ?? [];
|
|
@@ -12726,6 +12779,16 @@ const CatTime = class {
|
|
|
12726
12779
|
this.placement = 'bottom-end';
|
|
12727
12780
|
this.step = 30;
|
|
12728
12781
|
}
|
|
12782
|
+
onMinChanged(min, oldMin) {
|
|
12783
|
+
if (min !== oldMin) {
|
|
12784
|
+
this.reclamp('min', min);
|
|
12785
|
+
}
|
|
12786
|
+
}
|
|
12787
|
+
onMaxChanged(max, oldMax) {
|
|
12788
|
+
if (max !== oldMax) {
|
|
12789
|
+
this.reclamp('max', max);
|
|
12790
|
+
}
|
|
12791
|
+
}
|
|
12729
12792
|
componentWillLoad() {
|
|
12730
12793
|
this.syncValue(this.value ?? '');
|
|
12731
12794
|
}
|
|
@@ -12743,9 +12806,9 @@ const CatTime = class {
|
|
|
12743
12806
|
onOpen() {
|
|
12744
12807
|
const query = (selector) => this.hostElement.shadowRoot?.querySelector(selector);
|
|
12745
12808
|
const time = clampTime(this.min ?? null, this.selectionTime ?? new Date(2000, 5, 1, 8), this.max ?? null);
|
|
12746
|
-
const elem1 = query(`[data-time="${
|
|
12809
|
+
const elem1 = query(`[data-time="${formatIso(time)}"]`);
|
|
12747
12810
|
time.setMinutes(Math.floor(time.getMinutes() / this.step) * this.step);
|
|
12748
|
-
const elem2 = query(`[data-time="${
|
|
12811
|
+
const elem2 = query(`[data-time="${formatIso(time)}"]`);
|
|
12749
12812
|
setTimeout(() => {
|
|
12750
12813
|
(elem2 ?? elem1)?.doFocus();
|
|
12751
12814
|
(elem2 ?? elem1)?.scrollIntoView(this.selectionTime ? { block: 'center' } : undefined);
|
|
@@ -12766,7 +12829,7 @@ const CatTime = class {
|
|
|
12766
12829
|
const time = clampTime(this.min ?? null, date, this.max ?? null);
|
|
12767
12830
|
this.isAm = this.format(time).toLowerCase().includes('am');
|
|
12768
12831
|
this.selectionTime = time;
|
|
12769
|
-
this.value =
|
|
12832
|
+
this.value = formatIso(time);
|
|
12770
12833
|
}
|
|
12771
12834
|
// we need to set the input explicitly to sync the input even without a
|
|
12772
12835
|
// rerender (if the value is not changed)
|
|
@@ -12801,8 +12864,8 @@ const CatTime = class {
|
|
|
12801
12864
|
this.input?.clear();
|
|
12802
12865
|
}
|
|
12803
12866
|
render() {
|
|
12804
|
-
return (h(Host, { key: '
|
|
12805
|
-
const isoTime =
|
|
12867
|
+
return (h(Host, { key: 'c7ebe7c00d372720ce9c34907438f47150df0820' }, 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) }, h("span", { key: '504e24bcf7d7fa3e0eddb7df91261778e720cc87', slot: "label" }, this.hasSlottedLabel && h("slot", { name: "label" }), !this.hasSlottedLabel && this.label, h("span", { key: 'c617e13394f44bd851beae13e809f791a56dfa42', class: "label-aria" }, " (HH:mm)")), h("div", { key: '601bd57b6137a44901a3d32ce10f881aae67a2a8', slot: "addon", class: "cat-time-addon" }, this.locale.timeFormat === '12' && (h("cat-button", { class: "cat-time-format", disabled: this.disabled || this.readonly, onCatClick: () => this.toggleAm() }, this.isAm ? 'AM' : 'PM')), h("cat-dropdown", { key: 'ecdd2fb5987eb30890c9258ece4bd1e176b2d6c6', slot: "addon", placement: this.placement }, 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 }), h("nav", { key: 'e2e77112f74467cc2db37d24f38165389888978a', slot: "content", class: "cat-nav" }, h("ul", { key: 'c005ac2b43037f3e5953117e968a967ce60be477' }, this.timeArray().map(time => {
|
|
12868
|
+
const isoTime = formatIso(time);
|
|
12806
12869
|
const disabled = isBefore(time, this.min ?? null) || isAfter(time, this.max ?? null);
|
|
12807
12870
|
return (h("li", null, h("cat-button", { class: {
|
|
12808
12871
|
'cat-nav-item': true,
|
|
@@ -12851,14 +12914,27 @@ const CatTime = class {
|
|
|
12851
12914
|
: '';
|
|
12852
12915
|
return includeAmPm ? str : str.replace(/\s?(am|pm)/i, '');
|
|
12853
12916
|
}
|
|
12854
|
-
|
|
12855
|
-
|
|
12917
|
+
reclamp(mode, limit) {
|
|
12918
|
+
if (!this.value)
|
|
12919
|
+
return;
|
|
12920
|
+
const min = (mode === 'min' ? limit : this.min) ?? null;
|
|
12921
|
+
const max = (mode === 'max' ? limit : this.max) ?? null;
|
|
12922
|
+
const [match, hh, mm] = this.value.match(/(\d{2}):(\d{2})/) ?? [];
|
|
12923
|
+
const newValue = match ? formatIso(clampTime(min, new Date(2000, 5, 1, Number(hh), Number(mm)), max)) : undefined;
|
|
12924
|
+
if (this.value !== newValue) {
|
|
12925
|
+
this.syncValue(newValue ?? '');
|
|
12926
|
+
this.catChange.emit(newValue);
|
|
12927
|
+
}
|
|
12856
12928
|
}
|
|
12857
12929
|
get hostElement() { return getElement(this); }
|
|
12930
|
+
static get watchers() { return {
|
|
12931
|
+
"min": ["onMinChanged"],
|
|
12932
|
+
"max": ["onMaxChanged"]
|
|
12933
|
+
}; }
|
|
12858
12934
|
};
|
|
12859
12935
|
CatTime.style = CatTimeStyle0;
|
|
12860
12936
|
|
|
12861
|
-
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.
|
|
12937
|
+
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))}";
|
|
12862
12938
|
const CatToggleStyle0 = catToggleCss;
|
|
12863
12939
|
|
|
12864
12940
|
let nextUniqueId$1 = 0;
|