@webiny/admin-ui 6.5.0-beta.1 → 6.5.0-beta.10

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 (68) hide show
  1. package/DataTable/DataTable.d.ts +16 -6
  2. package/DataTable/DataTable.js +14 -6
  3. package/DataTable/DataTable.js.map +1 -1
  4. package/DataTable/components/ColumnsVisibility.d.ts +5 -4
  5. package/DataTable/components/ColumnsVisibility.js +6 -3
  6. package/DataTable/components/ColumnsVisibility.js.map +1 -1
  7. package/DatePicker/primitives/DateOnlyPicker.js +2 -2
  8. package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
  9. package/DatePicker/primitives/DateRangePicker.js +3 -3
  10. package/DatePicker/primitives/DateRangePicker.js.map +1 -1
  11. package/DatePicker/primitives/DateTimePicker.js +8 -7
  12. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  13. package/DatePicker/primitives/MultipleDatesPicker.js +3 -3
  14. package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
  15. package/DatePicker/utils/dateHelpers.d.ts +5 -0
  16. package/DatePicker/utils/dateHelpers.js +11 -4
  17. package/DatePicker/utils/dateHelpers.js.map +1 -1
  18. package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
  19. package/DatePicker/utils/dateHelpers.test.js +32 -0
  20. package/DatePicker/utils/dateHelpers.test.js.map +1 -0
  21. package/Drawer/Drawer.d.ts +10 -6
  22. package/Drawer/Drawer.js +2 -1
  23. package/Drawer/Drawer.js.map +1 -1
  24. package/Drawer/Drawer.stories.d.ts +1 -0
  25. package/Drawer/Drawer.stories.js +20 -2
  26. package/Drawer/Drawer.stories.js.map +1 -1
  27. package/Drawer/components/DrawerHeader.d.ts +2 -2
  28. package/Drawer/components/DrawerHeader.js +11 -8
  29. package/Drawer/components/DrawerHeader.js.map +1 -1
  30. package/Drawer/components/Icon.d.ts +1 -1
  31. package/Drawer/components/Icon.js +3 -4
  32. package/Drawer/components/Icon.js.map +1 -1
  33. package/FilePicker/FilePicker.stories.d.ts +6 -0
  34. package/FilePicker/FilePicker.stories.js +24 -1
  35. package/FilePicker/FilePicker.stories.js.map +1 -1
  36. package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
  37. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  38. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  39. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +4 -0
  40. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -1
  41. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +3 -0
  42. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -1
  43. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
  44. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +4 -0
  45. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -1
  46. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +5 -0
  47. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -1
  48. package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +4 -0
  49. package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -1
  50. package/FilePicker/primitives/components/previews/fileName.d.ts +8 -0
  51. package/FilePicker/primitives/components/previews/fileName.js.map +1 -1
  52. package/IconPicker/domains/IconPickerIcon.js +1 -1
  53. package/IconPicker/domains/IconPickerIcon.js.map +1 -1
  54. package/ImageEditor/types.js +1 -1
  55. package/ImageEditor/types.js.map +1 -1
  56. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
  57. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
  58. package/MultiAutoComplete/primitives/useMultiAutoComplete.js +3 -2
  59. package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
  60. package/Tabs/Tabs.d.ts +7 -2
  61. package/Tabs/Tabs.js +29 -11
  62. package/Tabs/Tabs.js.map +1 -1
  63. package/Tabs/Tabs.mdx +27 -0
  64. package/Tabs/Tabs.stories.d.ts +1 -0
  65. package/Tabs/Tabs.stories.js +19 -1
  66. package/Tabs/Tabs.stories.js.map +1 -1
  67. package/Toast/useToast.stories.js.map +1 -1
  68. package/package.json +26 -26
@@ -1,10 +1,17 @@
1
1
  import { endOfISOWeek, format, getISOWeek, getISOWeekYear, startOfISOWeek } from "date-fns";
2
2
  import { DEFAULT_YEAR_RANGE_SIZE, MONTH_NAMES_SHORT } from "./constants.js";
3
+ function parseDateValue(value) {
4
+ if ("string" == typeof value) {
5
+ const match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
6
+ if (match) return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
7
+ }
8
+ return new Date(value);
9
+ }
3
10
  function formatDateForDisplay(value, type, displayFormat) {
4
11
  if (null == value) return;
5
12
  switch(type){
6
13
  case "date":
7
- return format(new Date(value), displayFormat ?? "PPP");
14
+ return format(parseDateValue(value), displayFormat ?? "PPP");
8
15
  case "time":
9
16
  return value;
10
17
  case "dateTimeLocal":
@@ -54,8 +61,8 @@ function formatDateForDisplay(value, type, displayFormat) {
54
61
  const range = value;
55
62
  const fmt = displayFormat ?? "PPP";
56
63
  if (!range.from) return;
57
- if (!range.to) return format(new Date(range.from), fmt);
58
- return `${format(new Date(range.from), fmt)} – ${format(new Date(range.to), fmt)}`;
64
+ if (!range.to) return format(parseDateValue(range.from), fmt);
65
+ return `${format(parseDateValue(range.from), fmt)} – ${format(parseDateValue(range.to), fmt)}`;
59
66
  }
60
67
  case "multipleDates":
61
68
  {
@@ -147,6 +154,6 @@ function parseWeekValue(value) {
147
154
  week: Number(match[2])
148
155
  };
149
156
  }
150
- export { defaultYearRange, extractTimezone, formatDateForDisplay, formatMonthValue, formatTimeValue, formatWeekValue, getLocalTimezone, parseMonthValue, parseTimeValue, parseWeekValue, toIsoWithTz, toLocalNaive };
157
+ export { defaultYearRange, extractTimezone, formatDateForDisplay, formatMonthValue, formatTimeValue, formatWeekValue, getLocalTimezone, parseDateValue, parseMonthValue, parseTimeValue, parseWeekValue, toIsoWithTz, toLocalNaive };
151
158
 
152
159
  //# sourceMappingURL=dateHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker/utils/dateHelpers.js","sources":["../../../src/DatePicker/utils/dateHelpers.ts"],"sourcesContent":["import { format, getISOWeek, getISOWeekYear, startOfISOWeek, endOfISOWeek } from \"date-fns\";\nimport { DEFAULT_YEAR_RANGE_SIZE, MONTH_NAMES_SHORT } from \"./constants.js\";\n\nexport function formatDateForDisplay(\n value:\n | Date\n | string\n | number\n | { from?: string; to?: string }\n | Date[]\n | string[]\n | number[]\n | undefined,\n type: string,\n displayFormat?: string\n): string | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n\n switch (type) {\n case \"date\":\n return format(new Date(value as string), displayFormat ?? \"PPP\");\n case \"time\":\n return value as string;\n case \"dateTimeLocal\":\n return format(new Date(value as string), displayFormat ?? \"PPP p\");\n case \"dateTimeTz\": {\n if (!value) {\n return undefined;\n }\n const isoStr = value instanceof Date ? value.toISOString() : (value as string);\n const tzMatch = isoStr.match(/([+-]\\d{2}:\\d{2})$/);\n const tz = tzMatch ? `UTC${tzMatch[1]}` : \"\";\n const dateWithoutTz = isoStr.replace(/[+-]\\d{2}:\\d{2}$/, \"\");\n const parts = dateWithoutTz.split(\"T\");\n if (parts.length < 2) {\n return isoStr;\n }\n const datePart = new Date(parts[0] + \"T00:00:00\");\n const timeParts = parts[1].split(\":\");\n const hours = Number(timeParts[0]);\n const minutes = timeParts[1] ?? \"00\";\n const ampm = hours >= 12 ? \"PM\" : \"AM\";\n const h12 = hours % 12 || 12;\n if (displayFormat) {\n return `${format(datePart, displayFormat)} ${h12}:${minutes} ${ampm} (${tz})`;\n }\n return `${format(datePart, \"PPP\")} ${h12}:${minutes} ${ampm} (${tz})`;\n }\n case \"month\": {\n if (displayFormat) {\n const parsed = parseMonthValue(value as string);\n if (!parsed) {\n return undefined;\n }\n return format(new Date(parsed.year, parsed.month), displayFormat);\n }\n const parsed = parseMonthValue(value as string);\n if (!parsed) {\n return undefined;\n }\n return `${MONTH_NAMES_SHORT[parsed.month]} ${parsed.year}`;\n }\n case \"week\": {\n const parsed = parseWeekValue(value as string);\n if (!parsed) {\n return undefined;\n }\n const weekStart = startOfISOWeek(new Date(parsed.year, 0, 4 + (parsed.week - 1) * 7));\n const weekEnd = endOfISOWeek(weekStart);\n if (displayFormat) {\n return `${format(weekStart, displayFormat)} – ${format(weekEnd, displayFormat)}`;\n }\n return `Week ${parsed.week}, ${format(weekStart, \"MMM d\")} – ${format(weekEnd, \"MMM d, yyyy\")}`;\n }\n case \"year\":\n return String(value);\n case \"dateRange\": {\n const range = value as { from?: string; to?: string };\n const fmt = displayFormat ?? \"PPP\";\n if (!range.from) {\n return undefined;\n }\n if (!range.to) {\n return format(new Date(range.from), fmt);\n }\n return `${format(new Date(range.from), fmt)} – ${format(new Date(range.to), fmt)}`;\n }\n case \"multipleDates\": {\n const dates = value as string[];\n if (dates.length === 0) {\n return undefined;\n }\n return `${dates.length} date${dates.length > 1 ? \"s\" : \"\"} selected`;\n }\n case \"multipleMonths\": {\n const months = value as string[];\n if (months.length === 0) {\n return undefined;\n }\n return `${months.length} month${months.length > 1 ? \"s\" : \"\"} selected`;\n }\n case \"multipleYears\": {\n const years = value as number[];\n if (years.length === 0) {\n return undefined;\n }\n return `${years.length} year${years.length > 1 ? \"s\" : \"\"} selected`;\n }\n default:\n return undefined;\n }\n}\n\nexport function defaultYearRange(centerYear?: number): [number, number] {\n const center = centerYear ?? new Date().getFullYear();\n const half = Math.floor(DEFAULT_YEAR_RANGE_SIZE / 2);\n return [center - half, center + half - 1];\n}\n\nexport function formatMonthValue(year: number, month: number): string {\n return `${year}-${String(month + 1).padStart(2, \"0\")}`;\n}\n\nexport function parseMonthValue(value: string): { year: number; month: number } | undefined {\n const match = value.match(/^(\\d{4})-(\\d{2})$/);\n if (!match) {\n return undefined;\n }\n return { year: Number(match[1]), month: Number(match[2]) - 1 };\n}\n\nexport function formatTimeValue(date: Date): string {\n return format(date, \"HH:mm\");\n}\n\nexport function parseTimeValue(time: string): { hours: number; minutes: number } | undefined {\n const match = time.match(/^(\\d{2}):(\\d{2})$/);\n if (!match) {\n return undefined;\n }\n return { hours: Number(match[1]), minutes: Number(match[2]) };\n}\n\nexport function toIsoWithTz(date: Date, timezone?: string): string {\n if (timezone) {\n return format(date, \"yyyy-MM-dd'T'HH:mm:ss\") + timezone;\n }\n const offset = -date.getTimezoneOffset();\n const sign = offset >= 0 ? \"+\" : \"-\";\n const absOffset = Math.abs(offset);\n const hours = String(Math.floor(absOffset / 60)).padStart(2, \"0\");\n const minutes = String(absOffset % 60).padStart(2, \"0\");\n return format(date, \"yyyy-MM-dd'T'HH:mm:ss\") + `${sign}${hours}:${minutes}`;\n}\n\nexport function getLocalTimezone(): string {\n const offset = -new Date().getTimezoneOffset();\n const sign = offset >= 0 ? \"+\" : \"-\";\n const absOffset = Math.abs(offset);\n const hours = String(Math.floor(absOffset / 60)).padStart(2, \"0\");\n const minutes = String(absOffset % 60).padStart(2, \"0\");\n return `${sign}${hours}:${minutes}`;\n}\n\nexport function extractTimezone(isoString: string | Date | unknown): string | undefined {\n if (typeof isoString !== \"string\") {\n return undefined;\n }\n const match = isoString.match(/([+-]\\d{2}:\\d{2})$/);\n if (match) {\n return match[1];\n }\n return undefined;\n}\n\nexport function toLocalNaive(isoString: string): Date {\n return new Date(isoString);\n}\n\nexport function formatWeekValue(date: Date): string {\n const week = getISOWeek(date);\n const year = getISOWeekYear(date);\n return `${year}-W${String(week).padStart(2, \"0\")}`;\n}\n\nexport function parseWeekValue(value: string): { year: number; week: number } | undefined {\n const match = value.match(/^(\\d{4})-W(\\d{2})$/);\n if (!match) {\n return undefined;\n }\n return { year: Number(match[1]), week: Number(match[2]) };\n}\n"],"names":["formatDateForDisplay","value","type","displayFormat","format","Date","isoStr","tzMatch","tz","dateWithoutTz","parts","datePart","timeParts","hours","Number","minutes","ampm","h12","parsed","parseMonthValue","MONTH_NAMES_SHORT","parseWeekValue","weekStart","startOfISOWeek","weekEnd","endOfISOWeek","String","range","fmt","dates","months","years","defaultYearRange","centerYear","center","half","Math","DEFAULT_YEAR_RANGE_SIZE","formatMonthValue","year","month","match","formatTimeValue","date","parseTimeValue","time","toIsoWithTz","timezone","offset","sign","absOffset","getLocalTimezone","extractTimezone","isoString","toLocalNaive","formatWeekValue","week","getISOWeek","getISOWeekYear"],"mappings":";;AAGO,SAASA,qBACZC,KAQe,EACfC,IAAY,EACZC,aAAsB;IAEtB,IAAIF,QAAAA,OACA;IAGJ,OAAQC;QACJ,KAAK;YACD,OAAOE,OAAO,IAAIC,KAAKJ,QAAkBE,iBAAiB;QAC9D,KAAK;YACD,OAAOF;QACX,KAAK;YACD,OAAOG,OAAO,IAAIC,KAAKJ,QAAkBE,iBAAiB;QAC9D,KAAK;YAAc;gBACf,IAAI,CAACF,OACD;gBAEJ,MAAMK,SAASL,iBAAiBI,OAAOJ,MAAM,WAAW,KAAMA;gBAC9D,MAAMM,UAAUD,OAAO,KAAK,CAAC;gBAC7B,MAAME,KAAKD,UAAU,CAAC,GAAG,EAAEA,OAAO,CAAC,EAAE,EAAE,GAAG;gBAC1C,MAAME,gBAAgBH,OAAO,OAAO,CAAC,oBAAoB;gBACzD,MAAMI,QAAQD,cAAc,KAAK,CAAC;gBAClC,IAAIC,MAAM,MAAM,GAAG,GACf,OAAOJ;gBAEX,MAAMK,WAAW,IAAIN,KAAKK,KAAK,CAAC,EAAE,GAAG;gBACrC,MAAME,YAAYF,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;gBACjC,MAAMG,QAAQC,OAAOF,SAAS,CAAC,EAAE;gBACjC,MAAMG,UAAUH,SAAS,CAAC,EAAE,IAAI;gBAChC,MAAMI,OAAOH,SAAS,KAAK,OAAO;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QAAQY,UAAU,KAAK,CAAC;IAC9B,IAAIZ,OACA,OAAOA,KAAK,CAAC,EAAE;AAGvB;AAEO,SAASa,aAAaD,SAAiB;IAC1C,OAAO,IAAIhD,KAAKgD;AACpB;AAEO,SAASE,gBAAgBZ,IAAU;IACtC,MAAMa,OAAOC,WAAWd;IACxB,MAAMJ,OAAOmB,eAAef;IAC5B,OAAO,GAAGJ,KAAK,EAAE,EAAEb,OAAO8B,MAAM,QAAQ,CAAC,GAAG,MAAM;AACtD;AAEO,SAASnC,eAAepB,KAAa;IACxC,MAAMwC,QAAQxC,MAAM,KAAK,CAAC;IAC1B,IAAI,CAACwC,OACD;IAEJ,OAAO;QAAE,MAAM3B,OAAO2B,KAAK,CAAC,EAAE;QAAG,MAAM3B,OAAO2B,KAAK,CAAC,EAAE;IAAE;AAC5D"}
1
+ {"version":3,"file":"DatePicker/utils/dateHelpers.js","sources":["../../../src/DatePicker/utils/dateHelpers.ts"],"sourcesContent":["import { format, getISOWeek, getISOWeekYear, startOfISOWeek, endOfISOWeek } from \"date-fns\";\nimport { DEFAULT_YEAR_RANGE_SIZE, MONTH_NAMES_SHORT } from \"./constants.js\";\n\n/**\n * `new Date(\"2026-10-10\")` is UTC midnight, which is the previous day west of UTC.\n * Bare dates are calendar days, so build them at local midnight instead.\n */\nexport function parseDateValue(value: string | Date | number): Date {\n if (typeof value === \"string\") {\n const match = value.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/);\n if (match) {\n return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n }\n }\n return new Date(value);\n}\n\nexport function formatDateForDisplay(\n value:\n | Date\n | string\n | number\n | { from?: string; to?: string }\n | Date[]\n | string[]\n | number[]\n | undefined,\n type: string,\n displayFormat?: string\n): string | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n\n switch (type) {\n case \"date\":\n return format(parseDateValue(value as string), displayFormat ?? \"PPP\");\n case \"time\":\n return value as string;\n case \"dateTimeLocal\":\n return format(new Date(value as string), displayFormat ?? \"PPP p\");\n case \"dateTimeTz\": {\n if (!value) {\n return undefined;\n }\n const isoStr = value instanceof Date ? value.toISOString() : (value as string);\n const tzMatch = isoStr.match(/([+-]\\d{2}:\\d{2})$/);\n const tz = tzMatch ? `UTC${tzMatch[1]}` : \"\";\n const dateWithoutTz = isoStr.replace(/[+-]\\d{2}:\\d{2}$/, \"\");\n const parts = dateWithoutTz.split(\"T\");\n if (parts.length < 2) {\n return isoStr;\n }\n const datePart = new Date(parts[0] + \"T00:00:00\");\n const timeParts = parts[1].split(\":\");\n const hours = Number(timeParts[0]);\n const minutes = timeParts[1] ?? \"00\";\n const ampm = hours >= 12 ? \"PM\" : \"AM\";\n const h12 = hours % 12 || 12;\n if (displayFormat) {\n return `${format(datePart, displayFormat)} ${h12}:${minutes} ${ampm} (${tz})`;\n }\n return `${format(datePart, \"PPP\")} ${h12}:${minutes} ${ampm} (${tz})`;\n }\n case \"month\": {\n if (displayFormat) {\n const parsed = parseMonthValue(value as string);\n if (!parsed) {\n return undefined;\n }\n return format(new Date(parsed.year, parsed.month), displayFormat);\n }\n const parsed = parseMonthValue(value as string);\n if (!parsed) {\n return undefined;\n }\n return `${MONTH_NAMES_SHORT[parsed.month]} ${parsed.year}`;\n }\n case \"week\": {\n const parsed = parseWeekValue(value as string);\n if (!parsed) {\n return undefined;\n }\n const weekStart = startOfISOWeek(new Date(parsed.year, 0, 4 + (parsed.week - 1) * 7));\n const weekEnd = endOfISOWeek(weekStart);\n if (displayFormat) {\n return `${format(weekStart, displayFormat)} – ${format(weekEnd, displayFormat)}`;\n }\n return `Week ${parsed.week}, ${format(weekStart, \"MMM d\")} – ${format(weekEnd, \"MMM d, yyyy\")}`;\n }\n case \"year\":\n return String(value);\n case \"dateRange\": {\n const range = value as { from?: string; to?: string };\n const fmt = displayFormat ?? \"PPP\";\n if (!range.from) {\n return undefined;\n }\n if (!range.to) {\n return format(parseDateValue(range.from), fmt);\n }\n return `${format(parseDateValue(range.from), fmt)} – ${format(parseDateValue(range.to), fmt)}`;\n }\n case \"multipleDates\": {\n const dates = value as string[];\n if (dates.length === 0) {\n return undefined;\n }\n return `${dates.length} date${dates.length > 1 ? \"s\" : \"\"} selected`;\n }\n case \"multipleMonths\": {\n const months = value as string[];\n if (months.length === 0) {\n return undefined;\n }\n return `${months.length} month${months.length > 1 ? \"s\" : \"\"} selected`;\n }\n case \"multipleYears\": {\n const years = value as number[];\n if (years.length === 0) {\n return undefined;\n }\n return `${years.length} year${years.length > 1 ? \"s\" : \"\"} selected`;\n }\n default:\n return undefined;\n }\n}\n\nexport function defaultYearRange(centerYear?: number): [number, number] {\n const center = centerYear ?? new Date().getFullYear();\n const half = Math.floor(DEFAULT_YEAR_RANGE_SIZE / 2);\n return [center - half, center + half - 1];\n}\n\nexport function formatMonthValue(year: number, month: number): string {\n return `${year}-${String(month + 1).padStart(2, \"0\")}`;\n}\n\nexport function parseMonthValue(value: string): { year: number; month: number } | undefined {\n const match = value.match(/^(\\d{4})-(\\d{2})$/);\n if (!match) {\n return undefined;\n }\n return { year: Number(match[1]), month: Number(match[2]) - 1 };\n}\n\nexport function formatTimeValue(date: Date): string {\n return format(date, \"HH:mm\");\n}\n\nexport function parseTimeValue(time: string): { hours: number; minutes: number } | undefined {\n const match = time.match(/^(\\d{2}):(\\d{2})$/);\n if (!match) {\n return undefined;\n }\n return { hours: Number(match[1]), minutes: Number(match[2]) };\n}\n\nexport function toIsoWithTz(date: Date, timezone?: string): string {\n if (timezone) {\n return format(date, \"yyyy-MM-dd'T'HH:mm:ss\") + timezone;\n }\n const offset = -date.getTimezoneOffset();\n const sign = offset >= 0 ? \"+\" : \"-\";\n const absOffset = Math.abs(offset);\n const hours = String(Math.floor(absOffset / 60)).padStart(2, \"0\");\n const minutes = String(absOffset % 60).padStart(2, \"0\");\n return format(date, \"yyyy-MM-dd'T'HH:mm:ss\") + `${sign}${hours}:${minutes}`;\n}\n\nexport function getLocalTimezone(): string {\n const offset = -new Date().getTimezoneOffset();\n const sign = offset >= 0 ? \"+\" : \"-\";\n const absOffset = Math.abs(offset);\n const hours = String(Math.floor(absOffset / 60)).padStart(2, \"0\");\n const minutes = String(absOffset % 60).padStart(2, \"0\");\n return `${sign}${hours}:${minutes}`;\n}\n\nexport function extractTimezone(isoString: string | Date | unknown): string | undefined {\n if (typeof isoString !== \"string\") {\n return undefined;\n }\n const match = isoString.match(/([+-]\\d{2}:\\d{2})$/);\n if (match) {\n return match[1];\n }\n return undefined;\n}\n\nexport function toLocalNaive(isoString: string): Date {\n return new Date(isoString);\n}\n\nexport function formatWeekValue(date: Date): string {\n const week = getISOWeek(date);\n const year = getISOWeekYear(date);\n return `${year}-W${String(week).padStart(2, \"0\")}`;\n}\n\nexport function parseWeekValue(value: string): { year: number; week: number } | undefined {\n const match = value.match(/^(\\d{4})-W(\\d{2})$/);\n if (!match) {\n return undefined;\n }\n return { year: Number(match[1]), week: Number(match[2]) };\n}\n"],"names":["parseDateValue","value","match","Date","Number","formatDateForDisplay","type","displayFormat","format","isoStr","tzMatch","tz","dateWithoutTz","parts","datePart","timeParts","hours","minutes","ampm","h12","parsed","parseMonthValue","MONTH_NAMES_SHORT","parseWeekValue","weekStart","startOfISOWeek","weekEnd","endOfISOWeek","String","range","fmt","dates","months","years","defaultYearRange","centerYear","center","half","Math","DEFAULT_YEAR_RANGE_SIZE","formatMonthValue","year","month","formatTimeValue","date","parseTimeValue","time","toIsoWithTz","timezone","offset","sign","absOffset","getLocalTimezone","extractTimezone","isoString","toLocalNaive","formatWeekValue","week","getISOWeek","getISOWeekYear"],"mappings":";;AAOO,SAASA,eAAeC,KAA6B;IACxD,IAAI,AAAiB,YAAjB,OAAOA,OAAoB;QAC3B,MAAMC,QAAQD,MAAM,KAAK,CAAC;QAC1B,IAAIC,OACA,OAAO,IAAIC,KAAKC,OAAOF,KAAK,CAAC,EAAE,GAAGE,OAAOF,KAAK,CAAC,EAAE,IAAI,GAAGE,OAAOF,KAAK,CAAC,EAAE;IAE/E;IACA,OAAO,IAA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;IAEJ,OAAO;QAAE,MAAME,OAAOF,KAAK,CAAC,EAAE;QAAG,MAAME,OAAOF,KAAK,CAAC,EAAE;IAAE;AAC5D"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
2
+ import { formatDateForDisplay, parseDateValue } from "./dateHelpers.js";
3
+ describe("dateHelpers in a timezone west of UTC", ()=>{
4
+ const originalTz = process.env.TZ;
5
+ beforeAll(()=>{
6
+ process.env.TZ = "America/Chicago";
7
+ });
8
+ afterAll(()=>{
9
+ process.env.TZ = originalTz;
10
+ });
11
+ it("should parse a bare date as that calendar day", ()=>{
12
+ const date = parseDateValue("2026-10-10");
13
+ expect(date.getFullYear()).toBe(2026);
14
+ expect(date.getMonth()).toBe(9);
15
+ expect(date.getDate()).toBe(10);
16
+ });
17
+ it("should leave full ISO strings to the Date constructor", ()=>{
18
+ const date = parseDateValue("2026-10-10T00:00:00.000Z");
19
+ expect(date.toISOString()).toBe("2026-10-10T00:00:00.000Z");
20
+ });
21
+ it("should display a date-only value as the stored day", ()=>{
22
+ expect(formatDateForDisplay("2026-10-10", "date")).toBe("October 10th, 2026");
23
+ });
24
+ it("should display a date range as the stored days", ()=>{
25
+ expect(formatDateForDisplay({
26
+ from: "2026-10-10",
27
+ to: "2026-10-12"
28
+ }, "dateRange", "yyyy-MM-dd")).toBe("2026-10-10 – 2026-10-12");
29
+ });
30
+ });
31
+
32
+ //# sourceMappingURL=dateHelpers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker/utils/dateHelpers.test.js","sources":["../../../src/DatePicker/utils/dateHelpers.test.ts"],"sourcesContent":["import { afterAll, beforeAll, describe, expect, it } from \"vitest\";\nimport { formatDateForDisplay, parseDateValue } from \"./dateHelpers.js\";\n\ndescribe(\"dateHelpers in a timezone west of UTC\", () => {\n const originalTz = process.env.TZ;\n\n beforeAll(() => {\n process.env.TZ = \"America/Chicago\";\n });\n\n afterAll(() => {\n process.env.TZ = originalTz;\n });\n\n it(\"should parse a bare date as that calendar day\", () => {\n const date = parseDateValue(\"2026-10-10\");\n expect(date.getFullYear()).toBe(2026);\n expect(date.getMonth()).toBe(9);\n expect(date.getDate()).toBe(10);\n });\n\n it(\"should leave full ISO strings to the Date constructor\", () => {\n const date = parseDateValue(\"2026-10-10T00:00:00.000Z\");\n expect(date.toISOString()).toBe(\"2026-10-10T00:00:00.000Z\");\n });\n\n it(\"should display a date-only value as the stored day\", () => {\n expect(formatDateForDisplay(\"2026-10-10\", \"date\")).toBe(\"October 10th, 2026\");\n });\n\n it(\"should display a date range as the stored days\", () => {\n expect(\n formatDateForDisplay(\n { from: \"2026-10-10\", to: \"2026-10-12\" },\n \"dateRange\",\n \"yyyy-MM-dd\"\n )\n ).toBe(\"2026-10-10 – 2026-10-12\");\n });\n});\n"],"names":["describe","originalTz","process","beforeAll","afterAll","it","date","parseDateValue","expect","formatDateForDisplay"],"mappings":";;AAGAA,SAAS,yCAAyC;IAC9C,MAAMC,aAAaC,QAAQ,GAAG,CAAC,EAAE;IAEjCC,UAAU;QACND,QAAQ,GAAG,CAAC,EAAE,GAAG;IACrB;IAEAE,SAAS;QACLF,QAAQ,GAAG,CAAC,EAAE,GAAGD;IACrB;IAEAI,GAAG,iDAAiD;QAChD,MAAMC,OAAOC,eAAe;QAC5BC,OAAOF,KAAK,WAAW,IAAI,IAAI,CAAC;QAChCE,OAAOF,KAAK,QAAQ,IAAI,IAAI,CAAC;QAC7BE,OAAOF,KAAK,OAAO,IAAI,IAAI,CAAC;IAChC;IAEAD,GAAG,yDAAyD;QACxD,MAAMC,OAAOC,eAAe;QAC5BC,OAAOF,KAAK,WAAW,IAAI,IAAI,CAAC;IACpC;IAEAD,GAAG,sDAAsD;QACrDG,OAAOC,qBAAqB,cAAc,SAAS,IAAI,CAAC;IAC5D;IAEAJ,GAAG,kDAAkD;QACjDG,OACIC,qBACI;YAAE,MAAM;YAAc,IAAI;QAAa,GACvC,aACA,eAEN,IAAI,CAAC;IACX;AACJ"}
@@ -9,6 +9,10 @@ interface DrawerProps extends React.ComponentPropsWithoutRef<typeof DrawerRoot>,
9
9
  showCloseButton?: boolean;
10
10
  bodyPadding?: boolean;
11
11
  headerSeparator?: boolean;
12
+ /**
13
+ * Controls rendered in the header, next to the close button.
14
+ */
15
+ headerActions?: React.ReactNode;
12
16
  footerSeparator?: boolean;
13
17
  description?: React.ReactNode;
14
18
  children: React.ReactNode;
@@ -79,21 +83,21 @@ declare const Drawer: typeof DrawerBase & {
79
83
  displayName: string;
80
84
  }>) => (props: unknown) => React.JSX.Element;
81
85
  };
82
- Icon: (({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element) & {
83
- original: ({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element;
86
+ Icon: ((props: import("../index.js").IconProps) => React.JSX.Element) & {
87
+ original: (props: import("../index.js").IconProps) => React.JSX.Element;
84
88
  originalName: string;
85
89
  displayName: string;
86
90
  } & {
87
- original: (({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element) & {
88
- original: ({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element;
91
+ original: ((props: import("../index.js").IconProps) => React.JSX.Element) & {
92
+ original: (props: import("../index.js").IconProps) => React.JSX.Element;
89
93
  originalName: string;
90
94
  displayName: string;
91
95
  };
92
96
  originalName: string;
93
97
  displayName: string;
94
98
  } & {
95
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element) & {
96
- original: ({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element;
99
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("../index.js").IconProps) => React.JSX.Element) & {
100
+ original: (props: import("../index.js").IconProps) => React.JSX.Element;
97
101
  originalName: string;
98
102
  displayName: string;
99
103
  }>) => (props: unknown) => React.JSX.Element;
package/Drawer/Drawer.js CHANGED
@@ -13,7 +13,7 @@ import { CancelButton } from "./components/CancelButton.js";
13
13
  import * as __rspack_external_react from "react";
14
14
  const DrawerBase = (props)=>{
15
15
  const { rootProps, triggerProps, contentProps, headerProps, bodyProps, footerProps } = __rspack_external_react.useMemo(()=>{
16
- const { defaultOpen, open, onOpenChange: originalOnOpenChange, onClose, onOpen, modal = false, dir, trigger, title, icon, description, showCloseButton, headerSeparator, children, bodyPadding, actions, info, footerSeparator, ...rest } = props;
16
+ const { defaultOpen, open, onOpenChange: originalOnOpenChange, onClose, onOpen, modal = false, dir, trigger, title, icon, description, showCloseButton, headerSeparator, headerActions, children, bodyPadding, actions, info, footerSeparator, ...rest } = props;
17
17
  const onOpenChange = (open)=>{
18
18
  originalOnOpenChange && originalOnOpenChange(open);
19
19
  if (onClose && !open) onClose();
@@ -35,6 +35,7 @@ const DrawerBase = (props)=>{
35
35
  icon,
36
36
  description,
37
37
  showCloseButton,
38
+ headerActions,
38
39
  separator: headerSeparator
39
40
  },
40
41
  bodyProps: {
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer/Drawer.js","sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { DrawerContent } from \"./components/DrawerContent.js\";\nimport { DrawerFooter } from \"./components/DrawerFooter.js\";\nimport { DrawerHeader } from \"./components/DrawerHeader.js\";\nimport { DrawerOverlay } from \"./components/DrawerOverlay.js\";\nimport { DrawerPortal } from \"./components/DrawerPortal.js\";\nimport { DrawerRoot } from \"./components/DrawerRoot.js\";\nimport { DrawerTrigger } from \"./components/DrawerTrigger.js\";\nimport { DrawerBody } from \"~/Drawer/components/DrawerBody.js\";\nimport { Icon } from \"./components/Icon.js\";\nimport { ConfirmButton } from \"./components/ConfirmButton.js\";\nimport { CancelButton } from \"./components/CancelButton.js\";\n\ninterface DrawerProps\n extends\n React.ComponentPropsWithoutRef<typeof DrawerRoot>,\n Omit<React.ComponentPropsWithoutRef<typeof DrawerContent>, \"title\"> {\n trigger?: React.ReactNode;\n title?: React.ReactNode;\n icon?: React.ReactElement;\n modal?: boolean;\n showCloseButton?: boolean;\n bodyPadding?: boolean;\n headerSeparator?: boolean;\n footerSeparator?: boolean;\n description?: React.ReactNode;\n children: React.ReactNode;\n actions?: React.ReactNode;\n info?: React.ReactNode;\n width?: React.CSSProperties[\"width\"];\n onClose?: () => void;\n onOpen?: () => void;\n}\n\nconst DrawerBase = (props: DrawerProps) => {\n const { rootProps, triggerProps, contentProps, headerProps, bodyProps, footerProps } =\n React.useMemo(() => {\n const {\n // Root props.\n defaultOpen,\n open,\n onOpenChange: originalOnOpenChange,\n onClose,\n onOpen,\n\n // We want the drawer to always allow interaction with the outside elements.\n modal = false,\n dir,\n\n // Trigger props.\n trigger,\n\n // Header props.\n title,\n icon,\n description,\n showCloseButton,\n headerSeparator,\n\n // Body props.\n children,\n bodyPadding,\n\n // Footer props.\n actions,\n info,\n footerSeparator,\n\n // Content props.\n ...rest\n } = props;\n\n // Handles dialog open state changes, calling original and onClose / onOpen callbacks as needed\n const onOpenChange = (open: boolean) => {\n originalOnOpenChange && originalOnOpenChange(open);\n\n if (onClose && !open) {\n onClose();\n }\n\n if (onOpen && open) {\n onOpen();\n }\n };\n\n return {\n rootProps: {\n defaultOpen,\n open,\n onOpenChange,\n modal,\n dir\n },\n triggerProps: {\n // Temporary fix. We need this because `ref` doesn't get passed to components\n // that are decorated with `makeDecoratable`. This will be fixed in the future.\n children: <div>{trigger}</div>\n },\n headerProps: {\n title,\n icon,\n description,\n showCloseButton,\n separator: headerSeparator\n },\n bodyProps: { children, bodyPadding },\n footerProps: { info, actions, separator: footerSeparator },\n contentProps: rest\n };\n }, [props]);\n\n return (\n <DrawerRoot {...rootProps}>\n {triggerProps.children && <DrawerTrigger {...triggerProps} asChild />}\n <DrawerPortal>\n <div data-role=\"drawer\" className={\"absolute z-overlay\"}>\n {rootProps.modal && <DrawerOverlay />}\n <DrawerContent {...contentProps} modal={rootProps.modal}>\n <DrawerHeader {...headerProps} />\n <DrawerBody {...bodyProps} />\n <DrawerFooter {...footerProps} />\n </DrawerContent>\n </div>\n </DrawerPortal>\n </DrawerRoot>\n );\n};\n\nDrawerBase.displayName = \"Drawer\";\n\nconst DecoratableDrawer = makeDecoratable(\"Drawer\", DrawerBase);\n\nconst Drawer = withStaticProps(DecoratableDrawer, {\n ConfirmButton,\n CancelButton,\n Icon\n});\n\nexport { Drawer, type DrawerProps };\n"],"names":["DrawerBase","props","rootProps","triggerProps","contentProps","headerProps","bodyProps","footerProps","React","defaultOpen","open","originalOnOpenChange","onClose","onOpen","modal","dir","trigger","title","icon","description","showCloseButton","headerSeparator","children","bodyPadding","actions","info","footerSeparator","rest","onOpenChange","DrawerRoot","DrawerTrigger","DrawerPortal","DrawerOverlay","DrawerContent","DrawerHeader","DrawerBody","DrawerFooter","DecoratableDrawer","makeDecoratable","Drawer","withStaticProps","ConfirmButton","CancelButton","Icon"],"mappings":";;;;;;;;;;;;;AAmCA,MAAMA,aAAa,CAACC;IAChB,MAAM,EAAEC,SAAS,EAAEC,YAAY,EAAEC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAE,GAChFC,wBAAAA,OAAa,CAAC;QACV,MAAM,EAEFC,WAAW,EACXC,IAAI,EACJ,cAAcC,oBAAoB,EAClCC,OAAO,EACPC,MAAM,EAGNC,QAAQ,KAAK,EACbC,GAAG,EAGHC,OAAO,EAGPC,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,eAAe,EACfC,eAAe,EAGfC,QAAQ,EACRC,WAAW,EAGXC,OAAO,EACPC,IAAI,EACJC,eAAe,EAGf,GAAGC,MACN,GAAG1B;QAGJ,MAAM2B,eAAe,CAAClB;YAClBC,wBAAwBA,qBAAqBD;YAE7C,IAAIE,WAAW,CAACF,MACZE;YAGJ,IAAIC,UAAUH,MACVG;QAER;QAEA,OAAO;YACH,WAAW;gBACPJ;gBACAC;gBACAkB;gBACAd;gBACAC;YACJ;YACA,cAAc;gBAGV,UAAU,WAAV,GAAU,sCAAC,aAAKC;YACpB;YACA,aAAa;gBACTC;gBACAC;gBACAC;gBACAC;gBACA,WAAWC;YACf;YACA,WAAW;gBAAEC;gBAAUC;YAAY;YACnC,aAAa;gBAAEE;gBAAMD;gBAAS,WAAWE;YAAgB;YACzD,cAAcC;QAClB;IACJ,GAAG;QAAC1B;KAAM;IAEd,OAAO,WAAP,GACI,sCAAC4B,YAAe3B,WACXC,aAAa,QAAQ,IAAI,WAAJ,GAAI,sCAAC2B,eAAaA;QAAE,GAAG3B,YAAY;QAAE;sBAC3D,sCAAC4B,cAAYA,MAAAA,WAAAA,GACT,sCAAC;QAAI,aAAU;QAAS,WAAW;OAC9B7B,UAAU,KAAK,IAAI,WAAJ,GAAI,sCAAC8B,eAAaA,OAAAA,WAAAA,GAClC,sCAACC,eAAaA;QAAE,GAAG7B,YAAY;QAAE,OAAOF,UAAU,KAAK;qBACnD,sCAACgC,cAAiB7B,cAAAA,WAAAA,GAClB,sCAAC8B,YAAe7B,YAAAA,WAAAA,GAChB,sCAAC8B,cAAiB7B;AAM1C;AAEAP,WAAW,WAAW,GAAG;AAEzB,MAAMqC,oBAAoBC,gBAAgB,UAAUtC;AAEpD,MAAMuC,SAASC,gBAAgBH,mBAAmB;IAC9CI,eAAaA;IACbC,cAAYA;IACZC,MAAIA;AACR"}
1
+ {"version":3,"file":"Drawer/Drawer.js","sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { DrawerContent } from \"./components/DrawerContent.js\";\nimport { DrawerFooter } from \"./components/DrawerFooter.js\";\nimport { DrawerHeader } from \"./components/DrawerHeader.js\";\nimport { DrawerOverlay } from \"./components/DrawerOverlay.js\";\nimport { DrawerPortal } from \"./components/DrawerPortal.js\";\nimport { DrawerRoot } from \"./components/DrawerRoot.js\";\nimport { DrawerTrigger } from \"./components/DrawerTrigger.js\";\nimport { DrawerBody } from \"~/Drawer/components/DrawerBody.js\";\nimport { Icon } from \"./components/Icon.js\";\nimport { ConfirmButton } from \"./components/ConfirmButton.js\";\nimport { CancelButton } from \"./components/CancelButton.js\";\n\ninterface DrawerProps\n extends\n React.ComponentPropsWithoutRef<typeof DrawerRoot>,\n Omit<React.ComponentPropsWithoutRef<typeof DrawerContent>, \"title\"> {\n trigger?: React.ReactNode;\n title?: React.ReactNode;\n icon?: React.ReactElement;\n modal?: boolean;\n showCloseButton?: boolean;\n bodyPadding?: boolean;\n headerSeparator?: boolean;\n /**\n * Controls rendered in the header, next to the close button.\n */\n headerActions?: React.ReactNode;\n footerSeparator?: boolean;\n description?: React.ReactNode;\n children: React.ReactNode;\n actions?: React.ReactNode;\n info?: React.ReactNode;\n width?: React.CSSProperties[\"width\"];\n onClose?: () => void;\n onOpen?: () => void;\n}\n\nconst DrawerBase = (props: DrawerProps) => {\n const { rootProps, triggerProps, contentProps, headerProps, bodyProps, footerProps } =\n React.useMemo(() => {\n const {\n // Root props.\n defaultOpen,\n open,\n onOpenChange: originalOnOpenChange,\n onClose,\n onOpen,\n\n // We want the drawer to always allow interaction with the outside elements.\n modal = false,\n dir,\n\n // Trigger props.\n trigger,\n\n // Header props.\n title,\n icon,\n description,\n showCloseButton,\n headerSeparator,\n headerActions,\n\n // Body props.\n children,\n bodyPadding,\n\n // Footer props.\n actions,\n info,\n footerSeparator,\n\n // Content props.\n ...rest\n } = props;\n\n // Handles dialog open state changes, calling original and onClose / onOpen callbacks as needed\n const onOpenChange = (open: boolean) => {\n originalOnOpenChange && originalOnOpenChange(open);\n\n if (onClose && !open) {\n onClose();\n }\n\n if (onOpen && open) {\n onOpen();\n }\n };\n\n return {\n rootProps: {\n defaultOpen,\n open,\n onOpenChange,\n modal,\n dir\n },\n triggerProps: {\n // Temporary fix. We need this because `ref` doesn't get passed to components\n // that are decorated with `makeDecoratable`. This will be fixed in the future.\n children: <div>{trigger}</div>\n },\n headerProps: {\n title,\n icon,\n description,\n showCloseButton,\n headerActions,\n separator: headerSeparator\n },\n bodyProps: { children, bodyPadding },\n footerProps: { info, actions, separator: footerSeparator },\n contentProps: rest\n };\n }, [props]);\n\n return (\n <DrawerRoot {...rootProps}>\n {triggerProps.children && <DrawerTrigger {...triggerProps} asChild />}\n <DrawerPortal>\n <div data-role=\"drawer\" className={\"absolute z-overlay\"}>\n {rootProps.modal && <DrawerOverlay />}\n <DrawerContent {...contentProps} modal={rootProps.modal}>\n <DrawerHeader {...headerProps} />\n <DrawerBody {...bodyProps} />\n <DrawerFooter {...footerProps} />\n </DrawerContent>\n </div>\n </DrawerPortal>\n </DrawerRoot>\n );\n};\n\nDrawerBase.displayName = \"Drawer\";\n\nconst DecoratableDrawer = makeDecoratable(\"Drawer\", DrawerBase);\n\nconst Drawer = withStaticProps(DecoratableDrawer, {\n ConfirmButton,\n CancelButton,\n Icon\n});\n\nexport { Drawer, type DrawerProps };\n"],"names":["DrawerBase","props","rootProps","triggerProps","contentProps","headerProps","bodyProps","footerProps","React","defaultOpen","open","originalOnOpenChange","onClose","onOpen","modal","dir","trigger","title","icon","description","showCloseButton","headerSeparator","headerActions","children","bodyPadding","actions","info","footerSeparator","rest","onOpenChange","DrawerRoot","DrawerTrigger","DrawerPortal","DrawerOverlay","DrawerContent","DrawerHeader","DrawerBody","DrawerFooter","DecoratableDrawer","makeDecoratable","Drawer","withStaticProps","ConfirmButton","CancelButton","Icon"],"mappings":";;;;;;;;;;;;;AAuCA,MAAMA,aAAa,CAACC;IAChB,MAAM,EAAEC,SAAS,EAAEC,YAAY,EAAEC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAE,GAChFC,wBAAAA,OAAa,CAAC;QACV,MAAM,EAEFC,WAAW,EACXC,IAAI,EACJ,cAAcC,oBAAoB,EAClCC,OAAO,EACPC,MAAM,EAGNC,QAAQ,KAAK,EACbC,GAAG,EAGHC,OAAO,EAGPC,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,eAAe,EACfC,eAAe,EACfC,aAAa,EAGbC,QAAQ,EACRC,WAAW,EAGXC,OAAO,EACPC,IAAI,EACJC,eAAe,EAGf,GAAGC,MACN,GAAG3B;QAGJ,MAAM4B,eAAe,CAACnB;YAClBC,wBAAwBA,qBAAqBD;YAE7C,IAAIE,WAAW,CAACF,MACZE;YAGJ,IAAIC,UAAUH,MACVG;QAER;QAEA,OAAO;YACH,WAAW;gBACPJ;gBACAC;gBACAmB;gBACAf;gBACAC;YACJ;YACA,cAAc;gBAGV,UAAU,WAAV,GAAU,sCAAC,aAAKC;YACpB;YACA,aAAa;gBACTC;gBACAC;gBACAC;gBACAC;gBACAE;gBACA,WAAWD;YACf;YACA,WAAW;gBAAEE;gBAAUC;YAAY;YACnC,aAAa;gBAAEE;gBAAMD;gBAAS,WAAWE;YAAgB;YACzD,cAAcC;QAClB;IACJ,GAAG;QAAC3B;KAAM;IAEd,OAAO,WAAP,GACI,sCAAC6B,YAAe5B,WACXC,aAAa,QAAQ,IAAI,WAAJ,GAAI,sCAAC4B,eAAaA;QAAE,GAAG5B,YAAY;QAAE;sBAC3D,sCAAC6B,cAAYA,MAAAA,WAAAA,GACT,sCAAC;QAAI,aAAU;QAAS,WAAW;OAC9B9B,UAAU,KAAK,IAAI,WAAJ,GAAI,sCAAC+B,eAAaA,OAAAA,WAAAA,GAClC,sCAACC,eAAaA;QAAE,GAAG9B,YAAY;QAAE,OAAOF,UAAU,KAAK;qBACnD,sCAACiC,cAAiB9B,cAAAA,WAAAA,GAClB,sCAAC+B,YAAe9B,YAAAA,WAAAA,GAChB,sCAAC+B,cAAiB9B;AAM1C;AAEAP,WAAW,WAAW,GAAG;AAEzB,MAAMsC,oBAAoBC,gBAAgB,UAAUvC;AAEpD,MAAMwC,SAASC,gBAAgBH,mBAAmB;IAC9CI,eAAaA;IACbC,cAAYA;IACZC,MAAIA;AACR"}
@@ -16,5 +16,6 @@ export declare const CustomWidth: Story;
16
16
  export declare const WithTabs: Story;
17
17
  export declare const DropdownMenuInDrawer: Story;
18
18
  export declare const WithIcon: Story;
19
+ export declare const WithHeaderActions: Story;
19
20
  export declare const AsModal: Story;
20
21
  export declare const Documentation: Story;
@@ -1,9 +1,10 @@
1
1
  import react from "react";
2
2
  import { Drawer } from "./Drawer.js";
3
- import { Button } from "../Button/index.js";
3
+ import { Button, IconButton } from "../Button/index.js";
4
4
  import { DropdownMenu } from "../DropdownMenu/index.js";
5
5
  import { Tabs } from "../Tabs/index.js";
6
6
  import { ReactComponent } from "@webiny/icons/ring_volume.svg";
7
+ import { ReactComponent as refresh_svg_ReactComponent } from "@webiny/icons/refresh.svg";
7
8
  const meta = {
8
9
  title: "Components/Drawer",
9
10
  component: Drawer,
@@ -198,6 +199,20 @@ const WithIcon = {
198
199
  children: /*#__PURE__*/ react.createElement(react.Fragment, null, "The icon helps to visually identify the purpose of this drawer.")
199
200
  }
200
201
  };
202
+ const WithHeaderActions = {
203
+ args: {
204
+ ...Default.args,
205
+ headerActions: /*#__PURE__*/ react.createElement(IconButton, {
206
+ variant: "ghost",
207
+ size: "md",
208
+ iconSize: "lg",
209
+ title: "Refresh",
210
+ "aria-label": "Refresh",
211
+ icon: /*#__PURE__*/ react.createElement(refresh_svg_ReactComponent, null)
212
+ }),
213
+ children: /*#__PURE__*/ react.createElement(react.Fragment, null, "Header actions sit next to the close button.")
214
+ }
215
+ };
201
216
  const AsModal = {
202
217
  args: {
203
218
  ...Default.args,
@@ -287,6 +302,9 @@ const Documentation = {
287
302
  control: "boolean",
288
303
  defaultValue: true
289
304
  },
305
+ headerActions: {
306
+ description: "Controls rendered in the header, next to the close button, e.g. icon buttons."
307
+ },
290
308
  footerSeparator: {
291
309
  description: "Show separator above the footer",
292
310
  control: "boolean",
@@ -307,6 +325,6 @@ const Documentation = {
307
325
  }
308
326
  };
309
327
  export default Drawer_stories;
310
- export { AsModal, ControlledVisibility, CustomWidth, Default, Documentation, DropdownMenuInDrawer, SizeExtraLarge, SizeLarge, SizeMedium, SizeSmall, WithDropdownMenu, WithIcon, WithOpenCloseEventHandler, WithTabs, WithoutCloseButton };
328
+ export { AsModal, ControlledVisibility, CustomWidth, Default, Documentation, DropdownMenuInDrawer, SizeExtraLarge, SizeLarge, SizeMedium, SizeSmall, WithDropdownMenu, WithHeaderActions, WithIcon, WithOpenCloseEventHandler, WithTabs, WithoutCloseButton };
311
329
 
312
330
  //# sourceMappingURL=Drawer.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer/Drawer.stories.js","sources":["../../src/Drawer/Drawer.stories.tsx"],"sourcesContent":["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { Drawer } from \"./Drawer.js\";\nimport { Button } from \"~/Button/index.js\";\nimport { DropdownMenu } from \"~/DropdownMenu/index.js\";\nimport { Tabs } from \"~/Tabs/index.js\";\nimport { ReactComponent as DoorbellIcon } from \"@webiny/icons/ring_volume.svg\";\n\nconst meta: Meta<typeof Drawer> = {\n title: \"Components/Drawer\",\n component: Drawer,\n argTypes: {}\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof Drawer>;\n\nexport const Default: Story = {\n args: {\n trigger: <Button variant=\"primary\" text={\"Open\"} />,\n title: \"Drawer Title\",\n description: \"A short dialog description.\",\n info: (\n <>\n Learn more about this <a href={\"#\"}>here</a>.\n </>\n ),\n children: (\n <>\n <p className={\"mb-md\"}>\n The amazing, splendid, and most useful umbrella, resistant to rain and friendly\n to winds, is something that deserves all admiration. Crafted with perfect\n textures, it bravely withstands storms and gently shades the rays of the sun. A\n remarkable innovation, with an ergonomically designed grip most suited to the\n hand, it remains stable even in the fiercest weather.\n </p>\n <p className={\"mb-md\"}>\n Its fabric, woven from the highest quality materials, ensures that you stay dry,\n no matter the intensity of the rain. With a frame engineered for strength yet\n lightweight enough to carry with ease, this umbrella is a marvel of modern\n design. Not just a shield against the elements, but a companion in your everyday\n journey, it provides peace of mind, knowing you’re prepared for whatever the\n skies may bring.\n </p>\n <p className={\"mb-md\"}>\n The sleek, stylish design complements any outfit, making it not only a practical\n accessory but also a fashion statement. With its smooth opening mechanism, you\n can effortlessly transition from a sunny day to a rainy one without missing a\n beat. Whether you are navigating through a busy city street or enjoying a quiet\n stroll in the park, this umbrella offers unmatched comfort and protection.\n </p>\n <p className={\"mb-md\"}>\n Indeed, it is not just an umbrella — it is an experience. One that elevates your\n daily routine, making every step in both sun and storm feel just a little bit\n brighter.\n </p>\n </>\n ),\n onOpenChange: opened => {\n console.log(`Drawer is ${opened ? \"opened\" : \"closed\"}.`);\n },\n actions: (\n <>\n <Drawer.CancelButton />\n <Drawer.ConfirmButton />\n </>\n ),\n bodyPadding: true,\n headerSeparator: true,\n footerSeparator: true\n },\n argTypes: {}\n};\n\nexport const SizeSmall: Story = {\n args: {\n ...Default.args,\n size: \"sm\"\n }\n};\n\nexport const SizeMedium: Story = {\n args: {\n ...Default.args,\n size: \"md\"\n }\n};\n\nexport const SizeLarge: Story = {\n args: {\n ...Default.args,\n size: \"lg\"\n }\n};\n\nexport const SizeExtraLarge: Story = {\n args: {\n ...Default.args,\n size: \"xl\"\n }\n};\n\nexport const ControlledVisibility: Story = {\n render: props => {\n const [open, setOpen] = React.useState(false);\n\n return (\n <>\n <Button variant=\"primary\" text={\"Open\"} onClick={() => setOpen(true)} />\n <Drawer\n {...props}\n open={open}\n onOpenChange={open => {\n if (!open) {\n setOpen(false);\n }\n }}\n />\n </>\n );\n },\n args: {\n ...Default.args,\n trigger: null,\n children: <>This drawer&apos;s visibility is controlled by the open state.</>\n }\n};\n\nexport const WithOpenCloseEventHandler: Story = {\n args: {\n ...Default.args,\n onClose: () => {\n console.log(\"onClose triggered\");\n },\n onOpen: () => {\n console.log(\"onOpen triggered\");\n }\n }\n};\n\nexport const WithDropdownMenu: Story = {\n render: props => {\n const [open, setOpen] = React.useState(false);\n\n return (\n <>\n <DropdownMenu trigger={<Button variant=\"primary\" text={\"Open\"} />}>\n <DropdownMenu.Item\n text={\"Open Drawer\"}\n content={\"Open Drawer\"}\n onClick={() => setOpen(true)}\n />\n </DropdownMenu>\n\n <Drawer {...props} open={open} onOpenChange={() => setOpen(false)} />\n </>\n );\n },\n args: {\n ...Default.args,\n trigger: null,\n children: <>This drawer is opened from a dropdown menu item.</>\n }\n};\n\nexport const WithoutCloseButton: Story = {\n args: {\n ...Default.args,\n showCloseButton: false,\n children: <>This drawer is opened from a dropdown menu item.</>\n }\n};\n\nexport const CustomWidth: Story = {\n args: {\n ...Default.args,\n width: 1000,\n children: <>This drawer has a custom width of 1000px, making it wider than the default.</>\n }\n};\n\nexport const WithTabs: Story = {\n args: {\n ...Default.args,\n bodyPadding: false,\n headerSeparator: false,\n children: (\n <>\n <Tabs\n separator={true}\n spacing={\"lg\"}\n tabs={[\n <Tabs.Tab\n key=\"account\"\n value=\"account\"\n trigger={\"Account\"}\n content={\"Make changes to your account here.\"}\n />,\n <Tabs.Tab\n key=\"company\"\n value=\"company\"\n trigger={\"Company\"}\n content={\"Make changes to your company info here.\"}\n />,\n <Tabs.Tab\n key=\"security\"\n value=\"security\"\n trigger={\"Security\"}\n content={\"Make changes to your security settings here.\"}\n />,\n <Tabs.Tab\n key=\"development\"\n value=\"development\"\n trigger={\"Development\"}\n content={\"Make changes to your development settings here.\"}\n />\n ]}\n />\n </>\n )\n }\n};\n\nexport const DropdownMenuInDrawer: Story = {\n args: {\n ...Default.args,\n children: (\n <>\n <DropdownMenu trigger={<Button variant=\"primary\" text={\"Open\"} />}>\n <DropdownMenu.Item content={\"Billing\"} />\n <DropdownMenu.Item content={\"Settings\"} />\n <DropdownMenu.Item content={\"Keyboard shortcuts\"} />\n </DropdownMenu>\n </>\n )\n }\n};\n\nexport const WithIcon: Story = {\n args: {\n ...Default.args,\n icon: <Drawer.Icon icon={<DoorbellIcon />} label={\"Icon label...\"} />,\n children: <>The icon helps to visually identify the purpose of this drawer.</>\n }\n};\n\nexport const AsModal: Story = {\n args: {\n ...Default.args,\n modal: true,\n children: (\n <>\n This drawer has modal=true, which means it will show an overlay behind it and\n prevent interaction with the content underneath.\n </>\n )\n }\n};\n\nexport const Documentation: Story = {\n render: args => {\n const [open, setOpen] = React.useState(false);\n\n return (\n <>\n <Button variant=\"primary\" text=\"Open Drawer\" onClick={() => setOpen(true)} />\n\n <Drawer {...args} open={open} onOpenChange={open => setOpen(open)} />\n </>\n );\n },\n args: {\n title: \"Drawer Title\",\n description: \"A short drawer description.\",\n showCloseButton: true,\n bodyPadding: true,\n headerSeparator: true,\n footerSeparator: true,\n side: \"right\",\n modal: false,\n info: (\n <>\n Learn more about this <a href={\"#\"}>here</a>.\n </>\n ),\n children: (\n <>\n <p className={\"mb-md, mt-md\"}>\n This is the drawer content area. You can place any content here including forms,\n text, images, or other components.\n </p>\n <p className={\"mb-md\"}>\n Drawers are useful for displaying additional information or actions without\n navigating away from the current page.\n </p>\n </>\n ),\n actions: (\n <>\n <Drawer.CancelButton />\n <Drawer.ConfirmButton />\n </>\n ),\n width: undefined\n },\n argTypes: {\n title: {\n description: \"Title displayed in the header\",\n control: \"text\"\n },\n description: {\n description: \"Description displayed below the title\",\n control: \"text\"\n },\n side: {\n description: \"Side from which the drawer appears\",\n control: \"select\",\n options: [\"left\", \"right\"],\n defaultValue: \"right\"\n },\n size: {\n description: \"Controls the size of the drawer\",\n control: \"select\",\n options: [\"sm\", \"md\", \"lg\", \"xl\"],\n defaultValue: \"md\"\n },\n showCloseButton: {\n description: \"Show close button in the top-right corner\",\n control: \"boolean\",\n defaultValue: true\n },\n modal: {\n description: \"Whether the drawer should behave as a modal\",\n control: \"boolean\",\n defaultValue: false\n },\n bodyPadding: {\n description: \"Add padding to the drawer body\",\n control: \"boolean\",\n defaultValue: true\n },\n headerSeparator: {\n description: \"Show separator below the header\",\n control: \"boolean\",\n defaultValue: true\n },\n footerSeparator: {\n description: \"Show separator above the footer\",\n control: \"boolean\",\n defaultValue: true\n },\n width: {\n description:\n 'Width defines the horizontal size of the Drawer and accepts any valid CSS width value. You can pass a number (interpreted as pixels) or a string like \"80%\", \"50vw\", \"auto\", etc., following React.CSSProperties[\"width\"] types.'\n },\n info: {\n description:\n \"Additional info displayed below the description, please refer to the example below for details.\"\n },\n children: {\n description:\n \"Content of the Drawer, please refer to the 'With Dropdown Menu' and ''With Tabs' example below for details.\"\n },\n actions: {\n description:\n \"Actions displayed in the footer, please refer to the code example for details.\"\n }\n }\n};\n"],"names":["meta","Drawer","Default","Button","opened","console","SizeSmall","SizeMedium","SizeLarge","SizeExtraLarge","ControlledVisibility","props","open","setOpen","React","WithOpenCloseEventHandler","WithDropdownMenu","DropdownMenu","WithoutCloseButton","CustomWidth","WithTabs","Tabs","DropdownMenuInDrawer","WithIcon","DoorbellIcon","AsModal","Documentation","args","undefined"],"mappings":";;;;;;AAQA,MAAMA,OAA4B;IAC9B,OAAO;IACP,WAAWC;IACX,UAAU,CAAC;AACf;AAEA,uBAAeD;AAIR,MAAME,UAAiB;IAC1B,MAAM;QACF,SAAS,WAAT,GAAS,oBAACC,QAAMA;YAAC,SAAQ;YAAU,MAAM;;QACzC,OAAO;QACP,aAAa;QACb,MAAM,WAAN,GACI,0CAAE,wCACwB,oBAAC;YAAE,MAAM;WAAK,SAAQ;QAGpD,UAAU,WAAV,GACI,wDACI,oBAAC;YAAE,WAAW;WAAS,gYAOvB,oBAAC;YAAE,WAAW;WAAS,2aAQvB,oBAAC;YAAE,WAAW;WAAS,2ZAOvB,oBAAC;YAAE,WAAW;WAAS;QAO/B,cAAcC,CAAAA;YACVC,QAAQ,GAAG,CAAC,CAAC,UAAU,EAAED,SAAS,WAAW,SAAS,CAAC,CAAC;QAC5D;QACA,SAAS,WAAT,GACI,wDACI,oBAACH,OAAO,YAAY,uBACpB,oBAACA,OAAO,aAAa;QAG7B,aAAa;QACb,iBAAiB;QACjB,iBAAiB;IACrB;IACA,UAAU,CAAC;AACf;AAEO,MAAMK,YAAmB;IAC5B,MAAM;QACF,GAAGJ,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMK,aAAoB;IAC7B,MAAM;QACF,GAAGL,QAAQ,IAAI;QACf,MAAM;I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A,OAAO;YACH,aACI;QACR;QACA,MAAM;YACF,aACI;QACR;QACA,UAAU;YACN,aACI;QACR;QACA,SAAS;YACL,aACI;QACR;IACJ;AACJ"}
1
+ {"version":3,"file":"Drawer/Drawer.stories.js","sources":["../../src/Drawer/Drawer.stories.tsx"],"sourcesContent":["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { Drawer } from \"./Drawer.js\";\nimport { Button, IconButton } from \"~/Button/index.js\";\nimport { DropdownMenu } from \"~/DropdownMenu/index.js\";\nimport { Tabs } from \"~/Tabs/index.js\";\nimport { ReactComponent as DoorbellIcon } from \"@webiny/icons/ring_volume.svg\";\nimport { ReactComponent as RefreshIcon } from \"@webiny/icons/refresh.svg\";\n\nconst meta: Meta<typeof Drawer> = {\n title: \"Components/Drawer\",\n component: Drawer,\n argTypes: {}\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof Drawer>;\n\nexport const Default: Story = {\n args: {\n trigger: <Button variant=\"primary\" text={\"Open\"} />,\n title: \"Drawer Title\",\n description: \"A short dialog description.\",\n info: (\n <>\n Learn more about this <a href={\"#\"}>here</a>.\n </>\n ),\n children: (\n <>\n <p className={\"mb-md\"}>\n The amazing, splendid, and most useful umbrella, resistant to rain and friendly\n to winds, is something that deserves all admiration. Crafted with perfect\n textures, it bravely withstands storms and gently shades the rays of the sun. A\n remarkable innovation, with an ergonomically designed grip most suited to the\n hand, it remains stable even in the fiercest weather.\n </p>\n <p className={\"mb-md\"}>\n Its fabric, woven from the highest quality materials, ensures that you stay dry,\n no matter the intensity of the rain. With a frame engineered for strength yet\n lightweight enough to carry with ease, this umbrella is a marvel of modern\n design. Not just a shield against the elements, but a companion in your everyday\n journey, it provides peace of mind, knowing you’re prepared for whatever the\n skies may bring.\n </p>\n <p className={\"mb-md\"}>\n The sleek, stylish design complements any outfit, making it not only a practical\n accessory but also a fashion statement. With its smooth opening mechanism, you\n can effortlessly transition from a sunny day to a rainy one without missing a\n beat. Whether you are navigating through a busy city street or enjoying a quiet\n stroll in the park, this umbrella offers unmatched comfort and protection.\n </p>\n <p className={\"mb-md\"}>\n Indeed, it is not just an umbrella — it is an experience. One that elevates your\n daily routine, making every step in both sun and storm feel just a little bit\n brighter.\n </p>\n </>\n ),\n onOpenChange: opened => {\n console.log(`Drawer is ${opened ? \"opened\" : \"closed\"}.`);\n },\n actions: (\n <>\n <Drawer.CancelButton />\n <Drawer.ConfirmButton />\n </>\n ),\n bodyPadding: true,\n headerSeparator: true,\n footerSeparator: true\n },\n argTypes: {}\n};\n\nexport const SizeSmall: Story = {\n args: {\n ...Default.args,\n size: \"sm\"\n }\n};\n\nexport const SizeMedium: Story = {\n args: {\n ...Default.args,\n size: \"md\"\n }\n};\n\nexport const SizeLarge: Story = {\n args: {\n ...Default.args,\n size: \"lg\"\n }\n};\n\nexport const SizeExtraLarge: Story = {\n args: {\n ...Default.args,\n size: \"xl\"\n }\n};\n\nexport const ControlledVisibility: Story = {\n render: props => {\n const [open, setOpen] = React.useState(false);\n\n return (\n <>\n <Button variant=\"primary\" text={\"Open\"} onClick={() => setOpen(true)} />\n <Drawer\n {...props}\n open={open}\n onOpenChange={open => {\n if (!open) {\n setOpen(false);\n }\n }}\n />\n </>\n );\n },\n args: {\n ...Default.args,\n trigger: null,\n children: <>This drawer&apos;s visibility is controlled by the open state.</>\n }\n};\n\nexport const WithOpenCloseEventHandler: Story = {\n args: {\n ...Default.args,\n onClose: () => {\n console.log(\"onClose triggered\");\n },\n onOpen: () => {\n console.log(\"onOpen triggered\");\n }\n }\n};\n\nexport const WithDropdownMenu: Story = {\n render: props => {\n const [open, setOpen] = React.useState(false);\n\n return (\n <>\n <DropdownMenu trigger={<Button variant=\"primary\" text={\"Open\"} />}>\n <DropdownMenu.Item\n text={\"Open Drawer\"}\n content={\"Open Drawer\"}\n onClick={() => setOpen(true)}\n />\n </DropdownMenu>\n\n <Drawer {...props} open={open} onOpenChange={() => setOpen(false)} />\n </>\n );\n },\n args: {\n ...Default.args,\n trigger: null,\n children: <>This drawer is opened from a dropdown menu item.</>\n }\n};\n\nexport const WithoutCloseButton: Story = {\n args: {\n ...Default.args,\n showCloseButton: false,\n children: <>This drawer is opened from a dropdown menu item.</>\n }\n};\n\nexport const CustomWidth: Story = {\n args: {\n ...Default.args,\n width: 1000,\n children: <>This drawer has a custom width of 1000px, making it wider than the default.</>\n }\n};\n\nexport const WithTabs: Story = {\n args: {\n ...Default.args,\n bodyPadding: false,\n headerSeparator: false,\n children: (\n <>\n <Tabs\n separator={true}\n spacing={\"lg\"}\n tabs={[\n <Tabs.Tab\n key=\"account\"\n value=\"account\"\n trigger={\"Account\"}\n content={\"Make changes to your account here.\"}\n />,\n <Tabs.Tab\n key=\"company\"\n value=\"company\"\n trigger={\"Company\"}\n content={\"Make changes to your company info here.\"}\n />,\n <Tabs.Tab\n key=\"security\"\n value=\"security\"\n trigger={\"Security\"}\n content={\"Make changes to your security settings here.\"}\n />,\n <Tabs.Tab\n key=\"development\"\n value=\"development\"\n trigger={\"Development\"}\n content={\"Make changes to your development settings here.\"}\n />\n ]}\n />\n </>\n )\n }\n};\n\nexport const DropdownMenuInDrawer: Story = {\n args: {\n ...Default.args,\n children: (\n <>\n <DropdownMenu trigger={<Button variant=\"primary\" text={\"Open\"} />}>\n <DropdownMenu.Item content={\"Billing\"} />\n <DropdownMenu.Item content={\"Settings\"} />\n <DropdownMenu.Item content={\"Keyboard shortcuts\"} />\n </DropdownMenu>\n </>\n )\n }\n};\n\nexport const WithIcon: Story = {\n args: {\n ...Default.args,\n icon: <Drawer.Icon icon={<DoorbellIcon />} label={\"Icon label...\"} />,\n children: <>The icon helps to visually identify the purpose of this drawer.</>\n }\n};\n\nexport const WithHeaderActions: Story = {\n args: {\n ...Default.args,\n headerActions: (\n <IconButton\n variant={\"ghost\"}\n size={\"md\"}\n iconSize={\"lg\"}\n title={\"Refresh\"}\n aria-label={\"Refresh\"}\n icon={<RefreshIcon />}\n />\n ),\n children: <>Header actions sit next to the close button.</>\n }\n};\n\nexport const AsModal: Story = {\n args: {\n ...Default.args,\n modal: true,\n children: (\n <>\n This drawer has modal=true, which means it will show an overlay behind it and\n prevent interaction with the content underneath.\n </>\n )\n }\n};\n\nexport const Documentation: Story = {\n render: args => {\n const [open, setOpen] = React.useState(false);\n\n return (\n <>\n <Button variant=\"primary\" text=\"Open Drawer\" onClick={() => setOpen(true)} />\n\n <Drawer {...args} open={open} onOpenChange={open => setOpen(open)} />\n </>\n );\n },\n args: {\n title: \"Drawer Title\",\n description: \"A short drawer description.\",\n showCloseButton: true,\n bodyPadding: true,\n headerSeparator: true,\n footerSeparator: true,\n side: \"right\",\n modal: false,\n info: (\n <>\n Learn more about this <a href={\"#\"}>here</a>.\n </>\n ),\n children: (\n <>\n <p className={\"mb-md, mt-md\"}>\n This is the drawer content area. You can place any content here including forms,\n text, images, or other components.\n </p>\n <p className={\"mb-md\"}>\n Drawers are useful for displaying additional information or actions without\n navigating away from the current page.\n </p>\n </>\n ),\n actions: (\n <>\n <Drawer.CancelButton />\n <Drawer.ConfirmButton />\n </>\n ),\n width: undefined\n },\n argTypes: {\n title: {\n description: \"Title displayed in the header\",\n control: \"text\"\n },\n description: {\n description: \"Description displayed below the title\",\n control: \"text\"\n },\n side: {\n description: \"Side from which the drawer appears\",\n control: \"select\",\n options: [\"left\", \"right\"],\n defaultValue: \"right\"\n },\n size: {\n description: \"Controls the size of the drawer\",\n control: \"select\",\n options: [\"sm\", \"md\", \"lg\", \"xl\"],\n defaultValue: \"md\"\n },\n showCloseButton: {\n description: \"Show close button in the top-right corner\",\n control: \"boolean\",\n defaultValue: true\n },\n modal: {\n description: \"Whether the drawer should behave as a modal\",\n control: \"boolean\",\n defaultValue: false\n },\n bodyPadding: {\n description: \"Add padding to the drawer body\",\n control: \"boolean\",\n defaultValue: true\n },\n headerSeparator: {\n description: \"Show separator below the header\",\n control: \"boolean\",\n defaultValue: true\n },\n headerActions: {\n description:\n \"Controls rendered in the header, next to the close button, e.g. icon buttons.\"\n },\n footerSeparator: {\n description: \"Show separator above the footer\",\n control: \"boolean\",\n defaultValue: true\n },\n width: {\n description:\n 'Width defines the horizontal size of the Drawer and accepts any valid CSS width value. You can pass a number (interpreted as pixels) or a string like \"80%\", \"50vw\", \"auto\", etc., following React.CSSProperties[\"width\"] types.'\n },\n info: {\n description:\n \"Additional info displayed below the description, please refer to the example below for details.\"\n },\n children: {\n description:\n \"Content of the Drawer, please refer to the 'With Dropdown Menu' and ''With Tabs' example below for details.\"\n },\n actions: {\n description:\n \"Actions displayed in the footer, please refer to the code example for details.\"\n }\n }\n};\n"],"names":["meta","Drawer","Default","Button","opened","console","SizeSmall","SizeMedium","SizeLarge","SizeExtraLarge","ControlledVisibility","props","open","setOpen","React","WithOpenCloseEventHandler","WithDropdownMenu","DropdownMenu","WithoutCloseButton","CustomWidth","WithTabs","Tabs","DropdownMenuInDrawer","WithIcon","DoorbellIcon","WithHeaderActions","IconButton","RefreshIcon","AsModal","Documentation","args","undefined"],"mappings":";;;;;;;AASA,MAAMA,OAA4B;IAC9B,OAAO;IACP,WAAWC;IACX,UAAU,CAAC;AACf;AAEA,uBAAeD;AAIR,MAAME,UAAiB;IAC1B,MAAM;QACF,SAAS,WAAT,GAAS,oBAACC,QAAMA;YAAC,SAAQ;YAAU,MAAM;;QACzC,OAAO;QACP,aAAa;QACb,MAAM,WAAN,GACI,0CAAE,wCACwB,oBAAC;YAAE,MAAM;WAAK,SAAQ;QAGpD,UAAU,WAAV,GACI,wDACI,oBAAC;YAAE,WAAW;WAAS,gYAOvB,oBAAC;YAAE,WAAW;WAAS,2aAQvB,oBAAC;YAAE,WAAW;WAAS,2ZAOvB,oBAAC;YAAE,WAAW;WAAS;QAO/B,cAAcC,CAAAA;YACVC,QAAQ,GAAG,CAAC,CAAC,UAAU,EAAED,SAAS,WAAW,SAAS,CAAC,CAAC;QAC5D;QACA,SAAS,WAAT,GACI,wDACI,oBAACH,OAAO,YAAY,uBACpB,oBAACA,OAAO,aAAa;QAG7B,aAAa;QACb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MAAM;YACF,aAAa;YACb,SAAS;YACT,SAAS;gBAAC;gBAAQ;aAAQ;YAC1B,cAAc;QAClB;QACA,MAAM;YACF,aAAa;YACb,SAAS;YACT,SAAS;gBAAC;gBAAM;gBAAM;gBAAM;aAAK;YACjC,cAAc;QAClB;QACA,iBAAiB;YACb,aAAa;YACb,SAAS;YACT,cAAc;QAClB;QACA,OAAO;YACH,aAAa;YACb,SAAS;YACT,cAAc;QAClB;QACA,aAAa;YACT,aAAa;YACb,SAAS;YACT,cAAc;QAClB;QACA,iBAAiB;YACb,aAAa;YACb,SAAS;YACT,cAAc;QAClB;QACA,eAAe;YACX,aACI;QACR;QACA,iBAAiB;YACb,aAAa;YACb,SAAS;YACT,cAAc;QAClB;QACA,OAAO;YACH,aACI;QACR;QACA,MAAM;YACF,aACI;QACR;QACA,UAAU;YACN,aACI;QACR;QACA,SAAS;YACL,aACI;QACR;IACJ;AACJ"}
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { type DrawerProps } from "../Drawer.js";
3
- export type DrawerHeaderProps = Omit<React.HTMLAttributes<HTMLDivElement>, "title"> & Pick<DrawerProps, "title" | "icon" | "description" | "showCloseButton"> & {
3
+ export type DrawerHeaderProps = Omit<React.HTMLAttributes<HTMLDivElement>, "title"> & Pick<DrawerProps, "title" | "icon" | "description" | "showCloseButton" | "headerActions"> & {
4
4
  separator?: DrawerProps["headerSeparator"];
5
5
  };
6
- export declare const DrawerHeader: ({ title, icon, description, showCloseButton, separator, className, ...props }: DrawerHeaderProps) => React.JSX.Element | null;
6
+ export declare const DrawerHeader: ({ title, icon, description, showCloseButton, headerActions, separator, className, ...props }: DrawerHeaderProps) => React.JSX.Element | null;
@@ -6,29 +6,32 @@ import { IconButton } from "../../Button/index.js";
6
6
  import { Dialog } from "radix-ui";
7
7
  import { Separator } from "../../Separator/index.js";
8
8
  import * as __rspack_external_react from "react";
9
- const DrawerHeader = ({ title, icon, description, showCloseButton, separator, className, ...props })=>{
10
- const nothingToRender = (0, __rspack_external_react.useMemo)(()=>!title && !description && !icon && !showCloseButton, [
9
+ const DrawerHeader = ({ title, icon, description, showCloseButton, headerActions, separator, className, ...props })=>{
10
+ const nothingToRender = (0, __rspack_external_react.useMemo)(()=>!title && !description && !icon && !showCloseButton && !headerActions, [
11
11
  title,
12
12
  description,
13
13
  icon,
14
- showCloseButton
14
+ showCloseButton,
15
+ headerActions
15
16
  ]);
16
17
  if (nothingToRender) return null;
17
18
  return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external_react.Fragment, null, /*#__PURE__*/ __rspack_external_react.createElement("div", {
18
19
  ...props,
19
20
  className: cn("flex flex-col gap-sm px-lg py-md text-center sm:text-left text-neutral-primary", className)
20
- }, /*#__PURE__*/ __rspack_external_react.createElement(DrawerTitle, {
21
- className: "flex justify-between"
22
21
  }, /*#__PURE__*/ __rspack_external_react.createElement("div", {
23
- className: "flex gap-xs"
24
- }, icon, title), false !== showCloseButton && /*#__PURE__*/ __rspack_external_react.createElement(Dialog.Close, {
22
+ className: "flex items-center justify-between gap-sm"
23
+ }, /*#__PURE__*/ __rspack_external_react.createElement(DrawerTitle, {
24
+ className: "items-center gap-xs"
25
+ }, icon, title), /*#__PURE__*/ __rspack_external_react.createElement("div", {
26
+ className: "flex items-center gap-xs"
27
+ }, headerActions, false !== showCloseButton && /*#__PURE__*/ __rspack_external_react.createElement(Dialog.Close, {
25
28
  asChild: true
26
29
  }, /*#__PURE__*/ __rspack_external_react.createElement(IconButton, {
27
30
  size: "md",
28
31
  iconSize: "lg",
29
32
  variant: "ghost",
30
33
  icon: /*#__PURE__*/ __rspack_external_react.createElement(ReactComponent, null)
31
- }))), description && /*#__PURE__*/ __rspack_external_react.createElement(DrawerDescription, null, description)), separator && /*#__PURE__*/ __rspack_external_react.createElement(Separator, null));
34
+ })))), description && /*#__PURE__*/ __rspack_external_react.createElement(DrawerDescription, null, description)), separator && /*#__PURE__*/ __rspack_external_react.createElement(Separator, null));
32
35
  };
33
36
  export { DrawerHeader };
34
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer/components/DrawerHeader.js","sources":["../../../src/Drawer/components/DrawerHeader.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { type DrawerProps } from \"../Drawer.js\";\nimport { DrawerTitle } from \"./DrawerTitle.js\";\nimport { DrawerDescription } from \"./DrawerDescription.js\";\nimport { ReactComponent as XIcon } from \"@webiny/icons/close.svg\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Dialog as DrawerPrimitive } from \"radix-ui\";\nimport { useMemo } from \"react\";\nimport { Separator } from \"~/Separator/index.js\";\n\nexport type DrawerHeaderProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> &\n Pick<DrawerProps, \"title\" | \"icon\" | \"description\" | \"showCloseButton\"> & {\n separator?: DrawerProps[\"headerSeparator\"];\n };\n\nexport const DrawerHeader = ({\n title,\n icon,\n description,\n showCloseButton,\n separator,\n className,\n ...props\n}: DrawerHeaderProps) => {\n const nothingToRender = useMemo(() => {\n return !title && !description && !icon && !showCloseButton;\n }, [title, description, icon, showCloseButton]);\n\n if (nothingToRender) {\n return null;\n }\n\n return (\n <>\n <div\n {...props}\n className={cn(\n \"flex flex-col gap-sm px-lg py-md text-center sm:text-left text-neutral-primary\",\n className\n )}\n >\n <DrawerTitle className={\"flex justify-between\"}>\n <div className={\"flex gap-xs\"}>\n {icon}\n {title}\n </div>\n\n {showCloseButton !== false && (\n <DrawerPrimitive.Close asChild>\n <IconButton\n size=\"md\"\n iconSize=\"lg\"\n variant={\"ghost\"}\n icon={<XIcon />}\n />\n </DrawerPrimitive.Close>\n )}\n </DrawerTitle>\n {description && <DrawerDescription>{description}</DrawerDescription>}\n </div>\n {separator && <Separator />}\n </>\n );\n};\n"],"names":["DrawerHeader","title","icon","description","showCloseButton","separator","className","props","nothingToRender","useMemo","cn","DrawerTitle","DrawerPrimitive","IconButton","XIcon","DrawerDescription","Separator"],"mappings":";;;;;;;;AAgBO,MAAMA,eAAe,CAAC,EACzBC,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,eAAe,EACfC,SAAS,EACTC,SAAS,EACT,GAAGC,OACa;IAChB,MAAMC,kBAAkBC,AAAAA,IAAAA,wBAAAA,OAAAA,AAAAA,EAAQ,IACrB,CAACR,SAAS,CAACE,eAAe,CAACD,QAAQ,CAACE,iBAC5C;QAACH;QAAOE;QAAaD;QAAME;KAAgB;IAE9C,IAAII,iBACA,OAAO;IAGX,OAAO,WAAP,GACI,4FACI,sCAAC;QACI,GAAGD,KAAK;QACT,WAAWG,GACP,kFACAJ;qBAGJ,sCAACK,aAAWA;QAAC,WAAW;qBACpB,sCAAC;QAAI,WAAW;OACXT,MACAD,QAGJG,AAAoB,UAApBA,mBAA6B,WAAT,GACjB,sCAACQ,OAAAA,KAAqB;QAAC;qBACnB,sCAACC,YAAUA;QACP,MAAK;QACL,UAAS;QACT,SAAS;QACT,oBAAM,sCAACC,gBAAKA;UAK3BX,eAAe,WAAfA,GAAe,sCAACY,mBAAiBA,MAAEZ,eAEvCE,aAAa,WAAbA,GAAa,sCAACW,WAASA;AAGpC"}
1
+ {"version":3,"file":"Drawer/components/DrawerHeader.js","sources":["../../../src/Drawer/components/DrawerHeader.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { type DrawerProps } from \"../Drawer.js\";\nimport { DrawerTitle } from \"./DrawerTitle.js\";\nimport { DrawerDescription } from \"./DrawerDescription.js\";\nimport { ReactComponent as XIcon } from \"@webiny/icons/close.svg\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Dialog as DrawerPrimitive } from \"radix-ui\";\nimport { useMemo } from \"react\";\nimport { Separator } from \"~/Separator/index.js\";\n\nexport type DrawerHeaderProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> &\n Pick<DrawerProps, \"title\" | \"icon\" | \"description\" | \"showCloseButton\" | \"headerActions\"> & {\n separator?: DrawerProps[\"headerSeparator\"];\n };\n\nexport const DrawerHeader = ({\n title,\n icon,\n description,\n showCloseButton,\n headerActions,\n separator,\n className,\n ...props\n}: DrawerHeaderProps) => {\n const nothingToRender = useMemo(() => {\n return !title && !description && !icon && !showCloseButton && !headerActions;\n }, [title, description, icon, showCloseButton, headerActions]);\n\n if (nothingToRender) {\n return null;\n }\n\n return (\n <>\n <div\n {...props}\n className={cn(\n \"flex flex-col gap-sm px-lg py-md text-center sm:text-left text-neutral-primary\",\n className\n )}\n >\n {/* Buttons stay outside the title, so they don't become part of the dialog's name. */}\n <div className={\"flex items-center justify-between gap-sm\"}>\n <DrawerTitle className={\"items-center gap-xs\"}>\n {icon}\n {title}\n </DrawerTitle>\n\n <div className={\"flex items-center gap-xs\"}>\n {headerActions}\n {showCloseButton !== false && (\n <DrawerPrimitive.Close asChild>\n <IconButton\n size=\"md\"\n iconSize=\"lg\"\n variant={\"ghost\"}\n icon={<XIcon />}\n />\n </DrawerPrimitive.Close>\n )}\n </div>\n </div>\n {description && <DrawerDescription>{description}</DrawerDescription>}\n </div>\n {separator && <Separator />}\n </>\n );\n};\n"],"names":["DrawerHeader","title","icon","description","showCloseButton","headerActions","separator","className","props","nothingToRender","useMemo","cn","DrawerTitle","DrawerPrimitive","IconButton","XIcon","DrawerDescription","Separator"],"mappings":";;;;;;;;AAgBO,MAAMA,eAAe,CAAC,EACzBC,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,SAAS,EACT,GAAGC,OACa;IAChB,MAAMC,kBAAkBC,AAAAA,IAAAA,wBAAAA,OAAAA,AAAAA,EAAQ,IACrB,CAACT,SAAS,CAACE,eAAe,CAACD,QAAQ,CAACE,mBAAmB,CAACC,eAChE;QAACJ;QAAOE;QAAaD;QAAME;QAAiBC;KAAc;IAE7D,IAAII,iBACA,OAAO;IAGX,OAAO,WAAP,GACI,4FACI,sCAAC;QACI,GAAGD,KAAK;QACT,WAAWG,GACP,kFACAJ;qBAIJ,sCAAC;QAAI,WAAW;qBACZ,sCAACK,aAAWA;QAAC,WAAW;OACnBV,MACAD,QAAAA,WAAAA,GAGL,sCAAC;QAAI,WAAW;OACXI,eACAD,AAAoB,UAApBA,mBAA6B,WAAT,GACjB,sCAACS,OAAAA,KAAqB;QAAC;qBACnB,sCAACC,YAAUA;QACP,MAAK;QACL,UAAS;QACT,SAAS;QACT,oBAAM,sCAACC,gBAAKA;WAM/BZ,eAAe,WAAfA,GAAe,sCAACa,mBAAiBA,MAAEb,eAEvCG,aAAa,WAAbA,GAAa,sCAACW,WAASA;AAGpC"}
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { IconProps as IconComponentProps } from "../../Icon/index.js";
3
3
  type IconProps = IconComponentProps;
4
- declare const IconBase: ({ className, ...props }: IconProps) => React.JSX.Element;
4
+ declare const IconBase: (props: IconProps) => React.JSX.Element;
5
5
  export declare const Icon: typeof IconBase & {
6
6
  original: typeof IconBase;
7
7
  originalName: string;
@@ -1,11 +1,10 @@
1
- import { cn, makeDecoratable } from "../../utils.js";
1
+ import { makeDecoratable } from "../../utils.js";
2
2
  import { Icon } from "../../Icon/index.js";
3
3
  import * as __rspack_external_react from "react";
4
- const IconBase = ({ className, ...props })=>/*#__PURE__*/ __rspack_external_react.createElement(Icon, {
4
+ const IconBase = (props)=>/*#__PURE__*/ __rspack_external_react.createElement(Icon, {
5
5
  size: "lg",
6
6
  color: "neutral-strong",
7
- ...props,
8
- className: cn("pt-xs", className)
7
+ ...props
9
8
  });
10
9
  const Icon_Icon = makeDecoratable("Icon", IconBase);
11
10
  export { Icon_Icon as Icon };
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer/components/Icon.js","sources":["../../../src/Drawer/components/Icon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport type { IconProps as IconComponentProps } from \"~/Icon/index.js\";\nimport { Icon as IconComponent } from \"~/Icon/index.js\";\n\ntype IconProps = IconComponentProps;\n\nconst IconBase = ({ className, ...props }: IconProps) => {\n return (\n <IconComponent\n size={\"lg\"}\n color={\"neutral-strong\"}\n {...props}\n className={cn(\"pt-xs\", className)}\n />\n );\n};\n\nexport const Icon = makeDecoratable(\"Icon\", IconBase);\n"],"names":["IconBase","className","props","IconComponent","cn","Icon","makeDecoratable"],"mappings":";;;AAOA,MAAMA,WAAW,CAAC,EAAEC,SAAS,EAAE,GAAGC,OAAkB,GACzC,WAAP,GACI,sCAACC,MAAaA;QACV,MAAM;QACN,OAAO;QACN,GAAGD,KAAK;QACT,WAAWE,GAAG,SAASH;;AAK5B,MAAMI,YAAOC,gBAAgB,QAAQN"}
1
+ {"version":3,"file":"Drawer/components/Icon.js","sources":["../../../src/Drawer/components/Icon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { IconProps as IconComponentProps } from \"~/Icon/index.js\";\nimport { Icon as IconComponent } from \"~/Icon/index.js\";\n\ntype IconProps = IconComponentProps;\n\nconst IconBase = (props: IconProps) => {\n return <IconComponent size={\"lg\"} color={\"neutral-strong\"} {...props} />;\n};\n\nexport const Icon = makeDecoratable(\"Icon\", IconBase);\n"],"names":["IconBase","props","IconComponent","Icon","makeDecoratable"],"mappings":";;;AAOA,MAAMA,WAAW,CAACC,QACP,WAAP,GAAO,sCAACC,MAAaA;QAAC,MAAM;QAAM,OAAO;QAAmB,GAAGD,KAAK;;AAGjE,MAAME,YAAOC,gBAAgB,QAAQJ"}
@@ -22,4 +22,10 @@ export declare const CompactWithErrors: Story;
22
22
  export declare const CompactDisabled: Story;
23
23
  export declare const CompactWithValidateFunction: Story;
24
24
  export declare const CompactFullExample: Story;
25
+ /**
26
+ * Reproduces the Website Builder style sidebar at its 206px value column: the preview stacks,
27
+ * the file name truncates in the middle so the extension and version suffix survive, and the
28
+ * actions spell themselves out instead of costing a fixed block of the row.
29
+ */
30
+ export declare const CompactWithLongFileNameInNarrowContainer: Story;
25
31
  export declare const Documentation: Story;
@@ -210,6 +210,29 @@ const CompactFullExample = {
210
210
  }
211
211
  }
212
212
  };
213
+ const CompactWithLongFileNameInNarrowContainer = {
214
+ args: {
215
+ ...Compact.args
216
+ },
217
+ render: (args)=>{
218
+ const [selectedFile, setSelectedFile] = useState({
219
+ name: "tide-cc-statuses-2026-08-21-final-v2.png",
220
+ mimeType: "image/png",
221
+ size: 674161,
222
+ url: "https://picsum.photos/1200/800"
223
+ });
224
+ return /*#__PURE__*/ react.createElement("div", {
225
+ style: {
226
+ width: 206
227
+ }
228
+ }, /*#__PURE__*/ react.createElement(FilePicker, {
229
+ ...args,
230
+ value: selectedFile,
231
+ onSelectItem: ()=>setSelectedFile(getFile()),
232
+ onRemoveItem: ()=>setSelectedFile(null)
233
+ }));
234
+ }
235
+ };
213
236
  const Documentation = {
214
237
  render: (args)=>{
215
238
  const [selectedFile, setSelectedFile] = useState(args.value);
@@ -324,6 +347,6 @@ const Documentation = {
324
347
  }
325
348
  };
326
349
  export default FilePicker_stories;
327
- export { AreaDisabled, AreaFullExample, AreaType, AreaWithDescription, AreaWithErrors, AreaWithLabel, AreaWithLabelRequired, AreaWithNotes, AreaWithValidateFunction, Compact, CompactDisabled, CompactFullExample, CompactWithDescription, CompactWithErrors, CompactWithLabel, CompactWithLabelRequired, CompactWithNotes, CompactWithValidateFunction, Default, Documentation };
350
+ export { AreaDisabled, AreaFullExample, AreaType, AreaWithDescription, AreaWithErrors, AreaWithLabel, AreaWithLabelRequired, AreaWithNotes, AreaWithValidateFunction, Compact, CompactDisabled, CompactFullExample, CompactWithDescription, CompactWithErrors, CompactWithLabel, CompactWithLabelRequired, CompactWithLongFileNameInNarrowContainer, CompactWithNotes, CompactWithValidateFunction, Default, Documentation };
328
351
 
329
352
  //# sourceMappingURL=FilePicker.stories.js.map