@dloizides/ui-nav 1.33.0 → 1.34.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 CHANGED
@@ -1023,8 +1023,10 @@ interface DarkModeControlProps {
1023
1023
  testID?: string;
1024
1024
  /** Extra container style overrides. */
1025
1025
  containerStyle?: ViewStyle | ViewStyle[];
1026
+ /** Show the text label beside the icon; an option without an icon always shows it. */
1027
+ showLabel?: boolean;
1026
1028
  }
1027
- declare const DarkModeControl: ({ value, options, onChange, regionLabel, variant, testID, containerStyle, }: DarkModeControlProps) => React.ReactElement | null;
1029
+ declare const DarkModeControl: ({ value, options, onChange, regionLabel, variant, testID, containerStyle, showLabel, }: DarkModeControlProps) => React.ReactElement | null;
1028
1030
 
1029
1031
  /**
1030
1032
  * NavBarLink — a SINGLE horizontal `NavBar` link, extracted so each link owns its
package/dist/index.d.ts CHANGED
@@ -1023,8 +1023,10 @@ interface DarkModeControlProps {
1023
1023
  testID?: string;
1024
1024
  /** Extra container style overrides. */
1025
1025
  containerStyle?: ViewStyle | ViewStyle[];
1026
+ /** Show the text label beside the icon; an option without an icon always shows it. */
1027
+ showLabel?: boolean;
1026
1028
  }
1027
- declare const DarkModeControl: ({ value, options, onChange, regionLabel, variant, testID, containerStyle, }: DarkModeControlProps) => React.ReactElement | null;
1029
+ declare const DarkModeControl: ({ value, options, onChange, regionLabel, variant, testID, containerStyle, showLabel, }: DarkModeControlProps) => React.ReactElement | null;
1028
1030
 
1029
1031
  /**
1030
1032
  * NavBarLink — a SINGLE horizontal `NavBar` link, extracted so each link owns its
package/dist/index.js CHANGED
@@ -2266,7 +2266,8 @@ var DarkModeControl = ({
2266
2266
  regionLabel,
2267
2267
  variant = "segmented",
2268
2268
  testID,
2269
- containerStyle
2269
+ containerStyle,
2270
+ showLabel = false
2270
2271
  }) => {
2271
2272
  const { theme } = uiFeedback.useUi();
2272
2273
  const colors = theme.colors;
@@ -2280,6 +2281,7 @@ var DarkModeControl = ({
2280
2281
  if (next !== void 0) onChange(next.value);
2281
2282
  }, [options, currentIndex, onChange]);
2282
2283
  if (options.length === 0 || current === void 0) return null;
2284
+ const labelVisible = (option) => showLabel || typeof option.renderIcon !== "function";
2283
2285
  if (variant === "cycle") {
2284
2286
  const iconColor = colors.text;
2285
2287
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-label": regionLabel, style: containerStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2293,7 +2295,7 @@ var DarkModeControl = ({
2293
2295
  onPress: advance,
2294
2296
  children: [
2295
2297
  typeof current.renderIcon === "function" ? current.renderIcon(iconColor, DARK_MODE_ICON_SIZE) : null,
2296
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [darkModeStyles.cycleText, { color: colors.text }], children: current.label })
2298
+ labelVisible(current) ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [darkModeStyles.cycleText, { color: colors.text }], children: current.label }) : null
2297
2299
  ]
2298
2300
  }
2299
2301
  ) });
@@ -2318,7 +2320,7 @@ var DarkModeControl = ({
2318
2320
  onPress: () => onChange(option.value),
2319
2321
  children: [
2320
2322
  typeof option.renderIcon === "function" ? option.renderIcon(textColor, DARK_MODE_ICON_SIZE) : null,
2321
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [darkModeStyles.segmentText, { color: textColor }], children: option.label })
2323
+ labelVisible(option) ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [darkModeStyles.segmentText, { color: textColor }], children: option.label }) : null
2322
2324
  ]
2323
2325
  },
2324
2326
  option.value