@economic/taco 2.70.3-day-picker-v9.0 → 2.70.3-day-picker-v9.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.
package/dist/taco.css CHANGED
@@ -263,6 +263,11 @@ table.yt-table tbody.yt-table__body tr.yt-table__row td.yt-table__cell {
263
263
  [data-taco='calendar'] .calendar-caption {
264
264
  @apply font-semibold;
265
265
  }
266
+
267
+ /* focus style gets overriden by global taco css otherwise */
268
+ [data-taco='calendar'] [data-taco='calendar-today-button'] {
269
+ @apply focus-visible:!yt-focus;
270
+ }
266
271
  [data-taco='card'] [data-taco='report'],
267
272
  [data-taco='card'] [data-taco='table2'] {
268
273
  @apply !border-0;
package/dist/taco.js CHANGED
@@ -23846,7 +23846,7 @@ const YearsDropdown = (props) => {
23846
23846
  return /* @__PURE__ */ React.createElement("select", { className: "h-8 px-2", name: "year", onChange, value }, years.map((year) => /* @__PURE__ */ React.createElement("option", { key: year, value: year }, String(year))));
23847
23847
  };
23848
23848
  const Calendar = (props) => {
23849
- const { onChange: handleChange, value, disabledDays, autoFocus = false, ...otherProps } = props;
23849
+ const { onChange: handleChange, value, disabledDays, ...otherProps } = props;
23850
23850
  const [visibleMonth, setVisibleMonth] = React.useState(value ?? /* @__PURE__ */ new Date());
23851
23851
  const { texts } = useLocalization();
23852
23852
  React.useEffect(() => {
@@ -23864,7 +23864,6 @@ const Calendar = (props) => {
23864
23864
  return /* @__PURE__ */ React.createElement("div", { "data-taco": "calendar" }, /* @__PURE__ */ React.createElement(
23865
23865
  DayPicker,
23866
23866
  {
23867
- autoFocus,
23868
23867
  captionLayout: "dropdown",
23869
23868
  className,
23870
23869
  components: {
@@ -25841,6 +25840,7 @@ const Datepicker = React.forwardRef(function Datepicker2(props, ref) {
25841
25840
  const { calendar: calendar2, input } = useDatepicker(otherProps, ref);
25842
25841
  const { texts } = useLocalization();
25843
25842
  const className = clsx("inline-flex w-full text-black font-normal", externalClassName);
25843
+ const popoverContentRef = React.useRef(null);
25844
25844
  const handlePopoverClick = React.useCallback((event) => {
25845
25845
  event.stopPropagation();
25846
25846
  }, []);
@@ -25852,6 +25852,12 @@ const Datepicker = React.forwardRef(function Datepicker2(props, ref) {
25852
25852
  },
25853
25853
  [input.ref]
25854
25854
  );
25855
+ const handleOpenAutoFocus = (event) => {
25856
+ var _a;
25857
+ event.preventDefault();
25858
+ const currentDay = ((_a = popoverContentRef == null ? void 0 : popoverContentRef.current) == null ? void 0 : _a.querySelector("td.rdp-selected button")) ?? null;
25859
+ currentDay == null ? void 0 : currentDay.focus();
25860
+ };
25855
25861
  const handleInputKeyDown = (event) => {
25856
25862
  var _a, _b;
25857
25863
  (_a = props.onKeyDown) == null ? void 0 : _a.call(props, event);
@@ -25871,43 +25877,49 @@ const Datepicker = React.forwardRef(function Datepicker2(props, ref) {
25871
25877
  disabled: input.disabled || input.readOnly,
25872
25878
  icon: "calendar",
25873
25879
  tabIndex: -1,
25874
- popover: (props2) => /* @__PURE__ */ React.createElement(Popover, { ...props2 }, /* @__PURE__ */ React.createElement(Popover.Content, { onCloseAutoFocus: handleCloseAutoFocus }, ({ close }) => /* @__PURE__ */ React.createElement("div", { className: "-m-3 flex", onClick: handlePopoverClick }, /* @__PURE__ */ React.createElement(
25875
- Calendar,
25876
- {
25877
- ...calendar2,
25878
- autoFocus: true,
25879
- onChange: (date2, event) => {
25880
- calendar2.onChange(date2, event);
25881
- close();
25882
- }
25883
- }
25884
- ), shortcuts && /* @__PURE__ */ React.createElement("div", { className: "border-grey-300 flex flex-col border-l" }, /* @__PURE__ */ React.createElement("span", { className: "m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold" }, shortcutsText ?? texts.datepicker.shortcuts), /* @__PURE__ */ React.createElement("ul", null, shortcuts.map((shortcut2) => /* @__PURE__ */ React.createElement("li", { key: shortcut2.text }, /* @__PURE__ */ React.createElement(
25885
- "button",
25880
+ popover: (props2) => /* @__PURE__ */ React.createElement(Popover, { ...props2 }, /* @__PURE__ */ React.createElement(
25881
+ Popover.Content,
25886
25882
  {
25887
- type: "button",
25888
- className: "hover:wcag-grey-200 flex w-full items-start px-4 py-1 text-xs",
25889
- "data-taco": "datepicker-shortcut",
25890
- onClick: (event) => {
25891
- event.persist();
25892
- shortcut2.onClick(event);
25893
- close();
25894
- }
25883
+ onOpenAutoFocus: handleOpenAutoFocus,
25884
+ onCloseAutoFocus: handleCloseAutoFocus
25895
25885
  },
25896
- shortcut2.text
25897
- )))), handleReset && /* @__PURE__ */ React.createElement(
25898
- "button",
25899
- {
25900
- type: "button",
25901
- className: "mx-auto my-4 mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
25902
- "data-taco": "datepicker-clear-button",
25903
- onClick: (event) => {
25904
- event.persist();
25905
- handleReset(event);
25906
- close();
25886
+ ({ close }) => /* @__PURE__ */ React.createElement("div", { ref: popoverContentRef, className: "-m-3 flex", onClick: handlePopoverClick }, /* @__PURE__ */ React.createElement(
25887
+ Calendar,
25888
+ {
25889
+ ...calendar2,
25890
+ onChange: (date2, event) => {
25891
+ calendar2.onChange(date2, event);
25892
+ close();
25893
+ }
25907
25894
  }
25908
- },
25909
- texts.datepicker.clear
25910
- ))))),
25895
+ ), shortcuts && /* @__PURE__ */ React.createElement("div", { className: "border-grey-300 flex flex-col border-l" }, /* @__PURE__ */ React.createElement("span", { className: "m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold" }, shortcutsText ?? texts.datepicker.shortcuts), /* @__PURE__ */ React.createElement("ul", null, shortcuts.map((shortcut2) => /* @__PURE__ */ React.createElement("li", { key: shortcut2.text }, /* @__PURE__ */ React.createElement(
25896
+ "button",
25897
+ {
25898
+ type: "button",
25899
+ className: "hover:wcag-grey-200 flex w-full items-start px-4 py-1 text-xs",
25900
+ "data-taco": "datepicker-shortcut",
25901
+ onClick: (event) => {
25902
+ event.persist();
25903
+ shortcut2.onClick(event);
25904
+ close();
25905
+ }
25906
+ },
25907
+ shortcut2.text
25908
+ )))), handleReset && /* @__PURE__ */ React.createElement(
25909
+ "button",
25910
+ {
25911
+ type: "button",
25912
+ className: "mx-auto my-4 mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
25913
+ "data-taco": "datepicker-clear-button",
25914
+ onClick: (event) => {
25915
+ event.persist();
25916
+ handleReset(event);
25917
+ close();
25918
+ }
25919
+ },
25920
+ texts.datepicker.clear
25921
+ )))
25922
+ )),
25911
25923
  tooltip: texts.datepicker.calendar,
25912
25924
  "data-taco": "toggle-calendar-button"
25913
25925
  }