@trellixio/roaster-react 2.1.1 → 2.2.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/CHANGELOG.md +383 -0
- package/LICENSE.md +38 -2
- package/README.md +10 -10
- package/cjs/components/ActionList/components/ActionListDropdown.js +6 -5
- package/cjs/components/ActionList/components/ActionListDropdown.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListItem.js +9 -7
- package/cjs/components/ActionList/components/ActionListItem.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListSearch.js +24 -6
- package/cjs/components/ActionList/components/ActionListSearch.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListSubmenu.js +7 -5
- package/cjs/components/ActionList/components/ActionListSubmenu.js.map +1 -1
- package/cjs/components/ActionList/components/ActionListSwitchItem.js +6 -5
- package/cjs/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
- package/cjs/components/Alert/Alert.js +3 -2
- package/cjs/components/Alert/Alert.js.map +1 -1
- package/cjs/components/AppFrame/AppFrame.js.map +1 -1
- package/cjs/components/Avatar/Avatar.js +1 -1
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/cjs/components/Button/Button.js +3 -2
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/ButtonIcon/ButtonIcon.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.js +4 -4
- package/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/cjs/components/ColorField/ColorField.js +42 -29
- package/cjs/components/ColorField/ColorField.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.js +2 -2
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DatePicker/components/Calendar/Calendar.js +4 -3
- package/cjs/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardDropdown.js +6 -5
- package/cjs/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
- package/cjs/components/DropdownCard/components/DropdownCardTabs.js +3 -2
- package/cjs/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
- package/cjs/components/Field/Field.js +26 -6
- package/cjs/components/Field/Field.js.map +1 -1
- package/cjs/components/FileField/FileField.js +47 -33
- package/cjs/components/FileField/FileField.js.map +1 -1
- package/cjs/components/Icon/Icon.js.map +1 -1
- package/cjs/components/Icon/RoasterIcon.js +12 -0
- package/cjs/components/Icon/RoasterIcon.js.map +1 -0
- package/cjs/components/IconBadge/IconBadge.js.map +1 -1
- package/cjs/components/Modal/Modal.js +3 -2
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Pagination/Pagination.js +4 -3
- package/cjs/components/Pagination/Pagination.js.map +1 -1
- package/cjs/components/RangeField/RangeField.js +34 -21
- package/cjs/components/RangeField/RangeField.js.map +1 -1
- package/cjs/components/Select/Select.js +8 -6
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Sidebar/Sidebar.js +4 -3
- package/cjs/components/Sidebar/Sidebar.js.map +1 -1
- package/cjs/components/Sidebar/components/Back.js +7 -3
- package/cjs/components/Sidebar/components/Back.js.map +1 -1
- package/cjs/components/StatCard/StatCard.js +3 -2
- package/cjs/components/StatCard/StatCard.js.map +1 -1
- package/cjs/components/Switch/Switch.js +7 -1
- package/cjs/components/Switch/Switch.js.map +1 -1
- package/cjs/components/Table/components/TableHeadCell.js +4 -3
- package/cjs/components/Table/components/TableHeadCell.js.map +1 -1
- package/cjs/components/Tag/Tag.js +3 -2
- package/cjs/components/Tag/Tag.js.map +1 -1
- package/cjs/components/TextField/TextField.js +3 -1
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/Textarea/Textarea.js +36 -4
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/components/Thumbnail/Thumbnail.js +3 -2
- package/cjs/components/Thumbnail/Thumbnail.js.map +1 -1
- package/cjs/components/Toast/Toast.js +3 -2
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.js +6 -5
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/Tooltip/TooltipCallout.js +3 -2
- package/cjs/components/Tooltip/TooltipCallout.js.map +1 -1
- package/cjs/components/Visualizer/Visualizer.js +4 -3
- package/cjs/components/Visualizer/Visualizer.js.map +1 -1
- package/cjs/utils/Slot/index.js +5 -5
- package/cjs/utils/Slot/index.js.map +1 -1
- package/cjs/utils/useDropdown/DropdownTrigger.js +4 -4
- package/cjs/utils/useDropdown/DropdownTrigger.js.map +1 -1
- package/cjs/utils/useMergeRefs/index.js +51 -0
- package/cjs/utils/useMergeRefs/index.js.map +1 -0
- package/esm/components/ActionList/components/ActionListDropdown.js +2 -1
- package/esm/components/ActionList/components/ActionListDropdown.js.map +1 -1
- package/esm/components/ActionList/components/ActionListItem.js +5 -3
- package/esm/components/ActionList/components/ActionListItem.js.map +1 -1
- package/esm/components/ActionList/components/ActionListSearch.js +21 -3
- package/esm/components/ActionList/components/ActionListSearch.js.map +1 -1
- package/esm/components/ActionList/components/ActionListSubmenu.js +5 -3
- package/esm/components/ActionList/components/ActionListSubmenu.js.map +1 -1
- package/esm/components/ActionList/components/ActionListSwitchItem.js +2 -1
- package/esm/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
- package/esm/components/Alert/Alert.js +3 -2
- package/esm/components/Alert/Alert.js.map +1 -1
- package/esm/components/AppFrame/AppFrame.js.map +1 -1
- package/esm/components/Avatar/Avatar.js +1 -1
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/Button/Button.js +3 -2
- package/esm/components/Button/Button.js.map +1 -1
- package/esm/components/ButtonIcon/ButtonIcon.js.map +1 -1
- package/esm/components/Checkbox/Checkbox.js +1 -1
- package/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/esm/components/ColorField/ColorField.js +42 -29
- package/esm/components/ColorField/ColorField.js.map +1 -1
- package/esm/components/DatePicker/DatePicker.js +1 -1
- package/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/esm/components/DatePicker/components/Calendar/Calendar.js +4 -3
- package/esm/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardDropdown.js +2 -1
- package/esm/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
- package/esm/components/DropdownCard/components/DropdownCardTabs.js +3 -2
- package/esm/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
- package/esm/components/Field/Field.js +26 -6
- package/esm/components/Field/Field.js.map +1 -1
- package/esm/components/FileField/FileField.js +47 -33
- package/esm/components/FileField/FileField.js.map +1 -1
- package/esm/components/Icon/Icon.js.map +1 -1
- package/esm/components/Icon/RoasterIcon.js +10 -0
- package/esm/components/Icon/RoasterIcon.js.map +1 -0
- package/esm/components/IconBadge/IconBadge.js.map +1 -1
- package/esm/components/Modal/Modal.js +3 -2
- package/esm/components/Modal/Modal.js.map +1 -1
- package/esm/components/Pagination/Pagination.js +4 -3
- package/esm/components/Pagination/Pagination.js.map +1 -1
- package/esm/components/RangeField/RangeField.js +34 -21
- package/esm/components/RangeField/RangeField.js.map +1 -1
- package/esm/components/Select/Select.js +4 -2
- package/esm/components/Select/Select.js.map +1 -1
- package/esm/components/Sidebar/Sidebar.js +4 -3
- package/esm/components/Sidebar/Sidebar.js.map +1 -1
- package/esm/components/Sidebar/components/Back.js +7 -3
- package/esm/components/Sidebar/components/Back.js.map +1 -1
- package/esm/components/StatCard/StatCard.js +3 -2
- package/esm/components/StatCard/StatCard.js.map +1 -1
- package/esm/components/Switch/Switch.js +7 -1
- package/esm/components/Switch/Switch.js.map +1 -1
- package/esm/components/Table/components/TableHeadCell.js +4 -3
- package/esm/components/Table/components/TableHeadCell.js.map +1 -1
- package/esm/components/Tag/Tag.js +3 -2
- package/esm/components/Tag/Tag.js.map +1 -1
- package/esm/components/TextField/TextField.js +3 -1
- package/esm/components/TextField/TextField.js.map +1 -1
- package/esm/components/Textarea/Textarea.js +38 -6
- package/esm/components/Textarea/Textarea.js.map +1 -1
- package/esm/components/Thumbnail/Thumbnail.js +3 -2
- package/esm/components/Thumbnail/Thumbnail.js.map +1 -1
- package/esm/components/Toast/Toast.js +3 -2
- package/esm/components/Toast/Toast.js.map +1 -1
- package/esm/components/Tooltip/Tooltip.js +2 -1
- package/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/esm/components/Tooltip/TooltipCallout.js +3 -2
- package/esm/components/Tooltip/TooltipCallout.js.map +1 -1
- package/esm/components/Visualizer/Visualizer.js +4 -3
- package/esm/components/Visualizer/Visualizer.js.map +1 -1
- package/esm/package.json +4 -1
- package/esm/utils/Slot/index.js +1 -1
- package/esm/utils/Slot/index.js.map +1 -1
- package/esm/utils/useDropdown/DropdownTrigger.js +1 -1
- package/esm/utils/useDropdown/DropdownTrigger.js.map +1 -1
- package/esm/utils/useMergeRefs/index.js +36 -0
- package/esm/utils/useMergeRefs/index.js.map +1 -0
- package/lib/components/ActionList/components/ActionListItem.d.ts +4 -1
- package/lib/components/ActionList/components/ActionListItem.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListSearch.d.ts.map +1 -1
- package/lib/components/ActionList/components/ActionListSubmenu.d.ts.map +1 -1
- package/lib/components/AppFrame/AppFrame.d.ts +5 -1
- package/lib/components/AppFrame/AppFrame.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +4 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/ButtonIcon/ButtonIcon.d.ts +1 -1
- package/lib/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/ColorField/ColorField.d.ts.map +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/components/DatePicker/utils/index.d.ts +2 -1
- package/lib/components/DatePicker/utils/index.d.ts.map +1 -1
- package/lib/components/Field/Field.d.ts +13 -7
- package/lib/components/Field/Field.d.ts.map +1 -1
- package/lib/components/FileField/FileField.d.ts.map +1 -1
- package/lib/components/Icon/Icon.d.ts +13 -2
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/RoasterIcon.d.ts +13 -0
- package/lib/components/Icon/RoasterIcon.d.ts.map +1 -0
- package/lib/components/Icon/index.d.ts +2 -0
- package/lib/components/Icon/index.d.ts.map +1 -1
- package/lib/components/IconBadge/IconBadge.d.ts +2 -2
- package/lib/components/RangeField/RangeField.d.ts.map +1 -1
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Sidebar/components/Back.d.ts.map +1 -1
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/TextField/TextField.d.ts.map +1 -1
- package/lib/components/Textarea/Textarea.d.ts +6 -1
- package/lib/components/Textarea/Textarea.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/utils/Slot/index.d.ts.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/useDropdown/DropdownTrigger.d.ts.map +1 -1
- package/lib/utils/useMergeRefs/index.d.ts +11 -0
- package/lib/utils/useMergeRefs/index.d.ts.map +1 -0
- package/package.json +2 -2
- package/roaster.css +2 -1
- package/themes/azoth.css +1 -1
- package/themes/coffee.css +1 -1
- package/themes/scalar.css +1 -1
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var react = require('@floating-ui/react');
|
|
7
|
-
var index$
|
|
7
|
+
var index$2 = require('../../utils/Slot/index.js');
|
|
8
8
|
var useTooltip = require('./useTooltip.js');
|
|
9
9
|
var TooltipCallout = require('./TooltipCallout.js');
|
|
10
10
|
var index = require('../../utils/useControllableState/index.js');
|
|
11
|
-
var index$
|
|
11
|
+
var index$1 = require('../../utils/useMergeRefs/index.js');
|
|
12
|
+
var index$3 = require('../../utils/classNames/index.js');
|
|
12
13
|
|
|
13
14
|
function _interopNamespaceDefault(e) {
|
|
14
15
|
var n = Object.create(null);
|
|
@@ -39,15 +40,15 @@ const TooltipBase = React__namespace.forwardRef((props, ref) => {
|
|
|
39
40
|
} = props;
|
|
40
41
|
const [open, setOpen] = index.useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });
|
|
41
42
|
const tooltip = useTooltip.useTooltip({ placement, open, onOpenChange: setOpen, offset, inline });
|
|
42
|
-
const targetRef =
|
|
43
|
+
const targetRef = index$1.useMergeRefs([tooltip.refs.setReference, ref]);
|
|
43
44
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
44
|
-
/* @__PURE__ */ jsxRuntime.jsx(index$
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(index$2.Slot, { ...tooltip.getReferenceProps(), ref: targetRef, children }),
|
|
45
46
|
open && /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
46
47
|
"div",
|
|
47
48
|
{
|
|
48
49
|
...tooltip.getFloatingProps(others),
|
|
49
50
|
ref: tooltip.refs.setFloating,
|
|
50
|
-
className: index$
|
|
51
|
+
className: index$3.classNames("roaster-tooltip", "roaster-tooltip--floating", className),
|
|
51
52
|
style: { ...tooltip.floatingStyles, ...style },
|
|
52
53
|
"data-placement": tooltip.placement,
|
|
53
54
|
children: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FloatingPortal, Placement } from '@floating-ui/react';\nimport { Slot } from '@/utils/Slot';\nimport { classNames, useControllableState, useMergeRefs } from '@/utils';\nimport { useTooltip } from './useTooltip';\nimport { TooltipCallout } from './TooltipCallout';\n\nexport type FloatingSide = Placement;\n\n/** Every native `<div>` prop (`id`, `className`, `style`, ...) is accepted and forwarded to the tooltip. */\nexport interface TooltipProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n /** The target: one element that takes the focus (a button, a link, or an element with `tabIndex={0}`). */\n children: React.ReactNode;\n /** The text of the tooltip. */\n label: React.ReactNode;\n /**\n * Where the tooltip goes relative to its target. It moves to the other side when there is no room.\n * @defaultValue 'top'\n */\n placement?: FloatingSide;\n /** Whether the tooltip is open, when the parent controls it. Leave it out to let hover and focus open it. */\n open?: boolean;\n /**\n * Whether the tooltip starts open, when it is not controlled.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /** Called when hover, focus or Escape opens or closes the tooltip, controlled or not. */\n onOpenChange?(open: boolean): void;\n /**\n * The distance in pixels between the tooltip and its target.\n * @defaultValue 4\n */\n offset?: number;\n /** Set it when the target is text that may wrap over several lines, so the tooltip follows the hovered line. */\n inline?: boolean;\n}\n\nconst TooltipBase = React.forwardRef<HTMLElement, TooltipProps>((props, ref) => {\n const {\n children,\n label,\n placement = 'top',\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n offset = 4,\n inline = false,\n className,\n style,\n ...others\n } = props;\n\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const tooltip = useTooltip({ placement, open, onOpenChange: setOpen, offset, inline });\n const targetRef = useMergeRefs([tooltip.refs.setReference, ref]);\n\n return (\n <>\n <Slot {...tooltip.getReferenceProps()} ref={targetRef}>\n {children}\n </Slot>\n {open && (\n <FloatingPortal>\n <div\n {...tooltip.getFloatingProps(others)}\n ref={tooltip.refs.setFloating}\n className={classNames('roaster-tooltip', 'roaster-tooltip--floating', className)}\n style={{ ...tooltip.floatingStyles, ...style }}\n data-placement={tooltip.placement}\n >\n {label}\n </div>\n </FloatingPortal>\n )}\n </>\n );\n});\n\nTooltipBase.displayName = 'Tooltip';\n\n/**\n * A short description of its target, shown while the target is hovered or has the focus, and hidden with Escape. The\n * target is described by it (`aria-describedby`). The ref goes to the target. Tooltip.Callout stays open beside its\n * host until it is closed.\n */\nexport const Tooltip = Object.assign(TooltipBase, { Callout: TooltipCallout });\n"],"names":["React","useControllableState","useTooltip","useMergeRefs","jsxs","Fragment","jsx","Slot","FloatingPortal","classNames","TooltipCallout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,WAAW,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACrD,EAAE,MAAM;AACR,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,SAAS,GAAG,KAAK;AACrB,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW,GAAG,KAAK;AACvB,IAAI,YAAY;AAChB,IAAI,MAAM,GAAG,CAAC;AACd,IAAI,MAAM,GAAG,KAAK;AAClB,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAGC,0BAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AACtH,EAAE,MAAM,OAAO,GAAGC,qBAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACxF,EAAE,MAAM,SAAS,GAAGC,oBAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;AAClE,EAAE,uBAAuBC,eAAI,CAACC,mBAAQ,EAAE,EAAE,QAAQ,EAAE;AACpD,oBAAoBC,cAAG,CAACC,YAAI,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC3F,IAAI,IAAI,oBAAoBD,cAAG,CAACE,oBAAc,EAAE,EAAE,QAAQ,kBAAkBF,cAAG;AAC/E,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC;AAC3C,QAAQ,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;AACrC,QAAQ,SAAS,EAAEG,kBAAU,CAAC,iBAAiB,EAAE,2BAA2B,EAAE,SAAS,CAAC;AACxF,QAAQ,KAAK,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,KAAK,EAAE;AACtD,QAAQ,gBAAgB,EAAE,OAAO,CAAC,SAAS;AAC3C,QAAQ,QAAQ,EAAE;AAClB;AACA,KAAK,EAAE;AACP,GAAG,EAAE,CAAC;AACN,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,SAAS;AACvB,MAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,OAAO,EAAEC,6BAAc,EAAE;;"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
|
|
6
|
+
require('../Icon/Icon.js');
|
|
7
|
+
var RoasterIcon = require('../Icon/RoasterIcon.js');
|
|
7
8
|
var index = require('../../utils/useControllableState/index.js');
|
|
8
9
|
var index$1 = require('../../utils/useUid/index.js');
|
|
9
10
|
var index$2 = require('../../utils/classNames/index.js');
|
|
@@ -44,7 +45,7 @@ const TooltipCallout = React__namespace.forwardRef(
|
|
|
44
45
|
type: "button",
|
|
45
46
|
"aria-label": text.close,
|
|
46
47
|
onClick: () => setShown(false),
|
|
47
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" })
|
|
48
49
|
}
|
|
49
50
|
),
|
|
50
51
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "roaster-tooltip__title", id: titleId, children: title }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipCallout.js","sources":["../../../../src/components/Tooltip/TooltipCallout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport {
|
|
1
|
+
{"version":3,"file":"TooltipCallout.js","sources":["../../../../src/components/Tooltip/TooltipCallout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { RoasterIcon } from '../Icon';\n\n/** The text of the callout, for other languages. */\nexport interface TooltipCalloutLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultLabels: TooltipCalloutLabels = { close: 'Dismiss' };\n\n/** Every native `<div>` prop is accepted and forwarded to the callout. */\nexport interface TooltipCalloutProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> {\n /** The callout's title, which names it. */\n title: React.ReactNode;\n /** What it says under the title, and a link if any. */\n children: React.ReactNode;\n /** Whether the callout is shown, when the parent controls it. */\n open?: boolean;\n /**\n * Whether the callout starts shown, when it is not controlled.\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Called with `false` when its close button hides it. */\n onOpenChange?(open: boolean): void;\n /** The text of the callout, in English by default. */\n labels?: Partial<TooltipCalloutLabels>;\n}\n\n/**\n * A tooltip that stays open beside its host until it is closed, such as one that introduces a feature: a title, a\n * text, a link and a close button, with a line and a dot pointing at the host. Put it inside its host. It holds\n * controls, so it is a dialog named by its title.\n */\nexport const TooltipCallout = React.forwardRef<HTMLDivElement, TooltipCalloutProps>(\n ({ title, children, open, defaultOpen = true, onOpenChange, labels, className, ...others }, ref) => {\n const [shown, setShown] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });\n const titleId = useUid();\n const text = { ...defaultLabels, ...labels };\n if (!shown) return null;\n return (\n <div\n role=\"dialog\"\n aria-labelledby={titleId}\n {...others}\n ref={ref}\n className={classNames('roaster-tooltip', 'roaster-tooltip--callout', className)}\n >\n <button\n className=\"roaster-tooltip__close\"\n type=\"button\"\n aria-label={text.close}\n onClick={() => setShown(false)}\n >\n <RoasterIcon name=\"x\" />\n </button>\n <p className=\"roaster-tooltip__title\" id={titleId}>\n {title}\n </p>\n {children}\n </div>\n );\n }\n);\nTooltipCallout.displayName = 'TooltipCallout';\n"],"names":["React","useControllableState","useUid","jsxs","classNames","jsx","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,aAAa,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;AAC9B,MAAC,cAAc,GAAGA,gBAAK,CAAC,UAAU;AAC9C,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AACtG,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGC,0BAAoB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AACtH,IAAI,MAAM,OAAO,GAAGC,cAAM,EAAE;AAC5B,IAAI,MAAM,IAAI,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,EAAE;AAChD,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI;AAC3B,IAAI,uBAAuBC,eAAI;AAC/B,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,IAAI,EAAE,QAAQ;AACtB,QAAQ,iBAAiB,EAAE,OAAO;AAClC,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAEC,kBAAU,CAAC,iBAAiB,EAAE,0BAA0B,EAAE,SAAS,CAAC;AACvF,QAAQ,QAAQ,EAAE;AAClB,0BAA0BC,cAAG;AAC7B,YAAY,QAAQ;AACpB,YAAY;AACZ,cAAc,SAAS,EAAE,wBAAwB;AACjD,cAAc,IAAI,EAAE,QAAQ;AAC5B,cAAc,YAAY,EAAE,IAAI,CAAC,KAAK;AACtC,cAAc,OAAO,EAAE,MAAM,QAAQ,CAAC,KAAK,CAAC;AAC5C,cAAc,QAAQ,kBAAkBA,cAAG,CAACC,uBAAW,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE;AACtE;AACA,WAAW;AACX,0BAA0BD,cAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACzG,UAAU;AACV;AACA;AACA,KAAK;AACL,EAAE;AACF;AACA,cAAc,CAAC,WAAW,GAAG,gBAAgB;;"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var Button = require('../Button/Button.js');
|
|
7
|
-
|
|
7
|
+
require('../Icon/Icon.js');
|
|
8
|
+
var RoasterIcon = require('../Icon/RoasterIcon.js');
|
|
8
9
|
var index = require('../../utils/useUid/index.js');
|
|
9
10
|
var index$1 = require('../../utils/classNames/index.js');
|
|
10
11
|
|
|
@@ -65,7 +66,7 @@ const Visualizer = React__namespace.forwardRef((props, ref) => {
|
|
|
65
66
|
className: "roaster-visualizer__close",
|
|
66
67
|
"aria-label": text.close,
|
|
67
68
|
onClick: () => panelRef.current?.hidePopover?.(),
|
|
68
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" })
|
|
69
70
|
}
|
|
70
71
|
)
|
|
71
72
|
] }),
|
|
@@ -84,7 +85,7 @@ const Visualizer = React__namespace.forwardRef((props, ref) => {
|
|
|
84
85
|
"aria-controls": panelId,
|
|
85
86
|
"aria-expanded": open,
|
|
86
87
|
onClick: () => panelRef.current?.showPopover?.(),
|
|
87
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "chevron-up" })
|
|
88
89
|
}
|
|
89
90
|
)
|
|
90
91
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Visualizer.js","sources":["../../../../src/components/Visualizer/Visualizer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport {
|
|
1
|
+
{"version":3,"file":"Visualizer.js","sources":["../../../../src/components/Visualizer/Visualizer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The text of the visualizer's buttons, for other languages. */\nexport interface VisualizerLabels {\n /** The name of the button that opens the preview on phones, read by screen readers. */\n open: string;\n /** The name of the button that closes it. */\n close: string;\n}\n\nconst defaultVisualizerLabels: VisualizerLabels = { open: 'Open the preview', close: 'Close the preview' };\n\n/** Every native `<aside>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to the panel. */\nexport interface VisualizerProps extends Omit<React.ComponentPropsWithoutRef<'aside'>, 'title'> {\n /** The title of the preview. It also names the panel. */\n title: React.ReactNode;\n /** The preview. */\n children?: React.ReactNode;\n /** The text of the buttons, in English by default. */\n labels?: Partial<VisualizerLabels>;\n}\n\n/**\n * A preview panel beside a form, to see the result of the changes being made. On phones, it is a sheet (a popover)\n * that a bar at the bottom of the screen opens; its close button, Escape and a click outside close it.\n */\nexport const Visualizer = React.forwardRef<HTMLElement, VisualizerProps>((props, ref) => {\n const { className, children, title, labels, id, ...others } = props;\n const text = { ...defaultVisualizerLabels, ...labels };\n const panelId = useUid(id);\n const titleId = useUid();\n const panelRef = React.useRef<HTMLElement | null>(null);\n const setRefs = React.useCallback(\n (panel: HTMLElement | null) => {\n panelRef.current = panel;\n if (typeof ref === 'function') ref(panel);\n else if (ref) ref.current = panel;\n },\n [ref]\n );\n // Whether the sheet is open, for the opener's aria-expanded. The browser opens and closes it (popover).\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n const panel = panelRef.current;\n const onToggle = (event: Event) => setOpen((event as ToggleEvent).newState === 'open');\n panel?.addEventListener('toggle', onToggle);\n return () => panel?.removeEventListener('toggle', onToggle);\n }, []);\n // `popover` isn't in React 18's types.\n const popover = { popover: 'auto' } as React.HTMLAttributes<HTMLElement>;\n\n return (\n <>\n <aside\n aria-labelledby={titleId}\n {...others}\n {...popover}\n id={panelId}\n ref={setRefs}\n className={classNames('roaster-visualizer', 'roaster-preview-background', className)}\n >\n <div className=\"roaster-visualizer__header\">\n <h2 className=\"roaster-visualizer__title\" id={titleId}>\n {title}\n </h2>\n <Button\n iconOnly\n variant=\"secondary\"\n className=\"roaster-visualizer__close\"\n aria-label={text.close}\n onClick={() => panelRef.current?.hidePopover?.()}\n >\n <RoasterIcon name=\"x\" />\n </Button>\n </div>\n <div className=\"roaster-visualizer__content\">{children}</div>\n </aside>\n <div className=\"roaster-visualizer-opener\">\n <p className=\"roaster-visualizer-opener__title\">{title}</p>\n <Button\n iconOnly\n variant=\"secondary\"\n aria-label={text.open}\n aria-controls={panelId}\n aria-expanded={open}\n onClick={() => panelRef.current?.showPopover?.()}\n >\n <RoasterIcon name=\"chevron-up\" />\n </Button>\n </div>\n </>\n );\n});\n\nVisualizer.displayName = 'Visualizer';\n"],"names":["React","useUid","jsxs","Fragment","classNames","jsx","Button","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,mBAAmB,EAAE;AAC5E,MAAC,UAAU,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACrE,EAA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AAU,YAAY,EAAE,IAAI,CAAC,IAAI;AACjC,UAAU,eAAe,EAAE,OAAO;AAClC,UAAU,eAAe,EAAE,IAAI;AAC/B,UAAU,OAAO,EAAE,MAAM,QAAQ,CAAC,OAAO,EAAE,WAAW,IAAI;AAC1D,UAAU,QAAQ,kBAAkBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AAC3E;AACA;AACA,KAAK,EAAE;AACP,GAAG,EAAE,CAAC;AACN,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
package/cjs/utils/Slot/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var react = require('@floating-ui/react');
|
|
5
4
|
var React = require('react');
|
|
6
|
-
var index$
|
|
7
|
-
var index = require('../getElementRef/index.js');
|
|
5
|
+
var index$2 = require('../classNames/index.js');
|
|
6
|
+
var index$1 = require('../getElementRef/index.js');
|
|
7
|
+
var index = require('../useMergeRefs/index.js');
|
|
8
8
|
|
|
9
9
|
function _interopNamespaceDefault(e) {
|
|
10
10
|
var n = Object.create(null);
|
|
@@ -30,7 +30,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
30
30
|
slotValue(...args);
|
|
31
31
|
};
|
|
32
32
|
} else if (key === "className") {
|
|
33
|
-
merged.className = index$
|
|
33
|
+
merged.className = index$2.classNames(slotValue, childValue);
|
|
34
34
|
} else if (key === "style") {
|
|
35
35
|
merged.style = { ...slotValue, ...childValue };
|
|
36
36
|
}
|
|
@@ -39,7 +39,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
39
39
|
}
|
|
40
40
|
const Slot = React__namespace.forwardRef(({ children, ...slotProps }, forwardedRef) => {
|
|
41
41
|
const child = React__namespace.isValidElement(children) ? children : null;
|
|
42
|
-
const ref =
|
|
42
|
+
const ref = index.useMergeRefs([forwardedRef, child ? index$1.getElementRef(child) : void 0]);
|
|
43
43
|
if (!child) {
|
|
44
44
|
if (React__namespace.Children.count(children) > 1) throw new Error("Slot needs a single element as its child.");
|
|
45
45
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/utils/Slot/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/utils/Slot/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '../classNames';\nimport { getElementRef } from '../getElementRef';\nimport { useMergeRefs } from '../useMergeRefs';\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n /** One element, which receives the slot's props and ref. */\n children?: React.ReactNode;\n}\n\ntype AnyProps = Record<string, unknown>;\n\n/**\n * Merges the slot's props into the child's: event handlers both run (the child's first), classes add up, styles merge\n * with the child's winning, and anything else is the child's.\n */\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps): AnyProps {\n const merged: AnyProps = { ...slotProps, ...childProps };\n Object.keys(slotProps).forEach((key) => {\n const slotValue = slotProps[key];\n const childValue = childProps[key];\n if (/^on[A-Z]/.test(key) && typeof slotValue === 'function' && typeof childValue === 'function') {\n merged[key] = (...args: unknown[]) => {\n childValue(...args);\n slotValue(...args);\n };\n } else if (key === 'className') {\n merged.className = classNames(slotValue as string, childValue as string);\n } else if (key === 'style') {\n merged.style = { ...(slotValue as React.CSSProperties), ...(childValue as React.CSSProperties) };\n }\n });\n return merged;\n}\n\n/**\n * Renders its only child with the slot's props and ref merged in, instead of an element of its own. It is what\n * `asChild` and the triggers use: `<Tooltip label=\"Help\"><Button>?</Button></Tooltip>`.\n */\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>(({ children, ...slotProps }, forwardedRef) => {\n const child = React.isValidElement<AnyProps>(children) ? children : null;\n const ref = useMergeRefs([forwardedRef, child ? getElementRef(child) : undefined]);\n\n if (!child) {\n if (React.Children.count(children) > 1) throw new Error('Slot needs a single element as its child.');\n return null;\n }\n // The ref last: on React 19 the child's own ref is in its props, and it's merged into this one.\n return React.cloneElement(child, { ...mergeProps(slotProps, child.props), ref });\n});\n\nSlot.displayName = 'Slot';\n"],"names":["classNames","React","useMergeRefs","getElementRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE;AAC3C,EAAE,MAAM,MAAM,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,UAAU,EAAE;AAChD,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;AAC1C,IAAI,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC;AACpC,IAAI,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC;AACtC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,SAAS,KAAK,UAAU,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;AACrG,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK;AACjC,QAAQ,UAAU,CAAC,GAAG,IAAI,CAAC;AAC3B,QAAQ,SAAS,CAAC,GAAG,IAAI,CAAC;AAC1B,MAAM,CAAC;AACP,IAAI,CAAC,MAAM,IAAI,GAAG,KAAK,WAAW,EAAE;AACpC,MAAM,MAAM,CAAC,SAAS,GAAGA,kBAAU,CAAC,SAAS,EAAE,UAAU,CAAC;AAC1D,IAAI,CAAC,MAAM,IAAI,GAAG,KAAK,OAAO,EAAE;AAChC,MAAM,MAAM,CAAC,KAAK,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,UAAU,EAAE;AACpD,IAAI;AACJ,EAAE,CAAC,CAAC;AACJ,EAAE,OAAO,MAAM;AACf;AACY,MAAC,IAAI,GAAGC,gBAAK,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,YAAY,KAAK;AACnF,EAAE,MAAM,KAAK,GAAGA,gBAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,IAAI;AAChE,EAAE,MAAM,GAAG,GAAGC,kBAAY,CAAC,CAAC,YAAY,EAAE,KAAK,GAAGC,qBAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;AACjF,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,IAAIF,gBAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC;AACxG,IAAI,OAAO,IAAI;AACf,EAAE;AACF,EAAE,OAAOA,gBAAK,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,GAAG,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AAClF,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var react = require('@floating-ui/react');
|
|
6
5
|
var React = require('react');
|
|
7
|
-
var index = require('../Slot/index.js');
|
|
6
|
+
var index$1 = require('../Slot/index.js');
|
|
7
|
+
var index = require('../useMergeRefs/index.js');
|
|
8
8
|
|
|
9
9
|
function _interopNamespaceDefault(e) {
|
|
10
10
|
var n = Object.create(null);
|
|
@@ -22,8 +22,8 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
22
22
|
function createDropdownTrigger(name, useDropdownContext) {
|
|
23
23
|
const Trigger = React__namespace.forwardRef(({ children, ...props }, ref) => {
|
|
24
24
|
const context = useDropdownContext();
|
|
25
|
-
const mergedRef =
|
|
26
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index.Slot, { ...context.getReferenceProps(props), ref: mergedRef, children });
|
|
25
|
+
const mergedRef = index.useMergeRefs([context.refs.setReference, ref]);
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index$1.Slot, { ...context.getReferenceProps(props), ref: mergedRef, children });
|
|
27
27
|
});
|
|
28
28
|
Trigger.displayName = `${name}Trigger`;
|
|
29
29
|
return Trigger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownTrigger.js","sources":["../../../../src/utils/useDropdown/DropdownTrigger.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DropdownTrigger.js","sources":["../../../../src/utils/useDropdown/DropdownTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '../Slot';\nimport { useMergeRefs } from '../useMergeRefs';\nimport type { useDropdown } from './index';\n\nexport interface DropdownTriggerProps extends React.HTMLAttributes<HTMLElement> {\n /** The element that opens the dropdown, such as a Button. It must accept a ref: not a fragment, text or number. */\n children: React.ReactElement;\n}\n\n/**\n * Makes the trigger component of a dropdown (ActionList.Trigger, DropdownCard.Trigger): it gives its child element\n * the dropdown's ref and props, keeping the child's own.\n */\nexport function createDropdownTrigger(name: string, useDropdownContext: () => ReturnType<typeof useDropdown>) {\n const Trigger = React.forwardRef<HTMLElement, DropdownTriggerProps>(({ children, ...props }, ref) => {\n const context = useDropdownContext();\n const mergedRef = useMergeRefs([context.refs.setReference, ref]);\n\n return (\n <Slot {...context.getReferenceProps(props)} ref={mergedRef}>\n {children}\n </Slot>\n );\n });\n Trigger.displayName = `${name}Trigger`;\n return Trigger;\n}\n"],"names":["React","useMergeRefs","jsx","Slot"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKO,SAAS,qBAAqB,CAAC,IAAI,EAAE,kBAAkB,EAAE;AAChE,EAAE,MAAM,OAAO,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AACpE,IAAI,MAAM,OAAO,GAAG,kBAAkB,EAAE;AACxC,IAAI,MAAM,SAAS,GAAGC,kBAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;AACpE,IAAI,uBAAuBC,cAAG,CAACC,YAAI,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACvG,EAAE,CAAC,CAAC;AACJ,EAAE,OAAO,CAAC,WAAW,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;AACxC,EAAE,OAAO,OAAO;AAChB;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
for (var k in e) {
|
|
10
|
+
n[k] = e[k];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
n.default = e;
|
|
14
|
+
return Object.freeze(n);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
18
|
+
|
|
19
|
+
function useMergeRefs(refs) {
|
|
20
|
+
const cleanup = React__namespace.useRef(void 0);
|
|
21
|
+
return React__namespace.useMemo(
|
|
22
|
+
() => {
|
|
23
|
+
if (refs.every((ref) => ref == null)) return null;
|
|
24
|
+
return (instance) => {
|
|
25
|
+
cleanup.current?.();
|
|
26
|
+
cleanup.current = void 0;
|
|
27
|
+
if (instance == null) return;
|
|
28
|
+
const cleanups = refs.map((ref) => setRef(ref, instance));
|
|
29
|
+
cleanup.current = () => cleanups.forEach((refCleanup) => refCleanup?.());
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
// The refs are the dependencies, and each caller passes the same number of them on every render.
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
refs
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function setRef(ref, instance) {
|
|
38
|
+
if (ref == null) return void 0;
|
|
39
|
+
if (typeof ref === "function") {
|
|
40
|
+
const refCleanup = ref(instance);
|
|
41
|
+
return typeof refCleanup === "function" ? refCleanup : () => ref(null);
|
|
42
|
+
}
|
|
43
|
+
const objectRef = ref;
|
|
44
|
+
objectRef.current = instance;
|
|
45
|
+
return () => {
|
|
46
|
+
objectRef.current = null;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.useMergeRefs = useMergeRefs;
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/utils/useMergeRefs/index.ts"],"sourcesContent":["import * as React from 'react';\n\ntype Cleanup = () => void;\n\n/**\n * One callback ref that sets every ref given, or `null` when none is set: `ref={useMergeRefs([inputRef, ref])}`. It\n * keeps its identity while the refs do. A callback ref that returns a cleanup (React 19) gets it run when the element\n * goes; any other one is called with `null`.\n *\n * Roaster's own, not Floating UI's: Floating UI ships as one file, so importing this hook from it put the whole\n * library in the first load of every app with a Button, beside any component that needs the rest, such as ActionList.\n */\nexport function useMergeRefs<T>(refs: Array<React.Ref<T> | undefined>): React.RefCallback<T> | null {\n const cleanup = React.useRef<Cleanup | undefined>(undefined);\n\n return React.useMemo(\n () => {\n if (refs.every((ref) => ref == null)) return null;\n return (instance: T | null) => {\n cleanup.current?.();\n cleanup.current = undefined;\n if (instance == null) return;\n const cleanups = refs.map((ref) => setRef(ref, instance));\n cleanup.current = () => cleanups.forEach((refCleanup) => refCleanup?.());\n };\n },\n // The refs are the dependencies, and each caller passes the same number of them on every render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n refs\n );\n}\n\nfunction setRef<T>(ref: React.Ref<T> | undefined, instance: T): Cleanup | undefined {\n if (ref == null) return undefined;\n if (typeof ref === 'function') {\n const refCleanup: unknown = ref(instance);\n return typeof refCleanup === 'function' ? (refCleanup as Cleanup) : () => ref(null);\n }\n const objectRef = ref as React.MutableRefObject<T | null>;\n objectRef.current = instance;\n return () => {\n objectRef.current = null;\n };\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;AAEO,SAAS,YAAY,CAAC,IAAI,EAAE;AACnC,EAAE,MAAM,OAAO,GAAGA,gBAAK,CAAC,MAAM,CAAC,MAAM,CAAC;AACtC,EAAE,OAAOA,gBAAK,CAAC,OAAO;AACtB,IAAI,MAAM;AACV,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,IAAI,CAAC,EAAE,OAAO,IAAI;AACvD,MAAM,OAAO,CAAC,QAAQ,KAAK;AAC3B,QAAQ,OAAO,CAAC,OAAO,IAAI;AAC3B,QAAQ,OAAO,CAAC,OAAO,GAAG,MAAM;AAChC,QAAQ,IAAI,QAAQ,IAAI,IAAI,EAAE;AAC9B,QAAQ,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AACjE,QAAQ,OAAO,CAAC,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,IAAI,CAAC;AAChF,MAAM,CAAC;AACP,IAAI,CAAC;AACL;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA,SAAS,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE;AAC/B,EAAE,IAAI,GAAG,IAAI,IAAI,EAAE,OAAO,MAAM;AAChC,EAAE,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;AACjC,IAAI,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC;AACpC,IAAI,OAAO,OAAO,UAAU,KAAK,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC;AAC1E,EAAE;AACF,EAAE,MAAM,SAAS,GAAG,GAAG;AACvB,EAAE,SAAS,CAAC,OAAO,GAAG,QAAQ;AAC9B,EAAE,OAAO,MAAM;AACf,IAAI,SAAS,CAAC,OAAO,GAAG,IAAI;AAC5B,EAAE,CAAC;AACH;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { FloatingFocusManager, FloatingList } from '@floating-ui/react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { flushSync } from 'react-dom';
|
|
6
6
|
import { useActionListContext } from '../ActionList.context.js';
|
|
7
|
+
import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
|
|
7
8
|
import { useMediaQuery, PHONE_QUERY } from '../../../utils/useMediaQuery/index.js';
|
|
8
9
|
import { classNames } from '../../../utils/classNames/index.js';
|
|
9
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListDropdown.js","sources":["../../../../../src/components/ActionList/components/ActionListDropdown.tsx"],"sourcesContent":["import { FloatingFocusManager, FloatingList
|
|
1
|
+
{"version":3,"file":"ActionListDropdown.js","sources":["../../../../../src/components/ActionList/components/ActionListDropdown.tsx"],"sourcesContent":["import { FloatingFocusManager, FloatingList } from '@floating-ui/react';\nimport * as React from 'react';\nimport { flushSync } from 'react-dom';\nimport { PHONE_QUERY, classNames, useMediaQuery, useMergeRefs } from '@/utils';\nimport { useActionListContext } from '../ActionList.context';\n\n/** Every native `<div>` prop (`aria-label`, `className`, `style`...) is accepted and forwarded to the menu. */\nexport interface ActionListDropdownProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * On a phone (480px wide at most), the menu rises from the window's bottom as a sheet, its full width, over the\n * dimmed page; on a wider screen it opens under its trigger as usual. Guidance: keep a menu beside its trigger; a\n * sheet suits a long one, such as a list of filters with a search.\n * @defaultValue false\n */\n sheet?: boolean;\n}\n\n/** The menu: its groups, dividers and items. Rendered while the action list is open. */\nexport const ActionListDropdown = React.forwardRef<HTMLDivElement, ActionListDropdownProps>(\n ({ className, style, children, sheet = false, ...props }, propRef) => {\n const { context: floatingContext, ...context } = useActionListContext();\n const ref = useMergeRefs([context.refs.setFloating, propRef]);\n // A sheet on a phone is placed by the CSS, at the window's bottom, not beside its trigger.\n const asSheet = useMediaQuery(PHONE_QUERY) && sheet;\n // Closing gives the focus back to the trigger, except when tabbing away: then it moves on from the trigger.\n const [returnFocus, setReturnFocus] = React.useState(true);\n React.useEffect(() => {\n if (context.open) setReturnFocus(true);\n }, [context.open]);\n if (!context.open) return null;\n\n return (\n // The list navigation moves the focus to the first item.\n <FloatingFocusManager context={floatingContext} modal={false} initialFocus={-1} returnFocus={returnFocus}>\n <div\n ref={ref}\n {...context.getFloatingProps({\n ...props,\n onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n props.onKeyDown?.(event);\n // Tabbing away closes the menu, and Tab moves on from the trigger, as if the menu weren't there.\n if (event.key === 'Tab') {\n flushSync(() => setReturnFocus(false));\n (context.refs.domReference.current as HTMLElement | null)?.focus();\n context.setOpen(false);\n }\n },\n })}\n // After the spread, so a caller's className and style add to these instead of replacing them.\n className={classNames(\n 'roaster-action-list',\n 'roaster-action-list--floating',\n sheet && 'roaster-action-list--sheet',\n className\n )}\n style={asSheet ? style : { ...context.floatingStyles, ...style }}\n >\n <FloatingList elementsRef={context.elementsRef} labelsRef={context.labelsRef}>\n {children}\n </FloatingList>\n </div>\n </FloatingFocusManager>\n );\n }\n);\n\nActionListDropdown.displayName = 'ActionListDropdown';\n"],"names":[],"mappings":";;;;;;;;;;AAOY,MAAC,kBAAkB,GAAG,KAAK,CAAC,UAAU;AAClD,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,OAAO,KAAK;AACxE,IAAI,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,GAAG,oBAAoB,EAAE;AAC3E,IAAI,MAAM,GAAG,GAAG,YAAY,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Z,WAAW;AACX,UAAU,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,KAAK,EAAE;AAC1E,UAAU,QAAQ,kBAAkB,GAAG,CAAC,YAAY,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE;AAClI;AACA,OAAO,EAAE;AACT;AACA,EAAE;AACF;AACA,kBAAkB,CAAC,WAAW,GAAG,oBAAoB;;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useListItem
|
|
3
|
+
import { useListItem } from '@floating-ui/react';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import
|
|
5
|
+
import '../../Icon/Icon.js';
|
|
6
|
+
import { RoasterIcon } from '../../Icon/RoasterIcon.js';
|
|
6
7
|
import { useActionListContext } from '../ActionList.context.js';
|
|
8
|
+
import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
|
|
7
9
|
import { Slot } from '../../../utils/Slot/index.js';
|
|
8
10
|
import { classNames } from '../../../utils/classNames/index.js';
|
|
9
11
|
|
|
@@ -47,7 +49,7 @@ const ActionListItem = React.forwardRef(
|
|
|
47
49
|
),
|
|
48
50
|
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
51
|
children,
|
|
50
|
-
checkMark && /* @__PURE__ */ jsx(
|
|
52
|
+
checkMark && /* @__PURE__ */ jsx(RoasterIcon, { name: "check", className: "roaster-action-list__check roaster-action-list__check--end" }),
|
|
51
53
|
detail != null && detail !== false && /* @__PURE__ */ jsx("span", { className: "roaster-action-list__detail", children: detail })
|
|
52
54
|
] })
|
|
53
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListItem.js","sources":["../../../../../src/components/ActionList/components/ActionListItem.tsx"],"sourcesContent":["import { useListItem
|
|
1
|
+
{"version":3,"file":"ActionListItem.js","sources":["../../../../../src/components/ActionList/components/ActionListItem.tsx"],"sourcesContent":["import { useListItem } from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, Slot, useMergeRefs } from '@/utils';\nimport { RoasterIcon } from '../../Icon';\nimport { useActionListContext } from '../ActionList.context';\n\n/** Every native `<button>` prop (`onClick`, `disabled`, ...) is accepted and forwarded to the item. */\nexport interface ActionListItemProps extends React.ComponentPropsWithoutRef<'button'> {\n /**\n * The text of the item, with an optional icon. An icon after the text goes to the item's end, with the text in a\n * `<span>`: `<span>Privacy</span><i className=\"fa-regular fa-arrow-up-right-from-square\" aria-hidden=\"true\" />`.\n */\n children: React.ReactNode;\n /** `danger` for a destructive action, such as deleting or logging out. */\n tone?: 'danger';\n /** A short text at the item's end, such as the current choice of a setting. With `asChild`, write it in the child. */\n detail?: React.ReactNode;\n /**\n * Makes the item one of a set of choices (`role=\"menuitemradio\"`), chosen when `true`, such as a sort order. Its\n * icon takes the primary color while it is chosen.\n */\n checked?: boolean;\n /**\n * One of several choices that can be chosen together (`role=\"menuitemcheckbox\"`), such as labels, instead of one of a\n * set. With `checked`.\n */\n multiple?: boolean;\n /**\n * Shows a check at the item's end while it is chosen, such as in a picker whose items carry icons of their own (a\n * status, an avatar). With `checked`.\n */\n checkMark?: boolean;\n /**\n * Renders the child element (such as a link, or a router's Link) as the item, instead of a `<button>`.\n * @defaultValue false\n */\n asChild?: boolean;\n}\n\n/**\n * An item of the menu (`role=\"menuitem\"`, or `menuitemradio` with `checked`): a button, or with `asChild` its child,\n * such as a link. Choosing it closes the menu, after its own `onClick`, unless that calls `event.preventDefault()`.\n */\nexport const ActionListItem = React.forwardRef<HTMLButtonElement, ActionListItemProps>(\n (\n {\n className,\n children,\n tone,\n detail,\n checked,\n multiple,\n checkMark,\n asChild = false,\n onClick,\n type = 'button',\n ...rest\n },\n propRef\n ) => {\n const context = useActionListContext();\n const item = useListItem();\n const ref = useMergeRefs([item.ref, propRef]);\n const Component = asChild ? Slot : 'button';\n\n return (\n <Component\n {...(asChild ? {} : { type })}\n role={checked === undefined ? 'menuitem' : multiple ? 'menuitemcheckbox' : 'menuitemradio'}\n aria-checked={checked}\n {...context.getItemProps({\n ...rest,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n if (!event.defaultPrevented) context.setOpen(false);\n },\n })}\n ref={ref}\n tabIndex={context.activeIndex === item.index ? 0 : -1}\n className={classNames(\n 'roaster-action-list__item',\n { 'roaster-action-list__item--danger': tone === 'danger' },\n className\n )}\n >\n {asChild ? (\n children\n ) : (\n <>\n {children}\n {checkMark && (\n <RoasterIcon name=\"check\" className=\"roaster-action-list__check roaster-action-list__check--end\" />\n )}\n {detail != null && detail !== false && <span className=\"roaster-action-list__detail\">{detail}</span>}\n </>\n )}\n </Component>\n );\n }\n);\nActionListItem.displayName = 'ActionListItem';\n"],"names":[],"mappings":";;;;;;;;;;;AAOY,MAAC,cAAc,GAAG,KAAK,CAAC,UAAU;AAC9C,EAAE,CAAC;AACH,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,IAAI;AACR,IAAI,MAAM;AACV,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO,GAAG,KAAK;AACnB,IAAI,OAAO;AACX,IAAI,IAAI,GAAG,QAAQ;AACnB,IAAI,GAAG;AACP,GAAG,EAAE,OAAO,KAAK;AACjB,IAAI,MAAM,OAAO,GAAG,oBAAoB,EAAE;AAC1C,IAAI,MAAM,IAAI,GAAG,WAAW,EAAE;AAC9B,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACjD,IAAI,MAAM,SAAS,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ;AAC/C,IAAI,uBAAuB,GAAG;AAC9B,MAAM,SAAS;AACf,MAAM;AACN,QAAQ,GAA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|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useMergeRefs } from '@floating-ui/react';
|
|
5
4
|
import { useActionListContext } from '../ActionList.context.js';
|
|
5
|
+
import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
|
|
6
6
|
import { classNames } from '../../../utils/classNames/index.js';
|
|
7
7
|
|
|
8
8
|
const ActionListSearch = React.forwardRef(
|
|
@@ -11,14 +11,32 @@ const ActionListSearch = React.forwardRef(
|
|
|
11
11
|
const inputRef = React.useRef(null);
|
|
12
12
|
const ref = useMergeRefs([inputRef, propRef]);
|
|
13
13
|
React.useEffect(() => {
|
|
14
|
-
|
|
14
|
+
const input = inputRef.current;
|
|
15
|
+
const menu = input?.closest(".roaster-action-list");
|
|
16
|
+
if (!autoFocus || !input || !menu) return void 0;
|
|
17
|
+
const armed = new AbortController();
|
|
15
18
|
let inner = 0;
|
|
16
19
|
const outer = requestAnimationFrame(() => {
|
|
17
|
-
inner = requestAnimationFrame(() =>
|
|
20
|
+
inner = requestAnimationFrame(() => {
|
|
21
|
+
input.focus();
|
|
22
|
+
const disarm = () => armed.abort();
|
|
23
|
+
menu.addEventListener("keydown", disarm, { capture: true, signal: armed.signal });
|
|
24
|
+
menu.addEventListener("pointerdown", disarm, { capture: true, signal: armed.signal });
|
|
25
|
+
menu.addEventListener(
|
|
26
|
+
"focusin",
|
|
27
|
+
(event) => {
|
|
28
|
+
if (event.target === input) return;
|
|
29
|
+
disarm();
|
|
30
|
+
input.focus();
|
|
31
|
+
},
|
|
32
|
+
{ signal: armed.signal }
|
|
33
|
+
);
|
|
34
|
+
});
|
|
18
35
|
});
|
|
19
36
|
return () => {
|
|
20
37
|
cancelAnimationFrame(outer);
|
|
21
38
|
cancelAnimationFrame(inner);
|
|
39
|
+
armed.abort();
|
|
22
40
|
};
|
|
23
41
|
}, [autoFocus]);
|
|
24
42
|
return /* @__PURE__ */ jsxs("div", { className: classNames("roaster-action-list__search", className), style, children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListSearch.js","sources":["../../../../../src/components/ActionList/components/ActionListSearch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMergeRefs } from '
|
|
1
|
+
{"version":3,"file":"ActionListSearch.js","sources":["../../../../../src/components/ActionList/components/ActionListSearch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useMergeRefs } from '@/utils';\nimport { useActionListContext } from '../ActionList.context';\n\n/**\n * Every native `<input>` prop (`value`, `onChange`, `placeholder`, ...) is accepted and forwarded to the search field,\n * with the ref. `className` and `style` go to its row.\n */\nexport interface ActionListSearchProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'style'> {\n /** The search field's name, read by screen readers, such as \"Find a filter\". */\n 'aria-label': string;\n /** Called with the text as the user types: hide the items that don't match it. */\n onValueChange?(value: string): void;\n /** A key hint at the row's end, such as the shortcut that opens the menu. */\n shortcut?: React.ReactNode;\n /** Styles added to the row. */\n style?: React.CSSProperties;\n}\n\n/**\n * A search row at the top of a long menu, such as a list of filters: it takes the focus when the menu opens, and the\n * down arrow goes on to the items. Filter the items from its value.\n */\nexport const ActionListSearch = React.forwardRef<HTMLInputElement, ActionListSearchProps>(\n ({ onValueChange, onChange, onKeyDown, shortcut, className, style, autoFocus = true, ...rest }, propRef) => {\n const context = useActionListContext();\n const inputRef = React.useRef<HTMLInputElement>(null);\n const ref = useMergeRefs([inputRef, propRef]);\n // The menu gives the focus to its first item a frame after it opens; the search takes it back after that. On a slow\n // device the menu's can come later still: until a key or a click in the menu, the search takes the focus back from\n // an item, once.\n React.useEffect(() => {\n const input = inputRef.current;\n const menu = input?.closest<HTMLElement>('.roaster-action-list');\n if (!autoFocus || !input || !menu) return undefined;\n const armed = new AbortController();\n let inner = 0;\n const outer = requestAnimationFrame(() => {\n inner = requestAnimationFrame(() => {\n input.focus();\n const disarm = () => armed.abort();\n menu.addEventListener('keydown', disarm, { capture: true, signal: armed.signal });\n menu.addEventListener('pointerdown', disarm, { capture: true, signal: armed.signal });\n menu.addEventListener(\n 'focusin',\n (event) => {\n if (event.target === input) return;\n disarm();\n input.focus();\n },\n { signal: armed.signal }\n );\n });\n });\n return () => {\n cancelAnimationFrame(outer);\n cancelAnimationFrame(inner);\n armed.abort();\n };\n }, [autoFocus]);\n return (\n <div className={classNames('roaster-action-list__search', className)} style={style}>\n <input\n {...rest}\n ref={ref}\n type=\"search\"\n onChange={(event) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n // The menu's own keys move between its items; from the search field, the down arrow goes to the first.\n if (event.key === 'ArrowDown' && !event.defaultPrevented) {\n event.preventDefault();\n context.elementsRef.current.find((element) => element && !element.hidden)?.focus();\n }\n // Typing a letter moves between items elsewhere in the menu; here it is the search.\n event.stopPropagation();\n }}\n />\n {shortcut != null && shortcut !== false && <kbd>{shortcut}</kbd>}\n </div>\n );\n }\n);\nActionListSearch.displayName = 'ActionListSearch';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,gBAAgB,GAAG,KAAK,CAAC,UAAU;AAChD,EAAE,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,OAAO,KAAK;AAC9G,IAAI,MAAM,OAAO,GAAG,oBAAoB,EAAE;AAC1C,IAAI,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACvC,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACjD,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM;AAC1B,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO;AACpC,MAAM,MAAM,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC;AACzD,MAAM,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,IAA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AQ,EAAE;AAC3H,sBAAsB,GAAG;AACzB,QAAQ,OAAO;AACf,QAAQ;AACR,UAAU,GAAG,IAAI;AACjB,UAAU,GAAG;AACb,UAAU,IAAI,EAAE,QAAQ;AACxB,UAAU,QAAQ,EAAE,CAAC,KAAK,KAAK;AAC/B,YAAY,QAAQ,GAAG,KAAK,CAAC;AAC7B,YAAY,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;AACtD,UAAU,CAAC;AACX,UAAU,SAAS,EAAE,CAAC,KAAK,KAAK;AAChC,YAAY,SAAS,GAAG,KAAK,CAAC;AAC9B,YAAY,IAAI,KAAK,CAAC,GAAG,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;AACtE,cAAc,KAAK,CAAC,cAAc,EAAE;AACpC,cAAc,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE;AAChG,YAAY;AACZ,YAAY,KAAK,CAAC,eAAe,EAAE;AACnC,UAAU;AACV;AACA,OAAO;AACP,MAAM,QAAQ,IAAI,IAAI,IAAI,QAAQ,KAAK,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;AACjG,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;;"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useListItem, useFloating, autoUpdate, offset, flip, shift, useInteractions, useClick, useRole, useDismiss, useListNavigation, useTypeahead,
|
|
3
|
+
import { useListItem, useFloating, autoUpdate, offset, flip, shift, useInteractions, useClick, useRole, useDismiss, useListNavigation, useTypeahead, FloatingFocusManager, FloatingList } from '@floating-ui/react';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import
|
|
5
|
+
import '../../Icon/Icon.js';
|
|
6
|
+
import { RoasterIcon } from '../../Icon/RoasterIcon.js';
|
|
6
7
|
import { useActionListContext, ActionListProvider } from '../ActionList.context.js';
|
|
7
8
|
import { readLengthToken } from '../../../utils/useDropdown/index.js';
|
|
9
|
+
import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
|
|
8
10
|
import { classNames } from '../../../utils/classNames/index.js';
|
|
9
11
|
|
|
10
12
|
const ActionListSubmenu = React.forwardRef(
|
|
@@ -78,7 +80,7 @@ const ActionListSubmenu = React.forwardRef(
|
|
|
78
80
|
children: [
|
|
79
81
|
label,
|
|
80
82
|
detail != null && detail !== false && /* @__PURE__ */ jsx("span", { className: "roaster-action-list__detail", children: detail }),
|
|
81
|
-
/* @__PURE__ */ jsx(
|
|
83
|
+
/* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-right" })
|
|
82
84
|
]
|
|
83
85
|
}
|
|
84
86
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListSubmenu.js","sources":["../../../../../src/components/ActionList/components/ActionListSubmenu.tsx"],"sourcesContent":["import {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n offset,\n type Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useListItem,\n useListNavigation,\n
|
|
1
|
+
{"version":3,"file":"ActionListSubmenu.js","sources":["../../../../../src/components/ActionList/components/ActionListSubmenu.tsx"],"sourcesContent":["import {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n offset,\n type Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useListItem,\n useListNavigation,\n useRole,\n useTypeahead,\n} from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, readLengthToken, useMergeRefs } from '@/utils';\nimport { RoasterIcon } from '../../Icon';\nimport { ActionListProvider, useActionListContext } from '../ActionList.context';\n\n/** Every native `<button>` prop is accepted and forwarded to the item that opens the submenu. */\nexport interface ActionListSubmenuProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'children'> {\n /** The item that opens the submenu: its text, with an optional icon. */\n label: React.ReactNode;\n /** A short text before the item's chevron, such as the current choice. */\n detail?: React.ReactNode;\n /** The submenu's groups, dividers and items, as in ActionList.Dropdown. */\n children: React.ReactNode;\n /**\n * Where the submenu opens. It moves to the other side when there is no room.\n * @defaultValue 'right-start'\n */\n placement?: Placement;\n}\n\n/**\n * An item that opens a submenu beside it, such as a setting's choices: on click, Enter, or the right arrow (the left\n * arrow and Escape close it). The item names the submenu. Choosing an item of the submenu closes it and its menu.\n */\nexport const ActionListSubmenu = React.forwardRef<HTMLButtonElement, ActionListSubmenuProps>(\n ({ label, detail, children, placement = 'right-start', className, type = 'button', ...rest }, propRef) => {\n const parent = useActionListContext();\n const item = useListItem();\n const [open, setOpen] = React.useState(false);\n const elementsRef = React.useRef<Array<HTMLElement | null>>([]);\n const labelsRef = React.useRef<Array<string | null>>([]);\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null);\n\n const data = useFloating({\n placement,\n strategy: 'fixed',\n transform: false,\n open,\n onOpenChange: setOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n // As far from its item as the menu is from its button, past the menu's padding.\n offset(\n ({ elements }) =>\n readLengthToken(elements.floating, '--roaster-action-list-offset', 8) +\n readLengthToken(elements.floating, '--roaster-action-list-padding', 0)\n ),\n flip(),\n shift({ padding: 8 }),\n ],\n });\n const { context } = data;\n const interactions = useInteractions([\n useClick(context),\n useRole(context, { role: 'menu' }),\n useDismiss(context),\n useListNavigation(context, {\n listRef: elementsRef,\n activeIndex,\n onNavigate: setActiveIndex,\n loop: true,\n nested: true,\n focusItemOnOpen: true,\n }),\n useTypeahead(context, { listRef: labelsRef, activeIndex, onMatch: open ? setActiveIndex : undefined }),\n ]);\n\n // The submenu's items close it and the menu it came from.\n const parentSetOpen = parent.setOpen;\n const submenu = React.useMemo(\n () => ({\n ...data,\n ...interactions,\n open,\n activeIndex,\n elementsRef,\n labelsRef,\n setOpen: (next: boolean | ((previous: boolean) => boolean)) => {\n const value = typeof next === 'function' ? next(open) : next;\n setOpen(value);\n if (!value) parentSetOpen(false);\n },\n }),\n [data, interactions, open, activeIndex, parentSetOpen]\n );\n\n const triggerRef = useMergeRefs([item.ref, data.refs.setReference, propRef]);\n\n return (\n <>\n <button\n {...parent.getItemProps(interactions.getReferenceProps(rest))}\n ref={triggerRef}\n type={type}\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n tabIndex={parent.activeIndex === item.index ? 0 : -1}\n className={classNames('roaster-action-list__item', className)}\n >\n {label}\n {detail != null && detail !== false && <span className=\"roaster-action-list__detail\">{detail}</span>}\n <RoasterIcon name=\"chevron-right\" />\n </button>\n {open && (\n <FloatingFocusManager context={context} modal={false} initialFocus={-1}>\n <div\n ref={data.refs.setFloating}\n {...interactions.getFloatingProps({\n onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n // Its keys are its own: the menu around it doesn't move, nor close on Escape, which closes only\n // the submenu. Tab goes on to close both.\n if (event.key === 'Tab') return;\n event.stopPropagation();\n if (event.key === 'Escape') {\n setOpen(false);\n (data.refs.domReference.current as HTMLElement | null)?.focus();\n }\n },\n })}\n className=\"roaster-action-list roaster-action-list--submenu roaster-action-list--floating\"\n style={data.floatingStyles}\n >\n <ActionListProvider value={submenu}>\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {children}\n </FloatingList>\n </ActionListProvider>\n </div>\n </FloatingFocusManager>\n )}\n </>\n );\n }\n);\nActionListSubmenu.displayName = 'ActionListSubmenu';\n"],"names":[],"mappings":";;;;;;;;;;;AAsBY,MAAC,iBAAiB,GAAG,KAAK,CAAC,UAAU;AACjD,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,aAAa,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,OAA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I,CAAC,cAAc;AACpC,UAAU,QAAQ,kBAAkB,GAAG,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,kBAAkB,GAAG,CAAC,YAAY,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE;AACjK;AACA,OAAO,EAAE;AACT,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useListItem
|
|
3
|
+
import { useListItem } from '@floating-ui/react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useActionListContext } from '../ActionList.context.js';
|
|
6
|
+
import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
|
|
6
7
|
import { useControllableState } from '../../../utils/useControllableState/index.js';
|
|
7
8
|
import { classNames } from '../../../utils/classNames/index.js';
|
|
8
9
|
|