@qoretechnologies/reqore 0.78.6-pr.715.gdfefa70 → 0.78.7-pr.717.gdcb33d8
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 +14 -0
- package/dist/components/Accordion/index.d.ts.map +1 -1
- package/dist/components/Accordion/index.js +48 -21
- package/dist/components/Accordion/index.js.map +1 -1
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +344 -44
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/item.js +6 -2
- package/dist/components/Breadcrumbs/item.js.map +1 -1
- package/dist/components/Bubble/index.d.ts.map +1 -1
- package/dist/components/Bubble/index.js +20 -43
- package/dist/components/Bubble/index.js.map +1 -1
- package/dist/components/Button/index.d.ts +73 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +307 -109
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ButtonRail/index.d.ts.map +1 -1
- package/dist/components/ButtonRail/index.js +3 -2
- package/dist/components/ButtonRail/index.js.map +1 -1
- package/dist/components/Callout/index.d.ts +4 -3
- package/dist/components/Callout/index.d.ts.map +1 -1
- package/dist/components/Callout/index.js +87 -23
- package/dist/components/Callout/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +117 -40
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collapse/index.d.ts.map +1 -1
- package/dist/components/Collapse/index.js +7 -36
- package/dist/components/Collapse/index.js.map +1 -1
- package/dist/components/CollapsibleContent/index.d.ts.map +1 -1
- package/dist/components/CollapsibleContent/index.js +11 -39
- package/dist/components/CollapsibleContent/index.js.map +1 -1
- package/dist/components/Collection/index.js +3 -3
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +4 -4
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/column.d.ts.map +1 -1
- package/dist/components/Columns/column.js +6 -35
- package/dist/components/Columns/column.js.map +1 -1
- package/dist/components/Columns/index.d.ts.map +1 -1
- package/dist/components/Columns/index.js +3 -35
- package/dist/components/Columns/index.js.map +1 -1
- package/dist/components/Comment/index.js +8 -8
- package/dist/components/Comment/index.js.map +1 -1
- package/dist/components/CommentFeed/index.js +2 -2
- package/dist/components/CommentFeed/index.js.map +1 -1
- package/dist/components/Content/index.d.ts.map +1 -1
- package/dist/components/Content/index.js +3 -35
- package/dist/components/Content/index.js.map +1 -1
- package/dist/components/Content/wrapper.js +2 -2
- 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 +52 -19
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/ControlGroup/item.d.ts.map +1 -1
- package/dist/components/ControlGroup/item.js +35 -6
- package/dist/components/ControlGroup/item.js.map +1 -1
- package/dist/components/DataView/index.d.ts.map +1 -1
- package/dist/components/DataView/index.js +35 -65
- package/dist/components/DataView/index.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +40 -8
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DescriptionList/index.d.ts.map +1 -1
- package/dist/components/DescriptionList/index.js +28 -42
- package/dist/components/DescriptionList/index.js.map +1 -1
- package/dist/components/Drawer/backdrop.d.ts.map +1 -1
- package/dist/components/Drawer/backdrop.js +35 -6
- package/dist/components/Drawer/backdrop.js.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +77 -66
- 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 +3 -1
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +90 -19
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Effect/index.d.ts +48 -6
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +207 -46
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/EntityRow/index.d.ts +18 -1
- package/dist/components/EntityRow/index.d.ts.map +1 -1
- package/dist/components/EntityRow/index.js +135 -40
- package/dist/components/EntityRow/index.js.map +1 -1
- package/dist/components/FadeScroller/index.d.ts.map +1 -1
- package/dist/components/FadeScroller/index.js +14 -64
- package/dist/components/FadeScroller/index.js.map +1 -1
- package/dist/components/FeatureCard/index.d.ts +7 -1
- package/dist/components/FeatureCard/index.d.ts.map +1 -1
- package/dist/components/FeatureCard/index.js +88 -27
- package/dist/components/FeatureCard/index.js.map +1 -1
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +8 -5
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +39 -19
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/IconPicker/index.js +2 -2
- package/dist/components/IconPicker/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +37 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +91 -28
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InputClearButton/index.d.ts +7 -2
- package/dist/components/InputClearButton/index.d.ts.map +1 -1
- package/dist/components/InputClearButton/index.js +48 -9
- package/dist/components/InputClearButton/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +56 -19
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/KeyboardShortcut/index.js +3 -3
- package/dist/components/KeyboardShortcut/index.js.map +1 -1
- package/dist/components/Layout/content.js +2 -2
- package/dist/components/Layout/content.js.map +1 -1
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/Layout/index.js +3 -35
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/Link/index.d.ts.map +1 -1
- package/dist/components/Link/index.js +12 -39
- package/dist/components/Link/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +10 -6
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +40 -22
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +35 -5
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Menu/section.d.ts.map +1 -1
- package/dist/components/Menu/section.js +11 -6
- package/dist/components/Menu/section.js.map +1 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +20 -4
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/NavRail/index.d.ts +2 -0
- package/dist/components/NavRail/index.d.ts.map +1 -1
- package/dist/components/NavRail/index.js +110 -27
- package/dist/components/NavRail/index.js.map +1 -1
- package/dist/components/Navbar/divider.d.ts.map +1 -1
- package/dist/components/Navbar/divider.js +35 -6
- package/dist/components/Navbar/divider.js.map +1 -1
- package/dist/components/Navbar/group.js +3 -3
- package/dist/components/Navbar/group.js.map +1 -1
- package/dist/components/Navbar/index.js +3 -3
- package/dist/components/Navbar/index.js.map +1 -1
- package/dist/components/Navbar/item.js +3 -3
- package/dist/components/Navbar/item.js.map +1 -1
- package/dist/components/Notifications/index.d.ts.map +1 -1
- package/dist/components/Notifications/index.js +6 -35
- package/dist/components/Notifications/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +6 -2
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +87 -57
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Notifications/styles.d.ts +20 -0
- package/dist/components/Notifications/styles.d.ts.map +1 -1
- package/dist/components/Notifications/styles.js +40 -15
- package/dist/components/Notifications/styles.js.map +1 -1
- package/dist/components/Paging/index.d.ts.map +1 -1
- package/dist/components/Paging/index.js +19 -19
- package/dist/components/Paging/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +15 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +505 -204
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Panel/surface.d.ts +18 -0
- package/dist/components/Panel/surface.d.ts.map +1 -0
- package/dist/components/Panel/surface.js +56 -0
- package/dist/components/Panel/surface.js.map +1 -0
- package/dist/components/Paragraph/index.d.ts +6 -0
- package/dist/components/Paragraph/index.d.ts.map +1 -1
- package/dist/components/Paragraph/index.js +65 -13
- package/dist/components/Paragraph/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +8 -0
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +169 -21
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Progress/index.d.ts.map +1 -1
- package/dist/components/Progress/index.js +11 -43
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/Rating/index.d.ts.map +1 -1
- package/dist/components/Rating/index.js +24 -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 +130 -52
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/RowActionsMenu/index.d.ts +76 -0
- package/dist/components/RowActionsMenu/index.d.ts.map +1 -0
- package/dist/components/RowActionsMenu/index.js +182 -0
- package/dist/components/RowActionsMenu/index.js.map +1 -0
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.js +72 -76
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/Select/valuePreview.js +2 -2
- package/dist/components/Select/valuePreview.js.map +1 -1
- package/dist/components/SeverityRow/index.d.ts +19 -1
- package/dist/components/SeverityRow/index.d.ts.map +1 -1
- package/dist/components/SeverityRow/index.js +46 -15
- package/dist/components/SeverityRow/index.js.map +1 -1
- package/dist/components/Skeleton/index.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +6 -35
- package/dist/components/Skeleton/index.js.map +1 -1
- package/dist/components/Slider/index.js +9 -9
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Spacer/index.js +7 -7
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Span/index.d.ts.map +1 -1
- package/dist/components/Span/index.js +43 -11
- package/dist/components/Span/index.js.map +1 -1
- package/dist/components/StackedBar/index.d.ts.map +1 -1
- package/dist/components/StackedBar/index.js +48 -47
- package/dist/components/StackedBar/index.js.map +1 -1
- package/dist/components/Statistic/index.d.ts +0 -8
- package/dist/components/Statistic/index.d.ts.map +1 -1
- package/dist/components/Statistic/index.js +50 -44
- 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 +12 -44
- 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 +76 -52
- package/dist/components/Table/cell.js.map +1 -1
- package/dist/components/Table/header.d.ts.map +1 -1
- package/dist/components/Table/header.js +15 -12
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.d.ts.map +1 -1
- package/dist/components/Table/headerCell.js +8 -38
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +20 -0
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +52 -1
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +57 -2
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +154 -59
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +3 -1
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +44 -13
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Table/scrollbar.js +3 -3
- package/dist/components/Table/scrollbar.js.map +1 -1
- package/dist/components/Tabs/content.js +2 -2
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.js +3 -3
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +8 -6
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +6 -4
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +3 -35
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +77 -3
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +315 -83
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Testimonial/index.d.ts +6 -1
- package/dist/components/Testimonial/index.d.ts.map +1 -1
- package/dist/components/Testimonial/index.js +65 -19
- package/dist/components/Testimonial/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +16 -0
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +179 -30
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/Tier/group.d.ts.map +1 -1
- package/dist/components/Tier/group.js +9 -8
- package/dist/components/Tier/group.js.map +1 -1
- package/dist/components/Tier/index.d.ts +5 -0
- package/dist/components/Tier/index.d.ts.map +1 -1
- package/dist/components/Tier/index.js +14 -10
- package/dist/components/Tier/index.js.map +1 -1
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.d.ts.map +1 -1
- package/dist/components/Timeline/index.js +73 -28
- package/dist/components/Timeline/index.js.map +1 -1
- package/dist/components/TooltipComponent/index.d.ts.map +1 -1
- package/dist/components/TooltipComponent/index.js +6 -7
- package/dist/components/TooltipComponent/index.js.map +1 -1
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +26 -23
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/components/Tree/modal.d.ts.map +1 -1
- package/dist/components/Tree/modal.js +3 -1
- package/dist/components/Tree/modal.js.map +1 -1
- package/dist/constants/sizes.d.ts +5 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +6 -1
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.d.ts +0 -21
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +27 -13
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +7 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +27 -36
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/SurfaceContext.d.ts +18 -0
- package/dist/context/SurfaceContext.d.ts.map +1 -0
- package/dist/context/SurfaceContext.js +39 -0
- package/dist/context/SurfaceContext.js.map +1 -0
- package/dist/helpers/colors.d.ts +188 -11
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +751 -100
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/hoveringPointer.d.ts +54 -0
- package/dist/helpers/hoveringPointer.d.ts.map +1 -0
- package/dist/helpers/hoveringPointer.js +66 -0
- package/dist/helpers/hoveringPointer.js.map +1 -0
- package/dist/helpers/iconProps.d.ts +14 -0
- package/dist/helpers/iconProps.d.ts.map +1 -0
- package/dist/helpers/iconProps.js +33 -0
- package/dist/helpers/iconProps.js.map +1 -0
- package/dist/helpers/styled.d.ts +39 -26
- package/dist/helpers/styled.d.ts.map +1 -1
- package/dist/helpers/styled.js +156 -4
- package/dist/helpers/styled.js.map +1 -1
- package/dist/hooks/useAutoFocus.d.ts.map +1 -1
- package/dist/hooks/useAutoFocus.js +11 -1
- package/dist/hooks/useAutoFocus.js.map +1 -1
- package/dist/hooks/useCloneThroughFragments.d.ts.map +1 -1
- package/dist/hooks/useCloneThroughFragments.js +51 -18
- package/dist/hooks/useCloneThroughFragments.js.map +1 -1
- package/dist/hooks/useCombinedRefs.d.ts +16 -6
- package/dist/hooks/useCombinedRefs.d.ts.map +1 -1
- package/dist/hooks/useCombinedRefs.js +34 -27
- package/dist/hooks/useCombinedRefs.js.map +1 -1
- package/dist/hooks/useDragToScroll.d.ts +58 -0
- package/dist/hooks/useDragToScroll.d.ts.map +1 -0
- package/dist/hooks/useDragToScroll.js +262 -0
- package/dist/hooks/useDragToScroll.js.map +1 -0
- package/dist/hooks/useMarqueeOnHover.d.ts.map +1 -1
- package/dist/hooks/useMarqueeOnHover.js +10 -0
- package/dist/hooks/useMarqueeOnHover.js.map +1 -1
- package/dist/hooks/usePaging.d.ts +9 -4
- package/dist/hooks/usePaging.d.ts.map +1 -1
- package/dist/hooks/usePaging.js +21 -32
- package/dist/hooks/usePaging.js.map +1 -1
- package/dist/hooks/usePointerDrag.d.ts.map +1 -1
- package/dist/hooks/usePointerDrag.js +13 -3
- package/dist/hooks/usePointerDrag.js.map +1 -1
- package/dist/hooks/useReqoreMedia.d.ts +22 -7
- package/dist/hooks/useReqoreMedia.d.ts.map +1 -1
- package/dist/hooks/useReqoreMedia.js +33 -9
- package/dist/hooks/useReqoreMedia.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.js +6 -6
- package/dist/styles.js.map +1 -1
- package/package.json +3 -4
- package/vitest.config.ts +117 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoFocus.js","sourceRoot":"","sources":["../../src/hooks/useAutoFocus.ts"],"names":[],"mappings":";;;AAAA,+BAAuD;AACvD,uCAAwD;AAcjD,IAAM,YAAY,GAAG,UAC1B,OAA+C,EAC/C,KAA6B,EAC7B,QAA+B;IAE/B,IAAM,YAAY,GAAG,IAAA,cAAM,EAAU,KAAK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AAC;QAED,OAAO;YACL,OAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,mBAAmB,EAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,aAAa,CAAC;QAA3F,CAA2F,CAAC;IAChG,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AAzGW,QAAA,YAAY,gBAyGvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCloneThroughFragments.d.ts","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,eAAO,MAAM,wBAAwB,GACnC,aAAa,CACX,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,KAClC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACjC,OAAO,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"useCloneThroughFragments.d.ts","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,eAAO,MAAM,wBAAwB,GACnC,aAAa,CACX,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,KAClC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACjC,OAAO,GAAG,EAAE;sBAEyB,KAAK,CAAC,SAAS,KAAG,KAAK,CAAC,SAAS;CAsDvE,CAAC"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -36,26 +47,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
47
|
exports.useCloneThroughFragments = void 0;
|
|
37
48
|
var react_1 = __importStar(require("react"));
|
|
38
49
|
var useCloneThroughFragments = function (propsMapper, deps) {
|
|
39
|
-
var realIndex = 0;
|
|
40
50
|
var clone = (0, react_1.useCallback)(function (children) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
/* Counted per call, from the first child: the clone is kept between renders (`deps`), and a count kept with
|
|
52
|
+
it went on from where the last render left it - a group re-rendering by itself numbered its first child
|
|
53
|
+
the fourth. */
|
|
54
|
+
var realIndex = 0;
|
|
55
|
+
var cloneLevel = function (nodes) {
|
|
56
|
+
/* The keys given at this level of the children. A child keeps its own key, so React keeps it
|
|
57
|
+
(and its state) when another is added before it; a key given again is made unique (`#1`,
|
|
58
|
+
`#2`, ...), as the place a control group joined to every key used to make it. Children keyed
|
|
59
|
+
by what they say (a label, a name) can repeat it, and two children with one key are one to
|
|
60
|
+
React: it warns, and on an update drops or repeats one of them. A fragment's children are
|
|
61
|
+
keyed under the fragment, so each level counts its own. */
|
|
62
|
+
var given = new Map();
|
|
63
|
+
return react_1.default.Children.map(nodes, function (child, reactIndex) {
|
|
64
|
+
var _a;
|
|
65
|
+
if (child && react_1.default.isValidElement(child)) {
|
|
66
|
+
if (child.type === react_1.default.Fragment) {
|
|
67
|
+
return cloneLevel(child.props.children);
|
|
68
|
+
}
|
|
69
|
+
var props = propsMapper(child.props, reactIndex, realIndex, child.type);
|
|
70
|
+
/*
|
|
71
|
+
* Because of the way React.Children.map works, we have to
|
|
72
|
+
* manually decrement the index for every child that is `null`
|
|
73
|
+
* because react maps through null children and returns them in `Count`
|
|
74
|
+
* We filter these children out in the `realChildCount` variable,
|
|
75
|
+
* but the index is still incremented
|
|
76
|
+
* */
|
|
77
|
+
realIndex = realIndex + 1;
|
|
78
|
+
// a key the mapper set (a control group's `reactKey`) is the caller's to keep unique
|
|
79
|
+
if ((props === null || props === void 0 ? void 0 : props.key) === undefined && child.key !== null) {
|
|
80
|
+
var times = (_a = given.get(child.key)) !== null && _a !== void 0 ? _a : 0;
|
|
81
|
+
given.set(child.key, times + 1);
|
|
82
|
+
if (times > 0) {
|
|
83
|
+
return react_1.default.cloneElement(child, __assign(__assign({}, props), { key: "".concat(child.key, "#").concat(times) }));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return react_1.default.cloneElement(child, props);
|
|
45
87
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* because react maps through null children and returns them in `Count`
|
|
51
|
-
* We filter these children out in the `realChildCount` variable,
|
|
52
|
-
* but the index is still incremented
|
|
53
|
-
* */
|
|
54
|
-
realIndex = realIndex + 1;
|
|
55
|
-
return react_1.default.cloneElement(child, props);
|
|
56
|
-
}
|
|
57
|
-
return child;
|
|
58
|
-
});
|
|
88
|
+
return child;
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
return cloneLevel(children);
|
|
59
92
|
}, deps);
|
|
60
93
|
return (0, react_1.useMemo)(function () { return ({ clone: clone }); }, [clone]);
|
|
61
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCloneThroughFragments.js","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCloneThroughFragments.js","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoD;AAE7C,IAAM,wBAAwB,GAAG,UACtC,WAKiC,EACjC,IAAY;IAEZ,IAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,UAAC,QAAyB;QAClD;;yBAEiB;QACjB,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,IAAM,UAAU,GAAG,UAAC,KAAsB;YACxC;;;;;yEAK6D;YAC7D,IAAM,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;YAE3C,OAAO,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,UAAC,KAAK,EAAE,UAAU;;gBACjD,IAAI,KAAK,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzC,IAAI,KAAK,CAAC,IAAI,KAAK,eAAK,CAAC,QAAQ,EAAE,CAAC;wBAClC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;oBAE1E;;;;;;yBAMK;oBACL,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC;oBAE1B,qFAAqF;oBACrF,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,MAAK,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;wBACnD,IAAM,KAAK,GAAG,MAAA,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,mCAAI,CAAC,CAAC;wBAExC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;wBAEhC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;4BACd,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,wBAAO,KAAK,KAAE,GAAG,EAAE,UAAG,KAAK,CAAC,GAAG,cAAI,KAAK,CAAE,IAAG,CAAC;wBAC/E,CAAC;oBACH,CAAC;oBAED,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAC1C,CAAC;gBAED,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,IAAA,eAAO,EAAC,cAAM,OAAA,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,EAAX,CAAW,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AA/DW,QAAA,wBAAwB,4BA+DnC"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* One element, handed to several refs: the component's own (`targetRef`, to read) and those it is given
|
|
4
|
+
* (a forwarded ref, a ref of its parent's).
|
|
5
|
+
*
|
|
6
|
+
* `setRef` is the ref the element is drawn with. React calls it in the commit that attaches the element, so
|
|
7
|
+
* every ref has the element before the browser paints it. They used to be handed it in an effect, after the
|
|
8
|
+
* paint: a popover drawn around a button learnt of the button only then, and armed its click listener in
|
|
9
|
+
* the render after that - a click that landed on the button as soon as it was drawn opened nothing, and
|
|
10
|
+
* nothing on the page said when it would (qorus#646: the Qorus IDE's template selector kept a sleep for it).
|
|
11
|
+
* The effect also ran after every render, since the list of refs is new each time.
|
|
12
|
+
*
|
|
13
|
+
* A component that draws the element through a ref callback of its own calls `setRef` from it.
|
|
14
|
+
*
|
|
15
|
+
* @param refs - The refs to hand the element to, besides `targetRef`.
|
|
16
|
+
* @returns `targetRef`, holding the element, and `setRef`, the ref to draw it with.
|
|
7
17
|
*/
|
|
8
|
-
export declare function useCombinedRefs<T = any>(...refs:
|
|
9
|
-
_innerRef: any;
|
|
18
|
+
export declare function useCombinedRefs<T = any>(...refs: Array<React.Ref<T> | undefined | null>): {
|
|
10
19
|
targetRef: React.MutableRefObject<T>;
|
|
20
|
+
setRef: (node: T | null) => void;
|
|
11
21
|
};
|
|
12
22
|
//# sourceMappingURL=useCombinedRefs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCombinedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useCombinedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useCombinedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useCombinedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;;mBAI7E,CAAC,GAAG,IAAI;EAUlB"}
|
|
@@ -1,44 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.useCombinedRefs = useCombinedRefs;
|
|
16
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
+
/** Hands `node` to one ref: a callback is called with it, an object holds it. */
|
|
9
|
+
var assignRef = function (ref, node) {
|
|
10
|
+
if (!ref) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (typeof ref === 'function') {
|
|
14
|
+
ref(node);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
ref.current = node;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* One element, handed to several refs: the component's own (`targetRef`, to read) and those it is given
|
|
22
|
+
* (a forwarded ref, a ref of its parent's).
|
|
23
|
+
*
|
|
24
|
+
* `setRef` is the ref the element is drawn with. React calls it in the commit that attaches the element, so
|
|
25
|
+
* every ref has the element before the browser paints it. They used to be handed it in an effect, after the
|
|
26
|
+
* paint: a popover drawn around a button learnt of the button only then, and armed its click listener in
|
|
27
|
+
* the render after that - a click that landed on the button as soon as it was drawn opened nothing, and
|
|
28
|
+
* nothing on the page said when it would (qorus#646: the Qorus IDE's template selector kept a sleep for it).
|
|
29
|
+
* The effect also ran after every render, since the list of refs is new each time.
|
|
30
|
+
*
|
|
31
|
+
* A component that draws the element through a ref callback of its own calls `setRef` from it.
|
|
32
|
+
*
|
|
33
|
+
* @param refs - The refs to hand the element to, besides `targetRef`.
|
|
34
|
+
* @returns `targetRef`, holding the element, and `setRef`, the ref to draw it with.
|
|
22
35
|
*/
|
|
23
36
|
function useCombinedRefs() {
|
|
24
37
|
var refs = [];
|
|
25
38
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
26
39
|
refs[_i] = arguments[_i];
|
|
27
40
|
}
|
|
28
|
-
var _a = react_1.default.useState(null), _innerRef = _a[0], setInnerRef = _a[1];
|
|
29
41
|
var targetRef = react_1.default.useRef();
|
|
30
|
-
react_1.default.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
ref.current = targetRef.current;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}, [refs]);
|
|
42
|
-
return { _innerRef: _innerRef, targetRef: targetRef };
|
|
42
|
+
var setRef = react_1.default.useCallback(function (node) {
|
|
43
|
+
targetRef.current = node !== null && node !== void 0 ? node : undefined;
|
|
44
|
+
refs.forEach(function (ref) { return assignRef(ref, node); });
|
|
45
|
+
},
|
|
46
|
+
// A new ref given is handed the element the way React hands it to a new ref callback: this callback
|
|
47
|
+
// changes with it, so React calls the old one with null and this one with the element.
|
|
48
|
+
refs);
|
|
49
|
+
return { targetRef: targetRef, setRef: setRef };
|
|
43
50
|
}
|
|
44
51
|
//# sourceMappingURL=useCombinedRefs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCombinedRefs.js","sourceRoot":"","sources":["../../src/hooks/useCombinedRefs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCombinedRefs.js","sourceRoot":"","sources":["../../src/hooks/useCombinedRefs.ts"],"names":[],"mappings":";;;;;AA+BA,0CAcC;AA7CD,gDAA0B;AAE1B,iFAAiF;AACjF,IAAM,SAAS,GAAG,UAAI,GAAoC,EAAE,IAAc;IACxE,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO;IACT,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC;SAAM,CAAC;QACL,GAAwC,CAAC,OAAO,GAAG,IAAI,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,eAAe;IAAU,cAA+C;SAA/C,UAA+C,EAA/C,qBAA+C,EAA/C,IAA+C;QAA/C,yBAA+C;;IACtF,IAAM,SAAS,GAAG,eAAK,CAAC,MAAM,EAAK,CAAC;IAEpC,IAAM,MAAM,GAAG,eAAK,CAAC,WAAW,CAC9B,UAAC,IAAc;QACb,SAAS,CAAC,OAAO,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,EAApB,CAAoB,CAAC,CAAC;IAC9C,CAAC;IACD,oGAAoG;IACpG,uFAAuF;IACvF,IAAI,CACL,CAAC;IAEF,OAAO,EAAE,SAAS,WAAA,EAAE,MAAM,QAAA,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* How far the pointer must travel before a press becomes a drag.
|
|
4
|
+
*
|
|
5
|
+
* Zero would make every click a one-pixel drag and swallow it; too large and the
|
|
6
|
+
* row feels stuck before it moves. Four pixels is the usual hysteresis for
|
|
7
|
+
* distinguishing a click from a drag.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DRAG_TO_SCROLL_THRESHOLD = 4;
|
|
10
|
+
/**
|
|
11
|
+
* Elements a drag must never start on.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately NOT "anything interactive". The surfaces this is built for are made
|
|
14
|
+
* OF interactive things - a rail of clickable KPI tiles, a table header of sort
|
|
15
|
+
* buttons - so excluding buttons would leave nowhere to grab and the feature would
|
|
16
|
+
* do nothing. Their clicks are protected instead by suppressing the click that
|
|
17
|
+
* follows a real drag, which is what makes press-and-release still activate a
|
|
18
|
+
* tile while press-and-pull scrolls past it.
|
|
19
|
+
*
|
|
20
|
+
* What IS excluded is text entry, where a press-and-move already means
|
|
21
|
+
* "select within this value" and there is no other way to ask for it, and anything
|
|
22
|
+
* marked `reqore-no-drag-scroll`: a grab handle of its own (a column's resize handle),
|
|
23
|
+
* where a press-and-move already means something else.
|
|
24
|
+
*/
|
|
25
|
+
export declare const NON_DRAGGABLE = "input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], .reqore-no-drag-scroll";
|
|
26
|
+
export interface IUseDragToScrollOptions {
|
|
27
|
+
/** What scrolls sideways. */
|
|
28
|
+
scrollRef: RefObject<HTMLElement>;
|
|
29
|
+
/**
|
|
30
|
+
* Where the gesture is taken, when that is not the scroller itself: a table's
|
|
31
|
+
* header, which is scrolled with its body but is not a scroller of its own.
|
|
32
|
+
*/
|
|
33
|
+
handleRef?: RefObject<HTMLElement>;
|
|
34
|
+
/** Mouse and pen: press and pull sideways to scroll. */
|
|
35
|
+
mouse?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Touch: a sideways swipe on the handle scrolls the scroller. Only for a handle
|
|
38
|
+
* the browser cannot pan by itself (it does not overflow-scroll); on a real
|
|
39
|
+
* scroller touch already pans natively, and taking it over would replace that.
|
|
40
|
+
* The handle's own CSS must leave sideways panning to the page script
|
|
41
|
+
* (`touch-action: pan-y`), or the browser cancels the pointer before it moves.
|
|
42
|
+
*/
|
|
43
|
+
touch?: boolean;
|
|
44
|
+
/** Set on the handle while a drag is engaged. */
|
|
45
|
+
draggingClass?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Press and pull a sideways-scrolling surface to scroll it.
|
|
49
|
+
*
|
|
50
|
+
* `ReqoreTable`'s (`dragToScroll`, and its header's touch swipes). It binds to the
|
|
51
|
+
* elements themselves, not through handlers spread in render, because a table's body
|
|
52
|
+
* appears after mount and its header scrolls a body that is another element. The other
|
|
53
|
+
* drags in the library - a sheet, a modal, a toast, a tier stack, `ReqoreFadeScroller`'s
|
|
54
|
+
* `dragToScroll` - share `usePointerDrag`; a fix to the gesture belongs in both (a
|
|
55
|
+
* finger's implicit capture, for one).
|
|
56
|
+
*/
|
|
57
|
+
export declare const useDragToScroll: ({ scrollRef, handleRef, mouse, touch, draggingClass, }: IUseDragToScrollOptions) => void;
|
|
58
|
+
//# sourceMappingURL=useDragToScroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDragToScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useDragToScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,wGACyE,CAAC;AAEpG,MAAM,WAAW,uBAAuB;IACtC,6BAA6B;IAC7B,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,wDAM7B,uBAAuB,SA+CzB,CAAC"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDragToScroll = exports.NON_DRAGGABLE = exports.DRAG_TO_SCROLL_THRESHOLD = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* How far the pointer must travel before a press becomes a drag.
|
|
7
|
+
*
|
|
8
|
+
* Zero would make every click a one-pixel drag and swallow it; too large and the
|
|
9
|
+
* row feels stuck before it moves. Four pixels is the usual hysteresis for
|
|
10
|
+
* distinguishing a click from a drag.
|
|
11
|
+
*/
|
|
12
|
+
exports.DRAG_TO_SCROLL_THRESHOLD = 4;
|
|
13
|
+
/**
|
|
14
|
+
* Elements a drag must never start on.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately NOT "anything interactive". The surfaces this is built for are made
|
|
17
|
+
* OF interactive things - a rail of clickable KPI tiles, a table header of sort
|
|
18
|
+
* buttons - so excluding buttons would leave nowhere to grab and the feature would
|
|
19
|
+
* do nothing. Their clicks are protected instead by suppressing the click that
|
|
20
|
+
* follows a real drag, which is what makes press-and-release still activate a
|
|
21
|
+
* tile while press-and-pull scrolls past it.
|
|
22
|
+
*
|
|
23
|
+
* What IS excluded is text entry, where a press-and-move already means
|
|
24
|
+
* "select within this value" and there is no other way to ask for it, and anything
|
|
25
|
+
* marked `reqore-no-drag-scroll`: a grab handle of its own (a column's resize handle),
|
|
26
|
+
* where a press-and-move already means something else.
|
|
27
|
+
*/
|
|
28
|
+
exports.NON_DRAGGABLE = 'input, textarea, select, [contenteditable=""], [contenteditable="true"], .reqore-no-drag-scroll';
|
|
29
|
+
/**
|
|
30
|
+
* Press and pull a sideways-scrolling surface to scroll it.
|
|
31
|
+
*
|
|
32
|
+
* `ReqoreTable`'s (`dragToScroll`, and its header's touch swipes). It binds to the
|
|
33
|
+
* elements themselves, not through handlers spread in render, because a table's body
|
|
34
|
+
* appears after mount and its header scrolls a body that is another element. The other
|
|
35
|
+
* drags in the library - a sheet, a modal, a toast, a tier stack, `ReqoreFadeScroller`'s
|
|
36
|
+
* `dragToScroll` - share `usePointerDrag`; a fix to the gesture belongs in both (a
|
|
37
|
+
* finger's implicit capture, for one).
|
|
38
|
+
*/
|
|
39
|
+
var useDragToScroll = function (_a) {
|
|
40
|
+
var scrollRef = _a.scrollRef, handleRef = _a.handleRef, _b = _a.mouse, mouse = _b === void 0 ? false : _b, _c = _a.touch, touch = _c === void 0 ? false : _c, draggingClass = _a.draggingClass;
|
|
41
|
+
/* What the gesture is bound to. The elements can come and go after the hook
|
|
42
|
+
mounts - a table renders no body until it has rows - so every commit compares
|
|
43
|
+
them with what is bound and rebinds when they changed, instead of binding once
|
|
44
|
+
on mount and silently never seeing a body that appeared later. */
|
|
45
|
+
var bound = (0, react_1.useRef)();
|
|
46
|
+
(0, react_1.useEffect)(function () {
|
|
47
|
+
var _a;
|
|
48
|
+
var scroller = scrollRef.current;
|
|
49
|
+
var handle = handleRef ? handleRef.current : scroller;
|
|
50
|
+
var key = "".concat(mouse, ":").concat(touch, ":").concat(draggingClass !== null && draggingClass !== void 0 ? draggingClass : '');
|
|
51
|
+
if (bound.current &&
|
|
52
|
+
bound.current.scroller === scroller &&
|
|
53
|
+
bound.current.handle === handle &&
|
|
54
|
+
bound.current.key === key) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
(_a = bound.current) === null || _a === void 0 ? void 0 : _a.unbind();
|
|
58
|
+
bound.current = undefined;
|
|
59
|
+
if ((!mouse && !touch) || !scroller || !handle) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
bound.current = {
|
|
63
|
+
scroller: scroller,
|
|
64
|
+
handle: handle,
|
|
65
|
+
key: key,
|
|
66
|
+
unbind: bind(scroller, handle, mouse, touch, draggingClass),
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
// Unbound when the component goes, whatever is bound then.
|
|
70
|
+
(0, react_1.useEffect)(function () { return function () {
|
|
71
|
+
var _a;
|
|
72
|
+
(_a = bound.current) === null || _a === void 0 ? void 0 : _a.unbind();
|
|
73
|
+
bound.current = undefined;
|
|
74
|
+
}; }, []);
|
|
75
|
+
};
|
|
76
|
+
exports.useDragToScroll = useDragToScroll;
|
|
77
|
+
/** Binds the gesture; returns what unbinds it. */
|
|
78
|
+
var bind = function (scroller, handle, mouse, touch, draggingClass) {
|
|
79
|
+
{
|
|
80
|
+
var activePointer_1;
|
|
81
|
+
var startX_1 = 0;
|
|
82
|
+
var startScrollLeft_1 = 0;
|
|
83
|
+
var engaged_1 = false;
|
|
84
|
+
// Set when a drag actually moved the surface, and consumed by the click that
|
|
85
|
+
// the browser fires next. Without it, pulling sideways and letting go on top
|
|
86
|
+
// of a clickable tile ALSO activates that tile.
|
|
87
|
+
var swallowNextClick_1 = false;
|
|
88
|
+
/* The live gesture is tracked on the WINDOW, not on the handle.
|
|
89
|
+
*
|
|
90
|
+
* A pull leaves the handle almost immediately - the edges are where you are
|
|
91
|
+
* pulling TO - and the release can land anywhere, including outside the
|
|
92
|
+
* browser window entirely. Listening on the handle alone meant a release it
|
|
93
|
+
* never saw left `activePointer` set: the next move over it resumed the drag
|
|
94
|
+
* with no button held, and there was no way to let go.
|
|
95
|
+
*
|
|
96
|
+
* Pointer capture alone does not cover this - it is taken only once the drag
|
|
97
|
+
* ENGAGES, and a fast pull can be past the edge before the first qualifying
|
|
98
|
+
* move arrives.
|
|
99
|
+
*
|
|
100
|
+
* Bound per-gesture rather than permanently, so an idle surface adds no global
|
|
101
|
+
* pointermove listener. */
|
|
102
|
+
var stopTracking_1 = function () {
|
|
103
|
+
window.removeEventListener('pointermove', onPointerMove_1);
|
|
104
|
+
window.removeEventListener('pointerup', onPointerEnd_1);
|
|
105
|
+
window.removeEventListener('pointercancel', onPointerEnd_1);
|
|
106
|
+
window.removeEventListener('lostpointercapture', onPointerEnd_1);
|
|
107
|
+
window.removeEventListener('blur', endGesture_1);
|
|
108
|
+
};
|
|
109
|
+
var startTracking_1 = function () {
|
|
110
|
+
window.addEventListener('pointermove', onPointerMove_1);
|
|
111
|
+
window.addEventListener('pointerup', onPointerEnd_1);
|
|
112
|
+
window.addEventListener('pointercancel', onPointerEnd_1);
|
|
113
|
+
window.addEventListener('lostpointercapture', onPointerEnd_1);
|
|
114
|
+
// Alt-tabbing mid-pull: the release happens in another window.
|
|
115
|
+
window.addEventListener('blur', endGesture_1);
|
|
116
|
+
};
|
|
117
|
+
/* Ends the gesture however it got here - a normal release, a release the page
|
|
118
|
+
* never saw, a cancelled pointer, or the window losing focus. Idempotent:
|
|
119
|
+
* `activePointer` is cleared before the capture is released, so the
|
|
120
|
+
* `lostpointercapture` our own release fires re-enters and returns. */
|
|
121
|
+
var endGesture_1 = function () {
|
|
122
|
+
var _a;
|
|
123
|
+
if (activePointer_1 === undefined) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
var pointerId = activePointer_1;
|
|
127
|
+
activePointer_1 = undefined;
|
|
128
|
+
stopTracking_1();
|
|
129
|
+
if ((_a = handle.hasPointerCapture) === null || _a === void 0 ? void 0 : _a.call(handle, pointerId)) {
|
|
130
|
+
handle.releasePointerCapture(pointerId);
|
|
131
|
+
}
|
|
132
|
+
if (engaged_1) {
|
|
133
|
+
engaged_1 = false;
|
|
134
|
+
if (draggingClass) {
|
|
135
|
+
handle.classList.remove(draggingClass);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var onPointerEnd_1 = function (event) {
|
|
140
|
+
if (activePointer_1 === undefined || event.pointerId !== activePointer_1) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
/* Only the capture THIS gesture took ends it. A finger's pointer is captured by
|
|
144
|
+
the element it lands on (implicit touch capture); taking the capture for the
|
|
145
|
+
handle moves it away from that element, which then reports losing it - and
|
|
146
|
+
that is the drag starting, not ending. Ending there stopped a swipe on a
|
|
147
|
+
table's header after its first few pixels. */
|
|
148
|
+
if (event.type === 'lostpointercapture' && event.target !== handle) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
endGesture_1();
|
|
152
|
+
};
|
|
153
|
+
var onPointerMove_1 = function (event) {
|
|
154
|
+
if (activePointer_1 === undefined || event.pointerId !== activePointer_1) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
/* Nothing is held down, so the button came up somewhere this page could
|
|
158
|
+
* never observe it - off the edge of the window, the usual way. Recover on
|
|
159
|
+
* the first move back rather than wait for a pointerup that is never coming;
|
|
160
|
+
* `buttons` is a bitmask of what is CURRENTLY pressed, so during a real drag
|
|
161
|
+
* (or a finger on the screen) it can only be non-zero. */
|
|
162
|
+
if (event.buttons === 0) {
|
|
163
|
+
endGesture_1();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
var distance = event.clientX - startX_1;
|
|
167
|
+
if (!engaged_1) {
|
|
168
|
+
// Below the threshold this is still a click, so do nothing at all - not
|
|
169
|
+
// even preventDefault, which would break focus on the target.
|
|
170
|
+
if (Math.abs(distance) < exports.DRAG_TO_SCROLL_THRESHOLD) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
engaged_1 = true;
|
|
174
|
+
swallowNextClick_1 = true;
|
|
175
|
+
if (draggingClass) {
|
|
176
|
+
handle.classList.add(draggingClass);
|
|
177
|
+
}
|
|
178
|
+
// Capture keeps the moves addressed to the handle while the pointer is over
|
|
179
|
+
// other elements. The window listeners are what make the drag survive
|
|
180
|
+
// leaving it; this is what keeps hover states elsewhere quiet.
|
|
181
|
+
try {
|
|
182
|
+
handle.setPointerCapture(event.pointerId);
|
|
183
|
+
}
|
|
184
|
+
catch (_a) {
|
|
185
|
+
// Capture is a nicety, not the mechanism.
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Stops the browser starting a native text/image drag mid-pull.
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
scroller.scrollLeft = startScrollLeft_1 - distance;
|
|
191
|
+
};
|
|
192
|
+
var onPointerDown_1 = function (event) {
|
|
193
|
+
var _a, _b;
|
|
194
|
+
/* Before any guard. A previous gesture whose click never arrived - released
|
|
195
|
+
* off-window, so nothing followed it - leaves this armed, and the next
|
|
196
|
+
* genuine click would be eaten. A fresh press always makes the previous
|
|
197
|
+
* gesture's click moot, INCLUDING a press this handler goes on to decline. */
|
|
198
|
+
swallowNextClick_1 = false;
|
|
199
|
+
if (event.pointerType === 'touch') {
|
|
200
|
+
// A real scroller pans natively under a finger, and long-press selects.
|
|
201
|
+
if (!touch) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
if (!mouse) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
// Middle/right are paste and context menu.
|
|
210
|
+
if (event.button !== 0) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
// Shift is the documented escape hatch to "select instead of drag".
|
|
214
|
+
if (event.shiftKey) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if ((_b = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest) === null || _b === void 0 ? void 0 : _b.call(_a, exports.NON_DRAGGABLE)) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
// Nothing to scroll: leave the press alone entirely so a click on a surface
|
|
222
|
+
// that happens to fit behaves exactly as it did before.
|
|
223
|
+
if (scroller.scrollWidth <= scroller.clientWidth) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
activePointer_1 = event.pointerId;
|
|
227
|
+
startX_1 = event.clientX;
|
|
228
|
+
startScrollLeft_1 = scroller.scrollLeft;
|
|
229
|
+
engaged_1 = false;
|
|
230
|
+
startTracking_1();
|
|
231
|
+
};
|
|
232
|
+
var onClickCapture_1 = function (event) {
|
|
233
|
+
if (!swallowNextClick_1) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
swallowNextClick_1 = false;
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
event.stopPropagation();
|
|
239
|
+
};
|
|
240
|
+
// A native drag beats pointer events to the punch on links and images.
|
|
241
|
+
var onDragStart_1 = function (event) {
|
|
242
|
+
if (engaged_1) {
|
|
243
|
+
event.preventDefault();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
handle.addEventListener('pointerdown', onPointerDown_1);
|
|
247
|
+
handle.addEventListener('dragstart', onDragStart_1);
|
|
248
|
+
// Capture phase: the click has to be stopped before it reaches the tile.
|
|
249
|
+
handle.addEventListener('click', onClickCapture_1, true);
|
|
250
|
+
return function () {
|
|
251
|
+
handle.removeEventListener('pointerdown', onPointerDown_1);
|
|
252
|
+
handle.removeEventListener('dragstart', onDragStart_1);
|
|
253
|
+
handle.removeEventListener('click', onClickCapture_1, true);
|
|
254
|
+
// A gesture live at unmount would otherwise leave window listeners behind.
|
|
255
|
+
stopTracking_1();
|
|
256
|
+
if (draggingClass) {
|
|
257
|
+
handle.classList.remove(draggingClass);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
//# sourceMappingURL=useDragToScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDragToScroll.js","sourceRoot":"","sources":["../../src/hooks/useDragToScroll.ts"],"names":[],"mappings":";;;AAAA,+BAAqD;AAErD;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACU,QAAA,aAAa,GACxB,iGAAiG,CAAC;AAwBpG;;;;;;;;;GASG;AACI,IAAM,eAAe,GAAG,UAAC,EAMN;QALxB,SAAS,eAAA,EACT,SAAS,eAAA,EACT,aAAa,EAAb,KAAK,mBAAG,KAAK,KAAA,EACb,aAAa,EAAb,KAAK,mBAAG,KAAK,KAAA,EACb,aAAa,mBAAA;IAEb;;;wEAGoE;IACpE,IAAM,KAAK,GAAG,IAAA,cAAM,GAKhB,CAAC;IAEL,IAAA,iBAAS,EAAC;;QACR,IAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC;QACnC,IAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;QACxD,IAAM,GAAG,GAAG,UAAG,KAAK,cAAI,KAAK,cAAI,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAE,CAAC;QAEvD,IACE,KAAK,CAAC,OA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AC,CAAC;QAEF,uEAAuE;QACvE,IAAM,aAAW,GAAG,UAAC,KAAgB;YACnC,IAAI,SAAO,EAAE,CAAC;gBACZ,KAAK,CAAC,cAAc,EAAE,CAAC;YACzB,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,eAAa,CAAC,CAAC;QACtD,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAW,CAAC,CAAC;QAClD,yEAAyE;QACzE,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAc,EAAE,IAAI,CAAC,CAAC;QAEvD,OAAO;YACL,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,eAAa,CAAC,CAAC;YACzD,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,aAAW,CAAC,CAAC;YACrD,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAc,EAAE,IAAI,CAAC,CAAC;YAC1D,2EAA2E;YAC3E,cAAY,EAAE,CAAC;YACf,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YACzC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMarqueeOnHover.d.ts","sourceRoot":"","sources":["../../src/hooks/useMarqueeOnHover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMarqueeOnHover.d.ts","sourceRoot":"","sources":["../../src/hooks/useMarqueeOnHover.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,qBAAqB,CAK5D,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,sBAAsB;;CAA8C,CAAC;AAElF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;CAA6C,CAAC;AAC9E,eAAO,MAAM,mBAAmB;;CAA6C,CAAC;AAE9E,yFAAyF;AACzF,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AASnE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,YAAY,OAAO,EAAE,YAAY,OAAO,KAAG,MAKnE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM,KAAG,MAa3C,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,WAAW,GAAG,IAAI,KAAG,WAAW,GAAG,IA8B/E,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,WAAW,GAAG,IAAI,KAAG,WAAW,EAmB1E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,WAAW,GAAG,WAAW,EAAE,EACrC,SAAS,QAAQ,CAAC,qBAAqB,CAAC,KACvC,CAAC,MAAM,IAAI,CA+Fb,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,EAAE,UAAU,qBAAqB,KAAG,IA8FrF,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMarqueeOnHover = exports.startMarquee = exports.findMarqueeTargets = exports.findTruncatedElement = exports.marqueeProgress = exports.edgeMask = exports.MARQUEE_STATE_ATTRIBUTE = exports.REQORE_MARQUEE_TEXT = exports.REQORE_MARQUEE_HOST = exports.REQORE_MARQUEE_OPT_OUT = exports.MARQUEE_DEFAULTS = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
+
var hoveringPointer_1 = require("../helpers/hoveringPointer");
|
|
5
6
|
exports.MARQUEE_DEFAULTS = {
|
|
6
7
|
delay: 450,
|
|
7
8
|
speed: 40,
|
|
@@ -238,8 +239,16 @@ var useMarqueeOnHover = function (enabled, options) {
|
|
|
238
239
|
active === null || active === void 0 ? void 0 : active.stop();
|
|
239
240
|
active = null;
|
|
240
241
|
};
|
|
242
|
+
/* A hover scrolls a box: a mouse's, not a finger's tap - after which the browser emulates a `mouseover`
|
|
243
|
+
of its own, and the tapped box scrolled until the next tap elsewhere (on a touch laptop: `enabled` asks
|
|
244
|
+
about the device's primary pointer, this about the pointer that came). See `createHoverGate`. */
|
|
245
|
+
var gate = (0, hoveringPointer_1.createHoverGate)();
|
|
246
|
+
var stopGate = (0, hoveringPointer_1.watchHoverGate)(document, gate);
|
|
241
247
|
var onOver = function (event) {
|
|
242
248
|
var _a;
|
|
249
|
+
if (!gate.isHover()) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
243
252
|
var boxes = (0, exports.findMarqueeTargets)(event.target);
|
|
244
253
|
if (!boxes.length) {
|
|
245
254
|
return;
|
|
@@ -283,6 +292,7 @@ var useMarqueeOnHover = function (enabled, options) {
|
|
|
283
292
|
document.addEventListener('mouseout', onOut, true);
|
|
284
293
|
return function () {
|
|
285
294
|
stopActive();
|
|
295
|
+
stopGate();
|
|
286
296
|
document.removeEventListener('mouseover', onOver, true);
|
|
287
297
|
document.removeEventListener('mouseout', onOut, true);
|
|
288
298
|
};
|