@react-fabric/core 1.0.0-beta.4 → 1.0.0-beta.40
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/{src/components/actionLabel/ActionLabel.module.css → css/components/_actionLabel.css} +4 -4
- package/{src/overlays/alert/Alert.module.css → css/components/_alert.css} +3 -3
- package/{src/components/animations/Animations.module.css → css/components/_animations.css} +9 -9
- package/{src/components/avatar/Avatar.module.css → css/components/_avatar.css} +11 -11
- package/{src/components/badge/Badge.module.css → css/components/_badge.css} +19 -17
- package/{src/components/breadcrumbs/Breadcrumbs.module.css → css/components/_breadcrumbs.css} +49 -44
- package/{src/components/button/Button.module.css → css/components/_button.css} +68 -78
- package/{src/components/card/Card.module.css → css/components/_card.css} +32 -28
- package/{src/components/chip/Chip.module.css → css/components/_chip.css} +15 -11
- package/{src/components/collapsable/Collapsable.module.css → css/components/_collapsable.css} +3 -3
- package/css/components/_divider.css +32 -0
- package/{src/components/dropdown/Dropdown.module.css → css/components/_dropdown.css} +2 -2
- package/{src/overlays/flyout/Flyout.module.css → css/components/_flyout.css} +6 -6
- package/{src/components/icon/Icon.module.css → css/components/_icon.css} +8 -5
- package/{src/components/media/Media.module.css → css/components/_media.css} +17 -17
- package/{src/components/menu/Menu.module.css → css/components/_menu.css} +15 -16
- package/{src/overlays/message/Message.module.css → css/components/_message.css} +2 -2
- package/{src/components/meter/Meter.module.css → css/components/_meter.css} +10 -10
- package/{src/overlays/modal/Modal.module.css → css/components/_modal.css} +6 -6
- package/{src/components/panel/Panel.module.css → css/components/_panel.css} +17 -17
- package/{src/components/progress/Progress.module.css → css/components/_progress.css} +7 -10
- package/{src/components/tabpanel/TabPanel.module.css → css/components/_tabPanel.css} +73 -84
- package/{src/overlays/toast/Toast.module.css → css/components/_toast.css} +2 -2
- package/css/components/_tooltip.css +29 -0
- package/{src/core/content/Content.module.css → css/components/index.css} +25 -18
- package/{src/core/aside/Aside.module.css → css/core/_aside.css} +42 -42
- package/{src/core/section/Section.module.css → css/core/_content.css} +5 -3
- package/{src/core/boundary/ErrorBoundary.module.css → css/core/_errorboundary.css} +9 -9
- package/{src/core/headfoot/HeadFoot.module.css → css/core/_headfoot.css} +4 -10
- package/{src/core/page/Page.module.css → css/core/_page.css} +10 -14
- package/{src/core/responsive/Responsive.module.css → css/core/_responsive.css} +10 -10
- package/css/core/_section.css +28 -0
- package/{src/core/theme/Theme.module.css → css/core/_theme.css} +3 -3
- package/{src/typography/Typography.module.css → css/core/_typography.css} +14 -12
- package/{src/core/viewport/Viewport.module.css → css/core/_viewport.css} +7 -3
- package/css/core/index.css +33 -0
- package/css/reset/_gradients.css +8 -8
- package/css/reset/_reset.css +41 -223
- package/css/reset/_text.css +14 -29
- package/css/reset/_theme.css +315 -32
- package/css/reset/index.css +4 -4
- package/css/styles.css +7 -6
- package/css/theme/_colors.css +320 -0
- package/css/theme/_utilities.css +530 -0
- package/css/theme/index.css +44 -0
- package/dist/cjs/components/actionLabel/ActionLabel.js +3 -3
- package/dist/cjs/components/animations/Animations.js +29 -18
- package/dist/cjs/components/avatar/Avatar.js +10 -13
- package/dist/cjs/components/avatar/AvatarGroup.js +3 -3
- package/dist/cjs/components/badge/Badge.js +5 -5
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +10 -8
- package/dist/cjs/components/button/Button.js +18 -14
- package/dist/cjs/components/button/ButtonGroup.js +4 -3
- package/dist/cjs/components/button/ConfirmButton.js +7 -2
- package/dist/cjs/components/button/ToggleButtonGroup.js +3 -3
- package/dist/cjs/components/callout/Callout.js +15 -4
- package/dist/cjs/components/card/Card.js +8 -7
- package/dist/cjs/components/card/CardCover.js +10 -5
- package/dist/cjs/components/chip/Chip.js +11 -7
- package/dist/cjs/components/collapsable/Collapsable.js +5 -5
- package/dist/cjs/components/divider/Divider.js +10 -7
- package/dist/cjs/components/dropdown/Dropdown.js +5 -4
- package/dist/cjs/components/dropdown/DropdownTool.js +4 -3
- package/dist/cjs/components/icon/Icon.js +15 -14
- package/dist/cjs/components/media/Media.js +116 -75
- 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 +30 -16
- package/dist/cjs/components/meter/Meter.js +2 -3
- package/dist/cjs/components/navigator/Navigator.js +16 -9
- package/dist/cjs/components/panel/Panel.js +10 -9
- package/dist/cjs/components/panel/PanelGroup.js +1 -2
- package/dist/cjs/components/progress/ProgressBar.js +6 -5
- package/dist/cjs/components/progress/ProgressCircle.js +6 -4
- package/dist/cjs/components/tabpanel/Tab.js +58 -38
- package/dist/cjs/components/tabpanel/TabPanel.js +20 -16
- package/dist/cjs/core/aside/Aside.js +11 -10
- package/dist/cjs/core/boundary/ErrorBoundary.js +6 -7
- package/dist/cjs/core/boundary/ErrorIcon.js +1 -2
- package/dist/cjs/core/content/Content.js +9 -7
- package/dist/cjs/core/headfoot/HeadFoot.js +2 -20
- package/dist/cjs/core/page/Page.js +3 -3
- package/dist/cjs/core/responsive/Responsive.js +3 -4
- package/dist/cjs/core/section/Section.js +1 -2
- package/dist/cjs/core/theme/ThemeProvider.js +7 -8
- package/dist/cjs/core/viewport/Viewport.js +4 -2
- package/dist/cjs/hooks/useNavigator.js +6 -4
- package/dist/cjs/hotkeys/HotKeyLabel.js +1 -1
- package/dist/cjs/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/cjs/index.js +6 -2
- package/dist/cjs/overlays/alert/Alert.js +19 -13
- package/dist/cjs/overlays/flyout/Flyout.js +42 -44
- package/dist/cjs/overlays/message/Message.js +6 -3
- package/dist/cjs/overlays/modal/Modal.js +9 -10
- package/dist/cjs/overlays/toast/Toast.js +17 -9
- package/dist/cjs/overlays/tooltip/Tooltip.js +20 -8
- package/dist/cjs/types/icons.js +4 -0
- package/dist/cjs/typography/Abbr.js +2 -3
- package/dist/cjs/typography/{Link.js → Anchor.js} +5 -4
- package/dist/cjs/typography/Mark.js +2 -3
- package/dist/cjs/typography/Text.js +3 -4
- package/dist/cjs/typography/Title.js +3 -3
- package/dist/cjs/utils/cloneElement.js +44 -0
- package/dist/cjs/utils/getColor.js +1 -18
- package/dist/esm/components/actionLabel/ActionLabel.js +3 -3
- package/dist/esm/components/animations/Animations.js +30 -19
- package/dist/esm/components/avatar/Avatar.js +11 -14
- package/dist/esm/components/avatar/AvatarGroup.js +3 -3
- package/dist/esm/components/badge/Badge.js +5 -5
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +10 -8
- package/dist/esm/components/button/Button.js +18 -14
- package/dist/esm/components/button/ButtonGroup.js +5 -4
- package/dist/esm/components/button/ConfirmButton.js +7 -2
- package/dist/esm/components/button/ToggleButtonGroup.js +4 -4
- package/dist/esm/components/callout/Callout.js +15 -4
- package/dist/esm/components/card/Card.js +8 -7
- package/dist/esm/components/card/CardCover.js +10 -5
- package/dist/esm/components/chip/Chip.js +12 -8
- package/dist/esm/components/collapsable/Collapsable.js +5 -5
- package/dist/esm/components/divider/Divider.js +11 -8
- package/dist/esm/components/dropdown/Dropdown.js +5 -4
- package/dist/esm/components/dropdown/DropdownTool.js +4 -3
- package/dist/esm/components/icon/Icon.js +15 -14
- package/dist/esm/components/media/Media.js +117 -76
- 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 +24 -10
- package/dist/esm/components/meter/Meter.js +2 -3
- package/dist/esm/components/navigator/Navigator.js +16 -9
- package/dist/esm/components/panel/Panel.js +10 -9
- package/dist/esm/components/panel/PanelGroup.js +1 -2
- package/dist/esm/components/progress/ProgressBar.js +6 -5
- package/dist/esm/components/progress/ProgressCircle.js +6 -4
- package/dist/esm/components/tabpanel/Tab.js +59 -39
- package/dist/esm/components/tabpanel/TabPanel.js +20 -16
- package/dist/esm/core/aside/Aside.js +11 -10
- package/dist/esm/core/boundary/ErrorBoundary.js +6 -7
- package/dist/esm/core/boundary/ErrorIcon.js +1 -2
- package/dist/esm/core/content/Content.js +9 -7
- package/dist/esm/core/headfoot/HeadFoot.js +2 -20
- package/dist/esm/core/page/Page.js +3 -3
- package/dist/esm/core/responsive/Responsive.js +3 -4
- package/dist/esm/core/section/Section.js +1 -2
- package/dist/esm/core/theme/ThemeProvider.js +7 -8
- package/dist/esm/core/viewport/Viewport.js +4 -2
- package/dist/esm/hooks/useNavigator.js +7 -5
- package/dist/esm/hotkeys/HotKeyLabel.js +1 -1
- package/dist/esm/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/overlays/alert/Alert.js +20 -14
- package/dist/esm/overlays/flyout/Flyout.js +43 -45
- package/dist/esm/overlays/message/Message.js +7 -4
- package/dist/esm/overlays/modal/Modal.js +10 -11
- package/dist/esm/overlays/toast/Toast.js +18 -10
- package/dist/esm/overlays/tooltip/Tooltip.js +20 -8
- package/dist/esm/types/icons.js +4 -0
- package/dist/esm/typography/Abbr.js +2 -3
- package/dist/esm/typography/{Link.js → Anchor.js} +6 -5
- package/dist/esm/typography/Mark.js +2 -3
- package/dist/esm/typography/Text.js +4 -5
- package/dist/esm/typography/Title.js +4 -4
- package/dist/esm/utils/cloneElement.js +44 -0
- package/dist/esm/utils/getColor.js +2 -16
- package/dist/types/components/actionLabel/ActionLabel.d.ts +2 -2
- package/dist/types/components/animations/Animations.d.ts +5 -5
- package/dist/types/components/avatar/Avatar.d.ts +3 -3
- 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 +7 -5
- package/dist/types/components/button/ButtonGroup.d.ts +2 -2
- package/dist/types/components/button/ConfirmButton.d.ts +6 -1
- package/dist/types/components/callout/Callout.d.ts +2 -2
- package/dist/types/components/card/Card.d.ts +3 -3
- package/dist/types/components/chip/Chip.d.ts +3 -3
- package/dist/types/components/collapsable/Collapsable.d.ts +5 -1
- package/dist/types/components/divider/Divider.d.ts +7 -3
- package/dist/types/components/dropdown/DropdownTool.d.ts +2 -1
- package/dist/types/components/icon/Icon.d.ts +3 -3
- 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/menu/types.d.ts +2 -2
- package/dist/types/components/navigator/Navigator.d.ts +4 -4
- package/dist/types/components/progress/ProgressBar.d.ts +2 -2
- package/dist/types/components/progress/ProgressCircle.d.ts +2 -2
- package/dist/types/components/tabpanel/Tab.d.ts +5 -5
- package/dist/types/components/tabpanel/TabPanel.d.ts +10 -1
- package/dist/types/core/content/Content.d.ts +3 -2
- package/dist/types/core/headfoot/HeadFoot.d.ts +1 -9
- package/dist/types/core/responsive/Responsive.d.ts +1 -1
- package/dist/types/core/theme/ThemeProvider.d.ts +4 -4
- package/dist/types/hooks/useOverlayService.d.ts +3 -5
- package/dist/types/index.d.ts +3 -0
- package/dist/types/overlays/alert/Alert.d.ts +2 -2
- package/dist/types/overlays/flyout/Flyout.d.ts +3 -2
- package/dist/types/overlays/message/Message.d.ts +2 -2
- package/dist/types/overlays/modal/Modal.d.ts +4 -3
- package/dist/types/overlays/toast/Toast.d.ts +2 -2
- package/dist/types/overlays/tooltip/Tooltip.d.ts +1 -1
- package/dist/types/types/icons.d.ts +4 -0
- package/dist/types/types/index.d.ts +18 -6
- package/dist/types/typography/Abbr.d.ts +6 -2
- package/dist/types/typography/Anchor.d.ts +25 -0
- package/dist/types/typography/Mark.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/getColor.d.ts +1 -4
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +7 -9
- package/src/components/actionLabel/ActionLabel.tsx +15 -6
- package/src/components/animations/Animations.tsx +29 -23
- package/src/components/avatar/Avatar.tsx +74 -88
- package/src/components/avatar/AvatarGroup.tsx +4 -4
- package/src/components/badge/Badge.tsx +11 -7
- package/src/components/breadcrumbs/Breadcrumbs.tsx +13 -9
- package/src/components/button/Button.tsx +27 -22
- package/src/components/button/ButtonGroup.tsx +7 -7
- package/src/components/button/ConfirmButton.tsx +15 -5
- package/src/components/button/ToggleButtonGroup.tsx +5 -5
- package/src/components/callout/Callout.tsx +26 -11
- package/src/components/card/Card.tsx +10 -7
- package/src/components/card/CardCover.tsx +11 -6
- package/src/components/chip/Chip.tsx +17 -13
- package/src/components/collapsable/Collapsable.tsx +9 -4
- package/src/components/divider/Divider.tsx +15 -10
- package/src/components/dropdown/Dropdown.tsx +5 -5
- package/src/components/dropdown/DropdownTool.tsx +5 -3
- package/src/components/icon/Icon.tsx +55 -67
- package/src/components/media/Media.tsx +141 -106
- package/src/components/menu/ContextMenu.tsx +36 -11
- package/src/components/menu/Menu.tsx +51 -30
- package/src/components/menu/MenuItem.tsx +19 -9
- package/src/components/menu/types.ts +2 -2
- package/src/components/meter/Meter.tsx +2 -3
- package/src/components/navigator/Navigator.tsx +19 -5
- package/src/components/panel/Panel.tsx +10 -9
- package/src/components/panel/PanelGroup.tsx +1 -2
- package/src/components/progress/ProgressBar.tsx +8 -9
- package/src/components/progress/ProgressCircle.tsx +6 -9
- package/src/components/tabpanel/Tab.tsx +81 -64
- package/src/components/tabpanel/TabPanel.tsx +34 -12
- package/src/core/aside/Aside.tsx +11 -10
- package/src/core/boundary/ErrorBoundary.tsx +8 -7
- package/src/core/boundary/ErrorIcon.tsx +1 -2
- package/src/core/content/Content.tsx +17 -12
- package/src/core/headfoot/HeadFoot.tsx +2 -35
- package/src/core/page/Page.tsx +3 -3
- package/src/core/responsive/Responsive.tsx +8 -7
- package/src/core/section/Section.tsx +1 -2
- package/src/core/theme/ThemeProvider.tsx +11 -12
- package/src/core/viewport/Viewport.tsx +1 -2
- package/src/hooks/useNavigator.tsx +10 -5
- package/src/hooks/useOverlayService.tsx +12 -6
- package/src/hotkeys/HotKeyLabel.tsx +1 -1
- package/src/hotkeys/HotKeyWrapper.tsx +3 -1
- package/src/index.ts +4 -0
- package/src/overlays/alert/Alert.tsx +25 -31
- package/src/overlays/flyout/Flyout.tsx +65 -64
- package/src/overlays/message/Message.tsx +10 -7
- package/src/overlays/modal/Modal.tsx +18 -13
- package/src/overlays/toast/Toast.tsx +18 -27
- package/src/overlays/tooltip/Tooltip.tsx +30 -9
- package/src/types/icons.ts +9 -0
- package/src/types/index.ts +240 -27
- package/src/typography/Abbr.tsx +15 -9
- package/src/typography/{Link.tsx → Anchor.tsx} +8 -13
- package/src/typography/Mark.tsx +4 -9
- package/src/typography/Text.tsx +4 -12
- package/src/typography/Title.tsx +2 -6
- package/src/typography/index.ts +1 -1
- package/src/utils/cloneElement.ts +44 -0
- package/src/utils/getColor.ts +1 -17
- package/src/utils/index.ts +1 -0
- package/css/index.js +0 -250
- package/css/tailwind/colors.ts +0 -158
- package/dist/cjs/components/actionLabel/ActionLabel.module.css +0 -1
- package/dist/cjs/components/animations/Animations.module.css +0 -1
- package/dist/cjs/components/avatar/Avatar.module.css +0 -1
- package/dist/cjs/components/badge/Badge.module.css +0 -1
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.module.css +0 -1
- package/dist/cjs/components/button/Button.module.css +0 -1
- package/dist/cjs/components/card/Card.module.css +0 -1
- package/dist/cjs/components/chip/Chip.module.css +0 -1
- package/dist/cjs/components/collapsable/Collapsable.module.css +0 -1
- package/dist/cjs/components/dropdown/Dropdown.module.css +0 -1
- package/dist/cjs/components/icon/Icon.module.css +0 -1
- package/dist/cjs/components/media/Media.module.css +0 -1
- package/dist/cjs/components/menu/Menu.module.css +0 -1
- package/dist/cjs/components/meter/Meter.module.css +0 -1
- package/dist/cjs/components/panel/Panel.module.css +0 -1
- package/dist/cjs/components/progress/Progress.module.css +0 -1
- package/dist/cjs/components/tabpanel/TabPanel.module.css +0 -1
- package/dist/cjs/core/aside/Aside.module.css +0 -1
- package/dist/cjs/core/boundary/ErrorBoundary.module.css +0 -1
- package/dist/cjs/core/content/Content.module.css +0 -1
- package/dist/cjs/core/headfoot/HeadFoot.module.css +0 -1
- package/dist/cjs/core/page/Page.module.css +0 -1
- package/dist/cjs/core/responsive/Responsive.module.css +0 -1
- package/dist/cjs/core/section/Section.module.css +0 -1
- package/dist/cjs/core/theme/Theme.module.css +0 -1
- package/dist/cjs/core/viewport/Viewport.module.css +0 -1
- package/dist/cjs/overlays/alert/Alert.module.css +0 -1
- package/dist/cjs/overlays/flyout/Flyout.module.css +0 -1
- package/dist/cjs/overlays/message/Message.module.css +0 -1
- package/dist/cjs/overlays/modal/Modal.module.css +0 -1
- package/dist/cjs/overlays/toast/Toast.module.css +0 -1
- package/dist/cjs/overlays/tooltip/Tooltip.module.css +0 -1
- package/dist/cjs/typography/Typography.module.css +0 -1
- package/dist/esm/components/actionLabel/ActionLabel.module.css +0 -1
- package/dist/esm/components/animations/Animations.module.css +0 -1
- package/dist/esm/components/avatar/Avatar.module.css +0 -1
- package/dist/esm/components/badge/Badge.module.css +0 -1
- package/dist/esm/components/breadcrumbs/Breadcrumbs.module.css +0 -1
- package/dist/esm/components/button/Button.module.css +0 -1
- package/dist/esm/components/card/Card.module.css +0 -1
- package/dist/esm/components/chip/Chip.module.css +0 -1
- package/dist/esm/components/collapsable/Collapsable.module.css +0 -1
- package/dist/esm/components/dropdown/Dropdown.module.css +0 -1
- package/dist/esm/components/icon/Icon.module.css +0 -1
- package/dist/esm/components/media/Media.module.css +0 -1
- package/dist/esm/components/menu/Menu.module.css +0 -1
- package/dist/esm/components/meter/Meter.module.css +0 -1
- package/dist/esm/components/panel/Panel.module.css +0 -1
- package/dist/esm/components/progress/Progress.module.css +0 -1
- package/dist/esm/components/tabpanel/TabPanel.module.css +0 -1
- package/dist/esm/core/aside/Aside.module.css +0 -1
- package/dist/esm/core/boundary/ErrorBoundary.module.css +0 -1
- package/dist/esm/core/content/Content.module.css +0 -1
- package/dist/esm/core/headfoot/HeadFoot.module.css +0 -1
- package/dist/esm/core/page/Page.module.css +0 -1
- package/dist/esm/core/responsive/Responsive.module.css +0 -1
- package/dist/esm/core/section/Section.module.css +0 -1
- package/dist/esm/core/theme/Theme.module.css +0 -1
- package/dist/esm/core/viewport/Viewport.module.css +0 -1
- package/dist/esm/overlays/alert/Alert.module.css +0 -1
- package/dist/esm/overlays/flyout/Flyout.module.css +0 -1
- package/dist/esm/overlays/message/Message.module.css +0 -1
- package/dist/esm/overlays/modal/Modal.module.css +0 -1
- package/dist/esm/overlays/toast/Toast.module.css +0 -1
- package/dist/esm/overlays/tooltip/Tooltip.module.css +0 -1
- package/dist/esm/typography/Typography.module.css +0 -1
- package/dist/types/typography/Link.d.ts +0 -25
- package/src/overlays/tooltip/Tooltip.module.css +0 -53
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
import { getImageColorset } from "@react-fabric/utilities";
|
|
25
25
|
import classNames from "classnames";
|
|
26
|
-
import {
|
|
27
|
-
import { type AriaProps, type CssProp } from "../../types";
|
|
26
|
+
import { Fragment, useEffect, useRef, useState } from "react";
|
|
27
|
+
import { type AriaProps, type CssProp, type TestProps } from "../../types";
|
|
28
28
|
import { CoreIcons } from "../../types/icons";
|
|
29
29
|
import { Button } from "../button/Button";
|
|
30
|
-
import
|
|
30
|
+
import { Icon } from "../icon/Icon";
|
|
31
31
|
|
|
32
|
-
export interface BaseProps extends CssProp, AriaProps {
|
|
32
|
+
export interface BaseProps extends CssProp, TestProps, AriaProps {
|
|
33
33
|
/**
|
|
34
34
|
* media source
|
|
35
35
|
*/
|
|
@@ -44,6 +44,12 @@ export interface BaseProps extends CssProp, AriaProps {
|
|
|
44
44
|
fit?: "cover" | "contain" | "fill";
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
const cover = {
|
|
48
|
+
fill: "object-fill",
|
|
49
|
+
cover: "object-cover",
|
|
50
|
+
contain: "object-contain",
|
|
51
|
+
};
|
|
52
|
+
|
|
47
53
|
export interface ImageProps extends BaseProps {
|
|
48
54
|
/**
|
|
49
55
|
* image alt text
|
|
@@ -65,6 +71,17 @@ export interface VideoProps extends BaseProps {
|
|
|
65
71
|
playOnHover?: boolean;
|
|
66
72
|
}
|
|
67
73
|
|
|
74
|
+
const loadIndicator = (
|
|
75
|
+
<div
|
|
76
|
+
className={classNames(
|
|
77
|
+
"fabric-mediaPlaceholder",
|
|
78
|
+
"absolute z-1 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-4xl text-gray animate-pulse",
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
81
|
+
●●●
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
|
|
68
85
|
export const Image = ({
|
|
69
86
|
src,
|
|
70
87
|
alt,
|
|
@@ -74,47 +91,50 @@ export const Image = ({
|
|
|
74
91
|
...aria
|
|
75
92
|
}: ImageProps) => {
|
|
76
93
|
const [colorSet, setColorSet] = useState("light");
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)}
|
|
84
|
-
>
|
|
85
|
-
●●●
|
|
86
|
-
</div>
|
|
87
|
-
),
|
|
88
|
-
[src],
|
|
89
|
-
);
|
|
94
|
+
const [loaded, setLoaded] = useState(false);
|
|
95
|
+
const [errored, setErrored] = useState(false);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
setLoaded(false);
|
|
98
|
+
setErrored(false);
|
|
99
|
+
}, [src]);
|
|
90
100
|
return (
|
|
91
101
|
<div
|
|
92
102
|
data-ref="image"
|
|
93
103
|
className={classNames(
|
|
94
|
-
|
|
95
|
-
"relative overflow-hidden
|
|
96
|
-
reel &&
|
|
104
|
+
"fabric-mediaContainer",
|
|
105
|
+
"relative overflow-hidden inline-block",
|
|
106
|
+
reel && "fabric-mediaReel",
|
|
97
107
|
className,
|
|
98
108
|
)}
|
|
99
109
|
data-colorset={colorSet}
|
|
100
110
|
{...aria}
|
|
101
111
|
>
|
|
102
|
-
{loadIndicator}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
e
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
{!loaded && !errored && loadIndicator}
|
|
113
|
+
{!errored && (
|
|
114
|
+
<img
|
|
115
|
+
alt={alt ?? src}
|
|
116
|
+
src={src}
|
|
117
|
+
loading="lazy"
|
|
118
|
+
crossOrigin="anonymous"
|
|
119
|
+
className={classNames(
|
|
120
|
+
"fabric-media",
|
|
121
|
+
"pointer-events-none w-full h-full",
|
|
122
|
+
cover[fit],
|
|
123
|
+
)}
|
|
124
|
+
onLoad={(e) => {
|
|
125
|
+
setLoaded(true);
|
|
126
|
+
setColorSet(getImageColorset(e.currentTarget));
|
|
127
|
+
}}
|
|
128
|
+
onError={() => setErrored(true)}
|
|
129
|
+
/>
|
|
130
|
+
)}
|
|
131
|
+
{errored && (
|
|
132
|
+
<Icon
|
|
133
|
+
size="2rem"
|
|
134
|
+
className="absolute text-tint-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
135
|
+
icon={CoreIcons.mediaImageBroken}
|
|
136
|
+
/>
|
|
137
|
+
)}
|
|
118
138
|
</div>
|
|
119
139
|
);
|
|
120
140
|
};
|
|
@@ -130,17 +150,27 @@ export const Video = ({
|
|
|
130
150
|
...aria
|
|
131
151
|
}: VideoProps) => {
|
|
132
152
|
const videoRef = useRef<HTMLVideoElement>(null);
|
|
153
|
+
const [loaded, setLoaded] = useState(false);
|
|
154
|
+
const [errored, setErrored] = useState(false);
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
setLoaded(false);
|
|
157
|
+
setErrored(false);
|
|
158
|
+
}, [src]);
|
|
133
159
|
|
|
134
160
|
const [state, setState] = useState(true);
|
|
135
161
|
const [volume, setVolume] = useState(false);
|
|
136
162
|
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
setErrored(false);
|
|
165
|
+
}, [src]);
|
|
166
|
+
|
|
137
167
|
return (
|
|
138
168
|
<div
|
|
139
169
|
data-ref="video"
|
|
140
170
|
className={classNames(
|
|
141
|
-
|
|
142
|
-
"relative overflow-hidden
|
|
143
|
-
reel &&
|
|
171
|
+
"fabric-mediaContainer",
|
|
172
|
+
"relative overflow-hidden inline-block",
|
|
173
|
+
reel && "fabric-mediaReel",
|
|
144
174
|
className,
|
|
145
175
|
)}
|
|
146
176
|
onMouseEnter={() => {
|
|
@@ -151,74 +181,79 @@ export const Video = ({
|
|
|
151
181
|
}}
|
|
152
182
|
{...aria}
|
|
153
183
|
>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
184
|
+
{!loaded && !errored && loadIndicator}
|
|
185
|
+
{!errored && (
|
|
186
|
+
<Fragment>
|
|
187
|
+
<video
|
|
188
|
+
loop
|
|
189
|
+
ref={videoRef}
|
|
190
|
+
controls={false}
|
|
191
|
+
poster={poster}
|
|
192
|
+
autoPlay={autoPlay}
|
|
193
|
+
className={classNames(
|
|
194
|
+
"fabric-media",
|
|
195
|
+
"pointer-events-none w-full h-full",
|
|
196
|
+
fit && `object-${fit}`,
|
|
197
|
+
)}
|
|
198
|
+
onPlay={() => setState(true)}
|
|
199
|
+
onPause={() => setState(false)}
|
|
200
|
+
onVolumeChange={(e) => setVolume(!!e.currentTarget.volume)}
|
|
201
|
+
onLoadedData={(e) => {
|
|
202
|
+
e.currentTarget.volume = 0;
|
|
203
|
+
setLoaded(true);
|
|
204
|
+
}}
|
|
205
|
+
onError={() => setErrored(true)}
|
|
206
|
+
>
|
|
207
|
+
<source src={src} />
|
|
208
|
+
<track kind="captions" />
|
|
209
|
+
</video>
|
|
210
|
+
<div
|
|
211
|
+
data-inner-clickable
|
|
212
|
+
className={classNames(
|
|
213
|
+
"fabric-mediaControls",
|
|
214
|
+
"absolute bottom-6 end-6 rounded-full flex flex-col",
|
|
215
|
+
)}
|
|
216
|
+
>
|
|
217
|
+
<Button
|
|
218
|
+
rounded
|
|
219
|
+
variant="link"
|
|
220
|
+
className={"fabric-mediaControlPlaceholder"}
|
|
221
|
+
icon={CoreIcons.ellipsis}
|
|
222
|
+
aria-label="controls"
|
|
223
|
+
/>
|
|
224
|
+
<Button
|
|
225
|
+
rounded
|
|
226
|
+
variant="link"
|
|
227
|
+
aria-label="controls"
|
|
228
|
+
className={"fabric-mediaControlAction"}
|
|
229
|
+
onClick={() => {
|
|
230
|
+
videoRef.current &&
|
|
231
|
+
(videoRef.current.volume = videoRef.current.volume ? 0 : 1);
|
|
232
|
+
}}
|
|
233
|
+
icon={volume ? CoreIcons.volumeOn : CoreIcons.volumeOff}
|
|
234
|
+
/>
|
|
235
|
+
<Button
|
|
236
|
+
rounded
|
|
237
|
+
variant="link"
|
|
238
|
+
aria-label="controls"
|
|
239
|
+
className={"fabric-mediaControlAction"}
|
|
240
|
+
onClick={() => {
|
|
241
|
+
videoRef.current?.paused
|
|
242
|
+
? videoRef.current?.play()
|
|
243
|
+
: videoRef.current?.pause();
|
|
244
|
+
}}
|
|
245
|
+
icon={state ? CoreIcons.pause : CoreIcons.play}
|
|
246
|
+
/>
|
|
247
|
+
</div>
|
|
248
|
+
</Fragment>
|
|
249
|
+
)}
|
|
250
|
+
{errored && (
|
|
251
|
+
<Icon
|
|
252
|
+
size="2rem"
|
|
253
|
+
className="absolute text-tint-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
254
|
+
icon={CoreIcons.mediaVideoBroken}
|
|
220
255
|
/>
|
|
221
|
-
|
|
256
|
+
)}
|
|
222
257
|
</div>
|
|
223
258
|
);
|
|
224
259
|
};
|
|
@@ -29,30 +29,41 @@ import {
|
|
|
29
29
|
useClick,
|
|
30
30
|
useDismiss,
|
|
31
31
|
useFloating,
|
|
32
|
+
useFloatingNodeId,
|
|
32
33
|
useInteractions,
|
|
33
34
|
} from "@floating-ui/react";
|
|
34
|
-
import { cloneElement, useRef, useState } from "react";
|
|
35
|
+
import { cloneElement, useEffect, useRef, useState } from "react";
|
|
35
36
|
import { type ChildrenProp } from "../../types";
|
|
36
37
|
import { type Menu } from "./Menu";
|
|
37
38
|
|
|
38
39
|
export interface ContextMenuProps extends ChildrenProp {
|
|
39
40
|
menu: React.ReactElement<typeof Menu>;
|
|
41
|
+
|
|
42
|
+
disabled?: boolean;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
export const ContextMenu = ({ children, menu }: ContextMenuProps) => {
|
|
45
|
+
export const ContextMenu = ({ children, menu, disabled }: ContextMenuProps) => {
|
|
43
46
|
const [isOpen, setIsOpen] = useState(false);
|
|
47
|
+
const nodeId = useFloatingNodeId();
|
|
44
48
|
|
|
45
49
|
const { refs, floatingStyles, context } = useFloating({
|
|
46
50
|
open: isOpen,
|
|
47
|
-
|
|
51
|
+
nodeId,
|
|
52
|
+
onOpenChange: (open, evt, reason) => {
|
|
53
|
+
const target = evt?.target as HTMLElement;
|
|
54
|
+
if (!target?.closest(".menu-list")) setIsOpen(open);
|
|
55
|
+
},
|
|
48
56
|
strategy: "fixed",
|
|
49
57
|
placement: "bottom-start",
|
|
50
58
|
whileElementsMounted: autoUpdate,
|
|
51
59
|
middleware: [offset(8), flip()],
|
|
52
60
|
});
|
|
53
61
|
|
|
54
|
-
const click = useClick(context, {
|
|
55
|
-
|
|
62
|
+
const click = useClick(context, {
|
|
63
|
+
toggle: true,
|
|
64
|
+
ignoreMouse: true,
|
|
65
|
+
});
|
|
66
|
+
const dismiss = useDismiss(context, { bubbles: true });
|
|
56
67
|
|
|
57
68
|
const { getFloatingProps } = useInteractions([dismiss, click]);
|
|
58
69
|
|
|
@@ -78,10 +89,19 @@ export const ContextMenu = ({ children, menu }: ContextMenuProps) => {
|
|
|
78
89
|
return false;
|
|
79
90
|
});
|
|
80
91
|
|
|
81
|
-
const wrapperRef = useRef(
|
|
82
|
-
|
|
83
|
-
el
|
|
84
|
-
|
|
92
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const el = wrapperRef.current;
|
|
95
|
+
if (el && !disabled) {
|
|
96
|
+
el?.parentElement?.addEventListener("contextmenu", handleClick.current);
|
|
97
|
+
return () => {
|
|
98
|
+
el?.parentElement?.removeEventListener(
|
|
99
|
+
"contextmenu",
|
|
100
|
+
handleClick.current,
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}, [disabled]);
|
|
85
105
|
|
|
86
106
|
const tryClosing = useRef((e: React.MouseEvent) => {
|
|
87
107
|
if ((e.target as HTMLElement)?.closest("[data-dropdown-dismiss='true']"))
|
|
@@ -91,12 +111,17 @@ export const ContextMenu = ({ children, menu }: ContextMenuProps) => {
|
|
|
91
111
|
return (
|
|
92
112
|
<div
|
|
93
113
|
className="contents"
|
|
94
|
-
ref={wrapperRef
|
|
114
|
+
ref={wrapperRef}
|
|
95
115
|
onMouseUpCapture={tryClosing.current}
|
|
96
116
|
>
|
|
97
117
|
{children}
|
|
98
118
|
{isOpen && (
|
|
99
|
-
<FloatingPortal
|
|
119
|
+
<FloatingPortal
|
|
120
|
+
root={
|
|
121
|
+
refs.domReference.current?.closest<HTMLElement>(".theme-base") ??
|
|
122
|
+
undefined
|
|
123
|
+
}
|
|
124
|
+
>
|
|
100
125
|
{cloneElement(menu as AnyObject, {
|
|
101
126
|
...getFloatingProps(),
|
|
102
127
|
style: {
|
|
@@ -48,7 +48,6 @@ import {
|
|
|
48
48
|
import { mergeRefs } from "@react-fabric/utilities";
|
|
49
49
|
import classNames from "classnames";
|
|
50
50
|
import {
|
|
51
|
-
Children,
|
|
52
51
|
cloneElement,
|
|
53
52
|
Fragment,
|
|
54
53
|
useCallback,
|
|
@@ -56,8 +55,9 @@ import {
|
|
|
56
55
|
useRef,
|
|
57
56
|
useState,
|
|
58
57
|
} from "react";
|
|
58
|
+
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
59
59
|
import { CoreIcons } from "../../types/icons";
|
|
60
|
-
import { nodeCheck } from "../../utils";
|
|
60
|
+
import { cloneChildren, nodeCheck } from "../../utils";
|
|
61
61
|
import { MenuItem } from "./MenuItem";
|
|
62
62
|
import { type MenuProps } from "./types";
|
|
63
63
|
|
|
@@ -104,8 +104,9 @@ const MenuComponent = ({
|
|
|
104
104
|
handleClose: safePolygon({ blockPointerEvents: true }),
|
|
105
105
|
});
|
|
106
106
|
const click = useClick(context, {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
event: "mousedown",
|
|
108
|
+
toggle: !isNested,
|
|
109
|
+
ignoreMouse: isNested,
|
|
109
110
|
});
|
|
110
111
|
const role = useRole(context, { role: "menu" });
|
|
111
112
|
const dismiss = useDismiss(context, { bubbles: true });
|
|
@@ -187,6 +188,16 @@ const MenuComponent = ({
|
|
|
187
188
|
);
|
|
188
189
|
}, [isOpen]);
|
|
189
190
|
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if ((!isNested || isOpen) && activeIndex) {
|
|
193
|
+
setTimeout(() => {
|
|
194
|
+
elementsRef.current[activeIndex]?.scrollIntoView({
|
|
195
|
+
block: "nearest",
|
|
196
|
+
});
|
|
197
|
+
}, 100);
|
|
198
|
+
}
|
|
199
|
+
}, [isOpen, activeIndex]);
|
|
200
|
+
|
|
190
201
|
return (
|
|
191
202
|
<FloatingNode id={nodeId}>
|
|
192
203
|
{isNested && (
|
|
@@ -210,29 +221,29 @@ const MenuComponent = ({
|
|
|
210
221
|
{(!isNested || isOpen) && (
|
|
211
222
|
<Wrapper {...wrapperProps}>
|
|
212
223
|
{isNested && <FloatingOverlay />}
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<div
|
|
220
|
-
className={classNames(
|
|
221
|
-
menuClassName,
|
|
222
|
-
"flex flex-col bg-base p-1 menu-list",
|
|
223
|
-
isNested &&
|
|
224
|
-
"outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-[var(--z-popover)]",
|
|
225
|
-
)}
|
|
226
|
-
autoFocus
|
|
227
|
-
ref={mergeRefs(refs.setFloating, isNested ? undefined : ref)}
|
|
228
|
-
{...getFloatingProps({
|
|
229
|
-
onClick: isNested ? undefined : handleClick,
|
|
230
|
-
})}
|
|
231
|
-
// @ts-expect-error ignore
|
|
232
|
-
{...{ style: !isNested ? rest.style : floatingStyles }}
|
|
224
|
+
<HotKeyWrapper>
|
|
225
|
+
<FloatingFocusManager
|
|
226
|
+
context={context}
|
|
227
|
+
modal={!isNested}
|
|
228
|
+
initialFocus={isNested ? -1 : 0}
|
|
229
|
+
returnFocus={!isNested}
|
|
233
230
|
>
|
|
234
|
-
|
|
235
|
-
|
|
231
|
+
<div
|
|
232
|
+
className={classNames(
|
|
233
|
+
menuClassName,
|
|
234
|
+
"flex flex-col bg-base p-1 menu-list",
|
|
235
|
+
isNested &&
|
|
236
|
+
"outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-(--z-popover)",
|
|
237
|
+
)}
|
|
238
|
+
autoFocus
|
|
239
|
+
ref={mergeRefs(isNested ? refs.setFloating : ref)}
|
|
240
|
+
{...getFloatingProps({
|
|
241
|
+
onClick: isNested ? undefined : handleClick,
|
|
242
|
+
})}
|
|
243
|
+
// @ts-expect-error ignore
|
|
244
|
+
{...{ style: !isNested ? rest.style : floatingStyles }}
|
|
245
|
+
>
|
|
246
|
+
{cloneChildren(children, (child: AnyObject, index) => {
|
|
236
247
|
labelsRef.current[index] = child.props.label;
|
|
237
248
|
return cloneElement(
|
|
238
249
|
child,
|
|
@@ -249,10 +260,10 @@ const MenuComponent = ({
|
|
|
249
260
|
}
|
|
250
261
|
: {},
|
|
251
262
|
);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
</
|
|
255
|
-
</
|
|
263
|
+
})}
|
|
264
|
+
</div>
|
|
265
|
+
</FloatingFocusManager>
|
|
266
|
+
</HotKeyWrapper>
|
|
256
267
|
</Wrapper>
|
|
257
268
|
)}
|
|
258
269
|
</FloatingList>
|
|
@@ -262,6 +273,16 @@ const MenuComponent = ({
|
|
|
262
273
|
|
|
263
274
|
export const Menu = (props: MenuProps) => {
|
|
264
275
|
const parentId = useFloatingParentNodeId();
|
|
276
|
+
const tree = useFloatingTree();
|
|
277
|
+
|
|
278
|
+
if (tree) {
|
|
279
|
+
return (
|
|
280
|
+
<MenuComponent
|
|
281
|
+
{...(props as AnyObject)}
|
|
282
|
+
menuClassName={props.className}
|
|
283
|
+
/>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
265
286
|
|
|
266
287
|
if (parentId === null) {
|
|
267
288
|
return (
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { useFloatingTree } from "@floating-ui/react";
|
|
25
|
-
import { iconToken } from "@react-fabric/utilities";
|
|
25
|
+
import { iconToken, mergeRefs } from "@react-fabric/utilities";
|
|
26
26
|
import classNames from "classnames";
|
|
27
|
-
import { Fragment, useCallback, useMemo } from "react";
|
|
27
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from "react";
|
|
28
|
+
import { HotKey } from "../../hotkeys/HotKey";
|
|
28
29
|
import { HotKeyLabel } from "../../hotkeys/HotKeyLabel";
|
|
29
30
|
import { Tooltip } from "../../overlays";
|
|
30
31
|
import { type PolymorphicProps } from "../../types";
|
|
31
32
|
import { Badge, getBadgeProps } from "../badge/Badge";
|
|
32
33
|
import { Icon } from "../icon/Icon";
|
|
33
|
-
import classes from "./Menu.module.css";
|
|
34
34
|
import { type MenuItemProps } from "./types";
|
|
35
35
|
|
|
36
36
|
export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
@@ -50,6 +50,7 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
50
50
|
onClick,
|
|
51
51
|
badge,
|
|
52
52
|
hotKey,
|
|
53
|
+
tabIndex = -1,
|
|
53
54
|
// @ts-expect-error ignore
|
|
54
55
|
minimal,
|
|
55
56
|
// @ts-expect-error ignore
|
|
@@ -58,11 +59,16 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
58
59
|
ref,
|
|
59
60
|
...aria
|
|
60
61
|
}: MenuItemProps & PolymorphicProps<Tag>) => {
|
|
62
|
+
const elRef = useRef<HTMLElement>(null);
|
|
61
63
|
const tree = useFloatingTree();
|
|
62
64
|
const badgeProps = useMemo(() => {
|
|
63
65
|
return getBadgeProps(badge);
|
|
64
66
|
}, [badge]);
|
|
65
67
|
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
tabIndex === 0 && elRef.current?.focus();
|
|
70
|
+
}, [tabIndex]);
|
|
71
|
+
|
|
66
72
|
const iconEl = useMemo(() => {
|
|
67
73
|
let path = icon;
|
|
68
74
|
if (minimal && !path) {
|
|
@@ -70,7 +76,7 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
70
76
|
}
|
|
71
77
|
return (
|
|
72
78
|
<Icon
|
|
73
|
-
className={classNames(
|
|
79
|
+
className={classNames("fabric-menuIcon", minimal && "minimal")}
|
|
74
80
|
icon={path ?? ""}
|
|
75
81
|
bg={iconBg}
|
|
76
82
|
color={iconColor}
|
|
@@ -135,26 +141,30 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
135
141
|
return (
|
|
136
142
|
<Wrapper {...aria}>
|
|
137
143
|
<E
|
|
138
|
-
ref={ref}
|
|
144
|
+
ref={mergeRefs(ref, elRef)}
|
|
139
145
|
data-dropdown-dismiss
|
|
140
146
|
data-color={color}
|
|
141
147
|
className={classNames(
|
|
142
|
-
|
|
148
|
+
"fabric-menuItem cursor-pointer",
|
|
143
149
|
className,
|
|
144
|
-
active &&
|
|
145
|
-
minimal &&
|
|
146
|
-
disabled &&
|
|
150
|
+
active && "active",
|
|
151
|
+
minimal && "minimal",
|
|
152
|
+
disabled && "disabled",
|
|
147
153
|
"rounded-capped relative max-w-[50vw] my-0.5",
|
|
148
154
|
)}
|
|
149
155
|
data-active={active}
|
|
150
156
|
data-open={childOpen}
|
|
151
157
|
disabled={disabled}
|
|
152
158
|
data-id={id}
|
|
159
|
+
tabIndex={tabIndex}
|
|
153
160
|
onClick={(e) => {
|
|
154
161
|
onClick?.(e) !== false && tree?.events.emit("click");
|
|
155
162
|
}}
|
|
156
163
|
{...(minimal ? {} : aria)}
|
|
157
164
|
>
|
|
165
|
+
{hotKey && (
|
|
166
|
+
<HotKey keyCombo={hotKey} handler={() => elRef.current?.click?.()} />
|
|
167
|
+
)}
|
|
158
168
|
{menuLabel}
|
|
159
169
|
</E>
|
|
160
170
|
</Wrapper>
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
type BadgeType,
|
|
28
28
|
type CallbackReturn,
|
|
29
29
|
type ChildrenProp,
|
|
30
|
-
type
|
|
30
|
+
type ColorState,
|
|
31
31
|
type CssProp,
|
|
32
32
|
type IconProps,
|
|
33
33
|
type TestProps,
|
|
@@ -53,7 +53,7 @@ export interface MenuItemProps
|
|
|
53
53
|
/**
|
|
54
54
|
* menu color
|
|
55
55
|
*/
|
|
56
|
-
color?:
|
|
56
|
+
color?: ColorState;
|
|
57
57
|
/**
|
|
58
58
|
* item active
|
|
59
59
|
*/
|
|
@@ -25,7 +25,6 @@ import { Format } from "@react-fabric/utilities";
|
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { useMemoDebugger } from "../../hooks/useEffectDebugger";
|
|
27
27
|
import { type AriaProps, type CssProp, type TestProps } from "../../types";
|
|
28
|
-
import classes from "./Meter.module.css";
|
|
29
28
|
|
|
30
29
|
export interface MeterProps extends CssProp, AriaProps, TestProps {
|
|
31
30
|
/**
|
|
@@ -51,7 +50,7 @@ export const Meter = ({ value, hideLabel, className, ...aria }: MeterProps) => {
|
|
|
51
50
|
return (
|
|
52
51
|
<div
|
|
53
52
|
className={classNames(
|
|
54
|
-
|
|
53
|
+
"fabric-meter",
|
|
55
54
|
className,
|
|
56
55
|
"flex flex-nowrap items-center gap-[2px]",
|
|
57
56
|
)}
|
|
@@ -61,7 +60,7 @@ export const Meter = ({ value, hideLabel, className, ...aria }: MeterProps) => {
|
|
|
61
60
|
<div
|
|
62
61
|
key={step}
|
|
63
62
|
className={classNames(
|
|
64
|
-
|
|
63
|
+
"fabric-meterBar",
|
|
65
64
|
"first-of-type:rounded-s last-of-type:rounded-e bg-tint-100 relative outline -outline-offset-1 outline-muted overflow-hidden after:absolute after:inset-0",
|
|
66
65
|
)}
|
|
67
66
|
data-active={activeCount >= step}
|