@dloizides/ui-forms 1.54.0 → 1.55.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
@@ -810,8 +810,9 @@ interface FormCheckboxProps {
810
810
  testID?: string;
811
811
  accessibilityLabel?: string;
812
812
  accessibilityHint?: string;
813
+ labelHidden?: boolean;
813
814
  }
814
- declare const FormCheckbox: ({ label, value, onValueChange, onChange, hint, description, disabled, containerStyle, testID, accessibilityLabel, accessibilityHint, }: FormCheckboxProps) => React.ReactElement;
815
+ declare const FormCheckbox: ({ label, value, onValueChange, onChange, hint, description, disabled, containerStyle, testID, accessibilityLabel, accessibilityHint, labelHidden, }: FormCheckboxProps) => React.ReactElement;
815
816
 
816
817
  /**
817
818
  * Shared value types for the dense CONTROLS (select / typeahead / date-range) promoted out of
package/dist/index.d.ts CHANGED
@@ -810,8 +810,9 @@ interface FormCheckboxProps {
810
810
  testID?: string;
811
811
  accessibilityLabel?: string;
812
812
  accessibilityHint?: string;
813
+ labelHidden?: boolean;
813
814
  }
814
- declare const FormCheckbox: ({ label, value, onValueChange, onChange, hint, description, disabled, containerStyle, testID, accessibilityLabel, accessibilityHint, }: FormCheckboxProps) => React.ReactElement;
815
+ declare const FormCheckbox: ({ label, value, onValueChange, onChange, hint, description, disabled, containerStyle, testID, accessibilityLabel, accessibilityHint, labelHidden, }: FormCheckboxProps) => React.ReactElement;
815
816
 
816
817
  /**
817
818
  * Shared value types for the dense CONTROLS (select / typeahead / date-range) promoted out of
package/dist/index.js CHANGED
@@ -2034,9 +2034,8 @@ var FormSwitch = ({
2034
2034
  disabled = false,
2035
2035
  ...props
2036
2036
  }) => variant === "box" ? /* @__PURE__ */ jsxRuntime.jsx(FormSwitchBox, { ...props, disabled, stateLabel, testID }) : /* @__PURE__ */ jsxRuntime.jsx(FormSwitchRow, { ...props, disabled, testID });
2037
-
2038
- // src/FormCheckbox/checkboxColors.ts
2039
2037
  var checkboxBoxColors = (colors, brand, checked) => checked ? { backgroundColor: brand, borderColor: brand } : { backgroundColor: "transparent", borderColor: colors.textSecondary };
2038
+ var checkboxTickColor = (brand) => designTokens.resolveOnBrand(brand);
2040
2039
  var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
2041
2040
  var HINT_FONT_SIZE2 = 12;
2042
2041
  var BOX_SIZE = 20;
@@ -2063,6 +2062,11 @@ var styles17 = reactNative.StyleSheet.create({
2063
2062
  centered: {
2064
2063
  alignItems: "center"
2065
2064
  },
2065
+ boxOnly: {
2066
+ minWidth: a11y.MIN_TOUCH_TARGET_PX,
2067
+ justifyContent: "center",
2068
+ marginBottom: 0
2069
+ },
2066
2070
  box: {
2067
2071
  width: BOX_SIZE,
2068
2072
  height: BOX_SIZE,
@@ -2112,7 +2116,8 @@ var FormCheckbox = ({
2112
2116
  containerStyle,
2113
2117
  testID = "form-checkbox",
2114
2118
  accessibilityLabel,
2115
- accessibilityHint
2119
+ accessibilityHint,
2120
+ labelHidden = false
2116
2121
  }) => {
2117
2122
  const { theme } = uiFeedback.useUi();
2118
2123
  const { colors, palette } = theme;
@@ -2125,9 +2130,10 @@ var FormCheckbox = ({
2125
2130
  const boxOn = checkboxBoxColors(colors, brand, true);
2126
2131
  const boxOff = checkboxBoxColors(colors, brand, false);
2127
2132
  const ring = { borderColor: brand };
2133
+ const tick = { borderColor: checkboxTickColor(brand) };
2128
2134
  const labelStyle = { color: colors.text };
2129
2135
  const hintStyle = { color: colors.textSecondary };
2130
- return { boxOn, boxOff, ring, label: labelStyle, hint: hintStyle };
2136
+ return { boxOn, boxOff, ring, tick, label: labelStyle, hint: hintStyle };
2131
2137
  }, [brand, colors]);
2132
2138
  const toggle2 = () => {
2133
2139
  const next = !value;
@@ -2159,6 +2165,7 @@ var FormCheckbox = ({
2159
2165
  style: [
2160
2166
  styles17.container,
2161
2167
  hasHint ? null : styles17.centered,
2168
+ labelHidden ? styles17.boxOnly : null,
2162
2169
  containerStyle,
2163
2170
  disabled ? { opacity: DISABLED_OPACITY } : null,
2164
2171
  reactNative.Platform.OS === "web" ? WEB_NO_DEFAULT_OUTLINE : null
@@ -2168,9 +2175,9 @@ var FormCheckbox = ({
2168
2175
  children: [
2169
2176
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles17.box, value ? themeStyles.boxOn : themeStyles.boxOff], testID: `${testID}-box`, children: [
2170
2177
  focused ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { pointerEvents: "none", style: [styles17.focusRing, themeStyles.ring], testID: `${testID}-focus-ring` }) : null,
2171
- value ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, pointerEvents: "none", style: [styles17.tick, { borderColor: colors.surface }], testID: `${testID}-tick` }) : null
2178
+ value ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, pointerEvents: "none", style: [styles17.tick, themeStyles.tick], testID: `${testID}-tick` }) : null
2172
2179
  ] }),
2173
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.textColumn, children: [
2180
+ labelHidden ? null : /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.textColumn, children: [
2174
2181
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles17.label, themeStyles.label], children: label }),
2175
2182
  hasHint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { nativeID: hintId, style: [styles17.hint, themeStyles.hint], children: hintText }) : null
2176
2183
  ] })