@oxy.so/bloom 3.0.0 → 3.1.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/docs/adoption-matrix.mdx +266 -0
- package/docs/checkbox.mdx +16 -0
- package/docs/composition.mdx +88 -16
- package/docs/date-picker.mdx +11 -0
- package/docs/field.mdx +35 -4
- package/docs/file-upload.mdx +13 -0
- package/docs/glass.mdx +15 -0
- package/docs/input-group.mdx +22 -0
- package/docs/input-otp.mdx +14 -0
- package/docs/layout.mdx +34 -0
- package/docs/migrating-to-3.0.mdx +43 -4
- package/docs/page-header.mdx +46 -1
- package/docs/phone-input.mdx +17 -0
- package/docs/radio.mdx +16 -0
- package/docs/rating.mdx +14 -0
- package/docs/segmented-control.mdx +16 -4
- package/docs/select.mdx +22 -0
- package/docs/slider.mdx +14 -0
- package/docs/stepper.mdx +3 -1
- package/docs/switch.mdx +14 -0
- package/docs/text-field.mdx +14 -0
- package/docs/textarea.mdx +20 -0
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +11 -4
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/checkbox/Checkbox.js +24 -8
- package/lib/commonjs/checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/date-picker/TimeField.js +18 -6
- package/lib/commonjs/date-picker/TimeField.js.map +1 -1
- package/lib/commonjs/dialog/DialogContent.js +36 -29
- package/lib/commonjs/dialog/DialogContent.js.map +1 -1
- package/lib/commonjs/field/index.js +7 -0
- package/lib/commonjs/field/index.js.map +1 -1
- package/lib/commonjs/field/membership.js +105 -0
- package/lib/commonjs/field/membership.js.map +1 -0
- package/lib/commonjs/file-upload/FileUpload.js +17 -3
- package/lib/commonjs/file-upload/FileUpload.js.map +1 -1
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +21 -0
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/input-group/InputGroup.js +18 -5
- package/lib/commonjs/input-group/InputGroup.js.map +1 -1
- package/lib/commonjs/input-otp/InputOtp.js +20 -8
- package/lib/commonjs/input-otp/InputOtp.js.map +1 -1
- package/lib/commonjs/layout/index.js +7 -0
- package/lib/commonjs/layout/index.js.map +1 -1
- package/lib/commonjs/layout/screen-scope.js +61 -0
- package/lib/commonjs/layout/screen-scope.js.map +1 -0
- package/lib/commonjs/phone-input/PhoneInput.js +20 -8
- package/lib/commonjs/phone-input/PhoneInput.js.map +1 -1
- package/lib/commonjs/radio/Radio.js +35 -9
- package/lib/commonjs/radio/Radio.js.map +1 -1
- package/lib/commonjs/rating/RatingInput.js +14 -6
- package/lib/commonjs/rating/RatingInput.js.map +1 -1
- package/lib/commonjs/segmented-control/SegmentedControl.js +38 -8
- package/lib/commonjs/segmented-control/SegmentedControl.js.map +1 -1
- package/lib/commonjs/select/Select.js +15 -3
- package/lib/commonjs/select/Select.js.map +1 -1
- package/lib/commonjs/select/Select.web.js +13 -5
- package/lib/commonjs/select/Select.web.js.map +1 -1
- package/lib/commonjs/slider/Slider.js +17 -3
- package/lib/commonjs/slider/Slider.js.map +1 -1
- package/lib/commonjs/stepper/Stepper.js +16 -7
- package/lib/commonjs/stepper/Stepper.js.map +1 -1
- package/lib/commonjs/styles/styled-primitives.js.map +1 -1
- package/lib/commonjs/switch/Switch.js +23 -8
- package/lib/commonjs/switch/Switch.js.map +1 -1
- package/lib/commonjs/text-field/TextField.js +19 -4
- package/lib/commonjs/text-field/TextField.js.map +1 -1
- package/lib/commonjs/textarea/Textarea.js +39 -15
- package/lib/commonjs/textarea/Textarea.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +8 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/checkbox/Checkbox.js +24 -8
- package/lib/module/checkbox/Checkbox.js.map +1 -1
- package/lib/module/date-picker/TimeField.js +19 -5
- package/lib/module/date-picker/TimeField.js.map +1 -1
- package/lib/module/dialog/DialogContent.js +37 -30
- package/lib/module/dialog/DialogContent.js.map +1 -1
- package/lib/module/field/index.js +1 -0
- package/lib/module/field/index.js.map +1 -1
- package/lib/module/field/membership.js +101 -0
- package/lib/module/field/membership.js.map +1 -0
- package/lib/module/file-upload/FileUpload.js +17 -3
- package/lib/module/file-upload/FileUpload.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +2 -2
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/input-group/InputGroup.js +19 -4
- package/lib/module/input-group/InputGroup.js.map +1 -1
- package/lib/module/input-otp/InputOtp.js +21 -7
- package/lib/module/input-otp/InputOtp.js.map +1 -1
- package/lib/module/layout/index.js +4 -1
- package/lib/module/layout/index.js.map +1 -1
- package/lib/module/layout/screen-scope.js +57 -0
- package/lib/module/layout/screen-scope.js.map +1 -0
- package/lib/module/phone-input/PhoneInput.js +22 -9
- package/lib/module/phone-input/PhoneInput.js.map +1 -1
- package/lib/module/radio/Radio.js +35 -9
- package/lib/module/radio/Radio.js.map +1 -1
- package/lib/module/rating/RatingInput.js +15 -5
- package/lib/module/rating/RatingInput.js.map +1 -1
- package/lib/module/segmented-control/SegmentedControl.js +38 -8
- package/lib/module/segmented-control/SegmentedControl.js.map +1 -1
- package/lib/module/select/Select.js +15 -3
- package/lib/module/select/Select.js.map +1 -1
- package/lib/module/select/Select.web.js +14 -4
- package/lib/module/select/Select.web.js.map +1 -1
- package/lib/module/slider/Slider.js +17 -3
- package/lib/module/slider/Slider.js.map +1 -1
- package/lib/module/stepper/Stepper.js +17 -6
- package/lib/module/stepper/Stepper.js.map +1 -1
- package/lib/module/styles/styled-primitives.js.map +1 -1
- package/lib/module/switch/Switch.js +23 -8
- package/lib/module/switch/Switch.js.map +1 -1
- package/lib/module/text-field/TextField.js +19 -4
- package/lib/module/text-field/TextField.js.map +1 -1
- package/lib/module/textarea/Textarea.js +39 -15
- package/lib/module/textarea/Textarea.js.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkbox/types.d.ts +5 -0
- package/lib/typescript/commonjs/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/date-picker/TimeField.d.ts +1 -1
- package/lib/typescript/commonjs/date-picker/TimeField.d.ts.map +1 -1
- package/lib/typescript/commonjs/date-picker/types.d.ts +6 -3
- package/lib/typescript/commonjs/date-picker/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogContent.d.ts.map +1 -1
- package/lib/typescript/commonjs/field/index.d.ts +2 -0
- package/lib/typescript/commonjs/field/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/field/membership.d.ts +60 -0
- package/lib/typescript/commonjs/field/membership.d.ts.map +1 -0
- package/lib/typescript/commonjs/file-upload/FileUpload.d.ts +1 -1
- package/lib/typescript/commonjs/file-upload/FileUpload.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/types.d.ts +13 -0
- package/lib/typescript/commonjs/floating/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -3
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +3 -3
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/input-group/InputGroup.d.ts +1 -1
- package/lib/typescript/commonjs/input-group/InputGroup.d.ts.map +1 -1
- package/lib/typescript/commonjs/input-otp/InputOtp.d.ts.map +1 -1
- package/lib/typescript/commonjs/input-otp/types.d.ts +7 -1
- package/lib/typescript/commonjs/input-otp/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/layout/index.d.ts +4 -1
- package/lib/typescript/commonjs/layout/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/layout/screen-scope.d.ts +40 -0
- package/lib/typescript/commonjs/layout/screen-scope.d.ts.map +1 -0
- package/lib/typescript/commonjs/phone-input/PhoneInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/Radio.d.ts +1 -1
- package/lib/typescript/commonjs/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/types.d.ts +11 -3
- package/lib/typescript/commonjs/radio/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/rating/RatingInput.d.ts +1 -1
- package/lib/typescript/commonjs/rating/RatingInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/rating/types.d.ts +6 -3
- package/lib/typescript/commonjs/rating/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/segmented-control/SegmentedControl.d.ts +18 -2
- package/lib/typescript/commonjs/segmented-control/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/Select.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/Select.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/types.d.ts +8 -1
- package/lib/typescript/commonjs/select/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/slider/Slider.d.ts.map +1 -1
- package/lib/typescript/commonjs/stepper/Stepper.d.ts +1 -1
- package/lib/typescript/commonjs/stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/commonjs/stepper/types.d.ts +8 -1
- package/lib/typescript/commonjs/stepper/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/styled-primitives.d.ts +16 -0
- package/lib/typescript/commonjs/styles/styled-primitives.d.ts.map +1 -1
- package/lib/typescript/commonjs/switch/Switch.d.ts.map +1 -1
- package/lib/typescript/commonjs/switch/types.d.ts +7 -0
- package/lib/typescript/commonjs/switch/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/commonjs/textarea/Textarea.d.ts +1 -1
- package/lib/typescript/commonjs/textarea/Textarea.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/module/checkbox/types.d.ts +5 -0
- package/lib/typescript/module/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/module/date-picker/TimeField.d.ts +1 -1
- package/lib/typescript/module/date-picker/TimeField.d.ts.map +1 -1
- package/lib/typescript/module/date-picker/types.d.ts +6 -3
- package/lib/typescript/module/date-picker/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogContent.d.ts.map +1 -1
- package/lib/typescript/module/field/index.d.ts +2 -0
- package/lib/typescript/module/field/index.d.ts.map +1 -1
- package/lib/typescript/module/field/membership.d.ts +60 -0
- package/lib/typescript/module/field/membership.d.ts.map +1 -0
- package/lib/typescript/module/file-upload/FileUpload.d.ts +1 -1
- package/lib/typescript/module/file-upload/FileUpload.d.ts.map +1 -1
- package/lib/typescript/module/floating/types.d.ts +13 -0
- package/lib/typescript/module/floating/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -3
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +3 -3
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/input-group/InputGroup.d.ts +1 -1
- package/lib/typescript/module/input-group/InputGroup.d.ts.map +1 -1
- package/lib/typescript/module/input-otp/InputOtp.d.ts.map +1 -1
- package/lib/typescript/module/input-otp/types.d.ts +7 -1
- package/lib/typescript/module/input-otp/types.d.ts.map +1 -1
- package/lib/typescript/module/layout/index.d.ts +4 -1
- package/lib/typescript/module/layout/index.d.ts.map +1 -1
- package/lib/typescript/module/layout/screen-scope.d.ts +40 -0
- package/lib/typescript/module/layout/screen-scope.d.ts.map +1 -0
- package/lib/typescript/module/phone-input/PhoneInput.d.ts.map +1 -1
- package/lib/typescript/module/radio/Radio.d.ts +1 -1
- package/lib/typescript/module/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/module/radio/types.d.ts +11 -3
- package/lib/typescript/module/radio/types.d.ts.map +1 -1
- package/lib/typescript/module/rating/RatingInput.d.ts +1 -1
- package/lib/typescript/module/rating/RatingInput.d.ts.map +1 -1
- package/lib/typescript/module/rating/types.d.ts +6 -3
- package/lib/typescript/module/rating/types.d.ts.map +1 -1
- package/lib/typescript/module/segmented-control/SegmentedControl.d.ts +18 -2
- package/lib/typescript/module/segmented-control/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/module/select/Select.d.ts.map +1 -1
- package/lib/typescript/module/select/Select.web.d.ts.map +1 -1
- package/lib/typescript/module/select/types.d.ts +8 -1
- package/lib/typescript/module/select/types.d.ts.map +1 -1
- package/lib/typescript/module/slider/Slider.d.ts.map +1 -1
- package/lib/typescript/module/stepper/Stepper.d.ts +1 -1
- package/lib/typescript/module/stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/module/stepper/types.d.ts +8 -1
- package/lib/typescript/module/stepper/types.d.ts.map +1 -1
- package/lib/typescript/module/styles/styled-primitives.d.ts +16 -0
- package/lib/typescript/module/styles/styled-primitives.d.ts.map +1 -1
- package/lib/typescript/module/switch/Switch.d.ts.map +1 -1
- package/lib/typescript/module/switch/types.d.ts +7 -0
- package/lib/typescript/module/switch/types.d.ts.map +1 -1
- package/lib/typescript/module/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/module/textarea/Textarea.d.ts +1 -1
- package/lib/typescript/module/textarea/Textarea.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/bottom-sheet/BottomSheetBase.tsx +6 -1
- package/src/checkbox/Checkbox.tsx +24 -8
- package/src/checkbox/types.ts +5 -0
- package/src/date-picker/TimeField.tsx +14 -3
- package/src/date-picker/types.ts +6 -3
- package/src/dialog/DialogContent.tsx +6 -2
- package/src/field/index.ts +2 -0
- package/src/field/membership.ts +164 -0
- package/src/file-upload/FileUpload.tsx +14 -3
- package/src/floating/types.ts +13 -0
- package/src/index.ts +9 -2
- package/src/index.web.ts +9 -2
- package/src/input-group/InputGroup.tsx +13 -2
- package/src/input-otp/InputOtp.tsx +19 -5
- package/src/input-otp/types.ts +7 -1
- package/src/layout/index.ts +4 -1
- package/src/layout/screen-scope.tsx +54 -0
- package/src/phone-input/PhoneInput.tsx +20 -8
- package/src/radio/Radio.tsx +32 -9
- package/src/radio/types.ts +11 -3
- package/src/rating/RatingInput.tsx +10 -3
- package/src/rating/types.ts +6 -3
- package/src/segmented-control/SegmentedControl.tsx +51 -8
- package/src/select/Select.tsx +14 -2
- package/src/select/Select.web.tsx +11 -2
- package/src/select/types.ts +8 -1
- package/src/slider/Slider.tsx +13 -3
- package/src/stepper/Stepper.tsx +12 -4
- package/src/stepper/types.ts +8 -1
- package/src/styles/styled-primitives.ts +16 -0
- package/src/switch/Switch.tsx +22 -9
- package/src/switch/types.ts +7 -0
- package/src/text-field/TextField.tsx +16 -4
- package/src/textarea/Textarea.tsx +38 -15
|
@@ -11,6 +11,7 @@ var _index = require("../typography/index.js");
|
|
|
11
11
|
var _interactiveWebCss = require("../styles/interactive-web-css.js");
|
|
12
12
|
var _useInteractionState = require("../hooks/use-interaction-state.js");
|
|
13
13
|
var _shared = require("./shared.js");
|
|
14
|
+
var _membership = require("../field/membership.js");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
17
|
/**
|
|
@@ -85,9 +86,21 @@ const CheckboxComponent = ({
|
|
|
85
86
|
style,
|
|
86
87
|
labelStyle,
|
|
87
88
|
accessibilityLabel,
|
|
89
|
+
nativeID,
|
|
88
90
|
testID
|
|
89
91
|
}) => {
|
|
90
92
|
const theme = (0, _useTheme.useTheme)();
|
|
93
|
+
// The label is ADJACENT — the words beside the box ARE the control, so they
|
|
94
|
+
// name it and a `Field` around it only supplies what is missing. `disabled`
|
|
95
|
+
// is the other direction: the field's constrains, so it is OR-ed in.
|
|
96
|
+
const field = (0, _membership.useFieldMembership)({
|
|
97
|
+
accessibilityLabel,
|
|
98
|
+
label,
|
|
99
|
+
labelPlacement: 'adjacent',
|
|
100
|
+
disabled,
|
|
101
|
+
nativeID
|
|
102
|
+
});
|
|
103
|
+
const isDisabled = field.disabled;
|
|
91
104
|
(0, _interactiveWebCss.useInteractiveWebCss)(STYLE_ID, BLOOM_CHECKBOX_CSS);
|
|
92
105
|
(0, _interactiveWebCss.useInteractiveWebCss)(_shared.CHECKBOX_GLYPH_STYLE_ID, _shared.CHECKBOX_GLYPH_CSS);
|
|
93
106
|
const {
|
|
@@ -104,12 +117,12 @@ const CheckboxComponent = ({
|
|
|
104
117
|
} = (0, _useInteractionState.useInteractionState)();
|
|
105
118
|
const sizeConfig = _shared.CHECKBOX_SIZE_CONFIG[size];
|
|
106
119
|
const paint = (0, _react.useMemo)(() => (0, _shared.resolveCheckboxPaint)(theme, color), [theme, color]);
|
|
107
|
-
const highlighted = !
|
|
120
|
+
const highlighted = !isDisabled && (hovered || pressed);
|
|
108
121
|
const handlePress = (0, _react.useCallback)(() => {
|
|
109
|
-
if (!
|
|
122
|
+
if (!isDisabled) {
|
|
110
123
|
onCheckedChange(!checked);
|
|
111
124
|
}
|
|
112
|
-
}, [checked,
|
|
125
|
+
}, [checked, isDisabled, onCheckedChange]);
|
|
113
126
|
const hasText = Boolean(label || description);
|
|
114
127
|
const rowStyle = (0, _react.useMemo)(() => ({
|
|
115
128
|
flexDirection: 'row',
|
|
@@ -134,11 +147,14 @@ const CheckboxComponent = ({
|
|
|
134
147
|
} : {}),
|
|
135
148
|
style: [rowStyle, style],
|
|
136
149
|
onPress: handlePress,
|
|
137
|
-
onPressIn:
|
|
138
|
-
onPressOut:
|
|
150
|
+
onPressIn: isDisabled ? undefined : onPressIn,
|
|
151
|
+
onPressOut: isDisabled ? undefined : onPressOut,
|
|
139
152
|
onHoverIn: onHoverIn,
|
|
140
153
|
onHoverOut: onHoverOut,
|
|
141
|
-
disabled:
|
|
154
|
+
disabled: isDisabled,
|
|
155
|
+
nativeID: field.nativeID,
|
|
156
|
+
"aria-describedby": field.describedBy,
|
|
157
|
+
"aria-invalid": field.invalid || undefined,
|
|
142
158
|
accessibilityRole: "checkbox"
|
|
143
159
|
// `aria-checked`, not `accessibilityState`: react-native-web's
|
|
144
160
|
// `createDOMProps` never reads `accessibilityState`, so a checkbox that
|
|
@@ -149,7 +165,7 @@ const CheckboxComponent = ({
|
|
|
149
165
|
// travels on the `disabled` prop above, which both platforms map.
|
|
150
166
|
,
|
|
151
167
|
"aria-checked": indeterminate ? 'mixed' : checked,
|
|
152
|
-
accessibilityLabel: accessibilityLabel
|
|
168
|
+
accessibilityLabel: field.accessibilityLabel,
|
|
153
169
|
hitSlop: {
|
|
154
170
|
top: slop,
|
|
155
171
|
bottom: slop,
|
|
@@ -161,7 +177,7 @@ const CheckboxComponent = ({
|
|
|
161
177
|
size: size,
|
|
162
178
|
checked: checked,
|
|
163
179
|
indeterminate: indeterminate,
|
|
164
|
-
disabled:
|
|
180
|
+
disabled: isDisabled,
|
|
165
181
|
highlighted: highlighted,
|
|
166
182
|
paint: paint
|
|
167
183
|
// Centre the box on the label's first line box.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useTheme","_index","_interactiveWebCss","_useInteractionState","_shared","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DESCRIPTION_GAP","MIN_TOUCH_TARGET","IS_WEB","Platform","OS","STYLE_ID","ROW","BLOOM_CHECKBOX_CSS","interactiveWebCss","selector","varPrefix","base","transition","hover","declarations","outlineOffset","extraRules","CheckboxComponent","checked","onCheckedChange","label","description","size","disabled","indeterminate","color","style","labelStyle","accessibilityLabel","testID","theme","useTheme","useInteractiveWebCss","CHECKBOX_GLYPH_STYLE_ID","CHECKBOX_GLYPH_CSS","state","hovered","onIn","onHoverIn","onOut","onHoverOut","useInteractionState","pressed","onPressIn","onPressOut","sizeConfig","CHECKBOX_SIZE_CONFIG","paint","useMemo","resolveCheckboxPaint","highlighted","handlePress","useCallback","hasText","Boolean","rowStyle","flexDirection","alignItems","gap","opacity","slop","Math","max","ceil","box","jsxs","Pressable","dataSet","bloomCheckbox","bloomCheckboxFocusable","onPress","undefined","accessibilityRole","hitSlop","top","bottom","left","right","children","jsx","CheckboxGlyph","marginTop","checkboxLabelLineHeight","View","flex","Text","variant","text","Checkbox","exports","memo","displayName"],"sourceRoot":"../../../src","sources":["checkbox/Checkbox.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAEA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useTheme","_index","_interactiveWebCss","_useInteractionState","_shared","_membership","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DESCRIPTION_GAP","MIN_TOUCH_TARGET","IS_WEB","Platform","OS","STYLE_ID","ROW","BLOOM_CHECKBOX_CSS","interactiveWebCss","selector","varPrefix","base","transition","hover","declarations","outlineOffset","extraRules","CheckboxComponent","checked","onCheckedChange","label","description","size","disabled","indeterminate","color","style","labelStyle","accessibilityLabel","nativeID","testID","theme","useTheme","field","useFieldMembership","labelPlacement","isDisabled","useInteractiveWebCss","CHECKBOX_GLYPH_STYLE_ID","CHECKBOX_GLYPH_CSS","state","hovered","onIn","onHoverIn","onOut","onHoverOut","useInteractionState","pressed","onPressIn","onPressOut","sizeConfig","CHECKBOX_SIZE_CONFIG","paint","useMemo","resolveCheckboxPaint","highlighted","handlePress","useCallback","hasText","Boolean","rowStyle","flexDirection","alignItems","gap","opacity","slop","Math","max","ceil","box","jsxs","Pressable","dataSet","bloomCheckbox","bloomCheckboxFocusable","onPress","undefined","describedBy","invalid","accessibilityRole","hitSlop","top","bottom","left","right","children","jsx","CheckboxGlyph","marginTop","checkboxLabelLineHeight","View","flex","Text","variant","text","Checkbox","exports","memo","displayName"],"sourceRoot":"../../../src","sources":["checkbox/Checkbox.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAEA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAQA,IAAAO,WAAA,GAAAP,OAAA;AAAyD,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAD,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAU,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA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AGpB,eAAe,GAAG;QAAE,CAAE;QAAAqF,QAAA,EAE3EhE;MAAW,CACR,CACP;IAAA,CACG,CACP;EAAA,CACQ,CAAC;AAEhB,CAAC;AAEM,MAAM0E,QAAQ,GAAAC,OAAA,CAAAD,QAAA,gBAAG,IAAAE,WAAI,EAAChF,iBAAiB,CAAC;AAC/C8E,QAAQ,CAACG,WAAW,GAAG,UAAU","ignoreList":[]}
|
|
@@ -12,6 +12,8 @@ var _useTheme = require("../theme/use-theme.js");
|
|
|
12
12
|
var _index = require("../typography/index.js");
|
|
13
13
|
var _palette = require("./palette.js");
|
|
14
14
|
var _time = require("./time.js");
|
|
15
|
+
var _index2 = require("../control-surface/index.js");
|
|
16
|
+
var _membership = require("../field/membership.js");
|
|
15
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
19
|
/**
|
|
@@ -44,9 +46,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
44
46
|
* The VALUE is always 24h `"HH:mm"`, whatever `hourFormat` draws, so it drops
|
|
45
47
|
* straight into `MeetingScheduler`'s `timeSlots` and needs no locale from the
|
|
46
48
|
* caller.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
const SIZE_CONFIG = {
|
|
49
|
+
*/const SIZE_CONFIG = {
|
|
50
50
|
small: {
|
|
51
51
|
width: 96,
|
|
52
52
|
height: 32,
|
|
@@ -72,8 +72,8 @@ function TimeFieldComponent({
|
|
|
72
72
|
max,
|
|
73
73
|
step = 1,
|
|
74
74
|
hourFormat = '24h',
|
|
75
|
-
size
|
|
76
|
-
disabled = false,
|
|
75
|
+
size: sizeProp,
|
|
76
|
+
disabled: disabledProp = false,
|
|
77
77
|
accessibilityLabel,
|
|
78
78
|
placeholder,
|
|
79
79
|
width,
|
|
@@ -81,6 +81,15 @@ function TimeFieldComponent({
|
|
|
81
81
|
testID
|
|
82
82
|
}) {
|
|
83
83
|
const theme = (0, _useTheme.useTheme)();
|
|
84
|
+
// `"--:--"` names nothing, so the name is a prop — or, inside a `Field`, the
|
|
85
|
+
// field's label. The density contract supplies the size the same way: a
|
|
86
|
+
// container can ask for `small` once instead of on every control.
|
|
87
|
+
const size = (0, _index2.useInheritedControl)('density', sizeProp, 'medium');
|
|
88
|
+
const field = (0, _membership.useFieldMembership)({
|
|
89
|
+
accessibilityLabel,
|
|
90
|
+
disabled: disabledProp
|
|
91
|
+
});
|
|
92
|
+
const disabled = field.disabled;
|
|
84
93
|
const palette = (0, _react.useMemo)(() => (0, _palette.resolveCalendarPalette)(theme), [theme]);
|
|
85
94
|
const config = SIZE_CONFIG[size];
|
|
86
95
|
const shown = value ? (0, _time.formatTime)(value, hourFormat) : '';
|
|
@@ -164,7 +173,10 @@ function TimeFieldComponent({
|
|
|
164
173
|
placeholder: placeholder ?? (hourFormat === '12h' ? '--:-- --' : '--:--'),
|
|
165
174
|
placeholderTextColor: palette.secondaryText,
|
|
166
175
|
inputMode: hourFormat === '12h' ? 'text' : 'numeric',
|
|
167
|
-
|
|
176
|
+
nativeID: field.nativeID,
|
|
177
|
+
accessibilityLabel: field.accessibilityLabel,
|
|
178
|
+
"aria-describedby": field.describedBy,
|
|
179
|
+
"aria-invalid": field.invalid || undefined,
|
|
168
180
|
"aria-disabled": disabled || undefined,
|
|
169
181
|
style: [FIELD_TRANSITION, fieldStyle, style],
|
|
170
182
|
testID: testID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_menuType","_tokens","_useTheme","_index","_palette","_time","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SIZE_CONFIG","small","width","height","type","medium","FIELD_TRANSITION","Platform","OS","transitionProperty","transitionDuration","transitionTimingFunction","TimeFieldComponent","value","onChange","min","max","step","hourFormat","size","disabled","accessibilityLabel","placeholder","style","testID","theme","useTheme","palette","useMemo","resolveCalendarPalette","config","shown","formatTime","text","setText","useState","focused","setFocused","useEffect","commit","draft","trim","parsed","parseTime","next","snapTime","nudge","direction","stepTime","fieldStyle","paddingLeft","paddingRight","borderWidth","borderRadius","borderColor","chipBorderFocused","chipBorder","backgroundColor","panel","boxShadow","shadowXs","color","disabledText","opacity","DISABLED_OPACITY","TYPE_SCALE","MENU_FONT_FAMILY","outlineWidth","jsx","TextInput","editable","onChangeText","onFocus","onBlur","onSubmitEditing","onKeyPress","event","key","nativeEvent","preventDefault","placeholderTextColor","secondaryText","inputMode","undefined","TimeField","exports","memo","displayName"],"sourceRoot":"../../../src","sources":["date-picker/TimeField.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_menuType","_tokens","_useTheme","_index","_palette","_time","_index2","_membership","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SIZE_CONFIG","small","width","height","type","medium","FIELD_TRANSITION","Platform","OS","transitionProperty","transitionDuration","transitionTimingFunction","TimeFieldComponent","value","onChange","min","max","step","hourFormat","size","sizeProp","disabled","disabledProp","accessibilityLabel","placeholder","style","testID","theme","useTheme","useInheritedControl","field","useFieldMembership","palette","useMemo","resolveCalendarPalette","config","shown","formatTime","text","setText","useState","focused","setFocused","useEffect","commit","draft","trim","parsed","parseTime","next","snapTime","nudge","direction","stepTime","fieldStyle","paddingLeft","paddingRight","borderWidth","borderRadius","borderColor","chipBorderFocused","chipBorder","backgroundColor","panel","boxShadow","shadowXs","color","disabledText","opacity","DISABLED_OPACITY","TYPE_SCALE","MENU_FONT_FAMILY","outlineWidth","jsx","TextInput","editable","onChangeText","onFocus","onBlur","onSubmitEditing","onKeyPress","event","key","nativeEvent","preventDefault","placeholderTextColor","secondaryText","inputMode","nativeID","describedBy","invalid","undefined","TimeField","exports","memo","displayName"],"sourceRoot":"../../../src","sources":["date-picker/TimeField.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAEA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAAyD,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAD,wBAAAY,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAY,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EA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AAO,CAAE;IAC1EmE,oBAAoB,EAAErD,OAAO,CAACsD,aAAc;IAC5CC,SAAS,EAAErE,UAAU,KAAK,KAAK,GAAG,MAAM,GAAG,SAAU;IACrDsE,QAAQ,EAAE1D,KAAK,CAAC0D,QAAS;IACzBjE,kBAAkB,EAAEO,KAAK,CAACP,kBAAmB;IAC7C,oBAAkBO,KAAK,CAAC2D,WAAY;IACpC,gBAAc3D,KAAK,CAAC4D,OAAO,IAAIC,SAAU;IACzC,iBAAetE,QAAQ,IAAIsE,SAAU;IACrClE,KAAK,EAAE,CAACnB,gBAAgB,EAAEgD,UAAU,EAAE7B,KAAK,CAAE;IAC7CC,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN;AAEO,MAAMkE,SAAS,GAAAC,OAAA,CAAAD,SAAA,gBAAG,IAAAE,WAAI,EAAClF,kBAAkB,CAAC;AACjDgF,SAAS,CAACG,WAAW,GAAG,WAAW","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _index = require("../typography/index.js");
|
|
11
11
|
var _useTheme = require("../theme/use-theme.js");
|
|
12
|
+
var _index2 = require("../layout/index.js");
|
|
12
13
|
var _button = require("../button");
|
|
13
14
|
var _context = require("./context.js");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -36,36 +37,42 @@ function DialogBody({
|
|
|
36
37
|
children
|
|
37
38
|
}) {
|
|
38
39
|
const theme = (0, _useTheme.useTheme)();
|
|
39
|
-
return
|
|
40
|
-
children: [title ?
|
|
40
|
+
return (
|
|
41
41
|
/*#__PURE__*/
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
// A dialog is its own screen: chrome inside it claims THIS surface's top
|
|
43
|
+
// edge and follows THIS surface's scroller, not the page's underneath
|
|
44
|
+
// (`layout/screen-scope.tsx`).
|
|
45
|
+
(0, _jsxRuntime.jsxs)(_index2.ScreenScope, {
|
|
46
|
+
children: [title ?
|
|
47
|
+
/*#__PURE__*/
|
|
48
|
+
// Bloom's `Text`, not react-native's: the raw one renders in whatever
|
|
49
|
+
// font the platform picks and takes no theme colour, so every dialog
|
|
50
|
+
// title in the library was the system face while the rest of the surface
|
|
51
|
+
// was Bloom's. The sizes stay explicit — the typography ROLES
|
|
52
|
+
// (`H1`…`H6`, `P`) carry family and weight, not a size ramp.
|
|
53
|
+
(0, _jsxRuntime.jsx)(_index.Text, {
|
|
54
|
+
nativeID: titleId,
|
|
55
|
+
style: {
|
|
56
|
+
fontSize: 22,
|
|
57
|
+
fontWeight: '600',
|
|
58
|
+
paddingBottom: description ? 4 : 16,
|
|
59
|
+
lineHeight: 30
|
|
60
|
+
},
|
|
61
|
+
children: title
|
|
62
|
+
}) : null, description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Text, {
|
|
63
|
+
nativeID: descriptionId,
|
|
64
|
+
style: {
|
|
65
|
+
fontSize: 16,
|
|
66
|
+
color: theme.colors.textSecondary,
|
|
67
|
+
paddingBottom: 16,
|
|
68
|
+
lineHeight: 22
|
|
69
|
+
},
|
|
70
|
+
children: description
|
|
71
|
+
}) : null, children, actions && actions.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionRow, {
|
|
72
|
+
actions: actions
|
|
73
|
+
}) : null]
|
|
74
|
+
})
|
|
75
|
+
);
|
|
69
76
|
}
|
|
70
77
|
function ActionRow({
|
|
71
78
|
actions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_index","_useTheme","_button","_context","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DialogBody","titleId","descriptionId","title","description","actions","children","theme","useTheme","jsxs","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_index","_useTheme","_index2","_button","_context","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DialogBody","titleId","descriptionId","title","description","actions","children","theme","useTheme","jsxs","ScreenScope","jsx","Text","nativeID","style","fontSize","fontWeight","paddingBottom","lineHeight","color","colors","textSecondary","length","ActionRow","View","width","gap","justifyContent","map","action","idx","ActionButton","label","close","useDialogContext","shouldCloseOnPress","handlePress","useCallback","onPress","event","undefined","Button","variant","ACTION_VARIANT","size","disabled","accessibilityLabel","testID","fullWidth","alignSelf","cancel","destructive"],"sourceRoot":"../../../src","sources":["dialog/DialogContent.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AAA6C,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,C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ACV,KAAK,IAAI,SAAS;EAC1D,MAAMgB,kBAAkB,GAAGN,MAAM,CAACM,kBAAkB,IAAI,IAAI;;EAE5D;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,WAAW,GAAG,IAAAC,kBAAW,EAC5BxD,CAAyB,IAAK;IAC7B,MAAMyD,OAAO,GAAGT,MAAM,CAACS,OAAO;IAC9B,MAAMC,KAAK,GAAG1D,CAA0B;IACxC,IAAIsD,kBAAkB,EAAE;MACtBF,KAAK,CAACK,OAAO,GAAG,MAAMA,OAAO,CAACC,KAAK,CAAC,GAAGC,SAAS,CAAC;IACnD,CAAC,MAAM;MACLF,OAAO,GAAGC,KAAK,CAAC;IAClB;EACF,CAAC,EACD,CAACV,MAAM,CAACS,OAAO,EAAEL,KAAK,EAAEE,kBAAkB,CAC5C,CAAC;;EAED;EACA;EACA;EACA,oBACE,IAAAvD,WAAA,CAAA+B,GAAA,EAACjC,OAAA,CAAA+D,MAAM;IACLC,OAAO,EAAEC,cAAc,CAACxB,KAAK,CAAE;IAC/ByB,IAAI,EAAC,OAAO;IACZC,QAAQ,EAAEhB,MAAM,CAACgB,QAAS;IAC1BP,OAAO,EAAEA,CAAA,KAAMF,WAAW,CAAC,CAAE;IAC7BU,kBAAkB,EAAEjB,MAAM,CAACG,KAAM;IACjCe,MAAM,EAAElB,MAAM,CAACkB,MAAO;IACtBC,SAAS;IACTlC,KAAK,EAAE;MAAEmC,SAAS,EAAE;IAAU,CAAE;IAAA3C,QAAA,EAE/BuB,MAAM,CAACG;EAAK,CACP,CAAC;AAEb;;AAEA;AACA,MAAMW,cAAwD,GAAG;EAC/DpD,OAAO,EAAE,SAAS;EAClB2D,MAAM,EAAE,WAAW;EACnBC,WAAW,EAAE;AACf,CAAC","ignoreList":[]}
|
|
@@ -15,6 +15,13 @@ Object.defineProperty(exports, "useFieldControl", {
|
|
|
15
15
|
return _context.useFieldControl;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "useFieldMembership", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _membership.useFieldMembership;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
var _Field = require("./Field.js");
|
|
19
25
|
var _context = require("./context.js");
|
|
26
|
+
var _membership = require("./membership.js");
|
|
20
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Field","require","_context"],"sourceRoot":"../../../src","sources":["field/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_Field","require","_context","_membership"],"sourceRoot":"../../../src","sources":["field/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFieldMembership = useFieldMembership;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _context = require("./context.js");
|
|
9
|
+
/**
|
|
10
|
+
* ONE resolution of field membership, for every control that opts in.
|
|
11
|
+
*
|
|
12
|
+
* `useFieldControl()` hands a control the field's ids and state; applying them
|
|
13
|
+
* is four separate decisions, and each has a direction that is silently wrong:
|
|
14
|
+
*
|
|
15
|
+
* the NAME defers to the field (`??`) — a control inside a labelled
|
|
16
|
+
* field must not announce nothing
|
|
17
|
+
* the CONSTRAINTS combine with the field (`||`) — `disabled` and `invalid`
|
|
18
|
+
* restrict, so a control cannot opt out
|
|
19
|
+
* the ID is the field's (`??` the caller's own, which wins)
|
|
20
|
+
* `describedBy` is a LIST, so the two are joined rather than one chosen
|
|
21
|
+
*
|
|
22
|
+
* Fifteen families resolving that by hand is fifteen chances to write `??` where
|
|
23
|
+
* `||` belongs — and the failure is silent in both directions: a control that
|
|
24
|
+
* re-enables itself inside a disabled field looks fine and a field-labelled
|
|
25
|
+
* control that announces nothing looks fine too. So it is a function, for the
|
|
26
|
+
* same reason `useInheritedControl` is one.
|
|
27
|
+
*
|
|
28
|
+
* `TextFieldInput` is the one family that resolves the same rule inline, because
|
|
29
|
+
* it also reconciles the text-field shell's own context and its standalone
|
|
30
|
+
* branch. It is not exempt from the RULE: `FieldMembership.test.tsx` asserts the
|
|
31
|
+
* observable properties for every family, so the two implementations cannot
|
|
32
|
+
* disagree about what a field means without going red.
|
|
33
|
+
*
|
|
34
|
+
* ## The name, and why placement decides it
|
|
35
|
+
*
|
|
36
|
+
* A control's own label is either STACKED above it (`TextField`, `Textarea`:
|
|
37
|
+
* the field's label and the control's label are two spellings of one thing, and
|
|
38
|
+
* a `Field` around it should win) or ADJACENT to it (a checkbox's caption, a
|
|
39
|
+
* radio's option text: the words the user reads AS the control, which the
|
|
40
|
+
* announced name must match). Getting that backwards makes a screen reader say
|
|
41
|
+
* one thing while the eye reads another, so it is a declared property of the
|
|
42
|
+
* family rather than a guess this hook could make.
|
|
43
|
+
*
|
|
44
|
+
* A control with neither — `Switch`, `Slider`, a progress bar — can be named by
|
|
45
|
+
* NOTHING but the field, which is the case this hook exists for.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/** Where the control renders its own label, which decides which name wins. */
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolve what an enclosing `Field` contributes to one control.
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const field = useFieldMembership({ accessibilityLabel, label, labelPlacement: 'adjacent', disabled });
|
|
55
|
+
* <Pressable
|
|
56
|
+
* nativeID={field.nativeID}
|
|
57
|
+
* accessibilityLabel={field.accessibilityLabel}
|
|
58
|
+
* aria-describedby={field.describedBy}
|
|
59
|
+
* aria-invalid={field.invalid || undefined}
|
|
60
|
+
* disabled={field.disabled}
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* Outside a `Field` it returns the control's own values unchanged, so a control
|
|
65
|
+
* can call it unconditionally.
|
|
66
|
+
*/
|
|
67
|
+
function useFieldMembership(input = {}) {
|
|
68
|
+
const field = (0, _context.useFieldControl)();
|
|
69
|
+
const {
|
|
70
|
+
accessibilityLabel,
|
|
71
|
+
label,
|
|
72
|
+
labelPlacement = 'stacked',
|
|
73
|
+
disabled = false,
|
|
74
|
+
invalid = false,
|
|
75
|
+
required = false,
|
|
76
|
+
nativeID,
|
|
77
|
+
describedBy
|
|
78
|
+
} = input;
|
|
79
|
+
const fieldLabel = field?.labelText;
|
|
80
|
+
const fieldDescribedBy = field?.describedBy;
|
|
81
|
+
const fieldControlId = field?.controlId;
|
|
82
|
+
const fieldDisabled = field?.disabled === true;
|
|
83
|
+
const fieldInvalid = field?.invalid === true;
|
|
84
|
+
const fieldRequired = field?.required === true;
|
|
85
|
+
return (0, _react.useMemo)(() => {
|
|
86
|
+
const own = label ?? undefined;
|
|
87
|
+
const name = accessibilityLabel ?? (labelPlacement === 'adjacent' ? own ?? fieldLabel : fieldLabel ?? own);
|
|
88
|
+
|
|
89
|
+
// An id LIST: a control that already points at its own hint keeps it, and
|
|
90
|
+
// the field's error is added rather than swapped in. Duplicates are
|
|
91
|
+
// dropped — an id named twice is read twice by some screen readers.
|
|
92
|
+
const described = [describedBy, fieldDescribedBy].filter(id => typeof id === 'string' && id.length > 0);
|
|
93
|
+
const uniqueDescribed = Array.from(new Set(described.flatMap(ids => ids.split(/\s+/))));
|
|
94
|
+
return {
|
|
95
|
+
inField: field != null,
|
|
96
|
+
nativeID: nativeID ?? fieldControlId,
|
|
97
|
+
accessibilityLabel: name,
|
|
98
|
+
describedBy: uniqueDescribed.length > 0 ? uniqueDescribed.join(' ') : undefined,
|
|
99
|
+
disabled: disabled || fieldDisabled,
|
|
100
|
+
invalid: invalid || fieldInvalid,
|
|
101
|
+
required: required || fieldRequired
|
|
102
|
+
};
|
|
103
|
+
}, [field, accessibilityLabel, label, labelPlacement, disabled, invalid, required, nativeID, describedBy, fieldLabel, fieldDescribedBy, fieldControlId, fieldDisabled, fieldInvalid, fieldRequired]);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=membership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_context","useFieldMembership","input","field","useFieldControl","accessibilityLabel","label","labelPlacement","disabled","invalid","required","nativeID","describedBy","fieldLabel","labelText","fieldDescribedBy","fieldControlId","controlId","fieldDisabled","fieldInvalid","fieldRequired","useMemo","own","undefined","name","described","filter","id","length","uniqueDescribed","Array","from","Set","flatMap","ids","split","inField","join"],"sourceRoot":"../../../src","sources":["field/membership.ts"],"mappings":";;;;;;AAsCA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;;AA4CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAACC,KAA2B,GAAG,CAAC,CAAC,EAAmB;EACpF,MAAMC,KAAK,GAAG,IAAAC,wBAAe,EAAC,CAAC;EAC/B,MAAM;IACJC,kBAAkB;IAClBC,KAAK;IACLC,cAAc,GAAG,SAAS;IAC1BC,QAAQ,GAAG,KAAK;IAChBC,OAAO,GAAG,KAAK;IACfC,QAAQ,GAAG,KAAK;IAChBC,QAAQ;IACRC;EACF,CAAC,GAAGV,KAAK;EAET,MAAMW,UAAU,GAAGV,KAAK,EAAEW,SAAS;EACnC,MAAMC,gBAAgB,GAAGZ,KAAK,EAAES,WAAW;EAC3C,MAA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PC,QAAQ,EACRC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVE,gBAAgB,EAChBC,cAAc,EACdE,aAAa,EACbC,YAAY,EACZC,aAAa,CACd,CAAC;AACJ","ignoreList":[]}
|
|
@@ -24,6 +24,7 @@ var _useTheme = require("../theme/use-theme.js");
|
|
|
24
24
|
var _index2 = require("../typography/index.js");
|
|
25
25
|
var _shared2 = require("./shared.js");
|
|
26
26
|
var _tokens = require("../styles/tokens.js");
|
|
27
|
+
var _membership = require("../field/membership.js");
|
|
27
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
29
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
29
30
|
/**
|
|
@@ -407,12 +408,22 @@ const FileUploadComponent = function FileUpload({
|
|
|
407
408
|
maxBytes = DEFAULT_MAX_BYTES,
|
|
408
409
|
renderFileIcon,
|
|
409
410
|
labels: labelOverrides,
|
|
410
|
-
disabled = false,
|
|
411
|
-
accessibilityLabel
|
|
411
|
+
disabled: disabledProp = false,
|
|
412
|
+
accessibilityLabel,
|
|
412
413
|
style,
|
|
413
414
|
testID
|
|
414
415
|
}) {
|
|
415
416
|
const theme = (0, _useTheme.useTheme)();
|
|
417
|
+
// The drop zone draws a prompt but names itself with a prop, so a `Field`
|
|
418
|
+
// around it is the other place the name can come from — and the field's
|
|
419
|
+
// `disabled` blocks the picker whatever the caller passed. `'Upload a file'`
|
|
420
|
+
// stays the last resort rather than a default that would outrank a label the
|
|
421
|
+
// user can read.
|
|
422
|
+
const field = (0, _membership.useFieldMembership)({
|
|
423
|
+
accessibilityLabel,
|
|
424
|
+
disabled: disabledProp
|
|
425
|
+
});
|
|
426
|
+
const disabled = field.disabled;
|
|
416
427
|
(0, _interactiveWebCss.useInteractiveWebCss)(STYLE_ID, BLOOM_FILE_UPLOAD_CSS);
|
|
417
428
|
const reducedMotion = (0, _reactNativeReanimated.useReducedMotion)();
|
|
418
429
|
const paint = (0, _react.useMemo)(() => resolveFileUploadPaint(theme), [theme]);
|
|
@@ -594,7 +605,10 @@ const FileUploadComponent = function FileUpload({
|
|
|
594
605
|
bloomFileUpload: busy ? 'busy' : 'idle'
|
|
595
606
|
}),
|
|
596
607
|
accessibilityRole: "button",
|
|
597
|
-
|
|
608
|
+
nativeID: field.nativeID,
|
|
609
|
+
accessibilityLabel: field.accessibilityLabel ?? 'Upload a file',
|
|
610
|
+
"aria-describedby": field.describedBy,
|
|
611
|
+
"aria-invalid": field.invalid || undefined,
|
|
598
612
|
"aria-busy": busy,
|
|
599
613
|
disabled: disabled,
|
|
600
614
|
focusable: !blocked
|