@kanso-labs/kanso-ui 0.26.2 → 0.26.3
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/calendar/index.js +1 -1
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/months.js.map +1 -1
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/styles.js.map +1 -1
- package/dist/components/app-bar/index.js +148 -40
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +46 -14
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.js +1 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.js +67 -18
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.js +71 -19
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.js +118 -28
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/color-area/index.js +66 -12
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-field/index.js +61 -12
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.js +146 -43
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-slider/index.js +116 -21
- package/dist/components/color-slider/index.js.map +1 -1
- package/dist/components/color-swatch/index.js +1 -1
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.js +1 -1
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/color-wheel/index.js +75 -11
- package/dist/components/color-wheel/index.js.map +1 -1
- package/dist/components/combo-box/index.js +113 -32
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/container/index.js +53 -10
- package/dist/components/container/index.js.map +1 -1
- package/dist/components/copy-field/index.js +95 -40
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.js +68 -11
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-field/index.js +64 -15
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.js +121 -38
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.js +154 -52
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.js +87 -19
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.js +43 -10
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/disclosure-group/index.js +49 -6
- package/dist/components/disclosure-group/index.js.map +1 -1
- package/dist/components/drop-zone/index.js +1 -1
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/drop-zone/styles.js.map +1 -1
- package/dist/components/feed/index.js +52 -9
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/form/index.js +39 -6
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.js +89 -29
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/keycap/index.js.map +1 -1
- package/dist/components/link/index.js +52 -11
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list/index.js +96 -16
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.js +45 -8
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-detail/index.js +99 -20
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/list-item/index.js +42 -15
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/menu/index.js +139 -23
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.js +68 -8
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-tree/index.js +1 -1
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.js +135 -47
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.js +226 -49
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/product-icon/index.js +50 -17
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.js +92 -9
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.js +44 -10
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.js +1 -1
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.js +44 -9
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.js +111 -19
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.js +48 -10
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/separator/index.js +21 -6
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.js +87 -19
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.js +90 -18
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/stack/index.js +54 -9
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/supporting-pane/index.js +91 -20
- package/dist/components/supporting-pane/index.js.map +1 -1
- package/dist/components/switch/index.js +57 -12
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/table/index.js +229 -46
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tag/index.js +53 -10
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/text/index.js +54 -9
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.js +70 -15
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.js +73 -16
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.js +64 -15
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/token-field/index.js +133 -18
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.js +68 -11
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tooltip/index.js +87 -11
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.js +96 -16
- package/dist/components/tree/index.js.map +1 -1
- package/dist/drag/hooks.js +1 -1
- package/dist/drag/hooks.js.map +1 -1
- package/dist/drag/index.js +1 -1
- package/dist/drag/index.js.map +1 -1
- package/dist/drag/styles.js.map +1 -1
- package/dist/field/index.js +338 -96
- package/dist/field/index.js.map +1 -1
- package/dist/field/root.js.map +1 -1
- package/dist/glyphs/index.js +1 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/hooks/useImageLoadingStatus.js +1 -1
- package/dist/hooks/useImageLoadingStatus.js.map +1 -1
- package/dist/hooks/useRipple.js +1 -1
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/indicator/index.js +1 -1
- package/dist/indicator/index.js.map +1 -1
- package/dist/indicator/styles.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/render/aria.js.map +1 -1
- package/dist/render/useRender.js +66 -21
- package/dist/render/useRender.js.map +1 -1
- package/dist/row/index.js +97 -23
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/index.js.map +1 -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/merge.js.map +1 -1
- 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/tokens/design.tokens.stylex.js.map +1 -1
- package/dist/tokens/values.js.map +1 -1
- package/package.json +8 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":[],"sources":["../../src/indicator/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, typography } from '../tokens/design.tokens.stylex';\n\n// The line the progress indicators page draws, and the label row above it,\n// shared by the two components that draw one: ProgressIndicator, which adds\n// the ring and the two indeterminate presentations on top, and Meter, which\n// is this and nothing else.\n//\n// The page's anatomy names three parts — the active indicator in primary,\n// the track in secondary container, and the stop indicator in primary at the\n// end — at 4dp thick with 4dp between them. The active indicator's width is\n// the percentage itself and the track takes what is left, so the row is a\n// flex line and the two gaps are its `gap`.\n//\n// `tone` is the line's colour. `primary` is the page's own pair, and it is\n// what a progress indicator draws. `negative` and `positive` swap the active\n// indicator and the stop indicator alone, leaving the track in secondary\n// container, so a column of meters reads as one scale with bars of different\n// colours rather than as several unrelated gauges. `inherit` instead takes\n// the colour around it for both, and gives the track a quarter of it, which\n// is what makes a ring legible inside a filled button, where the page's\n// primary is the button's own fill.\n//\n// Apart from ./index.tsx so that file exports components alone, which is\n// what keeps fast refresh working for it.\n\n/** The thickness of every part, and the room the page leaves between them. */\nexport const THICKNESS = 4;\nexport const GAP = 4;\n\n/** What the page gives a value that changes to move over. */\nexport const DETERMINATE_MS = 250;\nexport const DETERMINATE_EASING = 'cubic-bezier(0.4, 0, 0.6, 1)';\nexport type IndicatorTone = 'inherit' | 'negative' | 'positive' | 'primary';\nconst _temp = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nexport const indicatorStyles = {\n active: {\n kWkggS: \"xnety89\",\n kZKoxP: \"x5yr21d\",\n kaIpWk: \"x3y1ksm\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kIyJzY: \"x1rvut6x\",\n k1ekBW: \"x1j4rzew\",\n kAMwcw: \"x16pyfke\",\n $$css: true\n },\n activeAt: (percentage: number) => [_temp, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(`${percentage}%`)\n }],\n inheritActive: {\n kWkggS: \"xtwfq29\",\n kjVXCG: \"x73je2i\",\n $$css: true\n },\n inheritTrack: {\n kWkggS: \"xtp5tyh\",\n kjVXCG: \"xy3ggvv\",\n $$css: true\n },\n label: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n $$css: true\n },\n labels: {\n kGNEyG: \"x1pha0wt\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"x126z3so\",\n kjj79g: \"x1qughib\",\n $$css: true\n },\n line: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xqu0tyb\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"x1jnr06f\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n negativeActive: {\n kWkggS: \"xmjwayr\",\n $$css: true\n },\n positiveActive: {\n kWkggS: \"x1xov01w\",\n $$css: true\n },\n root: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kOIVth: \"xzoy561\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n stop: {\n kWkggS: \"xnety89\",\n kZKoxP: \"xqu0tyb\",\n kaIpWk: \"x3y1ksm\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x51ohtg\",\n $$css: true\n },\n track: {\n kZKoxP: \"x5yr21d\",\n kaIpWk: \"x3y1ksm\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kzQI83: \"x1iyjqo2\",\n k7Eaqz: \"xeuugli\",\n kVQacm: \"xb3r6kr\",\n $$css: true\n },\n trackSolid: {\n kWkggS: \"x15dekr4\",\n $$css: true\n }\n};"],"mappings":";AAmCA,
|
|
1
|
+
{"version":3,"file":"styles.js","names":["stylex","colors","radii","spacing","typography","THICKNESS","GAP","DETERMINATE_MS","DETERMINATE_EASING","IndicatorTone","_temp","kzqmXN","indicatorStyles","active","kWkggS","kZKoxP","kaIpWk","kB7OPa","kmuXW","kIyJzY","k1ekBW","kAMwcw","$$css","activeAt","percentage","val","undefined","inheritActive","kjVXCG","inheritTrack","label","kMwMTN","kMv6JI","kGuDYH","k63SB2","kb6lSQ","kLWn49","labels","kGNEyG","k1xSpc","kOIVth","kjj79g","line","negativeActive","positiveActive","root","kXwgrk","stop","track","kzQI83","k7Eaqz","kVQacm","trackSolid"],"sources":["../../src/indicator/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, typography } from '../tokens/design.tokens.stylex';\n\n// The line the progress indicators page draws, and the label row above it,\n// shared by the two components that draw one: ProgressIndicator, which adds\n// the ring and the two indeterminate presentations on top, and Meter, which\n// is this and nothing else.\n//\n// The page's anatomy names three parts — the active indicator in primary,\n// the track in secondary container, and the stop indicator in primary at the\n// end — at 4dp thick with 4dp between them. The active indicator's width is\n// the percentage itself and the track takes what is left, so the row is a\n// flex line and the two gaps are its `gap`.\n//\n// `tone` is the line's colour. `primary` is the page's own pair, and it is\n// what a progress indicator draws. `negative` and `positive` swap the active\n// indicator and the stop indicator alone, leaving the track in secondary\n// container, so a column of meters reads as one scale with bars of different\n// colours rather than as several unrelated gauges. `inherit` instead takes\n// the colour around it for both, and gives the track a quarter of it, which\n// is what makes a ring legible inside a filled button, where the page's\n// primary is the button's own fill.\n//\n// Apart from ./index.tsx so that file exports components alone, which is\n// what keeps fast refresh working for it.\n\n/** The thickness of every part, and the room the page leaves between them. */\nexport const THICKNESS = 4;\nexport const GAP = 4;\n\n/** What the page gives a value that changes to move over. */\nexport const DETERMINATE_MS = 250;\nexport const DETERMINATE_EASING = 'cubic-bezier(0.4, 0, 0.6, 1)';\nexport type IndicatorTone = 'inherit' | 'negative' | 'positive' | 'primary';\nconst _temp = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nexport const indicatorStyles = {\n active: {\n kWkggS: \"xnety89\",\n kZKoxP: \"x5yr21d\",\n kaIpWk: \"x3y1ksm\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kIyJzY: \"x1rvut6x\",\n k1ekBW: \"x1j4rzew\",\n kAMwcw: \"x16pyfke\",\n $$css: true\n },\n activeAt: (percentage: number) => [_temp, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(`${percentage}%`)\n }],\n inheritActive: {\n kWkggS: \"xtwfq29\",\n kjVXCG: \"x73je2i\",\n $$css: true\n },\n inheritTrack: {\n kWkggS: \"xtp5tyh\",\n kjVXCG: \"xy3ggvv\",\n $$css: true\n },\n label: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n $$css: true\n },\n labels: {\n kGNEyG: \"x1pha0wt\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"x126z3so\",\n kjj79g: \"x1qughib\",\n $$css: true\n },\n line: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xqu0tyb\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"x1jnr06f\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n negativeActive: {\n kWkggS: \"xmjwayr\",\n $$css: true\n },\n positiveActive: {\n kWkggS: \"x1xov01w\",\n $$css: true\n },\n root: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kOIVth: \"xzoy561\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n stop: {\n kWkggS: \"xnety89\",\n kZKoxP: \"xqu0tyb\",\n kaIpWk: \"x3y1ksm\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x51ohtg\",\n $$css: true\n },\n track: {\n kZKoxP: \"x5yr21d\",\n kaIpWk: \"x3y1ksm\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kzQI83: \"x1iyjqo2\",\n k7Eaqz: \"xeuugli\",\n kVQacm: \"xb3r6kr\",\n $$css: true\n },\n trackSolid: {\n kWkggS: \"x15dekr4\",\n $$css: true\n }\n};"],"mappings":";AAmCA,MAAMU,QAAQ;CACZC,QAAQ;CACR,SAAS;AACX;AACA,MAAaC,kBAAkB;CAC7BC,QAAQ;EACNC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,WAAWC,eAAuB,CAACd,OAAO,EACxC,oBAAmBe,QAAO,OAAOA,QAAQ,WAAWA,MAAM,OAAOA,OAAO,OAAOA,MAAMC,KAAAA,EAAAA,CAAW,GAAGF,WAAU,EAAG,EAClH,CAAC;CACDG,eAAe;EACbb,QAAQ;EACRc,QAAQ;EACRN,OAAO;CACT;CACAO,cAAc;EACZf,QAAQ;EACRc,QAAQ;EACRN,OAAO;CACT;CACAQ,OAAO;EACLb,QAAQ;EACRc,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRd,OAAO;CACT;CACAe,QAAQ;EACNC,QAAQ;EACRrB,QAAQ;EACRsB,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRnB,OAAO;CACT;CACAoB,MAAM;EACJJ,QAAQ;EACRvB,QAAQ;EACRE,QAAQ;EACRsB,QAAQ;EACRC,QAAQ;EACR7B,QAAQ;EACRW,OAAO;CACT;CACAqB,gBAAgB;EACd7B,QAAQ;EACRQ,OAAO;CACT;CACAsB,gBAAgB;EACd9B,QAAQ;EACRQ,OAAO;CACT;CACAuB,MAAM;EACJ5B,QAAQ;EACRsB,QAAQ;EACRO,QAAQ;EACRN,QAAQ;EACR7B,QAAQ;EACRW,OAAO;CACT;CACAyB,MAAM;EACJjC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPP,QAAQ;EACRW,OAAO;CACT;CACA0B,OAAO;EACLjC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRsB,QAAQ;EACRU,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACR7B,OAAO;CACT;CACA8B,YAAY;EACVtC,QAAQ;EACRQ,OAAO;CACT;AACF"}
|
package/dist/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","names":[],"sources":["../src/layout.ts"],"sourcesContent":["// What the collections actually measure, for the layouts a virtualized one is\n// given. React Aria's `ListLayout`, `GridLayout`, `TableLayout` and\n// `WaterfallLayout` position rows from a size rather than from the DOM, so a\n// virtualized List, ListBox, Table or Tree has to be told how tall its rows\n// are — and a number guessed at the call site puts every row in the wrong\n// place the moment a component's own height changes.\n//\n// These are that number, and `src/layout.test.ts` renders each collection and\n// measures it, so a constant here cannot drift from what the component draws.\n//\n// They are the heights as rendered, which is what a virtualizer needs — not\n// what a spec page names, where the two can differ. They agree today.\n\n/**\n * The heights the collections draw, in pixels, for a virtualized one's\n * layout options.\n *\n * ```tsx\n * <Virtualizer\n * layout={ListLayout}\n * layoutOptions={{\n * rowSize: collectionSizes.listRow,\n * headingSize: collectionSizes.sectionHeading,\n * }}\n * >\n * <List aria-label=\"Label\" items={items}>{renderItem}</List>\n * </Virtualizer>\n * ```\n *\n * A row that wraps is taller than any of these, so a collection whose content\n * varies takes `estimatedRowSize` rather than `rowSize` and lets React Aria\n * measure the rest.\n */\nconst collectionSizes = {\n /** The thickness of the line a drag draws between two rows. */\n dropIndicator: 2,\n /** A `List`, `ListBox` or `Tree` row with a headline alone. */\n listRow: 56,\n /** A `List`, `ListBox` or `Tree` row with a headline and a supporting line. */\n listRowTwoLine: 72,\n /** A `Menu` item, which the menus page gives a shorter floor than a list's. */\n menuRow: 48,\n /** A `List.Section` or `Tree.Section` heading. */\n sectionHeading: 38,\n /** A `Table` header row, which the data tables page draws taller than a body row. */\n tableHeaderRow: 56,\n /** A `Table` body row. */\n tableRow: 52,\n} as const\n\nexport { collectionSizes }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiCA,
|
|
1
|
+
{"version":3,"file":"layout.js","names":["collectionSizes","dropIndicator","listRow","listRowTwoLine","menuRow","sectionHeading","tableHeaderRow","tableRow","const"],"sources":["../src/layout.ts"],"sourcesContent":["// What the collections actually measure, for the layouts a virtualized one is\n// given. React Aria's `ListLayout`, `GridLayout`, `TableLayout` and\n// `WaterfallLayout` position rows from a size rather than from the DOM, so a\n// virtualized List, ListBox, Table or Tree has to be told how tall its rows\n// are — and a number guessed at the call site puts every row in the wrong\n// place the moment a component's own height changes.\n//\n// These are that number, and `src/layout.test.ts` renders each collection and\n// measures it, so a constant here cannot drift from what the component draws.\n//\n// They are the heights as rendered, which is what a virtualizer needs — not\n// what a spec page names, where the two can differ. They agree today.\n\n/**\n * The heights the collections draw, in pixels, for a virtualized one's\n * layout options.\n *\n * ```tsx\n * <Virtualizer\n * layout={ListLayout}\n * layoutOptions={{\n * rowSize: collectionSizes.listRow,\n * headingSize: collectionSizes.sectionHeading,\n * }}\n * >\n * <List aria-label=\"Label\" items={items}>{renderItem}</List>\n * </Virtualizer>\n * ```\n *\n * A row that wraps is taller than any of these, so a collection whose content\n * varies takes `estimatedRowSize` rather than `rowSize` and lets React Aria\n * measure the rest.\n */\nconst collectionSizes = {\n /** The thickness of the line a drag draws between two rows. */\n dropIndicator: 2,\n /** A `List`, `ListBox` or `Tree` row with a headline alone. */\n listRow: 56,\n /** A `List`, `ListBox` or `Tree` row with a headline and a supporting line. */\n listRowTwoLine: 72,\n /** A `Menu` item, which the menus page gives a shorter floor than a list's. */\n menuRow: 48,\n /** A `List.Section` or `Tree.Section` heading. */\n sectionHeading: 38,\n /** A `Table` header row, which the data tables page draws taller than a body row. */\n tableHeaderRow: 56,\n /** A `Table` body row. */\n tableRow: 52,\n} as const\n\nexport { collectionSizes }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiCA,MAAMA,kBAAkB;;CAEtBC,eAAe;;CAEfC,SAAS;;CAETC,gBAAgB;;CAEhBC,SAAS;;CAETC,gBAAgB;;CAEhBC,gBAAgB;;CAEhBC,UAAU;AACZ"}
|
package/dist/render/aria.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aria.js","names":[],"sources":["../../src/render/aria.tsx"],"sourcesContent":["import type { AriaAttributes, KeyboardEventHandler } from 'react'\nimport type {\n ButtonProps,\n LinkProps,\n ToggleButtonProps,\n} from 'react-aria-components'\n\nimport { createElement } from 'react'\n\n// The four React Aria forwards on its own, and may combine with what a parent\n// provides through context — a dialog's trigger names its dialog this way.\n// Everything else it drops, so those stay out of the spread below rather\n// than overriding a value React Aria computed.\nconst LABELLING = new Set([\n 'aria-describedby',\n 'aria-details',\n 'aria-label',\n 'aria-labelledby',\n])\n\n/**\n * What a component puts on the element itself, past React Aria: the `aria-*`\n * props it would drop, and the keyboard handlers it would wrap.\n *\n * React Aria forwards only the labelling attributes, which is right for the\n * states it manages but leaves a call site no way to mark a button as\n * expanded, pressed, or in control of something React Aria does not know\n * about. Its keyboard handlers stop propagation unless the handler asks\n * otherwise, which is its own convention rather than the DOM's; attached to\n * the element directly they bubble as a call site expects, and an Escape\n * pressed on a button inside a dialog still reaches the dialog.\n */\ninterface ElementProps {\n aria: AriaAttributes\n onKeyDown?: KeyboardEventHandler<HTMLElement> | undefined\n onKeyUp?: KeyboardEventHandler<HTMLElement> | undefined\n}\n\n/** The `aria-*` props React Aria would drop, collected for {@link ElementProps}. */\nfunction ariaAttributesOf(props: object): AriaAttributes {\n const aria: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(props)) {\n if (key.startsWith('aria-') && !LABELLING.has(key)) {\n aria[key] = value\n }\n }\n return aria\n}\n\n/**\n * The `render` function for a React Aria `Button`: the element it would have\n * rendered, plus {@link ElementProps}, handed on to the call site's own\n * `render` when there is one. Built by a call rather than written inline at\n * the prop, which is what react-perf's no-new-function-as-prop is after.\n *\n * `createElement` rather than JSX, here and below: React Aria types the\n * props it hands over as a union of the elements it might have rendered, and\n * a spread of that union onto one tag does not type-check, where the plain\n * call takes any props object.\n */\nfunction buttonRenderer(\n element: ElementProps,\n render: ButtonProps['render'],\n): NonNullable<ButtonProps['render']> {\n return (domProps, state) => {\n const merged = withElementProps(domProps, element)\n if (render !== undefined) {\n return render(merged, state)\n }\n return createElement('button', merged)\n }\n}\n\n// React Aria's own keyboard handling comes first, then the call site's.\nfunction chain<Event>(\n first: ((event: Event) => void) | undefined,\n second: ((event: Event) => void) | undefined,\n) {\n if (second === undefined) {\n return first\n }\n return (event: Event) => {\n first?.(event)\n second(event)\n }\n}\n\n/**\n * The same for a React Aria `Link`, handed on to the call site's own `render`\n * when there is one. React Aria expects an anchor while the link is enabled\n * and has somewhere to go, and a span in every other case — a disabled anchor\n * is no link at all, and one without `href` is a placeholder — and it leaves\n * `href` out of what it hands over in both span cases, which is what the\n * element is chosen from.\n */\nfunction linkRenderer(\n element: ElementProps,\n render?: LinkProps['render'],\n): NonNullable<LinkProps['render']> {\n return (domProps, state) => {\n const merged = withElementProps(domProps, element)\n if (render !== undefined) {\n return render(merged, state)\n }\n if (state.isDisabled || !('href' in merged)) {\n return createElement('span', { ...merged, href: undefined })\n }\n return createElement('a', merged)\n }\n}\n\n/**\n * The same for a React Aria `ToggleButton`. Written out rather than made\n * generic over `buttonRenderer`: React Aria hands a toggle button a render\n * state of its own — no `isPending`, plus `isSelected` — and a function\n * written against the plain button's state does not type-check where that\n * one is expected.\n */\nfunction toggleButtonRenderer(\n element: ElementProps,\n render: ToggleButtonProps['render'],\n): NonNullable<ToggleButtonProps['render']> {\n return (domProps, state) => {\n const merged = withElementProps(domProps, element)\n if (render !== undefined) {\n return render(merged, state)\n }\n return createElement('button', merged)\n }\n}\n\nfunction withElementProps<Props extends object>(\n domProps: Props,\n element: ElementProps,\n) {\n const dom = domProps as Props & {\n onKeyDown?: KeyboardEventHandler<HTMLElement>\n onKeyUp?: KeyboardEventHandler<HTMLElement>\n }\n return {\n ...domProps,\n ...element.aria,\n onKeyDown: chain(dom.onKeyDown, element.onKeyDown),\n onKeyUp: chain(dom.onKeyUp, element.onKeyUp),\n }\n}\n\nexport type { ElementProps }\n\nexport { ariaAttributesOf, buttonRenderer, linkRenderer, toggleButtonRenderer }\n"],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"aria.js","names":["AriaAttributes","KeyboardEventHandler","ButtonProps","LinkProps","ToggleButtonProps","createElement","LABELLING","Set","ElementProps","aria","onKeyDown","HTMLElement","onKeyUp","ariaAttributesOf","props","Record","key","value","Object","entries","startsWith","has","buttonRenderer","element","render","NonNullable","domProps","state","merged","withElementProps","undefined","chain","first","event","Event","second","linkRenderer","isDisabled","href","toggleButtonRenderer","Props","dom"],"sources":["../../src/render/aria.tsx"],"sourcesContent":["import type { AriaAttributes, KeyboardEventHandler } from 'react'\nimport type {\n ButtonProps,\n LinkProps,\n ToggleButtonProps,\n} from 'react-aria-components'\n\nimport { createElement } from 'react'\n\n// The four React Aria forwards on its own, and may combine with what a parent\n// provides through context — a dialog's trigger names its dialog this way.\n// Everything else it drops, so those stay out of the spread below rather\n// than overriding a value React Aria computed.\nconst LABELLING = new Set([\n 'aria-describedby',\n 'aria-details',\n 'aria-label',\n 'aria-labelledby',\n])\n\n/**\n * What a component puts on the element itself, past React Aria: the `aria-*`\n * props it would drop, and the keyboard handlers it would wrap.\n *\n * React Aria forwards only the labelling attributes, which is right for the\n * states it manages but leaves a call site no way to mark a button as\n * expanded, pressed, or in control of something React Aria does not know\n * about. Its keyboard handlers stop propagation unless the handler asks\n * otherwise, which is its own convention rather than the DOM's; attached to\n * the element directly they bubble as a call site expects, and an Escape\n * pressed on a button inside a dialog still reaches the dialog.\n */\ninterface ElementProps {\n aria: AriaAttributes\n onKeyDown?: KeyboardEventHandler<HTMLElement> | undefined\n onKeyUp?: KeyboardEventHandler<HTMLElement> | undefined\n}\n\n/** The `aria-*` props React Aria would drop, collected for {@link ElementProps}. */\nfunction ariaAttributesOf(props: object): AriaAttributes {\n const aria: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(props)) {\n if (key.startsWith('aria-') && !LABELLING.has(key)) {\n aria[key] = value\n }\n }\n return aria\n}\n\n/**\n * The `render` function for a React Aria `Button`: the element it would have\n * rendered, plus {@link ElementProps}, handed on to the call site's own\n * `render` when there is one. Built by a call rather than written inline at\n * the prop, which is what react-perf's no-new-function-as-prop is after.\n *\n * `createElement` rather than JSX, here and below: React Aria types the\n * props it hands over as a union of the elements it might have rendered, and\n * a spread of that union onto one tag does not type-check, where the plain\n * call takes any props object.\n */\nfunction buttonRenderer(\n element: ElementProps,\n render: ButtonProps['render'],\n): NonNullable<ButtonProps['render']> {\n return (domProps, state) => {\n const merged = withElementProps(domProps, element)\n if (render !== undefined) {\n return render(merged, state)\n }\n return createElement('button', merged)\n }\n}\n\n// React Aria's own keyboard handling comes first, then the call site's.\nfunction chain<Event>(\n first: ((event: Event) => void) | undefined,\n second: ((event: Event) => void) | undefined,\n) {\n if (second === undefined) {\n return first\n }\n return (event: Event) => {\n first?.(event)\n second(event)\n }\n}\n\n/**\n * The same for a React Aria `Link`, handed on to the call site's own `render`\n * when there is one. React Aria expects an anchor while the link is enabled\n * and has somewhere to go, and a span in every other case — a disabled anchor\n * is no link at all, and one without `href` is a placeholder — and it leaves\n * `href` out of what it hands over in both span cases, which is what the\n * element is chosen from.\n */\nfunction linkRenderer(\n element: ElementProps,\n render?: LinkProps['render'],\n): NonNullable<LinkProps['render']> {\n return (domProps, state) => {\n const merged = withElementProps(domProps, element)\n if (render !== undefined) {\n return render(merged, state)\n }\n if (state.isDisabled || !('href' in merged)) {\n return createElement('span', { ...merged, href: undefined })\n }\n return createElement('a', merged)\n }\n}\n\n/**\n * The same for a React Aria `ToggleButton`. Written out rather than made\n * generic over `buttonRenderer`: React Aria hands a toggle button a render\n * state of its own — no `isPending`, plus `isSelected` — and a function\n * written against the plain button's state does not type-check where that\n * one is expected.\n */\nfunction toggleButtonRenderer(\n element: ElementProps,\n render: ToggleButtonProps['render'],\n): NonNullable<ToggleButtonProps['render']> {\n return (domProps, state) => {\n const merged = withElementProps(domProps, element)\n if (render !== undefined) {\n return render(merged, state)\n }\n return createElement('button', merged)\n }\n}\n\nfunction withElementProps<Props extends object>(\n domProps: Props,\n element: ElementProps,\n) {\n const dom = domProps as Props & {\n onKeyDown?: KeyboardEventHandler<HTMLElement>\n onKeyUp?: KeyboardEventHandler<HTMLElement>\n }\n return {\n ...domProps,\n ...element.aria,\n onKeyDown: chain(dom.onKeyDown, element.onKeyDown),\n onKeyUp: chain(dom.onKeyUp, element.onKeyUp),\n }\n}\n\nexport type { ElementProps }\n\nexport { ariaAttributesOf, buttonRenderer, linkRenderer, toggleButtonRenderer }\n"],"mappings":";;AAaA,MAAMM,4BAAY,IAAIC,IAAI;CACxB;CACA;CACA;CACA;AAAiB,CAClB;;AAqBD,SAASM,iBAAiBC,OAA+B;CACvD,MAAML,OAAgC,CAAC;CACvC,KAAK,MAAM,CAACO,KAAKC,UAAUC,OAAOC,QAAQL,KAAK,GAC7C,IAAIE,IAAII,WAAW,OAAO,KAAK,CAACd,UAAUe,IAAIL,GAAG,GAC/CP,KAAKO,OAAOC;CAGhB,OAAOR;AACT;;;;;;;;;;;;AAaA,SAASa,eACPC,SACAC,QACoC;CACpC,QAAQE,UAAUC,UAAU;EAC1B,MAAMC,SAASC,iBAAiBH,UAAUH,OAAO;EACjD,IAAIC,WAAWM,KAAAA,GACb,OAAON,OAAOI,QAAQD,KAAK;EAE7B,OAAOtB,cAAc,UAAUuB,MAAM;CACvC;AACF;AAGA,SAASG,MACPC,OACAG,QACA;CACA,IAAIA,WAAWL,KAAAA,GACb,OAAOE;CAET,QAAQC,UAAiB;EACvBD,QAAQC,KAAK;EACbE,OAAOF,KAAK;CACd;AACF;;;;;;;;;AAUA,SAASG,aACPb,SACAC,QACkC;CAClC,QAAQE,UAAUC,UAAU;EAC1B,MAAMC,SAASC,iBAAiBH,UAAUH,OAAO;EACjD,IAAIC,WAAWM,KAAAA,GACb,OAAON,OAAOI,QAAQD,KAAK;EAE7B,IAAIA,MAAMU,cAAc,EAAE,UAAUT,SAClC,OAAOvB,cAAc,QAAQ;GAAE,GAAGuB;GAAQU,MAAMR,KAAAA;EAAU,CAAC;EAE7D,OAAOzB,cAAc,KAAKuB,MAAM;CAClC;AACF;;;;;;;;AASA,SAASW,qBACPhB,SACAC,QAC0C;CAC1C,QAAQE,UAAUC,UAAU;EAC1B,MAAMC,SAASC,iBAAiBH,UAAUH,OAAO;EACjD,IAAIC,WAAWM,KAAAA,GACb,OAAON,OAAOI,QAAQD,KAAK;EAE7B,OAAOtB,cAAc,UAAUuB,MAAM;CACvC;AACF;AAEA,SAASC,iBACPH,UACAH,SACA;CACA,MAAMkB,MAAMf;CAIZ,OAAO;EACL,GAAGA;EACH,GAAGH,QAAQd;EACXC,WAAWqB,MAAMU,IAAI/B,WAAWa,QAAQb,SAAS;EACjDE,SAASmB,MAAMU,IAAI7B,SAASW,QAAQX,OAAO;CAC7C;AACF"}
|
package/dist/render/useRender.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { cloneElement, createElement, isValidElement } from "react";
|
|
2
3
|
//#region src/render/useRender.tsx
|
|
3
4
|
function attach(ref, node) {
|
|
4
5
|
if (ref === null) return () => {};
|
|
@@ -104,27 +105,71 @@ function styleOf(value) {
|
|
|
104
105
|
* contract in a hook of the library's own is what lets them stay put
|
|
105
106
|
* whichever behaviour library sits underneath the rest.
|
|
106
107
|
*/
|
|
107
|
-
function useRender(
|
|
108
|
+
function useRender(t0) {
|
|
109
|
+
const $ = c(17);
|
|
110
|
+
const { defaultTagName: t1, props: t2, render } = t0;
|
|
111
|
+
const defaultTagName = t1 === void 0 ? "div" : t1;
|
|
112
|
+
let t3;
|
|
113
|
+
if ($[0] !== t2) {
|
|
114
|
+
t3 = t2 === void 0 ? {} : t2;
|
|
115
|
+
$[0] = t2;
|
|
116
|
+
$[1] = t3;
|
|
117
|
+
} else t3 = $[1];
|
|
118
|
+
const props = t3;
|
|
108
119
|
const element = isValidElement(render) ? render : void 0;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
ref
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
element?.props.ref;
|
|
121
|
+
let t4;
|
|
122
|
+
if ($[2] !== element?.props.ref || $[3] !== props.ref) {
|
|
123
|
+
t4 = mergeRefs(refOf(props.ref), refOf(element?.props.ref));
|
|
124
|
+
$[2] = element?.props.ref;
|
|
125
|
+
$[3] = props.ref;
|
|
126
|
+
$[4] = t4;
|
|
127
|
+
} else t4 = $[4];
|
|
128
|
+
const ref = t4;
|
|
129
|
+
if (element !== void 0) {
|
|
130
|
+
let t5;
|
|
131
|
+
if ($[5] !== element || $[6] !== props || $[7] !== ref) {
|
|
132
|
+
t5 = cloneElement(element, {
|
|
133
|
+
...mergeElementProps(props, element.props),
|
|
134
|
+
ref
|
|
135
|
+
});
|
|
136
|
+
$[5] = element;
|
|
137
|
+
$[6] = props;
|
|
138
|
+
$[7] = ref;
|
|
139
|
+
$[8] = t5;
|
|
140
|
+
} else t5 = $[8];
|
|
141
|
+
return t5;
|
|
142
|
+
}
|
|
143
|
+
if (typeof render === "function") {
|
|
144
|
+
let t5;
|
|
145
|
+
if ($[9] !== props || $[10] !== ref || $[11] !== render) {
|
|
146
|
+
t5 = render({
|
|
147
|
+
...props,
|
|
148
|
+
ref
|
|
149
|
+
});
|
|
150
|
+
$[9] = props;
|
|
151
|
+
$[10] = ref;
|
|
152
|
+
$[11] = render;
|
|
153
|
+
$[12] = t5;
|
|
154
|
+
} else t5 = $[12];
|
|
155
|
+
return t5;
|
|
156
|
+
}
|
|
157
|
+
let t5;
|
|
158
|
+
if ($[13] !== defaultTagName || $[14] !== props || $[15] !== ref) {
|
|
159
|
+
t5 = createElement(defaultTagName, defaultTagName === "button" ? {
|
|
160
|
+
type: "button",
|
|
161
|
+
...props,
|
|
162
|
+
ref
|
|
163
|
+
} : {
|
|
164
|
+
...props,
|
|
165
|
+
ref
|
|
166
|
+
});
|
|
167
|
+
$[13] = defaultTagName;
|
|
168
|
+
$[14] = props;
|
|
169
|
+
$[15] = ref;
|
|
170
|
+
$[16] = t5;
|
|
171
|
+
} else t5 = $[16];
|
|
172
|
+
return t5;
|
|
128
173
|
}
|
|
129
174
|
//#endregion
|
|
130
175
|
export { useRender };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRender.js","names":[],"sources":["../../src/render/useRender.tsx"],"sourcesContent":["import type {\n ComponentPropsWithRef,\n CSSProperties,\n HTMLAttributes,\n JSX,\n ReactElement,\n Ref,\n RefCallback,\n RefObject,\n} from 'react'\n\nimport { cloneElement, createElement, isValidElement, useMemo } from 'react'\n\ntype Handler = (...args: ReadonlyArray<unknown>) => unknown\n\ntype IntrinsicTag = keyof JSX.IntrinsicElements\n\n/**\n * The props of a component rendered through {@link useRender}: everything the\n * element accepts, plus `render`.\n */\ntype RenderComponentProps<Tag extends IntrinsicTag> =\n ComponentPropsWithRef<Tag> & {\n /**\n * Replaces the element the component renders by default: another tag, as\n * `render={<h2 />}`, or a function returning the element to render, given\n * the props the component would have put on its own.\n */\n render?: RenderProp | undefined\n }\n\n/**\n * What a `render` function is handed: the element's props, merged and ready\n * to spread onto whatever element it returns. `any` on purpose, in the one\n * place it appears — the function may return any element, and a ref typed for\n * one of them would refuse every other.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- see above\ntype RenderFunctionProps = HTMLAttributes<any> & { ref?: Ref<any> | undefined }\n\ntype RenderProp = ((props: RenderFunctionProps) => ReactElement) | ReactElement\n\ninterface UseRenderParameters {\n /**\n * The tag rendered when `render` is not given.\n * @default 'div'\n */\n defaultTagName?: IntrinsicTag | undefined\n /** The props to put on whichever element ends up rendered. */\n props?: Record<string, unknown> | undefined\n render?: RenderProp | undefined\n}\n\nfunction attach(ref: Ref<Element>, node: Element | null): () => void {\n if (ref === null) {\n return () => {}\n }\n if (typeof ref === 'function') {\n const cleanup = ref(node)\n return typeof cleanup === 'function'\n ? cleanup\n : () => {\n ref(null)\n }\n }\n ref.current = node\n return () => {\n ref.current = null\n }\n}\n\nfunction isHandler(value: unknown): value is Handler {\n return typeof value === 'function'\n}\n\nfunction isHandlerKey(key: string) {\n return /^on[A-Z]/u.test(key)\n}\n\nfunction isRefCallback(value: unknown): value is RefCallback<Element> {\n return typeof value === 'function'\n}\n\nfunction isRefObject(value: unknown): value is RefObject<Element | null> {\n return typeof value === 'object' && value !== null && 'current' in value\n}\n\n// undefined rather than '' when there is nothing to say, so an element with\n// no classes on either side renders without a class attribute at all.\nfunction joinClassNames(...names: ReadonlyArray<string | undefined>) {\n return names.filter(Boolean).join(' ') || undefined\n}\n\n/**\n * The component's props over the element's own. The element wins a plain\n * conflict — it is the more specific of the two — while class names, styles\n * and handlers are combined rather than chosen between. `ref` is left out:\n * the hook merges the two refs itself.\n */\nfunction mergeElementProps(\n ours: Record<string, unknown>,\n theirs: Record<string, unknown>,\n) {\n const merged: Record<string, unknown> = { ...ours, ...theirs }\n\n merged.className = joinClassNames(\n stringOf(ours.className),\n stringOf(theirs.className),\n )\n merged.style = mergeStyleObjects(styleOf(ours.style), styleOf(theirs.style))\n\n for (const key of Object.keys(theirs)) {\n const own = ours[key]\n const their = theirs[key]\n if (isHandlerKey(key) && isHandler(own) && isHandler(their)) {\n // The element's own handler runs first, as the more specific one.\n merged[key] = (...args: ReadonlyArray<unknown>) => {\n their(...args)\n own(...args)\n }\n }\n }\n\n delete merged.ref\n return merged\n}\n\n/**\n * One ref that feeds both, or whichever one there is. Attaching through a\n * callback lets each side keep its own cleanup: React 19 calls a callback\n * ref's returned function on detach in place of calling it with `null`, so\n * the merged callback returns one that does the same for each of the two.\n */\nfunction mergeRefs(\n a: Ref<Element> | undefined,\n b: Ref<Element> | undefined,\n): Ref<Element> | undefined {\n if (a === undefined) {\n return b\n }\n if (b === undefined) {\n return a\n }\n return (node: Element | null) => {\n const detachA = attach(a, node)\n const detachB = attach(b, node)\n return () => {\n detachA()\n detachB()\n }\n }\n}\n\nfunction mergeStyleObjects(\n ours: CSSProperties | undefined,\n theirs: CSSProperties | undefined,\n) {\n if (ours === undefined && theirs === undefined) {\n return undefined\n }\n return { ...ours, ...theirs }\n}\n\nfunction refOf(value: unknown): Ref<Element> | undefined {\n if (isRefCallback(value) || isRefObject(value)) {\n return value\n }\n return undefined\n}\n\nfunction stringOf(value: unknown) {\n return typeof value === 'string' ? value : undefined\n}\n\nfunction styleOf(value: unknown) {\n return typeof value === 'object' && value !== null\n ? (value as CSSProperties)\n : undefined\n}\n\n/**\n * Renders a component's element, or whatever its `render` prop asks for\n * instead.\n *\n * `render` is either a React element, cloned with the component's props\n * merged over its own — class names joined, styles merged, event handlers\n * chained, the element's own value winning any other conflict — or a function\n * handed those merged props to return an element of its choosing. Without one,\n * `defaultTagName` is rendered. A default `button` is given `type=\"button\"`,\n * since a bare one submits any form it happens to sit in.\n *\n * The element form is the point of owning this. React Aria's own `render`\n * is a function that must return the element the component would have\n * rendered itself, which suits its interactive components and nothing else;\n * the non-interactive ones here take `render={<h2 />}`, and keeping that\n * contract in a hook of the library's own is what lets them stay put\n * whichever behaviour library sits underneath the rest.\n */\nfunction useRender({\n defaultTagName = 'div',\n props = {},\n render,\n}: UseRenderParameters): ReactElement {\n const element = isValidElement<Record<string, unknown>>(render)\n ? render\n : undefined\n\n // Both refs, when there are two, have to land on one node. The merged\n // callback is memoised so React does not detach and re-attach it on every\n // render — a new identity each time would.\n const ownRef = refOf(props.ref)\n const elementRef = refOf(element?.props.ref)\n const ref = useMemo(() => mergeRefs(ownRef, elementRef), [ownRef, elementRef])\n\n if (element !== undefined) {\n return cloneElement(element, {\n ...mergeElementProps(props, element.props),\n ref,\n })\n }\n\n if (typeof render === 'function') {\n return render({ ...props, ref } as RenderFunctionProps)\n }\n\n return createElement(\n defaultTagName,\n defaultTagName === 'button'\n ? { type: 'button', ...props, ref }\n : { ...props, ref },\n )\n}\n\nexport type { RenderComponentProps, RenderFunctionProps, UseRenderParameters }\n\nexport { useRender }\n"],"mappings":";;AAqDA,SAAS,OAAO,KAAmB,MAAkC;CACnE,IAAI,QAAQ,MACV,aAAa,CAAC;CAEhB,IAAI,OAAO,QAAQ,YAAY;EAC7B,MAAM,UAAU,IAAI,IAAI;EACxB,OAAO,OAAO,YAAY,aACtB,gBACM;GACJ,IAAI,IAAI;EACV;CACN;CACA,IAAI,UAAU;CACd,aAAa;EACX,IAAI,UAAU;CAChB;AACF;AAEA,SAAS,UAAU,OAAkC;CACnD,OAAO,OAAO,UAAU;AAC1B;AAEA,SAAS,aAAa,KAAa;CACjC,OAAO,YAAY,KAAK,GAAG;AAC7B;AAEA,SAAS,cAAc,OAA+C;CACpE,OAAO,OAAO,UAAU;AAC1B;AAEA,SAAS,YAAY,OAAoD;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa;AACrE;AAIA,SAAS,eAAe,GAAG,OAA0C;CACnE,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;AAC5C;;;;;;;AAQA,SAAS,kBACP,MACA,QACA;CACA,MAAM,SAAkC;EAAE,GAAG;EAAM,GAAG;CAAO;CAE7D,OAAO,YAAY,eACjB,SAAS,KAAK,SAAS,GACvB,SAAS,OAAO,SAAS,CAC3B;CACA,OAAO,QAAQ,kBAAkB,QA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,UAAU,CAAC;CAE7E,IAAI,YAAY,KAAA,GACd,OAAO,aAAa,SAAS;EAC3B,GAAG,kBAAkB,OAAO,QAAQ,KAAK;EACzC;CACF,CAAC;CAGH,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO;EAAE,GAAG;EAAO;CAAI,CAAwB;CAGxD,OAAO,cACL,gBACA,mBAAmB,WACf;EAAE,MAAM;EAAU,GAAG;EAAO;CAAI,IAChC;EAAE,GAAG;EAAO;CAAI,CACtB;AACF"}
|
|
1
|
+
{"version":3,"file":"useRender.js","names":["ComponentPropsWithRef","CSSProperties","HTMLAttributes","JSX","ReactElement","Ref","RefCallback","RefObject","cloneElement","createElement","isValidElement","useMemo","Handler","args","ReadonlyArray","IntrinsicTag","IntrinsicElements","RenderComponentProps","Tag","render","RenderProp","RenderFunctionProps","ref","props","UseRenderParameters","defaultTagName","Record","attach","Element","node","cleanup","current","isHandler","value","isHandlerKey","key","test","isRefCallback","isRefObject","joinClassNames","names","filter","Boolean","join","undefined","mergeElementProps","ours","theirs","merged","className","stringOf","style","mergeStyleObjects","styleOf","Object","keys","own","their","mergeRefs","a","b","detachA","detachB","refOf","useRender","t0","$","_c","t1","t2","t3","element","t4","t5","type"],"sources":["../../src/render/useRender.tsx"],"sourcesContent":["import type {\n ComponentPropsWithRef,\n CSSProperties,\n HTMLAttributes,\n JSX,\n ReactElement,\n Ref,\n RefCallback,\n RefObject,\n} from 'react'\n\nimport { cloneElement, createElement, isValidElement, useMemo } from 'react'\n\ntype Handler = (...args: ReadonlyArray<unknown>) => unknown\n\ntype IntrinsicTag = keyof JSX.IntrinsicElements\n\n/**\n * The props of a component rendered through {@link useRender}: everything the\n * element accepts, plus `render`.\n */\ntype RenderComponentProps<Tag extends IntrinsicTag> =\n ComponentPropsWithRef<Tag> & {\n /**\n * Replaces the element the component renders by default: another tag, as\n * `render={<h2 />}`, or a function returning the element to render, given\n * the props the component would have put on its own.\n */\n render?: RenderProp | undefined\n }\n\n/**\n * What a `render` function is handed: the element's props, merged and ready\n * to spread onto whatever element it returns. `any` on purpose, in the one\n * place it appears — the function may return any element, and a ref typed for\n * one of them would refuse every other.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- see above\ntype RenderFunctionProps = HTMLAttributes<any> & { ref?: Ref<any> | undefined }\n\ntype RenderProp = ((props: RenderFunctionProps) => ReactElement) | ReactElement\n\ninterface UseRenderParameters {\n /**\n * The tag rendered when `render` is not given.\n * @default 'div'\n */\n defaultTagName?: IntrinsicTag | undefined\n /** The props to put on whichever element ends up rendered. */\n props?: Record<string, unknown> | undefined\n render?: RenderProp | undefined\n}\n\nfunction attach(ref: Ref<Element>, node: Element | null): () => void {\n if (ref === null) {\n return () => {}\n }\n if (typeof ref === 'function') {\n const cleanup = ref(node)\n return typeof cleanup === 'function'\n ? cleanup\n : () => {\n ref(null)\n }\n }\n ref.current = node\n return () => {\n ref.current = null\n }\n}\n\nfunction isHandler(value: unknown): value is Handler {\n return typeof value === 'function'\n}\n\nfunction isHandlerKey(key: string) {\n return /^on[A-Z]/u.test(key)\n}\n\nfunction isRefCallback(value: unknown): value is RefCallback<Element> {\n return typeof value === 'function'\n}\n\nfunction isRefObject(value: unknown): value is RefObject<Element | null> {\n return typeof value === 'object' && value !== null && 'current' in value\n}\n\n// undefined rather than '' when there is nothing to say, so an element with\n// no classes on either side renders without a class attribute at all.\nfunction joinClassNames(...names: ReadonlyArray<string | undefined>) {\n return names.filter(Boolean).join(' ') || undefined\n}\n\n/**\n * The component's props over the element's own. The element wins a plain\n * conflict — it is the more specific of the two — while class names, styles\n * and handlers are combined rather than chosen between. `ref` is left out:\n * the hook merges the two refs itself.\n */\nfunction mergeElementProps(\n ours: Record<string, unknown>,\n theirs: Record<string, unknown>,\n) {\n const merged: Record<string, unknown> = { ...ours, ...theirs }\n\n merged.className = joinClassNames(\n stringOf(ours.className),\n stringOf(theirs.className),\n )\n merged.style = mergeStyleObjects(styleOf(ours.style), styleOf(theirs.style))\n\n for (const key of Object.keys(theirs)) {\n const own = ours[key]\n const their = theirs[key]\n if (isHandlerKey(key) && isHandler(own) && isHandler(their)) {\n // The element's own handler runs first, as the more specific one.\n merged[key] = (...args: ReadonlyArray<unknown>) => {\n their(...args)\n own(...args)\n }\n }\n }\n\n delete merged.ref\n return merged\n}\n\n/**\n * One ref that feeds both, or whichever one there is. Attaching through a\n * callback lets each side keep its own cleanup: React 19 calls a callback\n * ref's returned function on detach in place of calling it with `null`, so\n * the merged callback returns one that does the same for each of the two.\n */\nfunction mergeRefs(\n a: Ref<Element> | undefined,\n b: Ref<Element> | undefined,\n): Ref<Element> | undefined {\n if (a === undefined) {\n return b\n }\n if (b === undefined) {\n return a\n }\n return (node: Element | null) => {\n const detachA = attach(a, node)\n const detachB = attach(b, node)\n return () => {\n detachA()\n detachB()\n }\n }\n}\n\nfunction mergeStyleObjects(\n ours: CSSProperties | undefined,\n theirs: CSSProperties | undefined,\n) {\n if (ours === undefined && theirs === undefined) {\n return undefined\n }\n return { ...ours, ...theirs }\n}\n\nfunction refOf(value: unknown): Ref<Element> | undefined {\n if (isRefCallback(value) || isRefObject(value)) {\n return value\n }\n return undefined\n}\n\nfunction stringOf(value: unknown) {\n return typeof value === 'string' ? value : undefined\n}\n\nfunction styleOf(value: unknown) {\n return typeof value === 'object' && value !== null\n ? (value as CSSProperties)\n : undefined\n}\n\n/**\n * Renders a component's element, or whatever its `render` prop asks for\n * instead.\n *\n * `render` is either a React element, cloned with the component's props\n * merged over its own — class names joined, styles merged, event handlers\n * chained, the element's own value winning any other conflict — or a function\n * handed those merged props to return an element of its choosing. Without one,\n * `defaultTagName` is rendered. A default `button` is given `type=\"button\"`,\n * since a bare one submits any form it happens to sit in.\n *\n * The element form is the point of owning this. React Aria's own `render`\n * is a function that must return the element the component would have\n * rendered itself, which suits its interactive components and nothing else;\n * the non-interactive ones here take `render={<h2 />}`, and keeping that\n * contract in a hook of the library's own is what lets them stay put\n * whichever behaviour library sits underneath the rest.\n */\nfunction useRender({\n defaultTagName = 'div',\n props = {},\n render,\n}: UseRenderParameters): ReactElement {\n const element = isValidElement<Record<string, unknown>>(render)\n ? render\n : undefined\n\n // Both refs, when there are two, have to land on one node. The merged\n // callback is memoised so React does not detach and re-attach it on every\n // render — a new identity each time would.\n //\n // The dependencies are the props the refs are read from rather than the\n // refs themselves. React writes through a ref object, so the compiler reads\n // one as a value that may be modified later and declines to preserve a\n // memoisation keyed on it — which, under the panic threshold this lands\n // beside, fails the build. A prop it can prove holds still.\n const ref = useMemo(\n () => mergeRefs(refOf(props.ref), refOf(element?.props.ref)),\n [props.ref, element?.props.ref],\n )\n\n if (element !== undefined) {\n return cloneElement(element, {\n ...mergeElementProps(props, element.props),\n ref,\n })\n }\n\n if (typeof render === 'function') {\n return render({ ...props, ref } as RenderFunctionProps)\n }\n\n return createElement(\n defaultTagName,\n defaultTagName === 'button'\n ? { type: 'button', ...props, ref }\n : { ...props, ref },\n )\n}\n\nexport type { RenderComponentProps, RenderFunctionProps, UseRenderParameters }\n\nexport { useRender }\n"],"mappings":";;;AAqDA,SAAS2B,OAAOL,KAAmBO,MAAkC;CACnE,IAAIP,QAAQ,MACV,aAAa,CAAC;CAEhB,IAAI,OAAOA,QAAQ,YAAY;EAC7B,MAAMQ,UAAUR,IAAIO,IAAI;EACxB,OAAO,OAAOC,YAAY,aACtBA,gBACM;GACJR,IAAI,IAAI;EACV;CACN;CACAA,IAAIS,UAAUF;CACd,aAAa;EACXP,IAAIS,UAAU;CAChB;AACF;AAEA,SAASC,UAAUC,OAAkC;CACnD,OAAO,OAAOA,UAAU;AAC1B;AAEA,SAASC,aAAaC,KAAa;CACjC,OAAO,YAAYC,KAAKD,GAAG;AAC7B;AAEA,SAASE,cAAcJ,OAA+C;CACpE,OAAO,OAAOA,UAAU;AAC1B;AAEA,SAASK,YAAYL,OAAoD;CACvE,OAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQ,aAAaA;AACrE;AAIA,SAASM,eAAe,GAAGC,OAA0C;CACnE,OAAOA,M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AAA,KAAAP,EAAA;EAAA,OAHKO;CAGL;CAGJ,IAAI,OAAOtD,WAAW,YAAU;EAAA,IAAAsD;EAAA,IAAAP,EAAA,OAAA3C,SAAA2C,EAAA,QAAA5C,OAAA4C,EAAA,QAAA/C,QAAA;GACvBsD,KAAAtD,OAAO;IAAA,GAAKI;IAAKD;GAAM,CAAwB;GAAC4C,EAAA,KAAA3C;GAAA2C,EAAA,MAAA5C;GAAA4C,EAAA,MAAA/C;GAAA+C,EAAA,MAAAO;EAAA,OAAAA,KAAAP,EAAA;EAAA,OAAhDO;CAAgD;CACxD,IAAAA;CAAA,IAAAP,EAAA,QAAAzC,kBAAAyC,EAAA,QAAA3C,SAAA2C,EAAA,QAAA5C,KAAA;EAEMmD,KAAAhE,cACLgB,gBACAA,mBAAmB,WAAnB;GAAAiD,MACY;GAAQ,GAAKnD;GAAKD;EACV,IAFpB;GAAA,GAESC;GAAKD;EAAM,CACtB;EAAC4C,EAAA,MAAAzC;EAAAyC,EAAA,MAAA3C;EAAA2C,EAAA,MAAA5C;EAAA4C,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OALMO;AAKN"}
|
package/dist/row/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { props } from "../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { rowStyles } from "./styles.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
//#region src/row/index.tsx
|
|
5
6
|
/**
|
|
@@ -13,36 +14,109 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
13
14
|
* Not a component of the library's own and not exported; see `src/field` for
|
|
14
15
|
* the same arrangement around a field.
|
|
15
16
|
*/
|
|
16
|
-
function RowContent(
|
|
17
|
+
function RowContent(t0) {
|
|
18
|
+
const $ = c(28);
|
|
19
|
+
const { children, isDisabled: t1, isSelected: t2, leading, overline, supporting, trailing, variant: t3 } = t0;
|
|
20
|
+
const isDisabled = t1 === void 0 ? false : t1;
|
|
21
|
+
const isSelected = t2 === void 0 ? false : t2;
|
|
22
|
+
const variant = t3 === void 0 ? "list" : t3;
|
|
17
23
|
const label = variant === "drawer" || variant === "menu";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
let t4;
|
|
25
|
+
if ($[0] !== isDisabled || $[1] !== isSelected || $[2] !== variant) {
|
|
26
|
+
t4 = isDisabled ? rowStyles.supportingInherit : isSelected && selectedSupportingTone(variant);
|
|
27
|
+
$[0] = isDisabled;
|
|
28
|
+
$[1] = isSelected;
|
|
29
|
+
$[2] = variant;
|
|
30
|
+
$[3] = t4;
|
|
31
|
+
} else t4 = $[3];
|
|
32
|
+
const supportingTone = t4;
|
|
33
|
+
let t5;
|
|
34
|
+
if ($[4] !== leading) {
|
|
35
|
+
t5 = leading === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
21
36
|
...props(rowStyles.slot),
|
|
22
37
|
children: leading
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
});
|
|
39
|
+
$[4] = leading;
|
|
40
|
+
$[5] = t5;
|
|
41
|
+
} else t5 = $[5];
|
|
42
|
+
let t6;
|
|
43
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
44
|
+
t6 = props(rowStyles.main);
|
|
45
|
+
$[6] = t6;
|
|
46
|
+
} else t6 = $[6];
|
|
47
|
+
let t7;
|
|
48
|
+
if ($[7] !== overline || $[8] !== supportingTone) {
|
|
49
|
+
t7 = overline === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
50
|
+
...props(rowStyles.overline, supportingTone),
|
|
51
|
+
children: overline
|
|
52
|
+
});
|
|
53
|
+
$[7] = overline;
|
|
54
|
+
$[8] = supportingTone;
|
|
55
|
+
$[9] = t7;
|
|
56
|
+
} else t7 = $[9];
|
|
57
|
+
let t8;
|
|
58
|
+
if ($[10] !== label) {
|
|
59
|
+
t8 = props(label ? rowStyles.headlineMenu : rowStyles.headlineList);
|
|
60
|
+
$[10] = label;
|
|
61
|
+
$[11] = t8;
|
|
62
|
+
} else t8 = $[11];
|
|
63
|
+
let t9;
|
|
64
|
+
if ($[12] !== children || $[13] !== t8) {
|
|
65
|
+
t9 = /* @__PURE__ */ jsx("span", {
|
|
66
|
+
...t8,
|
|
67
|
+
children
|
|
68
|
+
});
|
|
69
|
+
$[12] = children;
|
|
70
|
+
$[13] = t8;
|
|
71
|
+
$[14] = t9;
|
|
72
|
+
} else t9 = $[14];
|
|
73
|
+
let t10;
|
|
74
|
+
if ($[15] !== supporting || $[16] !== supportingTone) {
|
|
75
|
+
t10 = supporting === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
76
|
+
...props(rowStyles.supporting, supportingTone),
|
|
77
|
+
children: supporting
|
|
78
|
+
});
|
|
79
|
+
$[15] = supporting;
|
|
80
|
+
$[16] = supportingTone;
|
|
81
|
+
$[17] = t10;
|
|
82
|
+
} else t10 = $[17];
|
|
83
|
+
let t11;
|
|
84
|
+
if ($[18] !== t10 || $[19] !== t7 || $[20] !== t9) {
|
|
85
|
+
t11 = /* @__PURE__ */ jsxs("span", {
|
|
86
|
+
...t6,
|
|
26
87
|
children: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
/* @__PURE__ */ jsx("span", {
|
|
32
|
-
...props(label ? rowStyles.headlineMenu : rowStyles.headlineList),
|
|
33
|
-
children
|
|
34
|
-
}),
|
|
35
|
-
supporting === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
36
|
-
...props(rowStyles.supporting, supportingTone),
|
|
37
|
-
children: supporting
|
|
38
|
-
})
|
|
88
|
+
t7,
|
|
89
|
+
t9,
|
|
90
|
+
t10
|
|
39
91
|
]
|
|
40
|
-
})
|
|
41
|
-
|
|
92
|
+
});
|
|
93
|
+
$[18] = t10;
|
|
94
|
+
$[19] = t7;
|
|
95
|
+
$[20] = t9;
|
|
96
|
+
$[21] = t11;
|
|
97
|
+
} else t11 = $[21];
|
|
98
|
+
let t12;
|
|
99
|
+
if ($[22] !== trailing) {
|
|
100
|
+
t12 = trailing === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
42
101
|
...props(rowStyles.slot),
|
|
43
102
|
children: trailing
|
|
44
|
-
})
|
|
45
|
-
|
|
103
|
+
});
|
|
104
|
+
$[22] = trailing;
|
|
105
|
+
$[23] = t12;
|
|
106
|
+
} else t12 = $[23];
|
|
107
|
+
let t13;
|
|
108
|
+
if ($[24] !== t11 || $[25] !== t12 || $[26] !== t5) {
|
|
109
|
+
t13 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
+
t5,
|
|
111
|
+
t11,
|
|
112
|
+
t12
|
|
113
|
+
] });
|
|
114
|
+
$[24] = t11;
|
|
115
|
+
$[25] = t12;
|
|
116
|
+
$[26] = t5;
|
|
117
|
+
$[27] = t13;
|
|
118
|
+
} else t13 = $[27];
|
|
119
|
+
return t13;
|
|
46
120
|
}
|
|
47
121
|
function selectedSupportingTone(variant) {
|
|
48
122
|
if (variant === "drawer") return rowStyles.supportingSelectedDrawer;
|
package/dist/row/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/row/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { rowStyles } from './styles';\ninterface RowContentProps {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /**\n * Whether the row is disabled. The supporting line takes the row's own\n * faded colour when it is, rather than staying at full strength in the\n * muted role.\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Whether the row is selected. The supporting line takes the selected\n * container's own content role when it is, rather than staying in the\n * muted role it draws on the surface.\n * @default false\n */\n isSelected?: boolean;\n /** Content before the headline: an avatar, an icon, a checkbox. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes.\n */\n overline?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n /**\n * Which spec page's row this is. A list item's headline is body-large; a\n * menu item's label and a navigation drawer row's are label-large. The\n * element around the content applies the matching `rowStyles.list`,\n * `rowStyles.menu` or `rowStyles.drawer` beside `rowStyles.base`.\n * @default 'list'\n */\n variant?: RowVariant;\n}\ntype RowVariant = 'drawer' | 'list' | 'menu';\n\n/**\n * The inside of a row: the leading slot, the headline with its supporting\n * line, and the trailing slot, each rendered only when given. The element\n * around it is the caller's — ListItem's div or button, a collection's item —\n * and takes `rowStyles.base`, the variant's own style, and whichever states\n * apply; this is what every one of them puts inside it, so a list, a menu, a\n * tree and a drawer draw the same row.\n *\n * Not a component of the library's own and not exported; see `src/field` for\n * the same arrangement around a field.\n */\nfunction RowContent({\n children,\n isDisabled = false,\n isSelected = false,\n leading,\n overline,\n supporting,\n trailing,\n variant = 'list'\n}: RowContentProps) {\n // The drawer's label is the menu's, so the two share the headline style;\n // what they do not share is the container a selected row brings, which is\n // why the tone below still asks which variant this is.\n const label = variant === 'drawer' || variant === 'menu';\n // Disabled first: a disabled row's own colour is already the faded one, so\n // it wins over the selected container's content role.\n const supportingTone = isDisabled ? rowStyles.supportingInherit : isSelected && selectedSupportingTone(variant);\n return <>\n {leading === undefined ? null : <span {...stylex.props(rowStyles.slot)}>{leading}</span>}\n <span {...stylex.props(rowStyles.main)}>\n {overline === undefined ? null : <span {...stylex.props(rowStyles.overline, supportingTone)}>\n {overline}\n </span>}\n <span {...stylex.props(label ? rowStyles.headlineMenu : rowStyles.headlineList)}>\n {children}\n </span>\n {supporting === undefined ? null : <span {...stylex.props(rowStyles.supporting, supportingTone)}>\n {supporting}\n </span>}\n </span>\n {trailing === undefined ? null : <span {...stylex.props(rowStyles.slot)}>{trailing}</span>}\n </>;\n}\n\n// Which on-colour a supporting line takes over a selected row's own\n// container. Each variant's container is a different colour family, and the\n// muted role is not guaranteed to be readable over any of them.\nfunction selectedSupportingTone(variant: RowVariant) {\n if (variant === 'drawer') {\n return rowStyles.supportingSelectedDrawer;\n }\n if (variant === 'menu') {\n return rowStyles.supportingSelectedMenu;\n }\n return rowStyles.supportingSelectedList;\n}\nexport type { RowContentProps, RowVariant };\nexport { RowContent };"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","stylex","rowStyles","RowContentProps","children","isDisabled","isSelected","leading","overline","supporting","trailing","variant","RowVariant","RowContent","t0","$","_c","t1","t2","t3","undefined","label","t4","supportingInherit","selectedSupportingTone","supportingTone","t5","props","slot","t6","Symbol","for","main","t7","t8","headlineMenu","headlineList","t9","t10","t11","t12","t13","supportingSelectedDrawer","supportingSelectedMenu","supportingSelectedList"],"sources":["../../src/row/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { rowStyles } from './styles';\ninterface RowContentProps {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /**\n * Whether the row is disabled. The supporting line takes the row's own\n * faded colour when it is, rather than staying at full strength in the\n * muted role.\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Whether the row is selected. The supporting line takes the selected\n * container's own content role when it is, rather than staying in the\n * muted role it draws on the surface.\n * @default false\n */\n isSelected?: boolean;\n /** Content before the headline: an avatar, an icon, a checkbox. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes.\n */\n overline?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n /**\n * Which spec page's row this is. A list item's headline is body-large; a\n * menu item's label and a navigation drawer row's are label-large. The\n * element around the content applies the matching `rowStyles.list`,\n * `rowStyles.menu` or `rowStyles.drawer` beside `rowStyles.base`.\n * @default 'list'\n */\n variant?: RowVariant;\n}\ntype RowVariant = 'drawer' | 'list' | 'menu';\n\n/**\n * The inside of a row: the leading slot, the headline with its supporting\n * line, and the trailing slot, each rendered only when given. The element\n * around it is the caller's — ListItem's div or button, a collection's item —\n * and takes `rowStyles.base`, the variant's own style, and whichever states\n * apply; this is what every one of them puts inside it, so a list, a menu, a\n * tree and a drawer draw the same row.\n *\n * Not a component of the library's own and not exported; see `src/field` for\n * the same arrangement around a field.\n */\nfunction RowContent({\n children,\n isDisabled = false,\n isSelected = false,\n leading,\n overline,\n supporting,\n trailing,\n variant = 'list'\n}: RowContentProps) {\n // The drawer's label is the menu's, so the two share the headline style;\n // what they do not share is the container a selected row brings, which is\n // why the tone below still asks which variant this is.\n const label = variant === 'drawer' || variant === 'menu';\n // Disabled first: a disabled row's own colour is already the faded one, so\n // it wins over the selected container's content role.\n const supportingTone = isDisabled ? rowStyles.supportingInherit : isSelected && selectedSupportingTone(variant);\n return <>\n {leading === undefined ? null : <span {...stylex.props(rowStyles.slot)}>{leading}</span>}\n <span {...stylex.props(rowStyles.main)}>\n {overline === undefined ? null : <span {...stylex.props(rowStyles.overline, supportingTone)}>\n {overline}\n </span>}\n <span {...stylex.props(label ? rowStyles.headlineMenu : rowStyles.headlineList)}>\n {children}\n </span>\n {supporting === undefined ? null : <span {...stylex.props(rowStyles.supporting, supportingTone)}>\n {supporting}\n </span>}\n </span>\n {trailing === undefined ? null : <span {...stylex.props(rowStyles.slot)}>{trailing}</span>}\n </>;\n}\n\n// Which on-colour a supporting line takes over a selected row's own\n// container. Each variant's container is a different colour family, and the\n// muted role is not guaranteed to be readable over any of them.\nfunction selectedSupportingTone(variant: RowVariant) {\n if (variant === 'drawer') {\n return rowStyles.supportingSelectedDrawer;\n }\n if (variant === 'menu') {\n return rowStyles.supportingSelectedMenu;\n }\n return rowStyles.supportingSelectedList;\n}\nexport type { RowContentProps, RowVariant };\nexport { RowContent };"],"mappings":";;;;;;;;;;;;;;;;AAqDA,SAAAa,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAAZ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A0B;CAAA,IAAA1B,EAAA,QAAAwB,OAAAxB,EAAA,QAAAyB,OAAAzB,EAAA,QAAAW,IAAA;EAbvFe,MAAA,qBAAA,UAAA,EAAA,UAAA;GACFf;GACDa;GAWCC;EAAyF,EAAA,CAAA;EACzFzB,EAAA,MAAAwB;EAAAxB,EAAA,MAAAyB;EAAAzB,EAAA,MAAAW;EAAAX,EAAA,MAAA0B;CAAA,OAAAA,MAAA1B,EAAA;CAAA,OAdE0B;AAcF;AAMP,SAASjB,uBAAuBb,SAAqB;CACnD,IAAIA,YAAY,UACd,OAAOT,UAAUwC;CAEnB,IAAI/B,YAAY,QACd,OAAOT,UAAUyC;CAEnB,OAAOzC,UAAU0C;AACnB"}
|
package/dist/row/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":[],"sources":["../../src/row/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The row every list draws: ListItem's, and from here on the item of every\n// collection the coverage plan adds — ListBox, Menu, List, Tree, the options\n// of Select and ComboBox. Apart from the RowContent component in ./index.tsx\n// so that file exports components alone, which is what keeps fast refresh\n// working for it.\n//\n// Three variants, because three spec pages draw three rows. The lists page\n// gives a list item a 56dp floor, a body-large headline and a body-medium\n// supporting line, and primary container when selected. The menus page gives\n// a menu item 48dp, a label-large label, and tertiary container when\n// selected. The navigation drawer page gives its row 56dp too, with a\n// label-large label like a menu's, and marks the current one with a\n// secondary-container pill held 12dp off each edge — 336dp of indicator in a\n// 360dp container, which is what that inset comes to. The layout, the\n// padding, the state layers and the disabled treatment are one row; `list`,\n// `menu` and `drawer` carry only what the three pages disagree on, and a\n// consumer applies one of them beside `base`.\n//\n// Laid out with flex rather than the grid the design draws. The design's\n// three columns are `auto 1fr auto`, which is what flex does natively — and\n// unlike a fixed three-column grid it stays correct when a row has no leading\n// or no trailing content, where the remaining children would otherwise slide\n// into the wrong columns.\n//\n// Rows align with each other through their leading content being the same\n// size, not through a fixed column width: a list of Avatars all at one size\n// lines up, and that is the same thing the design's 40px column achieves.\n//\n// The state layer composites over `transparent` rather than over a container\n// colour, because a row's own background is transparent and it therefore\n// tints whatever it happens to be sitting on — a card, a menu, or the page.\n// The two selected states are the ones that bring a container of their own.\nconst rowStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"xxj4525\",\n kzqmXN: \"xh8yej3\",\n k8WAf4: \"x1uvvd8r\",\n kg3NbH: \"x790zyz\",\n kVAEAm: \"x1n2onr6\",\n k9WMMc: \"x1yc453h\",\n $$css: true\n },\n disabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n drawer: {\n kaIpWk: \"x3y1ksm\",\n kzqmXN: \"x14atkfc\",\n kUOVxO: \"xd2r6sq\",\n kAzted: \"xbktkl8\",\n $$css: true\n },\n headlineList: {\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n $$css: true\n },\n headlineMenu: {\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n $$css: true\n },\n interactive: {\n kWkggS: \"x83qkoq x1p2om7n xjbqb8w\",\n kkrTdU: \"x1ypdohk\",\n kVVagm: \"xln7xf2\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x2ssjo2\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n list: {\n kAzted: \"xbktkl8\",\n $$css: true\n },\n main: {\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kOIVth: \"x14qo01y\",\n k7Eaqz: \"xeuugli\",\n $$css: true\n },\n menu: {\n kAzted: \"x1wxaq2x\",\n $$css: true\n },\n overline: {\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xs1w0rn\",\n kGuDYH: \"x1n35her\",\n k63SB2: \"x1su64ma\",\n kb6lSQ: \"xdlnduh\",\n kLWn49: \"xaomhve\",\n $$css: true\n },\n selectedDrawer: {\n kWkggS: \"xnqsvhv xlizrex x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n selectedList: {\n kWkggS: \"xxwd9aw x1hei0q8 xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n selectedMenu: {\n kWkggS: \"xoc6x28 x2p4cas xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n },\n slot: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n $$css: true\n },\n supporting: {\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xpo2rfv\",\n kGuDYH: \"x193rfdd\",\n k63SB2: \"x1hews6w\",\n kb6lSQ: \"xn43zvd\",\n kLWn49: \"xv61bfh\",\n $$css: true\n },\n supportingInherit: {\n kMwMTN: \"x1heor9g\",\n $$css: true\n },\n supportingSelectedDrawer: {\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n supportingSelectedList: {\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n supportingSelectedMenu: {\n kMwMTN: \"x3cbcwg\",\n $$css: true\n },\n threeLine: {\n kGNEyG: \"x1cy8zhl\",\n kAzted: \"xefclja\",\n $$css: true\n },\n twoLine: {\n kAzted: \"x1qafhyn\",\n $$css: true\n }\n};\nexport { rowStyles };"],"mappings":";AAoCA,
|
|
1
|
+
{"version":3,"file":"styles.js","names":["stylex","colors","radii","spacing","stateLayerOpacity","typography","rowStyles","base","kGNEyG","kWkggS","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kOIVth","kzqmXN","k8WAf4","kg3NbH","kVAEAm","k9WMMc","$$css","disabled","kkrTdU","drawer","kaIpWk","kUOVxO","kAzted","headlineList","kMv6JI","kGuDYH","k63SB2","kb6lSQ","kLWn49","headlineMenu","interactive","kVVagm","kjBf7l","kInvED","k3XXqK","kMeerF","list","main","kXwgrk","kzQI83","k7Eaqz","menu","overline","selectedDrawer","selectedList","selectedMenu","slot","kmuXW","supporting","supportingInherit","supportingSelectedDrawer","supportingSelectedList","supportingSelectedMenu","threeLine","twoLine"],"sources":["../../src/row/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The row every list draws: ListItem's, and from here on the item of every\n// collection the coverage plan adds — ListBox, Menu, List, Tree, the options\n// of Select and ComboBox. Apart from the RowContent component in ./index.tsx\n// so that file exports components alone, which is what keeps fast refresh\n// working for it.\n//\n// Three variants, because three spec pages draw three rows. The lists page\n// gives a list item a 56dp floor, a body-large headline and a body-medium\n// supporting line, and primary container when selected. The menus page gives\n// a menu item 48dp, a label-large label, and tertiary container when\n// selected. The navigation drawer page gives its row 56dp too, with a\n// label-large label like a menu's, and marks the current one with a\n// secondary-container pill held 12dp off each edge — 336dp of indicator in a\n// 360dp container, which is what that inset comes to. The layout, the\n// padding, the state layers and the disabled treatment are one row; `list`,\n// `menu` and `drawer` carry only what the three pages disagree on, and a\n// consumer applies one of them beside `base`.\n//\n// Laid out with flex rather than the grid the design draws. The design's\n// three columns are `auto 1fr auto`, which is what flex does natively — and\n// unlike a fixed three-column grid it stays correct when a row has no leading\n// or no trailing content, where the remaining children would otherwise slide\n// into the wrong columns.\n//\n// Rows align with each other through their leading content being the same\n// size, not through a fixed column width: a list of Avatars all at one size\n// lines up, and that is the same thing the design's 40px column achieves.\n//\n// The state layer composites over `transparent` rather than over a container\n// colour, because a row's own background is transparent and it therefore\n// tints whatever it happens to be sitting on — a card, a menu, or the page.\n// The two selected states are the ones that bring a container of their own.\nconst rowStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"xxj4525\",\n kzqmXN: \"xh8yej3\",\n k8WAf4: \"x1uvvd8r\",\n kg3NbH: \"x790zyz\",\n kVAEAm: \"x1n2onr6\",\n k9WMMc: \"x1yc453h\",\n $$css: true\n },\n disabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n drawer: {\n kaIpWk: \"x3y1ksm\",\n kzqmXN: \"x14atkfc\",\n kUOVxO: \"xd2r6sq\",\n kAzted: \"xbktkl8\",\n $$css: true\n },\n headlineList: {\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n $$css: true\n },\n headlineMenu: {\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n $$css: true\n },\n interactive: {\n kWkggS: \"x83qkoq x1p2om7n xjbqb8w\",\n kkrTdU: \"x1ypdohk\",\n kVVagm: \"xln7xf2\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x2ssjo2\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n list: {\n kAzted: \"xbktkl8\",\n $$css: true\n },\n main: {\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kOIVth: \"x14qo01y\",\n k7Eaqz: \"xeuugli\",\n $$css: true\n },\n menu: {\n kAzted: \"x1wxaq2x\",\n $$css: true\n },\n overline: {\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xs1w0rn\",\n kGuDYH: \"x1n35her\",\n k63SB2: \"x1su64ma\",\n kb6lSQ: \"xdlnduh\",\n kLWn49: \"xaomhve\",\n $$css: true\n },\n selectedDrawer: {\n kWkggS: \"xnqsvhv xlizrex x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n selectedList: {\n kWkggS: \"xxwd9aw x1hei0q8 xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n selectedMenu: {\n kWkggS: \"xoc6x28 x2p4cas xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n },\n slot: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n $$css: true\n },\n supporting: {\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xpo2rfv\",\n kGuDYH: \"x193rfdd\",\n k63SB2: \"x1hews6w\",\n kb6lSQ: \"xn43zvd\",\n kLWn49: \"xv61bfh\",\n $$css: true\n },\n supportingInherit: {\n kMwMTN: \"x1heor9g\",\n $$css: true\n },\n supportingSelectedDrawer: {\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n supportingSelectedList: {\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n supportingSelectedMenu: {\n kMwMTN: \"x3cbcwg\",\n $$css: true\n },\n threeLine: {\n kGNEyG: \"x1cy8zhl\",\n kAzted: \"xefclja\",\n $$css: true\n },\n twoLine: {\n kAzted: \"x1qafhyn\",\n $$css: true\n }\n};\nexport { rowStyles };"],"mappings":";AAoCA,MAAMM,YAAY;CAChBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;E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QAAQ;EACRQ,OAAO;CACT;CACAkC,0BAA0B;EACxB1C,QAAQ;EACRQ,OAAO;CACT;CACAmC,wBAAwB;EACtB3C,QAAQ;EACRQ,OAAO;CACT;CACAoC,wBAAwB;EACtB5C,QAAQ;EACRQ,OAAO;CACT;CACAqC,WAAW;EACTjD,QAAQ;EACRkB,QAAQ;EACRN,OAAO;CACT;CACAsC,SAAS;EACPhC,QAAQ;EACRN,OAAO;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/segments/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { DateInput as RACDateInput, DateSegment as RACDateSegment } from 'react-aria-components';\nimport { segmentStyles } from './styles';\n\n// How a date or a time is drawn once React Aria has decided what its parts\n// are. Shared by DateField and TimeField, which differ only in the value they\n// hold: the segments, their order and their number all come from React Aria,\n// so what is here is the same for both.\n\n// What React Aria hands the input for each part of the date. Taken off the\n// component rather than imported, since the segment type is not on the\n// package's public surface.\ntype Segment = Parameters<NonNullable<Parameters<typeof RACDateInput>[0]['children']>>[0];\n\n// What each segment draws. A literal — the slash or colon between two\n// segments — takes a style of its own, since it is punctuation rather than\n// something a reader types into.\nfunction renderSegment(segment: Segment): ReactElement {\n if (segment.type === 'literal') {\n return <RACDateSegment {...stylex.props(segmentStyles.segment, segmentStyles.segmentLiteral)} segment={segment} />;\n }\n return <RACDateSegment className={segmentClassName} segment={segment} />;\n}\n\n// A segment's classes, from React Aria's render state. StyleX cannot target\n// `[data-placeholder]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order matters: `disabled` is last, and StyleX replaces a property\n// whole, so it wins over both the placeholder and the focused branches.\nfunction segmentClassName(state: {\n isDisabled: boolean;\n isFocused: boolean;\n isPlaceholder: boolean;\n}) {\n return stylex.props(segmentStyles.segment, state.isPlaceholder && segmentStyles.segmentPlaceholder, state.isFocused && segmentStyles.segmentFocused, state.isDisabled && segmentStyles.segmentDisabled).className ?? '';\n}\nexport { renderSegment };"],"mappings":";;;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactElement","stylex","DateInput","RACDateInput","DateSegment","RACDateSegment","segmentStyles","Segment","Parameters","NonNullable","renderSegment","segment","type","props","segmentLiteral","segmentClassName","state","isDisabled","isFocused","isPlaceholder","segmentPlaceholder","segmentFocused","segmentDisabled","className"],"sources":["../../src/segments/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { DateInput as RACDateInput, DateSegment as RACDateSegment } from 'react-aria-components';\nimport { segmentStyles } from './styles';\n\n// How a date or a time is drawn once React Aria has decided what its parts\n// are. Shared by DateField and TimeField, which differ only in the value they\n// hold: the segments, their order and their number all come from React Aria,\n// so what is here is the same for both.\n\n// What React Aria hands the input for each part of the date. Taken off the\n// component rather than imported, since the segment type is not on the\n// package's public surface.\ntype Segment = Parameters<NonNullable<Parameters<typeof RACDateInput>[0]['children']>>[0];\n\n// What each segment draws. A literal — the slash or colon between two\n// segments — takes a style of its own, since it is punctuation rather than\n// something a reader types into.\nfunction renderSegment(segment: Segment): ReactElement {\n if (segment.type === 'literal') {\n return <RACDateSegment {...stylex.props(segmentStyles.segment, segmentStyles.segmentLiteral)} segment={segment} />;\n }\n return <RACDateSegment className={segmentClassName} segment={segment} />;\n}\n\n// A segment's classes, from React Aria's render state. StyleX cannot target\n// `[data-placeholder]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order matters: `disabled` is last, and StyleX replaces a property\n// whole, so it wins over both the placeholder and the focused branches.\nfunction segmentClassName(state: {\n isDisabled: boolean;\n isFocused: boolean;\n isPlaceholder: boolean;\n}) {\n return stylex.props(segmentStyles.segment, state.isPlaceholder && segmentStyles.segmentPlaceholder, state.isFocused && segmentStyles.segmentFocused, state.isDisabled && segmentStyles.segmentDisabled).className ?? '';\n}\nexport { renderSegment };"],"mappings":";;;;;AAkBA,SAASU,cAAcC,SAAgC;CACrD,IAAIA,QAAQC,SAAS,WACnB,OAAO,oBAAC,aAAD;EAAgB,GAAIX,MAAaK,cAAcK,SAASL,cAAcQ,cAAc;EAAYH;CAAQ,CAAA;CAEjH,OAAO,oBAAC,aAAD;EAAgB,WAAWI;EAA2BJ;CAAQ,CAAA;AACvE;AAQA,SAASI,iBAAiBC,OAIvB;CACD,OAAOf,MAAaK,cAAcK,SAASK,MAAMG,iBAAiBb,cAAcc,oBAAoBJ,MAAME,aAAaZ,cAAce,gBAAgBL,MAAMC,cAAcX,cAAcgB,eAAe,CAAC,CAACC,aAAa;AACvN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":[],"sources":["../../src/segments/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity } from '../tokens/design.tokens.stylex';\n\n// The segments a date or a time is typed into, shared by DateField and\n// TimeField. Apart from either component so the two cannot drift, and outside\n// `src/components` because a directory there is a public component with\n// stories, a barrel entry and a `styling.test.tsx` case — which shared styles\n// are none of.\n\nconst segmentStyles = {\n input: {\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n k3XXqK: \"x1t137rt\",\n $$css: true\n },\n segment: {\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n knGrYV: \"xbuiw85\",\n kMwMTN: \"x139gbkf\",\n k3XXqK: \"x1t137rt\",\n kg3NbH: \"xdomwbk\",\n k9WMMc: \"xp4054r\",\n $$css: true\n },\n segmentDisabled: {\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n segmentFocused: {\n kWkggS: \"xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n segmentLiteral: {\n kMwMTN: \"x1w5n3ug\",\n kg3NbH: \"xnjsko4\",\n $$css: true\n },\n segmentPlaceholder: {\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\nexport { segmentStyles };"],"mappings":";AAUA,
|
|
1
|
+
{"version":3,"file":"styles.js","names":["stylex","colors","radii","spacing","stateLayerOpacity","segmentStyles","input","kGNEyG","kB7OPa","k1xSpc","k3XXqK","$$css","segment","kaIpWk","knGrYV","kMwMTN","kg3NbH","k9WMMc","segmentDisabled","segmentFocused","kWkggS","segmentLiteral","segmentPlaceholder"],"sources":["../../src/segments/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity } from '../tokens/design.tokens.stylex';\n\n// The segments a date or a time is typed into, shared by DateField and\n// TimeField. Apart from either component so the two cannot drift, and outside\n// `src/components` because a directory there is a public component with\n// stories, a barrel entry and a `styling.test.tsx` case — which shared styles\n// are none of.\n\nconst segmentStyles = {\n input: {\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n k3XXqK: \"x1t137rt\",\n $$css: true\n },\n segment: {\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n knGrYV: \"xbuiw85\",\n kMwMTN: \"x139gbkf\",\n k3XXqK: \"x1t137rt\",\n kg3NbH: \"xdomwbk\",\n k9WMMc: \"xp4054r\",\n $$css: true\n },\n segmentDisabled: {\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n segmentFocused: {\n kWkggS: \"xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n segmentLiteral: {\n kMwMTN: \"x1w5n3ug\",\n kg3NbH: \"xnjsko4\",\n $$css: true\n },\n segmentPlaceholder: {\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\nexport { segmentStyles };"],"mappings":";AAUA,MAAMK,gBAAgB;CACpBC,OAAO;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,SAAS;EACPC,QAAQ;EACRL,QAAQ;EACRM,QAAQ;EACRC,QAAQ;EACRL,QAAQ;EACRM,QAAQ;EACRC,QAAQ;EACRN,OAAO;CACT;CACAO,iBAAiB;EACfH,QAAQ;EACRJ,OAAO;CACT;CACAQ,gBAAgB;EACdC,QAAQ;EACRL,QAAQ;EACRJ,OAAO;CACT;CACAU,gBAAgB;EACdN,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAW,oBAAoB;EAClBP,QAAQ;EACRJ,OAAO;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chequer.js","names":[],"sources":["../../src/styles/chequer.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors } from '../tokens/design.tokens.stylex';\n\n// The chequer a transparent colour is drawn against. A half-transparent red\n// over a light surface and an opaque pink are the same pixels; this is what\n// tells them apart, behind a swatch and behind a colour slider's alpha\n// track.\n//\n// In `src/styles` rather than either component, since both draw it and a\n// second copy would be a second density to keep in step.\n//\n// Two things about the recipe are worth knowing before touching it.\n//\n// **The offsets are half a tile, not a whole one.** Four gradients draw the\n// two dark squares of a tile, and at a whole tile all four line up — the\n// pattern comes out as diamonds, which reads as a texture rather than as\n// the absence of a colour.\n//\n// **It is a layer behind, never a background on the coloured element.**\n// React Aria writes a swatch's colour to its own inline `background-color`\n// and a colour track's gradient to its inline `background`, and CSS paints a\n// background image over a background colour rather than under it — so a\n// chequer on that element would cover what it is there to reveal.\n\n// 8px squares, which reads as a chequer at a swatch's size without turning\n// into a texture.\nconst TILE = '16px';\nconst HALF = '8px';\nconst GRADIENTS = `linear-gradient(45deg, ${colors.surfaceContainerHighest} 25%, transparent 25%),\nlinear-gradient(-45deg, ${colors.surfaceContainerHighest} 25%, transparent 25%),\nlinear-gradient(45deg, transparent 75%, ${colors.surfaceContainerHighest} 75%),\nlinear-gradient(-45deg, transparent 75%, ${colors.surfaceContainerHighest} 75%)`;\nconst chequer = {\n ground: {\n kWkggS: \"x14q8lhr\",\n kKwaWg: \"x12it5ax\",\n k1YJky: \"x1wlk0ns\",\n kgSjnq: \"x1ht9rhz\",\n $$css: true\n }\n};\nexport { chequer };"],"mappings":";;AA6BkB,
|
|
1
|
+
{"version":3,"file":"chequer.js","names":["stylex","colors","TILE","HALF","GRADIENTS","surfaceContainerHighest","chequer","ground","kWkggS","kKwaWg","k1YJky","kgSjnq","$$css"],"sources":["../../src/styles/chequer.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors } from '../tokens/design.tokens.stylex';\n\n// The chequer a transparent colour is drawn against. A half-transparent red\n// over a light surface and an opaque pink are the same pixels; this is what\n// tells them apart, behind a swatch and behind a colour slider's alpha\n// track.\n//\n// In `src/styles` rather than either component, since both draw it and a\n// second copy would be a second density to keep in step.\n//\n// Two things about the recipe are worth knowing before touching it.\n//\n// **The offsets are half a tile, not a whole one.** Four gradients draw the\n// two dark squares of a tile, and at a whole tile all four line up — the\n// pattern comes out as diamonds, which reads as a texture rather than as\n// the absence of a colour.\n//\n// **It is a layer behind, never a background on the coloured element.**\n// React Aria writes a swatch's colour to its own inline `background-color`\n// and a colour track's gradient to its inline `background`, and CSS paints a\n// background image over a background colour rather than under it — so a\n// chequer on that element would cover what it is there to reveal.\n\n// 8px squares, which reads as a chequer at a swatch's size without turning\n// into a texture.\nconst TILE = '16px';\nconst HALF = '8px';\nconst GRADIENTS = `linear-gradient(45deg, ${colors.surfaceContainerHighest} 25%, transparent 25%),\nlinear-gradient(-45deg, ${colors.surfaceContainerHighest} 25%, transparent 25%),\nlinear-gradient(45deg, transparent 75%, ${colors.surfaceContainerHighest} 75%),\nlinear-gradient(-45deg, transparent 75%, ${colors.surfaceContainerHighest} 75%)`;\nconst chequer = {\n ground: {\n kWkggS: \"x14q8lhr\",\n kKwaWg: \"x12it5ax\",\n k1YJky: \"x1wlk0ns\",\n kgSjnq: \"x1ht9rhz\",\n $$css: true\n }\n};\nexport { chequer };"],"mappings":";;AA6BkB,GAA0BC,OAAOI,0BACzBJ,OAAOI,0BACSJ,OAAOI,0BACNJ,OAAOI;AAClD,MAAMC,UAAU,EACdC,QAAQ;CACNC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF"}
|
package/dist/styles/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","names":[],"sources":["../../src/styles/color.ts"],"sourcesContent":["import type { ColorThumbRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows } from '../tokens/design.tokens.stylex';\n\n// The handle a colour slider and a colour area share. React Aria places it —\n// along one axis on a slider, along two in an area — and fills it with the\n// colour at that point, so everything here is the ring around that fill.\n//\n// In `src/styles` rather than a directory of its own, since it is a style\n// more than one component draws, which is what that directory holds.\n//\n// Two things about it are worth knowing.\n//\n// **It is ringed rather than filled, because its fill is the value.** The\n// ring is what has to read — against every colour the track or the plane\n// runs through — so it is a surface-coloured ring with a hairline outside\n// it, which works on a light ground and a dark one alike.\n//\n// **`dragging` is applied after `focused`.** StyleX replaces a property\n// whole, so a handle being dragged takes the lifted shadow rather than\n// keeping the resting ring under it.\n\nconst colorThumb = {\n thumb: {\n kZKoxP: \"x1qx5ct2\",\n kaIpWk: \"x3y1ksm\",\n kGVxlE: \"xlzcsym\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1jm3nie\",\n kzqmXN: \"xw4jnvo\",\n k87sOh: \"xwa60dl\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x2wh2y9\",\n k3XXqK: \"x1t137rt\",\n kMeerF: \"x1de99jn\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xkdsq27\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n thumbDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n thumbDragging: {\n kGVxlE: \"x1kr41ut\",\n kkrTdU: \"xi9pz9s\",\n $$css: true\n },\n thumbFocused: {\n k3XXqK: \"xaatb59\",\n $$css: true\n }\n};\n\n// The handle's classes, from React Aria's render state. StyleX cannot target\n// `[data-dragging]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\nfunction thumbClassName(state: ColorThumbRenderProps) {\n return {\n 0: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 x1jm3nie xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7\"\n },\n 4: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 x1jm3nie xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59\"\n },\n 2: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7 x1kr41ut xi9pz9s\"\n },\n 6: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59 x1kr41ut xi9pz9s\"\n },\n 1: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7 x1h6gzvc\"\n },\n 5: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59 x1h6gzvc\"\n },\n 3: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7 x1kr41ut x1h6gzvc\"\n },\n 7: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59 x1kr41ut x1h6gzvc\"\n }\n }[!!state.isFocusVisible << 2 | !!state.isDragging << 1 | !!state.isDisabled << 0].className ?? '';\n}\nexport { colorThumb, thumbClassName };"],"mappings":";AA2DA,
|
|
1
|
+
{"version":3,"file":"color.js","names":["ColorThumbRenderProps","stylex","colors","motion","radii","shadows","colorThumb","thumb","kZKoxP","kaIpWk","kGVxlE","kB7OPa","kkrTdU","kzqmXN","k87sOh","kjBf7l","kInvED","k3XXqK","kMeerF","kIyJzY","k1ekBW","kAMwcw","$$css","thumbDisabled","thumbDragging","thumbFocused","thumbClassName","state","className","isFocusVisible","isDragging","isDisabled"],"sources":["../../src/styles/color.ts"],"sourcesContent":["import type { ColorThumbRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows } from '../tokens/design.tokens.stylex';\n\n// The handle a colour slider and a colour area share. React Aria places it —\n// along one axis on a slider, along two in an area — and fills it with the\n// colour at that point, so everything here is the ring around that fill.\n//\n// In `src/styles` rather than a directory of its own, since it is a style\n// more than one component draws, which is what that directory holds.\n//\n// Two things about it are worth knowing.\n//\n// **It is ringed rather than filled, because its fill is the value.** The\n// ring is what has to read — against every colour the track or the plane\n// runs through — so it is a surface-coloured ring with a hairline outside\n// it, which works on a light ground and a dark one alike.\n//\n// **`dragging` is applied after `focused`.** StyleX replaces a property\n// whole, so a handle being dragged takes the lifted shadow rather than\n// keeping the resting ring under it.\n\nconst colorThumb = {\n thumb: {\n kZKoxP: \"x1qx5ct2\",\n kaIpWk: \"x3y1ksm\",\n kGVxlE: \"xlzcsym\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1jm3nie\",\n kzqmXN: \"xw4jnvo\",\n k87sOh: \"xwa60dl\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x2wh2y9\",\n k3XXqK: \"x1t137rt\",\n kMeerF: \"x1de99jn\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xkdsq27\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n thumbDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n thumbDragging: {\n kGVxlE: \"x1kr41ut\",\n kkrTdU: \"xi9pz9s\",\n $$css: true\n },\n thumbFocused: {\n k3XXqK: \"xaatb59\",\n $$css: true\n }\n};\n\n// The handle's classes, from React Aria's render state. StyleX cannot target\n// `[data-dragging]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\nfunction thumbClassName(state: ColorThumbRenderProps) {\n return {\n 0: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 x1jm3nie xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7\"\n },\n 4: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 x1jm3nie xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59\"\n },\n 2: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7 x1kr41ut xi9pz9s\"\n },\n 6: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59 x1kr41ut xi9pz9s\"\n },\n 1: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7 x1h6gzvc\"\n },\n 5: {\n className: \"x1qx5ct2 x3y1ksm xlzcsym x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59 x1h6gzvc\"\n },\n 3: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1t137rt x1de99jn x1qno0dh xkdsq27 xpc4ca7 x1kr41ut x1h6gzvc\"\n },\n 7: {\n className: \"x1qx5ct2 x3y1ksm x9f619 xw4jnvo xwa60dl xrgy624 x2wh2y9 x1de99jn x1qno0dh xkdsq27 xpc4ca7 xaatb59 x1kr41ut x1h6gzvc\"\n }\n }[!!state.isFocusVisible << 2 | !!state.isDragging << 1 | !!state.isDisabled << 0].className ?? '';\n}\nexport { colorThumb, thumbClassName };"],"mappings":";AA2DA,SAAS0B,eAAeC,OAA8B;CACpD,OAAO;EACL,GAAG,EACDC,WAAW,sHACb;EACA,GAAG,EACDA,WAAW,qHACb;EACA,GAAG,EACDA,WAAW,sHACb;EACA,GAAG,EACDA,WAAW,qHACb;EACA,GAAG,EACDA,WAAW,sHACb;EACA,GAAG,EACDA,WAAW,qHACb;EACA,GAAG,EACDA,WAAW,uHACb;EACA,GAAG,EACDA,WAAW,sHACb;CACF,EAAE,CAAC,CAACD,MAAME,kBAAkB,IAAI,CAAC,CAACF,MAAMG,cAAc,IAAI,CAAC,CAACH,MAAMI,cAAc,EAAE,CAACH,aAAa;AAClG"}
|
package/dist/styles/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","names":[],"sources":["../../src/styles/merge.ts"],"sourcesContent":["import type * as stylex from '@stylexjs/stylex';\nimport type { CSSProperties } from 'react';\n\n// What `stylex.props()` hands back: a className, and a `style` object only\n// when a dynamic style contributed one — Feed's cell minimum, for instance,\n// arrives as a custom property there rather than as a class.\ntype CompiledStyles = ReturnType<typeof stylex.props>;\n\n// React Aria lets `className` and `style` be functions of a component's own\n// render state, which is how a style can depend on something CSS cannot\n// select — Chip's selected state, a tab's active one. A consumer may pass\n// either form, so anything merging with one has to accept both.\ntype StatefulClassName<State> = ((state: State) => string | undefined) | string | undefined;\ntype StatefulStyle<State> = ((state: State) => CSSProperties | undefined) | CSSProperties | undefined;\nfunction joinClassNames(...names: ReadonlyArray<string | undefined>) {\n // undefined rather than '' when there is nothing to say, so an element with\n // no classes on either side renders without a class attribute at all.\n return names.filter(Boolean).join(' ') || undefined;\n}\n\n/**\n * {@link mergeStyles} for an element rendered by a behaviour-library\n * component, where `className` and `style` may each be a function of the\n * component's render state rather than a plain value.\n *\n * Returns functions unconditionally, since the libraries accept them\n * everywhere they accept the plain form and one shape is easier to follow\n * than a union that changes with the arguments. `compiled` is itself a\n * function where the component's own styles depend on that state.\n *\n * The two consumer functions carry their own state types rather than sharing\n * `State`: React Aria hands a `className` function the render state plus\n * `defaultClassName`, and a `style` function the same state plus\n * `defaultStyle`, and one parameter could not name both. Each extends\n * `State`, so `compiled` can be handed either.\n */\nfunction mergeStatefulStyles<State, ClassNameState extends State, StyleState extends State>(compiled: ((state: State) => CompiledStyles) | CompiledStyles, consumer: {\n className?: StatefulClassName<ClassNameState>;\n style?: StatefulStyle<StyleState>;\n}) {\n const compiledFor = (state: State) => typeof compiled === 'function' ? compiled(state) : compiled;\n\n // Resolved inline rather than through one shared helper: a generic one\n // cannot narrow `typeof value === 'function'` away from its own type\n // parameter, so it needs an assertion where these two need none.\n //\n // '' rather than undefined when there is nothing to say: a className\n // function has to return a string for React Aria, and every component that\n // reaches here has compiled classes of its own, so the case never renders.\n return {\n className: (state: ClassNameState) => joinClassNames(compiledFor(state).className, typeof consumer.className === 'function' ? consumer.className(state) : consumer.className) ?? '',\n style: (state: StyleState) => mergeStyleObjects(compiledFor(state).style, typeof consumer.style === 'function' ? consumer.style(state) : consumer.style)\n };\n}\nfunction mergeStyleObjects(compiled: CompiledStyles['style'], consumer: CSSProperties | undefined) {\n if (compiled === undefined && consumer === undefined) {\n return undefined;\n }\n return {\n ...compiled,\n ...consumer\n };\n}\n\n/**\n * Combines the styles StyleX compiled for a component with the `className`\n * and `style` its call site passed, so both reach the element.\n *\n * Spreading `stylex.props()` after the consumer's own props is what this\n * replaces, and that spread silently dropped both: the returned object always\n * carries `className`, so it overwrote rather than merged, leaving no way to\n * position a component from outside it and no warning that the prop had gone.\n *\n * Order is presentational rather than load-bearing. StyleX compiles into\n * `@layer` (see `useCSSLayers` in tsdown.config.ts) and a consumer's own\n * stylesheet is unlayered, so the cascade already gives the call site the\n * last word whichever way round the two class strings are written.\n *\n * The call site's `style` is applied over the compiled one, which is the\n * order that matters: both are inline, so nothing but source order separates\n * them.\n */\nfunction mergeStyles(compiled: CompiledStyles, consumer: {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n}) {\n return {\n ...compiled,\n className: joinClassNames(compiled.className, consumer.className),\n style: mergeStyleObjects(compiled.style, consumer.style)\n };\n}\nexport { mergeStatefulStyles, mergeStyles };"],"mappings":";AAcA,
|
|
1
|
+
{"version":3,"file":"merge.js","names":["stylex","CSSProperties","CompiledStyles","ReturnType","props","StatefulClassName","state","State","StatefulStyle","joinClassNames","names","ReadonlyArray","filter","Boolean","join","undefined","mergeStatefulStyles","compiled","consumer","className","ClassNameState","style","StyleState","compiledFor","mergeStyleObjects","mergeStyles"],"sources":["../../src/styles/merge.ts"],"sourcesContent":["import type * as stylex from '@stylexjs/stylex';\nimport type { CSSProperties } from 'react';\n\n// What `stylex.props()` hands back: a className, and a `style` object only\n// when a dynamic style contributed one — Feed's cell minimum, for instance,\n// arrives as a custom property there rather than as a class.\ntype CompiledStyles = ReturnType<typeof stylex.props>;\n\n// React Aria lets `className` and `style` be functions of a component's own\n// render state, which is how a style can depend on something CSS cannot\n// select — Chip's selected state, a tab's active one. A consumer may pass\n// either form, so anything merging with one has to accept both.\ntype StatefulClassName<State> = ((state: State) => string | undefined) | string | undefined;\ntype StatefulStyle<State> = ((state: State) => CSSProperties | undefined) | CSSProperties | undefined;\nfunction joinClassNames(...names: ReadonlyArray<string | undefined>) {\n // undefined rather than '' when there is nothing to say, so an element with\n // no classes on either side renders without a class attribute at all.\n return names.filter(Boolean).join(' ') || undefined;\n}\n\n/**\n * {@link mergeStyles} for an element rendered by a behaviour-library\n * component, where `className` and `style` may each be a function of the\n * component's render state rather than a plain value.\n *\n * Returns functions unconditionally, since the libraries accept them\n * everywhere they accept the plain form and one shape is easier to follow\n * than a union that changes with the arguments. `compiled` is itself a\n * function where the component's own styles depend on that state.\n *\n * The two consumer functions carry their own state types rather than sharing\n * `State`: React Aria hands a `className` function the render state plus\n * `defaultClassName`, and a `style` function the same state plus\n * `defaultStyle`, and one parameter could not name both. Each extends\n * `State`, so `compiled` can be handed either.\n */\nfunction mergeStatefulStyles<State, ClassNameState extends State, StyleState extends State>(compiled: ((state: State) => CompiledStyles) | CompiledStyles, consumer: {\n className?: StatefulClassName<ClassNameState>;\n style?: StatefulStyle<StyleState>;\n}) {\n const compiledFor = (state: State) => typeof compiled === 'function' ? compiled(state) : compiled;\n\n // Resolved inline rather than through one shared helper: a generic one\n // cannot narrow `typeof value === 'function'` away from its own type\n // parameter, so it needs an assertion where these two need none.\n //\n // '' rather than undefined when there is nothing to say: a className\n // function has to return a string for React Aria, and every component that\n // reaches here has compiled classes of its own, so the case never renders.\n return {\n className: (state: ClassNameState) => joinClassNames(compiledFor(state).className, typeof consumer.className === 'function' ? consumer.className(state) : consumer.className) ?? '',\n style: (state: StyleState) => mergeStyleObjects(compiledFor(state).style, typeof consumer.style === 'function' ? consumer.style(state) : consumer.style)\n };\n}\nfunction mergeStyleObjects(compiled: CompiledStyles['style'], consumer: CSSProperties | undefined) {\n if (compiled === undefined && consumer === undefined) {\n return undefined;\n }\n return {\n ...compiled,\n ...consumer\n };\n}\n\n/**\n * Combines the styles StyleX compiled for a component with the `className`\n * and `style` its call site passed, so both reach the element.\n *\n * Spreading `stylex.props()` after the consumer's own props is what this\n * replaces, and that spread silently dropped both: the returned object always\n * carries `className`, so it overwrote rather than merged, leaving no way to\n * position a component from outside it and no warning that the prop had gone.\n *\n * Order is presentational rather than load-bearing. StyleX compiles into\n * `@layer` (see `useCSSLayers` in tsdown.config.ts) and a consumer's own\n * stylesheet is unlayered, so the cascade already gives the call site the\n * last word whichever way round the two class strings are written.\n *\n * The call site's `style` is applied over the compiled one, which is the\n * order that matters: both are inline, so nothing but source order separates\n * them.\n */\nfunction mergeStyles(compiled: CompiledStyles, consumer: {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n}) {\n return {\n ...compiled,\n className: joinClassNames(compiled.className, consumer.className),\n style: mergeStyleObjects(compiled.style, consumer.style)\n };\n}\nexport { mergeStatefulStyles, mergeStyles };"],"mappings":";AAcA,SAASS,eAAe,GAAGC,OAA0C;CAGnE,OAAOA,MAAME,OAAOC,OAAO,CAAC,CAACC,KAAK,GAAG,KAAKC,KAAAA;AAC5C;;;;;;;;;;;;;;;;;AAkBA,SAASC,oBAAmFC,UAA+DC,UAGxJ;CACD,MAAMK,eAAejB,UAAiB,OAAOW,aAAa,aAAaA,SAASX,KAAK,IAAIW;CASzF,OAAO;EACLE,YAAYb,UAA0BG,eAAec,YAAYjB,KAAK,CAAC,CAACa,WAAW,OAAOD,SAASC,cAAc,aAAaD,SAASC,UAAUb,KAAK,IAAIY,SAASC,SAAS,KAAK;EACjLE,QAAQf,UAAsBkB,kBAAkBD,YAAYjB,KAAK,CAAC,CAACe,OAAO,OAAOH,SAASG,UAAU,aAAaH,SAASG,MAAMf,KAAK,IAAIY,SAASG,KAAK;CACzJ;AACF;AACA,SAASG,kBAAkBP,UAAmCC,UAAqC;CACjG,IAAID,aAAaF,KAAAA,KAAaG,aAAaH,KAAAA,GACzC;CAEF,OAAO;EACL,GAAGE;EACH,GAAGC;CACL;AACF;;;;;;;;;;;;;;;;;;;AAoBA,SAASO,YAAYR,UAA0BC,UAG5C;CACD,OAAO;EACL,GAAGD;EACHE,WAAWV,eAAeQ,SAASE,WAAWD,SAASC,SAAS;EAChEE,OAAOG,kBAAkBP,SAASI,OAAOH,SAASG,KAAK;CACzD;AACF"}
|