@ark-ui/solid 3.6.0 → 3.6.2

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/esm/index.js CHANGED
@@ -64,6 +64,7 @@ import * as tabs$1 from '@zag-js/tabs';
64
64
  export { anatomy as tabsAnatomy } from '@zag-js/tabs';
65
65
  import * as tagsInput$1 from '@zag-js/tags-input';
66
66
  export { anatomy as tagsInputAnatomy } from '@zag-js/tags-input';
67
+ import { parseTime } from '@internationalized/date';
67
68
  import * as timePicker$1 from '@zag-js/time-picker';
68
69
  import * as toast$1 from '@zag-js/toast';
69
70
  export { anatomy as toastAnatomy } from '@zag-js/toast';
@@ -4424,10 +4425,10 @@ const SelectHiddenSelect = props => {
4424
4425
  get each() {
4425
4426
  return select().collection.items;
4426
4427
  },
4427
- children: option => (() => {
4428
+ children: item => (() => {
4428
4429
  var _el$2 = _tmpl$2$1();
4429
- insert(_el$2, () => option().label);
4430
- effect(() => _el$2.value = option().value);
4430
+ effect(() => _el$2.disabled = select().collection.getItemDisabled(item));
4431
+ effect(() => _el$2.value = select().collection.getItemValue(item) ?? '');
4431
4432
  return _el$2;
4432
4433
  })()
4433
4434
  })];
@@ -5474,191 +5475,6 @@ const TimePickerPositioner = props => {
5474
5475
  });
5475
5476
  };
5476
5477
 
5477
- function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
5478
- return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
5479
- }
5480
- function $14e0f24ef4ac5c92$var$timeToMs(a) {
5481
- return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
5482
- }
5483
-
5484
- function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
5485
- let inverseDuration = {};
5486
- for(let key in duration)if (typeof duration[key] === 'number') inverseDuration[key] = -duration[key];
5487
- return inverseDuration;
5488
- }
5489
- function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
5490
- let mutableValue = value.copy();
5491
- if (fields.hour != null) mutableValue.hour = fields.hour;
5492
- if (fields.minute != null) mutableValue.minute = fields.minute;
5493
- if (fields.second != null) mutableValue.second = fields.second;
5494
- if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
5495
- $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
5496
- return mutableValue;
5497
- }
5498
- function $735220c2d4774dd3$var$balanceTime(time) {
5499
- time.second += Math.floor(time.millisecond / 1000);
5500
- time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1000);
5501
- time.minute += Math.floor(time.second / 60);
5502
- time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
5503
- time.hour += Math.floor(time.minute / 60);
5504
- time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
5505
- let days = Math.floor(time.hour / 24);
5506
- time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
5507
- return days;
5508
- }
5509
- function $735220c2d4774dd3$export$7555de1e070510cb(time) {
5510
- time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
5511
- time.second = Math.max(0, Math.min(time.second, 59));
5512
- time.minute = Math.max(0, Math.min(time.minute, 59));
5513
- time.hour = Math.max(0, Math.min(time.hour, 23));
5514
- }
5515
- function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
5516
- let result = a % b;
5517
- if (result < 0) result += b;
5518
- return result;
5519
- }
5520
- function $735220c2d4774dd3$var$addTimeFields(time, duration) {
5521
- time.hour += duration.hours || 0;
5522
- time.minute += duration.minutes || 0;
5523
- time.second += duration.seconds || 0;
5524
- time.millisecond += duration.milliseconds || 0;
5525
- return $735220c2d4774dd3$var$balanceTime(time);
5526
- }
5527
- function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
5528
- let res = time.copy();
5529
- $735220c2d4774dd3$var$addTimeFields(res, duration);
5530
- return res;
5531
- }
5532
- function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
5533
- return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
5534
- }
5535
- function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
5536
- let mutable = value.copy();
5537
- switch(field){
5538
- case 'hour':
5539
- {
5540
- let hours = value.hour;
5541
- let min = 0;
5542
- let max = 23;
5543
- if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
5544
- let isPM = hours >= 12;
5545
- min = isPM ? 12 : 0;
5546
- max = isPM ? 23 : 11;
5547
- }
5548
- mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
5549
- break;
5550
- }
5551
- case 'minute':
5552
- mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
5553
- break;
5554
- case 'second':
5555
- mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
5556
- break;
5557
- case 'millisecond':
5558
- mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
5559
- break;
5560
- default:
5561
- throw new Error('Unsupported field ' + field);
5562
- }
5563
- return mutable;
5564
- }
5565
- function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
5566
- if (round) {
5567
- value += Math.sign(amount);
5568
- if (value < min) value = max;
5569
- let div = Math.abs(amount);
5570
- if (amount > 0) value = Math.ceil(value / div) * div;
5571
- else value = Math.floor(value / div) * div;
5572
- if (value > max) value = min;
5573
- } else {
5574
- value += amount;
5575
- if (value < min) value = max - (min - value - 1);
5576
- else if (value > max) value = min + (value - max - 1);
5577
- }
5578
- return value;
5579
- }
5580
-
5581
- /*
5582
- * Copyright 2020 Adobe. All rights reserved.
5583
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
5584
- * you may not use this file except in compliance with the License. You may obtain a copy
5585
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
5586
- *
5587
- * Unless required by applicable law or agreed to in writing, software distributed under
5588
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
5589
- * OF ANY KIND, either express or implied. See the License for the specific language
5590
- * governing permissions and limitations under the License.
5591
- */
5592
-
5593
-
5594
-
5595
- const $fae977aafc393c5c$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
5596
- function $fae977aafc393c5c$export$c9698ec7f05a07e1(value) {
5597
- let m = value.match($fae977aafc393c5c$var$TIME_RE);
5598
- if (!m) throw new Error('Invalid ISO 8601 time string: ' + value);
5599
- return new ($35ea8db9cb2ccb90$export$680ea196effce5f)($fae977aafc393c5c$var$parseNumber(m[1], 0, 23), m[2] ? $fae977aafc393c5c$var$parseNumber(m[2], 0, 59) : 0, m[3] ? $fae977aafc393c5c$var$parseNumber(m[3], 0, 59) : 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, Infinity) * 1000 : 0);
5600
- }
5601
- function $fae977aafc393c5c$var$parseNumber(value, min, max) {
5602
- let val = Number(value);
5603
- if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
5604
- return val;
5605
- }
5606
- function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
5607
- return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;
5608
- }
5609
-
5610
- function _check_private_redeclaration(obj, privateCollection) {
5611
- if (privateCollection.has(obj)) {
5612
- throw new TypeError("Cannot initialize the same private elements twice on an object");
5613
- }
5614
- }
5615
-
5616
- function _class_private_field_init(obj, privateMap, value) {
5617
- _check_private_redeclaration(obj, privateMap);
5618
- privateMap.set(obj, value);
5619
- }
5620
-
5621
- var // This prevents TypeScript from allowing other types with the same fields to match.
5622
- // @ts-ignore
5623
- $35ea8db9cb2ccb90$var$_type1 = /*#__PURE__*/ new WeakMap();
5624
- class $35ea8db9cb2ccb90$export$680ea196effce5f {
5625
- /** Returns a copy of this time. */ copy() {
5626
- return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
5627
- }
5628
- /** Returns a new `Time` with the given duration added to it. */ add(duration) {
5629
- return ($735220c2d4774dd3$export$7ed87b6bc2506470)(this, duration);
5630
- }
5631
- /** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) {
5632
- return ($735220c2d4774dd3$export$fe34d3a381cd7501)(this, duration);
5633
- }
5634
- /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
5635
- return ($735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields);
5636
- }
5637
- /**
5638
- * Returns a new `Time` with the given field adjusted by a specified amount.
5639
- * When the resulting value reaches the limits of the field, it wraps around.
5640
- */ cycle(field, amount, options) {
5641
- return ($735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
5642
- }
5643
- /** Converts the time to an ISO 8601 formatted string. */ toString() {
5644
- return ($fae977aafc393c5c$export$f59dee82248f5ad4)(this);
5645
- }
5646
- /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ compare(b) {
5647
- return ($14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, b);
5648
- }
5649
- constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
5650
- (_class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type1, {
5651
- writable: true,
5652
- value: void 0
5653
- });
5654
- this.hour = hour;
5655
- this.minute = minute;
5656
- this.second = second;
5657
- this.millisecond = millisecond;
5658
- ($735220c2d4774dd3$export$7555de1e070510cb)(this);
5659
- }
5660
- }
5661
-
5662
5478
  const useTimePicker = (props = {}) => {
5663
5479
  const locale = useLocaleContext();
5664
5480
  const environment = useEnvironmentContext();
@@ -5670,9 +5486,9 @@ const useTimePicker = (props = {}) => {
5670
5486
  open: props.defaultOpen,
5671
5487
  'open.controlled': props.open !== undefined,
5672
5488
  ...props,
5673
- value: props.defaultValue ? $fae977aafc393c5c$export$c9698ec7f05a07e1(props.defaultValue) : undefined,
5674
- min: props.min ? $fae977aafc393c5c$export$c9698ec7f05a07e1(props.min) : undefined,
5675
- max: props.max ? $fae977aafc393c5c$export$c9698ec7f05a07e1(props.max) : undefined
5489
+ value: props.defaultValue ? parseTime(props.defaultValue) : undefined,
5490
+ min: props.min ? parseTime(props.min) : undefined,
5491
+ max: props.max ? parseTime(props.max) : undefined
5676
5492
  }));
5677
5493
  const [state, send] = useMachine(timePicker$1.machine(context()), {
5678
5494
  context