@kanso-labs/kanso-ui 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -9
- package/dist/button/hooks.js +81 -0
- package/dist/button/hooks.js.map +1 -0
- package/dist/button/index.d.ts +11 -0
- package/dist/button/index.js +260 -0
- package/dist/button/index.js.map +1 -0
- package/dist/button/styles.js +23 -0
- package/dist/button/styles.js.map +1 -0
- package/dist/calendar/index.js +473 -7
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +132 -4
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/index.js +29 -2
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/styles.js +30 -4
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/index.js +12 -9
- package/dist/collection/index.js.map +1 -1
- package/dist/color-scheme.d.ts +29 -0
- package/dist/color-scheme.js +32 -0
- package/dist/color-scheme.js.map +1 -0
- package/dist/components/avatar/index.js +35 -22
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +37 -0
- package/dist/components/badge/index.js +97 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +1 -1
- package/dist/components/breadcrumbs/index.js +1 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.d.ts +58 -14
- package/dist/components/button/index.js +418 -148
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +9 -1
- package/dist/components/calendar/index.js +71 -44
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +4 -4
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox-group/index.js +1 -0
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.js +2 -8
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +3 -3
- package/dist/components/chip-group/index.js +8 -9
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/color-field/index.js +25 -23
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.js +42 -31
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.d.ts +1 -1
- package/dist/components/color-swatch-picker/index.js +17 -13
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/combo-box/index.js +63 -58
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +7 -6
- package/dist/components/copy-field/index.js +92 -90
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +8 -7
- package/dist/components/currency/index.js +43 -65
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-field/index.js +24 -22
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +10 -2
- package/dist/components/date-picker/index.js +76 -69
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +10 -2
- package/dist/components/date-range-picker/index.js +93 -86
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/index.js +2 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +1 -1
- package/dist/components/disclosure/index.js +6 -6
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +72 -0
- package/dist/components/fab/index.js +89 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/fab-menu/index.d.ts +90 -0
- package/dist/components/fab-menu/index.js +297 -0
- package/dist/components/fab-menu/index.js.map +1 -0
- package/dist/components/feed/index.d.ts +2 -1
- package/dist/components/feed/index.js +1 -1
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +11 -8
- package/dist/components/icon-button/index.js +209 -177
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +26 -20
- package/dist/components/list/index.d.ts +15 -13
- package/dist/components/list/index.js +62 -63
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +3 -2
- package/dist/components/list-box/index.js +8 -8
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-item/index.js +1 -1
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +3 -2
- package/dist/components/menu/index.js +2 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-bar/index.d.ts +50 -0
- package/dist/components/navigation-bar/index.js +129 -0
- package/dist/components/navigation-bar/index.js.map +1 -0
- package/dist/components/navigation-rail/index.d.ts +59 -0
- package/dist/components/navigation-rail/index.js +166 -0
- package/dist/components/navigation-rail/index.js.map +1 -0
- package/dist/components/navigation-tree/index.d.ts +1 -5
- package/dist/components/navigation-tree/index.js +3 -3
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +6 -4
- package/dist/components/number-field/index.js +84 -84
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/radio-group/index.js +11 -10
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +7 -1
- package/dist/components/range-calendar/index.js +71 -44
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +2 -1
- package/dist/components/search-field/index.js +24 -25
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +1 -1
- package/dist/components/segmented-button/index.js +2 -2
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +1 -1
- package/dist/components/sheet/index.js +2 -2
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +2 -2
- package/dist/components/snackbar/index.js +28 -13
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/table/index.d.ts +11 -9
- package/dist/components/table/index.js +68 -29
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +1 -1
- package/dist/components/tabs/index.js +79 -23
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +1 -1
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +7 -5
- package/dist/components/text-area/index.js +28 -26
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +7 -5
- package/dist/components/text-field/index.js +28 -26
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.js +24 -22
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +7 -9
- package/dist/components/tree/index.js +11 -12
- package/dist/components/tree/index.js.map +1 -1
- package/dist/drag/styles.js +4 -1
- package/dist/drag/styles.js.map +1 -1
- package/dist/fab/styles.js +161 -0
- package/dist/fab/styles.js.map +1 -0
- package/dist/field/index.js +260 -214
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +10 -2
- package/dist/field/styles.js.map +1 -1
- package/dist/glyphs/index.js +19 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/hooks/useRipple.js +199 -162
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/i18n/index.js +42 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/messages.js +353 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/index.d.ts +27 -20
- package/dist/index.js +22 -16
- package/dist/navigation/context.js +7 -0
- package/dist/navigation/context.js.map +1 -0
- package/dist/navigation/index.d.ts +28 -0
- package/dist/navigation/index.js +96 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/styles.js +312 -0
- package/dist/navigation/styles.js.map +1 -0
- package/dist/react-aria.d.ts +2 -2
- package/dist/react-aria.js +2 -2
- package/dist/render/useRender.js +0 -1
- package/dist/render/useRender.js.map +1 -1
- package/dist/row/styles.js +18 -11
- package/dist/row/styles.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles/icon-button.js +9 -1
- package/dist/styles/icon-button.js.map +1 -1
- package/dist/styles/overlay.js +1 -0
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles/picker.js +1 -1
- package/dist/styles/picker.js.map +1 -1
- package/dist/styles.css +870 -360
- package/dist/tokens/design.tokens.stylex.js +18 -1
- package/dist/tokens/design.tokens.stylex.js.map +1 -1
- package/dist/tokens.css +166 -53
- package/package.json +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","stylex","RenderComponentProps","useImageLoadingStatus","useRender","mergeStyles","colors","radii","typography","styles","base","kGNEyG","kaIpWk","kB7OPa","k1xSpc","kmuXW","kMv6JI","k63SB2","kjj79g","kVQacm","kfSwDN","$$css","image","kZKoxP","kzqmXN","kVIFPx","lg","kGuDYH","md","negative","kWkggS","kMwMTN","positive","primary","secondary","sm","tertiary","AvatarProps","Omit","name","size","src","tone","Avatar","t0","$","render","t1","t2","props","undefined","status","t3","trim","named","t4","t5","role","t6","initialsFrom","t7","t8","children","t9","defaultTagName","words","split","filter","Boolean","length","first","Array","from","last","at","toLocaleUpperCase","_c","props","stylex.props"],"sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useImageLoadingStatus } from '../../hooks/useImageLoadingStatus';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, typography } from '../../tokens/design.tokens.stylex';\n\n// Tones are container/on-container pairs rather than one colour each, so the\n// initials are always a role's own foreground and can't end up unreadable on\n// a tint they were never paired with. Which tone a given person gets is the\n// consuming app's decision — the design cycles colours per person, and that\n// cycle belongs where the list of people is, not in this component.\n//\n// Sizes carry their own type size but not their own weight or family: the\n// label face at medium weight holds across all three, so a large avatar is\n// bigger initials rather than differently-styled ones.\n//\n// The three are the library's own rather than a spec page's — no Material\n// Design page gives a measurement for one in text; the lists page draws its\n// leading elements in a diagram and tabulates only their padding. So they are\n// stated against the scale the library already has. `md` is 40dp, which is\n// Button's and IconButton's own `md` height, so an avatar and a control line\n// up in a row. `lg` is 56dp. `sm` is 36dp, between the 32dp a chip and an\n// `xs` control take and that 40dp default, for a row that wants a person\n// smaller than the button beside them.\n//\n// ProductIcon takes the same three, so a mark and a person fill the same\n// slot.\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x16fbrrb\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n k63SB2: \"x1bf3uqz\",\n kjj79g: \"xl56j7k\",\n kVQacm: \"xb3r6kr\",\n kfSwDN: \"x87ps6o\",\n $$css: true\n },\n image: {\n kZKoxP: \"x5yr21d\",\n kzqmXN: \"xh8yej3\",\n kVIFPx: \"xl1xv1r\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kGuDYH: \"x1848etk\",\n kzqmXN: \"x15yg21f\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kGuDYH: \"x14zspaw\",\n kzqmXN: \"x100vrsf\",\n $$css: true\n },\n negative: {\n kWkggS: \"xkz0cvf\",\n kMwMTN: \"xylzu7l\",\n $$css: true\n },\n positive: {\n kWkggS: \"xa3zu90\",\n kMwMTN: \"x1di7zbg\",\n $$css: true\n },\n primary: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n sm: {\n kZKoxP: \"xc9qbxq\",\n kGuDYH: \"xkucv67\",\n kzqmXN: \"x14qfxbe\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n }\n};\ntype AvatarProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * The person this represents. Supplies both the initials and the accessible\n * name, so a screen reader announces who it is rather than reading two\n * letters aloud.\n */\n name: string;\n /**\n * Diameter: `sm` 36px, `md` 40px, `lg` 56px.\n * @default 'md'\n */\n size?: 'lg' | 'md' | 'sm';\n /**\n * A photo to show in place of the initials. The initials stay until it has\n * loaded, and come back if it fails.\n */\n src?: string;\n /**\n * Which container/on-container colour pair to tint with.\n * @default 'primary'\n */\n tone?: 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary';\n};\nfunction Avatar({\n name,\n render,\n size = 'md',\n src,\n tone = 'primary',\n ...props\n}: AvatarProps) {\n // The photo is shown only once it has loaded, and the initials stay until\n // then and come back if it fails — see useImageLoadingStatus.\n const status = useImageLoadingStatus(src);\n\n // role/aria-label rather than letting the initials be read: \"AL\" is not\n // what anyone means to announce. Marking the root as an image also makes\n // its contents presentational, so the photo and the initials can't be\n // announced a second time underneath the name. A span rather than an\n // <img>, which is void: this element's whole job is to hold the initials\n // shown when there is no photo, or none has loaded yet.\n //\n // A blank name — one still loading, say — names nothing, so the avatar is\n // then a plain element rather than an image with no name, which a screen\n // reader reads as a bare \"image\". Its empty initials, or its photo with an\n // empty alt, leave it nothing to announce.\n const named = name.trim() !== '';\n return useRender({\n defaultTagName: 'span',\n props: {\n ...(named ? {\n 'aria-label': name,\n role: 'img'\n } : {}),\n ...props,\n children: status === 'loaded' ? <img alt=\"\" src={src} className=\"x5yr21d xh8yej3 xl1xv1r\" /> : initialsFrom(name),\n ...mergeStyles(stylex.props(styles.base, styles[size], styles[tone]), props)\n },\n render\n });\n}\n\n// First letter of the first and last word, which handles both \"Ada\" and \"Ada\n// Lovelace\" without a separate prop for how many to take. Array.from rather\n// than indexing, so a name starting outside the Basic Multilingual Plane\n// yields its whole first character instead of half a surrogate pair.\nfunction initialsFrom(name: string) {\n const words = name.split(/\\s+/u).filter(Boolean);\n if (words.length === 0) {\n return '';\n }\n const first = Array.from(words[0] ?? '')[0] ?? '';\n const last = words.length > 1 ? Array.from(words.at(-1) ?? '')[0] ?? '' : '';\n return `${first}${last}`.toLocaleUpperCase();\n}\nexport type { AvatarProps };\nexport default Avatar;"],"mappings":";;;;;;;;AA+BA,MAAMU,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,OAAO;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAK,IAAI;EACFH,QAAQ;EACRI,QAAQ;EACRH,QAAQ;EACRH,OAAO;CACT;CACAO,IAAI;EACFL,QAAQ;EACRI,QAAQ;EACRH,QAAQ;EACRH,OAAO;CACT;CACAQ,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,UAAU;EACRF,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAY,SAAS;EACPH,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAa,WAAW;EACTJ,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAc,IAAI;EACFZ,QAAQ;EACRI,QAAQ;EACRH,QAAQ;EACRH,OAAO;CACT;CACAe,UAAU;EACRN,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;AACF;AAwBA,SAAAsB,OAAAC,IAAA;CAAA,MAAAC,IAAA7C,EAAA,EAAA;CAAgB,MAAA,EAAAuC,MAAAO,QAAAN,MAAAO,IAAAN,KAAAC,MAAAM,IAAA,GAAAC,YAAAL;CAGd,MAAAJ,OAAAO,OAAAG,KAAAA,IAAA,OAAAH;CAEA,MAAAL,OAAAM,OAAAE,KAAAA,IAAA,YAAAF;CAKA,MAAAG,SAAehD,sBAAsBs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AAMN,OACfY;GAQNf;EAEH;EAACD,EAAA,MAAAC;EAAAD,EAAA,MAAAgB;EAAAhB,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,OAZMzC,UAAU2D,EAYhB;AAAC;AAOJ,SAASJ,aAAapB,MAAc;CAClC,MAAM0B,QAAQ1B,KAAK2B,MAAM,MAAM,CAAC,CAACC,OAAOC,OAAO;CAC/C,IAAIH,MAAMI,WAAW,GACnB,OAAO;CAIT,OAAO,GAFOE,MAAMC,KAAKP,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,KAClCA,MAAMI,SAAS,IAAIE,MAAMC,KAAKP,MAAMS,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,KAAK,KACjDC,kBAAkB;AAC7C"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","stylex","useLocale","RenderComponentProps","useImageLoadingStatus","useRender","mergeStyles","colors","radii","typography","styles","base","kGNEyG","kaIpWk","kB7OPa","k1xSpc","kmuXW","kMv6JI","k63SB2","kjj79g","kVQacm","kfSwDN","$$css","image","kZKoxP","kzqmXN","kVIFPx","lg","kGuDYH","md","negative","kWkggS","kMwMTN","positive","primary","secondary","sm","tertiary","AvatarProps","Omit","name","size","src","tone","Avatar","t0","$","render","t1","t2","props","undefined","status","locale","t3","trim","named","t4","t5","role","t6","initialsFrom","t7","t8","children","t9","defaultTagName","words","split","filter","Boolean","length","first","firstGrapheme","last","at","toLocaleUpperCase","segmenters","Map","Intl","Segmenter","word","segmenter","get","granularity","set","segment","_c","props","stylex.props"],"sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { useLocale } from 'react-aria-components';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useImageLoadingStatus } from '../../hooks/useImageLoadingStatus';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, typography } from '../../tokens/design.tokens.stylex';\n\n// Tones are container/on-container pairs rather than one colour each, so the\n// initials are always a role's own foreground and can't end up unreadable on\n// a tint they were never paired with. Which tone a given person gets is the\n// consuming app's decision — the design cycles colours per person, and that\n// cycle belongs where the list of people is, not in this component.\n//\n// Sizes carry their own type size but not their own weight or family: the\n// label face at medium weight holds across all three, so a large avatar is\n// bigger initials rather than differently-styled ones.\n//\n// The three are the library's own rather than a spec page's — no Material\n// Design page gives a measurement for one in text; the lists page draws its\n// leading elements in a diagram and tabulates only their padding. So they are\n// stated against the scale the library already has. `md` is 40dp, which is\n// Button's and IconButton's own `md` height, so an avatar and a control line\n// up in a row. `lg` is 56dp. `sm` is 36dp, between the 32dp a chip and an\n// `xs` control take and that 40dp default, for a row that wants a person\n// smaller than the button beside them.\n//\n// ProductIcon takes the same three, so a mark and a person fill the same\n// slot.\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x16fbrrb\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n k63SB2: \"x1bf3uqz\",\n kjj79g: \"xl56j7k\",\n kVQacm: \"xb3r6kr\",\n kfSwDN: \"x87ps6o\",\n $$css: true\n },\n image: {\n kZKoxP: \"x5yr21d\",\n kzqmXN: \"xh8yej3\",\n kVIFPx: \"xl1xv1r\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kGuDYH: \"x1848etk\",\n kzqmXN: \"x15yg21f\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kGuDYH: \"x14zspaw\",\n kzqmXN: \"x100vrsf\",\n $$css: true\n },\n negative: {\n kWkggS: \"xkz0cvf\",\n kMwMTN: \"xylzu7l\",\n $$css: true\n },\n positive: {\n kWkggS: \"xa3zu90\",\n kMwMTN: \"x1di7zbg\",\n $$css: true\n },\n primary: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n sm: {\n kZKoxP: \"xc9qbxq\",\n kGuDYH: \"xkucv67\",\n kzqmXN: \"x14qfxbe\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n }\n};\ntype AvatarProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * The person this represents. Supplies both the initials and the accessible\n * name, so a screen reader announces who it is rather than reading two\n * letters aloud.\n */\n name: string;\n /**\n * Diameter: `sm` 36px, `md` 40px, `lg` 56px.\n * @default 'md'\n */\n size?: 'lg' | 'md' | 'sm';\n /**\n * A photo to show in place of the initials. The initials stay until it has\n * loaded, and come back if it fails.\n */\n src?: string;\n /**\n * Which container/on-container colour pair to tint with.\n * @default 'primary'\n */\n tone?: 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary';\n};\nfunction Avatar({\n name,\n render,\n size = 'md',\n src,\n tone = 'primary',\n ...props\n}: AvatarProps) {\n // The photo is shown only once it has loaded, and the initials stay until\n // then and come back if it fails — see useImageLoadingStatus.\n const status = useImageLoadingStatus(src);\n const {\n locale\n } = useLocale();\n\n // role/aria-label rather than letting the initials be read: \"AL\" is not\n // what anyone means to announce. Marking the root as an image also makes\n // its contents presentational, so the photo and the initials can't be\n // announced a second time underneath the name. A span rather than an\n // <img>, which is void: this element's whole job is to hold the initials\n // shown when there is no photo, or none has loaded yet.\n //\n // A blank name — one still loading, say — names nothing, so the avatar is\n // then a plain element rather than an image with no name, which a screen\n // reader reads as a bare \"image\". Its empty initials, or its photo with an\n // empty alt, leave it nothing to announce.\n const named = name.trim() !== '';\n return useRender({\n defaultTagName: 'span',\n props: {\n ...(named ? {\n 'aria-label': name,\n role: 'img'\n } : {}),\n ...props,\n children: status === 'loaded' ? <img alt=\"\" src={src} className=\"x5yr21d xh8yej3 xl1xv1r\" /> : initialsFrom(name, locale),\n ...mergeStyles(stylex.props(styles.base, styles[size], styles[tone]), props)\n },\n render\n });\n}\n\n// The first character of the first and last word, which handles both \"Ada\"\n// and \"Ada Lovelace\" without a separate prop for how many to take.\n//\n// A character is a grapheme, what a reader sees as one, rather than a code\n// point: a code point drops an accent written as a combining mark, splits an\n// Indic conjunct and cuts a flag or a joined emoji in half. And it is\n// upper-cased in the reader's locale, which is what turns a Turkish \"i\" into\n// \"İ\" rather than \"I\".\nfunction initialsFrom(name: string, locale: string) {\n const words = name.split(/\\s+/u).filter(Boolean);\n if (words.length === 0) {\n return '';\n }\n const first = firstGrapheme(words[0] ?? '', locale);\n const last = words.length > 1 ? firstGrapheme(words.at(-1) ?? '', locale) : '';\n return `${first}${last}`.toLocaleUpperCase(locale);\n}\nconst segmenters = new Map<string, Intl.Segmenter>();\nfunction firstGrapheme(word: string, locale: string) {\n let segmenter = segmenters.get(locale);\n if (segmenter === undefined) {\n segmenter = new Intl.Segmenter(locale, {\n granularity: 'grapheme'\n });\n segmenters.set(locale, segmenter);\n }\n for (const {\n segment\n } of segmenter.segment(word)) {\n return segment;\n }\n return '';\n}\nexport type { AvatarProps };\nexport default Avatar;"],"mappings":";;;;;;;;;AAgCA,MAAMW,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,OAAO;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAK,IAAI;EACFH,QAAQ;EACRI,QAAQ;EACRH,QAAQ;EACRH,OAAO;CACT;CACAO,IAAI;EACFL,QAAQ;EACRI,QAAQ;EACRH,QAAQ;EACRH,OAAO;CACT;CACAQ,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,UAAU;EACRF,QAAQ;EACRC,QAAQ;EACRV,OAAO;CAC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IAAIH,KAAKC,UAAU3B,QAAQ,EACrC+B,aAAa,WACf,CAAC;EACDP,WAAWQ,IAAIhC,QAAQ6B,SAAS;CAClC;CACA,KAAK,MAAM,EACTI,aACGJ,UAAUI,QAAQL,IAAI,GACzB,OAAOK;CAET,OAAO;AACT"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
|
+
//#region src/components/badge/index.d.ts
|
|
3
|
+
type BadgeProps = RenderComponentProps<'span'> & {
|
|
4
|
+
/**
|
|
5
|
+
* The number to show, which draws the page's large badge. Left out, the
|
|
6
|
+
* badge is the small 6dp dot, which flags without counting. A count of 0
|
|
7
|
+
* still draws, so leave the badge out when there is nothing to count.
|
|
8
|
+
*/
|
|
9
|
+
count?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The largest count drawn as itself. Above it the badge reads `max` and a
|
|
12
|
+
* plus, which is the page's 999+ at the default.
|
|
13
|
+
* @default 999
|
|
14
|
+
*/
|
|
15
|
+
max?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A badge on the corner of what it wraps, usually an icon: the small dot,
|
|
19
|
+
* or with `count` the large badge holding a number. The mark is hidden from
|
|
20
|
+
* assistive technology, so put what it says in the name of the control it
|
|
21
|
+
* sits on.
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <IconButton aria-label="Notifications, 3 new">
|
|
25
|
+
* <Badge count={3}>
|
|
26
|
+
* <BellIcon />
|
|
27
|
+
* </Badge>
|
|
28
|
+
* </IconButton>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The call site's `className` and `style` land on the element wrapping what
|
|
32
|
+
* the badge is drawn on.
|
|
33
|
+
*/
|
|
34
|
+
declare function Badge({ children, count, max, render, ...props }: BadgeProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { type BadgeProps, Badge as default };
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRender } from "../../render/useRender.js";
|
|
3
|
+
import { mergeStyles } from "../../styles/merge.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useLocale } from "react-aria-components";
|
|
7
|
+
//#region src/components/badge/index.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A badge on the corner of what it wraps, usually an icon: the small dot,
|
|
10
|
+
* or with `count` the large badge holding a number. The mark is hidden from
|
|
11
|
+
* assistive technology, so put what it says in the name of the control it
|
|
12
|
+
* sits on.
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <IconButton aria-label="Notifications, 3 new">
|
|
16
|
+
* <Badge count={3}>
|
|
17
|
+
* <BellIcon />
|
|
18
|
+
* </Badge>
|
|
19
|
+
* </IconButton>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* The call site's `className` and `style` land on the element wrapping what
|
|
23
|
+
* the badge is drawn on.
|
|
24
|
+
*/
|
|
25
|
+
function Badge(t0) {
|
|
26
|
+
const $ = c(18);
|
|
27
|
+
const { children, count, max: t1, render, ...props } = t0;
|
|
28
|
+
const max = t1 === void 0 ? 999 : t1;
|
|
29
|
+
const { locale } = useLocale();
|
|
30
|
+
let t2;
|
|
31
|
+
if ($[0] !== count || $[1] !== locale || $[2] !== max) {
|
|
32
|
+
const numbers = new Intl.NumberFormat(locale);
|
|
33
|
+
t2 = count === void 0 ? void 0 : count > max ? `${numbers.format(max)}+` : numbers.format(count);
|
|
34
|
+
$[0] = count;
|
|
35
|
+
$[1] = locale;
|
|
36
|
+
$[2] = max;
|
|
37
|
+
$[3] = t2;
|
|
38
|
+
} else t2 = $[3];
|
|
39
|
+
const label = t2;
|
|
40
|
+
const t3 = "span";
|
|
41
|
+
const t4 = mergeStyles({ className: "x9f619 x3nfvp2 x1n2onr6" }, props);
|
|
42
|
+
let t5;
|
|
43
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
44
|
+
t5 = {
|
|
45
|
+
0: { className: "xwi4nbo x1w1tqly x1dkaolv xx61lck x13rsnn2 x9f619 x47corl x10l6tqk x6s0dn4 xlup9mm x1l7c2jh x78zum5 xs1w0rn x1n35her xss6m8b x1su64ma x1qiirwl xty0069 xl56j7k xdlnduh xaomhve x15kz4h8 ximhkdq xuxw1ft" },
|
|
46
|
+
1: { className: "xwi4nbo x1w1tqly x1dkaolv xx61lck x13rsnn2 x9f619 x47corl x10l6tqk xols6we x1v4s8kt x13vifvy xtijo5x" }
|
|
47
|
+
};
|
|
48
|
+
$[4] = t5;
|
|
49
|
+
} else t5 = $[4];
|
|
50
|
+
const t6 = t5[!!(label === void 0) << 0];
|
|
51
|
+
let t7;
|
|
52
|
+
if ($[5] !== label || $[6] !== t6) {
|
|
53
|
+
t7 = /* @__PURE__ */ jsx("span", {
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
...t6,
|
|
56
|
+
children: label
|
|
57
|
+
});
|
|
58
|
+
$[5] = label;
|
|
59
|
+
$[6] = t6;
|
|
60
|
+
$[7] = t7;
|
|
61
|
+
} else t7 = $[7];
|
|
62
|
+
let t8;
|
|
63
|
+
if ($[8] !== children || $[9] !== t7) {
|
|
64
|
+
t8 = /* @__PURE__ */ jsxs(Fragment, { children: [children, t7] });
|
|
65
|
+
$[8] = children;
|
|
66
|
+
$[9] = t7;
|
|
67
|
+
$[10] = t8;
|
|
68
|
+
} else t8 = $[10];
|
|
69
|
+
let t9;
|
|
70
|
+
if ($[11] !== props || $[12] !== t4 || $[13] !== t8) {
|
|
71
|
+
t9 = {
|
|
72
|
+
...props,
|
|
73
|
+
...t4,
|
|
74
|
+
children: t8
|
|
75
|
+
};
|
|
76
|
+
$[11] = props;
|
|
77
|
+
$[12] = t4;
|
|
78
|
+
$[13] = t8;
|
|
79
|
+
$[14] = t9;
|
|
80
|
+
} else t9 = $[14];
|
|
81
|
+
let t10;
|
|
82
|
+
if ($[15] !== render || $[16] !== t9) {
|
|
83
|
+
t10 = {
|
|
84
|
+
defaultTagName: t3,
|
|
85
|
+
props: t9,
|
|
86
|
+
render
|
|
87
|
+
};
|
|
88
|
+
$[15] = render;
|
|
89
|
+
$[16] = t9;
|
|
90
|
+
$[17] = t10;
|
|
91
|
+
} else t10 = $[17];
|
|
92
|
+
return useRender(t10);
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { Badge as default };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","stylex","useLocale","RenderComponentProps","useRender","mergeStyles","colors","radii","spacing","typography","FORCED_COLORS","BadgeProps","count","max","Badge","t0","$","children","t1","render","props","undefined","locale","t2","numbers","Intl","NumberFormat","format","label","t3","t4","className","t5","Symbol","for","0","1","t6","t7","t8","t9","t10","defaultTagName","_c"],"sources":["../../../src/components/badge/index.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { useLocale } from 'react-aria-components';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// The badges page's badge: a mark on the corner of an icon that flags\n// something new there, either as the 6dp small badge or as the 16dp large\n// badge holding a count. Both are the error pair — the error role, with the\n// count in on error — on a full corner, and the count is label small, capped\n// at four characters with a plus, as \"999+\".\n//\n// The badge wraps what it is drawn on, usually an icon, and places the mark\n// against that element's box, which is what the page measures from. The\n// small badge fills the icon's top trailing 6dp square. The large badge's\n// bottom leading corner sits 14dp down and 12dp in from the icon's top\n// trailing corner, so it stands 2dp above the icon and grows toward the end\n// as its count lengthens, to the page's 34dp at \"999+\". Both are logical\n// insets, so the mark stays on the trailing corner under right-to-left.\n//\n// The mark is hidden from assistive technology. A count read on its own is a\n// number with no subject; it belongs in the name of the control it sits on,\n// where a reader meets it with what it counts — \"Notifications, 3 new\" — and\n// the stories show it there.\n//\n// Under forced colours the error fill is painted over in the mode's\n// background, which left the small badge as nothing at all. It takes a 1px\n// border there instead, which the mode keeps and paints in its text colour.\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\ntype BadgeProps = RenderComponentProps<'span'> & {\n /**\n * The number to show, which draws the page's large badge. Left out, the\n * badge is the small 6dp dot, which flags without counting. A count of 0\n * still draws, so leave the badge out when there is nothing to count.\n */\n count?: number;\n /**\n * The largest count drawn as itself. Above it the badge reads `max` and a\n * plus, which is the page's 999+ at the default.\n * @default 999\n */\n max?: number;\n};\n\n/**\n * A badge on the corner of what it wraps, usually an icon: the small dot,\n * or with `count` the large badge holding a number. The mark is hidden from\n * assistive technology, so put what it says in the name of the control it\n * sits on.\n *\n * ```tsx\n * <IconButton aria-label=\"Notifications, 3 new\">\n * <Badge count={3}>\n * <BellIcon />\n * </Badge>\n * </IconButton>\n * ```\n *\n * The call site's `className` and `style` land on the element wrapping what\n * the badge is drawn on.\n */\nfunction Badge({\n children,\n count,\n max = 999,\n render,\n ...props\n}: BadgeProps) {\n const {\n locale\n } = useLocale();\n const numbers = new Intl.NumberFormat(locale);\n const label = count === undefined ? undefined : count > max ? `${numbers.format(max)}+` : numbers.format(count);\n return useRender({\n defaultTagName: 'span',\n props: {\n ...props,\n ...mergeStyles({\n className: \"x9f619 x3nfvp2 x1n2onr6\"\n }, props),\n children: <>\n {children}\n <span aria-hidden=\"true\" {...{\n 0: {\n className: \"xwi4nbo x1w1tqly x1dkaolv xx61lck x13rsnn2 x9f619 x47corl x10l6tqk x6s0dn4 xlup9mm x1l7c2jh x78zum5 xs1w0rn x1n35her xss6m8b x1su64ma x1qiirwl xty0069 xl56j7k xdlnduh xaomhve x15kz4h8 ximhkdq xuxw1ft\"\n },\n 1: {\n className: \"xwi4nbo x1w1tqly x1dkaolv xx61lck x13rsnn2 x9f619 x47corl x10l6tqk xols6we x1v4s8kt x13vifvy xtijo5x\"\n }\n }[!!(label === undefined) << 0]}>\n {label}\n </span>\n </>\n },\n render\n });\n}\nexport type { BadgeProps };\nexport default Badge;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsEA,SAAAe,MAAAC,IAAA;CAAA,MAAAC,IAAAhB,EAAA,EAAA;CAAe,MAAA,EAAAiB,UAAAL,OAAAC,KAAAK,IAAAC,QAAA,GAAAC,UAAAL;CAGb,MAAAF,MAAAK,OAAAG,KAAAA,IAAA,MAAAH;CAIA,MAAA,EAAAI,WAEIpB,UAAU;CAAE,IAAAqB;CAAA,IAAAP,EAAA,OAAAJ,SAAAI,EAAA,OAAAM,UAAAN,EAAA,OAAAH,KAAA;EAChB,MAAAW,UAAgB,IAAIC,KAAIC,aAAcJ,MAAM;EAC9BC,KAAAX,UAAUS,KAAAA,IAAVA,KAAAA,IAAkCT,QAAQC,MAAR,GAAiBW,QAAOG,OAAQd,GAAG,EAAC,KAAMW,QAAOG,OAAQf,KAAK;EAACI,EAAA,KAAAJ;EAAAI,EAAA,KAAAM;EAAAN,EAAA,KAAAH;EAAAG,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAA/G,MAAAY,QAAcL;CAEI,MAAAM,KAAA;CAGX,MAAAC,KAAAzB,YAAY,EAAA0B,WACF,0BACb,GAAGX,KAAK;CAAC,IAAAY;CAAA,IAAAhB,EAAA,OAAAiB,OAAAC,IAAA,2BAAA,GAAA;EAGwBF,KAAA;GAAAG,GAC1B,EAAAJ,WACU,0MACb;GAACK,GACE,EAAAL,WACU,uGACb;EACF;EAACf,EAAA,KAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAP8B,MAAAqB,KAAAL,GAO7B,CAAC,EAAEJ,UAAUP,KAAAA,MAAc;CAAE,IAAAiB;CAAA,IAAAtB,EAAA,OAAAY,SAAAZ,EAAA,OAAAqB,IAAA;EAP7BC,KAAA,oBAAA,QAAA;GAAkB,eAAA;GAAM,GAAKD;GAQ1BT,UAAAA;EACI,CAAA;EAAAZ,EAAA,KAAAY;EAAAZ,EAAA,KAAAqB;EAAArB,EAAA,KAAAsB;CAAA,OAAAA,KAAAtB,EAAA;CAAA,IAAAuB;CAAA,IAAAvB,EAAA,OAAAC,YAAAD,EAAA,OAAAsB,IAAA;EAXDC,KAAA,qBAAA,UAAA,EAAA,UAAA,CACLtB,UACDqB,EASO,EAAA,CAAA;EACNtB,EAAA,KAAAC;EAAAD,EAAA,KAAAsB;EAAAtB,EAAA,MAAAuB;CAAA,OAAAA,KAAAvB,EAAA;CAAA,IAAAwB;CAAA,IAAAxB,EAAA,QAAAI,SAAAJ,EAAA,QAAAc,MAAAd,EAAA,QAAAuB,IAAA;EAjBAC,KAAA;GAAA,GACFpB;GAAK,GACLU;GAEMb,UACCsB;EAaZ;EAACvB,EAAA,MAAAI;EAAAJ,EAAA,MAAAc;EAAAd,EAAA,MAAAuB;EAAAvB,EAAA,MAAAwB;CAAA,OAAAA,KAAAxB,EAAA;CAAA,IAAAyB;CAAA,IAAAzB,EAAA,QAAAG,UAAAH,EAAA,QAAAwB,IAAA;EApBcC,MAAA;GAAAC,gBACCb;GAAMT,OACfoB;GAkBNrB;EAEH;EAACH,EAAA,MAAAG;EAAAH,EAAA,MAAAwB;EAAAxB,EAAA,MAAAyB;CAAA,OAAAA,MAAAzB,EAAA;CAAA,OAtBMZ,UAAUqC,GAsBhB;AAAC"}
|
|
@@ -53,5 +53,5 @@ declare namespace Breadcrumbs$1 {
|
|
|
53
53
|
*/
|
|
54
54
|
declare function BreadcrumbsItem({ children, href, rel, target, ...props }: BreadcrumbsItemProps): import("react").JSX.Element;
|
|
55
55
|
//#endregion
|
|
56
|
-
export { type BreadcrumbsItemProps, type BreadcrumbsProps$1 as BreadcrumbsProps, Breadcrumbs$1 as default };
|
|
56
|
+
export { BreadcrumbsItem, type BreadcrumbsItemProps, type BreadcrumbsProps$1 as BreadcrumbsProps, Breadcrumbs$1 as default };
|
|
57
57
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -129,6 +129,6 @@ function itemContent(children, href, rel, target) {
|
|
|
129
129
|
}
|
|
130
130
|
Breadcrumbs$1.Item = BreadcrumbsItem;
|
|
131
131
|
//#endregion
|
|
132
|
-
export { Breadcrumbs$1 as default };
|
|
132
|
+
export { BreadcrumbsItem, Breadcrumbs$1 as default };
|
|
133
133
|
|
|
134
134
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","BreadcrumbRenderProps","BreadcrumbProps","RACBreadcrumbProps","BreadcrumbsProps","RACBreadcrumbsProps","stylex","Breadcrumb","RACBreadcrumb","Breadcrumbs","RACBreadcrumbs","ChevronEndGlyph","mergeStatefulStyles","mergeStyles","colors","spacing","typography","Link","BreadcrumbsItemProps","Omit","children","className","href","rel","style","target","T","props","$","t0","t1","BreadcrumbsItem","T0","t2","t3","t4","t5","t6","itemContent","state","isCurrent","Item","Breadcrumbs","_c","RACBreadcrumbs","RACBreadcrumb","Link"],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { BreadcrumbRenderProps, BreadcrumbProps as RACBreadcrumbProps, BreadcrumbsProps as RACBreadcrumbsProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Breadcrumb as RACBreadcrumb, Breadcrumbs as RACBreadcrumbs } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport Link from '../link';\n\n// A trail of links back up a hierarchy, ending at the page you are on. The\n// design system carries no breadcrumbs page, so the two nearest ones stand\n// in: the row takes the top app bar's muted content role, and each link the\n// text button's label-large type. Both are written down here rather than\n// guessed at each call site.\n//\n// React Aria decides which item is current — the last one — and marks it\n// `aria-current=\"page\"`. The trail is an ordered list, which is what a screen\n// reader reads it as, and `Breadcrumbs.Item` is one entry in it.\n//\n// Three things are this component's own.\n//\n// **The current item is text, not a link.** React Aria's own answer is a\n// disabled link, and a disabled link takes the library's disabled treatment\n// — the content role at 38%, which fades the one item the trail exists to\n// name. Here it is a span carrying `aria-current=\"page\"` instead, in the\n// full-strength content role, so the page you are on is the most legible\n// thing in the row rather than the least.\n//\n// **The chevron belongs to the item before it.** Each item that is not the\n// current one draws one after its link, which puts a separator between every\n// pair and none at the end. It says \"further in\" rather than \"to the right\",\n// so it mirrors under a right-to-left writing mode.\n//\n// **A link is drawn as a link in a place already understood to be links.**\n// `tone=\"inherit\"` takes the row's muted colour and `underline=\"hover\"`\n// leaves the rule for a pointer, which is what Link's own documentation\n// names this case for. The row's position is what announces them.\n//\n// `onAction` is React Aria's and is not wrapped: give each item an `id` and\n// the trail reports which one was pressed, for a page that navigates without\n// an `href`.\n\ntype BreadcrumbsItemProps = Omit<RACBreadcrumbProps, 'children' | 'className' | 'style'> & {\n /** The item's label. */\n children?: ReactNode;\n /** A function may compute the class from the item's render state. */\n className?: RACBreadcrumbProps['className'];\n /**\n * Where the item leads. Leave it out on an item the page handles through\n * the trail's `onAction`, and on the current one, which is never a link.\n */\n href?: string;\n /** The link's `rel`. */\n rel?: string;\n /** A function may compute the style from the item's render state. */\n style?: RACBreadcrumbProps['style'];\n /** The link's `target`. */\n target?: string;\n};\ntype BreadcrumbsProps<T extends object = object> = Omit<RACBreadcrumbsProps<T>, 'children'> & {\n /** The trail, as `Breadcrumbs.Item` entries. */\n children?: ReactNode;\n};\n\n/**\n * A trail of links back up a hierarchy, ending at the page you are on.\n * React Aria makes the last item the current one and marks it\n * `aria-current=\"page\"`; everything before it is a link.\n *\n * ```tsx\n * <Breadcrumbs aria-label=\"Label\">\n * <Breadcrumbs.Item href=\"#first\">First item</Breadcrumbs.Item>\n * <Breadcrumbs.Item href=\"#second\">Second item</Breadcrumbs.Item>\n * <Breadcrumbs.Item>Third item</Breadcrumbs.Item>\n * </Breadcrumbs>\n * ```\n *\n * Name it with `aria-label` or `aria-labelledby`. A page that navigates\n * without an `href` gives each item an `id` and the trail an `onAction`,\n * which is React Aria's and reports the key that was pressed.\n *\n * The call site's `className` and `style` land on the list, which is the\n * element a layout positions.\n */\nfunction Breadcrumbs<T extends object = object>(props: BreadcrumbsProps<T> & RefAttributes<HTMLOListElement>) {\n return <RACBreadcrumbs<T> {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x1w5n3ug x78zum5 x1a02dak xkknnkr x14zspaw x1v9cpvo xzoy561 x155f00i x1lz68p4 xe8uvvx x1ghz6dp x1717udv\"\n }, props)} />;\n}\n\n/**\n * One entry in the trail. Give it an `href` to navigate, or an `id` and let\n * the trail's `onAction` handle it. The last entry is the current page and\n * is drawn as text rather than a link, whatever it is given.\n */\nfunction BreadcrumbsItem({\n children,\n href,\n rel,\n target,\n ...props\n}: BreadcrumbsItemProps) {\n return <RACBreadcrumb {...props} {...mergeStatefulStyles({\n className: \"x6s0dn4 x9f619 x78zum5 xzoy561\"\n }, props)}>\n {itemContent(children, href, rel, target)}\n </RACBreadcrumb>;\n}\n\n// What an entry draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\nfunction itemContent(children: ReactNode, href: string | undefined, rel: string | undefined, target: string | undefined) {\n return (state: BreadcrumbRenderProps) => {\n if (state.isCurrent) {\n return <span aria-current=\"page\" className=\"x139gbkf\">\n {children}\n </span>;\n }\n return <>\n <Link href={href} rel={rel} target={target} tone=\"inherit\" underline=\"hover\">\n {children}\n </Link>\n <ChevronEndGlyph className=\"xmix8c7 x2lah0s x1xp8n7a x19axjrm x1c071of\" />\n </>;\n };\n}\nBreadcrumbs.Item = BreadcrumbsItem;\nexport type { BreadcrumbsItemProps, BreadcrumbsProps };\nexport default Breadcrumbs;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,SAAAY,cAAAkB,OAAA;CAAA,MAAAC,IAAA9B,EAAA,CAAA;CAAA,IAAA+B;CAAA,IAAAD,EAAA,OAAAD,OAAA;EAC2CE,KAAAhB,YAAY,EAAAQ,WACxC,yHACb,GAAGM,KAAK;EAACC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAD,SAAAC,EAAA,OAAAC,IAAA;EAFFC,KAAA,oBAACc,aAAD;GAAe,GAAQjB;GAAK,GAAME;EAEhC,CAAA;EAAID,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAFNE;AAEM;;;;;;AAQf,SAAAC,gBAAAF,IAAA;CAAA,MAAAD,IAAA9B,EAAA,EAAA;CAAA,IAAAkC;CAAA,IAAAZ;CAAA,IAAAE;CAAA,IAAAC;CAAA,IAAAO;CAAA,IAAAG;CAAA,IAAAR;CAAA,IAAAG,EAAA,OAAAC,IAAA;EAAyB,MAAA,EAAAT,UAAAc,IAAAZ,MAAAa,IAAAZ,KAAAa,IAAAX,QAAAY,IAAA,GAAAV,UAAAE;EAAAT,WAAAc;EAAAZ,OAAAa;EAAAZ,MAAAa;EAAAX,SAAAY;EAOfL,KAAAxB;EAAkBmB,KAAAA;EAAWM,KAAArB,oBAAoB,EAAAS,WAC5C,iCACb,GAAGM,KAAK;EAACC,EAAA,KAAAC;EAAAD,EAAA,KAAAI;EAAAJ,EAAA,KAAAR;EAAAQ,EAAA,KAAAN;EAAAM,EAAA,KAAAL;EAAAK,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|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","BreadcrumbRenderProps","BreadcrumbProps","RACBreadcrumbProps","BreadcrumbsProps","RACBreadcrumbsProps","stylex","Breadcrumb","RACBreadcrumb","Breadcrumbs","RACBreadcrumbs","ChevronEndGlyph","mergeStatefulStyles","mergeStyles","colors","spacing","typography","Link","BreadcrumbsItemProps","Omit","children","className","href","rel","style","target","T","props","$","t0","t1","BreadcrumbsItem","T0","t2","t3","t4","t5","t6","itemContent","state","isCurrent","Item","Breadcrumbs","_c","RACBreadcrumbs","RACBreadcrumb","Link"],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { BreadcrumbRenderProps, BreadcrumbProps as RACBreadcrumbProps, BreadcrumbsProps as RACBreadcrumbsProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Breadcrumb as RACBreadcrumb, Breadcrumbs as RACBreadcrumbs } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport Link from '../link';\n\n// A trail of links back up a hierarchy, ending at the page you are on. The\n// design system carries no breadcrumbs page, so the two nearest ones stand\n// in: the row takes the top app bar's muted content role, and each link the\n// text button's label-large type. Both are written down here rather than\n// guessed at each call site.\n//\n// React Aria decides which item is current — the last one — and marks it\n// `aria-current=\"page\"`. The trail is an ordered list, which is what a screen\n// reader reads it as, and `Breadcrumbs.Item` is one entry in it.\n//\n// Three things are this component's own.\n//\n// **The current item is text, not a link.** React Aria's own answer is a\n// disabled link, and a disabled link takes the library's disabled treatment\n// — the content role at 38%, which fades the one item the trail exists to\n// name. Here it is a span carrying `aria-current=\"page\"` instead, in the\n// full-strength content role, so the page you are on is the most legible\n// thing in the row rather than the least.\n//\n// **The chevron belongs to the item before it.** Each item that is not the\n// current one draws one after its link, which puts a separator between every\n// pair and none at the end. It says \"further in\" rather than \"to the right\",\n// so it mirrors under a right-to-left writing mode.\n//\n// **A link is drawn as a link in a place already understood to be links.**\n// `tone=\"inherit\"` takes the row's muted colour and `underline=\"hover\"`\n// leaves the rule for a pointer, which is what Link's own documentation\n// names this case for. The row's position is what announces them.\n//\n// `onAction` is React Aria's and is not wrapped: give each item an `id` and\n// the trail reports which one was pressed, for a page that navigates without\n// an `href`.\n\ntype BreadcrumbsItemProps = Omit<RACBreadcrumbProps, 'children' | 'className' | 'style'> & {\n /** The item's label. */\n children?: ReactNode;\n /** A function may compute the class from the item's render state. */\n className?: RACBreadcrumbProps['className'];\n /**\n * Where the item leads. Leave it out on an item the page handles through\n * the trail's `onAction`, and on the current one, which is never a link.\n */\n href?: string;\n /** The link's `rel`. */\n rel?: string;\n /** A function may compute the style from the item's render state. */\n style?: RACBreadcrumbProps['style'];\n /** The link's `target`. */\n target?: string;\n};\ntype BreadcrumbsProps<T extends object = object> = Omit<RACBreadcrumbsProps<T>, 'children'> & {\n /** The trail, as `Breadcrumbs.Item` entries. */\n children?: ReactNode;\n};\n\n/**\n * A trail of links back up a hierarchy, ending at the page you are on.\n * React Aria makes the last item the current one and marks it\n * `aria-current=\"page\"`; everything before it is a link.\n *\n * ```tsx\n * <Breadcrumbs aria-label=\"Label\">\n * <Breadcrumbs.Item href=\"#first\">First item</Breadcrumbs.Item>\n * <Breadcrumbs.Item href=\"#second\">Second item</Breadcrumbs.Item>\n * <Breadcrumbs.Item>Third item</Breadcrumbs.Item>\n * </Breadcrumbs>\n * ```\n *\n * Name it with `aria-label` or `aria-labelledby`. A page that navigates\n * without an `href` gives each item an `id` and the trail an `onAction`,\n * which is React Aria's and reports the key that was pressed.\n *\n * The call site's `className` and `style` land on the list, which is the\n * element a layout positions.\n */\nfunction Breadcrumbs<T extends object = object>(props: BreadcrumbsProps<T> & RefAttributes<HTMLOListElement>) {\n return <RACBreadcrumbs<T> {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x1w5n3ug x78zum5 x1a02dak xkknnkr x14zspaw x1v9cpvo xzoy561 x155f00i x1lz68p4 xe8uvvx x1ghz6dp x1717udv\"\n }, props)} />;\n}\n\n/**\n * One entry in the trail. Give it an `href` to navigate, or an `id` and let\n * the trail's `onAction` handle it. The last entry is the current page and\n * is drawn as text rather than a link, whatever it is given.\n */\nfunction BreadcrumbsItem({\n children,\n href,\n rel,\n target,\n ...props\n}: BreadcrumbsItemProps) {\n return <RACBreadcrumb {...props} {...mergeStatefulStyles({\n className: \"x6s0dn4 x9f619 x78zum5 xzoy561\"\n }, props)}>\n {itemContent(children, href, rel, target)}\n </RACBreadcrumb>;\n}\n\n// What an entry draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\nfunction itemContent(children: ReactNode, href: string | undefined, rel: string | undefined, target: string | undefined) {\n return (state: BreadcrumbRenderProps) => {\n if (state.isCurrent) {\n return <span aria-current=\"page\" className=\"x139gbkf\">\n {children}\n </span>;\n }\n return <>\n <Link href={href} rel={rel} target={target} tone=\"inherit\" underline=\"hover\">\n {children}\n </Link>\n <ChevronEndGlyph className=\"xmix8c7 x2lah0s x1xp8n7a x19axjrm x1c071of\" />\n </>;\n };\n}\nBreadcrumbs.Item = BreadcrumbsItem;\nexport type { BreadcrumbsItemProps, BreadcrumbsProps };\nexport { BreadcrumbsItem };\nexport default Breadcrumbs;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,SAAAY,cAAAkB,OAAA;CAAA,MAAAC,IAAA9B,EAAA,CAAA;CAAA,IAAA+B;CAAA,IAAAD,EAAA,OAAAD,OAAA;EAC2CE,KAAAhB,YAAY,EAAAQ,WACxC,yHACb,GAAGM,KAAK;EAACC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAE;CAAA,I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AAA,MAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,QAAAI,MAAAJ,EAAA,QAAAE,MAAAF,EAAA,QAAAK,MAAAL,EAAA,QAAAM,IAAA;EAHtCC,KAAA,oBAAC,IAAD;GAAc,GAAKR;GAAK,GAAMM;GAGhCC,UAAAA;EAHgB,CAAA;EAIHN,EAAA,MAAAI;EAAAJ,EAAA,MAAAE;EAAAF,EAAA,MAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAJXO;AAIW;AAOpB,SAASG,YAAYlB,UAAqBE,MAA0BC,KAAyBE,QAA4B;CACvH,QAAQc,UAAiC;EACvC,IAAIA,MAAMC,WACR,OAAO,oBAAC,QAAD;GAAM,gBAAa;GAAO,WAAU;GACtCpB;EACG,CAAA;EAEV,OAAO,qBAAA,UAAA,EAAA,UAAA,CACH,oBAAC0B,QAAD;GAAYxB;GAAWC;GAAaE;GAAQ,MAAK;GAAU,WAAU;GAClEL;EACG,CAAA,GACN,oBAAC,iBAAD,EAAiB,WAAU,6CAA4C,CAAA,CACzE,EAAA,CAAA;CACJ;AACF;AACAX,cAAYgC,OAAOV"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ButtonDOMProps, ButtonState } from "../../button/index.js";
|
|
2
|
+
import { ReactNode, RefAttributes } from "react";
|
|
3
|
+
import { ClassNameOrFunction, StyleOrFunction } from "react-aria-components";
|
|
3
4
|
//#region src/components/button/index.d.ts
|
|
4
|
-
type ButtonDOMProps = Omit<ButtonProps, 'children' | 'className' | 'style' | GlobalEventKey> & Pick<DOMAttributes<HTMLElement>, GlobalEventKey>;
|
|
5
5
|
type ButtonProps$1 = {
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
/** A function may compute the class from the button's render state. */
|
|
8
8
|
className?: ClassNameOrFunction<ButtonState>;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a toggle starts selected, when it keeps its own state. Passing
|
|
11
|
+
* this, `isSelected` or `onChange` is what makes the button a toggle —
|
|
12
|
+
* except a `text` button, which the page gives no selected colours, so it
|
|
13
|
+
* stays a plain button.
|
|
14
|
+
*/
|
|
15
|
+
defaultSelected?: boolean;
|
|
9
16
|
/**
|
|
10
17
|
* Disables the press ripple. The hover/pressed background state layer is
|
|
11
18
|
* unaffected.
|
|
@@ -16,17 +23,44 @@ type ButtonProps$1 = {
|
|
|
16
23
|
* Where the button leads. Given one, the button is rendered as a link —
|
|
17
24
|
* an `<a>`, announced as the link it is — with the same styles and ripple.
|
|
18
25
|
* `render`, `type`, and the form and pending props apply to the button
|
|
19
|
-
* form only.
|
|
26
|
+
* form only, and a toggle is never a link.
|
|
20
27
|
*/
|
|
21
28
|
href?: string;
|
|
29
|
+
/**
|
|
30
|
+
* An icon before the label, at the page's icon size for the button's size:
|
|
31
|
+
* 20px at `xs` and `md`, 24px at `lg`, 32px at `xl` and 40px at `xxl`. Draw
|
|
32
|
+
* it `1em` square in `currentColor`, as every icon here is, and it follows.
|
|
33
|
+
* Hidden with the label while the button is pending.
|
|
34
|
+
*/
|
|
35
|
+
icon?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Whether a toggle is selected, when the call site holds the state. Pass
|
|
38
|
+
* it with `onChange`; passing this, `defaultSelected` or `onChange` is what
|
|
39
|
+
* makes the button a toggle, `text` excepted.
|
|
40
|
+
*/
|
|
41
|
+
isSelected?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Called with the new state when a toggle is pressed. Passing this,
|
|
44
|
+
* `isSelected` or `defaultSelected` is what makes the button a toggle,
|
|
45
|
+
* `text` excepted.
|
|
46
|
+
*/
|
|
47
|
+
onChange?: (isSelected: boolean) => void;
|
|
22
48
|
/**
|
|
23
49
|
* The name of the ring shown while the button is pending, for a screen
|
|
24
|
-
* reader. The label it replaces is hidden while it shows.
|
|
25
|
-
*
|
|
50
|
+
* reader. The label it replaces is hidden while it shows. Left out, it is
|
|
51
|
+
* the word for it in the I18nProvider's locale — "Loading" in English.
|
|
26
52
|
*/
|
|
27
53
|
pendingLabel?: string;
|
|
28
54
|
/** The link's `rel`, when `href` is set. */
|
|
29
55
|
rel?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The corner the button rests at: `round` is the pill, `square` the
|
|
58
|
+
* page's rounded rectangle, 12px up to `md`, 16px at `lg` and 28px above.
|
|
59
|
+
* Either tightens while pressed, and a toggle trades one for the other
|
|
60
|
+
* once selected.
|
|
61
|
+
* @default 'round'
|
|
62
|
+
*/
|
|
63
|
+
shape?: ButtonShape;
|
|
30
64
|
/**
|
|
31
65
|
* Control height: `xs` 32px, `md` 40px, `lg` 56px, `xl` 96px, `xxl` 136px —
|
|
32
66
|
* the buttons spec page's XS, S, M, L and XL, each with its own inline
|
|
@@ -47,17 +81,27 @@ type ButtonProps$1 = {
|
|
|
47
81
|
*/
|
|
48
82
|
variant?: ButtonVariant;
|
|
49
83
|
} & ButtonDOMProps;
|
|
84
|
+
type ButtonShape = 'round' | 'square';
|
|
50
85
|
type ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';
|
|
51
|
-
type ButtonState = Pick<ButtonRenderProps, 'isDisabled' | 'isFocused' | 'isFocusVisible' | 'isHovered' | 'isPressed'>;
|
|
52
86
|
type ButtonVariant = 'elevated' | 'filled' | 'outlined' | 'text' | 'tonal';
|
|
53
|
-
type GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof ButtonProps, 'onBlur' | 'onClick' | 'onFocus'>;
|
|
54
87
|
/**
|
|
55
|
-
* The design's button, at five emphasis levels and five control heights
|
|
56
|
-
* Given `href` it is a link with the same appearance. Every
|
|
57
|
-
* forwarded to the element; React Aria alone would keep only
|
|
58
|
-
* ones.
|
|
88
|
+
* The design's button, at five emphasis levels and five control heights,
|
|
89
|
+
* round or square. Given `href` it is a link with the same appearance. Every
|
|
90
|
+
* `aria-*` prop is forwarded to the element; React Aria alone would keep only
|
|
91
|
+
* the labelling ones.
|
|
92
|
+
*
|
|
93
|
+
* Given `isSelected`, `defaultSelected` or `onChange` it is a toggle, which
|
|
94
|
+
* reports its state through `aria-pressed` and draws the page's second pair
|
|
95
|
+
* of colour roles for its variant. A toggle takes neither `href` nor the
|
|
96
|
+
* pending props, and a `text` button never toggles.
|
|
97
|
+
*
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <Button defaultSelected variant="tonal">
|
|
100
|
+
* Label
|
|
101
|
+
* </Button>
|
|
102
|
+
* ```
|
|
59
103
|
*/
|
|
60
|
-
declare function Button$1({ children,
|
|
104
|
+
declare function Button$1({ children, defaultSelected, href, icon, isPending, isSelected, onChange, pendingLabel, rel, shape, size, target, variant, ...props }: ButtonProps$1 & RefAttributes<HTMLAnchorElement | HTMLButtonElement>): import("react").JSX.Element;
|
|
61
105
|
//#endregion
|
|
62
|
-
export { type ButtonDOMProps, type ButtonProps$1 as ButtonProps, type ButtonSize, type ButtonState, type ButtonVariant, Button$1 as default };
|
|
106
|
+
export { type ButtonDOMProps, type ButtonProps$1 as ButtonProps, type ButtonShape, type ButtonSize, type ButtonState, type ButtonVariant, Button$1 as default };
|
|
63
107
|
//# sourceMappingURL=index.d.ts.map
|