@oxy.so/bloom 2.12.4 → 3.0.1
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/README.md +4 -4
- package/docs/button-group.mdx +46 -4
- package/docs/composition.mdx +159 -0
- package/docs/field.mdx +39 -1
- package/docs/glass.mdx +61 -0
- package/docs/layout.mdx +72 -4
- package/docs/migrating-to-3.0.mdx +169 -0
- package/docs/page-header.mdx +237 -36
- package/lib/commonjs/button/Button.js +2 -0
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/button-group/ButtonGroup.js +124 -19
- package/lib/commonjs/button-group/ButtonGroup.js.map +1 -1
- package/lib/commonjs/control-surface/ControlSurface.js +46 -0
- package/lib/commonjs/control-surface/ControlSurface.js.map +1 -0
- package/lib/commonjs/control-surface/context.js +84 -0
- package/lib/commonjs/control-surface/context.js.map +1 -0
- package/lib/commonjs/control-surface/index.js +26 -0
- package/lib/commonjs/control-surface/index.js.map +1 -0
- package/lib/commonjs/control-surface/types.js +6 -0
- package/lib/commonjs/control-surface/types.js.map +1 -0
- package/lib/commonjs/field/Field.js +71 -26
- package/lib/commonjs/field/Field.js.map +1 -1
- package/lib/commonjs/field/context.js +80 -0
- package/lib/commonjs/field/context.js.map +1 -0
- package/lib/commonjs/field/index.js +7 -0
- package/lib/commonjs/field/index.js.map +1 -1
- package/lib/commonjs/floating/TriggerSlot.js +32 -0
- package/lib/commonjs/floating/TriggerSlot.js.map +1 -1
- package/lib/commonjs/glass/GlassIsland.js +107 -0
- package/lib/commonjs/glass/GlassIsland.js.map +1 -0
- package/lib/commonjs/glass/GlassSurface.js +4 -1
- package/lib/commonjs/glass/GlassSurface.js.map +1 -1
- package/lib/commonjs/glass/index.js +7 -0
- package/lib/commonjs/glass/index.js.map +1 -1
- package/lib/commonjs/index.js +564 -517
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +564 -517
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/label/Label.js +4 -1
- package/lib/commonjs/label/Label.js.map +1 -1
- package/lib/commonjs/layout/bottom-edge.js +3 -42
- package/lib/commonjs/layout/bottom-edge.js.map +1 -1
- package/lib/commonjs/layout/edge-store.js +65 -0
- package/lib/commonjs/layout/edge-store.js.map +1 -0
- package/lib/commonjs/layout/index.js +32 -0
- package/lib/commonjs/layout/index.js.map +1 -1
- package/lib/commonjs/layout/scroll-offset.js +83 -0
- package/lib/commonjs/layout/scroll-offset.js.map +1 -0
- package/lib/commonjs/layout/top-edge.js +109 -0
- package/lib/commonjs/layout/top-edge.js.map +1 -0
- package/lib/commonjs/page-header/EdgeScrim.js +136 -0
- package/lib/commonjs/page-header/EdgeScrim.js.map +1 -0
- package/lib/commonjs/page-header/PageHeader.js +236 -61
- package/lib/commonjs/page-header/PageHeader.js.map +1 -1
- package/lib/commonjs/provider/BloomProvider.js +5 -2
- package/lib/commonjs/provider/BloomProvider.js.map +1 -1
- package/lib/commonjs/social-button/OxyMark.js +2 -2
- package/lib/commonjs/social-button/OxyMark.js.map +1 -1
- package/lib/commonjs/social-button/SocialButton.js +2 -2
- package/lib/commonjs/social-button/SocialButton.js.map +1 -1
- package/lib/commonjs/styles/svg-id.js +29 -0
- package/lib/commonjs/styles/svg-id.js.map +1 -0
- package/lib/commonjs/text-field/TextField.js +39 -6
- package/lib/commonjs/text-field/TextField.js.map +1 -1
- package/lib/commonjs/theme/glass-colors.js +81 -1
- package/lib/commonjs/theme/glass-colors.js.map +1 -1
- package/lib/module/button/Button.js +2 -0
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/button-group/ButtonGroup.js +124 -19
- package/lib/module/button-group/ButtonGroup.js.map +1 -1
- package/lib/module/control-surface/ControlSurface.js +41 -0
- package/lib/module/control-surface/ControlSurface.js.map +1 -0
- package/lib/module/control-surface/context.js +77 -0
- package/lib/module/control-surface/context.js.map +1 -0
- package/lib/module/control-surface/index.js +5 -0
- package/lib/module/control-surface/index.js.map +1 -0
- package/lib/module/control-surface/types.js +4 -0
- package/lib/module/control-surface/types.js.map +1 -0
- package/lib/module/field/Field.js +72 -27
- package/lib/module/field/Field.js.map +1 -1
- package/lib/module/field/context.js +74 -0
- package/lib/module/field/context.js.map +1 -0
- package/lib/module/field/index.js +1 -0
- package/lib/module/field/index.js.map +1 -1
- package/lib/module/floating/TriggerSlot.js +33 -1
- package/lib/module/floating/TriggerSlot.js.map +1 -1
- package/lib/module/glass/GlassIsland.js +102 -0
- package/lib/module/glass/GlassIsland.js.map +1 -0
- package/lib/module/glass/GlassSurface.js +5 -2
- package/lib/module/glass/GlassSurface.js.map +1 -1
- package/lib/module/glass/index.js +1 -0
- package/lib/module/glass/index.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +2 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/label/Label.js +4 -1
- package/lib/module/label/Label.js.map +1 -1
- package/lib/module/layout/bottom-edge.js +2 -41
- package/lib/module/layout/bottom-edge.js.map +1 -1
- package/lib/module/layout/edge-store.js +58 -0
- package/lib/module/layout/edge-store.js.map +1 -0
- package/lib/module/layout/index.js +8 -3
- package/lib/module/layout/index.js.map +1 -1
- package/lib/module/layout/scroll-offset.js +77 -0
- package/lib/module/layout/scroll-offset.js.map +1 -0
- package/lib/module/layout/top-edge.js +102 -0
- package/lib/module/layout/top-edge.js.map +1 -0
- package/lib/module/page-header/EdgeScrim.js +132 -0
- package/lib/module/page-header/EdgeScrim.js.map +1 -0
- package/lib/module/page-header/PageHeader.js +233 -58
- package/lib/module/page-header/PageHeader.js.map +1 -1
- package/lib/module/provider/BloomProvider.js +5 -2
- package/lib/module/provider/BloomProvider.js.map +1 -1
- package/lib/module/social-button/OxyMark.js +1 -1
- package/lib/module/social-button/OxyMark.js.map +1 -1
- package/lib/module/social-button/SocialButton.js +1 -1
- package/lib/module/social-button/SocialButton.js.map +1 -1
- package/lib/module/styles/svg-id.js +26 -0
- package/lib/module/styles/svg-id.js.map +1 -0
- package/lib/module/text-field/TextField.js +39 -6
- package/lib/module/text-field/TextField.js.map +1 -1
- package/lib/module/theme/glass-colors.js +79 -0
- package/lib/module/theme/glass-colors.js.map +1 -1
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -1
- package/lib/typescript/commonjs/button-group/ButtonGroup.d.ts.map +1 -1
- package/lib/typescript/commonjs/button-group/types.d.ts +61 -5
- package/lib/typescript/commonjs/button-group/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/control-surface/ControlSurface.d.ts +4 -0
- package/lib/typescript/commonjs/control-surface/ControlSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/control-surface/context.d.ts +21 -0
- package/lib/typescript/commonjs/control-surface/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/control-surface/index.d.ts +4 -0
- package/lib/typescript/commonjs/control-surface/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/control-surface/types.d.ts +37 -0
- package/lib/typescript/commonjs/control-surface/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/field/Field.d.ts +1 -1
- package/lib/typescript/commonjs/field/Field.d.ts.map +1 -1
- package/lib/typescript/commonjs/field/context.d.ts +55 -0
- package/lib/typescript/commonjs/field/context.d.ts.map +1 -0
- 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/types.d.ts +22 -3
- package/lib/typescript/commonjs/field/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/TriggerSlot.d.ts.map +1 -1
- package/lib/typescript/commonjs/glass/GlassIsland.d.ts +4 -0
- package/lib/typescript/commonjs/glass/GlassIsland.d.ts.map +1 -0
- package/lib/typescript/commonjs/glass/GlassSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/glass/index.d.ts +2 -1
- package/lib/typescript/commonjs/glass/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/glass/types.d.ts +43 -0
- package/lib/typescript/commonjs/glass/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +2 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/label/Label.d.ts.map +1 -1
- package/lib/typescript/commonjs/label/types.d.ts +7 -1
- package/lib/typescript/commonjs/label/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/layout/bottom-edge.d.ts.map +1 -1
- package/lib/typescript/commonjs/layout/edge-store.d.ts +31 -0
- package/lib/typescript/commonjs/layout/edge-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/layout/index.d.ts +8 -3
- package/lib/typescript/commonjs/layout/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/layout/scroll-offset.d.ts +16 -0
- package/lib/typescript/commonjs/layout/scroll-offset.d.ts.map +1 -0
- package/lib/typescript/commonjs/layout/top-edge.d.ts +77 -0
- package/lib/typescript/commonjs/layout/top-edge.d.ts.map +1 -0
- package/lib/typescript/commonjs/page-header/EdgeScrim.d.ts +95 -0
- package/lib/typescript/commonjs/page-header/EdgeScrim.d.ts.map +1 -0
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts +1 -1
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/index.d.ts +1 -1
- package/lib/typescript/commonjs/page-header/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/page-header/types.d.ts +97 -10
- package/lib/typescript/commonjs/page-header/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/provider/BloomProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/svg-id.d.ts +20 -0
- package/lib/typescript/commonjs/styles/svg-id.d.ts.map +1 -0
- package/lib/typescript/commonjs/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/glass-colors.d.ts +67 -0
- package/lib/typescript/commonjs/theme/glass-colors.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.d.ts.map +1 -1
- package/lib/typescript/module/button-group/ButtonGroup.d.ts.map +1 -1
- package/lib/typescript/module/button-group/types.d.ts +61 -5
- package/lib/typescript/module/button-group/types.d.ts.map +1 -1
- package/lib/typescript/module/control-surface/ControlSurface.d.ts +4 -0
- package/lib/typescript/module/control-surface/ControlSurface.d.ts.map +1 -0
- package/lib/typescript/module/control-surface/context.d.ts +21 -0
- package/lib/typescript/module/control-surface/context.d.ts.map +1 -0
- package/lib/typescript/module/control-surface/index.d.ts +4 -0
- package/lib/typescript/module/control-surface/index.d.ts.map +1 -0
- package/lib/typescript/module/control-surface/types.d.ts +37 -0
- package/lib/typescript/module/control-surface/types.d.ts.map +1 -0
- package/lib/typescript/module/field/Field.d.ts +1 -1
- package/lib/typescript/module/field/Field.d.ts.map +1 -1
- package/lib/typescript/module/field/context.d.ts +55 -0
- package/lib/typescript/module/field/context.d.ts.map +1 -0
- 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/types.d.ts +22 -3
- package/lib/typescript/module/field/types.d.ts.map +1 -1
- package/lib/typescript/module/floating/TriggerSlot.d.ts.map +1 -1
- package/lib/typescript/module/glass/GlassIsland.d.ts +4 -0
- package/lib/typescript/module/glass/GlassIsland.d.ts.map +1 -0
- package/lib/typescript/module/glass/GlassSurface.d.ts.map +1 -1
- package/lib/typescript/module/glass/index.d.ts +2 -1
- package/lib/typescript/module/glass/index.d.ts.map +1 -1
- package/lib/typescript/module/glass/types.d.ts +43 -0
- package/lib/typescript/module/glass/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +2 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/label/Label.d.ts.map +1 -1
- package/lib/typescript/module/label/types.d.ts +7 -1
- package/lib/typescript/module/label/types.d.ts.map +1 -1
- package/lib/typescript/module/layout/bottom-edge.d.ts.map +1 -1
- package/lib/typescript/module/layout/edge-store.d.ts +31 -0
- package/lib/typescript/module/layout/edge-store.d.ts.map +1 -0
- package/lib/typescript/module/layout/index.d.ts +8 -3
- package/lib/typescript/module/layout/index.d.ts.map +1 -1
- package/lib/typescript/module/layout/scroll-offset.d.ts +16 -0
- package/lib/typescript/module/layout/scroll-offset.d.ts.map +1 -0
- package/lib/typescript/module/layout/top-edge.d.ts +77 -0
- package/lib/typescript/module/layout/top-edge.d.ts.map +1 -0
- package/lib/typescript/module/page-header/EdgeScrim.d.ts +95 -0
- package/lib/typescript/module/page-header/EdgeScrim.d.ts.map +1 -0
- package/lib/typescript/module/page-header/PageHeader.d.ts +1 -1
- package/lib/typescript/module/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/module/page-header/index.d.ts +1 -1
- package/lib/typescript/module/page-header/index.d.ts.map +1 -1
- package/lib/typescript/module/page-header/types.d.ts +97 -10
- package/lib/typescript/module/page-header/types.d.ts.map +1 -1
- package/lib/typescript/module/provider/BloomProvider.d.ts.map +1 -1
- package/lib/typescript/module/styles/svg-id.d.ts +20 -0
- package/lib/typescript/module/styles/svg-id.d.ts.map +1 -0
- package/lib/typescript/module/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/module/theme/glass-colors.d.ts +67 -0
- package/lib/typescript/module/theme/glass-colors.d.ts.map +1 -1
- package/package.json +15 -1
- package/src/button/Button.tsx +10 -1
- package/src/button-group/ButtonGroup.tsx +146 -19
- package/src/button-group/types.ts +68 -5
- package/src/control-surface/ControlSurface.tsx +41 -0
- package/src/control-surface/context.ts +81 -0
- package/src/control-surface/index.ts +4 -0
- package/src/control-surface/types.ts +40 -0
- package/src/field/Field.tsx +84 -27
- package/src/field/context.ts +110 -0
- package/src/field/index.ts +3 -0
- package/src/field/types.ts +22 -3
- package/src/floating/TriggerSlot.tsx +35 -1
- package/src/glass/GlassIsland.tsx +109 -0
- package/src/glass/GlassSurface.tsx +26 -2
- package/src/glass/index.ts +3 -0
- package/src/glass/types.ts +45 -0
- package/src/index.ts +6 -0
- package/src/index.web.ts +6 -0
- package/src/label/Label.tsx +3 -1
- package/src/label/types.ts +7 -1
- package/src/layout/bottom-edge.tsx +3 -56
- package/src/layout/edge-store.ts +69 -0
- package/src/layout/index.ts +8 -3
- package/src/layout/scroll-offset.ts +76 -0
- package/src/layout/top-edge.tsx +109 -0
- package/src/page-header/EdgeScrim.tsx +118 -0
- package/src/page-header/PageHeader.tsx +253 -61
- package/src/page-header/index.ts +9 -1
- package/src/page-header/types.ts +103 -10
- package/src/provider/BloomProvider.tsx +12 -1
- package/src/social-button/OxyMark.tsx +1 -1
- package/src/social-button/SocialButton.tsx +1 -1
- package/src/styles/svg-id.ts +23 -0
- package/src/text-field/TextField.tsx +44 -5
- package/src/theme/glass-colors.ts +80 -0
- package/lib/commonjs/social-button/use-svg-id.js +0 -16
- package/lib/commonjs/social-button/use-svg-id.js.map +0 -1
- package/lib/module/social-button/use-svg-id.js +0 -13
- package/lib/module/social-button/use-svg-id.js.map +0 -1
- package/lib/typescript/commonjs/social-button/use-svg-id.d.ts +0 -7
- package/lib/typescript/commonjs/social-button/use-svg-id.d.ts.map +0 -1
- package/lib/typescript/module/social-button/use-svg-id.d.ts +0 -7
- package/lib/typescript/module/social-button/use-svg-id.d.ts.map +0 -1
- package/src/social-button/use-svg-id.ts +0 -10
|
@@ -13,6 +13,7 @@ import { useReducedMotion } from 'react-native-reanimated';
|
|
|
13
13
|
|
|
14
14
|
import { useTheme } from '../theme/use-theme';
|
|
15
15
|
import { useInteractionState } from '../hooks/use-interaction-state';
|
|
16
|
+
import { useFieldControl } from '../field/context';
|
|
16
17
|
import { mergeRefs } from '../hooks/merge-refs';
|
|
17
18
|
import {
|
|
18
19
|
atoms as a,
|
|
@@ -338,7 +339,15 @@ export function TextFieldInput({
|
|
|
338
339
|
// Read directly rather than through `useTextFieldContext`: a missing root is
|
|
339
340
|
// not an error here, it is the branch below.
|
|
340
341
|
const ctx = useContext(Context);
|
|
341
|
-
|
|
342
|
+
// The enclosing `Field`, when there is one. This is the input's half of the
|
|
343
|
+
// association contract (`field/context.ts`): the field owns the id the label
|
|
344
|
+
// points at, which hint is currently described, the invalid state and the
|
|
345
|
+
// disabled state, and the input applies them. `disabled` combines with `||`
|
|
346
|
+
// because it is a constraint — a field that is off cannot be turned back on
|
|
347
|
+
// from inside it — while the id and the name DEFER to the field, so the
|
|
348
|
+
// visible label and the announced name cannot disagree.
|
|
349
|
+
const field = useFieldControl();
|
|
350
|
+
const inputDisabled = disabled === true || rest.editable === false || field?.disabled === true;
|
|
342
351
|
const setInputDisabled = ctx?.setInputDisabled;
|
|
343
352
|
|
|
344
353
|
// Report up, so the icon and suffix beside the input dim with it.
|
|
@@ -349,8 +358,16 @@ export function TextFieldInput({
|
|
|
349
358
|
}, [setInputDisabled, inputDisabled]);
|
|
350
359
|
|
|
351
360
|
if (ctx === null) {
|
|
361
|
+
// A standalone input wraps ITSELF in a field shell. The shell has to carry
|
|
362
|
+
// the enclosing `Field`'s invalid and disabled state too, or the chrome
|
|
363
|
+
// paints as if nothing were wrong while the input inside it is inert — the
|
|
364
|
+
// one arrangement where the two halves of the control disagree.
|
|
352
365
|
return (
|
|
353
|
-
<TextField
|
|
366
|
+
<TextField
|
|
367
|
+
isInvalid={isInvalid || field?.invalid === true}
|
|
368
|
+
disabled={disabled || field?.disabled === true}
|
|
369
|
+
size={size}
|
|
370
|
+
>
|
|
354
371
|
<TextFieldInput
|
|
355
372
|
label={label}
|
|
356
373
|
placeholder={placeholder}
|
|
@@ -375,7 +392,7 @@ export function TextFieldInput({
|
|
|
375
392
|
),
|
|
376
393
|
);
|
|
377
394
|
|
|
378
|
-
const invalid = ctx.isInvalid || isInvalid === true;
|
|
395
|
+
const invalid = ctx.isInvalid || isInvalid === true || field?.invalid === true;
|
|
379
396
|
const fieldDisabled = ctx.disabled || inputDisabled;
|
|
380
397
|
const state = {
|
|
381
398
|
hovered: ctx.hovered,
|
|
@@ -392,12 +409,32 @@ export function TextFieldInput({
|
|
|
392
409
|
'aria-disabled': fieldDisabled || undefined,
|
|
393
410
|
'aria-invalid': invalid || undefined,
|
|
394
411
|
};
|
|
412
|
+
// The enclosing `Field`'s wiring. `rest` is spread BEFORE these, so an
|
|
413
|
+
// explicit `nativeID` or `aria-describedby` on the input still wins — an app
|
|
414
|
+
// that already wired its own association keeps it.
|
|
415
|
+
const fieldProps = field
|
|
416
|
+
? {
|
|
417
|
+
nativeID: rest.nativeID ?? field.controlId,
|
|
418
|
+
'aria-describedby': (rest as Record<string, unknown>)['aria-describedby'] ?? field.describedBy,
|
|
419
|
+
'aria-required': field.required || undefined,
|
|
420
|
+
}
|
|
421
|
+
: undefined;
|
|
422
|
+
// On web the `<label for>` already names the input, but `aria-label` would
|
|
423
|
+
// OVERRIDE it — so when the field has a text label the two must be the same
|
|
424
|
+
// string rather than two spellings of it. On native there is no association
|
|
425
|
+
// at all and this prop is the only name the control has.
|
|
426
|
+
const accessibleName = field?.labelText ?? label;
|
|
395
427
|
const webDisabled = IS_WEB && fieldDisabled ? ({ disabled: true } as Record<string, unknown>) : undefined;
|
|
396
428
|
|
|
397
429
|
if (floatingLabel) {
|
|
430
|
+
// The ids and the described-by still travel, so the error is announced —
|
|
431
|
+
// but a floating label inside a `Field` that also draws a label shows the
|
|
432
|
+
// same words twice, once above the box and once inside it. They are
|
|
433
|
+
// alternatives, not layers: use one or the other. `docs/field.mdx` says so
|
|
434
|
+
// where a caller will read it.
|
|
398
435
|
return (
|
|
399
436
|
<FloatingLabelInput
|
|
400
|
-
label={
|
|
437
|
+
label={accessibleName}
|
|
401
438
|
value={value}
|
|
402
439
|
onChangeText={onChangeText}
|
|
403
440
|
onFocus={onFocus}
|
|
@@ -406,6 +443,7 @@ export function TextFieldInput({
|
|
|
406
443
|
refs={refs}
|
|
407
444
|
style={style}
|
|
408
445
|
{...rest}
|
|
446
|
+
{...fieldProps}
|
|
409
447
|
{...disabledProps}
|
|
410
448
|
{...webDisabled}
|
|
411
449
|
/>
|
|
@@ -462,9 +500,10 @@ export function TextFieldInput({
|
|
|
462
500
|
accessibilityHint={undefined}
|
|
463
501
|
hitSlop={{ top: 20, bottom: 20, left: 20, right: 20 }}
|
|
464
502
|
{...rest}
|
|
503
|
+
{...fieldProps}
|
|
465
504
|
{...disabledProps}
|
|
466
505
|
{...webDisabled}
|
|
467
|
-
accessibilityLabel={
|
|
506
|
+
accessibilityLabel={accessibleName}
|
|
468
507
|
ref={refs}
|
|
469
508
|
value={value}
|
|
470
509
|
onChangeText={onChangeText}
|
|
@@ -271,3 +271,83 @@ export function resolveGlassColors(fill: string): GlassColors {
|
|
|
271
271
|
hairlineWidth: BORDER_WIDTH.hairline,
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* The CHROME alpha — the neutral counterpart of {@link GLASS_FILL_ALPHA}.
|
|
277
|
+
*
|
|
278
|
+
* ── WHY A SECOND ALPHA AND NOT THE SAME ONE ─────────────────────────────────
|
|
279
|
+
*
|
|
280
|
+
* {@link GLASS_FILL_ALPHA} prices a BRAND fill: a `primary` button whose label
|
|
281
|
+
* is that fill's own on-colour, sitting on one of Bloom's five neutral
|
|
282
|
+
* surfaces. A page header's island is neither of those things. It is a NEUTRAL
|
|
283
|
+
* surface off the existing ladder (`styles/surface-levels`, rung 1 — the same
|
|
284
|
+
* fill a card and a menu panel paint) and it floats over content Bloom does not
|
|
285
|
+
* own: a photograph, a video still, a map, a list that scrolls under it. Its
|
|
286
|
+
* label is the theme's own `text`, not an on-fill token.
|
|
287
|
+
*
|
|
288
|
+
* So the two materials are priced against different backdrops, and the number
|
|
289
|
+
* that is right for one is wrong for the other in a measurable direction:
|
|
290
|
+
*
|
|
291
|
+
* brand fill backdrop ∈ Bloom's own five surfaces worst case: light mode,
|
|
292
|
+
* a white-ish page LIFTS
|
|
293
|
+
* the pane under a white
|
|
294
|
+
* label
|
|
295
|
+
* chrome fill backdrop ∈ [black, white] — anything worst case: DARK mode
|
|
296
|
+
* over a WHITE backdrop,
|
|
297
|
+
* which lifts a dark pane
|
|
298
|
+
* under a white label
|
|
299
|
+
*
|
|
300
|
+
* That is why dark carries the HIGHER alpha here and light the lower one, which
|
|
301
|
+
* is the opposite of the intuition that a dark UI can afford more transparency.
|
|
302
|
+
* A dark island has the whole luminance range above it to be washed out INTO; a
|
|
303
|
+
* light island over the same white backdrop barely moves, because it is already
|
|
304
|
+
* near white.
|
|
305
|
+
*
|
|
306
|
+
* ── WHAT THESE TWO VALUES BUY ───────────────────────────────────────────────
|
|
307
|
+
*
|
|
308
|
+
* Measured over 64 presets x the two extremes of the backdrop range, with the
|
|
309
|
+
* theme's own `text` as the label, in `theme/__tests__/glass-colors.test.ts`.
|
|
310
|
+
* The gate pins the floors EXACTLY, in both directions, so a hundredth in
|
|
311
|
+
* either direction has to be a decision:
|
|
312
|
+
*
|
|
313
|
+
* light 0.72 worst AA ratio over the range …pinned by the gate
|
|
314
|
+
* dark 0.80 worst AA ratio over the range …pinned by the gate
|
|
315
|
+
*
|
|
316
|
+
* and both remain genuinely translucent: the gate also measures how far the
|
|
317
|
+
* PAINTED pane moves between a black and a white backdrop, asserts that
|
|
318
|
+
* movement is non-zero, and asserts it is monotonic in the alpha — so an alpha
|
|
319
|
+
* quietly raised to 1.0 to buy contrast fails on the translucency side rather
|
|
320
|
+
* than passing on the legibility side.
|
|
321
|
+
*/
|
|
322
|
+
export const GLASS_CHROME_ALPHA = { light: 0.72, dark: 0.8 } as const;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Resolve the pane around a NEUTRAL chrome fill — an island of controls
|
|
326
|
+
* floating over content.
|
|
327
|
+
*
|
|
328
|
+
* Both arguments are resolved colour strings the caller already holds, for the
|
|
329
|
+
* same reason {@link resolveGlassColors} takes one: the caller is the only one
|
|
330
|
+
* who knows which rung of the surface ladder its container sits on. In practice
|
|
331
|
+
* that is `resolveSurfaceLevel(theme, 1)` — `.background` for `fill`, `.border`
|
|
332
|
+
* for `hairline` — which is the fill a card and a menu panel already paint, so
|
|
333
|
+
* an island reads as Bloom chrome rather than as a fourth material.
|
|
334
|
+
*
|
|
335
|
+
* The LABEL is not returned, exactly as in `resolveGlassColors`: a neutral pane
|
|
336
|
+
* carries the theme's own `text`, and the rungs under it come from
|
|
337
|
+
* `surfaceTextOn(theme, fill)` — the caller is already holding both.
|
|
338
|
+
*/
|
|
339
|
+
export function resolveChromeGlassColors(
|
|
340
|
+
fill: string,
|
|
341
|
+
hairline: string,
|
|
342
|
+
isDark: boolean,
|
|
343
|
+
): GlassColors {
|
|
344
|
+
return {
|
|
345
|
+
fill: withAlpha(fill, GLASS_CHROME_ALPHA[isDark ? 'dark' : 'light']),
|
|
346
|
+
// The hairline keeps a little more body than the pane it edges: it is the
|
|
347
|
+
// lip of the island, and a hairline that dissolves at the same rate as the
|
|
348
|
+
// fill stops reading as an edge at exactly the moment the fill stops
|
|
349
|
+
// reading as a surface.
|
|
350
|
+
hairline: withAlpha(hairline, Math.min(1, GLASS_CHROME_ALPHA[isDark ? 'dark' : 'light'] + 0.12)),
|
|
351
|
+
hairlineWidth: BORDER_WIDTH.hairline,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useSvgIdPrefix = useSvgIdPrefix;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
/**
|
|
9
|
-
* A DOM-safe id prefix, per component instance. Two marks of one brand on a
|
|
10
|
-
* page must not resolve each other's `url(#…)`, and React's `useId` carries
|
|
11
|
-
* characters an SVG id cannot.
|
|
12
|
-
*/
|
|
13
|
-
function useSvgIdPrefix(prefix) {
|
|
14
|
-
return `${prefix}-${(0, _react.useId)().replace(/[^a-zA-Z0-9]/g, '')}-`;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=use-svg-id.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useSvgIdPrefix","prefix","useId","replace"],"sourceRoot":"../../../src","sources":["social-button/use-svg-id.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,MAAc,EAAU;EACrD,OAAO,GAAGA,MAAM,IAAI,IAAAC,YAAK,EAAC,CAAC,CAACC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,GAAG;AAC7D","ignoreList":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useId } from 'react';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A DOM-safe id prefix, per component instance. Two marks of one brand on a
|
|
7
|
-
* page must not resolve each other's `url(#…)`, and React's `useId` carries
|
|
8
|
-
* characters an SVG id cannot.
|
|
9
|
-
*/
|
|
10
|
-
export function useSvgIdPrefix(prefix) {
|
|
11
|
-
return `${prefix}-${useId().replace(/[^a-zA-Z0-9]/g, '')}-`;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=use-svg-id.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useId","useSvgIdPrefix","prefix","replace"],"sourceRoot":"../../../src","sources":["social-button/use-svg-id.ts"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,OAAO;;AAE7B;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,MAAc,EAAU;EACrD,OAAO,GAAGA,MAAM,IAAIF,KAAK,CAAC,CAAC,CAACG,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,GAAG;AAC7D","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A DOM-safe id prefix, per component instance. Two marks of one brand on a
|
|
3
|
-
* page must not resolve each other's `url(#…)`, and React's `useId` carries
|
|
4
|
-
* characters an SVG id cannot.
|
|
5
|
-
*/
|
|
6
|
-
export declare function useSvgIdPrefix(prefix: string): string;
|
|
7
|
-
//# sourceMappingURL=use-svg-id.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-svg-id.d.ts","sourceRoot":"","sources":["../../../../src/social-button/use-svg-id.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A DOM-safe id prefix, per component instance. Two marks of one brand on a
|
|
3
|
-
* page must not resolve each other's `url(#…)`, and React's `useId` carries
|
|
4
|
-
* characters an SVG id cannot.
|
|
5
|
-
*/
|
|
6
|
-
export declare function useSvgIdPrefix(prefix: string): string;
|
|
7
|
-
//# sourceMappingURL=use-svg-id.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-svg-id.d.ts","sourceRoot":"","sources":["../../../../src/social-button/use-svg-id.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useId } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A DOM-safe id prefix, per component instance. Two marks of one brand on a
|
|
5
|
-
* page must not resolve each other's `url(#…)`, and React's `useId` carries
|
|
6
|
-
* characters an SVG id cannot.
|
|
7
|
-
*/
|
|
8
|
-
export function useSvgIdPrefix(prefix: string): string {
|
|
9
|
-
return `${prefix}-${useId().replace(/[^a-zA-Z0-9]/g, '')}-`;
|
|
10
|
-
}
|