@kanso-labs/react-native-kanso-ui 0.9.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/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 +44 -22
- package/dist/button/index.js.map +1 -1
- 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/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-group/index.d.ts +3 -4
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/checkbox-group/index.js.map +1 -1
- 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/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 +1 -1
- package/dist/components/fab/index.js +91 -76
- package/dist/components/fab/index.js.map +1 -1
- 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/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/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/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/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/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/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/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/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 +310 -154
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +9 -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 +5 -2
- 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 +35 -3
- package/dist/index.js +34 -3
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +92 -77
- package/dist/modal/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 +13 -1
- 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/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/package.json +11 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactElement","ReactNode","Ref","ColorValue","GestureResponderEvent","LayoutChangeEvent","LayoutRectangle","NativeScrollEvent","NativeSyntheticEvent","PressableProps","StyleProp","TextStyle","ViewStyle","AnimatedStyle","Key","Node","Orientation","TabListState","TabListStateOptions","Children","createContext","isValidElement","use","useCallback","useEffect","useId","useRef","useState","I18nManager","Text","NativeText","Pressable","ScrollView","StyleSheet","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","useTabListState","IconStyle","ResolvedTheme","IconStyleContext","usePressFeedback","useLinkPress","withOpacity","useTheme","composeStyles","themedStyles","useTypeRole","Badge","Bar","layout","TabsLayout","orientation","variant","TabsVariant","Measured","label","tab","Placement","length","offset","TabsContextValue","bar","found","ids","state","TabsListElement","TabsListProps","children","item","T","items","Iterable","ref","style","testID","TabsPanelProps","id","TabsPanelsProps","TabsProps","defaultSelectedKey","disabledKeys","isDisabled","onSelectionChange","key","selectedKey","TabsTabProps","Omit","badge","href","icon","textValue","PRIMARY_THICKNESS","SECONDARY_THICKNESS","LEAST_INDICATOR","ICON_SIZE","STACKED_HEIGHT","SCROLLABLE_LEAST","SCROLLABLE_MOST","NO_MEASUREMENTS","ReadonlyMap","Map","NO_HEIGHTS","NO_TABS","TabsContext","PanelHeightContext","height","styles","create","atLeft","left","atRight","right","flexShrink","besideBar","flexGrow","minWidth","clip","overflow","alignItems","justifyContent","width","flexDirection","line","listVertical","rootVertical","row","scroll","tabScrollable","maxWidth","tabShared","flex","tabStacked","minHeight","tabVertical","text","textAlign","textVertical","stylesOf","colors","sizing","spacing","divider","backgroundColor","outlineVariant","bottom","pointerEvents","position","dividerVertical","end","top","indicator","primary","borderTopLeftRadius","borderTopRightRadius","indicatorSecondary","indicatorSecondaryVertical","indicatorVertical","borderBottomStartRadius","borderTopStartRadius","labelInline","gap","sm","labelStacked","xxs","lineBadged","xs","boxSizing","controlMd","paddingHorizontal","lg","ringStyles","ring","outlineOffset","Tabs","t0","$","_c","t1","t2","t3","undefined","t4","listOf","list","t5","props","t6","t7","t8","t9","contextOf","context","t10","t11","t12","t13","TabsList","ariaLabel","labelledBy","useTabs","theme","own","reduceMotion","measured","setMeasured","viewport","setViewport","scrolled","revealed","vertical","scrollable","selected","get","placementOf","placement","Symbol","for","part","previous","withMeasurement","measure","event","contentOffset","nativeEvent","current","y","x","onScroll","first","target","revealOffset","animated","scrollTo","collection","map","node","tabs","t14","t15","viewportOf","t16","TabsTab","_props","getCollectionNode","hasChildNodes","rendered","type","TabState","disabled","engaged","badgeFor","colorOf","stateLayerOpacity","onSurface","disabledContent","onSurfaceVariant","heightOf","report","iconStyleOf","color","size","Indicator","motion","placed","moved","set","timing","duration","durationMedium1","easing","bezier","easingEmphasized","motionStyle","transform","translateY","translateX","indicatorStyleOf","leftEdgeOf","ReturnType","isRTL","getConstants","doLeftAndRightSwapInRTL","child","toArray","nested","ListTab","onMeasure","role","onBlur","onFocus","onHoverIn","onHoverOut","onLayout","onPress","onPressIn","onPressOut","_id","_isDisabled","_textValue","selectionManager","feedback","pressedColor","press","hasIcon","stacked","hovered","pressed","after","T0","nameOf","tabIdOf","handlers","measureThen","selectThen","tabWidthOf","layer","T1","inset","Math","max","start","setSelectedKey","String","replaceAll","TabsPanel","shown","TabsPanels","heights","setHeights","next","withHeight","box","measuredHeight","value","Error","delete","known","List","Panel","Panels","Tab","_c","NativeText"],"sources":["../../../src/components/tabs/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactElement, ReactNode, Ref } from 'react'\nimport type {\n ColorValue,\n GestureResponderEvent,\n LayoutChangeEvent,\n LayoutRectangle,\n NativeScrollEvent,\n NativeSyntheticEvent,\n PressableProps,\n StyleProp,\n TextStyle,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { Key, Node, Orientation } from 'react-stately'\nimport type {\n TabListState,\n TabListStateOptions,\n} from 'react-stately/useTabListState'\n\nimport {\n Children,\n createContext,\n isValidElement,\n use,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react'\nimport {\n I18nManager,\n Text as NativeText,\n Pressable,\n ScrollView,\n StyleSheet,\n View,\n} from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { useTabListState } from 'react-stately/useTabListState'\n\nimport type { IconStyle } from '../../glyphs/icon-style'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { IconStyleContext } from '../../glyphs/icon-style'\nimport { usePressFeedback } from '../../press'\nimport { useLinkPress } from '../../router'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\nimport { Badge } from '../badge'\n\n// kanso-ui's Tabs: the tabs page's primary and secondary tabs, with the\n// panels they switch between. Both are a 48dp bar divided into equal\n// sections, with a 1dp outline-variant divider inside the bar along its\n// bottom edge.\n//\n// **Primary** draws the active tab in the primary role and, under its label,\n// a 3dp primary indicator rounded along its top. The indicator follows the\n// label rather than the tab, 2dp short of the label at either end and never\n// shorter than 24dp. A primary tab given an icon stacks the page's 24dp icon\n// over its label, 2dp apart, and the bar grows to the page's 64dp.\n//\n// **Secondary** is the strip that sits under a primary one. Its active tab\n// keeps the on-surface role, and its 2dp primary indicator spans the whole\n// tab. An icon sits before the label, 8dp from it, and the strip keeps its\n// 48dp.\n//\n// A badge sits on the icon where a primary tab stacks one, and 4dp after the\n// label anywhere else.\n//\n// **The bar is equal sections unless `layout` says otherwise.**\n// `layout=\"scrollable\"` gives each tab its label's width, between 72dp and\n// 264dp, in a bar that scrolls without a scroll indicator and brings the\n// selected tab into view, at once the first time and with the platform's\n// own scroll after that.\n//\n// **`orientation=\"vertical\"` turns the bar on its side**, as web does, since\n// the page draws no vertical tabs: the tabs stack, the divider runs down the\n// bar's end edge, and each indicator lies along that edge, 3dp and rounded\n// toward the tab on a primary bar, 2dp and square on a secondary one. The bar\n// sits beside the panels rather than above them.\n//\n// **The state is React Stately's `useTabListState`**, the one web's React Aria\n// keeps. `Tabs` finds its `Tabs.List` among its children, through any view or\n// fragment around it, and builds the state from the tabs written there, so\n// the selection, the first tab chosen when none is given and the disabled\n// keys behave as they do on web. Each `Tabs.Tab` gives the state its entry and\n// renders nothing itself: the list draws every tab from its entry.\n//\n// **The indicator is one view**, which moves to the selected tab's measured\n// place over medium1 on the emphasized curve, as web's shared element does,\n// and at once under reduced motion or when the bar itself is laid out again.\n// `Tabs.Panels` moves its height the same way, between the heights its\n// panels report.\n//\n// A tab is a `tab` reporting whether it is selected, inside a `tablist`, and\n// a panel is a `tabpanel` named by its tab. Touch has no arrow keys, so web's\n// `keyboardActivation` is not taken.\n//\n// **The label comes first in the tree and is drawn after the icon**, through\n// a reversed row or column, as src/navigation does it and for its reason: a\n// badge's count is text, and ahead of the label it put the count before the\n// name.\n\n/** The bar's three decisions, which every part reads from the root. */\ntype Bar = {\n readonly layout: TabsLayout\n readonly orientation: Orientation\n readonly variant: TabsVariant\n}\n\n/** What a tab has reported of its place in the bar. */\ntype Measured = {\n readonly label?: LayoutRectangle\n readonly tab?: LayoutRectangle\n}\n\n/** Where the indicator lies along the bar's own axis. */\ntype Placement = {\n readonly length: number\n readonly offset: number\n}\n\ntype TabsContextValue = {\n readonly bar: Bar\n /** Whether a `Tabs.List` was found among the root's children. */\n readonly found: boolean\n /** The root's own id, which the tabs' and panels' ids start with. */\n readonly ids: string\n readonly state: TabListState<object>\n}\n\n/** How the bar shares its room among the tabs. */\ntype TabsLayout = 'fixed' | 'scrollable'\n\ntype TabsListElement = ReactElement<TabsListProps>\n\ntype TabsListProps<T extends object = object> = {\n /** Names the bar, for a screen reader. */\n readonly 'aria-label'?: string\n /** Names the bar after the element with this id. */\n readonly 'aria-labelledby'?: string\n /**\n * The tabs, as `Tabs.Tab` elements each given an `id`, or with `items` a\n * function from an item to its tab.\n */\n readonly children?: ((item: T) => ReactElement) | ReactNode\n /** The items to draw a tab for, through the function `children` is. */\n readonly items?: Iterable<T>\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n}\n\ntype TabsPanelProps = {\n readonly children?: ReactNode\n /**\n * The key of the tab the panel belongs to, which is drawn while that tab\n * is selected. A panel given none is drawn under whichever tab is.\n */\n readonly id?: Key\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n}\n\ntype TabsPanelsProps = {\n /** The `Tabs.Panel` elements, whose box moves between their heights. */\n readonly children?: ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n}\n\ntype TabsProps = {\n /** The bar, as a `Tabs.List`, and the `Tabs.Panel` elements it switches. */\n readonly children?: ReactNode\n /** The tab selected at first, when the bar keeps its own selection. */\n readonly defaultSelectedKey?: Key\n /** The keys of the tabs that take no press, and draw disabled. */\n readonly disabledKeys?: Iterable<Key>\n /**\n * Disables every tab.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * How the bar shares its room: `fixed` divides it into equal sections, and\n * `scrollable` gives each tab its label's width in a bar that scrolls,\n * which is the page's choice for more tabs than the room has sections for.\n * @default 'fixed'\n */\n readonly layout?: TabsLayout\n /** Called with the key of the tab that has just been selected. */\n readonly onSelectionChange?: (key: Key) => void\n /**\n * Whether the bar runs across, above its panels, or down, beside them.\n * @default 'horizontal'\n */\n readonly orientation?: Orientation\n readonly ref?: Ref<ComponentRef<typeof View>>\n /** The key of the selected tab, when the call site holds it. */\n readonly selectedKey?: Key | null\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n /**\n * Which of the page's two tab bars this is: `primary` for the main one,\n * `secondary` for a strip under a primary one.\n * @default 'primary'\n */\n readonly variant?: TabsVariant\n}\n\ntype TabsTabProps = Omit<\n PressableProps,\n 'children' | 'disabled' | 'id' | 'role' | 'style'\n> & {\n /**\n * A badge on the tab: `true` for the badges page's small dot, a number for\n * the large badge holding it. It sits on a primary tab's icon, and after\n * the label anywhere else. The badge is hidden from a screen reader, so say\n * what it says in the tab's `aria-label` too: \"Second item, 3 new\".\n */\n readonly badge?: boolean | number\n /** The tab's label. */\n readonly children?: ReactNode\n /** Where the tab goes when pressed, through the app's router. */\n readonly href?: string\n /**\n * An icon with the label, at the page's 24dp: over it on a primary tab,\n * whose bar grows to 64dp, and before it on a secondary one. The slot hands\n * it its colour and size through `useIconStyle()`.\n */\n readonly icon?: ReactNode\n /**\n * The tab's key, which selection reports and its `Tabs.Panel` shares.\n * Without one, a tab drawn from `items` takes its item's `id` or `key`.\n */\n readonly id?: Key\n /**\n * Draws the tab disabled, and it takes no press, as a key in the bar's\n * `disabledKeys` does.\n * @default false\n */\n readonly isDisabled?: boolean\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n /**\n * The tab's text, for a label that is not a plain string. Read off\n * `children` when it is one.\n */\n readonly textValue?: string\n}\n\n/** The tabs page's two styles of tab bar. */\ntype TabsVariant = 'primary' | 'secondary'\n\n// The page's thicknesses for the two indicators, and the least a primary one\n// is drawn at, which no token holds.\nconst PRIMARY_THICKNESS = 3\nconst SECONDARY_THICKNESS = 2\nconst LEAST_INDICATOR = 24\n\n// The page's 24dp icon, and the 64dp a primary bar grows to with one stacked\n// over a label. No sizing token holds 64.\nconst ICON_SIZE = 24\nconst STACKED_HEIGHT = 64\n\n// A scrollable bar's tab: MDC-Android's 72dp at the least and 264dp at the\n// most, as on web.\nconst SCROLLABLE_LEAST = 72\nconst SCROLLABLE_MOST = 264\n\nconst NO_MEASUREMENTS: ReadonlyMap<Key, Measured> = new Map()\nconst NO_HEIGHTS: ReadonlyMap<Key, number> = new Map()\nconst NO_TABS: ReactNode[] = []\n\nconst TabsContext = createContext<null | TabsContextValue>(null)\n\n// The heights the panels inside a `Tabs.Panels` report, by key. Null is no\n// box, and a panel then reports nothing.\nconst PanelHeightContext = createContext<\n ((key: Key, height: number | undefined) => void) | null\n>(null)\n\nconst styles = StyleSheet.create({\n // The bar's left edge, which a horizontal indicator is moved from, in the\n // two spellings `leftEdgeOf` picks between.\n atLeft: {\n left: 0,\n },\n atRight: {\n right: 0,\n },\n // A badge after the label, which keeps its size while the label narrows.\n badge: {\n flexShrink: 0,\n },\n // Beside a vertical bar a panel takes the rest of the row.\n besideBar: {\n flexGrow: 1,\n flexShrink: 1,\n minWidth: 0,\n },\n // What a box's height moves inside: its content lays out at its own height\n // whatever the box is, which is what a panel's `onLayout` measures.\n clip: {\n overflow: 'hidden',\n },\n // The page's 24dp icon slot.\n icon: {\n alignItems: 'center',\n flexShrink: 0,\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n },\n // A label longer than its tab narrows to fit inside it rather than pushing\n // out past its padding.\n label: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 1,\n minWidth: 0,\n },\n // The label's text and the badge after it.\n line: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 1,\n minWidth: 0,\n },\n // A vertical bar holds its tabs in a column as wide as its widest.\n listVertical: {\n flexDirection: 'column',\n flexShrink: 0,\n },\n // A vertical bar sits beside its panels.\n rootVertical: {\n flexDirection: 'row',\n },\n // A horizontal bar holds its tabs in a row.\n row: {\n flexDirection: 'row',\n },\n // A bar that scrolls takes the room the bar has, rather than its tabs'\n // whole length.\n scroll: {\n flexGrow: 1,\n flexShrink: 1,\n minWidth: 0,\n },\n // A bar's tab in its scrolling form, as wide as its label.\n tabScrollable: {\n flexGrow: 0,\n flexShrink: 0,\n maxWidth: SCROLLABLE_MOST,\n minWidth: SCROLLABLE_LEAST,\n },\n // An equal share of the bar, whatever its label measures.\n tabShared: {\n flex: 1,\n minWidth: 0,\n },\n tabStacked: {\n minHeight: STACKED_HEIGHT,\n },\n // A vertical bar's tab: one row of it, as tall as its content, with its\n // label at the start.\n tabVertical: {\n justifyContent: 'flex-start',\n },\n text: {\n flexShrink: 1,\n textAlign: 'center',\n },\n textVertical: {\n textAlign: 'auto',\n },\n})\n\nconst stylesOf = themedStyles(({ colors, sizing, spacing }: ResolvedTheme) =>\n StyleSheet.create({\n // The divider, inside the bar along its bottom edge, so it is part of the\n // 48 rather than a pixel under it, and the indicator is drawn over it.\n divider: {\n backgroundColor: colors.outlineVariant,\n bottom: 0,\n height: 1,\n left: 0,\n pointerEvents: 'none',\n position: 'absolute',\n right: 0,\n },\n // Down a vertical bar's end edge.\n dividerVertical: {\n backgroundColor: colors.outlineVariant,\n bottom: 0,\n end: 0,\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: 1,\n },\n // Under the label along a horizontal bar, rounded along its top.\n indicator: {\n backgroundColor: colors.primary,\n borderTopLeftRadius: PRIMARY_THICKNESS,\n borderTopRightRadius: PRIMARY_THICKNESS,\n bottom: 0,\n height: PRIMARY_THICKNESS,\n pointerEvents: 'none',\n position: 'absolute',\n },\n // Across the whole tab, square.\n indicatorSecondary: {\n backgroundColor: colors.primary,\n bottom: 0,\n height: SECONDARY_THICKNESS,\n pointerEvents: 'none',\n position: 'absolute',\n },\n indicatorSecondaryVertical: {\n backgroundColor: colors.primary,\n end: 0,\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: SECONDARY_THICKNESS,\n },\n // Along the tab's end edge, rounded toward the tab.\n indicatorVertical: {\n backgroundColor: colors.primary,\n borderBottomStartRadius: PRIMARY_THICKNESS,\n borderTopStartRadius: PRIMARY_THICKNESS,\n end: 0,\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: PRIMARY_THICKNESS,\n },\n // A secondary tab's icon before its label, 8dp from it. The label comes\n // first in the tree, so the row runs backwards.\n labelInline: {\n flexDirection: 'row-reverse',\n gap: spacing.sm,\n },\n // A primary tab's icon over its label, 2dp apart.\n labelStacked: {\n flexDirection: 'column-reverse',\n gap: spacing.xxs,\n },\n // A badge 4dp after the label.\n lineBadged: {\n gap: spacing.xs,\n },\n // A minimum rather than a height, so the bar takes its tallest tab's:\n // the row stretches every tab in it to one height.\n tab: {\n alignItems: 'center',\n boxSizing: 'border-box',\n flexDirection: 'row',\n justifyContent: 'center',\n minHeight: sizing.controlMd,\n paddingHorizontal: spacing.lg,\n },\n }),\n)\n\n// The focus ring, drawn inside the tab as web's is, so a focused tab shows\n// its whole ring rather than the half its neighbours cover.\nconst ringStyles = StyleSheet.create({\n ring: {\n outlineOffset: -2,\n },\n})\n\n/**\n * A tab bar and the panels it switches between. Pass `selectedKey` with\n * `onSelectionChange` to hold the selection, or `defaultSelectedKey` to let\n * the bar keep its own. Each `Tabs.Tab` names the `Tabs.Panel` it shows\n * through a shared `id`, and a bar may stand alone without panels.\n *\n * ```tsx\n * <Tabs defaultSelectedKey=\"first\">\n * <Tabs.List aria-label=\"Sections\">\n * <Tabs.Tab id=\"first\">First item</Tabs.Tab>\n * <Tabs.Tab id=\"second\">Second item</Tabs.Tab>\n * </Tabs.List>\n * <Tabs.Panel id=\"first\">\n * <Text>Supporting line</Text>\n * </Tabs.Panel>\n * <Tabs.Panel id=\"second\">\n * <Text>Supporting line</Text>\n * </Tabs.Panel>\n * </Tabs>\n * ```\n *\n * Write the `Tabs.List` among the children of `Tabs`, inside any view or\n * fragment, rather than in a component of the call site's own: the bar is\n * found there, and its tabs are what the selection is built from.\n *\n * `style`, `ref` and `testID` land on the root view, the one a layout\n * positions.\n */\nfunction Tabs({\n children,\n defaultSelectedKey,\n disabledKeys,\n isDisabled,\n layout = 'fixed',\n onSelectionChange,\n orientation = 'horizontal',\n ref,\n selectedKey,\n style,\n testID,\n variant = 'primary',\n}: TabsProps) {\n const list = listOf(children)\n const state = useTabListState<object>({\n // Each tab builds its own entry in the collection; see\n // `TabsTab.getCollectionNode`. The collection skips what is not an\n // element, as a ReactNode may be, and asks any element for its entry.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- see above\n children: (list?.props.children ??\n NO_TABS) as TabListStateOptions<object>['children'],\n defaultSelectedKey,\n disabledKeys,\n isDisabled,\n items: list?.props.items,\n onSelectionChange,\n selectedKey: selectedKey ?? undefined,\n })\n const ids = useId()\n const context = contextOf(\n { layout, orientation, variant },\n list !== undefined,\n ids,\n state,\n )\n\n return (\n <TabsContext value={context}>\n <View\n ref={ref}\n style={composeStyles<ViewStyle>(\n orientation === 'vertical' ? styles.rootVertical : undefined,\n style,\n )}\n testID={testID}\n >\n {children}\n </View>\n </TabsContext>\n )\n}\n\n/**\n * The bar: every tab, drawn from the entries its `Tabs.Tab` children gave\n * the root, with the divider and the indicator. Name it with `aria-label` or\n * `aria-labelledby`.\n *\n * `style`, `ref` and `testID` land on the bar's own view.\n */\nfunction TabsList<T extends object = object>({\n 'aria-label': ariaLabel,\n 'aria-labelledby': labelledBy,\n ref,\n style,\n testID,\n}: TabsListProps<T>) {\n const { bar, ids, state } = useTabs('Tabs.List', true)\n const theme = useTheme()\n const own = stylesOf(theme)\n const reduceMotion = useReducedMotion()\n const [measured, setMeasured] = useState(NO_MEASUREMENTS)\n const [viewport, setViewport] = useState(0)\n const scroll = useRef<ComponentRef<typeof ScrollView>>(null)\n const scrolled = useRef(0)\n // The key last brought into view, and undefined until one has been, which\n // is what makes the first reveal instant.\n const revealed = useRef<Key | null | undefined>(undefined)\n const vertical = bar.orientation === 'vertical'\n const scrollable = bar.layout === 'scrollable'\n const { selectedKey } = state\n const selected = selectedKey === null ? undefined : measured.get(selectedKey)\n const placement = placementOf(bar, selected, theme.spacing.xxs)\n\n const measure = useCallback(\n (key: Key, part: keyof Measured, layout: LayoutRectangle) => {\n setMeasured((previous) => withMeasurement(previous, key, part, layout))\n },\n [],\n )\n\n // Keeps how far the bar has scrolled, for the next reveal to measure from.\n const onScroll = useCallback(\n (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n const { contentOffset } = event.nativeEvent\n scrolled.current = vertical ? contentOffset.y : contentOffset.x\n },\n [vertical],\n )\n\n // Brings the selected tab into view in a bar that scrolls, as it becomes\n // the selected one.\n useEffect(() => {\n const tab = selected?.tab\n\n if (\n !scrollable ||\n tab === undefined ||\n viewport === 0 ||\n revealed.current === selectedKey\n ) {\n return\n }\n\n const first = revealed.current === undefined\n revealed.current = selectedKey\n\n const target = revealOffset(\n scrolled.current,\n viewport,\n vertical ? tab.y : tab.x,\n vertical ? tab.height : tab.width,\n )\n\n if (target !== undefined) {\n const animated = !first && !reduceMotion\n scroll.current?.scrollTo(\n vertical ? { animated, y: target } : { animated, x: target },\n )\n }\n }, [reduceMotion, scrollable, selected, selectedKey, vertical, viewport])\n\n const tabs = (\n <>\n {[...state.collection].map((node) => (\n <ListTab\n bar={bar}\n ids={ids}\n key={node.key}\n node={node}\n onMeasure={measure}\n state={state}\n />\n ))}\n {placement === undefined ? null : (\n <Indicator bar={bar} placement={placement} selectedKey={selectedKey} />\n )}\n </>\n )\n\n return (\n <View\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n ref={ref}\n role=\"tablist\"\n style={composeStyles<ViewStyle>(\n vertical ? styles.listVertical : styles.row,\n style,\n )}\n testID={testID}\n >\n <View style={vertical ? own.dividerVertical : own.divider} />\n {scrollable ? (\n <ScrollView\n horizontal={!vertical}\n onLayout={viewportOf(setViewport, vertical)}\n onScroll={onScroll}\n ref={scroll}\n scrollEventThrottle={16}\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n style={styles.scroll}\n >\n {tabs}\n </ScrollView>\n ) : (\n tabs\n )}\n </View>\n )\n}\n\n/**\n * One tab of a `Tabs.List`, which draws it: the root builds its selection\n * from these, so one renders nothing on its own. Give every tab an `id`,\n * which is the key selection reports and its `Tabs.Panel` shares.\n */\nfunction TabsTab(_props: TabsTabProps): null {\n return null\n}\n\n// The entry the root's collection holds for a tab, as React Stately's own\n// `Item` gives one: keyed by the tab's `id`, and carrying the props the bar\n// draws it from.\nTabsTab.getCollectionNode = function* getCollectionNode(props: TabsTabProps) {\n yield {\n 'aria-label': props['aria-label'],\n hasChildNodes: false,\n key: props.id,\n props,\n rendered: props.children,\n textValue:\n props.textValue ??\n (typeof props.children === 'string' ? props.children : ''),\n type: 'item',\n }\n}\n\ntype TabState = {\n readonly disabled: boolean\n readonly engaged: boolean\n readonly selected: boolean\n}\n\n// The badge, which wraps the icon where a primary tab stacks one and stands\n// after the label anywhere else: `true` for the small dot, a number for the\n// large badge, and nothing for `false`.\nfunction badgeFor(\n badge: boolean | number | undefined,\n icon?: ReactNode,\n): ReactNode {\n if (badge === undefined || badge === false) {\n return icon ?? null\n }\n return (\n <Badge\n count={badge === true ? undefined : badge}\n style={icon === undefined ? styles.badge : undefined}\n >\n {icon}\n </Badge>\n )\n}\n\n/**\n * The colour a tab draws its label and icon in: primary for the active tab\n * of a primary bar and on surface for a secondary one's, on surface for an\n * inactive tab a pointer, a focus or a press engages, on surface variant at\n * rest, and on surface at the disabled content opacity while disabled.\n */\nfunction colorOf(\n { colors, stateLayerOpacity }: ResolvedTheme,\n variant: TabsVariant,\n { disabled, engaged, selected }: TabState,\n): string {\n if (disabled) {\n return withOpacity(colors.onSurface, stateLayerOpacity.disabledContent)\n }\n if (selected) {\n return variant === 'primary' ? colors.primary : colors.onSurface\n }\n return engaged ? colors.onSurface : colors.onSurfaceVariant\n}\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's jsx-no-new-object-as-prop is after; the React Compiler\n// memoises the result on its inputs.\nfunction contextOf(\n bar: Bar,\n found: boolean,\n ids: string,\n state: TabListState<object>,\n): TabsContextValue {\n return { bar, found, ids, state }\n}\n\n// A panel's `onLayout` inside a `Tabs.Panels`, which reports its height, and\n// none outside one.\nfunction heightOf(\n report: ((key: Key, height: number | undefined) => void) | null,\n key: Key,\n) {\n if (report === null) {\n return undefined\n }\n return (event: LayoutChangeEvent) => {\n report(key, event.nativeEvent.layout.height)\n }\n}\n\nfunction iconStyleOf(color: ColorValue): IconStyle {\n return { color, size: ICON_SIZE }\n}\n\n/**\n * The active indicator: one view, which moves to the selected tab's place\n * when the selection does, and is put there at once when the bar is only\n * laid out again.\n */\nfunction Indicator({\n bar,\n placement,\n selectedKey,\n}: {\n readonly bar: Bar\n readonly placement: Placement\n readonly selectedKey: Key | null\n}) {\n const theme = useTheme()\n const { motion } = theme\n const own = stylesOf(theme)\n const reduceMotion = useReducedMotion()\n const offset = useSharedValue(placement.offset)\n const length = useSharedValue(placement.length)\n const placed = useRef(selectedKey)\n const vertical = bar.orientation === 'vertical'\n\n useEffect(() => {\n const moved = placed.current !== selectedKey\n placed.current = selectedKey\n\n if (!moved || reduceMotion) {\n offset.set(placement.offset)\n length.set(placement.length)\n return\n }\n\n const timing = {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasized),\n }\n offset.set(withTiming(placement.offset, timing))\n length.set(withTiming(placement.length, timing))\n }, [\n length,\n motion,\n offset,\n placement.length,\n placement.offset,\n reduceMotion,\n selectedKey,\n ])\n\n const motionStyle = useAnimatedStyle(() => {\n 'worklet'\n return vertical\n ? { height: length.get(), transform: [{ translateY: offset.get() }] }\n : { transform: [{ translateX: offset.get() }], width: length.get() }\n })\n\n return (\n <Animated.View\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n indicatorStyleOf(own, bar),\n vertical ? undefined : leftEdgeOf(),\n motionStyle,\n )}\n />\n )\n}\n\nfunction indicatorStyleOf(own: ReturnType<typeof stylesOf>, bar: Bar) {\n if (bar.variant === 'primary') {\n return bar.orientation === 'vertical'\n ? own.indicatorVertical\n : own.indicator\n }\n return bar.orientation === 'vertical'\n ? own.indicatorSecondaryVertical\n : own.indicatorSecondary\n}\n\n/**\n * The style that puts a horizontal indicator at the bar's left edge, which is\n * where a layout measures a tab's `x` from in either direction, so that the\n * indicator's translation is the tab's own `x`. React Native swaps `left` and\n * `right` under a right-to-left layout unless the app turns that off, so\n * there `right` is the one naming the left edge. React Native Web reports no\n * right-to-left layout here and keeps `left` where CSS has it.\n */\nfunction leftEdgeOf() {\n return I18nManager.isRTL && I18nManager.getConstants().doLeftAndRightSwapInRTL\n ? styles.atRight\n : styles.atLeft\n}\n\n// The `Tabs.List` among the root's children, looked for through any element\n// around it, a view or a fragment alike, though never inside another `Tabs`,\n// whose bar is its own. A function child, which some components take, is\n// skipped, as `Children.toArray` skips it.\nfunction listOf(children: ReactNode): TabsListElement | undefined {\n for (const child of Children.toArray(children)) {\n if (isValidElement<TabsListProps>(child) && child.type === TabsList) {\n return child\n }\n if (\n isValidElement<{ children?: ReactNode }>(child) &&\n child.type !== Tabs\n ) {\n const nested = listOf(child.props.children)\n\n if (nested !== undefined) {\n return nested\n }\n }\n }\n return undefined\n}\n\n/**\n * One tab as the bar draws it, from its entry in the collection: a `tab`\n * that selects itself when pressed, and reports where it and its label lie\n * so the indicator can follow them.\n */\nfunction ListTab({\n bar,\n ids,\n node,\n onMeasure,\n state,\n}: {\n readonly bar: Bar\n readonly ids: string\n readonly node: Node<object>\n readonly onMeasure: (\n key: Key,\n part: keyof Measured,\n layout: LayoutRectangle,\n ) => void\n readonly state: TabListState<object>\n}) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const role = useTypeRole('titleSmall')\n // A node carries the props its tab was written with, which\n // `getCollectionNode` puts there and React Stately types as `any`.\n // oxlint-disable-next-line typescript/no-unsafe-assignment -- see above\n const {\n 'aria-label': ariaLabel,\n badge,\n children,\n href,\n icon,\n id: _id,\n isDisabled: _isDisabled,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onLayout,\n onPress,\n onPressIn,\n onPressOut,\n ref,\n style,\n textValue: _textValue,\n ...props\n }: TabsTabProps = node.props\n const { key } = node\n // The selection manager reads a tab's own `isDisabled` off its node, beside\n // the bar's `disabledKeys`, so it answers for both.\n const disabled = state.isDisabled || state.selectionManager.isDisabled(key)\n const selected = state.selectedKey === key\n const { variant } = bar\n const feedback = usePressFeedback({\n color:\n variant === 'primary' && selected\n ? theme.colors.primary\n : theme.colors.onSurface,\n disabled,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n pressedColor:\n variant === 'primary' ? theme.colors.primary : theme.colors.onSurface,\n })\n const press = useLinkPress(href, onPress)\n const vertical = bar.orientation === 'vertical'\n const hasIcon = icon !== undefined && icon !== null\n const stacked = hasIcon && variant === 'primary'\n const color = colorOf(theme, variant, {\n disabled,\n engaged:\n feedback.hovered || feedback.pressed || feedback.ring !== undefined,\n selected,\n })\n const after = stacked ? null : badgeFor(badge)\n const text = (\n <NativeText\n numberOfLines={stacked ? 1 : 2}\n style={composeStyles<TextStyle>(\n role,\n styles.text,\n vertical ? styles.textVertical : undefined,\n { color },\n )}\n >\n {children}\n </NativeText>\n )\n\n return (\n <Pressable\n aria-label={ariaLabel ?? nameOf(children)}\n aria-selected={selected}\n id={tabIdOf(ids, key)}\n ref={ref}\n role=\"tab\"\n {...props}\n {...feedback.handlers}\n disabled={disabled}\n onLayout={measureThen(onMeasure, key, 'tab', onLayout)}\n onPress={selectThen(state, key, press)}\n style={composeStyles<ViewStyle>(\n own.tab,\n vertical ? styles.tabVertical : tabWidthOf(bar.layout),\n stacked ? styles.tabStacked : undefined,\n feedback.ring,\n feedback.ring === undefined ? undefined : ringStyles.ring,\n style,\n )}\n >\n {feedback.layer}\n <View\n onLayout={measureThen(onMeasure, key, 'label')}\n style={composeStyles<ViewStyle>(\n styles.label,\n hasIcon ? (stacked ? own.labelStacked : own.labelInline) : undefined,\n )}\n >\n {after === null ? (\n text\n ) : (\n <View style={composeStyles<ViewStyle>(styles.line, own.lineBadged)}>\n {text}\n {after}\n </View>\n )}\n {hasIcon ? (\n <View style={styles.icon}>\n <IconStyleContext value={iconStyleOf(color)}>\n {stacked ? badgeFor(badge, icon) : icon}\n </IconStyleContext>\n </View>\n ) : null}\n </View>\n </Pressable>\n )\n}\n\n// A tab's or a label's `onLayout`, which reports its place to the bar, then\n// calls the call site's own.\nfunction measureThen(\n onMeasure: (key: Key, part: keyof Measured, layout: LayoutRectangle) => void,\n key: Key,\n part: keyof Measured,\n onLayout?: ((event: LayoutChangeEvent) => void) | null,\n) {\n return (event: LayoutChangeEvent) => {\n onMeasure(key, part, event.nativeEvent.layout)\n onLayout?.(event)\n }\n}\n\n// A label that is a string names its tab; anything else leaves the name to\n// `aria-label`.\nfunction nameOf(children: ReactNode): string | undefined {\n return typeof children === 'string' ? children : undefined\n}\n\n/**\n * Where the indicator lies along the bar, from the selected tab's measured\n * place: under its label on a horizontal primary bar, 2dp short of it at\n * either end and at least 24dp, and along the tab's whole length on a\n * secondary bar. Down a vertical bar the same two, along the tab's height.\n * Nothing until what it follows has been measured.\n */\nfunction placementOf(\n { orientation, variant }: Bar,\n measured: Measured | undefined,\n inset: number,\n): Placement | undefined {\n const tab = measured?.tab\n\n if (tab === undefined) {\n return undefined\n }\n\n if (orientation === 'vertical') {\n if (variant === 'secondary') {\n return { length: tab.height, offset: tab.y }\n }\n const length = Math.max(LEAST_INDICATOR, tab.height - 2 * inset)\n return { length, offset: tab.y + (tab.height - length) / 2 }\n }\n\n if (variant === 'secondary') {\n return { length: tab.width, offset: tab.x }\n }\n\n const label = measured?.label\n\n if (label === undefined) {\n return undefined\n }\n\n const length = Math.max(LEAST_INDICATOR, label.width - 2 * inset)\n return { length, offset: tab.x + label.x + (label.width - length) / 2 }\n}\n\n// How far to scroll a bar so a tab lies whole inside it, or nothing when it\n// already does: to its start when it is cut off there, and to its end when\n// it is cut off at the end.\nfunction revealOffset(\n scrolled: number,\n viewport: number,\n start: number,\n size: number,\n): number | undefined {\n if (start < scrolled) {\n return start\n }\n if (start + size > scrolled + viewport) {\n return start + size - viewport\n }\n return undefined\n}\n\n// A press's selection of its tab, then the call site's own handler and the\n// tab's `href`.\nfunction selectThen(\n state: TabListState<object>,\n key: Key,\n press: (event: GestureResponderEvent) => void,\n) {\n return (event: GestureResponderEvent) => {\n state.setSelectedKey(key)\n press(event)\n }\n}\n\n// The id a tab carries for its panel to be named by. Whitespace is taken out\n// of the key, as React Aria does, since a name list is split on it.\nfunction tabIdOf(ids: string, key: Key) {\n return `${ids}-tab-${String(key).replaceAll(/\\s+/gu, '')}`\n}\n\n/**\n * The content of one tab, drawn while its tab is selected. Its `id` is the\n * tab's.\n *\n * `style`, `ref` and `testID` land on the panel's own view.\n */\nfunction TabsPanel({ children, id, ref, style, testID }: TabsPanelProps) {\n const { bar, ids, state } = useTabs('Tabs.Panel')\n const report = use(PanelHeightContext)\n const key = id ?? state.selectedKey\n const shown = key !== null && key === state.selectedKey\n\n // A panel's height is forgotten once it is no longer drawn, so the box\n // waits for the next one's own rather than moving to a height measured\n // the last time it was shown.\n useEffect(() => {\n if (report === null || !shown) {\n return undefined\n }\n return () => {\n report(key, undefined)\n }\n }, [key, report, shown])\n\n if (!shown) {\n return null\n }\n\n return (\n <View\n aria-labelledby={tabIdOf(ids, key)}\n onLayout={heightOf(report, key)}\n ref={ref}\n role=\"tabpanel\"\n style={composeStyles<ViewStyle>(\n bar.orientation === 'vertical' ? styles.besideBar : undefined,\n style,\n )}\n testID={testID}\n >\n {children}\n </View>\n )\n}\n\n/**\n * An optional box around the panels, which moves its height as one panel\n * gives way to the next, over medium1 on the emphasized curve and at once\n * under reduced motion. Without it the panels still work; the box around\n * them simply jumps from one height to the other.\n *\n * `style`, `ref` and `testID` land on the box.\n */\nfunction TabsPanels({ children, ref, style, testID }: TabsPanelsProps) {\n const { bar, state } = useTabs('Tabs.Panels')\n const { motion } = useTheme()\n const reduceMotion = useReducedMotion()\n const [heights, setHeights] = useState(NO_HEIGHTS)\n const height = useSharedValue(-1)\n // The key the box last took its height from, and undefined until it has\n // taken one, which is what keeps the first height from moving.\n const placed = useRef<Key | null | undefined>(undefined)\n const { selectedKey } = state\n const target = selectedKey === null ? undefined : heights.get(selectedKey)\n\n const report = useCallback((key: Key, next: number | undefined) => {\n setHeights((previous) => withHeight(previous, key, next))\n }, [])\n\n useEffect(() => {\n if (target === undefined) {\n return\n }\n\n const moved = placed.current !== undefined && placed.current !== selectedKey\n placed.current = selectedKey\n\n height.set(\n moved && !reduceMotion\n ? withTiming(target, {\n duration: motion.durationMedium1,\n easing: Easing.bezier(...motion.easingEmphasized),\n })\n : target,\n )\n }, [height, motion, reduceMotion, selectedKey, target])\n\n // Before a panel has reported its height the box takes its content's own.\n const box = useAnimatedStyle(() => {\n 'worklet'\n const measuredHeight = height.get()\n\n return measuredHeight < 0 ? {} : { height: measuredHeight }\n })\n\n return (\n <PanelHeightContext value={report}>\n <Animated.View\n ref={ref}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.clip,\n bar.orientation === 'vertical' ? styles.besideBar : undefined,\n box,\n style,\n )}\n testID={testID}\n >\n <View>{children}</View>\n </Animated.View>\n </PanelHeightContext>\n )\n}\n\nfunction tabWidthOf(layout: TabsLayout) {\n return layout === 'scrollable' ? styles.tabScrollable : styles.tabShared\n}\n\nfunction useTabs(part: string, list = false): TabsContextValue {\n const value = use(TabsContext)\n if (value === null) {\n throw new Error(`${part} is drawn inside Tabs.`)\n }\n if (list && !value.found) {\n throw new Error(\n 'Tabs.List is written among the children of Tabs, inside any view or fragment, rather than in a component of its own.',\n )\n }\n return value\n}\n\n// The bar's `onLayout` while it scrolls, which keeps how much of it shows.\nfunction viewportOf(\n setViewport: (viewport: number) => void,\n vertical: boolean,\n) {\n return (event: LayoutChangeEvent) => {\n const { height, width } = event.nativeEvent.layout\n setViewport(vertical ? height : width)\n }\n}\n\nfunction withHeight(\n previous: ReadonlyMap<Key, number>,\n key: Key,\n height: number | undefined,\n): ReadonlyMap<Key, number> {\n if (previous.get(key) === height) {\n return previous\n }\n const next = new Map(previous)\n if (height === undefined) {\n next.delete(key)\n } else {\n next.set(key, height)\n }\n return next\n}\n\nfunction withMeasurement(\n previous: ReadonlyMap<Key, Measured>,\n key: Key,\n part: keyof Measured,\n layout: LayoutRectangle,\n): ReadonlyMap<Key, Measured> {\n const known = previous.get(key)?.[part]\n if (\n known !== undefined &&\n known.x === layout.x &&\n known.y === layout.y &&\n known.width === layout.width &&\n known.height === layout.height\n ) {\n return previous\n }\n const next = new Map(previous)\n next.set(key, { ...previous.get(key), [part]: layout })\n return next\n}\n\nTabs.List = TabsList\nTabs.Panel = TabsPanel\nTabs.Panels = TabsPanels\nTabs.Tab = TabsTab\n\nexport { Tabs, TabsList, TabsPanel, TabsPanels, TabsTab }\nexport type {\n TabsLayout,\n TabsListProps,\n TabsPanelProps,\n TabsPanelsProps,\n TabsProps,\n TabsTabProps,\n TabsVariant,\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4QA,MAAMiG,oBAAoB;AAC1B,MAAMC,sBAAsB;AAC5B,MAAMC,kBAAkB;AAIxB,MAAMC,YAAY;AAClB,MAAMC,iBAAiB;AAIvB,MAAMC,mBAAmB;AACzB,MAAMC,kBAAkB;AAExB,MAAMC,kCAA8C,IAAIE,IAAI;AAC5D,MAAMC,6BAAuC,IAAID,IAAI;AACrD,MAAME,UAAuB,CAAA;AAE7B,MAAMC,cAAcxF,cAAuC,IAAI;AAI/D,MAAMyF,qBAAqBzF,cAEzB,IAAI;AAEN,MAAM2F,SAAS9E,WAAW+E,OAAO;CAG/BC,QAAQ,EACNC,MAAM,EACR;CACAC,SAAS,EACPC,OAAO,EACT;CAEAxB,OAAO,EACLyB,YAAY,EACd;CAEAC,WAAW;EACTC,UAAU;EACVF,YAAY;EACZG,UAAU;CACZ;CAGAC,MAAM,EACJC,UAAU,SACZ;CAEA5B,MAAM;EACJ6B,YAAY;EACZN,YAAY;EACZP,QAAQX;EACRyB,gBAAgB;EAChBC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B,IAAIjH,WAAW2E,KAAAA,GACbqJ,KAAKM,OAAO5P,GAAG;MAEfsP,KAAKhE,IAAItL,KAAKsB,MAAM;CAEtB,OAAOgO;AACT;AAEA,SAAS9G,gBACPD,UACAvI,KACAsI,MACAxK,QAC4B;CAC5B,MAAM+R,QAAQtH,SAASN,IAAIjI,GAAG,CAAC,GAAGsI;CAClC,IACEuH,UAAU5J,KAAAA,KACV4J,MAAM9G,MAAMjL,OAAOiL,KACnB8G,MAAM/G,MAAMhL,OAAOgL,KACnB+G,MAAMxN,UAAUvE,OAAOuE,SACvBwN,MAAMvO,WAAWxD,OAAOwD,QAExB,OAAOiH;CAET,MAAM+G,OAAO,IAAIrO,IAAIsH,QAAQ;CAC7B+G,KAAKhE,IAAItL,KAAK;EAAE,GAAGuI,SAASN,IAAIjI,GAAG;GAAIsI,OAAOxK;CAAO,CAAC;CACtD,OAAOwR;AACT;AAEA5J,KAAKoK,OAAO7I;AACZvB,KAAKqK,QAAQd;AACbvJ,KAAKsK,SAASb;AACdzJ,KAAKuK,MAAMnG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DateFieldProps } from "../date-field/index.js";
|
|
2
|
+
import { TimeFieldStateOptions, TimeValue } from "react-stately/useTimeFieldState";
|
|
3
|
+
//#region src/components/time-field/index.d.ts
|
|
4
|
+
type TimeFieldProps<T extends TimeValue = TimeValue> = Omit<DateFieldProps, 'defaultValue' | 'granularity' | 'hideTimeZone' | 'hourCycle' | 'isDateUnavailable' | 'locale' | 'maxValue' | 'minValue' | 'name' | 'onChange' | 'placeholderValue' | 'shouldForceLeadingZeros' | 'validate' | 'value'> & Pick<TimeFieldStateOptions<T>, 'defaultValue' | 'granularity' | 'hideTimeZone' | 'hourCycle' | 'maxValue' | 'minValue' | 'onChange' | 'placeholderValue' | 'shouldForceLeadingZeros' | 'validate' | 'value'> & {
|
|
5
|
+
/**
|
|
6
|
+
* The BCP 47 locale the time is written and typed in: whether it has a
|
|
7
|
+
* day period and what that is called, its placeholders and its digits.
|
|
8
|
+
* Defaults to the `I18nProvider`'s, or the device's outside one.
|
|
9
|
+
*/
|
|
10
|
+
readonly locale?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The name the value is submitted under by the `Form` around the field,
|
|
13
|
+
* and the key its `validationErrors` reach the field by. The form submits
|
|
14
|
+
* the time written out as ISO 8601, such as `09:30:00`, and `''` for an
|
|
15
|
+
* empty field.
|
|
16
|
+
*/
|
|
17
|
+
readonly name?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A time typed rather than picked: one segment per part, typed into a digit
|
|
21
|
+
* at a time. The value is an `@internationalized/date` `Time`, as on web:
|
|
22
|
+
* pass `value` with `onChange` to control it, or `defaultValue` to let it
|
|
23
|
+
* keep its own.
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* import { Time } from '@internationalized/date'
|
|
27
|
+
*
|
|
28
|
+
* <TimeField defaultValue={new Time(9, 30)} label="Label" />
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Whether it shows a twelve or twenty-four hour clock is the locale's,
|
|
32
|
+
* through the `I18nProvider`. `granularity` takes it down to seconds or up
|
|
33
|
+
* to hours, and `minValue` and `maxValue` bound what may be typed, an error
|
|
34
|
+
* under the field saying so in React Aria's words where a time is outside
|
|
35
|
+
* them.
|
|
36
|
+
*
|
|
37
|
+
* The segments, the box, the label and the message are DateField's.
|
|
38
|
+
* `style`, `ref` and `testID` land on the field as a whole.
|
|
39
|
+
*/
|
|
40
|
+
declare function TimeField<T extends TimeValue = TimeValue>({ isDisabled, isReadOnly, isRequired, locale, ...props }: TimeFieldProps<T>): import("react").JSX.Element;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { TimeField, type TimeFieldProps };
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { useLocaleOf } from "../../i18n/provider.js";
|
|
2
|
+
import { SegmentedField } from "../../segments/field.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useTimeFieldState } from "react-stately/useTimeFieldState";
|
|
6
|
+
//#region src/components/time-field/index.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A time typed rather than picked: one segment per part, typed into a digit
|
|
9
|
+
* at a time. The value is an `@internationalized/date` `Time`, as on web:
|
|
10
|
+
* pass `value` with `onChange` to control it, or `defaultValue` to let it
|
|
11
|
+
* keep its own.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { Time } from '@internationalized/date'
|
|
15
|
+
*
|
|
16
|
+
* <TimeField defaultValue={new Time(9, 30)} label="Label" />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Whether it shows a twelve or twenty-four hour clock is the locale's,
|
|
20
|
+
* through the `I18nProvider`. `granularity` takes it down to seconds or up
|
|
21
|
+
* to hours, and `minValue` and `maxValue` bound what may be typed, an error
|
|
22
|
+
* under the field saying so in React Aria's words where a time is outside
|
|
23
|
+
* them.
|
|
24
|
+
*
|
|
25
|
+
* The segments, the box, the label and the message are DateField's.
|
|
26
|
+
* `style`, `ref` and `testID` land on the field as a whole.
|
|
27
|
+
*/
|
|
28
|
+
function TimeField(t0) {
|
|
29
|
+
const $ = c(24);
|
|
30
|
+
let locale;
|
|
31
|
+
let props;
|
|
32
|
+
let t1;
|
|
33
|
+
let t2;
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[0] !== t0) {
|
|
36
|
+
({isDisabled: t1, isReadOnly: t2, isRequired: t3, locale, ...props} = t0);
|
|
37
|
+
$[0] = t0;
|
|
38
|
+
$[1] = locale;
|
|
39
|
+
$[2] = props;
|
|
40
|
+
$[3] = t1;
|
|
41
|
+
$[4] = t2;
|
|
42
|
+
$[5] = t3;
|
|
43
|
+
} else {
|
|
44
|
+
locale = $[1];
|
|
45
|
+
props = $[2];
|
|
46
|
+
t1 = $[3];
|
|
47
|
+
t2 = $[4];
|
|
48
|
+
t3 = $[5];
|
|
49
|
+
}
|
|
50
|
+
const isDisabled = t1 === void 0 ? false : t1;
|
|
51
|
+
const isReadOnly = t2 === void 0 ? false : t2;
|
|
52
|
+
const isRequired = t3 === void 0 ? false : t3;
|
|
53
|
+
const writtenIn = useLocaleOf(locale);
|
|
54
|
+
let t4;
|
|
55
|
+
if ($[6] !== isDisabled || $[7] !== isReadOnly || $[8] !== isRequired || $[9] !== props || $[10] !== writtenIn) {
|
|
56
|
+
t4 = {
|
|
57
|
+
...props,
|
|
58
|
+
isDisabled,
|
|
59
|
+
isReadOnly,
|
|
60
|
+
isRequired,
|
|
61
|
+
locale: writtenIn
|
|
62
|
+
};
|
|
63
|
+
$[6] = isDisabled;
|
|
64
|
+
$[7] = isReadOnly;
|
|
65
|
+
$[8] = isRequired;
|
|
66
|
+
$[9] = props;
|
|
67
|
+
$[10] = writtenIn;
|
|
68
|
+
$[11] = t4;
|
|
69
|
+
} else t4 = $[11];
|
|
70
|
+
const state = useTimeFieldState(t4);
|
|
71
|
+
const t5 = state.value === null;
|
|
72
|
+
let t6;
|
|
73
|
+
if ($[12] !== state.timeValue || $[13] !== state.value) {
|
|
74
|
+
t6 = state.value === null ? "" : state.timeValue.toString();
|
|
75
|
+
$[12] = state.timeValue;
|
|
76
|
+
$[13] = state.value;
|
|
77
|
+
$[14] = t6;
|
|
78
|
+
} else t6 = $[14];
|
|
79
|
+
let t7;
|
|
80
|
+
if ($[15] !== isDisabled || $[16] !== isReadOnly || $[17] !== isRequired || $[18] !== props || $[19] !== state || $[20] !== t5 || $[21] !== t6 || $[22] !== writtenIn) {
|
|
81
|
+
t7 = /* @__PURE__ */ jsx(SegmentedField, {
|
|
82
|
+
...props,
|
|
83
|
+
errors: state.realtimeValidation.validationErrors,
|
|
84
|
+
isDisabled,
|
|
85
|
+
isEmpty: t5,
|
|
86
|
+
isReadOnly,
|
|
87
|
+
isRequired,
|
|
88
|
+
locale: writtenIn,
|
|
89
|
+
state,
|
|
90
|
+
submitted: t6
|
|
91
|
+
});
|
|
92
|
+
$[15] = isDisabled;
|
|
93
|
+
$[16] = isReadOnly;
|
|
94
|
+
$[17] = isRequired;
|
|
95
|
+
$[18] = props;
|
|
96
|
+
$[19] = state;
|
|
97
|
+
$[20] = t5;
|
|
98
|
+
$[21] = t6;
|
|
99
|
+
$[22] = writtenIn;
|
|
100
|
+
$[23] = t7;
|
|
101
|
+
} else t7 = $[23];
|
|
102
|
+
return t7;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { TimeField };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["TimeFieldStateOptions","TimeValue","useTimeFieldState","DateFieldProps","useLocaleOf","SegmentedField","TimeFieldProps","Omit","Pick","T","locale","name","TimeField","t0","$","_c","props","t1","t2","t3","isDisabled","isReadOnly","isRequired","undefined","writtenIn","t4","state","t5","value","t6","timeValue","toString","t7","realtimeValidation","validationErrors","_c"],"sources":["../../../src/components/time-field/index.tsx"],"sourcesContent":["import type {\n TimeFieldStateOptions,\n TimeValue,\n} from 'react-stately/useTimeFieldState'\n\nimport { useTimeFieldState } from 'react-stately/useTimeFieldState'\n\nimport type { DateFieldProps } from '../date-field'\n\nimport { useLocaleOf } from '../../i18n/provider'\nimport { SegmentedField } from '../../segments/field'\n\n// kanso-ui's TimeField: a time typed a segment at a time. Every part of it is\n// DateField's, from src/segments, the segments, the muted placeholders, the\n// filled focus and the punctuation between them, and the box around them, so\n// a time on a form and a date on the same form cannot come apart.\n//\n// What differs is the value it holds and nothing else. The time pickers page\n// gives its input the text field's own box, which is what the shared field\n// chrome already draws, so there is no measurement here that DateField's\n// comment does not already name.\n//\n// **Twelve or twenty-four hours is the locale's.** React Stately decides from\n// the locale whether there is a day-period segment at all, so a field under\n// `en-GB` shows a 24-hour clock and the same field under `en-US` shows AM and\n// PM, in the locale's own words for the two. `hourCycle` is React Stately's\n// own, for a screen that has to set the clock whatever the locale.\n\ntype TimeFieldProps<T extends TimeValue = TimeValue> = Omit<\n DateFieldProps,\n | 'defaultValue'\n | 'granularity'\n | 'hideTimeZone'\n | 'hourCycle'\n | 'isDateUnavailable'\n | 'locale'\n | 'maxValue'\n | 'minValue'\n | 'name'\n | 'onChange'\n | 'placeholderValue'\n | 'shouldForceLeadingZeros'\n | 'validate'\n | 'value'\n> &\n Pick<\n TimeFieldStateOptions<T>,\n | 'defaultValue'\n | 'granularity'\n | 'hideTimeZone'\n | 'hourCycle'\n | 'maxValue'\n | 'minValue'\n | 'onChange'\n | 'placeholderValue'\n | 'shouldForceLeadingZeros'\n | 'validate'\n | 'value'\n > & {\n /**\n * The BCP 47 locale the time is written and typed in: whether it has a\n * day period and what that is called, its placeholders and its digits.\n * Defaults to the `I18nProvider`'s, or the device's outside one.\n */\n readonly locale?: string\n /**\n * The name the value is submitted under by the `Form` around the field,\n * and the key its `validationErrors` reach the field by. The form submits\n * the time written out as ISO 8601, such as `09:30:00`, and `''` for an\n * empty field.\n */\n readonly name?: string\n }\n\n/**\n * A time typed rather than picked: one segment per part, typed into a digit\n * at a time. The value is an `@internationalized/date` `Time`, as on web:\n * pass `value` with `onChange` to control it, or `defaultValue` to let it\n * keep its own.\n *\n * ```tsx\n * import { Time } from '@internationalized/date'\n *\n * <TimeField defaultValue={new Time(9, 30)} label=\"Label\" />\n * ```\n *\n * Whether it shows a twelve or twenty-four hour clock is the locale's,\n * through the `I18nProvider`. `granularity` takes it down to seconds or up\n * to hours, and `minValue` and `maxValue` bound what may be typed, an error\n * under the field saying so in React Aria's words where a time is outside\n * them.\n *\n * The segments, the box, the label and the message are DateField's.\n * `style`, `ref` and `testID` land on the field as a whole.\n */\nfunction TimeField<T extends TimeValue = TimeValue>({\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n locale,\n ...props\n}: TimeFieldProps<T>) {\n const writtenIn = useLocaleOf(locale)\n const state = useTimeFieldState<T>({\n ...props,\n isDisabled,\n isReadOnly,\n isRequired,\n locale: writtenIn,\n })\n\n return (\n <SegmentedField\n {...props}\n errors={state.realtimeValidation.validationErrors}\n isDisabled={isDisabled}\n isEmpty={state.value === null}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n locale={writtenIn}\n state={state}\n // The time alone, as web's field submits it, rather than the date and\n // time React Stately keeps it as underneath.\n submitted={state.value === null ? '' : state.timeValue.toString()}\n />\n )\n}\n\nexport type { TimeFieldProps }\n\nexport { TimeField }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,SAAAY,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAL;CAAA,IAAAM;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAoD,CAAA,CAAAO,YAAAH,IAAAI,YAAAH,IAAAI,YAAAH,IAAAT,QAAA,GAAAM,SAAAH;EAMhCC,EAAA,KAAAD;EAAAC,EAAA,KAAAJ;EAAAI,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAT,SAAAI,EAAA;EAAAE,QAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;CAAA;CALlB,MAAAM,aAAAH,OAAAM,KAAAA,IAAA,QAAAN;CACA,MAAAI,aAAAH,OAAAK,KAAAA,IAAA,QAAAL;CACA,MAAAI,aAAAH,OAAAI,KAAAA,IAAA,QAAAJ;CAIA,MAAAK,YAAkBpB,YAAYM,MAAM;CAAC,IAAAe;CAAA,IAAAX,EAAA,OAAAM,cAAAN,EAAA,OAAAO,cAAAP,EAAA,OAAAQ,cAAAR,EAAA,OAAAE,SAAAF,EAAA,QAAAU,WAAA;EACFC,KAAA;GAAA,GAC9BT;GAAKI;GAAAC;GAAAC;GAAAZ,QAIAc;EACV;EAACV,EAAA,KAAAM;EAAAN,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;EAAAR,EAAA,KAAAE;EAAAF,EAAA,MAAAU;EAAAV,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAND,MAAAY,QAAcxB,kBAAqBuB,EAMlC;CAOY,MAAAE,KAAAD,MAAKE,UAAW;CAAI,IAAAC;CAAA,IAAAf,EAAA,QAAAY,MAAAI,aAAAhB,EAAA,QAAAY,MAAAE,OAAA;EAOlBC,KAAAH,MAAKE,UAAW,OAAhB,KAA4BF,MAAKI,UAAUC,SAAU;EAACjB,EAAA,MAAAY,MAAAI;EAAAhB,EAAA,MAAAY,MAAAE;EAAAd,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,IAAAkB;CAAA,IAAAlB,EAAA,QAAAM,cAAAN,EAAA,QAAAO,cAAAP,EAAA,QAAAQ,cAAAR,EAAA,QAAAE,SAAAF,EAAA,QAAAY,SAAAZ,EAAA,QAAAa,MAAAb,EAAA,QAAAe,MAAAf,EAAA,QAAAU,WAAA;EAXnEQ,KAAA,oBAAC,gBAAD;GAAe,GACThB;GACI,QAAAU,MAAKO,mBAAmBC;GACpBd;GACH,SAAAO;GACGN;GACAC;GACJE,QAAAA;GACDE;GAGI,WAAAG;EAAsD,CAAA;EACjEf,EAAA,MAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAE;EAAAF,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAe;EAAAf,EAAA,MAAAU;EAAAV,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,OAZFkB;AAYE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { TimeFieldProps } from "../time-field/index.js";
|
|
2
|
+
import { TimeValue } from "react-stately/useTimeFieldState";
|
|
3
|
+
//#region src/components/time-picker/index.d.ts
|
|
4
|
+
/** Which of the time pickers page's two variants the modal shows. */
|
|
5
|
+
type TimePickerMode = 'dial' | 'input';
|
|
6
|
+
type TimePickerProps<T extends TimeValue = TimeValue> = Omit<TimeFieldProps<T>, 'trailingIcon'> & {
|
|
7
|
+
/**
|
|
8
|
+
* What the modal's dismissing action says. Left out, it is the word for it
|
|
9
|
+
* in the locale, "Cancel" in English.
|
|
10
|
+
*/
|
|
11
|
+
readonly cancelLabel?: string;
|
|
12
|
+
/**
|
|
13
|
+
* What the modal's confirming action says. Left out, it is the word for it
|
|
14
|
+
* in the locale, "OK" in English.
|
|
15
|
+
*/
|
|
16
|
+
readonly confirmLabel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Which variant the modal opens on: the dial, or the boxes as text fields
|
|
19
|
+
* to type into. The button at the modal's start switches between them.
|
|
20
|
+
* @default 'dial'
|
|
21
|
+
*/
|
|
22
|
+
readonly defaultMode?: TimePickerMode;
|
|
23
|
+
/** Whether the modal starts open, when it keeps its own state. */
|
|
24
|
+
readonly defaultOpen?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The input variant's headline, which also names the button that switches
|
|
27
|
+
* the dial to it. Left out, it is the locale's, "Enter time" in English.
|
|
28
|
+
*/
|
|
29
|
+
readonly enterTimeLabel?: string;
|
|
30
|
+
/** Whether the modal is open, when the call site holds the state. */
|
|
31
|
+
readonly isOpen?: boolean;
|
|
32
|
+
/** Called with the modal's new state as it opens or closes. */
|
|
33
|
+
readonly onOpenChange?: (isOpen: boolean) => void;
|
|
34
|
+
/**
|
|
35
|
+
* The dial's headline, which also names the clock button that opens the
|
|
36
|
+
* modal, before the field's label, and the button that switches the input
|
|
37
|
+
* variant back. Left out, it is the locale's, "Select time" in English.
|
|
38
|
+
*/
|
|
39
|
+
readonly selectTimeLabel?: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A time typed into a field, or picked in a modal behind the clock button at
|
|
43
|
+
* the field's end: on a dial, or typed into the modal's larger boxes. The
|
|
44
|
+
* value is an `@internationalized/date` value, as on web: pass `value` with
|
|
45
|
+
* `onChange` to control it, or `defaultValue` to let it keep its own.
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* import { Time } from '@internationalized/date'
|
|
49
|
+
*
|
|
50
|
+
* <TimePicker defaultValue={new Time(9, 30)} label="Label" />
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* The field is TimeField's, so `granularity`, `hourCycle`, `minValue` and
|
|
54
|
+
* `maxValue` behave as they do there. The modal sets hours and minutes and
|
|
55
|
+
* keeps the seconds a value already has; a time it writes back is checked
|
|
56
|
+
* against the bounds as a typed one is. Whether it shows a twelve or
|
|
57
|
+
* twenty-four hour clock is the locale's, through the `I18nProvider`, unless
|
|
58
|
+
* `hourCycle` says otherwise.
|
|
59
|
+
*
|
|
60
|
+
* `style`, `ref` and `testID` land on the field as a whole.
|
|
61
|
+
*/
|
|
62
|
+
declare function TimePicker<T extends TimeValue = TimeValue>({ cancelLabel, confirmLabel, defaultMode, defaultOpen, enterTimeLabel, isDisabled, isOpen, isReadOnly, isRequired, locale, onOpenChange, selectTimeLabel, ...props }: TimePickerProps<T>): import("react").JSX.Element;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { TimePicker, type TimePickerMode, type TimePickerProps };
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|