@kanso-labs/react-native-kanso-ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/index.d.ts +8 -0
- package/dist/button/index.js +38 -26
- package/dist/button/index.js.map +1 -1
- package/dist/button/slots.js +7 -0
- package/dist/button/slots.js.map +1 -0
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/index.js +115 -109
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +3 -3
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +2 -2
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +131 -0
- package/dist/components/dialog/index.js +861 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/icon-button/index.d.ts +3 -3
- package/dist/components/icon-button/index.js +128 -122
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +2 -2
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +3 -3
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +2 -2
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +2 -2
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +3 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +3 -3
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +3 -3
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +2 -2
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +3 -3
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/mark/index.d.ts +1 -1
- package/dist/mark/index.js.map +1 -1
- package/dist/overlay/host.js.map +1 -1
- package/dist/press/index.js +59 -60
- package/dist/press/index.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","GestureResponderEvent","HostInstance","LayoutChangeEvent","ModalProps","ScrollViewProps","StyleProp","TextProps","TextStyle","ViewProps","ViewStyle","AnimatedStyle","EdgeInsets","OverlayTriggerState","createContext","use","useCallback","useEffect","useId","useLayoutEffect","useMemo","useRef","useState","AccessibilityInfo","Modal","Text","NativeText","Platform","ScrollView","StyleSheet","useWindowDimensions","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","SafeAreaInsetsContext","useOverlayTriggerState","ButtonSlots","ResolvedTheme","AnimatedPressable","ButtonSlotContext","useWindowSizeClass","OverlayHost","withOpacity","useTheme","composeStyles","themedStyles","useTypeRole","MIN_WIDTH","MAX_WIDTH","SCALE_FROM","RISE_FROM","SCRIM_OPACITY","NO_INSETS","bottom","left","right","top","ORIENTATIONS","NO_PARTS","Readonly","Record","DialogPart","footer","header","title","stylesOf","colors","radii","shadows","sizing","spacing","create","actions","alignItems","flexDirection","flexShrink","flexWrap","gap","sm","justifyContent","padding","xl","actionsFull","borderTopColor","outlineVariant","borderTopWidth","minHeight","rowSm","paddingVertical","xs","bodyText","color","onSurfaceVariant","container","backgroundColor","surfaceContainerHigh","overflow","containerBasic","borderRadius","boxShadow","elevation3","maxHeight","maxWidth","minWidth","width","containerFull","flex","md","paddingBottom","lg","paddingHorizontal","paddingTop","headerFull","borderBottomColor","borderBottomWidth","layout","pointerEvents","position","layoutFull","scrim","onSurface","DialogLayout","basic","parts","register","part","setTitle","node","titleId","DialogTrigger","state","trigger","DialogLayoutContext","DialogTriggerContext","DialogBodyProps","ref","DialogContentProps","DialogOpenProps","Omit","children","isDismissable","isKeyboardDismissDisabled","role","style","defaultOpen","isOpen","onOpenChange","DialogPartProps","DialogProps","DialogTitleProps","bodyPaddingOf","Dialog","t0","$","_c","t1","setTrigger","t2","context","t3","default","event","target","currentTarget","open","slots","t4","t5","DialogBody","contentContainerStyle","onContentSizeChange","onLayout","props","useLayout","theme","styles","text","content","setContent","room","setRoom","height","measureContent","nativeEvent","measureRoom","T0","t6","DialogContent","undefined","outer","own","insets","sizeClass","setParts","Symbol","for","registerOf","present","setPresent","motion","useDialogMotion","close","t7","t8","useReturnFocus","labelledBy","web","OS","t9","focusOf","t10","t11","t12","panelRoleOf","t13","t14","insetsOf","panel","t15","t16","t17","t18","ignore","DialogFooter","DialogHeader","DialogTitle","refsOf","sendAccessibilityEvent","paddingLeft","paddingRight","Pick","T","other","current","update","reduceMotion","durationMedium1","durationShort2","durationShort3","easingEmphasizedAccelerate","easingEmphasizedDecelerate","easingStandard","fade","duration","easing","bezier","set","timer","setTimeout","Math","max","clearTimeout","shown","get","opacity","transform","scale","translateY","Error","gone","Body","Content","Footer","Header","Title","_c","NativeText"],"sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n GestureResponderEvent,\n HostInstance,\n LayoutChangeEvent,\n ModalProps,\n ScrollViewProps,\n StyleProp,\n TextProps,\n TextStyle,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { EdgeInsets } from 'react-native-safe-area-context'\nimport type { OverlayTriggerState } from 'react-stately/useOverlayTriggerState'\n\nimport {\n createContext,\n use,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport {\n AccessibilityInfo,\n Modal,\n Text as NativeText,\n Platform,\n ScrollView,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\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'\nimport { useOverlayTriggerState } from 'react-stately/useOverlayTriggerState'\n\nimport type { ButtonSlots } from '../../button/slots'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { AnimatedPressable } from '../../button'\nimport { ButtonSlotContext } from '../../button/slots'\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport { OverlayHost } from '../../overlay'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// The dialogs spec page's two dialogs, as kanso-ui's Dialog draws them: one\n// component, since the page pairs them by window size rather than offering a\n// choice. In a medium window or wider it is the basic dialog, a container on\n// surface container high with the 28dp corner, between 280 and 560dp wide,\n// centred over the scrim, with 24dp of padding all round, 16dp between the\n// headline and the body and 24dp between the body and the actions. In a\n// compact window, below 600dp, the same dialog fills the window as the page's\n// full-screen dialog: square corners, a 56dp header with the headline in\n// title large and a divider under it, and a 56dp action bar over a divider,\n// both inside the device's safe area.\n//\n// An alert dialog, `role=\"alertdialog\"`, is a question with two or three\n// answers rather than a task, and stays the basic dialog at every width, as\n// on web, where a question filling a phone read as a headline at the top of\n// the screen and its answers at the bottom with nothing between them.\n//\n// **It is drawn in a React Native `Modal`**, which keeps React context, so\n// the dialog keeps the `ThemeScope` around it, and which is a window of its\n// own on iOS and Android, above the screen and its overlays. The `Modal`\n// therefore hosts overlays of its own, so a snackbar or a popover raised from\n// inside the dialog draws above it rather than under it.\n//\n// **It animates out as well as in**, from the motion tokens: the panel scales\n// up from 90% on the emphasised decelerating curve, or rises 3% of the window\n// when it fills it, and leaves on the emphasised accelerating one, while the\n// scrim fades on the standard curve. Web only animates in, since React Aria\n// keeps a closing surface mounted only while a CSS animation runs; here the\n// dialog stays mounted until its exit has run. Under reduced motion the\n// panel appears and leaves at once, and the scrim still fades, which is what\n// says the dialog came and went.\n//\n// **A press on the scrim closes it**, unless `isDismissable` is false, and\n// Android's back gesture and VoiceOver's escape gesture close it, unless\n// `isKeyboardDismissDisabled`, the prop that keeps Escape from closing it on\n// web, which is the key React Native Web's `Modal` hands the same handler.\n// A button inside `Dialog` and outside its content opens it, and one given\n// `slot=\"close\"` inside the content closes it, through src/button's\n// slots.ts.\n//\n// **Focus moves into the dialog and back.** On iOS and Android the screen\n// reader is sent to the headline once the dialog shows, and back to the\n// button that opened it once it has gone. React Native Web's `Modal` traps\n// focus and restores it itself, and is the dialog element there, so on web it\n// takes the dialog's name and the panel takes no role of its own. That\n// `Modal` sets its role itself, so an alert dialog is announced as a dialog\n// in the web Storybook; kanso-ui, the library for web apps, keeps the role.\n\n// The panel's width bounds, the page's, and how far it travels as it\n// arrives: it scales up from 90% as the basic dialog, or rises 3% of the\n// window as the full-screen one, as web's keyframes have it.\nconst MIN_WIDTH = 280\nconst MAX_WIDTH = 560\nconst SCALE_FROM = 0.9\nconst RISE_FROM = 0.03\n\n// The scrim is the scrim role at 32%, the opacity Material Design gives a\n// modal's scrim and web mixes in.\nconst SCRIM_OPACITY = 0.32\n\n// Outside a SafeAreaProvider the insets are unknown, and the window's own edge\n// is the best bound there is.\nconst NO_INSETS = { bottom: 0, left: 0, right: 0, top: 0 }\n\n// iOS presents a `Modal` in portrait alone unless told otherwise, which would\n// turn an app held sideways round as the dialog opened.\nconst ORIENTATIONS: ModalProps['supportedOrientations'] = [\n 'portrait',\n 'portrait-upside-down',\n 'landscape',\n 'landscape-left',\n 'landscape-right',\n]\n\nconst NO_PARTS: Readonly<Record<DialogPart, number>> = {\n footer: 0,\n header: 0,\n title: 0,\n}\n\nconst stylesOf = themedStyles(\n ({ colors, radii, shadows, sizing, spacing }: ResolvedTheme) =>\n StyleSheet.create({\n // The page's 24dp between the body and the actions, and 8dp between\n // the buttons. Actions that do not fit on one row wrap onto another,\n // still at the trailing edge.\n actions: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 0,\n flexWrap: 'wrap',\n gap: spacing.sm,\n justifyContent: 'flex-end',\n padding: spacing.xl,\n },\n // Full screen, the actions are the page's bottom action bar: 56dp at\n // least, over a divider, so an action whose label wraps grows the bar\n // rather than meeting the divider.\n actionsFull: {\n borderTopColor: colors.outlineVariant,\n borderTopWidth: 1,\n minHeight: sizing.rowSm,\n paddingVertical: spacing.xs,\n },\n // The text a body is handed as a string, in the page's body medium on\n // on-surface variant, which is what web's body sets for its text.\n bodyText: {\n color: colors.onSurfaceVariant,\n },\n // Both dialogs' container, whose corner, where it has one, clips the\n // body's scroll.\n container: {\n backgroundColor: colors.surfaceContainerHigh,\n overflow: 'hidden',\n },\n // The basic dialog's container, centred over the scrim and only as\n // tall as the room the scrim's padding leaves, so the body scrolls\n // rather than running off the screen.\n containerBasic: {\n borderRadius: radii.xl,\n boxShadow: shadows.elevation3,\n maxHeight: '100%',\n maxWidth: MAX_WIDTH,\n minWidth: MIN_WIDTH,\n width: '100%',\n },\n // Full screen, the container fills the window with square corners, and\n // its fill runs on under the safe area its content keeps out of.\n containerFull: {\n flex: 1,\n },\n // The page's 24dp above the headline and 16dp between it and the body,\n // with the headline beside whatever else the header holds, a close\n // button for one.\n header: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 0,\n gap: spacing.md,\n justifyContent: 'space-between',\n paddingBottom: spacing.lg,\n paddingHorizontal: spacing.xl,\n paddingTop: spacing.xl,\n },\n // Full screen, the header is the page's own 56dp bar, at least, under\n // a divider.\n headerFull: {\n borderBottomColor: colors.outlineVariant,\n borderBottomWidth: 1,\n minHeight: sizing.rowSm,\n paddingBottom: spacing.xs,\n paddingTop: spacing.xs,\n },\n // The scrim centres the container, which is what makes the dialog a\n // dialog rather than a sheet. Full screen it has no room to give. It\n // takes no touches itself, so a press around the container reaches the\n // scrim under it.\n layout: {\n alignItems: 'center',\n bottom: 0,\n justifyContent: 'center',\n left: 0,\n padding: spacing.xl,\n pointerEvents: 'box-none',\n position: 'absolute',\n right: 0,\n top: 0,\n },\n layoutFull: {\n alignItems: 'stretch',\n padding: 0,\n },\n scrim: {\n backgroundColor: withOpacity(colors.scrim, SCRIM_OPACITY),\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n // The headline gives way to whatever shares its row.\n title: {\n color: colors.onSurface,\n flexShrink: 1,\n },\n }),\n)\n\n// What the content's parts read: which of the two dialogs is drawn, which\n// parts are there, and the headline's name and node.\ntype DialogLayout = {\n readonly basic: boolean\n readonly parts: Readonly<Record<DialogPart, number>>\n readonly register: (part: DialogPart) => () => void\n readonly setTitle: (node: HostInstance | null) => void\n readonly titleId: string\n}\n\ntype DialogPart = 'footer' | 'header' | 'title'\n\n// What `Dialog` hands its content: the open state, and the button that last\n// opened it, for focus to return to.\ntype DialogTrigger = {\n readonly state: OverlayTriggerState\n readonly trigger: HostInstance | null\n}\n\nconst DialogLayoutContext = createContext<DialogLayout | null>(null)\nconst DialogTriggerContext = createContext<DialogTrigger | null>(null)\n\ntype DialogBodyProps = ScrollViewProps & {\n readonly ref?: Ref<ComponentRef<typeof ScrollView>>\n}\n\ntype DialogContentProps = DialogOpenProps &\n Omit<ViewProps, 'children' | 'role' | 'style'> & {\n readonly children?: ReactNode\n /**\n * Whether a press on the scrim, outside the container, closes the\n * dialog. Android's back gesture is `isKeyboardDismissDisabled`'s, and\n * this says nothing about it, so a dialog that has to be answered from\n * one of its actions turns off both.\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 dialog.\n * @default false\n */\n readonly isKeyboardDismissDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * `alertdialog` for a dialog interrupting with something that has to be\n * answered before the app carries on. It also keeps the dialog the basic\n * one in a compact window, centred and sized to its content, where a\n * dialog of the default role fills the window.\n * @default 'dialog'\n */\n readonly role?: 'alertdialog' | 'dialog'\n readonly style?: StyleProp<ViewStyle>\n }\n\ntype DialogOpenProps = {\n /** Whether the dialog starts open, when it keeps its own state. */\n readonly defaultOpen?: boolean\n /** Whether the dialog is open, when the call site holds the state. */\n readonly isOpen?: boolean\n /** Called with the new state as the dialog opens or closes. */\n readonly onOpenChange?: (isOpen: boolean) => void\n}\n\ntype DialogPartProps = ViewProps & {\n readonly ref?: Ref<ComponentRef<typeof View>>\n}\n\ntype DialogProps = DialogOpenProps & {\n /** The button that opens the dialog, and `Dialog.Content`. */\n readonly children?: ReactNode\n}\n\ntype DialogTitleProps = Omit<TextProps, 'role'> & {\n readonly ref?: Ref<HostInstance>\n}\n\n// The body's padding. The page's 24dp all round is spent by whichever part\n// is at each end, so the body takes the top of it when no header is there\n// and the bottom when no footer is. Full screen, it keeps 24dp under the\n// header's divider as well, which is the content padding the page gives the\n// full-screen dialog.\nfunction bodyPaddingOf(\n { basic, parts }: DialogLayout,\n spacing: ResolvedTheme['spacing'],\n): ViewStyle {\n return {\n gap: spacing.lg,\n paddingBottom: parts.footer > 0 ? 0 : spacing.xl,\n paddingHorizontal: spacing.xl,\n paddingTop: basic && parts.header > 0 ? 0 : spacing.xl,\n }\n}\n\n/**\n * A modal dialog centred over the screen, and the same dialog filling the\n * window in a compact window, the dialogs spec page's basic and full-screen\n * dialogs, paired by window size as the page pairs them. An alert dialog\n * stays the basic one at every width. Pass `isOpen` with `onOpenChange` to\n * hold the open state, or `defaultOpen` to let it keep its own.\n *\n * ```tsx\n * <Dialog>\n * <Button>Open</Button>\n * <Dialog.Content>\n * <Dialog.Header>\n * <Dialog.Title>Headline</Dialog.Title>\n * </Dialog.Header>\n * <Dialog.Body>Supporting text</Dialog.Body>\n * <Dialog.Footer>\n * <Button slot=\"close\" variant=\"text\">Cancel</Button>\n * </Dialog.Footer>\n * </Dialog.Content>\n * </Dialog>\n * ```\n *\n * Composed rather than configured by props, as web's is, since a dialog's\n * header, body and actions all take arbitrary content. A `Button` or\n * `IconButton` inside `Dialog` and outside its content opens it, and one\n * given `slot=\"close\"` anywhere inside the content closes it. A dialog nothing on\n * the screen opens leaves `Dialog` out and passes `isOpen` and\n * `onOpenChange` to `Dialog.Content` instead.\n */\nfunction Dialog({ children, defaultOpen, isOpen, onOpenChange }: DialogProps) {\n const state = useOverlayTriggerState({ defaultOpen, isOpen, onOpenChange })\n const [trigger, setTrigger] = useState<HostInstance | null>(null)\n const context = useMemo(() => ({ state, trigger }), [state, trigger])\n // The default slot a button inside `Dialog` fills: it records\n // itself as the button focus returns to, and opens the dialog. React\n // Native types the target as a bare view tag too, which focus cannot be\n // sent to, so such a press records nothing.\n const slots = useMemo<ButtonSlots>(\n () => ({\n default: (event: GestureResponderEvent) => {\n const target = event.currentTarget\n\n setTrigger(typeof target === 'number' ? null : target)\n state.open()\n },\n }),\n [state],\n )\n\n return (\n <DialogTriggerContext value={context}>\n <ButtonSlotContext value={slots}>{children}</ButtonSlotContext>\n </DialogTriggerContext>\n )\n}\n\n/**\n * What the dialog shows, as a body that scrolls when its content runs past\n * the room it has. A string is drawn in the page's body medium on on-surface\n * variant; anything else draws itself. `style`, `ref` and `testID` land on\n * the `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.\n */\nfunction DialogBody({\n children,\n contentContainerStyle,\n onContentSizeChange,\n onLayout,\n ...props\n}: DialogBodyProps) {\n const layout = useLayout('Dialog.Body')\n const theme = useTheme()\n const styles = stylesOf(theme)\n const text = useTypeRole('bodyMedium')\n const { spacing } = theme\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\n return (\n <ScrollView\n focusable={content > room}\n onContentSizeChange={measureContent}\n onLayout={measureRoom}\n {...props}\n contentContainerStyle={composeStyles<ViewStyle>(\n bodyPaddingOf(layout, spacing),\n contentContainerStyle,\n )}\n >\n {typeof children === 'string' ? (\n <NativeText style={composeStyles<TextStyle>(text, styles.bodyText)}>\n {children}\n </NativeText>\n ) : (\n children\n )}\n </ScrollView>\n )\n}\n\n/**\n * The dialog itself, and the scrim behind it. Everything the dialog shows\n * goes in here; the button that opens it stays outside it.\n *\n * Inside `Dialog`, 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\"`\n * button, the scrim and the back gesture all report through `onOpenChange`.\n * `style`, `ref` and `testID` land on the container.\n */\nfunction DialogContent({\n children,\n defaultOpen,\n isDismissable = true,\n isKeyboardDismissDisabled = false,\n isOpen,\n onOpenChange,\n role = 'dialog',\n style,\n ...props\n}: DialogContentProps) {\n const outer = use(DialogTriggerContext)\n const own = useOverlayTriggerState({ defaultOpen, isOpen, onOpenChange })\n const state = outer?.state ?? own\n const theme = useTheme()\n const styles = stylesOf(theme)\n const insets = use(SafeAreaInsetsContext) ?? NO_INSETS\n const sizeClass = useWindowSizeClass()\n const basic = role === 'alertdialog' || sizeClass !== 'compact'\n const titleId = useId()\n const [parts, setParts] = useState(NO_PARTS)\n const [register] = useState(() => registerOf(setParts))\n const [title, setTitle] = useState<HostInstance | null>(null)\n const [present, setPresent] = useState(state.isOpen)\n const motion = useDialogMotion(state.isOpen, present, setPresent, basic)\n const close = useCallback(() => {\n state.close()\n }, [state])\n const slots = useMemo<ButtonSlots>(() => ({ close }), [close])\n const layout = useMemo<DialogLayout>(\n () => ({ basic, parts, register, setTitle, titleId }),\n [basic, parts, register, titleId],\n )\n\n // Mounted the moment it opens, and kept until its exit has run.\n if (state.isOpen && !present) {\n setPresent(true)\n }\n\n useReturnFocus(present, outer)\n\n if (!present) {\n return null\n }\n\n const labelledBy = parts.title > 0 ? titleId : undefined\n const web = Platform.OS === 'web'\n\n return (\n <Modal\n animationType=\"none\"\n aria-labelledby={web ? labelledBy : undefined}\n navigationBarTranslucent\n onRequestClose={isKeyboardDismissDisabled ? ignore : close}\n onShow={focusOf(title)}\n statusBarTranslucent\n supportedOrientations={ORIENTATIONS}\n transparent\n visible\n >\n {/* Nothing in the window takes the trigger's slot, the overlays this\n one hosts included, so a button in a snackbar raised from the dialog\n opens nothing; only the panel's buttons take the close slot. */}\n <ButtonSlotContext value={null}>\n <OverlayHost>\n {/* A screen reader and a keyboard skip the scrim: the first closes\n the dialog with the back or escape gesture, the second with\n Escape. React Native Web's Pressable is a tab stop unless told\n otherwise, whatever `focusable` says. */}\n <AnimatedPressable\n accessible={false}\n aria-hidden\n focusable={false}\n onPress={isDismissable && state.isOpen ? close : undefined}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.scrim,\n motion.scrim,\n )}\n tabIndex={-1}\n />\n <View\n style={composeStyles<ViewStyle>(\n styles.layout,\n basic ? undefined : styles.layoutFull,\n )}\n >\n <Animated.View\n {...(web ? undefined : panelRoleOf(role, labelledBy))}\n onAccessibilityEscape={\n isKeyboardDismissDisabled ? undefined : close\n }\n {...props}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.container,\n basic ? styles.containerBasic : styles.containerFull,\n basic ? undefined : insetsOf(insets),\n motion.panel,\n style,\n )}\n >\n <DialogLayoutContext value={layout}>\n <ButtonSlotContext value={slots}>{children}</ButtonSlotContext>\n </DialogLayoutContext>\n </Animated.View>\n </View>\n </OverlayHost>\n </ButtonSlotContext>\n </Modal>\n )\n}\n\n/**\n * The dialog's actions, at the trailing edge and wrapping onto another row\n * when they do not fit on one. Full screen they are the page's bottom action\n * bar. `style`, `ref` and `testID` land on its view.\n */\nfunction DialogFooter({ style, ...props }: DialogPartProps) {\n const layout = useLayout('Dialog.Footer')\n const styles = stylesOf(useTheme())\n const { register } = layout\n\n useLayoutEffect(() => register('footer'), [register])\n\n return (\n <View\n {...props}\n style={composeStyles<ViewStyle>(\n styles.actions,\n layout.basic ? undefined : styles.actionsFull,\n style,\n )}\n />\n )\n}\n\n/**\n * The dialog's header: its `Dialog.Title`, and anything beside it, such as a\n * close button. Full screen it is the page's header bar. `style`, `ref` and\n * `testID` land on its view.\n */\nfunction DialogHeader({ style, ...props }: DialogPartProps) {\n const layout = useLayout('Dialog.Header')\n const styles = stylesOf(useTheme())\n const { register } = layout\n\n useLayoutEffect(() => register('header'), [register])\n\n return (\n <View\n {...props}\n style={composeStyles<ViewStyle>(\n styles.header,\n layout.basic ? undefined : styles.headerFull,\n style,\n )}\n />\n )\n}\n\n/**\n * Names the dialog: the container is labelled by it, and a screen reader is\n * sent to it once the dialog shows. In headline small as the basic dialog,\n * and title large as the full-screen one, where it shares a 56dp bar.\n * `style`, `ref` and `testID` land on React Native's own Text.\n */\nfunction DialogTitle({ ref, style, ...props }: DialogTitleProps) {\n const layout = useLayout('Dialog.Title')\n const styles = stylesOf(useTheme())\n const role = useTypeRole(layout.basic ? 'headlineSmall' : 'titleLarge')\n const { register, setTitle } = layout\n\n useLayoutEffect(() => register('title'), [register])\n\n return (\n <NativeText\n {...props}\n nativeID={layout.titleId}\n ref={refsOf(setTitle, ref)}\n role=\"heading\"\n style={composeStyles<TextStyle>(role, styles.title, style)}\n />\n )\n}\n\n// Sends the screen reader to the headline once the dialog has shown. React\n// Native Web's `Modal` moves focus into itself.\nfunction focusOf(title: HostInstance | null) {\n return () => {\n if (title !== null && Platform.OS !== 'web') {\n AccessibilityInfo.sendAccessibilityEvent(title, 'focus')\n }\n }\n}\n\n// What the back gesture does on a dialog it may not close: nothing, rather\n// than leaving the handler out, which Android warns about.\nfunction ignore() {}\n\nfunction insetsOf(insets: EdgeInsets): ViewStyle {\n return {\n paddingBottom: insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n paddingTop: insets.top,\n }\n}\n\n// The panel's role and name on iOS and Android. On web React Native Web's\n// `Modal` is the dialog element, so the panel takes neither there.\nfunction panelRoleOf(\n role: 'alertdialog' | 'dialog',\n labelledBy: string | undefined,\n): Pick<ViewProps, 'aria-labelledby' | 'aria-modal' | 'role'> {\n return { 'aria-labelledby': labelledBy, 'aria-modal': true, role }\n}\n\n// Every ref a node is handed to, the part's own and the call site's.\nfunction refsOf<T>(own: (node: null | T) => void, other: Ref<T> | undefined) {\n return (node: null | T) => {\n own(node)\n if (typeof other === 'function') {\n other(node)\n } else if (other !== null && other !== undefined) {\n other.current = node\n }\n }\n}\n\n// Counts each part as it mounts and unmounts, so the body knows which ends\n// it has to pad.\nfunction registerOf(\n setParts: (\n update: (\n parts: Readonly<Record<DialogPart, number>>,\n ) => Readonly<Record<DialogPart, number>>,\n ) => void,\n) {\n return (part: DialogPart) => {\n setParts((parts) => ({ ...parts, [part]: parts[part] + 1 }))\n\n return () => {\n setParts((parts) => ({ ...parts, [part]: parts[part] - 1 }))\n }\n }\n}\n\n/**\n * The scrim's and the panel's motion, and the timer that unmounts the dialog\n * once its exit has run. The panel arrives over the medium duration on the\n * emphasised decelerating curve and leaves over the short one on the\n * accelerating curve, and the scrim fades over the short one on the standard\n * curve, both ways. Under reduced motion the panel arrives and leaves at once.\n */\nfunction useDialogMotion(\n isOpen: boolean,\n present: boolean,\n setPresent: (present: boolean) => void,\n basic: boolean,\n) {\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n const { height } = useWindowDimensions()\n const panel = useSharedValue(0)\n const scrim = useSharedValue(0)\n\n useEffect(() => {\n const fade = {\n duration: motion.durationShort2,\n easing: Easing.bezier(...motion.easingStandard),\n }\n\n if (isOpen) {\n scrim.set(withTiming(1, fade))\n panel.set(\n reduceMotion\n ? 1\n : withTiming(1, {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasizedDecelerate),\n }),\n )\n return undefined\n }\n\n if (!present) {\n return undefined\n }\n\n scrim.set(withTiming(0, fade))\n panel.set(\n reduceMotion\n ? 0\n : withTiming(0, {\n duration: motion.durationShort3,\n easing: Easing.bezier(...motion.easingEmphasizedAccelerate),\n }),\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 }, [isOpen, motion, panel, present, reduceMotion, scrim, setPresent])\n\n return {\n panel: useAnimatedStyle(() => {\n 'worklet'\n const shown = panel.get()\n\n return basic\n ? {\n opacity: shown,\n transform: [{ scale: SCALE_FROM + (1 - SCALE_FROM) * shown }],\n }\n : {\n opacity: shown,\n transform: [{ translateY: (1 - shown) * RISE_FROM * height }],\n }\n }),\n scrim: useAnimatedStyle(() => {\n 'worklet'\n return { opacity: scrim.get() }\n }),\n }\n}\n\nfunction useLayout(part: string) {\n const layout = use(DialogLayoutContext)\n\n if (layout === null) {\n throw new Error(`${part} is drawn inside Dialog.Content.`)\n }\n\n return layout\n}\n\n// Sends the screen reader back to the button that opened the dialog once the\n// dialog has gone. React Native Web's `Modal` restores focus itself.\nfunction useReturnFocus(present: boolean, outer: DialogTrigger | null) {\n const shown = useRef(present)\n\n useEffect(() => {\n const trigger = outer?.trigger ?? null\n const gone = shown.current && !present\n\n shown.current = present\n if (gone && trigger !== null && Platform.OS !== 'web') {\n AccessibilityInfo.sendAccessibilityEvent(trigger, 'focus')\n }\n }, [outer, present])\n}\n\nDialog.Body = DialogBody\nDialog.Content = DialogContent\nDialog.Footer = DialogFooter\nDialog.Header = DialogHeader\nDialog.Title = DialogTitle\n\nexport {\n Dialog,\n DialogBody,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n}\nexport type {\n DialogBodyProps,\n D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C/B,MAAMV,SAASxG,IAAIyH,mBAAmB;CAEtC,IAAIjB,WAAW,MACb,MAAM,IAAI+I,MAAM,GAAGrI,KAAI,iCAAkC;CAG3D,OAAOV;AACT;AAIA,SAAAyF,eAAAP,SAAAR,OAAA;CAAA,MAAApC,IAAAC,EAAA,CAAA;CACE,MAAAkG,QAAc3O,OAAOoL,OAAO;CAAC,IAAA7C;CAAA,IAAAC,EAAA,OAAAoC,OAAA1D,WAAAsB,EAAA,OAAA4C,SAAA;EAEnB7C,WAAA;GACR,MAAArB,UAAgB0D,OAAK1D,WAAL;GAChB,MAAAgI,OAAaP,MAAKnB,WAAL,CAAkBpC;GAE/BuD,MAAKnB,UAAWpC;GAChB,IAAI8D,QAAQhI,YAAY,QAAQ5G,SAAQwL,OAAQ,OAC9C5L,kBAAiBgN,uBAAwBhG,SAAS,OAAO;EAC1D;EACFsB,EAAA,KAAAoC,OAAA1D;EAAAsB,EAAA,KAAA4C;EAAA5C,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAoC,SAAApC,EAAA,OAAA4C,SAAA;EAAE1C,KAAA,CAACkC,OAAOQ,OAAO;EAAC5C,EAAA,KAAAoC;EAAApC,EAAA,KAAA4C;EAAA5C,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CARnB5I,UAAU2I,IAQPG,EAAgB;AAAC;AAGtBJ,OAAO6G,OAAO5F;AACdjB,OAAO8G,UAAU1E;AACjBpC,OAAO+G,SAASvC;AAChBxE,OAAOgH,SAASvC;AAChBzE,OAAOiH,QAAQvC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonLinkForm, ButtonPressForm, ButtonToggleForm } from "../../button/index.js";
|
|
2
2
|
import { PressableProps, StyleProp, View, ViewStyle } from "react-native";
|
|
3
|
-
import { ReactNode, Ref } from "react";
|
|
3
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
4
4
|
//#region src/components/icon-button/index.d.ts
|
|
5
5
|
type IconButtonProps = (ButtonLinkForm | ButtonPressForm | ButtonToggleForm) & Omit<PressableProps, 'aria-label' | 'children' | 'disabled' | 'style'> & {
|
|
6
6
|
/**
|
|
@@ -24,7 +24,7 @@ type IconButtonProps = (ButtonLinkForm | ButtonPressForm | ButtonToggleForm) & O
|
|
|
24
24
|
* @default false
|
|
25
25
|
*/
|
|
26
26
|
readonly isDisabled?: boolean;
|
|
27
|
-
readonly ref?: Ref<View
|
|
27
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
28
28
|
/**
|
|
29
29
|
* Control size: `xs` 32dp, `md` 40dp, `lg` 56dp, `xl` 96dp, `xxl` 136dp,
|
|
30
30
|
* the icon buttons spec page's XS to XL, and the same heights `Button`
|
|
@@ -62,7 +62,7 @@ type IconButtonVariant = 'filled' | 'outlined' | 'standard' | 'tonal';
|
|
|
62
62
|
* through `hitSlop`, which a `hitSlop` of the call site's own replaces.
|
|
63
63
|
* `style`, `ref` and `testID` land on the `Pressable`.
|
|
64
64
|
*/
|
|
65
|
-
declare function IconButton({ children, defaultSelected, disableRipple, hitSlop: ownHitSlop, href, isDisabled, isPending, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onLongPress, onPress, onPressIn, onPressOut, pendingLabel, size, style, type, variant, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
65
|
+
declare function IconButton({ children, defaultSelected, disableRipple, hitSlop: ownHitSlop, href, isDisabled, isPending, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onLongPress, onPress, onPressIn, onPressOut, pendingLabel, size, slot, style, type, variant, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
66
66
|
//#endregion
|
|
67
67
|
export { IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant };
|
|
68
68
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -88,7 +88,7 @@ const sizesOf = themedStyles(({ sizing }) => {
|
|
|
88
88
|
* `style`, `ref` and `testID` land on the `Pressable`.
|
|
89
89
|
*/
|
|
90
90
|
function IconButton(t0) {
|
|
91
|
-
const $ = c(
|
|
91
|
+
const $ = c(75);
|
|
92
92
|
let children;
|
|
93
93
|
let defaultSelected;
|
|
94
94
|
let href;
|
|
@@ -106,6 +106,7 @@ function IconButton(t0) {
|
|
|
106
106
|
let ownHitSlop;
|
|
107
107
|
let pendingLabel;
|
|
108
108
|
let props;
|
|
109
|
+
let slot;
|
|
109
110
|
let style;
|
|
110
111
|
let t1;
|
|
111
112
|
let t2;
|
|
@@ -114,7 +115,7 @@ function IconButton(t0) {
|
|
|
114
115
|
let t5;
|
|
115
116
|
let type;
|
|
116
117
|
if ($[0] !== t0) {
|
|
117
|
-
({children, defaultSelected, disableRipple: t1, hitSlop: ownHitSlop, href, isDisabled: t2, isPending: t3, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onLongPress, onPress, onPressIn, onPressOut, pendingLabel, size: t4, style, type, variant: t5, ...props} = t0);
|
|
118
|
+
({children, defaultSelected, disableRipple: t1, hitSlop: ownHitSlop, href, isDisabled: t2, isPending: t3, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onLongPress, onPress, onPressIn, onPressOut, pendingLabel, size: t4, slot, style, type, variant: t5, ...props} = t0);
|
|
118
119
|
$[0] = t0;
|
|
119
120
|
$[1] = children;
|
|
120
121
|
$[2] = defaultSelected;
|
|
@@ -133,13 +134,14 @@ function IconButton(t0) {
|
|
|
133
134
|
$[15] = ownHitSlop;
|
|
134
135
|
$[16] = pendingLabel;
|
|
135
136
|
$[17] = props;
|
|
136
|
-
$[18] =
|
|
137
|
-
$[19] =
|
|
138
|
-
$[20] =
|
|
139
|
-
$[21] =
|
|
140
|
-
$[22] =
|
|
141
|
-
$[23] =
|
|
142
|
-
$[24] =
|
|
137
|
+
$[18] = slot;
|
|
138
|
+
$[19] = style;
|
|
139
|
+
$[20] = t1;
|
|
140
|
+
$[21] = t2;
|
|
141
|
+
$[22] = t3;
|
|
142
|
+
$[23] = t4;
|
|
143
|
+
$[24] = t5;
|
|
144
|
+
$[25] = type;
|
|
143
145
|
} else {
|
|
144
146
|
children = $[1];
|
|
145
147
|
defaultSelected = $[2];
|
|
@@ -158,13 +160,14 @@ function IconButton(t0) {
|
|
|
158
160
|
ownHitSlop = $[15];
|
|
159
161
|
pendingLabel = $[16];
|
|
160
162
|
props = $[17];
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
slot = $[18];
|
|
164
|
+
style = $[19];
|
|
165
|
+
t1 = $[20];
|
|
166
|
+
t2 = $[21];
|
|
167
|
+
t3 = $[22];
|
|
168
|
+
t4 = $[23];
|
|
169
|
+
t5 = $[24];
|
|
170
|
+
type = $[25];
|
|
168
171
|
}
|
|
169
172
|
const disableRipple = t1 === void 0 ? false : t1;
|
|
170
173
|
const isDisabled = t2 === void 0 ? false : t2;
|
|
@@ -175,27 +178,30 @@ function IconButton(t0) {
|
|
|
175
178
|
const pending = href === void 0 && isPending;
|
|
176
179
|
const ringLabel = usePending(pending, pendingLabel);
|
|
177
180
|
const isToggle = defaultSelected !== void 0 || isSelected !== void 0 || onChange !== void 0;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
const t6 = slot ?? "default";
|
|
182
|
+
let t7;
|
|
183
|
+
if ($[26] !== defaultSelected || $[27] !== href || $[28] !== isSelected || $[29] !== isToggle || $[30] !== onChange || $[31] !== onPress || $[32] !== t6 || $[33] !== type) {
|
|
184
|
+
t7 = {
|
|
181
185
|
defaultSelected,
|
|
182
186
|
href,
|
|
183
187
|
isSelected,
|
|
184
188
|
isToggle,
|
|
185
189
|
onChange,
|
|
186
190
|
onPress,
|
|
191
|
+
slot: t6,
|
|
187
192
|
type
|
|
188
193
|
};
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[31] = type;
|
|
194
|
+
$[26] = defaultSelected;
|
|
195
|
+
$[27] = href;
|
|
196
|
+
$[28] = isSelected;
|
|
197
|
+
$[29] = isToggle;
|
|
198
|
+
$[30] = onChange;
|
|
199
|
+
$[31] = onPress;
|
|
196
200
|
$[32] = t6;
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
$[33] = type;
|
|
202
|
+
$[34] = t7;
|
|
203
|
+
} else t7 = $[34];
|
|
204
|
+
const action = useButtonAction(t7);
|
|
199
205
|
const colors = palettesOf(theme)[isDisabled ? DISABLED[variant] : isToggle ? TOGGLE_PALETTES[variant][action.selected ? "selected" : "unselected"] : variant];
|
|
200
206
|
const feedback = usePressFeedback({
|
|
201
207
|
color: colors.content,
|
|
@@ -213,119 +219,119 @@ function IconButton(t0) {
|
|
|
213
219
|
const edge = sizing[HEIGHTS[size]];
|
|
214
220
|
const shaped = useCorner(feedback.pressed || action.selected ? radii[PRESSED_CORNERS[size]] : radii.pill, onLayout);
|
|
215
221
|
const T0 = AnimatedPressable;
|
|
216
|
-
const
|
|
217
|
-
let
|
|
218
|
-
if ($[
|
|
219
|
-
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
} else
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
let
|
|
227
|
-
if ($[
|
|
228
|
-
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
} else
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
const
|
|
237
|
-
let t16;
|
|
238
|
-
if ($[39] !== shaped.corner) {
|
|
239
|
-
t16 = composeStyles(buttonStyles.clip, shaped.corner);
|
|
240
|
-
$[39] = shaped.corner;
|
|
241
|
-
$[40] = t16;
|
|
242
|
-
} else t16 = $[40];
|
|
222
|
+
const t8 = href === void 0 ? "button" : "link";
|
|
223
|
+
let t9;
|
|
224
|
+
if ($[35] !== action || $[36] !== isToggle) {
|
|
225
|
+
t9 = isToggle ? toggleState(action.selected) : void 0;
|
|
226
|
+
$[35] = action;
|
|
227
|
+
$[36] = isToggle;
|
|
228
|
+
$[37] = t9;
|
|
229
|
+
} else t9 = $[37];
|
|
230
|
+
const t10 = pending ? BUSY : void 0;
|
|
231
|
+
const t11 = feedback.handlers;
|
|
232
|
+
let t12;
|
|
233
|
+
if ($[38] !== edge || $[39] !== ownHitSlop) {
|
|
234
|
+
t12 = ownHitSlop ?? hitSlop(edge, edge);
|
|
235
|
+
$[38] = edge;
|
|
236
|
+
$[39] = ownHitSlop;
|
|
237
|
+
$[40] = t12;
|
|
238
|
+
} else t12 = $[40];
|
|
239
|
+
const t13 = shaped.onLayout;
|
|
240
|
+
const t14 = pending ? void 0 : onLongPress;
|
|
241
|
+
const t15 = pending ? void 0 : action.onPress;
|
|
242
|
+
const t16 = composeStyles(styles.base, sizesOf(theme)[size], variant === "outlined" ? outlineWidths[size] : void 0, colors.container, shaped.corner, feedback.ring, style);
|
|
243
243
|
let t17;
|
|
244
|
-
if ($[41] !==
|
|
245
|
-
t17 =
|
|
246
|
-
|
|
244
|
+
if ($[41] !== shaped.corner) {
|
|
245
|
+
t17 = composeStyles(buttonStyles.clip, shaped.corner);
|
|
246
|
+
$[41] = shaped.corner;
|
|
247
|
+
$[42] = t17;
|
|
248
|
+
} else t17 = $[42];
|
|
249
|
+
let t18;
|
|
250
|
+
if ($[43] !== feedback.layer || $[44] !== t17) {
|
|
251
|
+
t18 = /* @__PURE__ */ jsx(Animated.View, {
|
|
252
|
+
style: t17,
|
|
247
253
|
children: feedback.layer
|
|
248
254
|
});
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
} else
|
|
255
|
+
$[43] = feedback.layer;
|
|
256
|
+
$[44] = t17;
|
|
257
|
+
$[45] = t18;
|
|
258
|
+
} else t18 = $[45];
|
|
253
259
|
const T1 = PendingContent;
|
|
254
260
|
const T2 = IconStyleContext;
|
|
255
|
-
const
|
|
256
|
-
let
|
|
257
|
-
if ($[
|
|
258
|
-
|
|
259
|
-
value:
|
|
261
|
+
const t19 = iconStyleOf(colors.content, size);
|
|
262
|
+
let t20;
|
|
263
|
+
if ($[46] !== T2 || $[47] !== children || $[48] !== t19) {
|
|
264
|
+
t20 = /* @__PURE__ */ jsx(T2, {
|
|
265
|
+
value: t19,
|
|
260
266
|
children
|
|
261
267
|
});
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
} else
|
|
267
|
-
let
|
|
268
|
-
if ($[
|
|
269
|
-
|
|
268
|
+
$[46] = T2;
|
|
269
|
+
$[47] = children;
|
|
270
|
+
$[48] = t19;
|
|
271
|
+
$[49] = t20;
|
|
272
|
+
} else t20 = $[49];
|
|
273
|
+
let t21;
|
|
274
|
+
if ($[50] !== T1 || $[51] !== pending || $[52] !== t20) {
|
|
275
|
+
t21 = /* @__PURE__ */ jsx(T1, {
|
|
270
276
|
isPending: pending,
|
|
271
|
-
children:
|
|
277
|
+
children: t20
|
|
272
278
|
});
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
} else
|
|
278
|
-
let
|
|
279
|
-
if ($[
|
|
280
|
-
|
|
279
|
+
$[50] = T1;
|
|
280
|
+
$[51] = pending;
|
|
281
|
+
$[52] = t20;
|
|
282
|
+
$[53] = t21;
|
|
283
|
+
} else t21 = $[53];
|
|
284
|
+
let t22;
|
|
285
|
+
if ($[54] !== colors || $[55] !== pending || $[56] !== ringLabel || $[57] !== size) {
|
|
286
|
+
t22 = pending ? /* @__PURE__ */ jsx(PendingRing, {
|
|
281
287
|
color: colors.content,
|
|
282
288
|
diameter: ICON_SIZES[size],
|
|
283
289
|
label: ringLabel
|
|
284
290
|
}) : null;
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
} else
|
|
291
|
-
let
|
|
292
|
-
if ($[
|
|
293
|
-
|
|
294
|
-
role:
|
|
295
|
-
...t8,
|
|
291
|
+
$[54] = colors;
|
|
292
|
+
$[55] = pending;
|
|
293
|
+
$[56] = ringLabel;
|
|
294
|
+
$[57] = size;
|
|
295
|
+
$[58] = t22;
|
|
296
|
+
} else t22 = $[58];
|
|
297
|
+
let t23;
|
|
298
|
+
if ($[59] !== T0 || $[60] !== feedback.handlers || $[61] !== isDisabled || $[62] !== props || $[63] !== shaped.onLayout || $[64] !== t10 || $[65] !== t12 || $[66] !== t14 || $[67] !== t15 || $[68] !== t16 || $[69] !== t18 || $[70] !== t21 || $[71] !== t22 || $[72] !== t8 || $[73] !== t9) {
|
|
299
|
+
t23 = /* @__PURE__ */ jsxs(T0, {
|
|
300
|
+
role: t8,
|
|
296
301
|
...t9,
|
|
297
|
-
...props,
|
|
298
302
|
...t10,
|
|
303
|
+
...props,
|
|
304
|
+
...t11,
|
|
299
305
|
disabled: isDisabled,
|
|
300
|
-
hitSlop:
|
|
301
|
-
onLayout:
|
|
302
|
-
onLongPress:
|
|
303
|
-
onPress:
|
|
304
|
-
style:
|
|
306
|
+
hitSlop: t12,
|
|
307
|
+
onLayout: t13,
|
|
308
|
+
onLongPress: t14,
|
|
309
|
+
onPress: t15,
|
|
310
|
+
style: t16,
|
|
305
311
|
children: [
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
312
|
+
t18,
|
|
313
|
+
t21,
|
|
314
|
+
t22
|
|
309
315
|
]
|
|
310
316
|
});
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
$[
|
|
323
|
-
$[
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
} else
|
|
328
|
-
return
|
|
317
|
+
$[59] = T0;
|
|
318
|
+
$[60] = feedback.handlers;
|
|
319
|
+
$[61] = isDisabled;
|
|
320
|
+
$[62] = props;
|
|
321
|
+
$[63] = shaped.onLayout;
|
|
322
|
+
$[64] = t10;
|
|
323
|
+
$[65] = t12;
|
|
324
|
+
$[66] = t14;
|
|
325
|
+
$[67] = t15;
|
|
326
|
+
$[68] = t16;
|
|
327
|
+
$[69] = t18;
|
|
328
|
+
$[70] = t21;
|
|
329
|
+
$[71] = t22;
|
|
330
|
+
$[72] = t8;
|
|
331
|
+
$[73] = t9;
|
|
332
|
+
$[74] = t23;
|
|
333
|
+
} else t23 = $[74];
|
|
334
|
+
return t23;
|
|
329
335
|
}
|
|
330
336
|
function iconStyleOf(color, size) {
|
|
331
337
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","Ref","PressableProps","StyleProp","View","ViewStyle","AnimatedStyle","StyleSheet","Animated","ButtonLinkForm","ButtonPressForm","ButtonToggleForm","PaletteName","IconStyle","AnimatedPressable","buttonStyles","HEIGHTS","OUTLINE_WIDTHS","PRESSED_CORNERS","toggleState","useButtonAction","useCorner","palettesOf","BUSY","PendingContent","PendingRing","usePending","IconStyleContext","hitSlop","usePressFeedback","useTheme","composeStyles","themedStyles","IconButtonProps","Omit","children","disableRipple","isDisabled","ref","size","IconButtonSize","style","variant","IconButtonVariant","DISABLED","Readonly","Record","filled","outlined","standard","tonal","ICON_SIZES","lg","md","xl","xs","xxl","TOGGLE_PALETTES","selected","unselected","styles","create","base","alignItems","flexShrink","justifyContent","outlineWidths","borderWidth","sizesOf","sizing","square","edge","height","width","IconButton","t0","$","_c","defaultSelected","href","isSelected","onBlur","onChange","onFocus","onHoverIn","onHoverOut","onLayout","onLongPress","onPress","onPressIn","onPressOut","ownHitSlop","pendingLabel","props","t1","t2","t3","t4","t5","type","isPending","undefined","theme","pending","ringLabel","isToggle","t6","action","colors","feedback","color","content","disabled","radii","shaped","pressed","pill","T0","t7","t8","t9","t10","handlers","t11","t12","t13","t14","t15","container","corner","ring","t16","clip","t17","layer","T1","T2","t18","iconStyleOf","t19","t20","t21","t22","_c"],"sources":["../../../src/components/icon-button/index.tsx"],"sourcesContent":["import type { ReactNode, Ref } from 'react'\nimport type { PressableProps, StyleProp, View, ViewStyle } from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\n\nimport { StyleSheet } from 'react-native'\nimport Animated from 'react-native-reanimated'\n\nimport type {\n ButtonLinkForm,\n ButtonPressForm,\n ButtonToggleForm,\n} from '../../button'\nimport type { PaletteName } from '../../button/palettes'\nimport type { IconStyle } from '../../glyphs/icon-style'\n\nimport {\n AnimatedPressable,\n buttonStyles,\n HEIGHTS,\n OUTLINE_WIDTHS,\n PRESSED_CORNERS,\n toggleState,\n useButtonAction,\n useCorner,\n} from '../../button'\nimport { palettesOf } from '../../button/palettes'\nimport {\n BUSY,\n PendingContent,\n PendingRing,\n usePending,\n} from '../../button/pending'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// The icon buttons spec page's four styles at its five sizes, as kanso-ui's\n// IconButton draws them: Button's chrome around a single icon. The pairs are\n// the page's: filled on primary, tonal on secondary container, outlined with\n// an outline-variant rule and an on-surface-variant icon, and standard,\n// transparent, with the same icon over whatever it sits on. Disabled is\n// Button's, on-surface at the two disabled opacities, and a standard button\n// takes the text button's colour since neither has a container.\n//\n// The sizes are the page's XS to XL at Button's five heights, so the two line\n// up in a row: a square of 32, 40, 56, 96 or 136dp holding an icon of 20, 24,\n// 24, 32 or 40dp. The two middle sizes share one icon, and the container\n// alone grows between them. The two smallest take presses over a 48dp target\n// through `hitSlop`, which is the page's floor for them.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it takes the page's second pair of colour\n// roles for its variant: a filled toggle rests on surface container with an\n// on-surface-variant icon and takes primary once selected, a tonal one moves\n// from the secondary container pair to secondary, a standard one stays\n// transparent while its icon moves to primary, and an outlined one swaps its\n// rule for the inverse surface pair. So a selected filled toggle looks like a\n// plain filled button, and an unselected one does not.\n//\n// **A pending button keeps its place**, as Button's does: the icon is hidden\n// where it stands and an indeterminate ring is drawn over it, in the icon's\n// colour and at the icon's size, which is what web's `1em` reads there. The\n// button keeps its focus and its ring, reports itself busy and takes no\n// press until it clears, and src/button's pending.tsx says the change out\n// loud.\n//\n// **The corner morphs from a circle to a rounded square.** A press tightens\n// it to the size's pressed corner, 8dp for the two small sizes, 12dp at\n// `lg` and 16dp at the two large, and a selected toggle rests there, which is\n// the page's round-to-square morph. It eases as Button's does.\n//\n// The forms, the toggle's state, what a press does and the corner's ease are\n// src/button's, shared with Button.\n\ntype IconButtonProps = (ButtonLinkForm | ButtonPressForm | ButtonToggleForm) &\n Omit<PressableProps, 'aria-label' | 'children' | 'disabled' | 'style'> & {\n /**\n * What the button does, in words. Required rather than optional: an icon\n * on its own has no accessible name, so without this the control\n * announces nothing at all.\n */\n readonly 'aria-label': string\n /**\n * The icon. The button hands it its colour and the page's icon size for\n * the button's size through `useIconStyle()`.\n */\n readonly children?: ReactNode\n /**\n * Draws no press ripple. The state layer is unaffected.\n * @default false\n */\n readonly disableRipple?: boolean\n /**\n * Draws the button disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<View>\n /**\n * Control size: `xs` 32dp, `md` 40dp, `lg` 56dp, `xl` 96dp, `xxl` 136dp,\n * the icon buttons spec page's XS to XL, and the same heights `Button`\n * uses, so the two line up beside each other in a row. The icon is 20dp,\n * 24dp, 24dp, 32dp and 40dp in turn.\n * @default 'md'\n */\n readonly size?: IconButtonSize\n readonly style?: StyleProp<ViewStyle>\n /**\n * `standard` is transparent and tints what it sits on; `outlined` is\n * transparent with a rule around it; `filled` and `tonal` carry a\n * container of their own.\n * @default 'standard'\n */\n readonly variant?: IconButtonVariant\n }\n\ntype IconButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl'\n\ntype IconButtonVariant = 'filled' | 'outlined' | 'standard' | 'tonal'\n\n// The disabled container each variant draws. Filled and tonal share the\n// page's one disabled container, and standard draws the text button's\n// colour, which is the icon alone.\nconst DISABLED: Readonly<Record<IconButtonVariant, PaletteName>> = {\n filled: 'filledDisabled',\n outlined: 'outlinedDisabled',\n standard: 'textDisabled',\n tonal: 'filledDisabled',\n}\n\n// The icon each size holds, from the page's size token sets. Literals, as on\n// web: they are icon sizes, which the theme has no scale for.\nconst ICON_SIZES: Readonly<Record<IconButtonSize, number>> = {\n lg: 24,\n md: 24,\n xl: 32,\n xs: 20,\n xxl: 40,\n}\n\n// Which container a toggle draws, selected and not. An unselected outlined,\n// standard or tonal toggle is the plain button of that variant.\nconst TOGGLE_PALETTES: Readonly<\n Record<\n IconButtonVariant,\n Readonly<Record<'selected' | 'unselected', PaletteName>>\n >\n> = {\n filled: { selected: 'filledToggleSelected', unselected: 'filledToggle' },\n outlined: { selected: 'outlinedToggleSelected', unselected: 'outlined' },\n standard: { selected: 'standardToggleSelected', unselected: 'standard' },\n tonal: { selected: 'tonalToggleSelected', unselected: 'tonal' },\n}\n\nconst styles = StyleSheet.create({\n // The icon sits in the middle of a square that a row never squeezes.\n base: {\n alignItems: 'center',\n flexShrink: 0,\n justifyContent: 'center',\n },\n})\n\n// The outlined rule's width at each size, Button's.\nconst outlineWidths = StyleSheet.create({\n lg: { borderWidth: OUTLINE_WIDTHS.lg },\n md: { borderWidth: OUTLINE_WIDTHS.md },\n xl: { borderWidth: OUTLINE_WIDTHS.xl },\n xs: { borderWidth: OUTLINE_WIDTHS.xs },\n xxl: { borderWidth: OUTLINE_WIDTHS.xxl },\n})\n\n// Square, so one control height sets both edges.\nconst sizesOf = themedStyles(({ sizing }) => {\n function square(size: IconButtonSize): ViewStyle {\n const edge = sizing[HEIGHTS[size]]\n\n return { height: edge, width: edge }\n }\n\n return StyleSheet.create({\n lg: square('lg'),\n md: square('md'),\n xl: square('xl'),\n xs: square('xs'),\n xxl: square('xxl'),\n })\n})\n\n/**\n * A button that is an icon, at five control heights, with web's props and\n * values. Given `href` it is a link with the same appearance, and given\n * `isSelected`, `defaultSelected` or `onChange` it is a toggle, which reports\n * its state to a screen reader and draws the page's second pair of colour\n * roles for its variant. The three forms are exclusive, so a toggle given\n * `href` does not compile.\n *\n * ```tsx\n * <IconButton aria-label=\"Label\" defaultSelected variant=\"tonal\">\n * <Icon />\n * </IconButton>\n * ```\n *\n * The two sizes under 48dp, `xs` and `md`, take presses over a 48dp target\n * through `hitSlop`, which a `hitSlop` of the call site's own replaces.\n * `style`, `ref` and `testID` land on the `Pressable`.\n */\nfunction IconButton({\n children,\n defaultSelected,\n disableRipple = false,\n hitSlop: ownHitSlop,\n href,\n isDisabled = false,\n isPending = false,\n isSelected,\n onBlur,\n onChange,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onLongPress,\n onPress,\n onPressIn,\n onPressOut,\n pendingLabel,\n size = 'md',\n style,\n type,\n variant = 'standard',\n ...props\n}: IconButtonProps) {\n const theme = useTheme()\n // A link is never pending, as on web, where its props have no such state.\n const pending = href === undefined && isPending\n const ringLabel = usePending(pending, pendingLabel)\n\n // The three props that make this a toggle, read as web reads them.\n const isToggle =\n defaultSelected !== undefined ||\n isSelected !== undefined ||\n onChange !== undefined\n const action = useButtonAction({\n defaultSelected,\n href,\n isSelected,\n isToggle,\n onChange,\n onPress,\n type,\n })\n const colors =\n palettesOf(theme)[\n isDisabled\n ? DISABLED[variant]\n : isToggle\n ? TOGGLE_PALETTES[variant][\n action.selected ? 'selected' : 'unselected'\n ]\n : variant\n ]\n\n const feedback = usePressFeedback({\n color: colors.content,\n disabled: isDisabled,\n disableRipple,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n pending,\n })\n\n const { radii, sizing } = theme\n const edge = sizing[HEIGHTS[size]]\n const shaped = useCorner(\n feedback.pressed || action.selected\n ? radii[PRESSED_CORNERS[size]]\n : radii.pill,\n onLayout,\n )\n\n return (\n <AnimatedPressable\n role={href === undefined ? 'button' : 'link'}\n {...(isToggle ? toggleState(action.selected) : undefined)}\n {...(pending ? BUSY : undefined)}\n {...props}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={ownHitSlop ?? hitSlop(edge, edge)}\n onLayout={shaped.onLayout}\n onLongPress={pending ? undefined : onLongPress}\n onPress={pending ? undefined : action.onPress}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.base,\n sizesOf(theme)[size],\n variant === 'outlined' ? outlineWidths[size] : undefined,\n colors.container,\n shaped.corner,\n feedback.ring,\n style,\n )}\n >\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n buttonStyles.clip,\n shaped.corner,\n )}\n >\n {feedback.layer}\n </Animated.View>\n <PendingContent isPending={pending}>\n <IconStyleContext value={iconStyleOf(colors.content, size)}>\n {children}\n </IconStyleContext>\n </PendingContent>\n {pending ? (\n <PendingRing\n color={colors.content}\n diameter={ICON_SIZES[size]}\n label={ringLabel}\n />\n ) : null}\n </AnimatedPressable>\n )\n}\n\nfunction iconStyleOf(color: string, size: IconButtonSize): IconStyle {\n return { color, size: ICON_SIZES[size] }\n}\n\nexport { IconButton }\nexport type { IconButtonProps, IconButtonSize, IconButtonVariant }\n"],"mappings":";;;;;;;;;;;;AA4HA,MAAM4C,WAA6D;CACjEG,QAAQ;CACRC,UAAU;CACVC,UAAU;CACVC,OAAO;AACT;AAIA,MAAMC,aAAuD;CAC3DC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,KAAK;AACP;AAIA,MAAMC,kBAKF;CACFV,QAAQ;EAAEW,UAAU;EAAwBC,YAAY;CAAe;CACvEX,UAAU;EAAEU,UAAU;EAA0BC,YAAY;CAAW;CACvEV,UAAU;EAAES,UAAU;EAA0BC,YAAY;CAAW;C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AAEuE;EAAOvE,MAAMY,WAAWZ;CAAM;AACzC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","PressableProps","StyleProp","View","ViewStyle","AnimatedStyle","StyleSheet","Animated","ButtonLinkForm","ButtonPressForm","ButtonToggleForm","PaletteName","IconStyle","AnimatedPressable","buttonStyles","HEIGHTS","OUTLINE_WIDTHS","PRESSED_CORNERS","toggleState","useButtonAction","useCorner","palettesOf","BUSY","PendingContent","PendingRing","usePending","IconStyleContext","hitSlop","usePressFeedback","useTheme","composeStyles","themedStyles","IconButtonProps","Omit","children","disableRipple","isDisabled","ref","size","IconButtonSize","style","variant","IconButtonVariant","DISABLED","Readonly","Record","filled","outlined","standard","tonal","ICON_SIZES","lg","md","xl","xs","xxl","TOGGLE_PALETTES","selected","unselected","styles","create","base","alignItems","flexShrink","justifyContent","outlineWidths","borderWidth","sizesOf","sizing","square","edge","height","width","IconButton","t0","$","_c","defaultSelected","href","isSelected","onBlur","onChange","onFocus","onHoverIn","onHoverOut","onLayout","onLongPress","onPress","onPressIn","onPressOut","ownHitSlop","pendingLabel","props","slot","t1","t2","t3","t4","t5","type","isPending","undefined","theme","pending","ringLabel","isToggle","t6","t7","action","colors","feedback","color","content","disabled","radii","shaped","pressed","pill","T0","t8","t9","t10","t11","handlers","t12","t13","t14","t15","t16","container","corner","ring","t17","clip","t18","layer","T1","T2","t19","iconStyleOf","t20","t21","t22","t23","_c"],"sources":["../../../src/components/icon-button/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { PressableProps, StyleProp, View, ViewStyle } from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\n\nimport { StyleSheet } from 'react-native'\nimport Animated from 'react-native-reanimated'\n\nimport type {\n ButtonLinkForm,\n ButtonPressForm,\n ButtonToggleForm,\n} from '../../button'\nimport type { PaletteName } from '../../button/palettes'\nimport type { IconStyle } from '../../glyphs/icon-style'\n\nimport {\n AnimatedPressable,\n buttonStyles,\n HEIGHTS,\n OUTLINE_WIDTHS,\n PRESSED_CORNERS,\n toggleState,\n useButtonAction,\n useCorner,\n} from '../../button'\nimport { palettesOf } from '../../button/palettes'\nimport {\n BUSY,\n PendingContent,\n PendingRing,\n usePending,\n} from '../../button/pending'\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// The icon buttons spec page's four styles at its five sizes, as kanso-ui's\n// IconButton draws them: Button's chrome around a single icon. The pairs are\n// the page's: filled on primary, tonal on secondary container, outlined with\n// an outline-variant rule and an on-surface-variant icon, and standard,\n// transparent, with the same icon over whatever it sits on. Disabled is\n// Button's, on-surface at the two disabled opacities, and a standard button\n// takes the text button's colour since neither has a container.\n//\n// The sizes are the page's XS to XL at Button's five heights, so the two line\n// up in a row: a square of 32, 40, 56, 96 or 136dp holding an icon of 20, 24,\n// 24, 32 or 40dp. The two middle sizes share one icon, and the container\n// alone grows between them. The two smallest take presses over a 48dp target\n// through `hitSlop`, which is the page's floor for them.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it takes the page's second pair of colour\n// roles for its variant: a filled toggle rests on surface container with an\n// on-surface-variant icon and takes primary once selected, a tonal one moves\n// from the secondary container pair to secondary, a standard one stays\n// transparent while its icon moves to primary, and an outlined one swaps its\n// rule for the inverse surface pair. So a selected filled toggle looks like a\n// plain filled button, and an unselected one does not.\n//\n// **A pending button keeps its place**, as Button's does: the icon is hidden\n// where it stands and an indeterminate ring is drawn over it, in the icon's\n// colour and at the icon's size, which is what web's `1em` reads there. The\n// button keeps its focus and its ring, reports itself busy and takes no\n// press until it clears, and src/button's pending.tsx says the change out\n// loud.\n//\n// **The corner morphs from a circle to a rounded square.** A press tightens\n// it to the size's pressed corner, 8dp for the two small sizes, 12dp at\n// `lg` and 16dp at the two large, and a selected toggle rests there, which is\n// the page's round-to-square morph. It eases as Button's does.\n//\n// The forms, the toggle's state, what a press does and the corner's ease are\n// src/button's, shared with Button.\n\ntype IconButtonProps = (ButtonLinkForm | ButtonPressForm | ButtonToggleForm) &\n Omit<PressableProps, 'aria-label' | 'children' | 'disabled' | 'style'> & {\n /**\n * What the button does, in words. Required rather than optional: an icon\n * on its own has no accessible name, so without this the control\n * announces nothing at all.\n */\n readonly 'aria-label': string\n /**\n * The icon. The button hands it its colour and the page's icon size for\n * the button's size through `useIconStyle()`.\n */\n readonly children?: ReactNode\n /**\n * Draws no press ripple. The state layer is unaffected.\n * @default false\n */\n readonly disableRipple?: boolean\n /**\n * Draws the button disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * Control size: `xs` 32dp, `md` 40dp, `lg` 56dp, `xl` 96dp, `xxl` 136dp,\n * the icon buttons spec page's XS to XL, and the same heights `Button`\n * uses, so the two line up beside each other in a row. The icon is 20dp,\n * 24dp, 24dp, 32dp and 40dp in turn.\n * @default 'md'\n */\n readonly size?: IconButtonSize\n readonly style?: StyleProp<ViewStyle>\n /**\n * `standard` is transparent and tints what it sits on; `outlined` is\n * transparent with a rule around it; `filled` and `tonal` carry a\n * container of their own.\n * @default 'standard'\n */\n readonly variant?: IconButtonVariant\n }\n\ntype IconButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl'\n\ntype IconButtonVariant = 'filled' | 'outlined' | 'standard' | 'tonal'\n\n// The disabled container each variant draws. Filled and tonal share the\n// page's one disabled container, and standard draws the text button's\n// colour, which is the icon alone.\nconst DISABLED: Readonly<Record<IconButtonVariant, PaletteName>> = {\n filled: 'filledDisabled',\n outlined: 'outlinedDisabled',\n standard: 'textDisabled',\n tonal: 'filledDisabled',\n}\n\n// The icon each size holds, from the page's size token sets. Literals, as on\n// web: they are icon sizes, which the theme has no scale for.\nconst ICON_SIZES: Readonly<Record<IconButtonSize, number>> = {\n lg: 24,\n md: 24,\n xl: 32,\n xs: 20,\n xxl: 40,\n}\n\n// Which container a toggle draws, selected and not. An unselected outlined,\n// standard or tonal toggle is the plain button of that variant.\nconst TOGGLE_PALETTES: Readonly<\n Record<\n IconButtonVariant,\n Readonly<Record<'selected' | 'unselected', PaletteName>>\n >\n> = {\n filled: { selected: 'filledToggleSelected', unselected: 'filledToggle' },\n outlined: { selected: 'outlinedToggleSelected', unselected: 'outlined' },\n standard: { selected: 'standardToggleSelected', unselected: 'standard' },\n tonal: { selected: 'tonalToggleSelected', unselected: 'tonal' },\n}\n\nconst styles = StyleSheet.create({\n // The icon sits in the middle of a square that a row never squeezes.\n base: {\n alignItems: 'center',\n flexShrink: 0,\n justifyContent: 'center',\n },\n})\n\n// The outlined rule's width at each size, Button's.\nconst outlineWidths = StyleSheet.create({\n lg: { borderWidth: OUTLINE_WIDTHS.lg },\n md: { borderWidth: OUTLINE_WIDTHS.md },\n xl: { borderWidth: OUTLINE_WIDTHS.xl },\n xs: { borderWidth: OUTLINE_WIDTHS.xs },\n xxl: { borderWidth: OUTLINE_WIDTHS.xxl },\n})\n\n// Square, so one control height sets both edges.\nconst sizesOf = themedStyles(({ sizing }) => {\n function square(size: IconButtonSize): ViewStyle {\n const edge = sizing[HEIGHTS[size]]\n\n return { height: edge, width: edge }\n }\n\n return StyleSheet.create({\n lg: square('lg'),\n md: square('md'),\n xl: square('xl'),\n xs: square('xs'),\n xxl: square('xxl'),\n })\n})\n\n/**\n * A button that is an icon, at five control heights, with web's props and\n * values. Given `href` it is a link with the same appearance, and given\n * `isSelected`, `defaultSelected` or `onChange` it is a toggle, which reports\n * its state to a screen reader and draws the page's second pair of colour\n * roles for its variant. The three forms are exclusive, so a toggle given\n * `href` does not compile.\n *\n * ```tsx\n * <IconButton aria-label=\"Label\" defaultSelected variant=\"tonal\">\n * <Icon />\n * </IconButton>\n * ```\n *\n * The two sizes under 48dp, `xs` and `md`, take presses over a 48dp target\n * through `hitSlop`, which a `hitSlop` of the call site's own replaces.\n * `style`, `ref` and `testID` land on the `Pressable`.\n */\nfunction IconButton({\n children,\n defaultSelected,\n disableRipple = false,\n hitSlop: ownHitSlop,\n href,\n isDisabled = false,\n isPending = false,\n isSelected,\n onBlur,\n onChange,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onLongPress,\n onPress,\n onPressIn,\n onPressOut,\n pendingLabel,\n size = 'md',\n slot,\n style,\n type,\n variant = 'standard',\n ...props\n}: IconButtonProps) {\n const theme = useTheme()\n // A link is never pending, as on web, where its props have no such state.\n const pending = href === undefined && isPending\n const ringLabel = usePending(pending, pendingLabel)\n\n // The three props that make this a toggle, read as web reads them.\n const isToggle =\n defaultSelected !== undefined ||\n isSelected !== undefined ||\n onChange !== undefined\n const action = useButtonAction({\n defaultSelected,\n href,\n isSelected,\n isToggle,\n onChange,\n onPress,\n slot: slot ?? 'default',\n type,\n })\n const colors =\n palettesOf(theme)[\n isDisabled\n ? DISABLED[variant]\n : isToggle\n ? TOGGLE_PALETTES[variant][\n action.selected ? 'selected' : 'unselected'\n ]\n : variant\n ]\n\n const feedback = usePressFeedback({\n color: colors.content,\n disabled: isDisabled,\n disableRipple,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n pending,\n })\n\n const { radii, sizing } = theme\n const edge = sizing[HEIGHTS[size]]\n const shaped = useCorner(\n feedback.pressed || action.selected\n ? radii[PRESSED_CORNERS[size]]\n : radii.pill,\n onLayout,\n )\n\n return (\n <AnimatedPressable\n role={href === undefined ? 'button' : 'link'}\n {...(isToggle ? toggleState(action.selected) : undefined)}\n {...(pending ? BUSY : undefined)}\n {...props}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={ownHitSlop ?? hitSlop(edge, edge)}\n onLayout={shaped.onLayout}\n onLongPress={pending ? undefined : onLongPress}\n onPress={pending ? undefined : action.onPress}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.base,\n sizesOf(theme)[size],\n variant === 'outlined' ? outlineWidths[size] : undefined,\n colors.container,\n shaped.corner,\n feedback.ring,\n style,\n )}\n >\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n buttonStyles.clip,\n shaped.corner,\n )}\n >\n {feedback.layer}\n </Animated.View>\n <PendingContent isPending={pending}>\n <IconStyleContext value={iconStyleOf(colors.content, size)}>\n {children}\n </IconStyleContext>\n </PendingContent>\n {pending ? (\n <PendingRing\n color={colors.content}\n diameter={ICON_SIZES[size]}\n label={ringLabel}\n />\n ) : null}\n </AnimatedPressable>\n )\n}\n\nfunction iconStyleOf(color: string, size: IconButtonSize): IconStyle {\n return { color, size: ICON_SIZES[size] }\n}\n\nexport { IconButton }\nexport type { IconButtonProps, IconButtonSize, IconButtonVariant }\n"],"mappings":";;;;;;;;;;;;AA4HA,MAAM6C,WAA6D;CACjEG,QAAQ;CACRC,UAAU;CACVC,UAAU;CACVC,OAAO;AACT;AAIA,MAAMC,aAAuD;CAC3DC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,IAAI;CACJC,KAAK;AACP;AAIA,MAAMC,kBAKF;CACFV,QAAQ;EAAEW,UAAU;EAAwBC,YAAY;CAAe;CACvEX,UAAU;EAAEU,UAAU;EAA0BC,YAAY;CAAW;CACvEV,UAAU;EAAES,UAAU;EAA0BC,YAAY;CAAW;CACvET,OAAO;EAAEQ,UAAU;EAAuBC,YAAY;CAAQ;AAChE;AAEA,MAAMC,SAASrD,WAAWsD,OAAO,EAE/BC,MAAM;CACJC,YAAY;CACZC,YAAY;CACZC,gBAAgB;AAClB,EACF,CAAC;AAGD,MAAMC,gBAAgB3D,WAAWsD,OAAO;CACtCT,IAAI,EAAEe,aAAalD,eAAemC,GAAG;CACrCC,IAAI,EAAEc,aAAalD,eAAeoC,GAAG;CACrCC,IAAI,EAAEa,aAAalD,eAAeqC,GAAG;CACrCC,IAAI,EAAEY,aAAalD,eAAesC,GAAG;CACrCC,KAAK,EAAEW,aAAalD,eAAeuC,IAAI;AACzC,CAAC;AAGD,MAAMY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AAAwC,OAAA9B,YAAAV,EAAA,QAAA8C,OAAA9C,EAAA,QAAAiD,OAAAjD,EAAA,QAAAmD,OAAAnD,EAAA,QAAAoD,OAAApD,EAAA,QAAAqD,OAAArD,EAAA,QAAA2D,OAAA3D,EAAA,QAAAkE,OAAAlE,EAAA,QAAAmE,OAAAnE,EAAA,QAAA4C,MAAA5C,EAAA,QAAA6C,IAAA;EAxCVuB,MAAA,qBAAC,IAAD;GACQ,MAAAxB;GAAsC,GACvCC;GAAmD,GACnDC;GAA0B,GAC3B7B;GAAK,GACL8B;GACMtF,UAAAA;GACD,SAAAwF;GACC,UAAAC;GACG,aAAAC;GACJ,SAAAC;GACF,OAAAC;GAXT,UAAA;IAqBEM;IAQAO;IAKCC;GAlCe;;EAyCEnE,EAAA,MAAA2C;EAAA3C,EAAA,MAAAmC,SAAAa;EAAAhD,EAAA,MAAAvC;EAAAuC,EAAA,MAAAiB;EAAAjB,EAAA,MAAAwC,OAAA9B;EAAAV,EAAA,MAAA8C;EAAA9C,EAAA,MAAAiD;EAAAjD,EAAA,MAAAmD;EAAAnD,EAAA,MAAAoD;EAAApD,EAAA,MAAAqD;EAAArD,EAAA,MAAA2D;EAAA3D,EAAA,MAAAkE;EAAAlE,EAAA,MAAAmE;EAAAnE,EAAA,MAAA4C;EAAA5C,EAAA,MAAA6C;EAAA7C,EAAA,MAAAoE;CAAA,OAAAA,MAAApE,EAAA;CAAA,OAzCpBoE;AAyCoB;AAIxB,SAASJ,YAAY5B,OAAezE,MAAiC;CACnE,OAAO;EAAEyE;EAAOzE,MAAMY,WAAWZ;CAAM;AACzC"}
|
|
@@ -178,7 +178,7 @@ function webPropsOf(isDisabled, setHovered, setRingShown) {
|
|
|
178
178
|
if (!isDisabled && event.key === "Enter" && !event.repeat) event.currentTarget.click();
|
|
179
179
|
},
|
|
180
180
|
onPointerEnter: (event) => {
|
|
181
|
-
setHovered(event.pointerType !== "touch");
|
|
181
|
+
setHovered(event.nativeEvent.pointerType !== "touch");
|
|
182
182
|
},
|
|
183
183
|
onPointerLeave: () => {
|
|
184
184
|
setHovered(false);
|