@oxy.so/bloom 7.20.0 → 7.22.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/accordion.mdx +5 -0
- package/docs/adoption-matrix.mdx +9 -8
- package/docs/bottom-sheet.mdx +15 -0
- package/docs/collapsible.mdx +72 -0
- package/docs/dialog.mdx +49 -0
- package/docs/migrating-to-1.0.mdx +1 -1
- package/docs/overlay.mdx +18 -0
- package/docs/radio.mdx +15 -0
- package/lib/commonjs/accordion/Accordion.js +18 -45
- package/lib/commonjs/accordion/Accordion.js.map +1 -1
- package/lib/commonjs/accordion/Accordion.web.js +16 -53
- package/lib/commonjs/accordion/Accordion.web.js.map +1 -1
- package/lib/commonjs/accordion/use-accordion.js +3 -30
- package/lib/commonjs/accordion/use-accordion.js.map +1 -1
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +27 -10
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/collapsible/Collapsible.js +22 -0
- package/lib/commonjs/collapsible/Collapsible.js.map +1 -0
- package/lib/commonjs/collapsible/Collapsible.web.js +22 -0
- package/lib/commonjs/collapsible/Collapsible.web.js.map +1 -0
- package/lib/commonjs/collapsible/CollapsibleFrame.js +97 -0
- package/lib/commonjs/collapsible/CollapsibleFrame.js.map +1 -0
- package/lib/commonjs/collapsible/CollapsibleFrame.web.js +116 -0
- package/lib/commonjs/collapsible/CollapsibleFrame.web.js.map +1 -0
- package/lib/commonjs/collapsible/context.js +15 -0
- package/lib/commonjs/collapsible/context.js.map +1 -0
- package/lib/commonjs/collapsible/frame-types.js +6 -0
- package/lib/commonjs/collapsible/frame-types.js.map +1 -0
- package/lib/commonjs/collapsible/index.js +13 -0
- package/lib/commonjs/collapsible/index.js.map +1 -0
- package/lib/commonjs/collapsible/index.web.js +13 -0
- package/lib/commonjs/collapsible/index.web.js.map +1 -0
- package/lib/commonjs/collapsible/types.js +6 -0
- package/lib/commonjs/collapsible/types.js.map +1 -0
- package/lib/commonjs/collapsible/use-collapsible-motion.js +60 -0
- package/lib/commonjs/collapsible/use-collapsible-motion.js.map +1 -0
- package/lib/commonjs/dialog/Dialog.js +16 -5
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +32 -15
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +4 -0
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +12 -0
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/motion/surface-transition.js +18 -0
- package/lib/commonjs/motion/surface-transition.js.map +1 -0
- package/lib/commonjs/motion/use-surface-transition.js +24 -0
- package/lib/commonjs/motion/use-surface-transition.js.map +1 -0
- package/lib/commonjs/overlay/Overlay.js +11 -11
- package/lib/commonjs/overlay/Overlay.js.map +1 -1
- package/lib/commonjs/overlay/backdrop-paint.js +34 -0
- package/lib/commonjs/overlay/backdrop-paint.js.map +1 -0
- package/lib/commonjs/radio/Radio.js +54 -26
- package/lib/commonjs/radio/Radio.js.map +1 -1
- package/lib/commonjs/radio/RadioCard.js +8 -1
- package/lib/commonjs/radio/RadioCard.js.map +1 -1
- package/lib/commonjs/radio/use-radio-group-item.js +3 -1
- package/lib/commonjs/radio/use-radio-group-item.js.map +1 -1
- package/lib/commonjs/select/Select.js +10 -5
- package/lib/commonjs/select/Select.js.map +1 -1
- package/lib/commonjs/select/Select.web.js +11 -3
- package/lib/commonjs/select/Select.web.js.map +1 -1
- package/lib/module/accordion/Accordion.js +19 -46
- package/lib/module/accordion/Accordion.js.map +1 -1
- package/lib/module/accordion/Accordion.web.js +17 -54
- package/lib/module/accordion/Accordion.web.js.map +1 -1
- package/lib/module/accordion/use-accordion.js +4 -31
- package/lib/module/accordion/use-accordion.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +27 -10
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/collapsible/Collapsible.js +17 -0
- package/lib/module/collapsible/Collapsible.js.map +1 -0
- package/lib/module/collapsible/Collapsible.web.js +17 -0
- package/lib/module/collapsible/Collapsible.web.js.map +1 -0
- package/lib/module/collapsible/CollapsibleFrame.js +92 -0
- package/lib/module/collapsible/CollapsibleFrame.js.map +1 -0
- package/lib/module/collapsible/CollapsibleFrame.web.js +111 -0
- package/lib/module/collapsible/CollapsibleFrame.web.js.map +1 -0
- package/lib/module/collapsible/context.js +11 -0
- package/lib/module/collapsible/context.js.map +1 -0
- package/lib/module/collapsible/frame-types.js +4 -0
- package/lib/module/collapsible/frame-types.js.map +1 -0
- package/lib/module/collapsible/index.js +4 -0
- package/lib/module/collapsible/index.js.map +1 -0
- package/lib/module/collapsible/index.web.js +9 -0
- package/lib/module/collapsible/index.web.js.map +1 -0
- package/lib/module/collapsible/types.js +4 -0
- package/lib/module/collapsible/types.js.map +1 -0
- package/lib/module/collapsible/use-collapsible-motion.js +55 -0
- package/lib/module/collapsible/use-collapsible-motion.js.map +1 -0
- package/lib/module/dialog/Dialog.js +16 -5
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +32 -15
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +4 -0
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/motion/surface-transition.js +14 -0
- package/lib/module/motion/surface-transition.js.map +1 -0
- package/lib/module/motion/use-surface-transition.js +20 -0
- package/lib/module/motion/use-surface-transition.js.map +1 -0
- package/lib/module/overlay/Overlay.js +11 -11
- package/lib/module/overlay/Overlay.js.map +1 -1
- package/lib/module/overlay/backdrop-paint.js +29 -0
- package/lib/module/overlay/backdrop-paint.js.map +1 -0
- package/lib/module/radio/Radio.js +54 -26
- package/lib/module/radio/Radio.js.map +1 -1
- package/lib/module/radio/RadioCard.js +8 -1
- package/lib/module/radio/RadioCard.js.map +1 -1
- package/lib/module/radio/use-radio-group-item.js +3 -1
- package/lib/module/radio/use-radio-group-item.js.map +1 -1
- package/lib/module/select/Select.js +7 -2
- package/lib/module/select/Select.js.map +1 -1
- package/lib/module/select/Select.web.js +11 -3
- package/lib/module/select/Select.web.js.map +1 -1
- package/lib/typescript/commonjs/accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/commonjs/accordion/Accordion.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/accordion/use-accordion.d.ts +2 -3
- package/lib/typescript/commonjs/accordion/use-accordion.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts +6 -0
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/collapsible/Collapsible.d.ts +4 -0
- package/lib/typescript/commonjs/collapsible/Collapsible.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/Collapsible.web.d.ts +4 -0
- package/lib/typescript/commonjs/collapsible/Collapsible.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/CollapsibleFrame.d.ts +7 -0
- package/lib/typescript/commonjs/collapsible/CollapsibleFrame.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/CollapsibleFrame.web.d.ts +3 -0
- package/lib/typescript/commonjs/collapsible/CollapsibleFrame.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/context.d.ts +4 -0
- package/lib/typescript/commonjs/collapsible/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/frame-types.d.ts +11 -0
- package/lib/typescript/commonjs/collapsible/frame-types.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/index.d.ts +3 -0
- package/lib/typescript/commonjs/collapsible/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/index.web.d.ts +3 -0
- package/lib/typescript/commonjs/collapsible/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/types.d.ts +24 -0
- package/lib/typescript/commonjs/collapsible/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/use-collapsible-motion.d.ts +9 -0
- package/lib/typescript/commonjs/collapsible/use-collapsible-motion.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +6 -0
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/index.d.ts +1 -1
- package/lib/typescript/commonjs/motion/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/index.web.d.ts +1 -1
- package/lib/typescript/commonjs/motion/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/surface-transition.d.ts +8 -0
- package/lib/typescript/commonjs/motion/surface-transition.d.ts.map +1 -0
- package/lib/typescript/commonjs/motion/types.d.ts +7 -0
- package/lib/typescript/commonjs/motion/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/use-surface-transition.d.ts +9 -0
- package/lib/typescript/commonjs/motion/use-surface-transition.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/Overlay.d.ts.map +1 -1
- package/lib/typescript/commonjs/overlay/backdrop-paint.d.ts +7 -0
- package/lib/typescript/commonjs/overlay/backdrop-paint.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/index.d.ts +1 -1
- package/lib/typescript/commonjs/overlay/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/overlay/types.d.ts +23 -9
- package/lib/typescript/commonjs/overlay/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/RadioCard.d.ts +1 -1
- package/lib/typescript/commonjs/radio/RadioCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/index.d.ts +1 -1
- package/lib/typescript/commonjs/radio/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/types.d.ts +16 -2
- package/lib/typescript/commonjs/radio/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/use-radio-group-item.d.ts +17 -1
- package/lib/typescript/commonjs/radio/use-radio-group-item.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/module/accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/module/accordion/Accordion.web.d.ts.map +1 -1
- package/lib/typescript/module/accordion/use-accordion.d.ts +2 -3
- package/lib/typescript/module/accordion/use-accordion.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 +6 -0
- package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/module/collapsible/Collapsible.d.ts +4 -0
- package/lib/typescript/module/collapsible/Collapsible.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/Collapsible.web.d.ts +4 -0
- package/lib/typescript/module/collapsible/Collapsible.web.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/CollapsibleFrame.d.ts +7 -0
- package/lib/typescript/module/collapsible/CollapsibleFrame.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/CollapsibleFrame.web.d.ts +3 -0
- package/lib/typescript/module/collapsible/CollapsibleFrame.web.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/context.d.ts +4 -0
- package/lib/typescript/module/collapsible/context.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/frame-types.d.ts +11 -0
- package/lib/typescript/module/collapsible/frame-types.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/index.d.ts +3 -0
- package/lib/typescript/module/collapsible/index.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/index.web.d.ts +3 -0
- package/lib/typescript/module/collapsible/index.web.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/types.d.ts +24 -0
- package/lib/typescript/module/collapsible/types.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/use-collapsible-motion.d.ts +9 -0
- package/lib/typescript/module/collapsible/use-collapsible-motion.d.ts.map +1 -0
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +6 -0
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +1 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/motion/index.d.ts +1 -1
- package/lib/typescript/module/motion/index.d.ts.map +1 -1
- package/lib/typescript/module/motion/index.web.d.ts +1 -1
- package/lib/typescript/module/motion/index.web.d.ts.map +1 -1
- package/lib/typescript/module/motion/surface-transition.d.ts +8 -0
- package/lib/typescript/module/motion/surface-transition.d.ts.map +1 -0
- package/lib/typescript/module/motion/types.d.ts +7 -0
- package/lib/typescript/module/motion/types.d.ts.map +1 -1
- package/lib/typescript/module/motion/use-surface-transition.d.ts +9 -0
- package/lib/typescript/module/motion/use-surface-transition.d.ts.map +1 -0
- package/lib/typescript/module/overlay/Overlay.d.ts.map +1 -1
- package/lib/typescript/module/overlay/backdrop-paint.d.ts +7 -0
- package/lib/typescript/module/overlay/backdrop-paint.d.ts.map +1 -0
- package/lib/typescript/module/overlay/index.d.ts +1 -1
- package/lib/typescript/module/overlay/index.d.ts.map +1 -1
- package/lib/typescript/module/overlay/types.d.ts +23 -9
- package/lib/typescript/module/overlay/types.d.ts.map +1 -1
- package/lib/typescript/module/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/module/radio/RadioCard.d.ts +1 -1
- package/lib/typescript/module/radio/RadioCard.d.ts.map +1 -1
- package/lib/typescript/module/radio/index.d.ts +1 -1
- package/lib/typescript/module/radio/index.d.ts.map +1 -1
- package/lib/typescript/module/radio/types.d.ts +16 -2
- package/lib/typescript/module/radio/types.d.ts.map +1 -1
- package/lib/typescript/module/radio/use-radio-group-item.d.ts +17 -1
- package/lib/typescript/module/radio/use-radio-group-item.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/package.json +23 -1
- package/src/accordion/Accordion.tsx +7 -60
- package/src/accordion/Accordion.web.tsx +8 -32
- package/src/accordion/use-accordion.ts +4 -21
- package/src/bottom-sheet/BottomSheetBase.tsx +18 -8
- package/src/bottom-sheet/types.ts +6 -0
- package/src/collapsible/Collapsible.tsx +15 -0
- package/src/collapsible/Collapsible.web.tsx +15 -0
- package/src/collapsible/CollapsibleFrame.tsx +120 -0
- package/src/collapsible/CollapsibleFrame.web.tsx +131 -0
- package/src/collapsible/context.ts +8 -0
- package/src/collapsible/frame-types.ts +14 -0
- package/src/collapsible/index.ts +2 -0
- package/src/collapsible/index.web.ts +7 -0
- package/src/collapsible/types.ts +22 -0
- package/src/collapsible/use-collapsible-motion.ts +61 -0
- package/src/dialog/Dialog.tsx +17 -4
- package/src/dialog/Dialog.web.tsx +33 -12
- package/src/dialog/DialogBottomSheet.tsx +6 -0
- package/src/dialog/types.ts +6 -0
- package/src/index.ts +2 -0
- package/src/index.web.ts +2 -0
- package/src/motion/index.ts +1 -1
- package/src/motion/index.web.ts +1 -1
- package/src/motion/surface-transition.ts +15 -0
- package/src/motion/types.ts +8 -0
- package/src/motion/use-surface-transition.ts +14 -0
- package/src/overlay/Overlay.tsx +12 -8
- package/src/overlay/backdrop-paint.ts +25 -0
- package/src/overlay/index.ts +1 -1
- package/src/overlay/types.ts +22 -9
- package/src/radio/Radio.tsx +31 -12
- package/src/radio/RadioCard.tsx +3 -2
- package/src/radio/index.ts +1 -1
- package/src/radio/types.ts +17 -2
- package/src/radio/use-radio-group-item.ts +2 -2
- package/src/select/Select.tsx +5 -2
- package/src/select/Select.web.tsx +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-radio-group-item.d.ts","sourceRoot":"","sources":["../../../../src/radio/use-radio-group-item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-radio-group-item.d.ts","sourceRoot":"","sources":["../../../../src/radio/use-radio-group-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAY,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAInD,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI;gBAGvD,IAAI,GAAG,IAAI;;qBAKvB,aAAa,CAAC,WAAW,CAAC;kBALd,IAAI,GAAG,IAAI;;;;;qBAKvB,aAAa,CAAC,WAAW,CAAC;kBALd,IAAI,GAAG,IAAI;;;;EAU3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/select/Select.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/select/Select.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAOL,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAA0B,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAkC/J,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAsBxC;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,MAAM,GACP,EAAE,kBAAkB,2CA+DpB;AAMD,wBAAgB,WAAW,CAAC,EAC1B,WAAW,EACX,QAAQ,EAAE,YAAkC,EAC5C,OAAO,EACP,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,2CAmClB;AAED,uGAAuG;AAKvG,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,eAAe,2CAYpD;AAMD,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAC/B,KAAK,EACL,cAA0C,EAC1C,GAAG,KAAK,EACT,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAyBvB;AAqED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAgB,EAChB,OAAO,EACP,SAAS,EACT,KAAK,GACN,EAAE,eAAe,2CAiDjB;AAmCD,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.web.d.ts","sourceRoot":"","sources":["../../../../src/select/Select.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Select.web.d.ts","sourceRoot":"","sources":["../../../../src/select/Select.web.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAOL,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAA0B,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAuH/J,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuCxC;AAMD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,KAAK,EACL,UAAU,EAAE,kBAAkB,EAC9B,MAAM,GACP,EAAE,kBAAkB,2CAyGpB;AAMD,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EAAE,YAAkC,EAC5C,OAAO,EACP,WAAW,EACX,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,2CAwClB;AAED,uGAAuG;AAKvG,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,eAAe,2CAgBpD;AAMD,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAC/B,KAAK,EACL,UAAU,EACV,KAAK,EAAE,SAAS,EAChB,cAA0C,EAC1C,SAA6B,EAC7B,KAAK,EACL,SAAS,GACV,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAwJvB;AAMD,wBAAgB,UAAU,CAAC,EACzB,GAAG,EACH,KAAK,EACL,KAAK,EACL,QAAgB,EAChB,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,eAAe,2CAsEjB;AA4BD,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/bloom",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.22.0",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -390,6 +390,25 @@
|
|
|
390
390
|
"default": "./lib/commonjs/viewport/index.js"
|
|
391
391
|
}
|
|
392
392
|
},
|
|
393
|
+
"./collapsible": {
|
|
394
|
+
"react-native": {
|
|
395
|
+
"types": "./lib/typescript/module/collapsible/index.d.ts",
|
|
396
|
+
"default": "./src/collapsible/index.ts"
|
|
397
|
+
},
|
|
398
|
+
"browser": {
|
|
399
|
+
"types": "./lib/typescript/module/collapsible/index.web.d.ts",
|
|
400
|
+
"import": "./lib/module/collapsible/index.web.js",
|
|
401
|
+
"require": "./lib/commonjs/collapsible/index.web.js"
|
|
402
|
+
},
|
|
403
|
+
"import": {
|
|
404
|
+
"types": "./lib/typescript/module/collapsible/index.d.ts",
|
|
405
|
+
"default": "./lib/module/collapsible/index.js"
|
|
406
|
+
},
|
|
407
|
+
"require": {
|
|
408
|
+
"types": "./lib/typescript/commonjs/collapsible/index.d.ts",
|
|
409
|
+
"default": "./lib/commonjs/collapsible/index.js"
|
|
410
|
+
}
|
|
411
|
+
},
|
|
393
412
|
"./fab": {
|
|
394
413
|
"react-native": {
|
|
395
414
|
"types": "./lib/typescript/module/fab/index.d.ts",
|
|
@@ -3747,6 +3766,9 @@
|
|
|
3747
3766
|
"viewport": [
|
|
3748
3767
|
"./lib/typescript/module/viewport/index.d.ts"
|
|
3749
3768
|
],
|
|
3769
|
+
"collapsible": [
|
|
3770
|
+
"./lib/typescript/module/collapsible/index.d.ts"
|
|
3771
|
+
],
|
|
3750
3772
|
"fab": [
|
|
3751
3773
|
"./lib/typescript/module/fab/index.d.ts"
|
|
3752
3774
|
],
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { CollapsibleFrame } from '../collapsible/CollapsibleFrame';
|
|
2
|
+
import { useCollapsibleMotion } from '../collapsible/use-collapsible-motion';
|
|
1
3
|
import React, {
|
|
2
4
|
memo,
|
|
3
5
|
useCallback,
|
|
4
6
|
useContext,
|
|
5
|
-
useState,
|
|
6
7
|
} from 'react';
|
|
7
8
|
import {
|
|
8
9
|
View,
|
|
9
10
|
Text,
|
|
10
11
|
Pressable,
|
|
11
12
|
Animated,
|
|
12
|
-
type LayoutChangeEvent,
|
|
13
13
|
StyleSheet,
|
|
14
14
|
type TextStyle,
|
|
15
15
|
} from 'react-native';
|
|
@@ -176,65 +176,12 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
|
|
|
176
176
|
|
|
177
177
|
// ---- Accordion Content ----
|
|
178
178
|
|
|
179
|
-
const AccordionContentComponent: React.FC<AccordionContentProps & { contentStyle?: AccordionContentProps['style'] }> = ({
|
|
180
|
-
children,
|
|
181
|
-
style,
|
|
182
|
-
contentStyle,
|
|
183
|
-
}) => {
|
|
179
|
+
const AccordionContentComponent: React.FC<AccordionContentProps & { contentStyle?: AccordionContentProps['style'] }> = ({children,style,contentStyle}) => {
|
|
184
180
|
const { isExpanded, contentId, triggerId } = useContext(AccordionItemContext);
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
// and no scrollbar — an accordion holding a form or a paragraph of prose just
|
|
190
|
-
// lost its bottom. The content still lays out at its natural height inside the
|
|
191
|
-
// clip, so `onLayout` reports the real one whether the item is open or shut.
|
|
192
|
-
const [contentHeight, setContentHeight] = useState(0);
|
|
193
|
-
const handleContentLayout = useCallback((event: LayoutChangeEvent) => {
|
|
194
|
-
const next = event.nativeEvent.layout.height;
|
|
195
|
-
// Sub-pixel churn would re-render on every frame of the spring.
|
|
196
|
-
setContentHeight((prev) => (Math.abs(prev - next) > 0.5 ? next : prev));
|
|
197
|
-
}, []);
|
|
198
|
-
|
|
199
|
-
const opacity = heightAnim.interpolate({
|
|
200
|
-
inputRange: [0, 1],
|
|
201
|
-
outputRange: [0, 1],
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
const maxHeight = heightAnim.interpolate({
|
|
205
|
-
inputRange: [0, 1],
|
|
206
|
-
outputRange: [0, contentHeight],
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<Animated.View
|
|
211
|
-
nativeID={contentId}
|
|
212
|
-
{...{ 'aria-labelledby': triggerId }}
|
|
213
|
-
aria-hidden={!isExpanded}
|
|
214
|
-
pointerEvents={isExpanded ? 'auto' : 'none'}
|
|
215
|
-
accessibilityElementsHidden={!isExpanded}
|
|
216
|
-
importantForAccessibility={isExpanded ? 'auto' : 'no-hide-descendants'}
|
|
217
|
-
style={[
|
|
218
|
-
{
|
|
219
|
-
overflow: 'hidden',
|
|
220
|
-
opacity,
|
|
221
|
-
// Before the first measurement an OPEN item must not be clipped to
|
|
222
|
-
// zero, and a SHUT one must not flash open — so the unmeasured frame
|
|
223
|
-
// takes the answer its state already implies, and every frame after
|
|
224
|
-
// that is driven by the real height.
|
|
225
|
-
maxHeight: contentHeight === 0 && isExpanded ? undefined : maxHeight,
|
|
226
|
-
},
|
|
227
|
-
style,
|
|
228
|
-
]}
|
|
229
|
-
>
|
|
230
|
-
<View
|
|
231
|
-
onLayout={handleContentLayout}
|
|
232
|
-
style={[{ paddingBottom: space.md, paddingLeft: space.xs, paddingRight: space.xs }, contentStyle]}
|
|
233
|
-
>
|
|
234
|
-
{children}
|
|
235
|
-
</View>
|
|
236
|
-
</Animated.View>
|
|
237
|
-
);
|
|
181
|
+
const { transition } = useContext(AccordionContext);
|
|
182
|
+
const motion = useCollapsibleMotion(isExpanded, transition);
|
|
183
|
+
return <CollapsibleFrame open={isExpanded} {...motion} nativeID={contentId} labelledBy={triggerId} returnFocusId={triggerId}
|
|
184
|
+
style={style} contentStyle={[{paddingBottom:space.md,paddingLeft:space.xs,paddingRight:space.xs},contentStyle]}>{children}</CollapsibleFrame>;
|
|
238
185
|
};
|
|
239
186
|
|
|
240
187
|
export const Accordion = memo(styled(AccordionComponent, { className: 'style' }));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { CollapsibleFrame } from '../collapsible/CollapsibleFrame.web';
|
|
2
|
+
import { useCollapsibleMotion } from '../collapsible/use-collapsible-motion';
|
|
3
|
+
import React, { memo, useContext } from 'react';
|
|
4
|
+
import { Animated } from 'react-native';
|
|
3
5
|
import { RiArrowDownSLine } from '../icons/remix/RiArrowDownSLine';
|
|
4
6
|
import { resolveNativeWebStyle } from '../styles/resolve-native-web-style';
|
|
5
7
|
import { useInteractiveWebCss } from '../styles/interactive-web-css';
|
|
@@ -20,12 +22,6 @@ const CSS = `@layer base {
|
|
|
20
22
|
}`;
|
|
21
23
|
function useStyles() { useInteractiveWebCss('bloom-accordion', CSS); }
|
|
22
24
|
|
|
23
|
-
/** RN Animated resolves numeric layout/opacity before this DOM host receives them. */
|
|
24
|
-
const PanelHost = forwardRef<HTMLDivElement, Omit<React.HTMLAttributes<HTMLDivElement>, 'style'> & { style?: StyleProp<ViewStyle>; collapsable?: boolean }>(function PanelHost({ style, collapsable: _collapsable, ...props }, ref) {
|
|
25
|
-
return <div {...props} ref={ref} style={resolveNativeWebStyle(style)} />;
|
|
26
|
-
});
|
|
27
|
-
const AnimatedPanel = Animated.createAnimatedComponent(PanelHost);
|
|
28
|
-
|
|
29
25
|
export const Accordion = memo(function Accordion(props: AccordionProps) {
|
|
30
26
|
useStyles();
|
|
31
27
|
const state = useAccordionState(props);
|
|
@@ -64,28 +60,8 @@ export const AccordionTrigger = memo(function AccordionTrigger({ children, icon,
|
|
|
64
60
|
export const AccordionContent = memo(function AccordionContent({ children, style, className, contentClassName }: AccordionContentProps) {
|
|
65
61
|
useStyles();
|
|
66
62
|
const { isExpanded, triggerId, contentId } = useContext(AccordionItemContext);
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
useLayoutEffect(() => {
|
|
72
|
-
const node = body.current;
|
|
73
|
-
if (!node) return;
|
|
74
|
-
const measure = () => {
|
|
75
|
-
const next = node.getBoundingClientRect().height;
|
|
76
|
-
setHeight(previous => Math.abs(previous - next) > .5 ? next : previous);
|
|
77
|
-
};
|
|
78
|
-
measure();
|
|
79
|
-
const observer = new ResizeObserver(measure); observer.observe(node);
|
|
80
|
-
return () => observer.disconnect();
|
|
81
|
-
}, []);
|
|
82
|
-
useLayoutEffect(() => {
|
|
83
|
-
if (!isExpanded && panel.current?.contains(document.activeElement)) document.getElementById(triggerId)?.focus();
|
|
84
|
-
}, [isExpanded, triggerId]);
|
|
85
|
-
const maxHeight = progress.interpolate({ inputRange: [0, 1], outputRange: [0, height] });
|
|
86
|
-
return <AnimatedPanel ref={panel} id={contentId} role="region" aria-labelledby={triggerId} aria-hidden={!isExpanded} inert={!isExpanded}
|
|
87
|
-
className={['bloom-accordion-panel', className].filter(Boolean).join(' ')}
|
|
88
|
-
style={[{ opacity: progress, maxHeight: height === 0 && isExpanded ? undefined : maxHeight }, style]}>
|
|
89
|
-
<div ref={body} className={['bloom-accordion-body', contentClassName].filter(Boolean).join(' ')}>{children}</div>
|
|
90
|
-
</AnimatedPanel>;
|
|
63
|
+
const { transition } = useContext(AccordionContext);
|
|
64
|
+
const motion = useCollapsibleMotion(isExpanded, transition);
|
|
65
|
+
return <CollapsibleFrame open={isExpanded} {...motion} nativeID={contentId} region labelledBy={triggerId} returnFocusId={triggerId}
|
|
66
|
+
className={['bloom-accordion-panel',className].filter(Boolean).join(' ')} contentClassName={['bloom-accordion-body',contentClassName].filter(Boolean).join(' ')} style={style}>{children}</CollapsibleFrame>;
|
|
91
67
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { useCallback, useContext,
|
|
2
|
-
import {
|
|
3
|
-
import { usePrefersReducedMotion } from '../hooks/use-prefers-reduced-motion';
|
|
4
|
-
import { animation } from '../styles/tokens';
|
|
1
|
+
import { useCallback, useContext, useId, useMemo } from 'react';
|
|
2
|
+
import { useCollapsibleMotion } from '../collapsible/use-collapsible-motion';
|
|
5
3
|
import { AccordionContext } from './context';
|
|
6
4
|
import type { AccordionProps } from './types';
|
|
7
5
|
|
|
@@ -25,23 +23,8 @@ export function useAccordionItem(value: string, disabled: boolean) {
|
|
|
25
23
|
return useMemo(() => ({ value, disabled, isExpanded, triggerId: `${id}-trigger`, contentId: `${id}-content` }), [value, disabled, isExpanded, id]);
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
/**
|
|
26
|
+
/** Preserve accordion's spring defaults while sharing reveal cancellation. */
|
|
29
27
|
export function useAccordionMotion(expanded: boolean, kind: 'trigger' | 'content', useNativeDriver: boolean) {
|
|
30
28
|
const { transition } = useContext(AccordionContext);
|
|
31
|
-
|
|
32
|
-
const progress = useRef(new Animated.Value(expanded ? 1 : 0)).current;
|
|
33
|
-
const duration = transition === 'spring' ? undefined : transition.duration;
|
|
34
|
-
const [x1, y1, x2, y2] = transition === 'spring' || !transition.easing ? [.25, .1, .25, 1] : transition.easing;
|
|
35
|
-
const easing = useMemo(() => Easing.bezier(x1, y1, x2, y2), [x1, y1, x2, y2]);
|
|
36
|
-
useLayoutEffect(() => {
|
|
37
|
-
progress.stopAnimation();
|
|
38
|
-
const toValue = expanded ? 1 : 0;
|
|
39
|
-
if (reduced || duration === 0) { progress.setValue(toValue); return; }
|
|
40
|
-
const motion = duration === undefined
|
|
41
|
-
? Animated.spring(progress, { toValue, useNativeDriver, ...animation.spring[kind === 'trigger' ? 'snappy' : 'gentle'] })
|
|
42
|
-
: Animated.timing(progress, { toValue, useNativeDriver, duration: Math.max(0, duration), easing });
|
|
43
|
-
motion.start();
|
|
44
|
-
return () => motion.stop();
|
|
45
|
-
}, [expanded, progress, reduced, duration, easing, kind, useNativeDriver]);
|
|
46
|
-
return progress;
|
|
29
|
+
return useCollapsibleMotion(expanded, transition, kind, useNativeDriver).progress;
|
|
47
30
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useSurfaceTransition } from '../motion/use-surface-transition';
|
|
1
2
|
import { MOTION_RECIPES } from '../motion/recipes';
|
|
2
3
|
import { surfaceStyle } from '../shapes/surface-style';
|
|
3
4
|
import { SURFACE_SHAPES } from '../design-tokens/shapes';
|
|
@@ -56,6 +57,8 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
56
57
|
backgroundComponent,
|
|
57
58
|
backgroundFill,
|
|
58
59
|
backdropComponent,
|
|
60
|
+
backdrop,
|
|
61
|
+
transition,
|
|
59
62
|
style,
|
|
60
63
|
enableHandlePanningGesture = true,
|
|
61
64
|
onDismissAttempt,
|
|
@@ -72,6 +75,9 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
72
75
|
onLayout,
|
|
73
76
|
} = props;
|
|
74
77
|
|
|
78
|
+
const motion = useSurfaceTransition(transition);
|
|
79
|
+
const timed = transition !== undefined;
|
|
80
|
+
const timedConfig = useMemo(() => ({ ...MOTION_RECIPES.present, duration: motion.duration ?? 250, easing: motion.easing }), [motion.duration, motion.easing]);
|
|
75
81
|
const insets = useSafeAreaInsets();
|
|
76
82
|
const theme = useTheme();
|
|
77
83
|
const { colors } = theme;
|
|
@@ -192,19 +198,19 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
192
198
|
// it eventually fires, because its captured generation is stale.
|
|
193
199
|
closeGenerationRef.current += 1;
|
|
194
200
|
closeGeneration.value = closeGenerationRef.current;
|
|
195
|
-
opacity.value = withTiming(1, { ...MOTION_RECIPES.present, duration: 250 });
|
|
196
|
-
translateY.value = withSpring(0, SPRING_CONFIG);
|
|
201
|
+
opacity.value = withTiming(1, timed ? timedConfig : { ...MOTION_RECIPES.present, duration: motion.duration ?? 250 });
|
|
202
|
+
translateY.value = motion.reducedMotion ? 0 : timed ? withTiming(0, timedConfig) : withSpring(0, SPRING_CONFIG);
|
|
197
203
|
} else if (rendered) {
|
|
198
204
|
// Capture the generation for THIS close cycle so the animation
|
|
199
205
|
// callback (running on the UI thread, scheduled back to JS) and
|
|
200
206
|
// the fallback timer agree on which cycle they belong to.
|
|
201
207
|
const generation = closeGenerationRef.current;
|
|
202
|
-
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
208
|
+
opacity.value = withTiming(0, timed ? timedConfig : { ...MOTION_RECIPES.dismiss, duration: motion.duration ?? 250 }, (finished) => {
|
|
203
209
|
if (finished) {
|
|
204
210
|
runOnJS(finishClose)(generation);
|
|
205
211
|
}
|
|
206
212
|
});
|
|
207
|
-
translateY.value = withSpring(screenHeight, { ...SPRING_CONFIG, stiffness: 250 });
|
|
213
|
+
translateY.value = motion.reducedMotion ? screenHeight : timed ? withTiming(screenHeight, timedConfig) : withSpring(screenHeight, { ...SPRING_CONFIG, stiffness: 250 });
|
|
208
214
|
|
|
209
215
|
// Fallback timer to ensure close completes (especially on web
|
|
210
216
|
// where reanimated callbacks occasionally drop on tab blur).
|
|
@@ -214,9 +220,9 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
214
220
|
closeTimeoutRef.current = setTimeout(() => {
|
|
215
221
|
finishClose(generation);
|
|
216
222
|
closeTimeoutRef.current = null;
|
|
217
|
-
}, 300);
|
|
223
|
+
}, motion.reducedMotion ? 0 : timed ? timedConfig.duration + 50 : 300);
|
|
218
224
|
}
|
|
219
|
-
}, [visible, rendered, finishClose, screenHeight, closeGeneration, opacity, translateY]);
|
|
225
|
+
}, [visible, rendered, finishClose, screenHeight, closeGeneration, opacity, translateY, timed, timedConfig, motion.duration, motion.reducedMotion]);
|
|
220
226
|
|
|
221
227
|
// On unmount: ensure pending close callbacks (e.g. consumer's `onDismiss`)
|
|
222
228
|
// still fire if the BS is yanked mid-animation by a parent re-render while a
|
|
@@ -260,11 +266,14 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
260
266
|
translateY.value = withSpring(0, { ...SPRING_CONFIG, velocity });
|
|
261
267
|
return;
|
|
262
268
|
}
|
|
269
|
+
// The timed presentation shares the imperative close lifecycle, so a live
|
|
270
|
+
// reduced-motion change can also settle a gesture-initiated dismissal.
|
|
271
|
+
if (timed || motion.reducedMotion) { setVisible(false); return; }
|
|
263
272
|
translateY.value = withSpring(screenHeightSV.value, { ...SPRING_CONFIG, velocity });
|
|
264
273
|
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
265
274
|
if (finished) runOnJS(finishClose)(generation);
|
|
266
275
|
});
|
|
267
|
-
}, [onDismissAttempt, translateY, screenHeightSV, opacity, finishClose]);
|
|
276
|
+
}, [onDismissAttempt, translateY, screenHeightSV, opacity, finishClose, timed, timedConfig, motion.duration, motion.reducedMotion]);
|
|
268
277
|
|
|
269
278
|
const present = useCallback(() => {
|
|
270
279
|
setRendered(true);
|
|
@@ -709,6 +718,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
709
718
|
// `backdropOpacity`, so the shared component's own dim is
|
|
710
719
|
// switched off here to keep a single source of dimming.
|
|
711
720
|
<Backdrop
|
|
721
|
+
{...backdrop}
|
|
712
722
|
onPress={handleBackdropPress}
|
|
713
723
|
// `progress` is the FADE (0 → 1, folding the drag);
|
|
714
724
|
// how dark the backdrop gets is `backdropOpacity`,
|
|
@@ -717,7 +727,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
717
727
|
// `progress` rather than an animated style because an
|
|
718
728
|
// opacity on the root would sit above the blur layer
|
|
719
729
|
// and neutralise it.
|
|
720
|
-
dimOpacity={backdropOpacity}
|
|
730
|
+
dimOpacity={backdrop?.dimOpacity ?? backdropOpacity}
|
|
721
731
|
progress={backdropProgress}
|
|
722
732
|
style={styles.backdrop}
|
|
723
733
|
/>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BackdropAppearance } from '../overlay/types';
|
|
2
|
+
import type { SurfaceTransition } from '../motion/types';
|
|
1
3
|
import type React from 'react';
|
|
2
4
|
import { View, Platform, type LayoutChangeEvent, type ViewStyle, type StyleProp } from 'react-native';
|
|
3
5
|
import Animated, { type AnimatedStyle, type SharedValue } from 'react-native-reanimated';
|
|
@@ -14,6 +16,10 @@ export interface BottomSheetRef {
|
|
|
14
16
|
export interface BottomSheetProps {
|
|
15
17
|
/** Standard optical surface, or the unmodified backing fill. Default surface. */
|
|
16
18
|
material?: 'surface' | 'flat';
|
|
19
|
+
/** Backdrop paint; the surface continues to own dismissal and layering. */
|
|
20
|
+
backdrop?: BackdropAppearance;
|
|
21
|
+
/** Opt-in timing for panel and backdrop. Live reduced motion settles immediately. */
|
|
22
|
+
transition?: SurfaceTransition;
|
|
17
23
|
children: React.ReactNode;
|
|
18
24
|
/** Accessible name for the modal sheet panel on web. */
|
|
19
25
|
accessibilityLabel?: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { CollapsibleFrame } from './CollapsibleFrame';
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_COLLAPSIBLE_TRANSITION,
|
|
5
|
+
useCollapsibleMotion,
|
|
6
|
+
} from './use-collapsible-motion';
|
|
7
|
+
import type { CollapsibleProps } from './types';
|
|
8
|
+
|
|
9
|
+
export const Collapsible = memo(function Collapsible({
|
|
10
|
+
transition = DEFAULT_COLLAPSIBLE_TRANSITION,
|
|
11
|
+
...props
|
|
12
|
+
}: CollapsibleProps) {
|
|
13
|
+
const motion = useCollapsibleMotion(props.open, transition);
|
|
14
|
+
return <CollapsibleFrame {...props} {...motion} />;
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { CollapsibleFrame } from './CollapsibleFrame.web';
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_COLLAPSIBLE_TRANSITION,
|
|
5
|
+
useCollapsibleMotion,
|
|
6
|
+
} from './use-collapsible-motion';
|
|
7
|
+
import type { CollapsibleProps } from './types';
|
|
8
|
+
|
|
9
|
+
export const Collapsible = memo(function Collapsible({
|
|
10
|
+
transition = DEFAULT_COLLAPSIBLE_TRANSITION,
|
|
11
|
+
...props
|
|
12
|
+
}: CollapsibleProps) {
|
|
13
|
+
const motion = useCollapsibleMotion(props.open, transition);
|
|
14
|
+
return <CollapsibleFrame {...props} {...motion} />;
|
|
15
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AccessibilityInfo,
|
|
4
|
+
Animated,
|
|
5
|
+
findNodeHandle,
|
|
6
|
+
TextInput,
|
|
7
|
+
View,
|
|
8
|
+
type LayoutChangeEvent,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { styled } from 'react-native-css';
|
|
11
|
+
import {
|
|
12
|
+
CollapsibleVisibilityContext,
|
|
13
|
+
useCollapsibleVisibility,
|
|
14
|
+
} from './context';
|
|
15
|
+
import type { CollapsibleFrameProps } from './frame-types';
|
|
16
|
+
|
|
17
|
+
function CollapsibleFrameComponent({
|
|
18
|
+
open,
|
|
19
|
+
hidden,
|
|
20
|
+
progress,
|
|
21
|
+
children,
|
|
22
|
+
style,
|
|
23
|
+
contentStyle,
|
|
24
|
+
returnFocusRef,
|
|
25
|
+
nativeID,
|
|
26
|
+
testID,
|
|
27
|
+
labelledBy,
|
|
28
|
+
returnFocusId,
|
|
29
|
+
}: CollapsibleFrameProps) {
|
|
30
|
+
const visible = useCollapsibleVisibility() && open;
|
|
31
|
+
const panel = useRef<View>(null);
|
|
32
|
+
const initiallyOpen = useRef(open).current;
|
|
33
|
+
const focusWithin = useRef(false);
|
|
34
|
+
const [height, setHeight] = useState(0);
|
|
35
|
+
const measure = useCallback((event: LayoutChangeEvent) => {
|
|
36
|
+
const next = event.nativeEvent.layout.height;
|
|
37
|
+
if (next > 0) setHeight((old) => (Math.abs(old - next) > 0.5 ? next : old));
|
|
38
|
+
}, []);
|
|
39
|
+
const restore = useCallback(() => {
|
|
40
|
+
const input = TextInput.State?.currentlyFocusedInput?.();
|
|
41
|
+
// Native host nodes expose contains without importing a private renderer.
|
|
42
|
+
const root = panel.current;
|
|
43
|
+
const inputInside = Boolean(
|
|
44
|
+
root &&
|
|
45
|
+
input &&
|
|
46
|
+
'contains' in root &&
|
|
47
|
+
typeof root.contains === 'function' &&
|
|
48
|
+
root.contains(input),
|
|
49
|
+
);
|
|
50
|
+
if (!focusWithin.current && !inputInside) return;
|
|
51
|
+
focusWithin.current = false;
|
|
52
|
+
if (inputInside) input?.blur();
|
|
53
|
+
const target =
|
|
54
|
+
returnFocusRef?.current ??
|
|
55
|
+
(returnFocusId && root && 'ownerDocument' in root
|
|
56
|
+
? root.ownerDocument?.getElementById(returnFocusId)
|
|
57
|
+
: null);
|
|
58
|
+
if (target && 'focus' in target && typeof target.focus === 'function') {
|
|
59
|
+
target.focus();
|
|
60
|
+
const handle =
|
|
61
|
+
'measureInWindow' in target
|
|
62
|
+
? findNodeHandle(target as unknown as React.Component)
|
|
63
|
+
: null;
|
|
64
|
+
if (handle != null) AccessibilityInfo.setAccessibilityFocus(handle);
|
|
65
|
+
}
|
|
66
|
+
}, [returnFocusRef, returnFocusId]);
|
|
67
|
+
useLayoutEffect(() => {
|
|
68
|
+
if (!visible) restore();
|
|
69
|
+
}, [visible, restore]);
|
|
70
|
+
const maxHeight = progress.interpolate({
|
|
71
|
+
inputRange: [0, 1],
|
|
72
|
+
outputRange: [0, height],
|
|
73
|
+
});
|
|
74
|
+
return (
|
|
75
|
+
<CollapsibleVisibilityContext.Provider value={visible}>
|
|
76
|
+
<Animated.View
|
|
77
|
+
ref={panel}
|
|
78
|
+
nativeID={nativeID}
|
|
79
|
+
testID={testID}
|
|
80
|
+
{...{ 'aria-labelledby': labelledBy }}
|
|
81
|
+
aria-hidden={!visible}
|
|
82
|
+
accessibilityElementsHidden={!visible}
|
|
83
|
+
importantForAccessibility={visible ? 'auto' : 'no-hide-descendants'}
|
|
84
|
+
pointerEvents={visible ? 'auto' : 'none'}
|
|
85
|
+
onFocus={() => {
|
|
86
|
+
focusWithin.current = true;
|
|
87
|
+
if (!visible) restore();
|
|
88
|
+
}}
|
|
89
|
+
onBlur={() => {
|
|
90
|
+
focusWithin.current = false;
|
|
91
|
+
}}
|
|
92
|
+
style={[
|
|
93
|
+
{
|
|
94
|
+
overflow: 'hidden',
|
|
95
|
+
opacity: progress,
|
|
96
|
+
maxHeight:
|
|
97
|
+
height === 0 && open && initiallyOpen ? undefined : maxHeight,
|
|
98
|
+
},
|
|
99
|
+
style,
|
|
100
|
+
]}
|
|
101
|
+
>
|
|
102
|
+
<View
|
|
103
|
+
collapsable={false}
|
|
104
|
+
onLayout={measure}
|
|
105
|
+
style={[
|
|
106
|
+
{ flexShrink: 0 },
|
|
107
|
+
contentStyle,
|
|
108
|
+
hidden ? { display: 'none' } : undefined,
|
|
109
|
+
]}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</View>
|
|
113
|
+
</Animated.View>
|
|
114
|
+
</CollapsibleVisibilityContext.Provider>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
export const CollapsibleFrame = styled(CollapsibleFrameComponent, {
|
|
118
|
+
className: 'style',
|
|
119
|
+
contentClassName: 'contentStyle',
|
|
120
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React, { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { resolveNativeWebStyle } from '../styles/resolve-native-web-style';
|
|
4
|
+
import { useInteractiveWebCss } from '../styles/interactive-web-css';
|
|
5
|
+
import {
|
|
6
|
+
CollapsibleVisibilityContext,
|
|
7
|
+
useCollapsibleVisibility,
|
|
8
|
+
} from './context';
|
|
9
|
+
import type { CollapsibleFrameProps } from './frame-types';
|
|
10
|
+
|
|
11
|
+
const CSS = `@layer base {
|
|
12
|
+
.bloom-collapsible-panel,.bloom-collapsible-content { box-sizing:border-box;display:flex;flex-direction:column;flex-shrink:0;min-width:0; }
|
|
13
|
+
.bloom-collapsible-panel { overflow:hidden; }
|
|
14
|
+
}`;
|
|
15
|
+
const PanelHost = forwardRef<
|
|
16
|
+
HTMLDivElement,
|
|
17
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
collapsable?: boolean;
|
|
20
|
+
}
|
|
21
|
+
>(function PanelHost({ style, collapsable: _collapsable, ...props }, ref) {
|
|
22
|
+
return <div {...props} ref={ref} style={resolveNativeWebStyle(style)} />;
|
|
23
|
+
});
|
|
24
|
+
const AnimatedPanel = Animated.createAnimatedComponent(PanelHost);
|
|
25
|
+
|
|
26
|
+
export function CollapsibleFrame({
|
|
27
|
+
open,
|
|
28
|
+
progress,
|
|
29
|
+
children,
|
|
30
|
+
style,
|
|
31
|
+
className,
|
|
32
|
+
contentStyle,
|
|
33
|
+
contentClassName,
|
|
34
|
+
returnFocusRef,
|
|
35
|
+
nativeID,
|
|
36
|
+
testID,
|
|
37
|
+
labelledBy,
|
|
38
|
+
returnFocusId,
|
|
39
|
+
region,
|
|
40
|
+
}: CollapsibleFrameProps) {
|
|
41
|
+
useInteractiveWebCss('bloom-collapsible', CSS);
|
|
42
|
+
const visible = useCollapsibleVisibility() && open;
|
|
43
|
+
const panel = useRef<HTMLDivElement>(null);
|
|
44
|
+
const focusWithin = useRef(false);
|
|
45
|
+
const body = useRef<HTMLDivElement>(null);
|
|
46
|
+
const previousOutside = useRef<HTMLElement | null>(null);
|
|
47
|
+
const [height, setHeight] = useState(0);
|
|
48
|
+
useLayoutEffect(() => {
|
|
49
|
+
const node = body.current;
|
|
50
|
+
if (!node) return;
|
|
51
|
+
const measure = () => {
|
|
52
|
+
const next = node.getBoundingClientRect().height;
|
|
53
|
+
if (next > 0)
|
|
54
|
+
setHeight((old) => (Math.abs(old - next) > 0.5 ? next : old));
|
|
55
|
+
};
|
|
56
|
+
measure();
|
|
57
|
+
const observer = new ResizeObserver(measure);
|
|
58
|
+
observer.observe(node);
|
|
59
|
+
return () => observer.disconnect();
|
|
60
|
+
}, []);
|
|
61
|
+
useLayoutEffect(() => {
|
|
62
|
+
const active = document.activeElement;
|
|
63
|
+
if (visible) {
|
|
64
|
+
if (active instanceof HTMLElement && !panel.current?.contains(active))
|
|
65
|
+
previousOutside.current = active;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!panel.current?.contains(active) && !focusWithin.current) return;
|
|
69
|
+
focusWithin.current = false;
|
|
70
|
+
const target =
|
|
71
|
+
returnFocusRef?.current ??
|
|
72
|
+
(returnFocusId ? document.getElementById(returnFocusId) : null) ??
|
|
73
|
+
previousOutside.current;
|
|
74
|
+
if (
|
|
75
|
+
target instanceof HTMLElement &&
|
|
76
|
+
(!target.isConnected || target.closest('[inert]'))
|
|
77
|
+
) {
|
|
78
|
+
if (active instanceof HTMLElement) active.blur();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
target?.focus({ preventScroll: true });
|
|
82
|
+
if (
|
|
83
|
+
panel.current?.contains(document.activeElement) &&
|
|
84
|
+
active instanceof HTMLElement
|
|
85
|
+
)
|
|
86
|
+
active.blur();
|
|
87
|
+
}, [visible, returnFocusRef, returnFocusId]);
|
|
88
|
+
const maxHeight = progress.interpolate({
|
|
89
|
+
inputRange: [0, 1],
|
|
90
|
+
outputRange: [0, height],
|
|
91
|
+
});
|
|
92
|
+
return (
|
|
93
|
+
<CollapsibleVisibilityContext.Provider value={visible}>
|
|
94
|
+
<AnimatedPanel
|
|
95
|
+
ref={panel}
|
|
96
|
+
id={nativeID}
|
|
97
|
+
data-testid={testID}
|
|
98
|
+
role={region ? 'region' : undefined}
|
|
99
|
+
aria-labelledby={labelledBy}
|
|
100
|
+
aria-hidden={!visible}
|
|
101
|
+
inert={!visible}
|
|
102
|
+
onFocusCapture={() => {
|
|
103
|
+
focusWithin.current = true;
|
|
104
|
+
}}
|
|
105
|
+
onBlurCapture={() => {
|
|
106
|
+
focusWithin.current = false;
|
|
107
|
+
}}
|
|
108
|
+
className={['bloom-collapsible-panel', className]
|
|
109
|
+
.filter(Boolean)
|
|
110
|
+
.join(' ')}
|
|
111
|
+
style={[
|
|
112
|
+
{
|
|
113
|
+
opacity: progress,
|
|
114
|
+
maxHeight: height === 0 && open ? undefined : maxHeight,
|
|
115
|
+
},
|
|
116
|
+
style,
|
|
117
|
+
]}
|
|
118
|
+
>
|
|
119
|
+
<div
|
|
120
|
+
ref={body}
|
|
121
|
+
className={['bloom-collapsible-content', contentClassName]
|
|
122
|
+
.filter(Boolean)
|
|
123
|
+
.join(' ')}
|
|
124
|
+
style={resolveNativeWebStyle(contentStyle)}
|
|
125
|
+
>
|
|
126
|
+
{children}
|
|
127
|
+
</div>
|
|
128
|
+
</AnimatedPanel>
|
|
129
|
+
</CollapsibleVisibilityContext.Provider>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Logical visibility reaches portaled controls, unlike host-only inert/display. */
|
|
4
|
+
export const CollapsibleVisibilityContext = createContext(true);
|
|
5
|
+
CollapsibleVisibilityContext.displayName = 'CollapsibleVisibility';
|
|
6
|
+
export function useCollapsibleVisibility() {
|
|
7
|
+
return useContext(CollapsibleVisibilityContext);
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Animated } from 'react-native';
|
|
2
|
+
import type { CollapsibleProps } from './types';
|
|
3
|
+
|
|
4
|
+
export interface CollapsibleFrameProps extends Omit<
|
|
5
|
+
CollapsibleProps,
|
|
6
|
+
'transition'
|
|
7
|
+
> {
|
|
8
|
+
progress: Animated.Value;
|
|
9
|
+
hidden: boolean;
|
|
10
|
+
/** Accordion supplies its real relationship; standalone Collapsible supplies neither. */
|
|
11
|
+
labelledBy?: string;
|
|
12
|
+
returnFocusId?: string;
|
|
13
|
+
region?: boolean;
|
|
14
|
+
}
|