@dloizides/ui-layout 1.19.0 → 1.20.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 +34 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.20.0
|
|
4
|
+
|
|
5
|
+
**The collapsed `Tabs` menu now READS as a menu — a caret affordance + guaranteed focus.**
|
|
6
|
+
|
|
7
|
+
On the live phone-width organizer nav (`app.kefi.dloizides.com/organizer/passes`) the
|
|
8
|
+
collapsed trigger showed only the active label ("Passes") with no menu cue — styled like a
|
|
9
|
+
static chip/pill — so users could not tell it was a section switcher. This adds a clear
|
|
10
|
+
menu affordance and locks in keyboard focusability.
|
|
11
|
+
|
|
12
|
+
- **New opt-in prop `ModalDropdown.showCaret?: boolean` (default `false`).** When set, the
|
|
13
|
+
DEFAULT trigger renders a ▾ caret pinned to its trailing edge that rotates to point up
|
|
14
|
+
while the menu is open, with a ≥44dp (`MIN_TOUCH_TARGET`) hit target and the existing
|
|
15
|
+
bordered field box + theme tokens. **Every existing field-style dropdown in the kit is
|
|
16
|
+
unchanged** because the caret is off by default, and it is ignored when a custom
|
|
17
|
+
`renderTrigger` is supplied (that caller owns its own visuals). The caret is a font glyph
|
|
18
|
+
(U+25BE), so no icon package enters this contract-pure kit, and its colour comes from
|
|
19
|
+
`colors.textSecondary` (no raw literals). It is decorative — the trigger's `aria-label`
|
|
20
|
+
still names the control, so screen readers do not announce the glyph.
|
|
21
|
+
- **`TabsMenu` opts into `showCaret`**, so the collapsed `Tabs` section switcher now looks
|
|
22
|
+
like a proper control instead of a chip. No change to the public `Tabs` / `TabsMenu` API.
|
|
23
|
+
- **Focusability:** under react-native-web the trigger renders as a native `<button>`
|
|
24
|
+
(role=button, no `tabindex="-1"`), so it is keyboard-reachable and Enter/Space activate
|
|
25
|
+
it. A regression test asserts the collapsed trigger is not `tabindex="-1"`. (The
|
|
26
|
+
`tabindex="-1"` seen on the live DOM came from the older deployed version; it does not
|
|
27
|
+
reproduce on this source — proven by the rendered-DOM assertion, not assumed.)
|
|
28
|
+
|
|
29
|
+
Backward-compatible: one new optional prop, no testID/selector changes. Per-tab E2E
|
|
30
|
+
selectors (`{idPrefix}-menu` trigger, `{idPrefix}-tab-{key}` / descriptor option testIDs)
|
|
31
|
+
are untouched. No new i18n keys.
|
|
32
|
+
|
|
33
|
+
`ui-showcase` does not yet import `Tabs`/`ModalDropdown` (only `SegmentedControl`,
|
|
34
|
+
`CopyableId`, `TruncatedText`), so this is covered by component tests
|
|
35
|
+
(`ModalDropdown.test.tsx`, `Tabs.collapsed.test.tsx`); a showcase specimen is a follow-up.
|
|
36
|
+
|
|
3
37
|
## 1.19.0
|
|
4
38
|
|
|
5
39
|
**`Tabs` collapses to a real mobile menu below a breakpoint.**
|
package/dist/index.d.mts
CHANGED
|
@@ -269,8 +269,17 @@ interface ModalDropdownProps<T> {
|
|
|
269
269
|
* a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.
|
|
270
270
|
*/
|
|
271
271
|
menuMinWidth?: number;
|
|
272
|
+
/**
|
|
273
|
+
* Show a MENU affordance on the DEFAULT trigger: a caret (▾) pinned to the trailing edge that
|
|
274
|
+
* rotates to point up while the menu is open, and a ≥44dp hit target. Opt-in and OFF by default,
|
|
275
|
+
* so every existing field-style dropdown in the kit renders unchanged; a control that must read
|
|
276
|
+
* as a tappable menu rather than a static chip (the collapsed {@link import('../Tabs/Tabs').Tabs}
|
|
277
|
+
* section switcher) sets it. Ignored when a custom `renderTrigger` is supplied — that caller owns
|
|
278
|
+
* its own visuals, affordance included.
|
|
279
|
+
*/
|
|
280
|
+
showCaret?: boolean;
|
|
272
281
|
}
|
|
273
|
-
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
282
|
+
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, showCaret, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
274
283
|
|
|
275
284
|
/**
|
|
276
285
|
* ModalShell — a slide-up full-screen modal with a themed header (title + close button)
|
package/dist/index.d.ts
CHANGED
|
@@ -269,8 +269,17 @@ interface ModalDropdownProps<T> {
|
|
|
269
269
|
* a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.
|
|
270
270
|
*/
|
|
271
271
|
menuMinWidth?: number;
|
|
272
|
+
/**
|
|
273
|
+
* Show a MENU affordance on the DEFAULT trigger: a caret (▾) pinned to the trailing edge that
|
|
274
|
+
* rotates to point up while the menu is open, and a ≥44dp hit target. Opt-in and OFF by default,
|
|
275
|
+
* so every existing field-style dropdown in the kit renders unchanged; a control that must read
|
|
276
|
+
* as a tappable menu rather than a static chip (the collapsed {@link import('../Tabs/Tabs').Tabs}
|
|
277
|
+
* section switcher) sets it. Ignored when a custom `renderTrigger` is supplied — that caller owns
|
|
278
|
+
* its own visuals, affordance included.
|
|
279
|
+
*/
|
|
280
|
+
showCaret?: boolean;
|
|
272
281
|
}
|
|
273
|
-
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
282
|
+
declare const ModalDropdown: <T extends string | number>({ testID, accessibilityLabel, accessibilityHint, value, options, onChange, variant, renderTrigger, optionTestID, menuMinWidth, showCaret, }: ModalDropdownProps<T>) => React.ReactElement;
|
|
274
283
|
|
|
275
284
|
/**
|
|
276
285
|
* ModalShell — a slide-up full-screen modal with a themed header (title + close button)
|
package/dist/index.js
CHANGED
|
@@ -640,6 +640,12 @@ var MODAL_MIN_WIDTH = 200;
|
|
|
640
640
|
var MODAL_MAX_HEIGHT = 300;
|
|
641
641
|
var CONTAINER_PADDING_H = 12;
|
|
642
642
|
var CONTAINER_PADDING_V = 10;
|
|
643
|
+
var MIN_TOUCH_TARGET = 44;
|
|
644
|
+
var CARET_FONT_SIZE = 12;
|
|
645
|
+
var CARET_GAP = 8;
|
|
646
|
+
var CARET_GLYPH = "\u25BE";
|
|
647
|
+
var CARET_OPEN_ROTATION = "180deg";
|
|
648
|
+
var CARET_CLOSED_ROTATION = "0deg";
|
|
643
649
|
var styles7 = reactNative.StyleSheet.create({
|
|
644
650
|
anchor: { position: "relative" },
|
|
645
651
|
container: {
|
|
@@ -648,7 +654,20 @@ var styles7 = reactNative.StyleSheet.create({
|
|
|
648
654
|
paddingHorizontal: CONTAINER_PADDING_H,
|
|
649
655
|
paddingVertical: CONTAINER_PADDING_V
|
|
650
656
|
},
|
|
657
|
+
// Caret variant: a row with the label leading and the caret pinned to the trailing edge, at a
|
|
658
|
+
// phone-friendly minimum height. Only applied when `showCaret` is set, so field dropdowns are
|
|
659
|
+
// untouched.
|
|
660
|
+
containerMenu: {
|
|
661
|
+
minHeight: MIN_TOUCH_TARGET,
|
|
662
|
+
flexDirection: "row",
|
|
663
|
+
alignItems: "center",
|
|
664
|
+
justifyContent: "space-between",
|
|
665
|
+
columnGap: CARET_GAP
|
|
666
|
+
},
|
|
651
667
|
selectedText: { fontSize: BODY_FONT_SIZE2 },
|
|
668
|
+
// The label may shrink/ellipsize; the caret never does.
|
|
669
|
+
selectedTextMenu: { flexShrink: 1 },
|
|
670
|
+
caret: { fontSize: CARET_FONT_SIZE, flexShrink: 0 },
|
|
652
671
|
modalOverlay: {
|
|
653
672
|
flex: 1,
|
|
654
673
|
justifyContent: "center",
|
|
@@ -672,7 +691,8 @@ var ModalDropdown = ({
|
|
|
672
691
|
variant,
|
|
673
692
|
renderTrigger,
|
|
674
693
|
optionTestID,
|
|
675
|
-
menuMinWidth
|
|
694
|
+
menuMinWidth,
|
|
695
|
+
showCaret = false
|
|
676
696
|
}) => {
|
|
677
697
|
const { theme, t } = uiFeedback.useUi();
|
|
678
698
|
const { colors } = theme;
|
|
@@ -707,8 +727,19 @@ var ModalDropdown = ({
|
|
|
707
727
|
[onChange]
|
|
708
728
|
);
|
|
709
729
|
const containerStyle = React9.useMemo(
|
|
710
|
-
() => renderTrigger !== void 0 ? void 0 : [
|
|
711
|
-
|
|
730
|
+
() => renderTrigger !== void 0 ? void 0 : [
|
|
731
|
+
styles7.container,
|
|
732
|
+
showCaret ? styles7.containerMenu : null,
|
|
733
|
+
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
734
|
+
],
|
|
735
|
+
[colors.border, colors.surface, renderTrigger, showCaret]
|
|
736
|
+
);
|
|
737
|
+
const caretStyle = React9.useMemo(
|
|
738
|
+
() => [
|
|
739
|
+
styles7.caret,
|
|
740
|
+
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
741
|
+
],
|
|
742
|
+
[colors.textSecondary, isOpen]
|
|
712
743
|
);
|
|
713
744
|
const optionTestIDFor = React9.useCallback(
|
|
714
745
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
@@ -737,7 +768,10 @@ var ModalDropdown = ({
|
|
|
737
768
|
const keyExtractor = React9.useCallback((item) => String(item.value), []);
|
|
738
769
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
739
770
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
740
|
-
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsxRuntime.
|
|
771
|
+
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : showCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
772
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles7.selectedText, styles7.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
773
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
774
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
741
775
|
hintNode
|
|
742
776
|
] }),
|
|
743
777
|
isMenu && isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -809,6 +843,7 @@ var TabsMenu = ({
|
|
|
809
843
|
accessibilityLabel,
|
|
810
844
|
optionTestID,
|
|
811
845
|
options,
|
|
846
|
+
showCaret: true,
|
|
812
847
|
testID,
|
|
813
848
|
value: activeKey,
|
|
814
849
|
onChange
|