ionbase-ui 0.81.1 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox.d.ts +39 -0
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +77 -4
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Fieldset.d.ts +62 -0
- package/dist/components/Fieldset.d.ts.map +1 -0
- package/dist/components/Fieldset.js +58 -0
- package/dist/components/Fieldset.js.map +1 -0
- package/dist/components/Menu.d.ts +87 -24
- package/dist/components/Menu.d.ts.map +1 -1
- package/dist/components/Menu.js +245 -28
- package/dist/components/Menu.js.map +1 -1
- package/dist/components/PageHeader.d.ts +59 -0
- package/dist/components/PageHeader.d.ts.map +1 -0
- package/dist/components/PageHeader.js +29 -0
- package/dist/components/PageHeader.js.map +1 -0
- package/dist/components/Radio.d.ts +14 -0
- package/dist/components/Radio.d.ts.map +1 -1
- package/dist/components/Radio.js +15 -4
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/SearchField.d.ts +36 -0
- package/dist/components/SearchField.d.ts.map +1 -0
- package/dist/components/SearchField.js +76 -0
- package/dist/components/SearchField.js.map +1 -0
- package/dist/components/index.d.ts +10 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -2
- package/dist/components/index.js.map +1 -1
- package/dist/figma-descriptions.json +96 -76
- package/dist/figma-map.json +272 -39
- package/dist/meta/Checkbox.json +8 -6
- package/dist/meta/CheckboxGroup.json +268 -0
- package/dist/meta/Divider.json +2 -2
- package/dist/meta/Fieldset.json +162 -0
- package/dist/meta/Menu.json +201 -27
- package/dist/meta/MenuItem.json +137 -17
- package/dist/meta/MenuSection.json +90 -0
- package/dist/meta/MenuTrigger.json +177 -0
- package/dist/meta/PageHeader.json +169 -0
- package/dist/meta/Radio.json +0 -1
- package/dist/meta/RadioGroup.json +59 -7
- package/dist/meta/SearchField.json +487 -0
- package/dist/meta/Stepper.json +2 -2
- package/dist/meta/Tabs.json +3 -3
- package/dist/meta/components.json +1917 -217
- package/dist/meta/contrast.json +594 -90
- package/dist/meta/index.json +89 -10
- package/dist/meta/patterns/DataTable.json +14 -6
- package/dist/meta/patterns/Form.json +27 -2
- package/dist/meta/patterns/PageShell.json +18 -5
- package/dist/meta/patterns/index.json +5 -2
- package/dist/styles/fieldset.css +65 -0
- package/dist/styles/index.css +3 -0
- package/dist/styles/menu.css +153 -32
- package/dist/styles/page-header.css +94 -0
- package/dist/styles/radio.css +0 -20
- package/dist/styles/search-field.css +70 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
package/dist/components/Menu.js
CHANGED
|
@@ -1,35 +1,252 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { cloneElement, createContext, forwardRef, useContext, useMemo, useRef, } from 'react';
|
|
4
|
+
import { DismissButton, Overlay, mergeProps, useMenu, useMenuItem, useMenuSection, useMenuTrigger, usePopover, useSeparator, useSubmenuTrigger, } from 'react-aria';
|
|
5
|
+
import { useMenuTriggerState, useSubmenuTriggerState, useTreeState, } from 'react-stately';
|
|
6
|
+
import { CollectionBuilder, Item, Section, getChildNodes, } from '@react-stately/collections';
|
|
3
7
|
import { resolveDisabled } from './resolve-disabled.js';
|
|
4
8
|
/**
|
|
5
|
-
* Menu
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
* One row of a Menu. A collection element, like TabItem: it renders nothing
|
|
10
|
+
* itself — Menu reads its props and draws the row — so it only means anything
|
|
11
|
+
* as a direct child of Menu or MenuSection. Give it a `key`; that key is what
|
|
12
|
+
* `onAction` and `selectedKeys` speak in.
|
|
13
|
+
*/
|
|
14
|
+
export function MenuItem(
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
+
_props) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
/*
|
|
20
|
+
* The collection builder asks the element's TYPE how to turn it into a node.
|
|
21
|
+
* Borrowing Item's answer is what makes MenuItem a collection element while
|
|
22
|
+
* keeping its own prop type: the builder copies every prop onto `node.props`,
|
|
23
|
+
* which is where Menu reads `icon` and `isDisabled` back from.
|
|
24
|
+
*/
|
|
25
|
+
MenuItem.getCollectionNode = Item.getCollectionNode;
|
|
26
|
+
MenuItem.displayName = 'MenuItem';
|
|
27
|
+
/**
|
|
28
|
+
* A named group of MenuItems. `title` is Figma's `Menu Section Title`; without
|
|
29
|
+
* one, pass `aria-label` and the group is set off by a rule instead.
|
|
30
|
+
*/
|
|
31
|
+
export { Section as MenuSection };
|
|
21
32
|
/** Figma's trailing check. Always occupies its slot so rows never reflow as the
|
|
22
33
|
* selection moves; only its visibility changes. */
|
|
23
34
|
const Check = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "m5 13 4 4L19 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
/** Figma draws no submenu row; this is Button's chevron, turned to point
|
|
36
|
+
* where the submenu opens. Mirrored in right-to-left layouts by the CSS. */
|
|
37
|
+
const Chevron = () => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "m9 18 6-6-6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
38
|
+
/**
|
|
39
|
+
* What MenuTrigger hands the Menu it opens: the ARIA wiring from
|
|
40
|
+
* `useMenuTrigger` (the label, autofocus and close-on-action), and the root
|
|
41
|
+
* state every submenu's state is derived from.
|
|
42
|
+
*/
|
|
43
|
+
const MenuTriggerContext = createContext(null);
|
|
44
|
+
/**
|
|
45
|
+
* What a menu hands the submenus beneath it. `onAction` is the ROOT menu's:
|
|
46
|
+
* an action chosen three levels down is still one of the actions the caller
|
|
47
|
+
* listed, and it reaches the one handler the caller wrote.
|
|
48
|
+
*/
|
|
49
|
+
const MenuTreeContext = createContext(null);
|
|
50
|
+
/**
|
|
51
|
+
* Reads the two deprecated item props before the menu's state exists.
|
|
52
|
+
*
|
|
53
|
+
* `isDisabled` needs nothing here: react-stately's SelectionManager reads an
|
|
54
|
+
* item's own `isDisabled` off `node.props`, and the arrow keys skip it. The
|
|
55
|
+
* `disabled` alias it has never heard of, so that one has to reach
|
|
56
|
+
* `useTreeState` as a key — a row that only LOOKED disabled would still take
|
|
57
|
+
* focus and fire `onAction`. `isSelected` has to become `selectedKeys` for the
|
|
58
|
+
* same reason. Building the collection once more is the price of the aliases,
|
|
59
|
+
* and a menu is small enough that the price is nothing. Delete this with them.
|
|
60
|
+
*/
|
|
61
|
+
function readItemFlags(props) {
|
|
62
|
+
const flags = {
|
|
63
|
+
disabled: [],
|
|
64
|
+
selected: [],
|
|
65
|
+
hasLegacySelected: false,
|
|
66
|
+
};
|
|
67
|
+
const visit = (nodes) => {
|
|
68
|
+
for (const node of nodes) {
|
|
69
|
+
if (node.type === 'section') {
|
|
70
|
+
visit(node.childNodes);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const p = node.props;
|
|
74
|
+
if (!p)
|
|
75
|
+
continue;
|
|
76
|
+
if (p.isDisabled === undefined &&
|
|
77
|
+
resolveDisabled(p.isDisabled, p.disabled))
|
|
78
|
+
flags.disabled.push(node.key);
|
|
79
|
+
if (p.isSelected !== undefined) {
|
|
80
|
+
flags.hasLegacySelected = true;
|
|
81
|
+
if (p.isSelected)
|
|
82
|
+
flags.selected.push(node.key);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
visit(new CollectionBuilder().build(props));
|
|
87
|
+
return flags;
|
|
88
|
+
}
|
|
89
|
+
function MenuRow(props) {
|
|
90
|
+
const tree = useContext(MenuTreeContext);
|
|
91
|
+
return props.item.hasChildNodes && tree ? (_jsx(SubmenuRow, { ...props, tree: tree })) : (_jsx(ActionRow, { ...props }));
|
|
92
|
+
}
|
|
93
|
+
function ActionRow({ item, state }) {
|
|
94
|
+
const ref = useRef(null);
|
|
95
|
+
const { menuItemProps, labelProps, isFocused, isFocusVisible, isSelected, isDisabled, } = useMenuItem({ key: item.key }, state, ref);
|
|
96
|
+
const icon = item.props?.icon;
|
|
97
|
+
return (_jsxs("li", { ...menuItemProps, ref: ref, className: [
|
|
98
|
+
'ion-menu__item',
|
|
99
|
+
isSelected ? 'ion-menu__item--selected' : '',
|
|
100
|
+
]
|
|
101
|
+
.filter(Boolean)
|
|
102
|
+
.join(' '), "data-focused": isFocused || undefined, "data-focus-visible": isFocusVisible || undefined, "data-disabled": isDisabled || undefined, children: [icon && (_jsx("span", { className: "ion-menu__icon", "aria-hidden": "true", children: icon })), _jsx("span", { ...labelProps, className: "ion-menu__label", children: item.rendered }), state.selectionManager.selectionMode !== 'none' && (_jsx("span", { className: "ion-menu__check", "aria-hidden": "true", children: _jsx(Check, {}) }))] }));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A row that opens a submenu. Right arrow, Enter or Space opens it with focus
|
|
106
|
+
* on its first row; hovering opens it after a short delay; left arrow or
|
|
107
|
+
* Escape closes it and puts focus back on this row.
|
|
108
|
+
*
|
|
109
|
+
* The submenu is NOT modal: the parent menu stays on screen and hoverable, so
|
|
110
|
+
* the pointer can move between the two. react-aria makes that choice, and it
|
|
111
|
+
* is the right one — a submenu that trapped focus would make moving back up a
|
|
112
|
+
* level a keyboard-only act.
|
|
113
|
+
*/
|
|
114
|
+
function SubmenuRow({ item, state, menuRef, tree, }) {
|
|
115
|
+
const ref = useRef(null);
|
|
116
|
+
const submenuRef = useRef(null);
|
|
117
|
+
const submenuState = useSubmenuTriggerState({ triggerKey: item.key }, tree.rootState);
|
|
118
|
+
const { submenuTriggerProps, submenuProps, popoverProps } = useSubmenuTrigger({ parentMenuRef: menuRef, submenuRef, type: 'menu' }, submenuState, ref);
|
|
119
|
+
// `isOpen` describes the trigger, it is not a menu-item option.
|
|
120
|
+
const { isOpen, ...triggerOptions } = submenuTriggerProps;
|
|
121
|
+
const { menuItemProps, labelProps, isFocused, isFocusVisible, isDisabled } = useMenuItem({ ...triggerOptions, key: item.key }, state, ref);
|
|
122
|
+
const icon = item.props?.icon;
|
|
123
|
+
return (_jsxs("li", { ...menuItemProps, ref: ref, className: "ion-menu__item ion-menu__item--submenu", "data-focused": isFocused || undefined, "data-focus-visible": isFocusVisible || undefined, "data-disabled": isDisabled || undefined, "data-open": isOpen || undefined, children: [icon && (_jsx("span", { className: "ion-menu__icon", "aria-hidden": "true", children: icon })), _jsx("span", { ...labelProps, className: "ion-menu__label", children: item.rendered }), _jsx("span", { className: "ion-menu__chevron", "aria-hidden": "true", children: _jsx(Chevron, {}) }), submenuState.isOpen && (_jsx(MenuPopover, { state: submenuState, triggerRef: ref, popoverRef: submenuRef, placement: "end top", isNonModal: popoverProps.isNonModal, shouldCloseOnInteractOutside: popoverProps.shouldCloseOnInteractOutside, disableFocusManagement: popoverProps.disableFocusManagement, children: _jsx(MenuList, { ...submenuProps, onAction: tree.onAction, children: item.props.children }) }))] }));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The floating surface a menu opens on. Mounted only while open, for the
|
|
127
|
+
* reason AGENTS.md gives about overlay hooks: `usePopover` has to be called in
|
|
128
|
+
* the component that mounts with the overlay.
|
|
129
|
+
*
|
|
130
|
+
* Figma's Menu already IS the surface — border, radius, Shadow/lg — so this
|
|
131
|
+
* wrapper paints nothing. It positions, and it carries the underlay that makes
|
|
132
|
+
* an outside click close the root menu. A submenu has no underlay: it is
|
|
133
|
+
* non-modal, and an underlay would swallow the pointer on its way back to the
|
|
134
|
+
* parent.
|
|
135
|
+
*/
|
|
136
|
+
function MenuPopover({ state, triggerRef, popoverRef, placement, isNonModal, shouldCloseOnInteractOutside, disableFocusManagement, children, }) {
|
|
137
|
+
const { popoverProps, underlayProps } = usePopover({
|
|
138
|
+
triggerRef,
|
|
139
|
+
popoverRef,
|
|
140
|
+
placement,
|
|
141
|
+
offset: isNonModal ? 0 : 4,
|
|
142
|
+
// Line the submenu's first row up with the row that opened it: the
|
|
143
|
+
// menu's own padding plus its border.
|
|
144
|
+
crossOffset: isNonModal ? -7 : 0,
|
|
145
|
+
isNonModal,
|
|
146
|
+
shouldCloseOnInteractOutside,
|
|
147
|
+
}, state);
|
|
148
|
+
return (_jsxs(Overlay, { disableFocusManagement: disableFocusManagement, children: [!isNonModal && (_jsx("div", { ...underlayProps, className: "ion-menu-popover__underlay" })), _jsxs("div", { ...popoverProps, ref: popoverRef, className: "ion-menu-popover", children: [!isNonModal && _jsx(DismissButton, { onDismiss: state.close }), children, !isNonModal && _jsx(DismissButton, { onDismiss: state.close })] })] }));
|
|
149
|
+
}
|
|
150
|
+
function MenuSectionGroup({ section, state, isFirst, menuRef, }) {
|
|
151
|
+
const { itemProps, headingProps, groupProps } = useMenuSection({
|
|
152
|
+
heading: section.rendered,
|
|
153
|
+
'aria-label': section['aria-label'],
|
|
154
|
+
});
|
|
155
|
+
const { separatorProps } = useSeparator({ elementType: 'li' });
|
|
156
|
+
return (_jsxs(_Fragment, { children: [!isFirst && !section.rendered && (_jsx("li", { ...separatorProps, className: "ion-menu__separator" })), _jsxs("li", { ...itemProps, className: "ion-menu__section", children: [section.rendered && (_jsx("span", { ...headingProps, className: "ion-menu__section-title", children: section.rendered })), _jsx("ul", { ...groupProps, className: "ion-menu__group", children: [...getChildNodes(section, state.collection)].map((node) => (_jsx(MenuRow, { item: node, state: state, menuRef: menuRef }, node.key))) })] })] }));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The list itself, shared by the root menu and every submenu. It knows nothing
|
|
160
|
+
* about triggers: whatever opened it has already put its wiring into `props`.
|
|
161
|
+
*/
|
|
162
|
+
const MenuList = forwardRef(function MenuList(props, forwardedRef) {
|
|
163
|
+
const { className, style } = props;
|
|
164
|
+
const flags = useMemo(() => readItemFlags(props),
|
|
165
|
+
// Only the collection's inputs matter here; the rest of `props` changes on
|
|
166
|
+
// every render and would rebuild the collection for nothing.
|
|
167
|
+
[props.children, props.items]);
|
|
168
|
+
const disabledKeys = useMemo(() => new Set([...(props.disabledKeys ?? []), ...flags.disabled]), [props.disabledKeys, flags.disabled]);
|
|
169
|
+
const usesLegacySelection = flags.hasLegacySelected &&
|
|
170
|
+
props.selectedKeys === undefined &&
|
|
171
|
+
props.defaultSelectedKeys === undefined;
|
|
172
|
+
const stateProps = {
|
|
173
|
+
...props,
|
|
174
|
+
disabledKeys,
|
|
175
|
+
...(usesLegacySelection && {
|
|
176
|
+
selectedKeys: new Set(flags.selected),
|
|
177
|
+
selectionMode: props.selectionMode ??
|
|
178
|
+
(flags.selected.length > 1 ? 'multiple' : 'single'),
|
|
179
|
+
}),
|
|
180
|
+
};
|
|
181
|
+
const state = useTreeState(stateProps);
|
|
182
|
+
const ref = useRef(null);
|
|
183
|
+
const { menuProps } = useMenu(stateProps, state, ref);
|
|
184
|
+
const setRef = (el) => {
|
|
185
|
+
ref.current = el;
|
|
186
|
+
if (typeof forwardedRef === 'function')
|
|
187
|
+
forwardedRef(el);
|
|
188
|
+
else if (forwardedRef)
|
|
189
|
+
forwardedRef.current = el;
|
|
190
|
+
};
|
|
191
|
+
const nodes = [...state.collection];
|
|
192
|
+
return (_jsx("ul", { ...menuProps, ref: setRef, style: style, className: ['ion-menu', className].filter(Boolean).join(' '), children: nodes.map((node, i) => node.type === 'section' ? (_jsx(MenuSectionGroup, { section: node, state: state, isFirst: i === 0, menuRef: ref }, node.key)) : (_jsx(MenuRow, { item: node, state: state, menuRef: ref }, node.key))) }));
|
|
33
193
|
});
|
|
34
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Menu — Figma `Menu` (82:306), `Menu Item` and `Menu Section Title`.
|
|
196
|
+
*
|
|
197
|
+
* A real ARIA menu: `role="menu"`, one tab stop, arrow keys, Home and End,
|
|
198
|
+
* typeahead, and disabled rows listed but skipped. Figma's `Type` is
|
|
199
|
+
* `selectionMode` — Single draws one check, Multi draws several — and with
|
|
200
|
+
* a selection mode the rows become `menuitemradio` / `menuitemcheckbox` and
|
|
201
|
+
* announce their checked state.
|
|
202
|
+
*
|
|
203
|
+
* On its own it is the surface only, rendered in flow. Inside a MenuTrigger it
|
|
204
|
+
* floats, opens and closes, is named by its trigger, and can open submenus.
|
|
205
|
+
*/
|
|
206
|
+
export const Menu = forwardRef(function Menu(props, forwardedRef) {
|
|
207
|
+
const trigger = useContext(MenuTriggerContext);
|
|
208
|
+
if (!trigger)
|
|
209
|
+
return _jsx(MenuList, { ...props, ref: forwardedRef });
|
|
210
|
+
/*
|
|
211
|
+
* The trigger names the menu through aria-labelledby. An aria-label the
|
|
212
|
+
* caller passed is kept and wins, because a trigger reading "⋯" or "Options"
|
|
213
|
+
* is often a worse name than the one the caller wrote.
|
|
214
|
+
*/
|
|
215
|
+
const { 'aria-labelledby': labelledBy, ...wiring } = trigger.menuProps;
|
|
216
|
+
const named = props['aria-label'] || props['aria-labelledby'];
|
|
217
|
+
const merged = mergeProps(wiring, named ? {} : { 'aria-labelledby': labelledBy }, props);
|
|
218
|
+
return (_jsx(MenuTreeContext.Provider, { value: {
|
|
219
|
+
rootState: trigger.rootState,
|
|
220
|
+
onAction: props.onAction,
|
|
221
|
+
}, children: _jsx(MenuList, { ...merged, ref: forwardedRef }) }));
|
|
222
|
+
});
|
|
223
|
+
/**
|
|
224
|
+
* MenuTrigger — a Button that opens a Menu.
|
|
225
|
+
*
|
|
226
|
+
* The "⋯" overflow menu is this with an icon-only Button; there is no separate
|
|
227
|
+
* component for it, because the only difference is the Button's content and
|
|
228
|
+
* its required aria-label.
|
|
229
|
+
*
|
|
230
|
+
* `useMenuTrigger` does what a Popover wrapped round a Menu could not: the
|
|
231
|
+
* trigger announces `aria-haspopup="menu"` and `aria-expanded`, the menu is
|
|
232
|
+
* named by the trigger, ArrowDown and ArrowUp open it with focus on the first
|
|
233
|
+
* or last row, and choosing an action closes it and returns focus to the
|
|
234
|
+
* trigger.
|
|
235
|
+
*/
|
|
236
|
+
export function MenuTrigger({ children, placement = 'bottom start', isDisabled, ...stateProps }) {
|
|
237
|
+
const [trigger, menu] = React.Children.toArray(children);
|
|
238
|
+
const rootState = useMenuTriggerState(stateProps);
|
|
239
|
+
const triggerRef = useRef(null);
|
|
240
|
+
const popoverRef = useRef(null);
|
|
241
|
+
const { menuTriggerProps, menuProps } = useMenuTrigger({ isDisabled }, rootState, triggerRef);
|
|
242
|
+
return (_jsxs(_Fragment, { children: [cloneElement(trigger, mergeProps(trigger.props, {
|
|
243
|
+
...menuTriggerProps,
|
|
244
|
+
isDisabled,
|
|
245
|
+
ref: triggerRef,
|
|
246
|
+
})), rootState.isOpen && (_jsx(MenuPopover, { state: rootState, triggerRef: triggerRef, popoverRef: popoverRef, placement: placement, children: _jsx(MenuTriggerContext.Provider, { value: {
|
|
247
|
+
rootState,
|
|
248
|
+
menuProps: menuProps,
|
|
249
|
+
}, children: menu }) }))] }));
|
|
250
|
+
}
|
|
251
|
+
MenuTrigger.displayName = 'MenuTrigger';
|
|
35
252
|
//# sourceMappingURL=Menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../src/components/Menu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../src/components/Menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,E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EAChB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAsB,YAEjC,KAAC,kBAAkB,CAAC,QAAQ,IAC1B,KAAK,EAAE;wBACL,SAAS;wBACT,SAAS,EAAE,SAAoC;qBAChD,YAEA,IAAI,GACuB,GAClB,CACf,IACA,CACJ,CAAC;AACJ,CAAC;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Which heading the title renders as. `1` is the default because a page
|
|
4
|
+
* header is the page's title. `2` is for a header inside a pane that is not
|
|
5
|
+
* the page — the detail half of a list-detail layout, under the list's `h1`.
|
|
6
|
+
*/
|
|
7
|
+
export type PageHeaderHeadingLevel = 1 | 2;
|
|
8
|
+
export interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
9
|
+
/** The page's title. Rendered as the `h1`. */
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The title's id. Pass it when something else points at the heading —
|
|
13
|
+
* `<main aria-labelledby>` is the usual one. Generated when omitted.
|
|
14
|
+
*/
|
|
15
|
+
titleId?: string;
|
|
16
|
+
/** Heading element for the title. Defaults to `1`. */
|
|
17
|
+
headingLevel?: PageHeaderHeadingLevel;
|
|
18
|
+
/** One or two sentences under the title: what this page is for. */
|
|
19
|
+
description?: React.ReactNode;
|
|
20
|
+
/** A Breadcrumb, above the title. */
|
|
21
|
+
breadcrumb?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Beside the title: a Badge or two for the record's state — "Paused",
|
|
24
|
+
* "Draft". State, not actions.
|
|
25
|
+
*/
|
|
26
|
+
status?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* At the end of the title row: the page's actions, most important last.
|
|
29
|
+
* One primary Button at most; several more go in a MenuTrigger.
|
|
30
|
+
*/
|
|
31
|
+
actions?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* A row beneath, that belongs to the header rather than the page's
|
|
34
|
+
* content: the page's Tabs, or the filters its table answers to.
|
|
35
|
+
*/
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* PageHeader — the top of a page: where you are, what it is, and what you can
|
|
40
|
+
* do to it.
|
|
41
|
+
*
|
|
42
|
+
* Promoted from the demo app, where five screens hand-wrote it in three
|
|
43
|
+
* different shapes (`.demo-page__header`, `.demo-run-header`, and a bare
|
|
44
|
+
* `<div>`), each with its own gap and its own idea of where the actions
|
|
45
|
+
* aligned. Every enterprise system ships one — Carbon's PageHeader,
|
|
46
|
+
* Lightning's page headers — because every page has one.
|
|
47
|
+
*
|
|
48
|
+
* NOT A LANDMARK
|
|
49
|
+
*
|
|
50
|
+
* It renders a `<div>`, not a `<header>`. A `<header>` that is a child of
|
|
51
|
+
* `<body>` is the page's banner, and the app shell's Header already is that.
|
|
52
|
+
* The page's landmark is `<main>`, named by this title: pass `titleId` and
|
|
53
|
+
* point `<main aria-labelledby>` at it.
|
|
54
|
+
*
|
|
55
|
+
* No `'use client'`: `useId` resolves on the server, and nothing here is
|
|
56
|
+
* interactive. Interactive parts arrive through the slots.
|
|
57
|
+
*/
|
|
58
|
+
export declare const PageHeader: React.ForwardRefExoticComponent<PageHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
//# sourceMappingURL=PageHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/components/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,CAAC,CAAC;AAE3C,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,OAAO,CACR;IACC,8CAA8C;IAC9C,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,mEAAmE;IACnE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,qCAAqC;IACrC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,wFAmDtB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* PageHeader — the top of a page: where you are, what it is, and what you can
|
|
5
|
+
* do to it.
|
|
6
|
+
*
|
|
7
|
+
* Promoted from the demo app, where five screens hand-wrote it in three
|
|
8
|
+
* different shapes (`.demo-page__header`, `.demo-run-header`, and a bare
|
|
9
|
+
* `<div>`), each with its own gap and its own idea of where the actions
|
|
10
|
+
* aligned. Every enterprise system ships one — Carbon's PageHeader,
|
|
11
|
+
* Lightning's page headers — because every page has one.
|
|
12
|
+
*
|
|
13
|
+
* NOT A LANDMARK
|
|
14
|
+
*
|
|
15
|
+
* It renders a `<div>`, not a `<header>`. A `<header>` that is a child of
|
|
16
|
+
* `<body>` is the page's banner, and the app shell's Header already is that.
|
|
17
|
+
* The page's landmark is `<main>`, named by this title: pass `titleId` and
|
|
18
|
+
* point `<main aria-labelledby>` at it.
|
|
19
|
+
*
|
|
20
|
+
* No `'use client'`: `useId` resolves on the server, and nothing here is
|
|
21
|
+
* interactive. Interactive parts arrive through the slots.
|
|
22
|
+
*/
|
|
23
|
+
export const PageHeader = forwardRef(({ title, titleId, headingLevel = 1, description, breadcrumb, status, actions, className, children, ...rest }, ref) => {
|
|
24
|
+
const generatedId = useId();
|
|
25
|
+
const Heading = `h${headingLevel}`;
|
|
26
|
+
return (_jsxs("div", { ...rest, ref: ref, className: ['ion-page-header', className].filter(Boolean).join(' '), children: [breadcrumb && (_jsx("div", { className: "ion-page-header__breadcrumb", children: breadcrumb })), _jsxs("div", { className: "ion-page-header__main", children: [_jsxs("div", { className: "ion-page-header__heading", children: [_jsxs("div", { className: "ion-page-header__title-row", children: [_jsx(Heading, { id: titleId ?? generatedId, className: "ion-page-header__title", children: title }), status && (_jsx("div", { className: "ion-page-header__status", children: status }))] }), description && (_jsx("p", { className: "ion-page-header__description", children: description }))] }), actions && _jsx("div", { className: "ion-page-header__actions", children: actions })] }), children && _jsx("div", { className: "ion-page-header__below", children: children })] }));
|
|
27
|
+
});
|
|
28
|
+
PageHeader.displayName = 'PageHeader';
|
|
29
|
+
//# sourceMappingURL=PageHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageHeader.js","sourceRoot":"","sources":["../../src/components/PageHeader.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AA2CjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,KAAK,EACL,OAAO,EACP,YAAY,GAAG,CAAC,EAChB,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,WAAW,GAAG,KAAK,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAI,YAAY,EAAW,CAAC;IAE5C,OAAO,CACL,kBACM,IAAI,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAElE,UAAU,IAAI,CACb,cAAK,SAAS,EAAC,6BAA6B,YAAE,UAAU,GAAO,CAChE,EACD,eAAK,SAAS,EAAC,uBAAuB,aACpC,eAAK,SAAS,EAAC,0BAA0B,aACvC,eAAK,SAAS,EAAC,4BAA4B,aACzC,KAAC,OAAO,IACN,EAAE,EAAE,OAAO,IAAI,WAAW,EAC1B,SAAS,EAAC,wBAAwB,YAEjC,KAAK,GACE,EACT,MAAM,IAAI,CACT,cAAK,SAAS,EAAC,yBAAyB,YAAE,MAAM,GAAO,CACxD,IACG,EACL,WAAW,IAAI,CACd,YAAG,SAAS,EAAC,8BAA8B,YAAE,WAAW,GAAK,CAC9D,IACG,EACL,OAAO,IAAI,cAAK,SAAS,EAAC,0BAA0B,YAAE,OAAO,GAAO,IACjE,EACL,QAAQ,IAAI,cAAK,SAAS,EAAC,wBAAwB,YAAE,QAAQ,GAAO,IACjE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type FieldsetOrientation } from './Fieldset.js';
|
|
2
3
|
export type RadioSize = 'sm' | 'md' | 'lg';
|
|
3
4
|
export type RadioIntent = 'brand' | 'neutral' | 'danger';
|
|
4
5
|
export interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value'> {
|
|
@@ -20,7 +21,17 @@ export interface RadioGroupProps extends Omit<React.FieldsetHTMLAttributes<HTMLF
|
|
|
20
21
|
value?: string;
|
|
21
22
|
defaultValue?: string;
|
|
22
23
|
onChange?: (value: string) => void;
|
|
24
|
+
/** The question the options answer. Renders as the `<legend>`. */
|
|
23
25
|
label?: React.ReactNode;
|
|
26
|
+
/** Help text beneath the options. Replaced by `errorMessage` while invalid. */
|
|
27
|
+
description?: React.ReactNode;
|
|
28
|
+
/** Shown in the description's place while `isInvalid` is set. */
|
|
29
|
+
errorMessage?: React.ReactNode;
|
|
30
|
+
/** Shows `errorMessage` in the description's place. */
|
|
31
|
+
isInvalid?: boolean;
|
|
32
|
+
/** One option must be chosen before the form submits. */
|
|
33
|
+
isRequired?: boolean;
|
|
34
|
+
orientation?: FieldsetOrientation;
|
|
24
35
|
size?: RadioSize;
|
|
25
36
|
intent?: RadioIntent;
|
|
26
37
|
/** Whether every radio in the group is disabled. */
|
|
@@ -36,6 +47,9 @@ export interface RadioGroupProps extends Omit<React.FieldsetHTMLAttributes<HTMLF
|
|
|
36
47
|
* `role="radiogroup"`. Both are announced correctly, but a fieldset also groups
|
|
37
48
|
* the inputs for form submission and native validation, which the ARIA version
|
|
38
49
|
* does not.
|
|
50
|
+
*
|
|
51
|
+
* The fieldset itself is Fieldset's shell, shared with CheckboxGroup, so the
|
|
52
|
+
* two choice groups take the same label, help, error and orientation props.
|
|
39
53
|
*/
|
|
40
54
|
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
41
55
|
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../src/components/Radio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../src/components/Radio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC3C,MAAM,MAAM,W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IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,6FAoDtB,CAAC"}
|
package/dist/components/Radio.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useRef, useImperativeHandle, useContext, createContext, useId, } from 'react';
|
|
4
|
+
import { FieldsetShell, useFieldsetHelper, } from './Fieldset.js';
|
|
4
5
|
import { resolveDisabled } from './resolve-disabled.js';
|
|
5
6
|
/**
|
|
6
7
|
* A radio is meaningless alone — it needs siblings sharing a `name` and one
|
|
@@ -11,7 +12,7 @@ import { resolveDisabled } from './resolve-disabled.js';
|
|
|
11
12
|
const RadioGroupContext = createContext(null);
|
|
12
13
|
export const Radio = forwardRef((props, forwardedRef) => {
|
|
13
14
|
const group = useContext(RadioGroupContext);
|
|
14
|
-
const { value, size = group?.size ?? 'md', intent = group?.intent ?? 'brand', className, children, isDisabled, disabled, name = group?.name, ...rest } = props;
|
|
15
|
+
const { value, size = group?.size ?? 'md', intent = group?.intent ?? 'brand', className, children, isDisabled, disabled, name = group?.name, 'aria-describedby': describedBy, ...rest } = props;
|
|
15
16
|
const resolvedDisabled = resolveDisabled(isDisabled, disabled) ?? group?.isDisabled;
|
|
16
17
|
const domRef = useRef(null);
|
|
17
18
|
useImperativeHandle(forwardedRef, () => domRef.current);
|
|
@@ -40,7 +41,11 @@ export const Radio = forwardRef((props, forwardedRef) => {
|
|
|
40
41
|
group?.onChange?.(value);
|
|
41
42
|
rest.onChange?.(e);
|
|
42
43
|
};
|
|
43
|
-
return (_jsxs("label", { className: classNames, children: [_jsx("input", { ...rest, ref: domRef, type: "radio", name: name, value: value, disabled: resolvedDisabled,
|
|
44
|
+
return (_jsxs("label", { className: classNames, children: [_jsx("input", { ...rest, ref: domRef, type: "radio", name: name, value: value, disabled: resolvedDisabled,
|
|
45
|
+
// Native `required` on a radio already means "one of this name" —
|
|
46
|
+
// unlike a checkbox, it needs no toggling to say "at least one".
|
|
47
|
+
required: group?.isRequired || rest.required, "aria-describedby": [describedBy, group?.helperId].filter(Boolean).join(' ') ||
|
|
48
|
+
undefined, className: "ion-radio__input", onChange: handleChange, ...(controlled
|
|
44
49
|
? { checked: group.value === value }
|
|
45
50
|
: { defaultChecked: group?.defaultValue === value }) }), _jsx("span", { className: "ion-radio__indicator", "aria-hidden": "true", children: _jsx("span", { className: "ion-radio__dot" }) }), children && _jsx("span", { className: "ion-radio__label", children: children })] }));
|
|
46
51
|
});
|
|
@@ -50,11 +55,15 @@ Radio.displayName = 'Radio';
|
|
|
50
55
|
* `role="radiogroup"`. Both are announced correctly, but a fieldset also groups
|
|
51
56
|
* the inputs for form submission and native validation, which the ARIA version
|
|
52
57
|
* does not.
|
|
58
|
+
*
|
|
59
|
+
* The fieldset itself is Fieldset's shell, shared with CheckboxGroup, so the
|
|
60
|
+
* two choice groups take the same label, help, error and orientation props.
|
|
53
61
|
*/
|
|
54
62
|
export const RadioGroup = forwardRef((props, ref) => {
|
|
55
|
-
const { name, value, defaultValue, onChange,
|
|
63
|
+
const { name, value, defaultValue, onChange, size, intent, isDisabled, disabled, isRequired, description, errorMessage, className, ...rest } = props;
|
|
56
64
|
const resolvedDisabled = resolveDisabled(isDisabled, disabled);
|
|
57
65
|
const generated = useId();
|
|
66
|
+
const { helper, helperId } = useFieldsetHelper(description, errorMessage, rest.isInvalid);
|
|
58
67
|
return (_jsx(RadioGroupContext.Provider, { value: {
|
|
59
68
|
name: name ?? generated,
|
|
60
69
|
value,
|
|
@@ -63,7 +72,9 @@ export const RadioGroup = forwardRef((props, ref) => {
|
|
|
63
72
|
size,
|
|
64
73
|
intent,
|
|
65
74
|
isDisabled: resolvedDisabled,
|
|
66
|
-
|
|
75
|
+
isRequired,
|
|
76
|
+
helperId,
|
|
77
|
+
}, children: _jsx(FieldsetShell, { ...rest, ref: ref, disabled: resolvedDisabled, isChoiceGroup: true, helper: helper, helperId: helperId, className: ['ion-radio-group', className].filter(Boolean).join(' ') }) }));
|
|
67
78
|
});
|
|
68
79
|
RadioGroup.displayName = 'RadioGroup';
|
|
69
80
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../src/components/Radio.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EACZ,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,KAAK,GACN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../src/components/Radio.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EACZ,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,KAAK,GACN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAiBxD;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,aAAa,CAAgC,IAAI,CAAC,CAAC;AAkB7E,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IACtB,MAAM,KAAK,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC5C,MAAM,EACJ,KAAK,EACL,IAAI,GAAG,KAAK,EAAE,IAAI,IAAI,IAAI,EAC1B,MAAM,GAAG,KAAK,EAAE,MAAM,IAAI,OAAO,EACjC,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,IAAI,GAAG,KAAK,EAAE,IAAI,EAClB,kB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YACL,YAAY;YACZ,QAAQ;YACR,IAAI;YACJ,MAAM;YACN,UAAU,EAAE,gBAAgB;YAC5B,UAAU;YACV,QAAQ;SACT,YAED,KAAC,aAAa,OACR,IAAI,EACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,gBAAgB,EAC1B,aAAa,QACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GACnE,GACyB,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AriaSearchFieldProps } from 'react-aria';
|
|
3
|
+
export type SearchFieldSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
type SearchFieldDOMProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof AriaSearchFieldProps | 'size' | 'type' | 'disabled' | 'autoCapitalize'>;
|
|
5
|
+
export interface SearchFieldProps extends AriaSearchFieldProps, SearchFieldDOMProps {
|
|
6
|
+
/** Input's sizes: Small, Medium, Large. */
|
|
7
|
+
size?: SearchFieldSize;
|
|
8
|
+
/** Class names for the control box (`.ion-input`). */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Class names for the `.ion-field` wrapper when a label or helper is shown. */
|
|
11
|
+
wrapperClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* SearchField — a text field for a search query.
|
|
15
|
+
*
|
|
16
|
+
* NOT `<Input type="search">`. That gets the right input type and nothing
|
|
17
|
+
* else. `useSearchField` adds what a search box owes its user:
|
|
18
|
+
*
|
|
19
|
+
* `role="searchbox"`, so a screen reader announces a search field, not a
|
|
20
|
+
* text field. Enter calls `onSubmit` with the query. Escape clears it — a
|
|
21
|
+
* second Escape then reaches whatever the field sits in, so a search inside
|
|
22
|
+
* a dialog clears first and closes second. A clear button appears once there
|
|
23
|
+
* is something to clear, named in the user's language by React Aria.
|
|
24
|
+
*
|
|
25
|
+
* The clear button is out of the tab order on purpose, as React Aria sets it:
|
|
26
|
+
* Escape is the keyboard's way to clear, and an extra tab stop in every search
|
|
27
|
+
* box costs every keyboard user a keystroke. Pressing it puts focus back in the
|
|
28
|
+
* field.
|
|
29
|
+
*
|
|
30
|
+
* The box IS Input's — the component renders `.ion-input` and its size and
|
|
31
|
+
* state classes, so a search field beside an Input in a toolbar matches it
|
|
32
|
+
* exactly and cannot drift. Same arrangement as NumberInput.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SearchField: React.ForwardRefExoticComponent<SearchFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=SearchField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchField.d.ts","sourceRoot":"","sources":["../../src/components/SearchField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAQvE,OAAO,KAAK,EAAmB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIxE,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,KAAK,mBAAmB,GAAG,IAAI,CAC7B,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC3C,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAC7E,CAAC;AAEF,MAAM,WAAW,gBACf,SAAQ,oBAAoB,EAAE,mBAAmB;IACjD,2CAA2C;IAC3C,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AA0CD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,2FAqGvB,CAAC"}
|