@haiilo/catalyst 10.5.0 → 10.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/catalyst/catalyst.css +2 -2
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.esm.js +1 -1
  5. package/dist/catalyst/{p-54544546.js → p-2c8ac8cf.js} +1 -1
  6. package/dist/catalyst/p-2c8ac8cf.js.map +1 -0
  7. package/dist/catalyst/p-8b22b7fc.entry.js +10 -0
  8. package/dist/catalyst/p-8b22b7fc.entry.js.map +1 -0
  9. package/dist/catalyst/scss/_variables.scss +0 -1
  10. package/dist/catalyst/scss/core/_form.scss +2 -2
  11. package/dist/cjs/cat-alert_29.cjs.entry.js +133 -56
  12. package/dist/cjs/cat-alert_29.cjs.entry.js.map +1 -1
  13. package/dist/cjs/catalyst.cjs.js +1 -1
  14. package/dist/cjs/index.cjs.js +1 -1
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/cjs/{of-8163b41f.js → of-f2844da8.js} +2 -2
  17. package/dist/cjs/of-f2844da8.js.map +1 -0
  18. package/dist/collection/components/cat-checkbox/cat-checkbox.css +2 -1
  19. package/dist/collection/components/cat-date/cat-date.js +41 -1
  20. package/dist/collection/components/cat-date/cat-date.js.map +1 -1
  21. package/dist/collection/components/cat-date-inline/cat-date-inline.js +9 -8
  22. package/dist/collection/components/cat-date-inline/cat-date-inline.js.map +1 -1
  23. package/dist/collection/components/cat-dropdown/cat-dropdown.js +25 -2
  24. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  25. package/dist/collection/components/cat-radio/cat-radio.css +1 -1
  26. package/dist/collection/components/cat-select/cat-select.js +5 -5
  27. package/dist/collection/components/cat-time/cat-time-locale.js +3 -0
  28. package/dist/collection/components/cat-time/cat-time-locale.js.map +1 -1
  29. package/dist/collection/components/cat-time/cat-time.js +36 -8
  30. package/dist/collection/components/cat-time/cat-time.js.map +1 -1
  31. package/dist/collection/components/cat-toggle/cat-toggle.css +1 -1
  32. package/dist/collection/scss/_variables.scss +0 -1
  33. package/dist/collection/scss/core/_form.scss +2 -2
  34. package/dist/components/cat-checkbox2.js +1 -1
  35. package/dist/components/cat-checkbox2.js.map +1 -1
  36. package/dist/components/cat-date-inline2.js +9 -8
  37. package/dist/components/cat-date-inline2.js.map +1 -1
  38. package/dist/components/cat-date.js +39 -1
  39. package/dist/components/cat-date.js.map +1 -1
  40. package/dist/components/cat-dropdown2.js +8 -2
  41. package/dist/components/cat-dropdown2.js.map +1 -1
  42. package/dist/components/cat-radio.js +1 -1
  43. package/dist/components/cat-radio.js.map +1 -1
  44. package/dist/components/cat-scrollable2.js +5 -3
  45. package/dist/components/cat-scrollable2.js.map +1 -1
  46. package/dist/components/cat-select-demo.js +2 -2
  47. package/dist/components/cat-select-demo.js.map +1 -1
  48. package/dist/components/cat-select2.js.map +1 -1
  49. package/dist/components/cat-time.js +37 -8
  50. package/dist/components/cat-time.js.map +1 -1
  51. package/dist/components/cat-toggle.js +1 -1
  52. package/dist/components/cat-toggle.js.map +1 -1
  53. package/dist/components/floating-ui.dom.esm.js +38 -30
  54. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  55. package/dist/components/from.js +1 -1
  56. package/dist/components/from.js.map +1 -1
  57. package/dist/components/of.js.map +1 -1
  58. package/dist/esm/cat-alert_29.entry.js +133 -56
  59. package/dist/esm/cat-alert_29.entry.js.map +1 -1
  60. package/dist/esm/catalyst.js +1 -1
  61. package/dist/esm/index.js +2 -2
  62. package/dist/esm/loader.js +1 -1
  63. package/dist/esm/{of-f4b9a3ca.js → of-53334b95.js} +2 -2
  64. package/dist/esm/of-53334b95.js.map +1 -0
  65. package/dist/types/components/cat-date/cat-date.d.ts +3 -0
  66. package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +5 -0
  67. package/dist/types/components/cat-time/cat-time-locale.d.ts +1 -0
  68. package/dist/types/components/cat-time/cat-time.d.ts +3 -1
  69. package/dist/types/components.d.ts +8 -0
  70. package/package.json +2 -2
  71. package/dist/catalyst/p-54544546.js.map +0 -1
  72. package/dist/catalyst/p-66b41008.entry.js +0 -10
  73. package/dist/catalyst/p-66b41008.entry.js.map +0 -1
  74. package/dist/cjs/of-8163b41f.js.map +0 -1
  75. 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-f4b9a3ca.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-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 || this.requestAsyncId(scheduler, this.id, delay);
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
- intervalProvider.clearInterval(id);
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.5rem}: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 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))}";
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: '6f8ed88396eb9932a91f26e1f32086a573f82add' }, h("cat-input", { key: 'e73ec2bceb1cd648e14d8917ebf7fb6c99079408', 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 => this.catFocus.emit(e.detail), onCatBlur: e => this.onInputBlur(e.detail) }, h("span", { key: '8fb02c395b64728db2a2f5d4896e3151b3dc5aec', slot: "label" }, this.label, h("span", { key: 'f08e83d369b1f35d45fb4c0b2c39a9ad52b68b77', class: "label-aria" }, " (", this.locale.formatStr, ")")), h("cat-dropdown", { key: '48ee8472fab9d59b511df69afbbc348aa7b04828', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, h("cat-button", { key: 'b12ea88e170c2c8d916e9553b0bb205fae5e5d45', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), h("div", { key: '9173b680adcf83c32a7c10e818acbab188cfd979', slot: "content" }, h("cat-date-inline", { key: '997bc3bb5137d860893732234442feda61cd3d21', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
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
 
@@ -1616,18 +1653,19 @@ const CatDateInline = class {
1616
1653
  return all ? new Date(Number(year), Number(month) - 1, Number(day)) : null;
1617
1654
  }
1618
1655
  componentWillLoad() {
1619
- // select the initial value
1620
1656
  const [startDate, endDate] = this.getValue();
1621
- this.select(startDate);
1622
- if (this.range && endDate) {
1623
- this.select(endDate);
1657
+ if (endDate) {
1658
+ this.focus(endDate);
1659
+ }
1660
+ else if (startDate) {
1661
+ this.focus(startDate);
1624
1662
  }
1625
1663
  }
1626
1664
  componentDidRender() {
1627
1665
  if (this.focusDate) {
1628
1666
  // re-focus the previously focused date after re-render
1629
1667
  this.hostElement.shadowRoot
1630
- ?.querySelector(`[data-date="${this.locale.toLocalStr(this.focusDate)}"]`)
1668
+ ?.querySelector(`[data-date="${this.locale.toLocalISO(this.focusDate)}"]`)
1631
1669
  ?.doFocus();
1632
1670
  this.focusDate = null;
1633
1671
  }
@@ -1710,9 +1748,9 @@ const CatDateInline = class {
1710
1748
  const [minDate, maxDate] = this.getMinMaxDate();
1711
1749
  const dateGrid = this.dateGrid(this.viewDate.getFullYear(), this.viewDate.getMonth());
1712
1750
  const [dateStart, dateEnd] = this.getValue();
1713
- return (h(Host, { key: '2b21e43ebc9a69988b475f2eae1eb2f2aeee97cb' }, h("div", { key: '3f256483614d09440bee07be4e8996bc1c187d2b', class: { picker: true, 'picker-small': this.size === 's', 'picker-weeks': !this.noWeeks } }, h("div", { key: 'c9d82a518d78439164e99240fa13afabcc81e267', class: "picker-head" }, h("cat-button", { key: 'bcc803acb0ac2d7947fa53615ca105d77063e9f9', icon: "$cat:datepicker-year-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevYear, disabled: isSameYear(this.viewDate, minDate), onClick: () => this.navigate('prev', 'year'), "data-dropdown-no-close": true }), h("cat-button", { key: '3626bbe3e1a79c08d7a6257cb78ce398ceb1b750', icon: "$cat:datepicker-month-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevMonth, disabled: isSameMonth(this.viewDate, minDate), onClick: () => this.navigate('prev', 'month'), "data-dropdown-no-close": true }), h("h3", { key: '92462a6702792afd573c91f0c12e2bae599378ae' }, this.getHeadline()), h("cat-button", { key: '4ce63e1451b820098feea0ff2f45d9b7d0b5cc28', icon: "$cat:datepicker-month-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextMonth, disabled: isSameMonth(this.viewDate, maxDate), onClick: () => this.navigate('next', 'month'), "data-dropdown-no-close": true }), h("cat-button", { key: '97adedac70ce8f19ba0725ca6a1bb836a1d8c0c3', icon: "$cat:datepicker-year-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextYear, disabled: isSameYear(this.viewDate, maxDate), onClick: () => this.navigate('next', 'year'), "data-dropdown-no-close": true })), h("div", { key: '9bbc58c07f911e928cd231a784604abada3698ea', class: "picker-grid", onFocusin: () => this.setAriaLive(this.locale.arrowKeys) }, h("div", { key: '2eff946487bfdbce49521b513d6065bd42c78ac0', class: "picker-grid-head" }, Array.from(Array(7), (_, i) => (h("abbr", { title: this.locale.days.long[i] }, this.locale.days.short[i])))), !this.noWeeks && (h("div", { class: "picker-grid-weeks" }, dateGrid
1751
+ return (h(Host, { key: 'a7d905c8e87ff74d81dfc74af7ba373297e236f0' }, h("div", { key: '1da4117e24b346e7c8b0fb02bee21cf4ab0b4811', class: { picker: true, 'picker-small': this.size === 's', 'picker-weeks': !this.noWeeks } }, h("div", { key: 'fc0b889a89e79962ae83e871678b8994b110df26', class: "picker-head" }, h("cat-button", { key: '6a12fb84c1047342bed4c27919bb3e5581c628ef', icon: "$cat:datepicker-year-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevYear, disabled: isSameYear(this.viewDate, minDate), onClick: () => this.navigate('prev', 'year'), "data-dropdown-no-close": true }), h("cat-button", { key: '40d96782ca7d4f2c6ea2e4fbc7ebe51a2c8c1eba', icon: "$cat:datepicker-month-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevMonth, disabled: isSameMonth(this.viewDate, minDate), onClick: () => this.navigate('prev', 'month'), "data-dropdown-no-close": true }), h("h3", { key: 'd40d0418bee1337559939c56ef22dcdfbf9afa3d' }, this.getHeadline()), h("cat-button", { key: '1265b3ee5423afef7006ed9e590c42fec5a461c0', icon: "$cat:datepicker-month-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextMonth, disabled: isSameMonth(this.viewDate, maxDate), onClick: () => this.navigate('next', 'month'), "data-dropdown-no-close": true }), h("cat-button", { key: 'a0872674a56e6b9a48206d9bd05f669dc2b720f2', icon: "$cat:datepicker-year-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextYear, disabled: isSameYear(this.viewDate, maxDate), onClick: () => this.navigate('next', 'year'), "data-dropdown-no-close": true })), h("div", { key: 'a2f5d372f4693bfbd95c305add8a5ae9d2b93016', class: "picker-grid", onFocusin: () => this.setAriaLive(this.locale.arrowKeys) }, h("div", { key: '8ce7da396804f56ffbddeca8f106ed7bcdd0a82c', class: "picker-grid-head" }, Array.from(Array(7), (_, i) => (h("abbr", { title: this.locale.days.long[i] }, this.locale.days.short[i])))), !this.noWeeks && (h("div", { class: "picker-grid-weeks" }, dateGrid
1714
1752
  .filter((_, i) => i % 7 === 0)
1715
- .map(day => (h("div", null, this.getWeekNumber(day)))))), h("div", { key: '48f7b239e8ccb0d56b4f7c80d8892b79c2908990', class: "picker-grid-days" }, dateGrid.map(day => {
1753
+ .map(day => (h("div", null, this.getWeekNumber(day)))))), h("div", { key: '94446fe590c51c48b73e6d482a3f1d4d4fb03a82', class: "picker-grid-days" }, dateGrid.map(day => {
1716
1754
  const isStartDate = isSameDay(dateStart, day);
1717
1755
  const isEndDate = isSameDay(dateEnd, day);
1718
1756
  const isRange = !!dateStart && !!dateEnd && day > dateStart && day < dateEnd;
@@ -1727,7 +1765,7 @@ const CatDateInline = class {
1727
1765
  'date-focusable': this.canFocus(day),
1728
1766
  'date-disabled': !this.canClick(day)
1729
1767
  }, size: this.size, nativeAttributes: !this.canFocus(day) ? { tabindex: '-1' } : {}, variant: isStartDate || isEndDate ? 'filled' : isToday ? 'outlined' : 'text', a11yLabel: this.locale.toLocalStr(day), active: isStartDate || isEndDate || isRange, color: isStartDate || isEndDate || isToday ? 'primary' : 'secondary', disabled: !this.canClick(day), onClick: () => this.select(day), "data-date": this.locale.toLocalISO(day) }, day.getDate()));
1730
- }))), h("div", { key: 'e6c30b78568d92d3a17936fdff4c7fec1ac4965f', class: "picker-foot" }, !this.noToday && this.canClick(this.locale.now()) && (h("cat-button", { size: "s", "data-dropdown-no-close": true, onClick: () => this.select(this.locale.now()) }, this.locale.today)), !this.noHint && h("p", { class: "cursor-help" }, this.locale.arrowKeys), !this.noClear && (h("cat-button", { size: "s", disabled: !this.value, "data-dropdown-no-close": true, onClick: () => this.clear() }, this.locale.clear)))), h("p", { key: 'e31cabf38ed3545ddd4acc32c2540eb5706bc17c', class: "cursor-aria", "aria-live": "polite" })));
1768
+ }))), h("div", { key: '2c3386a794b6ebdfb644a41e892448fd454d7aaa', class: "picker-foot" }, !this.noToday && this.canClick(this.locale.now()) && (h("cat-button", { size: "s", "data-dropdown-no-close": true, onClick: () => this.select(this.locale.now()) }, this.locale.today)), !this.noHint && h("p", { class: "cursor-help" }, this.locale.arrowKeys), !this.noClear && (h("cat-button", { size: "s", disabled: !this.value, "data-dropdown-no-close": true, onClick: () => this.clear() }, this.locale.clear)))), h("p", { key: '6193ca5ae8ff21d847a377ad7c269f22bc52d9a8', class: "cursor-aria", "aria-live": "polite" })));
1731
1769
  }
1732
1770
  focus(date) {
1733
1771
  const [minDate, maxDate] = this.getMinMaxDate();
@@ -4629,8 +4667,18 @@ function getLocale$1(language) {
4629
4667
  };
4630
4668
  }
4631
4669
 
4632
- const min$1 = Math.min;
4633
- const max$1 = Math.max;
4670
+ /**
4671
+ * Custom positioning reference element.
4672
+ * @see https://floating-ui.com/docs/virtual-elements
4673
+ */
4674
+ const min = Math.min;
4675
+ const max = Math.max;
4676
+ const round = Math.round;
4677
+ const floor = Math.floor;
4678
+ const createCoords = v => ({
4679
+ x: v,
4680
+ y: v
4681
+ });
4634
4682
  const oppositeSideMap = {
4635
4683
  left: 'right',
4636
4684
  right: 'left',
@@ -4642,7 +4690,7 @@ const oppositeAlignmentMap = {
4642
4690
  end: 'start'
4643
4691
  };
4644
4692
  function clamp(start, value, end) {
4645
- return max$1(start, min$1(value, end));
4693
+ return max(start, min(value, end));
4646
4694
  }
4647
4695
  function evaluate(value, param) {
4648
4696
  return typeof value === 'function' ? value(param) : value;
@@ -4801,7 +4849,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
4801
4849
 
4802
4850
  /**
4803
4851
  * Computes the `x` and `y` coordinates that will place the floating element
4804
- * next to a reference element when it is given a certain positioning strategy.
4852
+ * next to a given reference element.
4805
4853
  *
4806
4854
  * This export does not have any `platform` interface logic. You will need to
4807
4855
  * write one for the platform you are using Floating UI with.
@@ -4879,7 +4927,6 @@ const computePosition$1 = async (reference, floating, config) => {
4879
4927
  } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
4880
4928
  }
4881
4929
  i = -1;
4882
- continue;
4883
4930
  }
4884
4931
  }
4885
4932
  return {
@@ -4942,6 +4989,7 @@ async function detectOverflow(state, options) {
4942
4989
  y: 1
4943
4990
  };
4944
4991
  const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
4992
+ elements,
4945
4993
  rect,
4946
4994
  offsetParent,
4947
4995
  strategy
@@ -5071,6 +5119,7 @@ const flip$1 = function (options) {
5071
5119
 
5072
5120
  // For type backwards-compatibility, the `OffsetOptions` type was also
5073
5121
  // Derivable.
5122
+
5074
5123
  async function convertValueToCoords(state, options) {
5075
5124
  const {
5076
5125
  placement,
@@ -5084,8 +5133,6 @@ async function convertValueToCoords(state, options) {
5084
5133
  const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
5085
5134
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
5086
5135
  const rawValue = evaluate(options, state);
5087
-
5088
- // eslint-disable-next-line prefer-const
5089
5136
  let {
5090
5137
  mainAxis,
5091
5138
  crossAxis,
@@ -5127,15 +5174,27 @@ const offset = function (options) {
5127
5174
  name: 'offset',
5128
5175
  options,
5129
5176
  async fn(state) {
5177
+ var _middlewareData$offse, _middlewareData$arrow;
5130
5178
  const {
5131
5179
  x,
5132
- y
5180
+ y,
5181
+ placement,
5182
+ middlewareData
5133
5183
  } = state;
5134
5184
  const diffCoords = await convertValueToCoords(state, options);
5185
+
5186
+ // If the placement is the same and the arrow caused an alignment offset
5187
+ // then we don't need to change the positioning coordinates.
5188
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
5189
+ return {};
5190
+ }
5135
5191
  return {
5136
5192
  x: x + diffCoords.x,
5137
5193
  y: y + diffCoords.y,
5138
- data: diffCoords
5194
+ data: {
5195
+ ...diffCoords,
5196
+ placement
5197
+ }
5139
5198
  };
5140
5199
  }
5141
5200
  };
@@ -5263,20 +5322,20 @@ const size$1 = function (options) {
5263
5322
  let availableWidth = overflowAvailableWidth;
5264
5323
  if (isYAxis) {
5265
5324
  const maximumClippingWidth = width - overflow.left - overflow.right;
5266
- availableWidth = alignment || noShift ? min$1(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
5325
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
5267
5326
  } else {
5268
5327
  const maximumClippingHeight = height - overflow.top - overflow.bottom;
5269
- availableHeight = alignment || noShift ? min$1(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
5328
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
5270
5329
  }
5271
5330
  if (noShift && !alignment) {
5272
- const xMin = max$1(overflow.left, 0);
5273
- const xMax = max$1(overflow.right, 0);
5274
- const yMin = max$1(overflow.top, 0);
5275
- const yMax = max$1(overflow.bottom, 0);
5331
+ const xMin = max(overflow.left, 0);
5332
+ const xMax = max(overflow.right, 0);
5333
+ const yMin = max(overflow.top, 0);
5334
+ const yMax = max(overflow.bottom, 0);
5276
5335
  if (isYAxis) {
5277
- availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right));
5336
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
5278
5337
  } else {
5279
- availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom));
5338
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
5280
5339
  }
5281
5340
  }
5282
5341
  await apply({
@@ -5297,19 +5356,6 @@ const size$1 = function (options) {
5297
5356
  };
5298
5357
  };
5299
5358
 
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
5359
  function getNodeName(node) {
5314
5360
  if (isNode(node)) {
5315
5361
  return (node.nodeName || '').toLowerCase();
@@ -7852,6 +7898,7 @@ const CatDropdown = class {
7852
7898
  this.arrowNavigation = 'vertical';
7853
7899
  this.noResize = false;
7854
7900
  this.overflow = false;
7901
+ this.noInitialFocus = false;
7855
7902
  }
7856
7903
  clickHandler(event) {
7857
7904
  // we need to delay the initialization of the trigger until first
@@ -7883,6 +7930,9 @@ const CatDropdown = class {
7883
7930
  * Opens the dropdown.
7884
7931
  */
7885
7932
  async open() {
7933
+ if (!this.trigger) {
7934
+ this.initTrigger();
7935
+ }
7886
7936
  if (this.isOpen === null || this.isOpen) {
7887
7937
  return; // busy or open
7888
7938
  }
@@ -7923,7 +7973,8 @@ const CatDropdown = class {
7923
7973
  return true;
7924
7974
  }
7925
7975
  return event.key === 'Tab' && event.shiftKey;
7926
- }
7976
+ },
7977
+ initialFocus: () => (this.noInitialFocus ? false : undefined)
7927
7978
  });
7928
7979
  this.trap.activate();
7929
7980
  });
@@ -7948,7 +7999,7 @@ const CatDropdown = class {
7948
7999
  }, timeTransitionS);
7949
8000
  }
7950
8001
  render() {
7951
- return (h(Host, { key: '5e8a36f00643aa9717333a38ef215b27d328c167' }, h("slot", { key: '86a79d3b71d98a57e78be7c94caf35bbf8dbdfdd', name: "trigger", ref: el => (this.triggerSlot = el) }), h("div", { key: '1367ba9d60feb7abb4ae5993ba0b5c48ee44e308', id: this.contentId, class: { content: true, 'overflow-auto': !this.overflow }, ref: el => (this.content = el) }, h("slot", { key: '816d07aa40e29aff294b1110370286f2b968fc46', name: "content" }))));
8002
+ 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
8003
  }
7953
8004
  get contentId() {
7954
8005
  return `cat-dropdown-${this.id}`;
@@ -9891,7 +9942,7 @@ const CatPagination = class {
9891
9942
  };
9892
9943
  CatPagination.style = CatPaginationStyle0;
9893
9944
 
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.5rem}: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))}";
9945
+ 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
9946
  const CatRadioStyle0 = catRadioCss;
9896
9947
 
9897
9948
  let nextUniqueId$5 = 0;
@@ -12656,6 +12707,9 @@ function getLocale(language) {
12656
12707
  timeFormat: getHour12(language) ? '12' : '24'
12657
12708
  };
12658
12709
  }
12710
+ function formatIso(date) {
12711
+ return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
12712
+ }
12659
12713
 
12660
12714
  function clampTime(min, date, max) {
12661
12715
  const [, hhMin, mmMin] = min?.match(/(\d{2}):(\d{2})/)?.map(Number) ?? [];
@@ -12726,6 +12780,16 @@ const CatTime = class {
12726
12780
  this.placement = 'bottom-end';
12727
12781
  this.step = 30;
12728
12782
  }
12783
+ onMinChanged(min, oldMin) {
12784
+ if (min !== oldMin) {
12785
+ this.reclamp('min', min);
12786
+ }
12787
+ }
12788
+ onMaxChanged(max, oldMax) {
12789
+ if (max !== oldMax) {
12790
+ this.reclamp('max', max);
12791
+ }
12792
+ }
12729
12793
  componentWillLoad() {
12730
12794
  this.syncValue(this.value ?? '');
12731
12795
  }
@@ -12743,9 +12807,9 @@ const CatTime = class {
12743
12807
  onOpen() {
12744
12808
  const query = (selector) => this.hostElement.shadowRoot?.querySelector(selector);
12745
12809
  const time = clampTime(this.min ?? null, this.selectionTime ?? new Date(2000, 5, 1, 8), this.max ?? null);
12746
- const elem1 = query(`[data-time="${this.formatIso(time)}"]`);
12810
+ const elem1 = query(`[data-time="${formatIso(time)}"]`);
12747
12811
  time.setMinutes(Math.floor(time.getMinutes() / this.step) * this.step);
12748
- const elem2 = query(`[data-time="${this.formatIso(time)}"]`);
12812
+ const elem2 = query(`[data-time="${formatIso(time)}"]`);
12749
12813
  setTimeout(() => {
12750
12814
  (elem2 ?? elem1)?.doFocus();
12751
12815
  (elem2 ?? elem1)?.scrollIntoView(this.selectionTime ? { block: 'center' } : undefined);
@@ -12766,7 +12830,7 @@ const CatTime = class {
12766
12830
  const time = clampTime(this.min ?? null, date, this.max ?? null);
12767
12831
  this.isAm = this.format(time).toLowerCase().includes('am');
12768
12832
  this.selectionTime = time;
12769
- this.value = this.formatIso(time);
12833
+ this.value = formatIso(time);
12770
12834
  }
12771
12835
  // we need to set the input explicitly to sync the input even without a
12772
12836
  // rerender (if the value is not changed)
@@ -12801,8 +12865,8 @@ const CatTime = class {
12801
12865
  this.input?.clear();
12802
12866
  }
12803
12867
  render() {
12804
- return (h(Host, { key: '899fb8f5f263ba560bacb99d111792e9219e057a' }, h("cat-input", { key: 'e2b84c644e265cdc166c7ec50cb873d79ddeb12e', 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: '097ee8e93a2d05d35051ddc1aa105b1e9ebf0528', slot: "label" }, this.hasSlottedLabel && h("slot", { name: "label" }), !this.hasSlottedLabel && this.label, h("span", { key: '5d526fe661331f8eb1a887ddc0eabc3f3338747a', class: "label-aria" }, " (HH:mm)")), h("div", { key: '28fcd51b6e297d552e121a01813c92c564cccbda', 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: 'f93687883da3f3c32027edcd89d6989caad8e504', slot: "addon", placement: this.placement }, h("cat-button", { key: 'eae27c8538ff6564d6b5a735b30e8c2aac07751d', 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: 'a334804d935c713bb95e3bb88fce40fa7f05724c', slot: "content", class: "cat-nav" }, h("ul", { key: '713181fc8597cf4b9486f2fb7aa63fb412180054' }, this.timeArray().map(time => {
12805
- const isoTime = this.formatIso(time);
12868
+ 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 => {
12869
+ const isoTime = formatIso(time);
12806
12870
  const disabled = isBefore(time, this.min ?? null) || isAfter(time, this.max ?? null);
12807
12871
  return (h("li", null, h("cat-button", { class: {
12808
12872
  'cat-nav-item': true,
@@ -12851,14 +12915,27 @@ const CatTime = class {
12851
12915
  : '';
12852
12916
  return includeAmPm ? str : str.replace(/\s?(am|pm)/i, '');
12853
12917
  }
12854
- formatIso(date) {
12855
- return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
12918
+ reclamp(mode, limit) {
12919
+ if (!this.value)
12920
+ return;
12921
+ const min = (mode === 'min' ? limit : this.min) ?? null;
12922
+ const max = (mode === 'max' ? limit : this.max) ?? null;
12923
+ const [match, hh, mm] = this.value.match(/(\d{2}):(\d{2})/) ?? [];
12924
+ const newValue = match ? formatIso(clampTime(min, new Date(2000, 5, 1, Number(hh), Number(mm)), max)) : undefined;
12925
+ if (this.value !== newValue) {
12926
+ this.syncValue(newValue ?? '');
12927
+ this.catChange.emit(newValue);
12928
+ }
12856
12929
  }
12857
12930
  get hostElement() { return getElement(this); }
12931
+ static get watchers() { return {
12932
+ "min": ["onMinChanged"],
12933
+ "max": ["onMaxChanged"]
12934
+ }; }
12858
12935
  };
12859
12936
  CatTime.style = CatTimeStyle0;
12860
12937
 
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.5rem}: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))}";
12938
+ 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
12939
  const CatToggleStyle0 = catToggleCss;
12863
12940
 
12864
12941
  let nextUniqueId$1 = 0;