@commercetools/nimbus 0.0.0-canary-20250826164027 → 0.0.0-canary-20250828113330

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 (103) hide show
  1. package/dist/chunks/{alert-BxQlH4k1.es.js → alert-BSP6Q3el.es.js} +2 -2
  2. package/dist/chunks/{alert-BxQlH4k1.es.js.map → alert-BSP6Q3el.es.js.map} +1 -1
  3. package/dist/chunks/{alert-BZUgI30X.cjs.js → alert-C88EdygK.cjs.js} +2 -2
  4. package/dist/chunks/{alert-BZUgI30X.cjs.js.map → alert-C88EdygK.cjs.js.map} +1 -1
  5. package/dist/chunks/button-B9biGn83.es.js +59 -0
  6. package/dist/chunks/{button-B4HX0fM_.es.js.map → button-B9biGn83.es.js.map} +1 -1
  7. package/dist/chunks/button-BCrCWnMd.cjs.js +2 -0
  8. package/dist/chunks/{button-qv44IWcR.cjs.js.map → button-BCrCWnMd.cjs.js.map} +1 -1
  9. package/dist/chunks/{calendar-DABzfMco.es.js → calendar-B9IgFF4u.es.js} +2 -2
  10. package/dist/chunks/{calendar-DABzfMco.es.js.map → calendar-B9IgFF4u.es.js.map} +1 -1
  11. package/dist/chunks/{calendar-v3st4EyG.cjs.js → calendar-BU_04xoY.cjs.js} +2 -2
  12. package/dist/chunks/{calendar-v3st4EyG.cjs.js.map → calendar-BU_04xoY.cjs.js.map} +1 -1
  13. package/dist/chunks/{combobox-Ah0GQqSW.cjs.js → combobox-BvfBQq9k.cjs.js} +2 -2
  14. package/dist/chunks/{combobox-Ah0GQqSW.cjs.js.map → combobox-BvfBQq9k.cjs.js.map} +1 -1
  15. package/dist/chunks/{combobox-D_IGHRck.es.js → combobox-ClhyR7hp.es.js} +3 -3
  16. package/dist/chunks/{combobox-D_IGHRck.es.js.map → combobox-ClhyR7hp.es.js.map} +1 -1
  17. package/dist/chunks/data-table-BZdQfaxu.cjs.js +2 -0
  18. package/dist/chunks/data-table-BZdQfaxu.cjs.js.map +1 -0
  19. package/dist/chunks/{data-table-BVhKXSXO.es.js → data-table-WHEWdh5f.es.js} +1720 -1580
  20. package/dist/chunks/data-table-WHEWdh5f.es.js.map +1 -0
  21. package/dist/chunks/{date-picker-Bpi1PgR2.es.js → date-picker--1p1znhu.es.js} +3 -3
  22. package/dist/chunks/{date-picker-Bpi1PgR2.es.js.map → date-picker--1p1znhu.es.js.map} +1 -1
  23. package/dist/chunks/{date-picker-DNROhe7B.cjs.js → date-picker-BAf5yyGT.cjs.js} +2 -2
  24. package/dist/chunks/{date-picker-DNROhe7B.cjs.js.map → date-picker-BAf5yyGT.cjs.js.map} +1 -1
  25. package/dist/chunks/{date-range-picker-CXKG84tw.es.js → date-range-picker-J-FqEMGo.es.js} +3 -3
  26. package/dist/chunks/{date-range-picker-CXKG84tw.es.js.map → date-range-picker-J-FqEMGo.es.js.map} +1 -1
  27. package/dist/chunks/{date-range-picker-tyjYdQx1.cjs.js → date-range-picker-zxwhdmlC.cjs.js} +2 -2
  28. package/dist/chunks/{date-range-picker-tyjYdQx1.cjs.js.map → date-range-picker-zxwhdmlC.cjs.js.map} +1 -1
  29. package/dist/chunks/{form-field-JpzG70WX.cjs.js → form-field-B9PncHWr.cjs.js} +2 -2
  30. package/dist/chunks/{form-field-JpzG70WX.cjs.js.map → form-field-B9PncHWr.cjs.js.map} +1 -1
  31. package/dist/chunks/{form-field-DePRnFqm.es.js → form-field-wK_anzOw.es.js} +2 -2
  32. package/dist/chunks/{form-field-DePRnFqm.es.js.map → form-field-wK_anzOw.es.js.map} +1 -1
  33. package/dist/chunks/{icon-button-CCrfnUUB.cjs.js → icon-button-BPQdpTPZ.cjs.js} +2 -2
  34. package/dist/chunks/{icon-button-CCrfnUUB.cjs.js.map → icon-button-BPQdpTPZ.cjs.js.map} +1 -1
  35. package/dist/chunks/{icon-button-O_dSWgZr.es.js → icon-button-a3WVC7IH.es.js} +2 -2
  36. package/dist/chunks/{icon-button-O_dSWgZr.es.js.map → icon-button-a3WVC7IH.es.js.map} +1 -1
  37. package/dist/chunks/{password-input-BtbZYHE8.es.js → password-input-BWFYKcBT.es.js} +2 -2
  38. package/dist/chunks/{password-input-BtbZYHE8.es.js.map → password-input-BWFYKcBT.es.js.map} +1 -1
  39. package/dist/chunks/{password-input-CGsQktks.cjs.js → password-input-D8R9Y9Ro.cjs.js} +2 -2
  40. package/dist/chunks/{password-input-CGsQktks.cjs.js.map → password-input-D8R9Y9Ro.cjs.js.map} +1 -1
  41. package/dist/chunks/{range-calendar-BNAIdxfK.es.js → range-calendar-B7-Z0ksl.es.js} +2 -2
  42. package/dist/chunks/{range-calendar-BNAIdxfK.es.js.map → range-calendar-B7-Z0ksl.es.js.map} +1 -1
  43. package/dist/chunks/{range-calendar-BW4gqU35.cjs.js → range-calendar-CswayeNh.cjs.js} +2 -2
  44. package/dist/chunks/{range-calendar-BW4gqU35.cjs.js.map → range-calendar-CswayeNh.cjs.js.map} +1 -1
  45. package/dist/chunks/{rich-text-input-D3xrDvLR.es.js → rich-text-input-Bty0WhBM.es.js} +2 -2
  46. package/dist/chunks/{rich-text-input-D3xrDvLR.es.js.map → rich-text-input-Bty0WhBM.es.js.map} +1 -1
  47. package/dist/chunks/{rich-text-input-iDEygf74.cjs.js → rich-text-input-Cvcywluc.cjs.js} +2 -2
  48. package/dist/chunks/{rich-text-input-iDEygf74.cjs.js.map → rich-text-input-Cvcywluc.cjs.js.map} +1 -1
  49. package/dist/chunks/{select-wby2GRxc.es.js → select-BwGMCDw8.es.js} +2 -2
  50. package/dist/chunks/{select-wby2GRxc.es.js.map → select-BwGMCDw8.es.js.map} +1 -1
  51. package/dist/chunks/{select-DihySN1w.cjs.js → select-DnmavfXh.cjs.js} +2 -2
  52. package/dist/chunks/{select-DihySN1w.cjs.js.map → select-DnmavfXh.cjs.js.map} +1 -1
  53. package/dist/chunks/{split-button-RydlGh27.cjs.js → split-button-BMpznhkI.cjs.js} +2 -2
  54. package/dist/chunks/{split-button-RydlGh27.cjs.js.map → split-button-BMpznhkI.cjs.js.map} +1 -1
  55. package/dist/chunks/{split-button-CcVa5yVH.es.js → split-button-a7my5Dc8.es.js} +3 -3
  56. package/dist/chunks/{split-button-CcVa5yVH.es.js.map → split-button-a7my5Dc8.es.js.map} +1 -1
  57. package/dist/chunks/{tag-group-Cwcr_VDp.cjs.js → tag-group-3YoW3lJr.cjs.js} +2 -2
  58. package/dist/chunks/{tag-group-Cwcr_VDp.cjs.js.map → tag-group-3YoW3lJr.cjs.js.map} +1 -1
  59. package/dist/chunks/{tag-group-DQ0jVbpR.es.js → tag-group-BBldLRQt.es.js} +2 -2
  60. package/dist/chunks/{tag-group-DQ0jVbpR.es.js.map → tag-group-BBldLRQt.es.js.map} +1 -1
  61. package/dist/components/alert.cjs +1 -1
  62. package/dist/components/alert.es.js +1 -1
  63. package/dist/components/button.cjs +1 -1
  64. package/dist/components/button.es.js +1 -1
  65. package/dist/components/calendar.cjs +1 -1
  66. package/dist/components/calendar.es.js +1 -1
  67. package/dist/components/combobox.cjs +1 -1
  68. package/dist/components/combobox.es.js +1 -1
  69. package/dist/components/components.cjs +1 -1
  70. package/dist/components/components.es.js +15 -15
  71. package/dist/components/data-table.cjs +1 -1
  72. package/dist/components/data-table.es.js +1 -1
  73. package/dist/components/date-picker.cjs +1 -1
  74. package/dist/components/date-picker.es.js +1 -1
  75. package/dist/components/date-range-picker.cjs +1 -1
  76. package/dist/components/date-range-picker.es.js +1 -1
  77. package/dist/components/form-field.cjs +1 -1
  78. package/dist/components/form-field.es.js +1 -1
  79. package/dist/components/icon-button.cjs +1 -1
  80. package/dist/components/icon-button.es.js +1 -1
  81. package/dist/components/password-input.cjs +1 -1
  82. package/dist/components/password-input.es.js +1 -1
  83. package/dist/components/range-calendar.cjs +1 -1
  84. package/dist/components/range-calendar.es.js +1 -1
  85. package/dist/components/rich-text-input.cjs +1 -1
  86. package/dist/components/rich-text-input.es.js +1 -1
  87. package/dist/components/select.cjs +1 -1
  88. package/dist/components/select.es.js +1 -1
  89. package/dist/components/split-button.cjs +1 -1
  90. package/dist/components/split-button.es.js +1 -1
  91. package/dist/components/tag-group.cjs +1 -1
  92. package/dist/components/tag-group.es.js +1 -1
  93. package/dist/components.d.ts +83 -37
  94. package/dist/data-table.d.ts +85 -37
  95. package/dist/index.cjs +1 -1
  96. package/dist/index.d.ts +86 -40
  97. package/dist/index.es.js +15 -15
  98. package/package.json +5 -5
  99. package/dist/chunks/button-B4HX0fM_.es.js +0 -57
  100. package/dist/chunks/button-qv44IWcR.cjs.js +0 -2
  101. package/dist/chunks/data-table-BVhKXSXO.es.js.map +0 -1
  102. package/dist/chunks/data-table-_iKOsqf2.cjs.js +0 -2
  103. package/dist/chunks/data-table-_iKOsqf2.cjs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"range-calendar-BW4gqU35.cjs.js","sources":["../../src/components/range-calendar/range-calendar.slots.tsx","../../src/components/range-calendar/components/range-calendar.grids.tsx","../../src/components/range-calendar/components/range-calendar.header.tsx","../../src/components/range-calendar/components/range-calendar.custom-context.tsx","../../src/components/range-calendar/range-calendar.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport {\n createSlotRecipeContext,\n type HTMLChakraProps,\n type RecipeVariantProps,\n} from \"@chakra-ui/react/styled-system\";\nimport { rangeCalendarSlotRecipe } from \"./range-calendar.recipe\";\nimport type { RangeCalendarProps } from \"react-aria-components\";\nimport type { DateValue } from \"@internationalized/date\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"rangeCalendar\",\n});\n\nexport interface RangeCalendarRootSlotProps\n extends HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof rangeCalendarSlotRecipe> &\n RangeCalendarProps<DateValue>\n > {}\nexport const RangeCalendarRootSlot = withProvider<\n HTMLDivElement,\n RangeCalendarRootSlotProps\n>(\"div\", \"root\");\n\nexport interface RangeCalendarHeaderSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const RangeCalendarHeaderSlot = withContext<\n HTMLDivElement,\n RangeCalendarHeaderSlotProps\n>(\"div\", \"header\");\n\nexport interface RangeCalendarGridsSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const RangeCalendarGridsSlot = withContext<\n HTMLDivElement,\n RangeCalendarGridsSlotProps\n>(\"div\", \"grids\");\n\nexport interface RangeCalendarMonthTitleSlotProps\n extends HTMLChakraProps<\"div\"> {}\nexport const RangeCalendarMonthTitleSlot = withContext<\n HTMLDivElement,\n RangeCalendarMonthTitleSlotProps\n>(\"div\", \"monthTitle\");\n\nexport interface RangeCalendarGridSlotProps extends HTMLChakraProps<\"table\"> {}\nexport const RangeCalendarGridSlot = withContext<\n HTMLTableElement,\n RangeCalendarGridSlotProps\n>(\"table\", \"grid\");\n\nexport interface RangeCalendarGridHeaderSlotProps\n extends HTMLChakraProps<\"thead\"> {}\nexport const RangeCalendarGridHeaderSlot = withContext<\n HTMLTableSectionElement,\n RangeCalendarGridHeaderSlotProps\n>(\"thead\", \"gridHeader\");\n\nexport interface RangeCalendarHeaderCellSlotProps\n extends HTMLChakraProps<\"th\"> {}\nexport const RangeCalendarHeaderCellSlot = withContext<\n HTMLTableCellElement,\n RangeCalendarHeaderCellSlotProps\n>(\"th\", \"headerCell\");\n\nexport interface RangeCalendarGridBodySlotProps\n extends HTMLChakraProps<\"tbody\"> {}\nexport const RangeCalendarGridBodySlot = withContext<\n HTMLTableSectionElement,\n RangeCalendarGridBodySlotProps\n>(\"tbody\", \"gridBody\");\n\nexport interface RangeCalendarCellSlotProps extends HTMLChakraProps<\"td\"> {}\nexport const RangeCalendarCellSlot = withContext<\n HTMLTableCellElement,\n RangeCalendarCellSlotProps\n>(\"td\", \"bodyCell\");\n","import { useContext } from \"react\";\nimport { today, getLocalTimeZone } from \"@internationalized/date\";\nimport {\n CalendarGrid as RaCalendarGrid,\n CalendarGridBody as RaCalendarGridBody,\n CalendarGridHeader as RaCalendarGridHeader,\n CalendarHeaderCell as RaCalendarHeaderCell,\n CalendarCell as RaCalendarCell,\n useSlottedContext,\n RangeCalendarContext,\n RangeCalendarStateContext,\n useLocale,\n} from \"react-aria-components\";\nimport { Box } from \"@/components\";\n\nimport {\n RangeCalendarCellSlot,\n RangeCalendarGridBodySlot,\n RangeCalendarGridHeaderSlot,\n RangeCalendarGridsSlot,\n RangeCalendarGridSlot,\n RangeCalendarHeaderCellSlot,\n RangeCalendarMonthTitleSlot,\n} from \"../range-calendar.slots\";\n\nexport const RangeCalendarGrids = () => {\n const { locale } = useLocale();\n const context = useSlottedContext(RangeCalendarContext);\n\n const calendarState = useContext(RangeCalendarStateContext)!;\n const visibleMonthsCount = context?.visibleDuration?.months || 1;\n const todayDate = today(getLocalTimeZone());\n const showMonthTitles = visibleMonthsCount > 1;\n\n return (\n <RangeCalendarGridsSlot>\n {Array.from({ length: visibleMonthsCount }, (_, index) => {\n const gridDate = calendarState.visibleRange.start.add({\n months: index,\n });\n const monthName = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(gridDate.toDate(getLocalTimeZone()));\n\n return (\n <Box\n key={monthName}\n width={visibleMonthsCount == 1 ? \"full\" : \"auto\"}\n >\n {showMonthTitles && (\n <RangeCalendarMonthTitleSlot>\n {monthName}\n </RangeCalendarMonthTitleSlot>\n )}\n <RangeCalendarGridSlot asChild>\n <RaCalendarGrid offset={{ months: index }} weekdayStyle=\"short\">\n <RangeCalendarGridHeaderSlot asChild>\n <RaCalendarGridHeader>\n {(day) => (\n <RangeCalendarHeaderCellSlot asChild>\n <RaCalendarHeaderCell>{day}</RaCalendarHeaderCell>\n </RangeCalendarHeaderCellSlot>\n )}\n </RaCalendarGridHeader>\n </RangeCalendarGridHeaderSlot>\n <RangeCalendarGridBodySlot asChild>\n <RaCalendarGridBody>\n {(date) => {\n const isToday = date.compare(todayDate) === 0;\n return (\n <RangeCalendarCellSlot asChild data-today={isToday}>\n <RaCalendarCell date={date} />\n </RangeCalendarCellSlot>\n );\n }}\n </RaCalendarGridBody>\n </RangeCalendarGridBodySlot>\n </RaCalendarGrid>\n </RangeCalendarGridSlot>\n </Box>\n );\n })}\n </RangeCalendarGridsSlot>\n );\n};\n","import {\n RangeCalendarContext,\n Heading,\n useSlottedContext,\n} from \"react-aria-components\";\nimport {\n Box,\n Flex,\n IconButton,\n Stack,\n Text,\n VisuallyHidden,\n} from \"@/components\";\nimport {\n KeyboardArrowLeft,\n KeyboardArrowRight,\n} from \"@commercetools/nimbus-icons\";\nimport { RangeCalendarHeaderSlot } from \"../range-calendar.slots\";\n\nexport const RangeCalendarHeader = () => {\n const rangeCalendarProps = useSlottedContext(RangeCalendarContext);\n\n // Needed to decide whether to show a single month or a range\n const visibleDurationMonths =\n rangeCalendarProps?.visibleDuration?.months || 1;\n const showRangeLabel = visibleDurationMonths > 1;\n\n return (\n <RangeCalendarHeaderSlot>\n <Flex>\n <Stack direction=\"row\" alignItems=\"center\">\n {/** solely for screen readers, if not present, a11y issues are raised */}\n <VisuallyHidden>\n <Heading />\n </VisuallyHidden>\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton\n slot={showRangeLabel ? \"previous\" : \"previous-month\"}\n size=\"xs\"\n variant=\"ghost\"\n tone=\"primary\"\n >\n <KeyboardArrowLeft />\n </IconButton>\n <Text\n textStyle=\"sm\"\n fontWeight=\"500\"\n color=\"neutral.11\"\n width={showRangeLabel ? \"4000\" : \"2000\"}\n textAlign=\"center\"\n aria-hidden=\"true\"\n slot={showRangeLabel ? \"monthRange\" : \"month\"}\n />\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton\n slot={showRangeLabel ? \"next\" : \"next-month\"}\n size=\"xs\"\n variant=\"ghost\"\n tone=\"primary\"\n >\n <KeyboardArrowRight />\n </IconButton>\n </Stack>\n <Box flexGrow=\"1\" />\n <Stack direction=\"row\" alignItems=\"center\">\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton\n slot=\"previous-year\"\n size=\"xs\"\n variant=\"ghost\"\n tone=\"primary\"\n >\n <KeyboardArrowLeft />\n </IconButton>\n <Text\n textStyle=\"sm\"\n fontWeight=\"500\"\n color=\"neutral.11\"\n width=\"1400\"\n textAlign=\"center\"\n aria-hidden=\"true\"\n slot=\"year\"\n />\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton slot=\"next-year\" size=\"xs\" variant=\"ghost\" tone=\"primary\">\n <KeyboardArrowRight />\n </IconButton>\n </Stack>\n </Flex>\n </RangeCalendarHeaderSlot>\n );\n};\n","import { getLocalTimeZone } from \"@internationalized/date\";\nimport { useContext } from \"react\";\nimport {\n Provider,\n ButtonContext,\n RangeCalendarStateContext,\n TextContext,\n useLocale,\n} from \"react-aria-components\";\n\nexport const RangeCalendarCustomContext = ({\n children,\n}: {\n children: React.ReactNode;\n}) => {\n const { locale } = useLocale();\n const buttonContext = useContext(ButtonContext)!;\n const textContext = useContext(TextContext)!;\n const calendarState = useContext(RangeCalendarStateContext)!;\n\n /**\n * Button slots\n * ================================\n */\n const buttonSlots = {\n \"next-month\": {\n onPress: () => calendarState.focusNextSection(),\n \"aria-label\": \"Next month\",\n },\n \"previous-month\": {\n onPress: () => calendarState.focusPreviousSection(),\n \"aria-label\": \"Previous month\",\n },\n \"next-year\": {\n onPress: () => calendarState.focusNextSection(true),\n \"aria-label\": \"Next year\",\n },\n \"previous-year\": {\n onPress: () => calendarState.focusPreviousSection(true),\n \"aria-label\": \"Previous year\",\n },\n };\n\n /**\n * Text slots\n * ================================\n */\n const monthLabel = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(calendarState.focusedDate.toDate(getLocalTimeZone()));\n\n const monthRangeLabel = [\n new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(calendarState.visibleRange.start.toDate(getLocalTimeZone())),\n new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(calendarState.visibleRange.end.toDate(getLocalTimeZone())),\n ].join(\" - \");\n\n const yearLabel = new Intl.DateTimeFormat(locale, {\n year: \"numeric\",\n }).format(calendarState.focusedDate.toDate(getLocalTimeZone()));\n\n const textSlots = {\n month: { children: monthLabel },\n monthRange: { children: monthRangeLabel },\n year: { children: yearLabel },\n };\n\n return (\n <Provider\n values={[\n [\n ButtonContext,\n {\n ...buttonContext,\n slots: {\n ...(buttonContext &&\n typeof buttonContext === \"object\" &&\n \"slots\" in buttonContext\n ? buttonContext.slots\n : {}),\n ...buttonSlots,\n },\n },\n ],\n [\n TextContext,\n {\n ...textContext,\n slots: {\n ...(textContext &&\n typeof textContext === \"object\" &&\n \"slots\" in textContext\n ? textContext.slots\n : {}),\n ...textSlots,\n },\n },\n ],\n ]}\n >\n {children}\n </Provider>\n );\n};\n","import type { RangeCalendarProps } from \"./range-calendar.types\";\nimport type { DateValue } from \"@internationalized/date\";\n\nimport { RangeCalendar as RaRangeCalendar } from \"react-aria-components\";\n\nimport { RangeCalendarRootSlot } from \"./range-calendar.slots\";\nimport { RangeCalendarGrids } from \"./components/range-calendar.grids\";\nimport { RangeCalendarHeader } from \"./components/range-calendar.header\";\nimport { rangeCalendarSlotRecipe } from \"./range-calendar.recipe\";\nimport { useRecipe } from \"@chakra-ui/react/styled-system\";\nimport { extractStyleProps } from \"@/utils/extractStyleProps\";\nimport { RangeCalendarCustomContext } from \"./components/range-calendar.custom-context\";\n\nexport const RangeCalendar = (props: RangeCalendarProps<DateValue>) => {\n const recipe = useRecipe({ recipe: rangeCalendarSlotRecipe });\n const [recipeProps, remainingProps] = recipe.splitVariantProps(props);\n const [styleProps, otherProps] = extractStyleProps(remainingProps);\n\n return (\n <RangeCalendarRootSlot {...recipeProps} {...styleProps} asChild>\n <RaRangeCalendar {...otherProps}>\n <RangeCalendarCustomContext>\n <RangeCalendarHeader />\n <RangeCalendarGrids />\n </RangeCalendarCustomContext>\n </RaRangeCalendar>\n </RangeCalendarRootSlot>\n );\n};\n"],"names":["withProvider","withContext","createSlotRecipeContext","RangeCalendarRootSlot","RangeCalendarHeaderSlot","RangeCalendarGridsSlot","RangeCalendarMonthTitleSlot","RangeCalendarGridSlot","RangeCalendarGridHeaderSlot","RangeCalendarHeaderCellSlot","RangeCalendarGridBodySlot","RangeCalendarCellSlot","RangeCalendarGrids","locale","useLocale","context","useSlottedContext","RangeCalendarContext","calendarState","useContext","RangeCalendarStateContext","visibleMonthsCount","todayDate","today","getLocalTimeZone","showMonthTitles","jsx","_","index","gridDate","monthName","jsxs","Box","RaCalendarGrid","RaCalendarGridHeader","day","RaCalendarHeaderCell","RaCalendarGridBody","date","isToday","RaCalendarCell","RangeCalendarHeader","showRangeLabel","Flex","Stack","VisuallyHidden","Heading","IconButton","KeyboardArrowLeft","Text","KeyboardArrowRight","RangeCalendarCustomContext","children","buttonContext","ButtonContext","textContext","TextContext","buttonSlots","monthLabel","monthRangeLabel","yearLabel","textSlots","Provider","RangeCalendar","props","recipe","useRecipe","rangeCalendarSlotRecipe","recipeProps","remainingProps","styleProps","otherProps","extractStyleProps","RaRangeCalendar"],"mappings":"+vBAUM,CAAE,aAAAA,EAAc,YAAAC,CAAA,EAAgBC,0BAAwB,CAC5D,IAAK,eACP,CAAC,EAQYC,EAAwBH,EAGnC,MAAO,MAAM,EAGFI,EAA0BH,EAGrC,MAAO,QAAQ,EAGJI,EAAyBJ,EAGpC,MAAO,OAAO,EAIHK,EAA8BL,EAGzC,MAAO,YAAY,EAGRM,EAAwBN,EAGnC,QAAS,MAAM,EAIJO,EAA8BP,EAGzC,QAAS,YAAY,EAIVQ,EAA8BR,EAGzC,KAAM,YAAY,EAIPS,EAA4BT,EAGvC,QAAS,UAAU,EAGRU,EAAwBV,EAGnC,KAAM,UAAU,EClDLW,EAAqB,IAAM,CACtC,KAAM,CAAE,OAAAC,CAAA,EAAWC,4CAAA,EACbC,EAAUC,EAAAA,0CAAkBC,2CAAoB,EAEhDC,EAAgBC,EAAAA,WAAWC,2CAAyB,EACpDC,EAAqBN,GAAS,iBAAiB,QAAU,EACzDO,EAAYC,4CAAMC,EAAAA,2CAAkB,EACpCC,EAAkBJ,EAAqB,EA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G9B,OACElC,EAAAA,IAACoC,EAAAA,0CAAA,CACC,OAAQ,CACN,CACER,EAAAA,0CACA,CACE,GAAGD,EACH,MAAO,CACL,GAAIA,GACJ,OAAOA,GAAkB,UACzB,UAAWA,EACPA,EAAc,MACd,CAAA,EACJ,GAAGI,CAAA,CACL,CACF,EAEF,CACED,EAAAA,0CACA,CACE,GAAGD,EACH,MAAO,CACL,GAAIA,GACJ,OAAOA,GAAgB,UACvB,UAAWA,EACPA,EAAY,MACZ,CAAA,EACJ,GAAGM,CAAA,CACL,CACF,CACF,EAGD,SAAAT,CAAA,CAAA,CAGP,EC7FaW,EAAiBC,GAAyC,CACrE,MAAMC,EAASC,EAAAA,UAAU,CAAE,OAAQC,EAAAA,wBAAyB,EACtD,CAACC,EAAaC,CAAc,EAAIJ,EAAO,kBAAkBD,CAAK,EAC9D,CAACM,EAAYC,CAAU,EAAIC,EAAAA,kBAAkBH,CAAc,EAEjE,OACE3C,EAAAA,IAACvB,EAAA,CAAuB,GAAGiE,EAAc,GAAGE,EAAY,QAAO,GAC7D,SAAA5C,EAAAA,IAAC+C,EAAAA,0CAAA,CAAiB,GAAGF,EACnB,gBAACpB,EAAA,CACC,SAAA,CAAAzB,EAAAA,IAACe,EAAA,EAAoB,QACpB7B,EAAA,CAAA,CAAmB,CAAA,CAAA,CACtB,EACF,EACF,CAEJ"}
1
+ {"version":3,"file":"range-calendar-CswayeNh.cjs.js","sources":["../../src/components/range-calendar/range-calendar.slots.tsx","../../src/components/range-calendar/components/range-calendar.grids.tsx","../../src/components/range-calendar/components/range-calendar.header.tsx","../../src/components/range-calendar/components/range-calendar.custom-context.tsx","../../src/components/range-calendar/range-calendar.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\nimport {\n createSlotRecipeContext,\n type HTMLChakraProps,\n type RecipeVariantProps,\n} from \"@chakra-ui/react/styled-system\";\nimport { rangeCalendarSlotRecipe } from \"./range-calendar.recipe\";\nimport type { RangeCalendarProps } from \"react-aria-components\";\nimport type { DateValue } from \"@internationalized/date\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n key: \"rangeCalendar\",\n});\n\nexport interface RangeCalendarRootSlotProps\n extends HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof rangeCalendarSlotRecipe> &\n RangeCalendarProps<DateValue>\n > {}\nexport const RangeCalendarRootSlot = withProvider<\n HTMLDivElement,\n RangeCalendarRootSlotProps\n>(\"div\", \"root\");\n\nexport interface RangeCalendarHeaderSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const RangeCalendarHeaderSlot = withContext<\n HTMLDivElement,\n RangeCalendarHeaderSlotProps\n>(\"div\", \"header\");\n\nexport interface RangeCalendarGridsSlotProps extends HTMLChakraProps<\"div\"> {}\nexport const RangeCalendarGridsSlot = withContext<\n HTMLDivElement,\n RangeCalendarGridsSlotProps\n>(\"div\", \"grids\");\n\nexport interface RangeCalendarMonthTitleSlotProps\n extends HTMLChakraProps<\"div\"> {}\nexport const RangeCalendarMonthTitleSlot = withContext<\n HTMLDivElement,\n RangeCalendarMonthTitleSlotProps\n>(\"div\", \"monthTitle\");\n\nexport interface RangeCalendarGridSlotProps extends HTMLChakraProps<\"table\"> {}\nexport const RangeCalendarGridSlot = withContext<\n HTMLTableElement,\n RangeCalendarGridSlotProps\n>(\"table\", \"grid\");\n\nexport interface RangeCalendarGridHeaderSlotProps\n extends HTMLChakraProps<\"thead\"> {}\nexport const RangeCalendarGridHeaderSlot = withContext<\n HTMLTableSectionElement,\n RangeCalendarGridHeaderSlotProps\n>(\"thead\", \"gridHeader\");\n\nexport interface RangeCalendarHeaderCellSlotProps\n extends HTMLChakraProps<\"th\"> {}\nexport const RangeCalendarHeaderCellSlot = withContext<\n HTMLTableCellElement,\n RangeCalendarHeaderCellSlotProps\n>(\"th\", \"headerCell\");\n\nexport interface RangeCalendarGridBodySlotProps\n extends HTMLChakraProps<\"tbody\"> {}\nexport const RangeCalendarGridBodySlot = withContext<\n HTMLTableSectionElement,\n RangeCalendarGridBodySlotProps\n>(\"tbody\", \"gridBody\");\n\nexport interface RangeCalendarCellSlotProps extends HTMLChakraProps<\"td\"> {}\nexport const RangeCalendarCellSlot = withContext<\n HTMLTableCellElement,\n RangeCalendarCellSlotProps\n>(\"td\", \"bodyCell\");\n","import { useContext } from \"react\";\nimport { today, getLocalTimeZone } from \"@internationalized/date\";\nimport {\n CalendarGrid as RaCalendarGrid,\n CalendarGridBody as RaCalendarGridBody,\n CalendarGridHeader as RaCalendarGridHeader,\n CalendarHeaderCell as RaCalendarHeaderCell,\n CalendarCell as RaCalendarCell,\n useSlottedContext,\n RangeCalendarContext,\n RangeCalendarStateContext,\n useLocale,\n} from \"react-aria-components\";\nimport { Box } from \"@/components\";\n\nimport {\n RangeCalendarCellSlot,\n RangeCalendarGridBodySlot,\n RangeCalendarGridHeaderSlot,\n RangeCalendarGridsSlot,\n RangeCalendarGridSlot,\n RangeCalendarHeaderCellSlot,\n RangeCalendarMonthTitleSlot,\n} from \"../range-calendar.slots\";\n\nexport const RangeCalendarGrids = () => {\n const { locale } = useLocale();\n const context = useSlottedContext(RangeCalendarContext);\n\n const calendarState = useContext(RangeCalendarStateContext)!;\n const visibleMonthsCount = context?.visibleDuration?.months || 1;\n const todayDate = today(getLocalTimeZone());\n const showMonthTitles = visibleMonthsCount > 1;\n\n return (\n <RangeCalendarGridsSlot>\n {Array.from({ length: visibleMonthsCount }, (_, index) => {\n const gridDate = calendarState.visibleRange.start.add({\n months: index,\n });\n const monthName = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(gridDate.toDate(getLocalTimeZone()));\n\n return (\n <Box\n key={monthName}\n width={visibleMonthsCount == 1 ? \"full\" : \"auto\"}\n >\n {showMonthTitles && (\n <RangeCalendarMonthTitleSlot>\n {monthName}\n </RangeCalendarMonthTitleSlot>\n )}\n <RangeCalendarGridSlot asChild>\n <RaCalendarGrid offset={{ months: index }} weekdayStyle=\"short\">\n <RangeCalendarGridHeaderSlot asChild>\n <RaCalendarGridHeader>\n {(day) => (\n <RangeCalendarHeaderCellSlot asChild>\n <RaCalendarHeaderCell>{day}</RaCalendarHeaderCell>\n </RangeCalendarHeaderCellSlot>\n )}\n </RaCalendarGridHeader>\n </RangeCalendarGridHeaderSlot>\n <RangeCalendarGridBodySlot asChild>\n <RaCalendarGridBody>\n {(date) => {\n const isToday = date.compare(todayDate) === 0;\n return (\n <RangeCalendarCellSlot asChild data-today={isToday}>\n <RaCalendarCell date={date} />\n </RangeCalendarCellSlot>\n );\n }}\n </RaCalendarGridBody>\n </RangeCalendarGridBodySlot>\n </RaCalendarGrid>\n </RangeCalendarGridSlot>\n </Box>\n );\n })}\n </RangeCalendarGridsSlot>\n );\n};\n","import {\n RangeCalendarContext,\n Heading,\n useSlottedContext,\n} from \"react-aria-components\";\nimport {\n Box,\n Flex,\n IconButton,\n Stack,\n Text,\n VisuallyHidden,\n} from \"@/components\";\nimport {\n KeyboardArrowLeft,\n KeyboardArrowRight,\n} from \"@commercetools/nimbus-icons\";\nimport { RangeCalendarHeaderSlot } from \"../range-calendar.slots\";\n\nexport const RangeCalendarHeader = () => {\n const rangeCalendarProps = useSlottedContext(RangeCalendarContext);\n\n // Needed to decide whether to show a single month or a range\n const visibleDurationMonths =\n rangeCalendarProps?.visibleDuration?.months || 1;\n const showRangeLabel = visibleDurationMonths > 1;\n\n return (\n <RangeCalendarHeaderSlot>\n <Flex>\n <Stack direction=\"row\" alignItems=\"center\">\n {/** solely for screen readers, if not present, a11y issues are raised */}\n <VisuallyHidden>\n <Heading />\n </VisuallyHidden>\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton\n slot={showRangeLabel ? \"previous\" : \"previous-month\"}\n size=\"xs\"\n variant=\"ghost\"\n tone=\"primary\"\n >\n <KeyboardArrowLeft />\n </IconButton>\n <Text\n textStyle=\"sm\"\n fontWeight=\"500\"\n color=\"neutral.11\"\n width={showRangeLabel ? \"4000\" : \"2000\"}\n textAlign=\"center\"\n aria-hidden=\"true\"\n slot={showRangeLabel ? \"monthRange\" : \"month\"}\n />\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton\n slot={showRangeLabel ? \"next\" : \"next-month\"}\n size=\"xs\"\n variant=\"ghost\"\n tone=\"primary\"\n >\n <KeyboardArrowRight />\n </IconButton>\n </Stack>\n <Box flexGrow=\"1\" />\n <Stack direction=\"row\" alignItems=\"center\">\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton\n slot=\"previous-year\"\n size=\"xs\"\n variant=\"ghost\"\n tone=\"primary\"\n >\n <KeyboardArrowLeft />\n </IconButton>\n <Text\n textStyle=\"sm\"\n fontWeight=\"500\"\n color=\"neutral.11\"\n width=\"1400\"\n textAlign=\"center\"\n aria-hidden=\"true\"\n slot=\"year\"\n />\n {/* @ts-expect-error - custom-context will add aria-label via the \"slot\" prop */}\n <IconButton slot=\"next-year\" size=\"xs\" variant=\"ghost\" tone=\"primary\">\n <KeyboardArrowRight />\n </IconButton>\n </Stack>\n </Flex>\n </RangeCalendarHeaderSlot>\n );\n};\n","import { getLocalTimeZone } from \"@internationalized/date\";\nimport { useContext } from \"react\";\nimport {\n Provider,\n ButtonContext,\n RangeCalendarStateContext,\n TextContext,\n useLocale,\n} from \"react-aria-components\";\n\nexport const RangeCalendarCustomContext = ({\n children,\n}: {\n children: React.ReactNode;\n}) => {\n const { locale } = useLocale();\n const buttonContext = useContext(ButtonContext)!;\n const textContext = useContext(TextContext)!;\n const calendarState = useContext(RangeCalendarStateContext)!;\n\n /**\n * Button slots\n * ================================\n */\n const buttonSlots = {\n \"next-month\": {\n onPress: () => calendarState.focusNextSection(),\n \"aria-label\": \"Next month\",\n },\n \"previous-month\": {\n onPress: () => calendarState.focusPreviousSection(),\n \"aria-label\": \"Previous month\",\n },\n \"next-year\": {\n onPress: () => calendarState.focusNextSection(true),\n \"aria-label\": \"Next year\",\n },\n \"previous-year\": {\n onPress: () => calendarState.focusPreviousSection(true),\n \"aria-label\": \"Previous year\",\n },\n };\n\n /**\n * Text slots\n * ================================\n */\n const monthLabel = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(calendarState.focusedDate.toDate(getLocalTimeZone()));\n\n const monthRangeLabel = [\n new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(calendarState.visibleRange.start.toDate(getLocalTimeZone())),\n new Intl.DateTimeFormat(locale, {\n month: \"long\",\n }).format(calendarState.visibleRange.end.toDate(getLocalTimeZone())),\n ].join(\" - \");\n\n const yearLabel = new Intl.DateTimeFormat(locale, {\n year: \"numeric\",\n }).format(calendarState.focusedDate.toDate(getLocalTimeZone()));\n\n const textSlots = {\n month: { children: monthLabel },\n monthRange: { children: monthRangeLabel },\n year: { children: yearLabel },\n };\n\n return (\n <Provider\n values={[\n [\n ButtonContext,\n {\n ...buttonContext,\n slots: {\n ...(buttonContext &&\n typeof buttonContext === \"object\" &&\n \"slots\" in buttonContext\n ? buttonContext.slots\n : {}),\n ...buttonSlots,\n },\n },\n ],\n [\n TextContext,\n {\n ...textContext,\n slots: {\n ...(textContext &&\n typeof textContext === \"object\" &&\n \"slots\" in textContext\n ? textContext.slots\n : {}),\n ...textSlots,\n },\n },\n ],\n ]}\n >\n {children}\n </Provider>\n );\n};\n","import type { RangeCalendarProps } from \"./range-calendar.types\";\nimport type { DateValue } from \"@internationalized/date\";\n\nimport { RangeCalendar as RaRangeCalendar } from \"react-aria-components\";\n\nimport { RangeCalendarRootSlot } from \"./range-calendar.slots\";\nimport { RangeCalendarGrids } from \"./components/range-calendar.grids\";\nimport { RangeCalendarHeader } from \"./components/range-calendar.header\";\nimport { rangeCalendarSlotRecipe } from \"./range-calendar.recipe\";\nimport { useRecipe } from \"@chakra-ui/react/styled-system\";\nimport { extractStyleProps } from \"@/utils/extractStyleProps\";\nimport { RangeCalendarCustomContext } from \"./components/range-calendar.custom-context\";\n\nexport const RangeCalendar = (props: RangeCalendarProps<DateValue>) => {\n const recipe = useRecipe({ recipe: rangeCalendarSlotRecipe });\n const [recipeProps, remainingProps] = recipe.splitVariantProps(props);\n const [styleProps, otherProps] = extractStyleProps(remainingProps);\n\n return (\n <RangeCalendarRootSlot {...recipeProps} {...styleProps} asChild>\n <RaRangeCalendar {...otherProps}>\n <RangeCalendarCustomContext>\n <RangeCalendarHeader />\n <RangeCalendarGrids />\n </RangeCalendarCustomContext>\n </RaRangeCalendar>\n </RangeCalendarRootSlot>\n );\n};\n"],"names":["withProvider","withContext","createSlotRecipeContext","RangeCalendarRootSlot","RangeCalendarHeaderSlot","RangeCalendarGridsSlot","RangeCalendarMonthTitleSlot","RangeCalendarGridSlot","RangeCalendarGridHeaderSlot","RangeCalendarHeaderCellSlot","RangeCalendarGridBodySlot","RangeCalendarCellSlot","RangeCalendarGrids","locale","useLocale","context","useSlottedContext","RangeCalendarContext","calendarState","useContext","RangeCalendarStateContext","visibleMonthsCount","todayDate","today","getLocalTimeZone","showMonthTitles","jsx","_","index","gridDate","monthName","jsxs","Box","RaCalendarGrid","RaCalendarGridHeader","day","RaCalendarHeaderCell","RaCalendarGridBody","date","isToday","RaCalendarCell","RangeCalendarHeader","showRangeLabel","Flex","Stack","VisuallyHidden","Heading","IconButton","KeyboardArrowLeft","Text","KeyboardArrowRight","RangeCalendarCustomContext","children","buttonContext","ButtonContext","textContext","TextContext","buttonSlots","monthLabel","monthRangeLabel","yearLabel","textSlots","Provider","RangeCalendar","props","recipe","useRecipe","rangeCalendarSlotRecipe","recipeProps","remainingProps","styleProps","otherProps","extractStyleProps","RaRangeCalendar"],"mappings":"+vBAUM,CAAE,aAAAA,EAAc,YAAAC,CAAA,EAAgBC,0BAAwB,CAC5D,IAAK,eACP,CAAC,EAQYC,EAAwBH,EAGnC,MAAO,MAAM,EAGFI,EAA0BH,EAGrC,MAAO,QAAQ,EAGJI,EAAyBJ,EAGpC,MAAO,OAAO,EAIHK,EAA8BL,EAGzC,MAAO,YAAY,EAGRM,EAAwBN,EAGnC,QAAS,MAAM,EAIJO,EAA8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@ import { EDITOR_DEFAULTS as I, textStyles as Pe } from "../components/constants.
8
8
  import { B as b } from "./box-C8731OYq.es.js";
9
9
  import { D as X } from "./divider-CpctZ_-U.es.js";
10
10
  import { G as J } from "./group-BQeamedA.es.js";
11
- import { I as k } from "./icon-button-O_dSWgZr.es.js";
11
+ import { I as k } from "./icon-button-a3WVC7IH.es.js";
12
12
  import { I as R } from "./icon-toggle-button-sFqCJEvI.es.js";
13
13
  import { T as v } from "./text-B2wziCK6.es.js";
14
14
  import { b as d } from "./tooltip-BOK0Uejw.es.js";
@@ -688,4 +688,4 @@ $e.displayName = "RichTextInput";
688
688
  export {
689
689
  $e as R
690
690
  };
691
- //# sourceMappingURL=rich-text-input-D3xrDvLR.es.js.map
691
+ //# sourceMappingURL=rich-text-input-Bty0WhBM.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text-input-D3xrDvLR.es.js","sources":["../../src/components/rich-text-input/rich-text-input.recipe.tsx","../../src/components/rich-text-input/rich-text-input.slots.tsx","../../../../node_modules/.pnpm/slate-history@0.113.1_slate@0.75.0/node_modules/slate-history/dist/index.es.js","../../src/components/rich-text-input/components/rich-text-editor.tsx","../../src/components/rich-text-input/components/formatting-menu.tsx","../../src/components/rich-text-input/components/rich-text-toolbar.tsx","../../src/components/rich-text-input/rich-text-input.tsx"],"sourcesContent":["import { defineSlotRecipe } from \"@chakra-ui/react\";\n\nexport const richTextInputRecipe = defineSlotRecipe({\n slots: [\"root\", \"toolbar\", \"editable\"],\n className: \"nimbus-rich-text-input\",\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n position: \"relative\",\n width: \"full\",\n borderRadius: \"200\",\n borderWidth: \"{sizes.25}\",\n colorPalette: \"slate\",\n borderColor: \"colorPalette.7\",\n backgroundColor: \"colorPalette.contrast\",\n\n // Invalid state styling\n \"&[data-invalid='true']\": {\n borderWidth: \"{sizes.50}\",\n borderColor: \"critical.7\",\n },\n },\n toolbar: {\n boxShadow: \"1\",\n\n // Disabled state styling for toolbar\n \"[data-disabled='true'] &\": {\n opacity: \"0.5\",\n },\n },\n editable: {\n padding: \"400\",\n minHeight: \"inherit\",\n outline: \"none\",\n\n // Disabled state styling for editable\n \"[data-disabled='true'] &\": {\n cursor: \"not-allowed\",\n opacity: \"0.5\",\n },\n\n // Styling for user-facing editor text\n \"& p\": {\n textStyle: \"md\",\n fontWeight: \"500\",\n },\n \"& h1\": {\n textStyle: \"2xl\",\n fontWeight: \"500\",\n },\n \"& h2\": {\n textStyle: \"xl\",\n fontWeight: \"500\",\n },\n \"& h3\": {\n textStyle: \"lg\",\n fontWeight: \"500\",\n },\n \"& h4\": {\n textStyle: \"md\",\n fontWeight: \"500\",\n },\n \"& h5\": {\n textStyle: \"xs\",\n fontWeight: \"500\",\n },\n \"& blockquote\": {\n textStyle: \"md\",\n fontWeight: \"400\",\n borderLeftWidth: \"{sizes.100}\",\n paddingLeft: \"400\",\n },\n \"& ul\": {\n paddingLeft: \"600\",\n listStyleType: \"disc\",\n },\n \"& ol\": {\n paddingLeft: \"600\",\n listStyleType: \"decimal\",\n },\n \"& code\": {\n padding: \"100\",\n fontFamily: \"mono\",\n },\n \"& pre\": {\n padding: \"300\",\n borderRadius: \"200\",\n overflow: \"auto\",\n \"& code\": {\n padding: \"0\",\n },\n },\n \"& a\": {\n color: \"primary.11\",\n textDecoration: \"underline\",\n cursor: \"pointer\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n \"& strong\": {\n fontWeight: \"700\",\n },\n \"& em\": {\n fontStyle: \"italic\",\n },\n \"& u\": {\n textDecoration: \"underline\",\n },\n \"& del\": {\n textDecoration: \"line-through\",\n },\n \"& sup\": {\n fontSize: \"75%\",\n verticalAlign: \"super\",\n lineHeight: \"0\",\n },\n \"& sub\": {\n fontSize: \"75%\",\n verticalAlign: \"sub\",\n lineHeight: \"0\",\n },\n },\n },\n variants: {},\n});\n","import {\n type HTMLChakraProps,\n type RecipeVariantProps,\n type UnstyledProp,\n createSlotRecipeContext,\n} from \"@chakra-ui/react\";\nimport { richTextInputRecipe } from \"./rich-text-input.recipe\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n recipe: richTextInputRecipe,\n});\n\n// Root slot\nexport type RichTextInputRootSlotProps = HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof richTextInputRecipe> & UnstyledProp\n>;\n\nexport const RichTextInputRootSlot = withProvider<\n HTMLDivElement,\n RichTextInputRootSlotProps\n>(\"div\", \"root\");\n\n// Toolbar slot\nexport type RichTextInputToolbarSlotProps = HTMLChakraProps<\"div\">;\n\nexport const RichTextInputToolbarSlot = withContext<\n HTMLDivElement,\n RichTextInputToolbarSlotProps\n>(\"div\", \"toolbar\");\n\n// Editable slot\nexport type RichTextInputEditableSlotProps = HTMLChakraProps<\"div\">;\nexport const RichTextInputEditableSlot = withContext<\n HTMLDivElement,\n RichTextInputEditableSlotProps\n>(\"div\", \"editable\");\n","import { isPlainObject } from 'is-plain-object';\nimport { Operation, Editor, Transforms, Path } from 'slate';\n\n// eslint-disable-next-line no-redeclare\nvar History = {\n /**\n * Check if a value is a `History` object.\n */\n isHistory(value) {\n return isPlainObject(value) && Array.isArray(value.redos) && Array.isArray(value.undos) && (value.redos.length === 0 || Operation.isOperationList(value.redos[0].operations)) && (value.undos.length === 0 || Operation.isOperationList(value.undos[0].operations));\n }\n};\n\n/**\n * Weakmaps for attaching state to the editor.\n */\nvar HISTORY = new WeakMap();\nvar SAVING = new WeakMap();\nvar MERGING = new WeakMap();\nvar SPLITTING_ONCE = new WeakMap();\n// eslint-disable-next-line no-redeclare\nvar HistoryEditor = {\n /**\n * Check if a value is a `HistoryEditor` object.\n */\n isHistoryEditor(value) {\n return History.isHistory(value.history) && Editor.isEditor(value);\n },\n /**\n * Get the merge flag's current value.\n */\n isMerging(editor) {\n return MERGING.get(editor);\n },\n /**\n * Get the splitting once flag's current value.\n */\n isSplittingOnce(editor) {\n return SPLITTING_ONCE.get(editor);\n },\n setSplittingOnce(editor, value) {\n SPLITTING_ONCE.set(editor, value);\n },\n /**\n * Get the saving flag's current value.\n */\n isSaving(editor) {\n return SAVING.get(editor);\n },\n /**\n * Redo to the previous saved state.\n */\n redo(editor) {\n editor.redo();\n },\n /**\n * Undo to the previous saved state.\n */\n undo(editor) {\n editor.undo();\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, These operations will\n * be merged into the previous history.\n */\n withMerging(editor, fn) {\n var prev = HistoryEditor.isMerging(editor);\n MERGING.set(editor, true);\n fn();\n MERGING.set(editor, prev);\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, ensuring that the first\n * operation starts a new batch in the history. Subsequent operations will be\n * merged as usual.\n */\n withNewBatch(editor, fn) {\n var prev = HistoryEditor.isMerging(editor);\n MERGING.set(editor, true);\n SPLITTING_ONCE.set(editor, true);\n fn();\n MERGING.set(editor, prev);\n SPLITTING_ONCE.delete(editor);\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, without merging any of\n * the new operations into previous save point in the history.\n */\n withoutMerging(editor, fn) {\n var prev = HistoryEditor.isMerging(editor);\n MERGING.set(editor, false);\n fn();\n MERGING.set(editor, prev);\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, without saving any of\n * their operations into the history.\n */\n withoutSaving(editor, fn) {\n var prev = HistoryEditor.isSaving(editor);\n SAVING.set(editor, false);\n try {\n fn();\n } finally {\n SAVING.set(editor, prev);\n }\n }\n};\n\n/**\n * The `withHistory` plugin keeps track of the operation history of a Slate\n * editor as operations are applied to it, using undo and redo stacks.\n *\n * If you are using TypeScript, you must extend Slate's CustomTypes to use\n * this plugin.\n *\n * See https://docs.slatejs.org/concepts/11-typescript to learn how.\n */\nvar withHistory = editor => {\n var e = editor;\n var {\n apply\n } = e;\n e.history = {\n undos: [],\n redos: []\n };\n e.redo = () => {\n var {\n history\n } = e;\n var {\n redos\n } = history;\n if (redos.length > 0) {\n var batch = redos[redos.length - 1];\n if (batch.selectionBefore) {\n Transforms.setSelection(e, batch.selectionBefore);\n }\n HistoryEditor.withoutSaving(e, () => {\n Editor.withoutNormalizing(e, () => {\n for (var op of batch.operations) {\n e.apply(op);\n }\n });\n });\n history.redos.pop();\n e.writeHistory('undos', batch);\n }\n };\n e.undo = () => {\n var {\n history\n } = e;\n var {\n undos\n } = history;\n if (undos.length > 0) {\n var batch = undos[undos.length - 1];\n HistoryEditor.withoutSaving(e, () => {\n Editor.withoutNormalizing(e, () => {\n var inverseOps = batch.operations.map(Operation.inverse).reverse();\n for (var op of inverseOps) {\n e.apply(op);\n }\n if (batch.selectionBefore) {\n Transforms.setSelection(e, batch.selectionBefore);\n }\n });\n });\n e.writeHistory('redos', batch);\n history.undos.pop();\n }\n };\n e.apply = op => {\n var {\n operations,\n history\n } = e;\n var {\n undos\n } = history;\n var lastBatch = undos[undos.length - 1];\n var lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];\n var save = HistoryEditor.isSaving(e);\n var merge = HistoryEditor.isMerging(e);\n if (save == null) {\n save = shouldSave(op);\n }\n if (save) {\n if (merge == null) {\n if (lastBatch == null) {\n merge = false;\n } else if (operations.length !== 0) {\n merge = true;\n } else {\n merge = shouldMerge(op, lastOp);\n }\n }\n if (HistoryEditor.isSplittingOnce(e)) {\n merge = false;\n HistoryEditor.setSplittingOnce(e, undefined);\n }\n if (lastBatch && merge) {\n lastBatch.operations.push(op);\n } else {\n var batch = {\n operations: [op],\n selectionBefore: e.selection\n };\n e.writeHistory('undos', batch);\n }\n while (undos.length > 100) {\n undos.shift();\n }\n history.redos = [];\n }\n apply(op);\n };\n e.writeHistory = (stack, batch) => {\n e.history[stack].push(batch);\n };\n return e;\n};\n/**\n * Check whether to merge an operation into the previous operation.\n */\nvar shouldMerge = (op, prev) => {\n if (prev && op.type === 'insert_text' && prev.type === 'insert_text' && op.offset === prev.offset + prev.text.length && Path.equals(op.path, prev.path)) {\n return true;\n }\n if (prev && op.type === 'remove_text' && prev.type === 'remove_text' && op.offset + op.text.length === prev.offset && Path.equals(op.path, prev.path)) {\n return true;\n }\n return false;\n};\n/**\n * Check whether an operation needs to be saved to the history.\n */\nvar shouldSave = (op, prev) => {\n if (op.type === 'set_selection') {\n return false;\n }\n return true;\n};\n\nexport { HISTORY, History, HistoryEditor, MERGING, SAVING, SPLITTING_ONCE, withHistory };\n//# sourceMappingURL=index.es.js.map\n","import {\n useMemo,\n useCallback,\n useImperativeHandle,\n forwardRef,\n type ForwardedRef,\n type FocusEventHandler,\n type ReactNode,\n} from \"react\";\nimport { createEditor, type Descendant } from \"slate\";\nimport { Slate, Editable, withReact } from \"slate-react\";\nimport { withHistory } from \"slate-history\";\nimport {\n RichTextInputEditableSlot,\n RichTextInputToolbarSlot,\n} from \"../rich-text-input.slots\";\nimport {\n Element,\n Leaf,\n withLinks,\n focusEditor,\n resetEditor,\n} from \"../utils/slate-helpers\";\nimport { createEmptyValue } from \"../utils/html-serialization\";\nimport { useKeyboardShortcuts } from \"../hooks/use-keyboard-shortcuts\";\nimport { EDITOR_DEFAULTS } from \"../constants\";\n\nexport interface RichTextEditorProps {\n value?: Descendant[];\n onChange: (value: Descendant[]) => void;\n onFocus?: FocusEventHandler<HTMLDivElement>;\n onBlur?: FocusEventHandler<HTMLDivElement>;\n placeholder?: string;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n autoFocus?: boolean;\n toolbar?: ReactNode;\n}\n\nexport interface RichTextEditorRef {\n focus: () => void;\n resetValue: (html: string) => void;\n}\n\nexport const RichTextEditor = forwardRef<\n RichTextEditorRef,\n RichTextEditorProps\n>((props, forwardedRef: ForwardedRef<RichTextEditorRef>) => {\n const {\n value,\n onChange,\n onFocus,\n onBlur,\n placeholder = EDITOR_DEFAULTS.placeholder,\n isDisabled = EDITOR_DEFAULTS.isDisabled,\n isReadOnly = EDITOR_DEFAULTS.isReadOnly,\n autoFocus = EDITOR_DEFAULTS.autoFocus,\n toolbar,\n } = props;\n\n // Create editor with plugins\n const editor = useMemo(() => {\n const baseEditor = createEditor();\n return withLinks(withHistory(withReact(baseEditor)));\n }, []);\n\n // Handle keyboard shortcuts using hook\n const { handleKeyDown } = useKeyboardShortcuts({ editor });\n\n // Handle focus\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (onFocus) {\n onFocus(event);\n }\n },\n [onFocus]\n );\n\n // Handle blur\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (onBlur) {\n onBlur(event);\n }\n },\n [onBlur]\n );\n\n // Expose methods through ref\n useImperativeHandle(\n forwardedRef,\n () => ({\n focus: () => focusEditor(editor),\n resetValue: (html: string) => resetEditor(editor, html),\n }),\n [editor]\n );\n\n // Render element\n const renderElement = useCallback(\n (props: Parameters<typeof Element>[0]) => <Element {...props} />,\n []\n );\n\n // Render leaf\n const renderLeaf = useCallback(\n (props: Parameters<typeof Leaf>[0]) => <Leaf {...props} />,\n []\n );\n\n // Ensure we always have a valid value\n const defaultValue = createEmptyValue();\n const safeInitialValue =\n Array.isArray(value) && value.length > 0 ? value : defaultValue;\n\n return (\n <Slate editor={editor} value={safeInitialValue} onChange={onChange}>\n {toolbar && (\n <RichTextInputToolbarSlot>{toolbar}</RichTextInputToolbarSlot>\n )}\n <RichTextInputEditableSlot asChild>\n <Editable\n renderElement={renderElement}\n renderLeaf={renderLeaf}\n placeholder={placeholder}\n autoFocus={autoFocus}\n readOnly={isReadOnly || isDisabled}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-label=\"Rich text editor\"\n role=\"textbox\"\n aria-multiline=\"true\"\n />\n </RichTextInputEditableSlot>\n </Slate>\n );\n});\n\nRichTextEditor.displayName = \"RichTextEditor\";\n","import { useSlate } from \"slate-react\";\nimport { Menu, IconButton, Text, Box, Tooltip } from \"@/components\";\nimport {\n MoreHoriz,\n FormatStrikethrough,\n Code,\n} from \"@commercetools/nimbus-icons\";\nimport { usePreservedSelection } from \"../hooks/use-preserved-selection\";\nimport { useFormattingState } from \"../hooks/use-formatting-state\";\n\nexport interface FormattingMenuProps {\n isDisabled?: boolean;\n}\n\nexport const FormattingMenu = ({ isDisabled = false }: FormattingMenuProps) => {\n const editor = useSlate();\n const withPreservedSelection = usePreservedSelection(editor);\n\n // Use the formatting state hook for all state management\n const { allSelectedKeys, handleAllSelectionChange } = useFormattingState({\n withPreservedSelection,\n });\n\n return (\n <Menu.Root\n selectionMode=\"multiple\"\n selectedKeys={allSelectedKeys}\n onSelectionChange={handleAllSelectionChange}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n <Menu.Trigger asChild>\n <IconButton\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"More formatting options\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n >\n <MoreHoriz />\n </IconButton>\n </Menu.Trigger>\n <Tooltip.Content placement=\"top\">More styles</Tooltip.Content>\n </Tooltip.Root>\n <Menu.Content>\n <Menu.Item id=\"strikethrough\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <FormatStrikethrough />\n <Text textStyle=\"sm\">Strikethrough</Text>\n </Box>\n </Menu.Item>\n <Menu.Item id=\"code\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <Code />\n <Text textStyle=\"sm\">Code</Text>\n </Box>\n </Menu.Item>\n <Menu.Item id=\"superscript\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <Text>X²</Text>\n <Text textStyle=\"sm\">Superscript</Text>\n </Box>\n </Menu.Item>\n <Menu.Item id=\"subscript\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <Text>X₂</Text>\n <Text textStyle=\"sm\">Subscript</Text>\n </Box>\n </Menu.Item>\n </Menu.Content>\n </Menu.Root>\n );\n};\n","import { useSlate } from \"slate-react\";\nimport {\n Toolbar,\n Menu,\n VisuallyHidden,\n Divider,\n ToggleButtonGroup,\n IconToggleButton,\n IconButton,\n Text,\n Box,\n Tooltip,\n} from \"@/components\";\nimport { Group } from \"@/components/group\";\nimport {\n FormatBold,\n FormatItalic,\n FormatUnderlined,\n FormatListBulleted,\n FormatListNumbered,\n KeyboardArrowDown,\n Undo,\n Redo,\n} from \"@commercetools/nimbus-icons\";\nimport { toggleMark } from \"../utils/slate-helpers\";\nimport { usePreservedSelection } from \"../hooks/use-preserved-selection\";\nimport { useToolbarState } from \"../hooks/use-toolbar-state\";\nimport { textStyles } from \"../constants\";\nimport { FormattingMenu } from \"./formatting-menu\";\n\nexport interface RichTextToolbarProps {\n isDisabled?: boolean;\n}\n\nexport const RichTextToolbar = ({\n isDisabled = false,\n}: RichTextToolbarProps) => {\n const editor = useSlate();\n const withPreservedSelection = usePreservedSelection(editor);\n\n // Use the toolbar state hook for all state management\n const {\n currentTextStyle,\n selectedTextStyleLabel,\n handleTextStyleChange,\n handleListToggle,\n selectedFormatKeys,\n selectedListKeys,\n hasUndos,\n hasRedos,\n } = useToolbarState({ withPreservedSelection });\n\n return (\n <Toolbar\n orientation=\"horizontal\"\n aria-label=\"Text formatting\"\n width=\"full\"\n overflow=\"hidden\"\n size=\"xs\"\n >\n {/* Text Style Menu */}\n <Group>\n <Menu.Root\n onAction={(styleId) => handleTextStyleChange(String(styleId))}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n {/* Menu trigger styles mimic the Select component */}\n <Menu.Trigger\n height=\"800\"\n width=\"4000\"\n bg=\"primary.1\"\n borderRadius=\"200\"\n _hover={{ bg: \"primary.2\" }}\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n aria-label=\"Text style menu\"\n >\n <Box display=\"flex\" alignItems=\"center\" gap=\"200\" px=\"200\">\n <Box display=\"flex\" alignItems=\"center\" gap=\"200\" flexGrow=\"1\">\n <Text my=\"auto\" textStyle=\"sm\" fontWeight=\"500\">\n {selectedTextStyleLabel}\n </Text>\n </Box>\n <KeyboardArrowDown />\n </Box>\n </Menu.Trigger>\n <Tooltip.Content placement=\"top\">Text style</Tooltip.Content>\n </Tooltip.Root>\n <Menu.Content>\n {textStyles.map((style) => (\n <Menu.Item\n key={style.id}\n id={style.id}\n {...(currentTextStyle === style.id && {\n \"data-state\": \"checked\",\n })}\n >\n <Text {...style.props}>{style.label}</Text>\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu.Root>\n </Group>\n\n <Divider orientation=\"vertical\" />\n\n {/* Text Formatting Toggles */}\n <ToggleButtonGroup.Root\n selectionMode=\"multiple\"\n selectedKeys={selectedFormatKeys}\n isDisabled={isDisabled}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"bold\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Bold\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n onPress={withPreservedSelection(() => toggleMark(editor, \"bold\"))}\n >\n <FormatBold />\n <VisuallyHidden>Bold</VisuallyHidden>\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Bold</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"italic\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Italic\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n onPress={withPreservedSelection(() => toggleMark(editor, \"italic\"))}\n >\n <FormatItalic />\n <VisuallyHidden>Italic</VisuallyHidden>\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Italic</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"underline\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Underline\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n onPress={withPreservedSelection(() =>\n toggleMark(editor, \"underline\")\n )}\n >\n <FormatUnderlined />\n <VisuallyHidden>Underline</VisuallyHidden>\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Underline</Tooltip.Content>\n </Tooltip.Root>\n </ToggleButtonGroup.Root>\n\n {/* Formatting Menu for additional options */}\n <FormattingMenu isDisabled={isDisabled} />\n\n <Divider orientation=\"vertical\" />\n\n {/* Lists & Indentation */}\n <ToggleButtonGroup.Root\n selectionMode=\"single\"\n selectedKeys={selectedListKeys}\n onSelectionChange={handleListToggle}\n aria-label=\"List formatting\"\n isDisabled={isDisabled}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"bulleted-list\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Bulleted List\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n >\n <FormatListBulleted />\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Bulleted list</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"numbered-list\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Numbered List\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n >\n <FormatListNumbered />\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Numbered list</Tooltip.Content>\n </Tooltip.Root>\n </ToggleButtonGroup.Root>\n\n {/* Spacer to push undo/redo buttons to the right */}\n <Box flexGrow=\"1\" />\n\n <Group>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconButton\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Undo\"\n isDisabled={!hasUndos || isDisabled}\n onPress={withPreservedSelection(() => editor.undo())}\n onMouseDown={(event) => event.preventDefault()}\n >\n <Undo />\n <VisuallyHidden>Undo</VisuallyHidden>\n </IconButton>\n <Tooltip.Content placement=\"top\">Undo</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconButton\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Redo\"\n isDisabled={!hasRedos || isDisabled}\n onPress={withPreservedSelection(() => editor.redo())}\n onMouseDown={(event) => event.preventDefault()}\n >\n <Redo />\n <VisuallyHidden>Redo</VisuallyHidden>\n </IconButton>\n <Tooltip.Content placement=\"top\">Redo</Tooltip.Content>\n </Tooltip.Root>\n </Group>\n </Toolbar>\n );\n};\n\nRichTextToolbar.displayName = \"RichTextToolbar\";\n","import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { useSlotRecipe } from \"@chakra-ui/react\";\nimport { extractStyleProps } from \"@/utils/extractStyleProps\";\nimport { RichTextInputRootSlot } from \"./rich-text-input.slots\";\nimport {\n RichTextEditor,\n type RichTextEditorRef,\n} from \"./components/rich-text-editor\";\nimport { RichTextToolbar } from \"./components/rich-text-toolbar\";\nimport type { RichTextInputProps } from \"./rich-text-input.types\";\nimport {\n toHTML,\n fromHTML,\n createEmptyValue,\n validSlateStateAdapter,\n} from \"./utils\";\nimport { richTextInputRecipe } from \"./rich-text-input.recipe\";\n\n/**\n RichTextInput - A rich text input component with formatting capabilities.\n */\nexport const RichTextInput = (props: RichTextInputProps) => {\n const {\n ref: forwardedRef,\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n placeholder = \"\",\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n autoFocus = false,\n ...restProps\n } = props;\n\n const recipe = useSlotRecipe({ recipe: richTextInputRecipe });\n const [recipeProps, remainingProps] = recipe.splitVariantProps({\n // Only semantic variants go here (none currently defined)\n ...restProps,\n });\n const [styleProps, functionalProps] = extractStyleProps(remainingProps);\n\n // Data attributes for state-based styling\n const dataAttributes = {\n \"data-disabled\": isDisabled ? \"true\" : undefined,\n \"data-invalid\": isInvalid ? \"true\" : undefined,\n \"data-readonly\": isReadOnly ? \"true\" : undefined,\n };\n\n // Internal state management\n const [internalValue, setInternalValue] = useState(() => {\n const initialHtml = value ?? defaultValue ?? \"\";\n try {\n return initialHtml ? fromHTML(initialHtml) : createEmptyValue();\n } catch (error) {\n console.warn(\"Failed to parse initial HTML, using empty value:\", error);\n return createEmptyValue();\n }\n });\n\n const [serializedValue, setSerializedValue] = useState(() => {\n return value ?? defaultValue ?? \"\";\n });\n\n const editorRef = useRef<RichTextEditorRef>(null);\n\n // Handle controlled value changes\n useEffect(() => {\n if (value !== undefined && value !== serializedValue) {\n const newSlateValue = value ? fromHTML(value) : createEmptyValue();\n setInternalValue(newSlateValue);\n setSerializedValue(value);\n }\n }, [value, serializedValue]);\n\n const handleChange = useCallback(\n (slateValue: ReturnType<typeof createEmptyValue>) => {\n const newHtml = toHTML(slateValue);\n const hasSerializedValueChanged = newHtml !== serializedValue;\n\n setInternalValue(slateValue);\n setSerializedValue(newHtml);\n\n // Only call onChange if the serialized HTML actually changed\n if (hasSerializedValueChanged && onChange) {\n onChange(newHtml);\n }\n },\n [serializedValue, onChange]\n );\n\n const currentValue = internalValue;\n\n // Safety check: ensure we always have a valid Slate value\n const safeValue = validSlateStateAdapter(currentValue);\n\n return (\n <RichTextInputRootSlot\n {...recipeProps}\n {...styleProps}\n {...functionalProps}\n {...dataAttributes}\n ref={forwardedRef}\n >\n <RichTextEditor\n ref={editorRef}\n value={safeValue}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n autoFocus={autoFocus}\n toolbar={\n !isReadOnly ? <RichTextToolbar isDisabled={isDisabled} /> : null\n }\n />\n </RichTextInputRootSlot>\n );\n};\n\nRichTextInput.displayName = \"RichTextInput\";\n"],"names":["richTextInputRecipe","defineSlotRecipe","withProvider","withContext","createSlotRecipeContext","RichTextInputRootSlot","RichTextInputToolbarSlot","RichTextInputEditableSlot","History","value","isPlainObject","Operation","SAVING","MERGING","SPLITTING_ONCE","HistoryEditor","Editor","editor","fn","prev","withHistory","e","apply","history","redos","batch","Transforms","op","undos","inverseOps","operations","lastBatch","lastOp","save","merge","shouldSave","shouldMerge","stack","Path","RichTextEditor","forwardRef","props","forwardedRef","onChange","onFocus","onBlur","placeholder","EDITOR_DEFAULTS","isDisabled","isReadOnly","autoFocus","toolbar","useMemo","baseEditor","createEditor","withLinks","withReact","handleKeyDown","useKeyboardShortcuts","handleFocus","useCallback","event","handleBlur","useImperativeHandle","focusEditor","html","resetEditor","renderElement","jsx","Element","renderLeaf","Leaf","defaultValue","createEmptyValue","safeInitialValue","jsxs","Slate","Editable","FormattingMenu","useSlate","withPreservedSelection","usePreservedSelection","allSelectedKeys","handleAllSelectionChange","useFormattingState","Menu","Tooltip","IconButton","MoreHoriz","Box","FormatStrikethrough","Text","Code","RichTextToolbar","currentTextStyle","selectedTextStyleLabel","handleTextStyleChange","handleListToggle","selectedFormatKeys","selectedListKeys","hasUndos","hasRedos","useToolbarState","Toolbar","Group","styleId","KeyboardArrowDown","textStyles","style","Divider","ToggleButtonGroup","IconToggleButton","toggleMark","FormatBold","VisuallyHidden","FormatItalic","FormatUnderlined","FormatListBulleted","FormatListNumbered","Undo","Redo","RichTextInput","isInvalid","restProps","recipe","useSlotRecipe","recipeProps","remainingProps","styleProps","functionalProps","extractStyleProps","dataAttributes","internalValue","setInternalValue","useState","initialHtml","fromHTML","error","serializedValue","setSerializedValue","editorRef","useRef","useEffect","newSlateValue","handleChange","slateValue","newHtml","toHTML","hasSerializedValueChanged","safeValue","validSlateStateAdapter"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,MAAMA,IAAsB,gBAAAC,GAAiB;AAAA,EAClD,OAAO,CAAC,QAAQ,WAAW,UAAU;AAAA,EACrC,WAAW;AAAA,EACX,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,eAAe;AAAA,MACf,UAAU;AAAA,MACV,OAAO;AAAA,MACP,cAAc;AAAA,MACd,aAAa;AAAA,MACb,cAAc;AAAA,MACd,aAAa;AAAA,MACb,iBAAiB;AAAA;AAAA,MAGjB,0BAA0B;AAAA,QACxB,aAAa;AAAA,QACb,aAAa;AAAA,MAAA;AAAA,IACf;AAAA,IAEF,SAAS;AAAA,MACP,WAAW;AAAA;AAAA,MAGX,4BAA4B;AAAA,QAC1B,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,UAAU;AAAA,MACR,SAAS;AAAA,MACT,WA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,CAACiE,GAAiBC,CAAkB,IAAIL,EAAS,MAC9C7H,KAAS+D,KAAgB,EACjC,GAEKoE,KAAYC,GAA0B,IAAI;AAGhD,EAAAC,GAAU,MAAM;AACd,QAAIrI,MAAU,UAAaA,MAAUiI,GAAiB;AACpD,YAAMK,IAAgBtI,IAAQ+H,EAAS/H,CAAK,IAAIgE,EAAA;AAChD,MAAA4D,EAAiBU,CAAa,GAC9BJ,EAAmBlI,CAAK;AAAA,IAC1B;AAAA,EACF,GAAG,CAACA,GAAOiI,CAAe,CAAC;AAE3B,QAAMM,KAAepF;AAAA,IACnB,CAACqF,MAAoD;AACnD,YAAMC,IAAUC,GAAOF,CAAU,GAC3BG,KAA4BF,MAAYR;AAE9C,MAAAL,EAAiBY,CAAU,GAC3BN,EAAmBO,CAAO,GAGtBE,MAA6BzG,KAC/BA,EAASuG,CAAO;AAAA,IAEpB;AAAA,IACA,CAACR,GAAiB/F,CAAQ;AAAA,EAAA,GAMtB0G,KAAYC,GAHGlB,CAGgC;AAErD,SACE,gBAAAhE;AAAA,IAAC/D;AAAA,IAAA;AAAA,MACE,GAAGyH;AAAA,MACH,GAAGE;AAAA,MACH,GAAGC;AAAA,MACH,GAAGE;AAAA,MACJ,KAAKzF;AAAA,MAEL,UAAA,gBAAA0B;AAAA,QAAC7B;AAAA,QAAA;AAAA,UACC,KAAKqG;AAAA,UACL,OAAOS;AAAA,UACP,UAAUL;AAAA,UACV,SAAApG;AAAA,UACA,QAAAC;AAAA,UACA,aAAAC;AAAA,UACA,YAAAE;AAAA,UACA,YAAAC;AAAA,UACA,WAAAC;AAAA,UACA,SACGD,IAA2D,OAA9C,gBAAAmB,EAACyB,IAAA,EAAgB,YAAA7C,GAAwB;AAAA,QAAK;AAAA,MAAA;AAAA,IAEhE;AAAA,EAAA;AAGN;AAEAyE,GAAc,cAAc;","x_google_ignoreList":[2]}
1
+ {"version":3,"file":"rich-text-input-Bty0WhBM.es.js","sources":["../../src/components/rich-text-input/rich-text-input.recipe.tsx","../../src/components/rich-text-input/rich-text-input.slots.tsx","../../../../node_modules/.pnpm/slate-history@0.113.1_slate@0.75.0/node_modules/slate-history/dist/index.es.js","../../src/components/rich-text-input/components/rich-text-editor.tsx","../../src/components/rich-text-input/components/formatting-menu.tsx","../../src/components/rich-text-input/components/rich-text-toolbar.tsx","../../src/components/rich-text-input/rich-text-input.tsx"],"sourcesContent":["import { defineSlotRecipe } from \"@chakra-ui/react\";\n\nexport const richTextInputRecipe = defineSlotRecipe({\n slots: [\"root\", \"toolbar\", \"editable\"],\n className: \"nimbus-rich-text-input\",\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n position: \"relative\",\n width: \"full\",\n borderRadius: \"200\",\n borderWidth: \"{sizes.25}\",\n colorPalette: \"slate\",\n borderColor: \"colorPalette.7\",\n backgroundColor: \"colorPalette.contrast\",\n\n // Invalid state styling\n \"&[data-invalid='true']\": {\n borderWidth: \"{sizes.50}\",\n borderColor: \"critical.7\",\n },\n },\n toolbar: {\n boxShadow: \"1\",\n\n // Disabled state styling for toolbar\n \"[data-disabled='true'] &\": {\n opacity: \"0.5\",\n },\n },\n editable: {\n padding: \"400\",\n minHeight: \"inherit\",\n outline: \"none\",\n\n // Disabled state styling for editable\n \"[data-disabled='true'] &\": {\n cursor: \"not-allowed\",\n opacity: \"0.5\",\n },\n\n // Styling for user-facing editor text\n \"& p\": {\n textStyle: \"md\",\n fontWeight: \"500\",\n },\n \"& h1\": {\n textStyle: \"2xl\",\n fontWeight: \"500\",\n },\n \"& h2\": {\n textStyle: \"xl\",\n fontWeight: \"500\",\n },\n \"& h3\": {\n textStyle: \"lg\",\n fontWeight: \"500\",\n },\n \"& h4\": {\n textStyle: \"md\",\n fontWeight: \"500\",\n },\n \"& h5\": {\n textStyle: \"xs\",\n fontWeight: \"500\",\n },\n \"& blockquote\": {\n textStyle: \"md\",\n fontWeight: \"400\",\n borderLeftWidth: \"{sizes.100}\",\n paddingLeft: \"400\",\n },\n \"& ul\": {\n paddingLeft: \"600\",\n listStyleType: \"disc\",\n },\n \"& ol\": {\n paddingLeft: \"600\",\n listStyleType: \"decimal\",\n },\n \"& code\": {\n padding: \"100\",\n fontFamily: \"mono\",\n },\n \"& pre\": {\n padding: \"300\",\n borderRadius: \"200\",\n overflow: \"auto\",\n \"& code\": {\n padding: \"0\",\n },\n },\n \"& a\": {\n color: \"primary.11\",\n textDecoration: \"underline\",\n cursor: \"pointer\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n \"& strong\": {\n fontWeight: \"700\",\n },\n \"& em\": {\n fontStyle: \"italic\",\n },\n \"& u\": {\n textDecoration: \"underline\",\n },\n \"& del\": {\n textDecoration: \"line-through\",\n },\n \"& sup\": {\n fontSize: \"75%\",\n verticalAlign: \"super\",\n lineHeight: \"0\",\n },\n \"& sub\": {\n fontSize: \"75%\",\n verticalAlign: \"sub\",\n lineHeight: \"0\",\n },\n },\n },\n variants: {},\n});\n","import {\n type HTMLChakraProps,\n type RecipeVariantProps,\n type UnstyledProp,\n createSlotRecipeContext,\n} from \"@chakra-ui/react\";\nimport { richTextInputRecipe } from \"./rich-text-input.recipe\";\n\nconst { withProvider, withContext } = createSlotRecipeContext({\n recipe: richTextInputRecipe,\n});\n\n// Root slot\nexport type RichTextInputRootSlotProps = HTMLChakraProps<\n \"div\",\n RecipeVariantProps<typeof richTextInputRecipe> & UnstyledProp\n>;\n\nexport const RichTextInputRootSlot = withProvider<\n HTMLDivElement,\n RichTextInputRootSlotProps\n>(\"div\", \"root\");\n\n// Toolbar slot\nexport type RichTextInputToolbarSlotProps = HTMLChakraProps<\"div\">;\n\nexport const RichTextInputToolbarSlot = withContext<\n HTMLDivElement,\n RichTextInputToolbarSlotProps\n>(\"div\", \"toolbar\");\n\n// Editable slot\nexport type RichTextInputEditableSlotProps = HTMLChakraProps<\"div\">;\nexport const RichTextInputEditableSlot = withContext<\n HTMLDivElement,\n RichTextInputEditableSlotProps\n>(\"div\", \"editable\");\n","import { isPlainObject } from 'is-plain-object';\nimport { Operation, Editor, Transforms, Path } from 'slate';\n\n// eslint-disable-next-line no-redeclare\nvar History = {\n /**\n * Check if a value is a `History` object.\n */\n isHistory(value) {\n return isPlainObject(value) && Array.isArray(value.redos) && Array.isArray(value.undos) && (value.redos.length === 0 || Operation.isOperationList(value.redos[0].operations)) && (value.undos.length === 0 || Operation.isOperationList(value.undos[0].operations));\n }\n};\n\n/**\n * Weakmaps for attaching state to the editor.\n */\nvar HISTORY = new WeakMap();\nvar SAVING = new WeakMap();\nvar MERGING = new WeakMap();\nvar SPLITTING_ONCE = new WeakMap();\n// eslint-disable-next-line no-redeclare\nvar HistoryEditor = {\n /**\n * Check if a value is a `HistoryEditor` object.\n */\n isHistoryEditor(value) {\n return History.isHistory(value.history) && Editor.isEditor(value);\n },\n /**\n * Get the merge flag's current value.\n */\n isMerging(editor) {\n return MERGING.get(editor);\n },\n /**\n * Get the splitting once flag's current value.\n */\n isSplittingOnce(editor) {\n return SPLITTING_ONCE.get(editor);\n },\n setSplittingOnce(editor, value) {\n SPLITTING_ONCE.set(editor, value);\n },\n /**\n * Get the saving flag's current value.\n */\n isSaving(editor) {\n return SAVING.get(editor);\n },\n /**\n * Redo to the previous saved state.\n */\n redo(editor) {\n editor.redo();\n },\n /**\n * Undo to the previous saved state.\n */\n undo(editor) {\n editor.undo();\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, These operations will\n * be merged into the previous history.\n */\n withMerging(editor, fn) {\n var prev = HistoryEditor.isMerging(editor);\n MERGING.set(editor, true);\n fn();\n MERGING.set(editor, prev);\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, ensuring that the first\n * operation starts a new batch in the history. Subsequent operations will be\n * merged as usual.\n */\n withNewBatch(editor, fn) {\n var prev = HistoryEditor.isMerging(editor);\n MERGING.set(editor, true);\n SPLITTING_ONCE.set(editor, true);\n fn();\n MERGING.set(editor, prev);\n SPLITTING_ONCE.delete(editor);\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, without merging any of\n * the new operations into previous save point in the history.\n */\n withoutMerging(editor, fn) {\n var prev = HistoryEditor.isMerging(editor);\n MERGING.set(editor, false);\n fn();\n MERGING.set(editor, prev);\n },\n /**\n * Apply a series of changes inside a synchronous `fn`, without saving any of\n * their operations into the history.\n */\n withoutSaving(editor, fn) {\n var prev = HistoryEditor.isSaving(editor);\n SAVING.set(editor, false);\n try {\n fn();\n } finally {\n SAVING.set(editor, prev);\n }\n }\n};\n\n/**\n * The `withHistory` plugin keeps track of the operation history of a Slate\n * editor as operations are applied to it, using undo and redo stacks.\n *\n * If you are using TypeScript, you must extend Slate's CustomTypes to use\n * this plugin.\n *\n * See https://docs.slatejs.org/concepts/11-typescript to learn how.\n */\nvar withHistory = editor => {\n var e = editor;\n var {\n apply\n } = e;\n e.history = {\n undos: [],\n redos: []\n };\n e.redo = () => {\n var {\n history\n } = e;\n var {\n redos\n } = history;\n if (redos.length > 0) {\n var batch = redos[redos.length - 1];\n if (batch.selectionBefore) {\n Transforms.setSelection(e, batch.selectionBefore);\n }\n HistoryEditor.withoutSaving(e, () => {\n Editor.withoutNormalizing(e, () => {\n for (var op of batch.operations) {\n e.apply(op);\n }\n });\n });\n history.redos.pop();\n e.writeHistory('undos', batch);\n }\n };\n e.undo = () => {\n var {\n history\n } = e;\n var {\n undos\n } = history;\n if (undos.length > 0) {\n var batch = undos[undos.length - 1];\n HistoryEditor.withoutSaving(e, () => {\n Editor.withoutNormalizing(e, () => {\n var inverseOps = batch.operations.map(Operation.inverse).reverse();\n for (var op of inverseOps) {\n e.apply(op);\n }\n if (batch.selectionBefore) {\n Transforms.setSelection(e, batch.selectionBefore);\n }\n });\n });\n e.writeHistory('redos', batch);\n history.undos.pop();\n }\n };\n e.apply = op => {\n var {\n operations,\n history\n } = e;\n var {\n undos\n } = history;\n var lastBatch = undos[undos.length - 1];\n var lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];\n var save = HistoryEditor.isSaving(e);\n var merge = HistoryEditor.isMerging(e);\n if (save == null) {\n save = shouldSave(op);\n }\n if (save) {\n if (merge == null) {\n if (lastBatch == null) {\n merge = false;\n } else if (operations.length !== 0) {\n merge = true;\n } else {\n merge = shouldMerge(op, lastOp);\n }\n }\n if (HistoryEditor.isSplittingOnce(e)) {\n merge = false;\n HistoryEditor.setSplittingOnce(e, undefined);\n }\n if (lastBatch && merge) {\n lastBatch.operations.push(op);\n } else {\n var batch = {\n operations: [op],\n selectionBefore: e.selection\n };\n e.writeHistory('undos', batch);\n }\n while (undos.length > 100) {\n undos.shift();\n }\n history.redos = [];\n }\n apply(op);\n };\n e.writeHistory = (stack, batch) => {\n e.history[stack].push(batch);\n };\n return e;\n};\n/**\n * Check whether to merge an operation into the previous operation.\n */\nvar shouldMerge = (op, prev) => {\n if (prev && op.type === 'insert_text' && prev.type === 'insert_text' && op.offset === prev.offset + prev.text.length && Path.equals(op.path, prev.path)) {\n return true;\n }\n if (prev && op.type === 'remove_text' && prev.type === 'remove_text' && op.offset + op.text.length === prev.offset && Path.equals(op.path, prev.path)) {\n return true;\n }\n return false;\n};\n/**\n * Check whether an operation needs to be saved to the history.\n */\nvar shouldSave = (op, prev) => {\n if (op.type === 'set_selection') {\n return false;\n }\n return true;\n};\n\nexport { HISTORY, History, HistoryEditor, MERGING, SAVING, SPLITTING_ONCE, withHistory };\n//# sourceMappingURL=index.es.js.map\n","import {\n useMemo,\n useCallback,\n useImperativeHandle,\n forwardRef,\n type ForwardedRef,\n type FocusEventHandler,\n type ReactNode,\n} from \"react\";\nimport { createEditor, type Descendant } from \"slate\";\nimport { Slate, Editable, withReact } from \"slate-react\";\nimport { withHistory } from \"slate-history\";\nimport {\n RichTextInputEditableSlot,\n RichTextInputToolbarSlot,\n} from \"../rich-text-input.slots\";\nimport {\n Element,\n Leaf,\n withLinks,\n focusEditor,\n resetEditor,\n} from \"../utils/slate-helpers\";\nimport { createEmptyValue } from \"../utils/html-serialization\";\nimport { useKeyboardShortcuts } from \"../hooks/use-keyboard-shortcuts\";\nimport { EDITOR_DEFAULTS } from \"../constants\";\n\nexport interface RichTextEditorProps {\n value?: Descendant[];\n onChange: (value: Descendant[]) => void;\n onFocus?: FocusEventHandler<HTMLDivElement>;\n onBlur?: FocusEventHandler<HTMLDivElement>;\n placeholder?: string;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n autoFocus?: boolean;\n toolbar?: ReactNode;\n}\n\nexport interface RichTextEditorRef {\n focus: () => void;\n resetValue: (html: string) => void;\n}\n\nexport const RichTextEditor = forwardRef<\n RichTextEditorRef,\n RichTextEditorProps\n>((props, forwardedRef: ForwardedRef<RichTextEditorRef>) => {\n const {\n value,\n onChange,\n onFocus,\n onBlur,\n placeholder = EDITOR_DEFAULTS.placeholder,\n isDisabled = EDITOR_DEFAULTS.isDisabled,\n isReadOnly = EDITOR_DEFAULTS.isReadOnly,\n autoFocus = EDITOR_DEFAULTS.autoFocus,\n toolbar,\n } = props;\n\n // Create editor with plugins\n const editor = useMemo(() => {\n const baseEditor = createEditor();\n return withLinks(withHistory(withReact(baseEditor)));\n }, []);\n\n // Handle keyboard shortcuts using hook\n const { handleKeyDown } = useKeyboardShortcuts({ editor });\n\n // Handle focus\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (onFocus) {\n onFocus(event);\n }\n },\n [onFocus]\n );\n\n // Handle blur\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (onBlur) {\n onBlur(event);\n }\n },\n [onBlur]\n );\n\n // Expose methods through ref\n useImperativeHandle(\n forwardedRef,\n () => ({\n focus: () => focusEditor(editor),\n resetValue: (html: string) => resetEditor(editor, html),\n }),\n [editor]\n );\n\n // Render element\n const renderElement = useCallback(\n (props: Parameters<typeof Element>[0]) => <Element {...props} />,\n []\n );\n\n // Render leaf\n const renderLeaf = useCallback(\n (props: Parameters<typeof Leaf>[0]) => <Leaf {...props} />,\n []\n );\n\n // Ensure we always have a valid value\n const defaultValue = createEmptyValue();\n const safeInitialValue =\n Array.isArray(value) && value.length > 0 ? value : defaultValue;\n\n return (\n <Slate editor={editor} value={safeInitialValue} onChange={onChange}>\n {toolbar && (\n <RichTextInputToolbarSlot>{toolbar}</RichTextInputToolbarSlot>\n )}\n <RichTextInputEditableSlot asChild>\n <Editable\n renderElement={renderElement}\n renderLeaf={renderLeaf}\n placeholder={placeholder}\n autoFocus={autoFocus}\n readOnly={isReadOnly || isDisabled}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-label=\"Rich text editor\"\n role=\"textbox\"\n aria-multiline=\"true\"\n />\n </RichTextInputEditableSlot>\n </Slate>\n );\n});\n\nRichTextEditor.displayName = \"RichTextEditor\";\n","import { useSlate } from \"slate-react\";\nimport { Menu, IconButton, Text, Box, Tooltip } from \"@/components\";\nimport {\n MoreHoriz,\n FormatStrikethrough,\n Code,\n} from \"@commercetools/nimbus-icons\";\nimport { usePreservedSelection } from \"../hooks/use-preserved-selection\";\nimport { useFormattingState } from \"../hooks/use-formatting-state\";\n\nexport interface FormattingMenuProps {\n isDisabled?: boolean;\n}\n\nexport const FormattingMenu = ({ isDisabled = false }: FormattingMenuProps) => {\n const editor = useSlate();\n const withPreservedSelection = usePreservedSelection(editor);\n\n // Use the formatting state hook for all state management\n const { allSelectedKeys, handleAllSelectionChange } = useFormattingState({\n withPreservedSelection,\n });\n\n return (\n <Menu.Root\n selectionMode=\"multiple\"\n selectedKeys={allSelectedKeys}\n onSelectionChange={handleAllSelectionChange}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n <Menu.Trigger asChild>\n <IconButton\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"More formatting options\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n >\n <MoreHoriz />\n </IconButton>\n </Menu.Trigger>\n <Tooltip.Content placement=\"top\">More styles</Tooltip.Content>\n </Tooltip.Root>\n <Menu.Content>\n <Menu.Item id=\"strikethrough\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <FormatStrikethrough />\n <Text textStyle=\"sm\">Strikethrough</Text>\n </Box>\n </Menu.Item>\n <Menu.Item id=\"code\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <Code />\n <Text textStyle=\"sm\">Code</Text>\n </Box>\n </Menu.Item>\n <Menu.Item id=\"superscript\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <Text>X²</Text>\n <Text textStyle=\"sm\">Superscript</Text>\n </Box>\n </Menu.Item>\n <Menu.Item id=\"subscript\">\n <Box slot=\"label\" display=\"flex\" alignItems=\"center\" gap=\"200\">\n <Text>X₂</Text>\n <Text textStyle=\"sm\">Subscript</Text>\n </Box>\n </Menu.Item>\n </Menu.Content>\n </Menu.Root>\n );\n};\n","import { useSlate } from \"slate-react\";\nimport {\n Toolbar,\n Menu,\n VisuallyHidden,\n Divider,\n ToggleButtonGroup,\n IconToggleButton,\n IconButton,\n Text,\n Box,\n Tooltip,\n} from \"@/components\";\nimport { Group } from \"@/components/group\";\nimport {\n FormatBold,\n FormatItalic,\n FormatUnderlined,\n FormatListBulleted,\n FormatListNumbered,\n KeyboardArrowDown,\n Undo,\n Redo,\n} from \"@commercetools/nimbus-icons\";\nimport { toggleMark } from \"../utils/slate-helpers\";\nimport { usePreservedSelection } from \"../hooks/use-preserved-selection\";\nimport { useToolbarState } from \"../hooks/use-toolbar-state\";\nimport { textStyles } from \"../constants\";\nimport { FormattingMenu } from \"./formatting-menu\";\n\nexport interface RichTextToolbarProps {\n isDisabled?: boolean;\n}\n\nexport const RichTextToolbar = ({\n isDisabled = false,\n}: RichTextToolbarProps) => {\n const editor = useSlate();\n const withPreservedSelection = usePreservedSelection(editor);\n\n // Use the toolbar state hook for all state management\n const {\n currentTextStyle,\n selectedTextStyleLabel,\n handleTextStyleChange,\n handleListToggle,\n selectedFormatKeys,\n selectedListKeys,\n hasUndos,\n hasRedos,\n } = useToolbarState({ withPreservedSelection });\n\n return (\n <Toolbar\n orientation=\"horizontal\"\n aria-label=\"Text formatting\"\n width=\"full\"\n overflow=\"hidden\"\n size=\"xs\"\n >\n {/* Text Style Menu */}\n <Group>\n <Menu.Root\n onAction={(styleId) => handleTextStyleChange(String(styleId))}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n {/* Menu trigger styles mimic the Select component */}\n <Menu.Trigger\n height=\"800\"\n width=\"4000\"\n bg=\"primary.1\"\n borderRadius=\"200\"\n _hover={{ bg: \"primary.2\" }}\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n aria-label=\"Text style menu\"\n >\n <Box display=\"flex\" alignItems=\"center\" gap=\"200\" px=\"200\">\n <Box display=\"flex\" alignItems=\"center\" gap=\"200\" flexGrow=\"1\">\n <Text my=\"auto\" textStyle=\"sm\" fontWeight=\"500\">\n {selectedTextStyleLabel}\n </Text>\n </Box>\n <KeyboardArrowDown />\n </Box>\n </Menu.Trigger>\n <Tooltip.Content placement=\"top\">Text style</Tooltip.Content>\n </Tooltip.Root>\n <Menu.Content>\n {textStyles.map((style) => (\n <Menu.Item\n key={style.id}\n id={style.id}\n {...(currentTextStyle === style.id && {\n \"data-state\": \"checked\",\n })}\n >\n <Text {...style.props}>{style.label}</Text>\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu.Root>\n </Group>\n\n <Divider orientation=\"vertical\" />\n\n {/* Text Formatting Toggles */}\n <ToggleButtonGroup.Root\n selectionMode=\"multiple\"\n selectedKeys={selectedFormatKeys}\n isDisabled={isDisabled}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"bold\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Bold\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n onPress={withPreservedSelection(() => toggleMark(editor, \"bold\"))}\n >\n <FormatBold />\n <VisuallyHidden>Bold</VisuallyHidden>\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Bold</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"italic\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Italic\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n onPress={withPreservedSelection(() => toggleMark(editor, \"italic\"))}\n >\n <FormatItalic />\n <VisuallyHidden>Italic</VisuallyHidden>\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Italic</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"underline\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Underline\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n onPress={withPreservedSelection(() =>\n toggleMark(editor, \"underline\")\n )}\n >\n <FormatUnderlined />\n <VisuallyHidden>Underline</VisuallyHidden>\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Underline</Tooltip.Content>\n </Tooltip.Root>\n </ToggleButtonGroup.Root>\n\n {/* Formatting Menu for additional options */}\n <FormattingMenu isDisabled={isDisabled} />\n\n <Divider orientation=\"vertical\" />\n\n {/* Lists & Indentation */}\n <ToggleButtonGroup.Root\n selectionMode=\"single\"\n selectedKeys={selectedListKeys}\n onSelectionChange={handleListToggle}\n aria-label=\"List formatting\"\n isDisabled={isDisabled}\n >\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"bulleted-list\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Bulleted List\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n >\n <FormatListBulleted />\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Bulleted list</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconToggleButton\n id=\"numbered-list\"\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Numbered List\"\n isDisabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n >\n <FormatListNumbered />\n </IconToggleButton>\n <Tooltip.Content placement=\"top\">Numbered list</Tooltip.Content>\n </Tooltip.Root>\n </ToggleButtonGroup.Root>\n\n {/* Spacer to push undo/redo buttons to the right */}\n <Box flexGrow=\"1\" />\n\n <Group>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconButton\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Undo\"\n isDisabled={!hasUndos || isDisabled}\n onPress={withPreservedSelection(() => editor.undo())}\n onMouseDown={(event) => event.preventDefault()}\n >\n <Undo />\n <VisuallyHidden>Undo</VisuallyHidden>\n </IconButton>\n <Tooltip.Content placement=\"top\">Undo</Tooltip.Content>\n </Tooltip.Root>\n <Tooltip.Root delay={0} closeDelay={0}>\n <IconButton\n size=\"xs\"\n variant=\"ghost\"\n aria-label=\"Redo\"\n isDisabled={!hasRedos || isDisabled}\n onPress={withPreservedSelection(() => editor.redo())}\n onMouseDown={(event) => event.preventDefault()}\n >\n <Redo />\n <VisuallyHidden>Redo</VisuallyHidden>\n </IconButton>\n <Tooltip.Content placement=\"top\">Redo</Tooltip.Content>\n </Tooltip.Root>\n </Group>\n </Toolbar>\n );\n};\n\nRichTextToolbar.displayName = \"RichTextToolbar\";\n","import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { useSlotRecipe } from \"@chakra-ui/react\";\nimport { extractStyleProps } from \"@/utils/extractStyleProps\";\nimport { RichTextInputRootSlot } from \"./rich-text-input.slots\";\nimport {\n RichTextEditor,\n type RichTextEditorRef,\n} from \"./components/rich-text-editor\";\nimport { RichTextToolbar } from \"./components/rich-text-toolbar\";\nimport type { RichTextInputProps } from \"./rich-text-input.types\";\nimport {\n toHTML,\n fromHTML,\n createEmptyValue,\n validSlateStateAdapter,\n} from \"./utils\";\nimport { richTextInputRecipe } from \"./rich-text-input.recipe\";\n\n/**\n RichTextInput - A rich text input component with formatting capabilities.\n */\nexport const RichTextInput = (props: RichTextInputProps) => {\n const {\n ref: forwardedRef,\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n placeholder = \"\",\n isDisabled = false,\n isReadOnly = false,\n isInvalid = false,\n autoFocus = false,\n ...restProps\n } = props;\n\n const recipe = useSlotRecipe({ recipe: richTextInputRecipe });\n const [recipeProps, remainingProps] = recipe.splitVariantProps({\n // Only semantic variants go here (none currently defined)\n ...restProps,\n });\n const [styleProps, functionalProps] = extractStyleProps(remainingProps);\n\n // Data attributes for state-based styling\n const dataAttributes = {\n \"data-disabled\": isDisabled ? \"true\" : undefined,\n \"data-invalid\": isInvalid ? \"true\" : undefined,\n \"data-readonly\": isReadOnly ? \"true\" : undefined,\n };\n\n // Internal state management\n const [internalValue, setInternalValue] = useState(() => {\n const initialHtml = value ?? defaultValue ?? \"\";\n try {\n return initialHtml ? fromHTML(initialHtml) : createEmptyValue();\n } catch (error) {\n console.warn(\"Failed to parse initial HTML, using empty value:\", error);\n return createEmptyValue();\n }\n });\n\n const [serializedValue, setSerializedValue] = useState(() => {\n return value ?? defaultValue ?? \"\";\n });\n\n const editorRef = useRef<RichTextEditorRef>(null);\n\n // Handle controlled value changes\n useEffect(() => {\n if (value !== undefined && value !== serializedValue) {\n const newSlateValue = value ? fromHTML(value) : createEmptyValue();\n setInternalValue(newSlateValue);\n setSerializedValue(value);\n }\n }, [value, serializedValue]);\n\n const handleChange = useCallback(\n (slateValue: ReturnType<typeof createEmptyValue>) => {\n const newHtml = toHTML(slateValue);\n const hasSerializedValueChanged = newHtml !== serializedValue;\n\n setInternalValue(slateValue);\n setSerializedValue(newHtml);\n\n // Only call onChange if the serialized HTML actually changed\n if (hasSerializedValueChanged && onChange) {\n onChange(newHtml);\n }\n },\n [serializedValue, onChange]\n );\n\n const currentValue = internalValue;\n\n // Safety check: ensure we always have a valid Slate value\n const safeValue = validSlateStateAdapter(currentValue);\n\n return (\n <RichTextInputRootSlot\n {...recipeProps}\n {...styleProps}\n {...functionalProps}\n {...dataAttributes}\n ref={forwardedRef}\n >\n <RichTextEditor\n ref={editorRef}\n value={safeValue}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n autoFocus={autoFocus}\n toolbar={\n !isReadOnly ? <RichTextToolbar isDisabled={isDisabled} /> : null\n }\n />\n </RichTextInputRootSlot>\n );\n};\n\nRichTextInput.displayName = \"RichTextInput\";\n"],"names":["richTextInputRecipe","defineSlotRecipe","withProvider","withContext","createSlotRecipeContext","RichTextInputRootSlot","RichTextInputToolbarSlot","RichTextInputEditableSlot","History","value","isPlainObject","Operation","SAVING","MERGING","SPLITTING_ONCE","HistoryEditor","Editor","editor","fn","prev","withHistory","e","apply","history","redos","batch","Transforms","op","undos","inverseOps","operations","lastBatch","lastOp","save","merge","shouldSave","shouldMerge","stack","Path","RichTextEditor","forwardRef","props","forwardedRef","onChange","onFocus","onBlur","placeholder","EDITOR_DEFAULTS","isDisabled","isReadOnly","autoFocus","toolbar","useMemo","baseEditor","createEditor","withLinks","withReact","handleKeyDown","useKeyboardShortcuts","handleFocus","useCallback","event","handleBlur","useImperativeHandle","focusEditor","html","resetEditor","renderElement","jsx","Element","renderLeaf","Leaf","defaultValue","createEmptyValue","safeInitialValue","jsxs","Slate","Editable","FormattingMenu","useSlate","withPreservedSelection","usePreservedSelection","allSelectedKeys","handleAllSelectionChange","useFormattingState","Menu","Tooltip","IconButton","MoreHoriz","Box","FormatStrikethrough","Text","Code","RichTextToolbar","currentTextStyle","selectedTextStyleLabel","handleTextStyleChange","handleListToggle","selectedFormatKeys","selectedListKeys","hasUndos","hasRedos","useToolbarState","Toolbar","Group","styleId","KeyboardArrowDown","textStyles","style","Divider","ToggleButtonGroup","IconToggleButton","toggleMark","FormatBold","VisuallyHidden","FormatItalic","FormatUnderlined","FormatListBulleted","FormatListNumbered","Undo","Redo","RichTextInput","isInvalid","restProps","recipe","useSlotRecipe","recipeProps","remainingProps","styleProps","functionalProps","extractStyleProps","dataAttributes","internalValue","setInternalValue","useState","initialHtml","fromHTML","error","serializedValue","setSerializedValue","editorRef","useRef","useEffect","newSlateValue","handleChange","slateValue","newHtml","toHTML","hasSerializedValueChanged","safeValue","validSlateStateAdapter"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,MAAMA,IAAsB,gBAAAC,GAAiB;AAAA,EAClD,OAAO,CAAC,QAAQ,WAAW,UAAU;AAAA,EACrC,WAAW;AAAA,EACX,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,eAAe;AAAA,MACf,UAAU;AAAA,MACV,OAAO;AAAA,MACP,cAAc;AAAA,MACd,aAAa;AAAA,MACb,cAAc;AAAA,MACd,aAAa;AAAA,MACb,iBAAiB;AAAA;AAAA,MAGjB,0BAA0B;AAAA,QACxB,aAAa;AAAA,QACb,aAAa;AAAA,MAAA;AAAA,IACf;AAAA,IAEF,SAAS;AAAA,MACP,WAAW;AAAA;AAAA,MAGX,4BAA4B;AAAA,QAC1B,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,UAAU;AAAA,MACR,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA;AAAA,MAGT,4BAA4B;AAAA,QAC1B,QAAQ;AAAA,QACR,SAAS;AAAA,MAAA;AAAA;AAAA,MAIX,OAAO;AAAA,QACL,WAAW;AAAA,QACX,YAAY;AAAA,MAAA;AAAA,MAEd,QAAQ;AAAA,QACN,WAAW;AAAA,QACX,YAAY;AAAA,MAAA;AAAA,MAEd,QAAQ;AAAA,QACN,WAAW;AAAA,QACX,YAAY;AAAA,MAAA;AAAA,MAEd,QAAQ;AAAA,QACN,WAAW;AAAA,QACX,YAAY;AAAA,MAAA;AAAA,MAEd,QAAQ;AAAA,QACN,WAAW;AAAA,QACX,YAAY;AAAA,MAAA;AAAA,MAEd,QAAQ;AAAA,QACN,WAAW;AAAA,QACX,YAAY;AAAA,MAAA;AAAA,MAEd,gBAAgB;AAAA,QACd,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,iBAAiB;AAAA,QACjB,aAAa;AAAA,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AAA,GAMtB0G,KAAYC,GAHGlB,CAGgC;AAErD,SACE,gBAAAhE;AAAA,IAAC/D;AAAA,IAAA;AAAA,MACE,GAAGyH;AAAA,MACH,GAAGE;AAAA,MACH,GAAGC;AAAA,MACH,GAAGE;AAAA,MACJ,KAAKzF;AAAA,MAEL,UAAA,gBAAA0B;AAAA,QAAC7B;AAAA,QAAA;AAAA,UACC,KAAKqG;AAAA,UACL,OAAOS;AAAA,UACP,UAAUL;AAAA,UACV,SAAApG;AAAA,UACA,QAAAC;AAAA,UACA,aAAAC;AAAA,UACA,YAAAE;AAAA,UACA,YAAAC;AAAA,UACA,WAAAC;AAAA,UACA,SACGD,IAA2D,OAA9C,gBAAAmB,EAACyB,IAAA,EAAgB,YAAA7C,GAAwB;AAAA,QAAK;AAAA,MAAA;AAAA,IAEhE;AAAA,EAAA;AAGN;AAEAyE,GAAc,cAAc;","x_google_ignoreList":[2]}
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react/jsx-runtime"),p=require("react"),k=require("@chakra-ui/react"),oe=require("./extractStyleProps-yFm0qaXg.cjs.js"),n=require("./slate-helpers-CMAwCMk0.cjs.js"),D=require("./use-formatting-state-Denpy3Zo.cjs.js"),I=require("../components/constants.cjs"),b=require("./box-BPfqlznQ.cjs.js"),N=require("./divider-CTTExmLv.cjs.js"),U=require("./group-BwSwp_8B.cjs.js"),O=require("./icon-button-CCrfnUUB.cjs.js"),w=require("./icon-toggle-button-D5Uji9qU.cjs.js"),v=require("./text-hUMahKuA.cjs.js"),d=require("./tooltip-DjUjwciC.cjs.js"),M=require("./visually-hidden-Uhh-2Y-q.cjs.js"),_=require("./toggle-button-group-C-jzm7ev.cjs.js"),re=require("./toolbar-Dbq_EngE.cjs.js"),f=require("@commercetools/nimbus-icons"),y=require("./menu-BX993uzm.cjs.js"),G=k.defineSlotRecipe({slots:["root","toolbar","editable"],className:"nimbus-rich-text-input",base:{root:{display:"flex",flexDirection:"column",position:"relative",width:"full",borderRadius:"200",borderWidth:"{sizes.25}",colorPalette:"slate",borderColor:"colorPalette.7",backgroundColor:"colorPalette.contrast","&[data-invalid='true']":{borderWidth:"{sizes.50}",borderColor:"critical.7"}},toolbar:{boxShadow:"1","[data-disabled='true'] &":{opacity:"0.5"}},editable:{padding:"400",minHeight:"inherit",outline:"none","[data-disabled='true'] &":{cursor:"not-allowed",opacity:"0.5"},"& p":{textStyle:"md",fontWeight:"500"},"& h1":{textStyle:"2xl",fontWeight:"500"},"& h2":{textStyle:"xl",fontWeight:"500"},"& h3":{textStyle:"lg",fontWeight:"500"},"& h4":{textStyle:"md",fontWeight:"500"},"& h5":{textStyle:"xs",fontWeight:"500"},"& blockquote":{textStyle:"md",fontWeight:"400",borderLeftWidth:"{sizes.100}",paddingLeft:"400"},"& ul":{paddingLeft:"600",listStyleType:"disc"},"& ol":{paddingLeft:"600",listStyleType:"decimal"},"& code":{padding:"100",fontFamily:"mono"},"& pre":{padding:"300",borderRadius:"200",overflow:"auto","& code":{padding:"0"}},"& a":{color:"primary.11",textDecoration:"underline",cursor:"pointer",_hover:{textDecoration:"none"}},"& strong":{fontWeight:"700"},"& em":{fontStyle:"italic"},"& u":{textDecoration:"underline"},"& del":{textDecoration:"line-through"},"& sup":{fontSize:"75%",verticalAlign:"super",lineHeight:"0"},"& sub":{fontSize:"75%",verticalAlign:"sub",lineHeight:"0"}}},variants:{}}),{withProvider:ne,withContext:K}=k.createSlotRecipeContext({recipe:G}),ie=ne("div","root"),se=K("div","toolbar"),le=K("div","editable");var ae={isHistory(t){return n.isPlainObject(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(t.redos.length===0||n.Operation.isOperationList(t.redos[0].operations))&&(t.undos.length===0||n.Operation.isOperationList(t.undos[0].operations))}},z=new WeakMap,S=new WeakMap,C=new WeakMap,m={isHistoryEditor(t){return ae.isHistory(t.history)&&n.Editor.isEditor(t)},isMerging(t){return S.get(t)},isSplittingOnce(t){return C.get(t)},setSplittingOnce(t,o){C.set(t,o)},isSaving(t){return z.get(t)},redo(t){t.redo()},undo(t){t.undo()},withMerging(t,o){var i=m.isMerging(t);S.set(t,!0),o(),S.set(t,i)},withNewBatch(t,o){var i=m.isMerging(t);S.set(t,!0),C.set(t,!0),o(),S.set(t,i),C.delete(t)},withoutMerging(t,o){var i=m.isMerging(t);S.set(t,!1),o(),S.set(t,i)},withoutSaving(t,o){var i=m.isSaving(t);z.set(t,!1);try{o()}finally{z.set(t,i)}}},de=t=>{var o=t,{apply:i}=o;return o.history={undos:[],redos:[]},o.redo=()=>{var{history:l}=o,{redos:s}=l;if(s.length>0){var a=s[s.length-1];a.selectionBefore&&n.Transforms.setSelection(o,a.selectionBefore),m.withoutSaving(o,()=>{n.Editor.withoutNormalizing(o,()=>{for(var c of a.operations)o.apply(c)})}),l.redos.pop(),o.writeHistory("undos",a)}},o.undo=()=>{var{history:l}=o,{undos:s}=l;if(s.length>0){var a=s[s.length-1];m.withoutSaving(o,()=>{n.Editor.withoutNormalizing(o,()=>{var c=a.operations.map(n.Operation.inverse).reverse();for(var u of c)o.apply(u);a.selectionBefore&&n.Transforms.setSelection(o,a.selectionBefore)})}),o.writeHistory("redos",a),l.undos.pop()}},o.apply=l=>{var{operations:s,history:a}=o,{undos:c}=a,u=c[c.length-1],j=u&&u.operations[u.operations.length-1],g=m.isSaving(o),h=m.isMerging(o);if(g==null&&(g=ue(l)),g){if(h==null&&(u==null?h=!1:s.length!==0?h=!0:h=ce(l,j)),m.isSplittingOnce(o)&&(h=!1,m.setSplittingOnce(o,void 0)),u&&h)u.operations.push(l);else{var r={operations:[l],selectionBefore:o.selection};o.writeHistory("undos",r)}for(;c.length>100;)c.shift();a.redos=[]}i(l)},o.writeHistory=(l,s)=>{o.history[l].push(s)},o},ce=(t,o)=>!!(o&&t.type==="insert_text"&&o.type==="insert_text"&&t.offset===o.offset+o.text.length&&n.Path.equals(t.path,o.path)||o&&t.type==="remove_text"&&o.type==="remove_text"&&t.offset+t.text.length===o.offset&&n.Path.equals(t.path,o.path)),ue=(t,o)=>t.type!=="set_selection";const X=p.forwardRef((t,o)=>{const{value:i,onChange:l,onFocus:s,onBlur:a,placeholder:c=I.EDITOR_DEFAULTS.placeholder,isDisabled:u=I.EDITOR_DEFAULTS.isDisabled,isReadOnly:j=I.EDITOR_DEFAULTS.isReadOnly,autoFocus:g=I.EDITOR_DEFAULTS.autoFocus,toolbar:h}=t,r=p.useMemo(()=>{const x=n.createEditor();return n.withLinks(de(n.withReact(x)))},[]),{handleKeyDown:E}=D.useKeyboardShortcuts({editor:r}),H=p.useCallback(x=>{s&&s(x)},[s]),L=p.useCallback(x=>{a&&a(x)},[a]);p.useImperativeHandle(o,()=>({focus:()=>n.focusEditor(r),resetValue:x=>n.resetEditor(r,x)}),[r]);const P=p.useCallback(x=>e.jsx(n.Element$1,{...x}),[]),F=p.useCallback(x=>e.jsx(n.Leaf,{...x}),[]),q=n.createEmptyValue(),V=Array.isArray(i)&&i.length>0?i:q;return e.jsxs(n.Slate,{editor:r,value:V,onChange:l,children:[h&&e.jsx(se,{children:h}),e.jsx(le,{asChild:!0,children:e.jsx(n.Editable,{renderElement:P,renderLeaf:F,placeholder:c,autoFocus:g,readOnly:j||u,onKeyDown:E,onFocus:H,onBlur:L,"aria-label":"Rich text editor",role:"textbox","aria-multiline":"true"})})]})});X.displayName="RichTextEditor";const he=({isDisabled:t=!1})=>{const o=n.useSlate(),i=D.usePreservedSelection(o),{allSelectedKeys:l,handleAllSelectionChange:s}=D.useFormattingState({withPreservedSelection:i});return e.jsxs(y.Menu.Root,{selectionMode:"multiple",selectedKeys:l,onSelectionChange:s,children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(y.Menu.Trigger,{asChild:!0,children:e.jsx(O.IconButton,{size:"xs",variant:"ghost","aria-label":"More formatting options",isDisabled:t,onMouseDown:a=>a.preventDefault(),children:e.jsx(f.MoreHoriz,{})})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"More styles"})]}),e.jsxs(y.Menu.Content,{children:[e.jsx(y.Menu.Item,{id:"strikethrough",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(f.FormatStrikethrough,{}),e.jsx(v.Text,{textStyle:"sm",children:"Strikethrough"})]})}),e.jsx(y.Menu.Item,{id:"code",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(f.Code,{}),e.jsx(v.Text,{textStyle:"sm",children:"Code"})]})}),e.jsx(y.Menu.Item,{id:"superscript",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(v.Text,{children:"X²"}),e.jsx(v.Text,{textStyle:"sm",children:"Superscript"})]})}),e.jsx(y.Menu.Item,{id:"subscript",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(v.Text,{children:"X₂"}),e.jsx(v.Text,{textStyle:"sm",children:"Subscript"})]})})]})]})},$=({isDisabled:t=!1})=>{const o=n.useSlate(),i=D.usePreservedSelection(o),{currentTextStyle:l,selectedTextStyleLabel:s,handleTextStyleChange:a,handleListToggle:c,selectedFormatKeys:u,selectedListKeys:j,hasUndos:g,hasRedos:h}=D.useToolbarState({withPreservedSelection:i});return e.jsxs(re.Toolbar,{orientation:"horizontal","aria-label":"Text formatting",width:"full",overflow:"hidden",size:"xs",children:[e.jsx(U.Group,{children:e.jsxs(y.Menu.Root,{onAction:r=>a(String(r)),children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(y.Menu.Trigger,{height:"800",width:"4000",bg:"primary.1",borderRadius:"200",_hover:{bg:"primary.2"},isDisabled:t,onMouseDown:r=>r.preventDefault(),"aria-label":"Text style menu",children:e.jsxs(b.Box,{display:"flex",alignItems:"center",gap:"200",px:"200",children:[e.jsx(b.Box,{display:"flex",alignItems:"center",gap:"200",flexGrow:"1",children:e.jsx(v.Text,{my:"auto",textStyle:"sm",fontWeight:"500",children:s})}),e.jsx(f.KeyboardArrowDown,{})]})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Text style"})]}),e.jsx(y.Menu.Content,{children:I.textStyles.map(r=>e.jsx(y.Menu.Item,{id:r.id,...l===r.id&&{"data-state":"checked"},children:e.jsx(v.Text,{...r.props,children:r.label})},r.id))})]})}),e.jsx(N.Divider,{orientation:"vertical"}),e.jsxs(_.ToggleButtonGroup.Root,{selectionMode:"multiple",selectedKeys:u,isDisabled:t,children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(w.IconToggleButton,{id:"bold",size:"xs",variant:"ghost","aria-label":"Bold",isDisabled:t,onMouseDown:r=>r.preventDefault(),onPress:i(()=>n.toggleMark(o,"bold")),children:[e.jsx(f.FormatBold,{}),e.jsx(M.VisuallyHidden,{children:"Bold"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Bold"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(w.IconToggleButton,{id:"italic",size:"xs",variant:"ghost","aria-label":"Italic",isDisabled:t,onMouseDown:r=>r.preventDefault(),onPress:i(()=>n.toggleMark(o,"italic")),children:[e.jsx(f.FormatItalic,{}),e.jsx(M.VisuallyHidden,{children:"Italic"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Italic"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(w.IconToggleButton,{id:"underline",size:"xs",variant:"ghost","aria-label":"Underline",isDisabled:t,onMouseDown:r=>r.preventDefault(),onPress:i(()=>n.toggleMark(o,"underline")),children:[e.jsx(f.FormatUnderlined,{}),e.jsx(M.VisuallyHidden,{children:"Underline"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Underline"})]})]}),e.jsx(he,{isDisabled:t}),e.jsx(N.Divider,{orientation:"vertical"}),e.jsxs(_.ToggleButtonGroup.Root,{selectionMode:"single",selectedKeys:j,onSelectionChange:c,"aria-label":"List formatting",isDisabled:t,children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(w.IconToggleButton,{id:"bulleted-list",size:"xs",variant:"ghost","aria-label":"Bulleted List",isDisabled:t,onMouseDown:r=>r.preventDefault(),children:e.jsx(f.FormatListBulleted,{})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Bulleted list"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(w.IconToggleButton,{id:"numbered-list",size:"xs",variant:"ghost","aria-label":"Numbered List",isDisabled:t,onMouseDown:r=>r.preventDefault(),children:e.jsx(f.FormatListNumbered,{})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Numbered list"})]})]}),e.jsx(b.Box,{flexGrow:"1"}),e.jsxs(U.Group,{children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(O.IconButton,{size:"xs",variant:"ghost","aria-label":"Undo",isDisabled:!g||t,onPress:i(()=>o.undo()),onMouseDown:r=>r.preventDefault(),children:[e.jsx(f.Undo,{}),e.jsx(M.VisuallyHidden,{children:"Undo"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Undo"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(O.IconButton,{size:"xs",variant:"ghost","aria-label":"Redo",isDisabled:!h||t,onPress:i(()=>o.redo()),onMouseDown:r=>r.preventDefault(),children:[e.jsx(f.Redo,{}),e.jsx(M.VisuallyHidden,{children:"Redo"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Redo"})]})]})]})};$.displayName="RichTextToolbar";const J=t=>{const{ref:o,value:i,defaultValue:l,onChange:s,onFocus:a,onBlur:c,placeholder:u="",isDisabled:j=!1,isReadOnly:g=!1,isInvalid:h=!1,autoFocus:r=!1,...E}=t,H=k.useSlotRecipe({recipe:G}),[L,P]=H.splitVariantProps({...E}),[F,q]=oe.extractStyleProps(P),V={"data-disabled":j?"true":void 0,"data-invalid":h?"true":void 0,"data-readonly":g?"true":void 0},[x,A]=p.useState(()=>{const T=i??l??"";try{return T?n.fromHTML(T):n.createEmptyValue()}catch(R){return console.warn("Failed to parse initial HTML, using empty value:",R),n.createEmptyValue()}}),[B,W]=p.useState(()=>i??l??""),Q=p.useRef(null);p.useEffect(()=>{if(i!==void 0&&i!==B){const T=i?n.fromHTML(i):n.createEmptyValue();A(T),W(i)}},[i,B]);const Y=p.useCallback(T=>{const R=n.toHTML(T),te=R!==B;A(T),W(R),te&&s&&s(R)},[B,s]),Z=x,ee=n.validSlateStateAdapter(Z);return e.jsx(ie,{...L,...F,...q,...V,ref:o,children:e.jsx(X,{ref:Q,value:ee,onChange:Y,onFocus:a,onBlur:c,placeholder:u,isDisabled:j,isReadOnly:g,autoFocus:r,toolbar:g?null:e.jsx($,{isDisabled:j})})})};J.displayName="RichTextInput";exports.RichTextInput=J;
2
- //# sourceMappingURL=rich-text-input-iDEygf74.cjs.js.map
1
+ "use strict";const e=require("react/jsx-runtime"),p=require("react"),k=require("@chakra-ui/react"),oe=require("./extractStyleProps-yFm0qaXg.cjs.js"),n=require("./slate-helpers-CMAwCMk0.cjs.js"),D=require("./use-formatting-state-Denpy3Zo.cjs.js"),I=require("../components/constants.cjs"),b=require("./box-BPfqlznQ.cjs.js"),N=require("./divider-CTTExmLv.cjs.js"),U=require("./group-BwSwp_8B.cjs.js"),O=require("./icon-button-BPQdpTPZ.cjs.js"),w=require("./icon-toggle-button-D5Uji9qU.cjs.js"),v=require("./text-hUMahKuA.cjs.js"),d=require("./tooltip-DjUjwciC.cjs.js"),M=require("./visually-hidden-Uhh-2Y-q.cjs.js"),_=require("./toggle-button-group-C-jzm7ev.cjs.js"),re=require("./toolbar-Dbq_EngE.cjs.js"),f=require("@commercetools/nimbus-icons"),y=require("./menu-BX993uzm.cjs.js"),G=k.defineSlotRecipe({slots:["root","toolbar","editable"],className:"nimbus-rich-text-input",base:{root:{display:"flex",flexDirection:"column",position:"relative",width:"full",borderRadius:"200",borderWidth:"{sizes.25}",colorPalette:"slate",borderColor:"colorPalette.7",backgroundColor:"colorPalette.contrast","&[data-invalid='true']":{borderWidth:"{sizes.50}",borderColor:"critical.7"}},toolbar:{boxShadow:"1","[data-disabled='true'] &":{opacity:"0.5"}},editable:{padding:"400",minHeight:"inherit",outline:"none","[data-disabled='true'] &":{cursor:"not-allowed",opacity:"0.5"},"& p":{textStyle:"md",fontWeight:"500"},"& h1":{textStyle:"2xl",fontWeight:"500"},"& h2":{textStyle:"xl",fontWeight:"500"},"& h3":{textStyle:"lg",fontWeight:"500"},"& h4":{textStyle:"md",fontWeight:"500"},"& h5":{textStyle:"xs",fontWeight:"500"},"& blockquote":{textStyle:"md",fontWeight:"400",borderLeftWidth:"{sizes.100}",paddingLeft:"400"},"& ul":{paddingLeft:"600",listStyleType:"disc"},"& ol":{paddingLeft:"600",listStyleType:"decimal"},"& code":{padding:"100",fontFamily:"mono"},"& pre":{padding:"300",borderRadius:"200",overflow:"auto","& code":{padding:"0"}},"& a":{color:"primary.11",textDecoration:"underline",cursor:"pointer",_hover:{textDecoration:"none"}},"& strong":{fontWeight:"700"},"& em":{fontStyle:"italic"},"& u":{textDecoration:"underline"},"& del":{textDecoration:"line-through"},"& sup":{fontSize:"75%",verticalAlign:"super",lineHeight:"0"},"& sub":{fontSize:"75%",verticalAlign:"sub",lineHeight:"0"}}},variants:{}}),{withProvider:ne,withContext:K}=k.createSlotRecipeContext({recipe:G}),ie=ne("div","root"),se=K("div","toolbar"),le=K("div","editable");var ae={isHistory(t){return n.isPlainObject(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(t.redos.length===0||n.Operation.isOperationList(t.redos[0].operations))&&(t.undos.length===0||n.Operation.isOperationList(t.undos[0].operations))}},z=new WeakMap,S=new WeakMap,C=new WeakMap,m={isHistoryEditor(t){return ae.isHistory(t.history)&&n.Editor.isEditor(t)},isMerging(t){return S.get(t)},isSplittingOnce(t){return C.get(t)},setSplittingOnce(t,o){C.set(t,o)},isSaving(t){return z.get(t)},redo(t){t.redo()},undo(t){t.undo()},withMerging(t,o){var i=m.isMerging(t);S.set(t,!0),o(),S.set(t,i)},withNewBatch(t,o){var i=m.isMerging(t);S.set(t,!0),C.set(t,!0),o(),S.set(t,i),C.delete(t)},withoutMerging(t,o){var i=m.isMerging(t);S.set(t,!1),o(),S.set(t,i)},withoutSaving(t,o){var i=m.isSaving(t);z.set(t,!1);try{o()}finally{z.set(t,i)}}},de=t=>{var o=t,{apply:i}=o;return o.history={undos:[],redos:[]},o.redo=()=>{var{history:l}=o,{redos:s}=l;if(s.length>0){var a=s[s.length-1];a.selectionBefore&&n.Transforms.setSelection(o,a.selectionBefore),m.withoutSaving(o,()=>{n.Editor.withoutNormalizing(o,()=>{for(var c of a.operations)o.apply(c)})}),l.redos.pop(),o.writeHistory("undos",a)}},o.undo=()=>{var{history:l}=o,{undos:s}=l;if(s.length>0){var a=s[s.length-1];m.withoutSaving(o,()=>{n.Editor.withoutNormalizing(o,()=>{var c=a.operations.map(n.Operation.inverse).reverse();for(var u of c)o.apply(u);a.selectionBefore&&n.Transforms.setSelection(o,a.selectionBefore)})}),o.writeHistory("redos",a),l.undos.pop()}},o.apply=l=>{var{operations:s,history:a}=o,{undos:c}=a,u=c[c.length-1],j=u&&u.operations[u.operations.length-1],g=m.isSaving(o),h=m.isMerging(o);if(g==null&&(g=ue(l)),g){if(h==null&&(u==null?h=!1:s.length!==0?h=!0:h=ce(l,j)),m.isSplittingOnce(o)&&(h=!1,m.setSplittingOnce(o,void 0)),u&&h)u.operations.push(l);else{var r={operations:[l],selectionBefore:o.selection};o.writeHistory("undos",r)}for(;c.length>100;)c.shift();a.redos=[]}i(l)},o.writeHistory=(l,s)=>{o.history[l].push(s)},o},ce=(t,o)=>!!(o&&t.type==="insert_text"&&o.type==="insert_text"&&t.offset===o.offset+o.text.length&&n.Path.equals(t.path,o.path)||o&&t.type==="remove_text"&&o.type==="remove_text"&&t.offset+t.text.length===o.offset&&n.Path.equals(t.path,o.path)),ue=(t,o)=>t.type!=="set_selection";const X=p.forwardRef((t,o)=>{const{value:i,onChange:l,onFocus:s,onBlur:a,placeholder:c=I.EDITOR_DEFAULTS.placeholder,isDisabled:u=I.EDITOR_DEFAULTS.isDisabled,isReadOnly:j=I.EDITOR_DEFAULTS.isReadOnly,autoFocus:g=I.EDITOR_DEFAULTS.autoFocus,toolbar:h}=t,r=p.useMemo(()=>{const x=n.createEditor();return n.withLinks(de(n.withReact(x)))},[]),{handleKeyDown:E}=D.useKeyboardShortcuts({editor:r}),H=p.useCallback(x=>{s&&s(x)},[s]),L=p.useCallback(x=>{a&&a(x)},[a]);p.useImperativeHandle(o,()=>({focus:()=>n.focusEditor(r),resetValue:x=>n.resetEditor(r,x)}),[r]);const P=p.useCallback(x=>e.jsx(n.Element$1,{...x}),[]),F=p.useCallback(x=>e.jsx(n.Leaf,{...x}),[]),q=n.createEmptyValue(),V=Array.isArray(i)&&i.length>0?i:q;return e.jsxs(n.Slate,{editor:r,value:V,onChange:l,children:[h&&e.jsx(se,{children:h}),e.jsx(le,{asChild:!0,children:e.jsx(n.Editable,{renderElement:P,renderLeaf:F,placeholder:c,autoFocus:g,readOnly:j||u,onKeyDown:E,onFocus:H,onBlur:L,"aria-label":"Rich text editor",role:"textbox","aria-multiline":"true"})})]})});X.displayName="RichTextEditor";const he=({isDisabled:t=!1})=>{const o=n.useSlate(),i=D.usePreservedSelection(o),{allSelectedKeys:l,handleAllSelectionChange:s}=D.useFormattingState({withPreservedSelection:i});return e.jsxs(y.Menu.Root,{selectionMode:"multiple",selectedKeys:l,onSelectionChange:s,children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(y.Menu.Trigger,{asChild:!0,children:e.jsx(O.IconButton,{size:"xs",variant:"ghost","aria-label":"More formatting options",isDisabled:t,onMouseDown:a=>a.preventDefault(),children:e.jsx(f.MoreHoriz,{})})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"More styles"})]}),e.jsxs(y.Menu.Content,{children:[e.jsx(y.Menu.Item,{id:"strikethrough",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(f.FormatStrikethrough,{}),e.jsx(v.Text,{textStyle:"sm",children:"Strikethrough"})]})}),e.jsx(y.Menu.Item,{id:"code",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(f.Code,{}),e.jsx(v.Text,{textStyle:"sm",children:"Code"})]})}),e.jsx(y.Menu.Item,{id:"superscript",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(v.Text,{children:"X²"}),e.jsx(v.Text,{textStyle:"sm",children:"Superscript"})]})}),e.jsx(y.Menu.Item,{id:"subscript",children:e.jsxs(b.Box,{slot:"label",display:"flex",alignItems:"center",gap:"200",children:[e.jsx(v.Text,{children:"X₂"}),e.jsx(v.Text,{textStyle:"sm",children:"Subscript"})]})})]})]})},$=({isDisabled:t=!1})=>{const o=n.useSlate(),i=D.usePreservedSelection(o),{currentTextStyle:l,selectedTextStyleLabel:s,handleTextStyleChange:a,handleListToggle:c,selectedFormatKeys:u,selectedListKeys:j,hasUndos:g,hasRedos:h}=D.useToolbarState({withPreservedSelection:i});return e.jsxs(re.Toolbar,{orientation:"horizontal","aria-label":"Text formatting",width:"full",overflow:"hidden",size:"xs",children:[e.jsx(U.Group,{children:e.jsxs(y.Menu.Root,{onAction:r=>a(String(r)),children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(y.Menu.Trigger,{height:"800",width:"4000",bg:"primary.1",borderRadius:"200",_hover:{bg:"primary.2"},isDisabled:t,onMouseDown:r=>r.preventDefault(),"aria-label":"Text style menu",children:e.jsxs(b.Box,{display:"flex",alignItems:"center",gap:"200",px:"200",children:[e.jsx(b.Box,{display:"flex",alignItems:"center",gap:"200",flexGrow:"1",children:e.jsx(v.Text,{my:"auto",textStyle:"sm",fontWeight:"500",children:s})}),e.jsx(f.KeyboardArrowDown,{})]})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Text style"})]}),e.jsx(y.Menu.Content,{children:I.textStyles.map(r=>e.jsx(y.Menu.Item,{id:r.id,...l===r.id&&{"data-state":"checked"},children:e.jsx(v.Text,{...r.props,children:r.label})},r.id))})]})}),e.jsx(N.Divider,{orientation:"vertical"}),e.jsxs(_.ToggleButtonGroup.Root,{selectionMode:"multiple",selectedKeys:u,isDisabled:t,children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(w.IconToggleButton,{id:"bold",size:"xs",variant:"ghost","aria-label":"Bold",isDisabled:t,onMouseDown:r=>r.preventDefault(),onPress:i(()=>n.toggleMark(o,"bold")),children:[e.jsx(f.FormatBold,{}),e.jsx(M.VisuallyHidden,{children:"Bold"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Bold"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(w.IconToggleButton,{id:"italic",size:"xs",variant:"ghost","aria-label":"Italic",isDisabled:t,onMouseDown:r=>r.preventDefault(),onPress:i(()=>n.toggleMark(o,"italic")),children:[e.jsx(f.FormatItalic,{}),e.jsx(M.VisuallyHidden,{children:"Italic"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Italic"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(w.IconToggleButton,{id:"underline",size:"xs",variant:"ghost","aria-label":"Underline",isDisabled:t,onMouseDown:r=>r.preventDefault(),onPress:i(()=>n.toggleMark(o,"underline")),children:[e.jsx(f.FormatUnderlined,{}),e.jsx(M.VisuallyHidden,{children:"Underline"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Underline"})]})]}),e.jsx(he,{isDisabled:t}),e.jsx(N.Divider,{orientation:"vertical"}),e.jsxs(_.ToggleButtonGroup.Root,{selectionMode:"single",selectedKeys:j,onSelectionChange:c,"aria-label":"List formatting",isDisabled:t,children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(w.IconToggleButton,{id:"bulleted-list",size:"xs",variant:"ghost","aria-label":"Bulleted List",isDisabled:t,onMouseDown:r=>r.preventDefault(),children:e.jsx(f.FormatListBulleted,{})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Bulleted list"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsx(w.IconToggleButton,{id:"numbered-list",size:"xs",variant:"ghost","aria-label":"Numbered List",isDisabled:t,onMouseDown:r=>r.preventDefault(),children:e.jsx(f.FormatListNumbered,{})}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Numbered list"})]})]}),e.jsx(b.Box,{flexGrow:"1"}),e.jsxs(U.Group,{children:[e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(O.IconButton,{size:"xs",variant:"ghost","aria-label":"Undo",isDisabled:!g||t,onPress:i(()=>o.undo()),onMouseDown:r=>r.preventDefault(),children:[e.jsx(f.Undo,{}),e.jsx(M.VisuallyHidden,{children:"Undo"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Undo"})]}),e.jsxs(d.Tooltip.Root,{delay:0,closeDelay:0,children:[e.jsxs(O.IconButton,{size:"xs",variant:"ghost","aria-label":"Redo",isDisabled:!h||t,onPress:i(()=>o.redo()),onMouseDown:r=>r.preventDefault(),children:[e.jsx(f.Redo,{}),e.jsx(M.VisuallyHidden,{children:"Redo"})]}),e.jsx(d.Tooltip.Content,{placement:"top",children:"Redo"})]})]})]})};$.displayName="RichTextToolbar";const J=t=>{const{ref:o,value:i,defaultValue:l,onChange:s,onFocus:a,onBlur:c,placeholder:u="",isDisabled:j=!1,isReadOnly:g=!1,isInvalid:h=!1,autoFocus:r=!1,...E}=t,H=k.useSlotRecipe({recipe:G}),[L,P]=H.splitVariantProps({...E}),[F,q]=oe.extractStyleProps(P),V={"data-disabled":j?"true":void 0,"data-invalid":h?"true":void 0,"data-readonly":g?"true":void 0},[x,A]=p.useState(()=>{const T=i??l??"";try{return T?n.fromHTML(T):n.createEmptyValue()}catch(R){return console.warn("Failed to parse initial HTML, using empty value:",R),n.createEmptyValue()}}),[B,W]=p.useState(()=>i??l??""),Q=p.useRef(null);p.useEffect(()=>{if(i!==void 0&&i!==B){const T=i?n.fromHTML(i):n.createEmptyValue();A(T),W(i)}},[i,B]);const Y=p.useCallback(T=>{const R=n.toHTML(T),te=R!==B;A(T),W(R),te&&s&&s(R)},[B,s]),Z=x,ee=n.validSlateStateAdapter(Z);return e.jsx(ie,{...L,...F,...q,...V,ref:o,children:e.jsx(X,{ref:Q,value:ee,onChange:Y,onFocus:a,onBlur:c,placeholder:u,isDisabled:j,isReadOnly:g,autoFocus:r,toolbar:g?null:e.jsx($,{isDisabled:j})})})};J.displayName="RichTextInput";exports.RichTextInput=J;
2
+ //# sourceMappingURL=rich-text-input-Cvcywluc.cjs.js.map