@tcn/ui 0.2.0 → 0.3.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/dist/divider.module-FptFV0PX.js +5 -0
- package/dist/divider.module-FptFV0PX.js.map +1 -0
- package/dist/form/field/field.js +1 -1
- package/dist/frame.css +1 -0
- package/dist/inputs/color_input/color_input.js +1 -1
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/color_input/color_picker.js +1 -1
- package/dist/inputs/combo_box/combo_box.js +1 -1
- package/dist/inputs/date_picker/date_picker.js +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +2 -2
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +1 -1
- package/dist/inputs/mask_input/key_capture_input.js +1 -1
- package/dist/inputs/mask_input/mask_input.js +1 -1
- package/dist/inputs/multiselect/multiselect.js +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +1 -1
- package/dist/inputs/select/select.js +1 -1
- package/dist/inputs/slider/slider.js +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +2 -2
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/switch/switch.js +1 -1
- package/dist/inputs/unit_input/unit_input.js +1 -1
- package/dist/layouts/divider/divider.js +24 -23
- package/dist/layouts/divider/divider.js.map +1 -1
- package/dist/layouts/index.d.ts +6 -5
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +28 -26
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/scaffold/scaffold.d.ts +9 -0
- package/dist/layouts/scaffold/scaffold.d.ts.map +1 -0
- package/dist/layouts/scaffold/scaffold.js +55 -0
- package/dist/layouts/scaffold/scaffold.js.map +1 -0
- package/dist/modal.css +1 -1
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +22 -5
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/overlay/index.d.ts +9 -2
- package/dist/overlay/index.d.ts.map +1 -1
- package/dist/overlay/index.js +22 -10
- package/dist/overlay/index.js.map +1 -1
- package/dist/overlay/menu/menu.d.ts +1 -1
- package/dist/overlay/menu/menu.d.ts.map +1 -1
- package/dist/overlay/menu/menu.js +2 -2
- package/dist/overlay/menu/menu.js.map +1 -1
- package/dist/overlay/popper/base/base_popper.d.ts +11 -0
- package/dist/overlay/popper/base/base_popper.d.ts.map +1 -0
- package/dist/overlay/popper/base/base_popper.js +27 -0
- package/dist/overlay/popper/base/base_popper.js.map +1 -0
- package/dist/overlay/popper/base/dismissal_decorator.d.ts +16 -0
- package/dist/overlay/popper/base/dismissal_decorator.d.ts.map +1 -0
- package/dist/overlay/popper/base/dismissal_decorator.js +69 -0
- package/dist/overlay/popper/base/dismissal_decorator.js.map +1 -0
- package/dist/overlay/popper/context_popper.d.ts +11 -0
- package/dist/overlay/popper/context_popper.d.ts.map +1 -0
- package/dist/overlay/popper/context_popper.js +33 -0
- package/dist/overlay/popper/context_popper.js.map +1 -0
- package/dist/overlay/popper/element_popper.d.ts +7 -0
- package/dist/overlay/popper/element_popper.d.ts.map +1 -0
- package/dist/overlay/popper/element_popper.js +33 -0
- package/dist/overlay/popper/element_popper.js.map +1 -0
- package/dist/overlay/popper/hooks/use_context_trigger.d.ts +7 -0
- package/dist/overlay/popper/hooks/use_context_trigger.d.ts.map +1 -0
- package/dist/overlay/popper/hooks/use_context_trigger.js +31 -0
- package/dist/overlay/popper/hooks/use_context_trigger.js.map +1 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.d.ts +6 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.d.ts.map +1 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.js +17 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.js.map +1 -0
- package/dist/overlay/popper/hooks/use_restore_focus.d.ts +2 -0
- package/dist/overlay/popper/hooks/use_restore_focus.d.ts.map +1 -0
- package/dist/overlay/popper/hooks/use_restore_focus.js +18 -0
- package/dist/overlay/popper/hooks/use_restore_focus.js.map +1 -0
- package/dist/overlay/popper/legacy/popper.d.ts.map +1 -0
- package/dist/overlay/popper/{popper.js → legacy/popper.js} +6 -6
- package/dist/overlay/popper/legacy/popper.js.map +1 -0
- package/dist/overlay/popper/preview_popper.d.ts +7 -0
- package/dist/overlay/popper/preview_popper.d.ts.map +1 -0
- package/dist/overlay/popper/preview_popper.js +46 -0
- package/dist/overlay/popper/preview_popper.js.map +1 -0
- package/dist/overlay/tethered/element_tethered.d.ts +8 -0
- package/dist/overlay/tethered/element_tethered.d.ts.map +1 -0
- package/dist/overlay/tethered/element_tethered.js +33 -0
- package/dist/overlay/tethered/element_tethered.js.map +1 -0
- package/dist/overlay/tethered/hooks/calculate_position.d.ts +19 -0
- package/dist/overlay/tethered/hooks/calculate_position.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/calculate_position.js +43 -0
- package/dist/overlay/tethered/hooks/calculate_position.js.map +1 -0
- package/dist/overlay/tethered/hooks/useTether.d.ts +19 -0
- package/dist/overlay/tethered/hooks/useTether.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/useTether.js +61 -0
- package/dist/overlay/tethered/hooks/useTether.js.map +1 -0
- package/dist/overlay/tethered/tethered.d.ts +20 -0
- package/dist/overlay/tethered/tethered.d.ts.map +1 -0
- package/dist/overlay/tethered/tethered.js +59 -0
- package/dist/overlay/tethered/tethered.js.map +1 -0
- package/dist/overlay/tethered/types.d.ts +3 -0
- package/dist/overlay/tethered/types.d.ts.map +1 -0
- package/dist/overlay/tethered/types.js +2 -0
- package/dist/overlay/tethered/types.js.map +1 -0
- package/dist/popper.css +1 -1
- package/dist/scaffold.css +1 -0
- package/dist/stacks/box/box.js +1 -1
- package/dist/stacks/h_collapsible_box.js +1 -1
- package/dist/stacks/v_collapsible_box.js +1 -1
- package/dist/surfaces/card/card.d.ts +2 -2
- package/dist/surfaces/card/card.d.ts.map +1 -1
- package/dist/surfaces/card/card.js +7 -7
- package/dist/surfaces/card/card.js.map +1 -1
- package/dist/surfaces/index.d.ts +2 -0
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +22 -18
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/modal/modal.d.ts +3 -3
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +14 -14
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/panel/h_panel.js +23 -24
- package/dist/surfaces/panel/h_panel.js.map +1 -1
- package/dist/surfaces/panel/v_panel.d.ts +3 -7
- package/dist/surfaces/panel/v_panel.d.ts.map +1 -1
- package/dist/surfaces/panel/v_panel.js +12 -54
- package/dist/surfaces/panel/v_panel.js.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.d.ts +5 -0
- package/dist/surfaces/pop_confirm/pop_confirm.d.ts.map +1 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js +37 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -0
- package/dist/surfaces/popconfirm/pop_confirm.d.ts +5 -0
- package/dist/surfaces/popconfirm/pop_confirm.d.ts.map +1 -0
- package/dist/surfaces/popconfirm/pop_confirm.js +13 -0
- package/dist/surfaces/popconfirm/pop_confirm.js.map +1 -0
- package/dist/surfaces/popover/popover.d.ts +1 -1
- package/dist/surfaces/popover/popover.d.ts.map +1 -1
- package/dist/surfaces/popover/popover.js +1 -1
- package/dist/surfaces/popover/popover.js.map +1 -1
- package/dist/surfaces/tooltip/tooltip.d.ts +10 -0
- package/dist/surfaces/tooltip/tooltip.d.ts.map +1 -0
- package/dist/surfaces/tooltip/tooltip.js +38 -0
- package/dist/surfaces/tooltip/tooltip.js.map +1 -0
- package/dist/surfaces/window/window.d.ts +3 -3
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +16 -14
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/tethered.css +1 -0
- package/dist/themes/themes/ergo/ergo_theme.js +144 -205
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/utility_bar.css +1 -1
- package/dist/utils/click_away_listener.d.ts +1 -0
- package/dist/utils/click_away_listener.d.ts.map +1 -1
- package/dist/utils/click_away_listener.js +2 -1
- package/dist/utils/click_away_listener.js.map +1 -1
- package/dist/utils/index.d.ts +6 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +26 -23
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mouse_leave_region.d.ts +8 -0
- package/dist/utils/mouse_leave_region.d.ts.map +1 -0
- package/dist/utils/mouse_leave_region.js +26 -0
- package/dist/utils/mouse_leave_region.js.map +1 -0
- package/dist/utils/types/dimensions.d.ts +11 -1
- package/dist/utils/types/dimensions.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/inputs/color_input/color_input.tsx +1 -1
- package/src/inputs/date_picker/date_picker_input.tsx +1 -1
- package/src/inputs/date_picker/date_picker_year_input.tsx +1 -1
- package/src/inputs/suggestions/suggestion_list.tsx +1 -1
- package/src/layouts/index.ts +7 -5
- package/src/layouts/scaffold/scaffold.module.css +5 -0
- package/src/layouts/scaffold/scaffold.tsx +60 -0
- package/src/layouts/utility_bar/utility_bar.module.css +0 -3
- package/src/overlay/frame/frame.module.css +5 -0
- package/src/overlay/frame/frame.stories.tsx +1 -1
- package/src/overlay/frame/frame.tsx +19 -3
- package/src/overlay/index.ts +29 -2
- package/src/overlay/menu/menu.tsx +1 -1
- package/src/overlay/popper/__stories__/base_args.ts +75 -0
- package/src/overlay/popper/__stories__/context_popper.stories.tsx +77 -0
- package/src/overlay/popper/__stories__/element_popper.stories.tsx +80 -0
- package/src/overlay/popper/__stories__/preview_popper.stories.tsx +73 -0
- package/src/overlay/popper/base/base_popper.tsx +55 -0
- package/src/overlay/popper/base/dismissal_decorator.tsx +80 -0
- package/src/overlay/popper/context_popper.tsx +43 -0
- package/src/overlay/popper/element_popper.tsx +42 -0
- package/src/overlay/popper/hooks/use_context_trigger.ts +50 -0
- package/src/overlay/popper/hooks/use_hover_trigger.ts +24 -0
- package/src/overlay/popper/hooks/use_restore_focus.ts +16 -0
- package/src/overlay/popper/{popper.stories.tsx → legacy/popper.stories.tsx} +11 -5
- package/src/overlay/popper/{popper.tsx → legacy/popper.tsx} +3 -2
- package/src/overlay/popper/preview_popper.tsx +54 -0
- package/src/overlay/tethered/__stories__/element/element_tethered.stories.tsx +57 -0
- package/src/overlay/tethered/__stories__/element/element_tethered_stories.module.css +14 -0
- package/src/overlay/tethered/__stories__/shared/base_story_config.ts +52 -0
- package/src/overlay/tethered/__stories__/shared/components/sb_point.module.css +20 -0
- package/src/overlay/tethered/__stories__/shared/components/sb_point.tsx +34 -0
- package/src/overlay/tethered/__stories__/shared/components/sb_reference_points.tsx +54 -0
- package/src/overlay/tethered/__stories__/tethered/tethered.stories.tsx +90 -0
- package/src/overlay/tethered/__stories__/tethered/tethered_stories.module.css +25 -0
- package/src/overlay/tethered/element_tethered.tsx +62 -0
- package/src/overlay/tethered/hooks/calculate_position.ts +110 -0
- package/src/overlay/tethered/hooks/useTether.ts +85 -0
- package/src/overlay/tethered/tethered.module.css +8 -0
- package/src/overlay/tethered/tethered.tsx +72 -0
- package/src/overlay/tethered/types.ts +2 -0
- package/src/stacks/h_stack.stories.tsx +2 -2
- package/src/stacks/v_stack.stories.tsx +2 -2
- package/src/surfaces/card/card.stories.tsx +64 -0
- package/src/surfaces/card/card.tsx +4 -4
- package/src/surfaces/card/card_stories.module.css +13 -0
- package/src/surfaces/index.ts +2 -0
- package/src/surfaces/modal/__stories__/modal.stories.tsx +12 -1
- package/src/surfaces/modal/modal.module.css +2 -2
- package/src/surfaces/modal/modal.tsx +14 -12
- package/src/surfaces/panel/__stories__/panel.stories.tsx +1 -1
- package/src/surfaces/panel/v_panel.tsx +8 -53
- package/src/surfaces/pop_confirm/pop_confirm.stories.tsx +70 -0
- package/src/surfaces/pop_confirm/pop_confirm.tsx +30 -0
- package/src/surfaces/popconfirm/pop_confirm.tsx +18 -0
- package/src/surfaces/popover/popover.tsx +1 -1
- package/src/surfaces/tooltip/tooltip.stories.tsx +54 -0
- package/src/surfaces/tooltip/tooltip.tsx +59 -0
- package/src/surfaces/window/window.stories.tsx +15 -1
- package/src/surfaces/window/window.tsx +16 -12
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.tsx +7 -9
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +2 -6
- package/src/themes/themes/ergo/__stories__/sb_materials.module.css +29 -21
- package/src/themes/themes/ergo/ergo_theme.css +144 -205
- package/src/utils/click_away_listener.tsx +1 -1
- package/src/utils/index.ts +7 -5
- package/src/utils/mouse_leave_region.tsx +38 -0
- package/src/utils/types/dimensions.ts +13 -1
- package/tsconfig.json +3 -0
- package/dist/overlay/popper/popper.d.ts.map +0 -1
- package/dist/overlay/popper/popper.js.map +0 -1
- package/dist/overlay/tooltip/tooltip.d.ts +0 -7
- package/dist/overlay/tooltip/tooltip.d.ts.map +0 -1
- package/dist/overlay/tooltip/tooltip.js +0 -20
- package/dist/overlay/tooltip/tooltip.js.map +0 -1
- package/dist/panel.module-DwGKncon.js +0 -5
- package/dist/panel.module-DwGKncon.js.map +0 -1
- package/src/overlay/tooltip/tooltip.stories.tsx +0 -22
- package/src/overlay/tooltip/tooltip.tsx +0 -24
- /package/dist/{panel.css → h_panel.css} +0 -0
- /package/dist/overlay/popper/{popper.d.ts → legacy/popper.d.ts} +0 -0
- /package/src/overlay/popper/{popper.module.css → legacy/popper.module.css} +0 -0
- /package/src/{overlay → surfaces}/tooltip/tooltip.module.css +0 -0
|
@@ -7,5 +7,6 @@ export interface ClickAwayListenerProps {
|
|
|
7
7
|
isException?: (target: HTMLElement) => boolean;
|
|
8
8
|
refs?: React.RefObject<Element>[];
|
|
9
9
|
}
|
|
10
|
+
export declare function isEventWithinElement(event: MouseEvent | TouchEvent, node: HTMLElement | null, activated: boolean, refs: (Element | null)[]): boolean;
|
|
10
11
|
export declare const ClickAwayListener: React.ForwardRefExoticComponent<ClickAwayListenerProps & React.RefAttributes<HTMLElement>>;
|
|
11
12
|
//# sourceMappingURL=click_away_listener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click_away_listener.d.ts","sourceRoot":"","sources":["../../src/utils/click_away_listener.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAClE,UAAU,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;IACrD,UAAU,CAAC,EAAE,cAAc,GAAG,YAAY,CAAC;IAC3C,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC;IAE/C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACnC;
|
|
1
|
+
{"version":3,"file":"click_away_listener.d.ts","sourceRoot":"","sources":["../../src/utils/click_away_listener.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAClE,UAAU,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;IACrD,UAAU,CAAC,EAAE,cAAc,GAAG,YAAY,CAAC;IAC3C,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC;IAE/C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;CACnC;AAWD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,GAAG,UAAU,EAC9B,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,SAAS,EAAE,OAAO,EAClB,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,WAsBzB;AAED,eAAO,MAAM,iBAAiB,4FA0E7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click_away_listener.js","sources":["../../src/utils/click_away_listener.tsx"],"sourcesContent":["import React, { useEffect, useCallback, useRef } from 'react';\nimport { useForkRef } from './hooks/use_fork_ref.js';\nexport interface ClickAwayListenerProps {\n children: React.ReactElement;\n onClickAway: (event: React.MouseEvent | React.TouchEvent) => void;\n mouseEvent?: 'onMouseUp' | 'onMouseDown' | 'onClick';\n touchEvent?: 'onTouchStart' | 'onTouchEnd';\n isException?: (target: HTMLElement) => boolean;\n // An array of refs that wont trigger the click away listener\n refs?: React.RefObject<Element>[];\n}\nconst eventMap = {\n onClick: 'click',\n onMouseDown: 'mousedown',\n onMouseUp: 'mouseup',\n};\nconst touchMap = {\n onTouchStart: 'touchstart',\n onTouchEnd: 'touchend',\n};\n\
|
|
1
|
+
{"version":3,"file":"click_away_listener.js","sources":["../../src/utils/click_away_listener.tsx"],"sourcesContent":["import React, { useEffect, useCallback, useRef } from 'react';\nimport { useForkRef } from './hooks/use_fork_ref.js';\nexport interface ClickAwayListenerProps {\n children: React.ReactElement;\n onClickAway: (event: React.MouseEvent | React.TouchEvent) => void;\n mouseEvent?: 'onMouseUp' | 'onMouseDown' | 'onClick';\n touchEvent?: 'onTouchStart' | 'onTouchEnd';\n isException?: (target: HTMLElement) => boolean;\n // An array of refs that wont trigger the click away listener\n refs?: React.RefObject<Element>[];\n}\nconst eventMap = {\n onClick: 'click',\n onMouseDown: 'mousedown',\n onMouseUp: 'mouseup',\n};\nconst touchMap = {\n onTouchStart: 'touchstart',\n onTouchEnd: 'touchend',\n};\n\nexport function isEventWithinElement(\n event: MouseEvent | TouchEvent,\n node: HTMLElement | null,\n activated: boolean,\n refs: (Element | null)[]\n) {\n if (!activated) {\n return true;\n }\n\n let isWithinElement: boolean;\n\n if (event.composedPath) {\n isWithinElement =\n [node, ...refs].find((ref: any) => {\n return event.composedPath().indexOf(ref) > -1;\n }) !== undefined;\n } else {\n isWithinElement =\n !document.documentElement.contains(event.target as any) ||\n [node, ...refs].find((ref: any) => {\n return ref?.contains(event.target);\n }) !== undefined;\n }\n\n return isWithinElement;\n}\n\nexport const ClickAwayListener = React.forwardRef<HTMLElement, ClickAwayListenerProps>(\n function ClickAwayListener(\n { children, mouseEvent, touchEvent, onClickAway, refs = [], isException },\n ref\n ) {\n const nodeRef = useRef<HTMLElement | null>(null);\n const startedActionWithinElementRef = useRef<boolean>(true);\n const DOMMouseEvent = eventMap[mouseEvent || 'onClick'];\n const DOMTouchEvent = touchMap[touchEvent || 'onTouchEnd'];\n const newRef = useForkRef(ref, nodeRef, (children as any).ref);\n const activatedRef = React.useRef(false);\n\n React.useEffect(() => {\n // Ensure that this component is not \"activated\" synchronously.\n // https://github.com/facebook/react/issues/20074\n window.setTimeout(() => {\n activatedRef.current = true;\n }, 0);\n return () => {\n activatedRef.current = false;\n };\n }, []);\n\n const trackAction = useCallback(\n (event: any) => {\n startedActionWithinElementRef.current = isEventWithinElement(\n event,\n nodeRef.current,\n activatedRef.current,\n refs.map(r => r.current)\n );\n },\n [refs]\n );\n\n const eventHandler = useCallback(\n (event: any) => {\n const startedFromWithinElement = startedActionWithinElementRef.current;\n const isWithinElement = isEventWithinElement(\n event,\n nodeRef.current,\n activatedRef.current,\n refs.map(r => r.current)\n );\n\n if (\n !isWithinElement &&\n !startedFromWithinElement &&\n (!isException || !isException(event.target))\n ) {\n onClickAway(event);\n }\n },\n [onClickAway, refs, isException]\n );\n\n useEffect(() => {\n document.addEventListener('mousedown', trackAction);\n document.addEventListener('touchstart', trackAction);\n document.addEventListener(DOMMouseEvent, eventHandler);\n document.addEventListener(DOMTouchEvent, eventHandler);\n return () => {\n document.removeEventListener('mousedown', trackAction);\n document.removeEventListener('touchstart', trackAction);\n document.removeEventListener(DOMMouseEvent, eventHandler);\n document.removeEventListener(DOMTouchEvent, eventHandler);\n };\n }, [DOMTouchEvent, DOMMouseEvent, eventHandler, trackAction]);\n\n return React.cloneElement(children, {\n ...children.props,\n ref: newRef,\n });\n }\n);\n"],"names":["eventMap","touchMap","isEventWithinElement","event","node","activated","refs","isWithinElement","ref","ClickAwayListener","React","children","mouseEvent","touchEvent","onClickAway","isException","nodeRef","useRef","startedActionWithinElementRef","DOMMouseEvent","DOMTouchEvent","newRef","useForkRef","activatedRef","trackAction","useCallback","r","eventHandler","startedFromWithinElement","useEffect"],"mappings":";;AAWA,MAAMA,IAAW;AAAA,EACf,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AACb,GACMC,IAAW;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AACd;AAEO,SAASC,EACdC,GACAC,GACAC,GACAC,GACA;AACA,MAAI,CAACD;AACH,WAAO;AAGT,MAAIE;AAEJ,SAAIJ,EAAM,eACRI,IACE,CAACH,GAAM,GAAGE,CAAI,EAAE,KAAK,CAACE,MACbL,EAAM,aAAA,EAAe,QAAQK,CAAG,IAAI,EAC5C,MAAM,SAETD,IACE,CAAC,SAAS,gBAAgB,SAASJ,EAAM,MAAa,KACtD,CAACC,GAAM,GAAGE,CAAI,EAAE,KAAK,CAACE,MACbA,GAAK,SAASL,EAAM,MAAM,CAClC,MAAM,QAGJI;AACT;AAEO,MAAME,IAAoBC,EAAM;AAAA,EACrC,SACE,EAAE,UAAAC,GAAU,YAAAC,GAAY,YAAAC,GAAY,aAAAC,GAAa,MAAAR,IAAO,CAAA,GAAI,aAAAS,EAAA,GAC5DP,GACA;AACA,UAAMQ,IAAUC,EAA2B,IAAI,GACzCC,IAAgCD,EAAgB,EAAI,GACpDE,IAAgBnB,EAASY,KAAc,SAAS,GAChDQ,IAAgBnB,EAASY,KAAc,YAAY,GACnDQ,IAASC,EAAWd,GAAKQ,GAAUL,EAAiB,GAAG,GACvDY,IAAeb,EAAM,OAAO,EAAK;AAEvC,IAAAA,EAAM,UAAU,OAGd,OAAO,WAAW,MAAM;AACtB,MAAAa,EAAa,UAAU;AAAA,IACzB,GAAG,CAAC,GACG,MAAM;AACX,MAAAA,EAAa,UAAU;AAAA,IACzB,IACC,CAAA,CAAE;AAEL,UAAMC,IAAcC;AAAA,MAClB,CAACtB,MAAe;AACd,QAAAe,EAA8B,UAAUhB;AAAA,UACtCC;AAAA,UACAa,EAAQ;AAAA,UACRO,EAAa;AAAA,UACbjB,EAAK,IAAI,CAAAoB,MAAKA,EAAE,OAAO;AAAA,QAAA;AAAA,MAE3B;AAAA,MACA,CAACpB,CAAI;AAAA,IAAA,GAGDqB,IAAeF;AAAA,MACnB,CAACtB,MAAe;AACd,cAAMyB,IAA2BV,EAA8B;AAQ/D,QACE,CARsBhB;AAAA,UACtBC;AAAA,UACAa,EAAQ;AAAA,UACRO,EAAa;AAAA,UACbjB,EAAK,IAAI,CAAAoB,MAAKA,EAAE,OAAO;AAAA,QAAA,KAKvB,CAACE,MACA,CAACb,KAAe,CAACA,EAAYZ,EAAM,MAAM,MAE1CW,EAAYX,CAAK;AAAA,MAErB;AAAA,MACA,CAACW,GAAaR,GAAMS,CAAW;AAAA,IAAA;AAGjC,WAAAc,EAAU,OACR,SAAS,iBAAiB,aAAaL,CAAW,GAClD,SAAS,iBAAiB,cAAcA,CAAW,GACnD,SAAS,iBAAiBL,GAAeQ,CAAY,GACrD,SAAS,iBAAiBP,GAAeO,CAAY,GAC9C,MAAM;AACX,eAAS,oBAAoB,aAAaH,CAAW,GACrD,SAAS,oBAAoB,cAAcA,CAAW,GACtD,SAAS,oBAAoBL,GAAeQ,CAAY,GACxD,SAAS,oBAAoBP,GAAeO,CAAY;AAAA,IAC1D,IACC,CAACP,GAAeD,GAAeQ,GAAcH,CAAW,CAAC,GAErDd,EAAM,aAAaC,GAAU;AAAA,MAClC,GAAGA,EAAS;AAAA,MACZ,KAAKU;AAAA,IAAA,CACN;AAAA,EACH;AACF;"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
export * from './focus_redirect.js';
|
|
2
1
|
export * from './click_away_listener.js';
|
|
2
|
+
export * from './focus_redirect.js';
|
|
3
3
|
export * from './scroll_away_listener.js';
|
|
4
|
-
export * from './hooks/make_context_hook.js';
|
|
5
4
|
export * from './dnd/hooks/use_draggable.js';
|
|
5
|
+
export * from './hooks/make_context_hook.js';
|
|
6
6
|
export * from './hooks/use_fork_ref.js';
|
|
7
7
|
export * from './hooks/use_media_query.js';
|
|
8
8
|
export * from './hooks/use_resize_observer.js';
|
|
9
9
|
export * from './default_value.js';
|
|
10
10
|
export * from './calendar/calendar_date.js';
|
|
11
11
|
export * from './calendar/calendar_dates_generator.js';
|
|
12
|
-
export * from './calendar/month.js';
|
|
13
|
-
export * from './calendar/get_months_of_year.js';
|
|
14
12
|
export * from './calendar/get_days_of_week.js';
|
|
15
|
-
export * from './
|
|
13
|
+
export * from './calendar/get_months_of_year.js';
|
|
14
|
+
export * from './calendar/month.js';
|
|
16
15
|
export * from './types/dimensions.js';
|
|
16
|
+
export * from './types/variations.js';
|
|
17
|
+
export * from './responsive/responsive_renderer.js';
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,qCAAqC,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ScrollAwayListener as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ClickAwayListener as o, isEventWithinElement as t } from "./click_away_listener.js";
|
|
2
|
+
import { FocusRedirect as m } from "./focus_redirect.js";
|
|
3
|
+
import { ScrollAwayListener as s } from "./scroll_away_listener.js";
|
|
4
|
+
import { useDraggable as a } from "./dnd/hooks/use_draggable.js";
|
|
5
|
+
import { makeContextHook as i } from "./hooks/make_context_hook.js";
|
|
6
6
|
import { useForkRef as u } from "./hooks/use_fork_ref.js";
|
|
7
|
-
import { useMediaQuery as
|
|
8
|
-
import { TriggerConfig as
|
|
7
|
+
import { useMediaQuery as d } from "./hooks/use_media_query.js";
|
|
8
|
+
import { TriggerConfig as R, useResizeObserver as c } from "./hooks/use_resize_observer.js";
|
|
9
9
|
import { defaultValue as C } from "./default_value.js";
|
|
10
|
-
import { CalendarDatesGenerator as
|
|
11
|
-
import {
|
|
12
|
-
import { getMonthsOfYear as
|
|
13
|
-
import {
|
|
10
|
+
import { CalendarDatesGenerator as v } from "./calendar/calendar_dates_generator.js";
|
|
11
|
+
import { getDaysOfWeek as M } from "./calendar/get_days_of_week.js";
|
|
12
|
+
import { getMonthsOfYear as b } from "./calendar/get_months_of_year.js";
|
|
13
|
+
import { Month as A } from "./calendar/month.js";
|
|
14
|
+
import { ResponsiveRenderer as F } from "./responsive/responsive_renderer.js";
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
v as CalendarDatesGenerator,
|
|
17
|
+
o as ClickAwayListener,
|
|
18
|
+
m as FocusRedirect,
|
|
19
|
+
A as Month,
|
|
20
|
+
F as ResponsiveRenderer,
|
|
21
|
+
s as ScrollAwayListener,
|
|
22
|
+
R as TriggerConfig,
|
|
21
23
|
C as defaultValue,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
i as
|
|
24
|
+
M as getDaysOfWeek,
|
|
25
|
+
b as getMonthsOfYear,
|
|
26
|
+
t as isEventWithinElement,
|
|
27
|
+
i as makeContextHook,
|
|
28
|
+
a as useDraggable,
|
|
26
29
|
u as useForkRef,
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
d as useMediaQuery,
|
|
31
|
+
c as useResizeObserver
|
|
29
32
|
};
|
|
30
33
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MouseLeaveRegionProps {
|
|
3
|
+
elementsRefs: (React.RefObject<Element> | React.MutableRefObject<Element>)[];
|
|
4
|
+
onMouseLeave: () => void;
|
|
5
|
+
buffer?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function MouseLeaveRegion({ onMouseLeave, elementsRefs: elementRefs, buffer, }: MouseLeaveRegionProps): null;
|
|
8
|
+
//# sourceMappingURL=mouse_leave_region.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse_leave_region.d.ts","sourceRoot":"","sources":["../../src/utils/mouse_leave_region.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;IAC7E,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,YAAY,EACZ,YAAY,EAAE,WAAW,EACzB,MAAU,GACX,EAAE,qBAAqB,QAyBvB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect as u } from "react";
|
|
2
|
+
function v({
|
|
3
|
+
onMouseLeave: o,
|
|
4
|
+
elementsRefs: i,
|
|
5
|
+
buffer: t = 8
|
|
6
|
+
}) {
|
|
7
|
+
return u(() => {
|
|
8
|
+
const r = (e) => {
|
|
9
|
+
i.some((c) => {
|
|
10
|
+
const s = c.current;
|
|
11
|
+
if (s != null) {
|
|
12
|
+
const n = s.getBoundingClientRect(), l = Math.max(e.clientX - t, n.left), m = Math.min(e.clientX + t, n.right), a = Math.max(e.clientY - t, n.top), p = Math.min(e.clientY + t, n.bottom);
|
|
13
|
+
return l <= m && a <= p;
|
|
14
|
+
}
|
|
15
|
+
return !1;
|
|
16
|
+
}) || o();
|
|
17
|
+
};
|
|
18
|
+
return window.addEventListener("mousemove", r), () => {
|
|
19
|
+
window.removeEventListener("mousemove", r);
|
|
20
|
+
};
|
|
21
|
+
}, [o, i, t]), null;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
v as MouseLeaveRegion
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=mouse_leave_region.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse_leave_region.js","sources":["../../src/utils/mouse_leave_region.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nexport interface MouseLeaveRegionProps {\n elementsRefs: (React.RefObject<Element> | React.MutableRefObject<Element>)[];\n onMouseLeave: () => void;\n buffer?: number;\n}\n\nexport function MouseLeaveRegion({\n onMouseLeave,\n elementsRefs: elementRefs,\n buffer = 8,\n}: MouseLeaveRegionProps) {\n useEffect(() => {\n const update = (event: MouseEvent) => {\n const intersects = elementRefs.some(ref => {\n const element = ref.current;\n if (element != null) {\n const rect = element.getBoundingClientRect();\n const overlapLeft = Math.max(event.clientX - buffer, rect.left);\n const overlapRight = Math.min(event.clientX + buffer, rect.right);\n const overlapTop = Math.max(event.clientY - buffer, rect.top);\n const overlapBottom = Math.min(event.clientY + buffer, rect.bottom);\n return overlapLeft <= overlapRight && overlapTop <= overlapBottom;\n }\n return false;\n });\n if (!intersects) {\n onMouseLeave();\n }\n };\n window.addEventListener('mousemove', update);\n return () => {\n window.removeEventListener('mousemove', update);\n };\n }, [onMouseLeave, elementRefs, buffer]);\n return null;\n}\n"],"names":["MouseLeaveRegion","onMouseLeave","elementRefs","buffer","useEffect","update","event","ref","element","rect","overlapLeft","overlapRight","overlapTop","overlapBottom"],"mappings":";AAQO,SAASA,EAAiB;AAAA,EAC/B,cAAAC;AAAA,EACA,cAAcC;AAAA,EACd,QAAAC,IAAS;AACX,GAA0B;AACxB,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAS,CAACC,MAAsB;AAapC,MAZmBJ,EAAY,KAAK,CAAAK,MAAO;AACzC,cAAMC,IAAUD,EAAI;AACpB,YAAIC,KAAW,MAAM;AACnB,gBAAMC,IAAOD,EAAQ,sBAAA,GACfE,IAAc,KAAK,IAAIJ,EAAM,UAAUH,GAAQM,EAAK,IAAI,GACxDE,IAAe,KAAK,IAAIL,EAAM,UAAUH,GAAQM,EAAK,KAAK,GAC1DG,IAAa,KAAK,IAAIN,EAAM,UAAUH,GAAQM,EAAK,GAAG,GACtDI,IAAgB,KAAK,IAAIP,EAAM,UAAUH,GAAQM,EAAK,MAAM;AAClE,iBAAOC,KAAeC,KAAgBC,KAAcC;AAAA,QACtD;AACA,eAAO;AAAA,MACT,CAAC,KAECZ,EAAA;AAAA,IAEJ;AACA,kBAAO,iBAAiB,aAAaI,CAAM,GACpC,MAAM;AACX,aAAO,oBAAoB,aAAaA,CAAM;AAAA,IAChD;AAAA,EACF,GAAG,CAACJ,GAAcC,GAAaC,CAAM,CAAC,GAC/B;AACT;"}
|
|
@@ -6,7 +6,17 @@ export interface Dimensions {
|
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface Rectangle {
|
|
10
|
+
dimensions: Dimensions;
|
|
11
|
+
position: Position;
|
|
12
|
+
}
|
|
13
|
+
export interface RectCorners {
|
|
14
|
+
topLeft: Position;
|
|
15
|
+
topRight: Position;
|
|
16
|
+
bottomLeft: Position;
|
|
17
|
+
bottomRight: Position;
|
|
18
|
+
}
|
|
19
|
+
export interface RectEdges {
|
|
10
20
|
top: number;
|
|
11
21
|
right: number;
|
|
12
22
|
bottom: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimensions.d.ts","sourceRoot":"","sources":["../../../src/utils/types/dimensions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"dimensions.d.ts","sourceRoot":"","sources":["../../../src/utils/types/dimensions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,QAAQ,CAAC;IACrB,WAAW,EAAE,QAAQ,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tcn/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "TCN",
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"dependencies": {
|
|
135
135
|
"clsx": "^2.1.1",
|
|
136
136
|
"react-color": "^2.19.3",
|
|
137
|
-
"@tcn/
|
|
138
|
-
"@tcn/
|
|
137
|
+
"@tcn/icons": "2.2.0",
|
|
138
|
+
"@tcn/state": "1.1.0"
|
|
139
139
|
},
|
|
140
140
|
"scripts": {
|
|
141
141
|
"build": "vite build",
|
|
@@ -11,7 +11,7 @@ import { ColorPicker } from './color_picker.js';
|
|
|
11
11
|
import { Input } from '../input/input.js';
|
|
12
12
|
import styles from './color_input.module.css';
|
|
13
13
|
|
|
14
|
-
import { Popper } from '../../overlay/popper/popper.js';
|
|
14
|
+
import { Popper } from '../../overlay/popper/legacy/popper.js';
|
|
15
15
|
|
|
16
16
|
export interface ColorInputProps
|
|
17
17
|
extends Omit<HTMLAttributes<HTMLButtonElement>, 'onChange' | 'onError'> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { Hierarchy } from '../../utils/index.js';
|
|
3
3
|
import { ZStack } from '../../stacks/z_stack.js';
|
|
4
|
-
import { Popper } from '../../overlay/popper/popper.js';
|
|
4
|
+
import { Popper } from '../../overlay/popper/legacy/popper.js';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { HTMLAttributes } from 'react';
|
|
7
7
|
import { Button } from '../../actions/index.js';
|
|
@@ -2,7 +2,7 @@ import { Button } from '../../actions/index.js';
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import styles from './date_picker_year_input.module.css';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import { Popper } from '../../overlay/popper/popper.js';
|
|
5
|
+
import { Popper } from '../../overlay/popper/legacy/popper.js';
|
|
6
6
|
import { DatePickerPresenter } from './date_picker_presenter.js';
|
|
7
7
|
import { DatePickerYearSelector } from './date_picker_year_selector.js';
|
|
8
8
|
import { useSignalValue } from '@tcn/state';
|
|
@@ -10,7 +10,7 @@ import { OptionProps, Option } from '../options/option.js';
|
|
|
10
10
|
import styles from './suggestion_list.module.css';
|
|
11
11
|
|
|
12
12
|
import { Button } from '../../actions/index.js';
|
|
13
|
-
import { Popper } from '../../overlay/popper/popper.js';
|
|
13
|
+
import { Popper } from '../../overlay/popper/legacy/popper.js';
|
|
14
14
|
|
|
15
15
|
const MAX_RESULTS = 50;
|
|
16
16
|
const BATCH_SIZE = 50;
|
package/src/layouts/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
export * from './body/h_body.js';
|
|
2
|
-
export * from './body/v_body.js';
|
|
3
1
|
export * from './column/column.js';
|
|
4
2
|
export * from './divider/divider.js';
|
|
5
|
-
export * from './footer/footer.js';
|
|
6
3
|
export * from './grid/grid.js';
|
|
7
|
-
export * from './header/header.js';
|
|
8
4
|
export * from './list/item.js';
|
|
9
5
|
export * from './list/list.js';
|
|
10
6
|
export * from './list/section_header.js';
|
|
11
7
|
export * from './sidebar_end/sidebar_end.js';
|
|
12
8
|
export * from './sidebar_start/sidebar_start.js';
|
|
13
|
-
|
|
9
|
+
// Scaffold
|
|
10
|
+
export { Scaffold, type ScaffoldProps } from './scaffold/scaffold.js';
|
|
11
|
+
export { HBody, type HBodyProps } from './body/h_body.js';
|
|
12
|
+
export { VBody, type VBodyProps } from './body/v_body.js';
|
|
13
|
+
export { Footer, type FooterProps } from './footer/footer.js';
|
|
14
|
+
export { Header, type HeaderProps } from './header/header.js';
|
|
15
|
+
export { UtilityBar, type UtilityBarProps } from './utility_bar/utility_bar.js';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { Box, type BoxProps } from '../../stacks/box/box.js';
|
|
4
|
+
import type { Alignment } from '../../stacks/types/alignment.js';
|
|
5
|
+
import { VStack } from '../../stacks/v_stack.js';
|
|
6
|
+
// Styles
|
|
7
|
+
import styles from './scaffold.module.css';
|
|
8
|
+
|
|
9
|
+
export interface ScaffoldProps extends Omit<BoxProps, 'as'> {
|
|
10
|
+
vAlign?: Alignment;
|
|
11
|
+
hAlign?: Alignment;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Scaffold = React.forwardRef<HTMLElement, ScaffoldProps>(function Scaffold(
|
|
15
|
+
{
|
|
16
|
+
children,
|
|
17
|
+
width,
|
|
18
|
+
height = '100%',
|
|
19
|
+
minWidth,
|
|
20
|
+
maxWidth,
|
|
21
|
+
minHeight,
|
|
22
|
+
maxHeight,
|
|
23
|
+
hAlign,
|
|
24
|
+
vAlign = 'start',
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: ScaffoldProps,
|
|
28
|
+
ref
|
|
29
|
+
) {
|
|
30
|
+
return (
|
|
31
|
+
<Box
|
|
32
|
+
ref={ref}
|
|
33
|
+
width={width}
|
|
34
|
+
height={height}
|
|
35
|
+
minWidth={minWidth}
|
|
36
|
+
maxWidth={maxWidth}
|
|
37
|
+
minHeight={minHeight}
|
|
38
|
+
maxHeight={maxHeight}
|
|
39
|
+
data-h-alignment={hAlign}
|
|
40
|
+
data-v-alignment={vAlign}
|
|
41
|
+
className={clsx(className, 'tcn-scaffold')}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<VStack
|
|
45
|
+
as="section"
|
|
46
|
+
minWidth={minWidth}
|
|
47
|
+
maxWidth={maxWidth}
|
|
48
|
+
minHeight={minHeight}
|
|
49
|
+
maxHeight={maxHeight}
|
|
50
|
+
hAlign={hAlign}
|
|
51
|
+
vAlign={vAlign}
|
|
52
|
+
ref={ref}
|
|
53
|
+
className={clsx(styles['scaffold-stack'], 'tcn-scaffold-stack')}
|
|
54
|
+
zIndex={0}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</VStack>
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
@@ -6,7 +6,7 @@ import { BodyText } from '../../typography/index.js';
|
|
|
6
6
|
import { Header } from '../../layouts/index.js';
|
|
7
7
|
import styles from './frame_stories.module.css';
|
|
8
8
|
export default {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Overlays/Floating/Frame',
|
|
10
10
|
component: Frame,
|
|
11
11
|
tags: ['autodocs'],
|
|
12
12
|
|
|
@@ -3,6 +3,10 @@ import { ZStack, type ZStackProps } from '../../stacks/index.js';
|
|
|
3
3
|
import { Portal } from '../portal/portal.js';
|
|
4
4
|
import { Draggable } from '../../utils/dnd/draggable/draggable.js';
|
|
5
5
|
|
|
6
|
+
// Styles
|
|
7
|
+
import styles from './frame.module.css';
|
|
8
|
+
import { clsx } from 'clsx';
|
|
9
|
+
|
|
6
10
|
export interface FrameOwnProps {
|
|
7
11
|
isOpen?: boolean;
|
|
8
12
|
children?: React.ReactNode;
|
|
@@ -13,7 +17,14 @@ export interface FrameOwnProps {
|
|
|
13
17
|
export type FrameProps = ZStackProps & FrameOwnProps;
|
|
14
18
|
|
|
15
19
|
export const Frame = React.forwardRef<HTMLDialogElement, FrameProps>(function Frame(
|
|
16
|
-
{
|
|
20
|
+
{
|
|
21
|
+
children,
|
|
22
|
+
isOpen = false,
|
|
23
|
+
draggable = true,
|
|
24
|
+
veil = false,
|
|
25
|
+
className,
|
|
26
|
+
...rest
|
|
27
|
+
}: FrameProps,
|
|
17
28
|
ref
|
|
18
29
|
) {
|
|
19
30
|
if (!isOpen) {
|
|
@@ -22,9 +33,14 @@ export const Frame = React.forwardRef<HTMLDialogElement, FrameProps>(function Fr
|
|
|
22
33
|
|
|
23
34
|
return (
|
|
24
35
|
<Portal>
|
|
25
|
-
<ZStack width="100%" height="100%" data-is-veil={veil} className="tcn-frame">
|
|
36
|
+
<ZStack width="100%" height="100%" data-is-veil={veil} className="tcn-frame-veil">
|
|
26
37
|
<Draggable draggable={draggable}>
|
|
27
|
-
<ZStack
|
|
38
|
+
<ZStack
|
|
39
|
+
as="dialog"
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={clsx(styles['frame'], 'tcn-frame', className)}
|
|
42
|
+
{...rest}
|
|
43
|
+
>
|
|
28
44
|
{children}
|
|
29
45
|
</ZStack>
|
|
30
46
|
</Draggable>
|
package/src/overlay/index.ts
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
export * from './portal/portal.js';
|
|
2
2
|
export * from './context_menu/context_menu.js';
|
|
3
3
|
export * from './menu/menu.js';
|
|
4
|
-
|
|
5
|
-
export * from './popper/popper.js';
|
|
4
|
+
|
|
6
5
|
export { Frame, type FrameOwnProps, type FrameProps } from './frame/frame.js';
|
|
6
|
+
export {
|
|
7
|
+
ElementTethered,
|
|
8
|
+
type ElementTetheredProps,
|
|
9
|
+
} from './tethered/element_tethered.js';
|
|
10
|
+
export { Tethered, type TetheredProps } from './tethered/tethered.js';
|
|
11
|
+
export { type HorizontalTether, type VerticalTether } from './tethered/types.js';
|
|
12
|
+
export * from './popper/legacy/popper.js';
|
|
13
|
+
export {
|
|
14
|
+
PopperDismissal,
|
|
15
|
+
type PopperDismissalDecoratorProps,
|
|
16
|
+
} from './popper/base/dismissal_decorator.js';
|
|
17
|
+
export {
|
|
18
|
+
PreviewPopper,
|
|
19
|
+
type PreviewPopperProps,
|
|
20
|
+
} from './popper/preview_popper.js';
|
|
21
|
+
export {
|
|
22
|
+
ContextPopper,
|
|
23
|
+
type ContextPopperProps,
|
|
24
|
+
} from './popper/context_popper.js';
|
|
25
|
+
export {
|
|
26
|
+
ElementPopper,
|
|
27
|
+
type ElementPopperProps,
|
|
28
|
+
} from './popper/element_popper.js';
|
|
29
|
+
export {
|
|
30
|
+
type BasePopperOwnProps,
|
|
31
|
+
type BasePopperProps,
|
|
32
|
+
BasePopper,
|
|
33
|
+
} from './popper/base/base_popper.js';
|
|
@@ -4,7 +4,7 @@ import { HStack } from '../../stacks/h_stack.js';
|
|
|
4
4
|
import { VStack } from '../../stacks/v_stack.js';
|
|
5
5
|
import type { HStackProps } from '../../stacks/h_stack.js';
|
|
6
6
|
import type { VStackProps } from '../../stacks/v_stack.js';
|
|
7
|
-
import { Popper, type PopperProps } from '
|
|
7
|
+
import { Popper, type PopperProps } from '../popper/legacy/popper.js';
|
|
8
8
|
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
9
9
|
import styles from './menu.module.css';
|
|
10
10
|
import { clsx } from 'clsx';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type ArgTypes } from '@storybook/react-vite';
|
|
2
|
+
import { PopperDismissal } from '../base/dismissal_decorator.js';
|
|
3
|
+
import type { BasePopperProps } from '../base/base_popper.js';
|
|
4
|
+
import type { BaseTetheredOwnProps } from '../../tethered/tethered.js';
|
|
5
|
+
|
|
6
|
+
export type SB_PopoverStoryProps = Pick<
|
|
7
|
+
BasePopperProps,
|
|
8
|
+
'restoreFocus' | 'dismissals' | 'veil'
|
|
9
|
+
> &
|
|
10
|
+
BaseTetheredOwnProps;
|
|
11
|
+
|
|
12
|
+
export const SBPopperInitialArgs: SB_PopoverStoryProps = {
|
|
13
|
+
verticalAnchor: 'top',
|
|
14
|
+
horizontalAnchor: 'center',
|
|
15
|
+
verticalOrigin: 'bottom',
|
|
16
|
+
horizontalOrigin: 'center',
|
|
17
|
+
verticalOffset: 0,
|
|
18
|
+
horizontalOffset: 0,
|
|
19
|
+
restoreFocus: false,
|
|
20
|
+
veil: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const SBPopperBaseArgs: ArgTypes<SB_PopoverStoryProps> = {
|
|
24
|
+
verticalAnchor: {
|
|
25
|
+
options: ['top', 'center', 'bottom'],
|
|
26
|
+
control: { type: 'radio' },
|
|
27
|
+
description: 'The anchor to position the popper vertically.',
|
|
28
|
+
},
|
|
29
|
+
horizontalAnchor: {
|
|
30
|
+
options: ['start', 'center', 'end'],
|
|
31
|
+
control: { type: 'radio' },
|
|
32
|
+
description: 'The anchor to position the popper horizontally.',
|
|
33
|
+
},
|
|
34
|
+
verticalOrigin: {
|
|
35
|
+
options: ['top', 'center', 'bottom'],
|
|
36
|
+
control: { type: 'radio' },
|
|
37
|
+
description: 'The origin to position the popper vertically.',
|
|
38
|
+
},
|
|
39
|
+
horizontalOrigin: {
|
|
40
|
+
options: ['start', 'center', 'end'],
|
|
41
|
+
control: { type: 'radio' },
|
|
42
|
+
description: 'The origin to position the popper horizontally.',
|
|
43
|
+
},
|
|
44
|
+
verticalOffset: {
|
|
45
|
+
control: { type: 'number' },
|
|
46
|
+
defaultValue: 0,
|
|
47
|
+
description: 'The offset to position the popper vertically.',
|
|
48
|
+
},
|
|
49
|
+
horizontalOffset: {
|
|
50
|
+
control: { type: 'number' },
|
|
51
|
+
defaultValue: 0,
|
|
52
|
+
description: 'The offset to position the popper horizontally.',
|
|
53
|
+
},
|
|
54
|
+
restoreFocus: {
|
|
55
|
+
control: { type: 'boolean' },
|
|
56
|
+
defaultValue: false,
|
|
57
|
+
description: 'Whether to restore focus when the popper is closed.',
|
|
58
|
+
},
|
|
59
|
+
dismissals: {
|
|
60
|
+
options: [
|
|
61
|
+
PopperDismissal.SCROLL_AWAY,
|
|
62
|
+
PopperDismissal.CLICK_AWAY,
|
|
63
|
+
PopperDismissal.MOUSE_LEAVE,
|
|
64
|
+
PopperDismissal.VEIL_CLICK,
|
|
65
|
+
],
|
|
66
|
+
control: { type: 'multi-select' },
|
|
67
|
+
defaultValue: [PopperDismissal.SCROLL_AWAY, PopperDismissal.CLICK_AWAY],
|
|
68
|
+
description: 'The dismissals to apply to the popper.',
|
|
69
|
+
},
|
|
70
|
+
veil: {
|
|
71
|
+
control: { type: 'boolean' },
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
description: 'Whether to display a veil when the popper is open.',
|
|
74
|
+
},
|
|
75
|
+
};
|