@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":"styles.js","names":["stylex","colors","media","radii","sizing","spacing","stateLayerOpacity","typography","ROW_BLOCK_SIZE","DATE_SIZE","DATE_ROOM","WEEK_INLINE_SIZE","TARGET_REACH","WEEKS_HELD","FORCED_COLORS","calendarStyles","cell","kgeoSG","kFcpXp","kEoFBp","kGNEyG","kWkggS","kZKoxP","kaIpWk","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kzqmXN","kjj79g","kb6lSQ","kLWn49","kqGvvJ","kUOVxO","kVAEAm","$$css","cellDisabled","kVAM5u","kAXs8y","cellInRange","kjBf7l","cellInvalid","cellRangeEnd","kT0f0o","kfmiAY","cellRangeStart","kVL7Gh","krdFHd","cellReadOnly","cellSelected","cellSelectedDisabled","cellToday","ksu8eU","kMzoRj","cellUnavailable","kMnn75","chevron","chevronGlyph","k3aq6I","chevronGlyphPrevious","chevronHidden","k33iCy","grid","kLvRdT","kheTzg","kPzzVL","header","kOIVth","kAzted","headerCell","headerCellDisabled","headerGroup","heading","kogj98","k9WMMc","menuArrow","kmuXW","menuArrowExpanded","menuButton","kGOzcv","kpsdNU","kg3NbH","menuCheck","menuItem","k3XXqK","menuItemDisabled","menuItemFocused","kInvED","kMeerF","menuItemSelected","menuList","kLZC3w","kPef9Z","kEafiO","kORKVm","month","ks0D6T","months","kJBjZk","kumcoG","root","kXwgrk","k7Eaqz","kmVPX3","dateLayers","inRangeHovered","inRangePressed","invalidHovered","invalidPressed","plainHovered","plainPressed","selectedHovered","selectedPressed","menuLayers"],"sources":["../../src/calendar/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, media, radii, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The styles Calendar and RangeCalendar both draw. Apart from either\n// component so the two cannot drift, and outside `src/components` because a\n// directory there is a public component with stories, a barrel entry and a\n// `styling.test.tsx` case — which shared styles are none of.\n//\n// The values are the date pickers page's docked calendar, named in\n// `src/components/calendar/index.tsx` along with the departures from it. What\n// is only a range's — the band between the two ends — takes its colours from\n// the modal date picker's range-selection tokens instead, since the docked\n// token set stops at the selected date; see `cellInRange`.\n//\n// Under forced colours a selected date and a range's band are fills, which\n// that mode paints in a system colour, so a calendar showed no selection and\n// no range there, only today's outline. Both take `Highlight` with\n// `HighlightText` over it, the pair the mode gives whatever is chosen, which\n// draws a range as one run from its first day to its last.\n//\n// They take the pair with `forced-color-adjust: none`. Left to adjust, the\n// mode lays a `Canvas` backplate behind every run of text, and a date in\n// `HighlightText` on that backplate is a blank box. With it off nothing is\n// forced on those cells, so they name a system colour for everything they\n// draw — the fill, the date, today's outline and the focus ring. A day ruled\n// out or disabled names none, so it hands itself back to the mode, apart from\n// the date a disabled calendar holds, which takes `GrayText` as its fill in\n// the same way; see `cellSelectedDisabled`.\n\n// One row of the grid. The weekday row and every week of dates are the same\n// 48dp, the page's date container and Compose's own row, so `headerCell`, the\n// room around each date and the room `months` reserves all follow this one\n// number — a row resized without the reservation following it would put the\n// calendar's height back on its month.\nconst ROW_BLOCK_SIZE = '48px';\n\n// The date's state layer: the 40dp circle a selected date fills and a hover\n// tints, inside the 48dp row and column it sits in.\nconst DATE_SIZE = '40px';\n\n// The room either side of a date's circle, which is the difference between\n// the two: the circle sits in the middle of its 48dp square.\nconst DATE_ROOM = `calc((${ROW_BLOCK_SIZE} - ${DATE_SIZE}) / 2)`;\n\n// A whole column: the page's 48dp date container, seven to a week. The grid\n// is at most seven of them and narrows with its container below that.\nconst WEEK_INLINE_SIZE = `calc(${ROW_BLOCK_SIZE} * 7)`;\n\n// What every press target in the calendar reaches to: the page's 48dp, for\n// controls drawn at 40.\nconst TARGET_REACH = `calc((${DATE_SIZE} - ${ROW_BLOCK_SIZE}) / 2)`;\n\n// The weeks the grid holds room for, which is the most any month occupies: a\n// 31-day month beginning on the last day of a week runs one day, then four\n// whole weeks, then two days. February 2026 is the other end at four. Holding\n// six draws every month in the box the longest one fills.\nconst WEEKS_HELD = 6;\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)';\nconst calendarStyles = {\n cell: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x15kbrqr\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1vqgdyp\",\n kaIpWk: \"x16fbrrb\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kzqmXN: \"x100vrsf\",\n kjj79g: \"xl56j7k\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n kqGvvJ: \"x8yh5r3\",\n kUOVxO: \"xvueqy4\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n cellDisabled: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x1pojj9x\",\n kMwMTN: \"x9w6zvh\",\n kkrTdU: \"x1h6gzvc\",\n kAXs8y: \"xr5dkdi\",\n $$css: true\n },\n cellInRange: {\n kWkggS: \"x15dekr4 x1jzqe4\",\n kVAM5u: \"x1uajy3w x1n2ykn\",\n kaIpWk: \"x2u8bby\",\n kMwMTN: \"x1sawysd x1k5gbb1\",\n kAXs8y: \"x1g12otp\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xrxpjvj\",\n kjBf7l: \"xrgy624 x3teovq\",\n $$css: true\n },\n cellInvalid: {\n kWkggS: \"x1skwi6t x1jzqe4\",\n kVAM5u: \"xpdgbdc x1n2ykn\",\n kMwMTN: \"x16elhoc x1k5gbb1\",\n $$css: true\n },\n cellRangeEnd: {\n kT0f0o: \"x187kppt\",\n kfmiAY: \"x1fpsnkq\",\n $$css: true\n },\n cellRangeStart: {\n kVL7Gh: \"x17kgqx\",\n krdFHd: \"x1uni95s\",\n $$css: true\n },\n cellReadOnly: {\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n cellSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kVAM5u: \"x1uajy3w x1n2ykn\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n kAXs8y: \"x1g12otp\",\n kjBf7l: \"xrgy624 x3teovq\",\n $$css: true\n },\n cellSelectedDisabled: {\n kWkggS: \"x19v6zzp x1o55y2u\",\n kVAM5u: \"x9r1u3d xmnqt3w\",\n kMwMTN: \"x9w6zvh x1a46atw\",\n kAXs8y: \"x1g12otp\",\n $$css: true\n },\n cellToday: {\n kVAM5u: \"x1uajy3w\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n cellUnavailable: {\n kWkggS: \"xjbqb8w\",\n kkrTdU: \"x1h6gzvc\",\n kAXs8y: \"xr5dkdi\",\n kMnn75: \"x5lhwog\",\n $$css: true\n },\n chevron: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x15kbrqr\",\n kEoFBp: \"x1hmns74\",\n kUOVxO: \"x34s64n\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n chevronGlyph: {\n kZKoxP: \"xxk0z11\",\n kzqmXN: \"xvy4d1p\",\n k3aq6I: \"x19axjrm x1c071of\",\n $$css: true\n },\n chevronGlyphPrevious: {\n k3aq6I: \"xdg80k9 xpk2tj9\",\n $$css: true\n },\n chevronHidden: {\n k33iCy: \"xlshs6z\",\n $$css: true\n },\n grid: {\n kLvRdT: \"x1vathgz\",\n kheTzg: \"x1gukg7c\",\n kzqmXN: \"xh8yej3\",\n kPzzVL: \"x140o2bo\",\n $$css: true\n },\n header: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"x126z3so\",\n kjj79g: \"x1qughib\",\n kAzted: \"x1ba4aug\",\n $$css: true\n },\n headerCell: {\n kZKoxP: \"xsdox4t\",\n kMwMTN: \"x139gbkf\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n $$css: true\n },\n headerCellDisabled: {\n kMwMTN: \"x9w6zvh\",\n $$css: true\n },\n headerGroup: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n $$css: true\n },\n heading: {\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kogj98: \"x1ghz6dp\",\n k9WMMc: \"x2b8uid\",\n $$css: true\n },\n menuArrow: {\n kZKoxP: \"xmix8c7\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n menuArrowExpanded: {\n k3aq6I: \"x19jd1h0\",\n $$css: true\n },\n menuButton: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1sk10ar\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1rv7mn0\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"xzoy561\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kg3NbH: \"xn60lsn\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n menuCheck: {\n kZKoxP: \"xxk0z11\",\n kMwMTN: \"x139gbkf\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"xvy4d1p\",\n $$css: true\n },\n menuItem: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xbg5kjn\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n k3XXqK: \"x1t137rt\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n menuItemDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x9w6zvh\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n menuItemFocused: {\n kjBf7l: \"xrgy624\",\n kInvED: \"x2ssjo2\",\n k3XXqK: \"xaatb59\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n menuItemSelected: {\n kWkggS: \"xkrgufg\",\n $$css: true\n },\n menuList: {\n kZKoxP: \"xmmrubu\",\n kLZC3w: \"x12smttz\",\n kPef9Z: \"x13fuv20\",\n kEafiO: \"x178xt8z\",\n kB7OPa: \"x9f619\",\n kUOVxO: \"xnx04jz\",\n k3XXqK: \"x1t137rt\",\n kORKVm: \"x1odjw0f\",\n $$css: true\n },\n month: {\n kB7OPa: \"x9f619\",\n kzqmXN: \"x1url4ad\",\n ks0D6T: \"x193iq5w\",\n $$css: true\n },\n months: {\n kGNEyG: \"x7a106z\",\n k1xSpc: \"x78zum5 x1yrkhk\",\n kOIVth: \"xj2l1yv\",\n kJBjZk: \"x17udjhq\",\n kumcoG: \"x1kji8p3\",\n kAzted: \"x8chfrn\",\n $$css: true\n },\n root: {\n kWkggS: \"xvkjz1l\",\n kaIpWk: \"xhpdng0\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kOIVth: \"x1gka490\",\n kzqmXN: \"xeq5yr9\",\n ks0D6T: \"x193iq5w\",\n k7Eaqz: \"xjrddbv\",\n kmVPX3: \"xa36j16\",\n $$css: true\n }\n};\n\n// A date's hover and pressed layers, one pair per ground it sits on: nothing,\n// the range band, the selected circle, and the invalid one. From React Aria's\n// render state rather than `:hover` and `:active`, for Button's reasons — see\n// its header: a hover layer stayed on after a tap, and no pressed layer\n// showed for a press made from the keyboard.\n// Each layer is written whole for its ground because StyleX replaces a\n// property whole, and the band and the circles keep their forced-colours\n// `Highlight` under the layer.\nconst dateLayers = {\n inRangeHovered: {\n kWkggS: \"x3zumxv x1jzqe4\",\n $$css: true\n },\n inRangePressed: {\n kWkggS: \"x1as5h4c x1jzqe4\",\n $$css: true\n },\n invalidHovered: {\n kWkggS: \"xbw18ef x1jzqe4\",\n $$css: true\n },\n invalidPressed: {\n kWkggS: \"xld5jmv x1jzqe4\",\n $$css: true\n },\n plainHovered: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n },\n plainPressed: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n selectedHovered: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n selectedPressed: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n }\n};\n\n// A list row's hover and pressed layers over the checked row's surface\n// variant. Over nothing a row takes a date's own pair, `dateLayers.plain*`,\n// since the page gives both the same on-surface layer.\nconst menuLayers = {\n selectedHovered: {\n kWkggS: \"xgw93rf\",\n $$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;CACT;CACAwE,gBAAgB;EACdzF,QAAQ;EACRiB,OAAO;CACT;CACAyE,gBAAgB;EACd1F,QAAQ;EACRiB,OAAO;CACT;CACA0E,cAAc;EACZ3F,QAAQ;EACRiB,OAAO;CACT;CACA2E,cAAc;EACZ5F,QAAQ;EACRiB,OAAO;CACT;CACA4E,iBAAiB;EACf7F,QAAQ;EACRiB,OAAO;CACT;CACA6E,iBAAiB;EACf9F,QAAQ;EACRiB,OAAO;CACT;AACF;AAKA,MAAM8E,aAAa;CACjBF,iBAAiB;EACf7F,QAAQ;EACRiB,OAAO;CACT;CACA6E,iBAAiB;EACf9F,QAAQ;EACRiB,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"styles.js","names":["calendarStyles","cell","kgeoSG","kFcpXp","kEoFBp","kGNEyG","kWkggS","kZKoxP","kaIpWk","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kzqmXN","kjj79g","kb6lSQ","kLWn49","kqGvvJ","kUOVxO","kVAEAm","$$css","cellDisabled","kVAM5u","kAXs8y","cellInRange","kjBf7l","cellInvalid","cellRangeEnd","kT0f0o","kfmiAY","cellRangeStart","kVL7Gh","krdFHd","cellReadOnly","cellSelected","cellSelectedDisabled","cellToday","ksu8eU","kMzoRj","cellUnavailable","kMnn75","chevron","chevronGlyph","k3aq6I","chevronGlyphPrevious","chevronHidden","k33iCy","grid","kLvRdT","kheTzg","kPzzVL","header","kOIVth","kAzted","headerCell","headerCellDisabled","headerGroup","heading","kogj98","k9WMMc","menuArrow","kmuXW","menuArrowExpanded","menuButton","kGOzcv","kpsdNU","kg3NbH","menuCheck","menuItem","k3XXqK","menuItemDisabled","menuItemFocused","kInvED","kMeerF","menuItemSelected","menuList","kLZC3w","kPef9Z","kEafiO","kORKVm","month","ks0D6T","monthCaption","kGO01o","months","kumcoG","monthsStacked","root","kXwgrk","k7Eaqz","kmVPX3","dateLayers","inRangeHovered","inRangePressed","invalidHovered","invalidPressed","plainHovered","plainPressed","selectedHovered","selectedPressed","menuLayers"],"sources":["../../src/calendar/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, media, radii, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The styles Calendar and RangeCalendar both draw. Apart from either\n// component so the two cannot drift, and outside `src/components` because a\n// directory there is a public component with stories, a barrel entry and a\n// `styling.test.tsx` case — which shared styles are none of.\n//\n// The values are the date pickers page's docked calendar, named in\n// `src/components/calendar/index.tsx` along with the departures from it. What\n// is only a range's — the band between the two ends — takes its colours from\n// the modal date picker's range-selection tokens instead, since the docked\n// token set stops at the selected date; see `cellInRange`.\n//\n// Under forced colours a selected date and a range's band are fills, which\n// that mode paints in a system colour, so a calendar showed no selection and\n// no range there, only today's outline. Both take `Highlight` with\n// `HighlightText` over it, the pair the mode gives whatever is chosen, which\n// draws a range as one run from its first day to its last.\n//\n// They take the pair with `forced-color-adjust: none`. Left to adjust, the\n// mode lays a `Canvas` backplate behind every run of text, and a date in\n// `HighlightText` on that backplate is a blank box. With it off nothing is\n// forced on those cells, so they name a system colour for everything they\n// draw — the fill, the date, today's outline and the focus ring. A day ruled\n// out or disabled names none, so it hands itself back to the mode, apart from\n// the date a disabled calendar holds, which takes `GrayText` as its fill in\n// the same way; see `cellSelectedDisabled`.\n\n// One row of the grid. The weekday row and every week of dates are the same\n// 48dp, the page's date container and Compose's own row, so `headerCell`, the\n// room around each date and the room `months` reserves all follow this one\n// number — a row resized without the reservation following it would put the\n// calendar's height back on its month.\nconst ROW_BLOCK_SIZE = '48px';\n\n// The date's state layer: the 40dp circle a selected date fills and a hover\n// tints, inside the 48dp row and column it sits in.\nconst DATE_SIZE = '40px';\n\n// The room either side of a date's circle, which is the difference between\n// the two: the circle sits in the middle of its 48dp square.\nconst DATE_ROOM = `calc((${ROW_BLOCK_SIZE} - ${DATE_SIZE}) / 2)`;\n\n// A whole column: the page's 48dp date container, seven to a week. The grid\n// is at most seven of them and narrows with its container below that.\nconst WEEK_INLINE_SIZE = `calc(${ROW_BLOCK_SIZE} * 7)`;\n\n// What every press target in the calendar reaches to: the page's 48dp, for\n// controls drawn at 40.\nconst TARGET_REACH = `calc((${DATE_SIZE} - ${ROW_BLOCK_SIZE}) / 2)`;\n\n// The weeks the grid holds room for, which is the most any month occupies: a\n// 31-day month beginning on the last day of a week runs one day, then four\n// whole weeks, then two days. February 2026 is the other end at four. Holding\n// six draws every month in the box the longest one fills.\nconst WEEKS_HELD = 6;\n\n// The room one month is held at, the weekday row and the six weeks, which\n// the open month or year list takes too.\nconst MONTH_BLOCK_SIZE = `calc(${ROW_BLOCK_SIZE} * ${WEEKS_HELD} + ${ROW_BLOCK_SIZE})`;\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)';\nconst calendarStyles = {\n cell: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x15kbrqr\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1vqgdyp\",\n kaIpWk: \"x16fbrrb\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kzqmXN: \"x100vrsf\",\n kjj79g: \"xl56j7k\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n kqGvvJ: \"x8yh5r3\",\n kUOVxO: \"xvueqy4\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n cellDisabled: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x1pojj9x\",\n kMwMTN: \"x9w6zvh\",\n kkrTdU: \"x1h6gzvc\",\n kAXs8y: \"xr5dkdi\",\n $$css: true\n },\n cellInRange: {\n kWkggS: \"x15dekr4 x1jzqe4\",\n kVAM5u: \"x1uajy3w x1n2ykn\",\n kaIpWk: \"x2u8bby\",\n kMwMTN: \"x1sawysd x1k5gbb1\",\n kAXs8y: \"x1g12otp\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xrxpjvj\",\n kjBf7l: \"xrgy624 x3teovq\",\n $$css: true\n },\n cellInvalid: {\n kWkggS: \"x1skwi6t x1jzqe4\",\n kVAM5u: \"xpdgbdc x1n2ykn\",\n kMwMTN: \"x16elhoc x1k5gbb1\",\n $$css: true\n },\n cellRangeEnd: {\n kT0f0o: \"x187kppt\",\n kfmiAY: \"x1fpsnkq\",\n $$css: true\n },\n cellRangeStart: {\n kVL7Gh: \"x17kgqx\",\n krdFHd: \"x1uni95s\",\n $$css: true\n },\n cellReadOnly: {\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n cellSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kVAM5u: \"x1uajy3w x1n2ykn\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n kAXs8y: \"x1g12otp\",\n kjBf7l: \"xrgy624 x3teovq\",\n $$css: true\n },\n cellSelectedDisabled: {\n kWkggS: \"x19v6zzp x1o55y2u\",\n kVAM5u: \"x9r1u3d xmnqt3w\",\n kMwMTN: \"x9w6zvh x1a46atw\",\n kAXs8y: \"x1g12otp\",\n $$css: true\n },\n cellToday: {\n kVAM5u: \"x1uajy3w\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n cellUnavailable: {\n kWkggS: \"xjbqb8w\",\n kkrTdU: \"x1h6gzvc\",\n kAXs8y: \"xr5dkdi\",\n kMnn75: \"x5lhwog\",\n $$css: true\n },\n chevron: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x15kbrqr\",\n kEoFBp: \"x1hmns74\",\n kUOVxO: \"x34s64n\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n chevronGlyph: {\n kZKoxP: \"xxk0z11\",\n kzqmXN: \"xvy4d1p\",\n k3aq6I: \"x19axjrm x1c071of\",\n $$css: true\n },\n chevronGlyphPrevious: {\n k3aq6I: \"xdg80k9 xpk2tj9\",\n $$css: true\n },\n chevronHidden: {\n k33iCy: \"xlshs6z\",\n $$css: true\n },\n grid: {\n kLvRdT: \"x1vathgz\",\n kheTzg: \"x1gukg7c\",\n kzqmXN: \"xh8yej3\",\n kPzzVL: \"x140o2bo\",\n $$css: true\n },\n header: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"x126z3so\",\n kjj79g: \"x1qughib\",\n kAzted: \"x1ba4aug\",\n $$css: true\n },\n headerCell: {\n kZKoxP: \"xsdox4t\",\n kMwMTN: \"x139gbkf\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n $$css: true\n },\n headerCellDisabled: {\n kMwMTN: \"x9w6zvh\",\n $$css: true\n },\n headerGroup: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n $$css: true\n },\n heading: {\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kogj98: \"x1ghz6dp\",\n k9WMMc: \"x2b8uid\",\n $$css: true\n },\n menuArrow: {\n kZKoxP: \"xmix8c7\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n menuArrowExpanded: {\n k3aq6I: \"x19jd1h0\",\n $$css: true\n },\n menuButton: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1sk10ar\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1rv7mn0\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"xzoy561\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kg3NbH: \"xn60lsn\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n menuCheck: {\n kZKoxP: \"xxk0z11\",\n kMwMTN: \"x139gbkf\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"xvy4d1p\",\n $$css: true\n },\n menuItem: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xbg5kjn\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n k3XXqK: \"x1t137rt\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n menuItemDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x9w6zvh\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n menuItemFocused: {\n kjBf7l: \"xrgy624\",\n kInvED: \"x2ssjo2\",\n k3XXqK: \"xaatb59\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n menuItemSelected: {\n kWkggS: \"xkrgufg\",\n $$css: true\n },\n menuList: {\n kZKoxP: \"xmmrubu\",\n kLZC3w: \"x12smttz\",\n kPef9Z: \"x13fuv20\",\n kEafiO: \"x178xt8z\",\n kB7OPa: \"x9f619\",\n kUOVxO: \"xnx04jz\",\n k3XXqK: \"x1t137rt\",\n kORKVm: \"x1odjw0f\",\n $$css: true\n },\n month: {\n kB7OPa: \"x9f619\",\n kzqmXN: \"x1url4ad\",\n ks0D6T: \"x193iq5w\",\n $$css: true\n },\n monthCaption: {\n kGNEyG: \"xpqajaz\",\n kZKoxP: \"xsdox4t\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n k1xSpc: \"x1s85apg x1dstske\",\n kMv6JI: \"xrgwony\",\n kGuDYH: \"x12s497w\",\n k63SB2: \"x1szcwkt\",\n kb6lSQ: \"xo803ec\",\n kLWn49: \"xyl1r0q\",\n kGO01o: \"xqf7pud\",\n kg3NbH: \"x18fpw6u\",\n $$css: true\n },\n months: {\n kGNEyG: \"x7a106z\",\n k1xSpc: \"x78zum5 x1yrkhk\",\n kOIVth: \"xj2l1yv\",\n kumcoG: \"x1kji8p3\",\n kAzted: \"x8chfrn\",\n $$css: true\n },\n monthsStacked: {\n kAzted: \"x8chfrn x1e8x83n\",\n $$css: true\n },\n root: {\n kWkggS: \"xvkjz1l\",\n kaIpWk: \"xhpdng0\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kOIVth: \"x1gka490\",\n kzqmXN: \"xeq5yr9\",\n ks0D6T: \"x193iq5w\",\n k7Eaqz: \"xjrddbv\",\n kmVPX3: \"xa36j16\",\n $$css: true\n }\n};\n\n// A date's hover and pressed layers, one pair per ground it sits on: nothing,\n// the range band, the selected circle, and the invalid one. From React Aria's\n// render state rather than `:hover` and `:active`, for Button's reasons — see\n// its header: a hover layer stayed on after a tap, and no pressed layer\n// showed for a press made from the keyboard.\n// Each layer is written whole for its ground because StyleX replaces a\n// property whole, and the band and the circles keep their forced-colours\n// `Highlight` under the layer.\nconst dateLayers = {\n inRangeHovered: {\n kWkggS: \"x3zumxv x1jzqe4\",\n $$css: true\n },\n inRangePressed: {\n kWkggS: \"x1as5h4c x1jzqe4\",\n $$css: true\n },\n invalidHovered: {\n kWkggS: \"xbw18ef x1jzqe4\",\n $$css: true\n },\n invalidPressed: {\n kWkggS: \"xld5jmv x1jzqe4\",\n $$css: true\n },\n plainHovered: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n },\n plainPressed: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n selectedHovered: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n selectedPressed: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n }\n};\n\n// A list row's hover and pressed layers over the checked row's surface\n// variant. Over nothing a row takes a date's own pair, `dateLayers.plain*`,\n// since the page gives both the same on-surface layer.\nconst menuLayers = {\n selectedHovered: {\n kWkggS: \"xgw93rf\",\n $$css: true\n },\n selectedPressed: {\n kWkggS: \"x113d7pk\",\n $$css: true\n }\n};\nexport { calendarStyles, dateLayers, menuLayers };"],"mappings":";AAoEA,MAAMA,iBAAiB;CACrBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,cAAc;EACZlB,QAAQ;EACRmB,QAAQ;EACRf,QAAQ;EACRC,QAAQ;EACRe,QAAQ;EACRH,OAAO;CACT;CACAI,aAAa;EACXrB,QAAQ;EACRmB,QAAQ;EACRjB,QAAQ;EACRE,QAAQ;EACRgB,QAAQ;EACRV,QAAQ;EACRK,QAAQ;E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O;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrangement.js","names":["CarouselLayout","GAP","SMALL_MAX","SMALL_MIN","Arrangement","large","largeCount","medium","small","steps","Placement","left","width","arrange","layout","room","itemSize","count","Math","min","max","withSteps","fit","floor","most","gaps","sizes","filledOf","Omit","trailingOf","length","placements","arrangement","padding","position","Array","from","_","index","clamped","to","fraction","start","rest","end","map","placement","next","step","filled","trailing","slice","last","turned","kept","slot","first","lefts","cursor","size","push","shift","away","filter","turning"],"sources":["../../src/carousel/arrangement.ts"],"sourcesContent":["// The carousel page's layouts as numbers: which items are large, medium and\n// small at each place a carousel comes to rest, and where each is drawn as\n// it moves between two of them. Apart from the component so the arithmetic\n// can be tested without a browser laying anything out, and so the\n// component's file holds what it renders.\n//\n// The model is MDC-Android's keylines, simplified to what the page draws.\n// At rest a multi-browse carousel shows `largeCount` large items, one medium\n// and one small, filling the room exactly; a hero carousel one large and one\n// small. Each rest is one item further along than the last, and once the\n// last item has come into view the rests that remain turn the arrangement\n// round a slot at a time — small, the large ones, medium; then small,\n// medium, the large ones — so every item is drawn large at one rest at\n// least. At rest `s` the large items are always `s` to `s + largeCount - 1`.\n// Between two rests every item's place and width are interpolated, which is\n// what makes an item grow or shrink as it moves rather than jump. Items past\n// either edge are drawn small and out of sight, so they arrive at the size\n// of the slot they enter.\n//\n// Everything is in pixels along the inline axis of the carousel's content\n// box: 0 is its start edge, inside the leading padding.\n\ntype CarouselLayout = 'hero' | 'multi-browse' | 'uncontained'\n\n/** The page's 8dp between items. */\nconst GAP = 8\n\n/** The page's small item: 40dp at the least and 56dp at the most. */\nconst SMALL_MAX = 56\nconst SMALL_MIN = 40\n\ntype Arrangement = {\n /** The large item's width, which every item is laid out at. */\n large: number\n /** How many items are large at rest. */\n largeCount: number\n /** The medium item's width, or 0 for a layout without one. */\n medium: number\n /** The small item's width, or 0 for a layout without one. */\n small: number\n /** The last place the carousel comes to rest, counting from 0. */\n steps: number\n}\n\n/** Where an item is drawn: the start of what shows of it, and its width. */\ntype Placement = { left: number; width: number }\n\n/**\n * The sizes a layout draws its items at in a content box `room` wide, for\n * `count` items and a preferred large width of `itemSize`.\n */\nfunction arrange(\n layout: CarouselLayout,\n room: number,\n itemSize: number,\n count: number,\n): Arrangement {\n if (layout === 'uncontained') {\n const large = Math.min(itemSize, room)\n return { large, largeCount: 0, medium: 0, small: 0, steps: 0 }\n }\n\n // The small item at its largest unless the room is too narrow for it.\n const small = room >= 3 * SMALL_MAX + 2 * GAP ? SMALL_MAX : SMALL_MIN\n\n if (layout === 'hero') {\n const large = Math.max(room - GAP - small, small)\n return withSteps({ large, largeCount: 1, medium: 0, small }, count)\n }\n\n // As many items at the preferred width as fit beside a medium and a small\n // one, and no more than leave a medium and a small item to fill those two\n // slots, so a short run of items still fills the room rather than leaving\n // its last slots empty. Where what is left for the medium item is not\n // between the small and the large width, the large width gives way, to\n // whatever leaves the medium item halfway between the two.\n const fit = Math.floor((room - small - GAP) / (itemSize + GAP))\n const most = Math.max(1, Math.min(fit, count - 2))\n for (let largeCount = most; largeCount >= 1; largeCount--) {\n const gaps = (largeCount + 1) * GAP\n const medium = room - largeCount * itemSize - gaps - small\n if (medium >= small && medium <= itemSize) {\n return withSteps({ large: itemSize, largeCount, medium, small }, count)\n }\n const large = (room - gaps - 1.5 * small) / (largeCount + 0.5)\n if (large >= small) {\n const sizes = { large, largeCount, medium: (large + small) / 2, small }\n return withSteps(sizes, count)\n }\n }\n // Too narrow for three: one large item and one small, as a hero draws.\n return arrange('hero', room, itemSize, count)\n}\n\n// How many of the slots are filled: all of them, unless there are fewer\n// items, which leaves the last slots empty.\nfunction filledOf(sizes: Omit<Arrangement, 'steps'>, count: number) {\n return Math.min(count, sizes.largeCount + trailingOf(sizes).length)\n}\n\n/**\n * Where every item is drawn with the carousel `position` rests along: a\n * whole number at a rest, and the fraction between two while it moves.\n * `room` is the content box's width and `padding` the space on each side of\n * it, which an item past the edge is drawn beyond.\n */\nfunction placements(\n layout: CarouselLayout,\n arrangement: Arrangement,\n room: number,\n padding: number,\n count: number,\n position: number,\n): Placement[] {\n if (layout === 'uncontained') {\n return Array.from({ length: count }, (_, index) => ({\n left: index * (arrangement.large + GAP),\n width: arrangement.large,\n }))\n }\n\n const clamped = Math.min(Math.max(position, 0), arrangement.steps)\n const from = Math.floor(clamped)\n const to = Math.min(from + 1, arrangement.steps)\n const fraction = clamped - from\n const start = rest(arrangement, room, padding, count, from)\n const end = rest(arrangement, room, padding, count, to)\n\n return start.map((placement, index) => {\n const next = end[index] ?? placement\n return {\n left: placement.left + (next.left - placement.left) * fraction,\n width: placement.width + (next.width - placement.width) * fraction,\n }\n })\n}\n\n// Where every item is drawn at one rest.\nfunction rest(\n arrangement: Arrangement,\n room: number,\n padding: number,\n count: number,\n step: number,\n) {\n const { large, largeCount, small } = arrangement\n const filled = filledOf(arrangement, count)\n const trailing = trailingOf(arrangement).slice(0, filled - largeCount)\n // The last rest drawn from the start; past it, how many trailing slots\n // have turned round to the front, the last of them first.\n const last = count - filled\n const turned = Math.max(0, step - last)\n const kept = trailing.length - turned\n const sizes = [\n ...Array.from(\n { length: turned },\n (_, slot) => trailing[trailing.length - 1 - slot] ?? small,\n ),\n ...Array.from({ length: Math.min(largeCount, filled) }, () => large),\n ...trailing.slice(0, kept),\n ]\n // The item in the first slot. Once the arrangement turns, the slots hold\n // the last items, whichever way round they are drawn.\n const first = Math.min(step, last)\n\n // The slots, laid out from the start edge.\n const lefts: number[] = []\n let cursor = 0\n for (const size of sizes) {\n lefts.push(cursor)\n cursor += size + GAP\n }\n // A turned arrangement that does not fill the room is set against the end\n // edge instead, which is where its large items belong.\n const shift = turned > 0 ? room - (cursor - GAP) : 0\n const away = small > 0 ? small : large\n\n return Array.from({ length: count }, (_, index): Placement => {\n const slot = index - first\n if (slot < 0) {\n // Past the start edge, beyond the padding, a small item per place.\n return { left: -padding + slot * (away + GAP), width: away }\n }\n if (slot >= sizes.length) {\n // Past the end edge, likewise.\n return {\n left: room + padding + GAP + (slot - sizes.length) * (away + GAP),\n width: away,\n }\n }\n return { left: (lefts[slot] ?? 0) + shift, width: sizes[slot] ?? away }\n })\n}\n\n// The widths that follow the large ones at rest: medium then small, or the\n// small alone for a hero.\nfunction trailingOf({ medium, small }: Omit<Arrangement, 'steps'>) {\n return [medium, small].filter((size) => size > 0)\n}\n\n// A rest starts at each item while every slot after it is filled, and each\n// trailing slot turning round to the front is one rest more.\nfunction withSteps(\n sizes: Omit<Arrangement, 'steps'>,\n count: number,\n): Arrangement {\n const filled = filledOf(sizes, count)\n const turning = Math.max(0, filled - sizes.largeCount)\n return { ...sizes, steps: count - filled + turning }\n}\n\nexport type { Arrangement, CarouselLayout, Placement }\n\nexport { arrange, GAP, placements }\n"],"mappings":";AA4BA,MAAME,YAAY;AAClB,MAAMC,YAAY;;;;;AAsBlB,SAASU,QACPC,QACAC,MACAC,UACAC,OACa;CACb,IAAIH,WAAW,eAEb,OAAO;EAAET,OADKa,KAAKC,IAAIH,UAAUD,IACxBV;EAAOC,YAAY;EAAGC,QAAQ;EAAGC,OAAO;EAAGC,OAAO;CAAE;CAI/D,MAAMD,QAAQO,QAAQ,MAA0Bb,YAAYC;CAE5D,IAAIW,WAAW,QAEb,OAAOO,UAAU;EAAEhB,OADLa,KAAKE,IAAIL,OAAAA,IAAaP,OAAOA,KACxBH;EAAOC,YAAY;EAAGC,QAAQ;EAAGC;CAAM,GAAGS,KAAK;CASpE,MAAMK,MAAMJ,KAAKK,OAAOR,OAAOP,QAAAA,MAAgBQ,WAAAA,EAAe;CAC9D,MAAMQ,OAAON,KAAKE,IAAI,GAAGF,KAAKC,IAAIG,KAAKL,QAAQ,CAAC,CAAC;CACjD,KAAK,IAAIX,aAAakB,MAAMlB,cAAc,GAAGA,cAAc;EACzD,MAAMmB,QAAQnB,aAAa,KAAA;EAC3B,MAAMC,SAASQ,OAAOT,aAAaU,WAAWS,OAAOjB;EACrD,IAAID,UAAUC,SAASD,UAAUS,UAC/B,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AAA;GACtDlD,OAAOkD;EACT;EAEF,OAAO;GAAEnD,OAAO8C,MAAMF,SAAS,KAAKM;GAAOjD,OAAOc,MAAM6B,SAASO;EAAK;CACxE,CAAC;AACH;AAIA,SAASjC,WAAW,EAAEtB,QAAQC,SAAqC;CACjE,OAAO,CAACD,QAAQC,KAAK,CAAC,CAACuD,QAAQJ,SAASA,OAAO,CAAC;AAClD;AAIA,SAAStC,UACPK,OACAT,OACa;CACb,MAAMgC,SAAStB,SAASD,OAAOT,KAAK;CACpC,MAAM+C,UAAU9C,KAAKE,IAAI,GAAG6B,SAASvB,MAAMpB,UAAU;CACrD,OAAO;EAAE,GAAGoB;EAAOjB,OAAOQ,QAAQgC,SAASe;CAAQ;AACrD"}
|
|
1
|
+
{"version":3,"file":"arrangement.js","names":["GAP","SMALL_MAX","SMALL_MIN","large","largeCount","medium","small","steps","left","width","arrange","layout","room","itemSize","count","Math","min","max","withSteps","fit","floor","most","gaps","sizes","filledOf","trailingOf","length","placements","arrangement","padding","position","Array","from","_","index","clamped","to","fraction","start","rest","end","map","placement","next","step","filled","trailing","slice","last","turned","kept","slot","first","lefts","cursor","size","push","shift","away","filter","turning"],"sources":["../../src/carousel/arrangement.ts"],"sourcesContent":["// The carousel page's layouts as numbers: which items are large, medium and\n// small at each place a carousel comes to rest, and where each is drawn as\n// it moves between two of them. Apart from the component so the arithmetic\n// can be tested without a browser laying anything out, and so the\n// component's file holds what it renders.\n//\n// The model is MDC-Android's keylines, simplified to what the page draws.\n// At rest a multi-browse carousel shows `largeCount` large items, one medium\n// and one small, filling the room exactly; a hero carousel one large and one\n// small. Each rest is one item further along than the last, and once the\n// last item has come into view the rests that remain turn the arrangement\n// round a slot at a time — small, the large ones, medium; then small,\n// medium, the large ones — so every item is drawn large at one rest at\n// least. At rest `s` the large items are always `s` to `s + largeCount - 1`.\n// Between two rests every item's place and width are interpolated, which is\n// what makes an item grow or shrink as it moves rather than jump. Items past\n// either edge are drawn small and out of sight, so they arrive at the size\n// of the slot they enter.\n//\n// Everything is in pixels along the inline axis of the carousel's content\n// box: 0 is its start edge, inside the leading padding.\n\ntype CarouselLayout = 'hero' | 'multi-browse' | 'uncontained'\n\n/** The page's 8dp between items. */\nconst GAP = 8\n\n/** The page's small item: 40dp at the least and 56dp at the most. */\nconst SMALL_MAX = 56\nconst SMALL_MIN = 40\n\ntype Arrangement = {\n /** The large item's width, which every item is laid out at. */\n large: number\n /** How many items are large at rest. */\n largeCount: number\n /** The medium item's width, or 0 for a layout without one. */\n medium: number\n /** The small item's width, or 0 for a layout without one. */\n small: number\n /** The last place the carousel comes to rest, counting from 0. */\n steps: number\n}\n\n/** Where an item is drawn: the start of what shows of it, and its width. */\ntype Placement = { left: number; width: number }\n\n/**\n * The sizes a layout draws its items at in a content box `room` wide, for\n * `count` items and a preferred large width of `itemSize`.\n */\nfunction arrange(\n layout: CarouselLayout,\n room: number,\n itemSize: number,\n count: number,\n): Arrangement {\n if (layout === 'uncontained') {\n const large = Math.min(itemSize, room)\n return { large, largeCount: 0, medium: 0, small: 0, steps: 0 }\n }\n\n // The small item at its largest unless the room is too narrow for it.\n const small = room >= 3 * SMALL_MAX + 2 * GAP ? SMALL_MAX : SMALL_MIN\n\n if (layout === 'hero') {\n const large = Math.max(room - GAP - small, small)\n return withSteps({ large, largeCount: 1, medium: 0, small }, count)\n }\n\n // As many items at the preferred width as fit beside a medium and a small\n // one, and no more than leave a medium and a small item to fill those two\n // slots, so a short run of items still fills the room rather than leaving\n // its last slots empty. Where what is left for the medium item is not\n // between the small and the large width, the large width gives way, to\n // whatever leaves the medium item halfway between the two.\n const fit = Math.floor((room - small - GAP) / (itemSize + GAP))\n const most = Math.max(1, Math.min(fit, count - 2))\n for (let largeCount = most; largeCount >= 1; largeCount--) {\n const gaps = (largeCount + 1) * GAP\n const medium = room - largeCount * itemSize - gaps - small\n if (medium >= small && medium <= itemSize) {\n return withSteps({ large: itemSize, largeCount, medium, small }, count)\n }\n const large = (room - gaps - 1.5 * small) / (largeCount + 0.5)\n if (large >= small) {\n const sizes = { large, largeCount, medium: (large + small) / 2, small }\n return withSteps(sizes, count)\n }\n }\n // Too narrow for three: one large item and one small, as a hero draws.\n return arrange('hero', room, itemSize, count)\n}\n\n// How many of the slots are filled: all of them, unless there are fewer\n// items, which leaves the last slots empty.\nfunction filledOf(sizes: Omit<Arrangement, 'steps'>, count: number) {\n return Math.min(count, sizes.largeCount + trailingOf(sizes).length)\n}\n\n/**\n * Where every item is drawn with the carousel `position` rests along: a\n * whole number at a rest, and the fraction between two while it moves.\n * `room` is the content box's width and `padding` the space on each side of\n * it, which an item past the edge is drawn beyond.\n */\nfunction placements(\n layout: CarouselLayout,\n arrangement: Arrangement,\n room: number,\n padding: number,\n count: number,\n position: number,\n): Placement[] {\n if (layout === 'uncontained') {\n return Array.from({ length: count }, (_, index) => ({\n left: index * (arrangement.large + GAP),\n width: arrangement.large,\n }))\n }\n\n const clamped = Math.min(Math.max(position, 0), arrangement.steps)\n const from = Math.floor(clamped)\n const to = Math.min(from + 1, arrangement.steps)\n const fraction = clamped - from\n const start = rest(arrangement, room, padding, count, from)\n const end = rest(arrangement, room, padding, count, to)\n\n return start.map((placement, index) => {\n const next = end[index] ?? placement\n return {\n left: placement.left + (next.left - placement.left) * fraction,\n width: placement.width + (next.width - placement.width) * fraction,\n }\n })\n}\n\n// Where every item is drawn at one rest.\nfunction rest(\n arrangement: Arrangement,\n room: number,\n padding: number,\n count: number,\n step: number,\n) {\n const { large, largeCount, small } = arrangement\n const filled = filledOf(arrangement, count)\n const trailing = trailingOf(arrangement).slice(0, filled - largeCount)\n // The last rest drawn from the start; past it, how many trailing slots\n // have turned round to the front, the last of them first.\n const last = count - filled\n const turned = Math.max(0, step - last)\n const kept = trailing.length - turned\n const sizes = [\n ...Array.from(\n { length: turned },\n (_, slot) => trailing[trailing.length - 1 - slot] ?? small,\n ),\n ...Array.from({ length: Math.min(largeCount, filled) }, () => large),\n ...trailing.slice(0, kept),\n ]\n // The item in the first slot. Once the arrangement turns, the slots hold\n // the last items, whichever way round they are drawn.\n const first = Math.min(step, last)\n\n // The slots, laid out from the start edge.\n const lefts: number[] = []\n let cursor = 0\n for (const size of sizes) {\n lefts.push(cursor)\n cursor += size + GAP\n }\n // A turned arrangement that does not fill the room is set against the end\n // edge instead, which is where its large items belong.\n const shift = turned > 0 ? room - (cursor - GAP) : 0\n const away = small > 0 ? small : large\n\n return Array.from({ length: count }, (_, index): Placement => {\n const slot = index - first\n if (slot < 0) {\n // Past the start edge, beyond the padding, a small item per place.\n return { left: -padding + slot * (away + GAP), width: away }\n }\n if (slot >= sizes.length) {\n // Past the end edge, likewise.\n return {\n left: room + padding + GAP + (slot - sizes.length) * (away + GAP),\n width: away,\n }\n }\n return { left: (lefts[slot] ?? 0) + shift, width: sizes[slot] ?? away }\n })\n}\n\n// The widths that follow the large ones at rest: medium then small, or the\n// small alone for a hero.\nfunction trailingOf({ medium, small }: Omit<Arrangement, 'steps'>) {\n return [medium, small].filter((size) => size > 0)\n}\n\n// A rest starts at each item while every slot after it is filled, and each\n// trailing slot turning round to the front is one rest more.\nfunction withSteps(\n sizes: Omit<Arrangement, 'steps'>,\n count: number,\n): Arrangement {\n const filled = filledOf(sizes, count)\n const turning = Math.max(0, filled - sizes.largeCount)\n return { ...sizes, steps: count - filled + turning }\n}\n\nexport type { Arrangement, CarouselLayout, Placement }\n\nexport { arrange, GAP, placements }\n"],"mappings":";AA4BA,MAAMC,YAAY;AAClB,MAAMC,YAAY;;;;;AAsBlB,SAASQ,QACPC,QACAC,MACAC,UACAC,OACa;CACb,IAAIH,WAAW,eAEb,OAAO;EAAER,OADKY,KAAKC,IAAIH,UAAUD,IACxBT;EAAOC,YAAY;EAAGC,QAAQ;EAAGC,OAAO;EAAGC,OAAO;CAAE;CAI/D,MAAMD,QAAQM,QAAQ,MAA0BX,YAAYC;CAE5D,IAAIS,WAAW,QAEb,OAAOO,UAAU;EAAEf,OADLY,KAAKE,IAAIL,OAAAA,IAAaN,OAAOA,KACx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S,IAAIrC,QAAQ0C,SAAAA,KAAgB;CACnD,MAAMI,OAAOpD,QAAQ,IAAIA,QAAQH;CAEjC,OAAO4B,MAAMC,KAAK,EAAEN,QAAQZ,MAAM,IAAImB,GAAGC,UAAqB;EAC5D,MAAMiB,OAAOjB,QAAQkB;EACrB,IAAID,OAAO,GAET,OAAO;GAAE3C,MAAM,CAACqB,UAAUsB,QAAQO,OAAAA;GAAajD,OAAOiD;EAAK;EAE7D,IAAIP,QAAQ5B,MAAMG,QAEhB,OAAO;GACLlB,MAAMI,OAAOiB,UAAAA,KAAiBsB,OAAO5B,MAAMG,WAAWgC,OAAAA;GACtDjD,OAAOiD;EACT;EAEF,OAAO;GAAElD,OAAO6C,MAAMF,SAAS,KAAKM;GAAOhD,OAAOc,MAAM4B,SAASO;EAAK;CACxE,CAAC;AACH;AAIA,SAASjC,WAAW,EAAEpB,QAAQC,SAAqC;CACjE,OAAO,CAACD,QAAQC,KAAK,CAAC,CAACqD,QAAQJ,SAASA,OAAO,CAAC;AAClD;AAIA,SAASrC,UACPK,OACAT,OACa;CACb,MAAM+B,SAASrB,SAASD,OAAOT,KAAK;CACpC,MAAM8C,UAAU7C,KAAKE,IAAI,GAAG4B,SAAStB,MAAMnB,UAAU;CACrD,OAAO;EAAE,GAAGmB;EAAOhB,OAAOO,QAAQ+B,SAASe;CAAQ;AACrD"}
|
package/dist/chip/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","stylex","CheckGlyph","focus","ChipLabel","chipLayers","chipStyles","chipGlyph","state","isDisabled","isSelected","icon","selectable","hasIcon","undefined","props","glyph","glyphOpening","glyphFolded","glyphSvg","chipLabel","children","chipTrailingIcon","trailing","CONTAINERS","elevated","disabled","elevatedDisabled","focused","elevatedFocused","hovered","elevatedHovered","pressed","elevatedPressed","selected","disabledSelected","selectedFocused","selectedHovered","selectedPressed","unselected","disabledUnselected","unselectedFocused","unselectedHovered","unselectedPressed","ChipKind","chipPropsFor","isFocusVisible","isHovered","isPressed","inert","kind","roles","containerOf","raised","lifted","base","target","ring","assist","raisedHovered","chipRemoveClassName","remove","removeHovered","removePressed","removeDisabled","className","stylex.props"],"sources":["../../src/chip/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckGlyph } from '../glyphs';\nimport { focus } from '../styles/focus';\nimport { ChipLabel } from './label';\nimport { chipLayers, chipStyles } from './styles';\n\n/**\n * What a chip draws before its label: the check while it is selected, its own\n * icon while it is not, and for an unselected chip with no icon, a slot folded\n * to nothing that opens when it is selected. A chip that can never be selected\n * passes `selectable` as false and draws nothing there. Returns a node rather\n * than letting the type be inferred, since `ReactNode` is a union that\n * includes a promise and an inferred one has to be `async`.\n *\n * The check takes the icon's place rather than joining it, as the chips page\n * draws a filter chip and as a segmented button's segments do. So a chip with\n * an icon keeps its width when it is chosen, where one without grows by the\n * slot, and the slot is kept mounted while folded so that growth has a width\n * to transition from; see the header of `./styles`.\n *\n * Shared rather than written at each of the two call sites: Chip and\n * ChipGroup's chip draw the same pill from `./styles`, and a check written\n * twice is the drift that module exists to stop. Not a component of the\n * library's own and not exported from the package; see `src/row` for the\n * same arrangement around a list's row.\n */\nfunction chipGlyph(state: {\n isDisabled: boolean;\n isSelected: boolean;\n}, icon?: ReactNode, selectable = true): ReactNode {\n const hasIcon = icon !== undefined && icon !== null;\n if (!hasIcon && (selectable || state.isSelected)) {\n return <span {...stylex.props(chipStyles.glyph, chipStyles.glyphOpening, !state.isSelected && chipStyles.glyphFolded)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (state.isSelected) {\n return <span {...stylex.props(chipStyles.glyph)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (!hasIcon) {\n return null;\n }\n return <span {...stylex.props(chipStyles.glyph, !state.isDisabled && chipStyles.icon)}>\n {icon}\n </span>;\n}\n\n/**\n * The label a chip draws, in a span of its own so it can be cut short with an\n * ellipsis rather than wrapped out of the pill; see the header of `./styles`.\n * A label cut short shows its full text in the browser's tooltip on hover —\n * see `useClippedTitle`. Shared for the reason `chipGlyph` is, by all three\n * components that draw the pill.\n */\nfunction chipLabel(children: ReactNode): ReactNode {\n return <ChipLabel>{children}</ChipLabel>;\n}\n\n/**\n * What a chip draws after its label: its trailing icon, in the 18dp slot the\n * leading one takes, trimming the chip's padding at its own end instead. It\n * keeps the chip's content colour, which is the page's trailing icon role in\n * every state, and it stays while the chip is selected, since the check\n * takes the leading slot alone. Nothing at all for a chip with none. Beside\n * `chipGlyph` so the two slots are drawn from one box.\n */\nfunction chipTrailingIcon(icon?: ReactNode): ReactNode {\n if (icon === undefined || icon === null) {\n return null;\n }\n return <span {...stylex.props(chipStyles.glyph, chipStyles.trailing)}>{icon}</span>;\n}\n\n// The three containers a chip can be on, with the layers and the disabled\n// treatment each takes. A table rather than a branch per state, so the\n// containers cannot differ in which states they answer.\nconst CONTAINERS = {\n elevated: {\n disabled: chipStyles.elevatedDisabled,\n focused: chipLayers.elevatedFocused,\n hovered: chipLayers.elevatedHovered,\n pressed: chipLayers.elevatedPressed\n },\n selected: {\n disabled: chipStyles.disabledSelected,\n focused: chipLayers.selectedFocused,\n hovered: chipLayers.selectedHovered,\n pressed: chipLayers.selectedPressed\n },\n unselected: {\n disabled: chipStyles.disabledUnselected,\n focused: chipLayers.unselectedFocused,\n hovered: chipLayers.unselectedHovered,\n pressed: chipLayers.unselectedPressed\n }\n};\n\n/** Which of the page's chips a pill is drawn as. */\ntype ChipKind = 'assist' | 'filter' | 'input' | 'suggestion';\n\n/**\n * The pill's styles in the render state React Aria hands a chip's\n * `className`, for Chip's two buttons and ChipGroup's tag alike. StyleX\n * cannot target `[data-selected]` on the element it is styling, so the\n * container is chosen here rather than in CSS — which is also why an\n * uncontrolled chip styles itself without keeping a copy of its state.\n *\n * Shared for the reason `chipGlyph` is: the order is the precedence. The\n * hover, focus and pressed layers come from the render state over the\n * container — focus over hover, and a press over both — and disabled comes\n * last so it wins over all of them, since StyleX replaces a property whole.\n *\n * `elevated` raises the chip off the page on a container of its own, and\n * `kind` names which of the page's chips it is, which decides the label's\n * role and whether a flat selected chip lifts under a hovering pointer: a\n * filter chip does and an input chip, a group's removable one, does not. A\n * hover's lift gives way while the chip is pressed, since a mouse press does\n * not end the hover.\n * `inert` marks a chip a press does nothing to, which draws the arrow rather\n * than the pointer.\n */\nfunction chipPropsFor(state: {\n isDisabled: boolean;\n isFocusVisible: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n}, {\n elevated = false,\n inert = false,\n kind = 'filter'\n}: {\n elevated?: boolean;\n inert?: boolean;\n kind?: ChipKind;\n} = {}) {\n const roles = CONTAINERS[containerOf(state.isSelected, elevated)];\n const raised = elevated && !state.isDisabled;\n const lifted = state.isHovered && !state.isPressed;\n return stylex.props(chipStyles.base, inert && chipStyles.inert, chipStyles.target, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, elevated && !state.isSelected && chipStyles.elevated, kind === 'assist' && chipStyles.assist, raised && chipStyles.raised, state.isHovered && roles.hovered, raised && lifted && chipStyles.raisedHovered, kind === 'filter' && !elevated && state.isSelected && lifted && chipStyles.selectedHovered, state.isFocusVisible && roles.focused, state.isPressed && roles.pressed, state.isDisabled && chipStyles.disabled, state.isDisabled && roles.disabled);\n}\n\n/**\n * The close target's class, from its button's own render state, so its\n * hover and pressed layers follow React Aria's report rather than `:hover`\n * and `:active` — see `chipLayers` — and a disabled chip's close target\n * takes the chip's cursor. A function, which React Aria's `className` takes\n * alongside a string.\n */\nfunction chipRemoveClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n}) {\n return stylex.props(chipStyles.remove, state.isHovered && chipLayers.removeHovered, state.isPressed && chipLayers.removePressed, state.isDisabled && chipStyles.removeDisabled).className ?? '';\n}\n\n// Which container a chip is on: the secondary container while selected,\n// elevated or not, and otherwise the elevated one or the outline.\nfunction containerOf(isSelected: boolean, elevated: boolean) {\n if (isSelected) {\n return 'selected';\n }\n return elevated ? 'elevated' : 'unselected';\n}\nexport type { ChipKind };\nexport { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName, chipTrailingIcon };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASO,UAAUC,OAGhBG,MAAkBC,aAAa,MAAiB;CACjD,MAAMC,UAAUF,SAASG,KAAAA,KAAaH,SAAS;CAC/C,IAAI,CAACE,YAAYD,cAAcJ,MAAME,aACnC,OAAO,oBAAC,QAAD;EAAM,GAAIT,MAAaK,WAAWU,OAAOV,WAAWW,cAAc,CAACT,MAAME,cAAcJ,WAAWY,WAAW;EAChH,UAAA,oBAAC,YAAD,EAAY,GAAIjB,MAAaK,WAAWa,QAAQ,EAAE,CAAA;CAC9C,CAAA;CAEV,IAAIX,MAAME,YACR,OAAO,oBAAC,QAAD;EAAM,GAAIT,MAAaK,WAAWU,KAAK;EAC1C,UAAA,oBAAC,YAAD,EAAY,GAAIf,MAAaK,WAAWa,QAAQ,EAAE,CAAA;CAC9C,CAAA;CAEV,IAAI,CAACN,SACH,OAAO;CAET,OAAO,oBAAC,QAAD;EAAM,GAAIZ,MAAaK,WAAWU,OAAO,CAACR,MAAMC,cAAcH,WAAWK,IAAI;EAC/EA,UAAAA;CACG,CAAA;AACV;;;;;;;;AASA,SAASS,UAAUC,UAAgC;CACjD,OAAO,oBAAC,WAAD,EAAYA,SAAoB,CAAA;AACzC;;;;;;;;;AAUA,SAASC,iBAAiBX,MAA6B;CACrD,IAAIA,SAASG,KAAAA,KAAaH,SAAS,MACjC,OAAO;CAET,OAAO,oBAAC,QAAD;EAAM,GAAIV,MAAaK,WAAWU,OAAOV,WAAWiB,QAAQ;EAAIZ,UAAAA;CAAW,CAAA;AACpF;AAKA,MAAMa,aAAa;CACjBC,UAAU;EACRC,UAAUpB,WAAWqB;EACrBC,SAASvB,WAAWwB;EACpBC,SAASzB,WAAW0B;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AIA,SAASb,YAAY1C,YAAqBe,UAAmB;CAC3D,IAAIf,YACF,OAAO;CAET,OAAOe,WAAW,aAAa;AACjC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["stylex","focus","chipLayers","chipStyles","chipGlyph","state","isDisabled","isSelected","icon","selectable","hasIcon","undefined","glyph","glyphOpening","glyphFolded","glyphSvg","chipLabel","children","chipTrailingIcon","trailing","CONTAINERS","elevated","disabled","elevatedDisabled","focused","elevatedFocused","hovered","elevatedHovered","pressed","elevatedPressed","selected","disabledSelected","selectedFocused","selectedHovered","selectedPressed","unselected","disabledUnselected","unselectedFocused","unselectedHovered","unselectedPressed","chipPropsFor","isFocusVisible","isHovered","isPressed","inert","kind","roles","containerOf","raised","lifted","base","target","ring","assist","raisedHovered","chipRemoveClassName","remove","removeHovered","removePressed","removeDisabled","className"],"sources":["../../src/chip/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckGlyph } from '../glyphs';\nimport { focus } from '../styles/focus';\nimport { ChipLabel } from './label';\nimport { chipLayers, chipStyles } from './styles';\n\n/**\n * What a chip draws before its label: the check while it is selected, its own\n * icon while it is not, and for an unselected chip with no icon, a slot folded\n * to nothing that opens when it is selected. A chip that can never be selected\n * passes `selectable` as false and draws nothing there. Returns a node rather\n * than letting the type be inferred, since `ReactNode` is a union that\n * includes a promise and an inferred one has to be `async`.\n *\n * The check takes the icon's place rather than joining it, as the chips page\n * draws a filter chip and as a segmented button's segments do. So a chip with\n * an icon keeps its width when it is chosen, where one without grows by the\n * slot, and the slot is kept mounted while folded so that growth has a width\n * to transition from; see the header of `./styles`.\n *\n * Shared rather than written at each of the two call sites: Chip and\n * ChipGroup's chip draw the same pill from `./styles`, and a check written\n * twice is the drift that module exists to stop. Not a component of the\n * library's own and not exported from the package; see `src/row` for the\n * same arrangement around a list's row.\n */\nfunction chipGlyph(state: {\n isDisabled: boolean;\n isSelected: boolean;\n}, icon?: ReactNode, selectable = true): ReactNode {\n const hasIcon = icon !== undefined && icon !== null;\n if (!hasIcon && (selectable || state.isSelected)) {\n return <span {...stylex.props(chipStyles.glyph, chipStyles.glyphOpening, !state.isSelected && chipStyles.glyphFolded)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (state.isSelected) {\n return <span {...stylex.props(chipStyles.glyph)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (!hasIcon) {\n return null;\n }\n return <span {...stylex.props(chipStyles.glyph, !state.isDisabled && chipStyles.icon)}>\n {icon}\n </span>;\n}\n\n/**\n * The label a chip draws, in a span of its own so it can be cut short with an\n * ellipsis rather than wrapped out of the pill; see the header of `./styles`.\n * A label cut short shows its full text in the browser's tooltip on hover —\n * see `useClippedTitle`. Shared for the reason `chipGlyph` is, by all three\n * components that draw the pill.\n */\nfunction chipLabel(children: ReactNode): ReactNode {\n return <ChipLabel>{children}</ChipLabel>;\n}\n\n/**\n * What a chip draws after its label: its trailing icon, in the 18dp slot the\n * leading one takes, trimming the chip's padding at its own end instead. It\n * keeps the chip's content colour, which is the page's trailing icon role in\n * every state, and it stays while the chip is selected, since the check\n * takes the leading slot alone. Nothing at all for a chip with none. Beside\n * `chipGlyph` so the two slots are drawn from one box.\n */\nfunction chipTrailingIcon(icon?: ReactNode): ReactNode {\n if (icon === undefined || icon === null) {\n return null;\n }\n return <span {...stylex.props(chipStyles.glyph, chipStyles.trailing)}>{icon}</span>;\n}\n\n// The three containers a chip can be on, with the layers and the disabled\n// treatment each takes. A table rather than a branch per state, so the\n// containers cannot differ in which states they answer.\nconst CONTAINERS = {\n elevated: {\n disabled: chipStyles.elevatedDisabled,\n focused: chipLayers.elevatedFocused,\n hovered: chipLayers.elevatedHovered,\n pressed: chipLayers.elevatedPressed\n },\n selected: {\n disabled: chipStyles.disabledSelected,\n focused: chipLayers.selectedFocused,\n hovered: chipLayers.selectedHovered,\n pressed: chipLayers.selectedPressed\n },\n unselected: {\n disabled: chipStyles.disabledUnselected,\n focused: chipLayers.unselectedFocused,\n hovered: chipLayers.unselectedHovered,\n pressed: chipLayers.unselectedPressed\n }\n};\n\n/** Which of the page's chips a pill is drawn as. */\ntype ChipKind = 'assist' | 'filter' | 'input' | 'suggestion';\n\n/**\n * The pill's styles in the render state React Aria hands a chip's\n * `className`, for Chip's two buttons and ChipGroup's tag alike. StyleX\n * cannot target `[data-selected]` on the element it is styling, so the\n * container is chosen here rather than in CSS — which is also why an\n * uncontrolled chip styles itself without keeping a copy of its state.\n *\n * Shared for the reason `chipGlyph` is: the order is the precedence. The\n * hover, focus and pressed layers come from the render state over the\n * container — focus over hover, and a press over both — and disabled comes\n * last so it wins over all of them, since StyleX replaces a property whole.\n *\n * `elevated` raises the chip off the page on a container of its own, and\n * `kind` names which of the page's chips it is, which decides the label's\n * role and whether a flat selected chip lifts under a hovering pointer: a\n * filter chip does and an input chip, a group's removable one, does not. A\n * hover's lift gives way while the chip is pressed, since a mouse press does\n * not end the hover.\n * `inert` marks a chip a press does nothing to, which draws the arrow rather\n * than the pointer.\n */\nfunction chipPropsFor(state: {\n isDisabled: boolean;\n isFocusVisible: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n}, {\n elevated = false,\n inert = false,\n kind = 'filter'\n}: {\n elevated?: boolean;\n inert?: boolean;\n kind?: ChipKind;\n} = {}) {\n const roles = CONTAINERS[containerOf(state.isSelected, elevated)];\n const raised = elevated && !state.isDisabled;\n const lifted = state.isHovered && !state.isPressed;\n return stylex.props(chipStyles.base, inert && chipStyles.inert, chipStyles.target, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, elevated && !state.isSelected && chipStyles.elevated, kind === 'assist' && chipStyles.assist, raised && chipStyles.raised, state.isHovered && roles.hovered, raised && lifted && chipStyles.raisedHovered, kind === 'filter' && !elevated && state.isSelected && lifted && chipStyles.selectedHovered, state.isFocusVisible && roles.focused, state.isPressed && roles.pressed, state.isDisabled && chipStyles.disabled, state.isDisabled && roles.disabled);\n}\n\n/**\n * The close target's class, from its button's own render state, so its\n * hover and pressed layers follow React Aria's report rather than `:hover`\n * and `:active` — see `chipLayers` — and a disabled chip's close target\n * takes the chip's cursor. A function, which React Aria's `className` takes\n * alongside a string.\n */\nfunction chipRemoveClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n}) {\n return stylex.props(chipStyles.remove, state.isHovered && chipLayers.removeHovered, state.isPressed && chipLayers.removePressed, state.isDisabled && chipStyles.removeDisabled).className ?? '';\n}\n\n// Which container a chip is on: the secondary container while selected,\n// elevated or not, and otherwise the elevated one or the outline.\nfunction containerOf(isSelected: boolean, elevated: boolean) {\n if (isSelected) {\n return 'selected';\n }\n return elevated ? 'elevated' : 'unselected';\n}\nexport type { ChipKind };\nexport { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName, chipTrailingIcon };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASI,UAAUC,OAGhBG,MAAkBC,aAAa,MAAiB;CACjD,MAAMC,UAAUF,SAASG,KAAAA,KAAaH,SAAS;CAC/C,IAAI,CAACE,YAAYD,cAAcJ,MAAME,aACnC,OAAO,oBAAC,QAAD;EAAM,GAAIP,MAAaG,WAAWS,OAAOT,WAAWU,cAAc,CAACR,MAAME,cAAcJ,WAAWW,WAAW;EAChH,UAAA,oBAAC,YAAD,EAAY,GAAId,MAAaG,WAAWY,QAAQ,EAAE,CAAA;CAC9C,CAAA;CAEV,IAAIV,MAAME,YACR,OAAO,oBAAC,QAAD;EAAM,GAAIP,MAAaG,WAAWS,KAAK;EAC1C,UAAA,oBAAC,YAAD,EAAY,GAAIZ,MAAaG,WAAWY,QAAQ,EAAE,CAAA;CAC9C,CAAA;CAEV,IAAI,CAACL,SACH,OAAO;CAET,OAAO,oBAAC,QAAD;EAAM,GAAIV,MAAaG,WAAWS,OAAO,CAACP,MAAMC,cAAcH,WAAWK,IAAI;EAC/EA,UAAAA;CACG,CAAA;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CAACxB,YAAYhB,MAAME,cAAc0C,UAAU9C,WAAW8B,iBAAiB5B,MAAMoC,kBAAkBK,MAAMtB,SAASnB,MAAMsC,aAAaG,MAAMlB,SAASvB,MAAMC,cAAcH,WAAWmB,UAAUjB,MAAMC,cAAcwC,MAAMxB,QAAQ;AAC5lB;;;;;;;;AASA,SAASiC,oBAAoBlD,OAI1B;CACD,OAAOL,MAAaG,WAAWqD,QAAQnD,MAAMqC,aAAaxC,WAAWuD,eAAepD,MAAMsC,aAAazC,WAAWwD,eAAerD,MAAMC,cAAcH,WAAWwD,cAAc,CAAC,CAACC,aAAa;AAC/L;AAIA,SAASb,YAAYxC,YAAqBc,UAAmB;CAC3D,IAAId,YACF,OAAO;CAET,OAAOc,WAAW,aAAa;AACjC"}
|
package/dist/chip/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","names":["
|
|
1
|
+
{"version":3,"file":"label.js","names":["stylex","useClippedTitle","chipStyles","ChipLabel","t0","$","_c","children","clipped","t1","Symbol","for","label","t2"],"sources":["../../src/chip/label.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useClippedTitle } from '../hooks/useClippedTitle';\nimport { chipStyles } from './styles';\n\n// Apart from ./index.tsx so that file keeps to the helpers it shares and this\n// one to the component, which is what keeps fast refresh working for both.\n\n// The span `chipLabel` draws, as a component, since the title is state and\n// `chipLabel` is called from React Aria's render functions.\nfunction ChipLabel({\n children\n}: {\n children: ReactNode;\n}) {\n const clipped = useClippedTitle(children);\n return <span {...clipped} {...stylex.props(chipStyles.label)}>\n {children}\n </span>;\n}\nexport { ChipLabel };"],"mappings":";;;;;;AAUA,SAAAG,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAmB,MAAA,EAAAC,aAAAH;CAKjB,MAAAI,UAAgBP,gBAAgBM,QAAQ;CAAE,IAAAE;CAAA,IAAAJ,EAAA,OAAAK,OAAAC,IAAA,2BAAA,GAAA;EACZF,KAAAT,MAAaE,WAAUU,KAAM;EAACP,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAE,YAAAF,EAAA,OAAAG,SAAA;EAArDK,KAAA,oBAAA,QAAA;GAEE,GAFQL;GAAO,GAAMC;GACzBF;EACI,CAAA;EAAAF,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAFFQ;AAEE"}
|
package/dist/chip/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["stylex","colors","motion","radii","shadows","sizing","spacing","stateLayerOpacity","typography","TARGET_SIZE","FORCED_COLORS","chipStyles","assist","kMwMTN","$$css","base","k6CgDc","kGNEyG","kZKoxP","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kmuXW","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","ks0D6T","k8WAf4","kg3NbH","kIyJzY","k1ekBW","kAMwcw","disabled","disabledSelected","kWkggS","disabledUnselected","kVAM5u","elevated","elevatedDisabled","kGVxlE","glyph","kzqmXN","kjj79g","keTefX","glyphFolded","k71WvV","kSiTet","glyphOpening","kVQacm","glyphSvg","icon","inert","label","kg5iWk","khDVqt","raised","raisedHovered","remove","kgeoSG","kFcpXp","kEoFBp","kjBf7l","kInvED","k3XXqK","kMeerF","kmVPX3","kVAEAm","removeDisabled","removeGlyph","selected","selectedHovered","surfaceCorners","target","kGOzcv","kpsdNU","trailing","unselected","chipLayers","elevatedFocused","elevatedHovered","elevatedPressed","removeHovered","removePressed","selectedFocused","selectedPressed","unselectedFocused","unselectedHovered","unselectedPressed"],"sources":["../../src/chip/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The pill the chips page draws, shared by the three components that draw\n// one: Chip, which is a toggle on its own or one of the page's two action\n// chips; ChipGroup's chip, which is one of a set that can also be removed;\n// and TokenField's token, which takes `base` and `unselected` alone — a token\n// is not selectable, so it reaches for neither the selected container nor\n// the check below. The measurements and roles are the page's filter chip — a\n// 32dp container with an 8dp corner and 16dp of inline padding, an outline\n// variant border while unselected, the secondary container pair once\n// selected.\n//\n// The assist and suggestion chips are that unselected pill, never selected.\n// The page's only difference between them is the label: on surface on an\n// assist chip, on surface variant on a suggestion chip as on a filter one.\n//\n// **An elevated chip trades the outline for a container**, surface container\n// low at the page's elevation 1, raised to 2 under a hovering pointer and\n// back to 1 while pressed, since a mouse press does not end the hover. A\n// selected one keeps the secondary container and takes the shadow with it.\n// Its 1px border stays, transparent, as every chip's does: a forced-colours\n// mode paints a transparent border in its text colour and drops the shadow\n// and the fill, so the border is the boundary left there.\n//\n// **A flat chip lies on the page, apart from one state.** A selected filter\n// chip under a hovering pointer rises to elevation 1, and comes back down\n// while pressed, as the page's filter chip tokens give it; every other flat\n// state, and every state of an input chip, stays at 0.\n//\n// **A disabled chip is translucent**, its content at 38% and its container at\n// 12% of on surface over whatever is behind it, as the page gives them,\n// rather than mixed into the surface. Mixed into the surface, a disabled chip\n// on a coloured container drew an opaque pale patch with grey text on it.\n//\n// **A label with no room on one line is cut short, never wrapped.** The\n// container is a fixed 32dp, so a second line has nowhere to go but out of\n// the pill: a chip or a token in a room narrower than its label drew the\n// rest below its own edge, and a chip in a group's row ran past the row's\n// end instead. The pill is held to the room it is in, and the label sits in\n// a span of its own that ends in an ellipsis where the pill does — a span,\n// because a flex container ignores `text-overflow`, which is also why\n// Material's own chips carry one. The whole label stays in the DOM, so a\n// screen reader still reads all of it.\n//\n// Each state composites an on-colour over its own container at the\n// interaction state's opacity rather than swapping in a separate hover\n// colour. `calc(<opacity> * 100%)` turns the token's unitless 0-1 ratio into\n// the percentage `color-mix()` takes, and it is inlined at each property\n// because @stylexjs/babel-plugin only statically recognises expressions\n// written directly as property values.\n//\n// The selected chip drops its border rather than recolouring it: it has a\n// container of its own to define its edge, and a border on top of that reads\n// as a second, competing outline.\n//\n// Disabled is applied from render state rather than from `:disabled`. Chip is\n// a button and would match the pseudo-class; a chip in a group is React\n// Aria's `Tag`, which is a div and never will. One mechanism serves both, and\n// StyleX replaces a property whole, so the disabled styles take the hover and\n// pressed branches of whichever state they are applied over.\n//\n// A selected chip carries the page's check before its label, which is what\n// makes the selection legible without colour. The two containers differ in\n// colour alone, and under a scheme whose secondary container sits close to\n// the surface — or for a reader who does not see colour — that is no\n// difference at all.\n//\n// The chip widens when the check appears, and that is the page's behaviour\n// rather than a cost of drawing it: a chip is flow content, laid out in a\n// row that wraps, so nothing around it has a width to hold. A segmented\n// button's segments are equal columns of one track, which is a different\n// geometry answering a different question, and the two should not be read\n// across. A chip given an icon does not widen, since the check takes the\n// icon's place in the same slot.\n//\n// **A filter chip can carry an icon after its label as well**, the page's\n// trailing icon, which is what draws its dropdown filter chip: an arrow\n// saying the chip opens a menu. It takes the same 18dp slot at the other\n// end, and the chip's content role rather than the primary one the leading\n// icon takes — on surface variant, then on secondary container once\n// selected, then the disabled 38% — so it is drawn in the chip's own colour\n// rather than a role of its own. The check never displaces it.\n//\n// **The widening is animated rather than taken in one frame.** A chip with\n// no icon keeps its slot mounted while unselected, folded to nothing, and\n// selecting it opens the slot over the chip's own short duration while the\n// check fades in, so the chips after it in a wrapped row glide rather than\n// jump 18dp. Reduced motion takes the change at once, as it does the\n// colours. A chip that can never be selected, an assist or suggestion chip\n// or one in a group that does not select, has no slot to open.\n//\n// **The press ripple takes the chip's corner from here** wherever the chip\n// is a ChipGroup's. The ripple clips itself to its host's corner by\n// inheriting it, and React Aria puts a cell between a group's chip and its\n// content, so what the ripple would inherit is the cell's square corner.\n// `surfaceCorners` restates the chip's own corner on a box the ripple sits\n// in, less the 1px border every chip keeps, since the ripple fills the\n// inside of that border.\n//\n// Apart from any component so a chip in a group and a chip on its own cannot\n// drift; see `src/row` for the same arrangement around a list's row.\n\n// The press area the chips page requires around its 32dp chip. A literal for\n// the reason IconButton's `TARGET_SIZE` gives.\nconst TARGET_SIZE = '48px';\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)';\nconst chipStyles = {\n assist: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n base: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xig8zya\",\n kaIpWk: \"x1xdvaa9\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n ks0D6T: \"x193iq5w\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"x790zyz\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xu8237s\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1gpw424 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n disabledSelected: {\n kWkggS: \"x19v6zzp\",\n $$css: true\n },\n disabledUnselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3 xmnqt3w\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1vnz5z6\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n elevatedDisabled: {\n kWkggS: \"x19v6zzp\",\n kVAM5u: \"x9r1u3d\",\n kGVxlE: \"x1gnnqk1\",\n $$css: true\n },\n glyph: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xmix8c7\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kGuDYH: \"xosj86m\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n keTefX: \"xxuhe3a\",\n $$css: true\n },\n glyphFolded: {\n kzqmXN: \"xnalus7\",\n k71WvV: \"x1kfc2zf\",\n keTefX: \"x1lziwak\",\n kSiTet: \"xg01cxk\",\n $$css: true\n },\n glyphOpening: {\n k6CgDc: \"x12w9bfk\",\n kVQacm: \"xb3r6kr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x17vvy08\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n glyphSvg: {\n kZKoxP: \"xmix8c7\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n icon: {\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n inert: {\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n label: {\n kB7OPa: \"x9f619\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n raised: {\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n raisedHovered: {\n kGVxlE: \"x1os83gw\",\n $$css: true\n },\n remove: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"xtu493u\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n k71WvV: \"x1kfc2zf\",\n kjBf7l: \"x14ytart\",\n kInvED: \"x1y3gkto\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n removeDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n removeGlyph: {\n kZKoxP: \"xmix8c7\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n selected: {\n kWkggS: \"x15dekr4\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n selectedHovered: {\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n surfaceCorners: {\n kaIpWk: \"x5a2xki\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"xjp7ctv\",\n $$css: true\n },\n target: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1xkszu9\",\n kpsdNU: \"x1ecwmwu\",\n kEoFBp: \"x1hmns74\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n trailing: {\n k71WvV: \"x1kfc2zf\",\n keTefX: \"x1lziwak\",\n $$css: true\n },\n unselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x133yhug\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\n\n// The hover and pressed layers, applied from React Aria's render state rather\n// than from `:hover` and `:active`, for Button's reasons — see its header: a\n// hover layer stayed on after a tap, and no pressed layer showed for a press\n// made from the keyboard. One pair per container, the pressed after the\n// hovered so a press wins, and one for the close target, whose own render\n// state is its button's. A token in a TokenField draws none of them: React\n// Aria reports neither state for one, since it is text the caret moves\n// through rather than a control a press acts on.\nconst chipLayers = {\n elevatedFocused: {\n kWkggS: \"x1drsm1c\",\n $$css: true\n },\n elevatedHovered: {\n kWkggS: \"x1ei6177\",\n $$css: true\n },\n elevatedPressed: {\n kWkggS: \"x1vt8e7r\",\n $$css: true\n },\n removeHovered: {\n kWkggS: \"x930l3l\",\n $$css: true\n },\n removePressed: {\n kWkggS: \"xsykwg8\",\n $$css: true\n },\n selectedFocused: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n selectedHovered: {\n kWkggS: \"x1fctxn6\",\n $$css: true\n },\n selectedPressed: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n unselectedFocused: {\n kWkggS: \"xwqhyid\",\n $$css: true\n },\n unselectedHovered: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n },\n unselectedPressed: {\n kWkggS: \"xjeeohs\",\n $$css: true\n }\n};\nexport { chipLayers, chipStyles };"],"mappings":";AAiHA,MAAMW,aAAa;CACjBC,QAAQ;EACNC,QAAQ;EACRC,OAAO;CACT;CACAC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRvB,OAAO;CACT;CACAwB,UAAU;EACRzB,QAAQ;EACRU,QAAQ;EACRT,OAAO;CACT;CACAyB,kBAAkB;EAChBC,QAAQ;EACR1B,OAAO;CACT;CACA2B,oBAAoB;EAClBD,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA6B,UAAU;EACRH,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA8B,kBAAkB;EAChBJ,QAAQ;EACRE,QAAQ;EACRG,QAAQ;EACR/B,OAAO;CACT;CACAgC,OAAO;EACL7B,QAAQ;EACRC,QAAQ;EACRM,QAAQ;EACRC,OAAO;EACPE,QAAQ;EACRoB,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRnC,OAAO;CACT;CACAoC,aAAa;EACXH,QAAQ;EACRI,QAA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EACR9B,QAAQ;EACRF,QAAQ;EACRnC,OAAO;CACT;CACAoE,YAAY;EACV1C,QAAQ;EACRE,QAAQ;EACR7B,QAAQ;EACRC,OAAO;CACT;AACF;AAUA,MAAMqE,aAAa;CACjBC,iBAAiB;EACf5C,QAAQ;EACR1B,OAAO;CACT;CACAuE,iBAAiB;EACf7C,QAAQ;EACR1B,OAAO;CACT;CACAwE,iBAAiB;EACf9C,QAAQ;EACR1B,OAAO;CACT;CACAyE,eAAe;EACb/C,QAAQ;EACR1B,OAAO;CACT;CACA0E,eAAe;EACbhD,QAAQ;EACR1B,OAAO;CACT;CACA2E,iBAAiB;EACfjD,QAAQ;EACR1B,OAAO;CACT;CACA8D,iBAAiB;EACfpC,QAAQ;EACR1B,OAAO;CACT;CACA4E,iBAAiB;EACflD,QAAQ;EACR1B,OAAO;CACT;CACA6E,mBAAmB;EACjBnD,QAAQ;EACR1B,OAAO;CACT;CACA8E,mBAAmB;EACjBpD,QAAQ;EACR1B,OAAO;CACT;CACA+E,mBAAmB;EACjBrD,QAAQ;EACR1B,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"styles.js","names":["chipStyles","assist","kMwMTN","$$css","base","k6CgDc","kGNEyG","kZKoxP","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kmuXW","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","ks0D6T","k8WAf4","kg3NbH","kIyJzY","k1ekBW","kAMwcw","disabled","disabledSelected","kWkggS","disabledUnselected","kVAM5u","elevated","elevatedDisabled","kGVxlE","glyph","kzqmXN","kjj79g","keTefX","glyphFolded","k71WvV","kSiTet","glyphOpening","kVQacm","glyphSvg","icon","inert","label","kg5iWk","khDVqt","raised","raisedHovered","remove","kgeoSG","kFcpXp","kEoFBp","kjBf7l","kInvED","k3XXqK","kMeerF","kmVPX3","kVAEAm","removeDisabled","removeGlyph","selected","selectedHovered","surfaceCorners","target","kGOzcv","kpsdNU","trailing","unselected","chipLayers","elevatedFocused","elevatedHovered","elevatedPressed","removeHovered","removePressed","selectedFocused","selectedPressed","unselectedFocused","unselectedHovered","unselectedPressed"],"sources":["../../src/chip/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The pill the chips page draws, shared by the three components that draw\n// one: Chip, which is a toggle on its own or one of the page's two action\n// chips; ChipGroup's chip, which is one of a set that can also be removed;\n// and TokenField's token, which takes `base` and `unselected` alone — a token\n// is not selectable, so it reaches for neither the selected container nor\n// the check below. The measurements and roles are the page's filter chip — a\n// 32dp container with an 8dp corner and 16dp of inline padding, an outline\n// variant border while unselected, the secondary container pair once\n// selected.\n//\n// The assist and suggestion chips are that unselected pill, never selected.\n// The page's only difference between them is the label: on surface on an\n// assist chip, on surface variant on a suggestion chip as on a filter one.\n//\n// **An elevated chip trades the outline for a container**, surface container\n// low at the page's elevation 1, raised to 2 under a hovering pointer and\n// back to 1 while pressed, since a mouse press does not end the hover. A\n// selected one keeps the secondary container and takes the shadow with it.\n// Its 1px border stays, transparent, as every chip's does: a forced-colours\n// mode paints a transparent border in its text colour and drops the shadow\n// and the fill, so the border is the boundary left there.\n//\n// **A flat chip lies on the page, apart from one state.** A selected filter\n// chip under a hovering pointer rises to elevation 1, and comes back down\n// while pressed, as the page's filter chip tokens give it; every other flat\n// state, and every state of an input chip, stays at 0.\n//\n// **A disabled chip is translucent**, its content at 38% and its container at\n// 12% of on surface over whatever is behind it, as the page gives them,\n// rather than mixed into the surface. Mixed into the surface, a disabled chip\n// on a coloured container drew an opaque pale patch with grey text on it.\n//\n// **A label with no room on one line is cut short, never wrapped.** The\n// container is a fixed 32dp, so a second line has nowhere to go but out of\n// the pill: a chip or a token in a room narrower than its label drew the\n// rest below its own edge, and a chip in a group's row ran past the row's\n// end instead. The pill is held to the room it is in, and the label sits in\n// a span of its own that ends in an ellipsis where the pill does — a span,\n// because a flex container ignores `text-overflow`, which is also why\n// Material's own chips carry one. The whole label stays in the DOM, so a\n// screen reader still reads all of it.\n//\n// Each state composites an on-colour over its own container at the\n// interaction state's opacity rather than swapping in a separate hover\n// colour. `calc(<opacity> * 100%)` turns the token's unitless 0-1 ratio into\n// the percentage `color-mix()` takes, and it is inlined at each property\n// because @stylexjs/babel-plugin only statically recognises expressions\n// written directly as property values.\n//\n// The selected chip drops its border rather than recolouring it: it has a\n// container of its own to define its edge, and a border on top of that reads\n// as a second, competing outline.\n//\n// Disabled is applied from render state rather than from `:disabled`. Chip is\n// a button and would match the pseudo-class; a chip in a group is React\n// Aria's `Tag`, which is a div and never will. One mechanism serves both, and\n// StyleX replaces a property whole, so the disabled styles take the hover and\n// pressed branches of whichever state they are applied over.\n//\n// A selected chip carries the page's check before its label, which is what\n// makes the selection legible without colour. The two containers differ in\n// colour alone, and under a scheme whose secondary container sits close to\n// the surface — or for a reader who does not see colour — that is no\n// difference at all.\n//\n// The chip widens when the check appears, and that is the page's behaviour\n// rather than a cost of drawing it: a chip is flow content, laid out in a\n// row that wraps, so nothing around it has a width to hold. A segmented\n// button's segments are equal columns of one track, which is a different\n// geometry answering a different question, and the two should not be read\n// across. A chip given an icon does not widen, since the check takes the\n// icon's place in the same slot.\n//\n// **A filter chip can carry an icon after its label as well**, the page's\n// trailing icon, which is what draws its dropdown filter chip: an arrow\n// saying the chip opens a menu. It takes the same 18dp slot at the other\n// end, and the chip's content role rather than the primary one the leading\n// icon takes — on surface variant, then on secondary container once\n// selected, then the disabled 38% — so it is drawn in the chip's own colour\n// rather than a role of its own. The check never displaces it.\n//\n// **The widening is animated rather than taken in one frame.** A chip with\n// no icon keeps its slot mounted while unselected, folded to nothing, and\n// selecting it opens the slot over the chip's own short duration while the\n// check fades in, so the chips after it in a wrapped row glide rather than\n// jump 18dp. Reduced motion takes the change at once, as it does the\n// colours. A chip that can never be selected, an assist or suggestion chip\n// or one in a group that does not select, has no slot to open.\n//\n// **The press ripple takes the chip's corner from here** wherever the chip\n// is a ChipGroup's. The ripple clips itself to its host's corner by\n// inheriting it, and React Aria puts a cell between a group's chip and its\n// content, so what the ripple would inherit is the cell's square corner.\n// `surfaceCorners` restates the chip's own corner on a box the ripple sits\n// in, less the 1px border every chip keeps, since the ripple fills the\n// inside of that border.\n//\n// Apart from any component so a chip in a group and a chip on its own cannot\n// drift; see `src/row` for the same arrangement around a list's row.\n\n// The press area the chips page requires around its 32dp chip. A literal for\n// the reason IconButton's `TARGET_SIZE` gives.\nconst TARGET_SIZE = '48px';\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)';\nconst chipStyles = {\n assist: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n base: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xig8zya\",\n kaIpWk: \"x1xdvaa9\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n ks0D6T: \"x193iq5w\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"x790zyz\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xu8237s\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1gpw424 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n disabledSelected: {\n kWkggS: \"x19v6zzp\",\n $$css: true\n },\n disabledUnselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3 xmnqt3w\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1vnz5z6\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n elevatedDisabled: {\n kWkggS: \"x19v6zzp\",\n kVAM5u: \"x9r1u3d\",\n kGVxlE: \"x1gnnqk1\",\n $$css: true\n },\n glyph: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xmix8c7\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kGuDYH: \"xosj86m\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n keTefX: \"xxuhe3a\",\n $$css: true\n },\n glyphFolded: {\n kzqmXN: \"xnalus7\",\n k71WvV: \"x1kfc2zf\",\n keTefX: \"x1lziwak\",\n kSiTet: \"xg01cxk\",\n $$css: true\n },\n glyphOpening: {\n k6CgDc: \"x12w9bfk\",\n kVQacm: \"xb3r6kr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x17vvy08\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n glyphSvg: {\n kZKoxP: \"xmix8c7\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n icon: {\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n inert: {\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n label: {\n kB7OPa: \"x9f619\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n raised: {\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n raisedHovered: {\n kGVxlE: \"x1os83gw\",\n $$css: true\n },\n remove: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"xtu493u\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n k71WvV: \"x1kfc2zf\",\n kjBf7l: \"x14ytart\",\n kInvED: \"x1y3gkto\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n removeDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n removeGlyph: {\n kZKoxP: \"xmix8c7\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n selected: {\n kWkggS: \"x15dekr4\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n selectedHovered: {\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n surfaceCorners: {\n kaIpWk: \"x5a2xki\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"xjp7ctv\",\n $$css: true\n },\n target: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1xkszu9\",\n kpsdNU: \"x1ecwmwu\",\n kEoFBp: \"x1hmns74\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n trailing: {\n k71WvV: \"x1kfc2zf\",\n keTefX: \"x1lziwak\",\n $$css: true\n },\n unselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x133yhug\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\n\n// The hover and pressed layers, applied from React Aria's render state rather\n// than from `:hover` and `:active`, for Button's reasons — see its header: a\n// hover layer stayed on after a tap, and no pressed layer showed for a press\n// made from the keyboard. One pair per container, the pressed after the\n// hovered so a press wins, and one for the close target, whose own render\n// state is its button's. A token in a TokenField draws none of them: React\n// Aria reports neither state for one, since it is text the caret moves\n// through rather than a control a press acts on.\nconst chipLayers = {\n elevatedFocused: {\n kWkggS: \"x1drsm1c\",\n $$css: true\n },\n elevatedHovered: {\n kWkggS: \"x1ei6177\",\n $$css: true\n },\n elevatedPressed: {\n kWkggS: \"x1vt8e7r\",\n $$css: true\n },\n removeHovered: {\n kWkggS: \"x930l3l\",\n $$css: true\n },\n removePressed: {\n kWkggS: \"xsykwg8\",\n $$css: true\n },\n selectedFocused: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n selectedHovered: {\n kWkggS: \"x1fctxn6\",\n $$css: true\n },\n selectedPressed: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n unselectedFocused: {\n kWkggS: \"xwqhyid\",\n $$css: true\n },\n unselectedHovered: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n },\n unselectedPressed: {\n kWkggS: \"xjeeohs\",\n $$css: true\n }\n};\nexport { chipLayers, chipStyles };"],"mappings":";AAiHA,MAAMA,aAAa;CACjBC,QAAQ;EACNC,QAAQ;EACRC,OAAO;CACT;CACAC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRvB,OAAO;CACT;CACAwB,UAAU;EACRzB,QAAQ;EACRU,QAAQ;EACRT,OAAO;CACT;CACAyB,kBAAkB;EAChBC,QAAQ;EACR1B,OAAO;CACT;CACA2B,oBAAoB;EAClBD,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA6B,UAAU;EACRH,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA8B,kBAAkB;EAChBJ,QAAQ;EACRE,Q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,QAAQ;EACR/B,OAAO;CACT;CACA+D,gBAAgB;EACd1D,QAAQ;EACRG,QAAQ;EACRE,QAAQ;EACRV,OAAO;CACT;CACAgE,QAAQ;EACNd,QAAQ;EACRe,QAAQ;EACRC,QAAQ;EACRd,QAAQ;EACRM,QAAQ;EACR1D,OAAO;CACT;CACAmE,UAAU;EACR9B,QAAQ;EACRF,QAAQ;EACRnC,OAAO;CACT;CACAoE,YAAY;EACV1C,QAAQ;EACRE,QAAQ;EACR7B,QAAQ;EACRC,OAAO;CACT;AACF;AAUA,MAAMqE,aAAa;CACjBC,iBAAiB;EACf5C,QAAQ;EACR1B,OAAO;CACT;CACAuE,iBAAiB;EACf7C,QAAQ;EACR1B,OAAO;CACT;CACAwE,iBAAiB;EACf9C,QAAQ;EACR1B,OAAO;CACT;CACAyE,eAAe;EACb/C,QAAQ;EACR1B,OAAO;CACT;CACA0E,eAAe;EACbhD,QAAQ;EACR1B,OAAO;CACT;CACA2E,iBAAiB;EACfjD,QAAQ;EACR1B,OAAO;CACT;CACA8D,iBAAiB;EACfpC,QAAQ;EACR1B,OAAO;CACT;CACA4E,iBAAiB;EACflD,QAAQ;EACR1B,OAAO;CACT;CACA6E,mBAAmB;EACjBnD,QAAQ;EACR1B,OAAO;CACT;CACA8E,mBAAmB;EACjBpD,QAAQ;EACR1B,OAAO;CACT;CACA+E,mBAAmB;EACjBrD,QAAQ;EACR1B,OAAO;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.js","names":["createContext","EmptyStatusContext"
|
|
1
|
+
{"version":3,"file":"empty.js","names":["createContext","EmptyStatusContext"],"sources":["../../src/collection/empty.ts"],"sourcesContent":["import { createContext } from 'react'\n\n// Who to tell that a collection has emptied, so it can say so where a screen\n// reader hears it. See `CollectionStatus` in ./index.tsx.\nconst EmptyStatusContext = createContext<((empty: boolean) => void) | null>(\n null,\n)\n\nexport { EmptyStatusContext }\n"],"mappings":";;AAIA,MAAMC,qBAAqBD,cACzB,IACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["stylex","useContext","useEffect","useState","useMessages","rowStyles","EmptyStatusContext","collectionStyles","variant","diameter","label","CollectionEmpty","t0","$","_c","messages","report","t1","t2","t3","base","menu","list","empty","t4","headlineMenu","headlineList","t5","noResults","t6","CollectionLoadMore","loadingMore","CollectionStatus","children","setEmpty","Symbol","for","status"],"sources":["../../src/collection/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useEffect, useState } from 'react';\nimport ProgressIndicator from '../components/progress-indicator';\nimport { useMessages } from '../i18n';\nimport { rowStyles } from '../row/styles';\nimport { EmptyStatusContext } from './empty';\nimport { collectionStyles } from './styles';\ntype CollectionEmptyProps = {\n /** Which spec page's row it stands in for: a list's or a menu's. */\n variant: 'list' | 'menu';\n};\ntype CollectionLoadMoreProps = {\n /** The ring's diameter, which follows the row it sits in. */\n diameter: string;\n /**\n * What a screen reader announces while the next page is on its way. Left\n * out, it is the I18nProvider's locale's word for it.\n */\n label: string | undefined;\n};\n\n/**\n * The row a collection shows when nothing is in it, which is what a search\n * that matches nothing leaves. `ListBox` and `Menu.Content` draw it as their\n * default `renderEmptyState`.\n *\n * An item's box and headline, so the collection keeps a row's height rather\n * than collapsing to its padding, in the muted role and with no role of its\n * own: it is not an option or an action. React Aria wraps it in an element\n * with the collection's item role and `display: contents`, since a listbox\n * or a menu may only own those.\n *\n * It also tells the nearest `CollectionStatus` the collection has emptied,\n * which is what puts it where a screen reader hears it.\n */\nfunction CollectionEmpty({\n variant\n}: CollectionEmptyProps) {\n const messages = useMessages();\n const report = useContext(EmptyStatusContext);\n useEffect(() => {\n report?.(true);\n return () => {\n report?.(false);\n };\n }, [report]);\n return <div {...stylex.props(rowStyles.base, variant === 'menu' ? rowStyles.menu : rowStyles.list, collectionStyles.empty)}>\n <span {...stylex.props(variant === 'menu' ? rowStyles.headlineMenu : rowStyles.headlineList)}>\n {messages.noResults}\n </span>\n </div>;\n}\n\n/**\n * The ring a collection shows while it loads more items.\n *\n * Indeterminate and circular in every collection that has one, since none of\n * them knows how many items are still to come.\n */\nfunction CollectionLoadMore({\n diameter,\n label\n}: CollectionLoadMoreProps) {\n const messages = useMessages();\n return <ProgressIndicator aria-label={label ?? messages.loadingMore} diameter={diameter} isIndeterminate variant=\"circular\" />;\n}\n\n/**\n * A polite status that says when a collection inside it has emptied.\n *\n * The region is rendered from the start and only its text changes, since a\n * screen reader announces a change to a live region it already knows about\n * and not one that arrives with its text in it. That is why the empty row\n * cannot announce itself: it mounts already saying what it says. `<output>`\n * carries an implicit role of status, as CopyField's does.\n *\n * `Autocomplete` puts one round what it filters, and `Menu.Content` one\n * inside its surface — a modal popover hides everything outside it from\n * assistive technology, a live region included, so the menu's has to be\n * within it. A row reports to the nearest, so a menu inside an\n * `Autocomplete` speaks through its own.\n */\nfunction CollectionStatus({\n children\n}: {\n children: ReactNode;\n}) {\n const messages = useMessages();\n const [empty, setEmpty] = useState(false);\n return <EmptyStatusContext value={setEmpty}>\n {children}\n <output {...stylex.props(collectionStyles.status)}>\n {empty ? messages.noResults : ''}\n </output>\n </EmptyStatusContext>;\n}\nexport type { CollectionEmptyProps, CollectionLoadMoreProps };\nexport { CollectionEmpty, CollectionLoadMore, CollectionStatus };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAAW,gBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAyB,MAAA,EAAAN,YAAAI;CAGvB,MAAAG,WAAiBX,YAAY;CAC7B,MAAAY,SAAef,WAAWK,kBAAkB;CAAE,IAAAW;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAG,QAAA;EACpCC,WAAA;GACRD,SAAS,IAAI;GAAC,aACP;IACLA,SAAS,KAAK;GAAC;EAChB;EACAE,KAAA,CAACF,MAAM;EAACH,EAAA,KAAAG;EAA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;EAA5DC,KAAA,oBAAC,mBAAD;GAA+B,cAAAD;GAAyCR;GAAU,iBAAA;GAAwB,SAAA;EAAU,CAAA;EAAGI,EAAA,KAAAJ;EAAAI,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAAvHK;AAAuH;;;;;;;;;;;;;;;;AAkBhI,SAAAc,iBAAApB,IAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAA0B,MAAA,EAAAmB,aAAArB;CAKxB,MAAAG,WAAiBX,YAAY;CAC7B,MAAA,CAAAmB,OAAAW,YAA0B/B,SAAS,KAAK;CAAE,IAAAc;CAAA,IAAAJ,EAAA,OAAAsB,OAAAC,IAAA,2BAAA,GAAA;EAG1BnB,KAAAjB,MAAaO,iBAAgB8B,MAAO;EAACxB,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAC9C,MAAAK,KAAAK,QAAQR,SAAQa,YAAhB;CAA+B,IAAAT;CAAA,IAAAN,EAAA,OAAAK,IAAA;EADlCC,KAAA,oBAAA,UAAA;GAES,GAFGF;GACTC,UAAAA;EACM,CAAA;EAAAL,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAoB,YAAApB,EAAA,OAAAM,IAAA;EAJNK,KAAA,qBAAC,oBAAD;GAA2BU,OAAAA;GAA3B,UAAA,CACFD,UACDd,EAFsB;;EAKHN,EAAA,KAAAoB;EAAApB,EAAA,KAAAM;EAAAN,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OALhBW;AAKgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["
|
|
1
|
+
{"version":3,"file":"styles.js","names":["stylex","hasContent","rowStyles","collectionStyles","container","kB7OPa","k1xSpc","kXwgrk","k3XXqK","k8WAf4","$$css","dropTarget","kWkggS","kjBf7l","kInvED","kMeerF","empty","kMwMTN","header","kMv6JI","kGuDYH","k63SB2","kb6lSQ","kLWn49","kGO01o","kLKAdn","kg3NbH","loading","kGNEyG","kjj79g","kAzted","section","status","kZKoxP","kz4h6p","kzqmXN","kVQacm","kVAEAm","khDVqt","isDisabled","isDragging","isDropTarget","isFocusVisible","isHovered","isPressed","isSelected","containerClasses","state","className","rowItemStyles","supporting","overline","extra","lines","base","list","twoLine","threeLine","dragging","selectedList","hovered","focusVisible","pressed","disabled"],"sources":["../../src/collection/styles.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { hasContent } from '../render/content';\nimport { rowStyles } from '../row/styles';\nimport '../tokens/design.tokens.stylex';\nimport { colors, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The chrome around the row. `src/row` was extracted so a list, menu, tree and\n// drawer draw the same row; everything wrapped around it stayed behind in each\n// component, so a change to the subhead over a list was three edits with\n// nothing failing if one were missed.\n//\n// Two of these are shared by four components and two by three, and the split\n// is the Material Design spec pages rather than convenience:\n//\n// - `container` and `section` are the box and the grouping, which List,\n// ListBox, Tree and NavigationTree all draw the same way.\n// - `header` and `loading` are the lists page's, so they are shared by the\n// three components that follow it. Menu and NavigationTree keep their own,\n// because the menus page and the navigation drawer page give different\n// values — a subhead tighter to the items above it, a label role rather\n// than a title role, and an inset that lines up with pill-shaped rows.\n// Those are the specs disagreeing rather than the code drifting, so each\n// stays where its comment explaining it is.\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)';\nconst collectionStyles = {\n container: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n k3XXqK: \"x1t137rt\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n },\n dropTarget: {\n kWkggS: \"x659ado\",\n kjBf7l: \"xrgy624 x1x84bn5\",\n kInvED: \"x2ssjo2\",\n k3XXqK: \"xaatb59\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n empty: {\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n header: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xrgwony\",\n kGuDYH: \"x12s497w\",\n k63SB2: \"x1szcwkt\",\n kb6lSQ: \"xo803ec\",\n kLWn49: \"xyl1r0q\",\n kGO01o: \"xw3mh6e\",\n kLKAdn: \"x1clyivc\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n loading: {\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kjj79g: \"xl56j7k\",\n kAzted: \"xyax5pk\",\n $$css: true\n },\n section: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n $$css: true\n },\n status: {\n kZKoxP: \"xjm9jq1\",\n kB7OPa: \"x9f619\",\n kz4h6p: \"x1hyvwdk\",\n kzqmXN: \"x1i1rx1s\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"x10l6tqk\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n }\n};\n\n/**\n * The render state every collection item this covers reports. Each of React\n * Aria's own is wider than this, and this is the part the three share.\n */\ntype CollectionItemState = {\n isDisabled: boolean;\n /** Reported only where the collection drags; see `dragging` in `src/row`. */\n isDragging?: boolean;\n /** Reported only where the collection takes drops onto its items. */\n isDropTarget?: boolean;\n isFocusVisible: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n};\n\n/**\n * A collection's own box, as the function React Aria's `className` prop\n * wants: the container, and the drop target while a drop would land on the\n * collection as a whole. List, ListBox and Tree each draw it.\n */\nfunction containerClasses(state: {\n isDropTarget: boolean;\n}) {\n return {\n 0: {\n className: \"x9f619 x78zum5 xdt5ytf x1t137rt x1cmllll\"\n },\n 1: {\n className: \"x9f619 x78zum5 xdt5ytf x1cmllll x659ado xrgy624 x1x84bn5 x2ssjo2 xaatb59 x1de99jn\"\n }\n }[!!state.isDropTarget << 0];\n}\n\n/**\n * The styles a selectable row in a list takes, as the function React Aria's\n * `className` prop wants.\n *\n * Which of the lists page's three items the row is, read from the content\n * rather than taken as a prop: a row holding all three lines already says it\n * is three lines, and a word for it would be a second place to get it wrong.\n * `ListItem` does the same arithmetic for the static row, and this is where\n * the collection forms share it.\n *\n * The three-line item is the only row whose slots move, which is why it alone\n * carries an alignment as well as a height.\n *\n * `extra` is the one difference between the three callers — Tree passes its\n * indent, which is why it sits where Tree already had it rather than at the\n * end. NavigationTree is not a caller: it draws the drawer variant, branches\n * on an ancestor being current, and reads `isCurrent` where these read\n * `isSelected`.\n */\nfunction rowItemStyles(supporting: ReactNode, overline: ReactNode, extra?: stylex.StyleXStyles) {\n const lines = (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0);\n return (state: CollectionItemState) => stylex.props(rowStyles.base, rowStyles.list, extra, lines === 1 && rowStyles.twoLine, lines === 2 && rowStyles.threeLine, state.isDragging === true && rowStyles.dragging, state.isSelected && rowStyles.selectedList, state.isHovered && rowStyles.hovered, state.isFocusVisible && rowStyles.focusVisible, state.isPressed && rowStyles.pressed, state.isDropTarget === true && rowStyles.dropTarget, state.isDisabled && rowStyles.disabled);\n}\nexport type { CollectionItemState };\nexport { collectionStyles, containerClasses, rowItemStyles };"],"mappings":";;;;AA6BA,MAAMG,mBAAmB;CACvBC,WAAW;EACTC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,YAAY;EACVC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRN,QAAQ;EACRO,QAAQ;EACRL,OAAO;CACT;CACAM,OAAO;EACLC,QAAQ;EACRP,OAAO;CACT;CACAQ,QAAQ;EACNb,QAAQ;EACRY,QAAQ;EACRE,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRhB,OAAO;CACT;CACAiB,SAAS;EACPC,QAAQ;EACRvB,QAAQ;EACRC,QAAQ;EACRuB,QAAQ;EACRC,QAAQ;EACRpB,OAAO;CACT;CACAqB,SAAS;EACP1B,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRG,OAAO;CACT;CACAsB,QAAQ;EACNC,QAAQ;EACR5B,QAAQ;EACR6B,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACR5B,OAAO;CACT;AACF;;;;;;AAuBA,SAASoC,iBAAiBC,OAEvB;CACD,OAAO;EACL,GAAG,EACDC,WAAW,2CACb;EACA,GAAG,EACDA,WAAW,oFACb;CACF,EAAE,CAAC,CAACD,MAAMN,gBAAgB;AAC5B;;;;;;;;;;;;;;;;;;;;AAqBA,SAASQ,cAAcC,YAAuBC,UAAqBC,OAA6B;CAC9F,MAAMC,SAASpD,WAAWkD,QAAQ,IAAI,IAAI,MAAMlD,WAAWiD,UAAU,IAAI,IAAI;CAC7E,QAAQH,UAA+B/C,MAAaE,UAAUoD,MAAMpD,UAAUqD,MAAMH,OAAOC,UAAU,KAAKnD,UAAUsD,SAASH,UAAU,KAAKnD,UAAUuD,WAAWV,MAAMP,eAAe,QAAQtC,UAAUwD,UAAUX,MAAMF,cAAc3C,UAAUyD,cAAcZ,MAAMJ,aAAazC,UAAU0D,SAASb,MAAML,kBAAkBxC,UAAU2D,cAAcd,MAAMH,aAAa1C,UAAU4D,SAASf,MAAMN,iBAAiB,QAAQvC,UAAUS,YAAYoC,MAAMR,cAAcrC,UAAU6D,QAAQ;AACvd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":["
|
|
1
|
+
{"version":3,"file":"text.js","names":["flatText","node","String","undefined","isNodeArray","text","part","partText","Array","isArray","textOf","children"],"sources":["../../src/collection/text.ts"],"sourcesContent":["import type { ReactNode } from 'react'\n\n// Apart from ./index.tsx so that file exports components alone, which is what\n// keeps fast refresh working for it — the same arrangement ./styles.ts has.\n\n// The text children render as, or `undefined` once any part is not text.\nfunction flatText(node: ReactNode): string | undefined {\n if (typeof node === 'string') {\n return node\n }\n if (typeof node === 'number' || typeof node === 'bigint') {\n return String(node)\n }\n if (node === null || node === undefined || typeof node === 'boolean') {\n return ''\n }\n if (!isNodeArray(node)) {\n return undefined\n }\n let text = ''\n for (const part of node) {\n const partText = flatText(part)\n if (partText === undefined) {\n return undefined\n }\n text += partText\n }\n return text\n}\n\n// `Array.isArray` narrows to `any[]`, which says nothing about the parts.\nfunction isNodeArray(node: ReactNode): node is readonly ReactNode[] {\n return Array.isArray(node)\n}\n\n/**\n * What a collection item is worth as text: what React Aria matches typeahead\n * on, what a combo box filters by, what a select shows once an option is\n * chosen, and what names a chip. React Aria reads it off an item's children\n * when they are a string and finds nothing when they are not — and an item\n * here is always an element, since it wraps its text in one of its own. So\n * this reads it instead, from children made of text alone: a string, a\n * number, or an array of those, which is what JSX hands over for\n * `Label {3}`. The parts join as React renders them, and `null`, `undefined`\n * and booleans count for nothing, as they draw nothing. Anything holding an\n * element is worth no text here, so it has to say what it is worth through\n * `textValue`.\n */\nfunction textOf(children: ReactNode) {\n const text = flatText(children)\n return text === '' ? undefined : text\n}\n\nexport { textOf }\n"],"mappings":";AAMA,SAASA,SAASC,MAAqC;CACrD,IAAI,OAAOA,SAAS,UAClB,OAAOA;CAET,IAAI,OAAOA,SAAS,YAAY,OAAOA,SAAS,UAC9C,OAAOC,OAAOD,IAAI;CAEpB,IAAIA,SAAS,QAAQA,SAASE,KAAAA,KAAa,OAAOF,SAAS,WACzD,OAAO;CAET,IAAI,CAACG,YAAYH,IAAI,GACnB;CAEF,IAAII,OAAO;CACX,KAAK,MAAMC,QAAQL,MAAM;EACvB,MAAMM,WAAWP,SAASM,IAAI;EAC9B,IAAIC,aAAaJ,KAAAA,GACf;EAEFE,QAAQE;CACV;CACA,OAAOF;AACT;AAGA,SAASD,YAAYH,MAA+C;CAClE,OAAOO,MAAMC,QAAQR,IAAI;AAC3B;;;;;;;;;;;;;;AAeA,SAASS,OAAOC,UAAqB;CACnC,MAAMN,OAAOL,SAASW,QAAQ;CAC9B,OAAON,SAAS,KAAKF,KAAAA,IAAYE;AACnC"}
|
package/dist/color-scheme.d.ts
CHANGED
package/dist/color-scheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-scheme.js","names":["stylex","pinnedScheme","colorDefaultsDarkTheme","colorDefaultsLightTheme","tokenScope","themeScope","
|
|
1
|
+
{"version":3,"file":"color-scheme.js","names":["stylex","pinnedScheme","colorDefaultsDarkTheme","colorDefaultsLightTheme","tokenScope","themeScope","className","colorScheme","dark","light"],"sources":["../src/color-scheme.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport { pinnedScheme } from './styles/scheme';\nimport { colorDefaultsDarkTheme, colorDefaultsLightTheme, tokenScope } from './tokens/design.tokens.stylex';\n\n// The library's tokens resolve once, on `:root`, and follow the reader's OS\n// through `prefers-color-scheme` unless something says otherwise. These are\n// the classes that say otherwise, for a page that cannot or would rather not\n// render `ThemeScope`: `themeScope` resolves every token again on the element\n// it lands on, and each `colorScheme` class does that and pins the scheme\n// too. All three were generated for Storybook first, where the Theme control\n// uses the scheme pair; nothing in the package named them, so an app with a\n// switch of its own had to restate every colour token under its own\n// selector, twice — dark for a light OS, light for a dark one.\n//\n// A server module like the entry, since it is three strings.\n\n/**\n * The class that lets an element theme what is inside it. A `--kui-*`\n * override declared on that element, or on one around it, reaches every\n * component rendered inside, where on any element but `<html>` it would\n * otherwise reach none — the tokens resolve on `:root` and are inherited from\n * there already resolved. The scheme is inherited from around it, so a scope\n * inside a dark page stays dark.\n *\n * Overlays are portalled to the body, outside the element, so they keep the\n * page's tokens; `ThemeScope` is the same class with a portal container of\n * its own, which takes them along.\n */\nconst themeScope = stylex.props(tokenScope).className ?? '';\n\n/**\n * The classes that pin the library's colours to its light or its dark\n * scheme, whatever the reader's OS asks for — for an app with a theme switch\n * of its own. Put one on the `<html>` element, where overlays portalled to\n * the body still sit inside it; with neither there, the colours follow the\n * OS as they always have. Each is also a {@link themeScope}, so either on a\n * smaller element pins and scopes the subtree under it.\n *\n * Shaped as an object of class names, one per scheme. Each name is several\n * classes separated by spaces, so add them with `className` rather than\n * `classList.add`, which takes one class per argument.\n *\n * A `--kui-color-*` override still applies under either, declared on the\n * same element or above it.\n *\n * Either also paints the element's surface and text in its scheme and sets\n * `color-scheme`, which native controls and scrollbars follow, as\n * `ThemeScope` does with `scheme` set. On `<html>` that makes the page's\n * own background and text colour the scheme's; an app's own stylesheet\n * still wins over both, since the library's rules sit in a cascade layer.\n */\nconst colorScheme = {\n dark: stylex.props(tokenScope, colorDefaultsDarkTheme, pinnedScheme.dark).className ?? '',\n light: stylex.props(tokenScope, colorDefaultsLightTheme, pinnedScheme.light).className ?? ''\n};\nexport { colorScheme, themeScope };"],"mappings":";;;;;;;;;;;;;;;;AA4BA,MAAMK,aAAaL,MAAaI,UAAU,CAAC,CAACE,aAAa;;;;;;;;;;;;;;;;;;;;;;AAuBzD,MAAMC,cAAc;CAClBC,MAAMR,MAAaI,YAAYF,wBAAwBD,aAAaO,IAAI,CAAC,CAACF,aAAa;CACvFG,OAAOT,MAAaI,YAAYD,yBAAyBF,aAAaQ,KAAK,CAAC,CAACH,aAAa;AAC5F"}
|
|
@@ -7,7 +7,9 @@ type AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {
|
|
|
7
7
|
* the text on the bar rather than between the slots, so a bar with a
|
|
8
8
|
* leading icon and no actions still has its headline in the middle. The
|
|
9
9
|
* text moves off the middle only as far as a slot wider than the other
|
|
10
|
-
* needs, rather than running under it.
|
|
10
|
+
* needs, rather than running under it. Beside the slots, which is `sm` and
|
|
11
|
+
* a collapsed flexible bar, each line of centred text takes one line and
|
|
12
|
+
* is cut short with an ellipsis rather than wrapping.
|
|
11
13
|
* @default 'start'
|
|
12
14
|
*/
|
|
13
15
|
align?: 'center' | 'start';
|
|
@@ -78,7 +80,11 @@ type AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {
|
|
|
78
80
|
* @default 1
|
|
79
81
|
*/
|
|
80
82
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
81
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* The page's title. Wraps rather than truncating, and grows the bar with
|
|
85
|
+
* it, except beside the slots of a centred bar, where it takes one line and
|
|
86
|
+
* is cut short with an ellipsis — see `align`.
|
|
87
|
+
*/
|
|
82
88
|
headline?: ReactNode;
|
|
83
89
|
/**
|
|
84
90
|
* Usually a back or menu icon button. Sits before the text, and a standard
|
|
@@ -138,5 +144,4 @@ type AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {
|
|
|
138
144
|
* element scrolls, so both are set from its own scroll handler.
|
|
139
145
|
*/
|
|
140
146
|
declare function AppBar({ align, collapsed, contentInset, contentMaxInlineSize, headingLevel, headline, leading, pinned, render, scrolled, size, subtitle, trailing, ...props }: AppBarProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
141
|
-
export { type AppBarProps, AppBar as default };
|
|
142
|
-
//# sourceMappingURL=index.d.ts.map
|
|
147
|
+
export { type AppBarProps, AppBar as default };
|