@dloizides/ui-layout 1.17.0 → 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/dist/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -121,8 +121,17 @@ declare function SegmentedControl<V extends string = string>({ options, value, o
|
|
|
121
121
|
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /
|
|
122
122
|
* router / store / icon imports. `label`s are pre-localized strings supplied by
|
|
123
123
|
* the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider
|
|
124
|
-
* theme, so the strip re-skins on tenant swap.
|
|
125
|
-
*
|
|
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.)
|
|
126
135
|
*/
|
|
127
136
|
|
|
128
137
|
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
package/dist/index.d.ts
CHANGED
|
@@ -121,8 +121,17 @@ declare function SegmentedControl<V extends string = string>({ options, value, o
|
|
|
121
121
|
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /
|
|
122
122
|
* router / store / icon imports. `label`s are pre-localized strings supplied by
|
|
123
123
|
* the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider
|
|
124
|
-
* theme, so the strip re-skins on tenant swap.
|
|
125
|
-
*
|
|
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.)
|
|
126
135
|
*/
|
|
127
136
|
|
|
128
137
|
/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */
|
package/dist/index.js
CHANGED
|
@@ -247,16 +247,25 @@ var styles5 = reactNative.StyleSheet.create({
|
|
|
247
247
|
root: {
|
|
248
248
|
width: "100%"
|
|
249
249
|
},
|
|
250
|
+
// The full-width rule under the row lives here (not on the strip) so it spans the
|
|
251
|
+
// whole width even when the tabs are narrower than the viewport (desktop) and is
|
|
252
|
+
// not clipped to the scroll content width.
|
|
253
|
+
stripOuter: {
|
|
254
|
+
width: "100%",
|
|
255
|
+
borderBottomWidth: BORDER_WIDTH2
|
|
256
|
+
},
|
|
250
257
|
strip: {
|
|
251
258
|
flexDirection: "row",
|
|
252
|
-
flexWrap: "
|
|
259
|
+
flexWrap: "nowrap",
|
|
253
260
|
alignItems: "center",
|
|
254
261
|
columnGap: COLUMN_GAP,
|
|
255
262
|
rowGap: ROW_GAP,
|
|
256
|
-
paddingVertical: ROW_PAD_V
|
|
257
|
-
borderBottomWidth: BORDER_WIDTH2
|
|
263
|
+
paddingVertical: ROW_PAD_V
|
|
258
264
|
},
|
|
259
265
|
pill: {
|
|
266
|
+
// Keep each pill at its natural size so the row scrolls instead of squashing
|
|
267
|
+
// the tabs when they don't all fit.
|
|
268
|
+
flexShrink: 0,
|
|
260
269
|
paddingHorizontal: PILL_PAD_H,
|
|
261
270
|
paddingVertical: PILL_PAD_V,
|
|
262
271
|
borderRadius: PILL_RADIUS,
|
|
@@ -296,12 +305,12 @@ var Tabs = ({
|
|
|
296
305
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
297
306
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
298
307
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles5.root, style], testID, children: [
|
|
299
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.stripOuter, { borderBottomColor: colors.border }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
300
309
|
reactNative.View,
|
|
301
310
|
{
|
|
302
311
|
accessibilityRole: "tablist",
|
|
303
312
|
"aria-label": accessibilityLabel,
|
|
304
|
-
style: [styles5.strip,
|
|
313
|
+
style: [styles5.strip, stripStyle],
|
|
305
314
|
children: tabs.map((tab) => {
|
|
306
315
|
const selected = tab.key === activeKey;
|
|
307
316
|
const textColor = selected ? TEXT_ON_PRIMARY : colors.textSecondary;
|
|
@@ -325,7 +334,7 @@ var Tabs = ({
|
|
|
325
334
|
);
|
|
326
335
|
})
|
|
327
336
|
}
|
|
328
|
-
) }),
|
|
337
|
+
) }) }),
|
|
329
338
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles5.panel, panelStyle], ...panelAria, children })
|
|
330
339
|
] });
|
|
331
340
|
};
|