@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","RefObject","HostInstance","StyleProp","TextInput","ViewStyle","AnimatedStyle","Key","ComboBoxState","ComboBoxValidationValue","MenuTriggerAction","ListProps","StatelyListProps","ChangeValueType","ValueType","useId","useImperativeHandle","useRef","useState","Platform","Pressable","StyleSheet","View","Animated","useComboBoxState","FieldVariant","ValidationResult","ResolvedTheme","containsIn","CollectionView","focusKeyOf","ResultsStatus","rowCountOf","describedBy","FieldBox","FieldChevron","FieldInput","FieldMessage","useFieldFocus","useFieldValidation","listFor","useLocaleOf","useMessages","Overlay","useAnchoredPlacement","DismissLayer","PANEL_ORIGINS","useBackToClose","useFocusOnPlaced","usePanelMotion","useReturnFocus","hitSlop","usePressFeedback","useTheme","composeStyles","themedStyles","ComboBoxListProps","anchor","control","isOpen","label","openedBy","setPresent","present","state","ComboBoxSelectionMode","ComboBoxProps","allowsCustomValue","allowsEmptyCollection","defaultFilter","textValue","inputValue","defaultInputValue","defaultItems","Iterable","T","defaultValue","M","description","disabledKeys","error","floatingLabel","formValue","inputRef","isDisabled","isReadOnly","isRequired","items","leadingIcon","menuTrigger","name","onChange","value","onInputChange","onOpenChange","options","item","ref","selectionMode","style","testID","validate","variant","ToggleProps","onPress","TOGGLE_SIZE","TOGGLE_SLOP","SHRINKS","flexGrow","stylesOf","colors","radii","shadows","create","list","backgroundColor","surfaceContainerLow","borderRadius","xs","boxShadow","elevation2","overflow","toggle","alignItems","circle","height","justifyContent","width","ComboBox","t0","$","_c","t1","t2","t3","t4","t5","t6","t7","undefined","id","box","setOpenedBy","messages","locale","children","changed","validation","onEdit","onBlur","trigger","current","focus","shouldCloseOnBlur","OS","chosen","several","t10","t11","t12","t13","t14","t15","t16","t8","t9","selectionManager","keysOf","submitsText","length","map","String","t17","validationValueOf","t18","isEmpty","submitted","t19","setFocused","onFocus","shownError","t20","t21","Symbol","for","T0","T1","t22","focused","t23","t24","t25","t26","showSuggestions","t27","t28","toggleFor","T2","t29","handlers","t30","selectedItems","_temp","t31","t32","t33","editOf","t34","t35","t36","t37","t38","t39","t40","ComboBoxList","styles","align","placement","motion","placed","panel","setPanel","option","setOption","sendsReader","close","anchorFrame","dismissOf","onLayout","anchorWidth","transformOrigin","side","suggestions","ComboBoxPopup","copyOf","blur","text","setInputValue","Toggle","theme","feedback","color","onSurfaceVariant","corners","disabled","disableRipple","ring","props","Omit","selectedKey","_c"],"sources":["../../../src/components/combo-box/index.tsx"],"sourcesContent":["import type {\n ComponentRef,\n ReactElement,\n ReactNode,\n Ref,\n RefObject,\n} from 'react'\nimport type {\n HostInstance,\n StyleProp,\n TextInput,\n ViewStyle,\n} from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { Key } from 'react-stately'\nimport type {\n ComboBoxState,\n ComboBoxValidationValue,\n MenuTriggerAction,\n} from 'react-stately/useComboBoxState'\nimport type { ListProps as StatelyListProps } from 'react-stately/useListState'\nimport type { ChangeValueType, ValueType } from 'react-stately/useSelectState'\n\nimport { useId, useImperativeHandle, useRef, useState } from 'react'\nimport { Platform, Pressable, StyleSheet, View } from 'react-native'\nimport Animated from 'react-native-reanimated'\nimport { useComboBoxState } from 'react-stately/useComboBoxState'\n\nimport type { FieldVariant } from '../../field'\nimport type { ValidationResult } from '../../form'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { containsIn } from '../../autocomplete'\nimport {\n CollectionView,\n focusKeyOf,\n ResultsStatus,\n rowCountOf,\n} from '../../collection'\nimport {\n describedBy,\n FieldBox,\n FieldChevron,\n FieldInput,\n FieldMessage,\n useFieldFocus,\n} from '../../field'\nimport { useFieldValidation } from '../../form'\nimport { listFor } from '../../i18n'\nimport { useLocaleOf, useMessages } from '../../i18n/provider'\nimport { Overlay, useAnchoredPlacement } from '../../overlay'\nimport {\n DismissLayer,\n PANEL_ORIGINS,\n useBackToClose,\n useFocusOnPlaced,\n usePanelMotion,\n useReturnFocus,\n} from '../../overlay/panel'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// kanso-ui's ComboBox, the text fields page's autocomplete field: a text\n// field whose typing narrows a list of options under it. Everything above\n// the list is the field chrome in src/field, the box, the label, the input,\n// the supporting line and the error every field here draws, and the list is\n// ListBox's, through src/collection, on the surface every anchored panel\n// here draws, placed by src/overlay exactly as Select's is. What is here is\n// React Stately's combo box state around the two, and the things that are\n// this component's own.\n//\n// It is Select's shape with differences that are web's too. The control is\n// a real input, so typing reaches it and a press on the box focuses it, and\n// only the chevron at the end opens the list on its own: an autocomplete\n// field is a text field with a button on it.\n//\n// **Filtering is on by default,** as on web: `defaultFilter` falls back to a\n// match anywhere in an option's text, compared by an `Intl.Collator` in the\n// `I18nProvider`'s locale, or the device's outside one, at base sensitivity,\n// so case and accents are ignored, which is Autocomplete's filter and what\n// web's `useFilter` makes. Options passed through `items` are the call\n// site's to filter, as on web.\n//\n// **A value that is not in the list is allowed or refused, not corrected.**\n// With `allowsCustomValue` off, the text goes back to the chosen option's as\n// the field loses focus or the list is dismissed.\n//\n// **The keyboard stays up.** Typing opens the list as `menuTrigger` says,\n// and an option is reached on the first tap rather than the one that would\n// otherwise only close the keyboard. A press outside the list closes it and\n// takes the focus out of the field, as a click outside does on web, but a\n// press on the box itself leaves the list open, as a click in the input does\n// there, so a tap that places the caret does not throw away what was typed.\n// Android's back gesture and VoiceOver's escape gesture close it too.\n//\n// **The count is announced,** as React Aria's ComboBox announces it on web:\n// how many options are listed, as the list opens and each time a search\n// changes the number, through a polite live region on Android and under\n// React Native Web and `AccessibilityInfo` on iOS. A screen reader stays in\n// the input while the list opens from typing, so typing goes on, and is\n// sent to the chosen option, or the first, where the chevron opens it, and\n// back to the input as it closes.\n//\n// Choosing more than one is `selectionMode=\"multiple\"`, which draws the\n// chosen options before the input on its line, written as one list in the\n// locale's words, the label floated over them, and keeps the list open as\n// they are chosen.\n//\n// What web's has that this does not, each because React Native has no\n// counterpart: web's arrow keys move through the list while the keyboard\n// stays in the input, through React Aria's virtual focus, which a touch\n// screen has no keys for, as Autocomplete drops it; and web's input tells a\n// screen reader it is a combo box with a listbox, roles React Native does\n// not have, so the chevron is the button that says whether the list is\n// expanded.\n\ntype ComboBoxListProps = {\n readonly anchor: RefObject<HostInstance | null>\n readonly control: RefObject<ComponentRef<typeof TextInput> | null>\n readonly isOpen: boolean\n readonly label: string\n readonly openedBy: MenuTriggerAction | undefined\n readonly setPresent: (present: boolean) => void\n readonly state: ComboBoxState<object, ComboBoxSelectionMode>\n}\n\ntype ComboBoxProps<\n T extends object = object,\n M extends ComboBoxSelectionMode = 'single',\n> = {\n /**\n * Lets the field keep text that matches no option. With it on, the text is\n * what the field holds and submits; with it off, the text goes back to the\n * chosen option's as the field loses focus.\n * @default false\n */\n readonly allowsCustomValue?: boolean\n /**\n * Lets the list open with no options in it, showing its empty state. Left\n * off, the list closes when a search leaves nothing.\n * @default false\n */\n readonly allowsEmptyCollection?: boolean\n /**\n * Which options a search keeps, handed an option's text and what has been\n * typed. Left out, an option is kept when its text contains what has been\n * typed anywhere in it, ignoring case and accents.\n */\n readonly defaultFilter?: (textValue: string, inputValue: string) => boolean\n /** The text the field opens with, when it keeps its own. */\n readonly defaultInputValue?: string\n /** The items the options are built from, when the field keeps its own. */\n readonly defaultItems?: Iterable<T>\n /**\n * What is chosen at first, when the field keeps its own value: an\n * option's `id`, or a list of them with `selectionMode=\"multiple\"`.\n */\n readonly defaultValue?: ValueType<M>\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n readonly description?: string\n /** The `id`s of the options drawn disabled, which take no presses. */\n readonly disabledKeys?: Iterable<Key>\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state: the message, the error colours, and the\n * error a screen reader reads with the field all follow from it. The line\n * under the field arrives with the message, so the field grows when this\n * does, unless it is inside a `Form`, which keeps the line drawn. It wins\n * over what `validate` and the form say, and holds a `native` form back.\n */\n readonly error?: string\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds a value. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n readonly floatingLabel?: boolean\n /**\n * Whether the `Form` around the field submits the chosen option's `id` or\n * the text in the field. A field allowing a custom value, which may hold\n * text that is no option's, always submits the text, and one choosing\n * several always submits the list of their `id`s.\n * @default 'key'\n */\n readonly formValue?: 'key' | 'text'\n /**\n * A ref to the field's own `TextInput`, which is what a call site moves\n * focus to, after a server's error, say. `ref` is the field as a whole.\n */\n readonly inputRef?: Ref<ComponentRef<typeof TextInput>>\n /** The text in the field, when the call site holds it. */\n readonly inputValue?: string\n /**\n * Draws the field disabled: it takes no focus and no input, and its list\n * never opens.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Shows the value and takes focus, but takes no input, and its list never\n * opens.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Marks the label with an asterisk, as the text fields page marks a field\n * that must be filled. Inside a `native` form, a field with nothing chosen\n * holds the form back, or with nothing typed where it submits its text.\n * @default false\n */\n readonly isRequired?: boolean\n /** The items the options are built from, when the call site holds them. */\n readonly items?: Iterable<T>\n /**\n * What the field is for, and the name a screen reader reads for it.\n * Required, since a combo box with no label is a box nobody can name.\n */\n readonly label: string\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. The slot hands it that\n * colour and size through `useIconStyle()`.\n */\n readonly leadingIcon?: ReactNode\n /**\n * What opens the list besides the chevron: typing into the field, the\n * field taking focus, or nothing else.\n * @default 'input'\n */\n readonly menuTrigger?: MenuTriggerAction\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. What is\n * submitted is set out under `formValue`.\n */\n readonly name?: string\n /**\n * Called with what is chosen whenever it changes: an option's `id`, or\n * the list of them with `selectionMode=\"multiple\"`.\n */\n readonly onChange?: (value: ChangeValueType<M>) => void\n /** Called with the text in the field whenever an edit changes it. */\n readonly onInputChange?: (value: string) => void\n /**\n * Called with whether the list is open whenever that changes, and, as it\n * opens, with what opened it.\n */\n readonly onOpenChange?: (\n isOpen: boolean,\n menuTrigger?: MenuTriggerAction,\n ) => void\n /**\n * The options, a `ListBox.Item` for each and `ListBox.Section` to group\n * them. The list is a ListBox's, and draws every slot one does. Give\n * every option an `id`, which is what the value holds. With `items` or\n * `defaultItems`, a function from an item to its option.\n */\n readonly options?: ((item: T) => ReactElement) | ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * Whether one option is chosen, or several.\n * @default 'single'\n */\n readonly selectionMode?: M\n /** Positions and sizes the field as a whole. */\n readonly style?: StyleProp<ViewStyle>\n /** The test id of the field's `TextInput`, which is the control. */\n readonly testID?: string\n /**\n * Checks the value, handed the text in the field and what is chosen, and\n * returns its problem in words, or several, where there is one, and\n * `true`, `null` or `undefined` where there is none. Under the default\n * `aria` validation the error shows as the value changes; inside a\n * `native` form it shows once a submission is tried, or once the field\n * loses focus after an edit, and holds the form back.\n */\n readonly validate?: (value: ComboBoxValidationValue<M>) => ValidationResult\n /** What is chosen, when the call site holds it. */\n readonly value?: ValueType<M>\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n readonly variant?: FieldVariant\n}\n\n// React Stately's combo box takes its own two-value selection mode rather\n// than the collection-wide one, which also has `none`, as web's does.\ntype ComboBoxSelectionMode = 'multiple' | 'single'\n\ntype ToggleProps = {\n readonly isDisabled: boolean\n readonly isOpen: boolean\n readonly label: string\n readonly onPress: () => void\n}\n\n// The chevron is the page's 24dp trailing icon, which takes a press, and\n// reaches to the 48dp target every control here has.\nconst TOGGLE_SIZE = 24\nconst TOGGLE_SLOP = hitSlop(TOGGLE_SIZE, TOGGLE_SIZE)\n\n// The list never grows past its room, and the rows scroll inside it.\nconst SHRINKS: ViewStyle = { flexGrow: 0 }\n\nconst stylesOf = themedStyles(({ colors, radii, shadows }: ResolvedTheme) =>\n StyleSheet.create({\n // The menus page's list surface: surface container low, the\n // extra-small corner and the second elevation, clipping its rows to\n // the corner, as Select's list draws it.\n list: {\n backgroundColor: colors.surfaceContainerLow,\n borderRadius: radii.xs,\n boxShadow: shadows.elevation2,\n overflow: 'hidden',\n },\n // The chevron as a button: the glyph alone, as web draws it, since the\n // box around it already carries the fill, the indicator and the focus.\n // Round, for the ring a keyboard's focus draws around it.\n toggle: {\n alignItems: 'center',\n borderRadius: radii.circle,\n height: TOGGLE_SIZE,\n justifyContent: 'center',\n width: TOGGLE_SIZE,\n },\n }),\n)\n\n/**\n * A labelled text field that filters a list of options as it is typed. Its\n * value is React Stately's: pass `value` with `onChange` to hold which\n * option is chosen, `inputValue` with `onInputChange` to hold the text, or\n * the `default` forms of either to let it keep its own. The value is an\n * option's `id`, so give every option one; with `selectionMode=\"multiple\"`\n * it is a list of them.\n *\n * ```tsx\n * <ComboBox\n * label=\"Label\"\n * options={[\n * <ListBox.Item id=\"first\" key=\"first\">First item</ListBox.Item>,\n * <ListBox.Item id=\"second\" key=\"second\">Second item</ListBox.Item>,\n * ]}\n * />\n * ```\n *\n * The box, the label, the input, the supporting line and the error are the\n * field chrome every field here draws; the list is a ListBox's, on the\n * surface every anchored panel here draws. `style` and `ref` are the field\n * as a whole, and `inputRef` and `testID` its `TextInput`.\n */\nfunction ComboBox<\n T extends object = object,\n M extends ComboBoxSelectionMode = 'single',\n>({\n allowsCustomValue = false,\n allowsEmptyCollection,\n defaultFilter,\n defaultInputValue,\n defaultItems,\n defaultValue,\n description,\n disabledKeys,\n error,\n floatingLabel = true,\n formValue = 'key',\n inputRef,\n inputValue,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n items,\n label,\n leadingIcon,\n menuTrigger,\n name,\n onChange,\n onInputChange,\n onOpenChange,\n options,\n ref,\n selectionMode,\n style,\n testID,\n validate,\n value,\n variant = 'filled',\n}: ComboBoxProps<T, M>) {\n const id = useId()\n const box = useRef<HostInstance>(null)\n const control = useRef<ComponentRef<typeof TextInput>>(null)\n const [openedBy, setOpenedBy] = useState<MenuTriggerAction | undefined>()\n const messages = useMessages()\n const locale = useLocaleOf(undefined)\n const state = useComboBoxState<T, M>({\n allowsCustomValue,\n allowsEmptyCollection,\n // Each option builds its own entry in the collection, as a ListBox's\n // does. The collection skips what is not an element, as a ReactNode may\n // be, and asks any element for its entry.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- see above\n children: options as StatelyListProps<T>['children'],\n defaultFilter: defaultFilter ?? containsIn(locale),\n defaultInputValue,\n defaultItems,\n defaultValue,\n disabledKeys,\n inputValue,\n isDisabled,\n isReadOnly,\n items,\n menuTrigger,\n onChange: (changed) => {\n // A choice is made once, rather than typed, so it is committed as it\n // lands, as Select commits one.\n validation.onEdit()\n validation.onBlur()\n onChange?.(changed)\n },\n onInputChange,\n onOpenChange: (isOpen, trigger) => {\n if (isOpen) {\n setOpenedBy(trigger)\n }\n // The chevron moves the focus into the input as it opens the list, as\n // web's button does, so what is typed next narrows what it opened.\n if (isOpen && trigger === 'manual') {\n control.current?.focus()\n }\n onOpenChange?.(isOpen, trigger)\n },\n selectionMode,\n // React Native Web takes the focus out of the input as an option is\n // clicked, before the click lands, and closing on that blur would close\n // the list under the pointer. A press outside the list closes it there,\n // as it does everywhere. iOS and Android keep the focus in the input\n // through a tap on an option, so the list closes on blur there, as on\n // web.\n shouldCloseOnBlur: Platform.OS !== 'web',\n value,\n })\n const chosen = keysOf(state.value)\n const several = state.selectionManager.selectionMode === 'multiple'\n const submitsText = !several && (allowsCustomValue || formValue === 'text')\n const validation = useFieldValidation({\n control,\n error,\n isDisabled,\n isEmpty: submitsText ? state.inputValue === '' : chosen.length === 0,\n isReadOnly,\n isRequired,\n name,\n submitted: several\n ? chosen.map(String)\n : submitsText\n ? state.inputValue\n : String(chosen[0] ?? ''),\n validate,\n value: validationValueOf<M>(state),\n })\n const focus = useFieldFocus({\n onBlur: () => {\n state.setFocused(false)\n validation.onBlur()\n },\n onFocus: () => {\n state.setFocused(true)\n },\n })\n const shownError = validation.error\n\n useImperativeHandle<\n ComponentRef<typeof TextInput> | null,\n ComponentRef<typeof TextInput> | null\n >(inputRef, () => control.current, [])\n\n return (\n <View ref={ref} style={style}>\n <FieldBox\n control={control}\n floatingLabel={floatingLabel}\n isDisabled={isDisabled}\n // A list opened from the chevron takes the reader away from the\n // input, so the box is told it is focused while the list is open,\n // or its label would fall back over an empty input.\n isFocused={focus.focused || state.isOpen}\n isInvalid={shownError !== undefined}\n isPopulated={state.inputValue !== '' || (several && chosen.length > 0)}\n isRequired={isRequired}\n label={label}\n leading={leadingIcon}\n ref={box}\n trailing={toggleFor(state, {\n isDisabled: isDisabled || isReadOnly,\n label: `${messages.showSuggestions} ${label}`,\n onPress: () => {\n state.toggle(null, 'manual')\n },\n })}\n variant={variant}\n >\n <FieldInput\n {...focus.handlers}\n aria-label={label}\n chosen={\n several\n ? listFor(\n state.selectedItems.map((item) => item.textValue),\n locale,\n )\n : undefined\n }\n described={describedBy(id, { description, error: shownError })}\n editable={!isDisabled && !isReadOnly}\n onChangeText={editOf(state, validation.onEdit)}\n ref={control}\n testID={testID}\n value={state.inputValue}\n />\n </FieldBox>\n <FieldMessage description={description} error={shownError} id={id} />\n <ResultsStatus count={state.isOpen ? rowCountOf(state) : null} />\n <ComboBoxPopup\n anchor={box}\n control={control}\n label={label}\n openedBy={openedBy}\n state={state}\n />\n </View>\n )\n}\n\n/**\n * The list, drawn in the overlay host above the screen and placed under the\n * box: as wide as the box, flipped above it at the edge of the window, over\n * a layer that closes it on a press anywhere but the list and the box.\n */\nfunction ComboBoxList({\n anchor,\n control,\n isOpen,\n label,\n openedBy,\n setPresent,\n state,\n}: ComboBoxListProps) {\n const styles = stylesOf(useTheme())\n const messages = useMessages()\n const placement = useAnchoredPlacement({ align: 'start', anchor })\n const motion = usePanelMotion(isOpen, placement.placed, setPresent)\n const [panel, setPanel] = useState<HostInstance | null>(null)\n const [option, setOption] = useState<HostInstance | null>(null)\n // Only the chevron sends a screen reader into the list. Typing keeps it in\n // the input.\n const sendsReader = openedBy === 'manual'\n // oxlint-disable-next-line typescript/unbound-method -- React Stately's `close` is a callback, and reads no `this`\n const close = state.close\n\n useBackToClose(close, isOpen)\n // Only while open: a choice moves the focus key to the option just chosen\n // as the list leaves, and the reader belongs back at the input by then.\n useFocusOnPlaced(sendsReader && isOpen && placement.placed, option ?? panel)\n\n return (\n <>\n {isOpen ? (\n <DismissLayer\n hole={placement.anchorFrame}\n onPress={dismissOf(control, close)}\n />\n ) : null}\n <Animated.View\n onAccessibilityEscape={close}\n onLayout={placement.onLayout}\n ref={setPanel}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.list,\n { width: placement.anchorWidth },\n placement.style,\n { transformOrigin: PANEL_ORIGINS[placement.side] },\n motion,\n )}\n >\n <CollectionView\n aria-label={`${messages.suggestions} ${label}`}\n focusKey={sendsReader ? focusKeyOf(state) : null}\n keyboardShouldPersistTaps=\"handled\"\n kind=\"listbox\"\n onFocusTarget={setOption}\n revealFocus={placement.placed}\n state={state}\n style={SHRINKS}\n />\n </Animated.View>\n </>\n )\n}\n\n/**\n * The list while it is open and while its exit runs: mounted the moment the\n * field opens it, and kept until the list has faded out. A screen reader the\n * chevron sent into the list goes back to the input once it has gone.\n */\nfunction ComboBoxPopup({\n anchor,\n control,\n label,\n openedBy,\n state,\n}: Omit<ComboBoxListProps, 'isOpen' | 'setPresent'>) {\n const [present, setPresent] = useState(state.isOpen)\n\n if (state.isOpen && !present) {\n setPresent(true)\n }\n\n useReturnFocus(present, openedBy !== 'manual', control)\n\n if (!present) {\n return null\n }\n\n return (\n <Overlay>\n <ComboBoxList\n anchor={anchor}\n control={control}\n isOpen={state.isOpen}\n label={label}\n openedBy={openedBy}\n setPresent={setPresent}\n state={state}\n />\n </Overlay>\n )\n}\n\n// A combo box's value with any list of keys in it copied.\nfunction copyOf(value: Key | null | readonly Key[]): Key | Key[] | null {\n return typeof value === 'object' && value !== null ? [...value] : value\n}\n\n// A press outside the list closes it and takes the focus out of the input,\n// as a click outside does on web. iOS and Android leave a field focused\n// through a press outside a scroll view, which would keep the keyboard up\n// over a list that has gone.\nfunction dismissOf(\n control: RefObject<ComponentRef<typeof TextInput> | null>,\n close: () => void,\n) {\n return () => {\n control.current?.blur()\n close()\n }\n}\n\n// What an edit of the input does: the text goes to the state, which narrows\n// the list and opens it, and counts as an edit for the field's validation.\nfunction editOf(\n state: ComboBoxState<object, ComboBoxSelectionMode>,\n onEdit: () => void,\n) {\n return (text: string) => {\n state.setInputValue(text)\n onEdit()\n }\n}\n\n// The keys a combo box's value holds, one or several, as a list.\nfunction keysOf(value: Key | null | readonly Key[]): readonly Key[] {\n if (value === null) {\n return []\n }\n\n return typeof value === 'object' ? value : [value]\n}\n\n/**\n * The chevron as the button opening the list, named in React Aria's words\n * before the field's label, saying whether the list is open, and drawing the\n * ring a keyboard's focus draws. It takes its colour from the box's trailing\n * slot, so it follows the field into its error and disabled states.\n */\nfunction Toggle({ isDisabled, isOpen, label, onPress }: ToggleProps) {\n const theme = useTheme()\n const styles = stylesOf(theme)\n const feedback = usePressFeedback({\n color: theme.colors.onSurfaceVariant,\n corners: styles.toggle,\n disabled: isDisabled,\n disableRipple: true,\n })\n\n return (\n <Pressable\n {...feedback.handlers}\n aria-expanded={isOpen}\n aria-label={label}\n disabled={isDisabled}\n hitSlop={TOGGLE_SLOP}\n onPress={onPress}\n role=\"button\"\n style={composeStyles<ViewStyle>(styles.toggle, feedback.ring)}\n >\n <FieldChevron isOpen={isOpen} />\n </Pressable>\n )\n}\n\n/**\n * The chevron button for the box's trailing slot, which opens the list with\n * every option in it, whatever has been typed, as web's does, and closes it\n * again. A call rather than JSX written at the prop, which is what\n * react-perf's jsx-no-jsx-as-prop is after.\n */\nfunction toggleFor(\n state: ComboBoxState<object, ComboBoxSelectionMode>,\n props: Omit<ToggleProps, 'isOpen'>,\n) {\n return <Toggle {...props} isOpen={state.isOpen} />\n}\n\n/**\n * What `validate` is handed, as React Aria's ComboBox hands it on web: the\n * text in the field and what is chosen, with the first chosen option's `id`\n * under the older name.\n */\nfunction validationValueOf<M extends ComboBoxSelectionMode>(\n state: ComboBoxState<object, M>,\n): ComboBoxValidationValue<M> {\n return {\n inputValue: state.inputValue,\n // oxlint-disable-next-line typescript/no-deprecated -- React Aria still hands it to `validate`\n selectedKey: state.selectedKey,\n // A list of keys is copied, since `validate` is typed to take one it may\n // change, and the state's own is read-only.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the value's shape follows the mode, which TypeScript cannot follow through the copy\n value: copyOf(state.value) as ComboBoxValidationValue<M>['value'],\n }\n}\n\nexport { ComboBox }\nexport type { ComboBoxProps, ComboBoxSelectionMode }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgTA,MAAM4G,cAAc;AACpB,MAAMC,cAAcvD,QAAQsD,aAAaA,WAAW;AAGpD,MAAME,UAAqB,EAAEC,UAAU,EAAE;AAEzC,MAAMC,WAAWtD,cAAc,EAAEuD,QAAQC,OAAOC,cAC9C3F,WAAW4F,OAAO;CAIhBC,MAAM;EACJC,iBAAiBL,OAAOM;EACxBC,cAAcN,MAAMO;EACpBC,WAAWP,QAAQQ;EACnBC,UAAU;CACZ;CAIAC,QAAQ;EACNC,YAAY;EACZN,cAAcN,MAAMa;EACpBC,QAAQpB;EACRqB,gBAAgB;EAChBC,OAAOtB;CACT;AACF,CAAC,CACH;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAAuB,SAAAC,IAAA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SAAAzC,YAAArE,EAAA,OAAA9C,cAAA8C,EAAA,OAAAvE,UAAAuE,EAAA,OAAAtE,SAAAsE,EAAA,OAAA1B,WAAA0B,EAAA,OAAAG,MAAAH,EAAA,OAAAK,MAAAL,EAAA,QAAAM,IAAA;EAVlCC,KAAA,oBAAC,IAAD;GAAU,GACJL;GACWzE,iBAAAA;GACHC,cAAAA;GACFwB,UAAAA;GACDsB,SAAAA;GACAF;GACJ,MAAA8B;GACE,OAAAC;GAEPC,UAAAA;EAVQ,CAAA;EAWEN,EAAA,KAAAuD;EAAAvD,EAAA,KAAA8G,SAAAzC;EAAArE,EAAA,KAAA9C;EAAA8C,EAAA,KAAAvE;EAAAuE,EAAA,KAAAtE;EAAAsE,EAAA,KAAA1B;EAAA0B,EAAA,KAAAG;EAAAH,EAAA,KAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAXZO;AAWY;;;;;;;AAUhB,SAAS2D,UACPpI,OACAuL,OACA;CACA,OAAO,oBAAC,QAAD;EAAQ,GAAIA;EAAO,QAAQvL,MAAML;CAAO,CAAA;AACjD;;;;;;AAOA,SAASkH,kBACP7G,OAC4B;CAC5B,OAAO;EACLO,YAAYP,MAAMO;EAElBkL,aAAazL,MAAMyL;EAInB7J,OAAO8I,OAAO1K,MAAM4B,KAAK;CAC3B;AACF"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { FieldVariant } from "../../field/index.js";
|
|
2
|
+
import { StyleProp, View, ViewStyle } from "react-native";
|
|
3
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
4
|
+
import { DateFieldStateOptions, DateValue } from "react-stately/useDateFieldState";
|
|
5
|
+
//#region src/components/date-field/index.d.ts
|
|
6
|
+
type DateFieldProps<T extends DateValue = DateValue> = Pick<DateFieldStateOptions<T>, 'defaultValue' | 'granularity' | 'hideTimeZone' | 'hourCycle' | 'isDateUnavailable' | 'maxValue' | 'minValue' | 'onChange' | 'placeholderValue' | 'shouldForceLeadingZeros' | 'validate' | 'value'> & {
|
|
7
|
+
/**
|
|
8
|
+
* A hint shown under the field. Replaced by `error` when there is one, so
|
|
9
|
+
* the two never stack.
|
|
10
|
+
*/
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The problem with the current value, in words. Its presence is what puts
|
|
14
|
+
* the field in its error state: the message, the error colours, and the
|
|
15
|
+
* invalid state a screen reader reads all follow from it. The line under
|
|
16
|
+
* the field arrives with the message, so the field grows when this does,
|
|
17
|
+
* unless it is inside a `Form`, which keeps the line drawn. It wins over
|
|
18
|
+
* what `validate`, the bounds and the form say.
|
|
19
|
+
*/
|
|
20
|
+
readonly error?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the label floats into the box's top, as the text fields page
|
|
23
|
+
* draws a field holding a value. The segments always show, their
|
|
24
|
+
* placeholders while empty, so it floats from the start. `false` keeps it
|
|
25
|
+
* small at the top.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
readonly floatingLabel?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Draws the field disabled: it takes no focus and no input.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
readonly isDisabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Shows the value and takes focus, but takes no input.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
readonly isReadOnly?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Marks the label with an asterisk, as the text fields page marks a field
|
|
41
|
+
* that must be filled.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
readonly isRequired?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* What the field is for, and the name a screen reader reads for it, after
|
|
47
|
+
* each segment's own. Required, since a field with no label is a box
|
|
48
|
+
* nobody can name.
|
|
49
|
+
*/
|
|
50
|
+
readonly label: string;
|
|
51
|
+
/**
|
|
52
|
+
* An icon at the start of the box, before the label and the segments: the
|
|
53
|
+
* page's 24dp leading icon, in the muted role. The slot hands it that
|
|
54
|
+
* colour and size through `useIconStyle()`.
|
|
55
|
+
*/
|
|
56
|
+
readonly leadingIcon?: ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* The BCP 47 locale the date is written and typed in: the order of its
|
|
59
|
+
* segments, their placeholders, its digits and its calendar system.
|
|
60
|
+
* Defaults to the `I18nProvider`'s, or the device's outside one.
|
|
61
|
+
*/
|
|
62
|
+
readonly locale?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The name the value is submitted under by the `Form` around the field,
|
|
65
|
+
* and the key its `validationErrors` reach the field by. The form submits
|
|
66
|
+
* the date written out as ISO 8601, such as `2026-09-15`, and `''` for an
|
|
67
|
+
* empty field.
|
|
68
|
+
*/
|
|
69
|
+
readonly name?: string;
|
|
70
|
+
/** Called as focus leaves the field, once it has filled what it can. */
|
|
71
|
+
readonly onBlur?: () => void;
|
|
72
|
+
/** Called as focus arrives in the field, at whichever segment. */
|
|
73
|
+
readonly onFocus?: () => void;
|
|
74
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
75
|
+
/** Positions and sizes the field as a whole. */
|
|
76
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
77
|
+
readonly testID?: string;
|
|
78
|
+
/**
|
|
79
|
+
* An icon at the end of the box, after the segments: the page's 24dp
|
|
80
|
+
* trailing icon, in the muted role and the error role while the field has
|
|
81
|
+
* an error. The slot hands it that colour and size through
|
|
82
|
+
* `useIconStyle()`.
|
|
83
|
+
*/
|
|
84
|
+
readonly trailingIcon?: ReactNode;
|
|
85
|
+
/**
|
|
86
|
+
* The filled box, or the outlined one: no fill, an outline that thickens
|
|
87
|
+
* and takes the primary role while focused, and the label cutting it, the
|
|
88
|
+
* text fields page's two fields.
|
|
89
|
+
* @default 'filled'
|
|
90
|
+
*/
|
|
91
|
+
readonly variant?: FieldVariant;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* A date typed rather than picked: one segment per part, typed into a digit
|
|
95
|
+
* at a time. The value is an `@internationalized/date` value, as on web:
|
|
96
|
+
* pass `value` with `onChange` to control it, or `defaultValue` to let it
|
|
97
|
+
* keep its own.
|
|
98
|
+
*
|
|
99
|
+
* ```tsx
|
|
100
|
+
* import { CalendarDate } from '@internationalized/date'
|
|
101
|
+
*
|
|
102
|
+
* <DateField defaultValue={new CalendarDate(2026, 9, 15)} label="Label" />
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* How many segments there are and in what order is the locale's, through
|
|
106
|
+
* the `I18nProvider`: `granularity` adds the time's segments, and `minValue`,
|
|
107
|
+
* `maxValue` and `isDateUnavailable` say which dates are right, an error
|
|
108
|
+
* under the field saying so in React Aria's words where they are not. On iOS
|
|
109
|
+
* and Android a press on a segment raises the keyboard, and VoiceOver and
|
|
110
|
+
* TalkBack step each segment with a swipe; under React Native Web each
|
|
111
|
+
* segment is a spin button with React Aria's keys.
|
|
112
|
+
*
|
|
113
|
+
* The box, label and message are the field chrome in src/field, shared with
|
|
114
|
+
* every other field. `style`, `ref` and `testID` land on the field as a
|
|
115
|
+
* whole.
|
|
116
|
+
*/
|
|
117
|
+
declare function DateField<T extends DateValue = DateValue>({ isDisabled, isReadOnly, isRequired, locale, ...props }: DateFieldProps<T>): import("react").JSX.Element;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { DateField, type DateFieldProps };
|
|
120
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
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 { createCalendar } from "@internationalized/date";
|
|
6
|
+
import { useDateFieldState } from "react-stately/useDateFieldState";
|
|
7
|
+
//#region src/components/date-field/index.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A date typed rather than picked: one segment per part, typed into a digit
|
|
10
|
+
* at a time. The value is an `@internationalized/date` value, as on web:
|
|
11
|
+
* pass `value` with `onChange` to control it, or `defaultValue` to let it
|
|
12
|
+
* keep its own.
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { CalendarDate } from '@internationalized/date'
|
|
16
|
+
*
|
|
17
|
+
* <DateField defaultValue={new CalendarDate(2026, 9, 15)} label="Label" />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* How many segments there are and in what order is the locale's, through
|
|
21
|
+
* the `I18nProvider`: `granularity` adds the time's segments, and `minValue`,
|
|
22
|
+
* `maxValue` and `isDateUnavailable` say which dates are right, an error
|
|
23
|
+
* under the field saying so in React Aria's words where they are not. On iOS
|
|
24
|
+
* and Android a press on a segment raises the keyboard, and VoiceOver and
|
|
25
|
+
* TalkBack step each segment with a swipe; under React Native Web each
|
|
26
|
+
* segment is a spin button with React Aria's keys.
|
|
27
|
+
*
|
|
28
|
+
* The box, label and message are the field chrome in src/field, shared with
|
|
29
|
+
* every other field. `style`, `ref` and `testID` land on the field as a
|
|
30
|
+
* whole.
|
|
31
|
+
*/
|
|
32
|
+
function DateField(t0) {
|
|
33
|
+
const $ = c(23);
|
|
34
|
+
let locale;
|
|
35
|
+
let props;
|
|
36
|
+
let t1;
|
|
37
|
+
let t2;
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[0] !== t0) {
|
|
40
|
+
({isDisabled: t1, isReadOnly: t2, isRequired: t3, locale, ...props} = t0);
|
|
41
|
+
$[0] = t0;
|
|
42
|
+
$[1] = locale;
|
|
43
|
+
$[2] = props;
|
|
44
|
+
$[3] = t1;
|
|
45
|
+
$[4] = t2;
|
|
46
|
+
$[5] = t3;
|
|
47
|
+
} else {
|
|
48
|
+
locale = $[1];
|
|
49
|
+
props = $[2];
|
|
50
|
+
t1 = $[3];
|
|
51
|
+
t2 = $[4];
|
|
52
|
+
t3 = $[5];
|
|
53
|
+
}
|
|
54
|
+
const isDisabled = t1 === void 0 ? false : t1;
|
|
55
|
+
const isReadOnly = t2 === void 0 ? false : t2;
|
|
56
|
+
const isRequired = t3 === void 0 ? false : t3;
|
|
57
|
+
const writtenIn = useLocaleOf(locale);
|
|
58
|
+
let t4;
|
|
59
|
+
if ($[6] !== isDisabled || $[7] !== isReadOnly || $[8] !== isRequired || $[9] !== props || $[10] !== writtenIn) {
|
|
60
|
+
t4 = {
|
|
61
|
+
...props,
|
|
62
|
+
createCalendar,
|
|
63
|
+
isDisabled,
|
|
64
|
+
isReadOnly,
|
|
65
|
+
isRequired,
|
|
66
|
+
locale: writtenIn
|
|
67
|
+
};
|
|
68
|
+
$[6] = isDisabled;
|
|
69
|
+
$[7] = isReadOnly;
|
|
70
|
+
$[8] = isRequired;
|
|
71
|
+
$[9] = props;
|
|
72
|
+
$[10] = writtenIn;
|
|
73
|
+
$[11] = t4;
|
|
74
|
+
} else t4 = $[11];
|
|
75
|
+
const state = useDateFieldState(t4);
|
|
76
|
+
const t5 = state.value === null;
|
|
77
|
+
let t6;
|
|
78
|
+
if ($[12] !== state.value) {
|
|
79
|
+
t6 = state.value?.toString() ?? "";
|
|
80
|
+
$[12] = state.value;
|
|
81
|
+
$[13] = t6;
|
|
82
|
+
} else t6 = $[13];
|
|
83
|
+
let t7;
|
|
84
|
+
if ($[14] !== isDisabled || $[15] !== isReadOnly || $[16] !== isRequired || $[17] !== props || $[18] !== state || $[19] !== t5 || $[20] !== t6 || $[21] !== writtenIn) {
|
|
85
|
+
t7 = /* @__PURE__ */ jsx(SegmentedField, {
|
|
86
|
+
...props,
|
|
87
|
+
errors: state.realtimeValidation.validationErrors,
|
|
88
|
+
isDisabled,
|
|
89
|
+
isEmpty: t5,
|
|
90
|
+
isReadOnly,
|
|
91
|
+
isRequired,
|
|
92
|
+
locale: writtenIn,
|
|
93
|
+
state,
|
|
94
|
+
submitted: t6
|
|
95
|
+
});
|
|
96
|
+
$[14] = isDisabled;
|
|
97
|
+
$[15] = isReadOnly;
|
|
98
|
+
$[16] = isRequired;
|
|
99
|
+
$[17] = props;
|
|
100
|
+
$[18] = state;
|
|
101
|
+
$[19] = t5;
|
|
102
|
+
$[20] = t6;
|
|
103
|
+
$[21] = writtenIn;
|
|
104
|
+
$[22] = t7;
|
|
105
|
+
} else t7 = $[22];
|
|
106
|
+
return t7;
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { DateField };
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","View","ViewStyle","DateFieldStateOptions","DateValue","createCalendar","useDateFieldState","FieldVariant","useLocaleOf","SegmentedField","DateFieldProps","Pick","T","description","error","floatingLabel","isDisabled","isReadOnly","isRequired","label","leadingIcon","locale","name","onBlur","onFocus","ref","style","testID","trailingIcon","variant","DateField","t0","$","_c","props","t1","t2","t3","undefined","writtenIn","t4","state","t5","value","t6","toString","t7","realtimeValidation","validationErrors","_c"],"sources":["../../../src/components/date-field/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, View, ViewStyle } from 'react-native'\nimport type {\n DateFieldStateOptions,\n DateValue,\n} from 'react-stately/useDateFieldState'\n\nimport { createCalendar } from '@internationalized/date'\nimport { useDateFieldState } from 'react-stately/useDateFieldState'\n\nimport type { FieldVariant } from '../../field'\n\nimport { useLocaleOf } from '../../i18n/provider'\nimport { SegmentedField } from '../../segments/field'\n\n// kanso-ui's DateField: a date typed a segment at a time rather than picked\n// from a calendar, which is what the date pickers page means by a date in a\n// text field. The box, the label and the line under it are the field chrome\n// in src/field, shared with every other field, so a date field on a form is\n// the same box as the text field beside it. The segments and that chrome\n// around them are src/segments, which TimeField draws as well.\n//\n// The value is React Stately's `useDateFieldState`, which web's React Aria\n// field is built on, over `@internationalized/date`, so the segments, their\n// order, the bounds and the calendar a locale counts in are web's.\n//\n// Three things are this component's own, as on web.\n//\n// **How many segments there are, and in what order, is the locale's.** A\n// field under a British locale puts the day before the month, and a\n// `granularity` of `minute` adds two more, so the segments are drawn from\n// the state, never written out.\n//\n// **A segment not yet filled is muted, and the label floats from the start.**\n// Each segment shows its own placeholder, `mm`, `dd` and `yyyy` in English,\n// in the muted role, so a half-typed date reads as half-typed, and the label\n// sits above them even while the field is empty rather than over them.\n//\n// **A focused segment is a filled shape rather than a caret**, in primary,\n// since nothing else says which of the segments is being typed.\n//\n// **The locale is the `I18nProvider`'s**, as web reads it from React Aria's,\n// unless the `locale` prop names another, and the device's under neither.\n\ntype DateFieldProps<T extends DateValue = DateValue> = Pick<\n DateFieldStateOptions<T>,\n | 'defaultValue'\n | 'granularity'\n | 'hideTimeZone'\n | 'hourCycle'\n | 'isDateUnavailable'\n | 'maxValue'\n | 'minValue'\n | 'onChange'\n | 'placeholderValue'\n | 'shouldForceLeadingZeros'\n | 'validate'\n | 'value'\n> & {\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state: the message, the error colours, and the\n * invalid state a screen reader reads all follow from it. The line under\n * the field arrives with the message, so the field grows when this does,\n * unless it is inside a `Form`, which keeps the line drawn. It wins over\n * what `validate`, the bounds and the form say.\n */\n readonly error?: string\n /**\n * Whether the label floats into the box's top, as the text fields page\n * draws a field holding a value. The segments always show, their\n * placeholders while empty, so it floats from the start. `false` keeps it\n * small at the top.\n * @default true\n */\n readonly floatingLabel?: boolean\n /**\n * Draws the field disabled: it takes no focus and no input.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Shows the value and takes focus, but takes no input.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Marks the label with an asterisk, as the text fields page marks a field\n * that must be filled.\n * @default false\n */\n readonly isRequired?: boolean\n /**\n * What the field is for, and the name a screen reader reads for it, after\n * each segment's own. Required, since a field with no label is a box\n * nobody can name.\n */\n readonly label: string\n /**\n * An icon at the start of the box, before the label and the segments: the\n * page's 24dp leading icon, in the muted role. The slot hands it that\n * colour and size through `useIconStyle()`.\n */\n readonly leadingIcon?: ReactNode\n /**\n * The BCP 47 locale the date is written and typed in: the order of its\n * segments, their placeholders, its digits and its calendar system.\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 date written out as ISO 8601, such as `2026-09-15`, and `''` for an\n * empty field.\n */\n readonly name?: string\n /** Called as focus leaves the field, once it has filled what it can. */\n readonly onBlur?: () => void\n /** Called as focus arrives in the field, at whichever segment. */\n readonly onFocus?: () => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n /** Positions and sizes the field as a whole. */\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n /**\n * An icon at the end of the box, after the segments: the page's 24dp\n * trailing icon, in the muted role and the error role while the field has\n * an error. The slot hands it that colour and size through\n * `useIconStyle()`.\n */\n readonly trailingIcon?: ReactNode\n /**\n * The filled box, or the outlined one: no fill, an outline that thickens\n * and takes the primary role while focused, and the label cutting it, the\n * text fields page's two fields.\n * @default 'filled'\n */\n readonly variant?: FieldVariant\n}\n\n/**\n * A date typed rather than picked: one segment per part, typed into a digit\n * at a time. The value is an `@internationalized/date` value, 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 { CalendarDate } from '@internationalized/date'\n *\n * <DateField defaultValue={new CalendarDate(2026, 9, 15)} label=\"Label\" />\n * ```\n *\n * How many segments there are and in what order is the locale's, through\n * the `I18nProvider`: `granularity` adds the time's segments, and `minValue`,\n * `maxValue` and `isDateUnavailable` say which dates are right, an error\n * under the field saying so in React Aria's words where they are not. On iOS\n * and Android a press on a segment raises the keyboard, and VoiceOver and\n * TalkBack step each segment with a swipe; under React Native Web each\n * segment is a spin button with React Aria's keys.\n *\n * The box, label and message are the field chrome in src/field, shared with\n * every other field. `style`, `ref` and `testID` land on the field as a\n * whole.\n */\nfunction DateField<T extends DateValue = DateValue>({\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n locale,\n ...props\n}: DateFieldProps<T>) {\n const writtenIn = useLocaleOf(locale)\n const state = useDateFieldState<T>({\n ...props,\n createCalendar,\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 submitted={state.value?.toString() ?? ''}\n />\n )\n}\n\nexport type { DateFieldProps }\n\nexport { DateField }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0KA,SAAAiC,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAZ;CAAA,IAAAa;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAoD,CAAA,CAAAf,YAAAmB,IAAAlB,YAAAmB,IAAAlB,YAAAmB,IAAAhB,QAAA,GAAAa,SAAAH;EAMhCC,EAAA,KAAAD;EAAAC,EAAA,KAAAX;EAAAW,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAhB,SAAAW,EAAA;EAAAE,QAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;CAAA;CALlB,MAAAhB,aAAAmB,OAAAG,KAAAA,IAAA,QAAAH;CACA,MAAAlB,aAAAmB,OAAAE,KAAAA,IAAA,QAAAF;CACA,MAAAlB,aAAAmB,OAAAC,KAAAA,IAAA,QAAAD;CAIA,MAAAE,YAAkB/B,YAAYa,MAAM;CAAC,IAAAmB;CAAA,IAAAR,EAAA,OAAAhB,cAAAgB,EAA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from "react-native";
|
|
3
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
4
|
+
import { DateDuration } from "@internationalized/date";
|
|
5
|
+
import { DatePickerStateOptions, DateValue } from "react-stately/useDatePickerState";
|
|
6
|
+
//#region src/components/date-picker/index.d.ts
|
|
7
|
+
type DatePickerProps<T extends DateValue = DateValue> = Pick<DatePickerStateOptions<T>, 'defaultOpen' | 'defaultValue' | 'firstDayOfWeek' | 'granularity' | 'hideTimeZone' | 'hourCycle' | 'isDateUnavailable' | 'isOpen' | 'maxValue' | 'minValue' | 'onChange' | 'onOpenChange' | 'placeholderValue' | 'shouldCloseOnSelect' | 'shouldForceLeadingZeros' | 'validate' | 'value'> & {
|
|
8
|
+
/**
|
|
9
|
+
* A hint shown under the field. Replaced by `error` when there is one, so
|
|
10
|
+
* the two never stack.
|
|
11
|
+
*/
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The problem with the current value, in words. Its presence is what puts
|
|
15
|
+
* the field in its error state: the message, the error colours, and the
|
|
16
|
+
* invalid state a screen reader reads all follow from it. The line under
|
|
17
|
+
* the field arrives with the message, so the field grows when this does,
|
|
18
|
+
* unless it is inside a `Form`, which keeps the line drawn. It wins over
|
|
19
|
+
* what `validate`, the bounds and the form say.
|
|
20
|
+
*/
|
|
21
|
+
readonly error?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the label floats into the box's top, as the text fields page
|
|
24
|
+
* draws a field holding a value. The segments always show, their
|
|
25
|
+
* placeholders while empty, so it floats from the start. `false` keeps it
|
|
26
|
+
* small at the top.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
readonly floatingLabel?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Draws the picker disabled: the field takes no input and the calendar
|
|
32
|
+
* does not open.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
readonly isDisabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Shows the value and takes focus, but takes no input, and the calendar
|
|
38
|
+
* does not open.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
readonly isReadOnly?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Marks the label with an asterisk, as the text fields page marks a field
|
|
44
|
+
* that must be filled.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
readonly isRequired?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* What the field is for, and the name a screen reader reads for it, after
|
|
50
|
+
* each segment's own. It names the calendar too, and the button opening
|
|
51
|
+
* it after that button's own name.
|
|
52
|
+
*/
|
|
53
|
+
readonly label: string;
|
|
54
|
+
/**
|
|
55
|
+
* An icon at the start of the box, before the label and the segments: the
|
|
56
|
+
* page's 24dp leading icon, in the muted role. The slot hands it that
|
|
57
|
+
* colour and size through `useIconStyle()`.
|
|
58
|
+
*/
|
|
59
|
+
readonly leadingIcon?: ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* The BCP 47 locale the date is written and typed in, and the calendar
|
|
62
|
+
* drawn in: the order of the segments, their placeholders, the month and
|
|
63
|
+
* weekday names, the digits and the calendar system. Defaults to the
|
|
64
|
+
* `I18nProvider`'s, or the device's outside one.
|
|
65
|
+
*/
|
|
66
|
+
readonly locale?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The name the value is submitted under by the `Form` around the picker,
|
|
69
|
+
* and the key its `validationErrors` reach it by. The form submits the
|
|
70
|
+
* date written out as ISO 8601, such as `2026-09-15`, and `''` for an
|
|
71
|
+
* empty picker.
|
|
72
|
+
*/
|
|
73
|
+
readonly name?: string;
|
|
74
|
+
/** Called as focus leaves the field, once it has filled what it can. */
|
|
75
|
+
readonly onBlur?: () => void;
|
|
76
|
+
/** Called as focus arrives in the field, at whichever segment. */
|
|
77
|
+
readonly onFocus?: () => void;
|
|
78
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the calendar's header draws the month and the year as menu
|
|
81
|
+
* buttons, each opening a list of them in the grid's place, as the docked
|
|
82
|
+
* date picker's header does: see `Calendar`.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
readonly showMonthYearMenus?: boolean;
|
|
86
|
+
/** Positions and sizes the picker as a whole. */
|
|
87
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
88
|
+
readonly testID?: string;
|
|
89
|
+
/**
|
|
90
|
+
* What the button that opens the calendar is called, for a screen reader,
|
|
91
|
+
* before the field's label. Left out, it is "Calendar" in the locale's
|
|
92
|
+
* words, React Aria's.
|
|
93
|
+
*/
|
|
94
|
+
readonly triggerLabel?: string;
|
|
95
|
+
/**
|
|
96
|
+
* The filled box, or the outlined one, as the text fields page draws them.
|
|
97
|
+
* @default 'filled'
|
|
98
|
+
*/
|
|
99
|
+
readonly variant?: FieldVariant;
|
|
100
|
+
/**
|
|
101
|
+
* How much of the calendar shows at once: `{ months: 2 }` draws two
|
|
102
|
+
* months, side by side from the expanded window size up and one under the
|
|
103
|
+
* other below it: see `Calendar`.
|
|
104
|
+
* @default { months: 1 }
|
|
105
|
+
*/
|
|
106
|
+
readonly visibleDuration?: DateDuration;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* A date typed into a field, or picked from a calendar behind a button. The
|
|
110
|
+
* value is an `@internationalized/date` value, as on web: pass `value` with
|
|
111
|
+
* `onChange` to control it, or `defaultValue` to let it keep its own.
|
|
112
|
+
*
|
|
113
|
+
* ```tsx
|
|
114
|
+
* import { CalendarDate } from '@internationalized/date'
|
|
115
|
+
*
|
|
116
|
+
* <DatePicker defaultValue={new CalendarDate(2026, 9, 15)} label="Label" />
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* The segments are DateField's and the calendar is Calendar, so
|
|
120
|
+
* `granularity`, `minValue`, `maxValue` and `isDateUnavailable` behave as
|
|
121
|
+
* they do there. From the medium window size up the calendar is docked to
|
|
122
|
+
* the field; below it, it opens centred over a scrim, which is the page's
|
|
123
|
+
* modal picker.
|
|
124
|
+
*
|
|
125
|
+
* `style`, `ref` and `testID` land on the picker as a whole.
|
|
126
|
+
*/
|
|
127
|
+
declare function DatePicker<T extends DateValue = DateValue>({ defaultOpen, defaultValue, firstDayOfWeek, isDateUnavailable, isDisabled, isOpen, isReadOnly, isRequired, label, locale, maxValue, minValue, onChange, onOpenChange, placeholderValue, shouldCloseOnSelect, showMonthYearMenus, triggerLabel, validate, value, visibleDuration, ...props }: DatePickerProps<T>): import("react").JSX.Element;
|
|
128
|
+
//#endregion
|
|
129
|
+
export { DatePicker, type DatePickerProps };
|
|
130
|
+
//# sourceMappingURL=index.d.ts.map
|