@webiny/admin-ui 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2

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 (152) hide show
  1. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +6 -0
  2. package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
  3. package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
  4. package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
  5. package/Breadcrumbs/Breadcrumbs.js +66 -0
  6. package/Breadcrumbs/Breadcrumbs.js.map +1 -0
  7. package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
  8. package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
  9. package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
  10. package/Breadcrumbs/index.d.ts +1 -0
  11. package/Breadcrumbs/index.js +1 -0
  12. package/Button/Button.d.ts +1 -1
  13. package/Button/Button.js +14 -0
  14. package/Button/Button.js.map +1 -1
  15. package/Button/Button.mdx +13 -0
  16. package/Button/Button.stories.d.ts +1 -0
  17. package/Button/Button.stories.js +10 -2
  18. package/Button/Button.stories.js.map +1 -1
  19. package/Button/Button.test.d.ts +1 -0
  20. package/Button/Button.test.js +28 -0
  21. package/Button/Button.test.js.map +1 -0
  22. package/Checkbox/primitives/presenters/CheckboxPresenter.js +5 -2
  23. package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
  24. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.d.ts +1 -0
  25. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js +61 -0
  26. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js.map +1 -0
  27. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js +5 -2
  28. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
  29. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.d.ts +1 -0
  30. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js +108 -0
  31. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js.map +1 -0
  32. package/Command/components/List.d.ts +1 -1
  33. package/Command/components/List.js +9 -5
  34. package/Command/components/List.js.map +1 -1
  35. package/DataTable/DataTable.d.ts +16 -6
  36. package/DataTable/DataTable.js +12 -4
  37. package/DataTable/DataTable.js.map +1 -1
  38. package/DataTable/components/ColumnsVisibility.d.ts +5 -4
  39. package/DataTable/components/ColumnsVisibility.js +6 -3
  40. package/DataTable/components/ColumnsVisibility.js.map +1 -1
  41. package/DatePicker/DatePicker.stories.d.ts +10 -0
  42. package/DatePicker/DatePicker.stories.js +44 -1
  43. package/DatePicker/DatePicker.stories.js.map +1 -1
  44. package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
  45. package/DatePicker/primitives/BirthdayPicker.js +355 -0
  46. package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
  47. package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
  48. package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
  49. package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
  50. package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
  51. package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
  52. package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
  53. package/DatePicker/primitives/DateOnlyPicker.d.ts +1 -1
  54. package/DatePicker/primitives/DateOnlyPicker.js +12 -4
  55. package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
  56. package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
  57. package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
  58. package/DatePicker/primitives/DateRangePicker.js +3 -3
  59. package/DatePicker/primitives/DateRangePicker.js.map +1 -1
  60. package/DatePicker/primitives/DateTimePicker.js +8 -7
  61. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  62. package/DatePicker/primitives/MultipleDatesPicker.js +3 -3
  63. package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
  64. package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
  65. package/DatePicker/utils/birthdayHelpers.js +145 -0
  66. package/DatePicker/utils/birthdayHelpers.js.map +1 -0
  67. package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
  68. package/DatePicker/utils/birthdayHelpers.test.js +394 -0
  69. package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
  70. package/DatePicker/utils/dateHelpers.d.ts +5 -0
  71. package/DatePicker/utils/dateHelpers.js +11 -4
  72. package/DatePicker/utils/dateHelpers.js.map +1 -1
  73. package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
  74. package/DatePicker/utils/dateHelpers.test.js +119 -0
  75. package/DatePicker/utils/dateHelpers.test.js.map +1 -0
  76. package/DatePicker/utils/index.d.ts +1 -0
  77. package/DatePicker/utils/index.js +1 -0
  78. package/DatePicker/utils/types.d.ts +13 -2
  79. package/Drawer/Drawer.d.ts +10 -6
  80. package/Drawer/Drawer.js +2 -1
  81. package/Drawer/Drawer.js.map +1 -1
  82. package/Drawer/Drawer.stories.d.ts +1 -0
  83. package/Drawer/Drawer.stories.js +20 -2
  84. package/Drawer/Drawer.stories.js.map +1 -1
  85. package/Drawer/components/DrawerHeader.d.ts +2 -2
  86. package/Drawer/components/DrawerHeader.js +11 -8
  87. package/Drawer/components/DrawerHeader.js.map +1 -1
  88. package/Drawer/components/Icon.d.ts +1 -1
  89. package/Drawer/components/Icon.js +3 -4
  90. package/Drawer/components/Icon.js.map +1 -1
  91. package/FilePicker/FilePicker.stories.d.ts +6 -0
  92. package/FilePicker/FilePicker.stories.js +24 -1
  93. package/FilePicker/FilePicker.stories.js.map +1 -1
  94. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  95. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  96. package/IconPicker/primitives/IconPickerPrimitive.js +1 -2
  97. package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
  98. package/ImageEditor/types.js +1 -1
  99. package/ImageEditor/types.js.map +1 -1
  100. package/Markdown/Markdown.d.ts +47 -0
  101. package/Markdown/Markdown.js +17 -0
  102. package/Markdown/Markdown.js.map +1 -0
  103. package/Markdown/index.d.ts +1 -0
  104. package/Markdown/index.js +1 -0
  105. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +6 -0
  106. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
  107. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
  108. package/MultiSelect/primitives/MultiSelectPrimitive.js +12 -5
  109. package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
  110. package/Popover/Popover.stories.d.ts +7 -0
  111. package/Popover/Popover.stories.js +24 -1
  112. package/Popover/Popover.stories.js.map +1 -1
  113. package/Popover/primitives/components/PopoverContent.js +6 -1
  114. package/Popover/primitives/components/PopoverContent.js.map +1 -1
  115. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
  116. package/RadioGroup/primitives/RadioGroupPrimitive.js +4 -2
  117. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  118. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js +4 -2
  119. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
  120. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.d.ts +1 -0
  121. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js +88 -0
  122. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js.map +1 -0
  123. package/ScrollArea/ScrollArea.d.ts +16 -2
  124. package/ScrollArea/ScrollArea.js +19 -5
  125. package/ScrollArea/ScrollArea.js.map +1 -1
  126. package/Select/primitives/components/SelectContent.js +4 -6
  127. package/Select/primitives/components/SelectContent.js.map +1 -1
  128. package/Switch/Switch.d.ts +4 -4
  129. package/Switch/Switch.js +21 -7
  130. package/Switch/Switch.js.map +1 -1
  131. package/Switch/domains/SwitchItemDto.d.ts +1 -1
  132. package/Switch/primitives/SwitchPrimitive.js +4 -3
  133. package/Switch/primitives/SwitchPrimitive.js.map +1 -1
  134. package/Tabs/Tabs.d.ts +7 -2
  135. package/Tabs/Tabs.js +29 -11
  136. package/Tabs/Tabs.js.map +1 -1
  137. package/Tabs/Tabs.mdx +27 -0
  138. package/Tabs/Tabs.stories.d.ts +1 -0
  139. package/Tabs/Tabs.stories.js +19 -1
  140. package/Tabs/Tabs.stories.js.map +1 -1
  141. package/Toast/useToast.stories.js.map +1 -1
  142. package/ToggleGroup/primitives/ToggleGroupPrimitive.js +1 -1
  143. package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
  144. package/hooks/index.d.ts +1 -0
  145. package/hooks/index.js +1 -0
  146. package/hooks/useEscapeScrollLock.d.ts +13 -0
  147. package/hooks/useEscapeScrollLock.js +21 -0
  148. package/hooks/useEscapeScrollLock.js.map +1 -0
  149. package/index.d.ts +2 -0
  150. package/index.js +2 -0
  151. package/package.json +22 -22
  152. package/theme.css +38 -0
@@ -0,0 +1,119 @@
1
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
2
+ import { formatDateForDisplay, parseDateValue } from "./dateHelpers.js";
3
+ const originalTimeZone = process.env.TZ;
4
+ const useTimeZone = (timeZone)=>{
5
+ process.env.TZ = timeZone;
6
+ };
7
+ const restoreTimeZone = ()=>{
8
+ if (void 0 === originalTimeZone) return void delete process.env.TZ;
9
+ process.env.TZ = originalTimeZone;
10
+ };
11
+ describe("date-only values in a zone west of UTC (America/New_York)", ()=>{
12
+ beforeAll(()=>{
13
+ useTimeZone("America/New_York");
14
+ });
15
+ afterAll(()=>{
16
+ restoreTimeZone();
17
+ });
18
+ it("runs in the New York zone, where a UTC parse of a yyyy-MM-dd value lands on the previous day", ()=>{
19
+ const utcMidnight = new Date("2026-10-20");
20
+ expect(utcMidnight.getDate()).toBe(19);
21
+ expect(utcMidnight.getHours()).toBe(20);
22
+ });
23
+ it("parses a yyyy-MM-dd value as local midnight of that day", ()=>{
24
+ const date = parseDateValue("2026-10-20");
25
+ expect(date.getFullYear()).toBe(2026);
26
+ expect(date.getMonth()).toBe(9);
27
+ expect(date.getDate()).toBe(20);
28
+ expect(date.getHours()).toBe(0);
29
+ expect(date.getMinutes()).toBe(0);
30
+ expect(date.getSeconds()).toBe(0);
31
+ expect(date.getMilliseconds()).toBe(0);
32
+ expect(date.toISOString()).toBe("2026-10-20T04:00:00.000Z");
33
+ });
34
+ it("parses a full ISO instant as before", ()=>{
35
+ const value = "2026-10-20T02:00:00.000Z";
36
+ const date = parseDateValue(value);
37
+ expect(date.getTime()).toBe(Date.parse(value));
38
+ expect(date.getDate()).toBe(19);
39
+ });
40
+ it("parses an ISO value with an offset as before", ()=>{
41
+ const value = "2026-10-20T23:59:59.999+02:00";
42
+ const date = parseDateValue(value);
43
+ expect(date.toISOString()).toBe("2026-10-20T21:59:59.999Z");
44
+ });
45
+ it("parses a local date-time value as before", ()=>{
46
+ const value = "2026-10-20T00:00:00";
47
+ const expected = new Date(value);
48
+ const date = parseDateValue(value);
49
+ expect(date.getTime()).toBe(expected.getTime());
50
+ });
51
+ it("shows a yyyy-MM-dd value as that day with the default format", ()=>{
52
+ const label = formatDateForDisplay("2026-10-20", "date");
53
+ expect(label).toBe("October 20th, 2026");
54
+ });
55
+ it("shows a yyyy-MM-dd value as that day with a display format", ()=>{
56
+ const label = formatDateForDisplay("2026-10-20", "date", "d MMM yyyy");
57
+ expect(label).toBe("20 Oct 2026");
58
+ });
59
+ it("shows a full ISO instant on its local day as before", ()=>{
60
+ const label = formatDateForDisplay("2026-10-20T02:00:00.000Z", "date");
61
+ expect(label).toBe("October 19th, 2026");
62
+ });
63
+ it("shows nothing for no value", ()=>{
64
+ const label = formatDateForDisplay(void 0, "date");
65
+ expect(label).toBeUndefined();
66
+ });
67
+ it("leaves the local date-time display unchanged", ()=>{
68
+ const label = formatDateForDisplay("2026-10-20T02:00:00.000Z", "dateTimeLocal", "yyyy-MM-dd HH:mm");
69
+ expect(label).toBe("2026-10-19 22:00");
70
+ });
71
+ });
72
+ describe("date-only values in a zone east of UTC (Asia/Tokyo)", ()=>{
73
+ beforeAll(()=>{
74
+ useTimeZone("Asia/Tokyo");
75
+ });
76
+ afterAll(()=>{
77
+ restoreTimeZone();
78
+ });
79
+ it("parses a yyyy-MM-dd value as local midnight of that day", ()=>{
80
+ const date = parseDateValue("2026-10-20");
81
+ expect(date.getDate()).toBe(20);
82
+ expect(date.getHours()).toBe(0);
83
+ expect(date.toISOString()).toBe("2026-10-19T15:00:00.000Z");
84
+ });
85
+ it("shows a yyyy-MM-dd value as that day", ()=>{
86
+ const label = formatDateForDisplay("2026-10-20", "date", "d MMM yyyy");
87
+ expect(label).toBe("20 Oct 2026");
88
+ });
89
+ });
90
+ describe("dateHelpers in a timezone west of UTC", ()=>{
91
+ const originalTz = process.env.TZ;
92
+ beforeAll(()=>{
93
+ process.env.TZ = "America/Chicago";
94
+ });
95
+ afterAll(()=>{
96
+ process.env.TZ = originalTz;
97
+ });
98
+ it("should parse a bare date as that calendar day", ()=>{
99
+ const date = parseDateValue("2026-10-10");
100
+ expect(date.getFullYear()).toBe(2026);
101
+ expect(date.getMonth()).toBe(9);
102
+ expect(date.getDate()).toBe(10);
103
+ });
104
+ it("should leave full ISO strings to the Date constructor", ()=>{
105
+ const date = parseDateValue("2026-10-10T00:00:00.000Z");
106
+ expect(date.toISOString()).toBe("2026-10-10T00:00:00.000Z");
107
+ });
108
+ it("should display a date-only value as the stored day", ()=>{
109
+ expect(formatDateForDisplay("2026-10-10", "date")).toBe("October 10th, 2026");
110
+ });
111
+ it("should display a date range as the stored days", ()=>{
112
+ expect(formatDateForDisplay({
113
+ from: "2026-10-10",
114
+ to: "2026-10-12"
115
+ }, "dateRange", "yyyy-MM-dd")).toBe("2026-10-10 – 2026-10-12");
116
+ });
117
+ });
118
+
119
+ //# 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 } from \"vitest\";\nimport { beforeAll } from \"vitest\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { formatDateForDisplay } from \"./dateHelpers.js\";\nimport { parseDateValue } from \"./dateHelpers.js\";\n\nconst originalTimeZone = process.env.TZ;\n\nconst useTimeZone = (timeZone: string): void => {\n process.env.TZ = timeZone;\n};\n\nconst restoreTimeZone = (): void => {\n if (originalTimeZone === undefined) {\n delete process.env.TZ;\n return;\n }\n process.env.TZ = originalTimeZone;\n};\n\ndescribe(\"date-only values in a zone west of UTC (America/New_York)\", () => {\n beforeAll(() => {\n useTimeZone(\"America/New_York\");\n });\n\n afterAll(() => {\n restoreTimeZone();\n });\n\n it(\"runs in the New York zone, where a UTC parse of a yyyy-MM-dd value lands on the previous day\", () => {\n const utcMidnight = new Date(\"2026-10-20\");\n\n expect(utcMidnight.getDate()).toBe(19);\n expect(utcMidnight.getHours()).toBe(20);\n });\n\n it(\"parses a yyyy-MM-dd value as local midnight of that day\", () => {\n const date = parseDateValue(\"2026-10-20\");\n\n expect(date.getFullYear()).toBe(2026);\n expect(date.getMonth()).toBe(9);\n expect(date.getDate()).toBe(20);\n expect(date.getHours()).toBe(0);\n expect(date.getMinutes()).toBe(0);\n expect(date.getSeconds()).toBe(0);\n expect(date.getMilliseconds()).toBe(0);\n expect(date.toISOString()).toBe(\"2026-10-20T04:00:00.000Z\");\n });\n\n it(\"parses a full ISO instant as before\", () => {\n const value = \"2026-10-20T02:00:00.000Z\";\n\n const date = parseDateValue(value);\n\n expect(date.getTime()).toBe(Date.parse(value));\n expect(date.getDate()).toBe(19);\n });\n\n it(\"parses an ISO value with an offset as before\", () => {\n const value = \"2026-10-20T23:59:59.999+02:00\";\n\n const date = parseDateValue(value);\n\n expect(date.toISOString()).toBe(\"2026-10-20T21:59:59.999Z\");\n });\n\n it(\"parses a local date-time value as before\", () => {\n const value = \"2026-10-20T00:00:00\";\n const expected = new Date(value);\n\n const date = parseDateValue(value);\n\n expect(date.getTime()).toBe(expected.getTime());\n });\n\n it(\"shows a yyyy-MM-dd value as that day with the default format\", () => {\n const label = formatDateForDisplay(\"2026-10-20\", \"date\");\n\n expect(label).toBe(\"October 20th, 2026\");\n });\n\n it(\"shows a yyyy-MM-dd value as that day with a display format\", () => {\n const label = formatDateForDisplay(\"2026-10-20\", \"date\", \"d MMM yyyy\");\n\n expect(label).toBe(\"20 Oct 2026\");\n });\n\n it(\"shows a full ISO instant on its local day as before\", () => {\n const label = formatDateForDisplay(\"2026-10-20T02:00:00.000Z\", \"date\");\n\n expect(label).toBe(\"October 19th, 2026\");\n });\n\n it(\"shows nothing for no value\", () => {\n const label = formatDateForDisplay(undefined, \"date\");\n\n expect(label).toBeUndefined();\n });\n\n it(\"leaves the local date-time display unchanged\", () => {\n const label = formatDateForDisplay(\n \"2026-10-20T02:00:00.000Z\",\n \"dateTimeLocal\",\n \"yyyy-MM-dd HH:mm\"\n );\n\n expect(label).toBe(\"2026-10-19 22:00\");\n });\n});\n\ndescribe(\"date-only values in a zone east of UTC (Asia/Tokyo)\", () => {\n beforeAll(() => {\n useTimeZone(\"Asia/Tokyo\");\n });\n\n afterAll(() => {\n restoreTimeZone();\n });\n\n it(\"parses a yyyy-MM-dd value as local midnight of that day\", () => {\n const date = parseDateValue(\"2026-10-20\");\n\n expect(date.getDate()).toBe(20);\n expect(date.getHours()).toBe(0);\n expect(date.toISOString()).toBe(\"2026-10-19T15:00:00.000Z\");\n });\n\n it(\"shows a yyyy-MM-dd value as that day\", () => {\n const label = formatDateForDisplay(\"2026-10-20\", \"date\", \"d MMM yyyy\");\n\n expect(label).toBe(\"20 Oct 2026\");\n });\n});\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":["originalTimeZone","process","useTimeZone","timeZone","restoreTimeZone","undefined","describe","beforeAll","afterAll","it","utcMidnight","Date","expect","date","parseDateValue","value","expected","label","formatDateForDisplay","originalTz"],"mappings":";;AAQA,MAAMA,mBAAmBC,QAAQ,GAAG,CAAC,EAAE;AAEvC,MAAMC,cAAc,CAACC;IACjBF,QAAQ,GAAG,CAAC,EAAE,GAAGE;AACrB;AAEA,MAAMC,kBAAkB;IACpB,IAAIJ,AAAqBK,WAArBL,kBAAgC,YAChC,OAAOC,QAAQ,GAAG,CAAC,EAAE;IAGzBA,QAAQ,GAAG,CAAC,EAAE,GAAGD;AACrB;AAEAM,SAAS,6DAA6D;IAClEC,UAAU;QACNL,YAAY;IAChB;IAEAM,SAAS;QACLJ;IACJ;IAEAK,GAAG,gGAAgG;QAC/F,MAAMC,cAAc,IAAIC,KAAK;QAE7BC,OAAOF,YAAY,OAAO,IAAI,IAAI,CAAC;QACnCE,OAAOF,YAAY,QAAQ,IAAI,IAAI,CAAC;IACx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@ -1,3 +1,4 @@
1
1
  export * from "./types.js";
2
2
  export * from "./dateHelpers.js";
3
3
  export * from "./constants.js";
4
+ export * from "./birthdayHelpers.js";
@@ -1,3 +1,4 @@
1
1
  export * from "./types.js";
2
2
  export * from "./dateHelpers.js";
3
3
  export * from "./constants.js";
4
+ export * from "./birthdayHelpers.js";
@@ -23,6 +23,17 @@ interface DateOnlyPickerProps extends DatePickerBaseProps {
23
23
  onChange?: (value: string | undefined) => void;
24
24
  presets?: DatePickerPreset[];
25
25
  }
26
+ /**
27
+ * Picks a date as day, then month, then year. The value is a `YYYY-MM-DD` string, the same as
28
+ * the `date` picker's. `yearRange` sets the years offered. By default they run from `maxDate`'s
29
+ * year (or this year) down to `minDate`'s year (or 120 years back). Days, months and years that
30
+ * can't make a date between `minDate` and `maxDate` can't be picked.
31
+ */
32
+ interface BirthdayPickerProps extends DatePickerBaseProps {
33
+ type: "birthday";
34
+ value?: string;
35
+ onChange?: (value: string | undefined) => void;
36
+ }
26
37
  interface TimeOnlyPickerProps extends DatePickerBaseProps {
27
38
  type: "time";
28
39
  value?: string;
@@ -79,5 +90,5 @@ interface MultipleYearsPickerProps extends DatePickerBaseProps {
79
90
  value?: number[];
80
91
  onChange?: (value: number[]) => void;
81
92
  }
82
- type DatePickerPrimitiveProps = DateOnlyPickerProps | TimeOnlyPickerProps | DateTimeLocalPickerProps | DateTimeTzPickerProps | MonthPickerProps | WeekPickerProps | YearPickerProps | DateRangePickerProps | MultipleDatesPickerProps | MultipleMonthsPickerProps | MultipleYearsPickerProps;
83
- export { type DatePickerPreset, type DatePickerBaseProps, type DatePickerPrimitiveProps, type DateOnlyPickerProps, type TimeOnlyPickerProps, type DateTimeLocalPickerProps, type DateTimeTzPickerProps, type MonthPickerProps, type WeekPickerProps, type YearPickerProps, type DateRangePickerProps, type MultipleDatesPickerProps, type MultipleMonthsPickerProps, type MultipleYearsPickerProps };
93
+ type DatePickerPrimitiveProps = DateOnlyPickerProps | BirthdayPickerProps | TimeOnlyPickerProps | DateTimeLocalPickerProps | DateTimeTzPickerProps | MonthPickerProps | WeekPickerProps | YearPickerProps | DateRangePickerProps | MultipleDatesPickerProps | MultipleMonthsPickerProps | MultipleYearsPickerProps;
94
+ export { type DatePickerPreset, type DatePickerBaseProps, type DatePickerPrimitiveProps, type DateOnlyPickerProps, type BirthdayPickerProps, type TimeOnlyPickerProps, type DateTimeLocalPickerProps, type DateTimeTzPickerProps, type MonthPickerProps, type WeekPickerProps, type YearPickerProps, type DateRangePickerProps, type MultipleDatesPickerProps, type MultipleMonthsPickerProps, type MultipleYearsPickerProps };
@@ -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,EAC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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,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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,EA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AAa;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,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
+ {"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,W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,WAAN,GACI,0CAAE,wCACwB,oBAAC;YAAE,MAAM;WAAK,SAAQ;QAGpD,UAAU,WAAV,GACI,wDACI,oBAAC;YAAE,WAAW;WAAgB,sIAI9B,oBAAC;YAAE,WAAW;WAAS;QAM/B,SAAS,WAAT,GACI,wDACI,oBAACX,OAAO,YAAY,uBACpB,oBAACA,OAAO,aAAa;QAG7B,OAAO8B;IACX;IACA,UAAU;QACN,OAAO;YACH,aAAa;YACb,SAAS;QACb;QACA,aAAa;YACT,aAAa;YACb,SAAS;QACb;QACA,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