@kanso-labs/kanso-ui 0.40.8 → 0.41.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.
Files changed (54) hide show
  1. package/dist/color-scheme.d.ts +6 -0
  2. package/dist/color-scheme.js +9 -2
  3. package/dist/color-scheme.js.map +1 -1
  4. package/dist/components/app-bar/index.d.ts +11 -2
  5. package/dist/components/app-bar/index.js +53 -46
  6. package/dist/components/app-bar/index.js.map +1 -1
  7. package/dist/components/avatar/index.d.ts +7 -0
  8. package/dist/components/avatar/index.js.map +1 -1
  9. package/dist/components/badge/index.js +7 -3
  10. package/dist/components/badge/index.js.map +1 -1
  11. package/dist/components/card/index.d.ts +12 -1
  12. package/dist/components/card/index.js +136 -66
  13. package/dist/components/card/index.js.map +1 -1
  14. package/dist/components/dialog/index.js +3 -2
  15. package/dist/components/dialog/index.js.map +1 -1
  16. package/dist/components/popover/index.d.ts +4 -1
  17. package/dist/components/popover/index.js +241 -138
  18. package/dist/components/popover/index.js.map +1 -1
  19. package/dist/components/product-icon/index.d.ts +3 -1
  20. package/dist/components/product-icon/index.js.map +1 -1
  21. package/dist/components/progress-indicator/index.js +1 -1
  22. package/dist/components/progress-indicator/index.js.map +1 -1
  23. package/dist/components/search-field/index.js +7 -3
  24. package/dist/components/search-field/index.js.map +1 -1
  25. package/dist/components/segmented-button/index.d.ts +20 -1
  26. package/dist/components/segmented-button/index.js +253 -114
  27. package/dist/components/segmented-button/index.js.map +1 -1
  28. package/dist/components/separator/index.js +2 -2
  29. package/dist/components/separator/index.js.map +1 -1
  30. package/dist/components/sheet/index.js +17 -16
  31. package/dist/components/sheet/index.js.map +1 -1
  32. package/dist/components/snackbar/index.d.ts +10 -3
  33. package/dist/components/snackbar/index.js +32 -12
  34. package/dist/components/snackbar/index.js.map +1 -1
  35. package/dist/components/switch/index.js +12 -3
  36. package/dist/components/switch/index.js.map +1 -1
  37. package/dist/components/toolbar/index.d.ts +3 -2
  38. package/dist/components/toolbar/index.js +3 -2
  39. package/dist/components/toolbar/index.js.map +1 -1
  40. package/dist/field/index.js +67 -61
  41. package/dist/field/index.js.map +1 -1
  42. package/dist/field/press.js +27 -0
  43. package/dist/field/press.js.map +1 -0
  44. package/dist/mark/initials.js +41 -26
  45. package/dist/mark/initials.js.map +1 -1
  46. package/dist/overlay/index.js +24 -0
  47. package/dist/overlay/index.js.map +1 -0
  48. package/dist/styles/scheme.js +19 -0
  49. package/dist/styles/scheme.js.map +1 -0
  50. package/dist/styles.css +106 -34
  51. package/dist/theme-scope.d.ts +5 -2
  52. package/dist/theme-scope.js +2 -1
  53. package/dist/theme-scope.js.map +1 -1
  54. package/package.json +1 -1
@@ -1,40 +1,55 @@
1
1
  //#region src/mark/initials.ts
2
+ const INITIAL = /^[\p{L}\p{N}\p{Extended_Pictographic}\p{Regional_Indicator}]/u;
3
+ const JOINING = /^[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Mongolian}\p{Script=Nko}\p{Script=Adlam}\p{Script=Mandaic}\p{Script=Manichaean}\p{Script=Psalter_Pahlavi}\p{Script=Hanifi_Rohingya}\p{Script=Sogdian}\p{Script=Old_Uyghur}]/u;
4
+ const ZERO_WIDTH_NON_JOINER = "‌";
5
+ const TITLE = /^\p{L}{2,4}\.$/u;
6
+ const SUFFIX = /^(?:jr|sr|ii|iii|iv|\d+(?:st|nd|rd|th))\.?,?$/iu;
7
+ const TRAILING_ASIDE = /\s*[([{][^)\]}]*[)\]}]\s*$/u;
8
+ const segmenters = /* @__PURE__ */ new Map();
9
+ function graphemesOf(text, locale) {
10
+ let segmenter = segmenters.get(locale);
11
+ if (segmenter === void 0) {
12
+ segmenter = new Intl.Segmenter(locale, { granularity: "grapheme" });
13
+ segmenters.set(locale, segmenter);
14
+ }
15
+ return Array.from(segmenter.segment(text), ({ segment }) => segment);
16
+ }
17
+ /**
18
+ * The character that stands for `word`: its first grapheme that is a letter,
19
+ * a number or a picture, or its first grapheme where it has none of those,
20
+ * so something always shows. Upper-cased in the locale, and then one
21
+ * grapheme of that, since upper-casing can lengthen it: "ß" is "SS".
22
+ */
23
+ function initialOf(word, locale) {
24
+ const graphemes = graphemesOf(word, locale);
25
+ return graphemesOf((graphemes.find((grapheme) => INITIAL.test(grapheme)) ?? graphemes.at(0) ?? "").toLocaleUpperCase(locale), locale).at(0) ?? "";
26
+ }
2
27
  /**
3
28
  * One letter, where a person takes two. A person has a first name and a last
4
29
  * name to initialise; a thing usually has neither, so the same rule applied
5
30
  * to "Second Item" would produce "SI" — a pair of initials for something that
6
- * was never two words in that sense. Array.from rather than indexing, so a
7
- * name starting outside the Basic Multilingual Plane yields its whole first
8
- * character instead of half a surrogate pair.
31
+ * was never two words in that sense.
9
32
  */
10
- function initialOfThing(name) {
11
- const trimmed = name.trim();
12
- return (Array.from(trimmed)[0] ?? "").toLocaleUpperCase();
33
+ function initialOfThing(name, locale) {
34
+ return initialOf(name.trim(), locale);
13
35
  }
14
36
  /**
15
- * The first character of the first and last word, which handles both "Ada"
16
- * and "Ada Lovelace" without a separate prop for how many to take.
17
- *
18
- * A character is a grapheme, what a reader sees as one, rather than a code
19
- * point: a code point drops an accent written as a combining mark, splits an
20
- * Indic conjunct and cuts a flag or a joined emoji in half. And it is
21
- * upper-cased in the reader's locale, which is what turns a Turkish "i" into
22
- * "İ" rather than "I".
37
+ * The initials of the first and the last word, which handles both "Ada" and
38
+ * "Ada Lovelace" without a separate prop for how many to take. What a
39
+ * display name carries around the name itself is left out first: a title
40
+ * before it, a generational suffix after it, and an aside in brackets at its
41
+ * end. A name written without spaces between its words — Japanese, Chinese —
42
+ * is one word to this, and takes one initial.
23
43
  */
24
44
  function initialsOfPerson(name, locale) {
25
- const words = name.split(/\s+/u).filter(Boolean);
45
+ let words = name.replace(TRAILING_ASIDE, "").split(/\s+/u).filter(Boolean);
46
+ if (words.length > 1 && TITLE.test(words[0] ?? "")) words = words.slice(1);
47
+ if (words.length > 1 && SUFFIX.test(words.at(-1) ?? "")) words = words.slice(0, -1);
26
48
  if (words.length === 0) return "";
27
- return `${firstGrapheme(words[0] ?? "", locale)}${words.length > 1 ? firstGrapheme(words.at(-1) ?? "", locale) : ""}`.toLocaleUpperCase(locale);
28
- }
29
- const segmenters = /* @__PURE__ */ new Map();
30
- function firstGrapheme(word, locale) {
31
- let segmenter = segmenters.get(locale);
32
- if (segmenter === void 0) {
33
- segmenter = new Intl.Segmenter(locale, { granularity: "grapheme" });
34
- segmenters.set(locale, segmenter);
35
- }
36
- for (const { segment } of segmenter.segment(word)) return segment;
37
- return "";
49
+ const first = initialOf(words[0] ?? "", locale);
50
+ if (words.length === 1) return first;
51
+ const last = initialOf(words.at(-1) ?? "", locale);
52
+ return `${first}${JOINING.test(first) && JOINING.test(last) ? ZERO_WIDTH_NON_JOINER : ""}${last}`;
38
53
  }
39
54
  //#endregion
40
55
  export { initialOfThing, initialsOfPerson };
@@ -1 +1 @@
1
- {"version":3,"file":"initials.js","names":["initialOfThing","name","trimmed","trim","Array","from","toLocaleUpperCase","initialsOfPerson","locale","words","split","filter","Boolean","length","first","firstGrapheme","last","at","segmenters","Map","Intl","Segmenter","word","segmenter","get","undefined","granularity","set","segment"],"sources":["../../src/mark/initials.ts"],"sourcesContent":["// What a mark shows while it has no image: two initials for a person, one for\n// anything else. Beside the mark rather than inside `./index.tsx`, which\n// exports components alone so fast refresh keeps working for it.\n\n/**\n * One letter, where a person takes two. A person has a first name and a last\n * name to initialise; a thing usually has neither, so the same rule applied\n * to \"Second Item\" would produce \"SI\" — a pair of initials for something that\n * was never two words in that sense. Array.from rather than indexing, so a\n * name starting outside the Basic Multilingual Plane yields its whole first\n * character instead of half a surrogate pair.\n */\nfunction initialOfThing(name: string) {\n const trimmed = name.trim()\n return (Array.from(trimmed)[0] ?? '').toLocaleUpperCase()\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\".\n */\nfunction initialsOfPerson(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}\n\nconst segmenters = new Map<string, Intl.Segmenter>()\n\nfunction firstGrapheme(word: string, locale: string) {\n let segmenter = segmenters.get(locale)\n if (segmenter === undefined) {\n segmenter = new Intl.Segmenter(locale, { granularity: 'grapheme' })\n segmenters.set(locale, segmenter)\n }\n for (const { segment } of segmenter.segment(word)) {\n return segment\n }\n return ''\n}\n\nexport { initialOfThing, initialsOfPerson }\n"],"mappings":";;;;;;;;;AAYA,SAASA,eAAeC,MAAc;CACpC,MAAMC,UAAUD,KAAKE,KAAK;CAC1B,QAAQC,MAAMC,KAAKH,OAAO,CAAC,CAAC,MAAM,GAAA,CAAII,kBAAkB;AAC1D;;;;;;;;;;;AAYA,SAASC,iBAAiBN,MAAcO,QAAgB;CACtD,MAAMC,QAAQR,KAAKS,MAAM,MAAM,CAAC,CAACC,OAAOC,OAAO;CAC/C,IAAIH,MAAMI,WAAW,GACnB,OAAO;CAIT,OAAO,GAFOE,cAAcN,MAAM,MAAM,IAAID,MAElCM,IADGL,MAAMI,SAAS,IAAIE,cAAcN,MAAMQ,GAAG,EAAE,KAAK,IAAIT,MAAM,IAAI,KACnDF,kBAAkBE,MAAM;AACnD;AAEA,MAAMU,6BAAa,IAAIC,IAA4B;AAEnD,SAASJ,cAAcO,MAAcd,QAAgB;CACnD,IAAIe,YAAYL,WAAWM,IAAIhB,MAAM;CACrC,IAAIe,cAAcE,KAAAA,GAAW;EAC3BF,YAAY,IAAIH,KAAKC,UAAUb,QAAQ,EAAEkB,aAAa,WAAW,CAAC;EAClER,WAAWS,IAAInB,QAAQe,SAAS;CAClC;CACA,KAAK,MAAM,EAAEK,aAAaL,UAAUK,QAAQN,IAAI,GAC9C,OAAOM;CAET,OAAO;AACT"}
1
+ {"version":3,"file":"initials.js","names":["INITIAL","JOINING","ZERO_WIDTH_NON_JOINER","TITLE","SUFFIX","TRAILING_ASIDE","segmenters","Map","Intl","Segmenter","graphemesOf","text","locale","segmenter","get","undefined","granularity","set","Array","from","segment","initialOf","word","graphemes","chosen","find","grapheme","test","at","toLocaleUpperCase","initialOfThing","name","trim","initialsOfPerson","words","replace","split","filter","Boolean","length","slice","first","last","between"],"sources":["../../src/mark/initials.ts"],"sourcesContent":["// What a mark shows while it has no image: two initials for a person, one for\n// anything else. Beside the mark rather than inside `./index.tsx`, which\n// exports components alone so fast refresh keeps working for it.\n//\n// Both take the same rule for which character stands for a word, in\n// `initialOf`, and both work in graphemes — what a reader sees as one\n// character — in the reader's locale. A code point drops an accent written\n// as a combining mark, splits an Indic conjunct and cuts a flag or a joined\n// emoji in half; upper-casing without the locale turns a Turkish \"i\" into\n// \"I\" rather than \"İ\".\n\n// What a word's initial can be: a letter, a number, or a picture — an emoji,\n// or a flag, which is a pair of regional indicators. A word opening with\n// anything else — a bracket, a quote, the @ of a handle, the # of a channel\n// — is initialised by the first of these inside it.\nconst INITIAL = /^[\\p{L}\\p{N}\\p{Extended_Pictographic}\\p{Regional_Indicator}]/u\n\n// The scripts whose letters join to the next one. Two initials in one of\n// them, written side by side, shape into a single connected word rather than\n// two letters, so a zero-width non-joiner goes between them.\nconst JOINING =\n /^[\\p{Script=Arabic}\\p{Script=Syriac}\\p{Script=Mongolian}\\p{Script=Nko}\\p{Script=Adlam}\\p{Script=Mandaic}\\p{Script=Manichaean}\\p{Script=Psalter_Pahlavi}\\p{Script=Hanifi_Rohingya}\\p{Script=Sogdian}\\p{Script=Old_Uyghur}]/u\n\nconst ZERO_WIDTH_NON_JOINER = '‌'\n\n// A title before a name — \"Dr.\", \"Mrs.\", \"Prof.\" — which is not one of its\n// words. Two letters at least, so a first initial written \"J.\" is kept.\nconst TITLE = /^\\p{L}{2,4}\\.$/u\n\n// A generational suffix after a name — \"Jr.\", \"Sr\", \"III\", \"3rd\" — which is\n// not its last word either. The numerals are the generational ones only, so\n// a surname that reads as a numeral, \"Xi\" say, is kept.\nconst SUFFIX = /^(?:jr|sr|ii|iii|iv|\\d+(?:st|nd|rd|th))\\.?,?$/iu\n\n// Something said about the name rather than part of it, in brackets at its\n// end: \"(she/her)\", \"[away]\".\nconst TRAILING_ASIDE = /\\s*[([{][^)\\]}]*[)\\]}]\\s*$/u\n\nconst segmenters = new Map<string, Intl.Segmenter>()\n\nfunction graphemesOf(text: string, locale: string) {\n let segmenter = segmenters.get(locale)\n if (segmenter === undefined) {\n segmenter = new Intl.Segmenter(locale, { granularity: 'grapheme' })\n segmenters.set(locale, segmenter)\n }\n return Array.from(segmenter.segment(text), ({ segment }) => segment)\n}\n\n/**\n * The character that stands for `word`: its first grapheme that is a letter,\n * a number or a picture, or its first grapheme where it has none of those,\n * so something always shows. Upper-cased in the locale, and then one\n * grapheme of that, since upper-casing can lengthen it: \"ß\" is \"SS\".\n */\nfunction initialOf(word: string, locale: string) {\n const graphemes = graphemesOf(word, locale)\n const chosen =\n graphemes.find((grapheme) => INITIAL.test(grapheme)) ??\n graphemes.at(0) ??\n ''\n return graphemesOf(chosen.toLocaleUpperCase(locale), locale).at(0) ?? ''\n}\n\n/**\n * One letter, where a person takes two. A person has a first name and a last\n * name to initialise; a thing usually has neither, so the same rule applied\n * to \"Second Item\" would produce \"SI\" — a pair of initials for something that\n * was never two words in that sense.\n */\nfunction initialOfThing(name: string, locale: string) {\n return initialOf(name.trim(), locale)\n}\n\n/**\n * The initials of the first and the last word, which handles both \"Ada\" and\n * \"Ada Lovelace\" without a separate prop for how many to take. What a\n * display name carries around the name itself is left out first: a title\n * before it, a generational suffix after it, and an aside in brackets at its\n * end. A name written without spaces between its words — Japanese, Chinese —\n * is one word to this, and takes one initial.\n */\nfunction initialsOfPerson(name: string, locale: string) {\n let words = name.replace(TRAILING_ASIDE, '').split(/\\s+/u).filter(Boolean)\n if (words.length > 1 && TITLE.test(words[0] ?? '')) {\n words = words.slice(1)\n }\n if (words.length > 1 && SUFFIX.test(words.at(-1) ?? '')) {\n words = words.slice(0, -1)\n }\n if (words.length === 0) {\n return ''\n }\n const first = initialOf(words[0] ?? '', locale)\n if (words.length === 1) {\n return first\n }\n const last = initialOf(words.at(-1) ?? '', locale)\n const between =\n JOINING.test(first) && JOINING.test(last) ? ZERO_WIDTH_NON_JOINER : ''\n return `${first}${between}${last}`\n}\n\nexport { initialOfThing, initialsOfPerson }\n"],"mappings":";AAeA,MAAMA,UAAU;AAKhB,MAAMC,UACJ;AAEF,MAAMC,wBAAwB;AAI9B,MAAMC,QAAQ;AAKd,MAAMC,SAAS;AAIf,MAAMC,iBAAiB;AAEvB,MAAMC,6BAAa,IAAIC,IAA4B;AAEnD,SAASG,YAAYC,MAAcC,QAAgB;CACjD,IAAIC,YAAYP,WAAWQ,IAAIF,MAAM;CACrC,IAAIC,cAAcE,KAAAA,GAAW;EAC3BF,YAAY,IAAIL,KAAKC,UAAUG,QAAQ,EAAEI,aAAa,WAAW,CAAC;EAClEV,WAAWW,IAAIL,QAAQC,SAAS;CAClC;CACA,OAAOK,MAAMC,KAAKN,UAAUO,QAAQT,IAAI,IAAI,EAAES,cAAcA,OAAO;AACrE;;;;;;;AAQA,SAASC,UAAUC,MAAcV,QAAgB;CAC/C,MAAMW,YAAYb,YAAYY,MAAMV,MAAM;CAK1C,OAAOF,aAHLa,UAAUE,MAAMC,aAAa1B,QAAQ2B,KAAKD,QAAQ,CAAC,KACnDH,UAAUK,GAAG,CAAC,KACd,GAAA,CACwBC,kBAAkBjB,MAAM,GAAGA,MAAM,CAAC,CAACgB,GAAG,CAAC,KAAK;AACxE;;;;;;;AAQA,SAASE,eAAeC,MAAcnB,QAAgB;CACpD,OAAOS,UAAUU,KAAKC,KAAK,GAAGpB,MAAM;AACtC;;;;;;;;;AAUA,SAASqB,iBAAiBF,MAAcnB,QAAgB;CACtD,IAAIsB,QAAQH,KAAKI,QAAQ9B,gBAAgB,EAAE,CAAC,CAAC+B,MAAM,MAAM,CAAC,CAACC,OAAOC,OAAO;CACzE,IAAIJ,MAAMK,SAAS,KAAKpC,MAAMwB,KAAKO,MAAM,MAAM,EAAE,GAC/CA,QAAQA,MAAMM,MAAM,CAAC;CAEvB,IAAIN,MAAMK,SAAS,KAAKnC,OAAOuB,KAAKO,MAAMN,GAAG,EAAE,KAAK,EAAE,GACpDM,QAAQA,MAAMM,MAAM,GAAG,EAAE;CAE3B,IAAIN,MAAMK,WAAW,GACnB,OAAO;CAET,MAAME,QAAQpB,UAAUa,MAAM,MAAM,IAAItB,MAAM;CAC9C,IAAIsB,MAAMK,WAAW,GACnB,OAAOE;CAET,MAAMC,OAAOrB,UAAUa,MAAMN,GAAG,EAAE,KAAK,IAAIhB,MAAM;CAGjD,OAAO,GAAG6B,QADRxC,QAAQ0B,KAAKc,KAAK,KAAKxC,QAAQ0B,KAAKe,IAAI,IAAIxC,wBAAwB,KAC1CwC;AAC9B"}
@@ -0,0 +1,24 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { SeparatorContext } from "react-aria-components";
4
+ //#region src/overlay/index.tsx
5
+ const NO_SEPARATOR = {};
6
+ /** Clears, for an overlay's content, the contexts that reach it from outside. */
7
+ function OverlayScope(t0) {
8
+ const $ = c(2);
9
+ const { children } = t0;
10
+ let t1;
11
+ if ($[0] !== children) {
12
+ t1 = /* @__PURE__ */ jsx(SeparatorContext, {
13
+ value: NO_SEPARATOR,
14
+ children
15
+ });
16
+ $[0] = children;
17
+ $[1] = t1;
18
+ } else t1 = $[1];
19
+ return t1;
20
+ }
21
+ //#endregion
22
+ export { OverlayScope };
23
+
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ReactNode","SeparatorContext","NO_SEPARATOR","OverlayScope","t0","$","_c","children","t1","_c"],"sources":["../../src/overlay/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { SeparatorContext } from 'react-aria-components'\n\n// React context crosses the portal an overlay renders through, so what a\n// component around the trigger sets for its own children reaches into the\n// overlay as well. `Toolbar` sets the one that matters: it turns a\n// `Separator` across the bar, and a horizontal rule in a popover opened from\n// the bar took that orientation and drew as a vertical rule 0px long, told\n// to assistive technology as vertical too. An overlay is a surface of its\n// own, so its content starts from none of it, and a `Separator` there falls\n// back to its own horizontal default — as one inside React Aria's `Menu`\n// already did, since `Menu` provides a separator context of its own.\n//\n// Empty rather than null, so the separator reads no props from it rather\n// than finding no context and looking further out; a module constant, so the\n// value is the same object on every render.\nconst NO_SEPARATOR = {}\n\n/** Clears, for an overlay's content, the contexts that reach it from outside. */\nfunction OverlayScope({ children }: { children: ReactNode }) {\n return <SeparatorContext value={NO_SEPARATOR}>{children}</SeparatorContext>\n}\n\nexport { OverlayScope }\n"],"mappings":";;;;AAiBA,MAAME,eAAe,CAAC;;AAGtB,SAAAC,aAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAsB,MAAA,EAAAC,aAAAH;CAAqC,IAAAI;CAAA,IAAAH,EAAA,OAAAE,UAAA;EAClDC,KAAA,oBAAC,kBAAD;GAAyBN,OAAAA;GAAeK;EAAvB,CAAA;EAAmDF,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAApEG;AAAoE"}
@@ -0,0 +1,19 @@
1
+ //#region src/styles/scheme.ts
2
+ const pinnedScheme = {
3
+ dark: {
4
+ kWkggS: "x14s9m32",
5
+ kMwMTN: "x139gbkf",
6
+ kQNsl9: "xntwwlm",
7
+ $$css: true
8
+ },
9
+ light: {
10
+ kWkggS: "x14s9m32",
11
+ kMwMTN: "x139gbkf",
12
+ kQNsl9: "x19aimcq",
13
+ $$css: true
14
+ }
15
+ };
16
+ //#endregion
17
+ export { pinnedScheme };
18
+
19
+ //# sourceMappingURL=scheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheme.js","names":["stylex","colors","pinnedScheme","dark","kWkggS","kMwMTN","kQNsl9","$$css","light"],"sources":["../../src/styles/scheme.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors } from '../tokens/design.tokens.stylex';\n\n// What pinning a scheme does beside the colour theme that pins the tokens:\n// the element paints its own surface and text in that scheme, and tells the\n// browser the scheme, which is what native controls, scrollbars, autofill\n// and spellcheck follow — they read `color-scheme` rather than any token.\n//\n// A theme pins the tokens alone. A pinned dark scope on a light page left\n// its own background transparent and its text the page's, so a `Text`\n// inside drew the dark scheme's on surface over the light page, 1.23:1, and\n// an `<input>` inside stayed white with black text.\n//\n// Surface and on surface rather than background and on background: the two\n// pairs hold the same colours in both of the library's schemes, and surface\n// is the pair Material Design draws content on. Shared by `ThemeScope` and\n// the `colorScheme` classes in src/color-scheme.ts, which are the same\n// classes in two forms; an unpinned scope applies neither, so it paints\n// nothing and inherits the scheme around it.\nconst pinnedScheme = {\n dark: {\n kWkggS: \"x14s9m32\",\n kMwMTN: \"x139gbkf\",\n kQNsl9: \"xntwwlm\",\n $$css: true\n },\n light: {\n kWkggS: \"x14s9m32\",\n kMwMTN: \"x139gbkf\",\n kQNsl9: \"x19aimcq\",\n $$css: true\n }\n};\nexport { pinnedScheme };"],"mappings":";AAoBA,MAAME,eAAe;CACnBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,OAAO;EACLJ,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;AACF"}
package/dist/styles.css CHANGED
@@ -55,6 +55,10 @@
55
55
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
56
56
  }
57
57
 
58
+ .x1y3ic1l {
59
+ border-color: color-mix(in srgb,var(--x1ridy1o) calc(var(--x1cq03z9) * 100%),transparent);
60
+ }
61
+
58
62
  .xrh88j3 {
59
63
  border-color: color-mix(in srgb,var(--xn0syi6) calc(var(--x1cq03z9) * 100%),transparent);
60
64
  }
@@ -633,6 +637,10 @@
633
637
  animation-name: x17cjob-B;
634
638
  }
635
639
 
640
+ .xz09zy6 {
641
+ animation-name: x17j028-B, x26nhu8-B;
642
+ }
643
+
636
644
  .x1sz9pa8 {
637
645
  animation-name: x18qdip-B, x1b9nlqo-B;
638
646
  }
@@ -661,10 +669,6 @@
661
669
  animation-name: x1pch1fy-B;
662
670
  }
663
671
 
664
- .x14p4i3i {
665
- animation-name: x1t81ys1-B, x26nhu8-B;
666
- }
667
-
668
672
  .xhpbw76 {
669
673
  animation-name: x1uknk9t-B;
670
674
  }
@@ -753,6 +757,10 @@
753
757
  background-color: color-mix(in srgb,var(--x13o0mym) calc(var(--x1cq03z9) * 100%),transparent);
754
758
  }
755
759
 
760
+ .x6mg230 {
761
+ background-color: color-mix(in srgb,var(--x13o0mym) calc(var(--xu361ij) * 100%),transparent);
762
+ }
763
+
756
764
  .xn4e5mw {
757
765
  background-color: color-mix(in srgb,var(--x1balm44) calc(var(--x124j18r) * 100%),var(--x1614qkl));
758
766
  }
@@ -869,6 +877,10 @@
869
877
  background-color: color-mix(in srgb,var(--x28n2pw) calc(var(--xhaltwz) * 100%),var(--x3cqee7));
870
878
  }
871
879
 
880
+ .x1jfv5e4 {
881
+ background-color: color-mix(in srgb,var(--xi1exwt) calc(var(--xu361ij) * 100%),transparent);
882
+ }
883
+
872
884
  .x16tkg7c {
873
885
  background-color: color-mix(in srgb,var(--xkltk4j) calc(var(--x124j18r) * 100%),var(--x189y34t));
874
886
  }
@@ -1265,6 +1277,10 @@
1265
1277
  box-shadow: inset 0 -2px 0 0 var(--x1cjupv7);
1266
1278
  }
1267
1279
 
1280
+ .x19irva8 {
1281
+ box-shadow: inset 0 0 0 1px var(--x12p1wyw);
1282
+ }
1283
+
1268
1284
  .xbd69nm {
1269
1285
  box-shadow: inset 0 0 0 1px var(--x7dbk6n);
1270
1286
  }
@@ -1417,6 +1433,18 @@
1417
1433
  color: var(--xwloagh);
1418
1434
  }
1419
1435
 
1436
+ .xntwwlm {
1437
+ --lightningcss-light: ;
1438
+ --lightningcss-dark: initial;
1439
+ color-scheme: dark;
1440
+ }
1441
+
1442
+ .x19aimcq {
1443
+ --lightningcss-light: initial;
1444
+ --lightningcss-dark: ;
1445
+ color-scheme: light;
1446
+ }
1447
+
1420
1448
  .xpamuu5 {
1421
1449
  column-gap: var(--x3km7fe);
1422
1450
  }
@@ -1521,6 +1549,10 @@
1521
1549
  flex-basis: 0;
1522
1550
  }
1523
1551
 
1552
+ .x4pfjvb {
1553
+ flex-basis: 50%;
1554
+ }
1555
+
1524
1556
  .xdl72j9 {
1525
1557
  flex-basis: auto;
1526
1558
  }
@@ -1937,10 +1969,6 @@
1937
1969
  inset-inline-start: var(--x-insetInlineStart);
1938
1970
  }
1939
1971
 
1940
- .x2xyl1b {
1941
- inset-inline-start: var(--x6borv4);
1942
- }
1943
-
1944
1972
  .xc8icb0 {
1945
1973
  isolation: isolate;
1946
1974
  }
@@ -2113,10 +2141,6 @@
2113
2141
  list-style-type: none;
2114
2142
  }
2115
2143
 
2116
- .x14z9mp {
2117
- margin-inline-end: 0;
2118
- }
2119
-
2120
2144
  .xk4mfur {
2121
2145
  margin-inline-end: calc(-1 * var(--x3km7fe));
2122
2146
  }
@@ -2125,10 +2149,6 @@
2125
2149
  margin-inline-end: calc(-1 * var(--xod9tvo));
2126
2150
  }
2127
2151
 
2128
- .x184gv5z {
2129
- margin-inline-end: calc((18px + var(--xod9tvo)) / 2);
2130
- }
2131
-
2132
2152
  .x1tn5xpv {
2133
2153
  margin-inline-end: calc(var(--x6borv4) - var(--x3km7fe));
2134
2154
  }
@@ -2141,6 +2161,10 @@
2141
2161
  margin-inline-end: var(--xbmbo34);
2142
2162
  }
2143
2163
 
2164
+ .x1nsf9p3 {
2165
+ margin-inline-end: var(--xod9tvo);
2166
+ }
2167
+
2144
2168
  .x18xomjl {
2145
2169
  margin-inline-start: -12px;
2146
2170
  }
@@ -2153,14 +2177,6 @@
2153
2177
  margin-inline-start: calc(-1 * var(--xod9tvo));
2154
2178
  }
2155
2179
 
2156
- .x1mjqfaz {
2157
- margin-inline-start: calc((18px + var(--xod9tvo)) / 2);
2158
- }
2159
-
2160
- .x1c5lys2 {
2161
- margin-inline-start: calc(18px + var(--xod9tvo));
2162
- }
2163
-
2164
2180
  .x1m7rnnc {
2165
2181
  margin-inline-start: var(--x3km7fe);
2166
2182
  }
@@ -2218,6 +2234,10 @@
2218
2234
  outline-offset: -2px;
2219
2235
  }
2220
2236
 
2237
+ .xr2mjdv {
2238
+ outline-offset: -4px;
2239
+ }
2240
+
2221
2241
  .x1y3gkto {
2222
2242
  outline-offset: 1px;
2223
2243
  }
@@ -2494,10 +2514,6 @@
2494
2514
  transform: scaleX(-1);
2495
2515
  }
2496
2516
 
2497
- .xmzmy3r {
2498
- transform: translate3d(0, -50%, 0);
2499
- }
2500
-
2501
2517
  .xuuh30 {
2502
2518
  transform: translateX(-50%);
2503
2519
  }
@@ -2646,6 +2662,14 @@
2646
2662
  transition-property: inline-size, block-size;
2647
2663
  }
2648
2664
 
2665
+ .x1gcwfje {
2666
+ transition-property: inline-size, margin-inline-end;
2667
+ }
2668
+
2669
+ .x1pha8k4 {
2670
+ transition-property: inline-size, min-inline-size;
2671
+ }
2672
+
2649
2673
  .x7x1mir {
2650
2674
  transition-property: inline-size, opacity;
2651
2675
  }
@@ -2658,8 +2682,8 @@
2658
2682
  transition-property: inset-inline-start;
2659
2683
  }
2660
2684
 
2661
- .x1ve1rmq {
2662
- transition-property: margin-inline-start, margin-inline-end;
2685
+ .xrtqwew {
2686
+ transition-property: max-inline-size;
2663
2687
  }
2664
2688
 
2665
2689
  .x13b0p5u {
@@ -2760,6 +2784,10 @@
2760
2784
  z-index: 1;
2761
2785
  }
2762
2786
 
2787
+ .xfj7q76 {
2788
+ z-index: 10;
2789
+ }
2790
+
2763
2791
  .x1bk8fjm {
2764
2792
  z-index: 1000;
2765
2793
  }
@@ -2776,6 +2804,10 @@
2776
2804
  box-shadow: inset 0 -2px 0 0 var(--x1cjupv7);
2777
2805
  }
2778
2806
 
2807
+ .x1bll8u6:focus-within {
2808
+ box-shadow: inset 0 0 0 2px var(--x12p1wyw);
2809
+ }
2810
+
2779
2811
  .x19i8hm1:focus-within {
2780
2812
  box-shadow: inset 0 0 0 2px var(--x1cjupv7);
2781
2813
  }
@@ -3616,6 +3648,10 @@
3616
3648
  max-width: 720px;
3617
3649
  }
3618
3650
 
3651
+ .x1tpxo8 {
3652
+ max-width: calc(100% - calc(18px + var(--xod9tvo)));
3653
+ }
3654
+
3619
3655
  .x35j8wb {
3620
3656
  max-width: calc(100% + 2 * var(--xbmbo34));
3621
3657
  }
@@ -3748,6 +3784,10 @@
3748
3784
  min-width: 16px;
3749
3785
  }
3750
3786
 
3787
+ .x16xo4sp {
3788
+ min-width: 18px;
3789
+ }
3790
+
3751
3791
  .x12rczxh {
3752
3792
  min-width: 220px;
3753
3793
  }
@@ -3772,6 +3812,10 @@
3772
3812
  min-width: 72px;
3773
3813
  }
3774
3814
 
3815
+ .x36sgg7 {
3816
+ min-width: calc(18px + var(--xod9tvo));
3817
+ }
3818
+
3775
3819
  .xjrddbv {
3776
3820
  min-width: min(360px, 100%);
3777
3821
  }
@@ -4034,10 +4078,34 @@
4034
4078
  width: calc(100% - 2 * var(--x1ug6acx));
4035
4079
  }
4036
4080
 
4081
+ .x1n0idw {
4082
+ width: calc(100% - var(--x3km7fe) - var(--x3km7fe));
4083
+ }
4084
+
4085
+ .x1u7osep {
4086
+ width: calc(100% - var(--x3km7fe));
4087
+ }
4088
+
4037
4089
  .x1url4ad {
4038
4090
  width: 336px;
4039
4091
  }
4040
4092
 
4093
+ .x1iuy3mw {
4094
+ width: calc(calc(var(--x6borv4) - var(--xod9tvo)) + 18px);
4095
+ }
4096
+
4097
+ .x154zo0h {
4098
+ width: calc(calc(var(--x6borv4) - var(--xod9tvo)) + calc((18px + var(--xod9tvo)) / 2));
4099
+ }
4100
+
4101
+ .x1n85vuq {
4102
+ width: calc(calc(var(--x6borv4) - var(--xod9tvo)) + calc(18px + var(--xod9tvo)));
4103
+ }
4104
+
4105
+ .xbraz1g {
4106
+ width: calc(var(--x6borv4) - var(--xod9tvo));
4107
+ }
4108
+
4041
4109
  .xd4ksm1 {
4042
4110
  width: clamp(360px,var(--trigger-width),720px);
4043
4111
  }
@@ -4718,6 +4786,10 @@
4718
4786
  content: "";
4719
4787
  }
4720
4788
 
4789
+ .xvss7es:before {
4790
+ content: attr(data-count);
4791
+ }
4792
+
4721
4793
  .x1hcrkkg::-webkit-search-cancel-button {
4722
4794
  display: none;
4723
4795
  }
@@ -4991,17 +5063,17 @@
4991
5063
  }
4992
5064
  }
4993
5065
 
4994
- @keyframes x1t81ys1-B {
5066
+ @keyframes x17j028-B {
4995
5067
  0% {
4996
- stroke-dasharray: 8 100;
5068
+ stroke-dasharray: 8 92;
4997
5069
  }
4998
5070
 
4999
5071
  50% {
5000
- stroke-dasharray: 75 100;
5072
+ stroke-dasharray: 75 25;
5001
5073
  }
5002
5074
 
5003
5075
  100% {
5004
- stroke-dasharray: 8 100;
5076
+ stroke-dasharray: 8 92;
5005
5077
  }
5006
5078
  }
5007
5079
 
@@ -3,8 +3,11 @@ import { RenderComponentProps } from "./render/useRender.js";
3
3
  type ThemeScopeProps = RenderComponentProps<'div'> & {
4
4
  /**
5
5
  * Pins the scope to the library's light or dark scheme, whatever the
6
- * reader's OS asks for. Left unset, the scope keeps the scheme around it:
7
- * the one an enclosing scope or the `<html>` element pins, or the OS's.
6
+ * reader's OS asks for. A pinned scope paints its own surface and text in
7
+ * that scheme and sets `color-scheme` for the native controls inside, so
8
+ * it reads on any page. Left unset, the scope paints nothing and keeps the
9
+ * scheme around it: the one an enclosing scope or the `<html>` element
10
+ * pins, or the OS's.
8
11
  */
9
12
  scheme?: 'dark' | 'light' | undefined;
10
13
  };
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { props } from "./node_modules/@stylexjs/stylex/lib/es/stylex.js";
3
3
  import { colorDefaultsDarkTheme, colorDefaultsLightTheme, tokenScope } from "./tokens/design.tokens.stylex.js";
4
+ import { pinnedScheme } from "./styles/scheme.js";
4
5
  import { useRender } from "./render/useRender.js";
5
6
  import { mergeStyles } from "./styles/merge.js";
6
7
  import { c } from "react/compiler-runtime";
@@ -54,7 +55,7 @@ function ThemeScope(t0) {
54
55
  } else t1 = $[1];
55
56
  const getContainer = t1;
56
57
  const t2 = "div";
57
- const t3 = mergeStyles(props(styles.root, tokenScope, scheme !== void 0 && schemes[scheme]), props$1);
58
+ const t3 = mergeStyles(props(styles.root, tokenScope, scheme !== void 0 && schemes[scheme], scheme !== void 0 && pinnedScheme[scheme]), props$1);
58
59
  let t4;
59
60
  if ($[2] !== children || $[3] !== getContainer) {
60
61
  t4 = /* @__PURE__ */ jsx(UNSAFE_PortalProvider, {
@@ -1 +1 @@
1
- {"version":3,"file":"theme-scope.js","names":["c","_c","stylex","useCallback","useState","UNSAFE_PortalProvider","PortalProvider","RenderComponentProps","useRender","mergeStyles","colorDefaultsDarkTheme","colorDefaultsLightTheme","tokenScope","styles","root","kB7OPa","$$css","schemes","dark","light","ThemeScopeProps","scheme","ThemeScope","t0","$","children","render","props","container","setContainer","t1","getContainer","t2","t3","undefined","t4","t5","t6","t7","t8","defaultTagName","_c","props","stylex.props","PortalProvider"],"sources":["../src/theme-scope.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { useCallback, useState } from 'react';\nimport { UNSAFE_PortalProvider as PortalProvider } from 'react-aria/PortalProvider';\nimport type { RenderComponentProps } from './render/useRender';\nimport { useRender } from './render/useRender';\nimport { mergeStyles } from './styles/merge';\nimport { colorDefaultsDarkTheme, colorDefaultsLightTheme, tokenScope } from './tokens/design.tokens.stylex';\n\n// The component form of `themeScope` and `colorScheme` in ./color-scheme.ts:\n// the same classes, on an element of its own, plus the one thing a class\n// cannot do — take the overlays along.\n//\n// React Aria portals every overlay to the end of `<body>` unless a portal\n// provider names another container, so a popover, a sheet, a tooltip or a\n// toast opened inside a themed element renders outside it, and keeps the\n// tokens of the page. The container here is the scope's own last child,\n// which is what makes the overlays inherit whatever the scope inherits: its\n// scheme, and the `--kui-*` overrides declared on it or on any element around\n// it. A container appended to the body and given the scope's classes would\n// carry the classes alone, losing every override declared above the scope.\n//\n// `display: contents` keeps that container out of the layout, so a scope\n// that is a grid or a flex container gains no item and no gap from it. React\n// Aria positions an overlay against the overlay's own containing block rather\n// than the container's box, so a container with no box of its own changes\n// nothing about where a popover lands.\nconst styles = {\n root: {\n kB7OPa: \"x9f619\",\n $$css: true\n }\n};\nconst schemes = {\n dark: colorDefaultsDarkTheme,\n light: colorDefaultsLightTheme\n};\ntype ThemeScopeProps = RenderComponentProps<'div'> & {\n /**\n * Pins the scope to the library's light or dark scheme, whatever the\n * reader's OS asks for. Left unset, the scope keeps the scheme around it:\n * the one an enclosing scope or the `<html>` element pins, or the OS's.\n */\n scheme?: 'dark' | 'light' | undefined;\n};\n\n/**\n * Themes what is inside it, overlays included.\n *\n * A `--kui-*` override declared on the scope — through `className` or\n * `style` — or on any element around it reaches every component inside,\n * where on any element but `<html>` it would otherwise reach none, since the\n * tokens resolve once on `:root`. Popovers, sheets, tooltips and toasts\n * opened inside portal into the scope rather than into the body, so they\n * follow it too. The rest of the page keeps its own tokens.\n *\n * ```tsx\n * // .accent { --kui-color-primary: #7d5260; }\n * <ThemeScope className=\"accent\" scheme=\"dark\">\n * <Select label=\"Label\">…</Select>\n * </ThemeScope>\n * ```\n *\n * Because the overlays render inside the scope, an ancestor that confines\n * its descendants confines them too: a `transform` or a `filter` makes a\n * sheet's fixed scrim cover that ancestor rather than the viewport, and\n * `overflow: hidden` with a position clips a popover. Put the scope around\n * such an element rather than inside it.\n *\n * `render` swaps the element, for a scope that should be a `<main>`, a\n * `<section>`, or the `<body>` itself.\n */\nfunction ThemeScope({\n children,\n render,\n scheme,\n ...props\n}: ThemeScopeProps) {\n // State rather than a ref, so the overlays render again once the container\n // exists. React Aria renders an overlay nowhere while `getContainer` hands\n // back nothing, and one open on the scope's first render would otherwise\n // stay that way.\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const getContainer = useCallback(() => container, [container]);\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n ...mergeStyles(stylex.props(styles.root, tokenScope, scheme !== undefined && schemes[scheme]), props),\n children: <>\n <PortalProvider getContainer={getContainer}>\n {children}\n </PortalProvider>\n <div className=\"x9f619 xjp7ctv\" ref={setContainer} />\n </>\n },\n render\n });\n}\nexport type { ThemeScopeProps };\nexport { ThemeScope };"],"mappings":";;;;;;;;;;AA4BA,MAAMa,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,OAAO;AACT,EACF;AACA,MAAMC,UAAU;CACdC,MAAMR;CACNS,OAAOR;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAAW,WAAAC,IAAA;CAAA,MAAAC,IAAAvB,EAAA,EAAA;CAAoB,MAAA,EAAAwB,UAAAC,QAAAL,QAAA,GAAAM,YAAAJ;CAUlB,MAAA,CAAAK,WAAAC,gBAAkCzB,SAAgC,IAAI;CAAE,IAAA0B;CAAA,IAAAN,EAAA,OAAAI,WAAA;EACvCE,WAAMF;EAASJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAhD,MAAAO,eAAqBD;CAEH,MAAAE,KAAA;CAGX,MAAAC,KAAAxB,YAAYP,MAAaW,OAAMC,MAAOF,YAAYS,WAAWa,KAAAA,KAAajB,QAAQI,OAAO,GAAGM,OAAK;CAAC,IAAAQ;CAAA,IAAAX,EAAA,OAAAC,YAAAD,EAAA,OAAAO,cAAA;EAEjGI,KAAA,oBAACS,uBAAD;GAA8Bb;GAC3BN;EADY,CAAA;EAEED,EAAA,KAAAC;EAAAD,EAAA,KAAAO;EAAAP,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAK,cAAA;EACjBO,KAAA,oBAAA,OAAA;GAAe,WAAA;GAAsBP,KAAAA;EAAY,CAAA;EAAIL,EAAA,KAAAK;EAAAL,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAW,MAAAX,EAAA,OAAAY,IAAA;EAJ/CC,KAAA,qBAAA,YAAA,EAAA,UAAA,CACNF,IAGAC,EAAqD,EAAA,CAAA;EACpDZ,EAAA,KAAAW;EAAAX,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,QAAAG,WAAAH,EAAA,QAAAS,MAAAT,EAAA,QAAAa,IAAA;EARAC,KAAA;GAAA,GACFX;GAAK,GACLM;GAAkGR,UAC3FY;EAMZ;EAACb,EAAA,MAAAG;EAAAH,EAAA,MAAAS;EAAAT,EAAA,MAAAa;EAAAb,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,IAAAe;CAAA,IAAAf,EAAA,QAAAE,UAAAF,EAAA,QAAAc,IAAA;EAXcC,KAAA;GAAAC,gBACCR;GAAKL,OACdW;GASNZ;EAEH;EAACF,EAAA,MAAAE;EAAAF,EAAA,MAAAc;EAAAd,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,OAbMhB,UAAU+B,EAahB;AAAC"}
1
+ {"version":3,"file":"theme-scope.js","names":["c","_c","stylex","useCallback","useState","UNSAFE_PortalProvider","PortalProvider","RenderComponentProps","useRender","mergeStyles","pinnedScheme","colorDefaultsDarkTheme","colorDefaultsLightTheme","tokenScope","styles","root","kB7OPa","$$css","schemes","dark","light","ThemeScopeProps","scheme","ThemeScope","t0","$","children","render","props","container","setContainer","t1","getContainer","t2","t3","undefined","t4","t5","t6","t7","t8","defaultTagName","_c","props","stylex.props","PortalProvider"],"sources":["../src/theme-scope.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { useCallback, useState } from 'react';\nimport { UNSAFE_PortalProvider as PortalProvider } from 'react-aria/PortalProvider';\nimport type { RenderComponentProps } from './render/useRender';\nimport { useRender } from './render/useRender';\nimport { mergeStyles } from './styles/merge';\nimport { pinnedScheme } from './styles/scheme';\nimport { colorDefaultsDarkTheme, colorDefaultsLightTheme, tokenScope } from './tokens/design.tokens.stylex';\n\n// The component form of `themeScope` and `colorScheme` in ./color-scheme.ts:\n// the same classes, on an element of its own, plus the one thing a class\n// cannot do — take the overlays along. A pinned scheme paints the scope's\n// surface and sets its `color-scheme` too; see src/styles/scheme.ts.\n//\n// React Aria portals every overlay to the end of `<body>` unless a portal\n// provider names another container, so a popover, a sheet, a tooltip or a\n// toast opened inside a themed element renders outside it, and keeps the\n// tokens of the page. The container here is the scope's own last child,\n// which is what makes the overlays inherit whatever the scope inherits: its\n// scheme, and the `--kui-*` overrides declared on it or on any element around\n// it. A container appended to the body and given the scope's classes would\n// carry the classes alone, losing every override declared above the scope.\n//\n// `display: contents` keeps that container out of the layout, so a scope\n// that is a grid or a flex container gains no item and no gap from it. React\n// Aria positions an overlay against the overlay's own containing block rather\n// than the container's box, so a container with no box of its own changes\n// nothing about where a popover lands.\nconst styles = {\n root: {\n kB7OPa: \"x9f619\",\n $$css: true\n }\n};\nconst schemes = {\n dark: colorDefaultsDarkTheme,\n light: colorDefaultsLightTheme\n};\ntype ThemeScopeProps = RenderComponentProps<'div'> & {\n /**\n * Pins the scope to the library's light or dark scheme, whatever the\n * reader's OS asks for. A pinned scope paints its own surface and text in\n * that scheme and sets `color-scheme` for the native controls inside, so\n * it reads on any page. Left unset, the scope paints nothing and keeps the\n * scheme around it: the one an enclosing scope or the `<html>` element\n * pins, or the OS's.\n */\n scheme?: 'dark' | 'light' | undefined;\n};\n\n/**\n * Themes what is inside it, overlays included.\n *\n * A `--kui-*` override declared on the scope — through `className` or\n * `style` — or on any element around it reaches every component inside,\n * where on any element but `<html>` it would otherwise reach none, since the\n * tokens resolve once on `:root`. Popovers, sheets, tooltips and toasts\n * opened inside portal into the scope rather than into the body, so they\n * follow it too. The rest of the page keeps its own tokens.\n *\n * ```tsx\n * // .accent { --kui-color-primary: #7d5260; }\n * <ThemeScope className=\"accent\" scheme=\"dark\">\n * <Select label=\"Label\">…</Select>\n * </ThemeScope>\n * ```\n *\n * Because the overlays render inside the scope, an ancestor that confines\n * its descendants confines them too: a `transform` or a `filter` makes a\n * sheet's fixed scrim cover that ancestor rather than the viewport, and\n * `overflow: hidden` with a position clips a popover. Put the scope around\n * such an element rather than inside it.\n *\n * `render` swaps the element, for a scope that should be a `<main>`, a\n * `<section>`, or the `<body>` itself.\n */\nfunction ThemeScope({\n children,\n render,\n scheme,\n ...props\n}: ThemeScopeProps) {\n // State rather than a ref, so the overlays render again once the container\n // exists. React Aria renders an overlay nowhere while `getContainer` hands\n // back nothing, and one open on the scope's first render would otherwise\n // stay that way.\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const getContainer = useCallback(() => container, [container]);\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n ...mergeStyles(stylex.props(styles.root, tokenScope, scheme !== undefined && schemes[scheme], scheme !== undefined && pinnedScheme[scheme]), props),\n children: <>\n <PortalProvider getContainer={getContainer}>\n {children}\n </PortalProvider>\n <div className=\"x9f619 xjp7ctv\" ref={setContainer} />\n </>\n },\n render\n });\n}\nexport type { ThemeScopeProps };\nexport { ThemeScope };"],"mappings":";;;;;;;;;;;AA8BA,MAAMc,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,OAAO;AACT,EACF;AACA,MAAMC,UAAU;CACdC,MAAMR;CACNS,OAAOR;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAAW,WAAAC,IAAA;CAAA,MAAAC,IAAAxB,EAAA,EAAA;CAAoB,MAAA,EAAAyB,UAAAC,QAAAL,QAAA,GAAAM,YAAAJ;CAUlB,MAAA,CAAAK,WAAAC,gBAAkC1B,SAAgC,IAAI;CAAE,IAAA2B;CAAA,IAAAN,EAAA,OAAAI,WAAA;EACvCE,WAAMF;EAASJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAhD,MAAAO,eAAqBD;CAEH,MAAAE,KAAA;CAGX,MAAAC,KAAAzB,YAAYP,MAAaY,OAAMC,MAAOF,YAAYS,WAAWa,KAAAA,KAAajB,QAAQI,SAASA,WAAWa,KAAAA,KAAazB,aAAaY,OAAO,GAAGM,OAAK;CAAC,IAAAQ;CAAA,IAAAX,EAAA,OAAAC,YAAAD,EAAA,OAAAO,cAAA;EAE/II,KAAA,oBAACS,uBAAD;GAA8Bb;GAC3BN;EADY,CAAA;EAEED,EAAA,KAAAC;EAAAD,EAAA,KAAAO;EAAAP,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAK,cAAA;EACjBO,KAAA,oBAAA,OAAA;GAAe,WAAA;GAAsBP,KAAAA;EAAY,CAAA;EAAIL,EAAA,KAAAK;EAAAL,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAW,MAAAX,EAAA,OAAAY,IAAA;EAJ/CC,KAAA,qBAAA,YAAA,EAAA,UAAA,CACNF,IAGAC,EAAqD,EAAA,CAAA;EACpDZ,EAAA,KAAAW;EAAAX,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,QAAAG,WAAAH,EAAA,QAAAS,MAAAT,EAAA,QAAAa,IAAA;EARAC,KAAA;GAAA,GACFX;GAAK,GACLM;GAAgJR,UACzIY;EAMZ;EAACb,EAAA,MAAAG;EAAAH,EAAA,MAAAS;EAAAT,EAAA,MAAAa;EAAAb,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,IAAAe;CAAA,IAAAf,EAAA,QAAAE,UAAAF,EAAA,QAAAc,IAAA;EAXcC,KAAA;GAAAC,gBACCR;GAAKL,OACdW;GASNZ;EAEH;EAACF,EAAA,MAAAE;EAAAF,EAAA,MAAAc;EAAAd,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,OAbMjB,UAAUgC,EAahB;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanso-labs/kanso-ui",
3
- "version": "0.40.8",
3
+ "version": "0.41.0",
4
4
  "description": "A React component library built on React Aria Components primitives and styled with StyleX, with design tokens sourced from a single W3C DTCG file and compiled via Style Dictionary",
5
5
  "keywords": [
6
6
  "react",