@kanso-labs/react-native-kanso-ui 0.11.24 → 0.11.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/calendar/index.js +105 -41
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +7 -0
- package/dist/calendar/styles.js.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -2
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +24 -3
- package/dist/components/carousel/index.js +58 -35
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/color-picker/index.js +98 -93
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/dialog/index.js +7 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +2 -2
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/segmented-button/index.js +108 -88
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/sheet/index.js +8 -4
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/index.js.map +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js +112 -161
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +4 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/number/parser.js +3 -3
- package/dist/number/parser.js.map +1 -1
- package/dist/overlay/keyboard.js +100 -27
- package/dist/overlay/keyboard.js.map +1 -1
- package/dist/segments/index.js +1 -1
- package/dist/segments/index.js.map +1 -1
- package/package.json +15 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Calendar","ComponentRef","Dispatch","Ref","RefObject","SetStateAction","AccessibilityActionEvent","AccessibilityActionInfo","HostInstance","PressableProps","StyleProp","TextStyle","ViewStyle","DateFieldState","DateSegment","DateSegmentType","CalendarDate","DateFormatter","toCalendar","useEffect","useEffectEvent","useId","useImperativeHandle","useRef","useState","I18nManager","Text","NativeText","Platform","Pressable","StyleSheet","TextInput","FieldDescriptionPart","Focusable","LibraryMessages","startsWithIn","descriptionOf","FieldSegments","messagesFor","NumberParser","useTheme","composeStyles","useTypeRole","segmentStylesOf","DateSegmentsProps","described","drawing","SegmentDrawing","holding","isInvalid","label","locale","onActiveChange","type","onBeforeStart","onBlur","onEdit","onFocus","onPastEnd","ref","SegmentsHandle","state","Focusing","Pick","SegmentLineProps","Moves","away","next","previous","box","isActive","literal","parts","ReadonlySet","raisesKeyboard","text","Omit","active","entered","input","inside","nodes","Map","setActive","focusLast","focusOn","keyboard","Step","WebSegmentProps","ADJUSTABLE","name","INVISIBLE","SENTINEL","AFTER_SENTINEL","end","length","start","NUMERIC","Set","styles","create","height","opacity","position","top","width","notDrawn","display","actionOf","line","segment","event","actionName","nativeEvent","stepKey","arrivedIn","current","changedOf","segments","find","each","undefined","eraseKey","point","replace","codePointAt","typeKey","String","fromCodePoint","commonPrefixLength","texts","sorted","toSorted","first","at","last","DateSegments","t0","$","_c","props","t1","Symbol","for","t2","reportActive","t3","t4","t5","focus","typedInto","focusTo","findLast","segment_0","type_0","t6","dayPeriodsOf","formatter","hour","hour12","periodAt","hours","date","Date","setHours","formatToParts","part","value","drawn","replaceAll","has","edited","changed","eraseFrom","moves","isDisabled","isReadOnly","placeholder","parser","maximumFractionDigits","isValidPartialNumber","isPlaceholder","shortened","slice","parsed","parse","kept","clearSegment","setSegment","movesFrom","erasOf","calendar","era","timeZone","year","eras","getEras","map","set","day","month","toDate","formatted","prefix","OS","get","blur","hidesEra","identifier","inputFocusedOf","inputOf","node","leftOf","confirmPlaceholder","editable","filter","findIndex","to","index","beyond","nameOf","nodeOf","delete","pressOf","relatedTargetOf","relatedTarget","SegmentLine","id","theme","own","role","words","valueOf","valueId","canEdit","T0","isEditable","textDisabled","textMuted","focused","describes","webPropsOf","webStateOf","maxValue","minValue","valueTextOf","empty","segmentFocused","textStyleOf","stepBy","by","ReturnType","textFocused","typeInto","key","startsWith","typed","number","Number","isNaN","over","am","pm","matched","written","formatValue","maxGranularity","selectedTime","selectedDate","dateFormatter","resolvedOptions","format","dateValue","step","erase","keys","isRTL","values","some","onKeyDown","altKey","ctrlKey","metaKey","handler","preventDefault","isRequired","_c","NativeText"],"sources":["../../src/segments/index.tsx"],"sourcesContent":["import type { Calendar } from '@internationalized/date'\nimport type {\n ComponentRef,\n Dispatch,\n Ref,\n RefObject,\n SetStateAction,\n} from 'react'\nimport type {\n AccessibilityActionEvent,\n AccessibilityActionInfo,\n HostInstance,\n PressableProps,\n StyleProp,\n TextStyle,\n ViewStyle,\n} from 'react-native'\nimport type {\n DateFieldState,\n DateSegment,\n DateSegmentType,\n} from 'react-stately/useDateFieldState'\n\nimport {\n CalendarDate,\n DateFormatter,\n toCalendar,\n} from '@internationalized/date'\nimport {\n useEffect,\n useEffectEvent,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react'\nimport {\n I18nManager,\n Text as NativeText,\n Platform,\n Pressable,\n StyleSheet,\n TextInput,\n} from 'react-native'\n\nimport type { FieldDescriptionPart } from '../field'\nimport type { Focusable } from '../form'\nimport type { LibraryMessages } from '../i18n/messages'\n\nimport { startsWithIn } from '../autocomplete'\nimport { descriptionOf, FieldSegments } from '../field'\nimport { messagesFor } from '../i18n'\nimport { NumberParser } from '../number/parser'\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { useTypeRole } from '../typography/roles'\nimport { segmentStylesOf } from './styles'\n\n// The segments a date or a time is typed into, one part of the value each, as\n// web's src/segments draws them. React Stately's date field state decides\n// what the parts are, how many, in what order and what each may hold, from\n// the locale and the granularity, so a field built on it draws them from that\n// state rather than writing any of them out. What is here is how a person\n// types into them and how a screen reader reads them, which is React Aria's\n// useDateSegment ported, since React Aria does not run on native.\n//\n// **Typing is React Aria's, digit for digit.** A digit goes into the segment\n// after the ones typed before it, and moves on to the next segment once no\n// further digit could fit, so `9` in a month moves on and `1` waits for a\n// second. A letter picks a day period or an era by the start of its name in\n// the locale, backspace takes a digit off the end, and on an empty segment\n// moves back to the one before it.\n//\n// **On iOS and Android one hidden input takes the keys.** A view cannot raise\n// the keyboard, so a press on a segment makes it the one being typed and\n// focuses a text input no one sees or reads, which holds one space and hands\n// over each key typed after it. Its keyboard is a number pad for a segment of\n// digits and the full one for a day period or an era. A screen reader reaches\n// each segment as an adjustable element instead, which a swipe steps up or\n// down, and which opens the keyboard when activated.\n//\n// **Under React Native Web each segment is its own focus stop**, as web's\n// are, read as a spin button and typed into with the keys a browser hands\n// it: digits and letters, backspace, the arrow keys up and down to step, and\n// left and right to move between segments, which follow the direction the\n// page reads in.\n//\n// **A drawing of their own replaces a field's line**, for segments that are\n// not a field's: a box per part, the text inside it and the punctuation\n// between them, each the caller's, as a time picker's modal draws its hour\n// and minute. It names the parts it draws, and focus passes the others by,\n// so a day period a selector beside the boxes stands for is never typed into.\n// Punctuation is drawn only where it holds something to see, since a\n// locale's literals carry bidirectional marks and spaces beside it.\n\ntype DateSegmentsProps = {\n /** What describes the field after the value it holds: the line under it. */\n readonly described: readonly FieldDescriptionPart[]\n /** How the segments are drawn where they are not a field's line. */\n readonly drawing?: SegmentDrawing\n /**\n * What the segments are read as holding, after their own names: the date\n * or the time written out, unless a range picker around them reads its\n * whole range here instead. `''` reads nothing.\n */\n readonly holding?: string\n /** Whether the field shows an error, which every segment then says. */\n readonly isInvalid: boolean\n /** The field's label, which each segment's name ends in. */\n readonly label: string\n /** The locale the field writes in: its `useLocaleOf`. */\n readonly locale: string\n /**\n * Called with the segment in focus as it changes, and with `null` as focus\n * leaves them.\n */\n readonly onActiveChange?: (type: DateSegmentType | null) => void\n /**\n * Called where focus would move back from the first segment, as a\n * backspace on it does, which a range picker sends on to the start's last.\n */\n readonly onBeforeStart?: () => void\n /** Called as focus leaves the segments, once they fill in what they can. */\n readonly onBlur?: () => void\n /** Called after each edit a person makes, typed or stepped. */\n readonly onEdit?: () => void\n /** Called as focus arrives in the segments from outside them. */\n readonly onFocus?: () => void\n /**\n * Called where focus would move on from the last segment, as a full one\n * does, which a range picker sends on to the end's first.\n */\n readonly onPastEnd?: () => void\n /** What focuses the segments: the first, or the last. */\n readonly ref?: Ref<SegmentsHandle>\n readonly state: DateFieldState\n}\n\n// What moving focus to a segment reaches for.\ntype Focusing = Pick<\n SegmentLineProps,\n 'entered' | 'input' | 'nodes' | 'setActive' | 'state'\n>\n\ntype Moves = {\n // Where focus goes from a segment that stops being drawn, as React Aria's\n // goes from one it removes: the one before it, or the one after it where it\n // was the first.\n readonly away: () => void\n readonly next: () => void\n readonly previous: () => void\n}\n\n/**\n * How segments are drawn in place of a field's line of body large text, each\n * style chosen for whether its part is the one in focus.\n */\ntype SegmentDrawing = {\n /** The box a part a person types into is drawn in. */\n readonly box: (\n type: DateSegmentType,\n isActive: boolean,\n ) => StyleProp<ViewStyle>\n /** The punctuation between two parts. */\n readonly literal: StyleProp<TextStyle>\n /** The parts drawn. The rest are left out, and focus passes them by. */\n readonly parts: ReadonlySet<DateSegmentType>\n /**\n * Whether a press on a part raises the keyboard on iOS and Android, as a\n * field's does, rather than only making it the one in focus.\n */\n readonly raisesKeyboard: boolean\n /** The text inside a part's box. */\n readonly text: (\n type: DateSegmentType,\n isActive: boolean,\n ) => StyleProp<TextStyle>\n}\n\n// The segments' own props, with what the component around them keeps for\n// them: which one is being typed, what has been typed into it, whether focus\n// is among them, the hidden input and each segment's element.\ntype SegmentLineProps = Omit<DateSegmentsProps, 'ref'> & {\n readonly active: DateSegmentType | null\n readonly entered: RefObject<string>\n readonly input: RefObject<ComponentRef<typeof TextInput> | null>\n readonly inside: RefObject<boolean>\n readonly nodes: RefObject<Map<DateSegmentType, HostInstance>>\n readonly setActive: Dispatch<SetStateAction<DateSegmentType | null>>\n}\n\n/**\n * What focuses a field's segments: `focus` the first, unless focus is among\n * them already, `focusLast` the last, and `focusOn` the one of `type`, with\n * the keyboard raised on iOS and Android or put away.\n */\ntype SegmentsHandle = Focusable & {\n readonly focusLast: () => void\n readonly focusOn: (type: DateSegmentType, keyboard: boolean) => void\n}\n\n// A step a spin button takes, each one a method of the field's state.\ntype Step =\n | 'decrement'\n | 'decrementPage'\n | 'decrementToMin'\n | 'increment'\n | 'incrementPage'\n | 'incrementToMax'\n\n// What a segment is handed under React Native Web, which takes keys and focus\n// on any element.\ntype WebSegmentProps = Pick<PressableProps, 'onBlur' | 'onFocus' | 'onKeyDown'>\n\n// What a screen reader can ask of a segment: a step up, or a step down.\nconst ADJUSTABLE: readonly AccessibilityActionInfo[] = [\n { name: 'increment' },\n { name: 'decrement' },\n]\n\n// What a literal holds besides what it is drawn for: the spaces, and the\n// marks a locale sets a direction with.\nconst INVISIBLE = /[\\s\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069]/gu\n\n// The text the hidden input holds, which a backspace has something to take\n// from and which every key typed lands after.\nconst SENTINEL = ' '\n\n// Where the hidden input's caret stays: after the space.\nconst AFTER_SENTINEL = { end: SENTINEL.length, start: SENTINEL.length }\n\n// The segments a number is typed into, which the number pad serves.\nconst NUMERIC = new Set<DateSegmentType>([\n 'day',\n 'hour',\n 'minute',\n 'month',\n 'second',\n 'year',\n])\n\nconst styles = StyleSheet.create({\n // The input no one sees, which is there to raise the keyboard and take its\n // keys. Still laid out, since an input with no size takes no focus.\n input: {\n height: 1,\n opacity: 0,\n position: 'absolute',\n start: 0,\n top: 0,\n width: 1,\n },\n // The date written out, in the document under React Native Web for the\n // first segment to point at, and drawn nowhere.\n notDrawn: {\n display: 'none',\n },\n})\n\n// What a screen reader's swipe up or down does to a segment.\nfunction actionOf(line: SegmentLineProps, segment: DateSegment) {\n return (event: AccessibilityActionEvent) => {\n const { actionName } = event.nativeEvent\n if (actionName === 'increment' || actionName === 'decrement') {\n stepKey(line, segment, actionName)\n }\n }\n}\n\n// Where focus goes once a person is in the segments: what the field calls on\n// arriving, which it hears once however many segments focus passes through.\nfunction arrivedIn({ inside, onFocus }: SegmentLineProps) {\n if (!inside.current) {\n inside.current = true\n onFocus?.()\n }\n}\n\n// What the hidden input does with each change to its text: a shorter text is\n// a backspace, and a longer one a key typed after the space.\nfunction changedOf(line: SegmentLineProps) {\n return (text: string) => {\n const segment = line.state.segments.find(\n (each) => each.type === line.active,\n )\n\n if (segment === undefined) {\n return\n }\n\n if (text.length < SENTINEL.length) {\n eraseKey(line, segment)\n return\n }\n\n // One key at a time, the first typed after the space: a second handed\n // over in the same change would be written over by the first, since\n // both are set from the value this render holds.\n const point = text.replace(SENTINEL, '').codePointAt(0)\n\n if (point !== undefined) {\n typeKey(line, segment, String.fromCodePoint(point))\n }\n }\n}\n\n// The number of characters at the start of every one of `texts` that they\n// share, which an era's name is typed after, as React Aria finds it.\nfunction commonPrefixLength(texts: readonly string[]) {\n const sorted = texts.toSorted()\n const first = sorted.at(0) ?? ''\n const last = sorted.at(-1) ?? ''\n let length = 0\n\n while (length < first.length && first[length] === last[length]) {\n length++\n }\n\n return length\n}\n\n/**\n * A date or a time's segments, inside a field's box, from React Stately's\n * date field state: each part of the value typed or stepped on its own, the\n * one being typed drawn as a filled shape and the empty ones in their\n * placeholders, muted.\n */\nfunction DateSegments({ onActiveChange, ref, ...props }: DateSegmentsProps) {\n const [active, setActive] = useState<DateSegmentType | null>(null)\n // What has been typed into the segment in focus since it took focus, which\n // the next digit is read after.\n const entered = useRef('')\n // Whether focus is in the segments, which a press on the box around them\n // leaves where it is.\n const inside = useRef(false)\n const input = useRef<ComponentRef<typeof TextInput>>(null)\n // Each segment's element under React Native Web, which focus moves to.\n const nodes = useRef(new Map<DateSegmentType, HostInstance>())\n const { drawing, state } = props\n const reportActive = useEffectEvent((type: DateSegmentType | null) => {\n onActiveChange?.(type)\n })\n\n useEffect(() => {\n reportActive(active)\n }, [active])\n\n useImperativeHandle(ref, () => ({\n focus: () => {\n const first = state.segments.find((segment) =>\n typedInto(drawing, segment),\n )\n if (!inside.current && first !== undefined) {\n focusTo({ entered, input, nodes, setActive, state }, first.type)\n }\n },\n focusLast: () => {\n const last = state.segments.findLast((segment) =>\n typedInto(drawing, segment),\n )\n if (last !== undefined) {\n focusTo({ entered, input, nodes, setActive, state }, last.type)\n }\n },\n focusOn: (type, keyboard) => {\n focusTo({ entered, input, nodes, setActive, state }, type, keyboard)\n },\n }))\n\n return (\n <SegmentLine\n {...props}\n active={active}\n entered={entered}\n input={input}\n inside={inside}\n nodes={nodes}\n setActive={setActive}\n />\n )\n}\n\n// What the locale calls the morning and the afternoon, which a key picks\n// between by the start of each.\nfunction dayPeriodsOf(locale: string): readonly [string, string] {\n const formatter = new DateFormatter(locale, { hour: 'numeric', hour12: true })\n const periodAt = (hours: number) => {\n const date = new Date()\n date.setHours(hours)\n return (\n formatter.formatToParts(date).find((part) => part.type === 'dayPeriod')\n ?.value ?? ''\n )\n }\n\n return [periodAt(0), periodAt(12)]\n}\n\n// Whether a segment is drawn: every one on a field's line, and in a drawing\n// of its own the parts it names and the punctuation that holds something to\n// see.\nfunction drawn(drawing: SegmentDrawing | undefined, segment: DateSegment) {\n if (drawing === undefined) {\n return true\n }\n\n return segment.type === 'literal'\n ? segment.text.replaceAll(INVISIBLE, '') !== ''\n : drawing.parts.has(segment.type)\n}\n\nfunction edited({ onEdit }: SegmentLineProps, changed: boolean) {\n if (changed) {\n onEdit?.()\n }\n}\n\n// Takes a digit off the end of a segment, as backspace does in React Aria's,\n// and clears a day period or an era outright. On a segment already empty it\n// moves to the one before. Whether it changed the value.\nfunction eraseFrom(\n state: DateFieldState,\n segment: DateSegment,\n locale: string,\n entered: RefObject<string>,\n moves: Moves,\n): boolean {\n if (state.isDisabled || state.isReadOnly) {\n return false\n }\n\n if (segment.text === segment.placeholder) {\n moves.previous()\n }\n\n const parser = new NumberParser(locale, { maximumFractionDigits: 0 })\n\n if (parser.isValidPartialNumber(segment.text) && !segment.isPlaceholder) {\n const shortened = segment.text.slice(0, -1)\n const parsed = parser.parse(shortened)\n const kept = parsed === 0 ? '' : shortened\n\n if (kept === '') {\n state.clearSegment(segment.type)\n } else {\n state.setSegment(segment.type, parsed)\n }\n entered.current = kept\n return true\n }\n\n if (segment.type === 'dayPeriod' || segment.type === 'era') {\n state.clearSegment(segment.type)\n return true\n }\n\n return false\n}\n\nfunction eraseKey(line: SegmentLineProps, segment: DateSegment) {\n edited(\n line,\n eraseFrom(\n line.state,\n segment,\n line.locale,\n line.entered,\n movesFrom(line, segment.type),\n ),\n )\n}\n\n// The calendar's eras with the names a key picks them by: each era's name in\n// the locale, less what every name begins with, so a calendar whose eras are\n// ERA0 and ERA1 is typed with 0 and 1, as React Aria's is.\nfunction erasOf(calendar: Calendar, locale: string) {\n const formatter = new DateFormatter(locale, {\n era: 'narrow',\n timeZone: 'UTC',\n year: 'numeric',\n })\n const first = toCalendar(new CalendarDate(1, 1, 1), calendar)\n const eras = calendar.getEras().map((era) => {\n const date = first.set({ day: 1, era, month: 1, year: 1 }).toDate('UTC')\n\n return {\n era,\n // An era with no name in the locale is typed by its identifier.\n formatted:\n formatter.formatToParts(date).find((part) => part.type === 'era')\n ?.value ?? era,\n }\n })\n const prefix = commonPrefixLength(eras.map((era) => era.formatted))\n\n return eras.map(({ era, formatted }) => ({\n era,\n formatted: formatted.slice(prefix),\n }))\n}\n\n// Moves focus to the segment of `type`: the segment's own element under React\n// Native Web, and on iOS and Android the hidden input, with the segment made\n// the one it types into. A read-only field raises no keyboard, and nor does a\n// move that puts the keyboard away, which makes the segment the one in focus\n// and takes focus off the input.\nfunction focusTo(\n { entered, input, nodes, setActive, state }: Focusing,\n type: DateSegmentType,\n keyboard = true,\n) {\n entered.current = ''\n\n if (Platform.OS === 'web') {\n nodes.current.get(type)?.focus()\n return\n }\n\n if (!keyboard) {\n setActive(type)\n input.current?.blur()\n return\n }\n\n if (state.isReadOnly) {\n return\n }\n\n setActive(type)\n input.current?.focus()\n}\n\n// Whether setting the era to `era` stops the era segment being drawn, which\n// React Stately draws in a Gregorian calendar only while the date is BC.\nfunction hidesEra(state: DateFieldState, era: string) {\n return state.calendar.identifier === 'gregory' && era !== 'BC'\n}\n\n// What the hidden input does on taking focus: types into the segment it was\n// focused for, or the first where it was focused some other way.\nfunction inputFocusedOf(line: SegmentLineProps) {\n return () => {\n const first =\n line.state.segments.find((segment) => typedInto(line.drawing, segment))\n ?.type ?? null\n line.setActive((current) => current ?? first)\n arrivedIn(line)\n }\n}\n\n// Keeps the hidden input, which focus is moved to on iOS and Android.\nfunction inputOf({ input }: SegmentLineProps) {\n return (node: ComponentRef<typeof TextInput> | null) => {\n input.current = node\n }\n}\n\n// What focus leaving the segments does: fills in what the placeholder can,\n// as React Aria's field does on blur, then tells the field.\nfunction leftOf({\n entered,\n inside,\n onBlur,\n setActive,\n state,\n}: SegmentLineProps) {\n return () => {\n inside.current = false\n entered.current = ''\n setActive(null)\n state.confirmPlaceholder()\n onBlur?.()\n }\n}\n\n// The segments on either side of the one of `type`, among those a person\n// types into, which a full segment moves on to and a backspace back to. Past\n// either end it is the field's to say, as a range picker's focus moves on\n// from one date's segments to the other's.\nfunction movesFrom(line: SegmentLineProps, type: DateSegmentType): Moves {\n const editable = line.state.segments.filter((segment) =>\n typedInto(line.drawing, segment),\n )\n const at = editable.findIndex((segment) => segment.type === type)\n const to = (index: number, beyond?: () => void) => () => {\n const segment = index < 0 ? undefined : editable.at(index)\n if (segment === undefined) {\n beyond?.()\n } else {\n focusTo(line, segment.type)\n }\n }\n\n return {\n away: to(at > 0 ? at - 1 : at + 1),\n next: to(at + 1, line.onPastEnd),\n previous: to(at - 1, line.onBeforeStart),\n }\n}\n\n// The name a segment of `type` is read by. A literal is never read, and is\n// named as a day only to keep the lookup total.\nfunction nameOf(\n type: DateSegmentType,\n): keyof Omit<\n LibraryMessages['segments'],\n 'empty' | 'selectedDate' | 'selectedTime'\n> {\n return type === 'literal' ? 'day' : type\n}\n\n// Keeps each segment's element, which focus is moved to under React Native\n// Web, for as long as it is drawn.\nfunction nodeOf({ nodes }: SegmentLineProps, type: DateSegmentType) {\n return (node: HostInstance | null) => {\n if (node === null) {\n return undefined\n }\n\n nodes.current.set(type, node)\n return () => {\n nodes.current.delete(type)\n }\n }\n}\n\n// What a press on a segment does on iOS and Android: makes it the one typed\n// into, and raises the keyboard, unless the drawing says a press only makes\n// it the one in focus.\nfunction pressOf(line: SegmentLineProps, type: DateSegmentType) {\n return () => {\n focusTo(line, type, line.drawing?.raisesKeyboard ?? true)\n }\n}\n\n// The element focus moved to, off a browser's blur event.\nfunction relatedTargetOf(event: unknown): unknown {\n return typeof event === 'object' && event !== null && 'relatedTarget' in event\n ? event.relatedTarget\n : undefined\n}\n\n// The segments themselves, drawn from the field's state.\nfunction SegmentLine(line: SegmentLineProps) {\n const { active, described, drawing, isInvalid, label, locale, state } = line\n const id = useId()\n const theme = useTheme()\n const own = segmentStylesOf(theme)\n const role = useTypeRole('bodyLarge')\n const words = messagesFor(locale).segments\n const first = state.segments.find((segment) => typedInto(drawing, segment))\n const value = line.holding ?? valueOf(state, words)\n const valueId = `${id}-value`\n const parts =\n value === '' ? described : [{ id: valueId, text: value }, ...described]\n const canEdit = !state.isDisabled && !state.isReadOnly\n\n return (\n <FieldSegments>\n {state.segments.map((segment, index) => {\n if (!drawn(drawing, segment)) {\n return null\n }\n\n if (!segment.isEditable) {\n return (\n <NativeText\n aria-hidden={segment.type === 'literal'}\n // A segment's place is its key, and a literal's its index, since\n // a locale can put the same punctuation between several.\n // oxlint-disable-next-line react/no-array-index-key -- see above\n key={`${segment.type}-${index}`}\n style={\n drawing === undefined\n ? composeStyles<TextStyle>(\n role,\n segment.type === 'literal' ? undefined : own.segment,\n state.isDisabled\n ? own.textDisabled\n : segment.type === 'literal'\n ? own.textMuted\n : own.text,\n )\n : drawing.literal\n }\n >\n {segment.text}\n </NativeText>\n )\n }\n\n const focused = segment.type === active\n // The field's description is said on the first segment alone, so it\n // is not heard again at every step, unless the field has an error.\n const describes = isInvalid || segment.type === first?.type\n\n return (\n <Pressable\n {...(Platform.OS === 'web' ? webPropsOf(line, segment) : undefined)}\n {...(describes ? descriptionOf(parts) : undefined)}\n {...webStateOf(isInvalid, state)}\n accessibilityActions={canEdit ? ADJUSTABLE : undefined}\n accessibilityRole={Platform.OS === 'web' ? undefined : 'adjustable'}\n aria-disabled={state.isDisabled}\n aria-label={`${words[nameOf(segment.type)]}, ${label}`}\n aria-valuemax={segment.maxValue}\n aria-valuemin={segment.minValue}\n aria-valuenow={segment.value ?? undefined}\n aria-valuetext={valueTextOf(segment, state, locale, words.empty)}\n disabled={state.isDisabled}\n key={segment.type}\n onAccessibilityAction={actionOf(line, segment)}\n onPress={\n Platform.OS === 'web' ? undefined : pressOf(line, segment.type)\n }\n ref={nodeOf(line, segment.type)}\n role={Platform.OS === 'web' ? 'spinbutton' : undefined}\n style={\n drawing === undefined\n ? composeStyles<ViewStyle>(\n own.segment,\n focused ? own.segmentFocused : undefined,\n )\n : drawing.box(segment.type, focused)\n }\n >\n <NativeText\n style={\n drawing === undefined\n ? composeStyles<TextStyle>(\n role,\n textStyleOf(own, segment, focused, state.isDisabled),\n )\n : drawing.text(segment.type, focused)\n }\n >\n {segment.text}\n </NativeText>\n </Pressable>\n )\n })}\n {Platform.OS === 'web' ? (\n value === '' ? null : (\n <NativeText id={valueId} style={styles.notDrawn}>\n {value}\n </NativeText>\n )\n ) : (\n <TextInput\n aria-hidden\n autoCapitalize=\"none\"\n autoComplete=\"off\"\n autoCorrect={false}\n caretHidden\n contextMenuHidden\n editable={canEdit}\n importantForAutofill=\"no\"\n keyboardType={\n active === null || NUMERIC.has(active) ? 'number-pad' : 'default'\n }\n onBlur={leftOf(line)}\n onChangeText={changedOf(line)}\n onFocus={inputFocusedOf(line)}\n ref={inputOf(line)}\n selection={AFTER_SENTINEL}\n spellCheck={false}\n style={styles.input}\n value={SENTINEL}\n />\n )}\n </FieldSegments>\n )\n}\n\n// Steps a segment, as an arrow key or a swipe does, which starts what is\n// typed into it again. Whether it changed the value.\nfunction stepBy(\n state: DateFieldState,\n segment: DateSegment,\n by: Step,\n entered: RefObject<string>,\n): boolean {\n if (state.isDisabled || state.isReadOnly) {\n return false\n }\n\n entered.current = ''\n state[by](segment.type)\n return true\n}\n\nfunction stepKey(line: SegmentLineProps, segment: DateSegment, by: Step) {\n const changed = stepBy(line.state, segment, by, line.entered)\n\n // A Gregorian era is drawn only while it is BC, so a step, which can only\n // take it to AD, takes the segment away, and focus with it where it is the\n // segment in focus. A screen reader's swipe moves no focus of ours, and\n // raises no keyboard.\n if (\n changed &&\n segment.type === 'era' &&\n line.active === 'era' &&\n hidesEra(line.state, 'AD')\n ) {\n movesFrom(line, 'era').away()\n }\n edited(line, changed)\n}\n\nfunction textStyleOf(\n own: ReturnType<typeof segmentStylesOf>,\n segment: DateSegment,\n focused: boolean,\n isDisabled: boolean,\n) {\n if (isDisabled) {\n return own.textDisabled\n }\n\n if (focused) {\n return own.textFocused\n }\n\n return segment.isPlaceholder ? own.textMuted : own.text\n}\n\n// Whether a person types into `segment`: one they can edit, which the\n// drawing, where there is one, draws.\nfunction typedInto(drawing: SegmentDrawing | undefined, segment: DateSegment) {\n return segment.isEditable && drawn(drawing, segment)\n}\n\n// Types `key` into a segment, as React Aria's segment takes a key typed into\n// it, and moves on once the segment can take no more. Whether it changed the\n// value.\nfunction typeInto(\n state: DateFieldState,\n segment: DateSegment,\n key: string,\n locale: string,\n entered: RefObject<string>,\n moves: Moves,\n): boolean {\n if (state.isDisabled || state.isReadOnly) {\n return false\n }\n\n const startsWith = startsWithIn(locale)\n\n switch (segment.type) {\n case 'day':\n case 'hour':\n case 'minute':\n case 'month':\n case 'second':\n case 'year': {\n const parser = new NumberParser(locale, { maximumFractionDigits: 0 })\n const typed = entered.current + key\n\n if (!parser.isValidPartialNumber(typed)) {\n return false\n }\n\n const number = parser.parse(typed)\n\n if (Number.isNaN(number)) {\n return false\n }\n\n const { maxValue } = segment\n const over = maxValue !== undefined && number > maxValue\n\n // A number past the segment's largest starts again from the key alone,\n // so 13 in a month is a 3.\n state.setSegment(segment.type, over ? parser.parse(key) : number)\n\n if (\n maxValue !== undefined &&\n (Number(`${number}0`) > maxValue ||\n typed.length >= String(maxValue).length)\n ) {\n entered.current = ''\n moves.next()\n } else {\n entered.current = typed\n }\n return true\n }\n case 'dayPeriod': {\n const [am, pm] = dayPeriodsOf(locale)\n\n if (startsWith(am, key)) {\n state.setSegment('dayPeriod', 0)\n } else if (startsWith(pm, key)) {\n state.setSegment('dayPeriod', 1)\n } else {\n return false\n }\n moves.next()\n return true\n }\n case 'era': {\n const matched = erasOf(state.calendar, locale).find((era) =>\n startsWith(era.formatted, key),\n )\n\n if (matched === undefined) {\n return false\n }\n state.setSegment('era', matched.era)\n\n if (hidesEra(state, matched.era)) {\n moves.away()\n } else {\n moves.next()\n }\n return true\n }\n case 'literal':\n case 'timeZoneName': {\n break\n }\n }\n\n // A literal and a time zone are written by the locale and the value, and\n // nothing typed reaches them.\n return false\n}\n\nfunction typeKey(line: SegmentLineProps, segment: DateSegment, key: string) {\n edited(\n line,\n typeInto(\n line.state,\n segment,\n key,\n line.locale,\n line.entered,\n movesFrom(line, segment.type),\n ),\n )\n}\n\n// The date or the time a field holds, written out, which describes the\n// field after its segments, as React Aria describes it. Nothing while the\n// field is empty.\nfunction valueOf(state: DateFieldState, words: LibraryMessages['segments']) {\n if (state.value === null) {\n return ''\n }\n\n const written = state.formatValue({ month: 'long' })\n\n return state.maxGranularity === 'hour'\n ? words.selectedTime.replace('{time}', written)\n : words.selectedDate.replace('{date}', written)\n}\n\n// What a segment's value reads as, as React Aria writes it: a month with its\n// name beside its number, an hour with its day period, and an empty segment\n// as empty.\nfunction valueTextOf(\n segment: DateSegment,\n state: DateFieldState,\n locale: string,\n empty: string,\n) {\n if (segment.isPlaceholder) {\n return empty\n }\n\n const { hour12, timeZone } = state.dateFormatter.resolvedOptions()\n\n if (segment.type === 'month') {\n const month = new DateFormatter(locale, { month: 'long', timeZone }).format(\n state.dateValue,\n )\n return month === segment.text ? month : `${segment.text} – ${month}`\n }\n\n if (segment.type === 'hour') {\n return new DateFormatter(locale, {\n hour: 'numeric',\n hour12,\n timeZone,\n }).format(state.dateValue)\n }\n\n return segment.text\n}\n\n// What a segment takes under React Native Web: focus, and the keys a browser\n// hands it.\nfunction webPropsOf(\n line: SegmentLineProps,\n segment: DateSegment,\n): WebSegmentProps {\n const moves = movesFrom(line, segment.type)\n const step = (by: Step) => () => {\n stepKey(line, segment, by)\n }\n const erase = () => {\n eraseKey(line, segment)\n }\n // The arrow keys move along the line as it reads, so left is the next\n // segment in a right-to-left page.\n const keys = new Map<string, () => void>([\n ['ArrowDown', step('decrement')],\n ['ArrowLeft', I18nManager.isRTL ? moves.next : moves.previous],\n ['ArrowRight', I18nManager.isRTL ? moves.previous : moves.next],\n ['ArrowUp', step('increment')],\n ['Backspace', erase],\n ['Delete', erase],\n ['End', step('incrementToMax')],\n ['Home', step('decrementToMin')],\n ['PageDown', step('decrementPage')],\n ['PageUp', step('incrementPage')],\n ])\n\n return {\n // Focus moving to another segment stays in the field, and only focus\n // leaving the segments altogether is the field's blur.\n onBlur: (event) => {\n const to = relatedTargetOf(event.nativeEvent)\n if (![...line.nodes.current.values()].some((node) => node === to)) {\n leftOf(line)()\n }\n },\n onFocus: () => {\n line.entered.current = ''\n line.setActive(segment.type)\n arrivedIn(line)\n },\n onKeyDown: (event) => {\n const { altKey, ctrlKey, key, metaKey } = event.nativeEvent\n const handler = keys.get(key)\n\n if (handler !== undefined) {\n event.preventDefault()\n handler()\n return\n }\n\n // A key that types one character, rather than one held with a key that\n // makes it a shortcut, is typed into the segment.\n const point = key.codePointAt(0)\n\n if (\n point !== undefined &&\n String.fromCodePoint(point) === key &&\n !altKey &&\n !ctrlKey &&\n !metaKey\n ) {\n event.preventDefault()\n typeKey(line, segment, key)\n }\n },\n }\n}\n\n// What a browser reads off a segment that React Native has no prop for.\nfunction webStateOf(isInvalid: boolean, state: DateFieldState) {\n if (Platform.OS !== 'web') {\n return undefined\n }\n\n return {\n ...(isInvalid ? { 'aria-invalid': true } : undefined),\n ...(state.isReadOnly ? { 'aria-readonly': true } : undefined),\n ...(state.isRequired ? { 'aria-required': true } : undefined),\n }\n}\n\nexport { DateSegments }\nexport type { DateSegmentsProps, SegmentDrawing, SegmentsHandle }\n"],"mappings":";;;;;;;;;;;;;;AAuNA,MAAMyF,aAAiD,CACrD,EAAEC,MAAM,YAAY,GACpB,EAAEA,MAAM,YAAY,CAAC;AAKvB,MAAMC,YAAY;AAIlB,MAAMC,WAAW;AAGjB,MAAMC,iBAAiB;CAAEC,KAAKF;CAAiBI,OAAOJ;AAAgB;AAGtE,MAAMK,0BAAU,IAAIC,IAAqB;CACvC;CACA;CACA;CACA;CACA;CACA;AAAM,CACP;AAED,MAAMC,SAASrE,WAAWsE,OAAO;CAG/BrB,OAAO;EACLsB,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVP,OAAO;EACPQ,KAAK;EACLC,OAAO;CACT;CAGAC,UAAU,EACRC,SAAS,OACX;AACF,CAAC;AAGD,SAASC,SAASC,MAAwBC,SAAsB;CAC9D,QAAQC,UAAoC;EAC1C,MAAM,EAAEC,eAAeD,MAAME;EAC7B,IAAID,eAAe,eAAeA,eAAe,aAC/CE,QAAQL,MAAMC,SAASE,UAAU;CAErC;AACF;AAIA,SAASG,UAAU,EAAEnC,QAAQvB,WAA6B;CACxD,IAAI,CAACuB,OAAOoC,SAAS;EACnBpC,OAAOoC,UAAU;EACjB3D,UAAU;CACZ;AACF;AAIA,SAAS4D,UAAUR,MAAwB;CACzC,QAAQlC,SAAiB;EACvB,MAAMmC,UAAUD,KAAKhD,MAAMyD,SAASC,MACjCC,SAASA,KAAKnE,SAASwD,KAAKhC,MAC/B;EAEA,IAAIiC,YAAYW,KAAAA,GACd;EAGF,IAAI9C,KAAKoB,SAASH,GAAiB;GACjC8B,SAASb,MAAMC,OAAO;GACtB;EACF;EAKA,MAAMa,QAAQhD,KAAKiD,QAAQhC,UAAU,EAAE,CAAC,CAACiC,YAAY,CAAC;EAEtD,IAAIF,UA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,EAAE,iBAAiB,KAAK,IAAIpK,KAAAA;CACrD;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Calendar","ComponentRef","Dispatch","Ref","RefObject","SetStateAction","AccessibilityActionEvent","AccessibilityActionInfo","HostInstance","PressableProps","StyleProp","TextStyle","ViewStyle","DateFieldState","DateSegment","DateSegmentType","CalendarDate","DateFormatter","toCalendar","useEffect","useEffectEvent","useId","useImperativeHandle","useRef","useState","I18nManager","Text","NativeText","Platform","Pressable","StyleSheet","TextInput","FieldDescriptionPart","Focusable","LibraryMessages","startsWithIn","descriptionOf","FieldSegments","messagesFor","NumberParser","useTheme","composeStyles","useTypeRole","segmentStylesOf","DateSegmentsProps","described","drawing","SegmentDrawing","holding","isInvalid","label","locale","onActiveChange","type","onBeforeStart","onBlur","onEdit","onFocus","onPastEnd","ref","SegmentsHandle","state","Focusing","Pick","SegmentLineProps","Moves","away","next","previous","box","isActive","literal","parts","ReadonlySet","raisesKeyboard","text","Omit","active","entered","input","inside","nodes","Map","setActive","focusLast","focusOn","keyboard","Step","WebSegmentProps","ADJUSTABLE","name","INVISIBLE","SENTINEL","AFTER_SENTINEL","end","length","start","NUMERIC","Set","styles","create","height","opacity","position","top","width","notDrawn","display","actionOf","line","segment","event","actionName","nativeEvent","stepKey","arrivedIn","current","changedOf","segments","find","each","undefined","eraseKey","point","replace","codePointAt","typeKey","String","fromCodePoint","commonPrefixLength","texts","sorted","sort","first","at","last","DateSegments","t0","$","_c","props","t1","Symbol","for","t2","reportActive","t3","t4","t5","focus","typedInto","focusTo","findLast","segment_0","type_0","t6","dayPeriodsOf","formatter","hour","hour12","periodAt","hours","date","Date","setHours","formatToParts","part","value","drawn","replaceAll","has","edited","changed","eraseFrom","moves","isDisabled","isReadOnly","placeholder","parser","maximumFractionDigits","isValidPartialNumber","isPlaceholder","shortened","slice","parsed","parse","kept","clearSegment","setSegment","movesFrom","erasOf","calendar","era","timeZone","year","eras","getEras","map","set","day","month","toDate","formatted","prefix","OS","get","blur","hidesEra","identifier","inputFocusedOf","inputOf","node","leftOf","confirmPlaceholder","editable","filter","findIndex","to","index","beyond","nameOf","nodeOf","delete","pressOf","relatedTargetOf","relatedTarget","SegmentLine","id","theme","own","role","words","valueOf","valueId","canEdit","T0","isEditable","textDisabled","textMuted","focused","describes","webPropsOf","webStateOf","maxValue","minValue","valueTextOf","empty","segmentFocused","textStyleOf","stepBy","by","ReturnType","textFocused","typeInto","key","startsWith","typed","number","Number","isNaN","over","am","pm","matched","written","formatValue","maxGranularity","selectedTime","selectedDate","dateFormatter","resolvedOptions","format","dateValue","step","erase","keys","isRTL","values","some","onKeyDown","altKey","ctrlKey","metaKey","handler","preventDefault","isRequired","_c","NativeText"],"sources":["../../src/segments/index.tsx"],"sourcesContent":["import type { Calendar } from '@internationalized/date'\nimport type {\n ComponentRef,\n Dispatch,\n Ref,\n RefObject,\n SetStateAction,\n} from 'react'\nimport type {\n AccessibilityActionEvent,\n AccessibilityActionInfo,\n HostInstance,\n PressableProps,\n StyleProp,\n TextStyle,\n ViewStyle,\n} from 'react-native'\nimport type {\n DateFieldState,\n DateSegment,\n DateSegmentType,\n} from 'react-stately/useDateFieldState'\n\nimport {\n CalendarDate,\n DateFormatter,\n toCalendar,\n} from '@internationalized/date'\nimport {\n useEffect,\n useEffectEvent,\n useId,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react'\nimport {\n I18nManager,\n Text as NativeText,\n Platform,\n Pressable,\n StyleSheet,\n TextInput,\n} from 'react-native'\n\nimport type { FieldDescriptionPart } from '../field'\nimport type { Focusable } from '../form'\nimport type { LibraryMessages } from '../i18n/messages'\n\nimport { startsWithIn } from '../autocomplete'\nimport { descriptionOf, FieldSegments } from '../field'\nimport { messagesFor } from '../i18n'\nimport { NumberParser } from '../number/parser'\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { useTypeRole } from '../typography/roles'\nimport { segmentStylesOf } from './styles'\n\n// The segments a date or a time is typed into, one part of the value each, as\n// web's src/segments draws them. React Stately's date field state decides\n// what the parts are, how many, in what order and what each may hold, from\n// the locale and the granularity, so a field built on it draws them from that\n// state rather than writing any of them out. What is here is how a person\n// types into them and how a screen reader reads them, which is React Aria's\n// useDateSegment ported, since React Aria does not run on native.\n//\n// **Typing is React Aria's, digit for digit.** A digit goes into the segment\n// after the ones typed before it, and moves on to the next segment once no\n// further digit could fit, so `9` in a month moves on and `1` waits for a\n// second. A letter picks a day period or an era by the start of its name in\n// the locale, backspace takes a digit off the end, and on an empty segment\n// moves back to the one before it.\n//\n// **On iOS and Android one hidden input takes the keys.** A view cannot raise\n// the keyboard, so a press on a segment makes it the one being typed and\n// focuses a text input no one sees or reads, which holds one space and hands\n// over each key typed after it. Its keyboard is a number pad for a segment of\n// digits and the full one for a day period or an era. A screen reader reaches\n// each segment as an adjustable element instead, which a swipe steps up or\n// down, and which opens the keyboard when activated.\n//\n// **Under React Native Web each segment is its own focus stop**, as web's\n// are, read as a spin button and typed into with the keys a browser hands\n// it: digits and letters, backspace, the arrow keys up and down to step, and\n// left and right to move between segments, which follow the direction the\n// page reads in.\n//\n// **A drawing of their own replaces a field's line**, for segments that are\n// not a field's: a box per part, the text inside it and the punctuation\n// between them, each the caller's, as a time picker's modal draws its hour\n// and minute. It names the parts it draws, and focus passes the others by,\n// so a day period a selector beside the boxes stands for is never typed into.\n// Punctuation is drawn only where it holds something to see, since a\n// locale's literals carry bidirectional marks and spaces beside it.\n\ntype DateSegmentsProps = {\n /** What describes the field after the value it holds: the line under it. */\n readonly described: readonly FieldDescriptionPart[]\n /** How the segments are drawn where they are not a field's line. */\n readonly drawing?: SegmentDrawing\n /**\n * What the segments are read as holding, after their own names: the date\n * or the time written out, unless a range picker around them reads its\n * whole range here instead. `''` reads nothing.\n */\n readonly holding?: string\n /** Whether the field shows an error, which every segment then says. */\n readonly isInvalid: boolean\n /** The field's label, which each segment's name ends in. */\n readonly label: string\n /** The locale the field writes in: its `useLocaleOf`. */\n readonly locale: string\n /**\n * Called with the segment in focus as it changes, and with `null` as focus\n * leaves them.\n */\n readonly onActiveChange?: (type: DateSegmentType | null) => void\n /**\n * Called where focus would move back from the first segment, as a\n * backspace on it does, which a range picker sends on to the start's last.\n */\n readonly onBeforeStart?: () => void\n /** Called as focus leaves the segments, once they fill in what they can. */\n readonly onBlur?: () => void\n /** Called after each edit a person makes, typed or stepped. */\n readonly onEdit?: () => void\n /** Called as focus arrives in the segments from outside them. */\n readonly onFocus?: () => void\n /**\n * Called where focus would move on from the last segment, as a full one\n * does, which a range picker sends on to the end's first.\n */\n readonly onPastEnd?: () => void\n /** What focuses the segments: the first, or the last. */\n readonly ref?: Ref<SegmentsHandle>\n readonly state: DateFieldState\n}\n\n// What moving focus to a segment reaches for.\ntype Focusing = Pick<\n SegmentLineProps,\n 'entered' | 'input' | 'nodes' | 'setActive' | 'state'\n>\n\ntype Moves = {\n // Where focus goes from a segment that stops being drawn, as React Aria's\n // goes from one it removes: the one before it, or the one after it where it\n // was the first.\n readonly away: () => void\n readonly next: () => void\n readonly previous: () => void\n}\n\n/**\n * How segments are drawn in place of a field's line of body large text, each\n * style chosen for whether its part is the one in focus.\n */\ntype SegmentDrawing = {\n /** The box a part a person types into is drawn in. */\n readonly box: (\n type: DateSegmentType,\n isActive: boolean,\n ) => StyleProp<ViewStyle>\n /** The punctuation between two parts. */\n readonly literal: StyleProp<TextStyle>\n /** The parts drawn. The rest are left out, and focus passes them by. */\n readonly parts: ReadonlySet<DateSegmentType>\n /**\n * Whether a press on a part raises the keyboard on iOS and Android, as a\n * field's does, rather than only making it the one in focus.\n */\n readonly raisesKeyboard: boolean\n /** The text inside a part's box. */\n readonly text: (\n type: DateSegmentType,\n isActive: boolean,\n ) => StyleProp<TextStyle>\n}\n\n// The segments' own props, with what the component around them keeps for\n// them: which one is being typed, what has been typed into it, whether focus\n// is among them, the hidden input and each segment's element.\ntype SegmentLineProps = Omit<DateSegmentsProps, 'ref'> & {\n readonly active: DateSegmentType | null\n readonly entered: RefObject<string>\n readonly input: RefObject<ComponentRef<typeof TextInput> | null>\n readonly inside: RefObject<boolean>\n readonly nodes: RefObject<Map<DateSegmentType, HostInstance>>\n readonly setActive: Dispatch<SetStateAction<DateSegmentType | null>>\n}\n\n/**\n * What focuses a field's segments: `focus` the first, unless focus is among\n * them already, `focusLast` the last, and `focusOn` the one of `type`, with\n * the keyboard raised on iOS and Android or put away.\n */\ntype SegmentsHandle = Focusable & {\n readonly focusLast: () => void\n readonly focusOn: (type: DateSegmentType, keyboard: boolean) => void\n}\n\n// A step a spin button takes, each one a method of the field's state.\ntype Step =\n | 'decrement'\n | 'decrementPage'\n | 'decrementToMin'\n | 'increment'\n | 'incrementPage'\n | 'incrementToMax'\n\n// What a segment is handed under React Native Web, which takes keys and focus\n// on any element.\ntype WebSegmentProps = Pick<PressableProps, 'onBlur' | 'onFocus' | 'onKeyDown'>\n\n// What a screen reader can ask of a segment: a step up, or a step down.\nconst ADJUSTABLE: readonly AccessibilityActionInfo[] = [\n { name: 'increment' },\n { name: 'decrement' },\n]\n\n// What a literal holds besides what it is drawn for: the spaces, and the\n// marks a locale sets a direction with.\nconst INVISIBLE = /[\\s\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069]/gu\n\n// The text the hidden input holds, which a backspace has something to take\n// from and which every key typed lands after.\nconst SENTINEL = ' '\n\n// Where the hidden input's caret stays: after the space.\nconst AFTER_SENTINEL = { end: SENTINEL.length, start: SENTINEL.length }\n\n// The segments a number is typed into, which the number pad serves.\nconst NUMERIC = new Set<DateSegmentType>([\n 'day',\n 'hour',\n 'minute',\n 'month',\n 'second',\n 'year',\n])\n\nconst styles = StyleSheet.create({\n // The input no one sees, which is there to raise the keyboard and take its\n // keys. Still laid out, since an input with no size takes no focus.\n input: {\n height: 1,\n opacity: 0,\n position: 'absolute',\n start: 0,\n top: 0,\n width: 1,\n },\n // The date written out, in the document under React Native Web for the\n // first segment to point at, and drawn nowhere.\n notDrawn: {\n display: 'none',\n },\n})\n\n// What a screen reader's swipe up or down does to a segment.\nfunction actionOf(line: SegmentLineProps, segment: DateSegment) {\n return (event: AccessibilityActionEvent) => {\n const { actionName } = event.nativeEvent\n if (actionName === 'increment' || actionName === 'decrement') {\n stepKey(line, segment, actionName)\n }\n }\n}\n\n// Where focus goes once a person is in the segments: what the field calls on\n// arriving, which it hears once however many segments focus passes through.\nfunction arrivedIn({ inside, onFocus }: SegmentLineProps) {\n if (!inside.current) {\n inside.current = true\n onFocus?.()\n }\n}\n\n// What the hidden input does with each change to its text: a shorter text is\n// a backspace, and a longer one a key typed after the space.\nfunction changedOf(line: SegmentLineProps) {\n return (text: string) => {\n const segment = line.state.segments.find(\n (each) => each.type === line.active,\n )\n\n if (segment === undefined) {\n return\n }\n\n if (text.length < SENTINEL.length) {\n eraseKey(line, segment)\n return\n }\n\n // One key at a time, the first typed after the space: a second handed\n // over in the same change would be written over by the first, since\n // both are set from the value this render holds.\n const point = text.replace(SENTINEL, '').codePointAt(0)\n\n if (point !== undefined) {\n typeKey(line, segment, String.fromCodePoint(point))\n }\n }\n}\n\n// The number of characters at the start of every one of `texts` that they\n// share, which an era's name is typed after, as React Aria finds it.\nfunction commonPrefixLength(texts: readonly string[]) {\n const sorted = [...texts].sort()\n const first = sorted.at(0) ?? ''\n const last = sorted.at(-1) ?? ''\n let length = 0\n\n while (length < first.length && first[length] === last[length]) {\n length++\n }\n\n return length\n}\n\n/**\n * A date or a time's segments, inside a field's box, from React Stately's\n * date field state: each part of the value typed or stepped on its own, the\n * one being typed drawn as a filled shape and the empty ones in their\n * placeholders, muted.\n */\nfunction DateSegments({ onActiveChange, ref, ...props }: DateSegmentsProps) {\n const [active, setActive] = useState<DateSegmentType | null>(null)\n // What has been typed into the segment in focus since it took focus, which\n // the next digit is read after.\n const entered = useRef('')\n // Whether focus is in the segments, which a press on the box around them\n // leaves where it is.\n const inside = useRef(false)\n const input = useRef<ComponentRef<typeof TextInput>>(null)\n // Each segment's element under React Native Web, which focus moves to.\n const nodes = useRef(new Map<DateSegmentType, HostInstance>())\n const { drawing, state } = props\n const reportActive = useEffectEvent((type: DateSegmentType | null) => {\n onActiveChange?.(type)\n })\n\n useEffect(() => {\n reportActive(active)\n }, [active])\n\n useImperativeHandle(ref, () => ({\n focus: () => {\n const first = state.segments.find((segment) =>\n typedInto(drawing, segment),\n )\n if (!inside.current && first !== undefined) {\n focusTo({ entered, input, nodes, setActive, state }, first.type)\n }\n },\n focusLast: () => {\n const last = state.segments.findLast((segment) =>\n typedInto(drawing, segment),\n )\n if (last !== undefined) {\n focusTo({ entered, input, nodes, setActive, state }, last.type)\n }\n },\n focusOn: (type, keyboard) => {\n focusTo({ entered, input, nodes, setActive, state }, type, keyboard)\n },\n }))\n\n return (\n <SegmentLine\n {...props}\n active={active}\n entered={entered}\n input={input}\n inside={inside}\n nodes={nodes}\n setActive={setActive}\n />\n )\n}\n\n// What the locale calls the morning and the afternoon, which a key picks\n// between by the start of each.\nfunction dayPeriodsOf(locale: string): readonly [string, string] {\n const formatter = new DateFormatter(locale, { hour: 'numeric', hour12: true })\n const periodAt = (hours: number) => {\n const date = new Date()\n date.setHours(hours)\n return (\n formatter.formatToParts(date).find((part) => part.type === 'dayPeriod')\n ?.value ?? ''\n )\n }\n\n return [periodAt(0), periodAt(12)]\n}\n\n// Whether a segment is drawn: every one on a field's line, and in a drawing\n// of its own the parts it names and the punctuation that holds something to\n// see.\nfunction drawn(drawing: SegmentDrawing | undefined, segment: DateSegment) {\n if (drawing === undefined) {\n return true\n }\n\n return segment.type === 'literal'\n ? segment.text.replaceAll(INVISIBLE, '') !== ''\n : drawing.parts.has(segment.type)\n}\n\nfunction edited({ onEdit }: SegmentLineProps, changed: boolean) {\n if (changed) {\n onEdit?.()\n }\n}\n\n// Takes a digit off the end of a segment, as backspace does in React Aria's,\n// and clears a day period or an era outright. On a segment already empty it\n// moves to the one before. Whether it changed the value.\nfunction eraseFrom(\n state: DateFieldState,\n segment: DateSegment,\n locale: string,\n entered: RefObject<string>,\n moves: Moves,\n): boolean {\n if (state.isDisabled || state.isReadOnly) {\n return false\n }\n\n if (segment.text === segment.placeholder) {\n moves.previous()\n }\n\n const parser = new NumberParser(locale, { maximumFractionDigits: 0 })\n\n if (parser.isValidPartialNumber(segment.text) && !segment.isPlaceholder) {\n const shortened = segment.text.slice(0, -1)\n const parsed = parser.parse(shortened)\n const kept = parsed === 0 ? '' : shortened\n\n if (kept === '') {\n state.clearSegment(segment.type)\n } else {\n state.setSegment(segment.type, parsed)\n }\n entered.current = kept\n return true\n }\n\n if (segment.type === 'dayPeriod' || segment.type === 'era') {\n state.clearSegment(segment.type)\n return true\n }\n\n return false\n}\n\nfunction eraseKey(line: SegmentLineProps, segment: DateSegment) {\n edited(\n line,\n eraseFrom(\n line.state,\n segment,\n line.locale,\n line.entered,\n movesFrom(line, segment.type),\n ),\n )\n}\n\n// The calendar's eras with the names a key picks them by: each era's name in\n// the locale, less what every name begins with, so a calendar whose eras are\n// ERA0 and ERA1 is typed with 0 and 1, as React Aria's is.\nfunction erasOf(calendar: Calendar, locale: string) {\n const formatter = new DateFormatter(locale, {\n era: 'narrow',\n timeZone: 'UTC',\n year: 'numeric',\n })\n const first = toCalendar(new CalendarDate(1, 1, 1), calendar)\n const eras = calendar.getEras().map((era) => {\n const date = first.set({ day: 1, era, month: 1, year: 1 }).toDate('UTC')\n\n return {\n era,\n // An era with no name in the locale is typed by its identifier.\n formatted:\n formatter.formatToParts(date).find((part) => part.type === 'era')\n ?.value ?? era,\n }\n })\n const prefix = commonPrefixLength(eras.map((era) => era.formatted))\n\n return eras.map(({ era, formatted }) => ({\n era,\n formatted: formatted.slice(prefix),\n }))\n}\n\n// Moves focus to the segment of `type`: the segment's own element under React\n// Native Web, and on iOS and Android the hidden input, with the segment made\n// the one it types into. A read-only field raises no keyboard, and nor does a\n// move that puts the keyboard away, which makes the segment the one in focus\n// and takes focus off the input.\nfunction focusTo(\n { entered, input, nodes, setActive, state }: Focusing,\n type: DateSegmentType,\n keyboard = true,\n) {\n entered.current = ''\n\n if (Platform.OS === 'web') {\n nodes.current.get(type)?.focus()\n return\n }\n\n if (!keyboard) {\n setActive(type)\n input.current?.blur()\n return\n }\n\n if (state.isReadOnly) {\n return\n }\n\n setActive(type)\n input.current?.focus()\n}\n\n// Whether setting the era to `era` stops the era segment being drawn, which\n// React Stately draws in a Gregorian calendar only while the date is BC.\nfunction hidesEra(state: DateFieldState, era: string) {\n return state.calendar.identifier === 'gregory' && era !== 'BC'\n}\n\n// What the hidden input does on taking focus: types into the segment it was\n// focused for, or the first where it was focused some other way.\nfunction inputFocusedOf(line: SegmentLineProps) {\n return () => {\n const first =\n line.state.segments.find((segment) => typedInto(line.drawing, segment))\n ?.type ?? null\n line.setActive((current) => current ?? first)\n arrivedIn(line)\n }\n}\n\n// Keeps the hidden input, which focus is moved to on iOS and Android.\nfunction inputOf({ input }: SegmentLineProps) {\n return (node: ComponentRef<typeof TextInput> | null) => {\n input.current = node\n }\n}\n\n// What focus leaving the segments does: fills in what the placeholder can,\n// as React Aria's field does on blur, then tells the field.\nfunction leftOf({\n entered,\n inside,\n onBlur,\n setActive,\n state,\n}: SegmentLineProps) {\n return () => {\n inside.current = false\n entered.current = ''\n setActive(null)\n state.confirmPlaceholder()\n onBlur?.()\n }\n}\n\n// The segments on either side of the one of `type`, among those a person\n// types into, which a full segment moves on to and a backspace back to. Past\n// either end it is the field's to say, as a range picker's focus moves on\n// from one date's segments to the other's.\nfunction movesFrom(line: SegmentLineProps, type: DateSegmentType): Moves {\n const editable = line.state.segments.filter((segment) =>\n typedInto(line.drawing, segment),\n )\n const at = editable.findIndex((segment) => segment.type === type)\n const to = (index: number, beyond?: () => void) => () => {\n const segment = index < 0 ? undefined : editable.at(index)\n if (segment === undefined) {\n beyond?.()\n } else {\n focusTo(line, segment.type)\n }\n }\n\n return {\n away: to(at > 0 ? at - 1 : at + 1),\n next: to(at + 1, line.onPastEnd),\n previous: to(at - 1, line.onBeforeStart),\n }\n}\n\n// The name a segment of `type` is read by. A literal is never read, and is\n// named as a day only to keep the lookup total.\nfunction nameOf(\n type: DateSegmentType,\n): keyof Omit<\n LibraryMessages['segments'],\n 'empty' | 'selectedDate' | 'selectedTime'\n> {\n return type === 'literal' ? 'day' : type\n}\n\n// Keeps each segment's element, which focus is moved to under React Native\n// Web, for as long as it is drawn.\nfunction nodeOf({ nodes }: SegmentLineProps, type: DateSegmentType) {\n return (node: HostInstance | null) => {\n if (node === null) {\n return undefined\n }\n\n nodes.current.set(type, node)\n return () => {\n nodes.current.delete(type)\n }\n }\n}\n\n// What a press on a segment does on iOS and Android: makes it the one typed\n// into, and raises the keyboard, unless the drawing says a press only makes\n// it the one in focus.\nfunction pressOf(line: SegmentLineProps, type: DateSegmentType) {\n return () => {\n focusTo(line, type, line.drawing?.raisesKeyboard ?? true)\n }\n}\n\n// The element focus moved to, off a browser's blur event.\nfunction relatedTargetOf(event: unknown): unknown {\n return typeof event === 'object' && event !== null && 'relatedTarget' in event\n ? event.relatedTarget\n : undefined\n}\n\n// The segments themselves, drawn from the field's state.\nfunction SegmentLine(line: SegmentLineProps) {\n const { active, described, drawing, isInvalid, label, locale, state } = line\n const id = useId()\n const theme = useTheme()\n const own = segmentStylesOf(theme)\n const role = useTypeRole('bodyLarge')\n const words = messagesFor(locale).segments\n const first = state.segments.find((segment) => typedInto(drawing, segment))\n const value = line.holding ?? valueOf(state, words)\n const valueId = `${id}-value`\n const parts =\n value === '' ? described : [{ id: valueId, text: value }, ...described]\n const canEdit = !state.isDisabled && !state.isReadOnly\n\n return (\n <FieldSegments>\n {state.segments.map((segment, index) => {\n if (!drawn(drawing, segment)) {\n return null\n }\n\n if (!segment.isEditable) {\n return (\n <NativeText\n aria-hidden={segment.type === 'literal'}\n // A segment's place is its key, and a literal's its index, since\n // a locale can put the same punctuation between several.\n // oxlint-disable-next-line react/no-array-index-key -- see above\n key={`${segment.type}-${index}`}\n style={\n drawing === undefined\n ? composeStyles<TextStyle>(\n role,\n segment.type === 'literal' ? undefined : own.segment,\n state.isDisabled\n ? own.textDisabled\n : segment.type === 'literal'\n ? own.textMuted\n : own.text,\n )\n : drawing.literal\n }\n >\n {segment.text}\n </NativeText>\n )\n }\n\n const focused = segment.type === active\n // The field's description is said on the first segment alone, so it\n // is not heard again at every step, unless the field has an error.\n const describes = isInvalid || segment.type === first?.type\n\n return (\n <Pressable\n {...(Platform.OS === 'web' ? webPropsOf(line, segment) : undefined)}\n {...(describes ? descriptionOf(parts) : undefined)}\n {...webStateOf(isInvalid, state)}\n accessibilityActions={canEdit ? ADJUSTABLE : undefined}\n accessibilityRole={Platform.OS === 'web' ? undefined : 'adjustable'}\n aria-disabled={state.isDisabled}\n aria-label={`${words[nameOf(segment.type)]}, ${label}`}\n aria-valuemax={segment.maxValue}\n aria-valuemin={segment.minValue}\n aria-valuenow={segment.value ?? undefined}\n aria-valuetext={valueTextOf(segment, state, locale, words.empty)}\n disabled={state.isDisabled}\n key={segment.type}\n onAccessibilityAction={actionOf(line, segment)}\n onPress={\n Platform.OS === 'web' ? undefined : pressOf(line, segment.type)\n }\n ref={nodeOf(line, segment.type)}\n role={Platform.OS === 'web' ? 'spinbutton' : undefined}\n style={\n drawing === undefined\n ? composeStyles<ViewStyle>(\n own.segment,\n focused ? own.segmentFocused : undefined,\n )\n : drawing.box(segment.type, focused)\n }\n >\n <NativeText\n style={\n drawing === undefined\n ? composeStyles<TextStyle>(\n role,\n textStyleOf(own, segment, focused, state.isDisabled),\n )\n : drawing.text(segment.type, focused)\n }\n >\n {segment.text}\n </NativeText>\n </Pressable>\n )\n })}\n {Platform.OS === 'web' ? (\n value === '' ? null : (\n <NativeText id={valueId} style={styles.notDrawn}>\n {value}\n </NativeText>\n )\n ) : (\n <TextInput\n aria-hidden\n autoCapitalize=\"none\"\n autoComplete=\"off\"\n autoCorrect={false}\n caretHidden\n contextMenuHidden\n editable={canEdit}\n importantForAutofill=\"no\"\n keyboardType={\n active === null || NUMERIC.has(active) ? 'number-pad' : 'default'\n }\n onBlur={leftOf(line)}\n onChangeText={changedOf(line)}\n onFocus={inputFocusedOf(line)}\n ref={inputOf(line)}\n selection={AFTER_SENTINEL}\n spellCheck={false}\n style={styles.input}\n value={SENTINEL}\n />\n )}\n </FieldSegments>\n )\n}\n\n// Steps a segment, as an arrow key or a swipe does, which starts what is\n// typed into it again. Whether it changed the value.\nfunction stepBy(\n state: DateFieldState,\n segment: DateSegment,\n by: Step,\n entered: RefObject<string>,\n): boolean {\n if (state.isDisabled || state.isReadOnly) {\n return false\n }\n\n entered.current = ''\n state[by](segment.type)\n return true\n}\n\nfunction stepKey(line: SegmentLineProps, segment: DateSegment, by: Step) {\n const changed = stepBy(line.state, segment, by, line.entered)\n\n // A Gregorian era is drawn only while it is BC, so a step, which can only\n // take it to AD, takes the segment away, and focus with it where it is the\n // segment in focus. A screen reader's swipe moves no focus of ours, and\n // raises no keyboard.\n if (\n changed &&\n segment.type === 'era' &&\n line.active === 'era' &&\n hidesEra(line.state, 'AD')\n ) {\n movesFrom(line, 'era').away()\n }\n edited(line, changed)\n}\n\nfunction textStyleOf(\n own: ReturnType<typeof segmentStylesOf>,\n segment: DateSegment,\n focused: boolean,\n isDisabled: boolean,\n) {\n if (isDisabled) {\n return own.textDisabled\n }\n\n if (focused) {\n return own.textFocused\n }\n\n return segment.isPlaceholder ? own.textMuted : own.text\n}\n\n// Whether a person types into `segment`: one they can edit, which the\n// drawing, where there is one, draws.\nfunction typedInto(drawing: SegmentDrawing | undefined, segment: DateSegment) {\n return segment.isEditable && drawn(drawing, segment)\n}\n\n// Types `key` into a segment, as React Aria's segment takes a key typed into\n// it, and moves on once the segment can take no more. Whether it changed the\n// value.\nfunction typeInto(\n state: DateFieldState,\n segment: DateSegment,\n key: string,\n locale: string,\n entered: RefObject<string>,\n moves: Moves,\n): boolean {\n if (state.isDisabled || state.isReadOnly) {\n return false\n }\n\n const startsWith = startsWithIn(locale)\n\n switch (segment.type) {\n case 'day':\n case 'hour':\n case 'minute':\n case 'month':\n case 'second':\n case 'year': {\n const parser = new NumberParser(locale, { maximumFractionDigits: 0 })\n const typed = entered.current + key\n\n if (!parser.isValidPartialNumber(typed)) {\n return false\n }\n\n const number = parser.parse(typed)\n\n if (Number.isNaN(number)) {\n return false\n }\n\n const { maxValue } = segment\n const over = maxValue !== undefined && number > maxValue\n\n // A number past the segment's largest starts again from the key alone,\n // so 13 in a month is a 3.\n state.setSegment(segment.type, over ? parser.parse(key) : number)\n\n if (\n maxValue !== undefined &&\n (Number(`${number}0`) > maxValue ||\n typed.length >= String(maxValue).length)\n ) {\n entered.current = ''\n moves.next()\n } else {\n entered.current = typed\n }\n return true\n }\n case 'dayPeriod': {\n const [am, pm] = dayPeriodsOf(locale)\n\n if (startsWith(am, key)) {\n state.setSegment('dayPeriod', 0)\n } else if (startsWith(pm, key)) {\n state.setSegment('dayPeriod', 1)\n } else {\n return false\n }\n moves.next()\n return true\n }\n case 'era': {\n const matched = erasOf(state.calendar, locale).find((era) =>\n startsWith(era.formatted, key),\n )\n\n if (matched === undefined) {\n return false\n }\n state.setSegment('era', matched.era)\n\n if (hidesEra(state, matched.era)) {\n moves.away()\n } else {\n moves.next()\n }\n return true\n }\n case 'literal':\n case 'timeZoneName': {\n break\n }\n }\n\n // A literal and a time zone are written by the locale and the value, and\n // nothing typed reaches them.\n return false\n}\n\nfunction typeKey(line: SegmentLineProps, segment: DateSegment, key: string) {\n edited(\n line,\n typeInto(\n line.state,\n segment,\n key,\n line.locale,\n line.entered,\n movesFrom(line, segment.type),\n ),\n )\n}\n\n// The date or the time a field holds, written out, which describes the\n// field after its segments, as React Aria describes it. Nothing while the\n// field is empty.\nfunction valueOf(state: DateFieldState, words: LibraryMessages['segments']) {\n if (state.value === null) {\n return ''\n }\n\n const written = state.formatValue({ month: 'long' })\n\n return state.maxGranularity === 'hour'\n ? words.selectedTime.replace('{time}', written)\n : words.selectedDate.replace('{date}', written)\n}\n\n// What a segment's value reads as, as React Aria writes it: a month with its\n// name beside its number, an hour with its day period, and an empty segment\n// as empty.\nfunction valueTextOf(\n segment: DateSegment,\n state: DateFieldState,\n locale: string,\n empty: string,\n) {\n if (segment.isPlaceholder) {\n return empty\n }\n\n const { hour12, timeZone } = state.dateFormatter.resolvedOptions()\n\n if (segment.type === 'month') {\n const month = new DateFormatter(locale, { month: 'long', timeZone }).format(\n state.dateValue,\n )\n return month === segment.text ? month : `${segment.text} – ${month}`\n }\n\n if (segment.type === 'hour') {\n return new DateFormatter(locale, {\n hour: 'numeric',\n hour12,\n timeZone,\n }).format(state.dateValue)\n }\n\n return segment.text\n}\n\n// What a segment takes under React Native Web: focus, and the keys a browser\n// hands it.\nfunction webPropsOf(\n line: SegmentLineProps,\n segment: DateSegment,\n): WebSegmentProps {\n const moves = movesFrom(line, segment.type)\n const step = (by: Step) => () => {\n stepKey(line, segment, by)\n }\n const erase = () => {\n eraseKey(line, segment)\n }\n // The arrow keys move along the line as it reads, so left is the next\n // segment in a right-to-left page.\n const keys = new Map<string, () => void>([\n ['ArrowDown', step('decrement')],\n ['ArrowLeft', I18nManager.isRTL ? moves.next : moves.previous],\n ['ArrowRight', I18nManager.isRTL ? moves.previous : moves.next],\n ['ArrowUp', step('increment')],\n ['Backspace', erase],\n ['Delete', erase],\n ['End', step('incrementToMax')],\n ['Home', step('decrementToMin')],\n ['PageDown', step('decrementPage')],\n ['PageUp', step('incrementPage')],\n ])\n\n return {\n // Focus moving to another segment stays in the field, and only focus\n // leaving the segments altogether is the field's blur.\n onBlur: (event) => {\n const to = relatedTargetOf(event.nativeEvent)\n if (![...line.nodes.current.values()].some((node) => node === to)) {\n leftOf(line)()\n }\n },\n onFocus: () => {\n line.entered.current = ''\n line.setActive(segment.type)\n arrivedIn(line)\n },\n onKeyDown: (event) => {\n const { altKey, ctrlKey, key, metaKey } = event.nativeEvent\n const handler = keys.get(key)\n\n if (handler !== undefined) {\n event.preventDefault()\n handler()\n return\n }\n\n // A key that types one character, rather than one held with a key that\n // makes it a shortcut, is typed into the segment.\n const point = key.codePointAt(0)\n\n if (\n point !== undefined &&\n String.fromCodePoint(point) === key &&\n !altKey &&\n !ctrlKey &&\n !metaKey\n ) {\n event.preventDefault()\n typeKey(line, segment, key)\n }\n },\n }\n}\n\n// What a browser reads off a segment that React Native has no prop for.\nfunction webStateOf(isInvalid: boolean, state: DateFieldState) {\n if (Platform.OS !== 'web') {\n return undefined\n }\n\n return {\n ...(isInvalid ? { 'aria-invalid': true } : undefined),\n ...(state.isReadOnly ? { 'aria-readonly': true } : undefined),\n ...(state.isRequired ? { 'aria-required': true } : undefined),\n }\n}\n\nexport { DateSegments }\nexport type { DateSegmentsProps, SegmentDrawing, SegmentsHandle }\n"],"mappings":";;;;;;;;;;;;;;AAuNA,MAAMyF,aAAiD,CACrD,EAAEC,MAAM,YAAY,GACpB,EAAEA,MAAM,YAAY,CAAC;AAKvB,MAAMC,YAAY;AAIlB,MAAMC,WAAW;AAGjB,MAAMC,iBAAiB;CAAEC,KAAKF;CAAiBI,OAAOJ;AAAgB;AAGtE,MAAMK,0BAAU,IAAIC,IAAqB;CACvC;CACA;CACA;CACA;CACA;CACA;AAAM,CACP;AAED,MAAMC,SAASrE,WAAWsE,OAAO;CAG/BrB,OAAO;EACLsB,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVP,OAAO;EACPQ,KAAK;EACLC,OAAO;CACT;CAGAC,UAAU,EACRC,SAAS,OACX;AACF,CAAC;AAGD,SAASC,SAASC,MAAwBC,SAAsB;CAC9D,QAAQC,UAAoC;EAC1C,MAAM,EAAEC,eAAeD,MAAME;EAC7B,IAAID,eAAe,eAAeA,eAAe,aAC/CE,QAAQL,MAAMC,SAASE,UAAU;CAErC;AACF;AAIA,SAASG,UAAU,EAAEnC,QAAQvB,WAA6B;CACxD,IAAI,CAACuB,OAAOoC,SAAS;EACnBpC,OAAOoC,UAAU;EACjB3D,UAAU;CACZ;AACF;AAIA,SAAS4D,UAAUR,MAAwB;CACzC,QAAQlC,SAAiB;EACvB,MAAMmC,UAAUD,KAAKhD,MAAMyD,SAASC,MACjCC,SAAS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AAG;GAC5B;EACF;CACF;AACF;AAGA,SAASZ,WAAWjM,WAAoBY,OAAuB;CAC7D,IAAIjC,SAASgL,OAAO,OAClB;CAGF,OAAO;EACL,GAAI3J,YAAY,EAAE,gBAAgB,KAAK,IAAIwE,KAAAA;EAC3C,GAAI5D,MAAMmH,aAAa,EAAE,iBAAiB,KAAK,IAAIvD,KAAAA;EACnD,GAAI5D,MAAMgO,aAAa,EAAE,iBAAiB,KAAK,IAAIpK,KAAAA;CACrD;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanso-labs/react-native-kanso-ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.26",
|
|
4
4
|
"description": "Kanso UI's Material Design components for React Native, themed through the same --kui-* design tokens as the web library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"@commitlint/config-conventional": "21.2.4",
|
|
62
62
|
"@eslint/js": "10.0.1",
|
|
63
63
|
"@jest/globals": "29.7.0",
|
|
64
|
-
"@kanso-labs/kanso-ui-core": "0.1.
|
|
64
|
+
"@kanso-labs/kanso-ui-core": "0.1.12",
|
|
65
65
|
"@react-native/babel-preset": "0.88.1",
|
|
66
66
|
"@react-native/jest-preset": "0.88.1",
|
|
67
67
|
"@rolldown/plugin-babel": "0.3.0",
|
|
68
|
-
"@storybook/addon-a11y": "10.6.
|
|
69
|
-
"@storybook/addon-docs": "10.6.
|
|
70
|
-
"@storybook/addon-vitest": "10.6.
|
|
71
|
-
"@storybook/react": "10.6.
|
|
72
|
-
"@storybook/react-native-web-vite": "10.6.
|
|
68
|
+
"@storybook/addon-a11y": "10.6.6",
|
|
69
|
+
"@storybook/addon-docs": "10.6.6",
|
|
70
|
+
"@storybook/addon-vitest": "10.6.6",
|
|
71
|
+
"@storybook/react": "10.6.6",
|
|
72
|
+
"@storybook/react-native-web-vite": "10.6.6",
|
|
73
73
|
"@testing-library/react-native": "14.1.0",
|
|
74
74
|
"@types/node": "26.6.6",
|
|
75
75
|
"@types/react": "19.3.0",
|
|
@@ -86,19 +86,19 @@
|
|
|
86
86
|
"lint-staged": "17.6.0",
|
|
87
87
|
"oxfmt": "0.76.0",
|
|
88
88
|
"oxlint": "1.91.0",
|
|
89
|
-
"oxlint-tsgolint": "7.0.
|
|
89
|
+
"oxlint-tsgolint": "7.0.2006",
|
|
90
90
|
"playwright": "1.64.1",
|
|
91
91
|
"publint": "0.3.25",
|
|
92
92
|
"react": "19.3.1",
|
|
93
93
|
"react-dom": "19.3.1",
|
|
94
94
|
"react-native": "0.88.1",
|
|
95
|
-
"react-native-gesture-handler": "3.
|
|
95
|
+
"react-native-gesture-handler": "3.5.0",
|
|
96
96
|
"react-native-reanimated": "4.7.1",
|
|
97
97
|
"react-native-safe-area-context": "5.11.1",
|
|
98
|
-
"react-native-svg": "15.16.
|
|
98
|
+
"react-native-svg": "15.16.1",
|
|
99
99
|
"react-native-web": "0.21.4",
|
|
100
100
|
"react-native-worklets": "0.13.1",
|
|
101
|
-
"storybook": "10.6.
|
|
101
|
+
"storybook": "10.6.6",
|
|
102
102
|
"test-renderer": "1.3.1",
|
|
103
103
|
"tsdown": "0.23.5",
|
|
104
104
|
"typescript": "6.0.3",
|
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"react": ">=19.2.0",
|
|
115
115
|
"react-native": ">=0.86.0",
|
|
116
116
|
"react-native-gesture-handler": "^2.32.0 || ^3.0.0",
|
|
117
|
+
"react-native-keyboard-controller": ">=1.22.0",
|
|
117
118
|
"react-native-reanimated": "^4.5.0",
|
|
118
119
|
"react-native-safe-area-context": "^5.0.0",
|
|
119
120
|
"react-native-svg": "^15.15.0",
|
|
@@ -131,6 +132,9 @@
|
|
|
131
132
|
},
|
|
132
133
|
"expo-image-picker": {
|
|
133
134
|
"optional": true
|
|
135
|
+
},
|
|
136
|
+
"react-native-keyboard-controller": {
|
|
137
|
+
"optional": true
|
|
134
138
|
}
|
|
135
139
|
},
|
|
136
140
|
"overrides": {
|