@raystack/apsara 0.28.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/dist/container/container.cjs +3 -0
  2. package/dist/container/container.cjs.map +1 -1
  3. package/dist/container/container.d.ts +3 -0
  4. package/dist/container/container.d.ts.map +1 -1
  5. package/dist/container/container.js +3 -0
  6. package/dist/container/container.js.map +1 -1
  7. package/dist/image/image.cjs +6 -0
  8. package/dist/image/image.cjs.map +1 -1
  9. package/dist/image/image.d.ts +6 -0
  10. package/dist/image/image.d.ts.map +1 -1
  11. package/dist/image/image.js +6 -0
  12. package/dist/image/image.js.map +1 -1
  13. package/dist/link/link.cjs +3 -0
  14. package/dist/link/link.cjs.map +1 -1
  15. package/dist/link/link.d.ts +3 -0
  16. package/dist/link/link.d.ts.map +1 -1
  17. package/dist/link/link.js +3 -0
  18. package/dist/link/link.js.map +1 -1
  19. package/dist/separator/separator.cjs +3 -0
  20. package/dist/separator/separator.cjs.map +1 -1
  21. package/dist/separator/separator.d.ts +3 -0
  22. package/dist/separator/separator.d.ts.map +1 -1
  23. package/dist/separator/separator.js +3 -0
  24. package/dist/separator/separator.js.map +1 -1
  25. package/dist/style.css +1 -1
  26. package/dist/table/DataTableFilterChips.cjs.map +1 -1
  27. package/dist/table/DataTableFilterChips.js.map +1 -1
  28. package/dist/toggle-group/togglegroup.cjs +0 -9
  29. package/dist/toggle-group/togglegroup.cjs.map +1 -1
  30. package/dist/toggle-group/togglegroup.d.ts +0 -15
  31. package/dist/toggle-group/togglegroup.d.ts.map +1 -1
  32. package/dist/toggle-group/togglegroup.js +0 -9
  33. package/dist/toggle-group/togglegroup.js.map +1 -1
  34. package/dist/v1/components/box/box.cjs +3 -3
  35. package/dist/v1/components/box/box.cjs.map +1 -1
  36. package/dist/v1/components/box/box.d.ts +7 -2
  37. package/dist/v1/components/box/box.d.ts.map +1 -1
  38. package/dist/v1/components/box/box.js +3 -3
  39. package/dist/v1/components/box/box.js.map +1 -1
  40. package/dist/v1/components/calendar/calendar.cjs +6 -6
  41. package/dist/v1/components/calendar/calendar.cjs.map +1 -1
  42. package/dist/v1/components/calendar/calendar.d.ts.map +1 -1
  43. package/dist/v1/components/calendar/calendar.js +6 -6
  44. package/dist/v1/components/calendar/calendar.js.map +1 -1
  45. package/dist/v1/components/calendar/calendar.module.css.cjs +1 -1
  46. package/dist/v1/components/calendar/calendar.module.css.js +1 -1
  47. package/dist/v1/components/calendar/date-picker.cjs +6 -6
  48. package/dist/v1/components/calendar/date-picker.cjs.map +1 -1
  49. package/dist/v1/components/calendar/date-picker.d.ts +3 -2
  50. package/dist/v1/components/calendar/date-picker.d.ts.map +1 -1
  51. package/dist/v1/components/calendar/date-picker.js +6 -6
  52. package/dist/v1/components/calendar/date-picker.js.map +1 -1
  53. package/dist/v1/components/calendar/range-picker.cjs +6 -6
  54. package/dist/v1/components/calendar/range-picker.cjs.map +1 -1
  55. package/dist/v1/components/calendar/range-picker.d.ts +3 -2
  56. package/dist/v1/components/calendar/range-picker.d.ts.map +1 -1
  57. package/dist/v1/components/calendar/range-picker.js +6 -6
  58. package/dist/v1/components/calendar/range-picker.js.map +1 -1
  59. package/dist/v1/components/callout/callout.cjs +7 -4
  60. package/dist/v1/components/callout/callout.cjs.map +1 -1
  61. package/dist/v1/components/callout/callout.d.ts +3 -1
  62. package/dist/v1/components/callout/callout.d.ts.map +1 -1
  63. package/dist/v1/components/callout/callout.js +7 -4
  64. package/dist/v1/components/callout/callout.js.map +1 -1
  65. package/dist/v1/components/container/container.cjs +31 -0
  66. package/dist/v1/components/container/container.cjs.map +1 -0
  67. package/dist/v1/components/container/container.d.ts +13 -0
  68. package/dist/v1/components/container/container.d.ts.map +1 -0
  69. package/dist/v1/components/container/container.js +29 -0
  70. package/dist/v1/components/container/container.js.map +1 -0
  71. package/dist/v1/components/container/container.module.css.cjs +8 -0
  72. package/dist/v1/components/container/container.module.css.cjs.map +1 -0
  73. package/dist/v1/components/container/container.module.css.js +4 -0
  74. package/dist/v1/components/container/container.module.css.js.map +1 -0
  75. package/dist/v1/components/container/index.d.ts +2 -0
  76. package/dist/v1/components/container/index.d.ts.map +1 -0
  77. package/dist/v1/components/filter-chip/filter-chip.cjs +53 -0
  78. package/dist/v1/components/filter-chip/filter-chip.cjs.map +1 -0
  79. package/dist/v1/components/filter-chip/filter-chip.d.ts +24 -0
  80. package/dist/v1/components/filter-chip/filter-chip.d.ts.map +1 -0
  81. package/dist/v1/components/filter-chip/filter-chip.js +51 -0
  82. package/dist/v1/components/filter-chip/filter-chip.js.map +1 -0
  83. package/dist/v1/components/filter-chip/filter-chip.module.css.cjs +8 -0
  84. package/dist/v1/components/filter-chip/filter-chip.module.css.cjs.map +1 -0
  85. package/dist/v1/components/filter-chip/filter-chip.module.css.js +4 -0
  86. package/dist/v1/components/filter-chip/filter-chip.module.css.js.map +1 -0
  87. package/dist/v1/components/filter-chip/index.d.ts +2 -0
  88. package/dist/v1/components/filter-chip/index.d.ts.map +1 -0
  89. package/dist/v1/components/image/image.cjs +43 -0
  90. package/dist/v1/components/image/image.cjs.map +1 -0
  91. package/dist/v1/components/image/image.d.ts +17 -0
  92. package/dist/v1/components/image/image.d.ts.map +1 -0
  93. package/dist/v1/components/image/image.js +41 -0
  94. package/dist/v1/components/image/image.js.map +1 -0
  95. package/dist/v1/components/image/image.module.css.cjs +8 -0
  96. package/dist/v1/components/image/image.module.css.cjs.map +1 -0
  97. package/dist/v1/components/image/image.module.css.js +4 -0
  98. package/dist/v1/components/image/image.module.css.js.map +1 -0
  99. package/dist/v1/components/image/index.d.ts +2 -0
  100. package/dist/v1/components/image/index.d.ts.map +1 -0
  101. package/dist/v1/components/input-field/input-field.cjs.map +1 -1
  102. package/dist/v1/components/input-field/input-field.d.ts.map +1 -1
  103. package/dist/v1/components/input-field/input-field.js.map +1 -1
  104. package/dist/v1/components/link/index.d.ts +2 -0
  105. package/dist/v1/components/link/index.d.ts.map +1 -0
  106. package/dist/v1/components/link/link.cjs +74 -0
  107. package/dist/v1/components/link/link.cjs.map +1 -0
  108. package/dist/v1/components/link/link.d.ts +18 -0
  109. package/dist/v1/components/link/link.d.ts.map +1 -0
  110. package/dist/v1/components/link/link.js +72 -0
  111. package/dist/v1/components/link/link.js.map +1 -0
  112. package/dist/v1/components/link/link.module.css.cjs +8 -0
  113. package/dist/v1/components/link/link.module.css.cjs.map +1 -0
  114. package/dist/v1/components/link/link.module.css.js +4 -0
  115. package/dist/v1/components/link/link.module.css.js.map +1 -0
  116. package/dist/v1/components/list/index.d.ts +2 -0
  117. package/dist/v1/components/list/index.d.ts.map +1 -0
  118. package/dist/v1/components/list/list.cjs +42 -0
  119. package/dist/v1/components/list/list.cjs.map +1 -0
  120. package/dist/v1/components/list/list.d.ts +44 -0
  121. package/dist/v1/components/list/list.d.ts.map +1 -0
  122. package/dist/v1/components/list/list.js +40 -0
  123. package/dist/v1/components/list/list.js.map +1 -0
  124. package/dist/v1/components/list/list.module.css.cjs +8 -0
  125. package/dist/v1/components/list/list.module.css.cjs.map +1 -0
  126. package/dist/v1/components/list/list.module.css.js +4 -0
  127. package/dist/v1/components/list/list.module.css.js.map +1 -0
  128. package/dist/v1/components/popover/popover.cjs +1 -1
  129. package/dist/v1/components/popover/popover.cjs.map +1 -1
  130. package/dist/v1/components/popover/popover.d.ts.map +1 -1
  131. package/dist/v1/components/popover/popover.js +1 -1
  132. package/dist/v1/components/popover/popover.js.map +1 -1
  133. package/dist/v1/components/search/search.cjs.map +1 -1
  134. package/dist/v1/components/search/search.d.ts.map +1 -1
  135. package/dist/v1/components/search/search.js.map +1 -1
  136. package/dist/v1/components/select/select.cjs +6 -1
  137. package/dist/v1/components/select/select.cjs.map +1 -1
  138. package/dist/v1/components/select/select.d.ts +1 -0
  139. package/dist/v1/components/select/select.d.ts.map +1 -1
  140. package/dist/v1/components/select/select.js +6 -1
  141. package/dist/v1/components/select/select.js.map +1 -1
  142. package/dist/v1/components/select/select.module.css.cjs +1 -1
  143. package/dist/v1/components/select/select.module.css.js +1 -1
  144. package/dist/v1/components/separator/index.d.ts +2 -0
  145. package/dist/v1/components/separator/index.d.ts.map +1 -0
  146. package/dist/v1/components/separator/separator.cjs +32 -0
  147. package/dist/v1/components/separator/separator.cjs.map +1 -0
  148. package/dist/v1/components/separator/separator.d.ts +13 -0
  149. package/dist/v1/components/separator/separator.d.ts.map +1 -0
  150. package/dist/v1/components/separator/separator.js +30 -0
  151. package/dist/v1/components/separator/separator.js.map +1 -0
  152. package/dist/v1/components/separator/separator.module.css.cjs +8 -0
  153. package/dist/v1/components/separator/separator.module.css.cjs.map +1 -0
  154. package/dist/v1/components/separator/separator.module.css.js +4 -0
  155. package/dist/v1/components/separator/separator.module.css.js.map +1 -0
  156. package/dist/v1/components/sidepanel/sidepanel.cjs.map +1 -1
  157. package/dist/v1/components/sidepanel/sidepanel.d.ts +1 -1
  158. package/dist/v1/components/sidepanel/sidepanel.d.ts.map +1 -1
  159. package/dist/v1/components/sidepanel/sidepanel.js.map +1 -1
  160. package/dist/v1/components/slider/slider.cjs +2 -2
  161. package/dist/v1/components/slider/slider.cjs.map +1 -1
  162. package/dist/v1/components/slider/slider.d.ts +2 -2
  163. package/dist/v1/components/slider/slider.d.ts.map +1 -1
  164. package/dist/v1/components/slider/slider.js +2 -2
  165. package/dist/v1/components/slider/slider.js.map +1 -1
  166. package/dist/v1/components/text/text.cjs.map +1 -1
  167. package/dist/v1/components/text/text.d.ts.map +1 -1
  168. package/dist/v1/components/text/text.js +33 -33
  169. package/dist/v1/components/text/text.js.map +1 -1
  170. package/dist/v1/components/text/text.module.css.cjs +2 -2
  171. package/dist/v1/components/text/text.module.css.js +2 -2
  172. package/dist/v1/components/text-area/text-area.cjs +1 -1
  173. package/dist/v1/components/text-area/text-area.cjs.map +1 -1
  174. package/dist/v1/components/text-area/text-area.d.ts +1 -1
  175. package/dist/v1/components/text-area/text-area.d.ts.map +1 -1
  176. package/dist/v1/components/text-area/text-area.js +1 -1
  177. package/dist/v1/components/text-area/text-area.js.map +1 -1
  178. package/dist/v1/components/textfield/textfield.cjs.map +1 -1
  179. package/dist/v1/components/textfield/textfield.d.ts.map +1 -1
  180. package/dist/v1/components/textfield/textfield.js.map +1 -1
  181. package/dist/v1/components/tooltip/tooltip.cjs +1 -1
  182. package/dist/v1/components/tooltip/tooltip.cjs.map +1 -1
  183. package/dist/v1/components/tooltip/tooltip.d.ts +1 -1
  184. package/dist/v1/components/tooltip/tooltip.d.ts.map +1 -1
  185. package/dist/v1/components/tooltip/tooltip.js +1 -1
  186. package/dist/v1/components/tooltip/tooltip.js.map +1 -1
  187. package/dist/v1/index.cjs +21 -8
  188. package/dist/v1/index.cjs.map +1 -1
  189. package/dist/v1/index.d.ts +11 -5
  190. package/dist/v1/index.d.ts.map +1 -1
  191. package/dist/v1/index.js +11 -5
  192. package/dist/v1/index.js.map +1 -1
  193. package/dist/v1/node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs +23 -0
  194. package/dist/v1/node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs.map +1 -1
  195. package/dist/v1/node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js +23 -1
  196. package/dist/v1/node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js.map +1 -1
  197. package/dist/v1/node_modules/.pnpm/@radix-ui_react-separator@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._na4co26slzimf5qojej32hgyjm/node_modules/@radix-ui/react-separator/dist/index.cjs +51 -0
  198. package/dist/v1/node_modules/.pnpm/@radix-ui_react-separator@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._na4co26slzimf5qojej32hgyjm/node_modules/@radix-ui/react-separator/dist/index.cjs.map +1 -0
  199. package/dist/v1/node_modules/.pnpm/@radix-ui_react-separator@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._na4co26slzimf5qojej32hgyjm/node_modules/@radix-ui/react-separator/dist/index.js +48 -0
  200. package/dist/v1/node_modules/.pnpm/@radix-ui_react-separator@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._na4co26slzimf5qojej32hgyjm/node_modules/@radix-ui/react-separator/dist/index.js.map +1 -0
  201. package/dist/v1/style.css +1 -1
  202. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sources":["../../../../v1/components/calendar/date-picker.tsx"],"sourcesContent":["import { Popover } from \"../popover\";\nimport { TextField } from \"../textfield\";\nimport { Calendar } from \"./calendar\";\nimport styles from \"./calendar.module.css\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { CalendarIcon } from \"@radix-ui/react-icons\";\nimport dayjs from \"dayjs\";\nimport { TextfieldProps } from \"../textfield/textfield\";\nimport { PropsBase, PropsSingleRequired } from \"react-day-picker\";\n\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\n\ndayjs.extend(customParseFormat);\n\ninterface DatePickerProps {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n dateFormat?: string;\n textFieldProps?: TextfieldProps;\n calendarProps?: PropsSingleRequired & PropsBase;\n onSelect?: (date: Date) => void;\n placeholder?: string;\n value?: Date;\n children?: React.ReactNode | ((props: { selectedDate: string }) => React.ReactNode);\n}\n\nexport function DatePicker({\n side = \"top\",\n dateFormat = \"DD/MM/YYYY\",\n placeholder = \"DD/MM/YYYY\",\n textFieldProps,\n calendarProps,\n value = new Date(),\n onSelect = () => {},\n children,\n}: DatePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [selectedDate, setSelectedDate] = useState(value);\n const [inputState, setInputState] = useState<Partial<React.ComponentProps<typeof TextField>['state']>>();\n\n const formattedDate = dayjs(selectedDate).format(dateFormat);\n\n const isDropdownOpenRef = useRef(false);\n const textFieldRef = useRef<HTMLInputElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const isInputFieldFocused = useRef(false);\n const selectedDateRef = useRef(selectedDate);\n\n useEffect(() => {\n selectedDateRef.current = selectedDate;\n }, [selectedDate]);\n\n function isElementOutside(el: HTMLElement) {\n return !isDropdownOpenRef.current && // Month and Year dropdown from Date picker\n !textFieldRef.current?.contains(el) && // TextField\n !contentRef.current?.contains(el);\n }\n\n const handleMouseDown = useCallback((event: MouseEvent) => {\n const el = (event.target) as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n }, [])\n\n function registerEventListeners() {\n isInputFieldFocused.current = true;\n document.addEventListener('mouseup', handleMouseDown);\n }\n\n function removeEventListeners() {\n isInputFieldFocused.current = false;\n setShowCalendar(false);\n\n const updatedVal = dayjs(selectedDateRef.current).format(dateFormat);\n\n if (textFieldRef.current) textFieldRef.current.value = updatedVal;\n if (inputState === undefined) onSelect(dayjs(updatedVal).toDate());\n\n document.removeEventListener('mouseup', handleMouseDown);\n }\n\n const handleSelect = (day: Date) => {\n setSelectedDate(day);\n onSelect(day);\n setInputState(undefined);\n removeEventListeners();\n };\n\n function onDropdownOpen() {\n isDropdownOpenRef.current = true;\n }\n\n function onOpenChange(open?: boolean) {\n if (!isDropdownOpenRef.current && !(isInputFieldFocused.current && showCalendar)) {\n setShowCalendar(Boolean(open));\n }\n\n isDropdownOpenRef.current = false;\n }\n\n function handleInputFocus() {\n if (isInputFieldFocused.current) return;\n if (!showCalendar) setShowCalendar(true);\n }\n\n function handleInputBlur(event: React.FocusEvent) {\n if (isInputFieldFocused.current) {\n const el = event.relatedTarget as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n } else {\n registerEventListeners();\n setTimeout(() => textFieldRef.current?.select());\n }\n }\n\n function handleKeyUp(event: React.KeyboardEvent) {\n if (event.code === 'Enter' && textFieldRef.current) {\n textFieldRef.current.blur();\n removeEventListeners();\n }\n }\n\n function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n\n const format = value.includes(\"/\") ? \"DD/MM/YYYY\" : value.includes(\"-\") ? \"DD-MM-YYYY\" : undefined;\n const date = dayjs(value.replace(/(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})/, (_, day, month, year) => {\n\t\t\t\treturn `${day.padStart(2, '0')}/${month.padStart(2, '0')}/${year}`; // Replaces [8/8/2024] to [08/08/2024]\n\t\t}), format);\n\n const isValidDate = date.isValid();\n\n const isAfter = calendarProps?.startMonth !== undefined ? dayjs(date).isSameOrAfter(calendarProps.startMonth) : true;\n const isBefore = calendarProps?.endMonth !== undefined ? dayjs(date).isSameOrBefore(calendarProps.endMonth) : true;\n\n const isValid = isValidDate && isAfter && isBefore && dayjs(date).isSameOrBefore(dayjs());\n\n if (isValid) {\n setSelectedDate(date.toDate());\n if (inputState === 'invalid') setInputState(undefined);\n } else {\n setInputState('invalid');\n }\n }\n\n const defaultTrigger = (\n <TextField\n ref={textFieldRef}\n defaultValue={formattedDate}\n trailing={<CalendarIcon />}\n onChange={handleInputChange}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n state={inputState}\n placeholder={placeholder}\n onKeyUp={handleKeyUp}\n {...textFieldProps}\n />\n );\n\n const trigger = typeof children === 'function'\n ? children({ selectedDate: formattedDate })\n : children || defaultTrigger;\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>\n {trigger}\n </Popover.Trigger>\n\n <Popover.Content side={side} className={styles.calendarPopover} ref={contentRef}>\n <Calendar\n required={true}\n {...calendarProps}\n onDropdownOpen={onDropdownOpen}\n mode=\"single\"\n selected={selectedDate}\n month={selectedDate}\n onSelect={handleSelect}\n onMonthChange={setSelectedDate}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAYA,KAAK,CAAC,MAAM,CAAC,iBAAiB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AAE,WAAW,EACxB,OAAO,EAAE,WAAW,EAChB,GAAA,cAAc,EAClB,CAAA,CACH,CAAC;AAEF,IAAA,MAAM,OAAO,GAAG,OAAO,QAAQ,KAAK,UAAU;UAC1C,QAAQ,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AAC3C,UAAE,QAAQ,IAAI,cAAc,CAAC;AAE/B,IAAA,QACEC,sBAAC,CAAA,OAAO,EAAC,EAAA,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EACrD,QAAA,EAAA,CAAAD,qBAAA,CAAC,OAAO,CAAC,OAAO,EAAC,EAAA,OAAO,EACrB,IAAA,EAAA,QAAA,EAAA,OAAO,GACQ,EAElBA,qBAAA,CAAC,OAAO,CAAC,OAAO,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,eAAe,EAAE,GAAG,EAAE,UAAU,YAC7EA,qBAAC,CAAA,QAAQ,EACP,EAAA,QAAQ,EAAE,IAAI,EAAA,GACV,aAAa,EACjB,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,YAAY,EACtB,aAAa,EAAE,eAAe,GAC9B,EACc,CAAA,CAAA,EAAA,CACV,EACV;AACJ;;;;"}
1
+ {"version":3,"file":"date-picker.js","sources":["../../../../v1/components/calendar/date-picker.tsx"],"sourcesContent":["import { CalendarIcon } from \"@radix-ui/react-icons\";\nimport dayjs from \"dayjs\";\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { PropsBase, PropsSingleRequired } from \"react-day-picker\";\n\nimport { Popover } from \"../popover\";\nimport { TextField } from \"../textfield\";\nimport { TextfieldProps } from \"../textfield/textfield\";\nimport { Calendar } from \"./calendar\";\nimport styles from \"./calendar.module.css\";\n\ndayjs.extend(customParseFormat);\n\ninterface DatePickerProps {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n dateFormat?: string;\n textFieldProps?: TextfieldProps;\n calendarProps?: PropsSingleRequired & PropsBase;\n onSelect?: (date: Date) => void;\n placeholder?: string;\n value?: Date;\n children?: React.ReactNode | ((props: { selectedDate: string }) => React.ReactNode);\n showCalendarIcon?: boolean;\n}\n\nexport function DatePicker({\n side = \"top\",\n dateFormat = \"DD/MM/YYYY\",\n placeholder = \"DD/MM/YYYY\",\n textFieldProps,\n calendarProps,\n value = new Date(),\n onSelect = () => {},\n children,\n showCalendarIcon = true,\n}: DatePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [selectedDate, setSelectedDate] = useState(value);\n const [inputState, setInputState] = useState<Partial<React.ComponentProps<typeof TextField>['state']>>();\n\n const formattedDate = dayjs(selectedDate).format(dateFormat);\n\n const isDropdownOpenRef = useRef(false);\n const textFieldRef = useRef<HTMLInputElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const isInputFieldFocused = useRef(false);\n const selectedDateRef = useRef(selectedDate);\n\n useEffect(() => {\n selectedDateRef.current = selectedDate;\n }, [selectedDate]);\n\n function isElementOutside(el: HTMLElement) {\n return !isDropdownOpenRef.current && // Month and Year dropdown from Date picker\n !textFieldRef.current?.contains(el) && // TextField\n !contentRef.current?.contains(el);\n }\n\n const handleMouseDown = useCallback((event: MouseEvent) => {\n const el = (event.target) as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n }, [])\n\n function registerEventListeners() {\n isInputFieldFocused.current = true;\n document.addEventListener('mouseup', handleMouseDown);\n }\n\n function removeEventListeners() {\n isInputFieldFocused.current = false;\n setShowCalendar(false);\n\n const updatedVal = dayjs(selectedDateRef.current).format(dateFormat);\n\n if (textFieldRef.current) textFieldRef.current.value = updatedVal;\n if (inputState === undefined) onSelect(dayjs(updatedVal).toDate());\n\n document.removeEventListener('mouseup', handleMouseDown);\n }\n\n const handleSelect = (day: Date) => {\n setSelectedDate(day);\n onSelect(day);\n setInputState(undefined);\n removeEventListeners();\n };\n\n function onDropdownOpen() {\n isDropdownOpenRef.current = true;\n }\n\n function onOpenChange(open?: boolean) {\n if (!isDropdownOpenRef.current && !(isInputFieldFocused.current && showCalendar)) {\n setShowCalendar(Boolean(open));\n }\n\n isDropdownOpenRef.current = false;\n }\n\n function handleInputFocus() {\n if (isInputFieldFocused.current) return;\n if (!showCalendar) setShowCalendar(true);\n }\n\n function handleInputBlur(event: React.FocusEvent) {\n if (isInputFieldFocused.current) {\n const el = event.relatedTarget as HTMLElement | null;\n if (el && isElementOutside(el)) removeEventListeners();\n } else {\n registerEventListeners();\n setTimeout(() => textFieldRef.current?.select());\n }\n }\n\n function handleKeyUp(event: React.KeyboardEvent) {\n if (event.code === 'Enter' && textFieldRef.current) {\n textFieldRef.current.blur();\n removeEventListeners();\n }\n }\n\n function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n\n const format = value.includes(\"/\") ? \"DD/MM/YYYY\" : value.includes(\"-\") ? \"DD-MM-YYYY\" : undefined;\n const date = dayjs(value.replace(/(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})/, (_, day, month, year) => {\n\t\t\t\treturn `${day.padStart(2, '0')}/${month.padStart(2, '0')}/${year}`; // Replaces [8/8/2024] to [08/08/2024]\n\t\t}), format);\n\n const isValidDate = date.isValid();\n\n const isAfter = calendarProps?.startMonth !== undefined ? dayjs(date).isSameOrAfter(calendarProps.startMonth) : true;\n const isBefore = calendarProps?.endMonth !== undefined ? dayjs(date).isSameOrBefore(calendarProps.endMonth) : true;\n\n const isValid = isValidDate && isAfter && isBefore && dayjs(date).isSameOrBefore(dayjs());\n\n if (isValid) {\n setSelectedDate(date.toDate());\n if (inputState === 'invalid') setInputState(undefined);\n } else {\n setInputState('invalid');\n }\n }\n\n const defaultTrigger = (\n <TextField\n ref={textFieldRef}\n defaultValue={formattedDate}\n trailing={showCalendarIcon ? <CalendarIcon /> : undefined}\n onChange={handleInputChange}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n state={inputState}\n placeholder={placeholder}\n onKeyUp={handleKeyUp}\n className={styles.datePickerInput}\n {...textFieldProps}\n />\n );\n\n const trigger = typeof children === 'function'\n ? children({ selectedDate: formattedDate })\n : children || defaultTrigger;\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>\n {trigger}\n </Popover.Trigger>\n\n <Popover.Content side={side} className={styles.calendarPopover} ref={contentRef}>\n <Calendar\n required={true}\n {...calendarProps}\n onDropdownOpen={onDropdownOpen}\n mode=\"single\"\n selected={selectedDate}\n month={selectedDate}\n onSelect={handleSelect}\n onMonthChange={setSelectedDate}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAYA,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;SAchB,UAAU,CAAC,EACzB,IAAI,GAAG,KAAK,EACZ,UAAU,GAAG,YAAY,EACzB,WAAW,GAAG,YAAY,EAC1B,cAAc,EACd,aAAa,EACb,KAAK,GAAG,IAAI,IAAI,EAAE,EAClB,QAAQ,GAAG,MAAK,GAAG,EACnB,QAAQ,EACR,gBAAgB,GAAG,IAAI,GACP,EAAA;IAChB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,EAA4D,CAAC;IAEzG,MAAM,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAE7D,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACxC,IAAA,MAAM,YAAY,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAC;AAC3D,IAAA,MAA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AAQ,EAAE,IAAI,EAAA,GACV,aAAa,EACjB,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,YAAY,EACtB,aAAa,EAAE,eAAe,GAC9B,EACc,CAAA,CAAA,EAAA,CACV,EACV;AACJ;;;;"}
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
4
+ var reactIcons_esm = require('../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
5
+ var dayjs_min = require('../../node_modules/.pnpm/dayjs@1.11.11/node_modules/dayjs/dayjs.min.cjs');
6
+ var React = require('react');
7
+ var flex = require('../flex/flex.cjs');
4
8
  var popover = require('../popover/popover.cjs');
5
9
  var textfield = require('../textfield/textfield.cjs');
6
10
  var calendar = require('./calendar.cjs');
7
11
  var calendar_module = require('./calendar.module.css.cjs');
8
- var React = require('react');
9
- var reactIcons_esm = require('../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
10
- var dayjs_min = require('../../node_modules/.pnpm/dayjs@1.11.11/node_modules/dayjs/dayjs.min.cjs');
11
- var flex = require('../flex/flex.cjs');
12
12
 
13
13
  function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, onSelect = () => { }, value = {
14
14
  to: new Date(),
15
15
  from: new Date(),
16
- }, pickerGroupClassName, children, }) {
16
+ }, pickerGroupClassName, children, showCalendarIcon = true, }) {
17
17
  const [showCalendar, setShowCalendar] = React.useState(false);
18
18
  const [currentRangeField, setCurrentRangeField] = React.useState("from");
19
19
  const [selectedRange, setSelectedRange] = React.useState(value);
@@ -41,7 +41,7 @@ function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps,
41
41
  function onOpenChange(open) {
42
42
  setShowCalendar(Boolean(open));
43
43
  }
44
- const defaultTrigger = (jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { gap: "medium", className: pickerGroupClassName, children: [jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { value: startDate, trailing: jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.CalendarIcon, {}), className: calendar_module.default.datePickerInput, readOnly: true, ...textFieldProps }), jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { value: endDate, trailing: jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.CalendarIcon, {}), className: calendar_module.default.datePickerInput, readOnly: true, ...textFieldProps })] }));
44
+ const defaultTrigger = (jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { gap: "medium", className: pickerGroupClassName, children: [jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { value: startDate, trailing: showCalendarIcon ? jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.CalendarIcon, {}) : undefined, className: calendar_module.default.datePickerInput, readOnly: true, ...textFieldProps }), jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { value: endDate, trailing: showCalendarIcon ? jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.CalendarIcon, {}) : undefined, className: calendar_module.default.datePickerInput, readOnly: true, ...textFieldProps })] }));
45
45
  const trigger = typeof children === 'function'
46
46
  ? children({ startDate, endDate })
47
47
  : children || defaultTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"range-picker.cjs","sources":["../../../../v1/components/calendar/range-picker.tsx"],"sourcesContent":["import { Popover } from \"../popover\";\nimport { TextField } from \"../textfield\";\nimport { Calendar } from \"./calendar\";\nimport styles from \"./calendar.module.css\";\nimport { useState } from \"react\";\nimport { CalendarIcon } from \"@radix-ui/react-icons\";\nimport dayjs from \"dayjs\";\nimport { TextfieldProps } from \"../textfield/textfield\";\nimport { DateRange, PropsBase, PropsRangeRequired } from \"react-day-picker\";\nimport { Flex } from \"../flex\";\n\ninterface RangePickerProps {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n dateFormat?: string;\n textFieldProps?: TextfieldProps;\n calendarProps?: PropsRangeRequired & PropsBase;\n onSelect?: (date: DateRange) => void;\n pickerGroupClassName?: string;\n value?: DateRange;\n children?: React.ReactNode | ((props: { startDate: string; endDate: string }) => React.ReactNode);\n}\n\ntype RangeFields = keyof DateRange;\n\nexport function RangePicker({\n side = \"top\",\n dateFormat = \"DD/MM/YYYY\",\n textFieldProps,\n calendarProps,\n onSelect = () => {},\n value = {\n to: new Date(),\n from: new Date(),\n },\n pickerGroupClassName,\n children,\n}: RangePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [currentRangeField, setCurrentRangeField] = useState<RangeFields>(\"from\");\n const [selectedRange, setSelectedRange] = useState(value);\n\n const startDate = selectedRange.from ? dayjs(selectedRange.from).format(dateFormat) : '';\n const endDate = selectedRange.to ? dayjs(selectedRange.to).format(dateFormat) : '';\n\n // 1st click will select the start date.\n // 2nd click will select the end date.\n // 3rd click will select the start date again.\n const handleSelect = (range: DateRange, selectedDay: Date) => {\n const from = selectedRange?.from || range?.from;\n let newRange: DateRange;\n \n if (currentRangeField === \"to\" && dayjs(selectedDay).isAfter(dayjs(from))) {\n // update the end date\n newRange = { from, to: selectedDay };\n setCurrentRangeField(\"from\");\n } else {\n // reset the range and select start day\n newRange = { from: selectedDay };\n setCurrentRangeField(\"to\");\n }\n \n setSelectedRange(newRange);\n onSelect(newRange);\n };\n\n function onOpenChange(open?: boolean) {\n setShowCalendar(Boolean(open));\n }\n\n const defaultTrigger = (\n <Flex gap={\"medium\"} className={pickerGroupClassName}>\n <TextField\n value={startDate}\n trailing={<CalendarIcon />}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n <TextField\n value={endDate}\n trailing={<CalendarIcon />}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n </Flex>\n );\n\n const trigger = typeof children === 'function' \n ? children({ startDate, endDate }) \n : children || defaultTrigger;\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>\n {trigger}\n </Popover.Trigger>\n <Popover.Content side={side} className={styles.calendarPopover}>\n <Calendar\n showOutsideDays={false}\n numberOfMonths={2}\n defaultMonth={selectedRange.from}\n required={true}\n {...calendarProps}\n mode=\"range\"\n selected={selectedRange}\n onSelect={handleSelect}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["useState","dayjs","_jsxs","Flex","_jsx","TextField","CalendarIcon","styles","Popover","Calendar"],"mappings":";;;;;;;;;;;;AAwBM,SAAU,WAAW,CAAC,EAC1B,IAAI,GAAG,KAAK,EACZ,UAAU,GAAG,YAAY,EACzB,cAAc,EACd,aAAa,EACb,QAAQ,GAAG,MAAO,GAAC,EACnB,KAAK,GAAG;IACN,EAAE,EAAE,IAAI,IAAI,EAAE;IACd,IAAI,EAAE,IAAI,IAAI,EAAE;CACjB,EACD,oBAAoB,EACpB,QAAQ,GACS,EAAA;IACjB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAGA,cAAQ,CAAc,MAAM,CAAC,CAAC;IAChF,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAGC,iBAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;IACzF,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,GAAGA,iBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;;;;AAKnF,IAAA,MAAM,YAAY,GAAG,CAAC,KAAgB,EAAE,WAAiB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AAC;AAEF,IAAA,MAAM,OAAO,GAAG,OAAO,QAAQ,KAAK,UAAU;UAC1C,QAAQ,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClC,UAAE,QAAQ,IAAI,cAAc,CAAC;AAE/B,IAAA,QACEL,iCAAA,CAACM,eAAO,EAAA,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAA,QAAA,EAAA,CACrDJ,gCAAC,CAAAI,eAAO,CAAC,OAAO,EAAA,EAAC,OAAO,EAAA,IAAA,EAAA,QAAA,EACrB,OAAO,EACQ,CAAA,EAClBJ,gCAAC,CAAAI,eAAO,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAED,uBAAM,CAAC,eAAe,EAAA,QAAA,EAC5DH,gCAAC,CAAAK,iBAAQ,IACP,eAAe,EAAE,KAAK,EACtB,cAAc,EAAE,CAAC,EACjB,YAAY,EAAE,aAAa,CAAC,IAAI,EAChC,QAAQ,EAAE,IAAI,EACV,GAAA,aAAa,EACjB,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,YAAY,EAAA,CACtB,EACc,CAAA,CAAA,EAAA,CACV,EACV;AACJ;;;;"}
1
+ {"version":3,"file":"range-picker.cjs","sources":["../../../../v1/components/calendar/range-picker.tsx"],"sourcesContent":["import { CalendarIcon } from \"@radix-ui/react-icons\";\nimport dayjs from \"dayjs\";\nimport { useState } from \"react\";\nimport { DateRange, PropsBase, PropsRangeRequired } from \"react-day-picker\";\n\nimport { Flex } from \"../flex\";\nimport { Popover } from \"../popover\";\nimport { TextField } from \"../textfield\";\nimport { TextfieldProps } from \"../textfield/textfield\";\nimport { Calendar } from \"./calendar\";\nimport styles from \"./calendar.module.css\";\n\ninterface RangePickerProps {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n dateFormat?: string;\n textFieldProps?: TextfieldProps;\n calendarProps?: PropsRangeRequired & PropsBase;\n onSelect?: (date: DateRange) => void;\n pickerGroupClassName?: string;\n value?: DateRange;\n children?: React.ReactNode | ((props: { startDate: string; endDate: string }) => React.ReactNode);\n showCalendarIcon?: boolean;\n}\n\ntype RangeFields = keyof DateRange;\n\nexport function RangePicker({\n side = \"top\",\n dateFormat = \"DD/MM/YYYY\",\n textFieldProps,\n calendarProps,\n onSelect = () => {},\n value = {\n to: new Date(),\n from: new Date(),\n },\n pickerGroupClassName,\n children,\n showCalendarIcon = true,\n}: RangePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [currentRangeField, setCurrentRangeField] = useState<RangeFields>(\"from\");\n const [selectedRange, setSelectedRange] = useState(value);\n\n const startDate = selectedRange.from ? dayjs(selectedRange.from).format(dateFormat) : '';\n const endDate = selectedRange.to ? dayjs(selectedRange.to).format(dateFormat) : '';\n\n // 1st click will select the start date.\n // 2nd click will select the end date.\n // 3rd click will select the start date again.\n const handleSelect = (range: DateRange, selectedDay: Date) => {\n const from = selectedRange?.from || range?.from;\n let newRange: DateRange;\n \n if (currentRangeField === \"to\" && dayjs(selectedDay).isAfter(dayjs(from))) {\n // update the end date\n newRange = { from, to: selectedDay };\n setCurrentRangeField(\"from\");\n } else {\n // reset the range and select start day\n newRange = { from: selectedDay };\n setCurrentRangeField(\"to\");\n }\n \n setSelectedRange(newRange);\n onSelect(newRange);\n };\n\n function onOpenChange(open?: boolean) {\n setShowCalendar(Boolean(open));\n }\n\n const defaultTrigger = (\n <Flex gap={\"medium\"} className={pickerGroupClassName}>\n <TextField\n value={startDate}\n trailing={showCalendarIcon ? <CalendarIcon /> : undefined}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n <TextField\n value={endDate}\n trailing={showCalendarIcon ? <CalendarIcon /> : undefined}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n </Flex>\n );\n\n const trigger = typeof children === 'function' \n ? children({ startDate, endDate }) \n : children || defaultTrigger;\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>\n {trigger}\n </Popover.Trigger>\n <Popover.Content side={side} className={styles.calendarPopover}>\n <Calendar\n showOutsideDays={false}\n numberOfMonths={2}\n defaultMonth={selectedRange.from}\n required={true}\n {...calendarProps}\n mode=\"range\"\n selected={selectedRange}\n onSelect={handleSelect}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["useState","dayjs","_jsxs","Flex","_jsx","TextField","CalendarIcon","styles","Popover","Calendar"],"mappings":";;;;;;;;;;;;AA0BM,SAAU,WAAW,CAAC,EAC1B,IAAI,GAAG,KAAK,EACZ,UAAU,GAAG,YAAY,EACzB,cAAc,EACd,aAAa,EACb,QAAQ,GAAG,MAAO,GAAC,EACnB,KAAK,GAAG;IACN,EAAE,EAAE,IAAI,IAAI,EAAE;IACd,IAAI,EAAE,IAAI,IAAI,EAAE;AACjB,CAAA,EACD,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,GAAG,IAAI,GACN,EAAA;IACjB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAGA,cAAQ,CAAc,MAAM,CAAC,CAAC;IAChF,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAGC,iBAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;IACzF,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,GAAGA,iBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;;;;AAKnF,IAAA,MAAM,YAAY,GAAG,CAAC,KAAgB,EAAE,WAAiB,KAAI;QAC3D,MAAM,IAAI,GAAG,aAAa,EAAE,IAAI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F,IAAA,MAAM,OAAO,GAAG,OAAO,QAAQ,KAAK,UAAU;UAC1C,QAAQ,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClC,UAAE,QAAQ,IAAI,cAAc,CAAC;AAE/B,IAAA,QACEL,iCAAA,CAACM,eAAO,EAAA,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAA,QAAA,EAAA,CACrDJ,gCAAC,CAAAI,eAAO,CAAC,OAAO,EAAA,EAAC,OAAO,EAAA,IAAA,EAAA,QAAA,EACrB,OAAO,EACQ,CAAA,EAClBJ,gCAAC,CAAAI,eAAO,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAED,uBAAM,CAAC,eAAe,EAAA,QAAA,EAC5DH,gCAAC,CAAAK,iBAAQ,IACP,eAAe,EAAE,KAAK,EACtB,cAAc,EAAE,CAAC,EACjB,YAAY,EAAE,aAAa,CAAC,IAAI,EAChC,QAAQ,EAAE,IAAI,EACV,GAAA,aAAa,EACjB,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,YAAY,EAAA,CACtB,EACc,CAAA,CAAA,EAAA,CACV,EACV;AACJ;;;;"}
@@ -1,5 +1,5 @@
1
- import { TextfieldProps } from "../textfield/textfield";
2
1
  import { DateRange, PropsBase, PropsRangeRequired } from "react-day-picker";
2
+ import { TextfieldProps } from "../textfield/textfield";
3
3
  interface RangePickerProps {
4
4
  side?: "top" | "right" | "bottom" | "left";
5
5
  dateFormat?: string;
@@ -12,7 +12,8 @@ interface RangePickerProps {
12
12
  startDate: string;
13
13
  endDate: string;
14
14
  }) => React.ReactNode);
15
+ showCalendarIcon?: boolean;
15
16
  }
16
- export declare function RangePicker({ side, dateFormat, textFieldProps, calendarProps, onSelect, value, pickerGroupClassName, children, }: RangePickerProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function RangePicker({ side, dateFormat, textFieldProps, calendarProps, onSelect, value, pickerGroupClassName, children, showCalendarIcon, }: RangePickerProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
18
19
  //# sourceMappingURL=range-picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"range-picker.d.ts","sourceRoot":"","sources":["../../../../v1/components/calendar/range-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CACnG;AAID,wBAAgB,WAAW,CAAC,EAC1B,IAAY,EACZ,UAAyB,EACzB,cAAc,EACd,aAAa,EACb,QAAmB,EACnB,KAGC,EACD,oBAAoB,EACpB,QAAQ,GACT,EAAE,gBAAgB,2CA2ElB"}
1
+ {"version":3,"file":"range-picker.d.ts","sourceRoot":"","sources":["../../../../v1/components/calendar/range-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK5E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAIxD,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAClG,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAID,wBAAgB,WAAW,CAAC,EAC1B,IAAY,EACZ,UAAyB,EACzB,cAAc,EACd,aAAa,EACb,QAAmB,EACnB,KAGC,EACD,oBAAoB,EACpB,QAAQ,EACR,gBAAuB,GACxB,EAAE,gBAAgB,2CA2ElB"}
@@ -1,17 +1,17 @@
1
1
  import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
2
+ import { CalendarIcon } from '../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
3
+ import dayjs from '../../node_modules/.pnpm/dayjs@1.11.11/node_modules/dayjs/dayjs.min.js';
4
+ import { useState } from 'react';
5
+ import { Flex } from '../flex/flex.js';
2
6
  import { Popover } from '../popover/popover.js';
3
7
  import { TextField } from '../textfield/textfield.js';
4
8
  import { Calendar } from './calendar.js';
5
9
  import styles from './calendar.module.css.js';
6
- import { useState } from 'react';
7
- import { CalendarIcon } from '../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
8
- import dayjs from '../../node_modules/.pnpm/dayjs@1.11.11/node_modules/dayjs/dayjs.min.js';
9
- import { Flex } from '../flex/flex.js';
10
10
 
11
11
  function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, onSelect = () => { }, value = {
12
12
  to: new Date(),
13
13
  from: new Date(),
14
- }, pickerGroupClassName, children, }) {
14
+ }, pickerGroupClassName, children, showCalendarIcon = true, }) {
15
15
  const [showCalendar, setShowCalendar] = useState(false);
16
16
  const [currentRangeField, setCurrentRangeField] = useState("from");
17
17
  const [selectedRange, setSelectedRange] = useState(value);
@@ -39,7 +39,7 @@ function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps,
39
39
  function onOpenChange(open) {
40
40
  setShowCalendar(Boolean(open));
41
41
  }
42
- const defaultTrigger = (jsxRuntimeExports.jsxs(Flex, { gap: "medium", className: pickerGroupClassName, children: [jsxRuntimeExports.jsx(TextField, { value: startDate, trailing: jsxRuntimeExports.jsx(CalendarIcon, {}), className: styles.datePickerInput, readOnly: true, ...textFieldProps }), jsxRuntimeExports.jsx(TextField, { value: endDate, trailing: jsxRuntimeExports.jsx(CalendarIcon, {}), className: styles.datePickerInput, readOnly: true, ...textFieldProps })] }));
42
+ const defaultTrigger = (jsxRuntimeExports.jsxs(Flex, { gap: "medium", className: pickerGroupClassName, children: [jsxRuntimeExports.jsx(TextField, { value: startDate, trailing: showCalendarIcon ? jsxRuntimeExports.jsx(CalendarIcon, {}) : undefined, className: styles.datePickerInput, readOnly: true, ...textFieldProps }), jsxRuntimeExports.jsx(TextField, { value: endDate, trailing: showCalendarIcon ? jsxRuntimeExports.jsx(CalendarIcon, {}) : undefined, className: styles.datePickerInput, readOnly: true, ...textFieldProps })] }));
43
43
  const trigger = typeof children === 'function'
44
44
  ? children({ startDate, endDate })
45
45
  : children || defaultTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"range-picker.js","sources":["../../../../v1/components/calendar/range-picker.tsx"],"sourcesContent":["import { Popover } from \"../popover\";\nimport { TextField } from \"../textfield\";\nimport { Calendar } from \"./calendar\";\nimport styles from \"./calendar.module.css\";\nimport { useState } from \"react\";\nimport { CalendarIcon } from \"@radix-ui/react-icons\";\nimport dayjs from \"dayjs\";\nimport { TextfieldProps } from \"../textfield/textfield\";\nimport { DateRange, PropsBase, PropsRangeRequired } from \"react-day-picker\";\nimport { Flex } from \"../flex\";\n\ninterface RangePickerProps {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n dateFormat?: string;\n textFieldProps?: TextfieldProps;\n calendarProps?: PropsRangeRequired & PropsBase;\n onSelect?: (date: DateRange) => void;\n pickerGroupClassName?: string;\n value?: DateRange;\n children?: React.ReactNode | ((props: { startDate: string; endDate: string }) => React.ReactNode);\n}\n\ntype RangeFields = keyof DateRange;\n\nexport function RangePicker({\n side = \"top\",\n dateFormat = \"DD/MM/YYYY\",\n textFieldProps,\n calendarProps,\n onSelect = () => {},\n value = {\n to: new Date(),\n from: new Date(),\n },\n pickerGroupClassName,\n children,\n}: RangePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [currentRangeField, setCurrentRangeField] = useState<RangeFields>(\"from\");\n const [selectedRange, setSelectedRange] = useState(value);\n\n const startDate = selectedRange.from ? dayjs(selectedRange.from).format(dateFormat) : '';\n const endDate = selectedRange.to ? dayjs(selectedRange.to).format(dateFormat) : '';\n\n // 1st click will select the start date.\n // 2nd click will select the end date.\n // 3rd click will select the start date again.\n const handleSelect = (range: DateRange, selectedDay: Date) => {\n const from = selectedRange?.from || range?.from;\n let newRange: DateRange;\n \n if (currentRangeField === \"to\" && dayjs(selectedDay).isAfter(dayjs(from))) {\n // update the end date\n newRange = { from, to: selectedDay };\n setCurrentRangeField(\"from\");\n } else {\n // reset the range and select start day\n newRange = { from: selectedDay };\n setCurrentRangeField(\"to\");\n }\n \n setSelectedRange(newRange);\n onSelect(newRange);\n };\n\n function onOpenChange(open?: boolean) {\n setShowCalendar(Boolean(open));\n }\n\n const defaultTrigger = (\n <Flex gap={\"medium\"} className={pickerGroupClassName}>\n <TextField\n value={startDate}\n trailing={<CalendarIcon />}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n <TextField\n value={endDate}\n trailing={<CalendarIcon />}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n </Flex>\n );\n\n const trigger = typeof children === 'function' \n ? children({ startDate, endDate }) \n : children || defaultTrigger;\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>\n {trigger}\n </Popover.Trigger>\n <Popover.Content side={side} className={styles.calendarPopover}>\n <Calendar\n showOutsideDays={false}\n numberOfMonths={2}\n defaultMonth={selectedRange.from}\n required={true}\n {...calendarProps}\n mode=\"range\"\n selected={selectedRange}\n onSelect={handleSelect}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AAwBM,SAAU,WAAW,CAAC,EAC1B,IAAI,GAAG,KAAK,EACZ,UAAU,GAAG,YAAY,EACzB,cAAc,EACd,aAAa,EACb,QAAQ,GAAG,MAAO,GAAC,EACnB,KAAK,GAAG;IACN,EAAE,EAAE,IAAI,IAAI,EAAE;IACd,IAAI,EAAE,IAAI,IAAI,EAAE;CACjB,EACD,oBAAoB,EACpB,QAAQ,GACS,EAAA;IACjB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAc,MAAM,CAAC,CAAC;IAChF,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,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A,CAClB,EACFA,qBAAA,CAAC,SAAS,EAAA,EACR,KAAK,EAAE,OAAO,EACd,QAAQ,EAAEA,qBAAA,CAAC,YAAY,EAAA,EAAA,CAAG,EAC1B,SAAS,EAAE,MAAM,CAAC,eAAe,EACjC,QAAQ,EACJ,IAAA,EAAA,GAAA,cAAc,EAClB,CAAA,CAAA,EAAA,CACG,CACR,CAAC;AAEF,IAAA,MAAM,OAAO,GAAG,OAAO,QAAQ,KAAK,UAAU;UAC1C,QAAQ,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClC,UAAE,QAAQ,IAAI,cAAc,CAAC;AAE/B,IAAA,QACED,sBAAA,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAA,QAAA,EAAA,CACrDC,qBAAC,CAAA,OAAO,CAAC,OAAO,EAAA,EAAC,OAAO,EAAA,IAAA,EAAA,QAAA,EACrB,OAAO,EACQ,CAAA,EAClBA,qBAAC,CAAA,OAAO,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,eAAe,EAAA,QAAA,EAC5DA,qBAAC,CAAA,QAAQ,IACP,eAAe,EAAE,KAAK,EACtB,cAAc,EAAE,CAAC,EACjB,YAAY,EAAE,aAAa,CAAC,IAAI,EAChC,QAAQ,EAAE,IAAI,EACV,GAAA,aAAa,EACjB,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,YAAY,EAAA,CACtB,EACc,CAAA,CAAA,EAAA,CACV,EACV;AACJ;;;;"}
1
+ {"version":3,"file":"range-picker.js","sources":["../../../../v1/components/calendar/range-picker.tsx"],"sourcesContent":["import { CalendarIcon } from \"@radix-ui/react-icons\";\nimport dayjs from \"dayjs\";\nimport { useState } from \"react\";\nimport { DateRange, PropsBase, PropsRangeRequired } from \"react-day-picker\";\n\nimport { Flex } from \"../flex\";\nimport { Popover } from \"../popover\";\nimport { TextField } from \"../textfield\";\nimport { TextfieldProps } from \"../textfield/textfield\";\nimport { Calendar } from \"./calendar\";\nimport styles from \"./calendar.module.css\";\n\ninterface RangePickerProps {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n dateFormat?: string;\n textFieldProps?: TextfieldProps;\n calendarProps?: PropsRangeRequired & PropsBase;\n onSelect?: (date: DateRange) => void;\n pickerGroupClassName?: string;\n value?: DateRange;\n children?: React.ReactNode | ((props: { startDate: string; endDate: string }) => React.ReactNode);\n showCalendarIcon?: boolean;\n}\n\ntype RangeFields = keyof DateRange;\n\nexport function RangePicker({\n side = \"top\",\n dateFormat = \"DD/MM/YYYY\",\n textFieldProps,\n calendarProps,\n onSelect = () => {},\n value = {\n to: new Date(),\n from: new Date(),\n },\n pickerGroupClassName,\n children,\n showCalendarIcon = true,\n}: RangePickerProps) {\n const [showCalendar, setShowCalendar] = useState(false);\n const [currentRangeField, setCurrentRangeField] = useState<RangeFields>(\"from\");\n const [selectedRange, setSelectedRange] = useState(value);\n\n const startDate = selectedRange.from ? dayjs(selectedRange.from).format(dateFormat) : '';\n const endDate = selectedRange.to ? dayjs(selectedRange.to).format(dateFormat) : '';\n\n // 1st click will select the start date.\n // 2nd click will select the end date.\n // 3rd click will select the start date again.\n const handleSelect = (range: DateRange, selectedDay: Date) => {\n const from = selectedRange?.from || range?.from;\n let newRange: DateRange;\n \n if (currentRangeField === \"to\" && dayjs(selectedDay).isAfter(dayjs(from))) {\n // update the end date\n newRange = { from, to: selectedDay };\n setCurrentRangeField(\"from\");\n } else {\n // reset the range and select start day\n newRange = { from: selectedDay };\n setCurrentRangeField(\"to\");\n }\n \n setSelectedRange(newRange);\n onSelect(newRange);\n };\n\n function onOpenChange(open?: boolean) {\n setShowCalendar(Boolean(open));\n }\n\n const defaultTrigger = (\n <Flex gap={\"medium\"} className={pickerGroupClassName}>\n <TextField\n value={startDate}\n trailing={showCalendarIcon ? <CalendarIcon /> : undefined}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n <TextField\n value={endDate}\n trailing={showCalendarIcon ? <CalendarIcon /> : undefined}\n className={styles.datePickerInput}\n readOnly\n {...textFieldProps}\n />\n </Flex>\n );\n\n const trigger = typeof children === 'function' \n ? children({ startDate, endDate }) \n : children || defaultTrigger;\n\n return (\n <Popover open={showCalendar} onOpenChange={onOpenChange}>\n <Popover.Trigger asChild>\n {trigger}\n </Popover.Trigger>\n <Popover.Content side={side} className={styles.calendarPopover}>\n <Calendar\n showOutsideDays={false}\n numberOfMonths={2}\n defaultMonth={selectedRange.from}\n required={true}\n {...calendarProps}\n mode=\"range\"\n selected={selectedRange}\n onSelect={handleSelect}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AA0BM,SAAU,WAAW,CAAC,EAC1B,IAAI,GAAG,KAAK,EACZ,UAAU,GAAG,YAAY,EACzB,cAAc,EACd,aAAa,EACb,QAAQ,GAAG,MAAO,GAAC,EACnB,KAAK,GAAG;IACN,EAAE,EAAE,IAAI,IAAI,EAAE;IACd,IAAI,EAAE,IAAI,IAAI,EAAE;AACjB,CAAA,EACD,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,GAAG,IAAI,GACN,EAAA;IACjB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAc,MAAM,CAAC,CAAC;IAChF,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;IACzF,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,GAAG,KAAK,CAAC,aAAa,CAAC,E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,EAAA,EAAA,CAAG,GAAG,SAAS,EACzD,SAAS,EAAE,MAAM,CAAC,eAAe,EACjC,QAAQ,EAAA,IAAA,EAAA,GACJ,cAAc,EAClB,CAAA,CAAA,EAAA,CACG,CACR,CAAC;AAEF,IAAA,MAAM,OAAO,GAAG,OAAO,QAAQ,KAAK,UAAU;UAC1C,QAAQ,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClC,UAAE,QAAQ,IAAI,cAAc,CAAC;AAE/B,IAAA,QACED,sBAAA,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAA,QAAA,EAAA,CACrDC,qBAAC,CAAA,OAAO,CAAC,OAAO,EAAA,EAAC,OAAO,EAAA,IAAA,EAAA,QAAA,EACrB,OAAO,EACQ,CAAA,EAClBA,qBAAC,CAAA,OAAO,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,eAAe,EAAA,QAAA,EAC5DA,qBAAC,CAAA,QAAQ,IACP,eAAe,EAAE,KAAK,EACtB,cAAc,EAAE,CAAC,EACjB,YAAY,EAAE,aAAa,CAAC,IAAI,EAChC,QAAQ,EAAE,IAAI,EACV,GAAA,aAAa,EACjB,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,YAAY,EAAA,CACtB,EACc,CAAA,CAAA,EAAA,CACV,EACV;AACJ;;;;"}
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
4
- var React = require('react');
5
4
  var reactIcons_esm = require('../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
6
5
  var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
6
+ var React = require('react');
7
7
  var callout_module = require('./callout.module.css.cjs');
8
8
 
9
9
  function _interopNamespaceDefault(e) {
@@ -47,8 +47,11 @@ const callout = index.cva(callout_module.default.callout, {
47
47
  type: 'grey',
48
48
  },
49
49
  });
50
- const Callout = React__namespace.forwardRef(({ className, type = 'grey', outline, highContrast, children, action, dismissible, onDismiss, width, ...props }, ref) => {
51
- const style = width ? { width: typeof width === 'number' ? `${width}px` : width } : undefined;
50
+ const Callout = React__namespace.forwardRef(({ className, type = 'grey', outline, highContrast, children, action, dismissible, onDismiss, width, style, icon, ...props }, ref) => {
51
+ const combinedStyle = {
52
+ ...style,
53
+ ...(width && { width: typeof width === 'number' ? `${width}px` : width }),
54
+ };
52
55
  const getRole = () => {
53
56
  switch (type) {
54
57
  case 'alert':
@@ -59,7 +62,7 @@ const Callout = React__namespace.forwardRef(({ className, type = 'grey', outline
59
62
  return 'status';
60
63
  }
61
64
  };
62
- return (jsxRuntime.jsxRuntimeExports.jsx("div", { ref: ref, className: `${callout({ type, outline, highContrast })} ${className || ''}`, style: style, role: getRole(), "aria-live": type === 'alert' ? 'assertive' : 'polite', ...props, children: jsxRuntime.jsxRuntimeExports.jsxs("div", { className: callout_module.default.container, children: [jsxRuntime.jsxRuntimeExports.jsxs("div", { className: callout_module.default.messageContainer, children: [jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.InfoCircledIcon, { className: callout_module.default.icon, "aria-hidden": "true" }), jsxRuntime.jsxRuntimeExports.jsx("div", { className: callout_module.default.message, children: children })] }), jsxRuntime.jsxRuntimeExports.jsxs("div", { className: callout_module.default.actionsContainer, children: [action && (jsxRuntime.jsxRuntimeExports.jsx("div", { className: callout_module.default.action, children: action })), dismissible && (jsxRuntime.jsxRuntimeExports.jsx("button", { className: callout_module.default.dismiss, onClick: onDismiss, "aria-label": "Dismiss message", type: "button", children: jsxRuntime.jsxRuntimeExports.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", role: "presentation", children: jsxRuntime.jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z", fill: "currentColor" }) }) }))] })] }) }));
65
+ return (jsxRuntime.jsxRuntimeExports.jsx("div", { ref: ref, className: `${callout({ type, outline, highContrast })} ${className || ''}`, style: combinedStyle, role: getRole(), "aria-live": type === 'alert' ? 'assertive' : 'polite', ...props, children: jsxRuntime.jsxRuntimeExports.jsxs("div", { className: callout_module.default.container, children: [jsxRuntime.jsxRuntimeExports.jsxs("div", { className: callout_module.default.messageContainer, children: [icon !== undefined ? (jsxRuntime.jsxRuntimeExports.jsx("div", { className: callout_module.default.icon, "aria-hidden": "true", children: icon })) : (jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.InfoCircledIcon, { className: callout_module.default.icon, "aria-hidden": "true" })), jsxRuntime.jsxRuntimeExports.jsx("div", { className: callout_module.default.message, children: children })] }), jsxRuntime.jsxRuntimeExports.jsxs("div", { className: callout_module.default.actionsContainer, children: [action && (jsxRuntime.jsxRuntimeExports.jsx("div", { className: callout_module.default.action, children: action })), dismissible && (jsxRuntime.jsxRuntimeExports.jsx("button", { className: callout_module.default.dismiss, onClick: onDismiss, "aria-label": "Dismiss message", type: "button", children: jsxRuntime.jsxRuntimeExports.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", role: "presentation", children: jsxRuntime.jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z", fill: "currentColor" }) }) }))] })] }) }));
63
66
  });
64
67
  Callout.displayName = 'Callout';
65
68
 
@@ -1 +1 @@
1
- {"version":3,"file":"callout.cjs","sources":["../../../../v1/components/callout/callout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { type ComponentPropsWithoutRef } from 'react';\nimport { InfoCircledIcon } from '@radix-ui/react-icons';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport styles from './callout.module.css';\n\nconst callout = cva(styles.callout, {\n variants: {\n type: {\n grey: styles['callout-grey'],\n success: styles['callout-success'],\n alert: styles['callout-alert'],\n gradient: styles['callout-gradient'],\n accent: styles['callout-accent'],\n attention: styles['callout-attention'],\n normal: styles['callout-normal'],\n },\n outline: {\n true: styles['callout-outline'],\n },\n highContrast: {\n true: styles['callout-high-contrast'],\n },\n },\n defaultVariants: {\n type: 'grey',\n },\n});\n\nexport interface CalloutProps extends ComponentPropsWithoutRef<'div'>, VariantProps<typeof callout> {\n children: React.ReactNode;\n action?: React.ReactNode;\n dismissible?: boolean;\n onDismiss?: () => void;\n width?: string | number;\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n ({ \n className,\n type = 'grey',\n outline,\n highContrast,\n children,\n action,\n dismissible,\n onDismiss,\n width,\n ...props\n }, ref) => {\n const style = width ? { width: typeof width === 'number' ? `${width}px` : width } : undefined;\n\n const getRole = () => {\n switch (type) {\n case 'alert':\n return 'alert';\n case 'success':\n return 'status';\n default:\n return 'status';\n }\n };\n\n return (\n <div\n ref={ref}\n className={`${callout({ type, outline, highContrast })} ${className || ''}`}\n style={style}\n role={getRole()}\n aria-live={type === 'alert' ? 'assertive' : 'polite'}\n {...props}\n >\n <div className={styles.container}>\n <div className={styles.messageContainer}>\n <InfoCircledIcon \n className={styles.icon} \n aria-hidden=\"true\"\n />\n <div className={styles.message}>{children}</div>\n </div>\n \n <div className={styles.actionsContainer}>\n {action && (\n <div className={styles.action}>\n {action}\n </div>\n )}\n {dismissible && (\n <button \n className={styles.dismiss} \n onClick={onDismiss}\n aria-label=\"Dismiss message\"\n type=\"button\"\n >\n <svg \n width=\"12\" \n height=\"12\" \n viewBox=\"0 0 12 12\" \n fill=\"none\" \n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n role=\"presentation\"\n >\n <path \n fillRule=\"evenodd\" \n clipRule=\"evenodd\" \n d=\"M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z\" \n fill=\"currentColor\"\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </div>\n );\n }\n);\n\nCallout.displayName =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,EAC5B,IAAI,EAAC,QAAQ,EAEb,QAAA,EAAAE,gCAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,EAAA,aAAA,EACtB,MAAM,EAClB,IAAI,EAAC,cAAc,EAAA,QAAA,EAEnBA,2CACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,qgBAAqgB,EACvgB,IAAI,EAAC,cAAc,EAAA,CACnB,GACE,EACC,CAAA,CACV,IACG,CACF,EAAA,CAAA,EAAA,CACF,EACN;AACJ,CAAC,EACD;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"callout.cjs","sources":["../../../../v1/components/callout/callout.tsx"],"sourcesContent":["import { InfoCircledIcon } from '@radix-ui/react-icons';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\nimport { type ComponentPropsWithoutRef } from 'react';\n\nimport styles from './callout.module.css';\n\nconst callout = cva(styles.callout, {\n variants: {\n type: {\n grey: styles['callout-grey'],\n success: styles['callout-success'],\n alert: styles['callout-alert'],\n gradient: styles['callout-gradient'],\n accent: styles['callout-accent'],\n attention: styles['callout-attention'],\n normal: styles['callout-normal'],\n },\n outline: {\n true: styles['callout-outline'],\n },\n highContrast: {\n true: styles['callout-high-contrast'],\n },\n },\n defaultVariants: {\n type: 'grey',\n },\n});\n\nexport interface CalloutProps extends ComponentPropsWithoutRef<'div'>, VariantProps<typeof callout> {\n children: React.ReactNode;\n action?: React.ReactNode;\n dismissible?: boolean;\n onDismiss?: () => void;\n width?: string | number;\n style?: React.CSSProperties;\n icon?: React.ReactNode;\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n ({ \n className,\n type = 'grey',\n outline,\n highContrast,\n children,\n action,\n dismissible,\n onDismiss,\n width,\n style,\n icon,\n ...props\n }, ref) => {\n const combinedStyle = {\n ...style,\n ...(width && { width: typeof width === 'number' ? `${width}px` : width }),\n };\n\n const getRole = () => {\n switch (type) {\n case 'alert':\n return 'alert';\n case 'success':\n return 'status';\n default:\n return 'status';\n }\n };\n\n return (\n <div\n ref={ref}\n className={`${callout({ type, outline, highContrast })} ${className || ''}`}\n style={combinedStyle}\n role={getRole()}\n aria-live={type === 'alert' ? 'assertive' : 'polite'}\n {...props}\n >\n <div className={styles.container}>\n <div className={styles.messageContainer}>\n {icon !== undefined ? (\n <div className={styles.icon} aria-hidden=\"true\">\n {icon}\n </div>\n ) : (\n <InfoCircledIcon \n className={styles.icon} \n aria-hidden=\"true\"\n />\n )}\n <div className={styles.message}>{children}</div>\n </div>\n \n <div className={styles.actionsContainer}>\n {action && (\n <div className={styles.action}>\n {action}\n </div>\n )}\n {dismissible && (\n <button \n className={styles.dismiss} \n onClick={onDismiss}\n aria-label=\"Dismiss message\"\n type=\"button\"\n >\n <svg \n width=\"12\" \n height=\"12\" \n viewBox=\"0 0 12 12\" \n fill=\"none\" \n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n role=\"presentation\"\n >\n <path \n fillRule=\"evenodd\" \n clipRule=\"evenodd\" \n d=\"M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z\" \n fill=\"currentColor\"\n />\n </svg>\n </button>\n )}\n </div>\n </div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AC,MAAM,YAC1B,MAAM,EAAA,CACH,CACP,EACA,WAAW,KACVE,gCAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAEF,sBAAM,CAAC,OAAO,EACzB,OAAO,EAAE,SAAS,EAAA,YAAA,EACP,iBAAiB,EAC5B,IAAI,EAAC,QAAQ,EAEb,QAAA,EAAAE,gCAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,iBACtB,MAAM,EAClB,IAAI,EAAC,cAAc,EAAA,QAAA,EAEnBA,2CACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,qgBAAqgB,EACvgB,IAAI,EAAC,cAAc,GACnB,EACE,CAAA,EAAA,CACC,CACV,CACG,EAAA,CAAA,CAAA,EAAA,CACF,EACF,CAAA,EACN;AACJ,CAAC,EACD;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
@@ -1,6 +1,6 @@
1
+ import { type VariantProps } from 'class-variance-authority';
1
2
  import * as React from 'react';
2
3
  import { type ComponentPropsWithoutRef } from 'react';
3
- import { type VariantProps } from 'class-variance-authority';
4
4
  declare const callout: (props?: ({
5
5
  type?: "alert" | "accent" | "attention" | "success" | "normal" | "gradient" | "grey" | null | undefined;
6
6
  outline?: boolean | null | undefined;
@@ -12,6 +12,8 @@ export interface CalloutProps extends ComponentPropsWithoutRef<'div'>, VariantPr
12
12
  dismissible?: boolean;
13
13
  onDismiss?: () => void;
14
14
  width?: string | number;
15
+ style?: React.CSSProperties;
16
+ icon?: React.ReactNode;
15
17
  }
16
18
  export declare const Callout: React.ForwardRefExoticComponent<CalloutProps & React.RefAttributes<HTMLDivElement>>;
17
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../../../v1/components/callout/callout.tsx"],"names":[],"mappings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CAAC,SAAS,CAAC;CACxB;AAED,eAAO,MAAM,OAAO,qFA2FnB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
2
- import * as React from 'react';
3
2
  import { InfoCircledIcon } from '../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
4
3
  import { cva } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
4
+ import * as React from 'react';
5
5
  import styles from './callout.module.css.js';
6
6
 
7
7
  const callout = cva(styles.callout, {
@@ -26,8 +26,11 @@ const callout = cva(styles.callout, {
26
26
  type: 'grey',
27
27
  },
28
28
  });
29
- const Callout = React.forwardRef(({ className, type = 'grey', outline, highContrast, children, action, dismissible, onDismiss, width, ...props }, ref) => {
30
- const style = width ? { width: typeof width === 'number' ? `${width}px` : width } : undefined;
29
+ const Callout = React.forwardRef(({ className, type = 'grey', outline, highContrast, children, action, dismissible, onDismiss, width, style, icon, ...props }, ref) => {
30
+ const combinedStyle = {
31
+ ...style,
32
+ ...(width && { width: typeof width === 'number' ? `${width}px` : width }),
33
+ };
31
34
  const getRole = () => {
32
35
  switch (type) {
33
36
  case 'alert':
@@ -38,7 +41,7 @@ const Callout = React.forwardRef(({ className, type = 'grey', outline, highContr
38
41
  return 'status';
39
42
  }
40
43
  };
41
- return (jsxRuntimeExports.jsx("div", { ref: ref, className: `${callout({ type, outline, highContrast })} ${className || ''}`, style: style, role: getRole(), "aria-live": type === 'alert' ? 'assertive' : 'polite', ...props, children: jsxRuntimeExports.jsxs("div", { className: styles.container, children: [jsxRuntimeExports.jsxs("div", { className: styles.messageContainer, children: [jsxRuntimeExports.jsx(InfoCircledIcon, { className: styles.icon, "aria-hidden": "true" }), jsxRuntimeExports.jsx("div", { className: styles.message, children: children })] }), jsxRuntimeExports.jsxs("div", { className: styles.actionsContainer, children: [action && (jsxRuntimeExports.jsx("div", { className: styles.action, children: action })), dismissible && (jsxRuntimeExports.jsx("button", { className: styles.dismiss, onClick: onDismiss, "aria-label": "Dismiss message", type: "button", children: jsxRuntimeExports.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", role: "presentation", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z", fill: "currentColor" }) }) }))] })] }) }));
44
+ return (jsxRuntimeExports.jsx("div", { ref: ref, className: `${callout({ type, outline, highContrast })} ${className || ''}`, style: combinedStyle, role: getRole(), "aria-live": type === 'alert' ? 'assertive' : 'polite', ...props, children: jsxRuntimeExports.jsxs("div", { className: styles.container, children: [jsxRuntimeExports.jsxs("div", { className: styles.messageContainer, children: [icon !== undefined ? (jsxRuntimeExports.jsx("div", { className: styles.icon, "aria-hidden": "true", children: icon })) : (jsxRuntimeExports.jsx(InfoCircledIcon, { className: styles.icon, "aria-hidden": "true" })), jsxRuntimeExports.jsx("div", { className: styles.message, children: children })] }), jsxRuntimeExports.jsxs("div", { className: styles.actionsContainer, children: [action && (jsxRuntimeExports.jsx("div", { className: styles.action, children: action })), dismissible && (jsxRuntimeExports.jsx("button", { className: styles.dismiss, onClick: onDismiss, "aria-label": "Dismiss message", type: "button", children: jsxRuntimeExports.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", role: "presentation", children: jsxRuntimeExports.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z", fill: "currentColor" }) }) }))] })] }) }));
42
45
  });
43
46
  Callout.displayName = 'Callout';
44
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"callout.js","sources":["../../../../v1/components/callout/callout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { type ComponentPropsWithoutRef } from 'react';\nimport { InfoCircledIcon } from '@radix-ui/react-icons';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport styles from './callout.module.css';\n\nconst callout = cva(styles.callout, {\n variants: {\n type: {\n grey: styles['callout-grey'],\n success: styles['callout-success'],\n alert: styles['callout-alert'],\n gradient: styles['callout-gradient'],\n accent: styles['callout-accent'],\n attention: styles['callout-attention'],\n normal: styles['callout-normal'],\n },\n outline: {\n true: styles['callout-outline'],\n },\n highContrast: {\n true: styles['callout-high-contrast'],\n },\n },\n defaultVariants: {\n type: 'grey',\n },\n});\n\nexport interface CalloutProps extends ComponentPropsWithoutRef<'div'>, VariantProps<typeof callout> {\n children: React.ReactNode;\n action?: React.ReactNode;\n dismissible?: boolean;\n onDismiss?: () => void;\n width?: string | number;\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n ({ \n className,\n type = 'grey',\n outline,\n highContrast,\n children,\n action,\n dismissible,\n onDismiss,\n width,\n ...props\n }, ref) => {\n const style = width ? { width: typeof width === 'number' ? `${width}px` : width } : undefined;\n\n const getRole = () => {\n switch (type) {\n case 'alert':\n return 'alert';\n case 'success':\n return 'status';\n default:\n return 'status';\n }\n };\n\n return (\n <div\n ref={ref}\n className={`${callout({ type, outline, highContrast })} ${className || ''}`}\n style={style}\n role={getRole()}\n aria-live={type === 'alert' ? 'assertive' : 'polite'}\n {...props}\n >\n <div className={styles.container}>\n <div className={styles.messageContainer}>\n <InfoCircledIcon \n className={styles.icon} \n aria-hidden=\"true\"\n />\n <div className={styles.message}>{children}</div>\n </div>\n \n <div className={styles.actionsContainer}>\n {action && (\n <div className={styles.action}>\n {action}\n </div>\n )}\n {dismissible && (\n <button \n className={styles.dismiss} \n onClick={onDismiss}\n aria-label=\"Dismiss message\"\n type=\"button\"\n >\n <svg \n width=\"12\" \n height=\"12\" \n viewBox=\"0 0 12 12\" \n fill=\"none\" \n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n role=\"presentation\"\n >\n <path \n fillRule=\"evenodd\" \n clipRule=\"evenodd\" \n d=\"M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z\" \n fill=\"currentColor\"\n />\n </svg>\n </button>\n )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BAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,EAAA,aAAA,EACtB,MAAM,EAClB,IAAI,EAAC,cAAc,EAAA,QAAA,EAEnBA,gCACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,qgBAAqgB,EACvgB,IAAI,EAAC,cAAc,EAAA,CACnB,GACE,EACC,CAAA,CACV,IACG,CACF,EAAA,CAAA,EAAA,CACF,EACN;AACJ,CAAC,EACD;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"callout.js","sources":["../../../../v1/components/callout/callout.tsx"],"sourcesContent":["import { InfoCircledIcon } from '@radix-ui/react-icons';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport * as React from 'react';\nimport { type ComponentPropsWithoutRef } from 'react';\n\nimport styles from './callout.module.css';\n\nconst callout = cva(styles.callout, {\n variants: {\n type: {\n grey: styles['callout-grey'],\n success: styles['callout-success'],\n alert: styles['callout-alert'],\n gradient: styles['callout-gradient'],\n accent: styles['callout-accent'],\n attention: styles['callout-attention'],\n normal: styles['callout-normal'],\n },\n outline: {\n true: styles['callout-outline'],\n },\n highContrast: {\n true: styles['callout-high-contrast'],\n },\n },\n defaultVariants: {\n type: 'grey',\n },\n});\n\nexport interface CalloutProps extends ComponentPropsWithoutRef<'div'>, VariantProps<typeof callout> {\n children: React.ReactNode;\n action?: React.ReactNode;\n dismissible?: boolean;\n onDismiss?: () => void;\n width?: string | number;\n style?: React.CSSProperties;\n icon?: React.ReactNode;\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n ({ \n className,\n type = 'grey',\n outline,\n highContrast,\n children,\n action,\n dismissible,\n onDismiss,\n width,\n style,\n icon,\n ...props\n }, ref) => {\n const combinedStyle = {\n ...style,\n ...(width && { width: typeof width === 'number' ? `${width}px` : width }),\n };\n\n const getRole = () => {\n switch (type) {\n case 'alert':\n return 'alert';\n case 'success':\n return 'status';\n default:\n return 'status';\n }\n };\n\n return (\n <div\n ref={ref}\n className={`${callout({ type, outline, highContrast })} ${className || ''}`}\n style={combinedStyle}\n role={getRole()}\n aria-live={type === 'alert' ? 'assertive' : 'polite'}\n {...props}\n >\n <div className={styles.container}>\n <div className={styles.messageContainer}>\n {icon !== undefined ? (\n <div className={styles.icon} aria-hidden=\"true\">\n {icon}\n </div>\n ) : (\n <InfoCircledIcon \n className={styles.icon} \n aria-hidden=\"true\"\n />\n )}\n <div className={styles.message}>{children}</div>\n </div>\n \n <div className={styles.actionsContainer}>\n {action && (\n <div className={styles.action}>\n {action}\n </div>\n )}\n {dismissible && (\n <button \n className={styles.dismiss} \n onClick={onDismiss}\n aria-label=\"Dismiss message\"\n type=\"button\"\n >\n <svg \n width=\"12\" \n height=\"12\" \n viewBox=\"0 0 12 12\" \n fill=\"none\" \n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n role=\"presentation\"\n >\n <path \n fillRule=\"evenodd\" \n clipRule=\"evenodd\" \n d=\"M9.5066 3.3066C9.73115 3.08205 9.73115 2.71798 9.5066 2.49343C9.28205 2.26887 8.91798 2.26887 8.69343 2.49343L6.00001 5.18684L3.3066 2.49343C3.08205 2.26887 2.71798 2.26887 2.49343 2.49343C2.26887 2.71798 2.26887 3.08205 2.49343 3.3066L5.18684 6.00001L2.49343 8.69343C2.26887 8.91798 2.26887 9.28205 2.49343 9.5066C2.71798 9.73115 3.08205 9.73115 3.3066 9.5066L6.00001 6.81318L8.69343 9.5066C8.91798 9.73115 9.28205 9.73115 9.5066 9.5066C9.73115 9.28205 9.73115 8.91798 9.5066 8.69343L6.81318 6.00001L9.5066 3.3066Z\" \n fill=\"currentColor\"\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </div>\n );\n }\n);\n\nCallout.displayName = 'Callout';"],"names":["_js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,YAAA,EACP,iBAAiB,EAC5B,IAAI,EAAC,QAAQ,EAEb,QAAA,EAAAA,qBAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,iBACtB,MAAM,EAClB,IAAI,EAAC,cAAc,EAAA,QAAA,EAEnBA,gCACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,qgBAAqgB,EACvgB,IAAI,EAAC,cAAc,GACnB,EACE,CAAA,EAAA,CACC,CACV,CACG,EAAA,CAAA,CAAA,EAAA,CACF,EACF,CAAA,EACN;AACJ,CAAC,EACD;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
4
+ var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
5
+ var container_module = require('./container.module.css.cjs');
6
+
7
+ const container = index.cva(container_module.default.container, {
8
+ variants: {
9
+ size: {
10
+ small: container_module.default["container-small"],
11
+ medium: container_module.default["container-medium"],
12
+ large: container_module.default["container-large"],
13
+ none: container_module.default["container-none"],
14
+ },
15
+ align: {
16
+ left: container_module.default["container-align-left"],
17
+ center: container_module.default["container-align-center"],
18
+ right: container_module.default["container-align-right"],
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ size: "none",
23
+ align: "center",
24
+ },
25
+ });
26
+ function Container({ children, size, align, className, role = "region", ...props }) {
27
+ return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: container({ size, align, className }), role: role, ...props, children: children }));
28
+ }
29
+
30
+ exports.Container = Container;
31
+ //# sourceMappingURL=container.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.cjs","sources":["../../../../v1/components/container/container.tsx"],"sourcesContent":["import { cva, VariantProps } from \"class-variance-authority\";\nimport { HTMLAttributes, PropsWithChildren } from \"react\";\nimport styles from \"./container.module.css\";\n\nconst container = cva(styles.container, {\n variants: {\n size: {\n small: styles[\"container-small\"],\n medium: styles[\"container-medium\"],\n large: styles[\"container-large\"],\n none: styles[\"container-none\"],\n },\n align: {\n left: styles[\"container-align-left\"],\n center: styles[\"container-align-center\"],\n right: styles[\"container-align-right\"],\n }\n },\n defaultVariants: {\n size: \"none\",\n align: \"center\",\n },\n});\n\ntype ContainerProps = PropsWithChildren<VariantProps<typeof container>> &\n HTMLAttributes<HTMLElement> & {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n };\n\nexport function Container({\n children,\n size,\n align,\n className,\n role = \"region\",\n ...props\n}: ContainerProps) {\n return (\n <div \n className={container({ size, align, className })} \n role={role}\n {...props}\n >\n {children}\n </div>\n );\n} "],"names":["cva","styles","_jsx"],"mappings":";;;;;;AAIA,MAAM,SAAS,GAAGA,SAAG,CAACC,wBAAM,CAAC,SAAS,EAAE;AACtC,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE;AACJ,YAAA,KAAK,EAAEA,wBAAM,CAAC,iBAAiB,CAAC;AAChC,YAAA,MAAM,EAAEA,wBAAM,CAAC,kBAAkB,CAAC;AAClC,YAAA,KAAK,EAAEA,wBAAM,CAAC,iBAAiB,CAAC;AAChC,YAAA,IAAI,EAAEA,wBAAM,CAAC,gBAAgB,CAAC;AAC/B,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAEA,wBAAM,CAAC,sBAAsB,CAAC;AACpC,YAAA,MAAM,EAAEA,wBAAM,CAAC,wBAAwB,CAAC;AACxC,YAAA,KAAK,EAAEA,wBAAM,CAAC,uBAAuB,CAAC;AACvC,SAAA;AACF,KAAA;AACD,IAAA,eAAe,EAAE;AACf,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,KAAK,EAAE,QAAQ;AAChB,KAAA;AACF,CAAA,CAAC,CAAC;SAQa,SAAS,CAAC,EACxB,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,SAAS,EACT,IAAI,GAAG,QAAQ,EACf,GAAG,KAAK,EACO,EAAA;IACf,QACEC,gCACE,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAChD,IAAI,EAAE,IAAI,EAAA,GACN,KAAK,EAER,QAAA,EAAA,QAAQ,EACL,CAAA,EACN;AACJ;;;;"}
@@ -0,0 +1,13 @@
1
+ import { VariantProps } from "class-variance-authority";
2
+ import { HTMLAttributes, PropsWithChildren } from "react";
3
+ declare const container: (props?: ({
4
+ size?: "small" | "medium" | "large" | "none" | null | undefined;
5
+ align?: "center" | "right" | "left" | null | undefined;
6
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
+ type ContainerProps = PropsWithChildren<VariantProps<typeof container>> & HTMLAttributes<HTMLElement> & {
8
+ "aria-label"?: string;
9
+ "aria-labelledby"?: string;
10
+ };
11
+ export declare function Container({ children, size, align, className, role, ...props }: ContainerProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../../v1/components/container/container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1D,QAAA,MAAM,SAAS;;;mFAkBb,CAAC;AAEH,KAAK,cAAc,GAAG,iBAAiB,CAAC,YAAY,CAAC,OAAO,SAAS,CAAC,CAAC,GACrE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEJ,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,SAAS,EACT,IAAe,EACf,GAAG,KAAK,EACT,EAAE,cAAc,2CAUhB"}
@@ -0,0 +1,29 @@
1
+ import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
2
+ import { cva } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
3
+ import styles from './container.module.css.js';
4
+
5
+ const container = cva(styles.container, {
6
+ variants: {
7
+ size: {
8
+ small: styles["container-small"],
9
+ medium: styles["container-medium"],
10
+ large: styles["container-large"],
11
+ none: styles["container-none"],
12
+ },
13
+ align: {
14
+ left: styles["container-align-left"],
15
+ center: styles["container-align-center"],
16
+ right: styles["container-align-right"],
17
+ }
18
+ },
19
+ defaultVariants: {
20
+ size: "none",
21
+ align: "center",
22
+ },
23
+ });
24
+ function Container({ children, size, align, className, role = "region", ...props }) {
25
+ return (jsxRuntimeExports.jsx("div", { className: container({ size, align, className }), role: role, ...props, children: children }));
26
+ }
27
+
28
+ export { Container };
29
+ //# sourceMappingURL=container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.js","sources":["../../../../v1/components/container/container.tsx"],"sourcesContent":["import { cva, VariantProps } from \"class-variance-authority\";\nimport { HTMLAttributes, PropsWithChildren } from \"react\";\nimport styles from \"./container.module.css\";\n\nconst container = cva(styles.container, {\n variants: {\n size: {\n small: styles[\"container-small\"],\n medium: styles[\"container-medium\"],\n large: styles[\"container-large\"],\n none: styles[\"container-none\"],\n },\n align: {\n left: styles[\"container-align-left\"],\n center: styles[\"container-align-center\"],\n right: styles[\"container-align-right\"],\n }\n },\n defaultVariants: {\n size: \"none\",\n align: \"center\",\n },\n});\n\ntype ContainerProps = PropsWithChildren<VariantProps<typeof container>> &\n HTMLAttributes<HTMLElement> & {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n };\n\nexport function Container({\n children,\n size,\n align,\n className,\n role = \"region\",\n ...props\n}: ContainerProps) {\n return (\n <div \n className={container({ size, align, className })} \n role={role}\n {...props}\n >\n {children}\n </div>\n );\n} "],"names":["_jsx"],"mappings":";;;;AAIA,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE;AACtC,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE;AACJ,YAAA,KAAK,EAAE,MAAM,CAAC,iBAAiB,CAAC;AAChC,YAAA,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC;AAClC,YAAA,KAAK,EAAE,MAAM,CAAC,iBAAiB,CAAC;AAChC,YAAA,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC;AAC/B,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM,CAAC,sBAAsB,CAAC;AACpC,YAAA,MAAM,EAAE,MAAM,CAAC,wBAAwB,CAAC;AACxC,YAAA,KAAK,EAAE,MAAM,CAAC,uBAAuB,CAAC;AACvC,SAAA;AACF,KAAA;AACD,IAAA,eAAe,EAAE;AACf,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,KAAK,EAAE,QAAQ;AAChB,KAAA;AACF,CAAA,CAAC,CAAC;SAQa,SAAS,CAAC,EACxB,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,SAAS,EACT,IAAI,GAAG,QAAQ,EACf,GAAG,KAAK,EACO,EAAA;IACf,QACEA,qBACE,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAChD,IAAI,EAAE,IAAI,EAAA,GACN,KAAK,EAER,QAAA,EAAA,QAAQ,EACL,CAAA,EACN;AACJ;;;;"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var styles = {"container":"container-module_container__6wfaA","container-small":"container-module_container-small__upirC","container-medium":"container-module_container-medium__viAod","container-large":"container-module_container-large__Gs2HJ","container-align-left":"container-module_container-align-left__bbk0q","container-align-center":"container-module_container-align-center__cJAW0","container-align-right":"container-module_container-align-right__-N-XX","container-none":"container-module_container-none__HTaG1","container___small":"container-module_container-small__upirC","container___medium":"container-module_container-medium__viAod","container___large":"container-module_container-large__Gs2HJ","container___align___left":"container-module_container-align-left__bbk0q","container___align___center":"container-module_container-align-center__cJAW0","container___align___right":"container-module_container-align-right__-N-XX","container___none":"container-module_container-none__HTaG1"};
6
+
7
+ exports.default = styles;
8
+ //# sourceMappingURL=container.module.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,4 @@
1
+ var styles = {"container":"container-module_container__6wfaA","container-small":"container-module_container-small__upirC","container-medium":"container-module_container-medium__viAod","container-large":"container-module_container-large__Gs2HJ","container-align-left":"container-module_container-align-left__bbk0q","container-align-center":"container-module_container-align-center__cJAW0","container-align-right":"container-module_container-align-right__-N-XX","container-none":"container-module_container-none__HTaG1","container___small":"container-module_container-small__upirC","container___medium":"container-module_container-medium__viAod","container___large":"container-module_container-large__Gs2HJ","container___align___left":"container-module_container-align-left__bbk0q","container___align___center":"container-module_container-align-center__cJAW0","container___align___right":"container-module_container-align-right__-N-XX","container___none":"container-module_container-none__HTaG1"};
2
+
3
+ export { styles as default };
4
+ //# sourceMappingURL=container.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,2 @@
1
+ export { Container } from "./container";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../v1/components/container/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}