@solibo/solibo-ui 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/assets/index10.css +1 -1
  2. package/dist/assets/index11.css +1 -1
  3. package/dist/assets/index12.css +1 -1
  4. package/dist/assets/index13.css +1 -1
  5. package/dist/assets/index14.css +1 -1
  6. package/dist/assets/index15.css +1 -1
  7. package/dist/assets/index16.css +1 -1
  8. package/dist/assets/index17.css +1 -1
  9. package/dist/assets/index18.css +1 -1
  10. package/dist/assets/index19.css +1 -1
  11. package/dist/assets/index20.css +1 -0
  12. package/dist/assets/index21.css +0 -1
  13. package/dist/assets/index22.css +1 -1
  14. package/dist/assets/index23.css +1 -1
  15. package/dist/assets/index24.css +1 -1
  16. package/dist/assets/index25.css +1 -1
  17. package/dist/assets/index26.css +1 -1
  18. package/dist/assets/index27.css +1 -1
  19. package/dist/assets/index28.css +1 -1
  20. package/dist/assets/index29.css +1 -1
  21. package/dist/assets/index3.css +1 -1
  22. package/dist/assets/index30.css +1 -1
  23. package/dist/assets/index31.css +1 -1
  24. package/dist/assets/index32.css +1 -1
  25. package/dist/assets/index33.css +1 -1
  26. package/dist/assets/index34.css +1 -1
  27. package/dist/assets/index35.css +1 -1
  28. package/dist/assets/index36.css +1 -1
  29. package/dist/assets/index37.css +1 -1
  30. package/dist/assets/index38.css +1 -1
  31. package/dist/assets/index39.css +1 -1
  32. package/dist/assets/index4.css +1 -1
  33. package/dist/assets/index40.css +1 -1
  34. package/dist/assets/index41.css +1 -1
  35. package/dist/assets/index42.css +1 -1
  36. package/dist/assets/index43.css +1 -1
  37. package/dist/assets/index44.css +1 -1
  38. package/dist/assets/index45.css +1 -1
  39. package/dist/assets/index46.css +1 -1
  40. package/dist/assets/index47.css +1 -1
  41. package/dist/assets/index48.css +1 -1
  42. package/dist/assets/index49.css +1 -1
  43. package/dist/assets/index5.css +1 -1
  44. package/dist/assets/index50.css +1 -1
  45. package/dist/assets/index51.css +1 -1
  46. package/dist/assets/index52.css +1 -0
  47. package/dist/assets/index6.css +1 -1
  48. package/dist/assets/index7.css +1 -1
  49. package/dist/assets/index8.css +1 -1
  50. package/dist/assets/index9.css +1 -1
  51. package/dist/components/app-link/index.cjs +1 -1
  52. package/dist/components/app-link/index.js +1 -1
  53. package/dist/components/aside/index.cjs +1 -1
  54. package/dist/components/aside/index.js +16 -16
  55. package/dist/components/avatar/index.cjs +1 -1
  56. package/dist/components/avatar/index.js +1 -1
  57. package/dist/components/badge/index.cjs +1 -1
  58. package/dist/components/badge/index.js +1 -1
  59. package/dist/components/banner/index.cjs +1 -1
  60. package/dist/components/banner/index.js +1 -1
  61. package/dist/components/branding/index.cjs +1 -1
  62. package/dist/components/branding/index.js +1 -1
  63. package/dist/components/button/index.cjs +1 -1
  64. package/dist/components/button/index.js +1 -1
  65. package/dist/components/card/index.cjs +1 -1
  66. package/dist/components/card/index.js +24 -24
  67. package/dist/components/checkbox/index.cjs +1 -1
  68. package/dist/components/checkbox/index.js +1 -1
  69. package/dist/components/chip/index.cjs +1 -1
  70. package/dist/components/chip/index.js +1 -1
  71. package/dist/components/collapsible/index.cjs +1 -1
  72. package/dist/components/collapsible/index.js +1 -1
  73. package/dist/components/controls/index.cjs +1 -1
  74. package/dist/components/controls/index.js +1 -1
  75. package/dist/components/croppable/index.cjs +1 -1
  76. package/dist/components/croppable/index.js +1 -1
  77. package/dist/components/dialog/index.cjs +1 -1
  78. package/dist/components/dialog/index.js +1 -1
  79. package/dist/components/dropdown/index.cjs +1 -1
  80. package/dist/components/dropdown/index.js +3 -3
  81. package/dist/components/dropzone/index.cjs +1 -1
  82. package/dist/components/dropzone/index.js +1 -1
  83. package/dist/components/editor/index.cjs +1 -1
  84. package/dist/components/editor/index.js +2 -2
  85. package/dist/components/empty-state/index.cjs +1 -1
  86. package/dist/components/empty-state/index.cjs.map +1 -1
  87. package/dist/components/empty-state/index.js +6 -6
  88. package/dist/components/fieldset/index.cjs +1 -1
  89. package/dist/components/fieldset/index.js +1 -1
  90. package/dist/components/figure/index.cjs +1 -1
  91. package/dist/components/figure/index.js +1 -1
  92. package/dist/components/file/index.cjs +1 -1
  93. package/dist/components/file/index.js +1 -1
  94. package/dist/components/footer/index.cjs +1 -1
  95. package/dist/components/footer/index.js +1 -1
  96. package/dist/components/form/index.cjs +1 -1
  97. package/dist/components/form/index.js +1 -1
  98. package/dist/components/graph/index.cjs +1 -1
  99. package/dist/components/graph/index.js +1 -1
  100. package/dist/components/group/index.cjs +1 -1
  101. package/dist/components/group/index.js +1 -1
  102. package/dist/components/header/index.cjs +1 -1
  103. package/dist/components/header/index.js +1 -1
  104. package/dist/components/icon/index.cjs +1 -1
  105. package/dist/components/icon/index.js +1 -1
  106. package/dist/components/iframe/index.cjs +1 -1
  107. package/dist/components/iframe/index.js +1 -1
  108. package/dist/components/image/index.cjs +1 -1
  109. package/dist/components/image/index.js +1 -1
  110. package/dist/components/input/index.cjs +1 -1
  111. package/dist/components/input/index.js +1 -1
  112. package/dist/components/link/index.cjs +1 -1
  113. package/dist/components/link/index.js +1 -1
  114. package/dist/components/list/index.cjs +1 -1
  115. package/dist/components/list/index.js +1 -1
  116. package/dist/components/loading/index.cjs +1 -1
  117. package/dist/components/loading/index.js +1 -1
  118. package/dist/components/menu/index.cjs +1 -1
  119. package/dist/components/menu/index.js +1 -1
  120. package/dist/components/message/index.cjs +1 -1
  121. package/dist/components/message/index.js +1 -1
  122. package/dist/components/messages/index.cjs +1 -1
  123. package/dist/components/messages/index.js +7 -7
  124. package/dist/components/nav/index.cjs +1 -1
  125. package/dist/components/nav/index.js +17 -17
  126. package/dist/components/object/index.cjs +1 -1
  127. package/dist/components/object/index.js +1 -1
  128. package/dist/components/popover/index.cjs +1 -1
  129. package/dist/components/popover/index.js +1 -1
  130. package/dist/components/portal/index.cjs +1 -1
  131. package/dist/components/portal/index.js +18 -18
  132. package/dist/components/search/index.cjs +1 -1
  133. package/dist/components/search/index.js +24 -24
  134. package/dist/components/select/index.cjs +1 -1
  135. package/dist/components/select/index.js +1 -1
  136. package/dist/components/sortable/index.cjs +1 -1
  137. package/dist/components/sortable/index.js +1 -1
  138. package/dist/components/table/index.cjs +1 -1
  139. package/dist/components/table/index.js +1 -1
  140. package/dist/components/textarea/index.cjs +1 -1
  141. package/dist/components/textarea/index.js +1 -1
  142. package/dist/components/toast/index.cjs +1 -1
  143. package/dist/components/toast/index.js +1 -1
  144. package/dist/components/toasts/index.cjs +1 -1
  145. package/dist/components/toasts/index.js +1 -1
  146. package/dist/components/toggle/index.cjs +1 -1
  147. package/dist/components/toggle/index.js +1 -1
  148. package/dist/components/toolbar/index.cjs +1 -1
  149. package/dist/components/toolbar/index.js +1 -1
  150. package/dist/components/tooltip/index.cjs +2 -0
  151. package/dist/components/tooltip/index.cjs.map +1 -0
  152. package/dist/components/tooltip/index.js +21 -0
  153. package/dist/components/tooltip/index.js.map +1 -0
  154. package/dist/{index-D-AyCDg7.js → index-B9xtLe2w.js} +2 -2
  155. package/dist/{index-D-AyCDg7.js.map → index-B9xtLe2w.js.map} +1 -1
  156. package/dist/{index-iItPktfX.cjs → index-CP5A_BGJ.cjs} +2 -2
  157. package/dist/{index-iItPktfX.cjs.map → index-CP5A_BGJ.cjs.map} +1 -1
  158. package/dist/{index-DS2cY2g4.js → index-DFXqYJat.js} +2 -2
  159. package/dist/{index-DS2cY2g4.js.map → index-DFXqYJat.js.map} +1 -1
  160. package/dist/{index-BOkkyMbX.cjs → index-N4IMha5Q.cjs} +2 -2
  161. package/dist/{index-BOkkyMbX.cjs.map → index-N4IMha5Q.cjs.map} +1 -1
  162. package/dist/index.cjs +1 -1
  163. package/dist/index.d.ts +13 -0
  164. package/dist/index.js +14 -12
  165. package/dist/index.js.map +1 -1
  166. package/dist/tokens.json +1 -1
  167. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index-D-AyCDg7.js","sources":["../src/components/select/sanitize-select-props.ts","../src/lib/color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/lib/color';\nimport { useTouched } from '@/lib/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('chevron').replace(\n 'currentColor',\n resolveColor('--colors-semantic-content-secondary')\n ),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, touched && styles.touched)}\n onBlur={onBlur}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","restSelectProps","withVars","iconSVG","replace","selectElement","jsxs","cx","select","jsx","required","undefined"],"mappings":";;;;AAAA,MAAMA,IAAa,oBAAIC,IAAI,CACzB,yBACA,qBACA,aACA,iBACA,oBACA,gBACA,iBACA,qBACA,iBACA,iBACA,eACA,gBACA,qBACA,cACA,mBACA,aACA,aACA,iBACA,wBACA,gBACA,aACA,aACA,gBACA,OACA,YACA,QACA,MACA,YACA,QACA,UACA,YACA,WACA,WACA,WACA,aACA,aACA,WACA,eACA,aACA,iBACA,eACA,YACA,QACA,QACA,SACA,YACA,SACA,OAAO,CACR;AAEM,SAASC,EAAuDC,GAAU;AAC/E,SAAOC,OAAOC,YACZD,OAAOE,QAAQH,CAAK,EAAEI,OACpB,CAAC,CAACC,CAAG,MAAMA,EAAIC,WAAW,OAAO,KAAKD,EAAIC,WAAW,OAAO,KAAKT,EAAWU,IAAIF,CAAG,CACrF,CACF;AACF;ACzDA,MAAMG,IAAqB,cACrBC,IAA8B,0CAE9BC,IAA0B,oBAAIZ,IAAI,CACtC,gBACA,WACA,WACA,UACA,gBACA,OAAO,CACR,GAEKa,IAAQ,OAAOC,WAAa,MAAcA,SAASC,cAAc,MAAM,IAAI;AAEjF,SAASC,EAAoBC,GAAuB;AAClD,QAAMC,IAAQD,EAAME,KAAAA;AAEpB,MAAI,CAACD,KAAS,CAACL,KAASD,EAAwBH,IAAIS,EAAME,YAAAA,CAAa;AACrE,WAAOF;AAGT,QAAMG,IAAYP,SAASQ,QAAQR,SAASS;AAQ5C,MANI,CAACF,MAILR,EAAMW,MAAMC,QAAQP,GAEhB,CAACL,EAAMW,MAAMC;AACf,WA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AAQ,SAAS,EAAEC,QAC/B,gBACAtB,EAAa,qCAAqC,CACpD;AAAA,EAAA,GAGIuB,IACJ,gBAAAC,EAAC,UAAA,EACC,WAAWC,EAAGvB,EAAOwB,QAAQX,KAAWb,EAAOa,OAAO,GACtD,QAAAC,GACA,OAAOI,GACP,GAAID,GAEHL,UAAAA;AAAAA,IAAAA,uBACE,UAAA,EAEC,OAAO,IACP,QAAM,IAELA,eAJG,aAKN;AAAA,IAEDF;AAAAA,EAAAA,GACH;AAGF,SAAKC,IAKH,gBAAAW,EAAC,SAAA,EAAK,kBAAA,UACJ,UAAA;AAAA,IAAA,gBAAAG,EAAC,QAAA,EACC,WAAWzB,EAAOW,OAClB,iBAAezC,EAAMwD,YAAYC,QAEhChB,UAAAA,EAAAA,CACH;AAAA,IACCU;AAAAA,EAAAA,GACH,IAZOA;AAcX;"}
1
+ {"version":3,"file":"index-B9xtLe2w.js","sources":["../src/components/select/sanitize-select-props.ts","../src/lib/color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/lib/color';\nimport { useTouched } from '@/lib/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('chevron').replace(\n 'currentColor',\n resolveColor('--colors-semantic-content-secondary')\n ),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, touched && styles.touched)}\n onBlur={onBlur}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","restSelectProps","withVars","iconSVG","replace","selectElement","jsxs","cx","select","jsx","required","undefined"],"mappings":";;;;AAAA,MAAMA,IAAa,oBAAIC,IAAI,CACzB,yBACA,qBACA,aACA,iBACA,oBACA,gBACA,iBACA,qBACA,iBACA,iBACA,eACA,gBACA,qBACA,cACA,mBACA,aACA,aACA,iBACA,wBACA,gBACA,aACA,aACA,gBACA,OACA,YACA,QACA,MACA,YACA,QACA,UACA,YACA,WACA,WACA,WACA,aACA,aACA,WACA,eACA,aACA,iBACA,eACA,YACA,QACA,QACA,SACA,YACA,SACA,OAAO,CACR;AAEM,SAASC,EAAuDC,GAAU;AAC/E,S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require("react"),F=require("./icons-DYCSlAoX.cjs"),P=require("./use-touched-D_TJ8wDc.cjs");function R(e){return e&&`${e[0].toLocaleUpperCase()}${e.slice(1)}`}function S(e){const n=R(e);return n&&!n.endsWith(":")?`${n}:`:n}const V="_input_antyf_3",w="_touched_antyf_43",z="_label_antyf_48",B="_inline_antyf_57",G="_code_antyf_81",s={input:V,touched:w,label:z,inline:B,code:G};function U({className:e,defaultCountryCode:n="+47",disabled:c=!1,icon:_,label:p,placeholder:x,ref:g,required:m,type:t="text",variant:v="default",...j}){const[f,L]=h.useState(""),[a,b]=h.useState(""),{name:I,onChange:u,pattern:T,value:l,...$}=j,{touched:N,onBlur:q}=P.useTouched(l===""),r=_&&t!=="radio"&&t!=="datetime-local"?_:void 0,y=p&&v==="inline"?S(p):p,C=r?{"--icon-svg":F.iconSVG(r,!0)}:void 0;h.useEffect(()=>{if(u&&t==="tel"){const i={name:I,value:a?(f||n).split(" ").join("")+a.split(" ").join(""):void 0};u({target:i,currentTarget:i})}},[f,n,I,u,a,t]),h.useEffect(()=>{t==="tel"&&!l&&(b(""),L(""))},[t,l]);const E=o.jsxs(o.Fragment,{children:[o.jsx("input",{disabled:c,hidden:!0,onChange:u,pattern:void 0,placeholder:x,ref:g,type:t,value:l}),o.jsx("input",{type:"text",className:d.t(s.code,s.input),disabled:c,maxLength:5,onChange:i=>L(i.target.value),placeholder:n,value:f}),o.jsx("input",{type:"tel",className:d.t(s.input,N&&s.touched),"data-icon":r?"true":void 0,disabled:c,maxLength:14,name:void 0,onChange:i=>b(i.target.value),onBlur:q,pattern:T,required:m,style:C,value:a,...$})]});return o.jsxs("label",{className:d.t(s.label,v==="inline"&&s.inline),"data-component":"input",children:[y&&o.jsx("span",{"data-required":m||void 0,children:y}),t==="tel"?E:o.jsx("input",{ref:g,className:d.t(s.input,e,N&&s.touched),"data-icon":r?"true":void 0,disabled:c,onBlur:q,placeholder:x,required:m,style:C,type:t,...j})]})}exports.Input=U;exports.formatInlineLabel=S;
2
- //# sourceMappingURL=index-iItPktfX.cjs.map
1
+ "use strict";require('./assets/index47.css');const o=require("react/jsx-runtime"),d=require("./classix-5H4IWnMA.cjs"),h=require("react"),F=require("./icons-DYCSlAoX.cjs"),P=require("./use-touched-D_TJ8wDc.cjs");function R(e){return e&&`${e[0].toLocaleUpperCase()}${e.slice(1)}`}function S(e){const n=R(e);return n&&!n.endsWith(":")?`${n}:`:n}const V="_input_antyf_3",w="_touched_antyf_43",z="_label_antyf_48",B="_inline_antyf_57",G="_code_antyf_81",s={input:V,touched:w,label:z,inline:B,code:G};function U({className:e,defaultCountryCode:n="+47",disabled:c=!1,icon:_,label:p,placeholder:x,ref:g,required:m,type:t="text",variant:v="default",...j}){const[f,L]=h.useState(""),[a,b]=h.useState(""),{name:I,onChange:u,pattern:T,value:l,...$}=j,{touched:N,onBlur:q}=P.useTouched(l===""),r=_&&t!=="radio"&&t!=="datetime-local"?_:void 0,y=p&&v==="inline"?S(p):p,C=r?{"--icon-svg":F.iconSVG(r,!0)}:void 0;h.useEffect(()=>{if(u&&t==="tel"){const i={name:I,value:a?(f||n).split(" ").join("")+a.split(" ").join(""):void 0};u({target:i,currentTarget:i})}},[f,n,I,u,a,t]),h.useEffect(()=>{t==="tel"&&!l&&(b(""),L(""))},[t,l]);const E=o.jsxs(o.Fragment,{children:[o.jsx("input",{disabled:c,hidden:!0,onChange:u,pattern:void 0,placeholder:x,ref:g,type:t,value:l}),o.jsx("input",{type:"text",className:d.t(s.code,s.input),disabled:c,maxLength:5,onChange:i=>L(i.target.value),placeholder:n,value:f}),o.jsx("input",{type:"tel",className:d.t(s.input,N&&s.touched),"data-icon":r?"true":void 0,disabled:c,maxLength:14,name:void 0,onChange:i=>b(i.target.value),onBlur:q,pattern:T,required:m,style:C,value:a,...$})]});return o.jsxs("label",{className:d.t(s.label,v==="inline"&&s.inline),"data-component":"input",children:[y&&o.jsx("span",{"data-required":m||void 0,children:y}),t==="tel"?E:o.jsx("input",{ref:g,className:d.t(s.input,e,N&&s.touched),"data-icon":r?"true":void 0,disabled:c,onBlur:q,placeholder:x,required:m,style:C,type:t,...j})]})}exports.Input=U;exports.formatInlineLabel=S;
2
+ //# sourceMappingURL=index-CP5A_BGJ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-iItPktfX.cjs","sources":["../src/lib/text.ts","../src/components/input/index.tsx"],"sourcesContent":["export function capitalizeFirstLetter(value: string): string {\n return value ? `${value[0].toLocaleUpperCase()}${value.slice(1)}` : value;\n}\n\nexport function formatInlineLabel(value: string): string {\n const label = capitalizeFirstLetter(value);\n return label && !label.endsWith(':') ? `${label}:` : label;\n}\n","import cx from 'classix';\nimport { useEffect, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { formatInlineLabel } from '@/lib/text';\nimport { useTouched } from '@/lib/use-touched';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n icon?: IconName;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n variant?: 'default' | 'inline';\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n icon,\n label,\n placeholder,\n ref,\n required,\n type = 'text',\n variant = 'default',\n ...props\n}: InputProps) {\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { name, onChange, pattern, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n const inputIcon = icon && type !== 'radio' && type !== 'datetime-local' ? icon : undefined;\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars = inputIcon\n ? {\n '--icon-svg': iconSVG(inputIcon, true),\n }\n : undefined;\n\n useEffect(() => {\n if (onChange && type === 'tel') {\n const target = {\n name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n\n onChange({ target, currentTarget: target } as React.ChangeEvent<HTMLInputElement>);\n }\n }, [countryCode, defaultCountryCode, name, onChange, phoneNumber, type]);\n\n useEffect(() => {\n if (type === 'tel' && !value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [type, value]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={cx(styles.code, styles.input)}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n type='tel'\n className={cx(styles.input, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n maxLength={14}\n name={undefined}\n onChange={(e) => setPhoneNumber(e.target.value)}\n onBlur={onBlur}\n pattern={pattern}\n required={required}\n style={withVars}\n value={phoneNumber}\n {...restProps}\n />\n </>\n );\n\n return (\n <label className={cx(styles.label, variant === 'inline' && styles.inline)}>\n {displayLabel && <span data-required={required || undefined}>{displayLabel}</span>}\n {type === 'tel' ? (\n telephoneInput\n ) : (\n <input\n ref={ref}\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n onBlur={onBlur}\n placeholder={placeholder}\n required={required}\n style={withVars}\n type={type}\n {...props}\n />\n )}\n </label>\n );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","icon","placeholder","ref","required","type","variant","props","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","onBlur","useTouched","inputIcon","undefined","displayLabel","withVars","iconSVG","useEffect","target","split","join","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","inline"],"mappings":"mLAAO,SAASA,EAAsBC,EAAuB,CAC3D,OAAOA,GAAQ,GAAGA,EAAM,CAAC,EAAEC,mBAAmB,GAAGD,EAAME,MAAM,CAAC,CAAC,EACjE,CAEO,SAASC,EAAkBH,EAAuB,CACvD,MAAMI,EAAQL,EAAsBC,CAAK,EACzC,OAAOI,GAAS,CAACA,EAAMC,SAAS,GAAG,EAAI,GAAGD,CAAK,IAAMA,CACvD,0JCsBO,SAASE,EAAM,CACpBC,UAAAA,EACAC,mBAAAA,EAAqB,MACrBC,SAAAA,EAAW,GACXC,KAAAA,EACAN,MAAAA,EACAO,YAAAA,EACAC,IAAAA,EACAC,SAAAA,EACAC,KAAAA,EAAO,OACPC,QAAAA,EAAU,UACV,GAAGC,CACO,EAAG,CACb,KAAM,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAS,EAAE,EAC3C,CAACC,EAAaC,CAAc,EAAIF,EAAAA,SAAS,EAAE,EAC3C,CAAEG,KAAAA,EAAMC,SAAAA,EAAUC,QAAAA,EAASxB,MAAAA,EAAO,GAAGyB,CAAAA,EAAcT,EACnD,CAAEU,QAAAA,EAASC,OAAAA,CAAAA,EAAWC,EAAAA,WAAW5B,IAAU,EAAE,EAC7C6B,EAAYnB,GAAQI,IAAS,SAAWA,IAAS,iBAAmBJ,EAAOoB,OAC3EC,EAAe3B,GAASW,IAAY,SAAWZ,EAAkBC,CAAK,EAAIA,EAQ1E4B,EAAqBH,EACvB,CACE,aAAcI,EAAAA,QAAQJ,EAAW,EAAI,CAAA,EAEvCC,OAEJI,EAAAA,UAAU,IAAM,CACd,GAAIX,GAAYT,IAAS,MAAO,CAC9B,MAAMqB,EAAS,CACbb,KAAAA,EACAtB,MAAOoB,GACFH,GAAeT,GAAoB4B,MAAM,GAAG,EAAEC,KAAK,EAAE,EACtDjB,EAAYgB,MAAM,GAAG,EAAEC,KAAK,EAAE,E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IAAC,QAAA,CACC,IAAA9B,EACA,UAAW+B,EAAAA,EAAGC,EAAOE,MAAOvC,EAAWmB,GAAWkB,EAAOlB,OAAO,EAChE,YAAWG,EAAY,OAASC,OAChC,SAAArB,EACA,OAAAkB,EACA,YAAAhB,EACA,SAAAE,EACA,MAAOmB,EACP,KAAAlB,EACA,GAAIE,CAAAA,CAAM,CAAA,EAGhB,CAEJ"}
1
+ {"version":3,"file":"index-CP5A_BGJ.cjs","sources":["../src/lib/text.ts","../src/components/input/index.tsx"],"sourcesContent":["export function capitalizeFirstLetter(value: string): string {\n return value ? `${value[0].toLocaleUpperCase()}${value.slice(1)}` : value;\n}\n\nexport function formatInlineLabel(value: string): string {\n const label = capitalizeFirstLetter(value);\n return label && !label.endsWith(':') ? `${label}:` : label;\n}\n","import cx from 'classix';\nimport { useEffect, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { formatInlineLabel } from '@/lib/text';\nimport { useTouched } from '@/lib/use-touched';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n icon?: IconName;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n variant?: 'default' | 'inline';\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n icon,\n label,\n placeholder,\n ref,\n required,\n type = 'text',\n variant = 'default',\n ...props\n}: InputProps) {\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { name, onChange, pattern, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n const inputIcon = icon && type !== 'radio' && type !== 'datetime-local' ? icon : undefined;\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars = inputIcon\n ? {\n '--icon-svg': iconSVG(inputIcon, true),\n }\n : undefined;\n\n useEffect(() => {\n if (onChange && type === 'tel') {\n const target = {\n name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n\n onChange({ target, currentTarget: target } as React.ChangeEvent<HTMLInputElement>);\n }\n }, [countryCode, defaultCountryCode, name, onChange, phoneNumber, type]);\n\n useEffect(() => {\n if (type === 'tel' && !value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [type, value]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={cx(styles.code, styles.input)}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n type='tel'\n className={cx(styles.input, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n maxLength={14}\n name={undefined}\n onChange={(e) => setPhoneNumber(e.target.value)}\n onBlur={onBlur}\n pattern={pattern}\n required={required}\n style={withVars}\n value={phoneNumber}\n {...restProps}\n />\n </>\n );\n\n return (\n <label className={cx(styles.label, variant === 'inline' && styles.inline)}>\n {displayLabel && <span data-required={required || undefined}>{displayLabel}</span>}\n {type === 'tel' ? (\n telephoneInput\n ) : (\n <input\n ref={ref}\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n onBlur={onBlur}\n placeholder={placeholder}\n required={required}\n style={withVars}\n type={type}\n {...props}\n />\n )}\n </label>\n );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","icon","placeholder","ref","required","type","variant","props","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","onBlur","useTouched","inputIcon","undefined","displayLabel","withVars","iconSVG","useEffect","target","split","join","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","inline"],"mappings":"mLAAO,SAASA,EAAsBC,EAAuB,CAC3D,OAAOA,GAAQ,GAAGA,EAAM,CAAC,EAAEC,mBAAmB,GAAGD,EAAME,MAAM,CAAC,CAAC,EACjE,CAEO,SAASC,EAAkBH,EAAuB,CACvD,MAAMI,EAAQL,EAAsBC,CAAK,EACzC,OAAOI,GAAS,CAACA,EAAMC,SAAS,GAAG,EAAI,GAAGD,CAAK,IAAMA,CACvD,0JCsBO,SAASE,EAAM,CACpBC,UAAAA,EACAC,mBAAAA,EAAqB,MACrBC,SAAAA,EAAW,GACXC,KAAAA,EACAN,MAAAA,EACAO,YAAAA,EACAC,IAAAA,EACAC,SAAAA,EACAC,KAAAA,EAAO,OACPC,QAAAA,EAAU,UACV,GAAGC,CACO,EAAG,CACb,KAAM,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAS,EAAE,EAC3C,CAACC,EAAaC,CAAc,EAAIF,EAAAA,SAAS,EAAE,EAC3C,CAAEG,KAAAA,EAAMC,SAAAA,EAAUC,QAAAA,EAASxB,MAAAA,EAAO,GAAGyB,CAAAA,EAAcT,EACnD,CAAEU,QAAAA,EAASC,OAAAA,CAAAA,EAAWC,EAAAA,WAAW5B,IAAU,EAAE,EAC7C6B,EAAYnB,GAAQI,IAAS,SAAWA,IAAS,iBAAmBJ,EAAOoB,OAC3EC,EAAe3B,GAASW,IAAY,SAAWZ,EAAkBC,CAAK,EAAIA,EAQ1E4B,EAAqBH,EACvB,CACE,aAAcI,EAAAA,QAAQJ,EAAW,EAAI,CAAA,EAEvCC,OAEJI,EAAAA,UAAU,IAAM,CACd,GAAIX,GAAYT,IAAS,MAAO,CAC9B,MAAMqB,EAAS,CACbb,KAAAA,EACAtB,MAAOoB,G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,EAAAA,IAAC,OAAA,CAAK,gBAAe7B,GAAYiB,OAAYC,SAAAA,EAAa,EAC1EjB,IAAS,MACRyB,EAEAG,EAAAA,IAAC,QAAA,CACC,IAAA9B,EACA,UAAW+B,EAAAA,EAAGC,EAAOE,MAAOvC,EAAWmB,GAAWkB,EAAOlB,OAAO,EAChE,YAAWG,EAAY,OAASC,OAChC,SAAArB,EACA,OAAAkB,EACA,YAAAhB,EACA,SAAAE,EACA,MAAOmB,EACP,KAAAlB,EACA,GAAIE,CAAAA,CAAM,CAAA,EAGhB,CAEJ"}
@@ -3,7 +3,7 @@ import { t as p } from "./classix-DG18itHa.js";
3
3
  import { useState as F, useEffect as P } from "react";
4
4
  import { i as z } from "./icons-CKzd_L4D.js";
5
5
  import { u as B } from "./use-touched-DXIJVVzz.js";
6
- import './assets/index46.css';function E(n) {
6
+ import './assets/index47.css';function E(n) {
7
7
  return n && `${n[0].toLocaleUpperCase()}${n.slice(1)}`;
8
8
  }
9
9
  function G(n) {
@@ -70,4 +70,4 @@ export {
70
70
  Q as I,
71
71
  G as f
72
72
  };
73
- //# sourceMappingURL=index-DS2cY2g4.js.map
73
+ //# sourceMappingURL=index-DFXqYJat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DS2cY2g4.js","sources":["../src/lib/text.ts","../src/components/input/index.tsx"],"sourcesContent":["export function capitalizeFirstLetter(value: string): string {\n return value ? `${value[0].toLocaleUpperCase()}${value.slice(1)}` : value;\n}\n\nexport function formatInlineLabel(value: string): string {\n const label = capitalizeFirstLetter(value);\n return label && !label.endsWith(':') ? `${label}:` : label;\n}\n","import cx from 'classix';\nimport { useEffect, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { formatInlineLabel } from '@/lib/text';\nimport { useTouched } from '@/lib/use-touched';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n icon?: IconName;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n variant?: 'default' | 'inline';\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n icon,\n label,\n placeholder,\n ref,\n required,\n type = 'text',\n variant = 'default',\n ...props\n}: InputProps) {\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { name, onChange, pattern, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n const inputIcon = icon && type !== 'radio' && type !== 'datetime-local' ? icon : undefined;\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars = inputIcon\n ? {\n '--icon-svg': iconSVG(inputIcon, true),\n }\n : undefined;\n\n useEffect(() => {\n if (onChange && type === 'tel') {\n const target = {\n name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n\n onChange({ target, currentTarget: target } as React.ChangeEvent<HTMLInputElement>);\n }\n }, [countryCode, defaultCountryCode, name, onChange, phoneNumber, type]);\n\n useEffect(() => {\n if (type === 'tel' && !value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [type, value]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={cx(styles.code, styles.input)}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n type='tel'\n className={cx(styles.input, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n maxLength={14}\n name={undefined}\n onChange={(e) => setPhoneNumber(e.target.value)}\n onBlur={onBlur}\n pattern={pattern}\n required={required}\n style={withVars}\n value={phoneNumber}\n {...restProps}\n />\n </>\n );\n\n return (\n <label className={cx(styles.label, variant === 'inline' && styles.inline)}>\n {displayLabel && <span data-required={required || undefined}>{displayLabel}</span>}\n {type === 'tel' ? (\n telephoneInput\n ) : (\n <input\n ref={ref}\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n onBlur={onBlur}\n placeholder={placeholder}\n required={required}\n style={withVars}\n type={type}\n {...props}\n />\n )}\n </label>\n );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","icon","placeholder","ref","required","type","variant","props","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","onBlur","useTouched","inputIcon","undefined","displayLabel","withVars","iconSVG","useEffect","target","split","join","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","inline"],"mappings":";;;;;AAAO,SAASA,EAAsBC,GAAuB;AAC3D,SAAOA,KAAQ,GAAGA,EAAM,CAAC,EAAEC,mBAAmB,GAAGD,EAAME,MAAM,CAAC,CAAC;AACjE;AAEO,SAASC,EAAkBH,GAAuB;AACvD,QAAMI,IAAQL,EAAsBC,CAAK;AACzC,SAAOI,KAAS,CAACA,EAAMC,SAAS,GAAG,IAAI,GAAGD,CAAK,MAAMA;AACvD;;;;;;;;ACsBO,SAASE,EAAM;AAAA,EACpBC,WAAAA;AAAAA,EACAC,oBAAAA,IAAqB;AAAA,EACrBC,UAAAA,IAAW;AAAA,EACXC,MAAAA;AAAAA,EACAN,OAAAA;AAAAA,EACAO,aAAAA;AAAAA,EACAC,KAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,MAAAA,IAAO;AAAA,EACPC,SAAAA,IAAU;AAAA,EACV,GAAGC;AACO,GAAG;AACb,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C,GACA,MAAAE,GACA,OAAAd,EAAA,CAAa;AAAA,IAEf,gBAAA0C,EAAC,SAAA,EACC,MAAK,QACL,WAAWC,EAAGC,EAAOC,MAAMD,EAAOE,KAAK,GACvC,UAAArC,GACA,WAAW,GACX,UAAWsC,CAAAA,MAAM7B,EAAe6B,EAAEZ,OAAOnC,KAAK,GAC9C,aAAaQ,GACb,OAAOS,EAAAA,CAAY;AAAA,sBAEpB,SAAA,EACC,MAAK,OACL,WAAW0B,EAAGC,EAAOE,OAAOpB,KAAWkB,EAAOlB,OAAO,GACrD,aAAWG,IAAY,SAASC,QAChC,UAAArB,GACA,WAAW,IACX,MAAMqB,QACN,UAAWiB,CAAAA,MAAM1B,EAAe0B,EAAEZ,OAAOnC,KAAK,GAC9C,QAAA2B,GACA,SAAAH,GACA,UAAAX,GACA,OAAOmB,GACP,OAAOZ,GACP,GAAIK,EAAAA,CAAU;AAAA,EAAA,GAElB;AAGF,SACE,gBAAAe,EAAC,SAAA,EAAM,WAAWG,EAAGC,EAAOxC,OAAOW,MAAY,YAAY6B,EAAOI,MAAM,GAAE,kBAAA,SACvEjB,UAAAA;AAAAA,IAAAA,KAAgB,gBAAAW,EAAC,QAAA,EAAK,iBAAe7B,KAAYiB,QAAYC,UAAAA,GAAa;AAAA,IAC1EjB,MAAS,QACRyB,IAEA,gBAAAG,EAAC,SAAA,EACC,KAAA9B,GACA,WAAW+B,EAAGC,EAAOE,OAAOvC,GAAWmB,KAAWkB,EAAOlB,OAAO,GAChE,aAAWG,IAAY,SAASC,QAChC,UAAArB,GACA,QAAAkB,GACA,aAAAhB,GACA,UAAAE,GACA,OAAOmB,GACP,MAAAlB,GACA,GAAIE,EAAAA,CAAM;AAAA,EAAA,GAGhB;AAEJ;"}
1
+ {"version":3,"file":"index-DFXqYJat.js","sources":["../src/lib/text.ts","../src/components/input/index.tsx"],"sourcesContent":["export function capitalizeFirstLetter(value: string): string {\n return value ? `${value[0].toLocaleUpperCase()}${value.slice(1)}` : value;\n}\n\nexport function formatInlineLabel(value: string): string {\n const label = capitalizeFirstLetter(value);\n return label && !label.endsWith(':') ? `${label}:` : label;\n}\n","import cx from 'classix';\nimport { useEffect, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { formatInlineLabel } from '@/lib/text';\nimport { useTouched } from '@/lib/use-touched';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n icon?: IconName;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n variant?: 'default' | 'inline';\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n icon,\n label,\n placeholder,\n ref,\n required,\n type = 'text',\n variant = 'default',\n ...props\n}: InputProps) {\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { name, onChange, pattern, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n const inputIcon = icon && type !== 'radio' && type !== 'datetime-local' ? icon : undefined;\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars = inputIcon\n ? {\n '--icon-svg': iconSVG(inputIcon, true),\n }\n : undefined;\n\n useEffect(() => {\n if (onChange && type === 'tel') {\n const target = {\n name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n\n onChange({ target, currentTarget: target } as React.ChangeEvent<HTMLInputElement>);\n }\n }, [countryCode, defaultCountryCode, name, onChange, phoneNumber, type]);\n\n useEffect(() => {\n if (type === 'tel' && !value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [type, value]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={cx(styles.code, styles.input)}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n type='tel'\n className={cx(styles.input, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n maxLength={14}\n name={undefined}\n onChange={(e) => setPhoneNumber(e.target.value)}\n onBlur={onBlur}\n pattern={pattern}\n required={required}\n style={withVars}\n value={phoneNumber}\n {...restProps}\n />\n </>\n );\n\n return (\n <label className={cx(styles.label, variant === 'inline' && styles.inline)}>\n {displayLabel && <span data-required={required || undefined}>{displayLabel}</span>}\n {type === 'tel' ? (\n telephoneInput\n ) : (\n <input\n ref={ref}\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={inputIcon ? 'true' : undefined}\n disabled={disabled}\n onBlur={onBlur}\n placeholder={placeholder}\n required={required}\n style={withVars}\n type={type}\n {...props}\n />\n )}\n </label>\n );\n}\n"],"names":["capitalizeFirstLetter","value","toLocaleUpperCase","slice","formatInlineLabel","label","endsWith","Input","className","defaultCountryCode","disabled","icon","placeholder","ref","required","type","variant","props","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","name","onChange","pattern","restProps","touched","onBlur","useTouched","inputIcon","undefined","displayLabel","withVars","iconSVG","useEffect","target","split","join","currentTarget","telephoneInput","jsxs","Fragment","jsx","cx","styles","code","input","e","inline"],"mappings":";;;;;AAAO,SAASA,EAAsBC,GAAuB;AAC3D,SAAOA,KAAQ,GAAGA,EAAM,CAAC,EAAEC,mBAAmB,GAAGD,EAAME,MAAM,CAAC,CAAC;AACjE;AAEO,SAASC,EAAkBH,GAAuB;AACvD,QAAMI,IAAQL,EAAsBC,CAAK;AACzC,SAAOI,KAAS,CAACA,EAAMC,SAAS,GAA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B,EAAOlB,OAAO,GAChE,aAAWG,IAAY,SAASC,QAChC,UAAArB,GACA,QAAAkB,GACA,aAAAhB,GACA,UAAAE,GACA,OAAOmB,GACP,MAAAlB,GACA,GAAIE,EAAAA,CAAM;AAAA,EAAA,GAGhB;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";require('./assets/index50.css');const u=require("react/jsx-runtime"),v=require("./classix-5H4IWnMA.cjs"),f=require("./icons-DYCSlAoX.cjs"),w=require("./use-touched-D_TJ8wDc.cjs"),C=new Set(["aria-activedescendant","aria-autocomplete","aria-busy","aria-controls","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-required","aria-roledescription","autoComplete","autoFocus","className","defaultValue","dir","disabled","form","id","multiple","name","onBlur","onChange","onClick","onFocus","onInput","onInvalid","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onPointerDown","onPointerUp","required","role","size","style","tabIndex","title","value"]);function h(o){return Object.fromEntries(Object.entries(o).filter(([e])=>e.startsWith("data-")||e.startsWith("aria-")||C.has(e)))}const S=/^--[\w-]+$/,P=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/,_=new Set(["currentcolor","inherit","initial","revert","revert-layer","unset"]),l=typeof document<"u"?document.createElement("span"):null;function p(o){const e=o.trim();if(!e||!l||_.has(e.toLowerCase()))return e;const s=document.body??document.documentElement;if(!s||(l.style.color=e,!l.style.color))return e;s.appendChild(l);const r=getComputedStyle(l).color.trim();return l.remove(),r||e}function y(o,e="currentColor"){var i;if(typeof document>"u")return e;const s=getComputedStyle(document.documentElement),r=new Set;let t=o.trim();for(;t;){const n=t.match(P),a=(n==null?void 0:n[1])??(S.test(t)?t:null),c=(i=n==null?void 0:n[2])==null?void 0:i.trim();if(!a)return p(t);if(r.has(a)){t=c??"";continue}r.add(a),t=s.getPropertyValue(a).trim()||c||""}return p(e)}const q="_select_u6sz6_3",x="_touched_u6sz6_23",z="_label_u6sz6_28",d={select:q,touched:x,label:z},j=({children:o,label:e,placeholder:s,...r})=>{const{touched:t,onBlur:i}=w.useTouched(r.value===""),n=h(r),{style:a,...c}=n,b={...a,"--icon-svg":f.iconSVG("chevron").replace("currentColor",y("--colors-semantic-content-secondary"))},m=u.jsxs("select",{className:v.t(d.select,t&&d.touched),onBlur:i,style:b,...c,children:[s&&u.jsx("option",{value:"",hidden:!0,children:s},"placeholder"),o]});return e?u.jsxs("label",{"data-component":"select",children:[u.jsx("span",{className:d.label,"data-required":r.required||void 0,children:e}),m]}):m};exports.Select=j;exports.resolveColor=y;exports.sanitizeSelectProps=h;
2
- //# sourceMappingURL=index-BOkkyMbX.cjs.map
1
+ "use strict";require('./assets/index51.css');const u=require("react/jsx-runtime"),v=require("./classix-5H4IWnMA.cjs"),f=require("./icons-DYCSlAoX.cjs"),w=require("./use-touched-D_TJ8wDc.cjs"),C=new Set(["aria-activedescendant","aria-autocomplete","aria-busy","aria-controls","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-required","aria-roledescription","autoComplete","autoFocus","className","defaultValue","dir","disabled","form","id","multiple","name","onBlur","onChange","onClick","onFocus","onInput","onInvalid","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onPointerDown","onPointerUp","required","role","size","style","tabIndex","title","value"]);function h(o){return Object.fromEntries(Object.entries(o).filter(([e])=>e.startsWith("data-")||e.startsWith("aria-")||C.has(e)))}const S=/^--[\w-]+$/,P=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/,_=new Set(["currentcolor","inherit","initial","revert","revert-layer","unset"]),l=typeof document<"u"?document.createElement("span"):null;function p(o){const e=o.trim();if(!e||!l||_.has(e.toLowerCase()))return e;const s=document.body??document.documentElement;if(!s||(l.style.color=e,!l.style.color))return e;s.appendChild(l);const r=getComputedStyle(l).color.trim();return l.remove(),r||e}function y(o,e="currentColor"){var i;if(typeof document>"u")return e;const s=getComputedStyle(document.documentElement),r=new Set;let t=o.trim();for(;t;){const n=t.match(P),a=(n==null?void 0:n[1])??(S.test(t)?t:null),c=(i=n==null?void 0:n[2])==null?void 0:i.trim();if(!a)return p(t);if(r.has(a)){t=c??"";continue}r.add(a),t=s.getPropertyValue(a).trim()||c||""}return p(e)}const q="_select_u6sz6_3",x="_touched_u6sz6_23",z="_label_u6sz6_28",d={select:q,touched:x,label:z},j=({children:o,label:e,placeholder:s,...r})=>{const{touched:t,onBlur:i}=w.useTouched(r.value===""),n=h(r),{style:a,...c}=n,b={...a,"--icon-svg":f.iconSVG("chevron").replace("currentColor",y("--colors-semantic-content-secondary"))},m=u.jsxs("select",{className:v.t(d.select,t&&d.touched),onBlur:i,style:b,...c,children:[s&&u.jsx("option",{value:"",hidden:!0,children:s},"placeholder"),o]});return e?u.jsxs("label",{"data-component":"select",children:[u.jsx("span",{className:d.label,"data-required":r.required||void 0,children:e}),m]}):m};exports.Select=j;exports.resolveColor=y;exports.sanitizeSelectProps=h;
2
+ //# sourceMappingURL=index-N4IMha5Q.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BOkkyMbX.cjs","sources":["../src/components/select/sanitize-select-props.ts","../src/lib/color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/lib/color';\nimport { useTouched } from '@/lib/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('chevron').replace(\n 'currentColor',\n resolveColor('--colors-semantic-content-secondary')\n ),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, touched && styles.touched)}\n onBlur={onBlur}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","restSelectProps","withVars","iconSVG","replace","selectElement","jsxs","cx","select","jsx","required","undefined"],"mappings":"gKAAMA,EAAa,IAAIC,IAAI,CACzB,wBACA,oBACA,YACA,gBACA,mBACA,eACA,gBACA,oBACA,gBACA,gBACA,cACA,eACA,oBACA,aACA,kBACA,YACA,YACA,g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color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/lib/color';\nimport { useTouched } from '@/lib/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('chevron').replace(\n 'currentColor',\n resolveColor('--colors-semantic-content-secondary')\n ),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, touched && styles.touched)}\n onBlur={onBlur}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","restSelectProps","withVars","iconSVG","replace","selectElement","jsxs","cx","select","jsx","required","undefined"],"mappings":"gKAAMA,EAAa,IAAIC,IAAI,CACzB,wBACA,oBACA,YACA,gBACA,mBACA,eACA,gBACA,oBACA,gBACA,gBACA,cACA,eACA,oBACA,aACA,kBACA,YACA,YACA,gBACA,uBACA,eACA,YACA,YACA,eACA,MACA,WACA,OACA,KACA,WACA,OACA,SACA,WACA,UACA,UACA,UACA,YACA,YACA,UACA,cACA,YACA,gBACA,cACA,WACA,OACA,OACA,QACA,WACA,QACA,OAAO,CACR,EAEM,SAASC,EAAuDC,EAAU,CAC/E,OAAOC,OAAOC,YACZD,OAAOE,QAAQH,CAAK,EAAEI,OACpB,CAAC,CAACC,CAAG,IAAMA,EAAIC,WAAW,OAAO,GAAKD,EAAIC,WAAW,OAAO,GAAKT,EAAWU,IAAIF,CAAG,CACrF,CACF,CACF,CCzDA,MAAMG,EAAqB,aACrBC,EAA8B,yCAE9BC,EAA0B,IAAIZ,IAAI,CACtC,eACA,UACA,UACA,SACA,eACA,OAAO,CACR,EAEKa,EAAQ,OAAOC,SAAa,IAAcA,SAASC,cAAc,MAAM,EAAI,KAEjF,SAASC,EAAoBC,EAAuB,CAClD,MAAMC,EAAQD,EAAME,KAAAA,EAEpB,GAAI,CAACD,GAAS,CAACL,GAASD,EAAwBH,IAAIS,EAAME,YAAAA,CAAa,EACrE,OAAOF,EAGT,MAAMG,EAAYP,SAASQ,MAAQR,SAASS,gBAQ5C,GANI,CAACF,IAILR,EAAMW,MAAMC,MAAQP,EAEhB,CAACL,EAAMW,MAAMC,OACf,OAAOP,EAG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X,GAAWb,EAAOa,OAAO,EACtD,OAAAC,EACA,MAAOI,EACP,GAAID,EAEHL,SAAAA,CAAAA,SACE,SAAA,CAEC,MAAO,GACP,OAAM,GAELA,YAJG,aAKN,EAEDF,CAAAA,EACH,EAGF,OAAKC,EAKHW,EAAAA,KAAC,QAAA,CAAK,iBAAA,SACJ,SAAA,CAAAG,EAAAA,IAAC,OAAA,CACC,UAAWzB,EAAOW,MAClB,gBAAezC,EAAMwD,UAAYC,OAEhChB,SAAAA,CAAAA,CACH,EACCU,CAAAA,EACH,EAZOA,CAcX"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/index.css');const e=require("./components/app-link/index.cjs"),n=require("./components/aside/index.cjs"),o=require("./components/avatar/index.cjs"),t=require("./components/badge/index.cjs"),r=require("./components/banner/index.cjs"),i=require("./components/branding/index.cjs"),s=require("./components/button/index.cjs"),c=require("./components/card/index.cjs"),_=require("./components/checkbox/index.cjs"),p=require("./components/chip/index.cjs"),a=require("./components/collapsible/index.cjs"),d=require("./components/controls/index.cjs"),u=require("./components/croppable/index.cjs"),m=require("./components/dialog/index.cjs"),x=require("./components/dropdown/index.cjs"),q=require("./components/dropzone/index.cjs"),l=require("./components/editor/index.cjs"),g=require("./components/empty-state/index.cjs"),b=require("./components/fieldset/index.cjs"),h=require("./components/figure/index.cjs"),T=require("./components/file/index.cjs"),C=require("./components/footer/index.cjs"),S=require("./components/form/index.cjs"),v=require("./components/graph/index.cjs"),F=require("./components/group/index.cjs"),f=require("./components/header/index.cjs"),k=require("./components/icon/index.cjs"),L=require("./components/iframe/index.cjs"),B=require("./components/image/index.cjs"),I=require("./index-iItPktfX.cjs"),M=require("./components/link/index.cjs"),A=require("./components/list/index.cjs"),D=require("./components/loading/index.cjs"),y=require("./components/menu/index.cjs"),P=require("./components/message/index.cjs"),j=require("./components/messages/index.cjs"),w=require("./components/nav/index.cjs"),E=require("./components/object/index.cjs"),G=require("./components/popover/index.cjs"),z=require("./components/portal/index.cjs"),O=require("./components/search/index.cjs"),H=require("./index-BOkkyMbX.cjs"),N=require("./components/sortable/index.cjs"),W=require("./components/table/index.cjs"),J=require("./components/textarea/index.cjs"),K=require("./components/toast/index.cjs"),Q=require("./components/toasts/index.cjs"),R=require("./components/toggle/index.cjs"),U=require("./components/toolbar/index.cjs"),V=require("./components/widget/index.cjs");exports.AppLink=e.AppLink;exports.Aside=n.Aside;exports.Avatar=o.Avatar;exports.Badge=t.Badge;exports.Banner=r.Banner;exports.Branding=i.Branding;exports.Button=s.Button;exports.Card=c.Card;exports.Checkbox=_.Checkbox;exports.Chip=p.Chip;exports.Collapsible=a.Collapsible;exports.Controls=d.Controls;exports.Croppable=u.Croppable;exports.Dialog=m.Dialog;exports.Dropdown=x.Dropdown;exports.Dropzone=q.Dropzone;exports.Editor=l.Editor;exports.EmptyState=g.EmptyState;exports.Fieldset=b.Fieldset;exports.Figure=h.Figure;exports.File=T.File;exports.Footer=C.Footer;exports.Form=S.Form;exports.Graph=v.Graph;exports.Group=F.Group;exports.Header=f.Header;exports.Icon=k.Icon;exports.Iframe=L.Iframe;exports.Image=B.Image;exports.Input=I.Input;exports.Link=M.Link;exports.List=A.List;exports.Loading=D.Loading;exports.Menu=y.Menu;exports.Message=P.Message;exports.Messages=j.Messages;exports.Nav=w.Nav;exports.Object=E.Object;exports.Popover=G.Popover;exports.Portal=z.Portal;exports.Search=O.Search;exports.Select=H.Select;exports.Sortable=N.Sortable;exports.Table=W.Table;exports.Textarea=J.Textarea;exports.Toast=K.Toast;exports.Toasts=Q.Toasts;exports.Toggle=R.Toggle;exports.Toolbar=U.Toolbar;exports.Widget=V.Widget;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/index.css');const e=require("./components/app-link/index.cjs"),n=require("./components/aside/index.cjs"),o=require("./components/avatar/index.cjs"),t=require("./components/badge/index.cjs"),r=require("./components/banner/index.cjs"),i=require("./components/branding/index.cjs"),s=require("./components/button/index.cjs"),c=require("./components/card/index.cjs"),_=require("./components/checkbox/index.cjs"),p=require("./components/chip/index.cjs"),a=require("./components/collapsible/index.cjs"),d=require("./components/controls/index.cjs"),u=require("./components/croppable/index.cjs"),m=require("./components/dialog/index.cjs"),x=require("./components/dropdown/index.cjs"),l=require("./components/dropzone/index.cjs"),q=require("./components/editor/index.cjs"),g=require("./components/empty-state/index.cjs"),b=require("./components/fieldset/index.cjs"),T=require("./components/figure/index.cjs"),h=require("./components/file/index.cjs"),C=require("./components/footer/index.cjs"),S=require("./components/form/index.cjs"),v=require("./components/graph/index.cjs"),F=require("./components/group/index.cjs"),f=require("./components/header/index.cjs"),k=require("./components/icon/index.cjs"),L=require("./components/iframe/index.cjs"),B=require("./components/image/index.cjs"),I=require("./index-CP5A_BGJ.cjs"),M=require("./components/link/index.cjs"),A=require("./components/list/index.cjs"),D=require("./components/loading/index.cjs"),y=require("./components/menu/index.cjs"),P=require("./components/message/index.cjs"),j=require("./components/messages/index.cjs"),w=require("./components/nav/index.cjs"),E=require("./components/object/index.cjs"),G=require("./components/popover/index.cjs"),z=require("./components/portal/index.cjs"),O=require("./components/search/index.cjs"),H=require("./index-N4IMha5Q.cjs"),N=require("./components/sortable/index.cjs"),W=require("./components/table/index.cjs"),J=require("./components/textarea/index.cjs"),K=require("./components/toast/index.cjs"),Q=require("./components/toasts/index.cjs"),R=require("./components/toggle/index.cjs"),U=require("./components/toolbar/index.cjs"),V=require("./components/tooltip/index.cjs"),X=require("./components/widget/index.cjs");exports.AppLink=e.AppLink;exports.Aside=n.Aside;exports.Avatar=o.Avatar;exports.Badge=t.Badge;exports.Banner=r.Banner;exports.Branding=i.Branding;exports.Button=s.Button;exports.Card=c.Card;exports.Checkbox=_.Checkbox;exports.Chip=p.Chip;exports.Collapsible=a.Collapsible;exports.Controls=d.Controls;exports.Croppable=u.Croppable;exports.Dialog=m.Dialog;exports.Dropdown=x.Dropdown;exports.Dropzone=l.Dropzone;exports.Editor=q.Editor;exports.EmptyState=g.EmptyState;exports.Fieldset=b.Fieldset;exports.Figure=T.Figure;exports.File=h.File;exports.Footer=C.Footer;exports.Form=S.Form;exports.Graph=v.Graph;exports.Group=F.Group;exports.Header=f.Header;exports.Icon=k.Icon;exports.Iframe=L.Iframe;exports.Image=B.Image;exports.Input=I.Input;exports.Link=M.Link;exports.List=A.List;exports.Loading=D.Loading;exports.Menu=y.Menu;exports.Message=P.Message;exports.Messages=j.Messages;exports.Nav=w.Nav;exports.Object=E.Object;exports.Popover=G.Popover;exports.Portal=z.Portal;exports.Search=O.Search;exports.Select=H.Select;exports.Sortable=N.Sortable;exports.Table=W.Table;exports.Textarea=J.Textarea;exports.Toast=K.Toast;exports.Toasts=Q.Toasts;exports.Toggle=R.Toggle;exports.Toolbar=U.Toolbar;exports.Tooltip=V.Tooltip;exports.Widget=X.Widget;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -761,6 +761,14 @@ declare type ToolbarProps = {
761
761
  variant?: 'default' | 'editor';
762
762
  };
763
763
 
764
+ export declare const Tooltip: ({ variant, children, iconName, ...props }: TooltipProps) => JSX.Element;
765
+
766
+ declare type TooltipProps = {
767
+ children?: React.ReactNode;
768
+ iconName?: IconName;
769
+ variant?: keyof typeof variants_9;
770
+ };
771
+
764
772
  declare const variants: {
765
773
  default: string;
766
774
  sidebar: string;
@@ -809,6 +817,11 @@ declare const variants_8: {
809
817
  tabs: string;
810
818
  };
811
819
 
820
+ declare const variants_9: {
821
+ default: string;
822
+ static: string;
823
+ };
824
+
812
825
  export declare const Widget: ({ children, ...props }: WidgetProps) => JSX.Element;
813
826
 
814
827
  declare type WidgetProps = {
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import { AppLink as e } from "./components/app-link/index.js";
2
2
  import { Aside as p } from "./components/aside/index.js";
3
3
  import { Avatar as x } from "./components/avatar/index.js";
4
4
  import { Badge as a } from "./components/badge/index.js";
5
- import { Banner as i } from "./components/banner/index.js";
5
+ import { Banner as l } from "./components/banner/index.js";
6
6
  import { Branding as n } from "./components/branding/index.js";
7
7
  import { Button as d } from "./components/button/index.js";
8
- import { Card as C } from "./components/card/index.js";
8
+ import { Card as T } from "./components/card/index.js";
9
9
  import { Checkbox as c } from "./components/checkbox/index.js";
10
10
  import { Chip as F } from "./components/chip/index.js";
11
11
  import { Collapsible as S } from "./components/collapsible/index.js";
@@ -27,19 +27,19 @@ import { Header as _ } from "./components/header/index.js";
27
27
  import { Icon as oo } from "./components/icon/index.js";
28
28
  import { Iframe as eo } from "./components/iframe/index.js";
29
29
  import { Image as po } from "./components/image/index.js";
30
- import { I as xo } from "./index-DS2cY2g4.js";
30
+ import { I as xo } from "./index-DFXqYJat.js";
31
31
  import { Link as ao } from "./components/link/index.js";
32
- import { List as io } from "./components/list/index.js";
32
+ import { List as lo } from "./components/list/index.js";
33
33
  import { Loading as no } from "./components/loading/index.js";
34
34
  import { Menu as bo } from "./components/menu/index.js";
35
- import { Message as To } from "./components/message/index.js";
35
+ import { Message as Co } from "./components/message/index.js";
36
36
  import { Messages as uo } from "./components/messages/index.js";
37
37
  import { Nav as Io } from "./components/nav/index.js";
38
38
  import { Object as ho } from "./components/object/index.js";
39
39
  import { Popover as Lo } from "./components/popover/index.js";
40
40
  import { Portal as vo } from "./components/portal/index.js";
41
41
  import { Search as Do } from "./components/search/index.js";
42
- import { S as Eo } from "./index-D-AyCDg7.js";
42
+ import { S as Eo } from "./index-B9xtLe2w.js";
43
43
  import { Sortable as Po } from "./components/sortable/index.js";
44
44
  import { Table as wo } from "./components/table/index.js";
45
45
  import { Textarea as zo } from "./components/textarea/index.js";
@@ -47,16 +47,17 @@ import { Toast as No } from "./components/toast/index.js";
47
47
  import { Toasts as Wo } from "./components/toasts/index.js";
48
48
  import { Toggle as Jo } from "./components/toggle/index.js";
49
49
  import { Toolbar as Qo } from "./components/toolbar/index.js";
50
- import { Widget as Uo } from "./components/widget/index.js";
50
+ import { Tooltip as Uo } from "./components/tooltip/index.js";
51
+ import { Widget as Xo } from "./components/widget/index.js";
51
52
  import './assets/index.css';export {
52
53
  e as AppLink,
53
54
  p as Aside,
54
55
  x as Avatar,
55
56
  a as Badge,
56
- i as Banner,
57
+ l as Banner,
57
58
  n as Branding,
58
59
  d as Button,
59
- C as Card,
60
+ T as Card,
60
61
  c as Checkbox,
61
62
  F as Chip,
62
63
  S as Collapsible,
@@ -80,10 +81,10 @@ import './assets/index.css';export {
80
81
  po as Image,
81
82
  xo as Input,
82
83
  ao as Link,
83
- io as List,
84
+ lo as List,
84
85
  no as Loading,
85
86
  bo as Menu,
86
- To as Message,
87
+ Co as Message,
87
88
  uo as Messages,
88
89
  Io as Nav,
89
90
  ho as Object,
@@ -98,6 +99,7 @@ import './assets/index.css';export {
98
99
  Wo as Toasts,
99
100
  Jo as Toggle,
100
101
  Qo as Toolbar,
101
- Uo as Widget
102
+ Uo as Tooltip,
103
+ Xo as Widget
102
104
  };
103
105
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/tokens.json CHANGED
@@ -358,7 +358,7 @@
358
358
  },
359
359
  "com.solibo": {
360
360
  "packageName": "@solibo/solibo-ui",
361
- "packageVersion": "1.0.1"
361
+ "packageVersion": "1.0.3"
362
362
  }
363
363
  },
364
364
  "$name": "Solibo UI Tokens",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solibo/solibo-ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "pnpm run tokens:build && vite build --watch",