@dloizides/ui-layout 1.19.0 → 1.21.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 +62 -0
- package/README.md +3 -2
- package/dist/index.d.mts +54 -3
- package/dist/index.d.ts +54 -3
- package/dist/index.js +75 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.21.0
|
|
4
|
+
|
|
5
|
+
**The collapsed `Tabs` menu can now present as a HAMBURGER (☰) — the universal mobile-nav affordance.**
|
|
6
|
+
|
|
7
|
+
The collapsed organizer nav reads better on a phone as a ☰ hamburger than as a caret field.
|
|
8
|
+
This adds an opt-in so a consumer can choose either presentation; the default is unchanged.
|
|
9
|
+
|
|
10
|
+
- **New opt-in prop `ModalDropdown.showHamburger?: boolean` (default `false`).** When set, the
|
|
11
|
+
DEFAULT trigger renders a ☰ glyph LEADING the active option's label, with the same bordered
|
|
12
|
+
field box, theme tokens and ≥44dp (`MIN_TOUCH_TARGET`) hit target as the caret variant. It
|
|
13
|
+
**takes precedence over `showCaret`** (a hamburger already IS the "this is a menu" cue, so the
|
|
14
|
+
trailing caret would be redundant) and, like `showCaret`, is ignored when a custom `renderTrigger`
|
|
15
|
+
is supplied. The glyph is a font character (U+2630) — no icon package enters this contract-pure
|
|
16
|
+
kit — and its colour comes from `colors.textSecondary` (no raw literals). It is decorative: the
|
|
17
|
+
trigger's `aria-label` still names the control, so screen readers do not announce the glyph.
|
|
18
|
+
- **New exported enum `TabsCollapsedTrigger { Caret, Hamburger }`** + new optional prop
|
|
19
|
+
**`Tabs.collapsedTrigger` / `TabsMenu.collapsedTrigger` (default `Caret`).** Selects how the
|
|
20
|
+
COLLAPSED (mobile) tab menu trigger presents; only affects the collapsed form, the wide pill
|
|
21
|
+
strip is identical either way. Exported as a regular (runtime) enum for the same reason as
|
|
22
|
+
`DropdownVariant` — a `const enum` cannot cross the published-package boundary under
|
|
23
|
+
`isolatedModules`.
|
|
24
|
+
|
|
25
|
+
Backward-compatible: two new optional props + one new enum, all defaulting to the prior behaviour;
|
|
26
|
+
no testID/selector changes. Per-tab E2E selectors (`{idPrefix}-menu` trigger, `{idPrefix}-tab-{key}`
|
|
27
|
+
/ descriptor option testIDs) are untouched. No new i18n keys (the existing `common.tabsMenuHint`
|
|
28
|
+
serves both presentations). Covered by component tests (`ModalDropdown.test.tsx`,
|
|
29
|
+
`Tabs.collapsed.test.tsx`).
|
|
30
|
+
|
|
31
|
+
## 1.20.0
|
|
32
|
+
|
|
33
|
+
**The collapsed `Tabs` menu now READS as a menu — a caret affordance + guaranteed focus.**
|
|
34
|
+
|
|
35
|
+
On the live phone-width organizer nav (`app.kefi.dloizides.com/organizer/passes`) the
|
|
36
|
+
collapsed trigger showed only the active label ("Passes") with no menu cue — styled like a
|
|
37
|
+
static chip/pill — so users could not tell it was a section switcher. This adds a clear
|
|
38
|
+
menu affordance and locks in keyboard focusability.
|
|
39
|
+
|
|
40
|
+
- **New opt-in prop `ModalDropdown.showCaret?: boolean` (default `false`).** When set, the
|
|
41
|
+
DEFAULT trigger renders a ▾ caret pinned to its trailing edge that rotates to point up
|
|
42
|
+
while the menu is open, with a ≥44dp (`MIN_TOUCH_TARGET`) hit target and the existing
|
|
43
|
+
bordered field box + theme tokens. **Every existing field-style dropdown in the kit is
|
|
44
|
+
unchanged** because the caret is off by default, and it is ignored when a custom
|
|
45
|
+
`renderTrigger` is supplied (that caller owns its own visuals). The caret is a font glyph
|
|
46
|
+
(U+25BE), so no icon package enters this contract-pure kit, and its colour comes from
|
|
47
|
+
`colors.textSecondary` (no raw literals). It is decorative — the trigger's `aria-label`
|
|
48
|
+
still names the control, so screen readers do not announce the glyph.
|
|
49
|
+
- **`TabsMenu` opts into `showCaret`**, so the collapsed `Tabs` section switcher now looks
|
|
50
|
+
like a proper control instead of a chip. No change to the public `Tabs` / `TabsMenu` API.
|
|
51
|
+
- **Focusability:** under react-native-web the trigger renders as a native `<button>`
|
|
52
|
+
(role=button, no `tabindex="-1"`), so it is keyboard-reachable and Enter/Space activate
|
|
53
|
+
it. A regression test asserts the collapsed trigger is not `tabindex="-1"`. (The
|
|
54
|
+
`tabindex="-1"` seen on the live DOM came from the older deployed version; it does not
|
|
55
|
+
reproduce on this source — proven by the rendered-DOM assertion, not assumed.)
|
|
56
|
+
|
|
57
|
+
Backward-compatible: one new optional prop, no testID/selector changes. Per-tab E2E
|
|
58
|
+
selectors (`{idPrefix}-menu` trigger, `{idPrefix}-tab-{key}` / descriptor option testIDs)
|
|
59
|
+
are untouched. No new i18n keys.
|
|
60
|
+
|
|
61
|
+
`ui-showcase` does not yet import `Tabs`/`ModalDropdown` (only `SegmentedControl`,
|
|
62
|
+
`CopyableId`, `TruncatedText`), so this is covered by component tests
|
|
63
|
+
(`ModalDropdown.test.tsx`, `Tabs.collapsed.test.tsx`); a showcase specimen is a follow-up.
|
|
64
|
+
|
|
3
65
|
## 1.19.0
|
|
4
66
|
|
|
5
67
|
**`Tabs` collapses to a real mobile menu below a breakpoint.**
|
package/README.md
CHANGED
|
@@ -11,8 +11,9 @@ Read theme + translations from the shared `@dloizides/ui-feedback` context (`use
|
|
|
11
11
|
| `Heading` | Themed section heading text. |
|
|
12
12
|
| `StatusBadge` | Status pill — caller supplies `label`/`color`/`backgroundColor`. |
|
|
13
13
|
| `UpgradePrompt` | Free-tier upgrade nudge; CTA navigates to the billing route via `useUi().navigate`. |
|
|
14
|
-
| `Tabs` | Controlled tabbed section shell. **Responsive**: a horizontal `role=tablist` pill strip on wide web, collapsing to a real mobile MENU (a trigger + vertical section list, via `ModalDropdown`) below `collapseBelow` (default 768) or on native. Per-tab `testID`s survive in both modes. Requires the `common.tabsMenuHint` key. |
|
|
15
|
-
| `
|
|
14
|
+
| `Tabs` | Controlled tabbed section shell. **Responsive**: a horizontal `role=tablist` pill strip on wide web, collapsing to a real mobile MENU (a trigger + vertical section list, via `ModalDropdown`) below `collapseBelow` (default 768) or on native. The collapsed trigger presents as a caret field (default) or a ☰ hamburger via `collapsedTrigger`. Per-tab `testID`s survive in both modes. Requires the `common.tabsMenuHint` key. |
|
|
15
|
+
| `TabsCollapsedTrigger` | Enum (`Caret` / `Hamburger`) selecting how the collapsed `Tabs` menu trigger presents. Defaults to `Caret`. |
|
|
16
|
+
| `ModalDropdown` | Generic dropdown selector. **Responsive by default**: an inline anchored menu on wide/desktop web, a modal on narrow/mobile — override per screen with `variant`. Opt into a menu affordance on the default trigger with `showCaret` (trailing ▾) or `showHamburger` (leading ☰, wins over `showCaret`). |
|
|
16
17
|
| `DropdownVariant` | Enum (`Menu` / `Modal`) to force a `ModalDropdown` rendering variant. |
|
|
17
18
|
| `Accordion` / `AccordionItem` | Themed expand/collapse disclosure group (replaces hand-rolled `<details>`/expanders). Controlled or uncontrolled, single- or multi-open, animated, keyboard + screen-reader accessible. |
|
|
18
19
|
| `useFocusTrap` | Web keyboard focus-trap hook (no-op on native). |
|
package/dist/index.d.mts
CHANGED
|
@@ -106,6 +106,31 @@ interface SegmentedControlProps<V extends string = string> {
|
|
|
106
106
|
*/
|
|
107
107
|
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* How the COLLAPSED (mobile) {@link import('./Tabs').Tabs} menu trigger presents.
|
|
111
|
+
*
|
|
112
|
+
* Below the collapse breakpoint the tab strip becomes a single trigger that opens
|
|
113
|
+
* the vertical section list. This selects that trigger's affordance:
|
|
114
|
+
*
|
|
115
|
+
* - `Caret` — a bordered field showing the active section's label + a rotating ▾
|
|
116
|
+
* caret. The default, so every existing consumer is visually unchanged.
|
|
117
|
+
* - `Hamburger` — a ☰ menu icon (the universal mobile-nav affordance) leading the
|
|
118
|
+
* active section's label. Opt in for a phone-first nav that reads as a menu.
|
|
119
|
+
*
|
|
120
|
+
* Exported as a regular (non-`const`) enum on purpose — the SAME reason as
|
|
121
|
+
* {@link import('../ModalDropdown/DropdownVariant').DropdownVariant}: a `const enum`
|
|
122
|
+
* is inlined at compile time and cannot cross a published-package boundary when the
|
|
123
|
+
* consumer bundles with `isolatedModules` (esbuild / vite / babel — i.e. every app
|
|
124
|
+
* that consumes this package). A regular enum emits a runtime object safe to import
|
|
125
|
+
* and compare in any consumer.
|
|
126
|
+
*/
|
|
127
|
+
declare enum TabsCollapsedTrigger {
|
|
128
|
+
/** Bordered field with the active label + a rotating ▾ caret (default, unchanged). */
|
|
129
|
+
Caret = "caret",
|
|
130
|
+
/** A ☰ hamburger icon leading the active label — the mobile-nav affordance. */
|
|
131
|
+
Hamburger = "hamburger"
|
|
132
|
+
}
|
|
133
|
+
|
|
109
134
|
/**
|
|
110
135
|
* Tabs — a named-section shell for a long dashboard. On WIDE viewports it is a
|
|
111
136
|
* horizontal strip of pill tabs (a single scrollable `nowrap` row) plus the
|
|
@@ -162,6 +187,13 @@ interface TabsProps {
|
|
|
162
187
|
* force the menu, or `0` to keep the row on any web width.
|
|
163
188
|
*/
|
|
164
189
|
collapseBelow?: number;
|
|
190
|
+
/**
|
|
191
|
+
* How the COLLAPSED (mobile) menu trigger presents — a caret field (default) or a
|
|
192
|
+
* ☰ hamburger. See {@link TabsCollapsedTrigger}. Defaults to `Caret`, so existing
|
|
193
|
+
* consumers are unchanged; a phone-first nav opts into `Hamburger`. Only affects the
|
|
194
|
+
* collapsed form — the wide pill strip is identical either way.
|
|
195
|
+
*/
|
|
196
|
+
collapsedTrigger?: TabsCollapsedTrigger;
|
|
165
197
|
/** Style override merged onto the root container. */
|
|
166
198
|
style?: StyleProp<ViewStyle>;
|
|
167
199
|
/** Style override merged onto the tab strip (wide mode only). */
|
|
@@ -175,7 +207,7 @@ interface TabsProps {
|
|
|
175
207
|
* the wide pill strip or — below `collapseBelow` — the mobile menu. Generic-free
|
|
176
208
|
* by design: tab identity is a plain string `key`.
|
|
177
209
|
*/
|
|
178
|
-
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, collapseBelow, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
210
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, collapseBelow, collapsedTrigger, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
179
211
|
|
|
180
212
|
/**
|
|
181
213
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
@@ -269,8 +301,27 @@ interface ModalDropdownProps<T> {
|
|
|
269
301
|
* a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.
|
|
270
302
|
*/
|
|
271
303
|
menuMinWidth?: number;
|
|
304
|
+
/**
|
|
305
|
+
* Show a MENU affordance on the DEFAULT trigger: a caret (▾) pinned to the trailing edge that
|
|
306
|
+
* rotates to point up while the menu is open, and a ≥44dp hit target. Opt-in and OFF by default,
|
|
307
|
+
* so every existing field-style dropdown in the kit renders unchanged; a control that must read
|
|
308
|
+
* as a tappable menu rather than a static chip (the collapsed {@link import('../Tabs/Tabs').Tabs}
|
|
309
|
+
* section switcher) sets it. Ignored when a custom `renderTrigger` is supplied — that caller owns
|
|
310
|
+
* its own visuals, affordance included.
|
|
311
|
+
*/
|
|
312
|
+
showCaret?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Present the DEFAULT trigger as a HAMBURGER (☰) menu: the universal mobile-nav glyph LEADING the
|
|
315
|
+
* active option's label, with the same bordered field box and ≥44dp hit target. Opt-in and OFF by
|
|
316
|
+
* default. When set it takes precedence over `showCaret` (a hamburger already IS the "this is a
|
|
317
|
+
* menu" cue, so the trailing caret is redundant), and — like `showCaret` — it is ignored when a
|
|
318
|
+
* custom `renderTrigger` is supplied. The glyph is a font character (U+2630), so no icon package
|
|
319
|
+
* enters this contract-pure kit, and it is decorative: the trigger's `aria-label` names the
|
|
320
|
+
* control, so screen readers do not announce it.
|
|
321
|
+
*/
|
|
322
|
+
showHamburger?: boolean;
|
|
272
323
|
}
|
|
273
|
-
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
324
|
+
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, showCaret, showHamburger, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
274
325
|
|
|
275
326
|
/**
|
|
276
327
|
* ModalShell — a slide-up full-screen modal with a themed header (title + close button)
|
|
@@ -630,4 +681,4 @@ declare const LAYOUT_I18N: {
|
|
|
630
681
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
631
682
|
};
|
|
632
683
|
|
|
633
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, COPY_FEEDBACK_MS, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
684
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, COPY_FEEDBACK_MS, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
package/dist/index.d.ts
CHANGED
|
@@ -106,6 +106,31 @@ interface SegmentedControlProps<V extends string = string> {
|
|
|
106
106
|
*/
|
|
107
107
|
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* How the COLLAPSED (mobile) {@link import('./Tabs').Tabs} menu trigger presents.
|
|
111
|
+
*
|
|
112
|
+
* Below the collapse breakpoint the tab strip becomes a single trigger that opens
|
|
113
|
+
* the vertical section list. This selects that trigger's affordance:
|
|
114
|
+
*
|
|
115
|
+
* - `Caret` — a bordered field showing the active section's label + a rotating ▾
|
|
116
|
+
* caret. The default, so every existing consumer is visually unchanged.
|
|
117
|
+
* - `Hamburger` — a ☰ menu icon (the universal mobile-nav affordance) leading the
|
|
118
|
+
* active section's label. Opt in for a phone-first nav that reads as a menu.
|
|
119
|
+
*
|
|
120
|
+
* Exported as a regular (non-`const`) enum on purpose — the SAME reason as
|
|
121
|
+
* {@link import('../ModalDropdown/DropdownVariant').DropdownVariant}: a `const enum`
|
|
122
|
+
* is inlined at compile time and cannot cross a published-package boundary when the
|
|
123
|
+
* consumer bundles with `isolatedModules` (esbuild / vite / babel — i.e. every app
|
|
124
|
+
* that consumes this package). A regular enum emits a runtime object safe to import
|
|
125
|
+
* and compare in any consumer.
|
|
126
|
+
*/
|
|
127
|
+
declare enum TabsCollapsedTrigger {
|
|
128
|
+
/** Bordered field with the active label + a rotating ▾ caret (default, unchanged). */
|
|
129
|
+
Caret = "caret",
|
|
130
|
+
/** A ☰ hamburger icon leading the active label — the mobile-nav affordance. */
|
|
131
|
+
Hamburger = "hamburger"
|
|
132
|
+
}
|
|
133
|
+
|
|
109
134
|
/**
|
|
110
135
|
* Tabs — a named-section shell for a long dashboard. On WIDE viewports it is a
|
|
111
136
|
* horizontal strip of pill tabs (a single scrollable `nowrap` row) plus the
|
|
@@ -162,6 +187,13 @@ interface TabsProps {
|
|
|
162
187
|
* force the menu, or `0` to keep the row on any web width.
|
|
163
188
|
*/
|
|
164
189
|
collapseBelow?: number;
|
|
190
|
+
/**
|
|
191
|
+
* How the COLLAPSED (mobile) menu trigger presents — a caret field (default) or a
|
|
192
|
+
* ☰ hamburger. See {@link TabsCollapsedTrigger}. Defaults to `Caret`, so existing
|
|
193
|
+
* consumers are unchanged; a phone-first nav opts into `Hamburger`. Only affects the
|
|
194
|
+
* collapsed form — the wide pill strip is identical either way.
|
|
195
|
+
*/
|
|
196
|
+
collapsedTrigger?: TabsCollapsedTrigger;
|
|
165
197
|
/** Style override merged onto the root container. */
|
|
166
198
|
style?: StyleProp<ViewStyle>;
|
|
167
199
|
/** Style override merged onto the tab strip (wide mode only). */
|
|
@@ -175,7 +207,7 @@ interface TabsProps {
|
|
|
175
207
|
* the wide pill strip or — below `collapseBelow` — the mobile menu. Generic-free
|
|
176
208
|
* by design: tab identity is a plain string `key`.
|
|
177
209
|
*/
|
|
178
|
-
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, collapseBelow, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
210
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, collapseBelow, collapsedTrigger, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
179
211
|
|
|
180
212
|
/**
|
|
181
213
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
@@ -269,8 +301,27 @@ interface ModalDropdownProps<T> {
|
|
|
269
301
|
* a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.
|
|
270
302
|
*/
|
|
271
303
|
menuMinWidth?: number;
|
|
304
|
+
/**
|
|
305
|
+
* Show a MENU affordance on the DEFAULT trigger: a caret (▾) pinned to the trailing edge that
|
|
306
|
+
* rotates to point up while the menu is open, and a ≥44dp hit target. Opt-in and OFF by default,
|
|
307
|
+
* so every existing field-style dropdown in the kit renders unchanged; a control that must read
|
|
308
|
+
* as a tappable menu rather than a static chip (the collapsed {@link import('../Tabs/Tabs').Tabs}
|
|
309
|
+
* section switcher) sets it. Ignored when a custom `renderTrigger` is supplied — that caller owns
|
|
310
|
+
* its own visuals, affordance included.
|
|
311
|
+
*/
|
|
312
|
+
showCaret?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Present the DEFAULT trigger as a HAMBURGER (☰) menu: the universal mobile-nav glyph LEADING the
|
|
315
|
+
* active option's label, with the same bordered field box and ≥44dp hit target. Opt-in and OFF by
|
|
316
|
+
* default. When set it takes precedence over `showCaret` (a hamburger already IS the "this is a
|
|
317
|
+
* menu" cue, so the trailing caret is redundant), and — like `showCaret` — it is ignored when a
|
|
318
|
+
* custom `renderTrigger` is supplied. The glyph is a font character (U+2630), so no icon package
|
|
319
|
+
* enters this contract-pure kit, and it is decorative: the trigger's `aria-label` names the
|
|
320
|
+
* control, so screen readers do not announce it.
|
|
321
|
+
*/
|
|
322
|
+
showHamburger?: boolean;
|
|
272
323
|
}
|
|
273
|
-
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
324
|
+
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, showCaret, showHamburger, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
274
325
|
|
|
275
326
|
/**
|
|
276
327
|
* ModalShell — a slide-up full-screen modal with a themed header (title + close button)
|
|
@@ -630,4 +681,4 @@ declare const LAYOUT_I18N: {
|
|
|
630
681
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
631
682
|
};
|
|
632
683
|
|
|
633
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, COPY_FEEDBACK_MS, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
684
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, COPY_FEEDBACK_MS, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
package/dist/index.js
CHANGED
|
@@ -236,6 +236,13 @@ function SegmentedControl({
|
|
|
236
236
|
}
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
|
+
|
|
240
|
+
// src/Tabs/TabsCollapsedTrigger.ts
|
|
241
|
+
var TabsCollapsedTrigger = /* @__PURE__ */ ((TabsCollapsedTrigger2) => {
|
|
242
|
+
TabsCollapsedTrigger2["Caret"] = "caret";
|
|
243
|
+
TabsCollapsedTrigger2["Hamburger"] = "hamburger";
|
|
244
|
+
return TabsCollapsedTrigger2;
|
|
245
|
+
})(TabsCollapsedTrigger || {});
|
|
239
246
|
var FOCUSABLE_SELECTOR = [
|
|
240
247
|
"a[href]",
|
|
241
248
|
"button:not([disabled])",
|
|
@@ -640,6 +647,14 @@ var MODAL_MIN_WIDTH = 200;
|
|
|
640
647
|
var MODAL_MAX_HEIGHT = 300;
|
|
641
648
|
var CONTAINER_PADDING_H = 12;
|
|
642
649
|
var CONTAINER_PADDING_V = 10;
|
|
650
|
+
var MIN_TOUCH_TARGET = 44;
|
|
651
|
+
var CARET_FONT_SIZE = 12;
|
|
652
|
+
var CARET_GAP = 8;
|
|
653
|
+
var CARET_GLYPH = "\u25BE";
|
|
654
|
+
var HAMBURGER_GLYPH = "\u2630";
|
|
655
|
+
var HAMBURGER_FONT_SIZE = 18;
|
|
656
|
+
var CARET_OPEN_ROTATION = "180deg";
|
|
657
|
+
var CARET_CLOSED_ROTATION = "0deg";
|
|
643
658
|
var styles7 = reactNative.StyleSheet.create({
|
|
644
659
|
anchor: { position: "relative" },
|
|
645
660
|
container: {
|
|
@@ -648,7 +663,30 @@ var styles7 = reactNative.StyleSheet.create({
|
|
|
648
663
|
paddingHorizontal: CONTAINER_PADDING_H,
|
|
649
664
|
paddingVertical: CONTAINER_PADDING_V
|
|
650
665
|
},
|
|
666
|
+
// Caret variant: a row with the label leading and the caret pinned to the trailing edge, at a
|
|
667
|
+
// phone-friendly minimum height. Only applied when `showCaret` is set, so field dropdowns are
|
|
668
|
+
// untouched.
|
|
669
|
+
containerMenu: {
|
|
670
|
+
minHeight: MIN_TOUCH_TARGET,
|
|
671
|
+
flexDirection: "row",
|
|
672
|
+
alignItems: "center",
|
|
673
|
+
justifyContent: "space-between",
|
|
674
|
+
columnGap: CARET_GAP
|
|
675
|
+
},
|
|
676
|
+
// Hamburger variant: the ☰ glyph LEADS the label (icon-first, like a phone nav button), so the
|
|
677
|
+
// row packs to the start rather than pushing a trailing caret to the far edge. Same tap target.
|
|
678
|
+
containerHamburger: {
|
|
679
|
+
minHeight: MIN_TOUCH_TARGET,
|
|
680
|
+
flexDirection: "row",
|
|
681
|
+
alignItems: "center",
|
|
682
|
+
justifyContent: "flex-start",
|
|
683
|
+
columnGap: CARET_GAP
|
|
684
|
+
},
|
|
651
685
|
selectedText: { fontSize: BODY_FONT_SIZE2 },
|
|
686
|
+
// The label may shrink/ellipsize; the caret / hamburger glyph never does.
|
|
687
|
+
selectedTextMenu: { flexShrink: 1 },
|
|
688
|
+
caret: { fontSize: CARET_FONT_SIZE, flexShrink: 0 },
|
|
689
|
+
hamburger: { fontSize: HAMBURGER_FONT_SIZE, flexShrink: 0 },
|
|
652
690
|
modalOverlay: {
|
|
653
691
|
flex: 1,
|
|
654
692
|
justifyContent: "center",
|
|
@@ -672,7 +710,9 @@ var ModalDropdown = ({
|
|
|
672
710
|
variant,
|
|
673
711
|
renderTrigger,
|
|
674
712
|
optionTestID,
|
|
675
|
-
menuMinWidth
|
|
713
|
+
menuMinWidth,
|
|
714
|
+
showCaret = false,
|
|
715
|
+
showHamburger = false
|
|
676
716
|
}) => {
|
|
677
717
|
const { theme, t } = uiFeedback.useUi();
|
|
678
718
|
const { colors } = theme;
|
|
@@ -706,9 +746,26 @@ var ModalDropdown = ({
|
|
|
706
746
|
},
|
|
707
747
|
[onChange]
|
|
708
748
|
);
|
|
749
|
+
const isHamburger = showHamburger;
|
|
750
|
+
const isCaret = showCaret && !isHamburger;
|
|
709
751
|
const containerStyle = React9.useMemo(
|
|
710
|
-
() => renderTrigger !== void 0 ? void 0 : [
|
|
711
|
-
|
|
752
|
+
() => renderTrigger !== void 0 ? void 0 : [
|
|
753
|
+
styles7.container,
|
|
754
|
+
isHamburger ? styles7.containerHamburger : isCaret ? styles7.containerMenu : null,
|
|
755
|
+
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
756
|
+
],
|
|
757
|
+
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
758
|
+
);
|
|
759
|
+
const hamburgerStyle = React9.useMemo(
|
|
760
|
+
() => [styles7.hamburger, { color: colors.textSecondary }],
|
|
761
|
+
[colors.textSecondary]
|
|
762
|
+
);
|
|
763
|
+
const caretStyle = React9.useMemo(
|
|
764
|
+
() => [
|
|
765
|
+
styles7.caret,
|
|
766
|
+
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
767
|
+
],
|
|
768
|
+
[colors.textSecondary, isOpen]
|
|
712
769
|
);
|
|
713
770
|
const optionTestIDFor = React9.useCallback(
|
|
714
771
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
@@ -737,7 +794,13 @@ var ModalDropdown = ({
|
|
|
737
794
|
const keyExtractor = React9.useCallback((item) => String(item.value), []);
|
|
738
795
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
739
796
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
740
|
-
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsxRuntime.
|
|
797
|
+
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
798
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
799
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles7.selectedText, styles7.selectedTextMenu, { color: colors.text }], children: selectedLabel })
|
|
800
|
+
] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
801
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles7.selectedText, styles7.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
802
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
803
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
741
804
|
hintNode
|
|
742
805
|
] }),
|
|
743
806
|
isMenu && isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -788,7 +851,8 @@ var TabsMenu = ({
|
|
|
788
851
|
onChange,
|
|
789
852
|
accessibilityLabel,
|
|
790
853
|
idPrefix,
|
|
791
|
-
testID
|
|
854
|
+
testID,
|
|
855
|
+
collapsedTrigger = "caret" /* Caret */
|
|
792
856
|
}) => {
|
|
793
857
|
const { t } = uiFeedback.useUi();
|
|
794
858
|
const options = React9.useMemo(
|
|
@@ -802,6 +866,7 @@ var TabsMenu = ({
|
|
|
802
866
|
},
|
|
803
867
|
[tabs, idPrefix]
|
|
804
868
|
);
|
|
869
|
+
const isHamburger = collapsedTrigger === "hamburger" /* Hamburger */;
|
|
805
870
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
806
871
|
ModalDropdown,
|
|
807
872
|
{
|
|
@@ -809,6 +874,8 @@ var TabsMenu = ({
|
|
|
809
874
|
accessibilityLabel,
|
|
810
875
|
optionTestID,
|
|
811
876
|
options,
|
|
877
|
+
showCaret: !isHamburger,
|
|
878
|
+
showHamburger: isHamburger,
|
|
812
879
|
testID,
|
|
813
880
|
value: activeKey,
|
|
814
881
|
onChange
|
|
@@ -921,6 +988,7 @@ var Tabs = ({
|
|
|
921
988
|
children,
|
|
922
989
|
idPrefix = "tabs",
|
|
923
990
|
collapseBelow = TABS_COLLAPSE_BREAKPOINT,
|
|
991
|
+
collapsedTrigger = "caret" /* Caret */,
|
|
924
992
|
style,
|
|
925
993
|
stripStyle,
|
|
926
994
|
panelStyle,
|
|
@@ -938,6 +1006,7 @@ var Tabs = ({
|
|
|
938
1006
|
{
|
|
939
1007
|
accessibilityLabel,
|
|
940
1008
|
activeKey,
|
|
1009
|
+
collapsedTrigger,
|
|
941
1010
|
idPrefix,
|
|
942
1011
|
tabs,
|
|
943
1012
|
testID: `${idPrefix}-menu`,
|
|
@@ -1680,6 +1749,7 @@ exports.Section = Section;
|
|
|
1680
1749
|
exports.SegmentedControl = SegmentedControl;
|
|
1681
1750
|
exports.StatusBadge = StatusBadge;
|
|
1682
1751
|
exports.Tabs = Tabs;
|
|
1752
|
+
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
1683
1753
|
exports.TruncatedText = TruncatedText;
|
|
1684
1754
|
exports.UpgradePrompt = UpgradePrompt;
|
|
1685
1755
|
exports.copyText = copyText;
|