@box/blueprint-web 19.6.0 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES +119 -0
- package/dist/lib-esm/accordion/accordion.js +6 -6
- package/dist/lib-esm/accordion/types.d.ts +1 -1
- package/dist/lib-esm/checkbox/checkbox-item.js +3 -3
- package/dist/lib-esm/checkbox/types.d.ts +1 -1
- package/dist/lib-esm/collapsible/collapsible-section.js +5 -5
- package/dist/lib-esm/collapsible/types.d.ts +1 -1
- package/dist/lib-esm/combobox-group/combobox-group-combobox.js +1 -1
- package/dist/lib-esm/date-picker/date-picker.js +8 -7
- package/dist/lib-esm/guided-tooltip/guided-tooltip.js +7 -7
- package/dist/lib-esm/guided-tooltip/types.d.ts +1 -1
- package/dist/lib-esm/modal/alert-modal.types.d.ts +1 -1
- package/dist/lib-esm/modal/modal-close.js +2 -2
- package/dist/lib-esm/modal/modal-content.d.ts +1 -1
- package/dist/lib-esm/modal/modal-content.js +4 -4
- package/dist/lib-esm/modal/modal-description.js +2 -2
- package/dist/lib-esm/modal/modal-title.js +2 -2
- package/dist/lib-esm/modal/modal-trigger.js +2 -2
- package/dist/lib-esm/modal/modal.d.ts +1 -1
- package/dist/lib-esm/modal/modal.js +1 -1
- package/dist/lib-esm/modal/types.d.ts +1 -1
- package/dist/lib-esm/navigation-menu/index.d.ts +4 -2
- package/dist/lib-esm/navigation-menu/navigation-menu-item.d.ts +1 -1
- package/dist/lib-esm/navigation-menu/navigation-menu-trigger.d.ts +3 -1
- package/dist/lib-esm/primitives/chips/chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/chip.js +2 -2
- package/dist/lib-esm/primitives/chips/chips-group.js +2 -2
- package/dist/lib-esm/primitives/chips/filter-chip/filter-chip-button.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/filter-chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/filter-combo-chip.d.ts +2 -2
- package/dist/lib-esm/primitives/chips/filter-chip/filter-trigger-chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/index.d.ts +5 -5
- package/dist/lib-esm/primitives/chips/types.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-item.d.ts +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-item.js +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.js +5 -5
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-header.js +3 -10
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-root.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-trigger.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-trigger.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.js +5 -5
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-root.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.d.ts +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.js +1 -1
- package/dist/lib-esm/primitives/context-menu/index.d.ts +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.js +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.js +5 -5
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-group.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-group.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-item.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.js +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-root.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.js +5 -5
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/index.d.ts +14 -8
- package/dist/lib-esm/primitives/notification/hooks/use-notification-layer.d.ts +15 -0
- package/dist/lib-esm/primitives/notification/hooks/use-notification-layer.js +49 -0
- package/dist/lib-esm/primitives/notification/notification-provider.js +2 -2
- package/dist/lib-esm/primitives/notification/notification.viewport-animated.js +12 -8
- package/dist/lib-esm/primitives/notification/notification.viewport.js +5 -1
- package/dist/lib-esm/primitives/notification/private-notification-element-animated.js +44 -6
- package/dist/lib-esm/primitives/notification/private-notification-element.js +34 -4
- package/dist/lib-esm/primitives/popover/index.d.ts +11 -5
- package/dist/lib-esm/primitives/popover/popover-anchor.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-anchor.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-close.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-close.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-content-container.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-content-container.js +3 -3
- package/dist/lib-esm/primitives/popover/popover-footer.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-main-content.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-root.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-root.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-trigger.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-trigger.js +2 -2
- package/dist/lib-esm/radio-group/index.d.ts +1 -1
- package/dist/lib-esm/radio-group/radio-group.d.ts +1 -1
- package/dist/lib-esm/radio-group/radio-group.js +2 -2
- package/dist/lib-esm/radio-group/radio-item.js +3 -3
- package/dist/lib-esm/radio-group/types.d.ts +1 -1
- package/dist/lib-esm/select/select.js +12 -12
- package/dist/lib-esm/select/types.d.ts +1 -1
- package/dist/lib-esm/select/utils/use-select-exit-animation.d.ts +3 -3
- package/dist/lib-esm/select/utils/use-select-exit-animation.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-close.js +2 -2
- package/dist/lib-esm/side-panel/side-panel-content.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-header.js +2 -2
- package/dist/lib-esm/side-panel/side-panel-overlay.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-trigger.js +2 -2
- package/dist/lib-esm/side-panel/side-panel.js +1 -1
- package/dist/lib-esm/side-panel/types.d.ts +1 -1
- package/dist/lib-esm/switch/switch-item.js +3 -3
- package/dist/lib-esm/switch/types.d.ts +1 -1
- package/dist/lib-esm/toolbar/index.d.ts +2 -2
- package/dist/lib-esm/toolbar/toolbar-button.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-input.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-link.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-root.js +3 -3
- package/dist/lib-esm/toolbar/toolbar-separator.d.ts +1 -1
- package/dist/lib-esm/toolbar/toolbar-separator.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-text-toggle-item.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-group.d.ts +1 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-group.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-item.js +2 -2
- package/dist/lib-esm/toolbar/types.d.ts +1 -1
- package/dist/lib-esm/tooltip/tooltip.d.ts +1 -1
- package/dist/lib-esm/tooltip/tooltip.js +6 -6
- package/dist/lib-esm/tooltip/types.d.ts +1 -1
- package/dist/lib-esm/utils/radix-compat/accordion.d.ts +45 -0
- package/dist/lib-esm/utils/radix-compat/accordion.js +299 -0
- package/dist/lib-esm/utils/radix-compat/allow-auto-focus.d.ts +9 -0
- package/dist/lib-esm/utils/radix-compat/allow-auto-focus.js +16 -0
- package/dist/lib-esm/utils/radix-compat/bubble-input.d.ts +14 -0
- package/dist/lib-esm/utils/radix-compat/bubble-input.js +70 -0
- package/dist/lib-esm/utils/radix-compat/button-controls.d.ts +9 -0
- package/dist/lib-esm/utils/radix-compat/button-controls.js +6 -0
- package/dist/lib-esm/utils/radix-compat/checkbox.d.ts +18 -0
- package/dist/lib-esm/utils/radix-compat/checkbox.js +131 -0
- package/dist/lib-esm/utils/radix-compat/collapsible.d.ts +33 -0
- package/dist/lib-esm/utils/radix-compat/collapsible.js +133 -0
- package/dist/lib-esm/utils/radix-compat/collection.d.ts +21 -0
- package/dist/lib-esm/utils/radix-compat/collection.js +82 -0
- package/dist/lib-esm/utils/radix-compat/compose-refs.d.ts +8 -0
- package/dist/lib-esm/utils/radix-compat/compose-refs.js +44 -0
- package/dist/lib-esm/utils/radix-compat/content-size.d.ts +15 -0
- package/dist/lib-esm/utils/radix-compat/content-size.js +61 -0
- package/dist/lib-esm/utils/radix-compat/context-menu.d.ts +56 -0
- package/dist/lib-esm/utils/radix-compat/context-menu.js +191 -0
- package/dist/lib-esm/utils/radix-compat/dialog.d.ts +50 -0
- package/dist/lib-esm/utils/radix-compat/dialog.js +367 -0
- package/dist/lib-esm/utils/radix-compat/dismiss-marker.d.ts +5 -0
- package/dist/lib-esm/utils/radix-compat/dismiss-marker.js +12 -0
- package/dist/lib-esm/utils/radix-compat/dismissable.d.ts +34 -0
- package/dist/lib-esm/utils/radix-compat/dismissable.js +205 -0
- package/dist/lib-esm/utils/radix-compat/dropdown-menu.d.ts +57 -0
- package/dist/lib-esm/utils/radix-compat/dropdown-menu.js +187 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope-component.d.ts +16 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope-component.js +41 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope.d.ts +37 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope.js +288 -0
- package/dist/lib-esm/utils/radix-compat/hide-others.d.ts +6 -0
- package/dist/lib-esm/utils/radix-compat/hide-others.js +18 -0
- package/dist/lib-esm/utils/radix-compat/index.d.ts +14 -0
- package/dist/lib-esm/utils/radix-compat/layers.d.ts +25 -0
- package/dist/lib-esm/utils/radix-compat/layers.js +61 -0
- package/dist/lib-esm/utils/radix-compat/menu.d.ts +98 -0
- package/dist/lib-esm/utils/radix-compat/menu.js +1041 -0
- package/dist/lib-esm/utils/radix-compat/popover.d.ts +44 -0
- package/dist/lib-esm/utils/radix-compat/popover.js +386 -0
- package/dist/lib-esm/utils/radix-compat/popper.d.ts +60 -0
- package/dist/lib-esm/utils/radix-compat/popper.js +416 -0
- package/dist/lib-esm/utils/radix-compat/portal.d.ts +11 -0
- package/dist/lib-esm/utils/radix-compat/portal.js +20 -0
- package/dist/lib-esm/utils/radix-compat/presence.d.ts +20 -0
- package/dist/lib-esm/utils/radix-compat/presence.js +110 -0
- package/dist/lib-esm/utils/radix-compat/radio-group.d.ts +27 -0
- package/dist/lib-esm/utils/radix-compat/radio-group.js +189 -0
- package/dist/lib-esm/utils/radix-compat/roving-focus.d.ts +35 -0
- package/dist/lib-esm/utils/radix-compat/roving-focus.js +237 -0
- package/dist/lib-esm/utils/radix-compat/select.d.ts +82 -0
- package/dist/lib-esm/utils/radix-compat/select.js +901 -0
- package/dist/lib-esm/utils/radix-compat/slot.d.ts +31 -0
- package/dist/lib-esm/utils/radix-compat/slot.js +119 -0
- package/dist/lib-esm/utils/radix-compat/store-options.d.ts +8 -0
- package/dist/lib-esm/utils/radix-compat/store-options.js +10 -0
- package/dist/lib-esm/utils/radix-compat/switch.d.ts +16 -0
- package/dist/lib-esm/utils/radix-compat/switch.js +97 -0
- package/dist/lib-esm/utils/radix-compat/toggle-group.d.ts +41 -0
- package/dist/lib-esm/utils/radix-compat/toggle-group.js +195 -0
- package/dist/lib-esm/utils/radix-compat/toolbar.d.ts +32 -0
- package/dist/lib-esm/utils/radix-compat/toolbar.js +136 -0
- package/dist/lib-esm/utils/radix-compat/tooltip.d.ts +59 -0
- package/dist/lib-esm/utils/radix-compat/tooltip.js +636 -0
- package/dist/lib-esm/utils/radix-compat/typeahead.d.ts +22 -0
- package/dist/lib-esm/utils/radix-compat/typeahead.js +64 -0
- package/dist/lib-esm/utils/radix-compat/types.d.ts +53 -0
- package/dist/lib-esm/utils/radix-compat/viewport-height.d.ts +5 -0
- package/dist/lib-esm/utils/radix-compat/viewport-height.js +28 -0
- package/dist/lib-esm/utils/radix-compat/visually-hidden.d.ts +2 -0
- package/dist/lib-esm/utils/radix-compat/visually-hidden.js +24 -0
- package/package.json +8 -19
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Size5 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
3
|
-
import * as ToolbarPrimitive from '@radix-ui/react-toolbar';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import { forwardRef, createElement } from 'react';
|
|
5
|
+
import { ToggleItem } from '../utils/radix-compat/toolbar.js';
|
|
6
6
|
import styles from './toolbar.module.js';
|
|
7
7
|
|
|
8
8
|
const ToolbarToggleItem = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
@@ -13,7 +13,7 @@ const ToolbarToggleItem = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
13
13
|
color = 'currentColor',
|
|
14
14
|
...rest
|
|
15
15
|
} = props;
|
|
16
|
-
return jsxs(
|
|
16
|
+
return jsxs(ToggleItem, {
|
|
17
17
|
...rest,
|
|
18
18
|
ref: forwardedRef,
|
|
19
19
|
className: clsx(styles.toolbarItem, styles.toolbarToggle),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ToolbarButtonProps as ToolbarPrimitiveButtonProps, type ToolbarLinkProps as ToolbarPrimitiveLinkProps, type ToolbarProps as ToolbarPrimitiveProps, type ToolbarSeparatorProps as ToolbarPrimitiveSeparatorProps, type ToolbarToggleItemProps as ToolbarPrimitiveToggleItemProps, type ToggleGroupProps as ToolbarToggleGroupPrimitiveProps } from '@radix-ui/react-toolbar';
|
|
2
1
|
import { type CSSProperties, type FunctionComponent, type HTMLAttributes, type PropsWithChildren, type SVGProps } from 'react';
|
|
2
|
+
import { type ToolbarButtonProps as ToolbarPrimitiveButtonProps, type ToolbarLinkProps as ToolbarPrimitiveLinkProps, type ToolbarProps as ToolbarPrimitiveProps, type ToolbarSeparatorProps as ToolbarPrimitiveSeparatorProps, type ToolbarToggleItemProps as ToolbarPrimitiveToggleItemProps, type ToggleGroupProps as ToolbarToggleGroupPrimitiveProps } from '../utils/radix-compat/toolbar';
|
|
3
3
|
/** Toolbar-only stopgap; not exported from the package root. */
|
|
4
4
|
export type ToolbarColorScheme = 'light' | 'dark';
|
|
5
5
|
interface ColorSchemeProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import * as RadixTooltip from '../utils/radix-compat/tooltip';
|
|
3
3
|
import { type TooltipProps, type TooltipProviderProps } from './types';
|
|
4
4
|
export declare const Tooltip: (props: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const ContainerContext: React.Context<HTMLElement | null | undefined>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { bpSpace040 } from '@box/blueprint-web-assets/tokens/px-tokens';
|
|
3
|
-
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import React__default, { useContext } from 'react';
|
|
6
5
|
import '../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
7
6
|
import '../blueprint-configuration-context/consts.js';
|
|
8
7
|
import { useBlueprintConfiguration } from '../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
8
|
+
import { Root, Portal, TooltipTrigger as Trigger, Content as Content$1, Provider } from '../utils/radix-compat/tooltip.js';
|
|
9
9
|
import styles from './tooltip.module.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -34,13 +34,13 @@ const Tooltip = props => {
|
|
|
34
34
|
componentsWithAnimationEnabled
|
|
35
35
|
} = useBlueprintConfiguration();
|
|
36
36
|
const isAnimationEnabled = componentsWithAnimationEnabled.includes('Tooltip');
|
|
37
|
-
return jsxs(
|
|
37
|
+
return jsxs(Root, {
|
|
38
38
|
defaultOpen: defaultOpen,
|
|
39
39
|
onOpenChange: onOpenChange,
|
|
40
40
|
open: open,
|
|
41
41
|
children: [jsx(TooltipTrigger, {
|
|
42
42
|
children: children
|
|
43
|
-
}), jsx(
|
|
43
|
+
}), jsx(Portal, {
|
|
44
44
|
container: container,
|
|
45
45
|
forceMount: forceMount,
|
|
46
46
|
children: jsx(Content, {
|
|
@@ -64,7 +64,7 @@ const TooltipProvider = props => {
|
|
|
64
64
|
const isAnimationEnabled = componentsWithAnimationEnabled.includes('Tooltip');
|
|
65
65
|
return jsx(ContainerContext.Provider, {
|
|
66
66
|
value: container,
|
|
67
|
-
children: jsx(
|
|
67
|
+
children: jsx(Provider, {
|
|
68
68
|
delayDuration: isAnimationEnabled ? 400 : 300,
|
|
69
69
|
disableHoverableContent: disableHoverableContent,
|
|
70
70
|
...(isAnimationEnabled ? {
|
|
@@ -75,7 +75,7 @@ const TooltipProvider = props => {
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
const TooltipTrigger = /*#__PURE__*/React__default.forwardRef(function TooltipTrigger(props, ref) {
|
|
78
|
-
return jsx(
|
|
78
|
+
return jsx(Trigger, {
|
|
79
79
|
ref: ref,
|
|
80
80
|
asChild: true,
|
|
81
81
|
"data-blueprint-tooltip-trigger": "",
|
|
@@ -90,7 +90,7 @@ const Content = /*#__PURE__*/React__default.forwardRef(function Content(props, r
|
|
|
90
90
|
className,
|
|
91
91
|
...rest
|
|
92
92
|
} = props;
|
|
93
|
-
return jsx(
|
|
93
|
+
return jsx(Content$1, {
|
|
94
94
|
...rest,
|
|
95
95
|
ref: ref,
|
|
96
96
|
className: clsx(styles.content, styles[variant], className),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
2
1
|
import type React from 'react';
|
|
2
|
+
import type * as RadixTooltip from '../utils/radix-compat/tooltip';
|
|
3
3
|
export declare const TooltipVariants: readonly ["standard", "error"];
|
|
4
4
|
export type TooltipVariant = (typeof TooltipVariants)[number];
|
|
5
5
|
export interface TooltipContentProps extends RadixTooltip.TooltipContentProps {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type Direction, type Orientation, type PrimitiveProps } from './types';
|
|
3
|
+
interface AccordionImplProps extends PrimitiveProps<'div'> {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
orientation?: Orientation;
|
|
6
|
+
dir?: Direction;
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionSingleProps extends AccordionImplProps {
|
|
9
|
+
type: 'single';
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onValueChange?(value: string): void;
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface AccordionMultipleProps extends AccordionImplProps {
|
|
16
|
+
type: 'multiple';
|
|
17
|
+
value?: string[];
|
|
18
|
+
defaultValue?: string[];
|
|
19
|
+
onValueChange?(value: string[]): void;
|
|
20
|
+
}
|
|
21
|
+
export type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
22
|
+
/**
|
|
23
|
+
* Accordion with the Radix API, DOM and keyboard model: every trigger is a tab stop, arrow keys move
|
|
24
|
+
* between triggers with wrapping, and Home/End go to the first/last one.
|
|
25
|
+
*/
|
|
26
|
+
export declare const Root: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export interface AccordionItemProps extends PrimitiveProps<'div'> {
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
value: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const Item: import("react").ForwardRefExoticComponent<AccordionItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export type AccordionHeaderProps = PrimitiveProps<'h3'>;
|
|
33
|
+
export declare const Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
|
|
34
|
+
asChild?: boolean;
|
|
35
|
+
} & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
36
|
+
export type AccordionTriggerProps = PrimitiveProps<'button'>;
|
|
37
|
+
export declare const Trigger: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
38
|
+
asChild?: boolean;
|
|
39
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
export interface AccordionContentProps extends PrimitiveProps<'div'> {
|
|
41
|
+
forceMount?: true;
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export declare const Content: import("react").ForwardRefExoticComponent<AccordionContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useId, useCallback, useRef, createContext } from 'react';
|
|
3
|
+
import { composeEventHandlers } from '../composeEventHandlers.js';
|
|
4
|
+
import { useControllableState } from '../useControllableState.js';
|
|
5
|
+
import { Root as Root$1, getOpenState, Trigger as Trigger$1, Content as Content$1 } from './collapsible.js';
|
|
6
|
+
import { createCollection } from './collection.js';
|
|
7
|
+
import { useComposedRefs } from './compose-refs.js';
|
|
8
|
+
import { Slot } from './slot.js';
|
|
9
|
+
|
|
10
|
+
const ACCORDION_KEYS = ['Home', 'End', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'];
|
|
11
|
+
const {
|
|
12
|
+
CollectionProvider,
|
|
13
|
+
useCollection,
|
|
14
|
+
useCollectionItem,
|
|
15
|
+
useCollectionRef
|
|
16
|
+
} = createCollection();
|
|
17
|
+
const AccordionValueContext = /*#__PURE__*/createContext(null);
|
|
18
|
+
const AccordionImplContext = /*#__PURE__*/createContext(null);
|
|
19
|
+
const AccordionImpl = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
20
|
+
const {
|
|
21
|
+
disabled,
|
|
22
|
+
dir,
|
|
23
|
+
orientation = 'vertical',
|
|
24
|
+
collapsible,
|
|
25
|
+
asChild,
|
|
26
|
+
...accordionProps
|
|
27
|
+
} = props;
|
|
28
|
+
const accordionRef = useRef(null);
|
|
29
|
+
const collectionRef = useCollectionRef();
|
|
30
|
+
const composedRefs = useComposedRefs(forwardedRef, accordionRef, collectionRef);
|
|
31
|
+
const getItems = useCollection();
|
|
32
|
+
const direction = dir ?? 'ltr';
|
|
33
|
+
const isDirectionLTR = direction === 'ltr';
|
|
34
|
+
// Arrow keys move between triggers and wrap around, like Radix; PageUp/PageDown are not handled.
|
|
35
|
+
const handleKeyDown = composeEventHandlers(props.onKeyDown, event => {
|
|
36
|
+
if (!ACCORDION_KEYS.includes(event.key)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
target
|
|
41
|
+
} = event;
|
|
42
|
+
const triggerCollection = getItems().filter(item => !item.ref.current?.disabled);
|
|
43
|
+
const triggerIndex = triggerCollection.findIndex(item => item.ref.current === target);
|
|
44
|
+
const triggerCount = triggerCollection.length;
|
|
45
|
+
if (triggerIndex === -1) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
let nextIndex = triggerIndex;
|
|
50
|
+
const homeIndex = 0;
|
|
51
|
+
const endIndex = triggerCount - 1;
|
|
52
|
+
const moveNext = () => {
|
|
53
|
+
nextIndex = triggerIndex + 1;
|
|
54
|
+
if (nextIndex > endIndex) {
|
|
55
|
+
nextIndex = homeIndex;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const movePrev = () => {
|
|
59
|
+
nextIndex = triggerIndex - 1;
|
|
60
|
+
if (nextIndex < homeIndex) {
|
|
61
|
+
nextIndex = endIndex;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
switch (event.key) {
|
|
65
|
+
case 'Home':
|
|
66
|
+
nextIndex = homeIndex;
|
|
67
|
+
break;
|
|
68
|
+
case 'End':
|
|
69
|
+
nextIndex = endIndex;
|
|
70
|
+
break;
|
|
71
|
+
case 'ArrowRight':
|
|
72
|
+
if (orientation === 'horizontal') {
|
|
73
|
+
if (isDirectionLTR) {
|
|
74
|
+
moveNext();
|
|
75
|
+
} else {
|
|
76
|
+
movePrev();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
case 'ArrowDown':
|
|
81
|
+
if (orientation === 'vertical') {
|
|
82
|
+
moveNext();
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
case 'ArrowLeft':
|
|
86
|
+
if (orientation === 'horizontal') {
|
|
87
|
+
if (isDirectionLTR) {
|
|
88
|
+
movePrev();
|
|
89
|
+
} else {
|
|
90
|
+
moveNext();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
case 'ArrowUp':
|
|
95
|
+
if (orientation === 'vertical') {
|
|
96
|
+
movePrev();
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
triggerCollection[nextIndex % triggerCount].ref.current?.focus();
|
|
101
|
+
});
|
|
102
|
+
const Comp = asChild ? Slot : 'div';
|
|
103
|
+
return jsx(AccordionImplContext.Provider, {
|
|
104
|
+
value: {
|
|
105
|
+
disabled,
|
|
106
|
+
direction,
|
|
107
|
+
orientation,
|
|
108
|
+
collapsible
|
|
109
|
+
},
|
|
110
|
+
children: jsx(Comp, {
|
|
111
|
+
...accordionProps,
|
|
112
|
+
ref: composedRefs,
|
|
113
|
+
"data-orientation": orientation,
|
|
114
|
+
onKeyDown: disabled ? undefined : handleKeyDown
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
const AccordionSingle = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
119
|
+
const {
|
|
120
|
+
value: valueProp,
|
|
121
|
+
defaultValue,
|
|
122
|
+
onValueChange = () => undefined,
|
|
123
|
+
collapsible = false,
|
|
124
|
+
type: _type,
|
|
125
|
+
...accordionSingleProps
|
|
126
|
+
} = props;
|
|
127
|
+
const [value, setValue] = useControllableState({
|
|
128
|
+
prop: valueProp,
|
|
129
|
+
defaultProp: defaultValue,
|
|
130
|
+
onChange: onValueChange
|
|
131
|
+
});
|
|
132
|
+
return jsx(AccordionValueContext.Provider, {
|
|
133
|
+
value: {
|
|
134
|
+
value: value ? [value] : [],
|
|
135
|
+
onItemOpen: setValue,
|
|
136
|
+
onItemClose: useCallback(() => collapsible && setValue(''), [collapsible, setValue])
|
|
137
|
+
},
|
|
138
|
+
children: jsx(AccordionImpl, {
|
|
139
|
+
...accordionSingleProps,
|
|
140
|
+
ref: forwardedRef,
|
|
141
|
+
collapsible: collapsible
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
const AccordionMultiple = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
146
|
+
const {
|
|
147
|
+
value: valueProp,
|
|
148
|
+
defaultValue,
|
|
149
|
+
onValueChange = () => undefined,
|
|
150
|
+
type: _type,
|
|
151
|
+
...multipleProps
|
|
152
|
+
} = props;
|
|
153
|
+
const [value = [], setValue] = useControllableState({
|
|
154
|
+
prop: valueProp,
|
|
155
|
+
defaultProp: defaultValue,
|
|
156
|
+
onChange: onValueChange
|
|
157
|
+
});
|
|
158
|
+
const onItemOpen = useCallback(itemValue => setValue((prevValue = []) => [...prevValue, itemValue]), [setValue]);
|
|
159
|
+
const onItemClose = useCallback(itemValue => setValue((prevValue = []) => prevValue.filter(item => item !== itemValue)), [setValue]);
|
|
160
|
+
return jsx(AccordionValueContext.Provider, {
|
|
161
|
+
value: {
|
|
162
|
+
value,
|
|
163
|
+
onItemOpen,
|
|
164
|
+
onItemClose
|
|
165
|
+
},
|
|
166
|
+
children: jsx(AccordionImpl, {
|
|
167
|
+
...multipleProps,
|
|
168
|
+
ref: forwardedRef,
|
|
169
|
+
collapsible: true
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* Accordion with the Radix API, DOM and keyboard model: every trigger is a tab stop, arrow keys move
|
|
175
|
+
* between triggers with wrapping, and Home/End go to the first/last one.
|
|
176
|
+
*/
|
|
177
|
+
const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => jsx(CollectionProvider, {
|
|
178
|
+
children: props.type === 'multiple' ? jsx(AccordionMultiple, {
|
|
179
|
+
...props,
|
|
180
|
+
ref: forwardedRef
|
|
181
|
+
}) : jsx(AccordionSingle, {
|
|
182
|
+
...props,
|
|
183
|
+
ref: forwardedRef
|
|
184
|
+
})
|
|
185
|
+
}));
|
|
186
|
+
Root.displayName = 'Accordion';
|
|
187
|
+
const AccordionItemContext = /*#__PURE__*/createContext(null);
|
|
188
|
+
const useItemContext = () => {
|
|
189
|
+
const context = useContext(AccordionItemContext);
|
|
190
|
+
const implContext = useContext(AccordionImplContext);
|
|
191
|
+
if (!context || !implContext) {
|
|
192
|
+
throw new Error('Accordion parts must be used within Accordion.Item');
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
...context,
|
|
196
|
+
implContext
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
const Item = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
200
|
+
const {
|
|
201
|
+
value,
|
|
202
|
+
...accordionItemProps
|
|
203
|
+
} = props;
|
|
204
|
+
const implContext = useContext(AccordionImplContext);
|
|
205
|
+
const valueContext = useContext(AccordionValueContext);
|
|
206
|
+
if (!implContext || !valueContext) {
|
|
207
|
+
throw new Error('Accordion.Item must be used within Accordion');
|
|
208
|
+
}
|
|
209
|
+
const triggerId = useId();
|
|
210
|
+
const open = value && valueContext.value.includes(value) || false;
|
|
211
|
+
const disabled = implContext.disabled || props.disabled;
|
|
212
|
+
const {
|
|
213
|
+
onItemOpen,
|
|
214
|
+
onItemClose
|
|
215
|
+
} = valueContext;
|
|
216
|
+
const handleOpenChange = useCallback(nextOpen => {
|
|
217
|
+
if (nextOpen) {
|
|
218
|
+
onItemOpen(value);
|
|
219
|
+
} else {
|
|
220
|
+
onItemClose(value);
|
|
221
|
+
}
|
|
222
|
+
}, [onItemOpen, onItemClose, value]);
|
|
223
|
+
return jsx(AccordionItemContext.Provider, {
|
|
224
|
+
value: {
|
|
225
|
+
open,
|
|
226
|
+
disabled,
|
|
227
|
+
triggerId
|
|
228
|
+
},
|
|
229
|
+
children: jsx(Root$1, {
|
|
230
|
+
"data-orientation": implContext.orientation,
|
|
231
|
+
"data-state": getOpenState(open),
|
|
232
|
+
...accordionItemProps,
|
|
233
|
+
ref: forwardedRef,
|
|
234
|
+
disabled: disabled,
|
|
235
|
+
open: open,
|
|
236
|
+
onOpenChange: handleOpenChange
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
Item.displayName = 'AccordionItem';
|
|
241
|
+
const Header = /*#__PURE__*/forwardRef(({
|
|
242
|
+
asChild,
|
|
243
|
+
...headerProps
|
|
244
|
+
}, forwardedRef) => {
|
|
245
|
+
const {
|
|
246
|
+
implContext,
|
|
247
|
+
open,
|
|
248
|
+
disabled
|
|
249
|
+
} = useItemContext();
|
|
250
|
+
const Comp = asChild ? Slot : 'h3';
|
|
251
|
+
return jsx(Comp, {
|
|
252
|
+
"data-disabled": disabled ? '' : undefined,
|
|
253
|
+
"data-orientation": implContext.orientation,
|
|
254
|
+
"data-state": getOpenState(open),
|
|
255
|
+
...headerProps,
|
|
256
|
+
ref: forwardedRef
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
Header.displayName = 'AccordionHeader';
|
|
260
|
+
const Trigger = /*#__PURE__*/forwardRef((triggerProps, forwardedRef) => {
|
|
261
|
+
const {
|
|
262
|
+
implContext,
|
|
263
|
+
open,
|
|
264
|
+
triggerId
|
|
265
|
+
} = useItemContext();
|
|
266
|
+
const ref = useRef(null);
|
|
267
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
268
|
+
const collectionItemProps = useCollectionItem(ref, {});
|
|
269
|
+
return jsx(Trigger$1, {
|
|
270
|
+
...collectionItemProps,
|
|
271
|
+
"aria-disabled": open && !implContext.collapsible || undefined,
|
|
272
|
+
"data-orientation": implContext.orientation,
|
|
273
|
+
id: triggerId,
|
|
274
|
+
...triggerProps,
|
|
275
|
+
ref: composedRefs
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
Trigger.displayName = 'AccordionTrigger';
|
|
279
|
+
const Content = /*#__PURE__*/forwardRef((contentProps, forwardedRef) => {
|
|
280
|
+
const {
|
|
281
|
+
implContext,
|
|
282
|
+
triggerId
|
|
283
|
+
} = useItemContext();
|
|
284
|
+
return jsx(Content$1, {
|
|
285
|
+
"aria-labelledby": triggerId,
|
|
286
|
+
"data-orientation": implContext.orientation,
|
|
287
|
+
role: "region",
|
|
288
|
+
...contentProps,
|
|
289
|
+
ref: forwardedRef,
|
|
290
|
+
style: {
|
|
291
|
+
'--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',
|
|
292
|
+
'--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',
|
|
293
|
+
...contentProps.style
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
Content.displayName = 'AccordionContent';
|
|
298
|
+
|
|
299
|
+
export { Content, Header, Item, Root, Trigger };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Ariakit dialogs only let the `autoFocus` focusables inside them (Blueprint buttons, for example) focus themselves
|
|
4
|
+
* when the dialog moves focus on show. The compat overlays leave that to the Radix focus scope, so their content
|
|
5
|
+
* opts back in, like it was outside Ariakit dialogs with Radix.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AllowAutoFocus: ({ children }: {
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { FocusableContext } from '@ariakit/react-core/focusable/focusable-context';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Ariakit dialogs only let the `autoFocus` focusables inside them (Blueprint buttons, for example) focus themselves
|
|
6
|
+
* when the dialog moves focus on show. The compat overlays leave that to the Radix focus scope, so their content
|
|
7
|
+
* opts back in, like it was outside Ariakit dialogs with Radix.
|
|
8
|
+
*/
|
|
9
|
+
const AllowAutoFocus = ({
|
|
10
|
+
children
|
|
11
|
+
}) => jsx(FocusableContext.Provider, {
|
|
12
|
+
value: true,
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { AllowAutoFocus };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type InputHTMLAttributes } from 'react';
|
|
2
|
+
interface BubbleInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'checked'> {
|
|
3
|
+
checked: boolean | 'indeterminate';
|
|
4
|
+
bubbles?: boolean;
|
|
5
|
+
control: HTMLElement | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hidden native input mirroring a custom checkbox, switch or radio inside a `<form>`, so the value is
|
|
9
|
+
* submitted and `change` events reach form libraries, like the Radix bubble input.
|
|
10
|
+
*/
|
|
11
|
+
export declare const BubbleInput: ({ control, checked, bubbles, style, ...inputProps }: BubbleInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/** Whether a custom control lives inside a form, which is when it needs a bubble input. */
|
|
13
|
+
export declare function isFormControl(control: HTMLElement | null): boolean;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function usePrevious(value) {
|
|
5
|
+
const ref = useRef({
|
|
6
|
+
value,
|
|
7
|
+
previous: value
|
|
8
|
+
});
|
|
9
|
+
if (ref.current.value !== value) {
|
|
10
|
+
ref.current.previous = ref.current.value;
|
|
11
|
+
ref.current.value = value;
|
|
12
|
+
}
|
|
13
|
+
return ref.current.previous;
|
|
14
|
+
}
|
|
15
|
+
const hiddenInputStyle = {
|
|
16
|
+
pointerEvents: 'none',
|
|
17
|
+
opacity: 0,
|
|
18
|
+
margin: 0
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hidden native input mirroring a custom checkbox, switch or radio inside a `<form>`, so the value is
|
|
22
|
+
* submitted and `change` events reach form libraries, like the Radix bubble input.
|
|
23
|
+
*/
|
|
24
|
+
const BubbleInput = ({
|
|
25
|
+
control,
|
|
26
|
+
checked,
|
|
27
|
+
bubbles = true,
|
|
28
|
+
style,
|
|
29
|
+
...inputProps
|
|
30
|
+
}) => {
|
|
31
|
+
const ref = useRef(null);
|
|
32
|
+
const prevChecked = usePrevious(checked);
|
|
33
|
+
const width = control?.offsetWidth;
|
|
34
|
+
const height = control?.offsetHeight;
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const input = ref.current;
|
|
37
|
+
if (!input) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
41
|
+
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
|
|
42
|
+
const setChecked = descriptor.set;
|
|
43
|
+
if (prevChecked !== checked && setChecked) {
|
|
44
|
+
const event = new Event('click', {
|
|
45
|
+
bubbles
|
|
46
|
+
});
|
|
47
|
+
input.indeterminate = checked === 'indeterminate';
|
|
48
|
+
setChecked.call(input, checked === 'indeterminate' ? false : checked);
|
|
49
|
+
input.dispatchEvent(event);
|
|
50
|
+
}
|
|
51
|
+
}, [prevChecked, checked, bubbles]);
|
|
52
|
+
return jsx("input", {
|
|
53
|
+
"aria-hidden": true,
|
|
54
|
+
defaultChecked: checked === 'indeterminate' ? false : checked,
|
|
55
|
+
tabIndex: -1,
|
|
56
|
+
type: "checkbox",
|
|
57
|
+
...inputProps,
|
|
58
|
+
ref: ref,
|
|
59
|
+
style: {
|
|
60
|
+
...style,
|
|
61
|
+
...hiddenInputStyle,
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
width,
|
|
64
|
+
height,
|
|
65
|
+
transform: 'translateX(-100%)'
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { BubbleInput };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ForwardRefExoticComponent, type ReactElement, type RefAttributes } from 'react';
|
|
2
|
+
type ButtonCheckboxProps = Omit<ComponentPropsWithoutRef<'button'>, 'value'> & {
|
|
3
|
+
checked?: boolean | 'mixed';
|
|
4
|
+
clickOnEnter?: boolean;
|
|
5
|
+
render?: ReactElement;
|
|
6
|
+
value?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const ButtonCheckbox: ForwardRefExoticComponent<ButtonCheckboxProps & RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type PrimitiveProps } from './types';
|
|
2
|
+
export type CheckedState = boolean | 'indeterminate';
|
|
3
|
+
export interface CheckboxProps extends Omit<PrimitiveProps<'button'>, 'checked' | 'defaultChecked'> {
|
|
4
|
+
checked?: CheckedState;
|
|
5
|
+
defaultChecked?: CheckedState;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
onCheckedChange?(checked: CheckedState): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checkbox rendered as a `<button role="checkbox">` with the Radix API and DOM
|
|
11
|
+
* (`data-state`, `data-disabled`, hidden form input), on top of the Ariakit `Checkbox`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Root: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export interface CheckboxIndicatorProps extends PrimitiveProps<'span'> {
|
|
15
|
+
/** Keeps the indicator mounted when unchecked, for styling or animations. */
|
|
16
|
+
forceMount?: true;
|
|
17
|
+
}
|
|
18
|
+
export declare const Indicator: import("react").ForwardRefExoticComponent<CheckboxIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
|