@dloizides/ui-layout 1.16.1 → 1.18.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 +16 -1
- package/dist/index.d.mts +68 -1
- package/dist/index.d.ts +68 -1
- package/dist/index.js +162 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +163 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
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
|
|
4
19
|
|
|
5
20
|
**`Heading` supports levels 1-6 instead of `<h1>` only.**
|
|
6
21
|
|
package/dist/index.d.mts
CHANGED
|
@@ -106,6 +106,73 @@ 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
|
+
* 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.
|
|
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.)
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
|
138
|
+
interface TabDescriptor {
|
|
139
|
+
/** Stable identity — emitted by `onChange`, compared against `activeKey`. */
|
|
140
|
+
key: string;
|
|
141
|
+
/** Pre-localized, human-readable tab label. */
|
|
142
|
+
label: string;
|
|
143
|
+
testID?: string;
|
|
144
|
+
/** Accessible name; defaults to `label`. */
|
|
145
|
+
accessibilityLabel?: string;
|
|
146
|
+
/** Accessible hint announced after the label. */
|
|
147
|
+
accessibilityHint?: string;
|
|
148
|
+
}
|
|
149
|
+
interface TabsProps {
|
|
150
|
+
/** The tabs, left → right. */
|
|
151
|
+
tabs: ReadonlyArray<TabDescriptor>;
|
|
152
|
+
/** The currently-active tab `key`. */
|
|
153
|
+
activeKey: string;
|
|
154
|
+
/** Fired with a tab's `key` when it is pressed. */
|
|
155
|
+
onChange: (key: string) => void;
|
|
156
|
+
/** Accessible name for the whole tablist. */
|
|
157
|
+
accessibilityLabel: string;
|
|
158
|
+
/** The panel content for the active tab. */
|
|
159
|
+
children?: React.ReactNode;
|
|
160
|
+
/** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */
|
|
161
|
+
idPrefix?: string;
|
|
162
|
+
/** Style override merged onto the root container. */
|
|
163
|
+
style?: StyleProp<ViewStyle>;
|
|
164
|
+
/** Style override merged onto the tab strip. */
|
|
165
|
+
stripStyle?: StyleProp<ViewStyle>;
|
|
166
|
+
/** Style override merged onto the panel wrapper. */
|
|
167
|
+
panelStyle?: StyleProp<ViewStyle>;
|
|
168
|
+
testID?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A controlled tabbed section shell. Renders the tab strip and the active tab's
|
|
172
|
+
* panel. Generic-free by design — tab identity is a plain string `key`.
|
|
173
|
+
*/
|
|
174
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
175
|
+
|
|
109
176
|
/**
|
|
110
177
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
111
178
|
* billing route via the injected navigate (default route overridable).
|
|
@@ -554,4 +621,4 @@ declare const LAYOUT_I18N: {
|
|
|
554
621
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
555
622
|
};
|
|
556
623
|
|
|
557
|
-
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, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
624
|
+
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
|
@@ -106,6 +106,73 @@ 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
|
+
* 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.
|
|
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.)
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
|
138
|
+
interface TabDescriptor {
|
|
139
|
+
/** Stable identity — emitted by `onChange`, compared against `activeKey`. */
|
|
140
|
+
key: string;
|
|
141
|
+
/** Pre-localized, human-readable tab label. */
|
|
142
|
+
label: string;
|
|
143
|
+
testID?: string;
|
|
144
|
+
/** Accessible name; defaults to `label`. */
|
|
145
|
+
accessibilityLabel?: string;
|
|
146
|
+
/** Accessible hint announced after the label. */
|
|
147
|
+
accessibilityHint?: string;
|
|
148
|
+
}
|
|
149
|
+
interface TabsProps {
|
|
150
|
+
/** The tabs, left → right. */
|
|
151
|
+
tabs: ReadonlyArray<TabDescriptor>;
|
|
152
|
+
/** The currently-active tab `key`. */
|
|
153
|
+
activeKey: string;
|
|
154
|
+
/** Fired with a tab's `key` when it is pressed. */
|
|
155
|
+
onChange: (key: string) => void;
|
|
156
|
+
/** Accessible name for the whole tablist. */
|
|
157
|
+
accessibilityLabel: string;
|
|
158
|
+
/** The panel content for the active tab. */
|
|
159
|
+
children?: React.ReactNode;
|
|
160
|
+
/** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */
|
|
161
|
+
idPrefix?: string;
|
|
162
|
+
/** Style override merged onto the root container. */
|
|
163
|
+
style?: StyleProp<ViewStyle>;
|
|
164
|
+
/** Style override merged onto the tab strip. */
|
|
165
|
+
stripStyle?: StyleProp<ViewStyle>;
|
|
166
|
+
/** Style override merged onto the panel wrapper. */
|
|
167
|
+
panelStyle?: StyleProp<ViewStyle>;
|
|
168
|
+
testID?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A controlled tabbed section shell. Renders the tab strip and the active tab's
|
|
172
|
+
* panel. Generic-free by design — tab identity is a plain string `key`.
|
|
173
|
+
*/
|
|
174
|
+
declare const Tabs: ({ tabs, activeKey, onChange, accessibilityLabel, children, idPrefix, style, stripStyle, panelStyle, testID, }: TabsProps) => React.ReactElement;
|
|
175
|
+
|
|
109
176
|
/**
|
|
110
177
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
111
178
|
* billing route via the injected navigate (default route overridable).
|
|
@@ -554,4 +621,4 @@ declare const LAYOUT_I18N: {
|
|
|
554
621
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
555
622
|
};
|
|
556
623
|
|
|
557
|
-
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, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
624
|
+
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 };
|