@kanso-labs/react-native-kanso-ui 0.7.0 → 0.8.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 (80) hide show
  1. package/README.md +37 -0
  2. package/dist/badge/index.js +25 -23
  3. package/dist/badge/index.js.map +1 -1
  4. package/dist/button/index.d.ts +2 -1
  5. package/dist/button/index.js.map +1 -1
  6. package/dist/button/pending.js +17 -21
  7. package/dist/button/pending.js.map +1 -1
  8. package/dist/calendar/index.js +1 -1
  9. package/dist/components/autocomplete/index.js +28 -26
  10. package/dist/components/autocomplete/index.js.map +1 -1
  11. package/dist/components/avatar/index.d.ts +2 -2
  12. package/dist/components/avatar/index.js +2 -2
  13. package/dist/components/avatar/index.js.map +1 -1
  14. package/dist/components/calendar/index.d.ts +1 -1
  15. package/dist/components/calendar/index.js +77 -38
  16. package/dist/components/calendar/index.js.map +1 -1
  17. package/dist/components/chip-group/index.d.ts +4 -3
  18. package/dist/components/chip-group/index.js +47 -45
  19. package/dist/components/chip-group/index.js.map +1 -1
  20. package/dist/components/copy-field/index.d.ts +5 -5
  21. package/dist/components/copy-field/index.js +30 -28
  22. package/dist/components/copy-field/index.js.map +1 -1
  23. package/dist/components/currency/index.d.ts +2 -2
  24. package/dist/components/currency/index.js +3 -1
  25. package/dist/components/currency/index.js.map +1 -1
  26. package/dist/components/list/index.d.ts +6 -5
  27. package/dist/components/list/index.js +97 -106
  28. package/dist/components/list/index.js.map +1 -1
  29. package/dist/components/menu/index.d.ts +4 -3
  30. package/dist/components/menu/index.js +32 -39
  31. package/dist/components/menu/index.js.map +1 -1
  32. package/dist/components/meter/index.d.ts +2 -1
  33. package/dist/components/meter/index.js +9 -7
  34. package/dist/components/meter/index.js.map +1 -1
  35. package/dist/components/number-field/index.d.ts +7 -3
  36. package/dist/components/number-field/index.js +214 -192
  37. package/dist/components/number-field/index.js.map +1 -1
  38. package/dist/components/product-icon/index.d.ts +2 -2
  39. package/dist/components/product-icon/index.js +2 -2
  40. package/dist/components/product-icon/index.js.map +1 -1
  41. package/dist/components/progress-indicator/index.d.ts +2 -1
  42. package/dist/components/progress-indicator/index.js +15 -13
  43. package/dist/components/progress-indicator/index.js.map +1 -1
  44. package/dist/components/search-field/index.d.ts +3 -3
  45. package/dist/components/search-field/index.js +105 -104
  46. package/dist/components/search-field/index.js.map +1 -1
  47. package/dist/components/sheet/index.d.ts +2 -2
  48. package/dist/components/sheet/index.js +22 -26
  49. package/dist/components/sheet/index.js.map +1 -1
  50. package/dist/components/snackbar/index.d.ts +3 -3
  51. package/dist/components/snackbar/index.js +36 -34
  52. package/dist/components/snackbar/index.js.map +1 -1
  53. package/dist/components/tag/index.d.ts +58 -0
  54. package/dist/components/tag/index.js +205 -0
  55. package/dist/components/tag/index.js.map +1 -0
  56. package/dist/components/text-field/index.d.ts +6 -3
  57. package/dist/components/text-field/index.js +3 -0
  58. package/dist/components/text-field/index.js.map +1 -1
  59. package/dist/field/index.js +39 -36
  60. package/dist/field/index.js.map +1 -1
  61. package/dist/i18n/index.js +12 -1
  62. package/dist/i18n/index.js.map +1 -1
  63. package/dist/i18n/messages.js +367 -0
  64. package/dist/i18n/messages.js.map +1 -1
  65. package/dist/i18n/provider.d.ts +53 -0
  66. package/dist/i18n/provider.js +96 -0
  67. package/dist/i18n/provider.js.map +1 -0
  68. package/dist/index.d.ts +3 -1
  69. package/dist/index.js +3 -1
  70. package/dist/indicator/index.js +1 -2
  71. package/dist/indicator/index.js.map +1 -1
  72. package/dist/mark/index.js +77 -117
  73. package/dist/mark/index.js.map +1 -1
  74. package/dist/mark/initials.js.map +1 -1
  75. package/dist/number/count.js +15 -0
  76. package/dist/number/count.js.map +1 -0
  77. package/dist/number/locale.js.map +1 -1
  78. package/dist/overlay/host.js +30 -21
  79. package/dist/overlay/host.js.map +1 -1
  80. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["LibraryMessages","localeOf","MESSAGES","TABLE","Map","Object","entries","cache","lookUp","locale","tag","split","language","get","find","key","startsWith","messagesFor","resolved","cached","undefined","messages","set","pluralOf","count","Intl","PluralRules","select","resultsFor","noResults","form","results","one","other","replace","NumberFormat","format"],"sources":["../../src/i18n/index.ts"],"sourcesContent":["import type { LibraryMessages } from './messages'\n\nimport { localeOf } from '../number/locale'\nimport { MESSAGES } from './messages'\n\n// The words the library writes itself, in the locale a component is given or\n// the device's. Web reads them through React Aria's dictionary, in the\n// I18nProvider's locale, and this falls back the way that dictionary does: the\n// table's entry for the locale, then the first for its language, then English,\n// so `fr-CA` reads French and a locale the table lacks reads English.\n\nconst TABLE = new Map(Object.entries(MESSAGES))\n\n// One set per locale an app renders in, looked up the first time a component\n// asks for it.\nconst cache = new Map<string, LibraryMessages>()\n\n// A device's locale can carry a Unicode extension, `pt-PT-u-nu-latn`, which\n// says how numbers are written rather than which words; it is set aside, or\n// `pt-PT` would match no entry and read the first Portuguese one, Brazil's.\nfunction lookUp(locale: string): LibraryMessages {\n const tag = locale.split('-u-')[0]\n const language = tag.split('-')[0]\n\n return (\n TABLE.get(tag) ??\n [...TABLE].find(([key]) => key.startsWith(`${language}-`))?.[1] ??\n MESSAGES['en-US']\n )\n}\n\n/** The library's words in `locale`, or in the device's when given none. */\nfunction messagesFor(locale?: string): LibraryMessages {\n const resolved = localeOf(locale)\n const cached = cache.get(resolved)\n\n if (cached !== undefined) {\n return cached\n }\n\n const messages = lookUp(resolved)\n cache.set(resolved, messages)\n return messages\n}\n\n// The plural form a count takes in `locale`. Hermes has not always shipped\n// `Intl.PluralRules`, and where it is missing a count of one takes the\n// singular and any other the plural, which is English's rule.\nfunction pluralOf(locale: string, count: number) {\n // oxlint-disable-next-line typescript/no-unnecessary-condition -- typed as always there, which a runtime without it is not\n if (Intl.PluralRules === undefined) {\n return count === 1 ? 'one' : 'other'\n }\n\n return new Intl.PluralRules(locale).select(count)\n}\n\n/**\n * How many rows a search leaves, in `locale` or the device's, for a screen\n * reader: the count in the locale's plural form, or the empty row's words\n * when it is none.\n */\nfunction resultsFor(count: number, locale?: string): string {\n const resolved = localeOf(locale)\n const messages = messagesFor(resolved)\n\n if (count === 0) {\n return messages.noResults\n }\n\n const form =\n pluralOf(resolved, count) === 'one'\n ? messages.results.one\n : messages.results.other\n\n return form.replace('{count}', new Intl.NumberFormat(resolved).format(count))\n}\n\nexport { messagesFor, resultsFor }\nexport type { LibraryMessages }\n"],"mappings":";;;AAWA,MAAMG,QAAQ,IAAIC,IAAIC,OAAOC,QAAQJ,QAAQ,CAAC;AAI9C,MAAMK,wBAAQ,IAAIH,IAA6B;AAK/C,SAASI,OAAOC,QAAiC;CAC/C,MAAMC,MAAMD,OAAOE,MAAM,KAAK,CAAC,CAAC;CAChC,MAAMC,WAAWF,IAAIC,MAAM,GAAG,CAAC,CAAC;CAEhC,OACER,MAAMU,IAAIH,GAAG,KACb,CAAC,GAAGP,KAAK,CAAC,CAACW,MAAM,CAACC,SAASA,IAAIC,WAAW,GAAGJ,SAAQ,EAAG,CAAC,CAAC,GAAG,MAC7DV,SAAS;AAEb;;AAGA,SAASe,YAAYR,QAAkC;CACrD,MAAMS,WAAWjB,SAASQ,MAAM;CAChC,MAAMU,SAASZ,MAAMM,IAAIK,QAAQ;CAEjC,IAAIC,WAAWC,KAAAA,GACb,OAAOD;CAGT,MAAME,WAAWb,OAAOU,QAAQ;CAChCX,MAAMe,IAAIJ,UAAUG,QAAQ;CAC5B,OAAOA;AACT;AAKA,SAASE,SAASd,QAAgBe,OAAe;CAE/C,IAAIC,KAAKC,gBAAgBN,KAAAA,GACvB,OAAOI,UAAU,IAAI,QAAQ;CAG/B,OAAO,IAAIC,KAAKC,YAAYjB,MAAM,CAAC,CAACkB,OAAOH,KAAK;AAClD;;;;;;AAOA,SAASI,WAAWJ,OAAef,QAAyB;CAC1D,MAAMS,WAAWjB,SAASQ,MAAM;CAChC,MAAMY,WAAWJ,YAAYC,QAAQ;CAErC,IAAIM,UAAU,GACZ,OAAOH,SAASQ;CAQlB,QAJEN,SAASL,UAAUM,KAAK,MAAM,QAC1BH,SAASU,QAAQC,MACjBX,SAASU,QAAQE,MAAAA,CAEXC,QAAQ,WAAW,IAAIT,KAAKU,aAAajB,QAAQ,CAAC,CAACkB,OAAOZ,KAAK,CAAC;AAC9E"}
1
+ {"version":3,"file":"index.js","names":["LibraryMessages","formatCount","localeOf","MESSAGES","TABLE","Map","Object","entries","cache","limitFor","count","locale","resolved","forms","messagesFor","characterLimit","form","pluralOf","other","replace","lookUp","tag","split","language","get","find","key","startsWith","cached","undefined","messages","set","Intl","PluralRules","select","resultsFor","noResults","results","one","NumberFormat","format"],"sources":["../../src/i18n/index.ts"],"sourcesContent":["import type { LibraryMessages } from './messages'\n\nimport { formatCount } from '../number/count'\nimport { localeOf } from '../number/locale'\nimport { MESSAGES } from './messages'\n\n// The words the library writes itself, in the locale a component is given or\n// the device's. A component asks through `useMessages` in ./provider.tsx,\n// which gives it the `I18nProvider`'s locale, as web reads them through React\n// Aria's dictionary in its provider's. This falls back the way that dictionary\n// does: the table's entry for the locale, then the first for its language,\n// then English, so `fr-CA` reads French and a locale the table lacks reads\n// English.\n\nconst TABLE = new Map(Object.entries(MESSAGES))\n\n// One set per locale an app renders in, looked up the first time a component\n// asks for it.\nconst cache = new Map<string, LibraryMessages>()\n\n/**\n * A field's character limit in words, in `locale` or the device's, for a\n * screen reader: the limit in the locale's digits, in the plural form its\n * rules give it.\n */\nfunction limitFor(count: number, locale?: string): string {\n const resolved = localeOf(locale)\n const forms = messagesFor(resolved).characterLimit\n const form = forms[pluralOf(resolved, count)] ?? forms.other\n\n return form.replace('{count}', formatCount(count, resolved))\n}\n\n// A device's locale can carry a Unicode extension, `pt-PT-u-nu-latn`, which\n// says how numbers are written rather than which words; it is set aside, or\n// `pt-PT` would match no entry and read the first Portuguese one, Brazil's.\nfunction lookUp(locale: string): LibraryMessages {\n const tag = locale.split('-u-')[0]\n const language = tag.split('-')[0]\n\n return (\n TABLE.get(tag) ??\n [...TABLE].find(([key]) => key.startsWith(`${language}-`))?.[1] ??\n MESSAGES['en-US']\n )\n}\n\n/** The library's words in `locale`, or in the device's when given none. */\nfunction messagesFor(locale?: string): LibraryMessages {\n const resolved = localeOf(locale)\n const cached = cache.get(resolved)\n\n if (cached !== undefined) {\n return cached\n }\n\n const messages = lookUp(resolved)\n cache.set(resolved, messages)\n return messages\n}\n\n// The plural form a count takes in `locale`. Hermes has not always shipped\n// `Intl.PluralRules`, and where it is missing a count of one takes the\n// singular and any other the plural, which is English's rule.\nfunction pluralOf(locale: string, count: number) {\n // oxlint-disable-next-line typescript/no-unnecessary-condition -- typed as always there, which a runtime without it is not\n if (Intl.PluralRules === undefined) {\n return count === 1 ? 'one' : 'other'\n }\n\n return new Intl.PluralRules(locale).select(count)\n}\n\n/**\n * How many rows a search leaves, in `locale` or the device's, for a screen\n * reader: the count in the locale's plural form, or the empty row's words\n * when it is none.\n */\nfunction resultsFor(count: number, locale?: string): string {\n const resolved = localeOf(locale)\n const messages = messagesFor(resolved)\n\n if (count === 0) {\n return messages.noResults\n }\n\n const form =\n pluralOf(resolved, count) === 'one'\n ? messages.results.one\n : messages.results.other\n\n return form.replace('{count}', new Intl.NumberFormat(resolved).format(count))\n}\n\nexport { limitFor, messagesFor, resultsFor }\nexport type { LibraryMessages }\n"],"mappings":";;;;AAcA,MAAMI,QAAQ,IAAIC,IAAIC,OAAOC,QAAQJ,QAAQ,CAAC;AAI9C,MAAMK,wBAAQ,IAAIH,IAA6B;;;;;;AAO/C,SAASI,SAASC,OAAeC,QAAyB;CACxD,MAAMC,WAAWV,SAASS,MAAM;CAChC,MAAME,QAAQC,YAAYF,QAAQ,CAAC,CAACG;CAGpC,QAFaF,MAAMI,SAASL,UAAUF,KAAK,MAAMG,MAAMK,MAAAA,CAE3CC,QAAQ,WAAWlB,YAAYS,OAAOE,QAAQ,CAAC;AAC7D;AAKA,SAASQ,OAAOT,QAAiC;CAC/C,MAAMU,MAAMV,OAAOW,MAAM,KAAK,CAAC,CAAC;CAChC,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