@clickhouse/click-ui 0.0.202 → 0.0.203

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.
@@ -17126,13 +17126,6 @@ pt.svg.withConfig({
17126
17126
  }
17127
17127
  `);
17128
17128
  const locale = "en-US";
17129
- const weekdayFormatter = new Intl.DateTimeFormat(locale, {
17130
- weekday: "short"
17131
- });
17132
- const headerDateFormatter = new Intl.DateTimeFormat(locale, {
17133
- month: "short",
17134
- year: "numeric"
17135
- });
17136
17129
  const selectedDateFormatter = new Intl.DateTimeFormat(locale, {
17137
17130
  day: "2-digit",
17138
17131
  month: "short",
@@ -17140,20 +17133,41 @@ const selectedDateFormatter = new Intl.DateTimeFormat(locale, {
17140
17133
  });
17141
17134
  const explicitWidth = "250px";
17142
17135
  const HighlightedInputWrapper = pt(InputWrapper).withConfig({
17143
- componentId: "sc-1kfphgn-0"
17136
+ componentId: "sc-1m6g9rm-0"
17144
17137
  })(["", " width:", ";}"], ({
17145
17138
  $isActive,
17146
17139
  theme: theme2
17147
17140
  }) => {
17148
17141
  return `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isActive ? theme2.click.datePicker.dateOption.color.stroke.active : theme2.click.field.color.stroke.default};`;
17149
17142
  }, explicitWidth);
17143
+ const DatePickerInput = ({
17144
+ isActive,
17145
+ disabled,
17146
+ id,
17147
+ placeholder,
17148
+ selectedDate
17149
+ }) => {
17150
+ const defaultId = useId();
17151
+ const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
17152
+ return /* @__PURE__ */ jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
17153
+ /* @__PURE__ */ jsx(SvgImage, { name: "calendar" }),
17154
+ /* @__PURE__ */ jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
17155
+ ] });
17156
+ };
17157
+ const weekdayFormatter = new Intl.DateTimeFormat(locale, {
17158
+ weekday: "short"
17159
+ });
17160
+ const headerDateFormatter = new Intl.DateTimeFormat(locale, {
17161
+ month: "short",
17162
+ year: "numeric"
17163
+ });
17150
17164
  const DatePickerContainer = pt(Container).withConfig({
17151
- componentId: "sc-1kfphgn-1"
17165
+ componentId: "sc-1m6g9rm-1"
17152
17166
  })(["background:", ";"], ({
17153
17167
  theme: theme2
17154
17168
  }) => theme2.click.datePicker.dateOption.color.background.default);
17155
17169
  const UnselectableTitle = pt.h2.withConfig({
17156
- componentId: "sc-1kfphgn-2"
17170
+ componentId: "sc-1m6g9rm-2"
17157
17171
  })(["", " user-select:none;"], ({
17158
17172
  theme: theme2
17159
17173
  }) => `
@@ -17161,16 +17175,14 @@ const UnselectableTitle = pt.h2.withConfig({
17161
17175
  font: ${theme2.click.datePicker.typography.title.default};
17162
17176
  `);
17163
17177
  const DateTable = pt.table.withConfig({
17164
- componentId: "sc-1kfphgn-3"
17165
- })(["border-collapse:separate;border-spacing:0;font:", " table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{", ";padding:4px;}"], ({
17178
+ componentId: "sc-1m6g9rm-3"
17179
+ })(["border-collapse:separate;border-spacing:0;font:", ";table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{padding:4px;}"], ({
17166
17180
  theme: theme2
17167
17181
  }) => theme2.typography.styles.product.text.normal.md, explicitWidth, ({
17168
17182
  theme: theme2
17169
- }) => theme2.click.datePicker.dateOption.size.height, ({
17170
- theme: theme2
17171
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default}`);
17183
+ }) => theme2.click.datePicker.dateOption.size.height);
17172
17184
  const DateTableHeader = pt.th.withConfig({
17173
- componentId: "sc-1kfphgn-4"
17185
+ componentId: "sc-1m6g9rm-4"
17174
17186
  })(["", " width:14%;"], ({
17175
17187
  theme: theme2
17176
17188
  }) => `
@@ -17178,10 +17190,11 @@ const DateTableHeader = pt.th.withConfig({
17178
17190
  font: ${theme2.click.datePicker.typography.daytitle.default};
17179
17191
  `);
17180
17192
  const DateTableCell = pt.td.withConfig({
17181
- componentId: "sc-1kfphgn-5"
17193
+ componentId: "sc-1m6g9rm-5"
17182
17194
  })(["", " ", " ", " text-align:center;", " &:hover{", ";}"], ({
17183
17195
  theme: theme2
17184
17196
  }) => `
17197
+ border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default};
17185
17198
  border-radius: ${theme2.click.datePicker.dateOption.radii.default};
17186
17199
  font: ${theme2.click.datePicker.dateOption.typography.label.default};
17187
17200
  `, ({
@@ -17203,50 +17216,35 @@ const DateTableCell = pt.td.withConfig({
17203
17216
  }) => $isToday && `font: ${theme2.click.datePicker.dateOption.typography.label.active};`, ({
17204
17217
  $isDisabled,
17205
17218
  theme: theme2
17206
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover}`);
17207
- const DatePickerInput = ({
17208
- isActive,
17209
- disabled,
17210
- id,
17211
- placeholder,
17212
- selectedDate
17213
- }) => {
17214
- const defaultId = useId();
17215
- const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
17216
- return /* @__PURE__ */ jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
17217
- /* @__PURE__ */ jsx(SvgImage, { name: "calendar" }),
17218
- /* @__PURE__ */ jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
17219
- ] });
17220
- };
17221
- const Calendar = ({
17222
- closeDatepicker,
17223
- futureDatesDisabled,
17224
- selectedDate,
17225
- setSelectedDate
17219
+ }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover};
17220
+
17221
+
17222
+ border-radius: ${theme2.click.datePicker.dateOption.radii.default};`);
17223
+ const CalendarRenderer = ({
17224
+ calendarOptions = {},
17225
+ children,
17226
+ ...props
17226
17227
  }) => {
17227
- const calendarOptions = {
17228
- defaultWeekStart: 1
17229
- };
17230
- if (selectedDate) {
17231
- calendarOptions.defaultDate = selectedDate;
17232
- }
17233
17228
  const {
17234
17229
  body,
17235
17230
  headers,
17236
17231
  month,
17237
17232
  navigation,
17238
17233
  year
17239
- } = useCalendar(calendarOptions);
17240
- const handleNextClick = () => {
17234
+ } = useCalendar({
17235
+ defaultWeekStart: 1,
17236
+ ...calendarOptions
17237
+ });
17238
+ const handleNextClick = useCallback(() => {
17241
17239
  navigation.toNext();
17242
- };
17243
- const handlePreviousClick = () => {
17240
+ }, [navigation]);
17241
+ const handlePreviousClick = useCallback(() => {
17244
17242
  navigation.toPrev();
17245
- };
17243
+ }, [navigation]);
17246
17244
  const headerDate = /* @__PURE__ */ new Date();
17247
17245
  headerDate.setMonth(month);
17248
17246
  headerDate.setFullYear(year);
17249
- return /* @__PURE__ */ jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", children: [
17247
+ return /* @__PURE__ */ jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", ...props, children: [
17250
17248
  /* @__PURE__ */ jsxs(Container, { isResponsive: false, justifyContent: "space-between", orientation: "horizontal", children: [
17251
17249
  /* @__PURE__ */ jsx(IconButton$1, { icon: "chevron-left", onClick: handlePreviousClick, size: "sm", type: "ghost" }),
17252
17250
  /* @__PURE__ */ jsx(UnselectableTitle, { children: headerDateFormatter.format(headerDate) }),
@@ -17259,32 +17257,42 @@ const Calendar = ({
17259
17257
  }) => {
17260
17258
  return /* @__PURE__ */ jsx(DateTableHeader, { children: weekdayFormatter.format(date) }, key);
17261
17259
  }) }) }),
17262
- /* @__PURE__ */ jsx("tbody", { children: body.value.map(({
17263
- key: weekKey,
17264
- value: week
17265
- }) => {
17266
- return /* @__PURE__ */ jsx("tr", { children: week.map(({
17267
- date,
17268
- isCurrentMonth,
17269
- key: dayKey,
17270
- value: fullDate
17271
- }) => {
17272
- const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
17273
- const today = /* @__PURE__ */ new Date();
17274
- const isCurrentDate = isSameDate(today, fullDate);
17275
- const isDisabled = futureDatesDisabled ? fullDate > today : false;
17276
- return /* @__PURE__ */ jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: () => {
17277
- if (isDisabled) {
17278
- return false;
17279
- }
17280
- setSelectedDate(fullDate);
17281
- closeDatepicker();
17282
- }, children: date }, dayKey);
17283
- }) }, weekKey);
17284
- }) })
17260
+ /* @__PURE__ */ jsx("tbody", { children: children(body) })
17285
17261
  ] })
17286
17262
  ] });
17287
17263
  };
17264
+ const Calendar = ({
17265
+ calendarBody,
17266
+ closeDatepicker,
17267
+ futureDatesDisabled,
17268
+ selectedDate,
17269
+ setSelectedDate
17270
+ }) => {
17271
+ return calendarBody.value.map(({
17272
+ key: weekKey,
17273
+ value: week
17274
+ }) => {
17275
+ return /* @__PURE__ */ jsx("tr", { children: week.map(({
17276
+ date,
17277
+ isCurrentMonth,
17278
+ key: dayKey,
17279
+ value: fullDate
17280
+ }) => {
17281
+ const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
17282
+ const today = /* @__PURE__ */ new Date();
17283
+ const isCurrentDate = isSameDate(today, fullDate);
17284
+ const isDisabled = futureDatesDisabled ? fullDate > today : false;
17285
+ const handleClick = () => {
17286
+ if (isDisabled) {
17287
+ return false;
17288
+ }
17289
+ setSelectedDate(fullDate);
17290
+ closeDatepicker();
17291
+ };
17292
+ return /* @__PURE__ */ jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: handleClick, children: date }, dayKey);
17293
+ }) }, weekKey);
17294
+ });
17295
+ };
17288
17296
  const DatePicker = ({
17289
17297
  date,
17290
17298
  disabled = false,
@@ -17294,6 +17302,10 @@ const DatePicker = ({
17294
17302
  }) => {
17295
17303
  const [isOpen, setIsOpen] = useState(false);
17296
17304
  const [selectedDate, setSelectedDate] = useState();
17305
+ const calendarOptions = {};
17306
+ if (selectedDate) {
17307
+ calendarOptions.defaultDate = selectedDate;
17308
+ }
17297
17309
  useEffect(() => {
17298
17310
  if (date) {
17299
17311
  setSelectedDate(date);
@@ -17307,8 +17319,8 @@ const DatePicker = ({
17307
17319
  onSelectDate(selectedDate2);
17308
17320
  };
17309
17321
  return /* @__PURE__ */ jsxs(Dropdown, { onOpenChange: setIsOpen, open: isOpen, children: [
17310
- /* @__PURE__ */ jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsx(DatePickerInput, { "data-testid": "datepicker-inpcontainer", disabled, isActive: isOpen, placeholder, selectedDate }) }),
17311
- /* @__PURE__ */ jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsx(Calendar, { closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) })
17322
+ /* @__PURE__ */ jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsx(DatePickerInput, { "data-testid": "datepicker-input-container", disabled, isActive: isOpen, placeholder, selectedDate }) }),
17323
+ /* @__PURE__ */ jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsx(CalendarRenderer, { calendarOptions, children: (body) => /* @__PURE__ */ jsx(Calendar, { calendarBody: body, closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) }) })
17312
17324
  ] });
17313
17325
  };
17314
17326
  const $5d3850c4d0b4e6c7$var$DIALOG_NAME = "Dialog";
@@ -17142,13 +17142,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17142
17142
  }
17143
17143
  `);
17144
17144
  const locale = "en-US";
17145
- const weekdayFormatter = new Intl.DateTimeFormat(locale, {
17146
- weekday: "short"
17147
- });
17148
- const headerDateFormatter = new Intl.DateTimeFormat(locale, {
17149
- month: "short",
17150
- year: "numeric"
17151
- });
17152
17145
  const selectedDateFormatter = new Intl.DateTimeFormat(locale, {
17153
17146
  day: "2-digit",
17154
17147
  month: "short",
@@ -17156,20 +17149,41 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17156
17149
  });
17157
17150
  const explicitWidth = "250px";
17158
17151
  const HighlightedInputWrapper = pt(InputWrapper).withConfig({
17159
- componentId: "sc-1kfphgn-0"
17152
+ componentId: "sc-1m6g9rm-0"
17160
17153
  })(["", " width:", ";}"], ({
17161
17154
  $isActive,
17162
17155
  theme: theme2
17163
17156
  }) => {
17164
17157
  return `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isActive ? theme2.click.datePicker.dateOption.color.stroke.active : theme2.click.field.color.stroke.default};`;
17165
17158
  }, explicitWidth);
17159
+ const DatePickerInput = ({
17160
+ isActive,
17161
+ disabled,
17162
+ id,
17163
+ placeholder,
17164
+ selectedDate
17165
+ }) => {
17166
+ const defaultId = React.useId();
17167
+ const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
17168
+ return /* @__PURE__ */ jsxRuntime.jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
17169
+ /* @__PURE__ */ jsxRuntime.jsx(SvgImage, { name: "calendar" }),
17170
+ /* @__PURE__ */ jsxRuntime.jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
17171
+ ] });
17172
+ };
17173
+ const weekdayFormatter = new Intl.DateTimeFormat(locale, {
17174
+ weekday: "short"
17175
+ });
17176
+ const headerDateFormatter = new Intl.DateTimeFormat(locale, {
17177
+ month: "short",
17178
+ year: "numeric"
17179
+ });
17166
17180
  const DatePickerContainer = pt(Container).withConfig({
17167
- componentId: "sc-1kfphgn-1"
17181
+ componentId: "sc-1m6g9rm-1"
17168
17182
  })(["background:", ";"], ({
17169
17183
  theme: theme2
17170
17184
  }) => theme2.click.datePicker.dateOption.color.background.default);
17171
17185
  const UnselectableTitle = pt.h2.withConfig({
17172
- componentId: "sc-1kfphgn-2"
17186
+ componentId: "sc-1m6g9rm-2"
17173
17187
  })(["", " user-select:none;"], ({
17174
17188
  theme: theme2
17175
17189
  }) => `
@@ -17177,16 +17191,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17177
17191
  font: ${theme2.click.datePicker.typography.title.default};
17178
17192
  `);
17179
17193
  const DateTable = pt.table.withConfig({
17180
- componentId: "sc-1kfphgn-3"
17181
- })(["border-collapse:separate;border-spacing:0;font:", " table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{", ";padding:4px;}"], ({
17194
+ componentId: "sc-1m6g9rm-3"
17195
+ })(["border-collapse:separate;border-spacing:0;font:", ";table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{padding:4px;}"], ({
17182
17196
  theme: theme2
17183
17197
  }) => theme2.typography.styles.product.text.normal.md, explicitWidth, ({
17184
17198
  theme: theme2
17185
- }) => theme2.click.datePicker.dateOption.size.height, ({
17186
- theme: theme2
17187
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default}`);
17199
+ }) => theme2.click.datePicker.dateOption.size.height);
17188
17200
  const DateTableHeader = pt.th.withConfig({
17189
- componentId: "sc-1kfphgn-4"
17201
+ componentId: "sc-1m6g9rm-4"
17190
17202
  })(["", " width:14%;"], ({
17191
17203
  theme: theme2
17192
17204
  }) => `
@@ -17194,10 +17206,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17194
17206
  font: ${theme2.click.datePicker.typography.daytitle.default};
17195
17207
  `);
17196
17208
  const DateTableCell = pt.td.withConfig({
17197
- componentId: "sc-1kfphgn-5"
17209
+ componentId: "sc-1m6g9rm-5"
17198
17210
  })(["", " ", " ", " text-align:center;", " &:hover{", ";}"], ({
17199
17211
  theme: theme2
17200
17212
  }) => `
17213
+ border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default};
17201
17214
  border-radius: ${theme2.click.datePicker.dateOption.radii.default};
17202
17215
  font: ${theme2.click.datePicker.dateOption.typography.label.default};
17203
17216
  `, ({
@@ -17219,50 +17232,35 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17219
17232
  }) => $isToday && `font: ${theme2.click.datePicker.dateOption.typography.label.active};`, ({
17220
17233
  $isDisabled,
17221
17234
  theme: theme2
17222
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover}`);
17223
- const DatePickerInput = ({
17224
- isActive,
17225
- disabled,
17226
- id,
17227
- placeholder,
17228
- selectedDate
17229
- }) => {
17230
- const defaultId = React.useId();
17231
- const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
17232
- return /* @__PURE__ */ jsxRuntime.jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
17233
- /* @__PURE__ */ jsxRuntime.jsx(SvgImage, { name: "calendar" }),
17234
- /* @__PURE__ */ jsxRuntime.jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
17235
- ] });
17236
- };
17237
- const Calendar = ({
17238
- closeDatepicker,
17239
- futureDatesDisabled,
17240
- selectedDate,
17241
- setSelectedDate
17235
+ }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover};
17236
+
17237
+
17238
+ border-radius: ${theme2.click.datePicker.dateOption.radii.default};`);
17239
+ const CalendarRenderer = ({
17240
+ calendarOptions = {},
17241
+ children,
17242
+ ...props
17242
17243
  }) => {
17243
- const calendarOptions = {
17244
- defaultWeekStart: 1
17245
- };
17246
- if (selectedDate) {
17247
- calendarOptions.defaultDate = selectedDate;
17248
- }
17249
17244
  const {
17250
17245
  body,
17251
17246
  headers,
17252
17247
  month,
17253
17248
  navigation,
17254
17249
  year
17255
- } = useCalendar(calendarOptions);
17256
- const handleNextClick = () => {
17250
+ } = useCalendar({
17251
+ defaultWeekStart: 1,
17252
+ ...calendarOptions
17253
+ });
17254
+ const handleNextClick = React.useCallback(() => {
17257
17255
  navigation.toNext();
17258
- };
17259
- const handlePreviousClick = () => {
17256
+ }, [navigation]);
17257
+ const handlePreviousClick = React.useCallback(() => {
17260
17258
  navigation.toPrev();
17261
- };
17259
+ }, [navigation]);
17262
17260
  const headerDate = /* @__PURE__ */ new Date();
17263
17261
  headerDate.setMonth(month);
17264
17262
  headerDate.setFullYear(year);
17265
- return /* @__PURE__ */ jsxRuntime.jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", children: [
17263
+ return /* @__PURE__ */ jsxRuntime.jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", ...props, children: [
17266
17264
  /* @__PURE__ */ jsxRuntime.jsxs(Container, { isResponsive: false, justifyContent: "space-between", orientation: "horizontal", children: [
17267
17265
  /* @__PURE__ */ jsxRuntime.jsx(IconButton$1, { icon: "chevron-left", onClick: handlePreviousClick, size: "sm", type: "ghost" }),
17268
17266
  /* @__PURE__ */ jsxRuntime.jsx(UnselectableTitle, { children: headerDateFormatter.format(headerDate) }),
@@ -17275,32 +17273,42 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17275
17273
  }) => {
17276
17274
  return /* @__PURE__ */ jsxRuntime.jsx(DateTableHeader, { children: weekdayFormatter.format(date) }, key);
17277
17275
  }) }) }),
17278
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: body.value.map(({
17279
- key: weekKey,
17280
- value: week
17281
- }) => {
17282
- return /* @__PURE__ */ jsxRuntime.jsx("tr", { children: week.map(({
17283
- date,
17284
- isCurrentMonth,
17285
- key: dayKey,
17286
- value: fullDate
17287
- }) => {
17288
- const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
17289
- const today = /* @__PURE__ */ new Date();
17290
- const isCurrentDate = isSameDate(today, fullDate);
17291
- const isDisabled = futureDatesDisabled ? fullDate > today : false;
17292
- return /* @__PURE__ */ jsxRuntime.jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: () => {
17293
- if (isDisabled) {
17294
- return false;
17295
- }
17296
- setSelectedDate(fullDate);
17297
- closeDatepicker();
17298
- }, children: date }, dayKey);
17299
- }) }, weekKey);
17300
- }) })
17276
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: children(body) })
17301
17277
  ] })
17302
17278
  ] });
17303
17279
  };
17280
+ const Calendar = ({
17281
+ calendarBody,
17282
+ closeDatepicker,
17283
+ futureDatesDisabled,
17284
+ selectedDate,
17285
+ setSelectedDate
17286
+ }) => {
17287
+ return calendarBody.value.map(({
17288
+ key: weekKey,
17289
+ value: week
17290
+ }) => {
17291
+ return /* @__PURE__ */ jsxRuntime.jsx("tr", { children: week.map(({
17292
+ date,
17293
+ isCurrentMonth,
17294
+ key: dayKey,
17295
+ value: fullDate
17296
+ }) => {
17297
+ const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
17298
+ const today = /* @__PURE__ */ new Date();
17299
+ const isCurrentDate = isSameDate(today, fullDate);
17300
+ const isDisabled = futureDatesDisabled ? fullDate > today : false;
17301
+ const handleClick = () => {
17302
+ if (isDisabled) {
17303
+ return false;
17304
+ }
17305
+ setSelectedDate(fullDate);
17306
+ closeDatepicker();
17307
+ };
17308
+ return /* @__PURE__ */ jsxRuntime.jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: handleClick, children: date }, dayKey);
17309
+ }) }, weekKey);
17310
+ });
17311
+ };
17304
17312
  const DatePicker = ({
17305
17313
  date,
17306
17314
  disabled = false,
@@ -17310,6 +17318,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17310
17318
  }) => {
17311
17319
  const [isOpen, setIsOpen] = React.useState(false);
17312
17320
  const [selectedDate, setSelectedDate] = React.useState();
17321
+ const calendarOptions = {};
17322
+ if (selectedDate) {
17323
+ calendarOptions.defaultDate = selectedDate;
17324
+ }
17313
17325
  React.useEffect(() => {
17314
17326
  if (date) {
17315
17327
  setSelectedDate(date);
@@ -17323,8 +17335,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
17323
17335
  onSelectDate(selectedDate2);
17324
17336
  };
17325
17337
  return /* @__PURE__ */ jsxRuntime.jsxs(Dropdown, { onOpenChange: setIsOpen, open: isOpen, children: [
17326
- /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsxRuntime.jsx(DatePickerInput, { "data-testid": "datepicker-inpcontainer", disabled, isActive: isOpen, placeholder, selectedDate }) }),
17327
- /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(Calendar, { closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) })
17338
+ /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsxRuntime.jsx(DatePickerInput, { "data-testid": "datepicker-input-container", disabled, isActive: isOpen, placeholder, selectedDate }) }),
17339
+ /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(CalendarRenderer, { calendarOptions, children: (body) => /* @__PURE__ */ jsxRuntime.jsx(Calendar, { calendarBody: body, closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) }) })
17328
17340
  ] });
17329
17341
  };
17330
17342
  const $5d3850c4d0b4e6c7$var$DIALOG_NAME = "Dialog";
@@ -15958,62 +15958,75 @@ styled.svg.withConfig({
15958
15958
  }
15959
15959
  `);
15960
15960
  const locale = "en-US";
15961
- const weekdayFormatter = new Intl.DateTimeFormat(locale, {
15962
- weekday: "short"
15963
- });
15964
- const headerDateFormatter = new Intl.DateTimeFormat(locale, {
15965
- month: "short",
15966
- year: "numeric"
15967
- });
15968
15961
  const selectedDateFormatter = new Intl.DateTimeFormat(locale, {
15969
15962
  day: "2-digit",
15970
15963
  month: "short",
15971
15964
  year: "numeric"
15972
15965
  });
15973
15966
  const explicitWidth = "250px";
15974
- const HighlightedInputWrapper = styled(InputWrapper).withConfig({
15975
- componentId: "sc-1kfphgn-0"
15967
+ const HighlightedInputWrapper = styled$1(InputWrapper).withConfig({
15968
+ componentId: "sc-1m6g9rm-0"
15976
15969
  })(["", " width:", ";}"], ({
15977
15970
  $isActive,
15978
15971
  theme: theme2
15979
15972
  }) => {
15980
15973
  return `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isActive ? theme2.click.datePicker.dateOption.color.stroke.active : theme2.click.field.color.stroke.default};`;
15981
15974
  }, explicitWidth);
15982
- const DatePickerContainer = styled(Container).withConfig({
15983
- componentId: "sc-1kfphgn-1"
15975
+ const DatePickerInput = ({
15976
+ isActive,
15977
+ disabled,
15978
+ id,
15979
+ placeholder,
15980
+ selectedDate
15981
+ }) => {
15982
+ const defaultId = useId();
15983
+ const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
15984
+ return /* @__PURE__ */ jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
15985
+ /* @__PURE__ */ jsx(SvgImage, { name: "calendar" }),
15986
+ /* @__PURE__ */ jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
15987
+ ] });
15988
+ };
15989
+ const weekdayFormatter = new Intl.DateTimeFormat(locale, {
15990
+ weekday: "short"
15991
+ });
15992
+ const headerDateFormatter = new Intl.DateTimeFormat(locale, {
15993
+ month: "short",
15994
+ year: "numeric"
15995
+ });
15996
+ const DatePickerContainer = styled$1(Container).withConfig({
15997
+ componentId: "sc-1m6g9rm-1"
15984
15998
  })(["background:", ";"], ({
15985
15999
  theme: theme2
15986
16000
  }) => theme2.click.datePicker.dateOption.color.background.default);
15987
- const UnselectableTitle = styled.h2.withConfig({
15988
- componentId: "sc-1kfphgn-2"
16001
+ const UnselectableTitle = styled$1.h2.withConfig({
16002
+ componentId: "sc-1m6g9rm-2"
15989
16003
  })(["", " user-select:none;"], ({
15990
16004
  theme: theme2
15991
16005
  }) => `
15992
16006
  color: ${theme2.click.datePicker.color.title.default};
15993
16007
  font: ${theme2.click.datePicker.typography.title.default};
15994
16008
  `);
15995
- const DateTable = styled.table.withConfig({
15996
- componentId: "sc-1kfphgn-3"
15997
- })(["border-collapse:separate;border-spacing:0;font:", " table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{", ";padding:4px;}"], ({
16009
+ const DateTable = styled$1.table.withConfig({
16010
+ componentId: "sc-1m6g9rm-3"
16011
+ })(["border-collapse:separate;border-spacing:0;font:", ";table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{padding:4px;}"], ({
15998
16012
  theme: theme2
15999
16013
  }) => theme2.typography.styles.product.text.normal.md, explicitWidth, ({
16000
16014
  theme: theme2
16001
- }) => theme2.click.datePicker.dateOption.size.height, ({
16002
- theme: theme2
16003
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default}`);
16004
- const DateTableHeader = styled.th.withConfig({
16005
- componentId: "sc-1kfphgn-4"
16015
+ }) => theme2.click.datePicker.dateOption.size.height);
16016
+ const DateTableHeader = styled$1.th.withConfig({
16017
+ componentId: "sc-1m6g9rm-4"
16006
16018
  })(["", " width:14%;"], ({
16007
16019
  theme: theme2
16008
16020
  }) => `
16009
16021
  color: ${theme2.click.datePicker.color.daytitle.default};
16010
16022
  font: ${theme2.click.datePicker.typography.daytitle.default};
16011
16023
  `);
16012
- const DateTableCell = styled.td.withConfig({
16013
- componentId: "sc-1kfphgn-5"
16024
+ const DateTableCell = styled$1.td.withConfig({
16025
+ componentId: "sc-1m6g9rm-5"
16014
16026
  })(["", " ", " ", " text-align:center;", " &:hover{", ";}"], ({
16015
16027
  theme: theme2
16016
16028
  }) => `
16029
+ border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default};
16017
16030
  border-radius: ${theme2.click.datePicker.dateOption.radii.default};
16018
16031
  font: ${theme2.click.datePicker.dateOption.typography.label.default};
16019
16032
  `, ({
@@ -16035,50 +16048,35 @@ const DateTableCell = styled.td.withConfig({
16035
16048
  }) => $isToday && `font: ${theme2.click.datePicker.dateOption.typography.label.active};`, ({
16036
16049
  $isDisabled,
16037
16050
  theme: theme2
16038
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover}`);
16039
- const DatePickerInput = ({
16040
- isActive,
16041
- disabled,
16042
- id,
16043
- placeholder,
16044
- selectedDate
16045
- }) => {
16046
- const defaultId = useId();
16047
- const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
16048
- return /* @__PURE__ */ jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
16049
- /* @__PURE__ */ jsx(SvgImage, { name: "calendar" }),
16050
- /* @__PURE__ */ jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
16051
- ] });
16052
- };
16053
- const Calendar = ({
16054
- closeDatepicker,
16055
- futureDatesDisabled,
16056
- selectedDate,
16057
- setSelectedDate
16051
+ }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover};
16052
+
16053
+
16054
+ border-radius: ${theme2.click.datePicker.dateOption.radii.default};`);
16055
+ const CalendarRenderer = ({
16056
+ calendarOptions = {},
16057
+ children,
16058
+ ...props
16058
16059
  }) => {
16059
- const calendarOptions = {
16060
- defaultWeekStart: 1
16061
- };
16062
- if (selectedDate) {
16063
- calendarOptions.defaultDate = selectedDate;
16064
- }
16065
16060
  const {
16066
16061
  body,
16067
16062
  headers,
16068
16063
  month,
16069
16064
  navigation,
16070
16065
  year
16071
- } = useCalendar(calendarOptions);
16072
- const handleNextClick = () => {
16066
+ } = useCalendar({
16067
+ defaultWeekStart: 1,
16068
+ ...calendarOptions
16069
+ });
16070
+ const handleNextClick = useCallback(() => {
16073
16071
  navigation.toNext();
16074
- };
16075
- const handlePreviousClick = () => {
16072
+ }, [navigation]);
16073
+ const handlePreviousClick = useCallback(() => {
16076
16074
  navigation.toPrev();
16077
- };
16075
+ }, [navigation]);
16078
16076
  const headerDate = /* @__PURE__ */ new Date();
16079
16077
  headerDate.setMonth(month);
16080
16078
  headerDate.setFullYear(year);
16081
- return /* @__PURE__ */ jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", children: [
16079
+ return /* @__PURE__ */ jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", ...props, children: [
16082
16080
  /* @__PURE__ */ jsxs(Container, { isResponsive: false, justifyContent: "space-between", orientation: "horizontal", children: [
16083
16081
  /* @__PURE__ */ jsx(IconButton$1, { icon: "chevron-left", onClick: handlePreviousClick, size: "sm", type: "ghost" }),
16084
16082
  /* @__PURE__ */ jsx(UnselectableTitle, { children: headerDateFormatter.format(headerDate) }),
@@ -16091,32 +16089,42 @@ const Calendar = ({
16091
16089
  }) => {
16092
16090
  return /* @__PURE__ */ jsx(DateTableHeader, { children: weekdayFormatter.format(date) }, key);
16093
16091
  }) }) }),
16094
- /* @__PURE__ */ jsx("tbody", { children: body.value.map(({
16095
- key: weekKey,
16096
- value: week
16097
- }) => {
16098
- return /* @__PURE__ */ jsx("tr", { children: week.map(({
16099
- date,
16100
- isCurrentMonth,
16101
- key: dayKey,
16102
- value: fullDate
16103
- }) => {
16104
- const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
16105
- const today = /* @__PURE__ */ new Date();
16106
- const isCurrentDate = isSameDate(today, fullDate);
16107
- const isDisabled = futureDatesDisabled ? fullDate > today : false;
16108
- return /* @__PURE__ */ jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: () => {
16109
- if (isDisabled) {
16110
- return false;
16111
- }
16112
- setSelectedDate(fullDate);
16113
- closeDatepicker();
16114
- }, children: date }, dayKey);
16115
- }) }, weekKey);
16116
- }) })
16092
+ /* @__PURE__ */ jsx("tbody", { children: children(body) })
16117
16093
  ] })
16118
16094
  ] });
16119
16095
  };
16096
+ const Calendar = ({
16097
+ calendarBody,
16098
+ closeDatepicker,
16099
+ futureDatesDisabled,
16100
+ selectedDate,
16101
+ setSelectedDate
16102
+ }) => {
16103
+ return calendarBody.value.map(({
16104
+ key: weekKey,
16105
+ value: week
16106
+ }) => {
16107
+ return /* @__PURE__ */ jsx("tr", { children: week.map(({
16108
+ date,
16109
+ isCurrentMonth,
16110
+ key: dayKey,
16111
+ value: fullDate
16112
+ }) => {
16113
+ const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
16114
+ const today = /* @__PURE__ */ new Date();
16115
+ const isCurrentDate = isSameDate(today, fullDate);
16116
+ const isDisabled = futureDatesDisabled ? fullDate > today : false;
16117
+ const handleClick = () => {
16118
+ if (isDisabled) {
16119
+ return false;
16120
+ }
16121
+ setSelectedDate(fullDate);
16122
+ closeDatepicker();
16123
+ };
16124
+ return /* @__PURE__ */ jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: handleClick, children: date }, dayKey);
16125
+ }) }, weekKey);
16126
+ });
16127
+ };
16120
16128
  const DatePicker = ({
16121
16129
  date,
16122
16130
  disabled = false,
@@ -16126,6 +16134,10 @@ const DatePicker = ({
16126
16134
  }) => {
16127
16135
  const [isOpen, setIsOpen] = useState(false);
16128
16136
  const [selectedDate, setSelectedDate] = useState();
16137
+ const calendarOptions = {};
16138
+ if (selectedDate) {
16139
+ calendarOptions.defaultDate = selectedDate;
16140
+ }
16129
16141
  useEffect(() => {
16130
16142
  if (date) {
16131
16143
  setSelectedDate(date);
@@ -16139,8 +16151,8 @@ const DatePicker = ({
16139
16151
  onSelectDate(selectedDate2);
16140
16152
  };
16141
16153
  return /* @__PURE__ */ jsxs(Dropdown, { onOpenChange: setIsOpen, open: isOpen, children: [
16142
- /* @__PURE__ */ jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsx(DatePickerInput, { "data-testid": "datepicker-inpcontainer", disabled, isActive: isOpen, placeholder, selectedDate }) }),
16143
- /* @__PURE__ */ jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsx(Calendar, { closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) })
16154
+ /* @__PURE__ */ jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsx(DatePickerInput, { "data-testid": "datepicker-input-container", disabled, isActive: isOpen, placeholder, selectedDate }) }),
16155
+ /* @__PURE__ */ jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsx(CalendarRenderer, { calendarOptions, children: (body) => /* @__PURE__ */ jsx(Calendar, { calendarBody: body, closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) }) })
16144
16156
  ] });
16145
16157
  };
16146
16158
  const $5d3850c4d0b4e6c7$var$DIALOG_NAME = "Dialog";
@@ -15973,62 +15973,75 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
15973
15973
  }
15974
15974
  `);
15975
15975
  const locale = "en-US";
15976
- const weekdayFormatter = new Intl.DateTimeFormat(locale, {
15977
- weekday: "short"
15978
- });
15979
- const headerDateFormatter = new Intl.DateTimeFormat(locale, {
15980
- month: "short",
15981
- year: "numeric"
15982
- });
15983
15976
  const selectedDateFormatter = new Intl.DateTimeFormat(locale, {
15984
15977
  day: "2-digit",
15985
15978
  month: "short",
15986
15979
  year: "numeric"
15987
15980
  });
15988
15981
  const explicitWidth = "250px";
15989
- const HighlightedInputWrapper = styled.styled(InputWrapper).withConfig({
15990
- componentId: "sc-1kfphgn-0"
15982
+ const HighlightedInputWrapper = styled(InputWrapper).withConfig({
15983
+ componentId: "sc-1m6g9rm-0"
15991
15984
  })(["", " width:", ";}"], ({
15992
15985
  $isActive,
15993
15986
  theme: theme2
15994
15987
  }) => {
15995
15988
  return `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isActive ? theme2.click.datePicker.dateOption.color.stroke.active : theme2.click.field.color.stroke.default};`;
15996
15989
  }, explicitWidth);
15997
- const DatePickerContainer = styled.styled(Container).withConfig({
15998
- componentId: "sc-1kfphgn-1"
15990
+ const DatePickerInput = ({
15991
+ isActive,
15992
+ disabled,
15993
+ id,
15994
+ placeholder,
15995
+ selectedDate
15996
+ }) => {
15997
+ const defaultId = React.useId();
15998
+ const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
15999
+ return /* @__PURE__ */ jsxRuntime.jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
16000
+ /* @__PURE__ */ jsxRuntime.jsx(SvgImage, { name: "calendar" }),
16001
+ /* @__PURE__ */ jsxRuntime.jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
16002
+ ] });
16003
+ };
16004
+ const weekdayFormatter = new Intl.DateTimeFormat(locale, {
16005
+ weekday: "short"
16006
+ });
16007
+ const headerDateFormatter = new Intl.DateTimeFormat(locale, {
16008
+ month: "short",
16009
+ year: "numeric"
16010
+ });
16011
+ const DatePickerContainer = styled(Container).withConfig({
16012
+ componentId: "sc-1m6g9rm-1"
15999
16013
  })(["background:", ";"], ({
16000
16014
  theme: theme2
16001
16015
  }) => theme2.click.datePicker.dateOption.color.background.default);
16002
- const UnselectableTitle = styled.styled.h2.withConfig({
16003
- componentId: "sc-1kfphgn-2"
16016
+ const UnselectableTitle = styled.h2.withConfig({
16017
+ componentId: "sc-1m6g9rm-2"
16004
16018
  })(["", " user-select:none;"], ({
16005
16019
  theme: theme2
16006
16020
  }) => `
16007
16021
  color: ${theme2.click.datePicker.color.title.default};
16008
16022
  font: ${theme2.click.datePicker.typography.title.default};
16009
16023
  `);
16010
- const DateTable = styled.styled.table.withConfig({
16011
- componentId: "sc-1kfphgn-3"
16012
- })(["border-collapse:separate;border-spacing:0;font:", " table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{", ";padding:4px;}"], ({
16024
+ const DateTable = styled.table.withConfig({
16025
+ componentId: "sc-1m6g9rm-3"
16026
+ })(["border-collapse:separate;border-spacing:0;font:", ";table-layout:fixed;user-select:none;width:", ";thead tr{height:", ";}tbody{cursor:pointer;}td,th{padding:4px;}"], ({
16013
16027
  theme: theme2
16014
16028
  }) => theme2.typography.styles.product.text.normal.md, explicitWidth, ({
16015
16029
  theme: theme2
16016
- }) => theme2.click.datePicker.dateOption.size.height, ({
16017
- theme: theme2
16018
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default}`);
16019
- const DateTableHeader = styled.styled.th.withConfig({
16020
- componentId: "sc-1kfphgn-4"
16030
+ }) => theme2.click.datePicker.dateOption.size.height);
16031
+ const DateTableHeader = styled.th.withConfig({
16032
+ componentId: "sc-1m6g9rm-4"
16021
16033
  })(["", " width:14%;"], ({
16022
16034
  theme: theme2
16023
16035
  }) => `
16024
16036
  color: ${theme2.click.datePicker.color.daytitle.default};
16025
16037
  font: ${theme2.click.datePicker.typography.daytitle.default};
16026
16038
  `);
16027
- const DateTableCell = styled.styled.td.withConfig({
16028
- componentId: "sc-1kfphgn-5"
16039
+ const DateTableCell = styled.td.withConfig({
16040
+ componentId: "sc-1m6g9rm-5"
16029
16041
  })(["", " ", " ", " text-align:center;", " &:hover{", ";}"], ({
16030
16042
  theme: theme2
16031
16043
  }) => `
16044
+ border: ${theme2.click.datePicker.dateOption.stroke} solid ${theme2.click.datePicker.dateOption.color.stroke.default};
16032
16045
  border-radius: ${theme2.click.datePicker.dateOption.radii.default};
16033
16046
  font: ${theme2.click.datePicker.dateOption.typography.label.default};
16034
16047
  `, ({
@@ -16050,50 +16063,35 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
16050
16063
  }) => $isToday && `font: ${theme2.click.datePicker.dateOption.typography.label.active};`, ({
16051
16064
  $isDisabled,
16052
16065
  theme: theme2
16053
- }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover}`);
16054
- const DatePickerInput = ({
16055
- isActive,
16056
- disabled,
16057
- id,
16058
- placeholder,
16059
- selectedDate
16060
- }) => {
16061
- const defaultId = React.useId();
16062
- const formattedSelectedDate = selectedDate instanceof Date ? selectedDateFormatter.format(selectedDate) : "";
16063
- return /* @__PURE__ */ jsxRuntime.jsxs(HighlightedInputWrapper, { $isActive: isActive, disabled, id: id ?? defaultId, children: [
16064
- /* @__PURE__ */ jsxRuntime.jsx(SvgImage, { name: "calendar" }),
16065
- /* @__PURE__ */ jsxRuntime.jsx(InputElement, { "data-testid": "datepicker-input", placeholder, readOnly: true, value: formattedSelectedDate })
16066
- ] });
16067
- };
16068
- const Calendar = ({
16069
- closeDatepicker,
16070
- futureDatesDisabled,
16071
- selectedDate,
16072
- setSelectedDate
16066
+ }) => `border: ${theme2.click.datePicker.dateOption.stroke} solid ${$isDisabled ? theme2.click.datePicker.dateOption.color.stroke.disabled : theme2.click.datePicker.dateOption.color.stroke.hover};
16067
+
16068
+
16069
+ border-radius: ${theme2.click.datePicker.dateOption.radii.default};`);
16070
+ const CalendarRenderer = ({
16071
+ calendarOptions = {},
16072
+ children,
16073
+ ...props
16073
16074
  }) => {
16074
- const calendarOptions = {
16075
- defaultWeekStart: 1
16076
- };
16077
- if (selectedDate) {
16078
- calendarOptions.defaultDate = selectedDate;
16079
- }
16080
16075
  const {
16081
16076
  body,
16082
16077
  headers,
16083
16078
  month,
16084
16079
  navigation,
16085
16080
  year
16086
- } = useCalendar(calendarOptions);
16087
- const handleNextClick = () => {
16081
+ } = useCalendar({
16082
+ defaultWeekStart: 1,
16083
+ ...calendarOptions
16084
+ });
16085
+ const handleNextClick = React.useCallback(() => {
16088
16086
  navigation.toNext();
16089
- };
16090
- const handlePreviousClick = () => {
16087
+ }, [navigation]);
16088
+ const handlePreviousClick = React.useCallback(() => {
16091
16089
  navigation.toPrev();
16092
- };
16090
+ }, [navigation]);
16093
16091
  const headerDate = /* @__PURE__ */ new Date();
16094
16092
  headerDate.setMonth(month);
16095
16093
  headerDate.setFullYear(year);
16096
- return /* @__PURE__ */ jsxRuntime.jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", children: [
16094
+ return /* @__PURE__ */ jsxRuntime.jsxs(DatePickerContainer, { "data-testid": "datepicker-calendar-container", isResponsive: false, fillWidth: false, orientation: "vertical", padding: "sm", ...props, children: [
16097
16095
  /* @__PURE__ */ jsxRuntime.jsxs(Container, { isResponsive: false, justifyContent: "space-between", orientation: "horizontal", children: [
16098
16096
  /* @__PURE__ */ jsxRuntime.jsx(IconButton$1, { icon: "chevron-left", onClick: handlePreviousClick, size: "sm", type: "ghost" }),
16099
16097
  /* @__PURE__ */ jsxRuntime.jsx(UnselectableTitle, { children: headerDateFormatter.format(headerDate) }),
@@ -16106,32 +16104,42 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
16106
16104
  }) => {
16107
16105
  return /* @__PURE__ */ jsxRuntime.jsx(DateTableHeader, { children: weekdayFormatter.format(date) }, key);
16108
16106
  }) }) }),
16109
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: body.value.map(({
16110
- key: weekKey,
16111
- value: week
16112
- }) => {
16113
- return /* @__PURE__ */ jsxRuntime.jsx("tr", { children: week.map(({
16114
- date,
16115
- isCurrentMonth,
16116
- key: dayKey,
16117
- value: fullDate
16118
- }) => {
16119
- const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
16120
- const today = /* @__PURE__ */ new Date();
16121
- const isCurrentDate = isSameDate(today, fullDate);
16122
- const isDisabled = futureDatesDisabled ? fullDate > today : false;
16123
- return /* @__PURE__ */ jsxRuntime.jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: () => {
16124
- if (isDisabled) {
16125
- return false;
16126
- }
16127
- setSelectedDate(fullDate);
16128
- closeDatepicker();
16129
- }, children: date }, dayKey);
16130
- }) }, weekKey);
16131
- }) })
16107
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: children(body) })
16132
16108
  ] })
16133
16109
  ] });
16134
16110
  };
16111
+ const Calendar = ({
16112
+ calendarBody,
16113
+ closeDatepicker,
16114
+ futureDatesDisabled,
16115
+ selectedDate,
16116
+ setSelectedDate
16117
+ }) => {
16118
+ return calendarBody.value.map(({
16119
+ key: weekKey,
16120
+ value: week
16121
+ }) => {
16122
+ return /* @__PURE__ */ jsxRuntime.jsx("tr", { children: week.map(({
16123
+ date,
16124
+ isCurrentMonth,
16125
+ key: dayKey,
16126
+ value: fullDate
16127
+ }) => {
16128
+ const isSelected = selectedDate ? isSameDate(selectedDate, fullDate) : false;
16129
+ const today = /* @__PURE__ */ new Date();
16130
+ const isCurrentDate = isSameDate(today, fullDate);
16131
+ const isDisabled = futureDatesDisabled ? fullDate > today : false;
16132
+ const handleClick = () => {
16133
+ if (isDisabled) {
16134
+ return false;
16135
+ }
16136
+ setSelectedDate(fullDate);
16137
+ closeDatepicker();
16138
+ };
16139
+ return /* @__PURE__ */ jsxRuntime.jsx(DateTableCell, { $isCurrentMonth: isCurrentMonth, $isDisabled: isDisabled, $isSelected: isSelected, $isToday: isCurrentDate, onClick: handleClick, children: date }, dayKey);
16140
+ }) }, weekKey);
16141
+ });
16142
+ };
16135
16143
  const DatePicker = ({
16136
16144
  date,
16137
16145
  disabled = false,
@@ -16141,6 +16149,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
16141
16149
  }) => {
16142
16150
  const [isOpen, setIsOpen] = React.useState(false);
16143
16151
  const [selectedDate, setSelectedDate] = React.useState();
16152
+ const calendarOptions = {};
16153
+ if (selectedDate) {
16154
+ calendarOptions.defaultDate = selectedDate;
16155
+ }
16144
16156
  React.useEffect(() => {
16145
16157
  if (date) {
16146
16158
  setSelectedDate(date);
@@ -16154,8 +16166,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
16154
16166
  onSelectDate(selectedDate2);
16155
16167
  };
16156
16168
  return /* @__PURE__ */ jsxRuntime.jsxs(Dropdown, { onOpenChange: setIsOpen, open: isOpen, children: [
16157
- /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsxRuntime.jsx(DatePickerInput, { "data-testid": "datepicker-inpcontainer", disabled, isActive: isOpen, placeholder, selectedDate }) }),
16158
- /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(Calendar, { closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) })
16169
+ /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Trigger, { disabled, children: /* @__PURE__ */ jsxRuntime.jsx(DatePickerInput, { "data-testid": "datepicker-input-container", disabled, isActive: isOpen, placeholder, selectedDate }) }),
16170
+ /* @__PURE__ */ jsxRuntime.jsx(Dropdown.Content, { align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(CalendarRenderer, { calendarOptions, children: (body) => /* @__PURE__ */ jsxRuntime.jsx(Calendar, { calendarBody: body, closeDatepicker: closeDatePicker, futureDatesDisabled, selectedDate, setSelectedDate: handleSelectDate }) }) })
16159
16171
  ] });
16160
16172
  };
16161
16173
  const $5d3850c4d0b4e6c7$var$DIALOG_NAME = "Dialog";
@@ -0,0 +1,33 @@
1
+ import { ReactNode } from 'react';
2
+ import { useCalendar, UseCalendarOptions } from '@h6s/calendar';
3
+
4
+ interface DatePickerInputProps {
5
+ isActive: boolean;
6
+ disabled: boolean;
7
+ id?: string;
8
+ placeholder?: string;
9
+ selectedDate?: Date;
10
+ }
11
+ export declare const DatePickerInput: ({ isActive, disabled, id, placeholder, selectedDate, }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
12
+ interface DateRangePickerInputProps {
13
+ isActive: boolean;
14
+ disabled: boolean;
15
+ id?: string;
16
+ placeholder?: string;
17
+ selectedEndDate?: Date;
18
+ selectedStartDate?: Date;
19
+ }
20
+ export declare const DateRangePickerInput: ({ isActive, disabled, id, placeholder, selectedEndDate, selectedStartDate, }: DateRangePickerInputProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const DateTableCell: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {
22
+ $isCurrentMonth?: boolean;
23
+ $isDisabled?: boolean;
24
+ $isSelected?: boolean;
25
+ $isToday?: boolean;
26
+ }>> & string;
27
+ export type Body = ReturnType<typeof useCalendar>["body"];
28
+ interface CalendarRendererProps {
29
+ calendarOptions?: UseCalendarOptions;
30
+ children: (body: Body) => ReactNode;
31
+ }
32
+ export declare const CalendarRenderer: ({ calendarOptions, children, ...props }: CalendarRendererProps) => import("react/jsx-runtime").JSX.Element;
33
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface DatePickerProps {
2
+ endDate?: Date;
3
+ disabled?: boolean;
4
+ futureDatesDisabled?: boolean;
5
+ onSelectDateRange: (selectedStartDate: Date, selectedEndDate: Date) => void;
6
+ placeholder?: string;
7
+ startDate?: Date;
8
+ }
9
+ export declare const DateRangePicker: ({ endDate, startDate, disabled, futureDatesDisabled, onSelectDateRange, placeholder, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.202",
3
+ "version": "0.0.203",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",