@kanso-labs/react-native-kanso-ui 0.8.0 → 0.10.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/README.md +4 -3
- package/dist/autocomplete/index.js +15 -1
- package/dist/autocomplete/index.js.map +1 -1
- package/dist/badge/index.js +9 -70
- package/dist/badge/index.js.map +1 -1
- package/dist/button/group.d.ts +5 -0
- package/dist/button/group.js +115 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/index.d.ts +4 -1
- package/dist/button/index.js +45 -23
- package/dist/button/index.js.map +1 -1
- package/dist/button/palettes.d.ts +2 -0
- package/dist/button/slots.js +2 -1
- package/dist/button/slots.js.map +1 -1
- package/dist/calendar/index.js +351 -182
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +33 -2
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +5 -0
- package/dist/carousel/arrangement.js +123 -0
- package/dist/carousel/arrangement.js.map +1 -0
- package/dist/chequer/index.js +95 -0
- package/dist/chequer/index.js.map +1 -0
- package/dist/collection/index.d.ts +157 -0
- package/dist/collection/index.js +1331 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color-thumb/index.js +56 -0
- package/dist/color-thumb/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +48 -0
- package/dist/components/badge/index.js +122 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/{badge → components/badge}/styles.js +10 -6
- package/dist/components/badge/styles.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +66 -0
- package/dist/components/breadcrumbs/index.js +285 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/button/index.d.ts +4 -2
- package/dist/components/button/index.js +227 -188
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +87 -0
- package/dist/components/button-group/index.js +275 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +11 -3
- package/dist/components/calendar/index.js +60 -45
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +72 -0
- package/dist/components/carousel/index.js +496 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +7 -1
- package/dist/components/checkbox/index.js +183 -138
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +92 -0
- package/dist/components/checkbox-group/index.js +306 -0
- package/dist/components/checkbox-group/index.js.map +1 -0
- package/dist/components/code/index.d.ts +25 -0
- package/dist/components/code/index.js +87 -0
- package/dist/components/code/index.js.map +1 -0
- package/dist/components/color-area/index.d.ts +85 -0
- package/dist/components/color-area/index.js +630 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-field/index.d.ts +144 -0
- package/dist/components/color-field/index.js +516 -0
- package/dist/components/color-field/index.js.map +1 -0
- package/dist/components/color-picker/index.d.ts +74 -0
- package/dist/components/color-picker/index.js +317 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +82 -0
- package/dist/components/color-slider/index.js +456 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +46 -0
- package/dist/components/color-swatch/index.js +127 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +81 -0
- package/dist/components/color-swatch-picker/index.js +287 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/color-wheel/index.d.ts +71 -0
- package/dist/components/color-wheel/index.js +407 -0
- package/dist/components/color-wheel/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +193 -0
- package/dist/components/combo-box/index.js +616 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/container/index.d.ts +47 -0
- package/dist/components/container/index.js +85 -0
- package/dist/components/container/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +120 -0
- package/dist/components/date-field/index.js +111 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +130 -0
- package/dist/components/date-picker/index.js +310 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +139 -0
- package/dist/components/date-range-picker/index.js +421 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/disclosure/index.d.ts +94 -0
- package/dist/components/disclosure/index.js +365 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +61 -0
- package/dist/components/disclosure-group/index.js +100 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/drop-zone/index.d.ts +113 -0
- package/dist/components/drop-zone/index.js +304 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +80 -0
- package/dist/components/fab/index.js +246 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/fab-menu/index.d.ts +120 -0
- package/dist/components/fab-menu/index.js +640 -0
- package/dist/components/fab-menu/index.js.map +1 -0
- package/dist/components/feed/index.d.ts +57 -0
- package/dist/components/feed/index.js +167 -0
- package/dist/components/feed/index.js.map +1 -0
- package/dist/components/form/index.d.ts +3 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +4 -2
- package/dist/components/icon-button/index.js +204 -171
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/keycap/index.d.ts +27 -0
- package/dist/components/keycap/index.js +136 -0
- package/dist/components/keycap/index.js.map +1 -0
- package/dist/components/list/index.d.ts +15 -158
- package/dist/components/list/index.js +21 -1047
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +73 -0
- package/dist/components/list-box/index.js +82 -0
- package/dist/components/list-box/index.js.map +1 -0
- package/dist/components/loading-indicator/index.d.ts +32 -0
- package/dist/components/loading-indicator/index.js +174 -0
- package/dist/components/loading-indicator/index.js.map +1 -0
- package/dist/components/menu/index.js +1 -1
- package/dist/components/navigation-tree/index.d.ts +117 -0
- package/dist/components/navigation-tree/index.js +135 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/number-field/index.js +132 -143
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +69 -0
- package/dist/components/range-calendar/index.js +144 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/search-view/index.d.ts +78 -0
- package/dist/components/search-view/index.js +570 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/select/index.d.ts +152 -0
- package/dist/components/select/index.js +419 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/separator/index.d.ts +3 -2
- package/dist/components/separator/index.js +29 -26
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +111 -0
- package/dist/components/slider/index.js +673 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/split-button/index.d.ts +77 -0
- package/dist/components/split-button/index.js +354 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/supporting-pane/index.d.ts +44 -0
- package/dist/components/supporting-pane/index.js +109 -0
- package/dist/components/supporting-pane/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +196 -0
- package/dist/components/tabs/index.js +1137 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +49 -21
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +145 -0
- package/dist/components/text-area/index.js +231 -0
- package/dist/components/text-area/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +43 -0
- package/dist/components/time-field/index.js +107 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-picker/index.d.ts +65 -0
- package/dist/components/time-picker/index.js +1168 -0
- package/dist/components/time-picker/index.js.map +1 -0
- package/dist/components/toolbar/index.d.ts +53 -0
- package/dist/components/toolbar/index.js +185 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +101 -0
- package/dist/components/tooltip/index.js +223 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +112 -0
- package/dist/components/tree/index.js +157 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/control/group.js +23 -0
- package/dist/control/group.js.map +1 -0
- package/dist/disclosure/chevron.js +75 -0
- package/dist/disclosure/chevron.js.map +1 -0
- package/dist/disclosure/index.js +7 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/drop/index.d.ts +54 -0
- package/dist/drop/index.js +161 -0
- package/dist/drop/index.js.map +1 -0
- package/dist/fab/index.d.ts +19 -0
- package/dist/fab/index.js +147 -0
- package/dist/fab/index.js.map +1 -0
- package/dist/field/chevron.js +74 -0
- package/dist/field/chevron.js.map +1 -0
- package/dist/field/index.d.ts +2 -1
- package/dist/field/index.js +350 -153
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +27 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +107 -0
- package/dist/files/index.js.map +1 -0
- package/dist/form/index.d.ts +6 -4
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +92 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +20 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1394 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +51 -6
- package/dist/index.js +47 -4
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +96 -68
- package/dist/modal/index.js.map +1 -1
- package/dist/navigation/index.js +8 -5
- package/dist/navigation/index.js.map +1 -1
- package/dist/number/keyboard.js +16 -0
- package/dist/number/keyboard.js.map +1 -0
- package/dist/overlay/anchored.js +68 -38
- package/dist/overlay/anchored.js.map +1 -1
- package/dist/overlay/keyboard.js +57 -0
- package/dist/overlay/keyboard.js.map +1 -0
- package/dist/overlay/panel.js +173 -19
- package/dist/overlay/panel.js.map +1 -1
- package/dist/overlay/placement.js +16 -2
- package/dist/overlay/placement.js.map +1 -1
- package/dist/picker/index.js +322 -0
- package/dist/picker/index.js.map +1 -0
- package/dist/press/index.d.ts +2 -0
- package/dist/press/index.js +102 -100
- package/dist/press/index.js.map +1 -1
- package/dist/row/index.js +77 -69
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +13 -2
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/field.js +277 -0
- package/dist/segments/field.js.map +1 -0
- package/dist/segments/index.js +574 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +24 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/separator/index.js +7 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/slider/index.js +145 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/swatch/index.js +56 -0
- package/dist/swatch/index.js.map +1 -0
- package/dist/typography/size.js +14 -0
- package/dist/typography/size.js.map +1 -0
- package/package.json +11 -2
- package/dist/badge/styles.js.map +0 -1
package/dist/press/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","Insets","PressableProps","ViewStyle","useRef","useState","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withDelay","withTiming","useTheme","composeStyles","styles","stylesOf","Corners","Pick","Handlers","Point","x","y","PressFeedback","handlers","NonNullable","Name","hovered","layer","pressed","ring","PressFeedbackOptions","area","Size","color","corners","disabled","disableRipple","disc","pending","pressedColor","RippleGeometry","end","scale","size","start","RipplePhase","height","width","TARGET_SIZE","INITIAL_ORIGIN_SCALE","FADE_IN","FADE_OUT","NO_RIPPLE","hitSlop","vertical","Math","max","horizontal","undefined","bottom","left","right","top","usePressFeedback","t0","$","_c","t1","onBlur","onFocus","onHoverIn","onHoverOut","onPressIn","onPressOut","t2","theme","reduceMotion","setHovered","setPressed","ringShown","setRingShown","focused","pressedUnfocused","pressStarted","phase","geometry","grow","fade","motion","spacing","stateLayerOpacity","active","interactive","rippled","rippleMotion","get","progress","backgroundColor","borderRadius","opacity","position","transform","translateX","translateY","t3","ripple","origin","size_0","floor","set","hypot","sm","duration","durationLong1","easing","bezier","easingStandard","linear","current","Date","now","t4","release","shown","durationMedium1","t5","event","t6","event_0","t7","event_1","t8","event_2","t9","event_3","fixed","currentTarget","pageX","pageY","nativeEvent","measure","_x","_y","width_0","height_0","Number","isFinite","t10","event_4","t11","layerOpacity","focus","hover","t12","surface","t13","t14","state","t15","t16","t17","t18","t19","t20","t21","_c"],"sources":["../../src/press/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Insets, PressableProps, ViewStyle } from 'react-native'\n\nimport { useRef, useState } from 'react'\nimport { View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withDelay,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { styles, stylesOf } from './styles'\n\n/** The corners a control is drawn with, which its feedback clips to. */\ntype Corners = Pick<\n ViewStyle,\n | 'borderBottomEndRadius'\n | 'borderBottomStartRadius'\n | 'borderRadius'\n | 'borderTopEndRadius'\n | 'borderTopStartRadius'\n>\n\n/** The handlers the feedback reads its states from. */\ntype Handlers = Pick<\n PressableProps,\n 'onBlur' | 'onFocus' | 'onHoverIn' | 'onHoverOut' | 'onPressIn' | 'onPressOut'\n>\n\ntype Point = { readonly x: number; readonly y: number }\n\ntype PressFeedback = {\n /**\n * The handlers to hand the control's `Pressable`. Each calls the one of\n * the same name it was given after its own.\n */\n readonly handlers: {\n readonly [Name in keyof Handlers]-?: NonNullable<Handlers[Name]>\n }\n /**\n * Whether a pointer is over the control, for a control that draws more\n * than the layer while hovered. Never while disabled or pending.\n */\n readonly hovered: boolean\n /** The state layer and the ripple, to render as the `Pressable`'s first child. */\n readonly layer: ReactNode\n /**\n * Whether the control is pressed, for a control that draws more than the\n * layer while pressed. Never while disabled or pending.\n */\n readonly pressed: boolean\n /** The focus ring while it shows, to compose into the control's style. */\n readonly ring: undefined | ViewStyle\n}\n\ntype PressFeedbackOptions = Handlers & {\n /**\n * The size of a layer drawn on a part of the control rather than across\n * it, as a navigation destination draws its layer on the indicator behind\n * its icon. The ripple then grows from that part's centre wherever the\n * press lands, and nothing is measured, as for `disc`.\n */\n readonly area?: Size | undefined\n /**\n * The colour the layer and the ripple are drawn in: the theme's value for\n * the control's content colour role.\n */\n readonly color: string\n /** The control's corners, which the layer and the ripple clip to. */\n readonly corners?: Corners | undefined\n readonly disabled?: boolean | null | undefined\n /**\n * Draws no ripple and leaves the state layer, as `disableRipple` does on\n * web's Button.\n */\n readonly disableRipple?: boolean | undefined\n /**\n * The side of a round layer of a fixed size, for a control whose state\n * layer is a disc beside its label rather than the whole control: a\n * checkbox's. The ripple then grows from the disc's centre wherever the\n * press lands, and nothing is measured. Left out, the ripple grows from\n * the press point across the control.\n */\n readonly disc?: number | undefined\n /**\n * Takes no press or hover while true, with no layer and no ripple for\n * either, and keeps the focus and its ring, as a pending button does.\n */\n readonly pending?: boolean | undefined\n /**\n * The colour the pressed layer and the ripple are drawn in, where it\n * differs from the hover and focus layers': a checkbox's swaps between\n * primary and on surface once pressed. Defaults to `color`.\n */\n readonly pressedColor?: string | undefined\n}\n\n/** Where the ripple starts and ends, and how far it grows, for one press. */\ntype RippleGeometry = {\n readonly end: Point\n readonly scale: number\n readonly size: number\n readonly start: Point\n}\n\n// Where the ripple of the latest press is: waiting on the control's\n// measurement, shown, or released before the measurement arrived.\ntype RipplePhase = 'idle' | 'measuring' | 'released' | 'shown'\n\ntype Size = { readonly height: number; readonly width: number }\n\n/**\n * The least a touch target measures each way, from Material Design's\n * accessibility guidance. A floor rather than a token, as web's `TARGET_SIZE`\n * is: a theme changes how big a control is drawn, never how small a target\n * may be.\n */\nconst TARGET_SIZE = 48\n\n// The ripple starts as a disc a fifth of the control's longer side, as on web.\nconst INITIAL_ORIGIN_SCALE = 0.2\n\n// The fade, in milliseconds: quick in and slow out, so a tap reads as a ripple\n// rather than a flicker. These are web's, and deliberately not motion tokens:\n// the two are tuned as a ratio to each other, which snapping either to the\n// scale would undo. Linear for the same reason, since a fade to and from a\n// state layer wants no acceleration.\nconst FADE_IN = 105\nconst FADE_OUT = 375\n\nconst NO_RIPPLE: RippleGeometry = {\n end: { x: 0, y: 0 },\n scale: 1,\n size: 0,\n start: { x: 0, y: 0 },\n}\n\n/**\n * The `hitSlop` that brings a control smaller than 48dp up to a 48dp target,\n * centred on it, as web's controls draw their target with a `::before`.\n * Nothing for a control already that big. A width left out is taken to be\n * wide enough, as a labelled button's is.\n */\nfunction hitSlop(height: number, width = TARGET_SIZE): Insets | undefined {\n const vertical = Math.max(0, (TARGET_SIZE - height) / 2)\n const horizontal = Math.max(0, (TARGET_SIZE - width) / 2)\n\n if (vertical === 0 && horizontal === 0) {\n return undefined\n }\n\n return {\n bottom: vertical,\n left: horizontal,\n right: horizontal,\n top: vertical,\n }\n}\n\n/**\n * The press feedback every interactive control draws: the state layer, the\n * ripple and the focus ring, as Material Design's state layers page sets them\n * out.\n *\n * The state layer is the control's content colour at the state's opacity\n * token, over the whole control: hover for an iPad pointer or an Android\n * mouse, focus while the ring shows, pressed while pressed. React Native has\n * no `color-mix()`, so it is a view of its own rather than a blended\n * background.\n *\n * The ripple grows from the press point to cover the control and fades out\n * once the press ends, held at least `durationMedium1` so a tap reads, and is\n * drawn the same on iOS and Android rather than through Android's own\n * `android_ripple`. It is a solid disc where web's has a soft edge, since\n * React Native draws a gradient only through an experimental style that React\n * Native Web ignores. It is not drawn while the device asks for reduced\n * motion, where the pressed layer alone marks the press.\n *\n * A control whose layer is a disc of its own beside its label, as a\n * checkbox's is, passes the disc's side as `disc`, and its ripple grows from\n * the disc's centre instead. One whose layer is drawn on a part of it of a\n * fixed size passes that size as `area`, with the same effect. One whose pressed layer takes another colour\n * passes it as `pressedColor`.\n *\n * The ring shows when focus arrives from a keyboard, and not when it arrives\n * with a press, which on web is a click focusing what it presses.\n *\n * ```tsx\n * const feedback = usePressFeedback({ color: colors.onPrimary, corners, onPressIn })\n *\n * <Pressable {...feedback.handlers} style={[styles.button, feedback.ring]}>\n * {feedback.layer}\n * <Text>Label</Text>\n * </Pressable>\n * ```\n */\nfunction usePressFeedback({\n area,\n color,\n corners,\n disabled,\n disableRipple = false,\n disc,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n pending,\n pressedColor = color,\n}: PressFeedbackOptions): PressFeedback {\n const theme = useTheme()\n const reduceMotion = useReducedMotion()\n const [hovered, setHovered] = useState(false)\n const [pressed, setPressed] = useState(false)\n const [ringShown, setRingShown] = useState(false)\n const focused = useRef(false)\n // Whether the press in flight began while the control had no focus, which\n // makes the focus that follows it a pointer's.\n const pressedUnfocused = useRef(false)\n const pressStarted = useRef(0)\n const phase = useRef<RipplePhase>('idle')\n const geometry = useSharedValue(NO_RIPPLE)\n const grow = useSharedValue(0)\n const fade = useSharedValue(0)\n\n const { motion, spacing, stateLayerOpacity } = theme\n const active = disabled !== true\n const interactive = active && pending !== true\n const rippled = interactive && !disableRipple && !reduceMotion\n\n const rippleMotion = useAnimatedStyle(() => {\n 'worklet'\n const { end, scale, size, start } = geometry.get()\n const progress = grow.get()\n\n // The whole style is the animation's, so the view takes the one object it\n // hands back.\n return {\n backgroundColor: pressedColor,\n borderRadius: size / 2,\n height: size,\n left: 0,\n opacity: fade.get(),\n position: 'absolute',\n top: 0,\n transform: [\n { translateX: start.x + (end.x - start.x) * progress },\n { translateY: start.y + (end.y - start.y) * progress },\n { scale: 1 + (scale - 1) * progress },\n ],\n width: size,\n }\n })\n\n // Grows a disc a fifth of the control's longer side from the press point\n // to the centre, until it covers the control and `spacing.sm` beyond its\n // corners, as web's does.\n function ripple(width: number, height: number, origin: Point) {\n const size = Math.max(\n 1,\n Math.floor(Math.max(width, height) * INITIAL_ORIGIN_SCALE),\n )\n\n geometry.set({\n end: { x: (width - size) / 2, y: (height - size) / 2 },\n scale: (Math.hypot(width, height) + spacing.sm) / size,\n size,\n start: { x: origin.x - size / 2, y: origin.y - size / 2 },\n })\n grow.set(0)\n grow.set(\n withTiming(1, {\n duration: motion.durationLong1,\n easing: Easing.bezier(...motion.easingStandard),\n }),\n )\n fade.set(\n withTiming(stateLayerOpacity.pressed, {\n duration: FADE_IN,\n easing: Easing.linear,\n }),\n )\n pressStarted.current = Date.now()\n }\n\n // Fades the ripple out, once it has been shown for `durationMedium1`.\n function release() {\n const shown = Date.now() - pressStarted.current\n\n fade.set(\n withDelay(\n Math.max(0, motion.durationMedium1 - shown),\n withTiming(0, { duration: FADE_OUT, easing: Easing.linear }),\n ),\n )\n }\n\n const handlers: PressFeedback['handlers'] = {\n onBlur: (event) => {\n focused.current = false\n setRingShown(false)\n onBlur?.(event)\n },\n onFocus: (event) => {\n focused.current = true\n setRingShown(!pressedUnfocused.current)\n pressedUnfocused.current = false\n onFocus?.(event)\n },\n onHoverIn: (event) => {\n setHovered(true)\n onHoverIn?.(event)\n },\n onHoverOut: (event) => {\n setHovered(false)\n onHoverOut?.(event)\n },\n onPressIn: (event) => {\n pressedUnfocused.current = !focused.current\n setPressed(true)\n\n const fixed = disc === undefined ? area : { height: disc, width: disc }\n\n if (rippled && fixed !== undefined) {\n ripple(fixed.width, fixed.height, {\n x: fixed.width / 2,\n y: fixed.height / 2,\n })\n phase.current = 'shown'\n } else if (rippled && typeof event.currentTarget !== 'number') {\n const { pageX, pageY } = event.nativeEvent\n\n // A touch's own location is measured from whichever child it landed\n // on, so the point is taken from the page and the control measured\n // there. A press from a key carries no point, and ripples from the\n // centre. React Native Web measures a frame later, so a press can end\n // first, and its ripple is then drawn whole. React Native types the\n // target as a bare view tag too, which has nothing to measure.\n phase.current = 'measuring'\n event.currentTarget.measure((_x, _y, width, height, left, top) => {\n ripple(width, height, {\n x: Number.isFinite(pageX - left) ? pageX - left : width / 2,\n y: Number.isFinite(pageY - top) ? pageY - top : height / 2,\n })\n\n if (phase.current === 'released') {\n release()\n phase.current = 'idle'\n } else {\n phase.current = 'shown'\n }\n })\n }\n\n onPressIn?.(event)\n },\n onPressOut: (event) => {\n pressedUnfocused.current = false\n setPressed(false)\n\n if (phase.current === 'shown') {\n release()\n }\n phase.current = phase.current === 'measuring' ? 'released' : 'idle'\n\n onPressOut?.(event)\n },\n }\n\n const layerOpacity = !active\n ? 0\n : interactive && pressed\n ? stateLayerOpacity.pressed\n : ringShown\n ? stateLayerOpacity.focus\n : interactive && hovered\n ? stateLayerOpacity.hover\n : 0\n const surface = composeStyles<ViewStyle>(styles.surface, corners)\n const state = composeStyles<ViewStyle>(styles.layer, {\n backgroundColor: interactive && pressed ? pressedColor : color,\n opacity: layerOpacity,\n })\n\n return {\n handlers,\n hovered: interactive && hovered,\n layer: (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={surface}\n >\n <View style={state} />\n {rippled ? <Animated.View style={rippleMotion} /> : null}\n </View>\n ),\n pressed: interactive && pressed,\n ring: active && ringShown ? stylesOf(theme).ring : undefined,\n }\n}\n\nexport { hitSlop, TARGET_SIZE, usePressFeedback }\nexport type { Corners, PressFeedback, PressFeedbackOptions }\n"],"mappings":";;;;;;;;AA6HA,MAAMmD,uBAAuB;AAO7B,MAAMC,UAAU;AAChB,MAAMC,WAAW;AAEjB,MAAMC,YAA4B;CAChCX,KAAK;EAAErB,GAAG;EAAGC,GAAG;CAAE;CAClBqB,OAAO;CACPC,MAAM;CACNC,OAAO;EAAExB,GAAG;EAAGC,GAAG;CAAE;AACtB;;;;;;;AAQA,SAASgC,QAAQP,QAAgBC,QAAAA,IAAyC;CACxE,MAAMO,WAAWC,KAAKC,IAAI,IAAA,KAAkBV,UAAU,CAAC;CACvD,MAAMW,aAAaF,KAAKC,IAAI,IAAA,KAAkBT,SAAS,CAAC;CAExD,IAAIO,aAAa,KAAKG,eAAe,GACnC;CAGF,OAAO;EACLE,QAAQL;EACRM,MAAMH;EACNI,OAAOJ;EACPK,KAAKR;CACP;AACF;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AA+F;EAAA/F,EAAA,MAAAgG;CAAA,OAAAA,MAAAhG,EAAA;CAEA,MAAAiG,MAAAtE,eAAAhE;CAAsB,IAAAuI;CAAA,IAAAlG,EAAA,QAAA0B,UAAA1B,EAAA,QAAAc,aAAAd,EAAA,QAAAU,OAAA;EACzBwF,MAAAxE,UAAAZ,YAAsBhE,SAAS4D,KAAK,CAAC,CAAA9C,OAArC6B,KAAAA;EAAsDO,EAAA,MAAA0B;EAAA1B,EAAA,MAAAc;EAAAd,EAAA,MAAAU;EAAAV,EAAA,MAAAkG;CAAA,OAAAA,MAAAlG,EAAA;CAAA,IAAAmG;CAAA,IAAAnG,EAAA,QAAA1C,YAAA0C,EAAA,QAAA6F,OAAA7F,EAAA,QAAAgG,OAAAhG,EAAA,QAAAiG,OAAAjG,EAAA,QAAAkG,KAAA;EAdvDC,MAAA;GAAA7I;GAAAG,SAEIoI;GAAsBnI,OAE7BsI;GAOOrI,SAEAsI;GAAsBrI,MACzBsI;EACR;EAAClG,EAAA,MAAA1C;EAAA0C,EAAA,MAAA6F;EAAA7F,EAAA,MAAAgG;EAAAhG,EAAA,MAAAiG;EAAAjG,EAAA,MAAAkG;EAAAlG,EAAA,MAAAmG;CAAA,OAAAA,MAAAnG,EAAA;CAAA,OAfMmG;AAeN"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","Insets","PressableProps","ViewStyle","useRef","useState","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withDelay","withTiming","useTheme","composeStyles","styles","stylesOf","Corners","Pick","Handlers","Point","x","y","PressFeedback","handlers","NonNullable","Name","hovered","layer","pressed","ring","PressFeedbackOptions","area","Size","color","corners","disabled","disableRipple","disc","held","pending","pressedColor","RippleGeometry","end","scale","size","start","RipplePhase","height","width","TARGET_SIZE","INITIAL_ORIGIN_SCALE","FADE_IN","FADE_OUT","NO_RIPPLE","hitSlop","vertical","Math","max","horizontal","undefined","bottom","left","right","top","usePressFeedback","t0","$","_c","t1","t2","onBlur","onFocus","onHoverIn","onHoverOut","onPressIn","onPressOut","t3","theme","reduceMotion","setHovered","setPressed","ringShown","setRingShown","focused","pressedUnfocused","pressStarted","phase","geometry","grow","fade","motion","spacing","stateLayerOpacity","active","interactive","rippled","rippleMotion","get","progress","backgroundColor","borderRadius","opacity","position","transform","translateX","translateY","t4","ripple","origin","size_0","floor","set","hypot","sm","duration","durationLong1","easing","bezier","easingStandard","linear","current","Date","now","t5","release","shown","durationMedium1","t6","event","t7","event_0","t8","event_1","t9","event_2","t10","event_3","fixed","currentTarget","pageX","pageY","nativeEvent","measure","_x","_y","width_0","height_0","Number","isFinite","t11","event_4","t12","pressedLayer","layerOpacity","focus","hover","t13","surface","t14","t15","state","t16","t17","t18","t19","t20","t21","t22","_c"],"sources":["../../src/press/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Insets, PressableProps, ViewStyle } from 'react-native'\n\nimport { useRef, useState } from 'react'\nimport { View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withDelay,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { styles, stylesOf } from './styles'\n\n/** The corners a control is drawn with, which its feedback clips to. */\ntype Corners = Pick<\n ViewStyle,\n | 'borderBottomEndRadius'\n | 'borderBottomStartRadius'\n | 'borderRadius'\n | 'borderTopEndRadius'\n | 'borderTopStartRadius'\n>\n\n/** The handlers the feedback reads its states from. */\ntype Handlers = Pick<\n PressableProps,\n 'onBlur' | 'onFocus' | 'onHoverIn' | 'onHoverOut' | 'onPressIn' | 'onPressOut'\n>\n\ntype Point = { readonly x: number; readonly y: number }\n\ntype PressFeedback = {\n /**\n * The handlers to hand the control's `Pressable`. Each calls the one of\n * the same name it was given after its own.\n */\n readonly handlers: {\n readonly [Name in keyof Handlers]-?: NonNullable<Handlers[Name]>\n }\n /**\n * Whether a pointer is over the control, for a control that draws more\n * than the layer while hovered. Never while disabled or pending.\n */\n readonly hovered: boolean\n /** The state layer and the ripple, to render as the `Pressable`'s first child. */\n readonly layer: ReactNode\n /**\n * Whether the control is pressed, for a control that draws more than the\n * layer while pressed. Never while disabled or pending.\n */\n readonly pressed: boolean\n /** The focus ring while it shows, to compose into the control's style. */\n readonly ring: undefined | ViewStyle\n}\n\ntype PressFeedbackOptions = Handlers & {\n /**\n * The size of a layer drawn on a part of the control rather than across\n * it, as a navigation destination draws its layer on the indicator behind\n * its icon. The ripple then grows from that part's centre wherever the\n * press lands, and nothing is measured, as for `disc`.\n */\n readonly area?: Size | undefined\n /**\n * The colour the layer and the ripple are drawn in: the theme's value for\n * the control's content colour role.\n */\n readonly color: string\n /** The control's corners, which the layer and the ripple clip to. */\n readonly corners?: Corners | undefined\n readonly disabled?: boolean | null | undefined\n /**\n * Draws no ripple and leaves the state layer, as `disableRipple` does on\n * web's Button.\n */\n readonly disableRipple?: boolean | undefined\n /**\n * The side of a round layer of a fixed size, for a control whose state\n * layer is a disc beside its label rather than the whole control: a\n * checkbox's. The ripple then grows from the disc's centre wherever the\n * press lands, and nothing is measured. Left out, the ripple grows from\n * the press point across the control.\n */\n readonly disc?: number | undefined\n /**\n * Draws the pressed layer while true, though nothing presses the control:\n * a split button's menu half while its menu is open, as web's React Aria\n * reports the trigger pressed for as long as its menu shows. It draws no\n * ripple, and `pressed` stays false, since no press is in flight.\n */\n readonly held?: boolean | undefined\n /**\n * Takes no press or hover while true, with no layer and no ripple for\n * either, and keeps the focus and its ring, as a pending button does.\n */\n readonly pending?: boolean | undefined\n /**\n * The colour the pressed layer and the ripple are drawn in, where it\n * differs from the hover and focus layers': a checkbox's swaps between\n * primary and on surface once pressed. Defaults to `color`.\n */\n readonly pressedColor?: string | undefined\n}\n\n/** Where the ripple starts and ends, and how far it grows, for one press. */\ntype RippleGeometry = {\n readonly end: Point\n readonly scale: number\n readonly size: number\n readonly start: Point\n}\n\n// Where the ripple of the latest press is: waiting on the control's\n// measurement, shown, or released before the measurement arrived.\ntype RipplePhase = 'idle' | 'measuring' | 'released' | 'shown'\n\ntype Size = { readonly height: number; readonly width: number }\n\n/**\n * The least a touch target measures each way, from Material Design's\n * accessibility guidance. A floor rather than a token, as web's `TARGET_SIZE`\n * is: a theme changes how big a control is drawn, never how small a target\n * may be.\n */\nconst TARGET_SIZE = 48\n\n// The ripple starts as a disc a fifth of the control's longer side, as on web.\nconst INITIAL_ORIGIN_SCALE = 0.2\n\n// The fade, in milliseconds: quick in and slow out, so a tap reads as a ripple\n// rather than a flicker. These are web's, and deliberately not motion tokens:\n// the two are tuned as a ratio to each other, which snapping either to the\n// scale would undo. Linear for the same reason, since a fade to and from a\n// state layer wants no acceleration.\nconst FADE_IN = 105\nconst FADE_OUT = 375\n\nconst NO_RIPPLE: RippleGeometry = {\n end: { x: 0, y: 0 },\n scale: 1,\n size: 0,\n start: { x: 0, y: 0 },\n}\n\n/**\n * The `hitSlop` that brings a control smaller than 48dp up to a 48dp target,\n * centred on it, as web's controls draw their target with a `::before`.\n * Nothing for a control already that big. A width left out is taken to be\n * wide enough, as a labelled button's is.\n */\nfunction hitSlop(height: number, width = TARGET_SIZE): Insets | undefined {\n const vertical = Math.max(0, (TARGET_SIZE - height) / 2)\n const horizontal = Math.max(0, (TARGET_SIZE - width) / 2)\n\n if (vertical === 0 && horizontal === 0) {\n return undefined\n }\n\n return {\n bottom: vertical,\n left: horizontal,\n right: horizontal,\n top: vertical,\n }\n}\n\n/**\n * The press feedback every interactive control draws: the state layer, the\n * ripple and the focus ring, as Material Design's state layers page sets them\n * out.\n *\n * The state layer is the control's content colour at the state's opacity\n * token, over the whole control: hover for an iPad pointer or an Android\n * mouse, focus while the ring shows, pressed while pressed. React Native has\n * no `color-mix()`, so it is a view of its own rather than a blended\n * background.\n *\n * The ripple grows from the press point to cover the control and fades out\n * once the press ends, held at least `durationMedium1` so a tap reads, and is\n * drawn the same on iOS and Android rather than through Android's own\n * `android_ripple`. It is a solid disc where web's has a soft edge, since\n * React Native draws a gradient only through an experimental style that React\n * Native Web ignores. It is not drawn while the device asks for reduced\n * motion, where the pressed layer alone marks the press.\n *\n * A control whose layer is a disc of its own beside its label, as a\n * checkbox's is, passes the disc's side as `disc`, and its ripple grows from\n * the disc's centre instead. One whose layer is drawn on a part of it of a\n * fixed size passes that size as `area`, with the same effect. One whose pressed layer takes another colour\n * passes it as `pressedColor`.\n *\n * The ring shows when focus arrives from a keyboard, and not when it arrives\n * with a press, which on web is a click focusing what it presses.\n *\n * ```tsx\n * const feedback = usePressFeedback({ color: colors.onPrimary, corners, onPressIn })\n *\n * <Pressable {...feedback.handlers} style={[styles.button, feedback.ring]}>\n * {feedback.layer}\n * <Text>Label</Text>\n * </Pressable>\n * ```\n */\nfunction usePressFeedback({\n area,\n color,\n corners,\n disabled,\n disableRipple = false,\n disc,\n held = false,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n pending,\n pressedColor = color,\n}: PressFeedbackOptions): PressFeedback {\n const theme = useTheme()\n const reduceMotion = useReducedMotion()\n const [hovered, setHovered] = useState(false)\n const [pressed, setPressed] = useState(false)\n const [ringShown, setRingShown] = useState(false)\n const focused = useRef(false)\n // Whether the press in flight began while the control had no focus, which\n // makes the focus that follows it a pointer's.\n const pressedUnfocused = useRef(false)\n const pressStarted = useRef(0)\n const phase = useRef<RipplePhase>('idle')\n const geometry = useSharedValue(NO_RIPPLE)\n const grow = useSharedValue(0)\n const fade = useSharedValue(0)\n\n const { motion, spacing, stateLayerOpacity } = theme\n const active = disabled !== true\n const interactive = active && pending !== true\n const rippled = interactive && !disableRipple && !reduceMotion\n\n const rippleMotion = useAnimatedStyle(() => {\n 'worklet'\n const { end, scale, size, start } = geometry.get()\n const progress = grow.get()\n\n // The whole style is the animation's, so the view takes the one object it\n // hands back.\n return {\n backgroundColor: pressedColor,\n borderRadius: size / 2,\n height: size,\n left: 0,\n opacity: fade.get(),\n position: 'absolute',\n top: 0,\n transform: [\n { translateX: start.x + (end.x - start.x) * progress },\n { translateY: start.y + (end.y - start.y) * progress },\n { scale: 1 + (scale - 1) * progress },\n ],\n width: size,\n }\n })\n\n // Grows a disc a fifth of the control's longer side from the press point\n // to the centre, until it covers the control and `spacing.sm` beyond its\n // corners, as web's does.\n function ripple(width: number, height: number, origin: Point) {\n const size = Math.max(\n 1,\n Math.floor(Math.max(width, height) * INITIAL_ORIGIN_SCALE),\n )\n\n geometry.set({\n end: { x: (width - size) / 2, y: (height - size) / 2 },\n scale: (Math.hypot(width, height) + spacing.sm) / size,\n size,\n start: { x: origin.x - size / 2, y: origin.y - size / 2 },\n })\n grow.set(0)\n grow.set(\n withTiming(1, {\n duration: motion.durationLong1,\n easing: Easing.bezier(...motion.easingStandard),\n }),\n )\n fade.set(\n withTiming(stateLayerOpacity.pressed, {\n duration: FADE_IN,\n easing: Easing.linear,\n }),\n )\n pressStarted.current = Date.now()\n }\n\n // Fades the ripple out, once it has been shown for `durationMedium1`.\n function release() {\n const shown = Date.now() - pressStarted.current\n\n fade.set(\n withDelay(\n Math.max(0, motion.durationMedium1 - shown),\n withTiming(0, { duration: FADE_OUT, easing: Easing.linear }),\n ),\n )\n }\n\n const handlers: PressFeedback['handlers'] = {\n onBlur: (event) => {\n focused.current = false\n setRingShown(false)\n onBlur?.(event)\n },\n onFocus: (event) => {\n focused.current = true\n setRingShown(!pressedUnfocused.current)\n pressedUnfocused.current = false\n onFocus?.(event)\n },\n onHoverIn: (event) => {\n setHovered(true)\n onHoverIn?.(event)\n },\n onHoverOut: (event) => {\n setHovered(false)\n onHoverOut?.(event)\n },\n onPressIn: (event) => {\n pressedUnfocused.current = !focused.current\n setPressed(true)\n\n const fixed = disc === undefined ? area : { height: disc, width: disc }\n\n if (rippled && fixed !== undefined) {\n ripple(fixed.width, fixed.height, {\n x: fixed.width / 2,\n y: fixed.height / 2,\n })\n phase.current = 'shown'\n } else if (rippled && typeof event.currentTarget !== 'number') {\n const { pageX, pageY } = event.nativeEvent\n\n // A touch's own location is measured from whichever child it landed\n // on, so the point is taken from the page and the control measured\n // there. A press from a key carries no point, and ripples from the\n // centre. React Native Web measures a frame later, so a press can end\n // first, and its ripple is then drawn whole. React Native types the\n // target as a bare view tag too, which has nothing to measure.\n phase.current = 'measuring'\n event.currentTarget.measure((_x, _y, width, height, left, top) => {\n ripple(width, height, {\n x: Number.isFinite(pageX - left) ? pageX - left : width / 2,\n y: Number.isFinite(pageY - top) ? pageY - top : height / 2,\n })\n\n if (phase.current === 'released') {\n release()\n phase.current = 'idle'\n } else {\n phase.current = 'shown'\n }\n })\n }\n\n onPressIn?.(event)\n },\n onPressOut: (event) => {\n pressedUnfocused.current = false\n setPressed(false)\n\n if (phase.current === 'shown') {\n release()\n }\n phase.current = phase.current === 'measuring' ? 'released' : 'idle'\n\n onPressOut?.(event)\n },\n }\n\n const pressedLayer = interactive && (pressed || held)\n const layerOpacity = !active\n ? 0\n : pressedLayer\n ? stateLayerOpacity.pressed\n : ringShown\n ? stateLayerOpacity.focus\n : interactive && hovered\n ? stateLayerOpacity.hover\n : 0\n const surface = composeStyles<ViewStyle>(styles.surface, corners)\n const state = composeStyles<ViewStyle>(styles.layer, {\n backgroundColor: pressedLayer ? pressedColor : color,\n opacity: layerOpacity,\n })\n\n return {\n handlers,\n hovered: interactive && hovered,\n layer: (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={surface}\n >\n <View style={state} />\n {rippled ? <Animated.View style={rippleMotion} /> : null}\n </View>\n ),\n pressed: interactive && pressed,\n ring: active && ringShown ? stylesOf(theme).ring : undefined,\n }\n}\n\nexport { hitSlop, TARGET_SIZE, usePressFeedback }\nexport type { Corners, PressFeedback, PressFeedbackOptions }\n"],"mappings":";;;;;;;;AAoIA,MAAMoD,uBAAuB;AAO7B,MAAMC,UAAU;AAChB,MAAMC,WAAW;AAEjB,MAAMC,YAA4B;CAChCX,KAAK;EAAEtB,GAAG;EAAGC,GAAG;CAAE;CAClBsB,OAAO;CACPC,MAAM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row/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconStyleContext } from "../glyphs/icon-style.js";
|
|
2
2
|
import { useTheme } from "../theme/scope.js";
|
|
3
3
|
import { composeStyles } from "../theme/styles.js";
|
|
4
|
-
import { useTypeRole } from "../typography/roles.js";
|
|
4
|
+
import { nativeWeight, useTypeRole } from "../typography/roles.js";
|
|
5
5
|
import { rowContentColor, rowStyles, rowStylesOf } from "./styles.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { Text, View } from "react-native";
|
|
@@ -9,6 +9,11 @@ import "react";
|
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/row/index.tsx
|
|
11
11
|
const ICON_SIZE = 24;
|
|
12
|
+
const SELECTED_CONTAINER = {
|
|
13
|
+
drawer: "selectedDrawer",
|
|
14
|
+
list: "selectedList",
|
|
15
|
+
menu: "selectedMenu"
|
|
16
|
+
};
|
|
12
17
|
/** Whether a slot was given something to draw. */
|
|
13
18
|
function hasContent(node) {
|
|
14
19
|
return node !== void 0 && node !== null && node !== false && node !== "";
|
|
@@ -22,19 +27,20 @@ function hasContent(node) {
|
|
|
22
27
|
* `useIconStyle()`. Not a component of the library's own and not exported.
|
|
23
28
|
*/
|
|
24
29
|
function RowContent(t0) {
|
|
25
|
-
const $ = c(
|
|
26
|
-
const { children, isDisabled: t1,
|
|
30
|
+
const $ = c(31);
|
|
31
|
+
const { children, isDisabled: t1, isEmphasized: t2, isSelected: t3, leading, overline, supporting, trailing, variant: t4 } = t0;
|
|
27
32
|
const isDisabled = t1 === void 0 ? false : t1;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
33
|
+
const isEmphasized = t2 === void 0 ? false : t2;
|
|
34
|
+
const isSelected = t3 === void 0 ? false : t3;
|
|
35
|
+
const variant = t4 === void 0 ? "list" : t4;
|
|
30
36
|
const theme = useTheme();
|
|
31
37
|
const own = rowStylesOf(theme);
|
|
32
|
-
const headlineRole = useTypeRole(variant === "
|
|
38
|
+
const headlineRole = useTypeRole(variant === "list" ? "bodyLarge" : "labelLarge");
|
|
33
39
|
const overlineRole = useTypeRole("labelSmall");
|
|
34
40
|
const supportingRole = useTypeRole("bodyMedium");
|
|
35
|
-
let
|
|
41
|
+
let t5;
|
|
36
42
|
if ($[0] !== isDisabled || $[1] !== isSelected || $[2] !== theme || $[3] !== variant) {
|
|
37
|
-
|
|
43
|
+
t5 = rowContentColor(theme, {
|
|
38
44
|
isDisabled,
|
|
39
45
|
isSelected,
|
|
40
46
|
variant
|
|
@@ -43,101 +49,103 @@ function RowContent(t0) {
|
|
|
43
49
|
$[1] = isSelected;
|
|
44
50
|
$[2] = theme;
|
|
45
51
|
$[3] = variant;
|
|
46
|
-
$[4] =
|
|
47
|
-
} else
|
|
48
|
-
const color =
|
|
49
|
-
let
|
|
52
|
+
$[4] = t5;
|
|
53
|
+
} else t5 = $[4];
|
|
54
|
+
const color = t5;
|
|
55
|
+
let t6;
|
|
50
56
|
if ($[5] !== color) {
|
|
51
|
-
|
|
57
|
+
t6 = {
|
|
52
58
|
color,
|
|
53
59
|
size: ICON_SIZE
|
|
54
60
|
};
|
|
55
61
|
$[5] = color;
|
|
56
|
-
$[6] =
|
|
57
|
-
} else
|
|
58
|
-
const icons =
|
|
62
|
+
$[6] = t6;
|
|
63
|
+
} else t6 = $[6];
|
|
64
|
+
const icons = t6;
|
|
59
65
|
const tone = isDisabled || isSelected ? { color } : own.muted;
|
|
60
66
|
const T0 = IconStyleContext;
|
|
61
|
-
let
|
|
67
|
+
let t7;
|
|
62
68
|
if ($[7] !== leading) {
|
|
63
|
-
|
|
69
|
+
t7 = hasContent(leading) ? /* @__PURE__ */ jsx(View, {
|
|
64
70
|
style: rowStyles.slot,
|
|
65
71
|
children: leading
|
|
66
72
|
}) : null;
|
|
67
73
|
$[7] = leading;
|
|
68
|
-
$[8] =
|
|
69
|
-
} else
|
|
74
|
+
$[8] = t7;
|
|
75
|
+
} else t7 = $[8];
|
|
70
76
|
const T1 = View;
|
|
71
|
-
const
|
|
72
|
-
const
|
|
77
|
+
const t8 = own.main;
|
|
78
|
+
const t9 = hasContent(overline) ? /* @__PURE__ */ jsx(Text, {
|
|
73
79
|
style: composeStyles(overlineRole, tone),
|
|
74
80
|
children: overline
|
|
75
81
|
}) : null;
|
|
76
|
-
let
|
|
77
|
-
if ($[9] !== color || $[10] !== headlineRole) {
|
|
78
|
-
|
|
82
|
+
let t10;
|
|
83
|
+
if ($[9] !== color || $[10] !== headlineRole || $[11] !== isEmphasized || $[12] !== theme) {
|
|
84
|
+
t10 = composeStyles(headlineRole, { color }, isEmphasized ? { fontWeight: nativeWeight(theme.typography.weightBold) } : void 0);
|
|
79
85
|
$[9] = color;
|
|
80
86
|
$[10] = headlineRole;
|
|
81
|
-
$[11] =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
$[11] = isEmphasized;
|
|
88
|
+
$[12] = theme;
|
|
89
|
+
$[13] = t10;
|
|
90
|
+
} else t10 = $[13];
|
|
91
|
+
let t11;
|
|
92
|
+
if ($[14] !== children || $[15] !== t10) {
|
|
93
|
+
t11 = /* @__PURE__ */ jsx(Text, {
|
|
94
|
+
style: t10,
|
|
87
95
|
children
|
|
88
96
|
});
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
} else
|
|
93
|
-
const
|
|
97
|
+
$[14] = children;
|
|
98
|
+
$[15] = t10;
|
|
99
|
+
$[16] = t11;
|
|
100
|
+
} else t11 = $[16];
|
|
101
|
+
const t12 = hasContent(supporting) ? /* @__PURE__ */ jsx(Text, {
|
|
94
102
|
style: composeStyles(supportingRole, tone),
|
|
95
103
|
children: supporting
|
|
96
104
|
}) : null;
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
100
|
-
style:
|
|
105
|
+
let t13;
|
|
106
|
+
if ($[17] !== T1 || $[18] !== own || $[19] !== t11 || $[20] !== t12 || $[21] !== t9) {
|
|
107
|
+
t13 = /* @__PURE__ */ jsxs(T1, {
|
|
108
|
+
style: t8,
|
|
101
109
|
children: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
t9,
|
|
111
|
+
t11,
|
|
112
|
+
t12
|
|
105
113
|
]
|
|
106
114
|
});
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[18] = t11;
|
|
111
|
-
$[19] = t8;
|
|
115
|
+
$[17] = T1;
|
|
116
|
+
$[18] = own;
|
|
117
|
+
$[19] = t11;
|
|
112
118
|
$[20] = t12;
|
|
113
|
-
|
|
114
|
-
let t13;
|
|
115
|
-
if ($[21] !== trailing) {
|
|
116
|
-
t13 = hasContent(trailing) ? /* @__PURE__ */ jsx(View, {
|
|
117
|
-
style: rowStyles.slot,
|
|
118
|
-
children: trailing
|
|
119
|
-
}) : null;
|
|
120
|
-
$[21] = trailing;
|
|
119
|
+
$[21] = t9;
|
|
121
120
|
$[22] = t13;
|
|
122
121
|
} else t13 = $[22];
|
|
123
122
|
let t14;
|
|
124
|
-
if ($[23] !==
|
|
125
|
-
t14 = /* @__PURE__ */
|
|
123
|
+
if ($[23] !== trailing) {
|
|
124
|
+
t14 = hasContent(trailing) ? /* @__PURE__ */ jsx(View, {
|
|
125
|
+
style: rowStyles.slot,
|
|
126
|
+
children: trailing
|
|
127
|
+
}) : null;
|
|
128
|
+
$[23] = trailing;
|
|
129
|
+
$[24] = t14;
|
|
130
|
+
} else t14 = $[24];
|
|
131
|
+
let t15;
|
|
132
|
+
if ($[25] !== T0 || $[26] !== icons || $[27] !== t13 || $[28] !== t14 || $[29] !== t7) {
|
|
133
|
+
t15 = /* @__PURE__ */ jsxs(T0, {
|
|
126
134
|
value: icons,
|
|
127
135
|
children: [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
t7,
|
|
137
|
+
t13,
|
|
138
|
+
t14
|
|
131
139
|
]
|
|
132
140
|
});
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[26] = t13;
|
|
137
|
-
$[27] = t6;
|
|
141
|
+
$[25] = T0;
|
|
142
|
+
$[26] = icons;
|
|
143
|
+
$[27] = t13;
|
|
138
144
|
$[28] = t14;
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
$[29] = t7;
|
|
146
|
+
$[30] = t15;
|
|
147
|
+
} else t15 = $[30];
|
|
148
|
+
return t15;
|
|
141
149
|
}
|
|
142
150
|
/**
|
|
143
151
|
* The style of the view around a row's content: the padding and gap, the
|
|
@@ -150,7 +158,7 @@ function RowContent(t0) {
|
|
|
150
158
|
function rowStyleOf(theme, { isSelected = false, overline, supporting, variant = "list" }) {
|
|
151
159
|
const own = rowStylesOf(theme);
|
|
152
160
|
const lines = (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0);
|
|
153
|
-
return composeStyles(own.base, own[variant], lines === 1 ? own.twoLine : void 0, lines === 2 ? own.threeLine : void 0, isSelected ? own[variant
|
|
161
|
+
return composeStyles(own.base, own[variant], lines === 1 ? own.twoLine : void 0, lines === 2 ? own.threeLine : void 0, isSelected ? own[SELECTED_CONTAINER[variant]] : void 0);
|
|
154
162
|
}
|
|
155
163
|
//#endregion
|
|
156
164
|
export { RowContent, hasContent, rowContentColor, rowStyleOf, rowStyles };
|
package/dist/row/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","StyleProp","TextStyle","ViewStyle","useMemo","Text","NativeText","View","IconStyle","ResolvedTheme","RowVariant","IconStyleContext","useTheme","composeStyles","useTypeRole","rowContentColor","rowStyles","rowStylesOf","ICON_SIZE","RowContentProps","children","isDisabled","isSelected","leading","overline","supporting","trailing","variant","hasContent","node","undefined","RowContent","t0","$","_c","t1","t2","t3","theme","own","headlineRole","overlineRole","supportingRole","t4","color","t5","size","icons","tone","muted","T0","t6","slot","T1","t7","main","t8","t9","t10","t11","t12","t13","t14","rowStyleOf","Pick","lines","base","twoLine","threeLine","_c","NativeText"],"sources":["../../src/row/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { StyleProp, TextStyle, ViewStyle } from 'react-native'\n\nimport { useMemo } from 'react'\nimport { Text as NativeText, View } from 'react-native'\n\nimport type { IconStyle } from '../glyphs/icon-style'\nimport type { ResolvedTheme } from '../theme/scope'\nimport type { RowVariant } from './styles'\n\nimport { IconStyleContext } from '../glyphs/icon-style'\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { useTypeRole } from '../typography/roles'\nimport { rowContentColor, rowStyles, rowStylesOf } from './styles'\n\n// The size an icon in either slot is drawn at, the lists and menus pages'.\nconst ICON_SIZE = 24\n\ntype RowContentProps = {\n /** The row's headline, the one thing it is mostly about. */\n readonly children?: ReactNode\n /**\n * Whether the row is disabled. Its headline, slots and lines take the\n * faded on-surface colour, the supporting line included.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Whether the row is selected. Its headline, slots and lines take the\n * selected container's own on-colour, since the muted role is not\n * guaranteed to be readable over it.\n * @default false\n */\n readonly isSelected?: boolean\n /** Content before the headline: an avatar, an icon, a checkbox. */\n readonly leading?: ReactNode\n /** A line above the headline, in label small and the muted role. */\n readonly overline?: ReactNode\n /** A second line under the headline, in body medium and the muted role. */\n readonly supporting?: ReactNode\n /** Content after the headline, such as an amount or a control. */\n readonly trailing?: ReactNode\n /**\n * Which spec page's row this is. A list item's headline is body large and\n * a menu item's label large.\n * @default 'list'\n */\n readonly variant?: RowVariant\n}\n\n/** Whether a slot was given something to draw. */\nfunction hasContent(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== ''\n}\n\n/**\n * The inside of a row: the leading slot, the headline with the lines beside\n * it, and the trailing slot, each drawn only when given. The view around it\n * is the caller's, ListItem's or a menu's item, and takes `rowStyleOf`; this\n * is what each of them puts inside it, so a list and a menu draw the same\n * row. Both slots hand an icon the row's content colour at 24dp, through\n * `useIconStyle()`. Not a component of the library's own and not exported.\n */\nfunction RowContent({\n children,\n isDisabled = false,\n isSelected = false,\n leading,\n overline,\n supporting,\n trailing,\n variant = 'list',\n}: RowContentProps) {\n const theme = useTheme()\n const own = rowStylesOf(theme)\n const headlineRole = useTypeRole(\n variant === 'menu' ? 'labelLarge' : 'bodyLarge',\n )\n const overlineRole = useTypeRole('labelSmall')\n const supportingRole = useTypeRole('bodyMedium')\n const color = rowContentColor(theme, { isDisabled, isSelected, variant })\n const icons = useMemo<IconStyle>(() => ({ color, size: ICON_SIZE }), [color])\n // The muted role on the surface; the row's own colour over a selected\n // container, and on a disabled row, which fades the lines with the rest.\n const tone = isDisabled || isSelected ? { color } : own.muted\n\n return (\n <IconStyleContext value={icons}>\n {hasContent(leading) ? (\n <View style={rowStyles.slot}>{leading}</View>\n ) : null}\n <View style={own.main}>\n {hasContent(overline) ? (\n <NativeText style={composeStyles<TextStyle>(overlineRole, tone)}>\n {overline}\n </NativeText>\n ) : null}\n <NativeText style={composeStyles<TextStyle>(headlineRole, { color })}>\n {children}\n </NativeText>\n {hasContent(supporting) ? (\n <NativeText style={composeStyles<TextStyle>(supportingRole, tone)}>\n {supporting}\n </NativeText>\n ) : null}\n </View>\n {hasContent(trailing) ? (\n <View style={rowStyles.slot}>{trailing}</View>\n ) : null}\n </IconStyleContext>\n )\n}\n\n/**\n * The style of the view around a row's content: the padding and gap, the\n * variant's height, the taller item its lines make it, and the selected\n * container. Which of the lists page's three items a row is comes from its\n * content rather than a prop, so a row holding all three lines already says\n * it is the three-line item. A line that wraps grows the shorter item and\n * keeps its slots centred.\n */\nfunction rowStyleOf(\n theme: ResolvedTheme,\n {\n isSelected = false,\n overline,\n supporting,\n variant = 'list',\n }: Pick<\n RowContentProps,\n 'isSelected' | 'overline' | 'supporting' | 'variant'\n >,\n): StyleProp<ViewStyle> {\n const own = rowStylesOf(theme)\n const lines =\n (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0)\n\n return composeStyles<ViewStyle>(\n own.base,\n own[variant],\n lines === 1 ? own.twoLine : undefined,\n lines === 2 ? own.threeLine : undefined,\n isSelected\n ? own[variant === 'menu' ? 'selectedMenu' : 'selectedList']\n : undefined,\n )\n}\n\nexport type { RowContentProps, RowVariant }\n\nexport { hasContent, RowContent, rowContentColor, rowStyleOf, rowStyles }\n"],"mappings":";;;;;;;;;;AAiBA,MAAMkB,YAAY;;AAmClB,SAASU,WAAWC,MAA0B;CAC5C,OAAOA,SAASC,KAAAA,KAAaD,SAAS,QAAQA,SAAS,SAASA,SAAS;AAC3E;;;;;;;;;AAUA,SAAAE,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAAd,UAAAC,YAAAc,IAAAb,YAAAc,IAAAb,SAAAC,UAAAC,YAAAC,UAAAC,SAAAU,OAAAL;CAElB,MAAAX,aAAAc,OAAAL,KAAAA,IAAA,QAAAK;CACA,MAAAb,aAAAc,OAAAN,KAAAA,IAAA,QAAAM;CAKA,MAAAT,UAAAU,OAAAP,KAAAA,IAAA,SAAAO;CAEA,MAAAC,QAAc1B,SAAS;CACvB,MAAA2B,MAAYtB,YAAYqB,KAAK;CAC7B,MAAAE,eAAqB1B,YACnBa,YAAY,SAAZ,eAAA,WACF;CACA,MAAAc,eAAqB3B,YAAY,YAAY;CAC7C,MAAA4B,iBAAuB5B,YAAY,YAAY;CAAC,IAAA6B;CAAA,IAAAV,EAAA,OAAAZ,cAAAY,EAAA,OAAAX,cAAAW,EAAA,OAAAK,SAAAL,EAAA,OAAAN,SAAA;EAClCgB,KAAA5B,gBAAgBuB,OAAO;GAAAjB;GAAAC;GAAAK;EAAkC,CAAC;EAACM,EAAA,KAAAZ;EAAAY,EAAA,KAAAX;EAAAW,EAAA,KAAAK;EAAAL,EAAA,KAAAN;EAAAM,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAzE,MAAAW,QAAcD;CAA2D,IAA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MACJ3B,IAAIZ,UACJsC,UAAU,IAAI1B,IAAI4B,UAAUrC,KAAAA,GAC5BmC,UAAU,IAAI1B,IAAI6B,YAAYtC,KAAAA,GAC9BR,aACIiB,IAAIZ,YAAY,SAAS,iBAAiB,kBAC1CG,KAAAA,CACN;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","StyleProp","TextStyle","ViewStyle","useMemo","Text","NativeText","View","IconStyle","ResolvedTheme","RowVariant","IconStyleContext","useTheme","composeStyles","nativeWeight","useTypeRole","rowContentColor","rowStyles","rowStylesOf","ICON_SIZE","SELECTED_CONTAINER","drawer","list","menu","const","Record","RowContentProps","children","isDisabled","isEmphasized","isSelected","leading","overline","supporting","trailing","variant","hasContent","node","undefined","RowContent","t0","$","_c","t1","t2","t3","t4","theme","own","headlineRole","overlineRole","supportingRole","t5","color","t6","size","icons","tone","muted","T0","t7","slot","T1","t8","main","t9","t10","fontWeight","typography","weightBold","t11","t12","t13","t14","t15","rowStyleOf","Pick","lines","base","twoLine","threeLine","_c","NativeText"],"sources":["../../src/row/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { StyleProp, TextStyle, ViewStyle } from 'react-native'\n\nimport { useMemo } from 'react'\nimport { Text as NativeText, View } from 'react-native'\n\nimport type { IconStyle } from '../glyphs/icon-style'\nimport type { ResolvedTheme } from '../theme/scope'\nimport type { RowVariant } from './styles'\n\nimport { IconStyleContext } from '../glyphs/icon-style'\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { nativeWeight, useTypeRole } from '../typography/roles'\nimport { rowContentColor, rowStyles, rowStylesOf } from './styles'\n\n// The size an icon in either slot is drawn at, the lists and menus pages'.\nconst ICON_SIZE = 24\n\n// The style of each variant's selected container.\nconst SELECTED_CONTAINER = {\n drawer: 'selectedDrawer',\n list: 'selectedList',\n menu: 'selectedMenu',\n} as const satisfies Record<RowVariant, string>\n\ntype RowContentProps = {\n /** The row's headline, the one thing it is mostly about. */\n readonly children?: ReactNode\n /**\n * Whether the row is disabled. Its headline, slots and lines take the\n * faded on-surface colour, the supporting line included.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Whether the headline is drawn in the bold weight rather than its role's\n * own, for a row marked without the container a selected one takes. The\n * navigation drawer's trail to the current row is what asks for it.\n * @default false\n */\n readonly isEmphasized?: boolean\n /**\n * Whether the row is selected. Its headline, slots and lines take the\n * selected container's own on-colour, since the muted role is not\n * guaranteed to be readable over it.\n * @default false\n */\n readonly isSelected?: boolean\n /** Content before the headline: an avatar, an icon, a checkbox. */\n readonly leading?: ReactNode\n /** A line above the headline, in label small and the muted role. */\n readonly overline?: ReactNode\n /** A second line under the headline, in body medium and the muted role. */\n readonly supporting?: ReactNode\n /** Content after the headline, such as an amount or a control. */\n readonly trailing?: ReactNode\n /**\n * Which spec page's row this is. A list item's headline is body large, and\n * a menu item's and a navigation drawer row's label large.\n * @default 'list'\n */\n readonly variant?: RowVariant\n}\n\n/** Whether a slot was given something to draw. */\nfunction hasContent(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== ''\n}\n\n/**\n * The inside of a row: the leading slot, the headline with the lines beside\n * it, and the trailing slot, each drawn only when given. The view around it\n * is the caller's, ListItem's or a menu's item, and takes `rowStyleOf`; this\n * is what each of them puts inside it, so a list and a menu draw the same\n * row. Both slots hand an icon the row's content colour at 24dp, through\n * `useIconStyle()`. Not a component of the library's own and not exported.\n */\nfunction RowContent({\n children,\n isDisabled = false,\n isEmphasized = false,\n isSelected = false,\n leading,\n overline,\n supporting,\n trailing,\n variant = 'list',\n}: RowContentProps) {\n const theme = useTheme()\n const own = rowStylesOf(theme)\n const headlineRole = useTypeRole(\n variant === 'list' ? 'bodyLarge' : 'labelLarge',\n )\n const overlineRole = useTypeRole('labelSmall')\n const supportingRole = useTypeRole('bodyMedium')\n const color = rowContentColor(theme, { isDisabled, isSelected, variant })\n const icons = useMemo<IconStyle>(() => ({ color, size: ICON_SIZE }), [color])\n // The muted role on the surface; the row's own colour over a selected\n // container, and on a disabled row, which fades the lines with the rest.\n const tone = isDisabled || isSelected ? { color } : own.muted\n\n return (\n <IconStyleContext value={icons}>\n {hasContent(leading) ? (\n <View style={rowStyles.slot}>{leading}</View>\n ) : null}\n <View style={own.main}>\n {hasContent(overline) ? (\n <NativeText style={composeStyles<TextStyle>(overlineRole, tone)}>\n {overline}\n </NativeText>\n ) : null}\n <NativeText\n style={composeStyles<TextStyle>(\n headlineRole,\n { color },\n isEmphasized\n ? { fontWeight: nativeWeight(theme.typography.weightBold) }\n : undefined,\n )}\n >\n {children}\n </NativeText>\n {hasContent(supporting) ? (\n <NativeText style={composeStyles<TextStyle>(supportingRole, tone)}>\n {supporting}\n </NativeText>\n ) : null}\n </View>\n {hasContent(trailing) ? (\n <View style={rowStyles.slot}>{trailing}</View>\n ) : null}\n </IconStyleContext>\n )\n}\n\n/**\n * The style of the view around a row's content: the padding and gap, the\n * variant's height, the taller item its lines make it, and the selected\n * container. Which of the lists page's three items a row is comes from its\n * content rather than a prop, so a row holding all three lines already says\n * it is the three-line item. A line that wraps grows the shorter item and\n * keeps its slots centred.\n */\nfunction rowStyleOf(\n theme: ResolvedTheme,\n {\n isSelected = false,\n overline,\n supporting,\n variant = 'list',\n }: Pick<\n RowContentProps,\n 'isSelected' | 'overline' | 'supporting' | 'variant'\n >,\n): StyleProp<ViewStyle> {\n const own = rowStylesOf(theme)\n const lines =\n (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0)\n\n return composeStyles<ViewStyle>(\n own.base,\n own[variant],\n lines === 1 ? own.twoLine : undefined,\n lines === 2 ? own.threeLine : undefined,\n isSelected ? own[SELECTED_CONTAINER[variant]] : undefined,\n )\n}\n\nexport type { RowContentProps, RowVariant }\n\nexport { hasContent, RowContent, rowContentColor, rowStyleOf, rowStyles }\n"],"mappings":";;;;;;;;;;AAiBA,MAAMmB,YAAY;AAGlB,MAAMC,qBAAqB;CACzBC,QAAQ;CACRC,MAAM;CACNC,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IAAI+B,UAAUzC,KAAAA,GAC5BuC,UAAU,IAAI7B,IAAIgC,YAAY1C,KAAAA,GAC9BR,aAAakB,IAAI5B,mBAAmBe,YAAYG,KAAAA,CAClD;AACF"}
|
package/dist/row/styles.js
CHANGED
|
@@ -2,7 +2,12 @@ import { themedStyles } from "../theme/styles.js";
|
|
|
2
2
|
import { withOpacity } from "../theme/color.js";
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
4
|
//#region src/row/styles.ts
|
|
5
|
-
const
|
|
5
|
+
const SELECTED_CONTENT = {
|
|
6
|
+
drawer: "onSecondaryContainer",
|
|
7
|
+
list: "onPrimaryContainer",
|
|
8
|
+
menu: "onTertiaryContainer"
|
|
9
|
+
};
|
|
10
|
+
const rowStylesOf = themedStyles(({ colors, radii, sizing, spacing }) => StyleSheet.create({
|
|
6
11
|
base: {
|
|
7
12
|
alignItems: "center",
|
|
8
13
|
flexDirection: "row",
|
|
@@ -10,6 +15,11 @@ const rowStylesOf = themedStyles(({ colors, sizing, spacing }) => StyleSheet.cre
|
|
|
10
15
|
paddingHorizontal: spacing.lg,
|
|
11
16
|
paddingVertical: spacing.md
|
|
12
17
|
},
|
|
18
|
+
drawer: {
|
|
19
|
+
borderRadius: radii.pill,
|
|
20
|
+
marginHorizontal: spacing.md,
|
|
21
|
+
minHeight: sizing.rowSm
|
|
22
|
+
},
|
|
13
23
|
list: { minHeight: sizing.rowSm },
|
|
14
24
|
main: {
|
|
15
25
|
flexGrow: 1,
|
|
@@ -19,6 +29,7 @@ const rowStylesOf = themedStyles(({ colors, sizing, spacing }) => StyleSheet.cre
|
|
|
19
29
|
},
|
|
20
30
|
menu: { minHeight: sizing.rowXs },
|
|
21
31
|
muted: { color: colors.onSurfaceVariant },
|
|
32
|
+
selectedDrawer: { backgroundColor: colors.secondaryContainer },
|
|
22
33
|
selectedList: { backgroundColor: colors.primaryContainer },
|
|
23
34
|
selectedMenu: { backgroundColor: colors.tertiaryContainer },
|
|
24
35
|
threeLine: {
|
|
@@ -42,7 +53,7 @@ const rowStyles = StyleSheet.create({
|
|
|
42
53
|
*/
|
|
43
54
|
function rowContentColor({ colors, stateLayerOpacity }, { isDisabled = false, isSelected = false, variant = "list" }) {
|
|
44
55
|
if (isDisabled) return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent);
|
|
45
|
-
if (isSelected) return variant
|
|
56
|
+
if (isSelected) return colors[SELECTED_CONTENT[variant]];
|
|
46
57
|
return colors.onSurface;
|
|
47
58
|
}
|
|
48
59
|
//#endregion
|
package/dist/row/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["StyleSheet","ResolvedTheme","withOpacity","themedStyles","RowVariant","rowStylesOf","colors","sizing","spacing","create","base","alignItems","flexDirection","gap","lg","paddingHorizontal","paddingVertical","md","
|
|
1
|
+
{"version":3,"file":"styles.js","names":["StyleSheet","ResolvedTheme","withOpacity","themedStyles","RowVariant","SELECTED_CONTENT","drawer","list","menu","const","Record","rowStylesOf","colors","radii","sizing","spacing","create","base","alignItems","flexDirection","gap","lg","paddingHorizontal","paddingVertical","md","borderRadius","pill","marginHorizontal","minHeight","rowSm","main","flexGrow","flexShrink","xxs","minWidth","rowXs","muted","color","onSurfaceVariant","selectedDrawer","backgroundColor","secondaryContainer","selectedList","primaryContainer","selectedMenu","tertiaryContainer","threeLine","rowLg","twoLine","rowMd","rowStyles","ring","outlineOffset","slot","justifyContent","rowContentColor","stateLayerOpacity","isDisabled","isSelected","variant","onSurface","disabledContent"],"sources":["../../src/row/styles.ts"],"sourcesContent":["import { StyleSheet } from 'react-native'\n\nimport type { ResolvedTheme } from '../theme/scope'\n\nimport { withOpacity } from '../theme/color'\nimport { themedStyles } from '../theme/styles'\n\n// The row every list and menu item draws, as web's src/row draws it: the\n// lists page's 16dp inline and 12dp block padding, 16dp between the slots\n// and the text, and a height per spec page and line count. Each height is a\n// `minHeight`, since the lines inside are set in type roles whose sizes are\n// tokens, and a larger OS text size grows the row rather than clipping it.\n// The navigation drawer page gives its row the lists page's 56dp too, with a\n// menu's label large label, and marks the current one with a secondary\n// container pill held 12dp off each edge, as web's drawer row does.\n\n/**\n * Which spec page's row this is: the lists page's, the menus page's or the\n * navigation drawer page's.\n */\ntype RowVariant = 'drawer' | 'list' | 'menu'\n\n// The on-colour of each variant's selected container.\nconst SELECTED_CONTENT = {\n drawer: 'onSecondaryContainer',\n list: 'onPrimaryContainer',\n menu: 'onTertiaryContainer',\n} as const satisfies Record<RowVariant, keyof ResolvedTheme['colors']>\n\nconst rowStylesOf = themedStyles(\n ({ colors, radii, sizing, spacing }: ResolvedTheme) =>\n StyleSheet.create({\n base: {\n alignItems: 'center',\n flexDirection: 'row',\n gap: spacing.lg,\n paddingHorizontal: spacing.lg,\n paddingVertical: spacing.md,\n },\n // The navigation drawer page's row: the lists page's floor, and a pill\n // held off each edge, since what marks the current row there is a shape\n // as much as a colour. The row hands the same corners to its state layer\n // and ripple, which clip to them.\n drawer: {\n borderRadius: radii.pill,\n marginHorizontal: spacing.md,\n minHeight: sizing.rowSm,\n },\n // The lists page's one-line item.\n list: {\n minHeight: sizing.rowSm,\n },\n // The headline and the lines beside it take what the slots leave and\n // wrap past it, so a long one never runs under the trailing slot.\n // `minWidth: 0` is for React Native Web, where a text in a row keeps\n // CSS's automatic minimum, the width of its longest word.\n main: {\n flexGrow: 1,\n flexShrink: 1,\n gap: spacing.xxs,\n minWidth: 0,\n },\n // The menus page's item.\n menu: {\n minHeight: sizing.rowXs,\n },\n muted: {\n color: colors.onSurfaceVariant,\n },\n // The drawer page's current row, on secondary container rather than the\n // lists page's primary one, which keeps it apart from a selected row in\n // a list beside it.\n selectedDrawer: {\n backgroundColor: colors.secondaryContainer,\n },\n selectedList: {\n backgroundColor: colors.primaryContainer,\n },\n selectedMenu: {\n backgroundColor: colors.tertiaryContainer,\n },\n // The three-line item, the only one whose slots move: they are held\n // level with the overline rather than centred on the three lines.\n threeLine: {\n alignItems: 'flex-start',\n minHeight: sizing.rowLg,\n },\n twoLine: {\n minHeight: sizing.rowMd,\n },\n }),\n)\n\nconst rowStyles = StyleSheet.create({\n // The focus ring, drawn inside the row as web's is, so a container that\n // clips its rows, such as a menu's surface, leaves the whole ring showing.\n ring: {\n outlineOffset: -2,\n },\n slot: {\n alignItems: 'center',\n flexShrink: 0,\n justifyContent: 'center',\n },\n})\n\n/**\n * The colour a row's headline, slots and feedback are drawn in: on surface,\n * the selected container's own on-colour, or on surface faded to the\n * disabled content opacity, which wins over the selected one.\n */\nfunction rowContentColor(\n { colors, stateLayerOpacity }: ResolvedTheme,\n {\n isDisabled = false,\n isSelected = false,\n variant = 'list',\n }: {\n readonly isDisabled?: boolean\n readonly isSelected?: boolean\n readonly variant?: RowVariant\n },\n): string {\n if (isDisabled) {\n return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n }\n if (isSelected) {\n return colors[SELECTED_CONTENT[variant]]\n }\n return colors.onSurface\n}\n\nexport type { RowVariant }\n\nexport { rowContentColor, rowStyles, rowStylesOf }\n"],"mappings":";;;;AAuBA,MAAMK,mBAAmB;CACvBC,QAAQ;CACRC,MAAM;CACNC,MAAM;AACR;AAEA,MAAMG,cAAcR,cACjB,EAAES,QAAQC,OAAOC,QAAQC,cACxBf,WAAWgB,OAAO;CAChBC,MAAM;EACJC,YAAY;EACZC,eAAe;EACfC,KAAKL,QAAQM;EACbC,mBAAmBP,QAAQM;EAC3BE,iBAAiBR,QAAQS;CAC3B;CAKAlB,QAAQ;EACNmB,cAAcZ,MAAMa;EACpBC,kBAAkBZ,QAAQS;EAC1BI,WAAWd,OAAOe;CACpB;CAEAtB,MAAM,EACJqB,WAAWd,OAAOe,MACpB;CAKAC,MAAM;EACJC,UAAU;EACVC,YAAY;EACZZ,KAAKL,QAAQkB;EACbC,UAAU;CACZ;CAEA1B,MAAM,EACJoB,WAAWd,OAAOqB,MACpB;CACAC,OAAO,EACLC,OAAOzB,OAAO0B,iBAChB;CAIAC,gBAAgB,EACdC,iBAAiB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