@qoretechnologies/reqore 0.76.0-pr.673.g960750c → 0.76.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.
- package/.claude/CLAUDE.md +2 -32
- package/dist/components/Accordion/index.js +89 -53
- package/dist/components/Accordion/index.js.map +1 -1
- package/dist/components/Breadcrumbs/index.js +71 -33
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Breadcrumbs/item.js +13 -8
- package/dist/components/Breadcrumbs/item.js.map +1 -1
- package/dist/components/Bubble/index.js +93 -53
- package/dist/components/Bubble/index.js.map +1 -1
- package/dist/components/Button/index.d.ts +11 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +156 -114
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Callout/index.js +84 -45
- package/dist/components/Callout/index.js.map +1 -1
- package/dist/components/Checkbox/index.js +106 -68
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collapse/index.js +56 -19
- package/dist/components/Collapse/index.js.map +1 -1
- package/dist/components/CollapsibleContent/index.js +78 -39
- package/dist/components/CollapsibleContent/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +7 -8
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +117 -75
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.js +73 -33
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/column.js +39 -3
- package/dist/components/Columns/column.js.map +1 -1
- package/dist/components/Columns/index.js +47 -8
- package/dist/components/Columns/index.js.map +1 -1
- package/dist/components/Comment/index.js +29 -22
- package/dist/components/Comment/index.js.map +1 -1
- package/dist/components/CommentFeed/index.js +14 -7
- package/dist/components/CommentFeed/index.js.map +1 -1
- package/dist/components/Content/index.js +48 -10
- package/dist/components/Content/index.js.map +1 -1
- package/dist/components/Content/wrapper.js +13 -8
- package/dist/components/Content/wrapper.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +171 -58
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/ControlGroup/item.js +18 -12
- package/dist/components/ControlGroup/item.js.map +1 -1
- package/dist/components/DataView/helpers.js +53 -37
- package/dist/components/DataView/helpers.js.map +1 -1
- package/dist/components/DataView/index.js +234 -182
- package/dist/components/DataView/index.js.map +1 -1
- package/dist/components/DatePicker/MonthYearDropdowns.js +19 -12
- package/dist/components/DatePicker/MonthYearDropdowns.js.map +1 -1
- package/dist/components/DatePicker/index.js +65 -58
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DescriptionList/index.js +65 -26
- package/dist/components/DescriptionList/index.js.map +1 -1
- package/dist/components/Drawer/backdrop.js +23 -17
- package/dist/components/Drawer/backdrop.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +89 -0
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +236 -69
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +23 -18
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/item.d.ts +1 -1
- package/dist/components/Dropdown/item.d.ts.map +1 -1
- package/dist/components/Dropdown/item.js +34 -11
- package/dist/components/Dropdown/item.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +96 -74
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Effect/index.d.ts +24 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +107 -65
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/EmptyState/index.js +26 -20
- package/dist/components/EmptyState/index.js.map +1 -1
- package/dist/components/EntityRow/index.js +98 -59
- package/dist/components/EntityRow/index.js.map +1 -1
- package/dist/components/ErrorBoundary/index.js +15 -12
- package/dist/components/ErrorBoundary/index.js.map +1 -1
- package/dist/components/ExportModal/index.js +24 -17
- package/dist/components/ExportModal/index.js.map +1 -1
- package/dist/components/FadeScroller/index.js +29 -23
- package/dist/components/FadeScroller/index.js.map +1 -1
- package/dist/components/FeatureCard/index.js +84 -45
- package/dist/components/FeatureCard/index.js.map +1 -1
- package/dist/components/GlobalModalsWrapper/index.js +16 -13
- package/dist/components/GlobalModalsWrapper/index.js.map +1 -1
- package/dist/components/Header/index.js +33 -21
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Icon/index.js +77 -41
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/IconPicker/index.js +80 -41
- package/dist/components/IconPicker/index.js.map +1 -1
- package/dist/components/Input/index.js +94 -55
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InputClearButton/index.js +20 -14
- package/dist/components/InputClearButton/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts +1 -0
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +190 -54
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/KeyValueTable/index.js +18 -11
- package/dist/components/KeyValueTable/index.js.map +1 -1
- package/dist/components/KeyboardShortcut/index.js +28 -22
- package/dist/components/KeyboardShortcut/index.js.map +1 -1
- package/dist/components/Label/index.js +11 -5
- package/dist/components/Label/index.js.map +1 -1
- package/dist/components/Layout/content.js +10 -5
- package/dist/components/Layout/content.js.map +1 -1
- package/dist/components/Layout/index.js +46 -8
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/Link/index.js +63 -24
- package/dist/components/Link/index.js.map +1 -1
- package/dist/components/Menu/divider.js +56 -20
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.js +67 -29
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.js +20 -18
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Menu/section.js +19 -12
- package/dist/components/Menu/section.js.map +1 -1
- package/dist/components/Message/index.js +33 -28
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Modal/index.js +18 -15
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +3 -3
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +10 -4
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/NavRail/index.js +145 -106
- package/dist/components/NavRail/index.js.map +1 -1
- package/dist/components/Navbar/divider.js +14 -9
- package/dist/components/Navbar/divider.js.map +1 -1
- package/dist/components/Navbar/group.js +45 -9
- package/dist/components/Navbar/group.js.map +1 -1
- package/dist/components/Navbar/index.js +53 -17
- package/dist/components/Navbar/index.js.map +1 -1
- package/dist/components/Navbar/item.js +50 -15
- package/dist/components/Navbar/item.js.map +1 -1
- package/dist/components/Notifications/index.js +44 -9
- package/dist/components/Notifications/index.js.map +1 -1
- package/dist/components/Notifications/notification.js +125 -79
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Notifications/styles.js +69 -33
- package/dist/components/Notifications/styles.js.map +1 -1
- package/dist/components/Paging/index.js +63 -24
- package/dist/components/Paging/index.js.map +1 -1
- package/dist/components/Panel/LabelEditor.js +21 -15
- package/dist/components/Panel/LabelEditor.js.map +1 -1
- package/dist/components/Panel/NonResponsiveActions.js +15 -9
- package/dist/components/Panel/NonResponsiveActions.js.map +1 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +228 -180
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Panel/responsive.d.ts +24 -0
- package/dist/components/Panel/responsive.d.ts.map +1 -0
- package/dist/components/Panel/responsive.js +30 -0
- package/dist/components/Panel/responsive.js.map +1 -0
- package/dist/components/Paragraph/index.d.ts +8 -0
- package/dist/components/Paragraph/index.d.ts.map +1 -1
- package/dist/components/Paragraph/index.js +19 -13
- package/dist/components/Paragraph/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +46 -0
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +240 -42
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Progress/index.js +78 -40
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +23 -9
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/Rating/index.js +81 -43
- package/dist/components/Rating/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +362 -114
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/SegmentedControl/index.js +97 -59
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/Select/index.d.ts +68 -29
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +75 -140
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/valuePreview.d.ts +11 -0
- package/dist/components/Select/valuePreview.d.ts.map +1 -0
- package/dist/components/Select/valuePreview.js +64 -0
- package/dist/components/Select/valuePreview.js.map +1 -0
- package/dist/components/SeverityRow/index.js +85 -47
- package/dist/components/SeverityRow/index.js.map +1 -1
- package/dist/components/Skeleton/index.js +46 -9
- package/dist/components/Skeleton/index.js.map +1 -1
- package/dist/components/Slider/index.js +76 -37
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Spacer/index.js +61 -25
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Span/index.js +19 -13
- package/dist/components/Span/index.js.map +1 -1
- package/dist/components/Spinner/index.js +16 -9
- package/dist/components/Spinner/index.js.map +1 -1
- package/dist/components/StackedBar/index.js +69 -34
- package/dist/components/StackedBar/index.js.map +1 -1
- package/dist/components/Statistic/index.js +73 -35
- package/dist/components/Statistic/index.js.map +1 -1
- package/dist/components/Table/body.d.ts.map +1 -1
- package/dist/components/Table/body.js +107 -48
- package/dist/components/Table/body.js.map +1 -1
- package/dist/components/Table/cell.d.ts.map +1 -1
- package/dist/components/Table/cell.js +68 -29
- package/dist/components/Table/cell.js.map +1 -1
- package/dist/components/Table/header.js +69 -33
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.js +65 -26
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +62 -28
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +189 -111
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +30 -2
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +142 -95
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +29 -1
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +163 -60
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Table/scrollbar.js +37 -31
- package/dist/components/Table/scrollbar.js.map +1 -1
- package/dist/components/Table/value.js +15 -9
- package/dist/components/Table/value.js.map +1 -1
- package/dist/components/Tabs/content.js +17 -12
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.js +52 -14
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.js +65 -26
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.js +101 -60
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.js +49 -11
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +5 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +147 -92
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Testimonial/index.js +82 -44
- package/dist/components/Testimonial/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +10 -0
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +167 -63
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/Tier/index.js +58 -19
- package/dist/components/Tier/index.js.map +1 -1
- package/dist/components/TimeAgo/index.js +16 -9
- package/dist/components/TimeAgo/index.js.map +1 -1
- package/dist/components/Timeline/index.js +117 -78
- package/dist/components/Timeline/index.js.map +1 -1
- package/dist/components/TooltipComponent/index.js +10 -7
- package/dist/components/TooltipComponent/index.js.map +1 -1
- package/dist/components/Tree/index.d.ts +2 -1
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +99 -70
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/components/Tree/modal.js +20 -13
- package/dist/components/Tree/modal.js.map +1 -1
- package/dist/constants/animations.js +5 -2
- package/dist/constants/animations.js.map +1 -1
- package/dist/constants/colors.js +5 -2
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/fonts.js +10 -6
- package/dist/constants/fonts.js.map +1 -1
- package/dist/constants/paging.js +6 -2
- package/dist/constants/paging.js.map +1 -1
- package/dist/constants/sizes.js +55 -51
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.js +22 -19
- package/dist/constants/theme.js.map +1 -1
- package/dist/containers/Paging.js +16 -13
- package/dist/containers/Paging.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +62 -52
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/ThemeProvider.js +13 -8
- package/dist/containers/ThemeProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +63 -31
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/CustomThemeContext.js +5 -3
- package/dist/context/CustomThemeContext.js.map +1 -1
- package/dist/context/ReqoreContext.js +6 -4
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/context/ThemeContext.js +5 -3
- package/dist/context/ThemeContext.js.map +1 -1
- package/dist/helpers/animations.js +5 -2
- package/dist/helpers/animations.js.map +1 -1
- package/dist/helpers/colors.js +103 -78
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/dates.js +17 -8
- package/dist/helpers/dates.js.map +1 -1
- package/dist/helpers/search.js +11 -5
- package/dist/helpers/search.js.map +1 -1
- package/dist/helpers/selectItem.d.ts +23 -0
- package/dist/helpers/selectItem.d.ts.map +1 -0
- package/dist/helpers/selectItem.js +147 -0
- package/dist/helpers/selectItem.js.map +1 -0
- package/dist/helpers/shortcuts.js +14 -7
- package/dist/helpers/shortcuts.js.map +1 -1
- package/dist/helpers/styled.js +5 -1
- package/dist/helpers/styled.js.map +1 -1
- package/dist/helpers/time.js +5 -1
- package/dist/helpers/time.js.map +1 -1
- package/dist/helpers/utils.js +58 -38
- package/dist/helpers/utils.js.map +1 -1
- package/dist/hooks/useAutoFocus.js +14 -10
- package/dist/hooks/useAutoFocus.js.map +1 -1
- package/dist/hooks/useCloneThroughFragments.js +45 -8
- package/dist/hooks/useCloneThroughFragments.js.map +1 -1
- package/dist/hooks/useCombinedRefs.js +11 -5
- package/dist/hooks/useCombinedRefs.js.map +1 -1
- package/dist/hooks/useComponentTooltip.js +11 -7
- package/dist/hooks/useComponentTooltip.js.map +1 -1
- package/dist/hooks/useFitTextSize.js +13 -9
- package/dist/hooks/useFitTextSize.js.map +1 -1
- package/dist/hooks/useFocusTrap.js +10 -7
- package/dist/hooks/useFocusTrap.js.map +1 -1
- package/dist/hooks/useLatestZIndex.js +8 -6
- package/dist/hooks/useLatestZIndex.js.map +1 -1
- package/dist/hooks/useMarqueeOnHover.js +34 -25
- package/dist/hooks/useMarqueeOnHover.js.map +1 -1
- package/dist/hooks/useNarrowContainer.js +12 -8
- package/dist/hooks/useNarrowContainer.js.map +1 -1
- package/dist/hooks/useOutsideClick.js +6 -4
- package/dist/hooks/useOutsideClick.js.map +1 -1
- package/dist/hooks/usePaging.js +27 -20
- package/dist/hooks/usePaging.js.map +1 -1
- package/dist/hooks/useQueryWithDelay.js +12 -8
- package/dist/hooks/useQueryWithDelay.js.map +1 -1
- package/dist/hooks/useReqore.js +11 -4
- package/dist/hooks/useReqore.js.map +1 -1
- package/dist/hooks/useReqoreContext.js +11 -4
- package/dist/hooks/useReqoreContext.js.map +1 -1
- package/dist/hooks/useReqoreEffect.js +9 -5
- package/dist/hooks/useReqoreEffect.js.map +1 -1
- package/dist/hooks/useScrollFade.js +12 -8
- package/dist/hooks/useScrollFade.js.map +1 -1
- package/dist/hooks/useTextareaAutoSize.js +5 -3
- package/dist/hooks/useTextareaAutoSize.js.map +1 -1
- package/dist/hooks/useTheme.js +22 -15
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/hooks/useWhyDidYouUpdate.js +7 -4
- package/dist/hooks/useWhyDidYouUpdate.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +284 -107
- package/dist/index.js.map +1 -1
- package/dist/styles.js +58 -22
- package/dist/styles.js.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +23 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/tableGeometry.d.ts +75 -0
- package/dist/testing/tableGeometry.d.ts.map +1 -0
- package/dist/testing/tableGeometry.js +168 -0
- package/dist/testing/tableGeometry.js.map +1 -0
- package/dist/types/global.js +2 -1
- package/dist/types/icons.js +2 -1
- package/package.json +13 -9
- package/testing/package.json +7 -0
- package/tests.json +1 -0
- package/dist/components/Accordion/index.cjs +0 -199
- package/dist/components/Accordion/index.cjs.map +0 -1
- package/dist/components/Breadcrumbs/index.cjs +0 -239
- package/dist/components/Breadcrumbs/index.cjs.map +0 -1
- package/dist/components/Breadcrumbs/item.cjs +0 -43
- package/dist/components/Breadcrumbs/item.cjs.map +0 -1
- package/dist/components/Bubble/index.cjs +0 -281
- package/dist/components/Bubble/index.cjs.map +0 -1
- package/dist/components/Button/index.cjs +0 -401
- package/dist/components/Button/index.cjs.map +0 -1
- package/dist/components/Callout/index.cjs +0 -203
- package/dist/components/Callout/index.cjs.map +0 -1
- package/dist/components/Checkbox/index.cjs +0 -222
- package/dist/components/Checkbox/index.cjs.map +0 -1
- package/dist/components/Collapse/index.cjs +0 -127
- package/dist/components/Collapse/index.cjs.map +0 -1
- package/dist/components/CollapsibleContent/index.cjs +0 -244
- package/dist/components/CollapsibleContent/index.cjs.map +0 -1
- package/dist/components/Collection/index.cjs +0 -362
- package/dist/components/Collection/index.cjs.map +0 -1
- package/dist/components/Collection/item.cjs +0 -196
- package/dist/components/Collection/item.cjs.map +0 -1
- package/dist/components/Columns/column.cjs +0 -47
- package/dist/components/Columns/column.cjs.map +0 -1
- package/dist/components/Columns/index.cjs +0 -79
- package/dist/components/Columns/index.cjs.map +0 -1
- package/dist/components/Comment/index.cjs +0 -72
- package/dist/components/Comment/index.cjs.map +0 -1
- package/dist/components/CommentFeed/index.cjs +0 -49
- package/dist/components/CommentFeed/index.cjs.map +0 -1
- package/dist/components/Content/index.cjs +0 -80
- package/dist/components/Content/index.cjs.map +0 -1
- package/dist/components/Content/wrapper.cjs +0 -43
- package/dist/components/Content/wrapper.cjs.map +0 -1
- package/dist/components/ControlGroup/index.cjs +0 -437
- package/dist/components/ControlGroup/index.cjs.map +0 -1
- package/dist/components/ControlGroup/item.cjs +0 -86
- package/dist/components/ControlGroup/item.cjs.map +0 -1
- package/dist/components/DataView/helpers.cjs +0 -350
- package/dist/components/DataView/helpers.cjs.map +0 -1
- package/dist/components/DataView/index.cjs +0 -961
- package/dist/components/DataView/index.cjs.map +0 -1
- package/dist/components/DatePicker/MonthYearDropdowns.cjs +0 -64
- package/dist/components/DatePicker/MonthYearDropdowns.cjs.map +0 -1
- package/dist/components/DatePicker/index.cjs +0 -289
- package/dist/components/DatePicker/index.cjs.map +0 -1
- package/dist/components/DescriptionList/index.cjs +0 -183
- package/dist/components/DescriptionList/index.cjs.map +0 -1
- package/dist/components/Drawer/backdrop.cjs +0 -73
- package/dist/components/Drawer/backdrop.cjs.map +0 -1
- package/dist/components/Drawer/index.cjs +0 -302
- package/dist/components/Drawer/index.cjs.map +0 -1
- package/dist/components/Dropdown/index.cjs +0 -77
- package/dist/components/Dropdown/index.cjs.map +0 -1
- package/dist/components/Dropdown/item.cjs +0 -42
- package/dist/components/Dropdown/item.cjs.map +0 -1
- package/dist/components/Dropdown/list.cjs +0 -346
- package/dist/components/Dropdown/list.cjs.map +0 -1
- package/dist/components/Effect/index.cjs +0 -331
- package/dist/components/Effect/index.cjs.map +0 -1
- package/dist/components/EmptyState/index.cjs +0 -60
- package/dist/components/EmptyState/index.cjs.map +0 -1
- package/dist/components/EntityRow/index.cjs +0 -249
- package/dist/components/EntityRow/index.cjs.map +0 -1
- package/dist/components/ErrorBoundary/index.cjs +0 -118
- package/dist/components/ErrorBoundary/index.cjs.map +0 -1
- package/dist/components/ExportModal/index.cjs +0 -91
- package/dist/components/ExportModal/index.cjs.map +0 -1
- package/dist/components/FadeScroller/index.cjs +0 -327
- package/dist/components/FadeScroller/index.cjs.map +0 -1
- package/dist/components/FeatureCard/index.cjs +0 -168
- package/dist/components/FeatureCard/index.cjs.map +0 -1
- package/dist/components/GlobalModalsWrapper/index.cjs +0 -46
- package/dist/components/GlobalModalsWrapper/index.cjs.map +0 -1
- package/dist/components/Header/index.cjs +0 -70
- package/dist/components/Header/index.cjs.map +0 -1
- package/dist/components/Icon/index.cjs +0 -195
- package/dist/components/Icon/index.cjs.map +0 -1
- package/dist/components/IconPicker/index.cjs +0 -236
- package/dist/components/IconPicker/index.cjs.map +0 -1
- package/dist/components/Input/index.cjs +0 -203
- package/dist/components/Input/index.cjs.map +0 -1
- package/dist/components/InputClearButton/index.cjs +0 -62
- package/dist/components/InputClearButton/index.cjs.map +0 -1
- package/dist/components/InternalPopover/index.cjs +0 -315
- package/dist/components/InternalPopover/index.cjs.map +0 -1
- package/dist/components/KeyValueTable/index.cjs +0 -108
- package/dist/components/KeyValueTable/index.cjs.map +0 -1
- package/dist/components/KeyboardShortcut/index.cjs +0 -69
- package/dist/components/KeyboardShortcut/index.cjs.map +0 -1
- package/dist/components/Label/index.cjs +0 -24
- package/dist/components/Label/index.cjs.map +0 -1
- package/dist/components/Layout/content.cjs +0 -41
- package/dist/components/Layout/content.cjs.map +0 -1
- package/dist/components/Layout/index.cjs +0 -79
- package/dist/components/Layout/index.cjs.map +0 -1
- package/dist/components/Link/index.cjs +0 -168
- package/dist/components/Link/index.cjs.map +0 -1
- package/dist/components/Menu/divider.cjs +0 -98
- package/dist/components/Menu/divider.cjs.map +0 -1
- package/dist/components/Menu/index.cjs +0 -135
- package/dist/components/Menu/index.cjs.map +0 -1
- package/dist/components/Menu/item.cjs +0 -99
- package/dist/components/Menu/item.cjs.map +0 -1
- package/dist/components/Menu/section.cjs +0 -59
- package/dist/components/Menu/section.cjs.map +0 -1
- package/dist/components/Message/index.cjs +0 -78
- package/dist/components/Message/index.cjs.map +0 -1
- package/dist/components/Modal/index.cjs +0 -67
- package/dist/components/Modal/index.cjs.map +0 -1
- package/dist/components/MultiSelect/index.cjs +0 -36
- package/dist/components/MultiSelect/index.cjs.map +0 -1
- package/dist/components/NavRail/index.cjs +0 -666
- package/dist/components/NavRail/index.cjs.map +0 -1
- package/dist/components/Navbar/divider.cjs +0 -47
- package/dist/components/Navbar/divider.cjs.map +0 -1
- package/dist/components/Navbar/group.cjs +0 -85
- package/dist/components/Navbar/group.cjs.map +0 -1
- package/dist/components/Navbar/index.cjs +0 -97
- package/dist/components/Navbar/index.cjs.map +0 -1
- package/dist/components/Navbar/item.cjs +0 -98
- package/dist/components/Navbar/item.cjs.map +0 -1
- package/dist/components/Notifications/index.cjs +0 -66
- package/dist/components/Notifications/index.cjs.map +0 -1
- package/dist/components/Notifications/notification.cjs +0 -343
- package/dist/components/Notifications/notification.cjs.map +0 -1
- package/dist/components/Notifications/styles.cjs +0 -131
- package/dist/components/Notifications/styles.cjs.map +0 -1
- package/dist/components/Paging/index.cjs +0 -173
- package/dist/components/Paging/index.cjs.map +0 -1
- package/dist/components/Panel/LabelEditor.cjs +0 -62
- package/dist/components/Panel/LabelEditor.cjs.map +0 -1
- package/dist/components/Panel/NonResponsiveActions.cjs +0 -47
- package/dist/components/Panel/NonResponsiveActions.cjs.map +0 -1
- package/dist/components/Panel/index.cjs +0 -1054
- package/dist/components/Panel/index.cjs.map +0 -1
- package/dist/components/Paragraph/index.cjs +0 -55
- package/dist/components/Paragraph/index.cjs.map +0 -1
- package/dist/components/Popover/index.cjs +0 -348
- package/dist/components/Popover/index.cjs.map +0 -1
- package/dist/components/Progress/index.cjs +0 -187
- package/dist/components/Progress/index.cjs.map +0 -1
- package/dist/components/RadioGroup/index.cjs +0 -42
- package/dist/components/RadioGroup/index.cjs.map +0 -1
- package/dist/components/Rating/index.cjs +0 -207
- package/dist/components/Rating/index.cjs.map +0 -1
- package/dist/components/RichTextEditor/index.cjs +0 -424
- package/dist/components/RichTextEditor/index.cjs.map +0 -1
- package/dist/components/SegmentedControl/index.cjs +0 -364
- package/dist/components/SegmentedControl/index.cjs.map +0 -1
- package/dist/components/Select/index.cjs +0 -363
- package/dist/components/Select/index.cjs.map +0 -1
- package/dist/components/SeverityRow/index.cjs +0 -207
- package/dist/components/SeverityRow/index.cjs.map +0 -1
- package/dist/components/Skeleton/index.cjs +0 -58
- package/dist/components/Skeleton/index.cjs.map +0 -1
- package/dist/components/Slider/index.cjs +0 -154
- package/dist/components/Slider/index.cjs.map +0 -1
- package/dist/components/Spacer/index.cjs +0 -138
- package/dist/components/Spacer/index.cjs.map +0 -1
- package/dist/components/Span/index.cjs +0 -61
- package/dist/components/Span/index.cjs.map +0 -1
- package/dist/components/Spinner/index.cjs +0 -44
- package/dist/components/Spinner/index.cjs.map +0 -1
- package/dist/components/StackedBar/index.cjs +0 -209
- package/dist/components/StackedBar/index.cjs.map +0 -1
- package/dist/components/Statistic/index.cjs +0 -161
- package/dist/components/Statistic/index.cjs.map +0 -1
- package/dist/components/Table/body.cjs +0 -265
- package/dist/components/Table/body.cjs.map +0 -1
- package/dist/components/Table/cell.cjs +0 -179
- package/dist/components/Table/cell.cjs.map +0 -1
- package/dist/components/Table/header.cjs +0 -170
- package/dist/components/Table/header.cjs.map +0 -1
- package/dist/components/Table/headerCell.cjs +0 -277
- package/dist/components/Table/headerCell.cjs.map +0 -1
- package/dist/components/Table/helpers.cjs +0 -386
- package/dist/components/Table/helpers.cjs.map +0 -1
- package/dist/components/Table/index.cjs +0 -682
- package/dist/components/Table/index.cjs.map +0 -1
- package/dist/components/Table/row.cjs +0 -345
- package/dist/components/Table/row.cjs.map +0 -1
- package/dist/components/Table/scrollbar.cjs +0 -201
- package/dist/components/Table/scrollbar.cjs.map +0 -1
- package/dist/components/Table/value.cjs +0 -26
- package/dist/components/Table/value.cjs.map +0 -1
- package/dist/components/Tabs/content.cjs +0 -63
- package/dist/components/Tabs/content.cjs.map +0 -1
- package/dist/components/Tabs/index.cjs +0 -109
- package/dist/components/Tabs/index.cjs.map +0 -1
- package/dist/components/Tabs/item.cjs +0 -136
- package/dist/components/Tabs/item.cjs.map +0 -1
- package/dist/components/Tabs/list.cjs +0 -322
- package/dist/components/Tabs/list.cjs.map +0 -1
- package/dist/components/Tag/group.cjs +0 -107
- package/dist/components/Tag/group.cjs.map +0 -1
- package/dist/components/Tag/index.cjs +0 -343
- package/dist/components/Tag/index.cjs.map +0 -1
- package/dist/components/Testimonial/index.cjs +0 -166
- package/dist/components/Testimonial/index.cjs.map +0 -1
- package/dist/components/Textarea/index.cjs +0 -220
- package/dist/components/Textarea/index.cjs.map +0 -1
- package/dist/components/Tier/index.cjs +0 -107
- package/dist/components/Tier/index.cjs.map +0 -1
- package/dist/components/TimeAgo/index.cjs +0 -27
- package/dist/components/TimeAgo/index.cjs.map +0 -1
- package/dist/components/Timeline/index.cjs +0 -416
- package/dist/components/Timeline/index.cjs.map +0 -1
- package/dist/components/TooltipComponent/index.cjs +0 -37
- package/dist/components/TooltipComponent/index.cjs.map +0 -1
- package/dist/components/Tree/index.cjs +0 -321
- package/dist/components/Tree/index.cjs.map +0 -1
- package/dist/components/Tree/modal.cjs +0 -38
- package/dist/components/Tree/modal.cjs.map +0 -1
- package/dist/constants/animations.cjs +0 -12
- package/dist/constants/animations.cjs.map +0 -1
- package/dist/constants/colors.cjs +0 -16
- package/dist/constants/colors.cjs.map +0 -1
- package/dist/constants/fonts.cjs +0 -28
- package/dist/constants/fonts.cjs.map +0 -1
- package/dist/constants/paging.cjs +0 -63
- package/dist/constants/paging.cjs.map +0 -1
- package/dist/constants/sizes.cjs +0 -462
- package/dist/constants/sizes.cjs.map +0 -1
- package/dist/constants/theme.cjs +0 -43
- package/dist/constants/theme.cjs.map +0 -1
- package/dist/containers/Paging.cjs +0 -52
- package/dist/containers/Paging.cjs.map +0 -1
- package/dist/containers/ReqoreProvider.cjs +0 -275
- package/dist/containers/ReqoreProvider.cjs.map +0 -1
- package/dist/containers/ThemeProvider.cjs +0 -17
- package/dist/containers/ThemeProvider.cjs.map +0 -1
- package/dist/containers/UIProvider.cjs +0 -96
- package/dist/containers/UIProvider.cjs.map +0 -1
- package/dist/context/CustomThemeContext.cjs +0 -6
- package/dist/context/CustomThemeContext.cjs.map +0 -1
- package/dist/context/ReqoreContext.cjs +0 -25
- package/dist/context/ReqoreContext.cjs.map +0 -1
- package/dist/context/ThemeContext.cjs +0 -6
- package/dist/context/ThemeContext.cjs.map +0 -1
- package/dist/helpers/animations.cjs +0 -11
- package/dist/helpers/animations.cjs.map +0 -1
- package/dist/helpers/colors.cjs +0 -273
- package/dist/helpers/colors.cjs.map +0 -1
- package/dist/helpers/dates.cjs +0 -62
- package/dist/helpers/dates.cjs.map +0 -1
- package/dist/helpers/portal.cjs +0 -32
- package/dist/helpers/portal.cjs.map +0 -1
- package/dist/helpers/portal.d.ts +0 -18
- package/dist/helpers/portal.d.ts.map +0 -1
- package/dist/helpers/portal.js +0 -27
- package/dist/helpers/portal.js.map +0 -1
- package/dist/helpers/search.cjs +0 -63
- package/dist/helpers/search.cjs.map +0 -1
- package/dist/helpers/shortcuts.cjs +0 -152
- package/dist/helpers/shortcuts.cjs.map +0 -1
- package/dist/helpers/styled.cjs +0 -46
- package/dist/helpers/styled.cjs.map +0 -1
- package/dist/helpers/time.cjs +0 -25
- package/dist/helpers/time.cjs.map +0 -1
- package/dist/helpers/utils.cjs +0 -294
- package/dist/helpers/utils.cjs.map +0 -1
- package/dist/hooks/useAutoFocus.cjs +0 -84
- package/dist/hooks/useAutoFocus.cjs.map +0 -1
- package/dist/hooks/useCloneThroughFragments.cjs +0 -63
- package/dist/hooks/useCloneThroughFragments.cjs.map +0 -1
- package/dist/hooks/useCombinedRefs.cjs +0 -44
- package/dist/hooks/useCombinedRefs.cjs.map +0 -1
- package/dist/hooks/useComponentTooltip.cjs +0 -34
- package/dist/hooks/useComponentTooltip.cjs.map +0 -1
- package/dist/hooks/useFitTextSize.cjs +0 -75
- package/dist/hooks/useFitTextSize.cjs.map +0 -1
- package/dist/hooks/useFocusTrap.cjs +0 -119
- package/dist/hooks/useFocusTrap.cjs.map +0 -1
- package/dist/hooks/useLatestZIndex.cjs +0 -12
- package/dist/hooks/useLatestZIndex.cjs.map +0 -1
- package/dist/hooks/useMarqueeOnHover.cjs +0 -292
- package/dist/hooks/useMarqueeOnHover.cjs.map +0 -1
- package/dist/hooks/useNarrowContainer.cjs +0 -68
- package/dist/hooks/useNarrowContainer.cjs.map +0 -1
- package/dist/hooks/useOutsideClick.cjs +0 -19
- package/dist/hooks/useOutsideClick.cjs.map +0 -1
- package/dist/hooks/usePaging.cjs +0 -152
- package/dist/hooks/usePaging.cjs.map +0 -1
- package/dist/hooks/useQueryWithDelay.cjs +0 -25
- package/dist/hooks/useQueryWithDelay.cjs.map +0 -1
- package/dist/hooks/useReqore.cjs +0 -17
- package/dist/hooks/useReqore.cjs.map +0 -1
- package/dist/hooks/useReqoreContext.cjs +0 -19
- package/dist/hooks/useReqoreContext.cjs.map +0 -1
- package/dist/hooks/useReqoreEffect.cjs +0 -34
- package/dist/hooks/useReqoreEffect.cjs.map +0 -1
- package/dist/hooks/useScrollFade.cjs +0 -70
- package/dist/hooks/useScrollFade.cjs.map +0 -1
- package/dist/hooks/useTextareaAutoSize.cjs +0 -22
- package/dist/hooks/useTextareaAutoSize.cjs.map +0 -1
- package/dist/hooks/useTheme.cjs +0 -49
- package/dist/hooks/useTheme.cjs.map +0 -1
- package/dist/hooks/useWhyDidYouUpdate.cjs +0 -46
- package/dist/hooks/useWhyDidYouUpdate.cjs.map +0 -1
- package/dist/index.cjs +0 -271
- package/dist/index.cjs.map +0 -1
- package/dist/package.json +0 -3
- package/dist/styles.cjs +0 -88
- package/dist/styles.cjs.map +0 -1
- package/dist/types/global.cjs +0 -3
- package/dist/types/global.cjs.map +0 -1
- package/dist/types/icons.cjs +0 -3
- package/dist/types/icons.cjs.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
|
2
3
|
__assign = Object.assign || function(t) {
|
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -29,29 +30,120 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
29
30
|
}
|
|
30
31
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ReqoreRichTextEditor = exports.DefaultElement = exports.withTemplates = exports.TemplateElement = void 0;
|
|
38
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
var is_prop_valid_1 = __importDefault(require("@emotion/is-prop-valid"));
|
|
40
|
+
var lodash_1 = require("lodash");
|
|
41
|
+
var react_1 = require("react");
|
|
42
|
+
var react_use_1 = require("react-use");
|
|
43
|
+
var slate_1 = require("slate");
|
|
44
|
+
var slate_history_1 = require("slate-history");
|
|
45
|
+
var slate_react_1 = require("slate-react");
|
|
46
|
+
var __1 = require("../..");
|
|
47
|
+
var utils_1 = require("../../helpers/utils");
|
|
48
|
+
var Paragraph_1 = require("../Paragraph");
|
|
49
|
+
var Span_1 = require("../Span");
|
|
50
|
+
var Tag_1 = __importDefault(require("../Tag"));
|
|
51
|
+
/* Stable identities for the optional props' defaults.
|
|
52
|
+
*
|
|
53
|
+
* Written as literals in the destructuring (`tagsProps = {}`,
|
|
54
|
+
* `getTagProps = () => ({})`) they were rebuilt on EVERY render, which put a
|
|
55
|
+
* new identity into `renderElement`'s dependency list every time — and
|
|
56
|
+
* slate-react's own `ElementComponent` memo compares `renderElement` by
|
|
57
|
+
* identity. So an unstable default made every element in the document
|
|
58
|
+
* re-render on every keystroke, including chips nothing had touched. Hoisting
|
|
59
|
+
* them costs nothing and is the whole fix for the common case, where the
|
|
60
|
+
* consumer passes neither prop. */
|
|
61
|
+
var NO_TAG_PROPS = function () { return ({}); };
|
|
62
|
+
var EMPTY_TAG_PROPS = {};
|
|
63
|
+
var EMPTY_TAGS_LIST_PROPS = {};
|
|
64
|
+
exports.TemplateElement = (0, react_1.memo)(function (props) {
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
var selected = (0, slate_react_1.useSelected)();
|
|
67
|
+
var editor = (0, slate_react_1.useSlateStatic)();
|
|
68
|
+
/* Slate's own answer, which is the editor's `readOnly` — it reaches `Editable`
|
|
69
|
+
as a DOM-valid prop and Slate reads it back. It is NOT the whole answer: the
|
|
70
|
+
editor's `disabled` never reaches Slate, so `composeTagProps` marks the chip
|
|
71
|
+
read-only for that case and this takes whichever of the two says so. */
|
|
72
|
+
var slateReadOnly = (0, slate_react_1.useReadOnly)();
|
|
73
|
+
var readOnly = slateReadOnly || !!((_a = props.tagProps) === null || _a === void 0 ? void 0 : _a.readOnly);
|
|
74
|
+
/* A chip is an inline VOID: it holds no text of its own, so a click on it has
|
|
75
|
+
no text position to land in and the browser places the cursor nowhere. This
|
|
76
|
+
handler used to `preventDefault()` + `stopPropagation()` and stop there,
|
|
77
|
+
which made the chip a dead spot.
|
|
78
|
+
|
|
79
|
+
That is not merely a missing convenience. A field whose entire value is one
|
|
80
|
+
reference renders as one chip and nothing else, so the chip IS the control:
|
|
81
|
+
with no way to get a cursor into the editor, nothing could be typed into it
|
|
82
|
+
at all. Reported against a Qorus test assertion's `Value`, where it made a
|
|
83
|
+
path deeper than any offered candidate — the case the rich-text control
|
|
84
|
+
exists for — impossible to write by hand.
|
|
85
|
+
|
|
86
|
+
The cursor goes AFTER the chip, which is where a walk is continued
|
|
87
|
+
(`$.order.id` -> `$.order.id.value`). Both calls above are kept and are
|
|
88
|
+
load-bearing: `preventDefault` stops the browser racing us to a position of
|
|
89
|
+
its own, and `stopPropagation` keeps the click from reaching a host row that
|
|
90
|
+
treats a click as "collapse me". The selection is then set explicitly rather
|
|
91
|
+
than left to the browser, so where the cursor lands does not depend on which
|
|
92
|
+
pixel of the chip was hit.
|
|
93
|
+
|
|
94
|
+
Removing a chip is unaffected: that is the tag's own `×`
|
|
95
|
+
(`onRemoveClick`), not a click on its body. */
|
|
96
|
+
var handleClick = (0, react_1.useCallback)(function (e) {
|
|
97
|
+
var _a, _b, _c;
|
|
49
98
|
e.preventDefault();
|
|
50
99
|
e.stopPropagation();
|
|
51
|
-
|
|
52
|
-
|
|
100
|
+
// The consumer's own handler still runs: the editor composes `onTagClick`
|
|
101
|
+
// and any `getTagProps().onClick` into the `tagProps.onClick` below, and
|
|
102
|
+
// this element used to be overridden by it rather than run alongside it.
|
|
103
|
+
(_b = (_a = props.tagProps) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
104
|
+
// A read-only surface has no cursor to give.
|
|
105
|
+
if (readOnly) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
var path = slate_react_1.ReactEditor.findPath(editor, props.element);
|
|
110
|
+
// From the void's END, and skipping voids. Asking for the point after
|
|
111
|
+
// the void's PATH can resolve to a point INSIDE its own empty text
|
|
112
|
+
// child, where typing is silently ignored — the cursor reads as placed
|
|
113
|
+
// (the DOM selection is real and inside the editor) and the editor
|
|
114
|
+
// still accepts nothing, which is a worse failure than an obvious one.
|
|
115
|
+
// The fallback covers a void that ends the document with no text node
|
|
116
|
+
// after it; a well-formed document always has one.
|
|
117
|
+
var point = (_c = slate_1.Editor.after(editor, slate_1.Editor.end(editor, path), { voids: false })) !== null && _c !== void 0 ? _c : slate_1.Editor.end(editor, []);
|
|
118
|
+
// Focus BEFORE selecting. `ReactEditor.focus` restores the editor's
|
|
119
|
+
// previous selection as it takes focus, so focusing afterwards throws
|
|
120
|
+
// away the point just set — which cost the FIRST character typed after
|
|
121
|
+
// a chip click and nothing else, the kind of loss that reads as a
|
|
122
|
+
// flaky keyboard rather than a bug.
|
|
123
|
+
slate_react_1.ReactEditor.focus(editor);
|
|
124
|
+
slate_1.Transforms.select(editor, point);
|
|
125
|
+
}
|
|
126
|
+
catch (_d) {
|
|
127
|
+
// The element can be gone between render and click (a re-render that
|
|
128
|
+
// replaced the value). Losing the cursor is the right outcome then, and
|
|
129
|
+
// it must not take the click handler down with it.
|
|
130
|
+
}
|
|
131
|
+
}, [editor, props.element, props.tagProps, readOnly]);
|
|
132
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Tag_1.default, __assign({}, props.attributes, { compact: true, flat: false, asBadge: true, fixed: 'key', tooltip: (_b = props.element.value) === null || _b === void 0 ? void 0 : _b.toString(), label: props.element.label }, props.tagProps, {
|
|
133
|
+
// AFTER the spread on purpose: `tagProps` carries an `onClick` of its
|
|
134
|
+
// own, so declaring this before it meant this handler never ran at all.
|
|
135
|
+
onClick: handleClick,
|
|
136
|
+
/* And `readOnly` with it, because winning the spread cost the chip the
|
|
137
|
+
one signal that said it could not be pressed. `composeTagProps`
|
|
138
|
+
withholds its `onClick` on a read-only surface; overriding that put a
|
|
139
|
+
handler back unconditionally, and a tag with a handler paints itself
|
|
140
|
+
pressable — pointer cursor, hover lift, a tab stop — for a click this
|
|
141
|
+
element then declines. The handler stays (it still runs the
|
|
142
|
+
consumer's own `onClick`), and this is what says the cursor is not on
|
|
143
|
+
offer. */
|
|
144
|
+
readOnly: readOnly, contentEditable: false, intent: selected ? 'info' : (_c = props.tagProps) === null || _c === void 0 ? void 0 : _c.intent })), props.children] }));
|
|
53
145
|
});
|
|
54
|
-
|
|
146
|
+
var withTemplates = function (editor) {
|
|
55
147
|
var isInline = editor.isInline, isVoid = editor.isVoid, markableVoid = editor.markableVoid;
|
|
56
148
|
editor.isInline = function (element) {
|
|
57
149
|
return element.type === 'tag' ? true : isInline(element);
|
|
@@ -64,30 +156,32 @@ export var withTemplates = function (editor) {
|
|
|
64
156
|
};
|
|
65
157
|
return editor;
|
|
66
158
|
};
|
|
159
|
+
exports.withTemplates = withTemplates;
|
|
67
160
|
var Leaf = function (_a) {
|
|
68
161
|
var attributes = _a.attributes, children = _a.children, leaf = _a.leaf;
|
|
69
162
|
if (leaf.bold) {
|
|
70
|
-
children =
|
|
163
|
+
children = (0, jsx_runtime_1.jsx)("strong", { children: children });
|
|
71
164
|
}
|
|
72
165
|
if (leaf.code) {
|
|
73
|
-
children =
|
|
166
|
+
children = (0, jsx_runtime_1.jsx)("code", { children: children });
|
|
74
167
|
}
|
|
75
168
|
if (leaf.italic) {
|
|
76
|
-
children =
|
|
169
|
+
children = (0, jsx_runtime_1.jsx)("em", { children: children });
|
|
77
170
|
}
|
|
78
171
|
if (leaf.underline) {
|
|
79
|
-
children =
|
|
172
|
+
children = (0, jsx_runtime_1.jsx)("u", { children: children });
|
|
80
173
|
}
|
|
81
|
-
return (
|
|
174
|
+
return ((0, jsx_runtime_1.jsx)(Span_1.ReqoreSpan, __assign({ inline: true }, attributes, { effect: {
|
|
82
175
|
weight: leaf.bold ? 'bold' : 'normal',
|
|
83
176
|
italic: leaf.italic,
|
|
84
177
|
underline: leaf.underline,
|
|
85
178
|
}, children: children })));
|
|
86
179
|
};
|
|
87
|
-
|
|
180
|
+
var DefaultElement = function (props) {
|
|
88
181
|
var _a;
|
|
89
|
-
return (
|
|
182
|
+
return ((0, jsx_runtime_1.jsxs)(Paragraph_1.ReqoreP, __assign({}, props.attributes, { style: { position: 'relative' }, children: [props.placeholder && ((0, jsx_runtime_1.jsx)(Span_1.ReqoreSpan, __assign({ inline: true, effect: { opacity: 0.3 } }, props.placeholderProps, { contentEditable: false, style: __assign({ position: 'absolute', top: 0, left: 0, right: 0, pointerEvents: 'none', userSelect: 'none' }, (_a = props.placeholderProps) === null || _a === void 0 ? void 0 : _a.style), children: props.placeholder }))), props.children] })));
|
|
90
183
|
};
|
|
184
|
+
exports.DefaultElement = DefaultElement;
|
|
91
185
|
var insertTag = function (editor, value, label, metadata) {
|
|
92
186
|
var mention = {
|
|
93
187
|
type: 'tag',
|
|
@@ -96,8 +190,8 @@ var insertTag = function (editor, value, label, metadata) {
|
|
|
96
190
|
metadata: metadata,
|
|
97
191
|
children: [{ text: '' }],
|
|
98
192
|
};
|
|
99
|
-
Transforms.insertNodes(editor, mention);
|
|
100
|
-
Transforms.move(editor);
|
|
193
|
+
slate_1.Transforms.insertNodes(editor, mention);
|
|
194
|
+
slate_1.Transforms.move(editor);
|
|
101
195
|
};
|
|
102
196
|
/**
|
|
103
197
|
* Slate props that are not DOM attributes and must survive the filter below.
|
|
@@ -145,50 +239,50 @@ var NON_EDITABLE_PROPS = new Set(['cols', 'fill', 'rows', 'value']);
|
|
|
145
239
|
* silently. Apply the same rule styled-components applies for a tag target,
|
|
146
240
|
* plus the Slate props it has no way to know about.
|
|
147
241
|
*/
|
|
148
|
-
var RefSafeSlateEditable = memo(forwardRef(function (props, ref) {
|
|
242
|
+
var RefSafeSlateEditable = (0, react_1.memo)((0, react_1.forwardRef)(function (props, ref) {
|
|
149
243
|
// Accept the polymorphic input's DOM-ref contract without passing it to
|
|
150
244
|
// Slate's function component. Slate owns this element through ReactEditor.
|
|
151
245
|
void ref;
|
|
152
246
|
// Not memoised: `memo` above already skips the re-render when the props are
|
|
153
247
|
// shallow-equal, so every render that reaches here has new props to filter.
|
|
154
248
|
var editableProps = Object.keys(props).reduce(function (acc, key) {
|
|
155
|
-
if (!NON_EDITABLE_PROPS.has(key) && (SLATE_EDITABLE_PROPS.has(key) ||
|
|
249
|
+
if (!NON_EDITABLE_PROPS.has(key) && (SLATE_EDITABLE_PROPS.has(key) || (0, is_prop_valid_1.default)(key))) {
|
|
156
250
|
acc[key] = props[key];
|
|
157
251
|
}
|
|
158
252
|
return acc;
|
|
159
253
|
}, {});
|
|
160
|
-
return
|
|
254
|
+
return (0, jsx_runtime_1.jsx)(slate_react_1.Editable, __assign({}, editableProps));
|
|
161
255
|
}));
|
|
162
256
|
RefSafeSlateEditable.displayName = 'RefSafeSlateEditable';
|
|
163
|
-
|
|
257
|
+
exports.ReqoreRichTextEditor = (0, react_1.forwardRef)(function (_a, ref) {
|
|
164
258
|
var _b = _a.value, value = _b === void 0 ? [
|
|
165
259
|
{
|
|
166
260
|
type: 'paragraph',
|
|
167
261
|
children: [{ text: '' }],
|
|
168
262
|
},
|
|
169
|
-
] : _b, onChange = _a.onChange, tags = _a.tags, _c = _a.getTagProps, getTagProps = _c === void 0 ?
|
|
263
|
+
] : _b, onChange = _a.onChange, tags = _a.tags, _c = _a.getTagProps, getTagProps = _c === void 0 ? NO_TAG_PROPS : _c, _d = _a.tagsProps, tagsProps = _d === void 0 ? EMPTY_TAG_PROPS : _d, onTagClick = _a.onTagClick, _e = _a.tagsListProps, tagsListProps = _e === void 0 ? EMPTY_TAGS_LIST_PROPS : _e, panelProps = _a.panelProps, actions = _a.actions, customRenderLeaf = _a.customRenderLeaf, decorate = _a.decorate, placeholder = _a.placeholder, placeholderProps = _a.placeholderProps, onFocus = _a.onFocus, onFocusCapture = _a.onFocusCapture, rest = __rest(_a, ["value", "onChange", "tags", "getTagProps", "tagsProps", "onTagClick", "tagsListProps", "panelProps", "actions", "customRenderLeaf", "decorate", "placeholder", "placeholderProps", "onFocus", "onFocusCapture"]);
|
|
170
264
|
// Create a Slate editor object that won't change across renders.
|
|
171
|
-
var editor = useState(function () { return withTemplates(withReact(withHistory(createEditor()))); })[0];
|
|
172
|
-
useImperativeHandle(ref, function () { return editor; }, [editor]);
|
|
173
|
-
var _f = useState(), target = _f[0], setTarget = _f[1];
|
|
174
|
-
useUpdateEffect(function () {
|
|
265
|
+
var editor = (0, react_1.useState)(function () { return (0, exports.withTemplates)((0, slate_react_1.withReact)((0, slate_history_1.withHistory)((0, slate_1.createEditor)()))); })[0];
|
|
266
|
+
(0, react_1.useImperativeHandle)(ref, function () { return editor; }, [editor]);
|
|
267
|
+
var _f = (0, react_1.useState)(), target = _f[0], setTarget = _f[1];
|
|
268
|
+
(0, react_use_1.useUpdateEffect)(function () {
|
|
175
269
|
// Only update the editor's children if the value has changed
|
|
176
270
|
if (JSON.stringify(value) === JSON.stringify(editor.children)) {
|
|
177
271
|
return;
|
|
178
272
|
}
|
|
179
273
|
// Use Slate transforms instead of direct mutation
|
|
180
274
|
try {
|
|
181
|
-
Editor.withoutNormalizing(editor, function () {
|
|
275
|
+
slate_1.Editor.withoutNormalizing(editor, function () {
|
|
182
276
|
// Deselect before replacing content
|
|
183
|
-
Transforms.deselect(editor);
|
|
277
|
+
slate_1.Transforms.deselect(editor);
|
|
184
278
|
// Remove all existing top-level nodes
|
|
185
279
|
while (editor.children.length) {
|
|
186
|
-
Transforms.removeNodes(editor, { at: [0] });
|
|
280
|
+
slate_1.Transforms.removeNodes(editor, { at: [0] });
|
|
187
281
|
}
|
|
188
282
|
// Insert new content
|
|
189
|
-
Transforms.insertNodes(editor, value, { at: [0] });
|
|
283
|
+
slate_1.Transforms.insertNodes(editor, value, { at: [0] });
|
|
190
284
|
// Move selection to end
|
|
191
|
-
Transforms.select(editor, Editor.end(editor, []));
|
|
285
|
+
slate_1.Transforms.select(editor, slate_1.Editor.end(editor, []));
|
|
192
286
|
});
|
|
193
287
|
}
|
|
194
288
|
catch (error) {
|
|
@@ -197,51 +291,71 @@ export var ReqoreRichTextEditor = forwardRef(function (_a, ref) {
|
|
|
197
291
|
editor.children = value;
|
|
198
292
|
}
|
|
199
293
|
}, [JSON.stringify(value)]);
|
|
200
|
-
var isEmpty = useMemo(function () {
|
|
201
|
-
return size(value) === 1 && size(value[0].children) === 1 && value[0].children[0].text === '';
|
|
294
|
+
var isEmpty = (0, react_1.useMemo)(function () {
|
|
295
|
+
return (0, lodash_1.size)(value) === 1 && (0, lodash_1.size)(value[0].children) === 1 && value[0].children[0].text === '';
|
|
202
296
|
}, [value]);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
297
|
+
/**
|
|
298
|
+
* The composed chip props, cached PER ELEMENT.
|
|
299
|
+
*
|
|
300
|
+
* Composing them inline in `renderElement` built a new object — and two new
|
|
301
|
+
* closures — every time it ran, for every chip in the document. That object
|
|
302
|
+
* is `TemplateElement`'s only non-trivial prop, so `memo()` on it could
|
|
303
|
+
* never bail out, and `handleClick`'s `useCallback` inside it, which lists
|
|
304
|
+
* `props.tagProps`, could never hit: every chip re-rendered and re-bound its
|
|
305
|
+
* handlers on every keystroke, on the hot path of a control whose whole job
|
|
306
|
+
* is to be typed into.
|
|
307
|
+
*
|
|
308
|
+
* A `WeakMap` keyed by the element is the right cache because Slate's
|
|
309
|
+
* documents are immutable: an untouched node keeps its identity across an
|
|
310
|
+
* edit, and an edited one becomes a new object, which misses and recomposes.
|
|
311
|
+
* Entries are dropped with the elements themselves.
|
|
312
|
+
*
|
|
313
|
+
* The cache is thrown away and rebuilt whenever anything the composition
|
|
314
|
+
* reads changes, so `getTagProps` identity is the invalidation signal — a
|
|
315
|
+
* `useCallback`-stable one is a promise that its answer for a given element
|
|
316
|
+
* is stable too. A `getTagProps` that has to react to something else (a
|
|
317
|
+
* hover, a selection held outside the editor) must list it, exactly as it
|
|
318
|
+
* already must for `renderElement` to see the change at all.
|
|
319
|
+
*/
|
|
320
|
+
var tagPropsCache = (0, react_1.useMemo)(function () { return new WeakMap(); }, [editor, getTagProps, tagsProps, onTagClick, rest.size, rest.readOnly, rest.disabled]);
|
|
321
|
+
var composeTagProps = (0, react_1.useCallback)(function (element) {
|
|
322
|
+
var cached = tagPropsCache.get(element);
|
|
323
|
+
if (cached) {
|
|
324
|
+
return cached;
|
|
229
325
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
326
|
+
var finalProps = __assign(__assign({}, tagsProps), getTagProps(element));
|
|
327
|
+
var interactive = !rest.readOnly && !rest.disabled;
|
|
328
|
+
var composed = __assign(__assign({}, finalProps), { size: rest.size ? (0, utils_1.getOneLessSize)(rest.size) : finalProps.size || 'small',
|
|
329
|
+
/* Says "not choosable" to the chip itself, which withholding the
|
|
330
|
+
handlers below cannot: `TemplateElement` binds a click of its own to
|
|
331
|
+
place the cursor, so an uninteractive editor still hands the tag a
|
|
332
|
+
handler and a tag with a handler paints itself pressable. This is
|
|
333
|
+
the flag that keeps the cursor, the hover effect and the tab stop
|
|
334
|
+
honest — and it is the ONLY route by which the editor's `disabled`
|
|
335
|
+
reaches the chip, since `disabled` never reaches Slate and
|
|
336
|
+
`useReadOnly()` therefore cannot see it. */
|
|
337
|
+
readOnly: !interactive || finalProps.readOnly, onClick: interactive
|
|
338
|
+
? function (event) {
|
|
339
|
+
var _a;
|
|
340
|
+
onTagClick === null || onTagClick === void 0 ? void 0 : onTagClick(element);
|
|
341
|
+
(_a = finalProps.onClick) === null || _a === void 0 ? void 0 : _a.call(finalProps, event);
|
|
342
|
+
}
|
|
343
|
+
: undefined, onRemoveClick: interactive
|
|
344
|
+
? function () {
|
|
345
|
+
try {
|
|
346
|
+
var path = slate_react_1.ReactEditor.findPath(editor, element);
|
|
347
|
+
slate_1.Transforms.removeNodes(editor, { at: path });
|
|
348
|
+
}
|
|
349
|
+
catch (error) {
|
|
350
|
+
// Element may no longer be in the editor
|
|
351
|
+
console.warn('Failed to remove tag:', error);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
: undefined });
|
|
355
|
+
tagPropsCache.set(element, composed);
|
|
356
|
+
return composed;
|
|
357
|
+
}, [
|
|
358
|
+
tagPropsCache,
|
|
245
359
|
editor,
|
|
246
360
|
getTagProps,
|
|
247
361
|
tagsProps,
|
|
@@ -250,13 +364,34 @@ export var ReqoreRichTextEditor = forwardRef(function (_a, ref) {
|
|
|
250
364
|
rest.readOnly,
|
|
251
365
|
rest.disabled,
|
|
252
366
|
]);
|
|
253
|
-
var
|
|
367
|
+
var renderElement = (0, react_1.useCallback)(function (props) {
|
|
368
|
+
switch (props.element.type) {
|
|
369
|
+
case 'tag': {
|
|
370
|
+
return (0, jsx_runtime_1.jsx)(exports.TemplateElement, __assign({}, props, { tagProps: composeTagProps(props.element) }));
|
|
371
|
+
}
|
|
372
|
+
default:
|
|
373
|
+
return ((0, jsx_runtime_1.jsx)(exports.DefaultElement, __assign({}, props, { placeholder: isEmpty ? placeholder : undefined, placeholderProps: isEmpty ? placeholderProps : undefined })));
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
// All values read inside the callback must be listed here. Everything
|
|
377
|
+
// the chip composition reads now hangs off `composeTagProps`, which
|
|
378
|
+
// carries those dependencies itself — so this list is short on purpose,
|
|
379
|
+
// and that matters: slate-react's `ElementComponent` memo compares
|
|
380
|
+
// `renderElement` BY IDENTITY, so a dependency that churns re-renders
|
|
381
|
+
// every element in the document, not just the chips.
|
|
382
|
+
//
|
|
383
|
+
// Consumers that pass non-stable callbacks (`getTagProps`, `onTagClick`)
|
|
384
|
+
// or a fresh `placeholderProps` object as inline literals put that churn
|
|
385
|
+
// back; pass stable refs (`useCallback` / `useMemo`) for best
|
|
386
|
+
// performance.
|
|
387
|
+
[isEmpty, placeholder, placeholderProps, composeTagProps]);
|
|
388
|
+
var handleFocus = (0, react_1.useCallback)(function (event) {
|
|
254
389
|
// Firefox does not always create a DOM selection when an empty Slate
|
|
255
390
|
// editor contains an absolutely positioned, non-editable placeholder.
|
|
256
391
|
// Establish the corresponding Slate selection before the first key
|
|
257
392
|
// event so keyboard input is not discarded.
|
|
258
393
|
if (isEmpty && !editor.selection && !rest.readOnly && !rest.disabled) {
|
|
259
|
-
Transforms.select(editor, Editor.start(editor, []));
|
|
394
|
+
slate_1.Transforms.select(editor, slate_1.Editor.start(editor, []));
|
|
260
395
|
}
|
|
261
396
|
// Chain any consumer-provided focus handlers. Slate's `Editable`
|
|
262
397
|
// gates its internal `onFocus` wrapper behind editable-target/selection
|
|
@@ -265,23 +400,23 @@ export var ReqoreRichTextEditor = forwardRef(function (_a, ref) {
|
|
|
265
400
|
onFocusCapture === null || onFocusCapture === void 0 ? void 0 : onFocusCapture(event);
|
|
266
401
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
267
402
|
}, [editor, isEmpty, onFocus, onFocusCapture, rest.disabled, rest.readOnly]);
|
|
268
|
-
var renderLeaf = useCallback(function (props) {
|
|
269
|
-
return customRenderLeaf ? customRenderLeaf(props) :
|
|
403
|
+
var renderLeaf = (0, react_1.useCallback)(function (props) {
|
|
404
|
+
return customRenderLeaf ? customRenderLeaf(props) : (0, jsx_runtime_1.jsx)(Leaf, __assign({}, props));
|
|
270
405
|
}, [customRenderLeaf]);
|
|
271
|
-
var isMarkActive = useCallback(function (editor, format) {
|
|
272
|
-
var marks = Editor.marks(editor);
|
|
406
|
+
var isMarkActive = (0, react_1.useCallback)(function (editor, format) {
|
|
407
|
+
var marks = slate_1.Editor.marks(editor);
|
|
273
408
|
return marks ? marks[format] === true : false;
|
|
274
409
|
}, []);
|
|
275
|
-
var toggleMark = useCallback(function (editor, format) {
|
|
410
|
+
var toggleMark = (0, react_1.useCallback)(function (editor, format) {
|
|
276
411
|
var isActive = isMarkActive(editor, format);
|
|
277
412
|
if (isActive) {
|
|
278
|
-
Editor.removeMark(editor, format);
|
|
413
|
+
slate_1.Editor.removeMark(editor, format);
|
|
279
414
|
}
|
|
280
415
|
else {
|
|
281
|
-
Editor.addMark(editor, format, true);
|
|
416
|
+
slate_1.Editor.addMark(editor, format, true);
|
|
282
417
|
}
|
|
283
418
|
}, [isMarkActive]);
|
|
284
|
-
var panelActions = useMemo(function () {
|
|
419
|
+
var panelActions = (0, react_1.useMemo)(function () {
|
|
285
420
|
var _actions = __spreadArray([], ((panelProps === null || panelProps === void 0 ? void 0 : panelProps.actions) || []), true);
|
|
286
421
|
if (!actions) {
|
|
287
422
|
return _actions;
|
|
@@ -346,47 +481,160 @@ export var ReqoreRichTextEditor = forwardRef(function (_a, ref) {
|
|
|
346
481
|
_actions.push(undoRedoActions);
|
|
347
482
|
}
|
|
348
483
|
return _actions;
|
|
349
|
-
}, [actions, value, target, Editor.marks(editor), editor]);
|
|
350
|
-
var items = useMemo(function () {
|
|
351
|
-
if (size(tags)) {
|
|
352
|
-
return map(tags, function (_a, key) {
|
|
484
|
+
}, [actions, value, target, slate_1.Editor.marks(editor), editor]);
|
|
485
|
+
var items = (0, react_1.useMemo)(function () {
|
|
486
|
+
if ((0, lodash_1.size)(tags)) {
|
|
487
|
+
return (0, lodash_1.map)(tags, function (_a, key) {
|
|
353
488
|
var items = _a.items, tag = __rest(_a, ["items"]);
|
|
354
489
|
return (__assign(__assign({ label: tag.label || key }, tag), { items: items }));
|
|
355
490
|
});
|
|
356
491
|
}
|
|
357
492
|
return undefined;
|
|
358
493
|
}, [tags]);
|
|
359
|
-
|
|
494
|
+
/* A caret in the empty text BESIDE a chip is a dead cursor.
|
|
495
|
+
|
|
496
|
+
The position itself is legitimate — it is the point `TemplateElement`
|
|
497
|
+
deliberately moves to when the chip is clicked, and typing works from
|
|
498
|
+
there. What breaks is arriving by clicking the empty text directly: the
|
|
499
|
+
BROWSER owns the DOM caret then, and it resolves the first keystroke back
|
|
500
|
+
into the chip's own text child, where Slate silently ignores it.
|
|
501
|
+
|
|
502
|
+
Measured on the reported case: selection `[0,2]` before the key,
|
|
503
|
+
`[0,1,0]` after it, document unchanged, `onChange` fired twice.
|
|
504
|
+
|
|
505
|
+
Re-selecting through Slate alone does not help, because Slate's selection
|
|
506
|
+
is ALREADY the right point — `Transforms.select` to the same range is a
|
|
507
|
+
no-op and never re-syncs the DOM. So the DOM range is set explicitly,
|
|
508
|
+
which is the thing the next keystroke actually resolves from.
|
|
509
|
+
|
|
510
|
+
Collapsed selections only: a RANGE spanning a chip is how it gets
|
|
511
|
+
selected for deletion and must be left alone. */
|
|
512
|
+
var repairCaretBesideVoid = (0, react_1.useCallback)(function () {
|
|
513
|
+
var _a;
|
|
514
|
+
if (rest.readOnly || rest.disabled) {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
/* Adopt the caret this click placed BEFORE reading it.
|
|
518
|
+
|
|
519
|
+
slate-react takes the browser's caret into `editor.selection` from a
|
|
520
|
+
`selectionchange` handler throttled to 100ms, so at mouseup Slate may
|
|
521
|
+
still have no selection at all. This handler then used to return
|
|
522
|
+
without repairing anything — and the gap is worse than a missed
|
|
523
|
+
repair: a re-render of the editable in that window sees a browser caret
|
|
524
|
+
with no Slate selection, treats it as stale and REMOVES it, which is
|
|
525
|
+
itself a selection change and spends the throttle window. The click's
|
|
526
|
+
own change is deferred to the trailing edge, a key pressed before then
|
|
527
|
+
is dropped, and by the time the handler runs there is no caret left to
|
|
528
|
+
adopt — the field reads as frozen.
|
|
529
|
+
|
|
530
|
+
Measured in the Qorus test editor: Slate's selection `null` at the first
|
|
531
|
+
keystroke while the browser caret sat correctly beside the chip; the
|
|
532
|
+
same story passed only when the key happened to land more than 100ms
|
|
533
|
+
after the last throttled call.
|
|
534
|
+
|
|
535
|
+
Only a caret slate-react itself would accept is taken, and never while
|
|
536
|
+
composing — an IME owns the selection then. */
|
|
537
|
+
try {
|
|
538
|
+
var domSelection = slate_react_1.ReactEditor.getWindow(editor).getSelection();
|
|
539
|
+
var _b = domSelection !== null && domSelection !== void 0 ? domSelection : {}, anchorNode = _b.anchorNode, focusNode = _b.focusNode;
|
|
540
|
+
/* The same test slate-react's own handler applies before it adopts a
|
|
541
|
+
caret, so this takes exactly what that handler would take, only
|
|
542
|
+
sooner. */
|
|
543
|
+
if (domSelection &&
|
|
544
|
+
domSelection.rangeCount > 0 &&
|
|
545
|
+
anchorNode &&
|
|
546
|
+
focusNode &&
|
|
547
|
+
!slate_react_1.ReactEditor.isComposing(editor) &&
|
|
548
|
+
slate_react_1.ReactEditor.hasSelectableTarget(editor, anchorNode) &&
|
|
549
|
+
slate_react_1.ReactEditor.hasSelectableTarget(editor, focusNode)) {
|
|
550
|
+
var clicked = slate_react_1.ReactEditor.toSlateRange(editor, domSelection, {
|
|
551
|
+
exactMatch: false,
|
|
552
|
+
suppressThrow: true,
|
|
553
|
+
});
|
|
554
|
+
if (clicked && !(editor.selection && slate_1.Range.equals(editor.selection, clicked))) {
|
|
555
|
+
slate_1.Transforms.select(editor, clicked);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
catch (_c) {
|
|
560
|
+
// Nothing to adopt is not an error; the throttled handler still runs.
|
|
561
|
+
}
|
|
562
|
+
var selection = editor.selection;
|
|
563
|
+
if (!selection || !slate_1.Range.isCollapsed(selection)) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
try {
|
|
567
|
+
/* Either already inside a void (`voids: true`, or the void the point
|
|
568
|
+
is inside is not matched at all), or in the empty text immediately
|
|
569
|
+
after one. `Editor.void` / `Editor.leaf` rather than `Editor.nodes`:
|
|
570
|
+
the latter returns a generator, which this build target cannot
|
|
571
|
+
destructure (TS2802). */
|
|
572
|
+
var inside = slate_1.Editor.void(editor, { at: selection, voids: true });
|
|
573
|
+
var voidPath = inside === null || inside === void 0 ? void 0 : inside[1];
|
|
574
|
+
if (!voidPath) {
|
|
575
|
+
var textEntry = slate_1.Editor.leaf(editor, selection);
|
|
576
|
+
if (!textEntry) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
var textNode = textEntry[0], textPath = textEntry[1];
|
|
580
|
+
if (textNode.text !== '') {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
var previous = slate_1.Editor.previous(editor, { at: textPath });
|
|
584
|
+
if (!previous || !slate_1.Editor.isVoid(editor, previous[0])) {
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
voidPath = previous[1];
|
|
588
|
+
}
|
|
589
|
+
// The same point `TemplateElement` uses: from the void's END and
|
|
590
|
+
// skipping voids, so it cannot resolve back into another one.
|
|
591
|
+
var point = (_a = slate_1.Editor.after(editor, slate_1.Editor.end(editor, voidPath), { voids: false })) !== null && _a !== void 0 ? _a : slate_1.Editor.end(editor, []);
|
|
592
|
+
var range = { anchor: point, focus: point };
|
|
593
|
+
slate_1.Transforms.select(editor, range);
|
|
594
|
+
var domRange = slate_react_1.ReactEditor.toDOMRange(editor, range);
|
|
595
|
+
var domSelection = slate_react_1.ReactEditor.getWindow(editor).getSelection();
|
|
596
|
+
if (domSelection) {
|
|
597
|
+
domSelection.removeAllRanges();
|
|
598
|
+
domSelection.addRange(domRange);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
catch (_d) {
|
|
602
|
+
// A selection can reference a path a concurrent re-render has removed,
|
|
603
|
+
// and `toDOMRange` throws for a point it cannot resolve. Leaving the
|
|
604
|
+
// cursor where it is beats throwing out of an event handler.
|
|
605
|
+
}
|
|
606
|
+
}, [editor, rest.readOnly, rest.disabled]);
|
|
607
|
+
return ((0, jsx_runtime_1.jsx)(__1.ReqorePanel, __assign({ flat: true, padded: false, minimal: true, transparent: true, size: 'small' }, panelProps, { children: (0, jsx_runtime_1.jsx)(slate_react_1.Slate, { editor: editor, initialValue: value, onChange: function (data) {
|
|
360
608
|
var selection = editor.selection;
|
|
361
609
|
setTarget(selection);
|
|
362
610
|
onChange === null || onChange === void 0 ? void 0 : onChange(data);
|
|
363
|
-
}, children:
|
|
611
|
+
}, children: (0, jsx_runtime_1.jsx)(__1.ReqoreTextarea, __assign({}, rest, { renderElement: renderElement, renderLeaf: renderLeaf, decorate: decorate, onFocusCapture: handleFocus, onMouseUp: repairCaretBesideVoid, as: RefSafeSlateEditable, style: {
|
|
364
612
|
lineHeight: 1.5,
|
|
365
613
|
outline: 'none',
|
|
366
614
|
}, onClearClick: isEmpty
|
|
367
615
|
? undefined
|
|
368
616
|
: function () {
|
|
369
|
-
Transforms.delete(editor, {
|
|
617
|
+
slate_1.Transforms.delete(editor, {
|
|
370
618
|
at: {
|
|
371
|
-
anchor: Editor.start(editor, []),
|
|
372
|
-
focus: Editor.end(editor, []),
|
|
619
|
+
anchor: slate_1.Editor.start(editor, []),
|
|
620
|
+
focus: slate_1.Editor.end(editor, []),
|
|
373
621
|
},
|
|
374
622
|
});
|
|
375
623
|
// Focus the editor
|
|
376
624
|
try {
|
|
377
|
-
ReactEditor.focus(editor);
|
|
625
|
+
slate_react_1.ReactEditor.focus(editor);
|
|
378
626
|
}
|
|
379
627
|
catch (error) {
|
|
380
628
|
// Editor may not be mounted
|
|
381
629
|
}
|
|
382
|
-
}, value: JSON.stringify(value || []), onChange: useCallback(function () { }, []), templates: __assign(__assign({ customElements: size(panelActions)
|
|
630
|
+
}, value: JSON.stringify(value || []), onChange: (0, react_1.useCallback)(function () { }, []), templates: __assign(__assign({ customElements: (0, lodash_1.size)(panelActions)
|
|
383
631
|
? [
|
|
384
|
-
|
|
632
|
+
(0, jsx_runtime_1.jsx)(__1.ReqoreControlGroup, { spaceBetween: true, size: 'small', fixed: true, children: panelActions.map(function (action, index) {
|
|
385
633
|
var _a;
|
|
386
634
|
if (action.group) {
|
|
387
|
-
return (
|
|
635
|
+
return ((0, jsx_runtime_1.jsx)(__1.ReqoreControlGroup, { stack: true, children: (_a = action.group) === null || _a === void 0 ? void 0 : _a.map(function (action, index) { return ((0, jsx_runtime_1.jsx)(__1.ReqoreButton, __assign({ customTheme: tagsListProps === null || tagsListProps === void 0 ? void 0 : tagsListProps.listCustomTheme, intent: tagsListProps === null || tagsListProps === void 0 ? void 0 : tagsListProps.listIntent }, action), index)); }) }, index));
|
|
388
636
|
}
|
|
389
|
-
return (
|
|
637
|
+
return ((0, jsx_runtime_1.jsx)(__1.ReqoreButton, __assign({ customTheme: tagsListProps === null || tagsListProps === void 0 ? void 0 : tagsListProps.listCustomTheme, intent: tagsListProps === null || tagsListProps === void 0 ? void 0 : tagsListProps.listIntent }, action), index));
|
|
390
638
|
}) }, 0),
|
|
391
639
|
]
|
|
392
640
|
: undefined }, tagsListProps), { items: items, closeOnInsideClick: false, onItemSelect: function (item) {
|
|
@@ -394,12 +642,12 @@ export var ReqoreRichTextEditor = forwardRef(function (_a, ref) {
|
|
|
394
642
|
try {
|
|
395
643
|
// Use current selection or fallback to end of document
|
|
396
644
|
var selection = editor.selection || {
|
|
397
|
-
anchor: Editor.end(editor, []),
|
|
398
|
-
focus: Editor.end(editor, []),
|
|
645
|
+
anchor: slate_1.Editor.end(editor, []),
|
|
646
|
+
focus: slate_1.Editor.end(editor, []),
|
|
399
647
|
};
|
|
400
|
-
Transforms.select(editor, selection);
|
|
648
|
+
slate_1.Transforms.select(editor, selection);
|
|
401
649
|
insertTag(editor, item.value, item.label, item.metadata);
|
|
402
|
-
ReactEditor.focus(editor);
|
|
650
|
+
slate_react_1.ReactEditor.focus(editor);
|
|
403
651
|
}
|
|
404
652
|
catch (error) {
|
|
405
653
|
// Fallback: just insert at current position
|