@oxy.so/bloom 7.12.0 → 7.13.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/docs/bottom-sheet.mdx +7 -0
- package/docs/carousel.mdx +13 -0
- package/docs/dialog.mdx +10 -0
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +13 -1
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/carousel/Carousel.js +32 -4
- package/lib/commonjs/carousel/Carousel.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +6 -3
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +13 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/carousel/Carousel.js +32 -4
- package/lib/module/carousel/Carousel.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +7 -4
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts +5 -0
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/carousel/Carousel.d.ts +1 -1
- package/lib/typescript/commonjs/carousel/Carousel.d.ts.map +1 -1
- package/lib/typescript/commonjs/carousel/types.d.ts +6 -0
- package/lib/typescript/commonjs/carousel/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/types.d.ts +5 -0
- package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/module/carousel/Carousel.d.ts +1 -1
- package/lib/typescript/module/carousel/Carousel.d.ts.map +1 -1
- package/lib/typescript/module/carousel/types.d.ts +6 -0
- package/lib/typescript/module/carousel/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bottom-sheet/BottomSheetBase.tsx +11 -0
- package/src/bottom-sheet/types.ts +5 -0
- package/src/carousel/Carousel.tsx +25 -5
- package/src/carousel/types.ts +6 -0
- package/src/dialog/DialogBottomSheet.tsx +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogBottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/dialog/DialogBottomSheet.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DialogBottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/dialog/DialogBottomSheet.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAsB,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,IAAI,EAAE,cAAc,EACpB,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,OAAO,EACP,MAAM,EACN,cAAyC,EACzC,UAAiB,EACjB,iBAAwB,EACxB,cAA+C,EAC/C,UAAU,EACV,KAAK,EACL,KAAK,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,QAAQ,GACT,EAAE,sBAAsB,2CAkRxB;AAqBD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,WAAW,EACT,SAAS,GACT,MAAM,GACN,WAAW,GACX,SAAS,GACT,QAAQ,GACR,OAAO,GACP,aAAa,GACb,SAAS,GACT,QAAQ,GACR,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,gBAAgB,GAChB,YAAY,GACZ,OAAO,GACP,OAAO,GACP,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,OAAO,GACP,UAAU,CACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -46,6 +46,9 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
46
46
|
const {
|
|
47
47
|
Shell,
|
|
48
48
|
children,
|
|
49
|
+
accessibilityLabel,
|
|
50
|
+
'aria-labelledby': labelledBy,
|
|
51
|
+
'aria-describedby': describedBy,
|
|
49
52
|
open,
|
|
50
53
|
onDismiss,
|
|
51
54
|
enablePanDownToClose = true,
|
|
@@ -722,6 +725,14 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
722
725
|
<GestureDetector gesture={panGesture}>
|
|
723
726
|
<Animated.View
|
|
724
727
|
ref={sheetRef}
|
|
728
|
+
// The semantic modal and keyboard boundary must include
|
|
729
|
+
// the sticky header as well as the scrolling body.
|
|
730
|
+
role={Platform.OS === 'web' ? 'dialog' : undefined}
|
|
731
|
+
aria-modal={Platform.OS === 'web' ? true : undefined}
|
|
732
|
+
aria-label={Platform.OS === 'web' ? accessibilityLabel : undefined}
|
|
733
|
+
aria-labelledby={Platform.OS === 'web' ? labelledBy : undefined}
|
|
734
|
+
aria-describedby={Platform.OS === 'web' ? describedBy : undefined}
|
|
735
|
+
tabIndex={Platform.OS === 'web' ? -1 : undefined}
|
|
725
736
|
onLayout={onLayout}
|
|
726
737
|
style={[
|
|
727
738
|
dynamicStyles.sheet,
|
|
@@ -13,6 +13,11 @@ export interface BottomSheetRef {
|
|
|
13
13
|
|
|
14
14
|
export interface BottomSheetProps {
|
|
15
15
|
children: React.ReactNode;
|
|
16
|
+
/** Accessible name for the modal sheet panel on web. */
|
|
17
|
+
accessibilityLabel?: string;
|
|
18
|
+
/** IDs of the elements naming/describing the modal sheet panel on web. */
|
|
19
|
+
'aria-labelledby'?: string;
|
|
20
|
+
'aria-describedby'?: string;
|
|
16
21
|
/**
|
|
17
22
|
* Controlled open state. When provided, the sheet mounts already-open if
|
|
18
23
|
* `true` (seeding its internal visible/rendered state) instead of relying on
|
|
@@ -104,10 +104,22 @@ export function resolveCarouselPaint(theme: Theme): CarouselPaint {
|
|
|
104
104
|
// ---------------------------------------------------------------------------
|
|
105
105
|
|
|
106
106
|
const STYLE_ID = 'bloom-carousel-web-css';
|
|
107
|
+
const ROOT = '[data-bloom-carousel]';
|
|
108
|
+
const HOVER_ROOT = '[data-bloom-carousel="hover"]';
|
|
109
|
+
const ARROW = '[data-bloom-carousel-arrow]';
|
|
107
110
|
const TRACK = '[data-bloom-carousel-track]';
|
|
108
111
|
const DOT = '[data-bloom-carousel-dot]';
|
|
109
112
|
|
|
110
113
|
const BLOOM_CAROUSEL_CSS = `
|
|
114
|
+
${ROOT} { --bloom-carousel-arrow-opacity: 1; }
|
|
115
|
+
${ARROW} {
|
|
116
|
+
opacity: var(--bloom-carousel-arrow-opacity, 1);
|
|
117
|
+
transition: opacity 150ms ease-out;
|
|
118
|
+
}
|
|
119
|
+
@media (hover: hover) and (pointer: fine) {
|
|
120
|
+
${HOVER_ROOT} { --bloom-carousel-arrow-opacity: 0; }
|
|
121
|
+
${HOVER_ROOT}:hover, ${HOVER_ROOT}:focus-within { --bloom-carousel-arrow-opacity: 1; }
|
|
122
|
+
}
|
|
111
123
|
${TRACK} {
|
|
112
124
|
scroll-snap-type: x mandatory;
|
|
113
125
|
scroll-padding-inline: var(--bloom-carousel-inset, 0px);
|
|
@@ -138,7 +150,7 @@ ${DOT}:focus-visible {
|
|
|
138
150
|
outline-offset: 2px;
|
|
139
151
|
}
|
|
140
152
|
@media (prefers-reduced-motion: reduce) {
|
|
141
|
-
${DOT} {
|
|
153
|
+
${DOT}, ${ARROW} {
|
|
142
154
|
transition: none;
|
|
143
155
|
}
|
|
144
156
|
}
|
|
@@ -317,6 +329,7 @@ const CarouselComponent = function Carousel({
|
|
|
317
329
|
header,
|
|
318
330
|
showArrows = true,
|
|
319
331
|
arrowsPlacement = 'header',
|
|
332
|
+
arrowsVisibility = 'always',
|
|
320
333
|
showDots = true,
|
|
321
334
|
align = 'start',
|
|
322
335
|
gap = 16,
|
|
@@ -619,13 +632,19 @@ const CarouselComponent = function Carousel({
|
|
|
619
632
|
|
|
620
633
|
const overlay = arrowsPlacement === 'overlay';
|
|
621
634
|
const arrowsVisible = showArrows && count > 0;
|
|
635
|
+
// Only the opt-in web presentation needs a fade wrapper. It never removes
|
|
636
|
+
// the button from the tab order or changes native controls. Each root owns
|
|
637
|
+
// the inherited opacity, so nested carousels reveal independently.
|
|
638
|
+
const arrow = (button: React.ReactElement) => IS_WEB && arrowsVisibility === 'hover'
|
|
639
|
+
? <View {...webDataSet({ bloomCarouselArrow: '' })} style={{ flexShrink: 0 }}>{button}</View>
|
|
640
|
+
: button;
|
|
622
641
|
const arrowButtons = <>
|
|
623
|
-
<Button size={overlay ? 'lg' : 'sm'} icon={rtl ? RiArrowRightSLine : RiArrowLeftSLine}
|
|
642
|
+
{arrow(<Button size={overlay ? 'lg' : 'sm'} icon={rtl ? RiArrowRightSLine : RiArrowLeftSLine}
|
|
624
643
|
accessibilityLabel={previousLabel} disabled={atStart} onPress={() => step(-1)}
|
|
625
|
-
appearance="subtle" tone="neutral" />
|
|
626
|
-
<Button size={overlay ? 'lg' : 'sm'} icon={rtl ? RiArrowLeftSLine : RiArrowRightSLine}
|
|
644
|
+
appearance="subtle" tone="neutral" />)}
|
|
645
|
+
{arrow(<Button size={overlay ? 'lg' : 'sm'} icon={rtl ? RiArrowLeftSLine : RiArrowRightSLine}
|
|
627
646
|
accessibilityLabel={nextLabel} disabled={atEnd} onPress={() => step(1)}
|
|
628
|
-
appearance="subtle" tone="neutral" />
|
|
647
|
+
appearance="subtle" tone="neutral" />)}
|
|
629
648
|
</>;
|
|
630
649
|
// iOS snapping reads physical offsets even though its imperative command and
|
|
631
650
|
// scroll events use logical offsets. Android converts snap offsets internally.
|
|
@@ -667,6 +686,7 @@ const CarouselComponent = function Carousel({
|
|
|
667
686
|
return (
|
|
668
687
|
<View
|
|
669
688
|
role="group"
|
|
689
|
+
{...webDataSet({ bloomCarousel: arrowsVisibility })}
|
|
670
690
|
{...directionProps}
|
|
671
691
|
{...(IS_WEB ? { 'aria-roledescription': messages.carouselRole } : {})}
|
|
672
692
|
accessibilityLabel={accessibilityLabel}
|
package/src/carousel/types.ts
CHANGED
|
@@ -19,6 +19,12 @@ export interface CarouselProps {
|
|
|
19
19
|
showArrows?: boolean;
|
|
20
20
|
/** Arrows share the header row or overlay the track's edges. Defaults to `'header'`. */
|
|
21
21
|
arrowsPlacement?: 'header' | 'overlay';
|
|
22
|
+
/**
|
|
23
|
+
* Defaults to 'always'. 'hover' reveals arrows on hover or focus within the
|
|
24
|
+
* carousel on web with a fine, hover-capable pointer. Touch and native keep
|
|
25
|
+
* them visible. showArrows still controls whether they are rendered.
|
|
26
|
+
*/
|
|
27
|
+
arrowsVisibility?: 'always' | 'hover';
|
|
22
28
|
/** Position indicator below the track. Defaults to `true`. */
|
|
23
29
|
showDots?: boolean;
|
|
24
30
|
/** Where a slide comes to rest when it snaps. Defaults to `'start'`. */
|
|
@@ -9,6 +9,7 @@ import React, {
|
|
|
9
9
|
useRef,
|
|
10
10
|
} from 'react';
|
|
11
11
|
import {
|
|
12
|
+
Platform,
|
|
12
13
|
useWindowDimensions,
|
|
13
14
|
View,
|
|
14
15
|
type StyleProp,
|
|
@@ -253,6 +254,9 @@ export function DialogBottomSheet({
|
|
|
253
254
|
|
|
254
255
|
return (
|
|
255
256
|
<BottomSheet
|
|
257
|
+
accessibilityLabel={label ?? header?.title}
|
|
258
|
+
aria-labelledby={!header && title ? titleId : undefined}
|
|
259
|
+
aria-describedby={!header && description ? descriptionId : undefined}
|
|
256
260
|
ref={ref}
|
|
257
261
|
// Seed the sheet's open state so a fresh mount that should be open renders
|
|
258
262
|
// visible on its FIRST commit instead of relying on a present()-in-effect
|
|
@@ -305,9 +309,9 @@ export function DialogBottomSheet({
|
|
|
305
309
|
<Context.Provider value={context}>
|
|
306
310
|
<StyledView
|
|
307
311
|
testID={testID}
|
|
308
|
-
accessibilityLabel={label}
|
|
309
|
-
aria-labelledby={title ? titleId : undefined}
|
|
310
|
-
aria-describedby={description ? descriptionId : undefined}
|
|
312
|
+
accessibilityLabel={Platform.OS === 'web' ? undefined : label}
|
|
313
|
+
aria-labelledby={Platform.OS === 'web' ? undefined : title ? titleId : undefined}
|
|
314
|
+
aria-describedby={Platform.OS === 'web' ? undefined : description ? descriptionId : undefined}
|
|
311
315
|
// Bottom placement renders ONE node for both, so the two classes are
|
|
312
316
|
// joined rather than spread twice — the second spread used to
|
|
313
317
|
// overwrite the first, so `containerClassName` was silently dropped on
|