@kanso-labs/react-native-kanso-ui 0.11.24 → 0.11.26

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.
Files changed (36) hide show
  1. package/README.md +27 -0
  2. package/dist/calendar/index.js +105 -41
  3. package/dist/calendar/index.js.map +1 -1
  4. package/dist/calendar/styles.js +7 -0
  5. package/dist/calendar/styles.js.map +1 -1
  6. package/dist/components/calendar/index.d.ts +2 -2
  7. package/dist/components/calendar/index.js.map +1 -1
  8. package/dist/components/carousel/index.d.ts +24 -3
  9. package/dist/components/carousel/index.js +58 -35
  10. package/dist/components/carousel/index.js.map +1 -1
  11. package/dist/components/color-picker/index.js +98 -93
  12. package/dist/components/color-picker/index.js.map +1 -1
  13. package/dist/components/dialog/index.js +7 -2
  14. package/dist/components/dialog/index.js.map +1 -1
  15. package/dist/components/range-calendar/index.d.ts +2 -2
  16. package/dist/components/range-calendar/index.js.map +1 -1
  17. package/dist/components/search-view/index.js.map +1 -1
  18. package/dist/components/segmented-button/index.js +108 -88
  19. package/dist/components/segmented-button/index.js.map +1 -1
  20. package/dist/components/sheet/index.js +8 -4
  21. package/dist/components/sheet/index.js.map +1 -1
  22. package/dist/components/table/index.js +1 -0
  23. package/dist/components/table/index.js.map +1 -1
  24. package/dist/field/index.d.ts +1 -1
  25. package/dist/field/index.js +112 -161
  26. package/dist/field/index.js.map +1 -1
  27. package/dist/field/styles.js +4 -0
  28. package/dist/field/styles.js.map +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/number/parser.js +3 -3
  31. package/dist/number/parser.js.map +1 -1
  32. package/dist/overlay/keyboard.js +100 -27
  33. package/dist/overlay/keyboard.js.map +1 -1
  34. package/dist/segments/index.js +1 -1
  35. package/dist/segments/index.js.map +1 -1
  36. package/package.json +15 -11
@@ -7,7 +7,7 @@ import { composeStyles, themedStyles } from "../../theme/styles.js";
7
7
  import { IconButton } from "../icon-button/index.js";
8
8
  import { c } from "react/compiler-runtime";
9
9
  import { I18nManager, Platform, StyleSheet, View, useWindowDimensions } from "react-native";
10
- import Animated, { Extrapolation, interpolate, useAnimatedReaction, useAnimatedScrollHandler, useAnimatedStyle, useReducedMotion, useSharedValue } from "react-native-reanimated";
10
+ import Animated, { Extrapolation, interpolate, useAnimatedReaction, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
11
11
  import { Children, createContext, isValidElement, use, useRef, useState } from "react";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
13
  import { scheduleOnRN } from "react-native-worklets";
@@ -317,7 +317,7 @@ function Carousel(t0) {
317
317
  * cuts what it holds to the width it is drawn at.
318
318
  */
319
319
  function CarouselItem(t0) {
320
- const $ = c(28);
320
+ const $ = c(32);
321
321
  let children;
322
322
  let props;
323
323
  let style;
@@ -339,7 +339,9 @@ function CarouselItem(t0) {
339
339
  const slot = use(SlotContext);
340
340
  const count = slot?.count ?? 1;
341
341
  const index = slot?.index ?? 0;
342
- const drawn = useDrawn(slot);
342
+ const visibleWidth = useVisibleWidth(slot);
343
+ const drawn = useDrawn(slot, visibleWidth);
344
+ const large = slot?.large ?? 0;
343
345
  const T0 = View;
344
346
  let t1;
345
347
  if ($[4] !== slot) {
@@ -372,45 +374,56 @@ function CarouselItem(t0) {
372
374
  $[13] = t8;
373
375
  } else t8 = $[13];
374
376
  let t9;
375
- if ($[14] !== children || $[15] !== t8) {
376
- t9 = /* @__PURE__ */ jsx(View, {
377
- style: t8,
378
- children
379
- });
377
+ if ($[14] !== children || $[15] !== large || $[16] !== visibleWidth) {
378
+ t9 = typeof children === "function" ? children({
379
+ visibleWidth,
380
+ width: large
381
+ }) : children;
380
382
  $[14] = children;
381
- $[15] = t8;
382
- $[16] = t9;
383
- } else t9 = $[16];
383
+ $[15] = large;
384
+ $[16] = visibleWidth;
385
+ $[17] = t9;
386
+ } else t9 = $[17];
384
387
  let t10;
385
- if ($[17] !== props || $[18] !== t2.View || $[19] !== t4 || $[20] !== t6 || $[21] !== t7 || $[22] !== t9) {
386
- t10 = /* @__PURE__ */ jsx(t2.View, {
388
+ if ($[18] !== t8 || $[19] !== t9) {
389
+ t10 = /* @__PURE__ */ jsx(View, {
390
+ style: t8,
391
+ children: t9
392
+ });
393
+ $[18] = t8;
394
+ $[19] = t9;
395
+ $[20] = t10;
396
+ } else t10 = $[20];
397
+ let t11;
398
+ if ($[21] !== props || $[22] !== t10 || $[23] !== t2.View || $[24] !== t4 || $[25] !== t6 || $[26] !== t7) {
399
+ t11 = /* @__PURE__ */ jsx(t2.View, {
387
400
  "aria-label": t4,
388
401
  role: t5,
389
402
  ...t6,
390
403
  ...props,
391
404
  style: t7,
392
- children: t9
393
- });
394
- $[17] = props;
395
- $[18] = t2.View;
396
- $[19] = t4;
397
- $[20] = t6;
398
- $[21] = t7;
399
- $[22] = t9;
400
- $[23] = t10;
401
- } else t10 = $[23];
402
- let t11;
403
- if ($[24] !== T0 || $[25] !== t1 || $[26] !== t10) {
404
- t11 = /* @__PURE__ */ jsx(T0, {
405
- style: t1,
406
405
  children: t10
407
406
  });
408
- $[24] = T0;
409
- $[25] = t1;
410
- $[26] = t10;
407
+ $[21] = props;
408
+ $[22] = t10;
409
+ $[23] = t2.View;
410
+ $[24] = t4;
411
+ $[25] = t6;
412
+ $[26] = t7;
411
413
  $[27] = t11;
412
414
  } else t11 = $[27];
413
- return t11;
415
+ let t12;
416
+ if ($[28] !== T0 || $[29] !== t1 || $[30] !== t11) {
417
+ t12 = /* @__PURE__ */ jsx(T0, {
418
+ style: t1,
419
+ children: t11
420
+ });
421
+ $[28] = T0;
422
+ $[29] = t1;
423
+ $[30] = t11;
424
+ $[31] = t12;
425
+ } else t12 = $[31];
426
+ return t12;
414
427
  }
415
428
  function describedAs(word) {
416
429
  return Platform.OS === "web" ? { "aria-roledescription": word } : void 0;
@@ -463,7 +476,7 @@ function pathsOf(rests, count) {
463
476
  function slotWidthOf(slot) {
464
477
  return slot === null ? void 0 : { width: slot.large };
465
478
  }
466
- function useDrawn(slot) {
479
+ function useDrawn(slot, visibleWidth) {
467
480
  const path = slot?.path;
468
481
  const scrolled = slot?.scrolled;
469
482
  const index = slot?.index ?? 0;
@@ -474,9 +487,8 @@ function useDrawn(slot) {
474
487
  "worklet";
475
488
  if (path === void 0 || scrolled === void 0) return {};
476
489
  const offset = scrolled.get();
477
- const position = offset / step;
478
- const start = interpolate(position, path.rests, path.starts, Extrapolation.CLAMP);
479
- const width = interpolate(position, path.rests, path.widths, Extrapolation.CLAMP);
490
+ const start = interpolate(offset / step, path.rests, path.starts, Extrapolation.CLAMP);
491
+ const width = visibleWidth.get();
480
492
  const shift = offset + start + width / 2 - index * step - large / 2;
481
493
  return {
482
494
  transform: [{ translateX: rtl ? -shift : shift }],
@@ -484,6 +496,17 @@ function useDrawn(slot) {
484
496
  };
485
497
  });
486
498
  }
499
+ function useVisibleWidth(slot) {
500
+ const path = slot?.path;
501
+ const scrolled = slot?.scrolled;
502
+ const large = slot?.large ?? 0;
503
+ const step = slot?.step ?? 0;
504
+ return useDerivedValue(() => {
505
+ "worklet";
506
+ if (path === void 0 || scrolled === void 0) return large;
507
+ return interpolate(scrolled.get() / step, path.rests, path.widths, Extrapolation.CLAMP);
508
+ });
509
+ }
487
510
  function widthTo(onMeasure) {
488
511
  return (event) => {
489
512
  onMeasure(event.nativeEvent.layout.width);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","LayoutChangeEvent","ScrollView","ViewProps","ViewStyle","AnimatedStyle","SharedValue","Children","createContext","isValidElement","use","useCallback","useRef","useState","I18nManager","Platform","StyleSheet","useWindowDimensions","View","Animated","Extrapolation","interpolate","useAnimatedReaction","useAnimatedScrollHandler","useAnimatedStyle","useReducedMotion","useSharedValue","scheduleOnRN","CarouselLayout","Placement","arrange","GAP","placements","ChevronEndGlyph","slideLabelFor","useLocaleOf","useMessages","useTheme","composeStyles","themedStyles","IconButton","DEFAULT_ITEM_SIZE","SLACK","CarouselItemProps","Omit","children","ref","CarouselProps","itemSize","label","layout","nextLabel","previousLabel","Edge","Geometry","end","masked","scrolled","step","Path","rests","starts","widths","Slot","count","index","large","path","rtl","SlotContext","styles","create","contentMasked","overflow","held","flexGrow","previousGlyph","transform","scaleX","previousGlyphRightToLeft","root","minWidth","slot","alignItems","flexShrink","stylesOf","radii","spacing","controls","columnGap","sm","flexDirection","justifyContent","paddingHorizontal","lg","item","borderRadius","xl","rowGap","row","paddingVertical","along","direction","offset","Math","round","min","max","Carousel","t0","$","_c","props","style","t1","t2","undefined","theme","own","messages","reduceMotion","dimensions","scroller","measured","setMeasured","width","padding","isRTL","items","toArray","filter","length","room","arrangement","steps","paths","pathsOf","Array","from","_","rest","t3","edgeOf","edge","setEdge","onScroll","event","set","fromStart","contentOffset","x","get","now","before","t4","geometry","current","scrollTo","animated","move","t5","previous","t6","next","slots","map","__0","T0","t7","t8","carousel","describedAs","t9","t10","t11","t12","t13","t14","t15","Symbol","for","widthTo","t16","t17","t18","offsetsOf","t19","index_0","key","t20","t21","previousSlide","t22","t23","t24","t25","nextSlide","t26","t27","t28","t29","t30","CarouselItem","locale","drawn","useDrawn","slotWidthOf","slide","word","OS","atStart","atEnd","Set","at","_placed","placed","left","position","start","CLAMP","shift","translateX","onMeasure","nativeEvent","Item","_c"],"sources":["../../../src/components/carousel/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle, SharedValue } from 'react-native-reanimated'\n\nimport {\n Children,\n createContext,\n isValidElement,\n use,\n useCallback,\n useRef,\n useState,\n} from 'react'\nimport {\n I18nManager,\n Platform,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport Animated, {\n Extrapolation,\n interpolate,\n useAnimatedReaction,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n} from 'react-native-reanimated'\nimport { scheduleOnRN } from 'react-native-worklets'\n\nimport type { CarouselLayout, Placement } from '../../carousel/arrangement'\n\nimport { arrange, GAP, placements } from '../../carousel/arrangement'\nimport { ChevronEndGlyph } from '../../glyphs'\nimport { slideLabelFor } from '../../i18n'\nimport { useLocaleOf, useMessages } from '../../i18n/provider'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { IconButton } from '../icon-button'\n\n// The carousel page's carousel, as kanso-ui's Carousel draws it: a row of\n// items that scrolls on and off the screen, in three of the page's layouts.\n// Each has the page's 16dp of padding at its ends and 8dp at its top and\n// bottom, 8dp between items and a 28dp corner on every item.\n//\n// - **Multi-browse**, the default, shows as many large items as fit at\n// `itemSize`, then a medium one and a small one, and fills its width\n// exactly; the large width gives way where the preferred one does not fit.\n// - **Hero** shows one large item and one small.\n// - **Uncontained** shows every item at `itemSize`, scrolling past the edge.\n//\n// **Items change size as they move**, as the page draws them. The first two\n// layouts come to rest one item apart, and between two rests every item's\n// place and width are interpolated, so an item shrinks as it leaves and\n// grows as it arrives; the last rests turn the arrangement round a slot at a\n// time, so every item is drawn large at one of them. The arithmetic is\n// `src/carousel/arrangement.ts`, web's own.\n//\n// **The scrolling is the platform's.** A horizontal scroll view holds the\n// items in a row, each in a slot as wide as a large item, and is as long as\n// the run of rests, so it comes to rest at them through `snapToOffsets`. A\n// scroll handler keeps how far it has scrolled on the UI thread, and each\n// item is drawn from that there too: moved along by as much as the view has\n// scrolled, which holds it against what shows, and then to where the\n// arrangement places it, and cut to the width it is drawn at by a view with\n// the page's corner, centred on what it holds, which is laid out at the large\n// width. What it holds is cut at both sides rather than squeezed, as the\n// page's masked items are, and as web's are by `clip-path`. Uncontained has\n// no rests and no masks, so its items scroll in the row themselves, snapping\n// to their own starts.\n//\n// **It is the ARIA carousel pattern** that web follows: a region named by\n// `label`, each item a group named by which of how many it is, and a previous\n// and a next button under it, at the end, which move to the neighbouring rest\n// and are disabled at either limit. Under React Native Web the region and its\n// items take web's role descriptions, carousel and slide; neither platform\n// has a role description to give them. On iOS and Android a screen reader\n// moves through the items itself, and nothing here scrolls when one is\n// reached, which web does on focus. Under reduced motion the buttons jump\n// rather than scroll.\n//\n// The gap between items is the arrangement's 8dp, `GAP`, rather than the\n// theme's `spacing.sm`, since every rest and every place is worked out from\n// it, and a scheme moving the one without the other would draw the items\n// over each other. The padding at the ends is the theme's `spacing.lg`, which\n// the arithmetic is handed.\n//\n// The page's large width is \"dynamic, or user-set\", and neither MDC-Android\n// nor Compose has a default for it; `itemSize`'s 240 is web's own.\n// Uncontained keeps the padding at its end as well as its start, where the\n// page gives it a leading padding alone, so its last item does not end flush\n// against the edge.\n//\n// React Native Web has no `snapToOffsets`, so in the web Storybook the\n// carousel rests wherever a drag leaves it; the buttons still move it from\n// rest to rest.\n\nconst DEFAULT_ITEM_SIZE = 240\n\n// How near a limit counts as at it, in dp, since a scroll can come to rest a\n// fraction of a pixel short.\nconst SLACK = 0.5\n\ntype CarouselItemProps = Omit<ViewProps, 'children'> & {\n /** What the item shows: usually an image, which the item masks. */\n readonly children?: ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\ntype CarouselProps = Omit<ViewProps, 'children'> & {\n /** The items: `Carousel.Item` for each. */\n readonly children?: ReactNode\n /**\n * The large item's preferred width, in dp. Multi-browse lays out as many\n * as fit and narrows them where they do not; uncontained draws every item\n * at it; hero takes its large item's width from the carousel's.\n * @default 240\n */\n readonly itemSize?: number\n /**\n * What the carousel shows, for a screen reader. Required rather than\n * optional: a carousel is a region, and a region with no name is one a\n * screen reader cannot introduce.\n */\n readonly label: string\n /**\n * Which of the page's layouts the carousel draws.\n * @default 'multi-browse'\n */\n readonly layout?: CarouselLayout\n /**\n * What the next button is called. Left out, the library names it in the\n * reader's locale — \"Next slide\" in English.\n */\n readonly nextLabel?: string\n /**\n * What the previous button is called. Left out, the library names it in\n * the reader's locale — \"Previous slide\" in English.\n */\n readonly previousLabel?: string\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\n/** Which limits the carousel is at, as one value a reaction can compare. */\ntype Edge = 'both' | 'end' | 'none' | 'start'\n\n/** What the controls scroll by, as numbers read off one render. */\ntype Geometry = {\n /** The offset of the last rest, or for uncontained how far it scrolls. */\n readonly end: number\n readonly masked: boolean\n readonly scrolled: number\n /** The distance between two rests, or for uncontained between two items. */\n readonly step: number\n}\n\n/** Where a layout that masks draws an item at each of its rests. */\ntype Path = {\n /** The rests, counted from 0, which the two below are drawn at. */\n readonly rests: readonly number[]\n /** Where the item starts at each rest, along the content box. */\n readonly starts: readonly number[]\n readonly widths: readonly number[]\n}\n\ntype Slot = {\n readonly count: number\n readonly index: number\n /** The width the item is laid out at. */\n readonly large: number\n readonly layout: CarouselLayout\n /** Where it is drawn, for a layout that masks. */\n readonly path: Path | undefined\n readonly rtl: boolean\n /** How far the carousel has scrolled along the text, on the UI thread. */\n readonly scrolled: SharedValue<number>\n /** The distance between two rests. */\n readonly step: number\n}\n\nconst SlotContext = createContext<null | Slot>(null)\n\nconst styles = StyleSheet.create({\n // A layout that masks holds its row to the run of rests, and clips what it\n // places past either end rather than letting it lengthen the scroll view.\n contentMasked: {\n overflow: 'hidden',\n },\n // What an item holds, laid out at the large width and centred on the mask,\n // so the mask cuts it at both sides.\n held: {\n flexGrow: 1,\n },\n // Previous points at the start, and next at the end; the end chevron turns\n // over with the text itself, so previous turns it back.\n previousGlyph: {\n transform: [{ scaleX: -1 }],\n },\n previousGlyphRightToLeft: {\n transform: [{ scaleX: 1 }],\n },\n root: {\n minWidth: 0,\n },\n // The room a large item is laid out in. The mask inside it is centred,\n // and the row stretches every slot to the tallest item.\n slot: {\n alignItems: 'center',\n flexShrink: 0,\n },\n})\n\nconst stylesOf = themedStyles(({ radii, spacing }) =>\n StyleSheet.create({\n controls: {\n columnGap: spacing.sm,\n flexDirection: 'row',\n justifyContent: 'flex-end',\n paddingHorizontal: spacing.lg,\n },\n // The mask, which is the item: the page's corner, cutting what it holds\n // to the width it is drawn at.\n item: {\n alignItems: 'center',\n borderRadius: radii.xl,\n flexGrow: 1,\n overflow: 'hidden',\n },\n root: {\n rowGap: spacing.sm,\n },\n row: {\n columnGap: GAP,\n flexDirection: 'row',\n paddingHorizontal: spacing.lg,\n paddingVertical: spacing.sm,\n },\n }),\n)\n\n// Where a press of previous or next scrolls to from `scrolled`: the rest\n// either side of the nearest one, or for uncontained an item's width along,\n// kept between the two ends.\nfunction along(\n direction: -1 | 1,\n { end, masked, scrolled, step }: Geometry,\n): number {\n const offset = masked\n ? (Math.round(scrolled / step) + direction) * step\n : scrolled + direction * step\n return Math.min(Math.max(offset, 0), end)\n}\n\n/**\n * A row of items that scrolls on and off the screen, in the carousel page's\n * multi-browse, hero or uncontained layout. Name it with `label`, and give it\n * a `Carousel.Item` for each item.\n *\n * ```tsx\n * <Carousel label=\"Label\">\n * <Carousel.Item><Image alt=\"First item\" source={first} /></Carousel.Item>\n * <Carousel.Item><Image alt=\"Second item\" source={second} /></Carousel.Item>\n * </Carousel>\n * ```\n *\n * `style`, `ref` and `testID` land on the carousel as a whole, which is the\n * view a layout positions, and a `style` there applies over its own.\n */\nfunction Carousel({\n children,\n itemSize = DEFAULT_ITEM_SIZE,\n label,\n layout = 'multi-browse',\n nextLabel,\n previousLabel,\n style,\n ...props\n}: CarouselProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const messages = useMessages()\n const reduceMotion = useReducedMotion()\n const dimensions = useWindowDimensions()\n const scroller = useRef<ComponentRef<typeof ScrollView>>(null)\n const scrolled = useSharedValue(0)\n // The scroll view's width, which the layout reports once it has drawn;\n // before that the first render guesses the window's.\n const [measured, setMeasured] = useState<number>()\n const width = measured ?? dimensions.width\n const padding = theme.spacing.lg\n const rtl = I18nManager.isRTL\n\n const items = Children.toArray(children).filter(isValidElement)\n const count = items.length\n const room = Math.max(width - 2 * padding, 0)\n const arrangement = arrange(layout, room, itemSize, count)\n const masked = layout !== 'uncontained'\n const step = arrangement.large + GAP\n // The last rest, or how far the uncontained row runs past the scroll view.\n const end = masked\n ? arrangement.steps * step\n : Math.max(count * step - GAP + 2 * padding - width, 0)\n const paths = masked\n ? pathsOf(\n Array.from({ length: arrangement.steps + 1 }, (_, rest) =>\n placements(layout, arrangement, room, padding, count, rest),\n ),\n count,\n )\n : []\n\n const [edge, setEdge] = useState<Edge>(() => edgeOf(0, end))\n\n const onScroll = useAnimatedScrollHandler({\n onScroll: (event) => {\n 'worklet'\n scrolled.set(fromStart(event.contentOffset.x, end, rtl))\n },\n })\n\n // Which limits the carousel is at, on the JavaScript thread, for the two\n // buttons; told only when it changes, rather than on every frame.\n useAnimatedReaction(\n () => {\n 'worklet'\n return edgeOf(scrolled.get(), end)\n },\n (now, before) => {\n 'worklet'\n if (now !== before) {\n scheduleOnRN(setEdge, now)\n }\n },\n )\n\n const move = useCallback(\n (direction: -1 | 1) => {\n const geometry = { end, masked, scrolled: scrolled.get(), step }\n scroller.current?.scrollTo({\n animated: !reduceMotion,\n x: fromStart(along(direction, geometry), end, rtl),\n })\n },\n [end, masked, reduceMotion, rtl, scrolled, step],\n )\n const previous = useCallback(() => {\n move(-1)\n }, [move])\n const next = useCallback(() => {\n move(1)\n }, [move])\n\n const slots = items.map((_, index): Slot => ({\n count,\n index,\n large: arrangement.large,\n layout,\n path: paths[index],\n rtl,\n scrolled,\n step,\n }))\n\n return (\n <View\n aria-label={label}\n role=\"region\"\n {...describedAs(messages.carousel)}\n {...props}\n style={composeStyles<ViewStyle>(styles.root, own.root, style)}\n >\n <Animated.ScrollView\n contentContainerStyle={composeStyles<ViewStyle>(\n own.row,\n masked && styles.contentMasked,\n masked && { width: width + end },\n )}\n decelerationRate=\"fast\"\n // A keyboard stop while there is anywhere to scroll, so the arrow\n // keys move it whatever its items hold, which axe's\n // scrollable-region-focusable asks of it under React Native Web.\n focusable={end > 0}\n horizontal\n onLayout={widthTo(setMeasured)}\n onScroll={onScroll}\n ref={scroller}\n scrollEventThrottle={16}\n showsHorizontalScrollIndicator={false}\n snapToOffsets={offsetsOf(masked, arrangement.steps, step, count, end)}\n >\n {items.map((item, index) => (\n <SlotContext key={item.key ?? index} value={slots[index] ?? null}>\n {item}\n </SlotContext>\n ))}\n </Animated.ScrollView>\n <View style={own.controls}>\n <IconButton\n aria-label={previousLabel ?? messages.previousSlide}\n isDisabled={edge === 'start' || edge === 'both'}\n onPress={previous}\n >\n <ChevronEndGlyph\n style={rtl ? styles.previousGlyphRightToLeft : styles.previousGlyph}\n />\n </IconButton>\n <IconButton\n aria-label={nextLabel ?? messages.nextSlide}\n isDisabled={edge === 'end' || edge === 'both'}\n onPress={next}\n >\n <ChevronEndGlyph />\n </IconButton>\n </View>\n </View>\n )\n}\n\n/**\n * One item. It is named by which of how many it is — \"2 of 6\" — unless it is\n * given an `aria-label` of its own.\n *\n * `style`, `ref` and `testID` land on the item, the view with the corner that\n * cuts what it holds to the width it is drawn at.\n */\nfunction CarouselItem({ children, style, ...props }: CarouselItemProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const locale = useLocaleOf(undefined)\n const messages = useMessages()\n const slot = use(SlotContext)\n const count = slot?.count ?? 1\n const index = slot?.index ?? 0\n const drawn = useDrawn(slot)\n\n return (\n <View style={composeStyles<ViewStyle>(styles.slot, slotWidthOf(slot))}>\n <Animated.View\n aria-label={slideLabelFor(index + 1, count, locale)}\n role=\"group\"\n {...describedAs(messages.slide)}\n {...props}\n style={composeStyles<AnimatedStyle<ViewStyle>>(own.item, drawn, style)}\n >\n <View style={composeStyles<ViewStyle>(styles.held, slotWidthOf(slot))}>\n {children}\n </View>\n </Animated.View>\n </View>\n )\n}\n\n// What the region and its items are described as, under React Native Web,\n// where the DOM takes a role description; React Native has none to give.\nfunction describedAs(word: string) {\n return Platform.OS === 'web' ? { 'aria-roledescription': word } : undefined\n}\n\nfunction edgeOf(scrolled: number, end: number): Edge {\n 'worklet'\n const atStart = scrolled <= SLACK\n const atEnd = scrolled >= end - SLACK\n if (atStart && atEnd) {\n return 'both'\n }\n if (atStart) {\n return 'start'\n }\n return atEnd ? 'end' : 'none'\n}\n\n/**\n * A right-to-left scroll view's offset counted from its other edge: from the\n * start of the text where it is from the left, and from the left where it is\n * from the start, so the one function reads an offset and writes one. `end`\n * is how much longer the content is than the view.\n *\n * iOS and Android agree on what a right-to-left scroll view reports, though\n * they get there differently. iOS turns the whole scroll view over, so its\n * own offset counts from the start, and React Native counts it from the left\n * again before handing it to `onScroll`, and back before `scrollTo`\n * (`_scrollViewMetrics` and `scrollToOffset` in\n * RCTScrollViewComponentView.mm). Android's is the view's own `scrollX`,\n * which is from the left and starts at the far end, so the start shows first\n * (ReactHorizontalScrollView.kt). So on both an event's offset and the one\n * `scrollTo` takes are from the left, while `snapToOffsets` is read from the\n * start on both: Android turns its offsets round where it flings, and iOS\n * compares them with its own turned-over offset. React Native Web reports no\n * right-to-left layout through I18nManager, so there nothing is turned.\n */\nfunction fromStart(offset: number, end: number, rtl: boolean): number {\n 'worklet'\n return rtl ? end - offset : offset\n}\n\n// Where the scroll view comes to rest: at every rest of a layout that masks,\n// or at each uncontained item's start, as far as the row goes.\nfunction offsetsOf(\n masked: boolean,\n steps: number,\n step: number,\n count: number,\n end: number,\n): number[] | undefined {\n if (end <= 0) {\n return undefined\n }\n if (masked) {\n return Array.from({ length: steps + 1 }, (_, rest) => rest * step)\n }\n const starts = Array.from({ length: count }, (_, index) =>\n Math.min(index * step, end),\n )\n return [...new Set(starts)]\n}\n\n// Each item's place and width at every rest, which the UI thread\n// interpolates between as the carousel moves. A carousel with one rest is\n// given it twice, since an interpolation needs two.\nfunction pathsOf(rests: readonly Placement[][], count: number): Path[] {\n const at = rests.length > 1 ? rests : [...rests, ...rests]\n return Array.from({ length: count }, (_, index) => ({\n rests: at.map((_placed, rest) => rest),\n starts: at.map((placed) => placed[index]?.left ?? 0),\n widths: at.map((placed) => placed[index]?.width ?? 0),\n }))\n}\n\nfunction slotWidthOf(slot: null | Slot): undefined | ViewStyle {\n return slot === null ? undefined : { width: slot.large }\n}\n\n// Where a layout that masks draws an item as the carousel scrolls: moved\n// along by as much as it has scrolled, which holds it against what shows,\n// then from its slot to where the arrangement places it, at the width it is\n// drawn at. Physical, since a transform is: a right-to-left row is laid out\n// from the right, so there the item moves the other way.\nfunction useDrawn(slot: null | Slot) {\n const path = slot?.path\n const scrolled = slot?.scrolled\n const index = slot?.index ?? 0\n const large = slot?.large ?? 0\n const step = slot?.step ?? 0\n const rtl = slot?.rtl ?? false\n\n return useAnimatedStyle(() => {\n 'worklet'\n if (path === undefined || scrolled === undefined) {\n return {}\n }\n const offset = scrolled.get()\n const position = offset / step\n const start = interpolate(\n position,\n path.rests,\n path.starts,\n Extrapolation.CLAMP,\n )\n const width = interpolate(\n position,\n path.rests,\n path.widths,\n Extrapolation.CLAMP,\n )\n const shift = offset + start + width / 2 - index * step - large / 2\n return { transform: [{ translateX: rtl ? -shift : shift }], width }\n })\n}\n\n// A layout handler handing the width it reports to `onMeasure`. Built by a\n// call rather than written inline, which is what react-perf's\n// jsx-no-new-function-as-prop is after; the React Compiler memoises it.\nfunction widthTo(onMeasure: (width: number) => void) {\n return (event: LayoutChangeEvent) => {\n onMeasure(event.nativeEvent.layout.width)\n }\n}\n\nCarousel.Item = CarouselItem\n\nexport { Carousel, CarouselItem }\nexport type { CarouselItemProps, CarouselLayout, CarouselProps }\n"],"mappings":";;;;;;;;;;;;;;AAuGA,MAAM2C,oBAAoB;AAI1B,MAAMC,QAAQ;AA+Ed,MAAM2B,cAAc7D,cAA2B,IAAI;AAEnD,MAAM8D,SAAStD,WAAWuD,OAAO;CAG/BC,eAAe,EACbC,UAAU,SACZ;CAGAC,MAAM,EACJC,UAAU,EACZ;CAGAC,eAAe,EACbC,WAAW,CAAC,EAAEC,QAAQ,GAAG,CAAC,EAC5B;CACAC,0BAA0B,EACxBF,WAAW,CAAC,EAAEC,QAAQ,EAAE,CAAC,EAC3B;CACAE,MAAM,EACJC,UAAU,EACZ;CAGAC,MAAM;EACJC,YAAY;EACZC,YA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AAMJ,SAASwD,QAAQyC,WAAoC;CACnD,QAAQ5E,UAA6B;EACnC4E,UAAU5E,MAAM6E,YAAY7K,OAAO2E,KAAK;CAC1C;AACF;AAEAjB,SAASoH,OAAOtB"}
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","LayoutChangeEvent","ScrollView","ViewProps","ViewStyle","AnimatedStyle","DerivedValue","SharedValue","Children","createContext","isValidElement","use","useCallback","useRef","useState","I18nManager","Platform","StyleSheet","useWindowDimensions","View","Animated","Extrapolation","interpolate","useAnimatedReaction","useAnimatedScrollHandler","useAnimatedStyle","useDerivedValue","useReducedMotion","useSharedValue","scheduleOnRN","CarouselLayout","Placement","arrange","GAP","placements","ChevronEndGlyph","slideLabelFor","useLocaleOf","useMessages","useTheme","composeStyles","themedStyles","IconButton","DEFAULT_ITEM_SIZE","SLACK","CarouselItemProps","Omit","children","state","CarouselItemRenderProps","ref","visibleWidth","width","CarouselProps","itemSize","label","layout","nextLabel","previousLabel","Edge","Geometry","end","masked","scrolled","step","Path","rests","starts","widths","Slot","count","index","large","path","rtl","SlotContext","styles","create","contentMasked","overflow","held","flexGrow","previousGlyph","transform","scaleX","previousGlyphRightToLeft","root","minWidth","slot","alignItems","flexShrink","stylesOf","radii","spacing","controls","columnGap","sm","flexDirection","justifyContent","paddingHorizontal","lg","item","borderRadius","xl","rowGap","row","paddingVertical","along","direction","offset","Math","round","min","max","Carousel","t0","$","_c","props","style","t1","t2","undefined","theme","own","messages","reduceMotion","dimensions","scroller","measured","setMeasured","padding","isRTL","items","toArray","filter","length","room","arrangement","steps","paths","pathsOf","Array","from","_","rest","t3","edgeOf","edge","setEdge","onScroll","event","set","fromStart","contentOffset","x","get","now","before","t4","geometry","current","scrollTo","animated","move","t5","previous","t6","next","slots","map","__0","T0","t7","t8","carousel","describedAs","t9","t10","t11","t12","t13","t14","t15","Symbol","for","widthTo","t16","t17","t18","offsetsOf","t19","index_0","key","t20","t21","previousSlide","t22","t23","t24","t25","nextSlide","t26","t27","t28","t29","t30","CarouselItem","locale","useVisibleWidth","drawn","useDrawn","slotWidthOf","slide","word","OS","atStart","atEnd","Set","at","_placed","placed","left","start","CLAMP","shift","translateX","onMeasure","nativeEvent","Item","_c"],"sources":["../../../src/components/carousel/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type {\n AnimatedStyle,\n DerivedValue,\n SharedValue,\n} from 'react-native-reanimated'\n\nimport {\n Children,\n createContext,\n isValidElement,\n use,\n useCallback,\n useRef,\n useState,\n} from 'react'\nimport {\n I18nManager,\n Platform,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport Animated, {\n Extrapolation,\n interpolate,\n useAnimatedReaction,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useDerivedValue,\n useReducedMotion,\n useSharedValue,\n} from 'react-native-reanimated'\nimport { scheduleOnRN } from 'react-native-worklets'\n\nimport type { CarouselLayout, Placement } from '../../carousel/arrangement'\n\nimport { arrange, GAP, placements } from '../../carousel/arrangement'\nimport { ChevronEndGlyph } from '../../glyphs'\nimport { slideLabelFor } from '../../i18n'\nimport { useLocaleOf, useMessages } from '../../i18n/provider'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { IconButton } from '../icon-button'\n\n// The carousel page's carousel, as kanso-ui's Carousel draws it: a row of\n// items that scrolls on and off the screen, in three of the page's layouts.\n// Each has the page's 16dp of padding at its ends and 8dp at its top and\n// bottom, 8dp between items and a 28dp corner on every item.\n//\n// - **Multi-browse**, the default, shows as many large items as fit at\n// `itemSize`, then a medium one and a small one, and fills its width\n// exactly; the large width gives way where the preferred one does not fit.\n// - **Hero** shows one large item and one small.\n// - **Uncontained** shows every item at `itemSize`, scrolling past the edge.\n//\n// **Items change size as they move**, as the page draws them. The first two\n// layouts come to rest one item apart, and between two rests every item's\n// place and width are interpolated, so an item shrinks as it leaves and\n// grows as it arrives; the last rests turn the arrangement round a slot at a\n// time, so every item is drawn large at one of them. The arithmetic is\n// `src/carousel/arrangement.ts`, web's own.\n//\n// **The scrolling is the platform's.** A horizontal scroll view holds the\n// items in a row, each in a slot as wide as a large item, and is as long as\n// the run of rests, so it comes to rest at them through `snapToOffsets`. A\n// scroll handler keeps how far it has scrolled on the UI thread, and each\n// item is drawn from that there too: moved along by as much as the view has\n// scrolled, which holds it against what shows, and then to where the\n// arrangement places it, and cut to the width it is drawn at by a view with\n// the page's corner, centred on what it holds, which is laid out at the large\n// width. What it holds is cut at both sides rather than squeezed, as the\n// page's masked items are, and as web's are by `clip-path`. Uncontained has\n// no rests and no masks, so its items scroll in the row themselves, snapping\n// to their own starts.\n//\n// **What an item holds can see its mask.** The page shows an item's text\n// once the item is wide enough to hold it, and only what the item holds\n// knows where its text is, so `Carousel.Item` takes its children as a\n// function too, as web's does, handed the width the item is laid out at and\n// the width that shows of it. The second is a Reanimated value rather than\n// web's number, since the mask follows the scroll on the UI thread and a\n// number would re-render the item every frame; an animated style reads it\n// there, so text can fade or hide as the mask closes over it.\n//\n// **It is the ARIA carousel pattern** that web follows: a region named by\n// `label`, each item a group named by which of how many it is, and a previous\n// and a next button under it, at the end, which move to the neighbouring rest\n// and are disabled at either limit. Under React Native Web the region and its\n// items take web's role descriptions, carousel and slide; neither platform\n// has a role description to give them. On iOS and Android a screen reader\n// moves through the items itself, and nothing here scrolls when one is\n// reached, which web does on focus. Under reduced motion the buttons jump\n// rather than scroll.\n//\n// The gap between items is the arrangement's 8dp, `GAP`, rather than the\n// theme's `spacing.sm`, since every rest and every place is worked out from\n// it, and a scheme moving the one without the other would draw the items\n// over each other. The padding at the ends is the theme's `spacing.lg`, which\n// the arithmetic is handed.\n//\n// The page's large width is \"dynamic, or user-set\", and neither MDC-Android\n// nor Compose has a default for it; `itemSize`'s 240 is web's own.\n// Uncontained keeps the padding at its end as well as its start, where the\n// page gives it a leading padding alone, so its last item does not end flush\n// against the edge.\n//\n// React Native Web has no `snapToOffsets`, so in the web Storybook the\n// carousel rests wherever a drag leaves it; the buttons still move it from\n// rest to rest.\n\nconst DEFAULT_ITEM_SIZE = 240\n\n// How near a limit counts as at it, in dp, since a scroll can come to rest a\n// fraction of a pixel short.\nconst SLACK = 0.5\n\ntype CarouselItemProps = Omit<ViewProps, 'children'> & {\n /**\n * What the item shows: usually an image, which the item masks. A function\n * is handed how much of the item shows, so text the item has no room for\n * can be hidden as the mask closes over it.\n */\n readonly children?:\n | ((state: CarouselItemRenderProps) => ReactNode)\n | ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\n/** How much of a `Carousel.Item` shows, for children written as a function. */\ntype CarouselItemRenderProps = {\n /**\n * How much of `width` shows, in dp, following the scroll on the UI\n * thread, where an animated style reads it. The mask takes the rest evenly\n * from both sides, so `(width - visibleWidth) / 2` is cut off each. It is\n * `width` for an item drawn large, and for every item of an uncontained\n * carousel, which masks nothing.\n */\n readonly visibleWidth: DerivedValue<number>\n /**\n * The width the item is laid out at, in dp: the large item's, which every\n * item in the carousel shares.\n */\n readonly width: number\n}\n\ntype CarouselProps = Omit<ViewProps, 'children'> & {\n /** The items: `Carousel.Item` for each. */\n readonly children?: ReactNode\n /**\n * The large item's preferred width, in dp. Multi-browse lays out as many\n * as fit and narrows them where they do not; uncontained draws every item\n * at it; hero takes its large item's width from the carousel's.\n * @default 240\n */\n readonly itemSize?: number\n /**\n * What the carousel shows, for a screen reader. Required rather than\n * optional: a carousel is a region, and a region with no name is one a\n * screen reader cannot introduce.\n */\n readonly label: string\n /**\n * Which of the page's layouts the carousel draws.\n * @default 'multi-browse'\n */\n readonly layout?: CarouselLayout\n /**\n * What the next button is called. Left out, the library names it in the\n * reader's locale — \"Next slide\" in English.\n */\n readonly nextLabel?: string\n /**\n * What the previous button is called. Left out, the library names it in\n * the reader's locale — \"Previous slide\" in English.\n */\n readonly previousLabel?: string\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\n/** Which limits the carousel is at, as one value a reaction can compare. */\ntype Edge = 'both' | 'end' | 'none' | 'start'\n\n/** What the controls scroll by, as numbers read off one render. */\ntype Geometry = {\n /** The offset of the last rest, or for uncontained how far it scrolls. */\n readonly end: number\n readonly masked: boolean\n readonly scrolled: number\n /** The distance between two rests, or for uncontained between two items. */\n readonly step: number\n}\n\n/** Where a layout that masks draws an item at each of its rests. */\ntype Path = {\n /** The rests, counted from 0, which the two below are drawn at. */\n readonly rests: readonly number[]\n /** Where the item starts at each rest, along the content box. */\n readonly starts: readonly number[]\n readonly widths: readonly number[]\n}\n\ntype Slot = {\n readonly count: number\n readonly index: number\n /** The width the item is laid out at. */\n readonly large: number\n readonly layout: CarouselLayout\n /** Where it is drawn, for a layout that masks. */\n readonly path: Path | undefined\n readonly rtl: boolean\n /** How far the carousel has scrolled along the text, on the UI thread. */\n readonly scrolled: SharedValue<number>\n /** The distance between two rests. */\n readonly step: number\n}\n\nconst SlotContext = createContext<null | Slot>(null)\n\nconst styles = StyleSheet.create({\n // A layout that masks holds its row to the run of rests, and clips what it\n // places past either end rather than letting it lengthen the scroll view.\n contentMasked: {\n overflow: 'hidden',\n },\n // What an item holds, laid out at the large width and centred on the mask,\n // so the mask cuts it at both sides.\n held: {\n flexGrow: 1,\n },\n // Previous points at the start, and next at the end; the end chevron turns\n // over with the text itself, so previous turns it back.\n previousGlyph: {\n transform: [{ scaleX: -1 }],\n },\n previousGlyphRightToLeft: {\n transform: [{ scaleX: 1 }],\n },\n root: {\n minWidth: 0,\n },\n // The room a large item is laid out in. The mask inside it is centred,\n // and the row stretches every slot to the tallest item.\n slot: {\n alignItems: 'center',\n flexShrink: 0,\n },\n})\n\nconst stylesOf = themedStyles(({ radii, spacing }) =>\n StyleSheet.create({\n controls: {\n columnGap: spacing.sm,\n flexDirection: 'row',\n justifyContent: 'flex-end',\n paddingHorizontal: spacing.lg,\n },\n // The mask, which is the item: the page's corner, cutting what it holds\n // to the width it is drawn at.\n item: {\n alignItems: 'center',\n borderRadius: radii.xl,\n flexGrow: 1,\n overflow: 'hidden',\n },\n root: {\n rowGap: spacing.sm,\n },\n row: {\n columnGap: GAP,\n flexDirection: 'row',\n paddingHorizontal: spacing.lg,\n paddingVertical: spacing.sm,\n },\n }),\n)\n\n// Where a press of previous or next scrolls to from `scrolled`: the rest\n// either side of the nearest one, or for uncontained an item's width along,\n// kept between the two ends.\nfunction along(\n direction: -1 | 1,\n { end, masked, scrolled, step }: Geometry,\n): number {\n const offset = masked\n ? (Math.round(scrolled / step) + direction) * step\n : scrolled + direction * step\n return Math.min(Math.max(offset, 0), end)\n}\n\n/**\n * A row of items that scrolls on and off the screen, in the carousel page's\n * multi-browse, hero or uncontained layout. Name it with `label`, and give it\n * a `Carousel.Item` for each item.\n *\n * ```tsx\n * <Carousel label=\"Label\">\n * <Carousel.Item><Image alt=\"First item\" source={first} /></Carousel.Item>\n * <Carousel.Item><Image alt=\"Second item\" source={second} /></Carousel.Item>\n * </Carousel>\n * ```\n *\n * `style`, `ref` and `testID` land on the carousel as a whole, which is the\n * view a layout positions, and a `style` there applies over its own.\n */\nfunction Carousel({\n children,\n itemSize = DEFAULT_ITEM_SIZE,\n label,\n layout = 'multi-browse',\n nextLabel,\n previousLabel,\n style,\n ...props\n}: CarouselProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const messages = useMessages()\n const reduceMotion = useReducedMotion()\n const dimensions = useWindowDimensions()\n const scroller = useRef<ComponentRef<typeof ScrollView>>(null)\n const scrolled = useSharedValue(0)\n // The scroll view's width, which the layout reports once it has drawn;\n // before that the first render guesses the window's.\n const [measured, setMeasured] = useState<number>()\n const width = measured ?? dimensions.width\n const padding = theme.spacing.lg\n const rtl = I18nManager.isRTL\n\n const items = Children.toArray(children).filter(isValidElement)\n const count = items.length\n const room = Math.max(width - 2 * padding, 0)\n const arrangement = arrange(layout, room, itemSize, count)\n const masked = layout !== 'uncontained'\n const step = arrangement.large + GAP\n // The last rest, or how far the uncontained row runs past the scroll view.\n const end = masked\n ? arrangement.steps * step\n : Math.max(count * step - GAP + 2 * padding - width, 0)\n const paths = masked\n ? pathsOf(\n Array.from({ length: arrangement.steps + 1 }, (_, rest) =>\n placements(layout, arrangement, room, padding, count, rest),\n ),\n count,\n )\n : []\n\n const [edge, setEdge] = useState<Edge>(() => edgeOf(0, end))\n\n const onScroll = useAnimatedScrollHandler({\n onScroll: (event) => {\n 'worklet'\n scrolled.set(fromStart(event.contentOffset.x, end, rtl))\n },\n })\n\n // Which limits the carousel is at, on the JavaScript thread, for the two\n // buttons; told only when it changes, rather than on every frame.\n useAnimatedReaction(\n () => {\n 'worklet'\n return edgeOf(scrolled.get(), end)\n },\n (now, before) => {\n 'worklet'\n if (now !== before) {\n scheduleOnRN(setEdge, now)\n }\n },\n )\n\n const move = useCallback(\n (direction: -1 | 1) => {\n const geometry = { end, masked, scrolled: scrolled.get(), step }\n scroller.current?.scrollTo({\n animated: !reduceMotion,\n x: fromStart(along(direction, geometry), end, rtl),\n })\n },\n [end, masked, reduceMotion, rtl, scrolled, step],\n )\n const previous = useCallback(() => {\n move(-1)\n }, [move])\n const next = useCallback(() => {\n move(1)\n }, [move])\n\n const slots = items.map((_, index): Slot => ({\n count,\n index,\n large: arrangement.large,\n layout,\n path: paths[index],\n rtl,\n scrolled,\n step,\n }))\n\n return (\n <View\n aria-label={label}\n role=\"region\"\n {...describedAs(messages.carousel)}\n {...props}\n style={composeStyles<ViewStyle>(styles.root, own.root, style)}\n >\n <Animated.ScrollView\n contentContainerStyle={composeStyles<ViewStyle>(\n own.row,\n masked && styles.contentMasked,\n masked && { width: width + end },\n )}\n decelerationRate=\"fast\"\n // A keyboard stop while there is anywhere to scroll, so the arrow\n // keys move it whatever its items hold, which axe's\n // scrollable-region-focusable asks of it under React Native Web.\n focusable={end > 0}\n horizontal\n onLayout={widthTo(setMeasured)}\n onScroll={onScroll}\n ref={scroller}\n scrollEventThrottle={16}\n showsHorizontalScrollIndicator={false}\n snapToOffsets={offsetsOf(masked, arrangement.steps, step, count, end)}\n >\n {items.map((item, index) => (\n <SlotContext key={item.key ?? index} value={slots[index] ?? null}>\n {item}\n </SlotContext>\n ))}\n </Animated.ScrollView>\n <View style={own.controls}>\n <IconButton\n aria-label={previousLabel ?? messages.previousSlide}\n isDisabled={edge === 'start' || edge === 'both'}\n onPress={previous}\n >\n <ChevronEndGlyph\n style={rtl ? styles.previousGlyphRightToLeft : styles.previousGlyph}\n />\n </IconButton>\n <IconButton\n aria-label={nextLabel ?? messages.nextSlide}\n isDisabled={edge === 'end' || edge === 'both'}\n onPress={next}\n >\n <ChevronEndGlyph />\n </IconButton>\n </View>\n </View>\n )\n}\n\n/**\n * One item. It is named by which of how many it is — \"2 of 6\" — unless it is\n * given an `aria-label` of its own.\n *\n * `style`, `ref` and `testID` land on the item, the view with the corner that\n * cuts what it holds to the width it is drawn at.\n */\nfunction CarouselItem({ children, style, ...props }: CarouselItemProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const locale = useLocaleOf(undefined)\n const messages = useMessages()\n const slot = use(SlotContext)\n const count = slot?.count ?? 1\n const index = slot?.index ?? 0\n const visibleWidth = useVisibleWidth(slot)\n const drawn = useDrawn(slot, visibleWidth)\n const large = slot?.large ?? 0\n\n return (\n <View style={composeStyles<ViewStyle>(styles.slot, slotWidthOf(slot))}>\n <Animated.View\n aria-label={slideLabelFor(index + 1, count, locale)}\n role=\"group\"\n {...describedAs(messages.slide)}\n {...props}\n style={composeStyles<AnimatedStyle<ViewStyle>>(own.item, drawn, style)}\n >\n <View style={composeStyles<ViewStyle>(styles.held, slotWidthOf(slot))}>\n {typeof children === 'function'\n ? children({ visibleWidth, width: large })\n : children}\n </View>\n </Animated.View>\n </View>\n )\n}\n\n// What the region and its items are described as, under React Native Web,\n// where the DOM takes a role description; React Native has none to give.\nfunction describedAs(word: string) {\n return Platform.OS === 'web' ? { 'aria-roledescription': word } : undefined\n}\n\nfunction edgeOf(scrolled: number, end: number): Edge {\n 'worklet'\n const atStart = scrolled <= SLACK\n const atEnd = scrolled >= end - SLACK\n if (atStart && atEnd) {\n return 'both'\n }\n if (atStart) {\n return 'start'\n }\n return atEnd ? 'end' : 'none'\n}\n\n/**\n * A right-to-left scroll view's offset counted from its other edge: from the\n * start of the text where it is from the left, and from the left where it is\n * from the start, so the one function reads an offset and writes one. `end`\n * is how much longer the content is than the view.\n *\n * iOS and Android agree on what a right-to-left scroll view reports, though\n * they get there differently. iOS turns the whole scroll view over, so its\n * own offset counts from the start, and React Native counts it from the left\n * again before handing it to `onScroll`, and back before `scrollTo`\n * (`_scrollViewMetrics` and `scrollToOffset` in\n * RCTScrollViewComponentView.mm). Android's is the view's own `scrollX`,\n * which is from the left and starts at the far end, so the start shows first\n * (ReactHorizontalScrollView.kt). So on both an event's offset and the one\n * `scrollTo` takes are from the left, while `snapToOffsets` is read from the\n * start on both: Android turns its offsets round where it flings, and iOS\n * compares them with its own turned-over offset. React Native Web reports no\n * right-to-left layout through I18nManager, so there nothing is turned.\n */\nfunction fromStart(offset: number, end: number, rtl: boolean): number {\n 'worklet'\n return rtl ? end - offset : offset\n}\n\n// Where the scroll view comes to rest: at every rest of a layout that masks,\n// or at each uncontained item's start, as far as the row goes.\nfunction offsetsOf(\n masked: boolean,\n steps: number,\n step: number,\n count: number,\n end: number,\n): number[] | undefined {\n if (end <= 0) {\n return undefined\n }\n if (masked) {\n return Array.from({ length: steps + 1 }, (_, rest) => rest * step)\n }\n const starts = Array.from({ length: count }, (_, index) =>\n Math.min(index * step, end),\n )\n return [...new Set(starts)]\n}\n\n// Each item's place and width at every rest, which the UI thread\n// interpolates between as the carousel moves. A carousel with one rest is\n// given it twice, since an interpolation needs two.\nfunction pathsOf(rests: readonly Placement[][], count: number): Path[] {\n const at = rests.length > 1 ? rests : [...rests, ...rests]\n return Array.from({ length: count }, (_, index) => ({\n rests: at.map((_placed, rest) => rest),\n starts: at.map((placed) => placed[index]?.left ?? 0),\n widths: at.map((placed) => placed[index]?.width ?? 0),\n }))\n}\n\nfunction slotWidthOf(slot: null | Slot): undefined | ViewStyle {\n return slot === null ? undefined : { width: slot.large }\n}\n\n// Where a layout that masks draws an item as the carousel scrolls: moved\n// along by as much as it has scrolled, which holds it against what shows,\n// then from its slot to where the arrangement places it, at the width it is\n// drawn at. Physical, since a transform is: a right-to-left row is laid out\n// from the right, so there the item moves the other way.\nfunction useDrawn(slot: null | Slot, visibleWidth: DerivedValue<number>) {\n const path = slot?.path\n const scrolled = slot?.scrolled\n const index = slot?.index ?? 0\n const large = slot?.large ?? 0\n const step = slot?.step ?? 0\n const rtl = slot?.rtl ?? false\n\n return useAnimatedStyle(() => {\n 'worklet'\n if (path === undefined || scrolled === undefined) {\n return {}\n }\n const offset = scrolled.get()\n const start = interpolate(\n offset / step,\n path.rests,\n path.starts,\n Extrapolation.CLAMP,\n )\n const width = visibleWidth.get()\n const shift = offset + start + width / 2 - index * step - large / 2\n return { transform: [{ translateX: rtl ? -shift : shift }], width }\n })\n}\n\n// The width an item is drawn at, which is how much of it shows: the\n// arrangement's, interpolated between rests, or the large width where\n// nothing is masked.\nfunction useVisibleWidth(slot: null | Slot): DerivedValue<number> {\n const path = slot?.path\n const scrolled = slot?.scrolled\n const large = slot?.large ?? 0\n const step = slot?.step ?? 0\n\n return useDerivedValue(() => {\n 'worklet'\n if (path === undefined || scrolled === undefined) {\n return large\n }\n return interpolate(\n scrolled.get() / step,\n path.rests,\n path.widths,\n Extrapolation.CLAMP,\n )\n })\n}\n\n// A layout handler handing the width it reports to `onMeasure`. Built by a\n// call rather than written inline, which is what react-perf's\n// jsx-no-new-function-as-prop is after; the React Compiler memoises it.\nfunction widthTo(onMeasure: (width: number) => void) {\n return (event: LayoutChangeEvent) => {\n onMeasure(event.nativeEvent.layout.width)\n }\n}\n\nCarousel.Item = CarouselItem\n\nexport { Carousel, CarouselItem }\nexport type {\n CarouselItemProps,\n CarouselItemRenderProps,\n CarouselLayout,\n CarouselProps,\n}\n"],"mappings":";;;;;;;;;;;;;;AA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B"}
@@ -35,6 +35,7 @@ const stylesOf = themedStyles(({ colors, radii, spacing, stateLayerOpacity }) =>
35
35
  height: SWATCH,
36
36
  width: SWATCH
37
37
  },
38
+ swatchDisabled: { opacity: stateLayerOpacity.disabledContent },
38
39
  trigger: {
39
40
  alignItems: "center",
40
41
  alignSelf: "flex-start",
@@ -73,7 +74,7 @@ const stylesOf = themedStyles(({ colors, radii, spacing, stateLayerOpacity }) =>
73
74
  * places.
74
75
  */
75
76
  function ColorPicker(t0) {
76
- const $ = c(68);
77
+ const $ = c(69);
77
78
  const { alpha: t1, children, defaultOpen, defaultValue, isDisabled: t2, isOpen, label, onChange, onOpenChange, ref, style, testID, value } = t0;
78
79
  const alpha = t1 === void 0 ? false : t1;
79
80
  const isDisabled = t2 === void 0 ? false : t2;
@@ -160,38 +161,42 @@ function ColorPicker(t0) {
160
161
  const t14 = "button";
161
162
  const t15 = composeStyles(styles.trigger, isDisabled ? styles.disabled : void 0, feedback.ring, style);
162
163
  const t16 = feedback.layer;
163
- let t17;
164
- if ($[22] !== state.color || $[23] !== styles.swatch) {
165
- t17 = /* @__PURE__ */ jsx(ColorSwatch, {
166
- color: state.color,
167
- style: styles.swatch
168
- });
169
- $[22] = state.color;
170
- $[23] = styles.swatch;
171
- $[24] = t17;
172
- } else t17 = $[24];
173
- let t18;
174
- if ($[25] !== colors.onSurface || $[26] !== isDisabled || $[27] !== labelRole || $[28] !== stateLayerOpacity) {
175
- t18 = composeStyles(labelRole, { color: isDisabled ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent) : colors.onSurface });
176
- $[25] = colors.onSurface;
177
- $[26] = isDisabled;
178
- $[27] = labelRole;
179
- $[28] = stateLayerOpacity;
180
- $[29] = t18;
181
- } else t18 = $[29];
164
+ const T1 = ColorSwatch;
165
+ const t17 = state.color;
166
+ const t18 = composeStyles(styles.swatch, isDisabled ? styles.swatchDisabled : void 0);
182
167
  let t19;
183
- if ($[30] !== label || $[31] !== t18) {
184
- t19 = /* @__PURE__ */ jsx(Text, {
185
- style: t18,
186
- children: label
168
+ if ($[22] !== T1 || $[23] !== state.color || $[24] !== t18) {
169
+ t19 = /* @__PURE__ */ jsx(T1, {
170
+ color: t17,
171
+ style: t18
187
172
  });
188
- $[30] = label;
189
- $[31] = t18;
190
- $[32] = t19;
191
- } else t19 = $[32];
173
+ $[22] = T1;
174
+ $[23] = state.color;
175
+ $[24] = t18;
176
+ $[25] = t19;
177
+ } else t19 = $[25];
192
178
  let t20;
193
- if ($[33] !== T0 || $[34] !== feedback.handlers || $[35] !== feedback.layer || $[36] !== isDisabled || $[37] !== overlay.isOpen || $[38] !== show || $[39] !== t10 || $[40] !== t12 || $[41] !== t13 || $[42] !== t15 || $[43] !== t17 || $[44] !== t19 || $[45] !== testID) {
194
- t20 = /* @__PURE__ */ jsxs(T0, {
179
+ if ($[26] !== colors.onSurface || $[27] !== isDisabled || $[28] !== labelRole || $[29] !== stateLayerOpacity) {
180
+ t20 = composeStyles(labelRole, { color: isDisabled ? withOpacity(colors.onSurface, stateLayerOpacity.disabledContent) : colors.onSurface });
181
+ $[26] = colors.onSurface;
182
+ $[27] = isDisabled;
183
+ $[28] = labelRole;
184
+ $[29] = stateLayerOpacity;
185
+ $[30] = t20;
186
+ } else t20 = $[30];
187
+ let t21;
188
+ if ($[31] !== label || $[32] !== t20) {
189
+ t21 = /* @__PURE__ */ jsx(Text, {
190
+ style: t20,
191
+ children: label
192
+ });
193
+ $[31] = label;
194
+ $[32] = t20;
195
+ $[33] = t21;
196
+ } else t21 = $[33];
197
+ let t22;
198
+ if ($[34] !== T0 || $[35] !== feedback.handlers || $[36] !== feedback.layer || $[37] !== isDisabled || $[38] !== overlay.isOpen || $[39] !== show || $[40] !== t10 || $[41] !== t12 || $[42] !== t13 || $[43] !== t15 || $[44] !== t19 || $[45] !== t21 || $[46] !== testID) {
199
+ t22 = /* @__PURE__ */ jsxs(T0, {
195
200
  ...t8,
196
201
  "aria-expanded": t9,
197
202
  "aria-label": t10,
@@ -204,35 +209,35 @@ function ColorPicker(t0) {
204
209
  testID,
205
210
  children: [
206
211
  t16,
207
- t17,
208
- t19
212
+ t19,
213
+ t21
209
214
  ]
210
215
  });
211
- $[33] = T0;
212
- $[34] = feedback.handlers;
213
- $[35] = feedback.layer;
214
- $[36] = isDisabled;
215
- $[37] = overlay.isOpen;
216
- $[38] = show;
217
- $[39] = t10;
218
- $[40] = t12;
219
- $[41] = t13;
220
- $[42] = t15;
221
- $[43] = t17;
216
+ $[34] = T0;
217
+ $[35] = feedback.handlers;
218
+ $[36] = feedback.layer;
219
+ $[37] = isDisabled;
220
+ $[38] = overlay.isOpen;
221
+ $[39] = show;
222
+ $[40] = t10;
223
+ $[41] = t12;
224
+ $[42] = t13;
225
+ $[43] = t15;
222
226
  $[44] = t19;
223
- $[45] = testID;
224
- $[46] = t20;
225
- } else t20 = $[46];
226
- const t21 = overlay.isOpen;
227
- let t22;
228
- if ($[47] !== state) {
229
- t22 = pickedOf(state);
230
- $[47] = state;
231
- $[48] = t22;
232
- } else t22 = $[48];
233
- let t23;
234
- if ($[49] !== alpha || $[50] !== children || $[51] !== isDisabled || $[52] !== label || $[53] !== locale || $[54] !== styles.body) {
235
- t23 = children ?? /* @__PURE__ */ jsxs(View, {
227
+ $[45] = t21;
228
+ $[46] = testID;
229
+ $[47] = t22;
230
+ } else t22 = $[47];
231
+ const t23 = overlay.isOpen;
232
+ let t24;
233
+ if ($[48] !== state) {
234
+ t24 = pickedOf(state);
235
+ $[48] = state;
236
+ $[49] = t24;
237
+ } else t24 = $[49];
238
+ let t25;
239
+ if ($[50] !== alpha || $[51] !== children || $[52] !== isDisabled || $[53] !== label || $[54] !== locale || $[55] !== styles) {
240
+ t25 = children ?? /* @__PURE__ */ jsxs(View, {
236
241
  style: styles.body,
237
242
  children: [
238
243
  /* @__PURE__ */ jsx(ColorArea, {
@@ -259,49 +264,49 @@ function ColorPicker(t0) {
259
264
  })
260
265
  ]
261
266
  });
262
- $[49] = alpha;
263
- $[50] = children;
264
- $[51] = isDisabled;
265
- $[52] = label;
266
- $[53] = locale;
267
- $[54] = styles.body;
268
- $[55] = t23;
269
- } else t23 = $[55];
270
- let t24;
271
- if ($[56] !== t22 || $[57] !== t23) {
272
- t24 = /* @__PURE__ */ jsx(PickedColorContext, {
273
- value: t22,
274
- children: t23
267
+ $[50] = alpha;
268
+ $[51] = children;
269
+ $[52] = isDisabled;
270
+ $[53] = label;
271
+ $[54] = locale;
272
+ $[55] = styles;
273
+ $[56] = t25;
274
+ } else t25 = $[56];
275
+ let t26;
276
+ if ($[57] !== t24 || $[58] !== t25) {
277
+ t26 = /* @__PURE__ */ jsx(PickedColorContext, {
278
+ value: t24,
279
+ children: t25
275
280
  });
276
- $[56] = t22;
277
- $[57] = t23;
278
- $[58] = t24;
279
- } else t24 = $[58];
280
- let t25;
281
- if ($[59] !== close || $[60] !== label || $[61] !== overlay.isOpen || $[62] !== t24 || $[63] !== trigger) {
282
- t25 = /* @__PURE__ */ jsx(PickerPopup, {
281
+ $[57] = t24;
282
+ $[58] = t25;
283
+ $[59] = t26;
284
+ } else t26 = $[59];
285
+ let t27;
286
+ if ($[60] !== close || $[61] !== label || $[62] !== overlay.isOpen || $[63] !== t26 || $[64] !== trigger) {
287
+ t27 = /* @__PURE__ */ jsx(PickerPopup, {
283
288
  anchor,
284
289
  close,
285
- isOpen: t21,
290
+ isOpen: t23,
286
291
  label,
287
292
  trigger,
288
- children: t24
293
+ children: t26
289
294
  });
290
- $[59] = close;
291
- $[60] = label;
292
- $[61] = overlay.isOpen;
293
- $[62] = t24;
294
- $[63] = trigger;
295
- $[64] = t25;
296
- } else t25 = $[64];
297
- let t26;
298
- if ($[65] !== t20 || $[66] !== t25) {
299
- t26 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t20, t25] });
300
- $[65] = t20;
301
- $[66] = t25;
302
- $[67] = t26;
303
- } else t26 = $[67];
304
- return t26;
295
+ $[60] = close;
296
+ $[61] = label;
297
+ $[62] = overlay.isOpen;
298
+ $[63] = t26;
299
+ $[64] = trigger;
300
+ $[65] = t27;
301
+ } else t27 = $[65];
302
+ let t28;
303
+ if ($[66] !== t22 || $[67] !== t27) {
304
+ t28 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t22, t27] });
305
+ $[66] = t22;
306
+ $[67] = t27;
307
+ $[68] = t28;
308
+ } else t28 = $[68];
309
+ return t28;
305
310
  }
306
311
  function pickedOf(state) {
307
312
  return {