@dloizides/ui-layout 1.18.0 → 1.19.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 +28 -0
- package/README.md +1 -0
- package/dist/index.d.mts +33 -24
- package/dist/index.d.ts +33 -24
- package/dist/index.js +336 -259
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +281 -204
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.19.0
|
|
4
|
+
|
|
5
|
+
**`Tabs` collapses to a real mobile menu below a breakpoint.**
|
|
6
|
+
|
|
7
|
+
On a phone the horizontal pill strip "is not a real menu and not mobile friendly" — a
|
|
8
|
+
scrolling chip row is hard to use with 7–8 tabs (the kefi organizer dashboard:
|
|
9
|
+
Overview / Passes / Attendees / Promoters / Door / Ledger / Messaging / Settings). `Tabs`
|
|
10
|
+
now renders responsively:
|
|
11
|
+
|
|
12
|
+
- **Wide (>= `collapseBelow`, default 768, web only):** the existing horizontal
|
|
13
|
+
`role=tablist` / `role=tab` strip — unchanged, fully backward-compatible.
|
|
14
|
+
- **Narrow (< breakpoint) or native:** a genuine menu — a trigger button showing the
|
|
15
|
+
active section that opens a vertical list of all sections. Delegates to the kit's
|
|
16
|
+
existing `ModalDropdown` (menu/listbox semantics, focus trap, dismiss backdrop, dual-
|
|
17
|
+
platform a11y) rather than reimplementing a dropdown.
|
|
18
|
+
|
|
19
|
+
Backward-compatible: the public API is unchanged except one new optional prop,
|
|
20
|
+
`collapseBelow?: number` (default = the shared kit breakpoint, 768; pass `0` to keep the
|
|
21
|
+
row on any web width, or a large number to force the menu). The collapse threshold reuses
|
|
22
|
+
the SAME viewport rule (`MENU_BREAKPOINT`) that `ModalDropdown` uses for its menu-vs-modal
|
|
23
|
+
split, so the whole layout kit changes shape at one consistent breakpoint.
|
|
24
|
+
|
|
25
|
+
**E2E survival:** per-tab selectors keep working in BOTH modes. Each collapsed menu row's
|
|
26
|
+
`testID` is the tab descriptor's own `testID` when supplied, otherwise the same
|
|
27
|
+
`{idPrefix}-tab-{key}` pattern the wide strip uses for its tab element ids (the menu must
|
|
28
|
+
be opened first, as with any select). Requires one new host i18n key,
|
|
29
|
+
`common.tabsMenuHint` (the accessible hint on the collapsed trigger).
|
|
30
|
+
|
|
3
31
|
## 1.17.0
|
|
4
32
|
|
|
5
33
|
**New `Tabs` primitive — a controlled tabbed section shell.**
|
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ 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. |
|
|
14
15
|
| `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`. |
|
|
15
16
|
| `DropdownVariant` | Enum (`Menu` / `Modal`) to force a `ModalDropdown` rendering variant. |
|
|
16
17
|
| `Accordion` / `AccordionItem` | Themed expand/collapse disclosure group (replaces hand-rolled `<details>`/expanders). Controlled or uncontrolled, single- or multi-open, animated, keyboard + screen-reader accessible. |
|
package/dist/index.d.mts
CHANGED
|
@@ -107,31 +107,27 @@ interface SegmentedControlProps<V extends string = string> {
|
|
|
107
107
|
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* Tabs — a
|
|
111
|
-
*
|
|
112
|
-
*
|
|
110
|
+
* Tabs — a named-section shell for a long dashboard. On WIDE viewports it is a
|
|
111
|
+
* horizontal strip of pill tabs (a single scrollable `nowrap` row) plus the
|
|
112
|
+
* active tab's panel. BELOW the collapse breakpoint it becomes a genuine mobile
|
|
113
|
+
* MENU — a button showing the active section that opens a vertical list of all
|
|
114
|
+
* sections — because a scrolling chip strip "is not a real menu and not mobile
|
|
115
|
+
* friendly" on a phone. The active panel renders identically in both modes.
|
|
113
116
|
*
|
|
114
117
|
* It is deliberately CONTROLLED — the host owns `activeKey` and `onChange`, so
|
|
115
118
|
* the selected tab can be driven from a route param, restored from storage, or
|
|
116
|
-
* changed programmatically. The active panel is passed as `children
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* panel
|
|
119
|
+
* changed programmatically. The active panel is passed as `children`.
|
|
120
|
+
*
|
|
121
|
+
* A11y: WIDE mode keeps `role=tablist` / `role=tab` with `aria-selected` and the
|
|
122
|
+
* `aria-controls` / `aria-labelledby` tab⇄panel wiring. COLLAPSED mode delegates
|
|
123
|
+
* to {@link ModalDropdown}'s menu/listbox semantics (a `role=button` trigger that
|
|
124
|
+
* opens a selectable list). The rendered panel is `aria-labelledby` the active
|
|
125
|
+
* tab id in BOTH modes.
|
|
120
126
|
*
|
|
121
127
|
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /
|
|
122
128
|
* router / store / icon imports. `label`s are pre-localized strings supplied by
|
|
123
129
|
* the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider
|
|
124
|
-
* theme, so the
|
|
125
|
-
*
|
|
126
|
-
* RESPONSIVE ROW: the tab row is a SINGLE horizontally-scrollable line, never a
|
|
127
|
-
* wrapping pile. Pills sit on one `nowrap` row inside a horizontal `ScrollView`
|
|
128
|
-
* and do not shrink (`flexShrink: 0`), so on a phone the extra tabs scroll off to
|
|
129
|
-
* the right (swipeable) instead of wrapping into an unusable multi-row chip pile;
|
|
130
|
-
* on desktop the same row lays out cleanly and, when the tabs fit, simply doesn't
|
|
131
|
-
* scroll. A full-width underline lives on the outer wrapper so it spans the whole
|
|
132
|
-
* width in both cases. (An earlier version used `flexWrap: 'wrap'` INSIDE the
|
|
133
|
-
* scroller, which made the content wrap to the viewport so the scroller never
|
|
134
|
-
* scrolled — the classic "wrap defeats the horizontal scroll" trap.)
|
|
130
|
+
* theme, so the shell re-skins on tenant swap.
|
|
135
131
|
*/
|
|
136
132
|
|
|
137
133
|
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
|
@@ -151,27 +147,35 @@ interface TabsProps {
|
|
|
151
147
|
tabs: ReadonlyArray<TabDescriptor>;
|
|
152
148
|
/** The currently-active tab `key`. */
|
|
153
149
|
activeKey: string;
|
|
154
|
-
/** Fired with a tab's `key` when it is pressed. */
|
|
150
|
+
/** Fired with a tab's `key` when it is pressed (wide) or chosen (collapsed). */
|
|
155
151
|
onChange: (key: string) => void;
|
|
156
|
-
/** Accessible name for the whole tablist. */
|
|
152
|
+
/** Accessible name for the whole tablist / collapsed menu. */
|
|
157
153
|
accessibilityLabel: string;
|
|
158
154
|
/** The panel content for the active tab. */
|
|
159
155
|
children?: React.ReactNode;
|
|
160
156
|
/** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */
|
|
161
157
|
idPrefix?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Viewport width (dp) at/above which the tabs stay a horizontal ROW; below it
|
|
160
|
+
* (or on native) they collapse to the mobile menu. Defaults to the shared kit
|
|
161
|
+
* breakpoint ({@link TABS_COLLAPSE_BREAKPOINT}, 768). Pass a large number to
|
|
162
|
+
* force the menu, or `0` to keep the row on any web width.
|
|
163
|
+
*/
|
|
164
|
+
collapseBelow?: number;
|
|
162
165
|
/** Style override merged onto the root container. */
|
|
163
166
|
style?: StyleProp<ViewStyle>;
|
|
164
|
-
/** Style override merged onto the tab strip. */
|
|
167
|
+
/** Style override merged onto the tab strip (wide mode only). */
|
|
165
168
|
stripStyle?: StyleProp<ViewStyle>;
|
|
166
169
|
/** Style override merged onto the panel wrapper. */
|
|
167
170
|
panelStyle?: StyleProp<ViewStyle>;
|
|
168
171
|
testID?: string;
|
|
169
172
|
}
|
|
170
173
|
/**
|
|
171
|
-
* A controlled tabbed section shell. Renders the
|
|
172
|
-
*
|
|
174
|
+
* A controlled tabbed section shell. Renders the active tab's panel plus either
|
|
175
|
+
* the wide pill strip or — below `collapseBelow` — the mobile menu. Generic-free
|
|
176
|
+
* by design: tab identity is a plain string `key`.
|
|
173
177
|
*/
|
|
174
|
-
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
178
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, collapseBelow, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
175
179
|
|
|
176
180
|
/**
|
|
177
181
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
@@ -583,6 +587,11 @@ declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
|
583
587
|
declare const LAYOUT_I18N: {
|
|
584
588
|
/** Placeholder shown by `ModalDropdown` when no option matches the current value. */
|
|
585
589
|
readonly selectPlaceholder: "common.selectPlaceholder";
|
|
590
|
+
/**
|
|
591
|
+
* Accessible hint on the collapsed (mobile) `Tabs` menu trigger — the button
|
|
592
|
+
* that shows the active section and opens the vertical list of sections.
|
|
593
|
+
*/
|
|
594
|
+
readonly tabsMenuHint: "common.tabsMenuHint";
|
|
586
595
|
/** Accessible name + hint of the modal-variant dropdown's dismiss backdrop. */
|
|
587
596
|
readonly dismissDropdown: "common.dismissDropdown";
|
|
588
597
|
readonly dismissDropdownHint: "common.dismissDropdownHint";
|
package/dist/index.d.ts
CHANGED
|
@@ -107,31 +107,27 @@ interface SegmentedControlProps<V extends string = string> {
|
|
|
107
107
|
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* Tabs — a
|
|
111
|
-
*
|
|
112
|
-
*
|
|
110
|
+
* Tabs — a named-section shell for a long dashboard. On WIDE viewports it is a
|
|
111
|
+
* horizontal strip of pill tabs (a single scrollable `nowrap` row) plus the
|
|
112
|
+
* active tab's panel. BELOW the collapse breakpoint it becomes a genuine mobile
|
|
113
|
+
* MENU — a button showing the active section that opens a vertical list of all
|
|
114
|
+
* sections — because a scrolling chip strip "is not a real menu and not mobile
|
|
115
|
+
* friendly" on a phone. The active panel renders identically in both modes.
|
|
113
116
|
*
|
|
114
117
|
* It is deliberately CONTROLLED — the host owns `activeKey` and `onChange`, so
|
|
115
118
|
* the selected tab can be driven from a route param, restored from storage, or
|
|
116
|
-
* changed programmatically. The active panel is passed as `children
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* panel
|
|
119
|
+
* changed programmatically. The active panel is passed as `children`.
|
|
120
|
+
*
|
|
121
|
+
* A11y: WIDE mode keeps `role=tablist` / `role=tab` with `aria-selected` and the
|
|
122
|
+
* `aria-controls` / `aria-labelledby` tab⇄panel wiring. COLLAPSED mode delegates
|
|
123
|
+
* to {@link ModalDropdown}'s menu/listbox semantics (a `role=button` trigger that
|
|
124
|
+
* opens a selectable list). The rendered panel is `aria-labelledby` the active
|
|
125
|
+
* tab id in BOTH modes.
|
|
120
126
|
*
|
|
121
127
|
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /
|
|
122
128
|
* router / store / icon imports. `label`s are pre-localized strings supplied by
|
|
123
129
|
* the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider
|
|
124
|
-
* theme, so the
|
|
125
|
-
*
|
|
126
|
-
* RESPONSIVE ROW: the tab row is a SINGLE horizontally-scrollable line, never a
|
|
127
|
-
* wrapping pile. Pills sit on one `nowrap` row inside a horizontal `ScrollView`
|
|
128
|
-
* and do not shrink (`flexShrink: 0`), so on a phone the extra tabs scroll off to
|
|
129
|
-
* the right (swipeable) instead of wrapping into an unusable multi-row chip pile;
|
|
130
|
-
* on desktop the same row lays out cleanly and, when the tabs fit, simply doesn't
|
|
131
|
-
* scroll. A full-width underline lives on the outer wrapper so it spans the whole
|
|
132
|
-
* width in both cases. (An earlier version used `flexWrap: 'wrap'` INSIDE the
|
|
133
|
-
* scroller, which made the content wrap to the viewport so the scroller never
|
|
134
|
-
* scrolled — the classic "wrap defeats the horizontal scroll" trap.)
|
|
130
|
+
* theme, so the shell re-skins on tenant swap.
|
|
135
131
|
*/
|
|
136
132
|
|
|
137
133
|
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
|
@@ -151,27 +147,35 @@ interface TabsProps {
|
|
|
151
147
|
tabs: ReadonlyArray<TabDescriptor>;
|
|
152
148
|
/** The currently-active tab `key`. */
|
|
153
149
|
activeKey: string;
|
|
154
|
-
/** Fired with a tab's `key` when it is pressed. */
|
|
150
|
+
/** Fired with a tab's `key` when it is pressed (wide) or chosen (collapsed). */
|
|
155
151
|
onChange: (key: string) => void;
|
|
156
|
-
/** Accessible name for the whole tablist. */
|
|
152
|
+
/** Accessible name for the whole tablist / collapsed menu. */
|
|
157
153
|
accessibilityLabel: string;
|
|
158
154
|
/** The panel content for the active tab. */
|
|
159
155
|
children?: React.ReactNode;
|
|
160
156
|
/** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */
|
|
161
157
|
idPrefix?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Viewport width (dp) at/above which the tabs stay a horizontal ROW; below it
|
|
160
|
+
* (or on native) they collapse to the mobile menu. Defaults to the shared kit
|
|
161
|
+
* breakpoint ({@link TABS_COLLAPSE_BREAKPOINT}, 768). Pass a large number to
|
|
162
|
+
* force the menu, or `0` to keep the row on any web width.
|
|
163
|
+
*/
|
|
164
|
+
collapseBelow?: number;
|
|
162
165
|
/** Style override merged onto the root container. */
|
|
163
166
|
style?: StyleProp<ViewStyle>;
|
|
164
|
-
/** Style override merged onto the tab strip. */
|
|
167
|
+
/** Style override merged onto the tab strip (wide mode only). */
|
|
165
168
|
stripStyle?: StyleProp<ViewStyle>;
|
|
166
169
|
/** Style override merged onto the panel wrapper. */
|
|
167
170
|
panelStyle?: StyleProp<ViewStyle>;
|
|
168
171
|
testID?: string;
|
|
169
172
|
}
|
|
170
173
|
/**
|
|
171
|
-
* A controlled tabbed section shell. Renders the
|
|
172
|
-
*
|
|
174
|
+
* A controlled tabbed section shell. Renders the active tab's panel plus either
|
|
175
|
+
* the wide pill strip or — below `collapseBelow` — the mobile menu. Generic-free
|
|
176
|
+
* by design: tab identity is a plain string `key`.
|
|
173
177
|
*/
|
|
174
|
-
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
178
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, collapseBelow, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
175
179
|
|
|
176
180
|
/**
|
|
177
181
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
@@ -583,6 +587,11 @@ declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
|
583
587
|
declare const LAYOUT_I18N: {
|
|
584
588
|
/** Placeholder shown by `ModalDropdown` when no option matches the current value. */
|
|
585
589
|
readonly selectPlaceholder: "common.selectPlaceholder";
|
|
590
|
+
/**
|
|
591
|
+
* Accessible hint on the collapsed (mobile) `Tabs` menu trigger — the button
|
|
592
|
+
* that shows the active section and opens the vertical list of sections.
|
|
593
|
+
*/
|
|
594
|
+
readonly tabsMenuHint: "common.tabsMenuHint";
|
|
586
595
|
/** Accessible name + hint of the modal-variant dropdown's dismiss backdrop. */
|
|
587
596
|
readonly dismissDropdown: "common.dismissDropdown";
|
|
588
597
|
readonly dismissDropdownHint: "common.dismissDropdownHint";
|