@sia.soul/sia-react-ui 0.1.44 → 0.1.46

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.
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-H7IAG72O.js";
15
15
 
16
16
  // src/components/DatePicker.tsx
17
- import { useEffect, useId, useMemo, useRef as useRef2, useState } from "react";
17
+ import { useEffect, useId, useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef2, useState } from "react";
18
18
 
19
19
  // src/components/DatePickerPanel.tsx
20
20
  import { useLayoutEffect, useRef } from "react";
@@ -496,6 +496,24 @@ function DateRangePicker({
496
496
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
497
497
  const [draftValue, setDraftValue] = useState(currentValue);
498
498
  const [activeIndex, setActiveIndex] = useState(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
499
+ const indicatorRef = useRef2(null);
500
+ useLayoutEffect2(() => {
501
+ const field = rootRef.current?.querySelector(`[data-range-endpoint="${activeIndex}"]`);
502
+ const indicator = indicatorRef.current;
503
+ if (!field || !indicator) return;
504
+ const alignIndicator = () => {
505
+ indicator.style.transform = `translateX(${field.offsetLeft}px)`;
506
+ indicator.style.width = `${field.offsetWidth}px`;
507
+ };
508
+ alignIndicator();
509
+ const observer = new ResizeObserver(alignIndicator);
510
+ const trigger = field.parentElement;
511
+ if (trigger) {
512
+ observer.observe(trigger);
513
+ for (const child of trigger.children) if (child !== indicator) observer.observe(child);
514
+ }
515
+ return () => observer.disconnect();
516
+ });
499
517
  const [confirmedIndex, setConfirmedIndex] = useState(null);
500
518
  const [presetSelected, setPresetSelected] = useState(false);
501
519
  const [hoverDate, setHoverDate] = useState("");
@@ -762,6 +780,7 @@ function DateRangePicker({
762
780
  /* @__PURE__ */ jsx2("span", { className: `sia-picker-range-control__value${displayValue[1] ? "" : " is-placeholder"}`, children: displayValue[1] ? formatValue(displayValue[1]) : placeholder[1] }),
763
781
  endFloating.label
764
782
  ] }),
783
+ /* @__PURE__ */ jsx2("span", { ref: indicatorRef, className: "sia-picker-range-control__indicator", "aria-hidden": "true" }),
765
784
  /* @__PURE__ */ jsx2("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ jsx2(Icon, { name: "calendar", size: 16 }) })
766
785
  ]
767
786
  }
package/dist/core.css CHANGED
@@ -121,15 +121,26 @@ fieldset:disabled .sia-input-number__floating-placeholder {
121
121
  min-width: 0;
122
122
  height: 100%;
123
123
  }
124
- .sia-picker-range-control__field.is-active::after {
125
- content: "";
124
+ .sia-picker-range-control > .sia-picker__trigger {
125
+ position: relative;
126
+ }
127
+ .sia-picker-range-control__indicator {
126
128
  position: absolute;
127
- right: 0;
128
129
  bottom: -1px;
129
130
  left: 0;
130
131
  height: 3px;
131
132
  background: var(--sia-color-primary);
132
133
  pointer-events: none;
134
+ visibility: hidden;
135
+ }
136
+ .sia-picker-range-control.is-open .sia-picker-range-control__indicator {
137
+ visibility: visible;
138
+ transition: transform 220ms ease, width 220ms ease;
139
+ }
140
+ @media (prefers-reduced-motion: reduce) {
141
+ .sia-picker-range-control.is-open .sia-picker-range-control__indicator {
142
+ transition: none;
143
+ }
133
144
  }
134
145
  .sia-picker-range-control__field.sia-placeholder-floating > .is-placeholder {
135
146
  color: transparent;