@kanso-labs/kanso-ui 0.45.21 → 0.45.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badge/index.js.map +1 -1
- package/dist/button/context.js.map +1 -1
- package/dist/button/group.js.map +1 -1
- package/dist/button/hooks.js.map +1 -1
- package/dist/button/index.d.ts +3 -4
- package/dist/button/index.js.map +1 -1
- package/dist/button/styles.js.map +1 -1
- package/dist/button/toggle.js.map +1 -1
- package/dist/calendar/index.js +119 -11
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +19 -1
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +1 -2
- package/dist/carousel/arrangement.js.map +1 -1
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/label.js.map +1 -1
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/empty.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/styles.js.map +1 -1
- package/dist/collection/text.js.map +1 -1
- package/dist/color-scheme.d.ts +1 -2
- package/dist/color-scheme.js.map +1 -1
- package/dist/components/app-bar/index.d.ts +9 -4
- package/dist/components/app-bar/index.js +123 -73
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +1 -2
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +1 -2
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +1 -2
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.d.ts +1 -2
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.d.ts +1 -2
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +1 -2
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +4 -5
- package/dist/components/calendar/index.js +8 -19
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.d.ts +1 -2
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +22 -4
- package/dist/components/carousel/index.js +26 -14
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +1 -2
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +1 -2
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -2
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +1 -2
- package/dist/components/chip-group/index.js +3 -0
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/code/index.d.ts +1 -2
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +1 -2
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +1 -2
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +1 -2
- package/dist/components/color-picker/index.js +64 -46
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-slider/index.d.ts +1 -2
- package/dist/components/color-slider/index.js.map +1 -1
- package/dist/components/color-swatch/index.d.ts +1 -2
- package/dist/components/color-swatch/index.js +20 -16
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.d.ts +1 -2
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/color-wheel/index.d.ts +1 -2
- package/dist/components/color-wheel/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +1 -2
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/container/index.d.ts +1 -2
- package/dist/components/container/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +1 -2
- package/dist/components/copy-field/index.js +1 -0
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +1 -2
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +1 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +1 -2
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +1 -2
- package/dist/components/date-range-picker/index.js +165 -81
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +1 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +1 -2
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/disclosure-group/index.d.ts +1 -2
- package/dist/components/disclosure-group/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +1 -2
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/drop-zone/styles.js.map +1 -1
- package/dist/components/fab/index.d.ts +1 -2
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/fab-menu/index.d.ts +1 -2
- package/dist/components/fab-menu/index.js.map +1 -1
- package/dist/components/feed/index.d.ts +1 -2
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/form/index.d.ts +1 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +1 -2
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/keycap/index.d.ts +1 -2
- package/dist/components/keycap/index.js.map +1 -1
- package/dist/components/link/index.d.ts +1 -2
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list/index.d.ts +1 -2
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +1 -2
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-detail/index.d.ts +1 -2
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/list-item/index.d.ts +1 -2
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/loading-indicator/index.d.ts +1 -2
- package/dist/components/loading-indicator/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +1 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +1 -2
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-bar/index.d.ts +1 -2
- package/dist/components/navigation-bar/index.js.map +1 -1
- package/dist/components/navigation-rail/index.d.ts +1 -2
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +1 -2
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +1 -2
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +1 -2
- package/dist/components/popover/index.js +14 -4
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +1 -2
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +1 -2
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +1 -2
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +1 -2
- package/dist/components/range-calendar/index.js +53 -80
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +1 -2
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-view/index.d.ts +1 -2
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +1 -2
- package/dist/components/segmented-button/index.js +261 -145
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.d.ts +1 -2
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +1 -2
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +1 -2
- package/dist/components/sheet/index.js +149 -82
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +1 -2
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +1 -2
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/split-button/index.d.ts +1 -2
- package/dist/components/split-button/index.js.map +1 -1
- package/dist/components/stack/index.d.ts +1 -2
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/supporting-pane/index.d.ts +1 -2
- package/dist/components/supporting-pane/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +1 -2
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/table/index.d.ts +1 -2
- package/dist/components/table/index.js +251 -123
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +1 -2
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +1 -2
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/text/index.d.ts +1 -2
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +1 -2
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +1 -2
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +1 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/time-picker/index.d.ts +1 -2
- package/dist/components/time-picker/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +1 -2
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +1 -2
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +1 -2
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +1 -2
- package/dist/components/tree/index.js.map +1 -1
- package/dist/control/index.js.map +1 -1
- package/dist/control/styles.js.map +1 -1
- package/dist/drag/hooks.d.ts +1 -2
- package/dist/drag/hooks.js.map +1 -1
- package/dist/drag/index.js.map +1 -1
- package/dist/drag/styles.js.map +1 -1
- package/dist/fab/styles.js.map +1 -1
- package/dist/field/index.d.ts +3 -4
- package/dist/field/index.js.map +1 -1
- package/dist/field/press.js.map +1 -1
- package/dist/field/root.js.map +1 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/glyphs/styles.js.map +1 -1
- package/dist/hooks/useAppBarScroll.d.ts +1 -2
- package/dist/hooks/useAppBarScroll.js.map +1 -1
- package/dist/hooks/useBottomEdge.js.map +1 -1
- package/dist/hooks/useClippedTitle.js.map +1 -1
- package/dist/hooks/useImageLoadingStatus.js.map +1 -1
- package/dist/hooks/useRipple.js +3 -2
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/hooks/useScrollStop.js.map +1 -1
- package/dist/hooks/useToggleGroupDisabled.js.map +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/indicator/index.js.map +1 -1
- package/dist/indicator/styles.d.ts +1 -2
- package/dist/indicator/styles.js.map +1 -1
- package/dist/kanso-ui-core/defaults-DMH0HWCw.d.ts +1 -2
- package/dist/keycap/context.js.map +1 -1
- package/dist/layout.d.ts +1 -2
- package/dist/layout.js.map +1 -1
- package/dist/mark/index.js.map +1 -1
- package/dist/mark/initials.js.map +1 -1
- package/dist/mark/styles.js.map +1 -1
- package/dist/navigation/context.js.map +1 -1
- package/dist/navigation/index.d.ts +2 -3
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js.map +1 -1
- package/dist/overlay/index.js.map +1 -1
- package/dist/render/aria.js.map +1 -1
- package/dist/render/content.js.map +1 -1
- package/dist/render/name.d.ts +1 -2
- package/dist/render/ref.js.map +1 -1
- package/dist/render/useRender.d.ts +1 -2
- package/dist/render/useRender.js.map +1 -1
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/index.js +2 -1
- package/dist/segments/index.js.map +1 -1
- package/dist/segments/styles.js +5 -1
- package/dist/segments/styles.js.map +1 -1
- package/dist/styles/chequer.js.map +1 -1
- package/dist/styles/color.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles/icon-button.js.map +1 -1
- package/dist/styles/merge.js.map +1 -1
- package/dist/styles/overlay.d.ts +2 -3
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles/picker.js.map +1 -1
- package/dist/styles/ripple.js.map +1 -1
- package/dist/styles/scheme.js.map +1 -1
- package/dist/styles.css +40 -8
- package/dist/swatch/index.js +19 -0
- package/dist/swatch/index.js.map +1 -0
- package/dist/theme-scope.d.ts +1 -2
- package/dist/theme-scope.js.map +1 -1
- package/dist/tokens/design.tokens.stylex.js.map +1 -1
- package/dist/tokens/values.js.map +1 -1
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","CalendarDate","ReactElement","RefAttributes","DateValue","RangeCalendarProps","RACRangeCalendarProps","stylex","CalendarCell","RACCalendarCell","CalendarGrid","RACCalendarGrid","CalendarGridBody","RACCalendarGridBody","RangeCalendar","RACRangeCalendar","CalendarFrame","CalendarGridHeader","monthOffsets","calendarStyles","dateLayers","focus","mergeStatefulStyles","className","T","showMonthYearMenus","style","Omit","cellClassName","state","isDisabled","isHovered","isPressed","isSelected","isSelectionEnd","isSelectionStart","isToday","isUnavailable","isEnd","props","cell","ring","cellToday","cellInRange","cellRangeStart","cellRangeEnd","cellSelected","selectedHovered","inRangeHovered","plainHovered","selectedPressed","inRangePressed","plainPressed","cellUnavailable","cellDisabled","gridCell","date","t0","$","T0","T1","t1","t2","t3","t4","t5","t6","t7","undefined","root","visibleDuration","months","Symbol","for","map","_temp","t8","t9","offset","month","grid","stylex.props","RACCalendarCell","RangeCalendar","_c","props","RACRangeCalendar","RACCalendarGrid","CalendarGridHeader","RACCalendarGridBody"],"sources":["../../../src/components/range-calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { DateValue, RangeCalendarProps as RACRangeCalendarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CalendarCell as RACCalendarCell, CalendarGrid as RACCalendarGrid, CalendarGridBody as RACCalendarGridBody, RangeCalendar as RACRangeCalendar } from 'react-aria-components';\nimport { CalendarFrame, CalendarGridHeader } from '../../calendar';\nimport { monthOffsets } from '../../calendar/months';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's calendar again, picking two dates rather than one.\n// Every part it draws is Calendar's, from `src/calendar` — the container, the\n// grid, the weekday row, the chevrons and the date circle — so the two cannot\n// come apart.\n//\n// What a range adds is the band between its two ends. The docked token set\n// stops at the selected date, so the band's colours are the modal date\n// picker's range-selection tokens — the secondary container, one step down\n// from the primary the two ends take — and its reasons are in\n// `src/calendar/styles.ts` where it is defined.\n//\n// Two things follow from drawing a band across a grid whose cells are spaced\n// apart.\n//\n// **The band is square and the ends are round.** A range of consecutive days\n// reads as one shape rather than a row of circles, and the first and last day\n// round only their outer edge, which is what makes the band begin and end at\n// a circle.\n//\n// **The band fills the whole of each day's 48dp.** A day in the range drops\n// the 4dp margin either side that every other date keeps and takes the full\n// width of its cell, so one day's band meets the next one's. Without it the\n// band arrives as a dashed run of separate blocks.\n\ntype RangeCalendarProps<T extends DateValue = DateValue> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACRangeCalendarProps<T>['className'];\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as `Calendar`'s does. The\n * year list runs a century either side of the year shown, or to\n * `minValue` and `maxValue` where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACRangeCalendarProps<T>['style'];\n} & Omit<RACRangeCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n// A date's classes, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order is what makes a range read as one shape. Every selected day takes\n// the band; the two ends then take the circle over it, and round the outer\n// edge the band does not continue past. The hover and pressed layers come\n// next, each written for the ground under it — the circle, the band, or\n// nothing — a press over a hover. `unavailable` comes after those, so a\n// ruled-out day inside a range keeps the band and takes the strikethrough\n// over it. `disabled` is last of all, and StyleX replaces a property whole,\n// so it takes the branches above it with it.\nfunction cellClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n isSelectionEnd: boolean;\n isSelectionStart: boolean;\n isToday: boolean;\n isUnavailable: boolean;\n}) {\n const isEnd = state.isSelected && (state.isSelectionStart || state.isSelectionEnd);\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellInRange, state.isSelected && state.isSelectionStart && calendarStyles.cellRangeStart, state.isSelected && state.isSelectionEnd && calendarStyles.cellRangeEnd, isEnd && calendarStyles.cellSelected, state.isHovered && (isEnd ? dateLayers.selectedHovered : state.isSelected ? dateLayers.inRangeHovered : dateLayers.plainHovered), state.isPressed && (isEnd ? dateLayers.selectedPressed : state.isSelected ? dateLayers.inRangePressed : dateLayers.plainPressed), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled).className ?? '';\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <RACCalendarCell className={cellClassName} date={date} />;\n}\n\n/**\n * A calendar for picking a range of dates. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as a `{ start, end }` pair of `@internationalized/date` values\n * from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <RangeCalendar\n * aria-label=\"Label\"\n * defaultValue={{\n * start: new CalendarDate(2026, 9, 8),\n * end: new CalendarDate(2026, 9, 15),\n * }}\n * />\n * ```\n *\n * The two ends take the circle a selected date takes in `Calendar`, and the\n * days between them a band in the secondary container. `minValue`,\n * `maxValue`, `isDateUnavailable` and `visibleDuration` are the same props\n * `Calendar` takes, and `allowsNonContiguousRanges` lets a range skip the\n * dates ruled out inside it rather than stopping at the first.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction RangeCalendar<T extends DateValue>({\n showMonthYearMenus = false,\n ...props\n}: RangeCalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACRangeCalendar<T> {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <div {...stylex.props(calendarStyles.months)}>\n {monthOffsets(props.visibleDuration?.months ?? 1).map(offset => <div key={offset.months} {...stylex.props(calendarStyles.month)}>\n <RACCalendarGrid offset={offset} {...stylex.props(calendarStyles.grid)}>\n <CalendarGridHeader />\n <RACCalendarGridBody>{gridCell}</RACCalendarGridBody>\n </RACCalendarGrid>\n </div>)}\n </div>\n </CalendarFrame>\n </RACRangeCalendar>;\n}\nexport type { RangeCalendarProps };\nexport default RangeCalendar;"],"mappings":";;;;;;;;;;;AAoEA,SAAS6B,cAAcC,OASpB;CACD,MAAMS,QAAQT,MAAMI,eAAeJ,MAAMM,oBAAoBN,MAAMK;CACnE,OAAO3B,MAAaY,eAAeqB,MAAMnB,MAAMoB,MAAMZ,MAAMO,WAAWjB,eAAeuB,WAAWb,MAAMI,cAAcd,eAAewB,aAAad,MAAMI,cAAcJ,MAAMM,oBAAoBhB,eAAeyB,gBAAgBf,MAAMI,cAAcJ,MAAMK,kBAAkBf,eAAe0B,cAAcP,SAASnB,eAAe2B,cAAcjB,MAAME,cAAcO,QAAQlB,WAAW2B,kBAAkBlB,MAAMI,aAAab,WAAW4B,iBAAiB5B,WAAW6B,eAAepB,MAAMG,cAAcM,QAAQlB,WAAW8B,kBAAkBrB,MAAMI,aAAab,WAAW+B,iBAAiB/B,WAAWgC,eAAevB,MAAMQ,iBAAiBlB,eAAekC,iBAAiBxB,MAAMC,cAAcX,eAAemC,YAAY,CAAC,CAAC/B,aAAa;AACvsB;AACA,SAASgC,SAASC,MAAkC;CAClD,OAAO,oBAAC0B,cAAD;EAAiB,WAAWtD;EAAqB4B;CAAK,CAAA;AAC/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAA1C,gBAAA2C,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EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAkB;CAAA,IAAAlB,EAAA,QAAAC,MAAAD,EAAA,QAAAK,MAAAL,EAAA,QAAAM,MAAAN,EAAA,QAAAS,IAAA;EARRS,KAAA,oBAAC,IAAD;GAAuB,QAAAb;GAAwDtC,oBAAAA;GAC7E0C,UAAAA;EADY,CAAA;EASET,EAAA,MAAAC;EAAAD,EAAA,MAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAS;EAAAT,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,IAAAmB;CAAA,IAAAnB,EAAA,QAAAE,MAAAF,EAAA,QAAAO,MAAAP,EAAA,QAAAQ,MAAAR,EAAA,QAAAkB,IAAA;EAVbC,KAAA,oBAAC,IAAD;GAAiB,GAAQtC;GAAK,GAAM2B;GACvCU,UAAAA;EADoB,CAAA;EAWHlB,EAAA,MAAAE;EAAAF,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAkB;EAAAlB,EAAA,MAAAmB;CAAA,OAAAA,KAAAnB,EAAA;CAAA,OAXdmB;AAWc;AAfvB,SAAAF,MAAAG,QAAA;CAAA,OAO0E,oBAAA,OAAA;EAAuB,GAAMvE,MAAaY,eAAc4D,KAAM;EAC1H,UAAA,qBAACQ,cAAD;GAAyBT;GAAM,GAAMvE,MAAaY,eAAc6D,IAAK;GAArE,UAAA,CACE,oBAACQ,sBAAD,CAAmB,CAAA,GACnB,oBAACC,kBAAD,EAAA,UAAsBlC,SAAF,CAAA,CAFN;;CAIZ,GALkEuB,OAAMP,MAKxE;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","RangeCalendar","RACRangeCalendar","calendarStyles","dateLayers","focus","mergeStatefulStyles","className","showMonthYearMenus","cellClassName","state","isDisabled","isHovered","isPressed","isSelected","isSelectionEnd","isSelectionStart","isToday","isUnavailable","isEnd","props","cell","ring","cellToday","cellInRange","cellRangeStart","cellRangeEnd","cellSelected","selectedHovered","inRangeHovered","plainHovered","selectedPressed","inRangePressed","plainPressed","cellUnavailable","cellDisabled","gridCell","date","t0","$","T0","t1","t2","t3","t4","undefined","root","visibleDuration","months","t5","t6","t7","RACCalendarCell"],"sources":["../../../src/components/range-calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { DateValue, RangeCalendarProps as RACRangeCalendarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CalendarCell as RACCalendarCell, RangeCalendar as RACRangeCalendar } from 'react-aria-components';\nimport { CalendarFrame, CalendarMonths } from '../../calendar';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's calendar again, picking two dates rather than one.\n// Every part it draws is Calendar's, from `src/calendar` — the container, the\n// grid, the weekday row, the chevrons and the date circle — so the two cannot\n// come apart.\n//\n// What a range adds is the band between its two ends. The docked token set\n// stops at the selected date, so the band's colours are the modal date\n// picker's range-selection tokens — the secondary container, one step down\n// from the primary the two ends take — and its reasons are in\n// `src/calendar/styles.ts` where it is defined.\n//\n// Two things follow from drawing a band across a grid whose cells are spaced\n// apart.\n//\n// **The band is square and the ends are round.** A range of consecutive days\n// reads as one shape rather than a row of circles, and the first and last day\n// round only their outer edge, which is what makes the band begin and end at\n// a circle.\n//\n// **The band fills the whole of each day's 48dp.** A day in the range drops\n// the 4dp margin either side that every other date keeps and takes the full\n// width of its cell, so one day's band meets the next one's. Without it the\n// band arrives as a dashed run of separate blocks.\n\ntype RangeCalendarProps<T extends DateValue = DateValue> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACRangeCalendarProps<T>['className'];\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as `Calendar`'s does. The\n * year list runs a century either side of the year shown, or to\n * `minValue` and `maxValue` where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACRangeCalendarProps<T>['style'];\n} & Omit<RACRangeCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n// A date's classes, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order is what makes a range read as one shape. Every selected day takes\n// the band; the two ends then take the circle over it, and round the outer\n// edge the band does not continue past. The hover and pressed layers come\n// next, each written for the ground under it — the circle, the band, or\n// nothing — a press over a hover. `unavailable` comes after those, so a\n// ruled-out day inside a range keeps the band and takes the strikethrough\n// over it. `disabled` is last of all, and StyleX replaces a property whole,\n// so it takes the branches above it with it.\nfunction cellClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n isSelectionEnd: boolean;\n isSelectionStart: boolean;\n isToday: boolean;\n isUnavailable: boolean;\n}) {\n const isEnd = state.isSelected && (state.isSelectionStart || state.isSelectionEnd);\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellInRange, state.isSelected && state.isSelectionStart && calendarStyles.cellRangeStart, state.isSelected && state.isSelectionEnd && calendarStyles.cellRangeEnd, isEnd && calendarStyles.cellSelected, state.isHovered && (isEnd ? dateLayers.selectedHovered : state.isSelected ? dateLayers.inRangeHovered : dateLayers.plainHovered), state.isPressed && (isEnd ? dateLayers.selectedPressed : state.isSelected ? dateLayers.inRangePressed : dateLayers.plainPressed), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled).className ?? '';\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <RACCalendarCell className={cellClassName} date={date} />;\n}\n\n/**\n * A calendar for picking a range of dates. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as a `{ start, end }` pair of `@internationalized/date` values\n * from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <RangeCalendar\n * aria-label=\"Label\"\n * defaultValue={{\n * start: new CalendarDate(2026, 9, 8),\n * end: new CalendarDate(2026, 9, 15),\n * }}\n * />\n * ```\n *\n * The two ends take the circle a selected date takes in `Calendar`, and the\n * days between them a band in the secondary container. `minValue`,\n * `maxValue`, `isDateUnavailable` and `visibleDuration` are the same props\n * `Calendar` takes, and `allowsNonContiguousRanges` lets a range skip the\n * dates ruled out inside it rather than stopping at the first.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction RangeCalendar<T extends DateValue>({\n showMonthYearMenus = false,\n ...props\n}: RangeCalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACRangeCalendar<T> {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <CalendarMonths months={props.visibleDuration?.months ?? 1}>\n {gridCell}\n </CalendarMonths>\n </CalendarFrame>\n </RACRangeCalendar>;\n}\nexport type { RangeCalendarProps };\nexport default RangeCalendar;"],"mappings":";;;;;;;;;;AAmEA,SAASU,cAAcC,OASpB;CACD,MAAMS,QAAQT,MAAMI,eAAeJ,MAAMM,oBAAoBN,MAAMK;CACnE,OAAOf,MAAaG,eAAekB,MAAMhB,MAAMiB,MAAMZ,MAAMO,WAAWd,eAAeoB,WAAWb,MAAMI,cAAcX,eAAeqB,aAAad,MAAMI,cAAcJ,MAAMM,oBAAoBb,eAAesB,gBAAgBf,MAAMI,cAAcJ,MAAMK,kBAAkBZ,eAAeuB,cAAcP,SAAShB,eAAewB,cAAcjB,MAAME,cAAcO,QAAQf,WAAWwB,kBAAkBlB,MAAMI,aAAaV,WAAWyB,iBAAiBzB,WAAW0B,eAAepB,MAAMG,cAAcM,QA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A,OAAA/B,sBAAA+B,EAAA,OAAAI,MAAAJ,EAAA,QAAAU,IAAA;EAHnBC,KAAA,oBAAC,eAAD;GAAuB,QAAAP;GAAwDnC;GAC7EyC,UAAAA;EADY,CAAA;EAIEV,EAAA,KAAA/B;EAAA+B,EAAA,KAAAI;EAAAJ,EAAA,MAAAU;EAAAV,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,QAAAC,MAAAD,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAW,IAAA;EALbC,KAAA,oBAAC,IAAD;GAAiB,GAAQ/B;GAAK,GAAMsB;GACvCQ,UAAAA;EADoB,CAAA;EAMHX,EAAA,MAAAC;EAAAD,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAW;EAAAX,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OANdY;AAMc"}
|
|
@@ -68,5 +68,4 @@ type SearchFieldProps$1 = {
|
|
|
68
68
|
* Material Design's search bar rather than the box of its text fields.
|
|
69
69
|
*/
|
|
70
70
|
declare function SearchField$1({ clearLabel, description, enterKeyHint, error, inputRef, isDisabled, label, placeholder, ...props }: RefAttributes<HTMLDivElement> & SearchFieldProps$1): import("react").JSX.Element;
|
|
71
|
-
export { type SearchFieldProps$1 as SearchFieldProps, SearchField$1 as default };
|
|
72
|
-
//# sourceMappingURL=index.d.ts.map
|
|
71
|
+
export { type SearchFieldProps$1 as SearchFieldProps, SearchField$1 as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","Ref","RefAttributes","SearchFieldProps","RACSearchFieldProps","SearchFieldRenderProps","stylex","FieldInputContext","Label","SearchField","RACSearchField","useSlottedContext","VisuallyHidden","FieldInput","FieldMessage","focusesControl","fieldStyles","invalidFrom","useFieldValidationBehavior","CloseGlyph","SearchGlyph","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","IconButton","FORCED_COLORS","HOVER_CAPABLE","clearLabel","description","enterKeyHint","error","inputRef","HTMLInputElement","label","placeholder","Omit","fieldContent","state","undefined","className","isInvalid","isDisabled","isEmpty","t0","$","t1","props","validationBehavior","inherited","T0","t2","t3","t4","root","t5","t6","SearchField","_c","props","RACSearchField","stylex.props"],"sources":["../../../src/components/search-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport type { SearchFieldProps as RACSearchFieldProps, SearchFieldRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { FieldInputContext, Label, SearchField as RACSearchField, useSlottedContext, VisuallyHidden } from 'react-aria-components';\nimport { FieldInput, FieldMessage } from '../../field';\nimport { focusesControl } from '../../field/press';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CloseGlyph, SearchGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// A pointer that can hover: a mouse or a trackpad, not a finger. The bar is a\n// plain element around the input rather than a part React Aria hosts, so its\n// hover layer is a pseudo-class, and Chromium leaves `:hover` on whatever a\n// touch last tapped. Inside this query a touch screen draws no hover at all;\n// a touchscreen laptop still matches it for its trackpad.\nconst HOVER_CAPABLE = '@media (hover: hover)';\n\n// The search page's search bar, on its own: a 56dp container with a full\n// corner on surface container high, a 24dp magnifier in on surface at the\n// start, the supporting text in on surface variant and the input text in on\n// surface, both body-large, and a trailing icon button in on surface\n// variant that clears the field while it holds anything. The page's\n// 16dp of padding is to a 48dp tap target, and the icon sits 12dp inside\n// that, so the magnifier starts 28dp in and the text 4dp past the target,\n// at 68dp; the clear button is the medium icon button, 40dp around a 24dp\n// icon, set 4dp in from the padding so its icon ends 28dp from the end. The\n// container follows its own width up to the page's 720dp; the page's 360dp\n// floor is left to the call site, since a phone's width less its margins is\n// under it. The list of suggestions the page draws under the bar is\n// Autocomplete's, and nothing here.\n//\n// The page gives the container level 3 elevation, and the bar casts no\n// shadow for it. Surface container high is the tone that level stands for,\n// and Google's own search bars draw it so: Compose's defaults give the bar\n// a shadow elevation of level 0, and the Android library keeps its 6dp but\n// makes the shadow transparent. The docked SearchView, which floats over\n// the page, is what casts level 3.\n//\n// The page's hovered and pressed states are on surface state layers over\n// the container, at the opacities the tokens hold. It names a focused state\n// and draws nothing for it, so the bar takes the 2dp primary ring the text\n// fields page gives a focused field, drawn inside the pill as a shadow for\n// the reason the chrome's box draws its underline that way: a shadow\n// changes nothing about the bar's size, and clipped to the corner it stays\n// inside the pill. It shows on any focus, as the underline does; a text\n// control matches `:focus-visible` on every focus anyway. Disabled takes\n// the chrome's dimmed container and content, since the page has no disabled\n// state and the sibling fields already agree on one.\n//\n// React Aria's `SearchField` is the root, a div holding the label,\n// description and error slots and the clear button's context; the bar is\n// its own element around the field chrome's input, and the label is\n// visually hidden, since the bar carries no label of its own and the\n// supporting text is what a person reads.\n\ntype SearchFieldProps = {\n /**\n * The name of the button that clears the field, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Clear search\" in\n * English.\n */\n clearLabel?: string;\n /**\n * A hint shown under the bar. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The action an on-screen keyboard labels its Enter key with. A search\n * field asks for Search, which iOS otherwise shows only for a search input\n * inside a form with an action, so a field submitted through `onSubmit`\n * alone gets it too. Inside an `Autocomplete` the field takes the Go key\n * React Aria gives it there, for the option Enter picks.\n *\n * @default 'search'\n */\n enterKeyHint?: RACSearchFieldProps['enterKeyHint'];\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and `aria-invalid` follow\n * from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\n /**\n * What the field searches, for a screen reader. The bar draws no label,\n * so this is read and never shown; `placeholder` is what is seen.\n *\n * Write it so it contains the placeholder's words — `Search` beside a\n * `Search` placeholder, or `Search people`. The placeholder is the only\n * text a sighted reader has to call the field by, so it is what someone\n * driving the page by voice says, and a name that does not contain it\n * leaves them nothing to say.\n */\n label: string;\n /** The supporting text in the empty bar, which is what a person reads. */\n placeholder?: string;\n} & Omit<RACSearchFieldProps, 'children' | 'enterKeyHint' | 'isInvalid' | 'validationBehavior'>;\n\n// What the bar draws, from the field's render state: the clear button only\n// while the field holds something, and the error ring while it is invalid. Built by a call rather than written\n// inline at the prop, which is what react-perf's no-new-function-as-prop is\n// after; the React Compiler memoises the result on its inputs.\n//\n// A press anywhere on the bar focuses the input, as a press anywhere on the\n// box of every other field does. The bar is 56dp and the input's line 24dp\n// of it, so the magnifier, the padding at either end and the strips above\n// and below the text took a press, darkened the bar for it, and focused\n// nothing. A press on the input itself or on the clear button is left to\n// them, and a disabled field takes none.\nfunction fieldContent(label: string, placeholder: string | undefined, clearLabel: string | undefined, description: string | undefined, error: string | undefined, inputRef: Ref<HTMLInputElement> | undefined) {\n return (state: SearchFieldRenderProps) => <>\n <VisuallyHidden>\n <Label>{label}</Label>\n </VisuallyHidden>\n <div onPointerDown={focusesControl(undefined)} {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x19i8hm1 x1gnnqk1 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 x1bll8u6 x19irva8\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n }\n }[!!state.isInvalid << 1 | !!state.isDisabled << 0]}>\n <SearchGlyph {...{\n 0: {\n className: \"xxk0z11 x139gbkf x1lliihq x2lah0s xvy4d1p\"\n },\n 1: {\n className: \"xxk0z11 x1lliihq x2lah0s xvy4d1p x1heor9g\"\n }\n }[!!state.isDisabled << 0]} />\n <FieldInput placeholder={placeholder} ref={inputRef} className=\"x1hcrkkg xzwh6sb xjyslct xmper1u x1iyjqo2 xeuugli\" />\n {state.isEmpty ? null : <IconButton aria-label={clearLabel} className=\"x15ir4sr\">\n <CloseGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>}\n </div>\n <FieldMessage description={description} error={error} />\n </>;\n}\n\n/**\n * A search bar: a keyword typed into a pill, submitted with Enter and\n * cleared with Escape or its button. Its value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep\n * its own; `onSubmit` is handed the value on Enter and `onClear` is called\n * when it is emptied.\n *\n * ```tsx\n * <SearchField label=\"Search\" onSubmit={search} placeholder=\"Search\" />\n * ```\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions. The input and the message are\n * drawn as every field in the library draws them; the pill around them is\n * Material Design's search bar rather than the box of its text fields.\n */\nfunction SearchField({\n clearLabel,\n description,\n enterKeyHint,\n error,\n inputRef,\n isDisabled = false,\n label,\n placeholder,\n ...props\n}: RefAttributes<HTMLDivElement> & SearchFieldProps) {\n const validationBehavior = useFieldValidationBehavior();\n // An Autocomplete hands its input `go` through this context, and a prop\n // written here would replace it, so the default steps aside for it; an\n // undefined prop leaves the context's value standing.\n const inherited = useSlottedContext(FieldInputContext)?.enterKeyHint;\n return <RACSearchField enterKeyHint={enterKeyHint ?? (inherited === undefined ? 'search' : undefined)} isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {fieldContent(label, placeholder, clearLabel, description, error, inputRef)}\n </RACSearchField>;\n}\nexport type { SearchFieldProps };\nexport default SearchField;"],"mappings":";;;;;;;;;;;;AAiIA,SAASyC,aAAaH,OAAeC,aAAiCP,YAAgCC,aAAiCE,OAA2BC,UAA6C;CAC7M,QAAQM,UAAkC,qBAAA,UAAA,EAAA,UAAA;EACtC,oBAAC,gBAAD,EAAA,UACE,oBAAC,OAAD,EAAA,UAAQJ,MAAa,CAAA,EACP,CAAA;EAChB,qBAAC,OAAD;GAAK,eAAetB,eAAe2B,KAAAA,CAAS;GAAG,GAAI;IACnD,GAAG,EACDC,WAAW,gRACb;IACA,GAAG,EACDA,WAAW,gRACb;IAC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,OAAAhB,eAAAgB,EAAA,OAAAd,SAAAc,EAAA,OAAAb,YAAAa,EAAA,OAAAX,SAAAW,EAAA,OAAAV,aAAA;EAC1QoB,KAAAlB,aAAaH,OAAOC,aAAaP,YAAYC,aAAaE,OAAOC,QAAQ;EAACa,EAAA,KAAAjB;EAAAiB,EAAA,KAAAhB;EAAAgB,EAAA,KAAAd;EAAAc,EAAA,KAAAb;EAAAa,EAAA,KAAAX;EAAAW,EAAA,KAAAV;EAAAU,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAK,MAAAL,EAAA,QAAAH,cAAAG,EAAA,QAAAE,WAAAF,EAAA,QAAAM,MAAAN,EAAA,QAAAO,MAAAP,EAAA,QAAAQ,MAAAR,EAAA,QAAAU,MAAAV,EAAA,QAAAG,oBAAA;EADxEQ,KAAA,oBAAC,IAAD;GAA8B,cAAAL;GAA8ET;GAAuB,WAAAU;GAAwCJ;GAAkB,GAAMD;GAAK,GAAMM;GAChNE,UAAAA;EADiB,CAAA;EAEHV,EAAA,KAAAK;EAAAL,EAAA,MAAAH;EAAAG,EAAA,MAAAE;EAAAF,EAAA,MAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAU;EAAAV,EAAA,MAAAG;EAAAH,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OAFZW;AAEY"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","FieldInputContext","SearchField","RACSearchField","useSlottedContext","focusesControl","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","clearLabel","description","enterKeyHint","error","inputRef","label","placeholder","fieldContent","state","undefined","className","isInvalid","isDisabled","isEmpty","t0","$","t1","props","validationBehavior","inherited","T0","t2","t3","t4","root","t5","t6"],"sources":["../../../src/components/search-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport type { SearchFieldProps as RACSearchFieldProps, SearchFieldRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { FieldInputContext, Label, SearchField as RACSearchField, useSlottedContext, VisuallyHidden } from 'react-aria-components';\nimport { FieldInput, FieldMessage } from '../../field';\nimport { focusesControl } from '../../field/press';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CloseGlyph, SearchGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// A pointer that can hover: a mouse or a trackpad, not a finger. The bar is a\n// plain element around the input rather than a part React Aria hosts, so its\n// hover layer is a pseudo-class, and Chromium leaves `:hover` on whatever a\n// touch last tapped. Inside this query a touch screen draws no hover at all;\n// a touchscreen laptop still matches it for its trackpad.\nconst HOVER_CAPABLE = '@media (hover: hover)';\n\n// The search page's search bar, on its own: a 56dp container with a full\n// corner on surface container high, a 24dp magnifier in on surface at the\n// start, the supporting text in on surface variant and the input text in on\n// surface, both body-large, and a trailing icon button in on surface\n// variant that clears the field while it holds anything. The page's\n// 16dp of padding is to a 48dp tap target, and the icon sits 12dp inside\n// that, so the magnifier starts 28dp in and the text 4dp past the target,\n// at 68dp; the clear button is the medium icon button, 40dp around a 24dp\n// icon, set 4dp in from the padding so its icon ends 28dp from the end. The\n// container follows its own width up to the page's 720dp; the page's 360dp\n// floor is left to the call site, since a phone's width less its margins is\n// under it. The list of suggestions the page draws under the bar is\n// Autocomplete's, and nothing here.\n//\n// The page gives the container level 3 elevation, and the bar casts no\n// shadow for it. Surface container high is the tone that level stands for,\n// and Google's own search bars draw it so: Compose's defaults give the bar\n// a shadow elevation of level 0, and the Android library keeps its 6dp but\n// makes the shadow transparent. The docked SearchView, which floats over\n// the page, is what casts level 3.\n//\n// The page's hovered and pressed states are on surface state layers over\n// the container, at the opacities the tokens hold. It names a focused state\n// and draws nothing for it, so the bar takes the 2dp primary ring the text\n// fields page gives a focused field, drawn inside the pill as a shadow for\n// the reason the chrome's box draws its underline that way: a shadow\n// changes nothing about the bar's size, and clipped to the corner it stays\n// inside the pill. It shows on any focus, as the underline does; a text\n// control matches `:focus-visible` on every focus anyway. Disabled takes\n// the chrome's dimmed container and content, since the page has no disabled\n// state and the sibling fields already agree on one.\n//\n// React Aria's `SearchField` is the root, a div holding the label,\n// description and error slots and the clear button's context; the bar is\n// its own element around the field chrome's input, and the label is\n// visually hidden, since the bar carries no label of its own and the\n// supporting text is what a person reads.\n\ntype SearchFieldProps = {\n /**\n * The name of the button that clears the field, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Clear search\" in\n * English.\n */\n clearLabel?: string;\n /**\n * A hint shown under the bar. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The action an on-screen keyboard labels its Enter key with. A search\n * field asks for Search, which iOS otherwise shows only for a search input\n * inside a form with an action, so a field submitted through `onSubmit`\n * alone gets it too. Inside an `Autocomplete` the field takes the Go key\n * React Aria gives it there, for the option Enter picks.\n *\n * @default 'search'\n */\n enterKeyHint?: RACSearchFieldProps['enterKeyHint'];\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and `aria-invalid` follow\n * from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\n /**\n * What the field searches, for a screen reader. The bar draws no label,\n * so this is read and never shown; `placeholder` is what is seen.\n *\n * Write it so it contains the placeholder's words — `Search` beside a\n * `Search` placeholder, or `Search people`. The placeholder is the only\n * text a sighted reader has to call the field by, so it is what someone\n * driving the page by voice says, and a name that does not contain it\n * leaves them nothing to say.\n */\n label: string;\n /** The supporting text in the empty bar, which is what a person reads. */\n placeholder?: string;\n} & Omit<RACSearchFieldProps, 'children' | 'enterKeyHint' | 'isInvalid' | 'validationBehavior'>;\n\n// What the bar draws, from the field's render state: the clear button only\n// while the field holds something, and the error ring while it is invalid. Built by a call rather than written\n// inline at the prop, which is what react-perf's no-new-function-as-prop is\n// after; the React Compiler memoises the result on its inputs.\n//\n// A press anywhere on the bar focuses the input, as a press anywhere on the\n// box of every other field does. The bar is 56dp and the input's line 24dp\n// of it, so the magnifier, the padding at either end and the strips above\n// and below the text took a press, darkened the bar for it, and focused\n// nothing. A press on the input itself or on the clear button is left to\n// them, and a disabled field takes none.\nfunction fieldContent(label: string, placeholder: string | undefined, clearLabel: string | undefined, description: string | undefined, error: string | undefined, inputRef: Ref<HTMLInputElement> | undefined) {\n return (state: SearchFieldRenderProps) => <>\n <VisuallyHidden>\n <Label>{label}</Label>\n </VisuallyHidden>\n <div onPointerDown={focusesControl(undefined)} {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x19i8hm1 x1gnnqk1 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 x1bll8u6 x19irva8\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n }\n }[!!state.isInvalid << 1 | !!state.isDisabled << 0]}>\n <SearchGlyph {...{\n 0: {\n className: \"xxk0z11 x139gbkf x1lliihq x2lah0s xvy4d1p\"\n },\n 1: {\n className: \"xxk0z11 x1lliihq x2lah0s xvy4d1p x1heor9g\"\n }\n }[!!state.isDisabled << 0]} />\n <FieldInput placeholder={placeholder} ref={inputRef} className=\"x1hcrkkg xzwh6sb xjyslct xmper1u x1iyjqo2 xeuugli\" />\n {state.isEmpty ? null : <IconButton aria-label={clearLabel} className=\"x15ir4sr\">\n <CloseGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>}\n </div>\n <FieldMessage description={description} error={error} />\n </>;\n}\n\n/**\n * A search bar: a keyword typed into a pill, submitted with Enter and\n * cleared with Escape or its button. Its value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep\n * its own; `onSubmit` is handed the value on Enter and `onClear` is called\n * when it is emptied.\n *\n * ```tsx\n * <SearchField label=\"Search\" onSubmit={search} placeholder=\"Search\" />\n * ```\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions. The input and the message are\n * drawn as every field in the library draws them; the pill around them is\n * Material Design's search bar rather than the box of its text fields.\n */\nfunction SearchField({\n clearLabel,\n description,\n enterKeyHint,\n error,\n inputRef,\n isDisabled = false,\n label,\n placeholder,\n ...props\n}: RefAttributes<HTMLDivElement> & SearchFieldProps) {\n const validationBehavior = useFieldValidationBehavior();\n // An Autocomplete hands its input `go` through this context, and a prop\n // written here would replace it, so the default steps aside for it; an\n // undefined prop leaves the context's value standing.\n const inherited = useSlottedContext(FieldInputContext)?.enterKeyHint;\n return <RACSearchField enterKeyHint={enterKeyHint ?? (inherited === undefined ? 'search' : undefined)} isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {fieldContent(label, placeholder, clearLabel, description, error, inputRef)}\n </RACSearchField>;\n}\nexport type { SearchFieldProps };\nexport default SearchField;"],"mappings":";;;;;;;;;;;;AAiIA,SAASkB,aAAaF,OAAeC,aAAiCN,YAAgCC,aAAiCE,OAA2BC,UAA6C;CAC7M,QAAQI,UAAkC,qBAAA,UAAA,EAAA,UAAA;EACtC,oBAAC,gBAAD,EAAA,UACE,oBAAC,OAAD,EAAA,UAAQH,MAAa,CAAA,EACP,CAAA;EAChB,qBAAC,OAAD;GAAK,eAAeV,eAAec,KAAAA,CAAS;GAAG,GAAI;IACnD,GAAG,EACDC,WAAW,gRACb;IACA,GAAG,EACDA,WAAW,gRACb;IACA,GAAG,EACDA,WAAW,8NACb;IACA,GAAG,EACDA,WAAW,8NACb;GACF,EAAE,CAAC,CAACF,MAAMG,aAAa,IAAI,CAAC,CAACH,MAAMI,cAAc;GAb/C,UAAA;IAcE,oBAAC,aAAD,EAAa,GAAI;KACjB,GAAG,EACDF,WAAW,4CACb;KACA,GAAG,EACDA,WAAW,4CACb;IACF,EAAE,CAAC,CAACF,MAAMI,cAAc,GAAG,CAAA;IACzB,oBAAC,YAAD;KAAyBN;K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;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAK,MAAAL,EAAA,QAAAH,cAAAG,EAAA,QAAAE,WAAAF,EAAA,QAAAM,MAAAN,EAAA,QAAAO,MAAAP,EAAA,QAAAQ,MAAAR,EAAA,QAAAU,MAAAV,EAAA,QAAAG,oBAAA;EADxEQ,KAAA,oBAAC,IAAD;GAA8B,cAAAL;GAA8ET;GAAuB,WAAAU;GAAwCJ;GAAkB,GAAMD;GAAK,GAAMM;GAChNE,UAAAA;EADiB,CAAA;EAEHV,EAAA,KAAAK;EAAAL,EAAA,MAAAH;EAAAG,EAAA,MAAAE;EAAAF,EAAA,MAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAU;EAAAV,EAAA,MAAAG;EAAAH,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OAFZW;AAEY"}
|
|
@@ -75,5 +75,4 @@ declare namespace SearchView {
|
|
|
75
75
|
* its `ref` too.
|
|
76
76
|
*/
|
|
77
77
|
declare function SearchViewContent<T extends object = object>({ backLabel, children, className, clearLabel, container, label, placeholder, ref, style, ...props }: RefAttributes<HTMLElement> & SearchViewContentProps<T>): import("react").JSX.Element;
|
|
78
|
-
export { SearchViewContent, type SearchViewContentProps, type SearchViewProps, SearchView as default };
|
|
79
|
-
//# sourceMappingURL=index.d.ts.map
|
|
78
|
+
export { SearchViewContent, type SearchViewContentProps, type SearchViewProps, SearchView as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","ClassNameOrFunction","DialogTriggerProps","PopoverRenderProps","SearchFieldRenderProps","StyleOrFunction","stylex","Dialog","DialogTrigger","Label","Popover","RACPopover","SearchField","RACSearchField","VisuallyHidden","AutocompleteProps","FieldInput","ArrowBackGlyph","CloseGlyph","useMessages","mergeStatefulStyles","overlay","colors","media","radii","shadows","sizing","spacing","Autocomplete","IconButton","SIDE_OFFSET","styles","view","kWkggS","kZKoxP","kaIpWk","kGVxlE","k1xSpc","kXwgrk","kzqmXN","krVfgx","k87sOh","kt4wiu","kLqNvP","kskxy","ks0D6T","kVQacm","kVAEAm","$$css","SearchViewContentProps","backLabel","children","className","clearLabel","container","Element","label","placeholder","style","Omit","T","SearchViewProps","fieldContent","state","isEmpty","SearchView","t0","$","props","t1","SearchViewContent","ref","messages","popup","t2","back","t3","Symbol","for","t4","t5","t6","t7","t8","t9","t10","t11","t12","Content","_c","props","stylex.props","RACSearchField","Autocomplete","RACPopover"],"sources":["../../../src/components/search-view/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DialogTriggerProps, PopoverRenderProps, SearchFieldRenderProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Dialog, DialogTrigger, Label, Popover as RACPopover, SearchField as RACSearchField, VisuallyHidden } from 'react-aria-components';\nimport type { AutocompleteProps } from '../autocomplete';\nimport { FieldInput } from '../../field';\nimport { ArrowBackGlyph, CloseGlyph } from '../../glyphs';\nimport { useMessages } from '../../i18n';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, radii, shadows, sizing, spacing } from '../../tokens/design.tokens.stylex';\nimport Autocomplete from '../autocomplete';\nimport IconButton from '../icon-button';\n\n// The search page's search view: what a search opens into. A header holds a\n// back button, the input and a clear button, over a 1dp divider in the\n// outline role, and the results run under it. Both of the page's forms are\n// surface container high, with the input in body-large on surface over a\n// supporting text in on surface variant, the back icon in on surface and the\n// clear icon in on surface variant.\n//\n// **Which form is the window's.** Below the medium breakpoint it is the\n// page's full-screen view: the whole window, square, with a 72dp header.\n// Above it, the docked view: dropped under what opened it, as wide as that\n// and held between the page's 360dp and 720dp, with a 28dp corner, a 56dp\n// header, results at least 240dp tall and the whole view no taller than two\n// thirds of the window, at elevation 3 — Compose's measurements for its\n// docked search bar, which the page draws without numbers. The swap is the\n// date pickers' — see `src/styles/picker.ts`: React Aria places the surface\n// with inline styles, which a class outranks only with `!important`, so the\n// full-screen form takes it on the edges, the position and the size, and\n// above the breakpoint this says nothing about any of them.\n//\n// **It is Autocomplete in an overlay.** The header's input and the results\n// are Autocomplete's two halves, so typing narrows the results as it does\n// anywhere else, and the results are the call site's ListBox or Menu.\n// Autocomplete still renders nothing of its own; this is the element around\n// it.\n//\n// **The header lines up with the search bar's.** The back button sits where\n// the bar's magnifier does, its icon 28dp in, and the text starts at 68dp,\n// as the bar's does; the clear button's icon ends 28dp from the end. So a\n// view opened from a bar puts its input where the bar's was.\n//\n// Composed as Popover is: `SearchView` holds the open state, a Button or\n// IconButton placed directly inside it opens the view, and\n// `SearchView.Content` is the view. The back button closes it, as Escape and\n// a press outside the docked view do.\n\n// The gap between what opened the view and the docked view, Popover's.\nconst SIDE_OFFSET = 8;\nconst styles = {\n view: {\n kWkggS: \"xvkjz1l\",\n kZKoxP: \"x16m7gpl\",\n kaIpWk: \"x19pkqky xxl0i3l\",\n kGVxlE: \"x1udv5rz xzvmenf\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzqmXN: \"xd4ksm1 x14gilbs\",\n krVfgx: \"xudx362\",\n k87sOh: \"xbvrusa\",\n kt4wiu: \"x1v0tev1\",\n kLqNvP: \"x12sfaok\",\n kskxy: \"x10iheve\",\n ks0D6T: \"x16xn7b0 x6iovhr\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"x1mesnot\",\n $$css: true\n }\n};\ntype SearchViewContentProps<T extends object = object> = {\n /**\n * What the back button is called, for a screen reader. Left out, the\n * library names it in the reader's locale — \"Back\" in English.\n */\n backLabel?: string;\n /** The results: a ListBox or a Menu, which typing narrows. */\n children?: ReactNode;\n /** A function may compute the class from the view's render state. */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * What the clear button is called, for a screen reader. Left out, React\n * Aria names it in the reader's locale — \"Clear search\" in English.\n */\n clearLabel?: string;\n /**\n * Where to portal the view. Defaults to the container of the `ThemeScope`\n * around it, which keeps the view on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the view\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * What is searched, for a screen reader. It names both the view and its\n * input, and is read rather than shown; `placeholder` is what is seen.\n * Write it so it contains the placeholder's words, as SearchField's\n * `label` explains.\n */\n label: string;\n /** The supporting text in the empty input, which is what a person reads. */\n placeholder?: string;\n /** A function may compute the style from the view's render state. */\n style?: StyleOrFunction<PopoverRenderProps>;\n} & Omit<AutocompleteProps<T>, 'children'>;\ntype SearchViewProps = Omit<DialogTriggerProps, 'children'> & {\n /**\n * The Button or IconButton that opens the view, and `SearchView.Content`.\n */\n children?: ReactNode;\n};\n\n// What the field draws, from its render state: the clear button only while\n// it holds something. Built by a call rather than written inline at the\n// prop, which is what react-perf's no-new-function-as-prop is after.\nfunction fieldContent(label: string, placeholder: string | undefined, clearLabel: string | undefined) {\n return (state: SearchFieldRenderProps) => <>\n <VisuallyHidden>\n <Label>{label}</Label>\n </VisuallyHidden>\n <FieldInput\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- a search view opens to be typed into, so the input takes focus rather than the back button the dialog would otherwise start on\n autoFocus placeholder={placeholder} className=\"x1hcrkkg xzwh6sb xjyslct x1iyjqo2 xeuugli\" />\n {state.isEmpty ? null : <IconButton aria-label={clearLabel} className=\"x15ir4sr\">\n <CloseGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>}\n </>;\n}\n\n/**\n * The view a search opens into: full screen on a compact window, docked\n * under what opened it on a wider one. Open state is React Aria's: pass\n * `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it keep\n * its own.\n *\n * ```tsx\n * <SearchView>\n * <IconButton aria-label=\"Search\"><SearchIcon /></IconButton>\n * <SearchView.Content label=\"Search\" placeholder=\"Search\">\n * <ListBox aria-label=\"Results\">…</ListBox>\n * </SearchView.Content>\n * </SearchView>\n * ```\n *\n * A Button or IconButton placed directly inside opens the view;\n * `SearchView.Content` is the view itself.\n */\nfunction SearchView({\n children,\n ...props\n}: SearchViewProps) {\n return <DialogTrigger {...props}>{children}</DialogTrigger>;\n}\n\n/**\n * The view: the header with its back button, input and clear button, and\n * the results under it, inside React Aria's Autocomplete, so typing narrows\n * them. Its value is Autocomplete's: pass `inputValue` with `onInputChange`\n * to control what has been typed, or `defaultInputValue` to let it keep its\n * own.\n *\n * The call site's `className` and `style` land on the view's surface, and\n * its `ref` too.\n */\nfunction SearchViewContent<T extends object = object>({\n backLabel,\n children,\n className,\n clearLabel,\n container,\n label,\n placeholder,\n ref,\n style,\n ...props\n}: RefAttributes<HTMLElement> & SearchViewContentProps<T>) {\n const messages = useMessages();\n return <RACPopover offset={SIDE_OFFSET} placement=\"bottom start\" ref={ref}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...mergeStatefulStyles(stylex.props(overlay.popup, styles.view), {\n className,\n style\n })}>\n <Dialog aria-label={label} className=\"x9f619 x78zum5 xdt5ytf x1iyjqo2 x2lwn1j x1t137rt\">\n <Autocomplete<T> {...props}>\n <div className=\"x6s0dn4 xs1ryiz xzcdm5u x9f619 x78zum5 x2lah0s x126z3so x790zyz\">\n <IconButton aria-label={backLabel ?? messages.back} slot=\"close\" className=\"x6aqprb\">\n <ArrowBackGlyph className=\"xlzyvqe x139gbkf x1lliihq x15vhz18 x19axjrm x1c071of\" />\n </IconButton>\n <RACSearchField className=\"x6s0dn4 x9f619 x78zum5 x1iyjqo2 x126z3so xeuugli\">\n {fieldContent(label, placeholder, clearLabel)}\n </RACSearchField>\n </div>\n <hr className=\"xp2scj5 xjm9jq1 xc342km x9f619 x2lah0s x1ghz6dp\" />\n <div className=\"x9f619 x1iyjqo2 xfwfbzp xrsa6q8 x1ficeh5 x1iob9gu x1odjw0f xish69e\">{children}</div>\n </Autocomplete>\n </Dialog>\n </RACPopover>;\n}\nSearchView.Content = SearchViewContent;\nexport type { SearchViewContentProps, SearchViewProps };\nexport { SearchViewContent };\nexport default SearchView;"],"mappings":";;;;;;;;;;;;;AAqDA,MAAMiC,cAAc;AACpB,MAAMC,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;CACPC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA8CA,SAASc,aAAaN,OAAeC,aAAiCJ,YAAgC;CACpG,QAAQU,UAAkC,qBAAA,UAAA,EAAA,UAAA;EACtC,oBAAC,gBAAD,EAAA,UACE,oBAAC,OAAD,EAAA,UAAQP,MAAa,CAAA,EACP,CAAA;EAChB,oBAAC,YAAD;GAEF,WAAA;GAAuBC;GAAa,WAAU;EAA2C,CAAA;EACtFM,MAAMC,UAAU,OAAO,oBAAC,YAAD;GAAY,cAAYX;GAAY,WAAU;GAClE,UAAA,oBAAC,YAAD,EAAY,WAAU,4BAA2B,CAAA;EACvC,CAAA;CAChB,EAAA,CAAA;AACJ;;;;;;;;;;;;;;;;;;;AAoBA,SAAAY,WAAAC,IAAA;CAAA,MAAAC,IAAArE,EAAA,CAAA;CAAA,IAAAqD;CAAA,IAAAiB;CAAA,IAAAD,EAAA,OAAAD,IAAA;EAAoB,CAAA,CAAAf,UAAA,GAAAiB,SAAAF;EAGFC,EAAA,KAAAD;EAAAC,EAAA,KAAAhB;EAAAgB,EAAA,KAAAC;CAAA,OAAA;EAAAjB,WAAAgB,EAAA;EAAAC,QAAAD,EAAA;CAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAhB,YAAAgB,EAAA,OAAAC,OAAA;EACTC,K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les","view","kWkggS","kZKoxP","kaIpWk","kGVxlE","k1xSpc","kXwgrk","kzqmXN","krVfgx","k87sOh","kt4wiu","kLqNvP","kskxy","ks0D6T","kVQacm","kVAEAm","$$css","backLabel","children","className","clearLabel","container","label","placeholder","style","fieldContent","state","isEmpty","SearchView","t0","$","props","t1","SearchViewContent","ref","messages","popup","t2","back","t3","Symbol","for","t4","t5","t6","t7","t8","t9","t10","t11","t12","Content","RACSearchField","Autocomplete","RACPopover"],"sources":["../../../src/components/search-view/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DialogTriggerProps, PopoverRenderProps, SearchFieldRenderProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Dialog, DialogTrigger, Label, Popover as RACPopover, SearchField as RACSearchField, VisuallyHidden } from 'react-aria-components';\nimport type { AutocompleteProps } from '../autocomplete';\nimport { FieldInput } from '../../field';\nimport { ArrowBackGlyph, CloseGlyph } from '../../glyphs';\nimport { useMessages } from '../../i18n';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, radii, shadows, sizing, spacing } from '../../tokens/design.tokens.stylex';\nimport Autocomplete from '../autocomplete';\nimport IconButton from '../icon-button';\n\n// The search page's search view: what a search opens into. A header holds a\n// back button, the input and a clear button, over a 1dp divider in the\n// outline role, and the results run under it. Both of the page's forms are\n// surface container high, with the input in body-large on surface over a\n// supporting text in on surface variant, the back icon in on surface and the\n// clear icon in on surface variant.\n//\n// **Which form is the window's.** Below the medium breakpoint it is the\n// page's full-screen view: the whole window, square, with a 72dp header.\n// Above it, the docked view: dropped under what opened it, as wide as that\n// and held between the page's 360dp and 720dp, with a 28dp corner, a 56dp\n// header, results at least 240dp tall and the whole view no taller than two\n// thirds of the window, at elevation 3 — Compose's measurements for its\n// docked search bar, which the page draws without numbers. The swap is the\n// date pickers' — see `src/styles/picker.ts`: React Aria places the surface\n// with inline styles, which a class outranks only with `!important`, so the\n// full-screen form takes it on the edges, the position and the size, and\n// above the breakpoint this says nothing about any of them.\n//\n// **It is Autocomplete in an overlay.** The header's input and the results\n// are Autocomplete's two halves, so typing narrows the results as it does\n// anywhere else, and the results are the call site's ListBox or Menu.\n// Autocomplete still renders nothing of its own; this is the element around\n// it.\n//\n// **The header lines up with the search bar's.** The back button sits where\n// the bar's magnifier does, its icon 28dp in, and the text starts at 68dp,\n// as the bar's does; the clear button's icon ends 28dp from the end. So a\n// view opened from a bar puts its input where the bar's was.\n//\n// Composed as Popover is: `SearchView` holds the open state, a Button or\n// IconButton placed directly inside it opens the view, and\n// `SearchView.Content` is the view. The back button closes it, as Escape and\n// a press outside the docked view do.\n\n// The gap between what opened the view and the docked view, Popover's.\nconst SIDE_OFFSET = 8;\nconst styles = {\n view: {\n kWkggS: \"xvkjz1l\",\n kZKoxP: \"x16m7gpl\",\n kaIpWk: \"x19pkqky xxl0i3l\",\n kGVxlE: \"x1udv5rz xzvmenf\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzqmXN: \"xd4ksm1 x14gilbs\",\n krVfgx: \"xudx362\",\n k87sOh: \"xbvrusa\",\n kt4wiu: \"x1v0tev1\",\n kLqNvP: \"x12sfaok\",\n kskxy: \"x10iheve\",\n ks0D6T: \"x16xn7b0 x6iovhr\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"x1mesnot\",\n $$css: true\n }\n};\ntype SearchViewContentProps<T extends object = object> = {\n /**\n * What the back button is called, for a screen reader. Left out, the\n * library names it in the reader's locale — \"Back\" in English.\n */\n backLabel?: string;\n /** The results: a ListBox or a Menu, which typing narrows. */\n children?: ReactNode;\n /** A function may compute the class from the view's render state. */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * What the clear button is called, for a screen reader. Left out, React\n * Aria names it in the reader's locale — \"Clear search\" in English.\n */\n clearLabel?: string;\n /**\n * Where to portal the view. Defaults to the container of the `ThemeScope`\n * around it, which keeps the view on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the view\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * What is searched, for a screen reader. It names both the view and its\n * input, and is read rather than shown; `placeholder` is what is seen.\n * Write it so it contains the placeholder's words, as SearchField's\n * `label` explains.\n */\n label: string;\n /** The supporting text in the empty input, which is what a person reads. */\n placeholder?: string;\n /** A function may compute the style from the view's render state. */\n style?: StyleOrFunction<PopoverRenderProps>;\n} & Omit<AutocompleteProps<T>, 'children'>;\ntype SearchViewProps = Omit<DialogTriggerProps, 'children'> & {\n /**\n * The Button or IconButton that opens the view, and `SearchView.Content`.\n */\n children?: ReactNode;\n};\n\n// What the field draws, from its render state: the clear button only while\n// it holds something. Built by a call rather than written inline at the\n// prop, which is what react-perf's no-new-function-as-prop is after.\nfunction fieldContent(label: string, placeholder: string | undefined, clearLabel: string | undefined) {\n return (state: SearchFieldRenderProps) => <>\n <VisuallyHidden>\n <Label>{label}</Label>\n </VisuallyHidden>\n <FieldInput\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- a search view opens to be typed into, so the input takes focus rather than the back button the dialog would otherwise start on\n autoFocus placeholder={placeholder} className=\"x1hcrkkg xzwh6sb xjyslct x1iyjqo2 xeuugli\" />\n {state.isEmpty ? null : <IconButton aria-label={clearLabel} className=\"x15ir4sr\">\n <CloseGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>}\n </>;\n}\n\n/**\n * The view a search opens into: full screen on a compact window, docked\n * under what opened it on a wider one. Open state is React Aria's: pass\n * `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it keep\n * its own.\n *\n * ```tsx\n * <SearchView>\n * <IconButton aria-label=\"Search\"><SearchIcon /></IconButton>\n * <SearchView.Content label=\"Search\" placeholder=\"Search\">\n * <ListBox aria-label=\"Results\">…</ListBox>\n * </SearchView.Content>\n * </SearchView>\n * ```\n *\n * A Button or IconButton placed directly inside opens the view;\n * `SearchView.Content` is the view itself.\n */\nfunction SearchView({\n children,\n ...props\n}: SearchViewProps) {\n return <DialogTrigger {...props}>{children}</DialogTrigger>;\n}\n\n/**\n * The view: the header with its back button, input and clear button, and\n * the results under it, inside React Aria's Autocomplete, so typing narrows\n * them. Its value is Autocomplete's: pass `inputValue` with `onInputChange`\n * to control what has been typed, or `defaultInputValue` to let it keep its\n * own.\n *\n * The call site's `className` and `style` land on the view's surface, and\n * its `ref` too.\n */\nfunction SearchViewContent<T extends object = object>({\n backLabel,\n children,\n className,\n clearLabel,\n container,\n label,\n placeholder,\n ref,\n style,\n ...props\n}: RefAttributes<HTMLElement> & SearchViewContentProps<T>) {\n const messages = useMessages();\n return <RACPopover offset={SIDE_OFFSET} placement=\"bottom start\" ref={ref}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...mergeStatefulStyles(stylex.props(overlay.popup, styles.view), {\n className,\n style\n })}>\n <Dialog aria-label={label} className=\"x9f619 x78zum5 xdt5ytf x1iyjqo2 x2lwn1j x1t137rt\">\n <Autocomplete<T> {...props}>\n <div className=\"x6s0dn4 xs1ryiz xzcdm5u x9f619 x78zum5 x2lah0s x126z3so x790zyz\">\n <IconButton aria-label={backLabel ?? messages.back} slot=\"close\" className=\"x6aqprb\">\n <ArrowBackGlyph className=\"xlzyvqe x139gbkf x1lliihq x15vhz18 x19axjrm x1c071of\" />\n </IconButton>\n <RACSearchField className=\"x6s0dn4 x9f619 x78zum5 x1iyjqo2 x126z3so xeuugli\">\n {fieldContent(label, placeholder, clearLabel)}\n </RACSearchField>\n </div>\n <hr className=\"xp2scj5 xjm9jq1 xc342km x9f619 x2lah0s x1ghz6dp\" />\n <div className=\"x9f619 x1iyjqo2 xfwfbzp xrsa6q8 x1ficeh5 x1iob9gu x1odjw0f xish69e\">{children}</div>\n </Autocomplete>\n </Dialog>\n </RACPopover>;\n}\nSearchView.Content = SearchViewContent;\nexport type { SearchViewContentProps, SearchViewProps };\nexport { SearchViewContent };\nexport default SearchView;"],"mappings":";;;;;;;;;;;;;AAqDA,MAAMK,cAAc;AACpB,MAAMC,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;CACPC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA8CA,SAASS,aAAaH,OAAeC,aAAiCH,YAAgC;CACpG,QAAQM,UAAkC,qBAAA,UAAA,EAAA,UAAA;EACtC,oBAAC,gBAAD,EAAA,UACE,oBAAC,OAAD,EAAA,UAAQJ,MAAa,CAAA,EACP,CAAA;EAChB,oBAAC,YAAD;GAEF,WAAA;GAAuBC;GAAa,WAAU;EAA2C,CAAA;EACtFG,MAAMC,UAAU,OAAO,oBAAC,YAAD;GAAY,cAAYP;GAAY,WAAU;GAClE,UAAA,oBAAC,YAAD,EAAY,WAAU,4BAA2B,CAAA;EACvC,CAAA;CAChB,EAAA,CAAA;AACJ;;;;;;;;;;;;;;;;;;;AAoBA,SAAAQ,WAAAC,IAAA;CAAA,MAAAC,IAAArC,EAAA,CAAA;CAAA,IAAAyB;CAAA,IAAAa;CAAA,IAAAD,EAAA,OAAAD,IAAA;EAAoB,CAAA,CAAAX,UAAA,GAAAa,SAAAF;EAGFC,EAAA,KAAAD;EAAAC,EAAA,KAAAZ;EAAAY,EAAA,KAAAC;CAAA,OAAA;EAAAb,WAAAY,EAAA;EAAAC,QAAAD,EAAA;CAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAZ,YAAAY,EAAA,OAAAC,OAAA;EACTC,KAAA,oBAAC,eAAD;GAAc,GAAKD;GAAQb;EAAb,CAAA;EAAsCY,EAAA,KAAAZ;E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,OAAA;GAAe,WAAA;GAAsE7B;EAAe,CAAA;EAAAY,EAAA,MAAAZ;EAAAY,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,IAAAkB;CAAA,IAAAlB,EAAA,QAAAC,WAAAD,EAAA,QAAAe,MAAAf,EAAA,QAAAiB,IAAA;EAVtGC,MAAA,qBAACK,gBAAD;GAAa,GAAQtB;GAArB,UAAA;IACEc;IAQAC;IACAC;GAVW;;EAWEjB,EAAA,MAAAC;EAAAD,EAAA,MAAAe;EAAAf,EAAA,MAAAiB;EAAAjB,EAAA,MAAAkB;CAAA,OAAAA,MAAAlB,EAAA;CAAA,IAAAmB;CAAA,IAAAnB,EAAA,QAAAR,SAAAQ,EAAA,QAAAkB,KAAA;EAZjBC,MAAA,oBAAC,QAAD;GAAoB3B,cAAAA;GAAiB,WAAA;GACnC0B,UAAAA;EADK,CAAA;EAaElB,EAAA,MAAAR;EAAAQ,EAAA,MAAAkB;EAAAlB,EAAA,MAAAmB;CAAA,OAAAA,MAAAnB,EAAA;CAAA,IAAAoB;CAAA,IAAApB,EAAA,QAAAT,aAAAS,EAAA,QAAAI,OAAAJ,EAAA,QAAAE,MAAAF,EAAA,QAAAmB,KAAA;EAnBNC,MAAA,oBAACI,SAAD;GAAoBxD,QAAAA;GAAuB,WAAA;GAAoBoC;GAE5Cb,0BAAAA;GAAS,GAAMW;GAIrCiB,UAAAA;EANc,CAAA;EAoBHnB,EAAA,MAAAT;EAAAS,EAAA,MAAAI;EAAAJ,EAAA,MAAAE;EAAAF,EAAA,MAAAmB;EAAAnB,EAAA,MAAAoB;CAAA,OAAAA,MAAApB,EAAA;CAAA,OApBRoB;AAoBQ;AAEjBtB,WAAWuB,UAAUlB"}
|
|
@@ -95,5 +95,4 @@ declare namespace SegmentedButton {
|
|
|
95
95
|
* unchosen one draws whatever `icon` holds, if anything.
|
|
96
96
|
*/
|
|
97
97
|
declare function SegmentedButtonSegment({ children, disableRipple, icon, onClick, onContextMenu, onKeyDown, onKeyUp, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, render, ...props }: RefAttributes<HTMLButtonElement> & SegmentedButtonSegmentProps): import("react").JSX.Element;
|
|
98
|
-
export { type SegmentedButtonProps, SegmentedButtonSegment, type SegmentedButtonSegmentProps, SegmentedButton as default };
|
|
99
|
-
//# sourceMappingURL=index.d.ts.map
|
|
98
|
+
export { type SegmentedButtonProps, SegmentedButtonSegment, type SegmentedButtonSegmentProps, SegmentedButton as default };
|