@kanso-labs/react-native-kanso-ui 0.11.25 → 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.
- package/README.md +27 -0
- package/dist/components/dialog/index.js +7 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/sheet/index.js +8 -4
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/number/parser.js +3 -3
- package/dist/number/parser.js.map +1 -1
- package/dist/overlay/keyboard.js +100 -27
- package/dist/overlay/keyboard.js.map +1 -1
- package/dist/segments/index.js +1 -1
- package/dist/segments/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","HostInstance","LayoutChangeEvent","ScrollViewProps","StyleProp","TextProps","TextStyle","ViewProps","ViewStyle","GestureType","AnimatedStyle","SharedValue","EdgeInsets","createContext","use","useCallback","useEffect","useId","useMemo","useState","I18nManager","Text","NativeText","Pressable","ScrollView","StyleSheet","useWindowDimensions","View","Gesture","GestureDetector","GestureHandlerRootView","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","SafeAreaInsetsContext","ButtonSlots","ModalOpenProps","ModalTrigger","ResolvedTheme","ButtonSlotContext","useWindowSizeClass","useMessages","insetsOf","ModalWindow","NO_INSETS","panelRoleOf","useModalState","useModalTrigger","usePressFeedback","refsOf","useTheme","composeStyles","themedStyles","useTypeRole","SIDE_WIDTH","TOP_MARGIN","PARTIAL","DRAG_SLOP","FLING","BAR_WIDTH","BAR_HEIGHT","BAR_SPACE","BAR_SIDE","stylesOf","colors","radii","shadows","spacing","create","bar","backgroundColor","onSurfaceVariant","borderRadius","pill","height","width","body","gap","lg","paddingHorizontal","xl","paddingVertical","bodyText","color","container","surfaceContainerLow","boxShadow","elevation1","overflow","containerBottom","borderTopLeftRadius","borderTopRightRadius","containerSide","borderBottomStartRadius","borderTopStartRadius","flex","footer","alignItems","borderTopColor","outlineVariant","borderTopWidth","flexDirection","flexShrink","flexWrap","sm","justifyContent","minHeight","paddingBottom","paddingTop","handle","alignSelf","header","borderBottomColor","borderBottomWidth","md","rootBottom","bottom","left","position","right","rootSide","end","maxWidth","top","title","minWidth","SheetLayout","expanded","pan","setTitle","node","titleId","toggle","SheetLayoutContext","SheetTriggerContext","SheetBodyProps","ref","SheetContentProps","Omit","SheetOpenProps","children","initialHeight","isDismissable","isKeyboardDismissDisabled","style","SheetHandleProps","defaultOpen","isOpen","onOpenChange","SheetPartProps","SheetProps","SheetTitleProps","SheetWindowProps","close","setPresent","present","slots","Stops","partial","settles","bottomBoundsOf","insets","maxHeight","Math","max","settleOf","at","velocity","find","stop","findLast","reduce","nearest","abs","Sheet","t0","$","_c","t1","context","t2","t3","SheetBody","contentContainerStyle","onContentSizeChange","onLayout","props","scrollEnabled","undefined","layout","useLayout","styles","text","content","setContent","room","setRoom","measureContent","event","nativeEvent","measureRoom","scrolls","overflows","t4","Native","enabled","blocksExternalGesture","native","T0","T1","t5","t6","t7","t8","t9","SheetContent","outer","state","SheetFooter","SheetHandle","label","theme","corners","feedback","messages","dragHandle","handlers","ring","layer","SheetHeader","SheetTitle","role","SheetWindow","testID","full","setFull","setExpanded","stopsOf","stops","twoHeights","rest","motion","useSheetMotion","length","offset","useSheetDrag","Symbol","for","_temp","t10","measure","labelledBy","t11","t12","scrim","t13","T2","t14","t15","t16","t17","sideInsetsOf","panel","t18","t19","t20","t21","t22","t23","was","paddingStart","lower","part","Error","reduceMotion","origin","lowest","follow","translation","set","min","get","settle","target","higher","duration","durationMedium1","easing","bezier","easingEmphasizedDecelerate","success","velocityY","Pan","activeOffsetY","runOnJS","onStart","translationY","onUpdate","translationY_0","onEnd","withTestId","shown","direction","isRTL","durationShort2","durationShort3","easingEmphasizedAccelerate","easingStandard","fade","enter","exit","gone","timer","setTimeout","clearTimeout","transform","translateY","progress","opacity","translateX","Body","Content","Footer","Handle","Header","Title","_c","NativeText"],"sources":["../../../src/components/sheet/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n HostInstance,\n LayoutChangeEvent,\n ScrollViewProps,\n StyleProp,\n TextProps,\n TextStyle,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { GestureType } from 'react-native-gesture-handler'\nimport type { AnimatedStyle, SharedValue } from 'react-native-reanimated'\nimport type { EdgeInsets } from 'react-native-safe-area-context'\n\nimport {\n createContext,\n use,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react'\nimport {\n I18nManager,\n Text as NativeText,\n Pressable,\n ScrollView,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport {\n Gesture,\n GestureDetector,\n GestureHandlerRootView,\n} from 'react-native-gesture-handler'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context'\n\nimport type { ButtonSlots } from '../../button/slots'\nimport type { ModalOpenProps, ModalTrigger } from '../../modal'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { ButtonSlotContext } from '../../button/slots'\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport { useMessages } from '../../i18n/provider'\nimport {\n insetsOf,\n ModalWindow,\n NO_INSETS,\n panelRoleOf,\n useModalState,\n useModalTrigger,\n} from '../../modal'\nimport { usePressFeedback } from '../../press'\nimport { refsOf } from '../../ref'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The bottom sheets and side sheets spec pages' modal sheets, as kanso-ui's\n// Sheet draws them: one component, which is a bottom sheet in a compact\n// window, below 600dp, and a side sheet from the medium window up. Both sit on\n// surface container low at the first elevation level, over the scrim. The\n// bottom sheet spans the window, with the 28dp corner on its top two corners,\n// and stops 72dp short of the window's top, the page's top margin, so a long\n// body scrolls. The side sheet is 400dp wide and as tall as the window, along\n// the end edge, with the 16dp corner on its two start corners, and turns over\n// with the layout under right-to-left.\n//\n// **The bottom sheet drags**, which web's does not: the spec page draws a\n// sheet that is dragged between heights and swiped down to go, and web\n// records leaving it out as a departure that native need not repeat. A sheet\n// taller than half the window opens at half its height, as Android's modal\n// bottom sheet does, and is dragged up to the whole of it and back; one no\n// taller opens whole. `initialHeight=\"whole\"` opens one with two heights at\n// the higher, as web's sheet always opens, for a sheet whose actions are what\n// it is opened for, such as a form's save; the handle and the drag still take\n// it down to half from there. Let go, it settles on the nearest of those\n// heights, or one height on in the direction of a fling, and below the lowest\n// it goes, unless `isDismissable` is false, which holds it at the lowest. The\n// drag is Gesture Handler's pan, through the builder API both its 2.x and its\n// 3 export. While the sheet is at half height its body does not scroll, so a\n// drag on it raises the sheet; once whole, a body with more than it can show\n// scrolls, and the sheet is dragged by the handle, header and actions. At\n// half height the actions are below the fold, where the drag brings them.\n//\n// **The handle is a control where the sheet has two heights**, as Android's\n// drag handle is: a press moves the sheet to the other one, and it says which\n// it is at as expanded or collapsed. It takes the press feedback every control\n// does, over a 48dp target, and is named \"Drag handle\" in the `I18nProvider`'s\n// locale, or the device's outside one, unless `aria-label` says otherwise. A sheet with one height has nothing for\n// it to do, and draws it as web does, as a mark the screen reader skips. The\n// side sheet draws no handle.\n//\n// **It is drawn in a React Native `Modal`**, through src/modal, as `Dialog`\n// is, so it keeps the `ThemeScope` around it, hosts its own overlays, and\n// takes its scrim, its back gesture and its focus handling from there. The\n// sheet's own panel is a Gesture Handler root, which Android needs for a\n// gesture inside a `Modal`'s window.\n//\n// **It animates out as well as in**, from the motion tokens: it arrives from\n// its edge over the medium duration on the emphasised decelerating curve and\n// leaves over the short one on the accelerating curve, while the scrim fades\n// on the standard one. Web only animates in, since React Aria keeps a closing\n// surface mounted only while a CSS animation runs. The side sheet fades as it\n// travels, as web's does; the bottom sheet does not, since its position is\n// also the drag's. Under reduced motion the sheet appears and leaves at once,\n// and the scrim still fades.\n//\n// **Its content sits inside the safe area** while its fill runs on under it:\n// the bottom sheet's above the home indicator and inside the side insets of a\n// phone held sideways, and the side sheet's under the status bar and over the\n// home indicator, inside the inset on its own edge.\n\n// The side sheet's width, web's and the side sheets page's.\nconst SIDE_WIDTH = 400\n\n// The bottom sheet's top margin once whole, the page's 72dp.\nconst TOP_MARGIN = 72\n\n// How much of the window a sheet with two heights shows at the lower one.\nconst PARTIAL = 0.5\n\n// How far a press travels before it is a drag, so a tap on the sheet's\n// content stays a tap.\nconst DRAG_SLOP = 8\n\n// A release faster than this, in dp a second, is a fling, which moves the\n// sheet one height on rather than to the nearest. Android's bottom sheet\n// takes the same speed as the one that hides it.\nconst FLING = 500\n\n// The handle's bar and the room above and below it, web's 32 by 4 with 22dp\n// either side, which with 8dp at its ends makes the 48dp target.\nconst BAR_WIDTH = 32\nconst BAR_HEIGHT = 4\nconst BAR_SPACE = 22\nconst BAR_SIDE = 8\n\nconst stylesOf = themedStyles(\n ({ colors, radii, shadows, spacing }: ResolvedTheme) =>\n StyleSheet.create({\n // The handle's bar, on on-surface variant.\n bar: {\n backgroundColor: colors.onSurfaceVariant,\n borderRadius: radii.pill,\n height: BAR_HEIGHT,\n width: BAR_WIDTH,\n },\n // The body's padding, web's: 24dp at the sides, 16dp at either end\n // and between whatever it holds.\n body: {\n gap: spacing.lg,\n paddingHorizontal: spacing.xl,\n paddingVertical: spacing.lg,\n },\n // The text a body is handed as a string, in body medium on on-surface\n // variant, as the stories on web set theirs.\n bodyText: {\n color: colors.onSurfaceVariant,\n },\n // Both sheets' container, whose corners clip the body's scroll.\n container: {\n backgroundColor: colors.surfaceContainerLow,\n boxShadow: shadows.elevation1,\n overflow: 'hidden',\n },\n // The bottom sheet's container: the window's width, rounded on top.\n containerBottom: {\n borderTopLeftRadius: radii.xl,\n borderTopRightRadius: radii.xl,\n width: '100%',\n },\n // The side sheet's container, as tall as the window and rounded on the\n // corners that face the screen it covers.\n containerSide: {\n borderBottomStartRadius: radii.lg,\n borderTopStartRadius: radii.lg,\n flex: 1,\n },\n // The actions, web's: leading, wrapping onto another row when they do\n // not fit on one, over a divider, in a bar 72dp tall at least.\n footer: {\n alignItems: 'center',\n borderTopColor: colors.outlineVariant,\n borderTopWidth: 1,\n flexDirection: 'row',\n flexShrink: 0,\n flexWrap: 'wrap',\n gap: spacing.sm,\n justifyContent: 'flex-start',\n minHeight: 72,\n paddingBottom: spacing.xl,\n paddingHorizontal: spacing.xl,\n paddingTop: spacing.lg,\n },\n // The handle's 48dp target, centred along the sheet's top edge.\n handle: {\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: radii.pill,\n flexShrink: 0,\n paddingHorizontal: BAR_SIDE,\n paddingVertical: BAR_SPACE,\n },\n // The headline and whatever shares its row, a close button for one,\n // over a divider.\n header: {\n alignItems: 'center',\n borderBottomColor: colors.outlineVariant,\n borderBottomWidth: 1,\n flexDirection: 'row',\n flexShrink: 0,\n gap: spacing.md,\n justifyContent: 'space-between',\n paddingHorizontal: spacing.xl,\n paddingVertical: spacing.sm,\n },\n // Where each sheet sits in the window. The panel is a Gesture Handler\n // root of its own, the size of the sheet, so a press beside it reaches\n // the scrim.\n rootBottom: {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n },\n rootSide: {\n bottom: 0,\n end: 0,\n maxWidth: '100%',\n position: 'absolute',\n top: 0,\n width: SIDE_WIDTH,\n },\n // The headline gives way to whatever shares its row.\n title: {\n color: colors.onSurfaceVariant,\n flexShrink: 1,\n minWidth: 0,\n },\n }),\n)\n\n// What the content's parts read: which sheet is drawn, whether it is at its\n// whole height, the drag a scrolling body holds off, and the headline.\ntype SheetLayout = {\n readonly bottom: boolean\n readonly expanded: boolean\n // Gesture Handler 3 deprecates its gesture builder, and this type, for hooks\n // that version 2 does not have, and the peer range admits both, so the sheet\n // keeps the builder while it does.\n // oxlint-disable-next-line typescript/no-deprecated -- see above\n readonly pan: GestureType\n readonly setTitle: (node: HostInstance | null) => void\n readonly titleId: string\n /** What a press on the handle does, where the sheet has two heights. */\n readonly toggle: (() => void) | undefined\n}\n\nconst SheetLayoutContext = createContext<null | SheetLayout>(null)\nconst SheetTriggerContext = createContext<ModalTrigger | null>(null)\n\ntype SheetBodyProps = ScrollViewProps & {\n readonly ref?: Ref<ComponentRef<typeof ScrollView>>\n}\n\ntype SheetContentProps = Omit<ViewProps, 'children' | 'style'> &\n SheetOpenProps & {\n readonly children?: ReactNode\n /**\n * The height a bottom sheet with two heights opens at each time: `half`,\n * where its content stays in reach of a drag, or `whole`, where its\n * actions are in view from the start. A sheet with one height, and a side\n * sheet, open whole whatever this says.\n * @default 'half'\n */\n readonly initialHeight?: 'half' | 'whole'\n /**\n * Whether a press on the scrim, outside the sheet, and a swipe down past\n * its lowest height close it. Android's back gesture is\n * `isKeyboardDismissDisabled`'s, and this says nothing about it.\n * @default true\n */\n readonly isDismissable?: boolean\n /**\n * Keeps Android's back gesture, VoiceOver's escape gesture, and Escape on\n * web, from closing the sheet.\n * @default false\n */\n readonly isKeyboardDismissDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n }\n\ntype SheetHandleProps = Omit<ViewProps, 'children'> & {\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\ntype SheetOpenProps = ModalOpenProps & {\n /** Whether the sheet starts open, when it keeps its own state. */\n readonly defaultOpen?: boolean\n /** Whether the sheet is open, when the call site holds the state. */\n readonly isOpen?: boolean\n /** Called with the new state as the sheet opens or closes. */\n readonly onOpenChange?: (isOpen: boolean) => void\n}\n\ntype SheetPartProps = ViewProps & {\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\ntype SheetProps = SheetOpenProps & {\n /** The button that opens the sheet, and `Sheet.Content`. */\n readonly children?: ReactNode\n}\n\ntype SheetTitleProps = Omit<TextProps, 'role'> & {\n readonly ref?: Ref<HostInstance>\n}\n\n// What the window draws once the sheet is open, and what it needs from the\n// part that keeps the open state.\ntype SheetWindowProps = Omit<\n SheetContentProps,\n 'defaultOpen' | 'isOpen' | 'onOpenChange'\n> & {\n readonly close: () => void\n readonly isDismissable: boolean\n readonly isKeyboardDismissDisabled: boolean\n readonly isOpen: boolean\n readonly setPresent: (present: boolean) => void\n readonly slots: ButtonSlots\n}\n\n// The heights a bottom sheet rests at, as how far its panel is moved down:\n// whole, at half the window where it is taller than that, and gone.\ntype Stops = {\n /** The lower height, where the sheet has two. */\n readonly partial: null | number\n /** Every height a release can settle on, highest first. */\n readonly settles: readonly number[]\n}\n\n// The bottom sheet's room and padding: no taller than the window less the top\n// margin, or less the status bar where that is the taller, and its content\n// above the home indicator and inside the side insets.\nfunction bottomBoundsOf(insets: EdgeInsets, height: number): ViewStyle {\n return {\n ...insetsOf(insets),\n maxHeight: height - Math.max(TOP_MARGIN, insets.top),\n paddingTop: 0,\n }\n}\n\n/**\n * Where a bottom sheet let go comes to rest: one height on in the direction of\n * a fling, and the nearest height otherwise. Heights are how far the panel is\n * moved down, highest first, and the highest is always the whole sheet, 0.\n */\nfunction settleOf(at: number, velocity: number, settles: readonly number[]) {\n if (velocity > FLING) {\n return settles.find((stop) => stop > at) ?? settles.at(-1) ?? 0\n }\n\n if (velocity < -FLING) {\n return settles.findLast((stop) => stop < at) ?? 0\n }\n\n return settles.reduce(\n (nearest, stop) =>\n Math.abs(stop - at) < Math.abs(nearest - at) ? stop : nearest,\n 0,\n )\n}\n\n/**\n * A modal sheet along an edge of the screen, the bottom sheets and side sheets\n * spec pages' modal sheets, paired by window size as kanso-ui's are: a bottom\n * sheet in a compact window, dragged between heights and swiped down to go,\n * and a side sheet along the end edge from the medium window up. Pass\n * `isOpen` with `onOpenChange` to hold the open state, or `defaultOpen` to let\n * it keep its own.\n *\n * ```tsx\n * <Sheet>\n * <Button>Open</Button>\n * <Sheet.Content>\n * <Sheet.Handle />\n * <Sheet.Header>\n * <Sheet.Title>Headline</Sheet.Title>\n * </Sheet.Header>\n * <Sheet.Body>Supporting text</Sheet.Body>\n * <Sheet.Footer>\n * <Button slot=\"close\">Done</Button>\n * </Sheet.Footer>\n * </Sheet.Content>\n * </Sheet>\n * ```\n *\n * Composed rather than configured by props, as web's is. A `Button`,\n * `IconButton` or `Chip` inside `Sheet` and outside its content opens it, and\n * a button given `slot=\"close\"` anywhere inside the content closes it. A\n * sheet nothing on the screen opens leaves `Sheet` out and passes `isOpen`\n * and `onOpenChange` to `Sheet.Content` instead.\n */\nfunction Sheet({ children, defaultOpen, isOpen, onOpenChange }: SheetProps) {\n const { context, slots } = useModalTrigger({\n defaultOpen,\n isOpen,\n onOpenChange,\n })\n\n return (\n <SheetTriggerContext value={context}>\n <ButtonSlotContext value={slots}>{children}</ButtonSlotContext>\n </SheetTriggerContext>\n )\n}\n\n/**\n * What the sheet shows, as a body that scrolls when its content runs past the\n * room it has. A string is drawn in body medium on on-surface variant;\n * anything else draws itself. `style`, `ref` and `testID` land on the\n * `ScrollView`.\n *\n * A body its content runs past takes focus, as web's is a tab stop, so a\n * keyboard can scroll it when nothing inside it takes focus; a call site's\n * own `focusable` still wins. A bottom sheet's body scrolls only once the\n * sheet is at its whole height, and holds the sheet's drag off while it does.\n */\nfunction SheetBody({\n children,\n contentContainerStyle,\n onContentSizeChange,\n onLayout,\n scrollEnabled = true,\n ...props\n}: SheetBodyProps) {\n const layout = useLayout('Sheet.Body')\n const styles = stylesOf(useTheme())\n const text = useTypeRole('bodyMedium')\n const [content, setContent] = useState(0)\n const [room, setRoom] = useState(0)\n const measureContent = useCallback(\n (width: number, height: number) => {\n setContent(height)\n onContentSizeChange?.(width, height)\n },\n [onContentSizeChange],\n )\n const measureRoom = useCallback(\n (event: LayoutChangeEvent) => {\n setRoom(event.nativeEvent.layout.height)\n onLayout?.(event)\n },\n [onLayout],\n )\n const scrolls = scrollEnabled && layout.expanded\n const overflows = content > room\n // oxlint-disable-next-line react/capitalized-calls, typescript/no-deprecated -- a builder named after its gesture, not a component; see SheetLayout\n const native = Gesture.Native()\n .enabled(scrolls && overflows)\n .blocksExternalGesture(layout.pan)\n\n return (\n <GestureDetector gesture={native}>\n <ScrollView\n focusable={scrolls && overflows}\n onContentSizeChange={measureContent}\n onLayout={measureRoom}\n {...props}\n contentContainerStyle={composeStyles<ViewStyle>(\n styles.body,\n contentContainerStyle,\n )}\n scrollEnabled={scrolls}\n >\n {typeof children === 'string' ? (\n <NativeText style={composeStyles<TextStyle>(text, styles.bodyText)}>\n {children}\n </NativeText>\n ) : (\n children\n )}\n </ScrollView>\n </GestureDetector>\n )\n}\n\n/**\n * The sheet itself, and the scrim behind it. Everything the sheet shows goes\n * in here; the button that opens it stays outside it.\n *\n * Inside `Sheet`, the open state is the trigger's. On its own it is this\n * part's: `isOpen` with `onOpenChange` holds it, and a `slot=\"close\"` button,\n * the scrim, the swipe and the back gesture all report through\n * `onOpenChange`. `style`, `ref` and `testID` land on the container, and\n * `testID` names the drag `<testID>-drag` for Gesture Handler's test helpers.\n */\nfunction SheetContent({\n defaultOpen,\n isDismissable = true,\n isKeyboardDismissDisabled = false,\n isOpen,\n onOpenChange,\n ...props\n}: SheetContentProps) {\n const outer = use(SheetTriggerContext)\n const { close, present, setPresent, slots, state } = useModalState(outer, {\n defaultOpen,\n isOpen,\n onOpenChange,\n })\n\n if (!present) {\n return null\n }\n\n return (\n <SheetWindow\n {...props}\n close={close}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={state.isOpen}\n setPresent={setPresent}\n slots={slots}\n />\n )\n}\n\n/**\n * The sheet's actions, leading and wrapping onto another row when they do not\n * fit on one, over a divider. On a bottom sheet at half height they are below\n * the fold until the sheet is raised, so a sheet opened for them takes\n * `initialHeight=\"whole\"` on `Sheet.Content`. `style`, `ref` and `testID`\n * land on its view.\n */\nfunction SheetFooter({ style, ...props }: SheetPartProps) {\n useLayout('Sheet.Footer')\n const styles = stylesOf(useTheme())\n\n return (\n <View {...props} style={composeStyles<ViewStyle>(styles.footer, style)} />\n )\n}\n\n/**\n * The bottom sheet's drag handle, a 32 by 4dp bar centred along its top edge.\n * Where the sheet has two heights it is a button moving it to the other one,\n * named \"Drag handle\" in the `I18nProvider`'s locale, or the device's outside\n * one, unless `aria-label` says otherwise; elsewhere it is a mark a screen reader skips. A side sheet draws\n * none. `style`, `ref` and `testID` land on its view.\n */\nfunction SheetHandle({\n 'aria-label': label,\n style,\n ...props\n}: SheetHandleProps) {\n const layout = useLayout('Sheet.Handle')\n const theme = useTheme()\n const styles = stylesOf(theme)\n const { colors, radii } = theme\n const feedback = usePressFeedback({\n color: colors.onSurfaceVariant,\n corners: { borderRadius: radii.pill },\n })\n const { toggle } = layout\n const messages = useMessages()\n\n if (!layout.bottom) {\n return null\n }\n\n if (toggle === undefined) {\n return (\n <View\n aria-hidden\n {...props}\n style={composeStyles<ViewStyle>(styles.handle, style)}\n >\n <View style={styles.bar} />\n </View>\n )\n }\n\n return (\n <Pressable\n aria-expanded={layout.expanded}\n aria-label={label ?? messages.dragHandle}\n role=\"button\"\n {...props}\n {...feedback.handlers}\n onPress={toggle}\n style={composeStyles<ViewStyle>(styles.handle, feedback.ring, style)}\n >\n {feedback.layer}\n <View style={styles.bar} />\n </Pressable>\n )\n}\n\n/**\n * The sheet's header: its `Sheet.Title`, and anything beside it, such as a\n * close button, over a divider. `style`, `ref` and `testID` land on its view.\n */\nfunction SheetHeader({ style, ...props }: SheetPartProps) {\n useLayout('Sheet.Header')\n const styles = stylesOf(useTheme())\n\n return (\n <View {...props} style={composeStyles<ViewStyle>(styles.header, style)} />\n )\n}\n\n/**\n * Names the sheet: the container is labelled by it, and a screen reader is\n * sent to it once the sheet shows. In title large on on-surface variant.\n * `style`, `ref` and `testID` land on React Native's own Text.\n */\nfunction SheetTitle({ ref, style, ...props }: SheetTitleProps) {\n const layout = useLayout('Sheet.Title')\n const styles = stylesOf(useTheme())\n const role = useTypeRole('titleLarge')\n\n return (\n <NativeText\n {...props}\n nativeID={layout.titleId}\n ref={refsOf(layout.setTitle, ref)}\n role=\"heading\"\n style={composeStyles<TextStyle>(role, styles.title, style)}\n />\n )\n}\n\n/**\n * The open sheet, mounted from the moment it opens until its exit has run, so\n * each opening starts from its edge and at its first height.\n */\nfunction SheetWindow({\n children,\n close,\n initialHeight = 'half',\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n onLayout,\n setPresent,\n slots,\n style,\n testID,\n ...props\n}: SheetWindowProps) {\n const styles = stylesOf(useTheme())\n const insets = use(SafeAreaInsetsContext) ?? NO_INSETS\n const { height } = useWindowDimensions()\n const bottom = useWindowSizeClass() === 'compact'\n const titleId = useId()\n const [title, setTitle] = useState<HostInstance | null>(null)\n // The panel's height as laid out, before any drag moves it, and whether a\n // sheet with two heights is at the higher one.\n const [full, setFull] = useState<null | number>(null)\n const [expanded, setExpanded] = useState(initialHeight === 'whole')\n const stops = stopsOf(bottom, full, height, isDismissable)\n const twoHeights = stops.partial !== null\n const rest = stops.partial !== null && !expanded ? stops.partial : 0\n const motion = useSheetMotion({ bottom, full, isOpen, rest, setPresent })\n const pan = useSheetDrag({\n close,\n enabled: bottom && isOpen && stops.settles.length > 1,\n expanded,\n full,\n isDismissable,\n offset: motion.offset,\n rest,\n setExpanded,\n stops,\n testID,\n })\n const toggle = useCallback(() => {\n setExpanded((was) => !was)\n }, [])\n const layout = useMemo<SheetLayout>(\n () => ({\n bottom,\n expanded: !twoHeights || expanded,\n pan,\n setTitle,\n titleId,\n toggle: twoHeights ? toggle : undefined,\n }),\n [bottom, expanded, pan, titleId, toggle, twoHeights],\n )\n const measure = useCallback(\n (event: LayoutChangeEvent) => {\n setFull(event.nativeEvent.layout.height)\n onLayout?.(event)\n },\n [onLayout],\n )\n const labelledBy = title === null ? undefined : titleId\n\n return (\n <ModalWindow\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n labelledBy={labelledBy}\n onClose={close}\n onScrimPress={isDismissable && isOpen ? close : undefined}\n scrim={motion.scrim}\n title={title}\n >\n <GestureHandlerRootView\n style={bottom ? styles.rootBottom : styles.rootSide}\n >\n <GestureDetector gesture={pan}>\n <Animated.View\n {...panelRoleOf('dialog', labelledBy)}\n onAccessibilityEscape={\n isKeyboardDismissDisabled ? undefined : close\n }\n {...props}\n onLayout={measure}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.container,\n bottom ? styles.containerBottom : styles.containerSide,\n bottom ? bottomBoundsOf(insets, height) : sideInsetsOf(insets),\n motion.panel,\n style,\n )}\n testID={testID}\n >\n <SheetLayoutContext value={layout}>\n <ButtonSlotContext value={slots}>{children}</ButtonSlotContext>\n </SheetLayoutContext>\n </Animated.View>\n </GestureDetector>\n </GestureHandlerRootView>\n </ModalWindow>\n )\n}\n\n// The side sheet's padding: its content under the status bar, over the home\n// indicator and inside the inset on its own edge. Its start edge faces the\n// screen it covers, which has none.\nfunction sideInsetsOf(insets: EdgeInsets): ViewStyle {\n return { ...insetsOf(insets), paddingStart: 0 }\n}\n\nfunction stopsOf(\n bottom: boolean,\n full: null | number,\n height: number,\n isDismissable: boolean,\n): Stops {\n if (!bottom || full === null) {\n return { partial: null, settles: [0] }\n }\n\n const lower = full - height * PARTIAL\n const partial = lower > 0 ? lower : null\n\n return {\n partial,\n settles: [\n 0,\n ...(partial === null ? [] : [partial]),\n ...(isDismissable ? [full] : []),\n ],\n }\n}\n\nfunction useLayout(part: string) {\n const layout = use(SheetLayoutContext)\n\n if (layout === null) {\n throw new Error(`${part} is drawn inside Sheet.Content.`)\n }\n\n return layout\n}\n\n/**\n * The bottom sheet's drag. The panel follows the finger, no higher than its\n * whole height and no lower than gone, or than its lowest height when it may\n * not be dismissed, and once let go it settles where `settleOf` says: below\n * the lowest height it closes, and at another height it moves the sheet there.\n */\nfunction useSheetDrag({\n close,\n enabled,\n expanded,\n full,\n isDismissable,\n offset,\n rest,\n setExpanded,\n stops,\n testID,\n}: {\n readonly close: () => void\n readonly enabled: boolean\n readonly expanded: boolean\n readonly full: null | number\n readonly isDismissable: boolean\n readonly offset: SharedValue<number>\n readonly rest: number\n readonly setExpanded: (expanded: boolean) => void\n readonly stops: Stops\n readonly testID: string | undefined\n}) {\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n // Where the panel stood when the drag was recognised. Gesture Handler\n // measures its translation from there, past the slop.\n const origin = useSharedValue(0)\n const lowest = stops.settles.at(-1) ?? 0\n\n function follow(translation: number) {\n offset.set(Math.min(lowest, Math.max(0, origin.get() + translation)))\n }\n\n function settle(target: number) {\n if (isDismissable && target === full) {\n close()\n return\n }\n\n const higher = target === 0\n if (stops.partial !== null && higher !== expanded) {\n setExpanded(higher)\n return\n }\n\n offset.set(\n reduceMotion\n ? target\n : withTiming(target, {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasizedDecelerate),\n }),\n )\n }\n\n // oxlint-disable-next-line react/capitalized-calls, typescript/no-deprecated -- a builder named after its gesture, not a component; see SheetLayout\n const pan = Gesture.Pan()\n .activeOffsetY([-DRAG_SLOP, DRAG_SLOP])\n .enabled(enabled)\n .runOnJS(true)\n .onStart(({ translationY }) => {\n origin.set(offset.get())\n follow(translationY)\n })\n .onUpdate(({ translationY }) => {\n follow(translationY)\n })\n .onEnd(({ velocityY }, success) => {\n settle(success ? settleOf(offset.get(), velocityY, stops.settles) : rest)\n })\n\n return testID === undefined ? pan : pan.withTestId(`${testID}-drag`)\n}\n\n/**\n * The scrim's and the panel's motion, and the timer that unmounts the sheet\n * once its exit has run. The bottom sheet's position is how far its panel is\n * moved down, which the drag sets too; it starts below the window and rises\n * to its height once that is measured. The side sheet's is how far it has\n * come in from its edge, which is the end edge, and so the left one under\n * right-to-left.\n */\nfunction useSheetMotion({\n bottom,\n full,\n isOpen,\n rest,\n setPresent,\n}: {\n readonly bottom: boolean\n readonly full: null | number\n readonly isOpen: boolean\n readonly rest: number\n readonly setPresent: (present: boolean) => void\n}) {\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n const { height } = useWindowDimensions()\n const offset = useSharedValue(height)\n const shown = useSharedValue(0)\n const scrim = useSharedValue(0)\n // A translation is not mirrored under a right-to-left layout, though the\n // side sheet's edge is, so it travels the other way there.\n const direction = I18nManager.isRTL ? -1 : 1\n\n useEffect(() => {\n const fade = {\n duration: motion.durationShort2,\n easing: Easing.bezier(...motion.easingStandard),\n }\n const enter = {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasizedDecelerate),\n }\n const exit = {\n duration: motion.durationShort3,\n easing: Easing.bezier(...motion.easingEmphasizedAccelerate),\n }\n\n if (isOpen) {\n scrim.set(withTiming(1, fade))\n if (!bottom) {\n shown.set(reduceMotion ? 1 : withTiming(1, enter))\n return undefined\n }\n if (full === null) {\n return undefined\n }\n // It rises from its own height below where it rests, not from the\n // bottom of the window, so it shows from the first frame.\n if (offset.get() > full) {\n offset.set(full)\n }\n offset.set(reduceMotion ? rest : withTiming(rest, enter))\n return undefined\n }\n\n scrim.set(withTiming(0, fade))\n if (bottom) {\n const gone = full ?? height\n offset.set(reduceMotion ? gone : withTiming(gone, exit))\n } else {\n shown.set(reduceMotion ? 0 : withTiming(0, exit))\n }\n const timer = setTimeout(\n () => {\n setPresent(false)\n },\n reduceMotion\n ? motion.durationShort2\n : Math.max(motion.durationShort2, motion.durationShort3),\n )\n\n return () => {\n clearTimeout(timer)\n }\n }, [\n bottom,\n full,\n height,\n isOpen,\n motion,\n offset,\n reduceMotion,\n rest,\n scrim,\n setPresent,\n shown,\n ])\n\n return {\n offset,\n panel: useAnimatedStyle(() => {\n 'worklet'\n if (bottom) {\n return { transform: [{ translateY: offset.get() }] }\n }\n\n const progress = shown.get()\n return {\n opacity: progress,\n transform: [{ translateX: (1 - progress) * SIDE_WIDTH * direction }],\n }\n }),\n scrim: useAnimatedStyle(() => {\n 'worklet'\n return { opacity: scrim.get() }\n }),\n }\n}\n\nSheet.Body = SheetBody\nSheet.Content = SheetContent\nSheet.Footer = SheetFooter\nSheet.Handle = SheetHandle\nSheet.Header = SheetHeader\nSheet.Title = SheetTitle\n\nexport {\n Sheet,\n SheetBody,\n SheetContent,\n SheetFooter,\n SheetHandle,\n SheetHeader,\n SheetTitle,\n}\nexport type {\n SheetBodyProps,\n SheetContentProps,\n SheetHandleProps,\n SheetPartProps,\n SheetProps,\n SheetTitleProps,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4HA,MAAM2D,aAAa;AAGnB,MAAMC,aAAa;AAGnB,MAAMC,UAAU;AAIhB,MAAMC,YAAY;AAKlB,MAAMC,QAAQ;AAId,MAAMC,YAAY;AAClB,MAAMC,aAAa;AACnB,MAAMC,YAAY;AAClB,MAAMC,WAAW;AAEjB,MAAMC,WAAWX,cACd,EAAEY,QAAQC,OAAOC,SAASC,cACzB7C,WAAW8C,OAAO;CAEhBC,KAAK;EACHC,iBAAiBN,OAAOO;EACxBC,cAAcP,MAAMQ;EACpBC,QAAQd;EACRe,OAAOhB;CACT;CAGAiB,MAAM;EACJC,KAAKV,QAAQW;EACbC,mBAAmBZ,QAAQa;EAC3BC,iBAAiBd,QAAQW;CAC3B;CAGAI,UAAU,EACRC,OAAOnB,OAAOO,iBAChB;CAEAa,WAAW;EACTd,iBAAiBN,OAAOqB;EACxBC,WAAWpB,QAAQqB;EACnBC,UAAU;CACZ;CAEAC,iBAAiB;EACfC,qBAAqBzB,MAAMe;EAC3BW,sBAAsB1B,MAAMe;EAC5BL,OAAO;CACT;CAGAiB,eAAe;EACbC,yBAAyB5B,MAAMa;EAC/BgB,sBAAsB7B,MAAMa;EAC5BiB,MAAM;CACR;CAGAC,QAAQ;EACNC,YAAY;EACZC,gBAAgBlC,OAAOmC;EACvBC,gBAAgB;EAChBC,eAAe;EACfC,YAAY;EACZC,UAAU;EACV1B,KAAKV,QAAQqC;EACbC,gBAAgB;EAChBC,WAAW;EACXC,eAAexC,QAAQa;EACvBD,mBAAmBZ,QAAQa;EAC3B4B,YAAYzC,QAAQW;CACtB;CAEA+B,QAAQ;EACNZ,YAAY;EACZa,WAAW;EACXtC,cAAcP,MAAMQ;EACpB6B,YAAY;EACZ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,IAmDPE,EAYF;CAIQ,MAAAC,KAAAvJ,uBAAiB;EAAA;EAEtB,IAAIsF,QAAM,OACD,EAAAuM,WAAa,CAAC,EAAAC,YAAcxE,OAAMqC,IAAK,EAAE,CAAC,EAAE;EAGrD,MAAAoC,WAAiBhB,MAAKpB,IAAK;EAAC,OACrB;GAAAqC,SACID;GAAQF,WACN,CAAC,EAAAI,aAAe,IAAIF,YAAYvQ,aAAawP,UAAU,CAAC;EACrE;CAAC,CACF;CACM,MAAAnG,KAAA7K,uBAAiB;EAAA;EAAA,OAEf,EAAAgS,SAAWhE,MAAK2B,IAAK,EAAE;CAAC,CAChC;CAAC,IAAAvE;CAAA,IAAAlC,EAAA,QAAAoE,UAAApE,EAAA,QAAAK,MAAAL,EAAA,QAAA2B,IAAA;EAjBGO,KAAA;GAAAkC;GAAAkB,OAEEjF;GAWLyE,OACKnD;EAIT;EAAC3B,EAAA,MAAAoE;EAAApE,EAAA,MAAAK;EAAAL,EAAA,MAAA2B;EAAA3B,EAAA,MAAAkC;CAAA,OAAAA,KAAAlC,EAAA;CAAA,OAlBMkC;AAkBN;AAGHpC,MAAMkJ,OAAO1I;AACbR,MAAMmJ,UAAU1G;AAChBzC,MAAMoJ,SAASxG;AACf5C,MAAMqJ,SAASxG;AACf7C,MAAMsJ,SAAS/F;AACfvD,MAAMuJ,QAAQ/F"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","HostInstance","LayoutChangeEvent","ScrollViewProps","StyleProp","TextProps","TextStyle","ViewProps","ViewStyle","GestureType","AnimatedStyle","SharedValue","EdgeInsets","createContext","use","useCallback","useEffect","useId","useMemo","useState","I18nManager","Text","NativeText","Pressable","ScrollView","StyleSheet","useWindowDimensions","View","Gesture","GestureDetector","GestureHandlerRootView","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","SafeAreaInsetsContext","ButtonSlots","ModalOpenProps","ModalTrigger","ResolvedTheme","ButtonSlotContext","useWindowSizeClass","useMessages","insetsOf","ModalWindow","NO_INSETS","panelRoleOf","useModalState","useModalTrigger","useKeyboardInset","usePressFeedback","refsOf","useTheme","composeStyles","themedStyles","useTypeRole","SIDE_WIDTH","TOP_MARGIN","PARTIAL","DRAG_SLOP","FLING","BAR_WIDTH","BAR_HEIGHT","BAR_SPACE","BAR_SIDE","stylesOf","colors","radii","shadows","spacing","create","bar","backgroundColor","onSurfaceVariant","borderRadius","pill","height","width","body","gap","lg","paddingHorizontal","xl","paddingVertical","bodyText","color","container","surfaceContainerLow","boxShadow","elevation1","overflow","containerBottom","borderTopLeftRadius","borderTopRightRadius","containerSide","borderBottomStartRadius","borderTopStartRadius","flex","footer","alignItems","borderTopColor","outlineVariant","borderTopWidth","flexDirection","flexShrink","flexWrap","sm","justifyContent","minHeight","paddingBottom","paddingTop","handle","alignSelf","header","borderBottomColor","borderBottomWidth","md","rootBottom","bottom","left","position","right","rootSide","end","maxWidth","top","title","minWidth","SheetLayout","expanded","pan","setTitle","node","titleId","toggle","SheetLayoutContext","SheetTriggerContext","SheetBodyProps","ref","SheetContentProps","Omit","SheetOpenProps","children","initialHeight","isDismissable","isKeyboardDismissDisabled","style","SheetHandleProps","defaultOpen","isOpen","onOpenChange","SheetPartProps","SheetProps","SheetTitleProps","SheetWindowProps","close","setPresent","present","slots","Stops","partial","settles","bottomBoundsOf","insets","keyboard","maxHeight","Math","max","settleOf","at","velocity","find","stop","findLast","reduce","nearest","abs","Sheet","t0","$","_c","t1","context","t2","t3","SheetBody","contentContainerStyle","onContentSizeChange","onLayout","props","scrollEnabled","undefined","layout","useLayout","styles","text","content","setContent","room","setRoom","measureContent","event","nativeEvent","measureRoom","scrolls","overflows","t4","Native","enabled","blocksExternalGesture","native","T0","T1","t5","t6","t7","t8","t9","SheetContent","outer","state","SheetFooter","SheetHandle","label","theme","corners","feedback","messages","dragHandle","handlers","ring","layer","SheetHeader","SheetTitle","role","SheetWindow","testID","full","setFull","setExpanded","stopsOf","stops","twoHeights","rest","motion","useSheetMotion","length","offset","useSheetDrag","Symbol","for","_temp","t10","measure","labelledBy","t11","t12","scrim","t13","T2","t14","t15","t16","t17","sideInsetsOf","panel","t18","t19","t20","t21","t22","t23","was","paddingStart","lower","part","Error","reduceMotion","origin","lowest","follow","translation","set","min","get","settle","target","higher","duration","durationMedium1","easing","bezier","easingEmphasizedDecelerate","success","velocityY","Pan","activeOffsetY","runOnJS","onStart","translationY","onUpdate","translationY_0","onEnd","withTestId","shown","direction","isRTL","durationShort2","durationShort3","easingEmphasizedAccelerate","easingStandard","fade","enter","exit","gone","timer","setTimeout","clearTimeout","transform","translateY","progress","opacity","translateX","Body","Content","Footer","Handle","Header","Title","_c","NativeText"],"sources":["../../../src/components/sheet/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n HostInstance,\n LayoutChangeEvent,\n ScrollViewProps,\n StyleProp,\n TextProps,\n TextStyle,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { GestureType } from 'react-native-gesture-handler'\nimport type { AnimatedStyle, SharedValue } from 'react-native-reanimated'\nimport type { EdgeInsets } from 'react-native-safe-area-context'\n\nimport {\n createContext,\n use,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react'\nimport {\n I18nManager,\n Text as NativeText,\n Pressable,\n ScrollView,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport {\n Gesture,\n GestureDetector,\n GestureHandlerRootView,\n} from 'react-native-gesture-handler'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context'\n\nimport type { ButtonSlots } from '../../button/slots'\nimport type { ModalOpenProps, ModalTrigger } from '../../modal'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { ButtonSlotContext } from '../../button/slots'\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport { useMessages } from '../../i18n/provider'\nimport {\n insetsOf,\n ModalWindow,\n NO_INSETS,\n panelRoleOf,\n useModalState,\n useModalTrigger,\n} from '../../modal'\nimport { useKeyboardInset } from '../../overlay/keyboard'\nimport { usePressFeedback } from '../../press'\nimport { refsOf } from '../../ref'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The bottom sheets and side sheets spec pages' modal sheets, as kanso-ui's\n// Sheet draws them: one component, which is a bottom sheet in a compact\n// window, below 600dp, and a side sheet from the medium window up. Both sit on\n// surface container low at the first elevation level, over the scrim. The\n// bottom sheet spans the window, with the 28dp corner on its top two corners,\n// and stops 72dp short of the window's top, the page's top margin, so a long\n// body scrolls. The side sheet is 400dp wide and as tall as the window, along\n// the end edge, with the 16dp corner on its two start corners, and turns over\n// with the layout under right-to-left.\n//\n// **The bottom sheet drags**, which web's does not: the spec page draws a\n// sheet that is dragged between heights and swiped down to go, and web\n// records leaving it out as a departure that native need not repeat. A sheet\n// taller than half the window opens at half its height, as Android's modal\n// bottom sheet does, and is dragged up to the whole of it and back; one no\n// taller opens whole. `initialHeight=\"whole\"` opens one with two heights at\n// the higher, as web's sheet always opens, for a sheet whose actions are what\n// it is opened for, such as a form's save; the handle and the drag still take\n// it down to half from there. Let go, it settles on the nearest of those\n// heights, or one height on in the direction of a fling, and below the lowest\n// it goes, unless `isDismissable` is false, which holds it at the lowest. The\n// drag is Gesture Handler's pan, through the builder API both its 2.x and its\n// 3 export. While the sheet is at half height its body does not scroll, so a\n// drag on it raises the sheet; once whole, a body with more than it can show\n// scrolls, and the sheet is dragged by the handle, header and actions. At\n// half height the actions are below the fold, where the drag brings them.\n//\n// **The handle is a control where the sheet has two heights**, as Android's\n// drag handle is: a press moves the sheet to the other one, and it says which\n// it is at as expanded or collapsed. It takes the press feedback every control\n// does, over a 48dp target, and is named \"Drag handle\" in the `I18nProvider`'s\n// locale, or the device's outside one, unless `aria-label` says otherwise. A sheet with one height has nothing for\n// it to do, and draws it as web does, as a mark the screen reader skips. The\n// side sheet draws no handle.\n//\n// **It is drawn in a React Native `Modal`**, through src/modal, as `Dialog`\n// is, so it keeps the `ThemeScope` around it, hosts its own overlays, and\n// takes its scrim, its back gesture and its focus handling from there. The\n// sheet's own panel is a Gesture Handler root, which Android needs for a\n// gesture inside a `Modal`'s window.\n//\n// **It animates out as well as in**, from the motion tokens: it arrives from\n// its edge over the medium duration on the emphasised decelerating curve and\n// leaves over the short one on the accelerating curve, while the scrim fades\n// on the standard one. Web only animates in, since React Aria keeps a closing\n// surface mounted only while a CSS animation runs. The side sheet fades as it\n// travels, as web's does; the bottom sheet does not, since its position is\n// also the drag's. Under reduced motion the sheet appears and leaves at once,\n// and the scrim still fades.\n//\n// **Its content sits inside the safe area** while its fill runs on under it:\n// the bottom sheet's above the home indicator and inside the side insets of a\n// phone held sideways, and the side sheet's under the status bar and over the\n// home indicator, inside the inset on its own edge.\n//\n// **Its content stays above the software keyboard.** While one is up the\n// sheet pads its bottom by as much of the screen as the keyboard covers, in\n// place of the home indicator's inset, and a sheet with two heights rises\n// whole, so a field focused in it is not hidden behind the keyboard. On\n// Android a `Modal` reports the keyboard to React Native only through\n// react-native-keyboard-controller, which src/overlay/keyboard.ts reads where\n// the app installs it.\n\n// The side sheet's width, web's and the side sheets page's.\nconst SIDE_WIDTH = 400\n\n// The bottom sheet's top margin once whole, the page's 72dp.\nconst TOP_MARGIN = 72\n\n// How much of the window a sheet with two heights shows at the lower one.\nconst PARTIAL = 0.5\n\n// How far a press travels before it is a drag, so a tap on the sheet's\n// content stays a tap.\nconst DRAG_SLOP = 8\n\n// A release faster than this, in dp a second, is a fling, which moves the\n// sheet one height on rather than to the nearest. Android's bottom sheet\n// takes the same speed as the one that hides it.\nconst FLING = 500\n\n// The handle's bar and the room above and below it, web's 32 by 4 with 22dp\n// either side, which with 8dp at its ends makes the 48dp target.\nconst BAR_WIDTH = 32\nconst BAR_HEIGHT = 4\nconst BAR_SPACE = 22\nconst BAR_SIDE = 8\n\nconst stylesOf = themedStyles(\n ({ colors, radii, shadows, spacing }: ResolvedTheme) =>\n StyleSheet.create({\n // The handle's bar, on on-surface variant.\n bar: {\n backgroundColor: colors.onSurfaceVariant,\n borderRadius: radii.pill,\n height: BAR_HEIGHT,\n width: BAR_WIDTH,\n },\n // The body's padding, web's: 24dp at the sides, 16dp at either end\n // and between whatever it holds.\n body: {\n gap: spacing.lg,\n paddingHorizontal: spacing.xl,\n paddingVertical: spacing.lg,\n },\n // The text a body is handed as a string, in body medium on on-surface\n // variant, as the stories on web set theirs.\n bodyText: {\n color: colors.onSurfaceVariant,\n },\n // Both sheets' container, whose corners clip the body's scroll.\n container: {\n backgroundColor: colors.surfaceContainerLow,\n boxShadow: shadows.elevation1,\n overflow: 'hidden',\n },\n // The bottom sheet's container: the window's width, rounded on top.\n containerBottom: {\n borderTopLeftRadius: radii.xl,\n borderTopRightRadius: radii.xl,\n width: '100%',\n },\n // The side sheet's container, as tall as the window and rounded on the\n // corners that face the screen it covers.\n containerSide: {\n borderBottomStartRadius: radii.lg,\n borderTopStartRadius: radii.lg,\n flex: 1,\n },\n // The actions, web's: leading, wrapping onto another row when they do\n // not fit on one, over a divider, in a bar 72dp tall at least.\n footer: {\n alignItems: 'center',\n borderTopColor: colors.outlineVariant,\n borderTopWidth: 1,\n flexDirection: 'row',\n flexShrink: 0,\n flexWrap: 'wrap',\n gap: spacing.sm,\n justifyContent: 'flex-start',\n minHeight: 72,\n paddingBottom: spacing.xl,\n paddingHorizontal: spacing.xl,\n paddingTop: spacing.lg,\n },\n // The handle's 48dp target, centred along the sheet's top edge.\n handle: {\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: radii.pill,\n flexShrink: 0,\n paddingHorizontal: BAR_SIDE,\n paddingVertical: BAR_SPACE,\n },\n // The headline and whatever shares its row, a close button for one,\n // over a divider.\n header: {\n alignItems: 'center',\n borderBottomColor: colors.outlineVariant,\n borderBottomWidth: 1,\n flexDirection: 'row',\n flexShrink: 0,\n gap: spacing.md,\n justifyContent: 'space-between',\n paddingHorizontal: spacing.xl,\n paddingVertical: spacing.sm,\n },\n // Where each sheet sits in the window. The panel is a Gesture Handler\n // root of its own, the size of the sheet, so a press beside it reaches\n // the scrim.\n rootBottom: {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n },\n rootSide: {\n bottom: 0,\n end: 0,\n maxWidth: '100%',\n position: 'absolute',\n top: 0,\n width: SIDE_WIDTH,\n },\n // The headline gives way to whatever shares its row.\n title: {\n color: colors.onSurfaceVariant,\n flexShrink: 1,\n minWidth: 0,\n },\n }),\n)\n\n// What the content's parts read: which sheet is drawn, whether it is at its\n// whole height, the drag a scrolling body holds off, and the headline.\ntype SheetLayout = {\n readonly bottom: boolean\n readonly expanded: boolean\n // Gesture Handler 3 deprecates its gesture builder, and this type, for hooks\n // that version 2 does not have, and the peer range admits both, so the sheet\n // keeps the builder while it does.\n // oxlint-disable-next-line typescript/no-deprecated -- see above\n readonly pan: GestureType\n readonly setTitle: (node: HostInstance | null) => void\n readonly titleId: string\n /** What a press on the handle does, where the sheet has two heights. */\n readonly toggle: (() => void) | undefined\n}\n\nconst SheetLayoutContext = createContext<null | SheetLayout>(null)\nconst SheetTriggerContext = createContext<ModalTrigger | null>(null)\n\ntype SheetBodyProps = ScrollViewProps & {\n readonly ref?: Ref<ComponentRef<typeof ScrollView>>\n}\n\ntype SheetContentProps = Omit<ViewProps, 'children' | 'style'> &\n SheetOpenProps & {\n readonly children?: ReactNode\n /**\n * The height a bottom sheet with two heights opens at each time: `half`,\n * where its content stays in reach of a drag, or `whole`, where its\n * actions are in view from the start. A sheet with one height, and a side\n * sheet, open whole whatever this says.\n * @default 'half'\n */\n readonly initialHeight?: 'half' | 'whole'\n /**\n * Whether a press on the scrim, outside the sheet, and a swipe down past\n * its lowest height close it. Android's back gesture is\n * `isKeyboardDismissDisabled`'s, and this says nothing about it.\n * @default true\n */\n readonly isDismissable?: boolean\n /**\n * Keeps Android's back gesture, VoiceOver's escape gesture, and Escape on\n * web, from closing the sheet.\n * @default false\n */\n readonly isKeyboardDismissDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n }\n\ntype SheetHandleProps = Omit<ViewProps, 'children'> & {\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\ntype SheetOpenProps = ModalOpenProps & {\n /** Whether the sheet starts open, when it keeps its own state. */\n readonly defaultOpen?: boolean\n /** Whether the sheet is open, when the call site holds the state. */\n readonly isOpen?: boolean\n /** Called with the new state as the sheet opens or closes. */\n readonly onOpenChange?: (isOpen: boolean) => void\n}\n\ntype SheetPartProps = ViewProps & {\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\ntype SheetProps = SheetOpenProps & {\n /** The button that opens the sheet, and `Sheet.Content`. */\n readonly children?: ReactNode\n}\n\ntype SheetTitleProps = Omit<TextProps, 'role'> & {\n readonly ref?: Ref<HostInstance>\n}\n\n// What the window draws once the sheet is open, and what it needs from the\n// part that keeps the open state.\ntype SheetWindowProps = Omit<\n SheetContentProps,\n 'defaultOpen' | 'isOpen' | 'onOpenChange'\n> & {\n readonly close: () => void\n readonly isDismissable: boolean\n readonly isKeyboardDismissDisabled: boolean\n readonly isOpen: boolean\n readonly setPresent: (present: boolean) => void\n readonly slots: ButtonSlots\n}\n\n// The heights a bottom sheet rests at, as how far its panel is moved down:\n// whole, at half the window where it is taller than that, and gone.\ntype Stops = {\n /** The lower height, where the sheet has two. */\n readonly partial: null | number\n /** Every height a release can settle on, highest first. */\n readonly settles: readonly number[]\n}\n\n// The bottom sheet's room and padding: no taller than the window less the top\n// margin, or less the status bar where that is the taller, and its content\n// above the home indicator, or above the keyboard while one is up, and inside\n// the side insets.\nfunction bottomBoundsOf(\n insets: EdgeInsets,\n height: number,\n keyboard: number,\n): ViewStyle {\n return {\n ...insetsOf(insets),\n maxHeight: height - Math.max(TOP_MARGIN, insets.top),\n paddingBottom: Math.max(insets.bottom, keyboard),\n paddingTop: 0,\n }\n}\n\n/**\n * Where a bottom sheet let go comes to rest: one height on in the direction of\n * a fling, and the nearest height otherwise. Heights are how far the panel is\n * moved down, highest first, and the highest is always the whole sheet, 0.\n */\nfunction settleOf(at: number, velocity: number, settles: readonly number[]) {\n if (velocity > FLING) {\n return settles.find((stop) => stop > at) ?? settles.at(-1) ?? 0\n }\n\n if (velocity < -FLING) {\n return settles.findLast((stop) => stop < at) ?? 0\n }\n\n return settles.reduce(\n (nearest, stop) =>\n Math.abs(stop - at) < Math.abs(nearest - at) ? stop : nearest,\n 0,\n )\n}\n\n/**\n * A modal sheet along an edge of the screen, the bottom sheets and side sheets\n * spec pages' modal sheets, paired by window size as kanso-ui's are: a bottom\n * sheet in a compact window, dragged between heights and swiped down to go,\n * and a side sheet along the end edge from the medium window up. Pass\n * `isOpen` with `onOpenChange` to hold the open state, or `defaultOpen` to let\n * it keep its own.\n *\n * ```tsx\n * <Sheet>\n * <Button>Open</Button>\n * <Sheet.Content>\n * <Sheet.Handle />\n * <Sheet.Header>\n * <Sheet.Title>Headline</Sheet.Title>\n * </Sheet.Header>\n * <Sheet.Body>Supporting text</Sheet.Body>\n * <Sheet.Footer>\n * <Button slot=\"close\">Done</Button>\n * </Sheet.Footer>\n * </Sheet.Content>\n * </Sheet>\n * ```\n *\n * Composed rather than configured by props, as web's is. A `Button`,\n * `IconButton` or `Chip` inside `Sheet` and outside its content opens it, and\n * a button given `slot=\"close\"` anywhere inside the content closes it. A\n * sheet nothing on the screen opens leaves `Sheet` out and passes `isOpen`\n * and `onOpenChange` to `Sheet.Content` instead.\n */\nfunction Sheet({ children, defaultOpen, isOpen, onOpenChange }: SheetProps) {\n const { context, slots } = useModalTrigger({\n defaultOpen,\n isOpen,\n onOpenChange,\n })\n\n return (\n <SheetTriggerContext value={context}>\n <ButtonSlotContext value={slots}>{children}</ButtonSlotContext>\n </SheetTriggerContext>\n )\n}\n\n/**\n * What the sheet shows, as a body that scrolls when its content runs past the\n * room it has. A string is drawn in body medium on on-surface variant;\n * anything else draws itself. `style`, `ref` and `testID` land on the\n * `ScrollView`.\n *\n * A body its content runs past takes focus, as web's is a tab stop, so a\n * keyboard can scroll it when nothing inside it takes focus; a call site's\n * own `focusable` still wins. A bottom sheet's body scrolls only once the\n * sheet is at its whole height, and holds the sheet's drag off while it does.\n */\nfunction SheetBody({\n children,\n contentContainerStyle,\n onContentSizeChange,\n onLayout,\n scrollEnabled = true,\n ...props\n}: SheetBodyProps) {\n const layout = useLayout('Sheet.Body')\n const styles = stylesOf(useTheme())\n const text = useTypeRole('bodyMedium')\n const [content, setContent] = useState(0)\n const [room, setRoom] = useState(0)\n const measureContent = useCallback(\n (width: number, height: number) => {\n setContent(height)\n onContentSizeChange?.(width, height)\n },\n [onContentSizeChange],\n )\n const measureRoom = useCallback(\n (event: LayoutChangeEvent) => {\n setRoom(event.nativeEvent.layout.height)\n onLayout?.(event)\n },\n [onLayout],\n )\n const scrolls = scrollEnabled && layout.expanded\n const overflows = content > room\n // oxlint-disable-next-line react/capitalized-calls, typescript/no-deprecated -- a builder named after its gesture, not a component; see SheetLayout\n const native = Gesture.Native()\n .enabled(scrolls && overflows)\n .blocksExternalGesture(layout.pan)\n\n return (\n <GestureDetector gesture={native}>\n <ScrollView\n focusable={scrolls && overflows}\n onContentSizeChange={measureContent}\n onLayout={measureRoom}\n {...props}\n contentContainerStyle={composeStyles<ViewStyle>(\n styles.body,\n contentContainerStyle,\n )}\n scrollEnabled={scrolls}\n >\n {typeof children === 'string' ? (\n <NativeText style={composeStyles<TextStyle>(text, styles.bodyText)}>\n {children}\n </NativeText>\n ) : (\n children\n )}\n </ScrollView>\n </GestureDetector>\n )\n}\n\n/**\n * The sheet itself, and the scrim behind it. Everything the sheet shows goes\n * in here; the button that opens it stays outside it.\n *\n * Inside `Sheet`, the open state is the trigger's. On its own it is this\n * part's: `isOpen` with `onOpenChange` holds it, and a `slot=\"close\"` button,\n * the scrim, the swipe and the back gesture all report through\n * `onOpenChange`. `style`, `ref` and `testID` land on the container, and\n * `testID` names the drag `<testID>-drag` for Gesture Handler's test helpers.\n */\nfunction SheetContent({\n defaultOpen,\n isDismissable = true,\n isKeyboardDismissDisabled = false,\n isOpen,\n onOpenChange,\n ...props\n}: SheetContentProps) {\n const outer = use(SheetTriggerContext)\n const { close, present, setPresent, slots, state } = useModalState(outer, {\n defaultOpen,\n isOpen,\n onOpenChange,\n })\n\n if (!present) {\n return null\n }\n\n return (\n <SheetWindow\n {...props}\n close={close}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={state.isOpen}\n setPresent={setPresent}\n slots={slots}\n />\n )\n}\n\n/**\n * The sheet's actions, leading and wrapping onto another row when they do not\n * fit on one, over a divider. On a bottom sheet at half height they are below\n * the fold until the sheet is raised, so a sheet opened for them takes\n * `initialHeight=\"whole\"` on `Sheet.Content`. `style`, `ref` and `testID`\n * land on its view.\n */\nfunction SheetFooter({ style, ...props }: SheetPartProps) {\n useLayout('Sheet.Footer')\n const styles = stylesOf(useTheme())\n\n return (\n <View {...props} style={composeStyles<ViewStyle>(styles.footer, style)} />\n )\n}\n\n/**\n * The bottom sheet's drag handle, a 32 by 4dp bar centred along its top edge.\n * Where the sheet has two heights it is a button moving it to the other one,\n * named \"Drag handle\" in the `I18nProvider`'s locale, or the device's outside\n * one, unless `aria-label` says otherwise; elsewhere it is a mark a screen reader skips. A side sheet draws\n * none. `style`, `ref` and `testID` land on its view.\n */\nfunction SheetHandle({\n 'aria-label': label,\n style,\n ...props\n}: SheetHandleProps) {\n const layout = useLayout('Sheet.Handle')\n const theme = useTheme()\n const styles = stylesOf(theme)\n const { colors, radii } = theme\n const feedback = usePressFeedback({\n color: colors.onSurfaceVariant,\n corners: { borderRadius: radii.pill },\n })\n const { toggle } = layout\n const messages = useMessages()\n\n if (!layout.bottom) {\n return null\n }\n\n if (toggle === undefined) {\n return (\n <View\n aria-hidden\n {...props}\n style={composeStyles<ViewStyle>(styles.handle, style)}\n >\n <View style={styles.bar} />\n </View>\n )\n }\n\n return (\n <Pressable\n aria-expanded={layout.expanded}\n aria-label={label ?? messages.dragHandle}\n role=\"button\"\n {...props}\n {...feedback.handlers}\n onPress={toggle}\n style={composeStyles<ViewStyle>(styles.handle, feedback.ring, style)}\n >\n {feedback.layer}\n <View style={styles.bar} />\n </Pressable>\n )\n}\n\n/**\n * The sheet's header: its `Sheet.Title`, and anything beside it, such as a\n * close button, over a divider. `style`, `ref` and `testID` land on its view.\n */\nfunction SheetHeader({ style, ...props }: SheetPartProps) {\n useLayout('Sheet.Header')\n const styles = stylesOf(useTheme())\n\n return (\n <View {...props} style={composeStyles<ViewStyle>(styles.header, style)} />\n )\n}\n\n/**\n * Names the sheet: the container is labelled by it, and a screen reader is\n * sent to it once the sheet shows. In title large on on-surface variant.\n * `style`, `ref` and `testID` land on React Native's own Text.\n */\nfunction SheetTitle({ ref, style, ...props }: SheetTitleProps) {\n const layout = useLayout('Sheet.Title')\n const styles = stylesOf(useTheme())\n const role = useTypeRole('titleLarge')\n\n return (\n <NativeText\n {...props}\n nativeID={layout.titleId}\n ref={refsOf(layout.setTitle, ref)}\n role=\"heading\"\n style={composeStyles<TextStyle>(role, styles.title, style)}\n />\n )\n}\n\n/**\n * The open sheet, mounted from the moment it opens until its exit has run, so\n * each opening starts from its edge and at its first height.\n */\nfunction SheetWindow({\n children,\n close,\n initialHeight = 'half',\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n onLayout,\n setPresent,\n slots,\n style,\n testID,\n ...props\n}: SheetWindowProps) {\n const styles = stylesOf(useTheme())\n const insets = use(SafeAreaInsetsContext) ?? NO_INSETS\n const { height } = useWindowDimensions()\n const bottom = useWindowSizeClass() === 'compact'\n const keyboard = useKeyboardInset()\n const titleId = useId()\n const [title, setTitle] = useState<HostInstance | null>(null)\n // The panel's height as laid out, before any drag moves it, and whether a\n // sheet with two heights is at the higher one.\n const [full, setFull] = useState<null | number>(null)\n const [expanded, setExpanded] = useState(initialHeight === 'whole')\n const stops = stopsOf(bottom, full, height, isDismissable)\n const twoHeights = stops.partial !== null\n // A sheet with two heights rises whole while the keyboard is up, so the\n // field being typed in stays on the screen.\n const rest =\n stops.partial !== null && !expanded && keyboard === 0 ? stops.partial : 0\n const motion = useSheetMotion({ bottom, full, isOpen, rest, setPresent })\n const pan = useSheetDrag({\n close,\n enabled: bottom && isOpen && stops.settles.length > 1,\n expanded,\n full,\n isDismissable,\n offset: motion.offset,\n rest,\n setExpanded,\n stops,\n testID,\n })\n const toggle = useCallback(() => {\n setExpanded((was) => !was)\n }, [])\n const layout = useMemo<SheetLayout>(\n () => ({\n bottom,\n expanded: !twoHeights || expanded,\n pan,\n setTitle,\n titleId,\n toggle: twoHeights ? toggle : undefined,\n }),\n [bottom, expanded, pan, titleId, toggle, twoHeights],\n )\n const measure = useCallback(\n (event: LayoutChangeEvent) => {\n setFull(event.nativeEvent.layout.height)\n onLayout?.(event)\n },\n [onLayout],\n )\n const labelledBy = title === null ? undefined : titleId\n\n return (\n <ModalWindow\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n labelledBy={labelledBy}\n onClose={close}\n onScrimPress={isDismissable && isOpen ? close : undefined}\n scrim={motion.scrim}\n title={title}\n >\n <GestureHandlerRootView\n style={bottom ? styles.rootBottom : styles.rootSide}\n >\n <GestureDetector gesture={pan}>\n <Animated.View\n {...panelRoleOf('dialog', labelledBy)}\n onAccessibilityEscape={\n isKeyboardDismissDisabled ? undefined : close\n }\n {...props}\n onLayout={measure}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.container,\n bottom ? styles.containerBottom : styles.containerSide,\n bottom\n ? bottomBoundsOf(insets, height, keyboard)\n : sideInsetsOf(insets, keyboard),\n motion.panel,\n style,\n )}\n testID={testID}\n >\n <SheetLayoutContext value={layout}>\n <ButtonSlotContext value={slots}>{children}</ButtonSlotContext>\n </SheetLayoutContext>\n </Animated.View>\n </GestureDetector>\n </GestureHandlerRootView>\n </ModalWindow>\n )\n}\n\n// The side sheet's padding: its content under the status bar, over the home\n// indicator, or over the keyboard while one is up, and inside the inset on its\n// own edge. Its start edge faces the screen it covers, which has none.\nfunction sideInsetsOf(insets: EdgeInsets, keyboard: number): ViewStyle {\n return {\n ...insetsOf(insets),\n paddingBottom: Math.max(insets.bottom, keyboard),\n paddingStart: 0,\n }\n}\n\nfunction stopsOf(\n bottom: boolean,\n full: null | number,\n height: number,\n isDismissable: boolean,\n): Stops {\n if (!bottom || full === null) {\n return { partial: null, settles: [0] }\n }\n\n const lower = full - height * PARTIAL\n const partial = lower > 0 ? lower : null\n\n return {\n partial,\n settles: [\n 0,\n ...(partial === null ? [] : [partial]),\n ...(isDismissable ? [full] : []),\n ],\n }\n}\n\nfunction useLayout(part: string) {\n const layout = use(SheetLayoutContext)\n\n if (layout === null) {\n throw new Error(`${part} is drawn inside Sheet.Content.`)\n }\n\n return layout\n}\n\n/**\n * The bottom sheet's drag. The panel follows the finger, no higher than its\n * whole height and no lower than gone, or than its lowest height when it may\n * not be dismissed, and once let go it settles where `settleOf` says: below\n * the lowest height it closes, and at another height it moves the sheet there.\n */\nfunction useSheetDrag({\n close,\n enabled,\n expanded,\n full,\n isDismissable,\n offset,\n rest,\n setExpanded,\n stops,\n testID,\n}: {\n readonly close: () => void\n readonly enabled: boolean\n readonly expanded: boolean\n readonly full: null | number\n readonly isDismissable: boolean\n readonly offset: SharedValue<number>\n readonly rest: number\n readonly setExpanded: (expanded: boolean) => void\n readonly stops: Stops\n readonly testID: string | undefined\n}) {\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n // Where the panel stood when the drag was recognised. Gesture Handler\n // measures its translation from there, past the slop.\n const origin = useSharedValue(0)\n const lowest = stops.settles.at(-1) ?? 0\n\n function follow(translation: number) {\n offset.set(Math.min(lowest, Math.max(0, origin.get() + translation)))\n }\n\n function settle(target: number) {\n if (isDismissable && target === full) {\n close()\n return\n }\n\n const higher = target === 0\n if (stops.partial !== null && higher !== expanded) {\n setExpanded(higher)\n return\n }\n\n offset.set(\n reduceMotion\n ? target\n : withTiming(target, {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasizedDecelerate),\n }),\n )\n }\n\n // oxlint-disable-next-line react/capitalized-calls, typescript/no-deprecated -- a builder named after its gesture, not a component; see SheetLayout\n const pan = Gesture.Pan()\n .activeOffsetY([-DRAG_SLOP, DRAG_SLOP])\n .enabled(enabled)\n .runOnJS(true)\n .onStart(({ translationY }) => {\n origin.set(offset.get())\n follow(translationY)\n })\n .onUpdate(({ translationY }) => {\n follow(translationY)\n })\n .onEnd(({ velocityY }, success) => {\n settle(success ? settleOf(offset.get(), velocityY, stops.settles) : rest)\n })\n\n return testID === undefined ? pan : pan.withTestId(`${testID}-drag`)\n}\n\n/**\n * The scrim's and the panel's motion, and the timer that unmounts the sheet\n * once its exit has run. The bottom sheet's position is how far its panel is\n * moved down, which the drag sets too; it starts below the window and rises\n * to its height once that is measured. The side sheet's is how far it has\n * come in from its edge, which is the end edge, and so the left one under\n * right-to-left.\n */\nfunction useSheetMotion({\n bottom,\n full,\n isOpen,\n rest,\n setPresent,\n}: {\n readonly bottom: boolean\n readonly full: null | number\n readonly isOpen: boolean\n readonly rest: number\n readonly setPresent: (present: boolean) => void\n}) {\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n const { height } = useWindowDimensions()\n const offset = useSharedValue(height)\n const shown = useSharedValue(0)\n const scrim = useSharedValue(0)\n // A translation is not mirrored under a right-to-left layout, though the\n // side sheet's edge is, so it travels the other way there.\n const direction = I18nManager.isRTL ? -1 : 1\n\n useEffect(() => {\n const fade = {\n duration: motion.durationShort2,\n easing: Easing.bezier(...motion.easingStandard),\n }\n const enter = {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasizedDecelerate),\n }\n const exit = {\n duration: motion.durationShort3,\n easing: Easing.bezier(...motion.easingEmphasizedAccelerate),\n }\n\n if (isOpen) {\n scrim.set(withTiming(1, fade))\n if (!bottom) {\n shown.set(reduceMotion ? 1 : withTiming(1, enter))\n return undefined\n }\n if (full === null) {\n return undefined\n }\n // It rises from its own height below where it rests, not from the\n // bottom of the window, so it shows from the first frame.\n if (offset.get() > full) {\n offset.set(full)\n }\n offset.set(reduceMotion ? rest : withTiming(rest, enter))\n return undefined\n }\n\n scrim.set(withTiming(0, fade))\n if (bottom) {\n const gone = full ?? height\n offset.set(reduceMotion ? gone : withTiming(gone, exit))\n } else {\n shown.set(reduceMotion ? 0 : withTiming(0, exit))\n }\n const timer = setTimeout(\n () => {\n setPresent(false)\n },\n reduceMotion\n ? motion.durationShort2\n : Math.max(motion.durationShort2, motion.durationShort3),\n )\n\n return () => {\n clearTimeout(timer)\n }\n }, [\n bottom,\n full,\n height,\n isOpen,\n motion,\n offset,\n reduceMotion,\n rest,\n scrim,\n setPresent,\n shown,\n ])\n\n return {\n offset,\n panel: useAnimatedStyle(() => {\n 'worklet'\n if (bottom) {\n return { transform: [{ translateY: offset.get() }] }\n }\n\n const progress = shown.get()\n return {\n opacity: progress,\n transform: [{ translateX: (1 - progress) * SIDE_WIDTH * direction }],\n }\n }),\n scrim: useAnimatedStyle(() => {\n 'worklet'\n return { opacity: scrim.get() }\n }),\n }\n}\n\nSheet.Body = SheetBody\nSheet.Content = SheetContent\nSheet.Footer = SheetFooter\nSheet.Handle = SheetHandle\nSheet.Header = SheetHeader\nSheet.Title = SheetTitle\n\nexport {\n Sheet,\n SheetBody,\n SheetContent,\n SheetFooter,\n SheetHandle,\n SheetHeader,\n SheetTitle,\n}\nexport type {\n SheetBodyProps,\n SheetContentProps,\n SheetHandleProps,\n SheetPartProps,\n SheetProps,\n SheetTitleProps,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqIA,MAAM4D,aAAa;AAGnB,MAAMC,aAAa;AAGnB,MAAMC,UAAU;AAIhB,MAAMC,YAAY;AAKlB,MAAMC,QAAQ;AAId,MAAMC,YAAY;AAClB,MAAMC,aAAa;AACnB,MAAMC,YAAY;AAClB,MAAM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,MAAKpB,IAAK;EAAC,OACrB;GAAAqC,SACID;GAAQF,WACN,CAAC,EAAAI,aAAe,IAAIF,YAAYxQ,aAAayP,UAAU,CAAC;EACrE;CAAC,CACF;CACM,MAAAnG,KAAA/K,uBAAiB;EAAA;EAAA,OAEf,EAAAkS,SAAWhE,MAAK2B,IAAK,EAAE;CAAC,CAChC;CAAC,IAAAvE;CAAA,IAAAlC,EAAA,QAAAoE,UAAApE,EAAA,QAAAK,MAAAL,EAAA,QAAA2B,IAAA;EAjBGO,KAAA;GAAAkC;GAAAkB,OAEEjF;GAWLyE,OACKnD;EAIT;EAAC3B,EAAA,MAAAoE;EAAApE,EAAA,MAAAK;EAAAL,EAAA,MAAA2B;EAAA3B,EAAA,MAAAkC;CAAA,OAAAA,KAAAlC,EAAA;CAAA,OAlBMkC;AAkBN;AAGHpC,MAAMkJ,OAAO1I;AACbR,MAAMmJ,UAAU1G;AAChBzC,MAAMoJ,SAASxG;AACf5C,MAAMqJ,SAASxG;AACf7C,MAAMsJ,SAAS/F;AACfvD,MAAMuJ,QAAQ/F"}
|
package/dist/number/parser.js
CHANGED
|
@@ -171,13 +171,13 @@ function numeralsOf(locale, numberingSystem) {
|
|
|
171
171
|
return Array.from(new Intl.NumberFormat(locale, {
|
|
172
172
|
numberingSystem,
|
|
173
173
|
useGrouping: false
|
|
174
|
-
}).format(9876543210)).
|
|
174
|
+
}).format(9876543210)).reverse();
|
|
175
175
|
}
|
|
176
176
|
function optionalString(value) {
|
|
177
177
|
return typeof value === "string" ? value : void 0;
|
|
178
178
|
}
|
|
179
179
|
function parserOf(locale, options) {
|
|
180
|
-
const key = locale + Object.entries(options).
|
|
180
|
+
const key = locale + Object.entries(options).sort(([a], [b]) => a < b ? -1 : 1).join();
|
|
181
181
|
const cached = parserCache.get(key);
|
|
182
182
|
if (cached !== void 0) return cached;
|
|
183
183
|
const parser = new NumberParserImpl(locale, options);
|
|
@@ -287,7 +287,7 @@ function symbolsOf(locale, resolved, options) {
|
|
|
287
287
|
return spans.digits === "" ? [] : [spans.prefix, spans.suffix];
|
|
288
288
|
})
|
|
289
289
|
];
|
|
290
|
-
const pieces = [...new Set(around.flatMap((text) => text.split(SPACING_RUN)).filter((piece) => piece !== "" && piece !== minusSign).map(escapeRegex))].
|
|
290
|
+
const pieces = [...new Set(around.flatMap((text) => text.split(SPACING_RUN)).filter((piece) => piece !== "" && piece !== minusSign).map(escapeRegex))].sort((a, b) => b.length - a.length);
|
|
291
291
|
const literals = new RegExp([...pieces, `[${SPACING}]`].join("|"), "gu");
|
|
292
292
|
const indexes = new Map(numerals.map((numeral, digit) => [numeral, digit]));
|
|
293
293
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","names":["NumberFormatOptions","NoNumeralUnit","unit","value","Spans","digits","gaps","prefix","suffix","Symbols","decimal","group","index","numeral","literals","RegExp","minusSign","noNumeralUnits","numerals","plusSign","CURRENCY_SIGN_REGEX","NUMBERING_SYSTEMS","PLURAL_NUMBERS","PROBE","PROBE_DIGITS","SPACING","SPACING_RUN","SPACING_ANY","SYSTEMS_BY_ZERO","Map","parserCache","NumberParserImpl","NumberParser","locale","options","constructor","getNumberingSystem","numberParserFor","numberingSystem","isValidPartialNumber","minValue","maxValue","parse","formatter","Intl","NumberFormat","ResolvedNumberFormatOptions","symbols","given","withRoundingIncrement","resolvedOptions","symbolsOf","optionalString","get","Infinity","groupAllowed","Boolean","useGrouping","rest","sanitize","startsWith","slice","length","undefined","includes","maximumFractionDigits","replaceAll","replace","plain","Number","NaN","style","percentOf","parsed","isNaN","Math","min","minimumFractionDigits","format","currencySign","test","spelled","find","entry","String","differenceOf","from","to","fromChars","Array","toChars","start","end","added","join","escapeRegex","text","parser","parserOf","system","other","numeralsOf","toReversed","key","Object","entries","toSorted","a","b","cached","set","negative","point","indexOf","moved","probeOptionsOf","resolved","extra","maximumSignificantDigits","minimumSignificantDigits","notation","roundingIncrement","roundingMode","roundingPriority","signDisplay","trailingZeroDisplay","signOf","spansOf","digitOf","ReadonlyMap","chars","gap","char","digit","push","map","scale","probe","positive","read","before","after","signedBefore","signedAfter","signed","plusBefore","plusAfter","plurals","pluralTexts","at","trim","filter","some","has","around","flatMap","spans","pieces","Set","split","piece","indexes"],"sources":["../../src/number/parser.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * Modified by Kanso Labs: ported from @internationalized/number's NumberParser\n * to find the locale's symbols with `format` rather than `formatToParts`.\n */\n\nimport type { NumberFormatOptions } from '@internationalized/number'\n\n// Reading back a number a person typed, in the locale and the format the\n// field shows it in: the parser web's NumberField reads its value with,\n// through React Stately, which is @internationalized/number's NumberParser.\n//\n// **It finds the locale's symbols with `format` alone.** The parser it ports\n// asks `formatToParts` for them, the minus sign, the decimal and group\n// separators, and the currency, percent and unit text around the digits, and\n// Hermes defines no `formatToParts` for `Intl.NumberFormat` on iOS, so it\n// throws on the first character typed there. `format` is what every runtime\n// React Native runs on has. So a known number is formatted, its digits found\n// by the locale's own numerals, and each symbol read off where it falls: the\n// group separator between the second and third digits of 12,345.67, the\n// decimal between the fifth and sixth, the minus where the negative differs\n// from the positive, and the rest of the text around the digits as what the\n// parser strips. Everything after that is the parser it ports, line for\n// line, and the tests compare the two across locales and formats on a\n// runtime that has both.\n\ntype NoNumeralUnit = {\n readonly unit: string\n readonly value: number\n}\n\n// Where a formatted number's digits fall: the digits themselves, as ASCII, the\n// text between each and the next, and the text before and after them.\ntype Spans = {\n readonly digits: string\n readonly gaps: readonly string[]\n readonly prefix: string\n readonly suffix: string\n}\n\ntype Symbols = {\n readonly decimal: string | undefined\n readonly group: string | undefined\n readonly index: (numeral: string) => string\n readonly literals: RegExp\n readonly minusSign: string\n readonly noNumeralUnits: readonly NoNumeralUnit[]\n readonly numeral: RegExp\n readonly numerals: readonly string[]\n readonly plusSign: string | undefined\n}\n\nconst CURRENCY_SIGN_REGEX = /^.*\\(.*\\).*$/u\n\n// The numbering systems a value is tried in when it does not read in the\n// locale's own, as the parser it ports tries them.\nconst NUMBERING_SYSTEMS = [\n 'latn',\n 'arab',\n 'hanidec',\n 'deva',\n 'beng',\n 'fullwide',\n]\n\n// Every number whose plural form a unit or a currency name can take in some\n// locale, from the parser it ports.\nconst PLURAL_NUMBERS = [0, 4, 2, 1, 11, 20, 3, 7, 100, 21, 0.1, 1.1]\n\n// 12,345.67: a group separator after its second digit in every locale that\n// groups, and the decimal separator after its fifth.\nconst PROBE = 12_345.67\nconst PROBE_DIGITS = '1234567'\n\n// White space and the formatting characters, Unicode's `White_Space` and\n// `Cf`, which the parser it ports strips as `\\p{White_Space}|\\p{Cf}`. Spelled\n// out rather than as property escapes, so the expression means the same\n// wherever it is compiled. These are the characters in the Basic\n// Multilingual Plane, which is every one a number format writes.\nconst SPACING =\n '\\\\s\\\\u0085\\\\u00ad\\\\u0600-\\\\u0605\\\\u061c\\\\u06dd\\\\u070f\\\\u0890\\\\u0891\\\\u08e2\\\\u180e\\\\u200b-\\\\u200f\\\\u202a-\\\\u202e\\\\u2060-\\\\u2064\\\\u2066-\\\\u206f\\\\ufeff\\\\ufff9-\\\\ufffb'\nconst SPACING_RUN = new RegExp(`[${SPACING}]+`, 'u')\nconst SPACING_ANY = new RegExp(`[${SPACING}]`, 'gu')\n\n// The numbering system a locale's zero belongs to, for a runtime whose\n// resolved options do not name one: Hermes on iOS names none. These are the\n// systems a value is tried in, and Persian's. A locale writing any other is\n// left unnamed, which a formatter reads as the locale's own system, and\n// that is the one it writes.\nconst SYSTEMS_BY_ZERO = new Map([\n ['0', 'latn'],\n ['٠', 'arab'],\n ['۰', 'arabext'],\n ['〇', 'hanidec'],\n ['०', 'deva'],\n ['০', 'beng'],\n ['0', 'fullwide'],\n])\n\nconst parserCache = new Map<string, NumberParserImpl>()\n\n/**\n * Parses a number in a locale and a format, as @internationalized/number's\n * `NumberParser` does, without `formatToParts`.\n */\nclass NumberParser {\n private readonly locale: string\n private readonly options: NumberFormatOptions\n\n constructor(locale: string, options: NumberFormatOptions = {}) {\n this.locale = locale\n this.options = options\n }\n\n /**\n * The numbering system the value reads in, in the locale, or the locale's\n * own when none matches. `undefined` is the locale's own, on a runtime\n * that does not name it.\n */\n getNumberingSystem(value: string): string | undefined {\n return numberParserFor(this.locale, this.options, value).numberingSystem\n }\n\n /**\n * Whether the value could be the start of a number, which is how input is\n * checked as it is typed. A minus sign counts only where `minValue` is\n * below zero, and a plus sign only where `maxValue` is above it.\n */\n isValidPartialNumber(\n value: string,\n minValue?: number,\n maxValue?: number,\n ): boolean {\n return numberParserFor(\n this.locale,\n this.options,\n value,\n ).isValidPartialNumber(value, minValue, maxValue)\n }\n\n /** The number the value reads as, or `NaN` when it reads as none. */\n parse(value: string): number {\n return numberParserFor(this.locale, this.options, value).parse(value)\n }\n}\n\nclass NumberParserImpl {\n readonly numberingSystem: string | undefined\n private readonly formatter: Intl.NumberFormat\n private readonly locale: string\n private readonly options: Intl.ResolvedNumberFormatOptions\n private readonly symbols: Symbols\n\n constructor(locale: string, given: NumberFormatOptions = {}) {\n this.locale = locale\n const options = withRoundingIncrement(given)\n this.formatter = new Intl.NumberFormat(locale, options)\n this.options = this.formatter.resolvedOptions()\n this.symbols = symbolsOf(locale, this.options, options)\n this.numberingSystem =\n optionalString(this.options.numberingSystem) ??\n SYSTEMS_BY_ZERO.get(this.symbols.numerals[0] ?? '')\n }\n\n isValidPartialNumber(\n value: string,\n minValue = -Infinity,\n maxValue = Infinity,\n ) {\n const groupAllowed = Boolean(this.formatter.resolvedOptions().useGrouping)\n const { decimal, group, minusSign, numeral, plusSign } = this.symbols\n let rest = this.sanitize(value)\n\n // A sign comes first.\n if (minusSign !== '' && rest.startsWith(minusSign) && minValue < 0) {\n rest = rest.slice(minusSign.length)\n } else if (\n plusSign !== undefined &&\n rest.startsWith(plusSign) &&\n maxValue > 0\n ) {\n rest = rest.slice(plusSign.length)\n }\n\n // A format with no fraction takes no decimal separator.\n if (\n decimal !== undefined &&\n rest.includes(decimal) &&\n this.options.maximumFractionDigits === 0\n ) {\n return false\n }\n\n if (group !== undefined && groupAllowed) {\n rest = rest.replaceAll(group, '')\n }\n rest = rest.replace(numeral, '')\n if (decimal !== undefined) {\n rest = rest.replace(decimal, '')\n }\n\n return rest.length === 0\n }\n\n parse(value: string): number {\n const groupAllowed = Boolean(this.formatter.resolvedOptions().useGrouping)\n const { decimal, group, index, minusSign, numeral } = this.symbols\n let plain = this.sanitize(value)\n\n if (!groupAllowed && group !== undefined && plain.includes(group)) {\n return Number.NaN\n } else if (group !== undefined) {\n plain = plain.replaceAll(group, '')\n }\n if (decimal !== undefined) {\n plain = plain.replace(decimal, '.')\n }\n plain = plain.replace(minusSign, '-')\n plain = plain.replace(numeral, index)\n\n if (this.options.style === 'percent') {\n plain = percentOf(plain)\n }\n\n const parsed = plain === '' ? Number.NaN : Number(plain)\n if (Number.isNaN(parsed)) {\n return Number.NaN\n }\n\n if (this.options.style === 'percent') {\n // Rounded as the field's formatter would show it.\n const options = {\n ...this.options,\n maximumFractionDigits: Math.min(\n (this.options.maximumFractionDigits ?? 0) + 2,\n 20,\n ),\n minimumFractionDigits: Math.min(\n (this.options.minimumFractionDigits ?? 0) + 2,\n 20,\n ),\n style: 'decimal',\n } satisfies NumberFormatOptions\n return new NumberParser(this.locale, options).parse(\n new Intl.NumberFormat(this.locale, options).format(parsed),\n )\n }\n\n // An accounting format writes a negative in brackets, which the literals\n // have already stripped.\n if (\n this.options.currencySign === 'accounting' &&\n CURRENCY_SIGN_REGEX.test(value)\n ) {\n return -1 * parsed\n }\n\n return parsed\n }\n\n private sanitize(value: string) {\n const groupAllowed = Boolean(this.formatter.resolvedOptions().useGrouping)\n const { decimal, group, literals, minusSign, noNumeralUnits } = this.symbols\n\n // A unit some plural forms write with no numeral, such as a day spelled\n // out, stands for its number.\n const spelled = noNumeralUnits.find((entry) => entry.unit === value)\n if (spelled !== undefined) {\n return String(spelled.value)\n }\n\n let rest = value.replace(literals, '')\n\n // The ASCII hyphen stands for the locale's minus, which a keyboard may\n // not have.\n rest = rest.replace('-', minusSign)\n\n // Arabic's decimal separator is on few keyboards, which type a comma or\n // the Arabic comma instead, and a full stop for its group separator.\n if (this.numberingSystem === 'arab') {\n if (decimal !== undefined) {\n rest = rest.replaceAll(',', decimal)\n rest = rest.replaceAll('،', decimal)\n }\n if (group !== undefined && groupAllowed) {\n rest = rest.replaceAll('.', group)\n }\n }\n\n // A right single quotation mark groups digits in some formats, Swiss\n // currency among them, where a keyboard types an apostrophe, and newer\n // data writes the apostrophe where older wrote the quotation mark.\n if (group === '’' && rest.includes(\"'\") && groupAllowed) {\n rest = rest.replaceAll(\"'\", group)\n }\n if (group === \"'\" && rest.includes('’') && groupAllowed) {\n rest = rest.replaceAll('’', group)\n }\n\n // French groups with a narrow no-break space, which no French keyboard\n // has, so a space and a no-break space group too.\n if (\n this.options.locale === 'fr-FR' &&\n group !== undefined &&\n groupAllowed\n ) {\n rest = rest.replaceAll(' ', group)\n rest = rest.replaceAll(' ', group)\n }\n\n return rest\n }\n}\n\n// What `from` became in `to`: the text `to` has between the start and the end\n// the two share, and `to` with a space in its place.\nfunction differenceOf(from: string, to: string) {\n const fromChars = Array.from(from)\n const toChars = Array.from(to)\n let start = 0\n while (\n start < fromChars.length &&\n start < toChars.length &&\n fromChars[start] === toChars[start]\n ) {\n start += 1\n }\n let end = 0\n while (\n end < fromChars.length - start &&\n end < toChars.length - start &&\n fromChars[fromChars.length - 1 - end] === toChars[toChars.length - 1 - end]\n ) {\n end += 1\n }\n\n return {\n added: toChars.slice(start, toChars.length - end).join(''),\n rest: `${toChars.slice(0, start).join('')} ${toChars.slice(toChars.length - end).join('')}`,\n }\n}\n\nfunction escapeRegex(text: string) {\n return text.replaceAll(/[$()*+.?[\\\\\\]^{|}]/gu, '\\\\$&')\n}\n\n// The parser for a value: the locale's own numbering system, or the first of\n// the others the value reads in, unless the locale names one.\nfunction numberParserFor(\n locale: string,\n options: NumberFormatOptions,\n value: string,\n) {\n const parser = parserOf(locale, options)\n\n if (!locale.includes('-nu-') && !parser.isValidPartialNumber(value)) {\n for (const system of NUMBERING_SYSTEMS) {\n if (system !== parser.numberingSystem) {\n const other = parserOf(\n `${locale}${locale.includes('-u-') ? '-nu-' : '-u-nu-'}${system}`,\n options,\n )\n if (other.isValidPartialNumber(value)) {\n return other\n }\n }\n }\n }\n\n return parser\n}\n\n// The numerals a locale writes, zero first.\nfunction numeralsOf(locale: string, numberingSystem: string | undefined) {\n return Array.from(\n new Intl.NumberFormat(locale, {\n numberingSystem,\n useGrouping: false,\n }).format(9_876_543_210),\n ).toReversed()\n}\n\nfunction optionalString(value: unknown) {\n return typeof value === 'string' ? value : undefined\n}\n\nfunction parserOf(locale: string, options: NumberFormatOptions) {\n const key =\n locale +\n Object.entries(options)\n .toSorted(([a], [b]) => (a < b ? -1 : 1))\n .join()\n const cached = parserCache.get(key)\n if (cached !== undefined) {\n return cached\n }\n\n const parser = new NumberParserImpl(locale, options)\n parserCache.set(key, parser)\n return parser\n}\n\n// A percent's digits moved two places left on the string rather than divided\n// by 100, which keeps the figures it was written with.\nfunction percentOf(plain: string) {\n const negative = plain.includes('-')\n let digits = plain.replace('-', '').replace('+', '')\n let point = digits.indexOf('.')\n if (point === -1) {\n point = digits.length\n }\n digits = digits.replace('.', '')\n\n const moved =\n point - 2 === 0\n ? `0.${digits}`\n : point - 2 === -1\n ? `0.0${digits}`\n : point - 2 === -2\n ? '0.00'\n : `${digits.slice(0, point - 2)}.${digits.slice(point - 2)}`\n\n return negative ? `-${moved}` : moved\n}\n\n// The options a symbol is read with: the format's own, so its currency,\n// percent or unit text is the text read, at the fraction digits given,\n// grouped, and with the rounding, the notation and the sign at their\n// defaults, so the digits come out whole.\nfunction probeOptionsOf(\n resolved: Intl.ResolvedNumberFormatOptions,\n extra: NumberFormatOptions,\n): NumberFormatOptions {\n return {\n ...resolved,\n maximumSignificantDigits: undefined,\n minimumSignificantDigits: undefined,\n notation: 'standard',\n roundingIncrement: 1,\n roundingMode: 'halfExpand',\n roundingPriority: 'auto',\n signDisplay: 'auto',\n trailingZeroDisplay: 'auto',\n useGrouping: true,\n ...extra,\n }\n}\n\n// The text a number's sign is, with the white space and direction marks\n// around it left out, as `formatToParts` leaves them out of its sign.\nfunction signOf(text: string) {\n return text.replace(SPACING_ANY, '')\n}\n\n// Where a formatted number's digits fall, read by the numerals given.\nfunction spansOf(text: string, digitOf: ReadonlyMap<string, number>): Spans {\n const chars = Array.from(text)\n let digits = ''\n const gaps: string[] = []\n let prefix = ''\n let gap = ''\n\n for (const char of chars) {\n const digit = digitOf.get(char)\n if (digit === undefined) {\n gap += char\n } else {\n if (digits === '') {\n prefix = gap\n } else {\n gaps.push(gap)\n }\n gap = ''\n digits += String(digit)\n }\n }\n\n return { digits, gaps, prefix, suffix: digits === '' ? '' : gap }\n}\n\n// The symbols of a locale's format, found with `format` alone.\nfunction symbolsOf(\n locale: string,\n resolved: Intl.ResolvedNumberFormatOptions,\n options: NumberFormatOptions,\n): Symbols {\n const numberingSystem = optionalString(resolved.numberingSystem)\n const numerals = numeralsOf(resolved.locale, numberingSystem)\n const digitOf = new Map(numerals.map((numeral, digit) => [numeral, digit]))\n const scale = resolved.style === 'percent' ? 100 : 1\n\n // 12,345.67 and its negative, in the format's style.\n const probe = new Intl.NumberFormat(\n locale,\n probeOptionsOf(resolved, {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n }),\n )\n const positive = spansOf(probe.format(PROBE / scale), digitOf)\n const negative = spansOf(probe.format(-PROBE / scale), digitOf)\n const read = positive.digits === PROBE_DIGITS ? positive : undefined\n const decimal = read?.gaps[4] === '' ? undefined : read?.gaps[4]\n const group = read?.gaps[1] === '' ? undefined : read?.gaps[1]\n\n // The sign is what the negative adds on one side of the digits. Added on\n // both, it is an accounting format's brackets, which are text around the\n // number rather than a sign.\n const before = differenceOf(positive.prefix, negative.prefix)\n const after = differenceOf(positive.suffix, negative.suffix)\n const signedBefore = before.added !== '' && after.added === ''\n const signedAfter = after.added !== '' && before.added === ''\n const minusSign =\n signOf(signedBefore ? before.added : signedAfter ? after.added : '') || '-'\n\n // A plus sign, where the format writes one.\n let plusSign: string | undefined\n if (\n options.signDisplay === 'always' ||\n options.signDisplay === 'exceptZero'\n ) {\n const signed = spansOf(\n new Intl.NumberFormat(\n locale,\n probeOptionsOf(resolved, {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n signDisplay: 'always',\n }),\n ).format(PROBE / scale),\n digitOf,\n )\n const plusBefore = differenceOf(positive.prefix, signed.prefix).added\n const plusAfter = differenceOf(positive.suffix, signed.suffix).added\n plusSign = signOf(plusBefore === '' ? plusAfter : plusBefore) || '+'\n }\n\n // The plural forms of the format, whose text can differ from one number to\n // the next: \"1 day\" and \"2 days\".\n const plurals = new Intl.NumberFormat(\n locale,\n probeOptionsOf(resolved, {\n maximumFractionDigits: 3,\n minimumFractionDigits: 0,\n }),\n )\n const pluralTexts = PLURAL_NUMBERS.map((value) => plurals.format(value))\n const noNumeralUnits = pluralTexts\n .map((text, at) => ({ text: text.trim(), value: PLURAL_NUMBERS[at] ?? 0 }))\n .filter(({ text }) => !Array.from(text).some((char) => digitOf.has(char)))\n .map(({ text, value }) => ({ unit: text, value }))\n\n // Everything around the digits that is not a sign, in pieces between white\n // space, as `formatToParts` hands it over in parts. An accounting format's\n // brackets are pieces of their own, apart from the currency beside them.\n const around = [\n positive.prefix,\n positive.suffix,\n before.rest,\n after.rest,\n ...(signedBefore || signedAfter ? [] : [before.added, after.added]),\n ...pluralTexts.flatMap((text) => {\n const spans = spansOf(text, digitOf)\n return spans.digits === '' ? [] : [spans.prefix, spans.suffix]\n }),\n ]\n const pieces = [\n ...new Set(\n around\n .flatMap((text) => text.split(SPACING_RUN))\n .filter((piece) => piece !== '' && piece !== minusSign)\n .map(escapeRegex),\n ),\n ].toSorted((a, b) => b.length - a.length)\n const literals = new RegExp([...pieces, `[${SPACING}]`].join('|'), 'gu')\n\n const indexes = new Map(numerals.map((numeral, digit) => [numeral, digit]))\n\n return {\n decimal,\n group,\n index: (numeral) => String(indexes.get(numeral)),\n literals,\n minusSign,\n noNumeralUnits,\n numeral: new RegExp(`[${numerals.join('')}]`, 'gu'),\n numerals,\n plusSign,\n }\n}\n\n// A rounding increment needs the fraction digits it rounds to on both\n// sides, which the parser it ports fills in where they are left out.\nfunction withRoundingIncrement(\n given: NumberFormatOptions,\n): NumberFormatOptions {\n const options = { ...given }\n if (options.roundingIncrement !== 1 && options.roundingIncrement != null) {\n if (\n options.maximumFractionDigits == null &&\n options.minimumFractionDigits == null\n ) {\n options.maximumFractionDigits = 0\n options.minimumFractionDigits = 0\n } else {\n options.maximumFractionDigits ??= options.minimumFractionDigits\n options.minimumFractionDigits ??= options.maximumFractionDigits\n }\n }\n return options\n}\n\nexport { NumberParser }\n"],"mappings":";AA6DA,MAAMoB,sBAAsB;AAI5B,MAAMC,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;AAAU;AAKZ,MAAMC,iBAAiB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAI;CAAI;CAAG;CAAG;CAAK;CAAI;CAAK;AAAG;AAInE,MAAMC,QAAQ;AACd,MAAMC,eAAe;AAOrB,MAAMC,UACJ;AACF,MAAMC,cAAc,IAAIX,OAAO,IAAIU,QAAO,KAAM,GAAG;AACnD,MAAME,cAAc,IAAIZ,OAAO,IAAIU,QAAO,IAAK,IAAI;AAOnD,MAAMG,kCAAkB,IAAIC,IAAI;CAC9B,CAAC,KAAK,MAAM;CACZ,CAAC,KAAK,MAAM;CACZ,CAAC,KAAK,SAAS;CACf,CAAC,KAAK,SAAS;CACf,CAAC,KAAK,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CACxC,MAAMhD,WAAW,IAAIC,OAAO,CAAC,GAAG8I,QAAQ,IAAIpI,QAAO,EAAG,CAAC,CAACqE,KAAK,GAAG,GAAG,IAAI;CAEvE,MAAMmE,UAAU,IAAIpI,IAAIX,SAASqH,KAAK1H,SAASwH,UAAU,CAACxH,SAASwH,KAAK,CAAC,CAAC;CAE1E,OAAO;EACL3H;EACAC;EACAC,QAAQC,YAAYuE,OAAO6E,QAAQ5G,IAAIxC,OAAO,CAAC;EAC/CC;EACAE;EACAC;EACAJ,SAAS,IAAIE,OAAO,IAAIG,SAAS4E,KAAK,EAAE,EAAC,IAAK,IAAI;EAClD5E;EACAC;CACF;AACF;AAIA,SAAS8B,sBACPD,OACqB;CACrB,MAAMd,UAAU,EAAE,GAAGc,MAAM;CAC3B,IAAId,QAAQuF,sBAAsB,KAAKvF,QAAQuF,qBAAqB,MAAM;EACxE,IACEvF,QAAQ+B,yBAAyB,QACjC/B,QAAQ2C,yBAAyB,MACjC;GACA3C,QAAQ+B,wBAAwB;GAChC/B,QAAQ2C,wBAAwB;EAClC,OAAO;GACL3C,QAAQ+B,0BAA0B/B,QAAQ2C;GAC1C3C,QAAQ2C,0BAA0B3C,QAAQ+B;EAC5C;CACF;CACA,OAAO/B;AACT"}
|
|
1
|
+
{"version":3,"file":"parser.js","names":["NumberFormatOptions","NoNumeralUnit","unit","value","Spans","digits","gaps","prefix","suffix","Symbols","decimal","group","index","numeral","literals","RegExp","minusSign","noNumeralUnits","numerals","plusSign","CURRENCY_SIGN_REGEX","NUMBERING_SYSTEMS","PLURAL_NUMBERS","PROBE","PROBE_DIGITS","SPACING","SPACING_RUN","SPACING_ANY","SYSTEMS_BY_ZERO","Map","parserCache","NumberParserImpl","NumberParser","locale","options","constructor","getNumberingSystem","numberParserFor","numberingSystem","isValidPartialNumber","minValue","maxValue","parse","formatter","Intl","NumberFormat","ResolvedNumberFormatOptions","symbols","given","withRoundingIncrement","resolvedOptions","symbolsOf","optionalString","get","Infinity","groupAllowed","Boolean","useGrouping","rest","sanitize","startsWith","slice","length","undefined","includes","maximumFractionDigits","replaceAll","replace","plain","Number","NaN","style","percentOf","parsed","isNaN","Math","min","minimumFractionDigits","format","currencySign","test","spelled","find","entry","String","differenceOf","from","to","fromChars","Array","toChars","start","end","added","join","escapeRegex","text","parser","parserOf","system","other","numeralsOf","reverse","key","Object","entries","sort","a","b","cached","set","negative","point","indexOf","moved","probeOptionsOf","resolved","extra","maximumSignificantDigits","minimumSignificantDigits","notation","roundingIncrement","roundingMode","roundingPriority","signDisplay","trailingZeroDisplay","signOf","spansOf","digitOf","ReadonlyMap","chars","gap","char","digit","push","map","scale","probe","positive","read","before","after","signedBefore","signedAfter","signed","plusBefore","plusAfter","plurals","pluralTexts","at","trim","filter","some","has","around","flatMap","spans","pieces","Set","split","piece","indexes"],"sources":["../../src/number/parser.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * Modified by Kanso Labs: ported from @internationalized/number's NumberParser\n * to find the locale's symbols with `format` rather than `formatToParts`.\n */\n\nimport type { NumberFormatOptions } from '@internationalized/number'\n\n// Reading back a number a person typed, in the locale and the format the\n// field shows it in: the parser web's NumberField reads its value with,\n// through React Stately, which is @internationalized/number's NumberParser.\n//\n// **It finds the locale's symbols with `format` alone.** The parser it ports\n// asks `formatToParts` for them, the minus sign, the decimal and group\n// separators, and the currency, percent and unit text around the digits, and\n// Hermes defines no `formatToParts` for `Intl.NumberFormat` on iOS, so it\n// throws on the first character typed there. `format` is what every runtime\n// React Native runs on has. So a known number is formatted, its digits found\n// by the locale's own numerals, and each symbol read off where it falls: the\n// group separator between the second and third digits of 12,345.67, the\n// decimal between the fifth and sixth, the minus where the negative differs\n// from the positive, and the rest of the text around the digits as what the\n// parser strips. Everything after that is the parser it ports, line for\n// line, and the tests compare the two across locales and formats on a\n// runtime that has both.\n\ntype NoNumeralUnit = {\n readonly unit: string\n readonly value: number\n}\n\n// Where a formatted number's digits fall: the digits themselves, as ASCII, the\n// text between each and the next, and the text before and after them.\ntype Spans = {\n readonly digits: string\n readonly gaps: readonly string[]\n readonly prefix: string\n readonly suffix: string\n}\n\ntype Symbols = {\n readonly decimal: string | undefined\n readonly group: string | undefined\n readonly index: (numeral: string) => string\n readonly literals: RegExp\n readonly minusSign: string\n readonly noNumeralUnits: readonly NoNumeralUnit[]\n readonly numeral: RegExp\n readonly numerals: readonly string[]\n readonly plusSign: string | undefined\n}\n\nconst CURRENCY_SIGN_REGEX = /^.*\\(.*\\).*$/u\n\n// The numbering systems a value is tried in when it does not read in the\n// locale's own, as the parser it ports tries them.\nconst NUMBERING_SYSTEMS = [\n 'latn',\n 'arab',\n 'hanidec',\n 'deva',\n 'beng',\n 'fullwide',\n]\n\n// Every number whose plural form a unit or a currency name can take in some\n// locale, from the parser it ports.\nconst PLURAL_NUMBERS = [0, 4, 2, 1, 11, 20, 3, 7, 100, 21, 0.1, 1.1]\n\n// 12,345.67: a group separator after its second digit in every locale that\n// groups, and the decimal separator after its fifth.\nconst PROBE = 12_345.67\nconst PROBE_DIGITS = '1234567'\n\n// White space and the formatting characters, Unicode's `White_Space` and\n// `Cf`, which the parser it ports strips as `\\p{White_Space}|\\p{Cf}`. Spelled\n// out rather than as property escapes, so the expression means the same\n// wherever it is compiled. These are the characters in the Basic\n// Multilingual Plane, which is every one a number format writes.\nconst SPACING =\n '\\\\s\\\\u0085\\\\u00ad\\\\u0600-\\\\u0605\\\\u061c\\\\u06dd\\\\u070f\\\\u0890\\\\u0891\\\\u08e2\\\\u180e\\\\u200b-\\\\u200f\\\\u202a-\\\\u202e\\\\u2060-\\\\u2064\\\\u2066-\\\\u206f\\\\ufeff\\\\ufff9-\\\\ufffb'\nconst SPACING_RUN = new RegExp(`[${SPACING}]+`, 'u')\nconst SPACING_ANY = new RegExp(`[${SPACING}]`, 'gu')\n\n// The numbering system a locale's zero belongs to, for a runtime whose\n// resolved options do not name one: Hermes on iOS names none. These are the\n// systems a value is tried in, and Persian's. A locale writing any other is\n// left unnamed, which a formatter reads as the locale's own system, and\n// that is the one it writes.\nconst SYSTEMS_BY_ZERO = new Map([\n ['0', 'latn'],\n ['٠', 'arab'],\n ['۰', 'arabext'],\n ['〇', 'hanidec'],\n ['०', 'deva'],\n ['০', 'beng'],\n ['0', 'fullwide'],\n])\n\nconst parserCache = new Map<string, NumberParserImpl>()\n\n/**\n * Parses a number in a locale and a format, as @internationalized/number's\n * `NumberParser` does, without `formatToParts`.\n */\nclass NumberParser {\n private readonly locale: string\n private readonly options: NumberFormatOptions\n\n constructor(locale: string, options: NumberFormatOptions = {}) {\n this.locale = locale\n this.options = options\n }\n\n /**\n * The numbering system the value reads in, in the locale, or the locale's\n * own when none matches. `undefined` is the locale's own, on a runtime\n * that does not name it.\n */\n getNumberingSystem(value: string): string | undefined {\n return numberParserFor(this.locale, this.options, value).numberingSystem\n }\n\n /**\n * Whether the value could be the start of a number, which is how input is\n * checked as it is typed. A minus sign counts only where `minValue` is\n * below zero, and a plus sign only where `maxValue` is above it.\n */\n isValidPartialNumber(\n value: string,\n minValue?: number,\n maxValue?: number,\n ): boolean {\n return numberParserFor(\n this.locale,\n this.options,\n value,\n ).isValidPartialNumber(value, minValue, maxValue)\n }\n\n /** The number the value reads as, or `NaN` when it reads as none. */\n parse(value: string): number {\n return numberParserFor(this.locale, this.options, value).parse(value)\n }\n}\n\nclass NumberParserImpl {\n readonly numberingSystem: string | undefined\n private readonly formatter: Intl.NumberFormat\n private readonly locale: string\n private readonly options: Intl.ResolvedNumberFormatOptions\n private readonly symbols: Symbols\n\n constructor(locale: string, given: NumberFormatOptions = {}) {\n this.locale = locale\n const options = withRoundingIncrement(given)\n this.formatter = new Intl.NumberFormat(locale, options)\n this.options = this.formatter.resolvedOptions()\n this.symbols = symbolsOf(locale, this.options, options)\n this.numberingSystem =\n optionalString(this.options.numberingSystem) ??\n SYSTEMS_BY_ZERO.get(this.symbols.numerals[0] ?? '')\n }\n\n isValidPartialNumber(\n value: string,\n minValue = -Infinity,\n maxValue = Infinity,\n ) {\n const groupAllowed = Boolean(this.formatter.resolvedOptions().useGrouping)\n const { decimal, group, minusSign, numeral, plusSign } = this.symbols\n let rest = this.sanitize(value)\n\n // A sign comes first.\n if (minusSign !== '' && rest.startsWith(minusSign) && minValue < 0) {\n rest = rest.slice(minusSign.length)\n } else if (\n plusSign !== undefined &&\n rest.startsWith(plusSign) &&\n maxValue > 0\n ) {\n rest = rest.slice(plusSign.length)\n }\n\n // A format with no fraction takes no decimal separator.\n if (\n decimal !== undefined &&\n rest.includes(decimal) &&\n this.options.maximumFractionDigits === 0\n ) {\n return false\n }\n\n if (group !== undefined && groupAllowed) {\n rest = rest.replaceAll(group, '')\n }\n rest = rest.replace(numeral, '')\n if (decimal !== undefined) {\n rest = rest.replace(decimal, '')\n }\n\n return rest.length === 0\n }\n\n parse(value: string): number {\n const groupAllowed = Boolean(this.formatter.resolvedOptions().useGrouping)\n const { decimal, group, index, minusSign, numeral } = this.symbols\n let plain = this.sanitize(value)\n\n if (!groupAllowed && group !== undefined && plain.includes(group)) {\n return Number.NaN\n } else if (group !== undefined) {\n plain = plain.replaceAll(group, '')\n }\n if (decimal !== undefined) {\n plain = plain.replace(decimal, '.')\n }\n plain = plain.replace(minusSign, '-')\n plain = plain.replace(numeral, index)\n\n if (this.options.style === 'percent') {\n plain = percentOf(plain)\n }\n\n const parsed = plain === '' ? Number.NaN : Number(plain)\n if (Number.isNaN(parsed)) {\n return Number.NaN\n }\n\n if (this.options.style === 'percent') {\n // Rounded as the field's formatter would show it.\n const options = {\n ...this.options,\n maximumFractionDigits: Math.min(\n (this.options.maximumFractionDigits ?? 0) + 2,\n 20,\n ),\n minimumFractionDigits: Math.min(\n (this.options.minimumFractionDigits ?? 0) + 2,\n 20,\n ),\n style: 'decimal',\n } satisfies NumberFormatOptions\n return new NumberParser(this.locale, options).parse(\n new Intl.NumberFormat(this.locale, options).format(parsed),\n )\n }\n\n // An accounting format writes a negative in brackets, which the literals\n // have already stripped.\n if (\n this.options.currencySign === 'accounting' &&\n CURRENCY_SIGN_REGEX.test(value)\n ) {\n return -1 * parsed\n }\n\n return parsed\n }\n\n private sanitize(value: string) {\n const groupAllowed = Boolean(this.formatter.resolvedOptions().useGrouping)\n const { decimal, group, literals, minusSign, noNumeralUnits } = this.symbols\n\n // A unit some plural forms write with no numeral, such as a day spelled\n // out, stands for its number.\n const spelled = noNumeralUnits.find((entry) => entry.unit === value)\n if (spelled !== undefined) {\n return String(spelled.value)\n }\n\n let rest = value.replace(literals, '')\n\n // The ASCII hyphen stands for the locale's minus, which a keyboard may\n // not have.\n rest = rest.replace('-', minusSign)\n\n // Arabic's decimal separator is on few keyboards, which type a comma or\n // the Arabic comma instead, and a full stop for its group separator.\n if (this.numberingSystem === 'arab') {\n if (decimal !== undefined) {\n rest = rest.replaceAll(',', decimal)\n rest = rest.replaceAll('،', decimal)\n }\n if (group !== undefined && groupAllowed) {\n rest = rest.replaceAll('.', group)\n }\n }\n\n // A right single quotation mark groups digits in some formats, Swiss\n // currency among them, where a keyboard types an apostrophe, and newer\n // data writes the apostrophe where older wrote the quotation mark.\n if (group === '’' && rest.includes(\"'\") && groupAllowed) {\n rest = rest.replaceAll(\"'\", group)\n }\n if (group === \"'\" && rest.includes('’') && groupAllowed) {\n rest = rest.replaceAll('’', group)\n }\n\n // French groups with a narrow no-break space, which no French keyboard\n // has, so a space and a no-break space group too.\n if (\n this.options.locale === 'fr-FR' &&\n group !== undefined &&\n groupAllowed\n ) {\n rest = rest.replaceAll(' ', group)\n rest = rest.replaceAll(' ', group)\n }\n\n return rest\n }\n}\n\n// What `from` became in `to`: the text `to` has between the start and the end\n// the two share, and `to` with a space in its place.\nfunction differenceOf(from: string, to: string) {\n const fromChars = Array.from(from)\n const toChars = Array.from(to)\n let start = 0\n while (\n start < fromChars.length &&\n start < toChars.length &&\n fromChars[start] === toChars[start]\n ) {\n start += 1\n }\n let end = 0\n while (\n end < fromChars.length - start &&\n end < toChars.length - start &&\n fromChars[fromChars.length - 1 - end] === toChars[toChars.length - 1 - end]\n ) {\n end += 1\n }\n\n return {\n added: toChars.slice(start, toChars.length - end).join(''),\n rest: `${toChars.slice(0, start).join('')} ${toChars.slice(toChars.length - end).join('')}`,\n }\n}\n\nfunction escapeRegex(text: string) {\n return text.replaceAll(/[$()*+.?[\\\\\\]^{|}]/gu, '\\\\$&')\n}\n\n// The parser for a value: the locale's own numbering system, or the first of\n// the others the value reads in, unless the locale names one.\nfunction numberParserFor(\n locale: string,\n options: NumberFormatOptions,\n value: string,\n) {\n const parser = parserOf(locale, options)\n\n if (!locale.includes('-nu-') && !parser.isValidPartialNumber(value)) {\n for (const system of NUMBERING_SYSTEMS) {\n if (system !== parser.numberingSystem) {\n const other = parserOf(\n `${locale}${locale.includes('-u-') ? '-nu-' : '-u-nu-'}${system}`,\n options,\n )\n if (other.isValidPartialNumber(value)) {\n return other\n }\n }\n }\n }\n\n return parser\n}\n\n// The numerals a locale writes, zero first.\nfunction numeralsOf(locale: string, numberingSystem: string | undefined) {\n return Array.from(\n new Intl.NumberFormat(locale, {\n numberingSystem,\n useGrouping: false,\n }).format(9_876_543_210),\n ).reverse()\n}\n\nfunction optionalString(value: unknown) {\n return typeof value === 'string' ? value : undefined\n}\n\nfunction parserOf(locale: string, options: NumberFormatOptions) {\n const key =\n locale +\n Object.entries(options)\n .sort(([a], [b]) => (a < b ? -1 : 1))\n .join()\n const cached = parserCache.get(key)\n if (cached !== undefined) {\n return cached\n }\n\n const parser = new NumberParserImpl(locale, options)\n parserCache.set(key, parser)\n return parser\n}\n\n// A percent's digits moved two places left on the string rather than divided\n// by 100, which keeps the figures it was written with.\nfunction percentOf(plain: string) {\n const negative = plain.includes('-')\n let digits = plain.replace('-', '').replace('+', '')\n let point = digits.indexOf('.')\n if (point === -1) {\n point = digits.length\n }\n digits = digits.replace('.', '')\n\n const moved =\n point - 2 === 0\n ? `0.${digits}`\n : point - 2 === -1\n ? `0.0${digits}`\n : point - 2 === -2\n ? '0.00'\n : `${digits.slice(0, point - 2)}.${digits.slice(point - 2)}`\n\n return negative ? `-${moved}` : moved\n}\n\n// The options a symbol is read with: the format's own, so its currency,\n// percent or unit text is the text read, at the fraction digits given,\n// grouped, and with the rounding, the notation and the sign at their\n// defaults, so the digits come out whole.\nfunction probeOptionsOf(\n resolved: Intl.ResolvedNumberFormatOptions,\n extra: NumberFormatOptions,\n): NumberFormatOptions {\n return {\n ...resolved,\n maximumSignificantDigits: undefined,\n minimumSignificantDigits: undefined,\n notation: 'standard',\n roundingIncrement: 1,\n roundingMode: 'halfExpand',\n roundingPriority: 'auto',\n signDisplay: 'auto',\n trailingZeroDisplay: 'auto',\n useGrouping: true,\n ...extra,\n }\n}\n\n// The text a number's sign is, with the white space and direction marks\n// around it left out, as `formatToParts` leaves them out of its sign.\nfunction signOf(text: string) {\n return text.replace(SPACING_ANY, '')\n}\n\n// Where a formatted number's digits fall, read by the numerals given.\nfunction spansOf(text: string, digitOf: ReadonlyMap<string, number>): Spans {\n const chars = Array.from(text)\n let digits = ''\n const gaps: string[] = []\n let prefix = ''\n let gap = ''\n\n for (const char of chars) {\n const digit = digitOf.get(char)\n if (digit === undefined) {\n gap += char\n } else {\n if (digits === '') {\n prefix = gap\n } else {\n gaps.push(gap)\n }\n gap = ''\n digits += String(digit)\n }\n }\n\n return { digits, gaps, prefix, suffix: digits === '' ? '' : gap }\n}\n\n// The symbols of a locale's format, found with `format` alone.\nfunction symbolsOf(\n locale: string,\n resolved: Intl.ResolvedNumberFormatOptions,\n options: NumberFormatOptions,\n): Symbols {\n const numberingSystem = optionalString(resolved.numberingSystem)\n const numerals = numeralsOf(resolved.locale, numberingSystem)\n const digitOf = new Map(numerals.map((numeral, digit) => [numeral, digit]))\n const scale = resolved.style === 'percent' ? 100 : 1\n\n // 12,345.67 and its negative, in the format's style.\n const probe = new Intl.NumberFormat(\n locale,\n probeOptionsOf(resolved, {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n }),\n )\n const positive = spansOf(probe.format(PROBE / scale), digitOf)\n const negative = spansOf(probe.format(-PROBE / scale), digitOf)\n const read = positive.digits === PROBE_DIGITS ? positive : undefined\n const decimal = read?.gaps[4] === '' ? undefined : read?.gaps[4]\n const group = read?.gaps[1] === '' ? undefined : read?.gaps[1]\n\n // The sign is what the negative adds on one side of the digits. Added on\n // both, it is an accounting format's brackets, which are text around the\n // number rather than a sign.\n const before = differenceOf(positive.prefix, negative.prefix)\n const after = differenceOf(positive.suffix, negative.suffix)\n const signedBefore = before.added !== '' && after.added === ''\n const signedAfter = after.added !== '' && before.added === ''\n const minusSign =\n signOf(signedBefore ? before.added : signedAfter ? after.added : '') || '-'\n\n // A plus sign, where the format writes one.\n let plusSign: string | undefined\n if (\n options.signDisplay === 'always' ||\n options.signDisplay === 'exceptZero'\n ) {\n const signed = spansOf(\n new Intl.NumberFormat(\n locale,\n probeOptionsOf(resolved, {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n signDisplay: 'always',\n }),\n ).format(PROBE / scale),\n digitOf,\n )\n const plusBefore = differenceOf(positive.prefix, signed.prefix).added\n const plusAfter = differenceOf(positive.suffix, signed.suffix).added\n plusSign = signOf(plusBefore === '' ? plusAfter : plusBefore) || '+'\n }\n\n // The plural forms of the format, whose text can differ from one number to\n // the next: \"1 day\" and \"2 days\".\n const plurals = new Intl.NumberFormat(\n locale,\n probeOptionsOf(resolved, {\n maximumFractionDigits: 3,\n minimumFractionDigits: 0,\n }),\n )\n const pluralTexts = PLURAL_NUMBERS.map((value) => plurals.format(value))\n const noNumeralUnits = pluralTexts\n .map((text, at) => ({ text: text.trim(), value: PLURAL_NUMBERS[at] ?? 0 }))\n .filter(({ text }) => !Array.from(text).some((char) => digitOf.has(char)))\n .map(({ text, value }) => ({ unit: text, value }))\n\n // Everything around the digits that is not a sign, in pieces between white\n // space, as `formatToParts` hands it over in parts. An accounting format's\n // brackets are pieces of their own, apart from the currency beside them.\n const around = [\n positive.prefix,\n positive.suffix,\n before.rest,\n after.rest,\n ...(signedBefore || signedAfter ? [] : [before.added, after.added]),\n ...pluralTexts.flatMap((text) => {\n const spans = spansOf(text, digitOf)\n return spans.digits === '' ? [] : [spans.prefix, spans.suffix]\n }),\n ]\n const pieces = [\n ...new Set(\n around\n .flatMap((text) => text.split(SPACING_RUN))\n .filter((piece) => piece !== '' && piece !== minusSign)\n .map(escapeRegex),\n ),\n ].sort((a, b) => b.length - a.length)\n const literals = new RegExp([...pieces, `[${SPACING}]`].join('|'), 'gu')\n\n const indexes = new Map(numerals.map((numeral, digit) => [numeral, digit]))\n\n return {\n decimal,\n group,\n index: (numeral) => String(indexes.get(numeral)),\n literals,\n minusSign,\n noNumeralUnits,\n numeral: new RegExp(`[${numerals.join('')}]`, 'gu'),\n numerals,\n plusSign,\n }\n}\n\n// A rounding increment needs the fraction digits it rounds to on both\n// sides, which the parser it ports fills in where they are left out.\nfunction withRoundingIncrement(\n given: NumberFormatOptions,\n): NumberFormatOptions {\n const options = { ...given }\n if (options.roundingIncrement !== 1 && options.roundingIncrement != null) {\n if (\n options.maximumFractionDigits == null &&\n options.minimumFractionDigits == null\n ) {\n options.maximumFractionDigits = 0\n options.minimumFractionDigits = 0\n } else {\n options.maximumFractionDigits ??= options.minimumFractionDigits\n options.minimumFractionDigits ??= options.maximumFractionDigits\n }\n }\n return options\n}\n\nexport { NumberParser }\n"],"mappings":";AA6DA,MAAMoB,sBAAsB;AAI5B,MAAMC,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;AAAU;AAKZ,MAAMC,iBAAiB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAI;CAAI;CAAG;CAAG;CA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