@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.mjs CHANGED
@@ -2027,9 +2027,8 @@ var FormSwitch = ({
2027
2027
  disabled = false,
2028
2028
  ...props
2029
2029
  }) => variant === "box" ? /* @__PURE__ */ jsx(FormSwitchBox, { ...props, disabled, stateLabel, testID }) : /* @__PURE__ */ jsx(FormSwitchRow, { ...props, disabled, testID });
2030
-
2031
- // src/FormCheckbox/checkboxColors.ts
2032
2030
  var checkboxBoxColors = (colors, brand, checked) => checked ? { backgroundColor: brand, borderColor: brand } : { backgroundColor: "transparent", borderColor: colors.textSecondary };
2031
+ var checkboxTickColor = (brand) => resolveOnBrand(brand);
2033
2032
  var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
2034
2033
  var HINT_FONT_SIZE2 = 12;
2035
2034
  var BOX_SIZE = 20;
@@ -2056,6 +2055,11 @@ var styles17 = StyleSheet.create({
2056
2055
  centered: {
2057
2056
  alignItems: "center"
2058
2057
  },
2058
+ boxOnly: {
2059
+ minWidth: MIN_TOUCH_TARGET_PX,
2060
+ justifyContent: "center",
2061
+ marginBottom: 0
2062
+ },
2059
2063
  box: {
2060
2064
  width: BOX_SIZE,
2061
2065
  height: BOX_SIZE,
@@ -2105,7 +2109,8 @@ var FormCheckbox = ({
2105
2109
  containerStyle,
2106
2110
  testID = "form-checkbox",
2107
2111
  accessibilityLabel,
2108
- accessibilityHint
2112
+ accessibilityHint,
2113
+ labelHidden = false
2109
2114
  }) => {
2110
2115
  const { theme } = useUi();
2111
2116
  const { colors, palette } = theme;
@@ -2118,9 +2123,10 @@ var FormCheckbox = ({
2118
2123
  const boxOn = checkboxBoxColors(colors, brand, true);
2119
2124
  const boxOff = checkboxBoxColors(colors, brand, false);
2120
2125
  const ring = { borderColor: brand };
2126
+ const tick = { borderColor: checkboxTickColor(brand) };
2121
2127
  const labelStyle = { color: colors.text };
2122
2128
  const hintStyle = { color: colors.textSecondary };
2123
- return { boxOn, boxOff, ring, label: labelStyle, hint: hintStyle };
2129
+ return { boxOn, boxOff, ring, tick, label: labelStyle, hint: hintStyle };
2124
2130
  }, [brand, colors]);
2125
2131
  const toggle2 = () => {
2126
2132
  const next = !value;
@@ -2152,6 +2158,7 @@ var FormCheckbox = ({
2152
2158
  style: [
2153
2159
  styles17.container,
2154
2160
  hasHint ? null : styles17.centered,
2161
+ labelHidden ? styles17.boxOnly : null,
2155
2162
  containerStyle,
2156
2163
  disabled ? { opacity: DISABLED_OPACITY } : null,
2157
2164
  Platform.OS === "web" ? WEB_NO_DEFAULT_OUTLINE : null
@@ -2161,9 +2168,9 @@ var FormCheckbox = ({
2161
2168
  children: [
2162
2169
  /* @__PURE__ */ jsxs(View, { style: [styles17.box, value ? themeStyles.boxOn : themeStyles.boxOff], testID: `${testID}-box`, children: [
2163
2170
  focused ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: [styles17.focusRing, themeStyles.ring], testID: `${testID}-focus-ring` }) : null,
2164
- value ? /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, pointerEvents: "none", style: [styles17.tick, { borderColor: colors.surface }], testID: `${testID}-tick` }) : null
2171
+ value ? /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, pointerEvents: "none", style: [styles17.tick, themeStyles.tick], testID: `${testID}-tick` }) : null
2165
2172
  ] }),
2166
- /* @__PURE__ */ jsxs(View, { style: styles17.textColumn, children: [
2173
+ labelHidden ? null : /* @__PURE__ */ jsxs(View, { style: styles17.textColumn, children: [
2167
2174
  /* @__PURE__ */ jsx(Text, { style: [styles17.label, themeStyles.label], children: label }),
2168
2175
  hasHint ? /* @__PURE__ */ jsx(Text, { nativeID: hintId, style: [styles17.hint, themeStyles.hint], children: hintText }) : null
2169
2176
  ] })