@sesamehr/react-design-system 3.5.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/Data/Table/TableBulkHeader/TableBulkHeader.d.ts +11 -8
  2. package/dist/Display/RichText/RichText.d.ts +31 -0
  3. package/dist/Display/RichText/index.d.ts +26 -0
  4. package/dist/Display/RichText/sanitizeHtml.d.ts +18 -0
  5. package/dist/Forms/Inputs/Calendar/Calendar.d.ts +52 -9
  6. package/dist/Forms/Inputs/Calendar/CalendarRange.d.ts +33 -9
  7. package/dist/Forms/Inputs/DatePicker/DatePicker.d.ts +19 -1
  8. package/dist/Forms/Inputs/DatePicker/DateRangePicker.d.ts +19 -1
  9. package/dist/Forms/Inputs/RichTextEditor/RichTextEditor.d.ts +48 -0
  10. package/dist/Forms/Inputs/RichTextEditor/RichTextToolbar/RichTextToolbar.d.ts +19 -0
  11. package/dist/Forms/Inputs/RichTextEditor/RichTextToolbar/index.d.ts +1 -0
  12. package/dist/Forms/Inputs/RichTextEditor/RichTextToolbarButton/RichTextToolbarButton.d.ts +19 -0
  13. package/dist/Forms/Inputs/RichTextEditor/RichTextToolbarButton/index.d.ts +1 -0
  14. package/dist/Forms/Inputs/RichTextEditor/commands.d.ts +67 -0
  15. package/dist/Forms/Inputs/RichTextEditor/devChecks.d.ts +92 -0
  16. package/dist/Forms/Inputs/RichTextEditor/extensions.d.ts +54 -0
  17. package/dist/Forms/Inputs/RichTextEditor/index.d.ts +7 -0
  18. package/dist/Forms/Inputs/RichTextEditor/useRichTextAdapter.d.ts +56 -0
  19. package/dist/Forms/Inputs/RichTextEditor/useRichTextToolbar.d.ts +26 -0
  20. package/dist/Forms/Inputs/index.d.ts +1 -0
  21. package/dist/main.d.ts +2 -1
  22. package/dist/react-design-system.css +1 -1
  23. package/dist/react-design-system.js +12517 -10985
  24. package/dist/react-design-system.umd.cjs +143 -58
  25. package/package.json +21 -1
@@ -0,0 +1,56 @@
1
+ import { Editor } from '@tiptap/core';
2
+ import { RichTextCommand } from './commands.ts';
3
+ /**
4
+ * What the toolbar talks to, and the only thing it talks to.
5
+ *
6
+ * Three questions, which between them are everything a toolbar button needs:
7
+ * run this, is it on, is it available. Nothing here mentions TipTap, so a
8
+ * second editor becomes an implementation of this interface rather than a
9
+ * second toolbar.
10
+ *
11
+ * **What this is deliberately not is an abstraction of the document.** The
12
+ * document stays TipTap JSON, read and written through the editor the caller
13
+ * owns. Abstracting that too would mean a schema of our own that has to be
14
+ * mapped onto ProseMirror's at both ends, which is a much larger thing than a
15
+ * toolbar needs and a worse one than ProseMirror's.
16
+ */
17
+ export interface RichTextAdapter {
18
+ /** Turn a command on, or off if it is already on. */
19
+ toggle: (command: RichTextCommand) => void;
20
+ /** Whether the command applies to the current selection. */
21
+ isActive: (command: RichTextCommand) => boolean;
22
+ /** Whether the command can run at all — a disabled button if not. */
23
+ can: (command: RichTextCommand) => boolean;
24
+ }
25
+ /** Whatever `OxRichTextEditor` will accept as the thing the toolbar drives. */
26
+ export type RichTextSource = Editor | RichTextAdapter;
27
+ /**
28
+ * `toggle` is the discriminator because it is the one name an `Editor` does not
29
+ * have. Reaching for `isActive` or `can` would match both — an `Editor` has
30
+ * those too, with different signatures, which is exactly the overlap that makes
31
+ * this interface fit over it.
32
+ */
33
+ export declare const isRichTextAdapter: (source: RichTextSource) => source is RichTextAdapter;
34
+ /**
35
+ * Normalises whatever the caller handed over into one reactive
36
+ * `RichTextAdapter`.
37
+ *
38
+ * **The reactivity is this hook's whole reason for existing**, and it is not
39
+ * optional plumbing. A toolbar built on `editor.isActive()` read during render
40
+ * would be memoised against an editor object whose identity never changes, so
41
+ * it would be evaluated once and never again: buttons that render correctly,
42
+ * respond to clicks, and never light up. Nothing would fail, no test asserting
43
+ * on a handler would notice, and the control would simply stop telling the
44
+ * truth after the first keystroke.
45
+ *
46
+ * That holds here even though `useEditor` in `@tiptap/react` re-renders its own
47
+ * caller on a transaction, and the reason is worth knowing: a re-render is not
48
+ * an invalidation. The editor instance is the same object across all of them,
49
+ * so a `useMemo` keyed on it keeps handing back the first answer. The editor's
50
+ * own `transaction` event is therefore the dependency — one counter, one
51
+ * subscription, and every button's state recomputed together.
52
+ *
53
+ * An adapter supplied by the caller is left alone: its reactivity is theirs,
54
+ * and a re-render recomputes the snapshot from it either way.
55
+ */
56
+ export declare const useRichTextAdapter: (source: RichTextSource | undefined) => RichTextAdapter;
@@ -0,0 +1,26 @@
1
+ import { RichTextAdapter } from './useRichTextAdapter.ts';
2
+ /**
3
+ * Published by `OxRichTextEditor` so a toolbar button needs no prop but its
4
+ * `command`.
5
+ *
6
+ * Context and not props, for the usual reason and one specific to this case:
7
+ * passing the adapter down would mean every button carrying it, and a toolbar
8
+ * is eleven buttons. The specific reason is that `command` is then the *whole*
9
+ * API — `<OxRichTextToolbarButton command="bold" />` — so a button that
10
+ * resolves its own icon, name and pressed state cannot be handed a mismatched
11
+ * set of the three.
12
+ *
13
+ * The context object is what the Vue side spells `provideRichTextAdapter`.
14
+ * Neither is exported from the barrel: this is the editor's wiring, and the
15
+ * only public half is the hook below.
16
+ */
17
+ export declare const RichTextAdapterContext: import('react').Context<RichTextAdapter | undefined>;
18
+ /**
19
+ * The adapter the toolbar drives.
20
+ *
21
+ * Throws rather than returning `undefined`, because there is no sensible
22
+ * degraded form: a toolbar with no editor is a row of buttons that do nothing,
23
+ * which looks finished and is not. A thrown error at mount names the mistake;
24
+ * a silent no-op would be found by a user.
25
+ */
26
+ export declare const useRichTextToolbar: () => RichTextAdapter;
@@ -9,6 +9,7 @@ export * from './ChatInput/index.ts';
9
9
  export * from './ColorPicker/index.ts';
10
10
  export * from './IconPicker/index.ts';
11
11
  export * from './DatePicker/index.ts';
12
+ export * from './RichTextEditor/index.ts';
12
13
  export * from './SearchBar/index.ts';
13
14
  export * from './SearchPanel/index.ts';
14
15
  export * from './Select/index.ts';
package/dist/main.d.ts CHANGED
@@ -39,6 +39,7 @@ export { VoiceMessage as OxVoiceMessage, type AudiowaveformJson, type WaveformSo
39
39
  export { FilePreviewCard as OxFilePreviewCard } from './Display/FilePreviewCard/index.ts';
40
40
  export { ChatBubble as OxChatBubble, chatBubbleVariants, type ChatBubbleDelivery, type ChatBubbleVariants, } from './Display/ChatBubble/index.ts';
41
41
  export { ChatBubbleStatus as OxChatBubbleStatus, chatBubbleStatusVariants, type ChatBubbleStatusVariants, } from './Display/ChatBubble/ChatBubbleStatus/index.ts';
42
+ export { RichText as OxRichText, RICH_TEXT_SCHEMA, type RichTextSchemaMark, type RichTextSchemaNode, } from './Display/RichText/index.ts';
42
43
  export { Mention as OxMention, mentionVariants, type MentionVariants, } from './Display/Mention/index.ts';
43
44
  export { Chip as OxChip, chipVariants, type ChipVariants, } from './Display/Chip/index.ts';
44
45
  export { PlayerPill as OxPlayerPill, PlayerPillAction as OxPlayerPillAction, PlayerPillStatus as OxPlayerPillStatus, PlayerPillTime as OxPlayerPillTime, playerPillVariants, type PlayerPillActionName, type PlayerPillState, type PlayerPillVariants, } from './Display/PlayerPill/index.ts';
@@ -69,6 +70,6 @@ export { Breadcrumb as OxBreadcrumb, BreadcrumbList as OxBreadcrumbList, Breadcr
69
70
  export { Counter as OxCounter, counterVariants, type CounterVariants, } from './Forms/Field/Counter/index.ts';
70
71
  export { FieldGroup as OxFieldGroup, FieldLabel as OxFieldLabel, FieldMessage as OxFieldMessage, useFieldControl, useFieldControlGroup, type FieldControlAttrs, type FieldControlGroupAttrs, type FieldGroupProps, type FieldVariant, } from './Forms/Field/index.ts';
71
72
  export { AiSearch as OxAiSearch, AiSearchAsk as OxAiSearchAsk, AiSearchPanel as OxAiSearchPanel, AiSearchSend as OxAiSearchSend, AiSearchShortcut as OxAiSearchShortcut, AiSearchSuggestion as OxAiSearchSuggestion, } from './Forms/Inputs/AiSearch/index.ts';
72
- export { InputGroup as OxInputGroup, InputText as OxInputText, InputNumber as OxInputNumber, InputNumberContent as OxInputNumberContent, InputNumberDecrement as OxInputNumberDecrement, InputNumberIncrement as OxInputNumberIncrement, InputNumberInput as OxInputNumberInput, InputPassword as OxInputPassword, InputPasswordInput as OxInputPasswordInput, InputPasswordToggle as OxInputPasswordToggle, useInputPassword, InputOtp as OxInputOtp, InputOtpGroup as OxInputOtpGroup, InputOtpSlot as OxInputOtpSlot, InputOtpSeparator as OxInputOtpSeparator, useInputOtp, Calendar as OxCalendar, CalendarRange as OxCalendarRange, CalendarDay as OxCalendarDay, calendarDayVariants, Combobox as OxCombobox, ComboboxCancel as OxComboboxCancel, ComboboxInput as OxComboboxInput, ComboboxChipsInput as OxComboboxChipsInput, ComboboxContent as OxComboboxContent, ComboboxItem as OxComboboxItem, ComboboxItemEdit as OxComboboxItemEdit, ComboboxEmpty as OxComboboxEmpty, ComboboxGroup as OxComboboxGroup, ComboboxSeparator as OxComboboxSeparator, ChatInput as OxChatInput, ColorPicker as OxColorPicker, ColorPickerTrigger as OxColorPickerTrigger, ColorPickerContent as OxColorPickerContent, ColorPickerSwatch as OxColorPickerSwatch, useColorPicker, IconPicker as OxIconPicker, IconPickerTrigger as OxIconPickerTrigger, IconPickerContent as OxIconPickerContent, IconPickerItem as OxIconPickerItem, useIconPicker, DatePicker as OxDatePicker, DateRangePicker as OxDateRangePicker, DatePickerTrigger as OxDatePickerTrigger, DatePickerHeader as OxDatePickerHeader, DatePickerMonthSelect as OxDatePickerMonthSelect, DatePickerYearSelect as OxDatePickerYearSelect, SearchBar as OxSearchBar, searchBarVariants, SearchPanel as OxSearchPanel, SearchPanelInput as OxSearchPanelInput, SearchPanelList as OxSearchPanelList, SearchPanelGroup as OxSearchPanelGroup, SearchPanelItem as OxSearchPanelItem, SearchPanelEmpty as OxSearchPanelEmpty, Select as OxSelect, SelectTrigger as OxSelectTrigger, SelectContent as OxSelectContent, SelectItem as OxSelectItem, SelectGroup as OxSelectGroup, SelectSeparator as OxSelectSeparator, TimePicker as OxTimePicker, TimePickerField as OxTimePickerField, TimePickerList as OxTimePickerList, TimePickerWheel as OxTimePickerWheel, TimePickerWheelColumn as OxTimePickerWheelColumn, Textarea as OxTextarea, Switch as OxSwitch, Checkbox as OxCheckbox, RadioButton as OxRadioButton, RadioGroup as OxRadioGroup, ToggleGroup as OxToggleGroup, ToggleLabel as OxToggleLabel, ToggleDescription as OxToggleDescription, SWITCH_SIZES, type InputNumberProps, type InputPasswordProps, type InputPasswordContext, type InputOtpProps, type InputOtpSlotProps, type InputOtpContext, type CalendarProps, type CalendarRangeProps, type CalendarDateRange, type CalendarDayProps, type CalendarDayState, type CalendarDayVariants, type CalendarConstraints, type CalendarNav, type ComboboxProps, type ChatInputActionLabels, type ChatInputState, type ColorPickerProps, type ColorPickerContext, type IconPickerProps, type IconPickerContext, type DatePickerProps, type DateRangePickerProps, type DatePickerTriggerProps, type DatePickerHeaderProps, type DatePickerMonthSelectProps, type DatePickerYearSelectProps, type SearchBarVariants, type SelectProps, type TimePickerProps, type TimeFormat, type TimePart, type TextareaCounterState, type RadioGroupProps, type ToggleGroupProps, type ToggleLabelProps, type ToggleDescriptionProps, } from './Forms/Inputs/index.ts';
73
+ export { InputGroup as OxInputGroup, InputText as OxInputText, InputNumber as OxInputNumber, InputNumberContent as OxInputNumberContent, InputNumberDecrement as OxInputNumberDecrement, InputNumberIncrement as OxInputNumberIncrement, InputNumberInput as OxInputNumberInput, InputPassword as OxInputPassword, InputPasswordInput as OxInputPasswordInput, InputPasswordToggle as OxInputPasswordToggle, useInputPassword, InputOtp as OxInputOtp, InputOtpGroup as OxInputOtpGroup, InputOtpSlot as OxInputOtpSlot, InputOtpSeparator as OxInputOtpSeparator, useInputOtp, Calendar as OxCalendar, CalendarRange as OxCalendarRange, CalendarDay as OxCalendarDay, calendarDayVariants, Combobox as OxCombobox, ComboboxCancel as OxComboboxCancel, ComboboxInput as OxComboboxInput, ComboboxChipsInput as OxComboboxChipsInput, ComboboxContent as OxComboboxContent, ComboboxItem as OxComboboxItem, ComboboxItemEdit as OxComboboxItemEdit, ComboboxEmpty as OxComboboxEmpty, ComboboxGroup as OxComboboxGroup, ComboboxSeparator as OxComboboxSeparator, ChatInput as OxChatInput, ColorPicker as OxColorPicker, ColorPickerTrigger as OxColorPickerTrigger, ColorPickerContent as OxColorPickerContent, ColorPickerSwatch as OxColorPickerSwatch, useColorPicker, IconPicker as OxIconPicker, IconPickerTrigger as OxIconPickerTrigger, IconPickerContent as OxIconPickerContent, IconPickerItem as OxIconPickerItem, useIconPicker, DatePicker as OxDatePicker, DateRangePicker as OxDateRangePicker, DatePickerTrigger as OxDatePickerTrigger, DatePickerHeader as OxDatePickerHeader, DatePickerMonthSelect as OxDatePickerMonthSelect, DatePickerYearSelect as OxDatePickerYearSelect, SearchBar as OxSearchBar, searchBarVariants, SearchPanel as OxSearchPanel, SearchPanelInput as OxSearchPanelInput, SearchPanelList as OxSearchPanelList, SearchPanelGroup as OxSearchPanelGroup, SearchPanelItem as OxSearchPanelItem, SearchPanelEmpty as OxSearchPanelEmpty, Select as OxSelect, SelectTrigger as OxSelectTrigger, SelectContent as OxSelectContent, SelectItem as OxSelectItem, SelectGroup as OxSelectGroup, SelectSeparator as OxSelectSeparator, TimePicker as OxTimePicker, TimePickerField as OxTimePickerField, TimePickerList as OxTimePickerList, TimePickerWheel as OxTimePickerWheel, TimePickerWheelColumn as OxTimePickerWheelColumn, Textarea as OxTextarea, RichTextEditor as OxRichTextEditor, RichTextToolbar as OxRichTextToolbar, RichTextToolbarButton as OxRichTextToolbarButton, RICH_TEXT_COMMANDS, RICH_TEXT_COMMAND_NAMES, isRichTextAdapter, oxRichTextExtensions, useRichTextAdapter, useRichTextToolbar, type RichTextAdapter, type RichTextCommand, type RichTextCommandSpec, type RichTextSource, Switch as OxSwitch, Checkbox as OxCheckbox, RadioButton as OxRadioButton, RadioGroup as OxRadioGroup, ToggleGroup as OxToggleGroup, ToggleLabel as OxToggleLabel, ToggleDescription as OxToggleDescription, SWITCH_SIZES, type InputNumberProps, type InputPasswordProps, type InputPasswordContext, type InputOtpProps, type InputOtpSlotProps, type InputOtpContext, type CalendarProps, type CalendarRangeProps, type CalendarDateRange, type CalendarDayProps, type CalendarDayState, type CalendarDayVariants, type CalendarConstraints, type CalendarNav, type ComboboxProps, type ChatInputActionLabels, type ChatInputState, type ColorPickerProps, type ColorPickerContext, type IconPickerProps, type IconPickerContext, type DatePickerProps, type DateRangePickerProps, type DatePickerTriggerProps, type DatePickerHeaderProps, type DatePickerMonthSelectProps, type DatePickerYearSelectProps, type SearchBarVariants, type SelectProps, type TimePickerProps, type TimeFormat, type TimePart, type TextareaCounterState, type RadioGroupProps, type ToggleGroupProps, type ToggleLabelProps, type ToggleDescriptionProps, } from './Forms/Inputs/index.ts';
73
74
  export { Table as OxTable, TableVirtualized as OxTableVirtualized, TableHead as OxTableHead, TableBody as OxTableBody, TableRow as OxTableRow, TableCell as OxTableCell, TableHeaderCell as OxTableHeaderCell, TableSelectCell as OxTableSelectCell, TableDragCell as OxTableDragCell, TableBulkHeader as OxTableBulkHeader, TablePagination as OxTablePagination, TableEmpty as OxTableEmpty, TableRowExpanded as OxTableRowExpanded, TableExpandCell as OxTableExpandCell, TableColumnVisibility as OxTableColumnVisibility, useTable, useTableSelection, useTableSorting, useTablePagination, useTableDetailRow, useTablePinning, useTableColumns, useScrollShadow, useDragToScroll, useFixedColumns, useTableVirtual, } from './Data/Table/index.ts';
74
75
  export type { UseTableOptions, UseTableReturn, UseTableSelectionReturn, UseTableSortingReturn, UseTablePaginationOptions, UseTablePaginationReturn, DetailRowInstance, DetailRowOptions, DetailRowPluginDef, UseTablePinningOptions, UseTablePinningReturn, CellInfo, HeaderInfo, UseTableVirtualOptions, UseTableVirtualReturn, UseTableColumnsOptions, UseTableColumnsReturn, UseScrollShadowOptions, UseScrollShadowReturn, UseDragToScrollOptions, UseDragToScrollReturn, UseFixedColumnsOptions, TableProps, TableMode, ColumnDef, ColumnAlign, CellContext, SortingState, PaginationState, PaginationChangePayload, SortingChangePayload, SelectionChangePayload, FilterChangePayload, ColumnResizeMode, ColumnVisibilityState, ColumnOrderState, ExpandedState, ColumnVisibilityChangePayload, ColumnOrderChangePayload, RowExpandChangePayload, ColumnResizePayload, ColumnPinningState, } from './Data/Table/index.ts';