@react-fabric/core 1.0.0-beta.3 → 1.0.0-beta.30
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/css/index.js +14 -14
- package/css/reset/_reset.css +1 -1
- package/dist/cjs/components/actionLabel/ActionLabel.js +1 -0
- package/dist/cjs/components/animations/Animations.js +14 -7
- package/dist/cjs/components/avatar/Avatar.js +8 -10
- package/dist/cjs/components/avatar/AvatarGroup.js +1 -0
- package/dist/cjs/components/badge/Badge.js +5 -4
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +5 -2
- package/dist/cjs/components/button/Button.js +5 -4
- package/dist/cjs/components/button/Button.module.css +1 -1
- package/dist/cjs/components/button/ButtonGroup.js +3 -1
- package/dist/cjs/components/button/ConfirmButton.js +7 -2
- package/dist/cjs/components/button/ToggleButtonGroup.js +2 -1
- package/dist/cjs/components/callout/Callout.js +7 -2
- package/dist/cjs/components/card/Card.js +5 -3
- package/dist/cjs/components/card/CardCover.js +1 -1
- package/dist/cjs/components/chip/Chip.js +9 -4
- package/dist/cjs/components/chip/Chip.module.css +1 -1
- package/dist/cjs/components/collapsable/Collapsable.js +3 -2
- package/dist/cjs/components/divider/Divider.js +4 -3
- package/dist/cjs/components/divider/Divider.module.css +1 -0
- package/dist/cjs/components/dropdown/Dropdown.js +4 -2
- package/dist/cjs/components/dropdown/DropdownTool.js +4 -3
- package/dist/cjs/components/icon/Icon.js +14 -12
- package/dist/cjs/components/icon/Icon.module.css +1 -1
- package/dist/cjs/components/menu/ContextMenu.js +30 -10
- package/dist/cjs/components/menu/Menu.js +39 -20
- package/dist/cjs/components/menu/MenuItem.js +29 -14
- package/dist/cjs/components/navigator/Navigator.js +16 -9
- package/dist/cjs/components/panel/Panel.js +3 -1
- package/dist/cjs/components/progress/ProgressBar.js +2 -1
- package/dist/cjs/components/progress/ProgressCircle.js +2 -1
- package/dist/cjs/components/tabpanel/Tab.js +55 -36
- package/dist/cjs/components/tabpanel/TabPanel.js +19 -14
- package/dist/cjs/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/cjs/core/aside/Aside.js +6 -2
- package/dist/cjs/core/content/Content.js +8 -5
- package/dist/cjs/core/headfoot/HeadFoot.js +3 -2
- package/dist/cjs/core/headfoot/HeadFoot.module.css +1 -1
- package/dist/cjs/core/page/Page.js +1 -0
- package/dist/cjs/core/responsive/Responsive.js +1 -1
- package/dist/cjs/core/section/Section.module.css +1 -1
- package/dist/cjs/hooks/useNavigator.js +6 -4
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/overlays/alert/Alert.js +42 -17
- package/dist/cjs/overlays/alert/Alert.module.css +1 -1
- package/dist/cjs/overlays/flyout/Flyout.js +40 -42
- package/dist/cjs/overlays/message/Message.js +1 -1
- package/dist/cjs/overlays/modal/Modal.js +4 -5
- package/dist/cjs/overlays/toast/Toast.js +1 -1
- package/dist/cjs/overlays/tooltip/Tooltip.js +3 -3
- package/dist/cjs/overlays/tooltip/Tooltip.module.css +1 -1
- package/dist/cjs/types/icons.js +3 -0
- package/dist/cjs/typography/Abbr.js +1 -1
- package/dist/cjs/typography/{Link.js → Anchor.js} +4 -3
- package/dist/cjs/typography/Mark.js +1 -1
- package/dist/cjs/typography/Text.js +2 -2
- package/dist/cjs/typography/Title.js +3 -2
- package/dist/cjs/typography/Typography.module.css +1 -1
- package/dist/cjs/utils/cloneElement.js +44 -0
- package/dist/esm/components/actionLabel/ActionLabel.js +1 -0
- package/dist/esm/components/animations/Animations.js +14 -7
- package/dist/esm/components/avatar/Avatar.js +9 -11
- package/dist/esm/components/avatar/AvatarGroup.js +1 -0
- package/dist/esm/components/badge/Badge.js +5 -4
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +5 -2
- package/dist/esm/components/button/Button.js +5 -4
- package/dist/esm/components/button/Button.module.css +1 -1
- package/dist/esm/components/button/ButtonGroup.js +4 -2
- package/dist/esm/components/button/ConfirmButton.js +7 -2
- package/dist/esm/components/button/ToggleButtonGroup.js +3 -2
- package/dist/esm/components/callout/Callout.js +7 -2
- package/dist/esm/components/card/Card.js +5 -3
- package/dist/esm/components/card/CardCover.js +1 -1
- package/dist/esm/components/chip/Chip.js +9 -4
- package/dist/esm/components/chip/Chip.module.css +1 -1
- package/dist/esm/components/collapsable/Collapsable.js +3 -2
- package/dist/esm/components/divider/Divider.js +4 -3
- package/dist/esm/components/divider/Divider.module.css +1 -0
- package/dist/esm/components/dropdown/Dropdown.js +4 -2
- package/dist/esm/components/dropdown/DropdownTool.js +4 -3
- package/dist/esm/components/icon/Icon.js +14 -12
- package/dist/esm/components/icon/Icon.module.css +1 -1
- package/dist/esm/components/menu/ContextMenu.js +32 -12
- package/dist/esm/components/menu/Menu.js +41 -22
- package/dist/esm/components/menu/MenuItem.js +23 -8
- package/dist/esm/components/navigator/Navigator.js +16 -9
- package/dist/esm/components/panel/Panel.js +3 -1
- package/dist/esm/components/progress/ProgressBar.js +2 -1
- package/dist/esm/components/progress/ProgressCircle.js +2 -1
- package/dist/esm/components/tabpanel/Tab.js +56 -37
- package/dist/esm/components/tabpanel/TabPanel.js +19 -14
- package/dist/esm/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/esm/core/aside/Aside.js +6 -2
- package/dist/esm/core/content/Content.js +8 -5
- package/dist/esm/core/headfoot/HeadFoot.js +3 -2
- package/dist/esm/core/headfoot/HeadFoot.module.css +1 -1
- package/dist/esm/core/page/Page.js +1 -0
- package/dist/esm/core/responsive/Responsive.js +1 -1
- package/dist/esm/core/section/Section.module.css +1 -1
- package/dist/esm/hooks/useNavigator.js +7 -5
- package/dist/esm/index.js +4 -1
- package/dist/esm/overlays/alert/Alert.js +31 -6
- package/dist/esm/overlays/alert/Alert.module.css +1 -1
- package/dist/esm/overlays/flyout/Flyout.js +41 -43
- package/dist/esm/overlays/message/Message.js +1 -1
- package/dist/esm/overlays/modal/Modal.js +5 -6
- package/dist/esm/overlays/toast/Toast.js +1 -1
- package/dist/esm/overlays/tooltip/Tooltip.js +3 -3
- package/dist/esm/overlays/tooltip/Tooltip.module.css +1 -1
- package/dist/esm/types/icons.js +3 -0
- package/dist/esm/typography/Abbr.js +1 -1
- package/dist/esm/typography/{Link.js → Anchor.js} +4 -3
- package/dist/esm/typography/Mark.js +1 -1
- package/dist/esm/typography/Text.js +2 -2
- package/dist/esm/typography/Title.js +3 -2
- package/dist/esm/typography/Typography.module.css +1 -1
- package/dist/esm/utils/cloneElement.js +44 -0
- package/dist/types/components/actionLabel/ActionLabel.d.ts +2 -2
- package/dist/types/components/animations/Animations.d.ts +1 -1
- package/dist/types/components/badge/Badge.d.ts +5 -1
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/types/components/button/Button.d.ts +5 -3
- package/dist/types/components/button/ConfirmButton.d.ts +6 -1
- package/dist/types/components/card/Card.d.ts +3 -3
- package/dist/types/components/chip/Chip.d.ts +1 -1
- package/dist/types/components/collapsable/Collapsable.d.ts +5 -1
- package/dist/types/components/dropdown/DropdownTool.d.ts +2 -1
- package/dist/types/components/media/Media.d.ts +2 -2
- package/dist/types/components/menu/ContextMenu.d.ts +2 -1
- package/dist/types/components/menu/MenuItem.d.ts +1 -1
- package/dist/types/components/navigator/Navigator.d.ts +3 -3
- package/dist/types/components/tabpanel/Tab.d.ts +4 -4
- package/dist/types/components/tabpanel/TabPanel.d.ts +10 -1
- package/dist/types/core/aside/Aside.d.ts +7 -3
- package/dist/types/core/content/Content.d.ts +3 -2
- package/dist/types/core/responsive/Responsive.d.ts +1 -1
- package/dist/types/core/theme/ThemeProvider.d.ts +1 -1
- package/dist/types/hooks/useOverlayService.d.ts +3 -3
- package/dist/types/index.d.ts +3 -0
- package/dist/types/overlays/alert/Alert.d.ts +9 -1
- package/dist/types/overlays/flyout/Flyout.d.ts +3 -2
- package/dist/types/overlays/modal/Modal.d.ts +4 -3
- package/dist/types/types/icons.d.ts +3 -0
- package/dist/types/types/index.d.ts +8 -1
- package/dist/types/typography/{Link.d.ts → Anchor.d.ts} +2 -2
- package/dist/types/typography/index.d.ts +1 -1
- package/dist/types/utils/cloneElement.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/actionLabel/ActionLabel.tsx +13 -3
- package/src/components/animations/Animations.tsx +9 -3
- package/src/components/avatar/Avatar.tsx +69 -81
- package/src/components/avatar/AvatarGroup.tsx +1 -0
- package/src/components/badge/Badge.tsx +9 -4
- package/src/components/breadcrumbs/Breadcrumbs.tsx +9 -4
- package/src/components/button/Button.module.css +8 -1
- package/src/components/button/Button.tsx +12 -9
- package/src/components/button/ButtonGroup.tsx +3 -2
- package/src/components/button/ConfirmButton.tsx +15 -5
- package/src/components/button/ToggleButtonGroup.tsx +3 -2
- package/src/components/callout/Callout.tsx +12 -3
- package/src/components/card/Card.tsx +4 -0
- package/src/components/chip/Chip.module.css +4 -1
- package/src/components/chip/Chip.tsx +9 -4
- package/src/components/collapsable/Collapsable.tsx +6 -0
- package/src/components/divider/Divider.module.css +32 -0
- package/src/components/divider/Divider.tsx +3 -2
- package/src/components/dropdown/Dropdown.tsx +3 -2
- package/src/components/dropdown/DropdownTool.tsx +4 -2
- package/src/components/icon/Icon.module.css +0 -1
- package/src/components/icon/Icon.tsx +48 -58
- package/src/components/media/Media.tsx +2 -2
- package/src/components/menu/ContextMenu.tsx +36 -11
- package/src/components/menu/Menu.tsx +51 -30
- package/src/components/menu/MenuItem.tsx +14 -3
- package/src/components/navigator/Navigator.tsx +17 -4
- package/src/components/panel/Panel.tsx +3 -1
- package/src/components/tabpanel/Tab.tsx +74 -59
- package/src/components/tabpanel/TabPanel.module.css +19 -30
- package/src/components/tabpanel/TabPanel.tsx +33 -10
- package/src/core/aside/Aside.tsx +17 -3
- package/src/core/content/Content.tsx +16 -10
- package/src/core/headfoot/HeadFoot.module.css +2 -0
- package/src/core/headfoot/HeadFoot.tsx +1 -1
- package/src/core/page/Page.tsx +1 -0
- package/src/core/responsive/Responsive.tsx +3 -2
- package/src/core/section/Section.module.css +1 -1
- package/src/core/theme/ThemeProvider.tsx +1 -1
- package/src/hooks/useNavigator.tsx +10 -5
- package/src/hooks/useOverlayService.tsx +12 -4
- package/src/index.ts +4 -0
- package/src/overlays/alert/Alert.module.css +1 -1
- package/src/overlays/alert/Alert.tsx +30 -4
- package/src/overlays/flyout/Flyout.tsx +63 -62
- package/src/overlays/modal/Modal.tsx +13 -8
- package/src/overlays/tooltip/Tooltip.module.css +7 -7
- package/src/overlays/tooltip/Tooltip.tsx +4 -4
- package/src/types/icons.ts +6 -0
- package/src/types/index.ts +10 -9
- package/src/typography/{Link.tsx → Anchor.tsx} +3 -3
- package/src/typography/Text.tsx +1 -1
- package/src/typography/Title.tsx +0 -1
- package/src/typography/Typography.module.css +4 -2
- package/src/typography/index.ts +1 -1
- package/src/utils/cloneElement.ts +44 -0
- package/src/utils/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.buttonWrapper{--color:theme(colors.primary.500);border-radius:var(--rounding);font-size:1rem;& .button{background-color:var(--bg);background-image:var(--click-gradient);border-radius:inherit;color:var(--text);outline:1px solid var(--outline);&.spinOnHover:hover .buttonIcon{& :global{animation:spin 2s linear infinite}}&>*{pointer-events:none}&:not(:disabled) input[type=file]{pointer-events:auto;&::-webkit-file-upload-button{cursor:pointer;inset:0;position:absolute}}}& .rounded{border-radius:9999px}& .buttonLabel{line-height:1;order:1;padding:.5em 1em;&+.altIcon{margin-inline-start:-1em}}& .buttonChild{line-height:1;order:1;padding:.5em}& .buttonIcon{font-size:1.125em;padding:.3889em}& :global(.hotkey-label){align-self:center;order:3}& .altIcon{align-self:center;order:4;padding:.125em .5em}& [data-ref=badge]{align-self:center;margin-inline-end:.5em;order:2}}.buttonGroup{&>.buttonWrapper{flex:0 1 1em}&:not(.flex)+&:not(.flex){margin-inline-start:.5rem}}}@layer util{.buttonWrapper{&[data-size=xs]{font-size:.625rem}&[data-size=sm]{font-size:.875rem}&[data-size=md]{font-size:1.125rem}&[data-size=lg]{font-size:1.25rem}&[data-size=xl]{font-size:1.5rem}}.button{--bg:color-mix(in lab,var(--fabric-bg) 99%,var(--tint));--outline:color-mix(in lab,var(--bg) 90%,var(--fabric-text));--text:color-mix(in lab,var(--color) 80%,var(--fabric-text));--bg-hover:color-mix(in lab,var(--color) 18%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-active:color-mix(in lab,var(--color) 36%,var(--fabric-bg));&[data-color=accent]{--color:theme(colors.accent.500)}&[data-color=info]{--color:theme(colors.info.500)}&[data-color=danger]{--color:theme(colors.danger.500)}&[data-color=success]{--color:theme(colors.success.500)}&[data-color=warning]{--color:theme(colors.warning.500)}&[data-variant=outline]{--outline:var(--color)}&[data-variant=solid]{--outline:var(--color);--bg:color-mix(in lab,var(--color) 96%,var(--fabric-text));--text:theme(colors.white);--bg-hover:color-mix(in lab,var(--color) 90%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 80%,theme(colors.black));--bg-active:color-mix(in lab,var(--color) 70%,theme(colors.black));& :global(.hotkey-label){background-color:theme(backgroundColor.dark/30%);color:theme(colors.white/70%)}}&[data-variant=link]{--bg:transparent;--outline:transparent;background-image:none;box-shadow:none}&[data-color=invert]{--bg:theme(backgroundColor.invert);--text:color-mix(in lab,var(--color) 90%,theme(textColor.invert));--bg-hover:color-mix(in lab,var(--color) 15%,theme(backgroundColor.invert));--bg-click:color-mix(in lab,var(--color) 35%,theme(backgroundColor.invert))}}.buttonIcon[data-align=start]{order:0;&+.buttonLabel[data-colored-icon=false]{margin-inline-start:-1em}}.buttonIcon[data-align=end]{order:2;&~.buttonLabel[data-colored-icon=false]{margin-inline-end:-1em}}}@layer var{.buttonWrapper{height:unset;padding:unset;&[data-disabled=true]{cursor:not-allowed;& .button{background-image:var(--active-gradient);opacity:.5;pointer-events:none}}&[data-loading=true]{cursor:wait;& .button{background-image:var(--progress-gradient);background-size:1em 1em;pointer-events:none;& :global{animation:
|
|
1
|
+
@layer comp{.buttonWrapper{--color:theme(colors.primary.500);border-radius:var(--rounding);font-size:1rem;& .button{background-color:var(--bg);background-image:var(--click-gradient);border-radius:inherit;color:var(--text);outline:1px solid var(--outline);&.spinOnHover:hover .buttonIcon{& :global{animation:spin 2s linear infinite}}&>*{pointer-events:none}&:not(:disabled) input[type=file]{pointer-events:auto;&::-webkit-file-upload-button{cursor:pointer;inset:0;position:absolute}}}& .rounded{border-radius:9999px}& .buttonLabel{line-height:1;order:1;padding:.5em 1em;&+.altIcon{margin-inline-start:-1em}}& .buttonChild{line-height:1;order:1;padding:.5em}& .buttonIcon{font-size:1.125em;padding:.3889em}& :global(.hotkey-label){align-self:center;order:3}& .altIcon{align-self:center;order:4;padding:.125em .5em}& [data-ref=badge]{align-self:center;margin-inline-end:.5em;order:2}}.buttonGroup{&>.buttonWrapper{flex:0 1 1em}&:not(.flex)+&:not(.flex){margin-inline-start:.5rem}}}@layer util{.buttonWrapper{&[data-size=xs]{font-size:.625rem}&[data-size=sm]{font-size:.875rem}&[data-size=md]{font-size:1.125rem}&[data-size=lg]{font-size:1.25rem}&[data-size=xl]{font-size:1.5rem}}.button{--bg:color-mix(in lab,var(--fabric-bg) 99%,var(--tint));--outline:color-mix(in lab,var(--bg) 90%,var(--fabric-text));--text:color-mix(in lab,var(--color) 80%,var(--fabric-text));--bg-hover:color-mix(in lab,var(--color) 18%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-active:color-mix(in lab,var(--color) 36%,var(--fabric-bg));&[data-color=accent]{--color:theme(colors.accent.500)}&[data-color=info]{--color:theme(colors.info.500)}&[data-color=danger]{--color:theme(colors.danger.500)}&[data-color=success]{--color:theme(colors.success.500)}&[data-color=warning]{--color:theme(colors.warning.500)}&[data-variant=outline]{--outline:var(--color)}&[data-variant=soft]{--bg:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-hover:color-mix(in lab,var(--color) 35%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 50%,theme(colors.tint.50));--bg-active:color-mix(in lab,var(--color) 50%,theme(colors.tint.50))}&[data-variant=solid]{--outline:var(--color);--bg:color-mix(in lab,var(--color) 96%,var(--fabric-text));--text:theme(colors.white);--bg-hover:color-mix(in lab,var(--color) 90%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 80%,theme(colors.black));--bg-active:color-mix(in lab,var(--color) 70%,theme(colors.black));& :global(.hotkey-label){background-color:theme(backgroundColor.dark/30%);color:theme(colors.white/70%)}}&[data-variant=link]{--bg:transparent;--outline:transparent;background-image:none;box-shadow:none}&[data-color=invert]{--bg:theme(backgroundColor.invert);--text:color-mix(in lab,var(--color) 90%,theme(textColor.invert));--bg-hover:color-mix(in lab,var(--color) 15%,theme(backgroundColor.invert));--bg-click:color-mix(in lab,var(--color) 35%,theme(backgroundColor.invert))}}.buttonIcon[data-align=start]{order:0;&+.buttonLabel[data-colored-icon=false]{margin-inline-start:-1em}}.buttonIcon[data-align=end]{order:2;&~.buttonLabel[data-colored-icon=false]{margin-inline-end:-1em}}}@layer var{.buttonWrapper{height:unset;padding:unset;&[data-disabled=true]{cursor:not-allowed;& .button{background-image:var(--active-gradient);opacity:.5;pointer-events:none}}&[data-loading=true]{cursor:wait;& .button{background-image:var(--progress-gradient);background-size:1em 1em;pointer-events:none;& :global{animation:bgprogress .75s linear infinite}}& .button:not([data-variant=solid]){background-color:color-mix(in lab,var(--color) 15%,var(--fabric-bg))}}&:global(.btn-dashed)>.button{color:theme(colors.tint.600);outline:1px dashed theme(colors.tint.600);&[data-invalid=true]{background-color:theme(colors.danger.100);color:theme(colors.danger.600);outline:1px dashed theme(colors.danger.600)}}}.button{--tw-ring-color:var(--color);&:hover{background-color:var(--bg-hover)}&:active{background-color:var(--bg-click);background-image:var(--active-gradient);.buttonIcon,.buttonLabel{transform:translateY(1px)}}&[data-active=true],&[data-checked=true],&[data-dropdown-open=true]{background-color:var(--bg-active);background-image:none}&[data-active=true],&[data-dropdown-open=true]{pointer-events:none}}.buttonGroup{&>.buttonWrapper{margin:0;& .button[data-variant=link]{--outline:theme(backgroundColor.base)}}&:not(.vertical){&>:not(:first-child){&:before{border-inline-start:.5px solid theme(borderColor.base);content:"";inset-block:5%;inset-inline-start:-.5px;position:absolute}}&.separator>:not(:first-child){margin-inline-start:2px;&:before{inset-inline-start:-1.5px}}&>:not(:last-child) .button{border-end-end-radius:0;border-start-end-radius:0}&>:not(:first-child) .button{border-end-start-radius:0;border-start-start-radius:0}}&.vertical{&>:not(:first-child){&:before{border-block-start:.5px solid theme(borderColor.base);content:"";inset-block-start:-.5px;inset-inline:5%;position:absolute}}&.separator>:not(:first-child){margin-block-start:1px;&:before{inset-block-start:-1px}}&>:not(:last-child) .button{border-end-end-radius:0;border-end-start-radius:0}&>:not(:first-child) .button{border-start-end-radius:0;border-start-start-radius:0}}}}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import {
|
|
6
|
+
import { cloneElement } from 'react';
|
|
7
|
+
import { cloneChildren } from '../../utils/cloneElement.js';
|
|
8
|
+
import '@react-fabric/utilities';
|
|
7
9
|
import classes from './Button.module.css';
|
|
8
10
|
import { jsx } from 'react/jsx-runtime';
|
|
9
11
|
|
|
@@ -25,7 +27,7 @@ var ButtonGroup = function ButtonGroup(_ref) {
|
|
|
25
27
|
"data-ref": "buttonGroup",
|
|
26
28
|
className: classNames(classes.buttonGroup, className, fullWidth ? "flex" : "inline-flex", "flex-nowrap align-middle rounded", vertical && classes.vertical, vertical && "flex-col items-stretch")
|
|
27
29
|
}, aria), {}, {
|
|
28
|
-
children:
|
|
30
|
+
children: cloneChildren(children, function (child) {
|
|
29
31
|
return /*#__PURE__*/cloneElement(child, _objectSpread({
|
|
30
32
|
color: color,
|
|
31
33
|
size: size,
|
|
@@ -11,7 +11,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
11
11
|
import { Button } from './Button.js';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
|
-
var _excluded = ["ref", "message", "color", "okLabel", "cancelLabel", "onClick", "loading", "actionMessage", "showActionDone", "showActionDoneEvent"],
|
|
14
|
+
var _excluded = ["ref", "message", "color", "okLabel", "cancelLabel", "onClick", "loading", "placement", "actionMessage", "showActionDone", "showActionDoneEvent"],
|
|
15
15
|
_excluded2 = ["ref"];
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -26,6 +26,8 @@ var ConfirmButton = function ConfirmButton(_ref) {
|
|
|
26
26
|
cancelLabel = _ref.cancelLabel,
|
|
27
27
|
onClick = _ref.onClick,
|
|
28
28
|
loading = _ref.loading,
|
|
29
|
+
_ref$placement = _ref.placement,
|
|
30
|
+
placement = _ref$placement === void 0 ? "bottom" : _ref$placement,
|
|
29
31
|
actionMessage = _ref.actionMessage,
|
|
30
32
|
showActionDone = _ref.showActionDone,
|
|
31
33
|
_ref$showActionDoneEv = _ref.showActionDoneEvent,
|
|
@@ -77,7 +79,7 @@ var ConfirmButton = function ConfirmButton(_ref) {
|
|
|
77
79
|
}
|
|
78
80
|
},
|
|
79
81
|
strategy: "fixed",
|
|
80
|
-
placement:
|
|
82
|
+
placement: placement,
|
|
81
83
|
whileElementsMounted: autoUpdate,
|
|
82
84
|
middleware: [shift({
|
|
83
85
|
padding: 8
|
|
@@ -129,12 +131,14 @@ var ConfirmButton = function ConfirmButton(_ref) {
|
|
|
129
131
|
className: "font-medium ",
|
|
130
132
|
children: [/*#__PURE__*/jsx("p", {
|
|
131
133
|
className: "py-2 px-4",
|
|
134
|
+
"data-ref": "confirmMessage",
|
|
132
135
|
children: message
|
|
133
136
|
}), /*#__PURE__*/jsxs("div", {
|
|
134
137
|
className: "flex justify-end py-2 px-4 gap-2",
|
|
135
138
|
children: [/*#__PURE__*/jsx(Button, {
|
|
136
139
|
size: "sm",
|
|
137
140
|
variant: "link",
|
|
141
|
+
"data-ref": "confirmCancel",
|
|
138
142
|
color: color,
|
|
139
143
|
onClick: function onClick() {
|
|
140
144
|
return [clickHandler(false), setIsOpen(false)];
|
|
@@ -145,6 +149,7 @@ var ConfirmButton = function ConfirmButton(_ref) {
|
|
|
145
149
|
variant: "solid",
|
|
146
150
|
color: color,
|
|
147
151
|
autoFocus: true,
|
|
152
|
+
"data-ref": "confirmOk",
|
|
148
153
|
onClick: function onClick() {
|
|
149
154
|
return [clickHandler(true), setIsOpen(false)];
|
|
150
155
|
},
|
|
@@ -5,8 +5,9 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
5
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
6
|
import { isArray, EMPTY_ARRAY } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { useMemo, useCallback,
|
|
8
|
+
import { useMemo, useCallback, cloneElement } from 'react';
|
|
9
9
|
import { useControlledValue } from '../../hooks/useControlledValue.js';
|
|
10
|
+
import { cloneChildren } from '../../utils/cloneElement.js';
|
|
10
11
|
import classes from './Button.module.css';
|
|
11
12
|
import { jsx } from 'react/jsx-runtime';
|
|
12
13
|
|
|
@@ -48,7 +49,7 @@ var ToggleButtonGroup = function ToggleButtonGroup(_ref) {
|
|
|
48
49
|
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
49
50
|
className: classNames(classes.buttonGroup, className, fullWidth ? "flex" : "inline-flex", "flex-nowrap align-middle", vertical && classes.vertical, vertical && "flex-col")
|
|
50
51
|
}, aria), {}, {
|
|
51
|
-
children:
|
|
52
|
+
children: cloneChildren(children, function (child) {
|
|
52
53
|
return /*#__PURE__*/cloneElement(child, _objectSpread(_objectSpread({
|
|
53
54
|
color: color,
|
|
54
55
|
size: size,
|
|
@@ -4,10 +4,11 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { CoreIcons } from '../../types/icons.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
9
|
import { getBgClass, getColorClass, getBorderClass } from '../../utils/getColor.js';
|
|
8
10
|
import '@react-fabric/utilities';
|
|
9
11
|
import { Icon } from '../icon/Icon.js';
|
|
10
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
12
|
|
|
12
13
|
var _excluded = ["children", "color", "legend", "title", "icon", "border", "onClose", "className"];
|
|
13
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -28,15 +29,18 @@ var Callout = function Callout(_ref) {
|
|
|
28
29
|
}, aria), {}, {
|
|
29
30
|
children: [legend && /*#__PURE__*/jsx("legend", {
|
|
30
31
|
className: "px-2 mx-4 font-medium",
|
|
32
|
+
"data-ref": "calloutLegend",
|
|
31
33
|
children: legend
|
|
32
34
|
}), /*#__PURE__*/jsxs("div", {
|
|
33
35
|
className: classNames("break-words whitespace-break-spaces p-2"),
|
|
34
36
|
children: [/*#__PURE__*/jsxs("div", {
|
|
35
37
|
className: "flex flex-nowrap items-center text-xl pe-4 gap-2 mb-4 empty:mb-0",
|
|
36
38
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
37
|
-
icon: icon
|
|
39
|
+
icon: icon,
|
|
40
|
+
"data-ref": "calloutIcon"
|
|
38
41
|
}), title && /*#__PURE__*/jsx("p", {
|
|
39
42
|
className: "flex-1",
|
|
43
|
+
"data-ref": "calloutTitle",
|
|
40
44
|
children: title
|
|
41
45
|
})]
|
|
42
46
|
}), /*#__PURE__*/jsx("div", {
|
|
@@ -45,6 +49,7 @@ var Callout = function Callout(_ref) {
|
|
|
45
49
|
})]
|
|
46
50
|
}), onClose && /*#__PURE__*/jsx(Icon, {
|
|
47
51
|
size: "md",
|
|
52
|
+
"data-ref": "calloutClose",
|
|
48
53
|
className: classNames("absolute end-2", legend ? "top-0" : "top-2"),
|
|
49
54
|
icon: CoreIcons.close,
|
|
50
55
|
onClick: onClose
|
|
@@ -7,12 +7,12 @@ import classNames from 'classnames';
|
|
|
7
7
|
import { useMemo, Children } from 'react';
|
|
8
8
|
import { ErrorBoundary } from '../../core/boundary/ErrorBoundary.js';
|
|
9
9
|
import { Header, Footer } from '../../core/headfoot/HeadFoot.js';
|
|
10
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
import '@react-fabric/utilities';
|
|
11
12
|
import { nodeCheck } from '../../utils/nodeCheck.js';
|
|
12
13
|
import classes from './Card.module.css';
|
|
13
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
|
-
var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "flex", "draggable", "dragKey", "dragData"];
|
|
15
|
+
var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "flex", "draggable", "dragKey", "dragData", "ref"];
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
18
|
var Card = function Card(_ref) {
|
|
@@ -26,6 +26,7 @@ var Card = function Card(_ref) {
|
|
|
26
26
|
draggable = _ref.draggable,
|
|
27
27
|
dragKey = _ref.dragKey,
|
|
28
28
|
dragData = _ref.dragData,
|
|
29
|
+
ref = _ref.ref,
|
|
29
30
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
30
31
|
var _useMemo = useMemo(function () {
|
|
31
32
|
return Children.toArray(children).reduce(function (ret, node) {
|
|
@@ -46,7 +47,8 @@ var Card = function Card(_ref) {
|
|
|
46
47
|
onDragStart: !draggable ? undefined : function (e) {
|
|
47
48
|
var _e$dataTransfer;
|
|
48
49
|
return dragKey && ((_e$dataTransfer = e.dataTransfer) === null || _e$dataTransfer === void 0 ? void 0 : _e$dataTransfer.setData(dragKey, JSON.stringify(dragData)));
|
|
49
|
-
}
|
|
50
|
+
},
|
|
51
|
+
ref: ref
|
|
50
52
|
}, aria), {}, {
|
|
51
53
|
children: [header, /*#__PURE__*/jsx("div", {
|
|
52
54
|
role: "none",
|
|
@@ -5,11 +5,11 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
5
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useMemo, Children } from 'react';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
9
|
import '@react-fabric/utilities';
|
|
9
10
|
import { nodeCheck } from '../../utils/nodeCheck.js';
|
|
10
11
|
import { Image, Video } from '../media/Media.js';
|
|
11
12
|
import classes from './Card.module.css';
|
|
12
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
var _excluded = ["className", "children", "height", "justify", "colorScheme"];
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -5,11 +5,11 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
7
|
import { useMemoDebugger } from '../../hooks/useEffectDebugger.js';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
9
|
import { getColor, getColorClass } from '../../utils/getColor.js';
|
|
9
10
|
import '@react-fabric/utilities';
|
|
10
11
|
import { Icon } from '../icon/Icon.js';
|
|
11
12
|
import classes from './Chip.module.css';
|
|
12
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "iconBg", "iconColor", "rtlFlip", "disabled", "onClick", "onIconClick", "onRemove", "rounded", "stopPropagation", "as"];
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -66,13 +66,15 @@ var Chip = function Chip(_ref) {
|
|
|
66
66
|
return /*#__PURE__*/jsxs(E, _objectSpread(_objectSpread({
|
|
67
67
|
ref: ref,
|
|
68
68
|
role: "term",
|
|
69
|
-
|
|
69
|
+
"data-ref": "chip",
|
|
70
|
+
className: classNames(classes.chip, className, color && getColorClass(color), "select-none inline-flex flex-nowrap items-center align-middle max-w-72 rounded", rounded && "rounded-full", !!onClick && classes.clickable, disabled && classes.disabled),
|
|
70
71
|
style: styles,
|
|
71
72
|
"data-variant": variant,
|
|
72
73
|
"data-inner-clickable": !!onClick,
|
|
73
|
-
onClick: clickHandler
|
|
74
|
+
onClick: disabled ? undefined : clickHandler
|
|
74
75
|
}, aria), {}, {
|
|
75
76
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
77
|
+
"data-ref": "chipIcon",
|
|
76
78
|
className: classNames(classes.chipIcon, "m-1"),
|
|
77
79
|
icon: icon,
|
|
78
80
|
bg: iconBg,
|
|
@@ -80,10 +82,13 @@ var Chip = function Chip(_ref) {
|
|
|
80
82
|
color: iconColor,
|
|
81
83
|
rtlFlip: rtlFlip
|
|
82
84
|
}), children && /*#__PURE__*/jsx("label", {
|
|
83
|
-
|
|
85
|
+
"data-ref": "chipLabel",
|
|
86
|
+
className: classNames(classes.chipLabel, "truncate"),
|
|
84
87
|
children: children
|
|
85
88
|
}), onRemove && /*#__PURE__*/jsx("span", {
|
|
86
89
|
role: "none",
|
|
90
|
+
"data-ref": "chipRemove",
|
|
91
|
+
"data-inner-cliackable": true,
|
|
87
92
|
className: classNames(classes.chipRemove, "cursor-pointer pe-1 opacity-65 hover:opacity-90"),
|
|
88
93
|
onClick: removeHandler,
|
|
89
94
|
children: "\xD7"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.chip{--blank-gradient:linear-gradient(180deg,#00000005 0%,#0000 10%);background-image:var(--blank-gradient);color:theme(colors.tint.500);outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{padding
|
|
1
|
+
@layer comp{.chip{--blank-gradient:linear-gradient(180deg,#00000005 0%,#0000 10%);background-image:var(--blank-gradient);color:theme(colors.tint.500);font-size:.875rem;outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{line-height:1.5;padding:0 .5em}&>.chipIcon{&+.chipLabel{margin-inline-start:-.5em}}&.clickable{background-image:var(--click-gradient);cursor:pointer;&.disabled{opacity:.5;pointer-events:none}}}}@layer var{.chip{background-color:color-mix(in lab,currentcolor 10%,var(--fabric-bg));height:unset;padding:unset;&[data-variant=outline]{box-shadow:0 0 2px color-mix(in lab,currentcolor 50%,var(--tint)) inset;outline-color:color-mix(in lab,currentcolor 50%,var(--fabric-bg))}>*{color:color-mix(in lab,currentcolor 50%,var(--fabric-text))}&.clickable{&:hover{background-color:color-mix(in lab,currentcolor 20%,var(--fabric-bg))}&:active,&[data-dropdown-open=true]{background-color:color-mix(in lab,currentcolor 15%,var(--fabric-bg));background-image:var(--active-gradient)}&[data-dropdown-open=true]{pointer-events:none}}&[data-variant=solid]{background-color:color-mix(in lab,currentcolor 35%,var(--fabric-bg));outline-color:color-mix(in lab,currentcolor 50%,var(--fabric-bg));&>*{color:color-mix(in lab,currentcolor 5%,var(--fabric-text))}&.clickable{&:hover{background-color:color-mix(in lab,currentcolor 45%,var(--fabric-bg))}&:active,&[data-dropdown-open=true]{background-color:color-mix(in lab,currentcolor 30%,var(--fabric-bg))}}}}}
|
|
@@ -11,7 +11,7 @@ import { Icon } from '../icon/Icon.js';
|
|
|
11
11
|
import classes from './Collapsable.module.css';
|
|
12
12
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
|
-
var _excluded = ["ref", "disabled", "className", "bodyClassName", "headerClassName", "children", "iconAlign", "iconClosed", "iconOpen", "open", "onClose", "onOpen"];
|
|
14
|
+
var _excluded = ["ref", "disabled", "className", "bodyClassName", "headerClassName", "children", "iconAlign", "stickyHeader", "iconClosed", "iconOpen", "open", "onClose", "onOpen"];
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
17
|
var Collapsable = function Collapsable(_ref) {
|
|
@@ -22,6 +22,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
22
22
|
headerClassName = _ref.headerClassName,
|
|
23
23
|
children = _ref.children,
|
|
24
24
|
iconAlign = _ref.iconAlign,
|
|
25
|
+
stickyHeader = _ref.stickyHeader,
|
|
25
26
|
_ref$iconClosed = _ref.iconClosed,
|
|
26
27
|
iconClosed = _ref$iconClosed === void 0 ? CoreIcons.chevronRight : _ref$iconClosed,
|
|
27
28
|
_ref$iconOpen = _ref.iconOpen,
|
|
@@ -62,7 +63,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
62
63
|
children: [/*#__PURE__*/jsxs("div", {
|
|
63
64
|
role: "none",
|
|
64
65
|
ref: headRef,
|
|
65
|
-
className: classNames(classes.collapsableHead, "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, iconAlign === "end" ? "flex-row-reverse" : "flex-row"),
|
|
66
|
+
className: classNames(classes.collapsableHead, "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, stickyHeader && "bg-base sticky top-0 px-2 py-1 z-10", iconAlign === "end" ? "flex-row-reverse" : "flex-row"),
|
|
66
67
|
onClick: function onClick() {
|
|
67
68
|
return !disabled && setOpenState(!openState);
|
|
68
69
|
},
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
6
|
import { getBorderClass, getBgClass, getColorClass } from '../../utils/getColor.js';
|
|
6
7
|
import '@react-fabric/utilities';
|
|
7
|
-
import
|
|
8
|
+
import classes from './Divider.module.css';
|
|
8
9
|
|
|
9
10
|
/*
|
|
10
11
|
* React Fabric
|
|
@@ -44,7 +45,7 @@ var Divider = function Divider(_ref) {
|
|
|
44
45
|
style: {
|
|
45
46
|
flex: flex
|
|
46
47
|
},
|
|
47
|
-
className: classNames(className, vertical && "vertical", !flex && "self-stretch", vertical ?
|
|
48
|
+
className: classNames(className, vertical && "vertical", !flex && "self-stretch", vertical ? classes.vertical : classes.horizontal, color && getBorderClass(color + "-200"))
|
|
48
49
|
});
|
|
49
50
|
}, [color, vertical]);
|
|
50
51
|
return children ? /*#__PURE__*/jsxs("div", {
|
|
@@ -52,7 +53,7 @@ var Divider = function Divider(_ref) {
|
|
|
52
53
|
children: [/*#__PURE__*/jsx(Rule, {
|
|
53
54
|
flex: align === "start" ? "0 0 1rem" : "1 1 1em"
|
|
54
55
|
}), /*#__PURE__*/jsx("div", {
|
|
55
|
-
className: classNames("px-2 whitespace-nowrap", vertical ?
|
|
56
|
+
className: classNames("px-2 whitespace-nowrap", vertical ? classes.vertical : classes.horizontal, fill && getBgClass((color !== null && color !== void 0 ? color : "tint") + "-200"), !fill && getColorClass((color !== null && color !== void 0 ? color : "tint") + "-600"), "rounded-full text-[0.75em]", vertical && "origin-center -rotate-90 z-1"),
|
|
56
57
|
children: children
|
|
57
58
|
}), /*#__PURE__*/jsx(Rule, {
|
|
58
59
|
flex: align === "end" ? "0 0 1rem" : "1 1 1em"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer comp{.vertical{margin-inline:.25rem}.horizontal{margin-block:.25rem}}
|
|
@@ -115,6 +115,7 @@ var DropdownElement = function DropdownElement(_ref) {
|
|
|
115
115
|
e.stopPropagation();
|
|
116
116
|
}
|
|
117
117
|
})), {}, {
|
|
118
|
+
"data-inner-clickable": "true",
|
|
118
119
|
"data-dropdown-open": isOpen ? true : undefined,
|
|
119
120
|
ref: innerRef
|
|
120
121
|
})), isOpen && /*#__PURE__*/jsxs(FloatingPortal, {
|
|
@@ -131,7 +132,8 @@ var DropdownElement = function DropdownElement(_ref) {
|
|
|
131
132
|
style: _objectSpread({
|
|
132
133
|
minWidth: minWidth,
|
|
133
134
|
zIndex: "var(--z-popover)"
|
|
134
|
-
}, floatingStyles)
|
|
135
|
+
}, floatingStyles),
|
|
136
|
+
"data-ref": "dropdownBody"
|
|
135
137
|
}, getFloatingProps({
|
|
136
138
|
onClick: function onClick(e) {
|
|
137
139
|
return e.stopPropagation();
|
|
@@ -139,7 +141,7 @@ var DropdownElement = function DropdownElement(_ref) {
|
|
|
139
141
|
})), {}, {
|
|
140
142
|
children: [/*#__PURE__*/jsx("div", {
|
|
141
143
|
role: "none",
|
|
142
|
-
className: classNames(classes.dropdownBody, dropdownClassName, !plainDropdown && "shadow-lg
|
|
144
|
+
className: classNames(classes.dropdownBody, dropdownClassName, !plainDropdown && "shadow-lg bg-base ring-1 ring-tint-100", "rounded-capped overflow-auto scroll-thin grid max-h-[70vh]"),
|
|
143
145
|
onMouseUpCapture: tryClosing,
|
|
144
146
|
children: panel
|
|
145
147
|
}), showArrow && /*#__PURE__*/jsx(FloatingArrow, {
|
|
@@ -8,18 +8,19 @@ import { Icon } from '../icon/Icon.js';
|
|
|
8
8
|
import { Dropdown } from './Dropdown.js';
|
|
9
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
|
-
var _excluded = ["children", "className", "groupHover"];
|
|
11
|
+
var _excluded = ["children", "className", "groupHover", "icon"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
var DropdownTool = function DropdownTool(_ref) {
|
|
15
15
|
var children = _ref.children,
|
|
16
16
|
className = _ref.className,
|
|
17
17
|
groupHover = _ref.groupHover,
|
|
18
|
+
icon = _ref.icon,
|
|
18
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
20
|
return /*#__PURE__*/jsxs(Dropdown, _objectSpread(_objectSpread({}, props), {}, {
|
|
20
21
|
children: [/*#__PURE__*/jsx(Icon, {
|
|
21
|
-
icon: CoreIcons.caretDown,
|
|
22
|
-
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover:inline-block data-[dropdown-open]:inline-block")
|
|
22
|
+
icon: icon !== null && icon !== void 0 ? icon : CoreIcons.caretDown,
|
|
23
|
+
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover/tool:inline-block data-[dropdown-open]:inline-block")
|
|
23
24
|
}), children]
|
|
24
25
|
}));
|
|
25
26
|
};
|
|
@@ -4,10 +4,10 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import { isSvgPath, isString } from '@react-fabric/utilities';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import {
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
9
|
import { getColor, getBgClass, getColorClass } from '../../utils/getColor.js';
|
|
9
10
|
import classes from './Icon.module.css';
|
|
10
|
-
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
12
|
var _excluded = ["ref", "icon", "bg", "color", "size", "rtlFlip", "animate", "rounded", "viewBox", "className", "onClick"];
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -40,7 +40,7 @@ var Icon = function Icon(_ref) {
|
|
|
40
40
|
onClick = _ref.onClick,
|
|
41
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
42
|
/** ***************** style map *******************/
|
|
43
|
-
var styles =
|
|
43
|
+
var styles = useMemo(function () {
|
|
44
44
|
var s = {};
|
|
45
45
|
if (bg) {
|
|
46
46
|
s.backgroundColor = getColor(bg);
|
|
@@ -55,16 +55,15 @@ var Icon = function Icon(_ref) {
|
|
|
55
55
|
s.fontSize = SizeMap[size];
|
|
56
56
|
}
|
|
57
57
|
return s;
|
|
58
|
-
}, [bg, color, size]
|
|
58
|
+
}, [bg, color, size]);
|
|
59
59
|
|
|
60
60
|
/** ***************** check if icon is svg path *******************/
|
|
61
|
-
var isSvg =
|
|
61
|
+
var isSvg = useMemo(function () {
|
|
62
62
|
return isSvgPath(icon);
|
|
63
|
-
}, [icon]
|
|
63
|
+
}, [icon]);
|
|
64
64
|
|
|
65
65
|
/** ***************** render icon *******************/
|
|
66
|
-
var iconEl =
|
|
67
|
-
var _SvgTextSize$icon$len;
|
|
66
|
+
var iconEl = useMemo(function () {
|
|
68
67
|
if (!isString(icon)) {
|
|
69
68
|
throw Error("Invalid icon expected string");
|
|
70
69
|
}
|
|
@@ -83,22 +82,25 @@ var Icon = function Icon(_ref) {
|
|
|
83
82
|
dominantBaseline: "middle",
|
|
84
83
|
textAnchor: "middle",
|
|
85
84
|
style: {
|
|
86
|
-
fontSize:
|
|
85
|
+
fontSize: SvgTextSize[icon.length]
|
|
87
86
|
},
|
|
88
87
|
children: icon
|
|
89
88
|
})
|
|
90
89
|
}) : /*#__PURE__*/jsx("i", {
|
|
91
90
|
className: "".concat(icon)
|
|
92
91
|
});
|
|
93
|
-
}, [icon, isSvg, viewBox]
|
|
94
|
-
return /*#__PURE__*/jsx("dfn", _objectSpread(_objectSpread({
|
|
95
|
-
ref:
|
|
92
|
+
}, [icon, isSvg, viewBox]);
|
|
93
|
+
return /*#__PURE__*/jsx("dfn", _objectSpread(_objectSpread({
|
|
94
|
+
"data-ref": "icon",
|
|
95
|
+
ref: ref
|
|
96
|
+
}, rest), {}, {
|
|
96
97
|
role: "presentation",
|
|
97
98
|
className: classNames(classes.icon, className, "select-none overflow-hidden inline-block box-content leading-none not-italic text-center", bg && getBgClass(bg), color && getColorClass(color), !rounded && "rounded", rounded && "rounded-full", animate && "animate-".concat(animate)),
|
|
98
99
|
onClick: onClick,
|
|
99
100
|
"data-flip": rtlFlip,
|
|
100
101
|
style: styles,
|
|
101
102
|
"data-clickable": !!onClick,
|
|
103
|
+
"data-inner-clickable": !!onClick,
|
|
102
104
|
children: iconEl
|
|
103
105
|
}));
|
|
104
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.icon{height:1em;position:relative;vertical-align:-.125em;width:1em;&>i,&>img,&>svg{
|
|
1
|
+
@layer comp{.icon{height:1em;position:relative;vertical-align:-.125em;width:1em;&>i,&>img,&>svg{display:block;height:1em;line-height:1;object-fit:cover;overflow:hidden;pointer-events:none;width:1em;fill:currentcolor}&>i:before{line-height:1}&[data-clickable=true]{opacity:.75;&:hover{background-color:theme(colors.text/10%);opacity:.9}&:active{opacity:.5}}}[dir=rtl] .icon[data-flip=true]{transform:scaleX(-1)}}
|
|
@@ -2,22 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
|
-
import { useFloating, autoUpdate, offset, flip, useClick, useDismiss, useInteractions, FloatingPortal } from '@floating-ui/react';
|
|
6
|
-
import { useState, useRef, cloneElement } from 'react';
|
|
5
|
+
import { useFloatingNodeId, useFloating, autoUpdate, offset, flip, useClick, useDismiss, useInteractions, FloatingPortal } from '@floating-ui/react';
|
|
6
|
+
import { useState, useRef, useEffect, cloneElement } from 'react';
|
|
7
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
var ContextMenu = function ContextMenu(_ref) {
|
|
12
|
+
var _refs$domReference$cu, _refs$domReference$cu2;
|
|
12
13
|
var children = _ref.children,
|
|
13
|
-
menu = _ref.menu
|
|
14
|
+
menu = _ref.menu,
|
|
15
|
+
disabled = _ref.disabled;
|
|
14
16
|
var _useState = useState(false),
|
|
15
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16
18
|
isOpen = _useState2[0],
|
|
17
19
|
setIsOpen = _useState2[1];
|
|
20
|
+
var nodeId = useFloatingNodeId();
|
|
18
21
|
var _useFloating = useFloating({
|
|
19
22
|
open: isOpen,
|
|
20
|
-
|
|
23
|
+
nodeId: nodeId,
|
|
24
|
+
onOpenChange: function onOpenChange(open, evt, reason) {
|
|
25
|
+
var target = evt === null || evt === void 0 ? void 0 : evt.target;
|
|
26
|
+
if (!(target !== null && target !== void 0 && target.closest(".menu-list"))) setIsOpen(open);
|
|
27
|
+
},
|
|
21
28
|
strategy: "fixed",
|
|
22
29
|
placement: "bottom-start",
|
|
23
30
|
whileElementsMounted: autoUpdate,
|
|
@@ -26,8 +33,13 @@ var ContextMenu = function ContextMenu(_ref) {
|
|
|
26
33
|
refs = _useFloating.refs,
|
|
27
34
|
floatingStyles = _useFloating.floatingStyles,
|
|
28
35
|
context = _useFloating.context;
|
|
29
|
-
var click = useClick(context, {
|
|
30
|
-
|
|
36
|
+
var click = useClick(context, {
|
|
37
|
+
toggle: true,
|
|
38
|
+
ignoreMouse: true
|
|
39
|
+
});
|
|
40
|
+
var dismiss = useDismiss(context, {
|
|
41
|
+
bubbles: true
|
|
42
|
+
});
|
|
31
43
|
var _useInteractions = useInteractions([dismiss, click]),
|
|
32
44
|
getFloatingProps = _useInteractions.getFloatingProps;
|
|
33
45
|
var handleClick = useRef(function (e) {
|
|
@@ -51,11 +63,18 @@ var ContextMenu = function ContextMenu(_ref) {
|
|
|
51
63
|
e.preventDefault();
|
|
52
64
|
return false;
|
|
53
65
|
});
|
|
54
|
-
var wrapperRef = useRef(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
var wrapperRef = useRef(null);
|
|
67
|
+
useEffect(function () {
|
|
68
|
+
var el = wrapperRef.current;
|
|
69
|
+
if (el && !disabled) {
|
|
70
|
+
var _el$parentElement;
|
|
71
|
+
el === null || el === void 0 || (_el$parentElement = el.parentElement) === null || _el$parentElement === void 0 || _el$parentElement.addEventListener("contextmenu", handleClick.current);
|
|
72
|
+
return function () {
|
|
73
|
+
var _el$parentElement2;
|
|
74
|
+
el === null || el === void 0 || (_el$parentElement2 = el.parentElement) === null || _el$parentElement2 === void 0 || _el$parentElement2.removeEventListener("contextmenu", handleClick.current);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}, [disabled]);
|
|
59
78
|
var tryClosing = useRef(function (e) {
|
|
60
79
|
var _e$target;
|
|
61
80
|
if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.closest("[data-dropdown-dismiss='true']")) setTimeout(function () {
|
|
@@ -64,9 +83,10 @@ var ContextMenu = function ContextMenu(_ref) {
|
|
|
64
83
|
});
|
|
65
84
|
return /*#__PURE__*/jsxs("div", {
|
|
66
85
|
className: "contents",
|
|
67
|
-
ref: wrapperRef
|
|
86
|
+
ref: wrapperRef,
|
|
68
87
|
onMouseUpCapture: tryClosing.current,
|
|
69
88
|
children: [children, isOpen && /*#__PURE__*/jsx(FloatingPortal, {
|
|
89
|
+
root: (_refs$domReference$cu = (_refs$domReference$cu2 = refs.domReference.current) === null || _refs$domReference$cu2 === void 0 ? void 0 : _refs$domReference$cu2.closest(".theme-base")) !== null && _refs$domReference$cu !== void 0 ? _refs$domReference$cu : undefined,
|
|
70
90
|
children: /*#__PURE__*/cloneElement(menu, _objectSpread(_objectSpread({}, getFloatingProps()), {}, {
|
|
71
91
|
style: _objectSpread(_objectSpread({}, floatingStyles), {}, {
|
|
72
92
|
borderRadius: "var(--rounding)",
|