jaci-ui 0.1.0 → 0.2.0

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 (52) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +168 -0
  3. package/dist/components/color-picker/color-picker.cjs +77 -22
  4. package/dist/components/color-picker/color-picker.cjs.map +1 -1
  5. package/dist/components/color-picker/color-picker.d.cts +3 -3
  6. package/dist/components/color-picker/color-picker.d.ts +3 -3
  7. package/dist/components/color-picker/color-picker.js +77 -22
  8. package/dist/components/color-picker/color-picker.js.map +1 -1
  9. package/dist/components/date-picker/date-picker.cjs +227 -30
  10. package/dist/components/date-picker/date-picker.cjs.map +1 -1
  11. package/dist/components/date-picker/date-picker.d.cts +23 -5
  12. package/dist/components/date-picker/date-picker.d.ts +23 -5
  13. package/dist/components/date-picker/date-picker.js +226 -32
  14. package/dist/components/date-picker/date-picker.js.map +1 -1
  15. package/dist/components/date-picker/date-utils.cjs +32 -2
  16. package/dist/components/date-picker/date-utils.cjs.map +1 -1
  17. package/dist/components/date-picker/date-utils.d.cts +5 -0
  18. package/dist/components/date-picker/date-utils.d.ts +5 -0
  19. package/dist/components/date-picker/date-utils.js +29 -3
  20. package/dist/components/date-picker/date-utils.js.map +1 -1
  21. package/dist/components/date-picker/index.d.cts +3 -2
  22. package/dist/components/date-picker/index.d.ts +3 -2
  23. package/dist/components/menu/menu.cjs +1 -2
  24. package/dist/components/menu/menu.cjs.map +1 -1
  25. package/dist/components/menu/menu.d.cts +1 -2
  26. package/dist/components/menu/menu.d.ts +1 -2
  27. package/dist/components/menu/menu.js +1 -2
  28. package/dist/components/menu/menu.js.map +1 -1
  29. package/dist/components/option-selector/option-selector.cjs.map +1 -1
  30. package/dist/components/option-selector/option-selector.d.cts +2 -2
  31. package/dist/components/option-selector/option-selector.d.ts +2 -2
  32. package/dist/components/option-selector/option-selector.js.map +1 -1
  33. package/dist/components/toast/toast.cjs +1 -1
  34. package/dist/components/toast/toast.cjs.map +1 -1
  35. package/dist/components/toast/toast.d.cts +1 -1
  36. package/dist/components/toast/toast.d.ts +1 -1
  37. package/dist/components/toast/toast.js +1 -1
  38. package/dist/components/toast/toast.js.map +1 -1
  39. package/dist/index.cjs +3 -0
  40. package/dist/index.d.cts +3 -2
  41. package/dist/index.d.ts +3 -2
  42. package/dist/index.js +2 -2
  43. package/dist/styled-system/recipes/color-picker.cjs +1 -0
  44. package/dist/styled-system/recipes/color-picker.cjs.map +1 -1
  45. package/dist/styled-system/recipes/color-picker.js +1 -0
  46. package/dist/styled-system/recipes/color-picker.js.map +1 -1
  47. package/dist/styled-system/recipes/date-picker.cjs +6 -0
  48. package/dist/styled-system/recipes/date-picker.cjs.map +1 -1
  49. package/dist/styled-system/recipes/date-picker.js +6 -0
  50. package/dist/styled-system/recipes/date-picker.js.map +1 -1
  51. package/dist/styles.css +190 -4
  52. package/package.json +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"date-utils.cjs","names":[],"sources":["../../../src/components/date-picker/date-utils.ts"],"sourcesContent":["export type DateLike = Date | null | undefined;\n\nexport function cloneDate(date: Date): Date {\n return new Date(date.getTime());\n}\n\n/** Creates a local date at noon to avoid DST changes moving a calendar day. */\nexport function createCalendarDate(year: number, month: number, day: number): Date {\n return new Date(year, month, day, 12, 0, 0, 0);\n}\n\nexport function startOfMonth(date: Date): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth(), 1);\n}\n\nexport function addDays(date: Date, amount: number): Date {\n const result = cloneDate(date);\n result.setDate(result.getDate() + amount);\n return result;\n}\n\nexport function addMonths(date: Date, amount: number): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth() + amount, 1);\n}\n\nexport function dateKey(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function toInputDate(date: DateLike): string {\n return date ? dateKey(date) : \"\";\n}\n\nexport function isSameDay(left: DateLike, right: DateLike): boolean {\n return Boolean(left && right && dateKey(left) === dateKey(right));\n}\n\nexport function isBeforeDay(left: Date, right: Date): boolean {\n return dateKey(left) < dateKey(right);\n}\n\nexport function isAfterDay(left: Date, right: Date): boolean {\n return dateKey(left) > dateKey(right);\n}\n\nexport function getCalendarDays(month: Date, weekStartsOn: number): Date[] {\n const firstDay = startOfMonth(month);\n const offset = (firstDay.getDay() - weekStartsOn + 7) % 7;\n const firstVisibleDay = addDays(firstDay, -offset);\n\n return Array.from({ length: 42 }, (_, index) => addDays(firstVisibleDay, index));\n}\n\nexport function getWeekdayLabels(locale: string, weekStartsOn: number): string[] {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\" });\n const sunday = createCalendarDate(2024, 0, 7);\n\n return Array.from({ length: 7 }, (_, index) =>\n formatter.format(addDays(sunday, (weekStartsOn + index) % 7)),\n );\n}\n\nexport function formatMonthLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(date);\n}\n\nexport function formatDateLabel(date: DateLike, locale: string, placeholder: string): string {\n return date ? new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" }).format(date) : placeholder;\n}\n\nexport function getDateRangeLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }).format(date);\n}\n"],"mappings":";AAEA,SAAgB,UAAU,MAAkB;CAC1C,OAAO,IAAI,KAAK,KAAK,QAAQ,CAAC;AAChC;;AAGA,SAAgB,mBAAmB,MAAc,OAAe,KAAmB;CACjF,OAAO,IAAI,KAAK,MAAM,OAAO,KAAK,IAAI,GAAG,GAAG,CAAC;AAC/C;AAEA,SAAgB,aAAa,MAAkB;CAC7C,OAAO,mBAAmB,KAAK,YAAY,GAAG,KAAK,SAAS,GAAG,CAAC;AAClE;AAEA,SAAgB,QAAQ,MAAY,QAAsB;CACxD,MAAM,SAAS,UAAU,IAAI;CAC7B,OAAO,Q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,SAAS,CAAC,CAAC,CAC9D;AACF;AAEA,SAAgB,iBAAiB,MAAY,QAAwB;CACnE,OAAO,IAAI,KAAK,eAAe,QAAQ;EAAE,OAAO;EAAQ,MAAM;CAAU,CAAC,CAAC,CAAC,OAAO,IAAI;AACxF;AAEA,SAAgB,gBAAgB,MAAgB,QAAgB,aAA6B;CAC3F,OAAO,OAAO,IAAI,KAAK,eAAe,QAAQ,EAAE,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,IAAI;AACxF;AAEA,SAAgB,kBAAkB,MAAY,QAAwB;CACpE,OAAO,IAAI,KAAK,eAAe,QAAQ;EACrC,KAAK;EACL,OAAO;EACP,MAAM;CACR,CAAC,CAAC,CAAC,OAAO,IAAI;AAChB"}
1
+ {"version":3,"file":"date-utils.cjs","names":[],"sources":["../../../src/components/date-picker/date-utils.ts"],"sourcesContent":["export type DateLike = Date | null | undefined;\n\nexport type DatePickerGranularity = \"day\" | \"month\" | \"date-time\";\n\nexport function cloneDate(date: Date): Date {\n return new Date(date.getTime());\n}\n\n/** Creates a local date at noon to avoid DST changes moving a calendar day. */\nexport function createCalendarDate(year: number, month: number, day: number): Date {\n return new Date(year, month, day, 12, 0, 0, 0);\n}\n\nexport function startOfMonth(date: Date): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth(), 1);\n}\n\nexport function addDays(date: Date, amount: number): Date {\n const result = cloneDate(date);\n result.setDate(result.getDate() + amount);\n return result;\n}\n\nexport function addMonths(date: Date, amount: number): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth() + amount, 1);\n}\n\nexport function dateKey(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function toInputDate(date: DateLike): string {\n return date ? dateKey(date) : \"\";\n}\n\nexport function toInputMonth(date: DateLike): string {\n return date ? `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, \"0\")}` : \"\";\n}\n\nexport function toInputDateTime(date: DateLike): string {\n if (!date) return \"\";\n const hours = String(date.getHours()).padStart(2, \"0\");\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n return `${dateKey(date)}T${hours}:${minutes}`;\n}\n\nexport function isSameDay(left: DateLike, right: DateLike): boolean {\n return Boolean(left && right && dateKey(left) === dateKey(right));\n}\n\nexport function isBeforeDay(left: Date, right: Date): boolean {\n return dateKey(left) < dateKey(right);\n}\n\nexport function isAfterDay(left: Date, right: Date): boolean {\n return dateKey(left) > dateKey(right);\n}\n\nexport function getCalendarDays(month: Date, weekStartsOn: number): Date[] {\n const firstDay = startOfMonth(month);\n const offset = (firstDay.getDay() - weekStartsOn + 7) % 7;\n const firstVisibleDay = addDays(firstDay, -offset);\n\n return Array.from({ length: 42 }, (_, index) => addDays(firstVisibleDay, index));\n}\n\nexport function getWeekdayLabels(locale: string, weekStartsOn: number): string[] {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\" });\n const sunday = createCalendarDate(2024, 0, 7);\n\n return Array.from({ length: 7 }, (_, index) =>\n formatter.format(addDays(sunday, (weekStartsOn + index) % 7)),\n );\n}\n\nexport function formatMonthLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(date);\n}\n\nexport function formatDateLabel(\n date: DateLike,\n locale: string,\n placeholder: string,\n granularity: DatePickerGranularity = \"day\",\n): string {\n if (!date) return placeholder;\n if (granularity === \"month\") {\n return new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(date);\n }\n if (granularity === \"date-time\") {\n return new Intl.DateTimeFormat(locale, {\n dateStyle: \"medium\",\n timeStyle: \"short\",\n }).format(date);\n }\n return new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" }).format(date);\n}\n\nexport function getMonthLabels(locale: string): string[] {\n const formatter = new Intl.DateTimeFormat(locale, { month: \"long\" });\n return Array.from({ length: 12 }, (_, month) =>\n formatter.format(createCalendarDate(2024, month, 1)),\n );\n}\n\nexport function toTimeInput(date: DateLike): string {\n if (!date) return \"\";\n return `${String(date.getHours()).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")}`;\n}\n\nexport function getDateRangeLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }).format(date);\n}\n"],"mappings":";AAIA,SAAgB,UAAU,MAAkB;CAC1C,OAAO,IAAI,KAAK,KAAK,QAAQ,CAAC;AAChC;;AAGA,SAAgB,mBAAmB,MAAc,OAAe,KAAmB;CACjF,OAAO,IAAI,KAAK,MAAM,OAAO,KAAK,IAAI,GAAG,GAAG,CAAC;AAC/C;AAEA,SAAgB,aAAa,MAAkB;CAC7C,OAAO,mBAAmB,KAAK,YAAY,GAAG,KAAK,SAAS,GAAG,CAAC;AAClE;AAEA,SAAgB,QAAQ,MAAY,QAAsB;CACxD,MAAM,SAAS,UAAU,IAAI;CAC7B,OAAO,QAAQ,OAAO,QAAQ,IAAI,MAAM;CACxC,OAAO;AACT;AAEA,SAAgB,UAAU,MAAY,QAAsB;CAC1D,OAAO,mBAAmB,KAAK,YAAY,GAAG,KAAK,SAAS,IAAI,QAAQ,CAAC;AAC3E;AAEA,SAAgB,QAAQ,MAAoB;CAC1C,MAAM,QAAQ,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;CACzD,MAAM,MAAM,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;CAClD,OAAO,GAAG,KAAK,YAAY,EAAE,GAAG,MAAM,GAAG;AAC3C;AAEA,SAAgB,YAAY,MAAwB;CAClD,OAAO,OAAO,QAAQ,IAAI,IAAI;AAChC;AAEA,SAAgB,aAAa,MAAwB;CACnD,OAAO,OAAO,GAAG,KAAK,YAAY,EAAE,GAAG,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,MAAM;AAC1F;A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AqC,OAC7B;CACR,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,gBAAgB,SAClB,OAAO,IAAI,KAAK,eAAe,QAAQ;EAAE,OAAO;EAAQ,MAAM;CAAU,CAAC,CAAC,CAAC,OAAO,IAAI;CAExF,IAAI,gBAAgB,aAClB,OAAO,IAAI,KAAK,eAAe,QAAQ;EACrC,WAAW;EACX,WAAW;CACb,CAAC,CAAC,CAAC,OAAO,IAAI;CAEhB,OAAO,IAAI,KAAK,eAAe,QAAQ,EAAE,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI;AAC7E;AAEA,SAAgB,eAAe,QAA0B;CACvD,MAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,OAAO,CAAC;CACnE,OAAO,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,UACpC,UAAU,OAAO,mBAAmB,MAAM,OAAO,CAAC,CAAC,CACrD;AACF;AAEA,SAAgB,YAAY,MAAwB;CAClD,IAAI,CAAC,MAAM,OAAO;CAClB,OAAO,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;AACjG;AAEA,SAAgB,kBAAkB,MAAY,QAAwB;CACpE,OAAO,IAAI,KAAK,eAAe,QAAQ;EACrC,KAAK;EACL,OAAO;EACP,MAAM;CACR,CAAC,CAAC,CAAC,OAAO,IAAI;AAChB"}
@@ -0,0 +1,5 @@
1
+ //#region src/components/date-picker/date-utils.d.ts
2
+ type DatePickerGranularity = "day" | "month" | "date-time";
3
+ //#endregion
4
+ export { DatePickerGranularity };
5
+ //# sourceMappingURL=date-utils.d.cts.map
@@ -0,0 +1,5 @@
1
+ //#region src/components/date-picker/date-utils.d.ts
2
+ type DatePickerGranularity = "day" | "month" | "date-time";
3
+ //#endregion
4
+ export { DatePickerGranularity };
5
+ //# sourceMappingURL=date-utils.d.ts.map
@@ -25,6 +25,15 @@ function dateKey(date) {
25
25
  function toInputDate(date) {
26
26
  return date ? dateKey(date) : "";
27
27
  }
28
+ function toInputMonth(date) {
29
+ return date ? `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}` : "";
30
+ }
31
+ function toInputDateTime(date) {
32
+ if (!date) return "";
33
+ const hours = String(date.getHours()).padStart(2, "0");
34
+ const minutes = String(date.getMinutes()).padStart(2, "0");
35
+ return `${dateKey(date)}T${hours}:${minutes}`;
36
+ }
28
37
  function isSameDay(left, right) {
29
38
  return Boolean(left && right && dateKey(left) === dateKey(right));
30
39
  }
@@ -50,8 +59,25 @@ function formatMonthLabel(date, locale) {
50
59
  year: "numeric"
51
60
  }).format(date);
52
61
  }
53
- function formatDateLabel(date, locale, placeholder) {
54
- return date ? new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date) : placeholder;
62
+ function formatDateLabel(date, locale, placeholder, granularity = "day") {
63
+ if (!date) return placeholder;
64
+ if (granularity === "month") return new Intl.DateTimeFormat(locale, {
65
+ month: "long",
66
+ year: "numeric"
67
+ }).format(date);
68
+ if (granularity === "date-time") return new Intl.DateTimeFormat(locale, {
69
+ dateStyle: "medium",
70
+ timeStyle: "short"
71
+ }).format(date);
72
+ return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
73
+ }
74
+ function getMonthLabels(locale) {
75
+ const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
76
+ return Array.from({ length: 12 }, (_, month) => formatter.format(createCalendarDate(2024, month, 1)));
77
+ }
78
+ function toTimeInput(date) {
79
+ if (!date) return "";
80
+ return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
55
81
  }
56
82
  function getDateRangeLabel(date, locale) {
57
83
  return new Intl.DateTimeFormat(locale, {
@@ -61,6 +87,6 @@ function getDateRangeLabel(date, locale) {
61
87
  }).format(date);
62
88
  }
63
89
  //#endregion
64
- export { addDays, addMonths, cloneDate, createCalendarDate, dateKey, formatDateLabel, formatMonthLabel, getCalendarDays, getDateRangeLabel, getWeekdayLabels, isAfterDay, isBeforeDay, isSameDay, startOfMonth, toInputDate };
90
+ export { addDays, addMonths, cloneDate, createCalendarDate, dateKey, formatDateLabel, formatMonthLabel, getCalendarDays, getDateRangeLabel, getMonthLabels, getWeekdayLabels, isAfterDay, isBeforeDay, isSameDay, startOfMonth, toInputDate, toInputDateTime, toInputMonth, toTimeInput };
65
91
 
66
92
  //# sourceMappingURL=date-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-utils.js","names":[],"sources":["../../../src/components/date-picker/date-utils.ts"],"sourcesContent":["export type DateLike = Date | null | undefined;\n\nexport function cloneDate(date: Date): Date {\n return new Date(date.getTime());\n}\n\n/** Creates a local date at noon to avoid DST changes moving a calendar day. */\nexport function createCalendarDate(year: number, month: number, day: number): Date {\n return new Date(year, month, day, 12, 0, 0, 0);\n}\n\nexport function startOfMonth(date: Date): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth(), 1);\n}\n\nexport function addDays(date: Date, amount: number): Date {\n const result = cloneDate(date);\n result.setDate(result.getDate() + amount);\n return result;\n}\n\nexport function addMonths(date: Date, amount: number): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth() + amount, 1);\n}\n\nexport function dateKey(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function toInputDate(date: DateLike): string {\n return date ? dateKey(date) : \"\";\n}\n\nexport function isSameDay(left: DateLike, right: DateLike): boolean {\n return Boolean(left && right && dateKey(left) === dateKey(right));\n}\n\nexport function isBeforeDay(left: Date, right: Date): boolean {\n return dateKey(left) < dateKey(right);\n}\n\nexport function isAfterDay(left: Date, right: Date): boolean {\n return dateKey(left) > dateKey(right);\n}\n\nexport function getCalendarDays(month: Date, weekStartsOn: number): Date[] {\n const firstDay = startOfMonth(month);\n const offset = (firstDay.getDay() - weekStartsOn + 7) % 7;\n const firstVisibleDay = addDays(firstDay, -offset);\n\n return Array.from({ length: 42 }, (_, index) => addDays(firstVisibleDay, index));\n}\n\nexport function getWeekdayLabels(locale: string, weekStartsOn: number): string[] {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\" });\n const sunday = createCalendarDate(2024, 0, 7);\n\n return Array.from({ length: 7 }, (_, index) =>\n formatter.format(addDays(sunday, (weekStartsOn + index) % 7)),\n );\n}\n\nexport function formatMonthLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(date);\n}\n\nexport function formatDateLabel(date: DateLike, locale: string, placeholder: string): string {\n return date ? new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" }).format(date) : placeholder;\n}\n\nexport function getDateRangeLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }).format(date);\n}\n"],"mappings":";AAEA,SAAgB,UAAU,MAAkB;CAC1C,OAAO,IAAI,KAAK,KAAK,QAAQ,CAAC;AAChC;;AAGA,SAAgB,mBAAmB,MAAc,OAAe,KAAmB;CACjF,OAAO,IAAI,KAAK,MAAM,OAAO,KAAK,IAAI,GAAG,GAAG,CAAC;AAC/C;AAEA,SAAgB,aAAa,MAAkB;CAC7C,OAAO,mBAAmB,KAAK,YAAY,GAAG,KAAK,SAAS,GAAG,CAAC;AAClE;AAEA,SAAgB,QAAQ,MAAY,QAAsB;CACxD,MAAM,SAAS,UAAU,IAAI;CAC7B,OAAO,QAAQ,OAAO,QAAQ,IAAI,MAAM;CACxC,OAAO;AACT;AAEA,SAAgB,UAAU,MAAY,QAAsB;CAC1D,OAAO,mBAAmB,KAAK,YAAY,GAAG,KAAK,SAAS,IAAI,QAAQ,CAAC;AAC3E;AAEA,SAAgB,QAAQ,MAAoB;CAC1C,MAAM,QAAQ,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG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AAE,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,IAAI;AACxF;AAEA,SAAgB,kBAAkB,MAAY,QAAwB;CACpE,OAAO,IAAI,KAAK,eAAe,QAAQ;EACrC,KAAK;EACL,OAAO;EACP,MAAM;CACR,CAAC,CAAC,CAAC,OAAO,IAAI;AAChB"}
1
+ {"version":3,"file":"date-utils.js","names":[],"sources":["../../../src/components/date-picker/date-utils.ts"],"sourcesContent":["export type DateLike = Date | null | undefined;\n\nexport type DatePickerGranularity = \"day\" | \"month\" | \"date-time\";\n\nexport function cloneDate(date: Date): Date {\n return new Date(date.getTime());\n}\n\n/** Creates a local date at noon to avoid DST changes moving a calendar day. */\nexport function createCalendarDate(year: number, month: number, day: number): Date {\n return new Date(year, month, day, 12, 0, 0, 0);\n}\n\nexport function startOfMonth(date: Date): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth(), 1);\n}\n\nexport function addDays(date: Date, amount: number): Date {\n const result = cloneDate(date);\n result.setDate(result.getDate() + amount);\n return result;\n}\n\nexport function addMonths(date: Date, amount: number): Date {\n return createCalendarDate(date.getFullYear(), date.getMonth() + amount, 1);\n}\n\nexport function dateKey(date: Date): string {\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function toInputDate(date: DateLike): string {\n return date ? dateKey(date) : \"\";\n}\n\nexport function toInputMonth(date: DateLike): string {\n return date ? `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, \"0\")}` : \"\";\n}\n\nexport function toInputDateTime(date: DateLike): string {\n if (!date) return \"\";\n const hours = String(date.getHours()).padStart(2, \"0\");\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n return `${dateKey(date)}T${hours}:${minutes}`;\n}\n\nexport function isSameDay(left: DateLike, right: DateLike): boolean {\n return Boolean(left && right && dateKey(left) === dateKey(right));\n}\n\nexport function isBeforeDay(left: Date, right: Date): boolean {\n return dateKey(left) < dateKey(right);\n}\n\nexport function isAfterDay(left: Date, right: Date): boolean {\n return dateKey(left) > dateKey(right);\n}\n\nexport function getCalendarDays(month: Date, weekStartsOn: number): Date[] {\n const firstDay = startOfMonth(month);\n const offset = (firstDay.getDay() - weekStartsOn + 7) % 7;\n const firstVisibleDay = addDays(firstDay, -offset);\n\n return Array.from({ length: 42 }, (_, index) => addDays(firstVisibleDay, index));\n}\n\nexport function getWeekdayLabels(locale: string, weekStartsOn: number): string[] {\n const formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\" });\n const sunday = createCalendarDate(2024, 0, 7);\n\n return Array.from({ length: 7 }, (_, index) =>\n formatter.format(addDays(sunday, (weekStartsOn + index) % 7)),\n );\n}\n\nexport function formatMonthLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(date);\n}\n\nexport function formatDateLabel(\n date: DateLike,\n locale: string,\n placeholder: string,\n granularity: DatePickerGranularity = \"day\",\n): string {\n if (!date) return placeholder;\n if (granularity === \"month\") {\n return new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(date);\n }\n if (granularity === \"date-time\") {\n return new Intl.DateTimeFormat(locale, {\n dateStyle: \"medium\",\n timeStyle: \"short\",\n }).format(date);\n }\n return new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" }).format(date);\n}\n\nexport function getMonthLabels(locale: string): string[] {\n const formatter = new Intl.DateTimeFormat(locale, { month: \"long\" });\n return Array.from({ length: 12 }, (_, month) =>\n formatter.format(createCalendarDate(2024, month, 1)),\n );\n}\n\nexport function toTimeInput(date: DateLike): string {\n if (!date) return \"\";\n return `${String(date.getHours()).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")}`;\n}\n\nexport function getDateRangeLabel(date: Date, locale: string): string {\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n }).format(date);\n}\n"],"mappings":";AAIA,SAAgB,UAAU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,OAAO,IAAI;CAEhB,OAAO,IAAI,KAAK,eAAe,QAAQ,EAAE,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI;AAC7E;AAEA,SAAgB,eAAe,QAA0B;CACvD,MAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,OAAO,CAAC;CACnE,OAAO,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,UACpC,UAAU,OAAO,mBAAmB,MAAM,OAAO,CAAC,CAAC,CACrD;AACF;AAEA,SAAgB,YAAY,MAAwB;CAClD,IAAI,CAAC,MAAM,OAAO;CAClB,OAAO,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;AACjG;AAEA,SAAgB,kBAAkB,MAAY,QAAwB;CACpE,OAAO,IAAI,KAAK,eAAe,QAAQ;EACrC,KAAK;EACL,OAAO;EACP,MAAM;CACR,CAAC,CAAC,CAAC,OAAO,IAAI;AAChB"}
@@ -1,2 +1,3 @@
1
- import { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps } from "./date-picker.cjs";
2
- export { DatePicker, DatePickerCalendar, type DatePickerCalendarProps, DatePickerCaption, type DatePickerCaptionProps, DatePickerClear, type DatePickerClearProps, DatePickerClose, type DatePickerCloseProps, DatePickerControl, type DatePickerControlProps, DatePickerDay, type DatePickerDayProps, DatePickerHeader, type DatePickerHeaderProps, DatePickerLabel, type DatePickerLabelProps, type DatePickerNavigationProps, DatePickerNext, DatePickerPopup, type DatePickerPopupProps, DatePickerPortal, type DatePickerPortalProps, DatePickerPositioner, type DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, type DatePickerRootProps, type DatePickerSize, DatePickerTrigger, type DatePickerTriggerProps, DatePickerValue, type DatePickerValueProps };
1
+ import { DatePickerGranularity } from "./date-utils.cjs";
2
+ import { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerMonthSelect, DatePickerMonthSelectProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTimeField, DatePickerTimeFieldProps, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps, DatePickerYearRange, DatePickerYearSelect, DatePickerYearSelectProps } from "./date-picker.cjs";
3
+ export { DatePicker, DatePickerCalendar, type DatePickerCalendarProps, DatePickerCaption, type DatePickerCaptionProps, DatePickerClear, type DatePickerClearProps, DatePickerClose, type DatePickerCloseProps, DatePickerControl, type DatePickerControlProps, DatePickerDay, type DatePickerDayProps, type DatePickerGranularity, DatePickerHeader, type DatePickerHeaderProps, DatePickerLabel, type DatePickerLabelProps, DatePickerMonthSelect, type DatePickerMonthSelectProps, type DatePickerNavigationProps, DatePickerNext, DatePickerPopup, type DatePickerPopupProps, DatePickerPortal, type DatePickerPortalProps, DatePickerPositioner, type DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, type DatePickerRootProps, type DatePickerSize, DatePickerTimeField, type DatePickerTimeFieldProps, DatePickerTrigger, type DatePickerTriggerProps, DatePickerValue, type DatePickerValueProps, type DatePickerYearRange, DatePickerYearSelect, type DatePickerYearSelectProps };
@@ -1,2 +1,3 @@
1
- import { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps } from "./date-picker.js";
2
- export { DatePicker, DatePickerCalendar, type DatePickerCalendarProps, DatePickerCaption, type DatePickerCaptionProps, DatePickerClear, type DatePickerClearProps, DatePickerClose, type DatePickerCloseProps, DatePickerControl, type DatePickerControlProps, DatePickerDay, type DatePickerDayProps, DatePickerHeader, type DatePickerHeaderProps, DatePickerLabel, type DatePickerLabelProps, type DatePickerNavigationProps, DatePickerNext, DatePickerPopup, type DatePickerPopupProps, DatePickerPortal, type DatePickerPortalProps, DatePickerPositioner, type DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, type DatePickerRootProps, type DatePickerSize, DatePickerTrigger, type DatePickerTriggerProps, DatePickerValue, type DatePickerValueProps };
1
+ import { DatePickerGranularity } from "./date-utils.js";
2
+ import { DatePicker, DatePickerCalendar, DatePickerCalendarProps, DatePickerCaption, DatePickerCaptionProps, DatePickerClear, DatePickerClearProps, DatePickerClose, DatePickerCloseProps, DatePickerControl, DatePickerControlProps, DatePickerDay, DatePickerDayProps, DatePickerHeader, DatePickerHeaderProps, DatePickerLabel, DatePickerLabelProps, DatePickerMonthSelect, DatePickerMonthSelectProps, DatePickerNavigationProps, DatePickerNext, DatePickerPopup, DatePickerPopupProps, DatePickerPortal, DatePickerPortalProps, DatePickerPositioner, DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, DatePickerRootProps, DatePickerSize, DatePickerTimeField, DatePickerTimeFieldProps, DatePickerTrigger, DatePickerTriggerProps, DatePickerValue, DatePickerValueProps, DatePickerYearRange, DatePickerYearSelect, DatePickerYearSelectProps } from "./date-picker.js";
3
+ export { DatePicker, DatePickerCalendar, type DatePickerCalendarProps, DatePickerCaption, type DatePickerCaptionProps, DatePickerClear, type DatePickerClearProps, DatePickerClose, type DatePickerCloseProps, DatePickerControl, type DatePickerControlProps, DatePickerDay, type DatePickerDayProps, type DatePickerGranularity, DatePickerHeader, type DatePickerHeaderProps, DatePickerLabel, type DatePickerLabelProps, DatePickerMonthSelect, type DatePickerMonthSelectProps, type DatePickerNavigationProps, DatePickerNext, DatePickerPopup, type DatePickerPopupProps, DatePickerPortal, type DatePickerPortalProps, DatePickerPositioner, type DatePickerPositionerProps, DatePickerPrevious, DatePickerRoot, type DatePickerRootProps, type DatePickerSize, DatePickerTimeField, type DatePickerTimeFieldProps, DatePickerTrigger, type DatePickerTriggerProps, DatePickerValue, type DatePickerValueProps, type DatePickerYearRange, DatePickerYearSelect, type DatePickerYearSelectProps };
@@ -44,8 +44,7 @@ const MenuItem = (0, react.forwardRef)(function MenuItem({ className, ...props }
44
44
  });
45
45
  });
46
46
  /**
47
- * A navigational item. This is the semantic counterpart of the legacy
48
- * dropdown's link option and retains Base UI's keyboard navigation.
47
+ * A navigational item. It retains Base UI's keyboard navigation.
49
48
  */
50
49
  const MenuLinkItem = (0, react.forwardRef)(function MenuLinkItem({ className, ...props }, ref) {
51
50
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.LinkItem, {
@@ -1 +1 @@
1
- {"version":3,"file":"menu.cjs","names":["BaseMenu","withRecipeClassName","menu"],"sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { MenuRoot as BaseMenuRoot, MenuTrigger as BaseMenuTrigger } from \"@base-ui/react/menu\";\n\nimport { menu } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\n/**\n * Groups the menu parts. It keeps Base UI's controlled `open`/\n * `onOpenChange` API and uncontrolled `defaultOpen` API intact.\n */\nexport type MenuRootProps<Payload = unknown> = BaseMenuRoot.Props<Payload>;\n\nexport function MenuRoot<Payload = unknown>(props: MenuRootProps<Payload>) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type MenuTriggerProps<Payload = unknown> = BaseMenuTrigger.Props<Payload>;\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().trigger, className)}\n data-jaci-component=\"menu\"\n data-slot=\"menu-trigger\"\n />\n );\n});\n\n/** Preserves Base UI's portal and optional container APIs. */\nexport const MenuPortal = BaseMenu.Portal;\n\nexport type MenuPositionerProps = ComponentPropsWithoutRef<typeof BaseMenu.Positioner>;\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(\n function MenuPositioner({ className, ...props }, ref) {\n return (\n <BaseMenu.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().positioner, className)}\n data-slot=\"menu-positioner\"\n />\n );\n },\n);\n\nexport type MenuPopupProps = ComponentPropsWithoutRef<typeof BaseMenu.Popup>;\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().popup, className)}\n data-slot=\"menu-popup\"\n />\n );\n});\n\nexport type MenuItemProps = ComponentPropsWithoutRef<typeof BaseMenu.Item>;\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-item\"\n />\n );\n});\n\nexport type MenuLinkItemProps = ComponentPropsWithoutRef<typeof BaseMenu.LinkItem>;\n\n/**\n * A navigational item. This is the semantic counterpart of the legacy\n * dropdown's link option and retains Base UI's keyboard navigation.\n */\nexport const MenuLinkItem = forwardRef<Element, MenuLinkItemProps>(function MenuLinkItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.LinkItem\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-link-item\"\n />\n );\n});\n\nexport type MenuSeparatorProps = ComponentPropsWithoutRef<typeof BaseMenu.Separator>;\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, MenuSeparatorProps>(function MenuSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().separator, className)}\n data-slot=\"menu-separator\"\n />\n );\n});\n\nexport type MenuGroupProps = ComponentPropsWithoutRef<typeof BaseMenu.Group>;\n\nexport const MenuGroup = forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().group, className)}\n data-slot=\"menu-group\"\n />\n );\n});\n\nexport type MenuGroupLabelProps = ComponentPropsWithoutRef<typeof BaseMenu.GroupLabel>;\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(\n function MenuGroupLabel({ className, ...props }, ref) {\n return (\n <BaseMenu.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().groupLabel, className)}\n data-slot=\"menu-group-label\"\n />\n );\n },\n);\n\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Separator: MenuSeparator,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n createHandle: BaseMenu.createHandle,\n};\n"],"mappings":";;;;;;;AAgBA,SAAgB,SAA4B,OAA+B;CACzE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,MAAV,EAAe,GAAI,MAAQ,CAAA;AACpC;AAIA,MAAa,eAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,SAAV;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,aAAAA,KAAK,CAAC,CAAC,SAAS,SAAS;EACxD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,MAAa,aAAaF,oBAAAA,KAAS;AAInC,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,YAAV;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,aAAAA,KAAK,CAAC,CAAC,YAAY,SAAS;EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,aAAA,GAAA,MAAA,WAAA,CAAuD,SAAS,UAC3E,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,oBAAAA,KAAS,OAAV;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,aAAAA,KAAK,CAAC,CAAC,OAAO,SAAS;EACtD,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,YAAA,GAAA,MAAA,WAAA,CAAkD,SAAS,SACtE,EAAE,WAA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EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,OAAO;CAClB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,MAAM;CACN,UAAU;CACV,WAAW;CACX,OAAO;CACP,YAAY;CACZ,cAAcF,oBAAAA,KAAS;AACzB"}
1
+ {"version":3,"file":"menu.cjs","names":["BaseMenu","withRecipeClassName","menu"],"sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { MenuRoot as BaseMenuRoot, MenuTrigger as BaseMenuTrigger } from \"@base-ui/react/menu\";\n\nimport { menu } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\n/**\n * Groups the menu parts. It keeps Base UI's controlled `open`/\n * `onOpenChange` API and uncontrolled `defaultOpen` API intact.\n */\nexport type MenuRootProps<Payload = unknown> = BaseMenuRoot.Props<Payload>;\n\nexport function MenuRoot<Payload = unknown>(props: MenuRootProps<Payload>) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type MenuTriggerProps<Payload = unknown> = BaseMenuTrigger.Props<Payload>;\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().trigger, className)}\n data-jaci-component=\"menu\"\n data-slot=\"menu-trigger\"\n />\n );\n});\n\n/** Preserves Base UI's portal and optional container APIs. */\nexport const MenuPortal = BaseMenu.Portal;\n\nexport type MenuPositionerProps = ComponentPropsWithoutRef<typeof BaseMenu.Positioner>;\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(\n function MenuPositioner({ className, ...props }, ref) {\n return (\n <BaseMenu.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().positioner, className)}\n data-slot=\"menu-positioner\"\n />\n );\n },\n);\n\nexport type MenuPopupProps = ComponentPropsWithoutRef<typeof BaseMenu.Popup>;\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().popup, className)}\n data-slot=\"menu-popup\"\n />\n );\n});\n\nexport type MenuItemProps = ComponentPropsWithoutRef<typeof BaseMenu.Item>;\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-item\"\n />\n );\n});\n\nexport type MenuLinkItemProps = ComponentPropsWithoutRef<typeof BaseMenu.LinkItem>;\n\n/**\n * A navigational item. It retains Base UI's keyboard navigation.\n */\nexport const MenuLinkItem = forwardRef<Element, MenuLinkItemProps>(function MenuLinkItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.LinkItem\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-link-item\"\n />\n );\n});\n\nexport type MenuSeparatorProps = ComponentPropsWithoutRef<typeof BaseMenu.Separator>;\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, MenuSeparatorProps>(function MenuSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().separator, className)}\n data-slot=\"menu-separator\"\n />\n );\n});\n\nexport type MenuGroupProps = ComponentPropsWithoutRef<typeof BaseMenu.Group>;\n\nexport const MenuGroup = forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().group, className)}\n data-slot=\"menu-group\"\n />\n );\n});\n\nexport type MenuGroupLabelProps = ComponentPropsWithoutRef<typeof BaseMenu.GroupLabel>;\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(\n function MenuGroupLabel({ className, ...props }, ref) {\n return (\n <BaseMenu.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().groupLabel, className)}\n data-slot=\"menu-group-label\"\n />\n );\n },\n);\n\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Separator: MenuSeparator,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n createHandle: BaseMenu.createHandle,\n};\n"],"mappings":";;;;;;;AAgBA,SAAgB,SAA4B,OAA+B;CACzE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,MAAV,EAAe,GAAI,MAAQ,CAAA;AACpC;AAIA,MAAa,eAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,SAAV;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,aAAAA,KAAK,CAAC,CAAC,SAAS,SAAS;EACxD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,MAAa,aAAaF,oBAAAA,KAAS;AAInC,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,YAAV;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,aAAAA,KAAK,CAAC,CAAC,YAAY,SAAS;EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,aAAA,GAAA,MAAA,WAAA,CAAuD,SAAS,UAC3E,EAAE,WAAW,GAAG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U;CACX,CAAA;AAEL,CAAC;AAID,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,oBAAAA,KAAS,YAAV;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,aAAAA,KAAK,CAAC,CAAC,YAAY,SAAS;EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,OAAO;CAClB,MAAM;CACN,SAAS;CACT,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,MAAM;CACN,UAAU;CACV,WAAW;CACX,OAAO;CACP,YAAY;CACZ,cAAcF,oBAAAA,KAAS;AACzB"}
@@ -19,8 +19,7 @@ type MenuItemProps = ComponentPropsWithoutRef<typeof Menu.Item>;
19
19
  declare const MenuItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ContextMenuItemProps, "ref"> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLElement>>;
20
20
  type MenuLinkItemProps = ComponentPropsWithoutRef<typeof Menu.LinkItem>;
21
21
  /**
22
- * A navigational item. This is the semantic counterpart of the legacy
23
- * dropdown's link option and retains Base UI's keyboard navigation.
22
+ * A navigational item. It retains Base UI's keyboard navigation.
24
23
  */
25
24
  declare const MenuLinkItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ContextMenuLinkItemProps, "ref"> & import("react").RefAttributes<Element>, "ref"> & import("react").RefAttributes<Element>>;
26
25
  type MenuSeparatorProps = ComponentPropsWithoutRef<typeof Menu.Separator>;
@@ -19,8 +19,7 @@ type MenuItemProps = ComponentPropsWithoutRef<typeof Menu.Item>;
19
19
  declare const MenuItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ContextMenuItemProps, "ref"> & import("react").RefAttributes<HTMLElement>, "ref"> & import("react").RefAttributes<HTMLElement>>;
20
20
  type MenuLinkItemProps = ComponentPropsWithoutRef<typeof Menu.LinkItem>;
21
21
  /**
22
- * A navigational item. This is the semantic counterpart of the legacy
23
- * dropdown's link option and retains Base UI's keyboard navigation.
22
+ * A navigational item. It retains Base UI's keyboard navigation.
24
23
  */
25
24
  declare const MenuLinkItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ContextMenuLinkItemProps, "ref"> & import("react").RefAttributes<Element>, "ref"> & import("react").RefAttributes<Element>>;
26
25
  type MenuSeparatorProps = ComponentPropsWithoutRef<typeof Menu.Separator>;
@@ -44,8 +44,7 @@ const MenuItem = forwardRef(function MenuItem({ className, ...props }, ref) {
44
44
  });
45
45
  });
46
46
  /**
47
- * A navigational item. This is the semantic counterpart of the legacy
48
- * dropdown's link option and retains Base UI's keyboard navigation.
47
+ * A navigational item. It retains Base UI's keyboard navigation.
49
48
  */
50
49
  const MenuLinkItem = forwardRef(function MenuLinkItem({ className, ...props }, ref) {
51
50
  return /* @__PURE__ */ jsx(Menu.LinkItem, {
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","names":["MenuRoot","BaseMenu","MenuTrigger","Menu"],"sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { MenuRoot as BaseMenuRoot, MenuTrigger as BaseMenuTrigger } from \"@base-ui/react/menu\";\n\nimport { menu } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\n/**\n * Groups the menu parts. It keeps Base UI's controlled `open`/\n * `onOpenChange` API and uncontrolled `defaultOpen` API intact.\n */\nexport type MenuRootProps<Payload = unknown> = BaseMenuRoot.Props<Payload>;\n\nexport function MenuRoot<Payload = unknown>(props: MenuRootProps<Payload>) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type MenuTriggerProps<Payload = unknown> = BaseMenuTrigger.Props<Payload>;\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().trigger, className)}\n data-jaci-component=\"menu\"\n data-slot=\"menu-trigger\"\n />\n );\n});\n\n/** Preserves Base UI's portal and optional container APIs. */\nexport const MenuPortal = BaseMenu.Portal;\n\nexport type MenuPositionerProps = ComponentPropsWithoutRef<typeof BaseMenu.Positioner>;\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(\n function MenuPositioner({ className, ...props }, ref) {\n return (\n <BaseMenu.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().positioner, className)}\n data-slot=\"menu-positioner\"\n />\n );\n },\n);\n\nexport type MenuPopupProps = ComponentPropsWithoutRef<typeof BaseMenu.Popup>;\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().popup, className)}\n data-slot=\"menu-popup\"\n />\n );\n});\n\nexport type MenuItemProps = ComponentPropsWithoutRef<typeof BaseMenu.Item>;\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-item\"\n />\n );\n});\n\nexport type MenuLinkItemProps = ComponentPropsWithoutRef<typeof BaseMenu.LinkItem>;\n\n/**\n * A navigational item. This is the semantic counterpart of the legacy\n * dropdown's link option and retains Base UI's keyboard navigation.\n */\nexport const MenuLinkItem = forwardRef<Element, MenuLinkItemProps>(function MenuLinkItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.LinkItem\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-link-item\"\n />\n );\n});\n\nexport type MenuSeparatorProps = ComponentPropsWithoutRef<typeof BaseMenu.Separator>;\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, MenuSeparatorProps>(function MenuSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().separator, className)}\n data-slot=\"menu-separator\"\n />\n );\n});\n\nexport type MenuGroupProps = ComponentPropsWithoutRef<typeof BaseMenu.Group>;\n\nexport const MenuGroup = forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().group, className)}\n data-slot=\"menu-group\"\n />\n );\n});\n\nexport type MenuGroupLabelProps = ComponentPropsWithoutRef<typeof BaseMenu.GroupLabel>;\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(\n function MenuGroupLabel({ className, ...props }, ref) {\n return (\n <BaseMenu.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().groupLabel, className)}\n data-slot=\"menu-group-label\"\n />\n );\n },\n);\n\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Separator: MenuSeparator,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n createHandle: BaseMenu.createHandle,\n};\n"],"mappings":";;;;;;;AAgBA,SAAgBA,WAA4B,OAA+B;CACzE,OAAO,oBAACC,KAAS,MAAV,EAAe,GAAI,MAAQ,CAAA;AACpC;AAIA,MAAaC,gBAAc,WAAgD,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACD,KAAS,SAAV;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,KAAK,CAAC,CAAC,SAAS,SAAS;EACxD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,MA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eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAACA,KAAS,YAAV;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,KAAK,CAAC,CAAC,YAAY,SAAS;EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAaE,SAAO;CAClB,MAAMH;CACN,SAASE;CACT,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,MAAM;CACN,UAAU;CACV,WAAW;CACX,OAAO;CACP,YAAY;CACZ,cAAcD,KAAS;AACzB"}
1
+ {"version":3,"file":"menu.js","names":["MenuRoot","BaseMenu","MenuTrigger","Menu"],"sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { MenuRoot as BaseMenuRoot, MenuTrigger as BaseMenuTrigger } from \"@base-ui/react/menu\";\n\nimport { menu } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\n/**\n * Groups the menu parts. It keeps Base UI's controlled `open`/\n * `onOpenChange` API and uncontrolled `defaultOpen` API intact.\n */\nexport type MenuRootProps<Payload = unknown> = BaseMenuRoot.Props<Payload>;\n\nexport function MenuRoot<Payload = unknown>(props: MenuRootProps<Payload>) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type MenuTriggerProps<Payload = unknown> = BaseMenuTrigger.Props<Payload>;\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().trigger, className)}\n data-jaci-component=\"menu\"\n data-slot=\"menu-trigger\"\n />\n );\n});\n\n/** Preserves Base UI's portal and optional container APIs. */\nexport const MenuPortal = BaseMenu.Portal;\n\nexport type MenuPositionerProps = ComponentPropsWithoutRef<typeof BaseMenu.Positioner>;\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(\n function MenuPositioner({ className, ...props }, ref) {\n return (\n <BaseMenu.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().positioner, className)}\n data-slot=\"menu-positioner\"\n />\n );\n },\n);\n\nexport type MenuPopupProps = ComponentPropsWithoutRef<typeof BaseMenu.Popup>;\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().popup, className)}\n data-slot=\"menu-popup\"\n />\n );\n});\n\nexport type MenuItemProps = ComponentPropsWithoutRef<typeof BaseMenu.Item>;\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-item\"\n />\n );\n});\n\nexport type MenuLinkItemProps = ComponentPropsWithoutRef<typeof BaseMenu.LinkItem>;\n\n/**\n * A navigational item. It retains Base UI's keyboard navigation.\n */\nexport const MenuLinkItem = forwardRef<Element, MenuLinkItemProps>(function MenuLinkItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.LinkItem\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-link-item\"\n />\n );\n});\n\nexport type MenuSeparatorProps = ComponentPropsWithoutRef<typeof BaseMenu.Separator>;\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, MenuSeparatorProps>(function MenuSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().separator, className)}\n data-slot=\"menu-separator\"\n />\n );\n});\n\nexport type MenuGroupProps = ComponentPropsWithoutRef<typeof BaseMenu.Group>;\n\nexport const MenuGroup = forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().group, className)}\n data-slot=\"menu-group\"\n />\n );\n});\n\nexport type MenuGroupLabelProps = ComponentPropsWithoutRef<typeof BaseMenu.GroupLabel>;\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(\n function MenuGroupLabel({ className, ...props }, ref) {\n return (\n <BaseMenu.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().groupLabel, className)}\n data-slot=\"menu-group-label\"\n />\n );\n },\n);\n\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Separator: MenuSeparator,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n createHandle: BaseMenu.createHandle,\n};\n"],"mappings":";;;;;;;AAgBA,SAAgBA,WAA4B,OAA+B;CACzE,OAAO,oBAACC,KAAS,MAAV,EAAe,GAAI,MAAQ,CAAA;AACpC;AAIA,MAAaC,gBAAc,WAAgD,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACD,KAAS,SAAV;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,KAAK,CAAC,CAAC,SAAS,SAAS;EACxD,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,MAAa,aAAaA,KAAS;AAInC,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAACA,KAAS,YAAV;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,KAAK,CAAC,CAAC,YAAY,SAAS;EAC3D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,YAAY,WAA2C,SAAS,UAC3E,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACA,KAAS,OAAV;EACE,GAAI;EACC;EACL,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1 @@
1
- {"version":3,"file":"option-selector.cjs","names":["optionSelector","cx"],"sources":["../../../src/components/option-selector/option-selector.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useId, useState } from \"react\";\nimport type { ChangeEventHandler, ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { optionSelector } from \"../../styled-system/recipes\";\n\nexport interface OptionSelectorOption {\n /** Stable value submitted by the option. */\n value: string;\n /** Optional visible text. Use `children` for a richer option body. */\n label?: ReactNode;\n /** Custom content such as an icon, preview or illustration. */\n children?: ReactNode;\n /** Disables only this option. */\n disabled?: boolean;\n /** Explicit id for the native input and its label. */\n id?: string;\n}\n\nexport type OptionSelectorValue = string | string[];\n\nexport interface OptionSelectorProps\n extends Omit<ComponentPropsWithoutRef<\"fieldset\">, \"children\" | \"onChange\"> {\n /** Optional icon displayed next to the legend. */\n icon?: ReactNode;\n /** Accessible and visible group label. */\n label?: ReactNode;\n /** Supporting text announced with the group. */\n description?: ReactNode;\n /** Options rendered as custom selectable cards. */\n options?: OptionSelectorOption[];\n /** Name used by the native radio/checkbox inputs and form submission. */\n name?: string;\n /** Select multiple options with checkboxes instead of one radio option. */\n multiple?: boolean;\n /** Controlled selection. A string is used for one option and an array for many. */\n value?: OptionSelectorValue;\n /** Initial selection for an uncontrolled selector. */\n defaultValue?: OptionSelectorValue;\n /** Called with the next selected value after an option changes. */\n onValueChange?: (value: OptionSelectorValue) => void;\n /** Native change event callback kept for compatibility with the legacy API. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Layout of the option cards. Defaults to the horizontal legacy layout. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Responsive number of columns in the option grid. */\n columns?: 1 | 2 | 3 | 4;\n children?: ReactNode;\n}\n\nfunction getMultipleValues(value: OptionSelectorValue | undefined) {\n if (Array.isArray(value)) {\n return value;\n }\n\n return value === undefined ? [] : [value];\n}\n\nfunction getSingleValue(value: OptionSelectorValue | undefined) {\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction isSelected(value: string, selected: OptionSelectorValue | undefined, multiple: boolean) {\n return multiple\n ? getMultipleValues(selected).includes(value)\n : getSingleValue(selected) === value;\n}\n\nexport const OptionSelector = forwardRef<HTMLFieldSetElement, OptionSelectorProps>(\n function OptionSelector(\n {\n children,\n className,\n columns = 1,\n defaultValue,\n description,\n disabled = false,\n icon,\n id,\n label,\n multiple = false,\n name,\n onChange,\n onValueChange,\n options = [],\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n ) {\n const generatedId = useId();\n const baseId = id ?? generatedId;\n const descriptionId = description ? `${baseId}-description` : undefined;\n const inputName = name ?? `${baseId}-options`;\n const [uncontrolledValue, setUncontrolledValue] = useState<OptionSelectorValue>(() =>\n multiple ? getMultipleValues(defaultValue) : (getSingleValue(defaultValue) ?? \"\"),\n );\n const selectedValue = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const styles = optionSelector({\n orientation,\n columns: String(columns) as \"1\" | \"2\" | \"3\" | \"4\",\n });\n\n return (\n <fieldset\n {...props}\n ref={ref}\n aria-describedby={props[\"aria-describedby\"] ?? descriptionId}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"option-selector\"\n data-slot=\"option-selector\"\n disabled={disabled}\n id={id}\n >\n {label || icon ? (\n <legend className={styles.legend} data-slot=\"option-selector-legend\">\n {icon ? (\n <span aria-hidden=\"true\" className={styles.icon} data-slot=\"option-selector-icon\">\n {icon}\n </span>\n ) : null}\n <span className={styles.label} data-slot=\"option-selector-label\">\n {label}\n </span>\n </legend>\n ) : null}\n {description ? (\n <p\n className={styles.description}\n data-slot=\"option-selector-description\"\n id={descriptionId}\n >\n {description}\n </p>\n ) : null}\n <div className={styles.options} data-slot=\"option-selector-options\">\n {options.map((option, index) => {\n const optionDisabled = disabled || Boolean(option.disabled);\n const selected = isSelected(option.value, selectedValue, multiple);\n const optionId = option.id ?? `${baseId}-option-${index}`;\n\n return (\n <label\n className={styles.option}\n data-disabled={optionDisabled || undefined}\n data-selected={selected || undefined}\n data-slot=\"option-selector-option\"\n htmlFor={optionId}\n key={option.value}\n >\n <input\n aria-label={typeof option.label === \"string\" ? option.label : undefined}\n checked={selected}\n className={styles.input}\n data-slot=\"option-selector-input\"\n disabled={optionDisabled}\n id={optionId}\n name={inputName}\n onChange={(event) => {\n const nextValue = multiple\n ? event.currentTarget.checked\n ? [...getMultipleValues(selectedValue), option.value]\n : getMultipleValues(selectedValue).filter(\n (current) => current !== option.value,\n )\n : option.value;\n\n setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n onChange?.(event);\n }}\n type={multiple ? \"checkbox\" : \"radio\"}\n value={option.value}\n />\n <span className={styles.content}>\n {option.children}\n {option.label ? (\n <span className={styles.optionLabel} data-slot=\"option-selector-option-label\">\n {option.label}\n </span>\n ) : null}\n </span>\n </label>\n );\n })}\n {children}\n </div>\n </fieldset>\n );\n },\n);\n"],"mappings":";;;;;;AAoDA,SAAS,kBAAkB,OAAwC;CACjE,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO;CAGT,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK;AAC1C;AAEA,SAAS,eAAe,OAAwC;CAC9D,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK;AAC3C;AAEA,SAAS,WAAW,OAAe,UAA2C,UAAmB;CAC/F,OAAO,WACH,kBAAkB,QAAQ,CAAC,CAAC,SAAS,KAAK,IAC1C,eAAe,QAAQ,MAAM;AACnC;AAEA,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eACP,EACE,UACA,WACA,UAAU,GACV,cACA,aACA,WAAW,OACX,MACA,IACA,OACA,WAAW,OACX,MACA,UACA,eACA,UAAU,CAAC,GACX,cAAc,cACd,OAAO,iBACP,GAAG,SAEL,KACA;CACA,MAAM,eAAA,GAAA,MAAA,MAAA,CAAoB;CAC1B,MAAM,SAAS,MAAM;CACrB,MAAM,gBAA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,SAAD;MACE,WAAW,OAAO;MAClB,iBAAe,kBAAkB,KAAA;MACjC,iBAAe,YAAY,KAAA;MAC3B,aAAU;MACV,SAAS;gBALX,CAQE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;OACE,cAAY,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,KAAA;OAC9D,SAAS;OACT,WAAW,OAAO;OAClB,aAAU;OACV,UAAU;OACV,IAAI;OACJ,MAAM;OACN,WAAW,UAAU;QACnB,MAAM,YAAY,WACd,MAAM,cAAc,UAClB,CAAC,GAAG,kBAAkB,aAAa,GAAG,OAAO,KAAK,IAClD,kBAAkB,aAAa,CAAC,CAAC,QAC9B,YAAY,YAAY,OAAO,KAClC,IACF,OAAO;QAEX,qBAAqB,SAAS;QAC9B,gBAAgB,SAAS;QACzB,WAAW,KAAK;OAClB;OACA,MAAM,WAAW,aAAa;OAC9B,OAAO,OAAO;MACf,CAAA,GACD,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;OAAM,WAAW,OAAO;iBAAxB,CACG,OAAO,UACP,OAAO,QACN,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;QAAM,WAAW,OAAO;QAAa,aAAU;kBAC5C,OAAO;OACJ,CAAA,IACJ,IACA;QACD;QAlCA,OAAO,KAkCP;IAEX,CAAC,GACA,QACE;;EACG;;AAEd,CACF"}
1
+ {"version":3,"file":"option-selector.cjs","names":["optionSelector","cx"],"sources":["../../../src/components/option-selector/option-selector.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useId, useState } from \"react\";\nimport type { ChangeEventHandler, ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { optionSelector } from \"../../styled-system/recipes\";\n\nexport interface OptionSelectorOption {\n /** Stable value submitted by the option. */\n value: string;\n /** Optional visible text. Use `children` for a richer option body. */\n label?: ReactNode;\n /** Custom content such as an icon, preview or illustration. */\n children?: ReactNode;\n /** Disables only this option. */\n disabled?: boolean;\n /** Explicit id for the native input and its label. */\n id?: string;\n}\n\nexport type OptionSelectorValue = string | string[];\n\nexport interface OptionSelectorProps\n extends Omit<ComponentPropsWithoutRef<\"fieldset\">, \"children\" | \"onChange\"> {\n /** Optional icon displayed next to the legend. */\n icon?: ReactNode;\n /** Accessible and visible group label. */\n label?: ReactNode;\n /** Supporting text announced with the group. */\n description?: ReactNode;\n /** Options rendered as custom selectable cards. */\n options?: OptionSelectorOption[];\n /** Name used by the native radio/checkbox inputs and form submission. */\n name?: string;\n /** Select multiple options with checkboxes instead of one radio option. */\n multiple?: boolean;\n /** Controlled selection. A string is used for one option and an array for many. */\n value?: OptionSelectorValue;\n /** Initial selection for an uncontrolled selector. */\n defaultValue?: OptionSelectorValue;\n /** Called with the next selected value after an option changes. */\n onValueChange?: (value: OptionSelectorValue) => void;\n /** Native change event callback. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Layout of the option cards. Defaults to the horizontal layout. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Responsive number of columns in the option grid. */\n columns?: 1 | 2 | 3 | 4;\n children?: ReactNode;\n}\n\nfunction getMultipleValues(value: OptionSelectorValue | undefined) {\n if (Array.isArray(value)) {\n return value;\n }\n\n return value === undefined ? [] : [value];\n}\n\nfunction getSingleValue(value: OptionSelectorValue | undefined) {\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction isSelected(value: string, selected: OptionSelectorValue | undefined, multiple: boolean) {\n return multiple\n ? getMultipleValues(selected).includes(value)\n : getSingleValue(selected) === value;\n}\n\nexport const OptionSelector = forwardRef<HTMLFieldSetElement, OptionSelectorProps>(\n function OptionSelector(\n {\n children,\n className,\n columns = 1,\n defaultValue,\n description,\n disabled = false,\n icon,\n id,\n label,\n multiple = false,\n name,\n onChange,\n onValueChange,\n options = [],\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n ) {\n const generatedId = useId();\n const baseId = id ?? generatedId;\n const descriptionId = description ? `${baseId}-description` : undefined;\n const inputName = name ?? `${baseId}-options`;\n const [uncontrolledValue, setUncontrolledValue] = useState<OptionSelectorValue>(() =>\n multiple ? getMultipleValues(defaultValue) : (getSingleValue(defaultValue) ?? \"\"),\n );\n const selectedValue = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const styles = optionSelector({\n orientation,\n columns: String(columns) as \"1\" | \"2\" | \"3\" | \"4\",\n });\n\n return (\n <fieldset\n {...props}\n ref={ref}\n aria-describedby={props[\"aria-describedby\"] ?? descriptionId}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"option-selector\"\n data-slot=\"option-selector\"\n disabled={disabled}\n id={id}\n >\n {label || icon ? (\n <legend className={styles.legend} data-slot=\"option-selector-legend\">\n {icon ? (\n <span aria-hidden=\"true\" className={styles.icon} data-slot=\"option-selector-icon\">\n {icon}\n </span>\n ) : null}\n <span className={styles.label} data-slot=\"option-selector-label\">\n {label}\n </span>\n </legend>\n ) : null}\n {description ? (\n <p\n className={styles.description}\n data-slot=\"option-selector-description\"\n id={descriptionId}\n >\n {description}\n </p>\n ) : null}\n <div className={styles.options} data-slot=\"option-selector-options\">\n {options.map((option, index) => {\n const optionDisabled = disabled || Boolean(option.disabled);\n const selected = isSelected(option.value, selectedValue, multiple);\n const optionId = option.id ?? `${baseId}-option-${index}`;\n\n return (\n <label\n className={styles.option}\n data-disabled={optionDisabled || undefined}\n data-selected={selected || undefined}\n data-slot=\"option-selector-option\"\n htmlFor={optionId}\n key={option.value}\n >\n <input\n aria-label={typeof option.label === \"string\" ? option.label : undefined}\n checked={selected}\n className={styles.input}\n data-slot=\"option-selector-input\"\n disabled={optionDisabled}\n id={optionId}\n name={inputName}\n onChange={(event) => {\n const nextValue = multiple\n ? event.currentTarget.checked\n ? [...getMultipleValues(selectedValue), option.value]\n : getMultipleValues(selectedValue).filter(\n (current) => current !== option.value,\n )\n : option.value;\n\n setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n onChange?.(event);\n }}\n type={multiple ? \"checkbox\" : \"radio\"}\n value={option.value}\n />\n <span className={styles.content}>\n {option.children}\n {option.label ? (\n <span className={styles.optionLabel} data-slot=\"option-selector-option-label\">\n {option.label}\n </span>\n ) : null}\n </span>\n </label>\n );\n })}\n {children}\n </div>\n </fieldset>\n );\n },\n);\n"],"mappings":";;;;;;AAoDA,SAAS,kBAAkB,OAAwC;CACjE,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO;CAGT,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK;AAC1C;AAEA,SAAS,eAAe,OAAwC;CAC9D,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK;AAC3C;AAEA,SAAS,WAAW,OAAe,UAA2C,UAAmB;CAC/F,OAAO,WACH,kBAAkB,QAAQ,CAAC,CAAC,SAAS,KAAK,IAC1C,eAAe,QAAQ,MAAM;AACnC;AAEA,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eACP,EACE,UACA,WACA,UAAU,GACV,cACA,aACA,WAAW,OACX,MACA,IACA,OACA,WAAW,OACX,MACA,UACA,eACA,UAAU,CAAC,GACX,cAAc,cACd,OAAO,iBACP,GAAG,SAEL,KACA;CACA,MAAM,eAAA,GAAA,MAAA,MAAA,CAAoB;CAC1B,MAAM,SAAS,MAAM;CACrB,MAAM,gBAAgB,cAAc,GAAG,OAAO,gBAAgB,KAAA;CAC9D,MAAM,YAAY,QAAQ,GAAG,OAAO;CACpC,MAAM,CAAC,mBAAmB,yBAAA,GAAA,MAAA,SAAA,OACxB,WAAW,kBAAkB,YAAY,IAAK,eAAe,YAAY,KAAK,EAChF;CACA,MAAM,gBAAgB,oBAAoB,KAAA,IAAY,oBAAoB;CAC1E,MAAM,SAASA,wBAAAA,eAAe;EAC5B;EACA,SAAS,OAAO,OAAO;CACzB,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,YAAD;EACE,GAAI;EACC;EACL,oBAAkB,MAAM,uBAAuB;EAC/C,WAA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,CAAC,QAC9B,YAAY,YAAY,OAAO,KAClC,IACF,OAAO;QAEX,qBAAqB,SAAS;QAC9B,gBAAgB,SAAS;QACzB,WAAW,KAAK;OAClB;OACA,MAAM,WAAW,aAAa;OAC9B,OAAO,OAAO;MACf,CAAA,GACD,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;OAAM,WAAW,OAAO;iBAAxB,CACG,OAAO,UACP,OAAO,QACN,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;QAAM,WAAW,OAAO;QAAa,aAAU;kBAC5C,OAAO;OACJ,CAAA,IACJ,IACA;QACD;QAlCA,OAAO,KAkCP;IAEX,CAAC,GACA,QACE;;EACG;;AAEd,CACF"}
@@ -32,9 +32,9 @@ interface OptionSelectorProps extends Omit<ComponentPropsWithoutRef<"fieldset">,
32
32
  defaultValue?: OptionSelectorValue;
33
33
  /** Called with the next selected value after an option changes. */
34
34
  onValueChange?: (value: OptionSelectorValue) => void;
35
- /** Native change event callback kept for compatibility with the legacy API. */
35
+ /** Native change event callback. */
36
36
  onChange?: ChangeEventHandler<HTMLInputElement>;
37
- /** Layout of the option cards. Defaults to the horizontal legacy layout. */
37
+ /** Layout of the option cards. Defaults to the horizontal layout. */
38
38
  orientation?: "horizontal" | "vertical";
39
39
  /** Responsive number of columns in the option grid. */
40
40
  columns?: 1 | 2 | 3 | 4;
@@ -32,9 +32,9 @@ interface OptionSelectorProps extends Omit<ComponentPropsWithoutRef<"fieldset">,
32
32
  defaultValue?: OptionSelectorValue;
33
33
  /** Called with the next selected value after an option changes. */
34
34
  onValueChange?: (value: OptionSelectorValue) => void;
35
- /** Native change event callback kept for compatibility with the legacy API. */
35
+ /** Native change event callback. */
36
36
  onChange?: ChangeEventHandler<HTMLInputElement>;
37
- /** Layout of the option cards. Defaults to the horizontal legacy layout. */
37
+ /** Layout of the option cards. Defaults to the horizontal layout. */
38
38
  orientation?: "horizontal" | "vertical";
39
39
  /** Responsive number of columns in the option grid. */
40
40
  columns?: 1 | 2 | 3 | 4;
@@ -1 +1 @@
1
- {"version":3,"file":"option-selector.js","names":[],"sources":["../../../src/components/option-selector/option-selector.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useId, useState } from \"react\";\nimport type { ChangeEventHandler, ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { optionSelector } from \"../../styled-system/recipes\";\n\nexport interface OptionSelectorOption {\n /** Stable value submitted by the option. */\n value: string;\n /** Optional visible text. Use `children` for a richer option body. */\n label?: ReactNode;\n /** Custom content such as an icon, preview or illustration. */\n children?: ReactNode;\n /** Disables only this option. */\n disabled?: boolean;\n /** Explicit id for the native input and its label. */\n id?: string;\n}\n\nexport type OptionSelectorValue = string | string[];\n\nexport interface OptionSelectorProps\n extends Omit<ComponentPropsWithoutRef<\"fieldset\">, \"children\" | \"onChange\"> {\n /** Optional icon displayed next to the legend. */\n icon?: ReactNode;\n /** Accessible and visible group label. */\n label?: ReactNode;\n /** Supporting text announced with the group. */\n description?: ReactNode;\n /** Options rendered as custom selectable cards. */\n options?: OptionSelectorOption[];\n /** Name used by the native radio/checkbox inputs and form submission. */\n name?: string;\n /** Select multiple options with checkboxes instead of one radio option. */\n multiple?: boolean;\n /** Controlled selection. A string is used for one option and an array for many. */\n value?: OptionSelectorValue;\n /** Initial selection for an uncontrolled selector. */\n defaultValue?: OptionSelectorValue;\n /** Called with the next selected value after an option changes. */\n onValueChange?: (value: OptionSelectorValue) => void;\n /** Native change event callback kept for compatibility with the legacy API. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Layout of the option cards. Defaults to the horizontal legacy layout. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Responsive number of columns in the option grid. */\n columns?: 1 | 2 | 3 | 4;\n children?: ReactNode;\n}\n\nfunction getMultipleValues(value: OptionSelectorValue | undefined) {\n if (Array.isArray(value)) {\n return value;\n }\n\n return value === undefined ? [] : [value];\n}\n\nfunction getSingleValue(value: OptionSelectorValue | undefined) {\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction isSelected(value: string, selected: OptionSelectorValue | undefined, multiple: boolean) {\n return multiple\n ? getMultipleValues(selected).includes(value)\n : getSingleValue(selected) === value;\n}\n\nexport const OptionSelector = forwardRef<HTMLFieldSetElement, OptionSelectorProps>(\n function OptionSelector(\n {\n children,\n className,\n columns = 1,\n defaultValue,\n description,\n disabled = false,\n icon,\n id,\n label,\n multiple = false,\n name,\n onChange,\n onValueChange,\n options = [],\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n ) {\n const generatedId = useId();\n const baseId = id ?? generatedId;\n const descriptionId = description ? `${baseId}-description` : undefined;\n const inputName = name ?? `${baseId}-options`;\n const [uncontrolledValue, setUncontrolledValue] = useState<OptionSelectorValue>(() =>\n multiple ? getMultipleValues(defaultValue) : (getSingleValue(defaultValue) ?? \"\"),\n );\n const selectedValue = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const styles = optionSelector({\n orientation,\n columns: String(columns) as \"1\" | \"2\" | \"3\" | \"4\",\n });\n\n return (\n <fieldset\n {...props}\n ref={ref}\n aria-describedby={props[\"aria-describedby\"] ?? descriptionId}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"option-selector\"\n data-slot=\"option-selector\"\n disabled={disabled}\n id={id}\n >\n {label || icon ? (\n <legend className={styles.legend} data-slot=\"option-selector-legend\">\n {icon ? (\n <span aria-hidden=\"true\" className={styles.icon} data-slot=\"option-selector-icon\">\n {icon}\n </span>\n ) : null}\n <span className={styles.label} data-slot=\"option-selector-label\">\n {label}\n </span>\n </legend>\n ) : null}\n {description ? (\n <p\n className={styles.description}\n data-slot=\"option-selector-description\"\n id={descriptionId}\n >\n {description}\n </p>\n ) : null}\n <div className={styles.options} data-slot=\"option-selector-options\">\n {options.map((option, index) => {\n const optionDisabled = disabled || Boolean(option.disabled);\n const selected = isSelected(option.value, selectedValue, multiple);\n const optionId = option.id ?? `${baseId}-option-${index}`;\n\n return (\n <label\n className={styles.option}\n data-disabled={optionDisabled || undefined}\n data-selected={selected || undefined}\n data-slot=\"option-selector-option\"\n htmlFor={optionId}\n key={option.value}\n >\n <input\n aria-label={typeof option.label === \"string\" ? option.label : undefined}\n checked={selected}\n className={styles.input}\n data-slot=\"option-selector-input\"\n disabled={optionDisabled}\n id={optionId}\n name={inputName}\n onChange={(event) => {\n const nextValue = multiple\n ? event.currentTarget.checked\n ? [...getMultipleValues(selectedValue), option.value]\n : getMultipleValues(selectedValue).filter(\n (current) => current !== option.value,\n )\n : option.value;\n\n setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n onChange?.(event);\n }}\n type={multiple ? \"checkbox\" : \"radio\"}\n value={option.value}\n />\n <span className={styles.content}>\n {option.children}\n {option.label ? (\n <span className={styles.optionLabel} data-slot=\"option-selector-option-label\">\n {option.label}\n </span>\n ) : null}\n </span>\n </label>\n );\n })}\n {children}\n </div>\n </fieldset>\n );\n },\n);\n"],"mappings":";;;;;;AAoDA,SAAS,kBAAkB,OAAwC;CACjE,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO;CAGT,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK;AAC1C;AAEA,SAAS,eAAe,OAAwC;CAC9D,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK;AAC3C;AAEA,SAAS,WAAW,OAAe,UAA2C,UAAmB;CAC/F,OAAO,WACH,kBAAkB,QAAQ,CAAC,CAAC,SAAS,KAAK,IAC1C,eAAe,QAAQ,MAAM;AACnC;AAEA,MAAa,iBAAiB,WAC5B,SAAS,eACP,EACE,UACA,WACA,UAAU,GACV,cACA,aACA,WAAW,OACX,MACA,IACA,OACA,WAAW,OACX,MACA,UACA,eACA,UAAU,CAAC,GACX,cAAc,cACd,OAAO,iBACP,GAAG,SAEL,KACA;CACA,MAAM,cAAc,MAAM;CAC1B,MAAM,SAAS,MAAM;CACrB,MAAM,gBAAgB,cAAc,GAAG,OAAO,gB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ACV,IAAI;OACJ,MAAM;OACN,WAAW,UAAU;QACnB,MAAM,YAAY,WACd,MAAM,cAAc,UAClB,CAAC,GAAG,kBAAkB,aAAa,GAAG,OAAO,KAAK,IAClD,kBAAkB,aAAa,CAAC,CAAC,QAC9B,YAAY,YAAY,OAAO,KAClC,IACF,OAAO;QAEX,qBAAqB,SAAS;QAC9B,gBAAgB,SAAS;QACzB,WAAW,KAAK;OAClB;OACA,MAAM,WAAW,aAAa;OAC9B,OAAO,OAAO;MACf,CAAA,GACD,qBAAC,QAAD;OAAM,WAAW,OAAO;iBAAxB,CACG,OAAO,UACP,OAAO,QACN,oBAAC,QAAD;QAAM,WAAW,OAAO;QAAa,aAAU;kBAC5C,OAAO;OACJ,CAAA,IACJ,IACA;QACD;QAlCA,OAAO,KAkCP;IAEX,CAAC,GACA,QACE;;EACG;;AAEd,CACF"}
1
+ {"version":3,"file":"option-selector.js","names":[],"sources":["../../../src/components/option-selector/option-selector.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useId, useState } from \"react\";\nimport type { ChangeEventHandler, ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { optionSelector } from \"../../styled-system/recipes\";\n\nexport interface OptionSelectorOption {\n /** Stable value submitted by the option. */\n value: string;\n /** Optional visible text. Use `children` for a richer option body. */\n label?: ReactNode;\n /** Custom content such as an icon, preview or illustration. */\n children?: ReactNode;\n /** Disables only this option. */\n disabled?: boolean;\n /** Explicit id for the native input and its label. */\n id?: string;\n}\n\nexport type OptionSelectorValue = string | string[];\n\nexport interface OptionSelectorProps\n extends Omit<ComponentPropsWithoutRef<\"fieldset\">, \"children\" | \"onChange\"> {\n /** Optional icon displayed next to the legend. */\n icon?: ReactNode;\n /** Accessible and visible group label. */\n label?: ReactNode;\n /** Supporting text announced with the group. */\n description?: ReactNode;\n /** Options rendered as custom selectable cards. */\n options?: OptionSelectorOption[];\n /** Name used by the native radio/checkbox inputs and form submission. */\n name?: string;\n /** Select multiple options with checkboxes instead of one radio option. */\n multiple?: boolean;\n /** Controlled selection. A string is used for one option and an array for many. */\n value?: OptionSelectorValue;\n /** Initial selection for an uncontrolled selector. */\n defaultValue?: OptionSelectorValue;\n /** Called with the next selected value after an option changes. */\n onValueChange?: (value: OptionSelectorValue) => void;\n /** Native change event callback. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Layout of the option cards. Defaults to the horizontal layout. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Responsive number of columns in the option grid. */\n columns?: 1 | 2 | 3 | 4;\n children?: ReactNode;\n}\n\nfunction getMultipleValues(value: OptionSelectorValue | undefined) {\n if (Array.isArray(value)) {\n return value;\n }\n\n return value === undefined ? [] : [value];\n}\n\nfunction getSingleValue(value: OptionSelectorValue | undefined) {\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction isSelected(value: string, selected: OptionSelectorValue | undefined, multiple: boolean) {\n return multiple\n ? getMultipleValues(selected).includes(value)\n : getSingleValue(selected) === value;\n}\n\nexport const OptionSelector = forwardRef<HTMLFieldSetElement, OptionSelectorProps>(\n function OptionSelector(\n {\n children,\n className,\n columns = 1,\n defaultValue,\n description,\n disabled = false,\n icon,\n id,\n label,\n multiple = false,\n name,\n onChange,\n onValueChange,\n options = [],\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n ) {\n const generatedId = useId();\n const baseId = id ?? generatedId;\n const descriptionId = description ? `${baseId}-description` : undefined;\n const inputName = name ?? `${baseId}-options`;\n const [uncontrolledValue, setUncontrolledValue] = useState<OptionSelectorValue>(() =>\n multiple ? getMultipleValues(defaultValue) : (getSingleValue(defaultValue) ?? \"\"),\n );\n const selectedValue = controlledValue === undefined ? uncontrolledValue : controlledValue;\n const styles = optionSelector({\n orientation,\n columns: String(columns) as \"1\" | \"2\" | \"3\" | \"4\",\n });\n\n return (\n <fieldset\n {...props}\n ref={ref}\n aria-describedby={props[\"aria-describedby\"] ?? descriptionId}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"option-selector\"\n data-slot=\"option-selector\"\n disabled={disabled}\n id={id}\n >\n {label || icon ? (\n <legend className={styles.legend} data-slot=\"option-selector-legend\">\n {icon ? (\n <span aria-hidden=\"true\" className={styles.icon} data-slot=\"option-selector-icon\">\n {icon}\n </span>\n ) : null}\n <span className={styles.label} data-slot=\"option-selector-label\">\n {label}\n </span>\n </legend>\n ) : null}\n {description ? (\n <p\n className={styles.description}\n data-slot=\"option-selector-description\"\n id={descriptionId}\n >\n {description}\n </p>\n ) : null}\n <div className={styles.options} data-slot=\"option-selector-options\">\n {options.map((option, index) => {\n const optionDisabled = disabled || Boolean(option.disabled);\n const selected = isSelected(option.value, selectedValue, multiple);\n const optionId = option.id ?? `${baseId}-option-${index}`;\n\n return (\n <label\n className={styles.option}\n data-disabled={optionDisabled || undefined}\n data-selected={selected || undefined}\n data-slot=\"option-selector-option\"\n htmlFor={optionId}\n key={option.value}\n >\n <input\n aria-label={typeof option.label === \"string\" ? option.label : undefined}\n checked={selected}\n className={styles.input}\n data-slot=\"option-selector-input\"\n disabled={optionDisabled}\n id={optionId}\n name={inputName}\n onChange={(event) => {\n const nextValue = multiple\n ? event.currentTarget.checked\n ? [...getMultipleValues(selectedValue), option.value]\n : getMultipleValues(selectedValue).filter(\n (current) => current !== option.value,\n )\n : option.value;\n\n setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n onChange?.(event);\n }}\n type={multiple ? \"checkbox\" : \"radio\"}\n value={option.value}\n />\n <span className={styles.content}>\n {option.children}\n {option.label ? (\n <span className={styles.optionLabel} data-slot=\"option-selector-option-label\">\n {option.label}\n </span>\n ) : null}\n </span>\n </label>\n );\n })}\n {children}\n </div>\n </fieldset>\n );\n },\n);\n"],"mappings":";;;;;;AAoDA,SAAS,kBAAkB,OAAwC;CACjE,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO;CAGT,OAAO,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,KAAK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ACD;GACJ,qBAAC,OAAD;IAAK,WAAW,OAAO;IAAS,aAAU;cAA1C,CACG,QAAQ,KAAK,QAAQ,UAAU;KAC9B,MAAM,iBAAiB,YAAY,QAAQ,OAAO,QAAQ;KAC1D,MAAM,WAAW,WAAW,OAAO,OAAO,eAAe,QAAQ;KACjE,MAAM,WAAW,OAAO,MAAM,GAAG,OAAO,UAAU;KAElD,OACE,qBAAC,SAAD;MACE,WAAW,OAAO;MAClB,iBAAe,kBAAkB,KAAA;MACjC,iBAAe,YAAY,KAAA;MAC3B,aAAU;MACV,SAAS;gBALX,CAQE,oBAAC,SAAD;OACE,cAAY,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,KAAA;OAC9D,SAAS;OACT,WAAW,OAAO;OAClB,aAAU;OACV,UAAU;OACV,IAAI;OACJ,MAAM;OACN,WAAW,UAAU;QACnB,MAAM,YAAY,WACd,MAAM,cAAc,UAClB,CAAC,GAAG,kBAAkB,aAAa,GAAG,OAAO,KAAK,IAClD,kBAAkB,aAAa,CAAC,CAAC,QAC9B,YAAY,YAAY,OAAO,KAClC,IACF,OAAO;QAEX,qBAAqB,SAAS;QAC9B,gBAAgB,SAAS;QACzB,WAAW,KAAK;OAClB;OACA,MAAM,WAAW,aAAa;OAC9B,OAAO,OAAO;MACf,CAAA,GACD,qBAAC,QAAD;OAAM,WAAW,OAAO;iBAAxB,CACG,OAAO,UACP,OAAO,QACN,oBAAC,QAAD;QAAM,WAAW,OAAO;QAAa,aAAU;kBAC5C,OAAO;OACJ,CAAA,IACJ,IACA;QACD;QAlCA,OAAO,KAkCP;IAEX,CAAC,GACA,QACE;;EACG;;AAEd,CACF"}
@@ -25,7 +25,7 @@ function ToastProvider(props) {
25
25
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_toast.Toast.Provider, { ...props });
26
26
  }
27
27
  /**
28
- * A bottom-centred notification region matching the legacy Jaci toast.
28
+ * A bottom-centred notification region.
29
29
  */
30
30
  const ToastViewport = (0, react.forwardRef)(function ToastViewport({ className, ...props }, ref) {
31
31
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_toast.Toast.Viewport, {
@@ -1 +1 @@
1
- {"version":3,"file":"toast.cjs","names":["BaseToast","withRecipeClassName","toastRecipe","cx"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region matching the legacy Jaci toast.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport const ToastPortal: typeof BaseToast.Portal = BaseToast.Portal;\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};\n"],"mappings":";;;;;;;;AAYA,MAAM,kBAA6C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,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,qBAAAA,MAAU,QAAX;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,QAAQ,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,MAAa,cAAuCF,qBAAAA,MAAU;AAgB9D,MAAa,QAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBA,qBAAAA,MAAU;AAC7B"}
1
+ {"version":3,"file":"toast.cjs","names":["BaseToast","withRecipeClassName","toastRecipe","cx"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport const ToastPortal: typeof BaseToast.Portal = BaseToast.Portal;\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};\n"],"mappings":";;;;;;;;AAYA,MAAM,kBAA6C;CACjD,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACX;AAEA,SAAS,YAAY,MAA0B,MAAwC;CACrF,OAAO,SAAS,SAAS,KAAA,IAAY,YAAa,gBAAgB,SAAS;AAC7E;;;;;;AASA,SAAgB,cAAc,OAA2B;CACvD,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,qBAAAA,MAAU,UAAX,EAAoB,GAAI,MAAQ,CAAA;AACzC;;;;AAOA,MAAa,iBAAA,GAAA,MAAA,WAAA,CAA+D,SAAS,cACnF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,qBAAAA,MAAU,UAAX;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,UAAU,SAAS;EAChE,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;;;;;AAeD,MAAa,aAAA,GAAA,MAAA,WAAA,CAAuD,SAAS,UAC3E,EAAE,WAAW,OAAO,aAAa,MAAM,GAAG,SAC1C,KACA;CACA,MAAM,eAAe,YAAY,YAAY,MAAM,IAAI;CAEvD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,qBAAAA,MAAU,MAAX;EACE,GAAI;EACC;EACL,OAAO;EACP,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,EAAE,MAAM,aAAa,CAAC,CAAC,CAAC,MAAM,SAAS;EAClF,uBAAoB;EACpB,kBAAgB;EAChB,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MA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ACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,OAAO,SAAS;EAC7D,aAAU;YAET,YAAY;CACE,CAAA;AAErB,CAAC;AAID,MAAa,eAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACF,qBAAAA,MAAU,QAAX;EACE,GAAI;EACC;EACL,WAAWC,gBAAAA,oBAAoBC,cAAAA,MAAY,CAAC,CAAC,QAAQ,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,MAAa,cAAuCF,qBAAAA,MAAU;AAgB9D,MAAa,QAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBA,qBAAAA,MAAU;AAC7B"}
@@ -11,7 +11,7 @@ type ToastProviderProps = ComponentPropsWithoutRef<typeof Toast.Provider>;
11
11
  declare function ToastProvider(props: ToastProviderProps): import("react").JSX.Element;
12
12
  type ToastViewportProps = ComponentPropsWithoutRef<typeof Toast.Viewport>;
13
13
  /**
14
- * A bottom-centred notification region matching the legacy Jaci toast.
14
+ * A bottom-centred notification region.
15
15
  */
16
16
  declare const ToastViewport: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ToastViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
17
17
  interface ToastRootProps extends ComponentPropsWithoutRef<typeof Toast.Root> {
@@ -11,7 +11,7 @@ type ToastProviderProps = ComponentPropsWithoutRef<typeof Toast.Provider>;
11
11
  declare function ToastProvider(props: ToastProviderProps): import("react").JSX.Element;
12
12
  type ToastViewportProps = ComponentPropsWithoutRef<typeof Toast.Viewport>;
13
13
  /**
14
- * A bottom-centred notification region matching the legacy Jaci toast.
14
+ * A bottom-centred notification region.
15
15
  */
16
16
  declare const ToastViewport: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ToastViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
17
17
  interface ToastRootProps extends ComponentPropsWithoutRef<typeof Toast.Root> {
@@ -25,7 +25,7 @@ function ToastProvider(props) {
25
25
  return /* @__PURE__ */ jsx(Toast.Provider, { ...props });
26
26
  }
27
27
  /**
28
- * A bottom-centred notification region matching the legacy Jaci toast.
28
+ * A bottom-centred notification region.
29
29
  */
30
30
  const ToastViewport = forwardRef(function ToastViewport({ className, ...props }, ref) {
31
31
  return /* @__PURE__ */ jsx(Toast.Viewport, {
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","names":["BaseToast","toastRecipe","Toast"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region matching the legacy Jaci toast.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport const ToastPortal: typeof BaseToast.Portal = BaseToast.Portal;\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};\n"],"mappings":";;;;;;;;AAYA,MAAM,kBAA6C;CACjD,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACX;AAEA,SAAS,YAAY,MAA0B,MAAwC;CACrF,OAAO,SAAS,SAAS,KAAA,IAAY,YAAa,gBAAgB,SAAS;AAC7E;;;;;;AASA,SAAgB,cAAc,OAA2B;CACvD,OAAO,oBAACA,MAAU,UAAX,EAAoB,GAAI,MAAQ,CAAA;AACzC;;;;AAOA,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACA,MAAU,UAAX;EACE,GAAI;EACC;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,UAAU,SAAS;EAChE,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CAAC;;;;;;AAeD,MAAa,YAAY,WAA2C,SAAS,UAC3E,EAAE,WAAW,OAAO,aAAa,MAAM,GAAG,SAC1C,KACA;CACA,MAAM,eAAe,YAAY,YAAY,MAAM,IAAI;CAEvD,OACE,oBAACD,MAAU,MAAX;EACE,GAAI;EACC;EACL,OAAO;EACP,WAAW,oBAAoBC,MAAY,EAAE,MAAM,aAAa,CAAC,CAAC,CAAC,MAAM,SAAS;EAClF,uBAAoB;EACpB,kBAAgB;EAChB,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,eAAe,WAA8C,SAAS,aACjF,EAAE,WAAW,GA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AAa,cAAuCD,MAAU;AAgB9D,MAAaE,UAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBF,MAAU;AAC7B"}
1
+ {"version":3,"file":"toast.js","names":["BaseToast","toastRecipe","Toast"],"sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { toast as toastRecipe } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nconst toneByToastType: Record<string, ToastTone> = {\n danger: \"danger\",\n error: \"danger\",\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n};\n\nfunction resolveTone(type: string | undefined, tone: ToastTone | undefined): ToastTone {\n return tone ?? (type === undefined ? \"neutral\" : (toneByToastType[type] ?? \"neutral\"));\n}\n\nexport type ToastProviderProps = ComponentPropsWithoutRef<typeof BaseToast.Provider>;\n\n/**\n * Creates an isolated, declarative toast region. Configure `timeout` and\n * `limit` here; use `Toast.Root` to render each toast from local state or\n * `Toast.useToastManager()`.\n */\nexport function ToastProvider(props: ToastProviderProps) {\n return <BaseToast.Provider {...props} />;\n}\n\nexport type ToastViewportProps = ComponentPropsWithoutRef<typeof BaseToast.Viewport>;\n\n/**\n * A bottom-centred notification region.\n */\nexport const ToastViewport = forwardRef<HTMLDivElement, ToastViewportProps>(function ToastViewport(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().viewport, className)}\n data-jaci-component=\"toast-viewport\"\n data-slot=\"toast-viewport\"\n />\n );\n});\n\nexport interface ToastRootProps extends ComponentPropsWithoutRef<typeof BaseToast.Root> {\n /**\n * Visual status. When omitted, the value is inferred from the toast's\n * `type` (`error` maps to `danger`) and otherwise remains neutral.\n */\n tone?: ToastTone;\n}\n\n/**\n * Renders a toast object while preserving Base UI's lifecycle, focus, swipe,\n * and auto-dismiss behavior. It is intentionally composed rather than a\n * global imperative notification API.\n */\nexport const ToastRoot = forwardRef<HTMLDivElement, ToastRootProps>(function ToastRoot(\n { className, toast: toastObject, tone, ...props },\n ref,\n) {\n const resolvedTone = resolveTone(toastObject.type, tone);\n\n return (\n <BaseToast.Root\n {...props}\n ref={ref}\n toast={toastObject}\n className={withRecipeClassName(toastRecipe({ tone: resolvedTone }).root, className)}\n data-jaci-component=\"toast\"\n data-jaci-tone={resolvedTone}\n data-slot=\"toast\"\n />\n );\n});\n\nexport type ToastContentProps = ComponentPropsWithoutRef<typeof BaseToast.Content>;\n\nexport const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(function ToastContent(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().content, className)}\n data-slot=\"toast-content\"\n />\n );\n});\n\n/** A layout wrapper for `Toast.Title` and `Toast.Description`. */\nexport type ToastTextProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const ToastText = forwardRef<HTMLDivElement, ToastTextProps>(function ToastText(\n { className, ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(toastRecipe().text, className)}\n data-slot=\"toast-text\"\n />\n );\n});\n\nexport type ToastTitleProps = ComponentPropsWithoutRef<typeof BaseToast.Title>;\n\nexport const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(function ToastTitle(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().title, className)}\n data-slot=\"toast-title\"\n />\n );\n});\n\nexport type ToastDescriptionProps = ComponentPropsWithoutRef<typeof BaseToast.Description>;\n\nexport const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(\n function ToastDescription({ className, ...props }, ref) {\n return (\n <BaseToast.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().description, className)}\n data-slot=\"toast-description\"\n />\n );\n },\n);\n\nexport type ToastCloseProps = ComponentPropsWithoutRef<typeof BaseToast.Close>;\n\nexport const ToastClose = forwardRef<HTMLButtonElement, ToastCloseProps>(function ToastClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const hasVisibleLabel = children != null;\n\n return (\n <BaseToast.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Dismiss notification\")}\n ref={ref}\n className={withRecipeClassName(toastRecipe().close, className)}\n data-slot=\"toast-close\"\n >\n {children ?? \"×\"}\n </BaseToast.Close>\n );\n});\n\nexport type ToastActionProps = ComponentPropsWithoutRef<typeof BaseToast.Action>;\n\nexport const ToastAction = forwardRef<HTMLButtonElement, ToastActionProps>(function ToastAction(\n { className, ...props },\n ref,\n) {\n return (\n <BaseToast.Action\n {...props}\n ref={ref}\n className={withRecipeClassName(toastRecipe().action, className)}\n data-slot=\"toast-action\"\n />\n );\n});\n\n/** Base UI's portal is preserved for rendering the viewport at document level. */\nexport const ToastPortal: typeof BaseToast.Portal = BaseToast.Portal;\n\nexport interface ToastComponent {\n Provider: typeof ToastProvider;\n Viewport: typeof ToastViewport;\n Root: typeof ToastRoot;\n Content: typeof ToastContent;\n Text: typeof ToastText;\n Title: typeof ToastTitle;\n Description: typeof ToastDescription;\n Close: typeof ToastClose;\n Action: typeof ToastAction;\n Portal: typeof ToastPortal;\n useToastManager: typeof BaseToast.useToastManager;\n}\n\nexport const Toast: ToastComponent = {\n Provider: ToastProvider,\n Viewport: ToastViewport,\n Root: ToastRoot,\n Content: ToastContent,\n Text: ToastText,\n Title: ToastTitle,\n Description: ToastDescription,\n Close: ToastClose,\n Action: ToastAction,\n Portal: ToastPortal,\n useToastManager: BaseToast.useToastManager,\n};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AAa,aAAa,WAAgD,SAAS,WACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACD,MAAU,OAAX;EACE,GAAI;EACC;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,OAAO,SAAS;EAC7D,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,mBAAmB,WAC9B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAS,KAAK;CACtD,OACE,oBAACD,MAAU,aAAX;EACE,GAAI;EACC;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,aAAa,SAAS;EACnE,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,aAAa,WAA+C,SAAS,WAChF,EAAE,cAAc,WAAW,UAAU,WAAW,GAAG,SACnD,KACA;CACA,MAAM,kBAAkB,YAAY;CAEpC,OACE,oBAACD,MAAU,OAAX;EACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,OAAO,SAAS;EAC7D,aAAU;YAET,YAAY;CACE,CAAA;AAErB,CAAC;AAID,MAAa,cAAc,WAAgD,SAAS,YAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,oBAACD,MAAU,QAAX;EACE,GAAI;EACC;EACL,WAAW,oBAAoBC,MAAY,CAAC,CAAC,QAAQ,SAAS;EAC9D,aAAU;CACX,CAAA;AAEL,CAAC;;AAGD,MAAa,cAAuCD,MAAU;AAgB9D,MAAaE,UAAwB;CACnC,UAAU;CACV,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,iBAAiBF,MAAU;AAC7B"}
package/dist/index.cjs CHANGED
@@ -209,14 +209,17 @@ exports.DatePickerControl = require_date_picker.DatePickerControl;
209
209
  exports.DatePickerDay = require_date_picker.DatePickerDay;
210
210
  exports.DatePickerHeader = require_date_picker.DatePickerHeader;
211
211
  exports.DatePickerLabel = require_date_picker.DatePickerLabel;
212
+ exports.DatePickerMonthSelect = require_date_picker.DatePickerMonthSelect;
212
213
  exports.DatePickerNext = require_date_picker.DatePickerNext;
213
214
  exports.DatePickerPopup = require_date_picker.DatePickerPopup;
214
215
  exports.DatePickerPortal = require_date_picker.DatePickerPortal;
215
216
  exports.DatePickerPositioner = require_date_picker.DatePickerPositioner;
216
217
  exports.DatePickerPrevious = require_date_picker.DatePickerPrevious;
217
218
  exports.DatePickerRoot = require_date_picker.DatePickerRoot;
219
+ exports.DatePickerTimeField = require_date_picker.DatePickerTimeField;
218
220
  exports.DatePickerTrigger = require_date_picker.DatePickerTrigger;
219
221
  exports.DatePickerValue = require_date_picker.DatePickerValue;
222
+ exports.DatePickerYearSelect = require_date_picker.DatePickerYearSelect;
220
223
  exports.Dialog = require_dialog.Dialog;
221
224
  exports.DialogBackdrop = require_dialog.DialogBackdrop;
222
225
  exports.DialogBody = require_dialog.DialogBody;