@dloizides/ui-layout 1.15.1 → 1.17.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 +31 -0
- package/dist/index.d.mts +91 -4
- package/dist/index.d.ts +91 -4
- package/dist/index.js +173 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.17.0
|
|
4
|
+
|
|
5
|
+
**New `Tabs` primitive — a controlled tabbed section shell.**
|
|
6
|
+
|
|
7
|
+
Adds `Tabs`: a wrapping/scrolling pill tab strip plus the active tab's panel, wired
|
|
8
|
+
as a proper `tablist` / `tab` / `tabpanel` (aria-selected, aria-controls,
|
|
9
|
+
aria-labelledby). Controlled (`activeKey` + `onChange`), so the selected tab can be
|
|
10
|
+
driven from a route param or storage. Labels are pre-localized strings; colours read
|
|
11
|
+
from the `@dloizides/ui-feedback` theme (no FM/router/store imports), consistent with
|
|
12
|
+
the rest of the kit.
|
|
13
|
+
|
|
14
|
+
Extracted so the seven portals share ONE tab shell instead of hand-rolling a bar per
|
|
15
|
+
app — first consumer is the kefi-web organizer dashboard, split from one enormous page
|
|
16
|
+
into menu tabs.
|
|
17
|
+
|
|
18
|
+
## 1.16.1
|
|
19
|
+
|
|
20
|
+
**`Heading` supports levels 1-6 instead of `<h1>` only.**
|
|
21
|
+
|
|
22
|
+
`Heading` rendered `<h1>` unconditionally, so any screen needing sub-structure either
|
|
23
|
+
shipped multiple `<h1>`s or avoided the component. The Digital Kin guide editor did the
|
|
24
|
+
latter — styled `<Text>` instead — and shipped **zero headings**: measured on the live
|
|
25
|
+
CMS, `document.querySelectorAll('h1,h2,h3,h4,h5,h6').length === 0` for the entire page.
|
|
26
|
+
|
|
27
|
+
So there was no `<h1>` naming the guide being edited and nothing marking the steps
|
|
28
|
+
section. Screen-reader users could not navigate by heading, and styling was standing in
|
|
29
|
+
for structure.
|
|
30
|
+
|
|
31
|
+
After: `h1` names the guide, `h2` marks the steps section, `h3` per step.
|
|
32
|
+
|
|
33
|
+
|
|
3
34
|
## 1.15.1
|
|
4
35
|
|
|
5
36
|
- **Fix (`CopyableId` truncated the value with room to spare).** 1.15.0 gave the value wrapper
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
|
-
import { ViewStyle, StyleProp, TextStyle, View } from 'react-native';
|
|
2
|
+
import { ViewStyle, Text, StyleProp, TextStyle, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Section — a bordered card container that themes its border + surface.
|
|
@@ -12,14 +12,43 @@ interface SectionProps {
|
|
|
12
12
|
declare const Section: ({ children, style }: SectionProps) => React.ReactElement;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Heading — themed section heading text.
|
|
15
|
+
* Heading — themed section heading text, rendered as a REAL `<h1>`–`<h6>` on web.
|
|
16
|
+
*
|
|
17
|
+
* ## Why `level` exists
|
|
18
|
+
*
|
|
19
|
+
* `accessibilityRole="header"` maps to the ARIA `heading` role, which react-native-web turns
|
|
20
|
+
* into a real heading element — but with no `aria-level` it always emits `<h1>`. A screen
|
|
21
|
+
* having several `<h1>`s and no `<h2>` is a flat document: heading navigation, the primary way
|
|
22
|
+
* assistive-tech users move around a long page, lists every section as a peer of the page title.
|
|
23
|
+
*
|
|
24
|
+
* `level` supplies `aria-level`, which RN-web uses to pick `h{level}`. It defaults to 2 rather
|
|
25
|
+
* than 1 on purpose: a page has exactly ONE `<h1>` (its title) and many section headings, so the
|
|
26
|
+
* common case must be the safe one. A second `<h1>` is a defect that renders identically to a
|
|
27
|
+
* correct heading, so nothing about the page would reveal the mistake.
|
|
28
|
+
*
|
|
29
|
+
* The visual size is deliberately NOT derived from `level`. Heading level is document structure;
|
|
30
|
+
* type scale is design. Tying them together is what pushes authors to pick a level for its font
|
|
31
|
+
* size and break the outline to get the look they want.
|
|
16
32
|
*/
|
|
17
33
|
|
|
34
|
+
/** `h1`–`h6`; HTML defines no `h7`. */
|
|
35
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
18
36
|
interface HeadingProps {
|
|
19
37
|
text?: string;
|
|
20
38
|
children?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Document outline depth → `<h1>`–`<h6>` on web, `aria-level` on native. Defaults to 2.
|
|
41
|
+
* Pick it from the page's STRUCTURE, never from how large you want the text to look.
|
|
42
|
+
*/
|
|
43
|
+
level?: HeadingLevel;
|
|
44
|
+
/**
|
|
45
|
+
* Merged AFTER the themed base, for the genuine one-off — a page title that needs to be
|
|
46
|
+
* visibly larger than a section heading. Structure stays in `level`; size lives here.
|
|
47
|
+
*/
|
|
48
|
+
style?: React.ComponentProps<typeof Text>['style'];
|
|
49
|
+
testID?: string;
|
|
21
50
|
}
|
|
22
|
-
declare const Heading: ({ text, children }: HeadingProps) => React.ReactElement;
|
|
51
|
+
declare const Heading: ({ text, children, level, style, testID, }: HeadingProps) => React.ReactElement;
|
|
23
52
|
|
|
24
53
|
/**
|
|
25
54
|
* StatusBadge — unified status pill. Colours are passed in; domain adapters map their
|
|
@@ -77,6 +106,64 @@ interface SegmentedControlProps<V extends string = string> {
|
|
|
77
106
|
*/
|
|
78
107
|
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
79
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Tabs — a wrapping strip of pill tabs plus the panel for the active tab. The
|
|
111
|
+
* cross-portal "section shell": one long dashboard split into named tabs so an
|
|
112
|
+
* operator can find a surface instead of scrolling past it.
|
|
113
|
+
*
|
|
114
|
+
* It is deliberately CONTROLLED — the host owns `activeKey` and `onChange`, so
|
|
115
|
+
* the selected tab can be driven from a route param, restored from storage, or
|
|
116
|
+
* changed programmatically. The active panel is passed as `children`; Tabs wraps
|
|
117
|
+
* it in a `tabpanel` and wires the `aria-labelledby` / `aria-controls`
|
|
118
|
+
* relationship so assistive tech announces "tab N of M, <label>" and links the
|
|
119
|
+
* panel back to its tab.
|
|
120
|
+
*
|
|
121
|
+
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /
|
|
122
|
+
* router / store / icon imports. `label`s are pre-localized strings supplied by
|
|
123
|
+
* the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider
|
|
124
|
+
* theme, so the strip re-skins on tenant swap. The tab row is horizontally
|
|
125
|
+
* scrollable AND wraps, so 3 tabs or 15 tabs both lay out sensibly.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
|
129
|
+
interface TabDescriptor {
|
|
130
|
+
/** Stable identity — emitted by `onChange`, compared against `activeKey`. */
|
|
131
|
+
key: string;
|
|
132
|
+
/** Pre-localized, human-readable tab label. */
|
|
133
|
+
label: string;
|
|
134
|
+
testID?: string;
|
|
135
|
+
/** Accessible name; defaults to `label`. */
|
|
136
|
+
accessibilityLabel?: string;
|
|
137
|
+
/** Accessible hint announced after the label. */
|
|
138
|
+
accessibilityHint?: string;
|
|
139
|
+
}
|
|
140
|
+
interface TabsProps {
|
|
141
|
+
/** The tabs, left → right. */
|
|
142
|
+
tabs: ReadonlyArray<TabDescriptor>;
|
|
143
|
+
/** The currently-active tab `key`. */
|
|
144
|
+
activeKey: string;
|
|
145
|
+
/** Fired with a tab's `key` when it is pressed. */
|
|
146
|
+
onChange: (key: string) => void;
|
|
147
|
+
/** Accessible name for the whole tablist. */
|
|
148
|
+
accessibilityLabel: string;
|
|
149
|
+
/** The panel content for the active tab. */
|
|
150
|
+
children?: React.ReactNode;
|
|
151
|
+
/** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */
|
|
152
|
+
idPrefix?: string;
|
|
153
|
+
/** Style override merged onto the root container. */
|
|
154
|
+
style?: StyleProp<ViewStyle>;
|
|
155
|
+
/** Style override merged onto the tab strip. */
|
|
156
|
+
stripStyle?: StyleProp<ViewStyle>;
|
|
157
|
+
/** Style override merged onto the panel wrapper. */
|
|
158
|
+
panelStyle?: StyleProp<ViewStyle>;
|
|
159
|
+
testID?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A controlled tabbed section shell. Renders the tab strip and the active tab's
|
|
163
|
+
* panel. Generic-free by design — tab identity is a plain string `key`.
|
|
164
|
+
*/
|
|
165
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
166
|
+
|
|
80
167
|
/**
|
|
81
168
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
82
169
|
* billing route via the injected navigate (default route overridable).
|
|
@@ -525,4 +612,4 @@ declare const LAYOUT_I18N: {
|
|
|
525
612
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
526
613
|
};
|
|
527
614
|
|
|
528
|
-
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 HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
615
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
|
-
import { ViewStyle, StyleProp, TextStyle, View } from 'react-native';
|
|
2
|
+
import { ViewStyle, Text, StyleProp, TextStyle, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Section — a bordered card container that themes its border + surface.
|
|
@@ -12,14 +12,43 @@ interface SectionProps {
|
|
|
12
12
|
declare const Section: ({ children, style }: SectionProps) => React.ReactElement;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Heading — themed section heading text.
|
|
15
|
+
* Heading — themed section heading text, rendered as a REAL `<h1>`–`<h6>` on web.
|
|
16
|
+
*
|
|
17
|
+
* ## Why `level` exists
|
|
18
|
+
*
|
|
19
|
+
* `accessibilityRole="header"` maps to the ARIA `heading` role, which react-native-web turns
|
|
20
|
+
* into a real heading element — but with no `aria-level` it always emits `<h1>`. A screen
|
|
21
|
+
* having several `<h1>`s and no `<h2>` is a flat document: heading navigation, the primary way
|
|
22
|
+
* assistive-tech users move around a long page, lists every section as a peer of the page title.
|
|
23
|
+
*
|
|
24
|
+
* `level` supplies `aria-level`, which RN-web uses to pick `h{level}`. It defaults to 2 rather
|
|
25
|
+
* than 1 on purpose: a page has exactly ONE `<h1>` (its title) and many section headings, so the
|
|
26
|
+
* common case must be the safe one. A second `<h1>` is a defect that renders identically to a
|
|
27
|
+
* correct heading, so nothing about the page would reveal the mistake.
|
|
28
|
+
*
|
|
29
|
+
* The visual size is deliberately NOT derived from `level`. Heading level is document structure;
|
|
30
|
+
* type scale is design. Tying them together is what pushes authors to pick a level for its font
|
|
31
|
+
* size and break the outline to get the look they want.
|
|
16
32
|
*/
|
|
17
33
|
|
|
34
|
+
/** `h1`–`h6`; HTML defines no `h7`. */
|
|
35
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
18
36
|
interface HeadingProps {
|
|
19
37
|
text?: string;
|
|
20
38
|
children?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Document outline depth → `<h1>`–`<h6>` on web, `aria-level` on native. Defaults to 2.
|
|
41
|
+
* Pick it from the page's STRUCTURE, never from how large you want the text to look.
|
|
42
|
+
*/
|
|
43
|
+
level?: HeadingLevel;
|
|
44
|
+
/**
|
|
45
|
+
* Merged AFTER the themed base, for the genuine one-off — a page title that needs to be
|
|
46
|
+
* visibly larger than a section heading. Structure stays in `level`; size lives here.
|
|
47
|
+
*/
|
|
48
|
+
style?: React.ComponentProps<typeof Text>['style'];
|
|
49
|
+
testID?: string;
|
|
21
50
|
}
|
|
22
|
-
declare const Heading: ({ text, children }: HeadingProps) => React.ReactElement;
|
|
51
|
+
declare const Heading: ({ text, children, level, style, testID, }: HeadingProps) => React.ReactElement;
|
|
23
52
|
|
|
24
53
|
/**
|
|
25
54
|
* StatusBadge — unified status pill. Colours are passed in; domain adapters map their
|
|
@@ -77,6 +106,64 @@ interface SegmentedControlProps<V extends string = string> {
|
|
|
77
106
|
*/
|
|
78
107
|
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
79
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Tabs — a wrapping strip of pill tabs plus the panel for the active tab. The
|
|
111
|
+
* cross-portal "section shell": one long dashboard split into named tabs so an
|
|
112
|
+
* operator can find a surface instead of scrolling past it.
|
|
113
|
+
*
|
|
114
|
+
* It is deliberately CONTROLLED — the host owns `activeKey` and `onChange`, so
|
|
115
|
+
* the selected tab can be driven from a route param, restored from storage, or
|
|
116
|
+
* changed programmatically. The active panel is passed as `children`; Tabs wraps
|
|
117
|
+
* it in a `tabpanel` and wires the `aria-labelledby` / `aria-controls`
|
|
118
|
+
* relationship so assistive tech announces "tab N of M, <label>" and links the
|
|
119
|
+
* panel back to its tab.
|
|
120
|
+
*
|
|
121
|
+
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /
|
|
122
|
+
* router / store / icon imports. `label`s are pre-localized strings supplied by
|
|
123
|
+
* the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider
|
|
124
|
+
* theme, so the strip re-skins on tenant swap. The tab row is horizontally
|
|
125
|
+
* scrollable AND wraps, so 3 tabs or 15 tabs both lay out sensibly.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
|
129
|
+
interface TabDescriptor {
|
|
130
|
+
/** Stable identity — emitted by `onChange`, compared against `activeKey`. */
|
|
131
|
+
key: string;
|
|
132
|
+
/** Pre-localized, human-readable tab label. */
|
|
133
|
+
label: string;
|
|
134
|
+
testID?: string;
|
|
135
|
+
/** Accessible name; defaults to `label`. */
|
|
136
|
+
accessibilityLabel?: string;
|
|
137
|
+
/** Accessible hint announced after the label. */
|
|
138
|
+
accessibilityHint?: string;
|
|
139
|
+
}
|
|
140
|
+
interface TabsProps {
|
|
141
|
+
/** The tabs, left → right. */
|
|
142
|
+
tabs: ReadonlyArray<TabDescriptor>;
|
|
143
|
+
/** The currently-active tab `key`. */
|
|
144
|
+
activeKey: string;
|
|
145
|
+
/** Fired with a tab's `key` when it is pressed. */
|
|
146
|
+
onChange: (key: string) => void;
|
|
147
|
+
/** Accessible name for the whole tablist. */
|
|
148
|
+
accessibilityLabel: string;
|
|
149
|
+
/** The panel content for the active tab. */
|
|
150
|
+
children?: React.ReactNode;
|
|
151
|
+
/** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */
|
|
152
|
+
idPrefix?: string;
|
|
153
|
+
/** Style override merged onto the root container. */
|
|
154
|
+
style?: StyleProp<ViewStyle>;
|
|
155
|
+
/** Style override merged onto the tab strip. */
|
|
156
|
+
stripStyle?: StyleProp<ViewStyle>;
|
|
157
|
+
/** Style override merged onto the panel wrapper. */
|
|
158
|
+
panelStyle?: StyleProp<ViewStyle>;
|
|
159
|
+
testID?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A controlled tabbed section shell. Renders the tab strip and the active tab's
|
|
163
|
+
* panel. Generic-free by design — tab identity is a plain string `key`.
|
|
164
|
+
*/
|
|
165
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
166
|
+
|
|
80
167
|
/**
|
|
81
168
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
82
169
|
* billing route via the injected navigate (default route overridable).
|
|
@@ -525,4 +612,4 @@ declare const LAYOUT_I18N: {
|
|
|
525
612
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
526
613
|
};
|
|
527
614
|
|
|
528
|
-
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 HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
615
|
+
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 };
|