@chotot/clad-ui 3.0.0 → 3.0.1

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 (257) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +9 -9
  3. package/dist/{chunk-Bmb41Sf3.cjs → _virtual/_rolldown/runtime.cjs} +1 -1
  4. package/dist/brand/ChototLogoText.cjs +1 -0
  5. package/dist/brand/ChototLogoText.es.js +15 -0
  6. package/dist/brand/CtC2C.cjs +1 -0
  7. package/dist/brand/CtC2C.es.js +18 -0
  8. package/dist/brand/CtProperty.cjs +1 -0
  9. package/dist/brand/CtProperty.es.js +204 -0
  10. package/dist/brand/CtVehicle.cjs +1 -0
  11. package/dist/brand/CtVehicle.es.js +70 -0
  12. package/dist/brand/Tot.cjs +1 -0
  13. package/dist/brand/Tot.es.js +17 -0
  14. package/dist/components/Announcer/Announcer.cjs +1 -0
  15. package/dist/components/Announcer/Announcer.es.js +100 -0
  16. package/dist/components/Announcer/announcer.styles.cjs +1 -0
  17. package/dist/components/Announcer/announcer.styles.es.js +24 -0
  18. package/dist/components/Badge/Badge.cjs +1 -0
  19. package/dist/components/Badge/Badge.es.js +83 -0
  20. package/dist/components/Badge/badge.styles.cjs +1 -0
  21. package/dist/components/Badge/badge.styles.es.js +83 -0
  22. package/dist/components/Box/Box.cjs +1 -0
  23. package/dist/components/Box/Box.es.js +72 -0
  24. package/dist/components/Breadcrumbs/BreadcrumbItem.cjs +1 -0
  25. package/dist/components/Breadcrumbs/BreadcrumbItem.es.js +17 -0
  26. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -0
  27. package/dist/components/Breadcrumbs/Breadcrumbs.es.js +44 -0
  28. package/dist/components/Breadcrumbs/breadcrumbs.styles.cjs +1 -0
  29. package/dist/components/Breadcrumbs/breadcrumbs.styles.es.js +5 -0
  30. package/dist/components/Button/Button.cjs +1 -0
  31. package/dist/components/Button/Button.es.js +41 -0
  32. package/dist/components/Button/ButtonLink.cjs +1 -0
  33. package/dist/components/Button/ButtonLink.es.js +5 -0
  34. package/dist/components/Button/GhostButton.cjs +1 -0
  35. package/dist/components/Button/GhostButton.es.js +25 -0
  36. package/dist/components/Button/IconButton.cjs +1 -0
  37. package/dist/components/Button/IconButton.es.js +13 -0
  38. package/dist/components/Button/button.styles.cjs +1 -0
  39. package/dist/components/Button/button.styles.es.js +100 -0
  40. package/dist/components/Checkbox/Checkbox.cjs +1 -0
  41. package/dist/components/Checkbox/Checkbox.es.js +43 -0
  42. package/dist/components/Checkbox/checkbox.styles.cjs +1 -0
  43. package/dist/components/Checkbox/checkbox.styles.es.js +15 -0
  44. package/dist/components/Chip/Chip.cjs +1 -0
  45. package/dist/components/Chip/Chip.es.js +35 -0
  46. package/dist/components/Chip/chip.styles.cjs +1 -0
  47. package/dist/components/Chip/chip.styles.es.js +33 -0
  48. package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
  49. package/dist/components/CurrencyInput/CurrencyInput.es.js +142 -0
  50. package/dist/components/CurrencyInput/currency-input.styles.cjs +1 -0
  51. package/dist/components/CurrencyInput/currency-input.styles.es.js +13 -0
  52. package/dist/components/CurrencyInput/utils.cjs +1 -0
  53. package/dist/components/CurrencyInput/utils.es.js +30 -0
  54. package/dist/components/DatePicker/DatePicker.cjs +1 -0
  55. package/dist/components/DatePicker/DatePicker.es.js +354 -0
  56. package/dist/components/DatePicker/DateTimePicker.cjs +1 -0
  57. package/dist/components/DatePicker/DateTimePicker.es.js +416 -0
  58. package/dist/components/DatePicker/date-picker.styles.cjs +1 -0
  59. package/dist/components/DatePicker/date-picker.styles.es.js +8 -0
  60. package/dist/components/DatePicker/date-time-picker.styles.cjs +1 -0
  61. package/dist/components/DatePicker/date-time-picker.styles.es.js +8 -0
  62. package/dist/components/DatePicker/index.d.ts +2 -1
  63. package/dist/components/DatePicker/types.cjs +1 -0
  64. package/dist/components/DatePicker/types.es.js +6 -0
  65. package/dist/components/Drawer/Drawer.cjs +1 -0
  66. package/dist/components/Drawer/Drawer.es.js +407 -0
  67. package/dist/components/Dropdown/Dropdown.cjs +1 -0
  68. package/dist/components/Dropdown/Dropdown.es.js +145 -0
  69. package/dist/components/Dropdown/dropdown.styles.cjs +1 -0
  70. package/dist/components/Dropdown/dropdown.styles.es.js +12 -0
  71. package/dist/components/EmptyState/EmptyState.cjs +2 -0
  72. package/dist/components/EmptyState/EmptyState.es.js +114 -0
  73. package/dist/components/EmptyState/empty-state.styles.cjs +1 -0
  74. package/dist/components/EmptyState/empty-state.styles.es.js +5 -0
  75. package/dist/components/Grid/Col.cjs +1 -0
  76. package/dist/components/Grid/Col.es.js +37 -0
  77. package/dist/components/Grid/Grid.cjs +1 -0
  78. package/dist/components/Grid/Grid.es.js +66 -0
  79. package/dist/components/Input/Input.cjs +1 -0
  80. package/dist/components/Input/Input.es.js +122 -0
  81. package/dist/components/Input/input.styles.cjs +1 -0
  82. package/dist/components/Input/input.styles.es.js +14 -0
  83. package/dist/components/InputGroup/InputGroup.cjs +1 -0
  84. package/dist/components/InputGroup/InputGroup.es.js +16 -0
  85. package/dist/components/InputGroup/input-group.styles.cjs +1 -0
  86. package/dist/components/InputGroup/input-group.styles.es.js +12 -0
  87. package/dist/components/LegacyDialog/DialogMainIcon.cjs +1 -0
  88. package/dist/components/LegacyDialog/DialogMainIcon.es.js +52 -0
  89. package/dist/components/LegacyDialog/LegacyDialog.cjs +1 -0
  90. package/dist/components/LegacyDialog/LegacyDialog.es.js +54 -0
  91. package/dist/components/LegacyPopup/LegacyPopup.cjs +1 -0
  92. package/dist/components/LegacyPopup/LegacyPopup.es.js +72 -0
  93. package/dist/components/MultiSearchDropdown/MultiSearchDropdown.cjs +1 -0
  94. package/dist/components/MultiSearchDropdown/MultiSearchDropdown.es.js +206 -0
  95. package/dist/components/MultiSearchDropdown/multi-search-dropdown.styles.cjs +1 -0
  96. package/dist/components/MultiSearchDropdown/multi-search-dropdown.styles.es.js +12 -0
  97. package/dist/components/Pagination/PageItem.cjs +1 -0
  98. package/dist/components/Pagination/PageItem.es.js +20 -0
  99. package/dist/components/Pagination/Pagination.cjs +1 -0
  100. package/dist/components/Pagination/Pagination.es.js +84 -0
  101. package/dist/components/Pagination/pagination.styles.cjs +1 -0
  102. package/dist/components/Pagination/pagination.styles.es.js +15 -0
  103. package/dist/components/Pagination/types.d.ts +1 -1
  104. package/dist/components/Popover/Popover.cjs +1 -0
  105. package/dist/components/Popover/Popover.es.js +54 -0
  106. package/dist/components/Popover/popover.styles.cjs +1 -0
  107. package/dist/components/Popover/popover.styles.es.js +5 -0
  108. package/dist/components/Popup/Popup.cjs +1 -0
  109. package/dist/components/Popup/Popup.es.js +148 -0
  110. package/dist/components/RadioButton/RadioButton.cjs +1 -0
  111. package/dist/components/RadioButton/RadioButton.es.js +61 -0
  112. package/dist/components/RadioButton/radio-button.styles.cjs +1 -0
  113. package/dist/components/RadioButton/radio-button.styles.es.js +15 -0
  114. package/dist/components/RangeInput/RangeInput.cjs +1 -0
  115. package/dist/components/RangeInput/RangeInput.es.js +32 -0
  116. package/dist/components/RangeInput/range-input.styles.cjs +1 -0
  117. package/dist/components/RangeInput/range-input.styles.es.js +5 -0
  118. package/dist/components/RowItem/RowItem.cjs +1 -0
  119. package/dist/components/RowItem/RowItem.es.js +56 -0
  120. package/dist/components/RowItem/rowitem.styles.cjs +1 -0
  121. package/dist/components/RowItem/rowitem.styles.es.js +23 -0
  122. package/dist/components/SearchInput/SearchInput.cjs +1 -0
  123. package/dist/components/SearchInput/SearchInput.es.js +129 -0
  124. package/dist/components/SearchInput/search-input.styles.cjs +1 -0
  125. package/dist/components/SearchInput/search-input.styles.es.js +12 -0
  126. package/dist/components/Searchbar/Searchbar.cjs +1 -0
  127. package/dist/components/Searchbar/Searchbar.es.js +51 -0
  128. package/dist/components/Searchbar/searchbar.styles.cjs +1 -0
  129. package/dist/components/Searchbar/searchbar.styles.es.js +5 -0
  130. package/dist/components/ShapeIcon/ShapeIcon.cjs +1 -0
  131. package/dist/components/ShapeIcon/ShapeIcon.es.js +22 -0
  132. package/dist/components/ShapeIcon/shape-icon.styles.cjs +1 -0
  133. package/dist/components/ShapeIcon/shape-icon.styles.es.js +65 -0
  134. package/dist/components/Slider/Slider.cjs +1 -0
  135. package/dist/components/Slider/Slider.es.js +169 -0
  136. package/dist/components/Slider/slider.styles.cjs +1 -0
  137. package/dist/components/Slider/slider.styles.es.js +5 -0
  138. package/dist/components/Snack/Snack.cjs +1 -0
  139. package/dist/components/Snack/Snack.es.js +69 -0
  140. package/dist/components/Snack/snack.styles.cjs +1 -0
  141. package/dist/components/Snack/snack.styles.es.js +13 -0
  142. package/dist/components/Tabs/Tab.cjs +1 -0
  143. package/dist/components/Tabs/Tab.es.js +42 -0
  144. package/dist/components/Tabs/Tabs.cjs +1 -0
  145. package/dist/components/Tabs/Tabs.es.js +80 -0
  146. package/dist/components/Tabs/tabs.styles.cjs +1 -0
  147. package/dist/components/Tabs/tabs.styles.es.js +33 -0
  148. package/dist/components/TagCloud/TagCloud.cjs +1 -0
  149. package/dist/components/TagCloud/TagCloud.es.js +47 -0
  150. package/dist/components/TagCloud/tagcloud.styles.cjs +1 -0
  151. package/dist/components/TagCloud/tagcloud.styles.es.js +12 -0
  152. package/dist/components/TextArea/TextArea.cjs +1 -0
  153. package/dist/components/TextArea/TextArea.es.js +104 -0
  154. package/dist/components/TextArea/text-area.styles.cjs +1 -0
  155. package/dist/components/TextArea/text-area.styles.es.js +13 -0
  156. package/dist/components/TextLabel/TextLabel.cjs +1 -0
  157. package/dist/components/TextLabel/TextLabel.es.js +28 -0
  158. package/dist/components/TextLabel/textlabel.styles.cjs +1 -0
  159. package/dist/components/TextLabel/textlabel.styles.es.js +29 -0
  160. package/dist/components/ToggleSwitch/ToggleSwitch.cjs +1 -0
  161. package/dist/components/ToggleSwitch/ToggleSwitch.es.js +37 -0
  162. package/dist/components/ToggleSwitch/toggle-switch.styles.cjs +1 -0
  163. package/dist/components/ToggleSwitch/toggle-switch.styles.es.js +24 -0
  164. package/dist/components/Tooltip/Tooltip.cjs +1 -0
  165. package/dist/components/Tooltip/Tooltip.es.js +103 -0
  166. package/dist/components/Tooltip/tooltip.styles.cjs +1 -0
  167. package/dist/components/Tooltip/tooltip.styles.es.js +12 -0
  168. package/dist/forge/index.cjs +1 -0
  169. package/dist/icons.cjs +1 -1
  170. package/dist/index.cjs +1 -0
  171. package/dist/index.es.js +82 -0
  172. package/dist/styles.css +1 -1
  173. package/dist/types/index.cjs +1 -0
  174. package/dist/types/index.es.js +7 -0
  175. package/dist/typography/BodyAnnotation.cjs +1 -0
  176. package/dist/typography/BodyAnnotation.es.js +10 -0
  177. package/dist/typography/BodyCaption.cjs +1 -0
  178. package/dist/typography/BodyCaption.es.js +10 -0
  179. package/dist/typography/BodyPage.cjs +1 -0
  180. package/dist/typography/BodyPage.es.js +10 -0
  181. package/dist/typography/BodySection.cjs +1 -0
  182. package/dist/typography/BodySection.es.js +10 -0
  183. package/dist/typography/DisplayAnnotation.cjs +1 -0
  184. package/dist/typography/DisplayAnnotation.es.js +10 -0
  185. package/dist/typography/DisplayCaption.cjs +1 -0
  186. package/dist/typography/DisplayCaption.es.js +10 -0
  187. package/dist/typography/DisplayPage.cjs +1 -0
  188. package/dist/typography/DisplayPage.es.js +10 -0
  189. package/dist/typography/DisplayPrice.cjs +1 -0
  190. package/dist/typography/DisplayPrice.es.js +10 -0
  191. package/dist/typography/DisplaySection.cjs +1 -0
  192. package/dist/typography/DisplaySection.es.js +10 -0
  193. package/dist/typography/HeaderAnnotation.cjs +1 -0
  194. package/dist/typography/HeaderAnnotation.es.js +10 -0
  195. package/dist/typography/HeaderCaption.cjs +1 -0
  196. package/dist/typography/HeaderCaption.es.js +10 -0
  197. package/dist/typography/HeaderPage.cjs +1 -0
  198. package/dist/typography/HeaderPage.es.js +10 -0
  199. package/dist/typography/HeaderSection.cjs +1 -0
  200. package/dist/typography/HeaderSection.es.js +10 -0
  201. package/dist/typography/LabelAnnotation.cjs +1 -0
  202. package/dist/typography/LabelAnnotation.es.js +10 -0
  203. package/dist/typography/LabelCaption.cjs +1 -0
  204. package/dist/typography/LabelCaption.es.js +10 -0
  205. package/dist/typography/LabelPage.cjs +1 -0
  206. package/dist/typography/LabelPage.es.js +10 -0
  207. package/dist/typography/LabelSection.cjs +1 -0
  208. package/dist/typography/LabelSection.es.js +10 -0
  209. package/dist/typography/NoteCaption.cjs +1 -0
  210. package/dist/typography/NoteCaption.es.js +10 -0
  211. package/dist/typography/NotePage.cjs +1 -0
  212. package/dist/typography/NotePage.es.js +10 -0
  213. package/dist/typography/NoteSection.cjs +1 -0
  214. package/dist/typography/NoteSection.es.js +10 -0
  215. package/dist/typography/TaglineAnnotation.cjs +1 -0
  216. package/dist/typography/TaglineAnnotation.es.js +10 -0
  217. package/dist/typography/TaglineCaption.cjs +1 -0
  218. package/dist/typography/TaglineCaption.es.js +10 -0
  219. package/dist/typography/TaglineFootext.cjs +1 -0
  220. package/dist/typography/TaglineFootext.es.js +10 -0
  221. package/dist/typography/TaglineSection.cjs +1 -0
  222. package/dist/typography/TaglineSection.es.js +10 -0
  223. package/dist/utils/bundleCss.cjs +1 -1
  224. package/dist/utils/cleanHtml.cjs +1 -0
  225. package/dist/utils/cleanHtml.es.js +6 -0
  226. package/dist/utils/cn.cjs +1 -0
  227. package/dist/utils/cn.es.js +59 -0
  228. package/dist/utils/createUniversalPortal.cjs +1 -0
  229. package/dist/utils/createUniversalPortal.es.js +17 -0
  230. package/dist/utils/floating.cjs +1 -0
  231. package/dist/utils/floating.es.js +374 -0
  232. package/dist/utils/getBreakpointsValues.cjs +1 -0
  233. package/dist/utils/getBreakpointsValues.es.js +27 -0
  234. package/dist/utils/sizes.cjs +1 -0
  235. package/dist/utils/sizes.es.js +30 -0
  236. package/dist/utils/themeTokens.cjs +1 -0
  237. package/dist/utils/themeTokens.es.js +319 -0
  238. package/dist/utils/useBodyScrollLock.cjs +1 -0
  239. package/dist/utils/useBodyScrollLock.es.js +24 -0
  240. package/dist/utils/useScrollTop.cjs +1 -0
  241. package/dist/utils/useScrollTop.es.js +9 -0
  242. package/package.json +6 -6
  243. package/scripts/postinstall.cjs +34 -6
  244. package/skills/clad-ui/SKILL.md +3 -1
  245. package/skills/clad-ui-feedback/SKILL.md +1 -1
  246. package/skills/migrate-clad-ui-v3/SKILL.md +4 -2
  247. package/skills/migrate-clad-ui-v3/references/component-api-changes.md +42 -0
  248. package/skills/migrate-clad-ui-v3/references/token-and-linaria-mapping.md +4 -1
  249. package/src/styles/preset.css +1 -1
  250. package/dist/clad-ui.cjs +0 -2
  251. package/dist/clad-ui.d.ts +0 -2
  252. package/dist/clad-ui.es.js +0 -9791
  253. package/dist/components/Drawer/Drawer.pw.fixtures.d.ts +0 -9
  254. package/dist/components/Grid/Grid.pw.fixtures.d.ts +0 -3
  255. package/dist/components/Popover/Popover.pw.fixtures.d.ts +0 -6
  256. package/dist/components/Popup/Popup.pw.fixtures.d.ts +0 -5
  257. package/dist/components/Tooltip/Tooltip.pw.fixtures.d.ts +0 -1
@@ -0,0 +1,15 @@
1
+ import { tv as e } from "tailwind-variants/lite";
2
+ //#region src/components/RadioButton/radio-button.styles.ts
3
+ var t = e({
4
+ base: "radio",
5
+ defaultVariants: { color: "primary" },
6
+ variants: { color: {
7
+ primary: "radio--primary",
8
+ info: "radio--info",
9
+ success: "radio--success",
10
+ error: "radio--error",
11
+ neutral: "radio--neutral"
12
+ } }
13
+ });
14
+ //#endregion
15
+ export { t as radioButtonVariants };
@@ -0,0 +1 @@
1
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/cn.cjs`),n=require(`./range-input.styles.cjs`);let r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`);var a=({children:e,helptext:a=``,helptextClassName:o=``,className:s=``,status:c=`default`,separatorComponent:l,...u})=>{let d=c===`error`;return(0,i.jsxs)(`div`,{...u,className:t.default(n.rangeInputStyles(),s),"data-clad":`Range Input`,children:[(0,i.jsx)(`div`,{className:`range-input-wrapper`,children:r.Children.map(e,(e,t)=>{let n=e?.key??t,r=null;return t>0&&(r=l||(0,i.jsx)(`p`,{className:`range-input-separator`,children:`-`})),(0,i.jsxs)(`span`,{className:`separator-wrapper`,children:[r,e]},n)})}),a?(0,i.jsx)(`p`,{className:t.default(`range-input-helptext`,o,d&&`error`),children:a}):null]})};a.displayName=`RangeInput`,exports.default=a;
@@ -0,0 +1,32 @@
1
+ import e from "../../utils/cn.es.js";
2
+ import { rangeInputStyles as t } from "./range-input.styles.es.js";
3
+ import * as n from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/components/RangeInput/RangeInput.tsx
6
+ var a = ({ children: a, helptext: o = "", helptextClassName: s = "", className: c = "", status: l = "default", separatorComponent: u, ...d }) => {
7
+ let f = l === "error";
8
+ return /* @__PURE__ */ i("div", {
9
+ ...d,
10
+ className: e(t(), c),
11
+ "data-clad": "Range Input",
12
+ children: [/* @__PURE__ */ r("div", {
13
+ className: "range-input-wrapper",
14
+ children: n.Children.map(a, (e, t) => {
15
+ let n = e?.key ?? t, a = null;
16
+ return t > 0 && (a = u || /* @__PURE__ */ r("p", {
17
+ className: "range-input-separator",
18
+ children: "-"
19
+ })), /* @__PURE__ */ i("span", {
20
+ className: "separator-wrapper",
21
+ children: [a, e]
22
+ }, n);
23
+ })
24
+ }), o ? /* @__PURE__ */ r("p", {
25
+ className: e("range-input-helptext", s, f && "error"),
26
+ children: o
27
+ }) : null]
28
+ });
29
+ };
30
+ a.displayName = "RangeInput";
31
+ //#endregion
32
+ export { a as default };
@@ -0,0 +1 @@
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`range-input-container`});exports.rangeInputStyles=e;
@@ -0,0 +1,5 @@
1
+ import { tv as e } from "tailwind-variants/lite";
2
+ //#region src/components/RangeInput/range-input.styles.ts
3
+ var t = e({ base: "range-input-container" });
4
+ //#endregion
5
+ export { t as rangeInputStyles };
@@ -0,0 +1 @@
1
+ "use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../Checkbox/Checkbox.cjs`),n=require(`../RadioButton/RadioButton.cjs`),r=require(`./rowitem.styles.cjs`);let i=require(`react`),a=require(`@chotot/icons`);var o=({name:o,size:s=`md`,icon:c,border:l=`none`,type:u=`list`,inverted:d=!1,onClick:f,onChange:p,value:m,checked:h=!1,children:g=`Default Row`,description:_=``,collapsibleContent:v,isCollapsed:y=!1,onCollapseChange:b,className:x,...S})=>{let[C,w]=(0,i.useState)(h);(0,i.useEffect)(()=>{w(h)},[h]);let T=e=>{u===`list`||u===`chevron`||u===`accordion`?f?.(e):e.target.value||p?.({value:m,checked:!C}),u===`accordion`&&b?.(!y)},E=(()=>{switch(u){case`checkbox`:return(0,i.createElement)(t.default,{name:o,checked:C,value:m});case`radio`:return(0,i.createElement)(n.default,{name:o,checked:C,value:m});case`chevron`:return(0,i.createElement)(a.ChevronRight,{width:16,height:16,"aria-hidden":!0});case`accordion`:return y?(0,i.createElement)(a.ChevronUp,{width:16,height:16,"aria-hidden":!0}):(0,i.createElement)(a.ChevronDown,{width:16,height:16,"aria-hidden":!0});default:return null}})(),D=e.default(`row-item__top-row`,d&&`row-item__top-row--inverted`);return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(`div`,{...S,className:e.default(r.rowItemVariants({size:s,border:l}),x),onClick:T,"data-clad":`Row Item`},(0,i.createElement)(`div`,{className:D},c?(0,i.createElement)(`div`,{className:`row-item__icon`},c):null,(0,i.createElement)(`div`,{className:`row-item__text`},g),(0,i.createElement)(`div`,{className:`row-item__icon`},E)),_?(0,i.createElement)(`div`,{className:`row-item__description`},_):null),y&&v?(0,i.createElement)(`div`,{className:`row-item__collapsible`},v):null)};o.displayName=`RowItem`,exports.default=o;
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import e from "../../utils/cn.es.js";
3
+ import t from "../Checkbox/Checkbox.es.js";
4
+ import n from "../RadioButton/RadioButton.es.js";
5
+ import { rowItemVariants as r } from "./rowitem.styles.es.js";
6
+ import { Fragment as i, createElement as a, useEffect as o, useState as s } from "react";
7
+ import { ChevronDown as c, ChevronRight as l, ChevronUp as u } from "@chotot/icons";
8
+ //#region src/components/RowItem/RowItem.tsx
9
+ var d = ({ name: d, size: f = "md", icon: p, border: m = "none", type: h = "list", inverted: g = !1, onClick: _, onChange: v, value: y, checked: b = !1, children: x = "Default Row", description: S = "", collapsibleContent: C, isCollapsed: w = !1, onCollapseChange: T, className: E, ...D }) => {
10
+ let [O, k] = s(b);
11
+ o(() => {
12
+ k(b);
13
+ }, [b]);
14
+ let A = (e) => {
15
+ h === "list" || h === "chevron" || h === "accordion" ? _?.(e) : e.target.value || v?.({
16
+ value: y,
17
+ checked: !O
18
+ }), h === "accordion" && T?.(!w);
19
+ }, j = (() => {
20
+ switch (h) {
21
+ case "checkbox": return a(t, {
22
+ name: d,
23
+ checked: O,
24
+ value: y
25
+ });
26
+ case "radio": return a(n, {
27
+ name: d,
28
+ checked: O,
29
+ value: y
30
+ });
31
+ case "chevron": return a(l, {
32
+ width: 16,
33
+ height: 16,
34
+ "aria-hidden": !0
35
+ });
36
+ case "accordion": return a(w ? u : c, {
37
+ width: 16,
38
+ height: 16,
39
+ "aria-hidden": !0
40
+ });
41
+ default: return null;
42
+ }
43
+ })(), M = e("row-item__top-row", g && "row-item__top-row--inverted");
44
+ return a(i, null, a("div", {
45
+ ...D,
46
+ className: e(r({
47
+ size: f,
48
+ border: m
49
+ }), E),
50
+ onClick: A,
51
+ "data-clad": "Row Item"
52
+ }, a("div", { className: M }, p ? a("div", { className: "row-item__icon" }, p) : null, a("div", { className: "row-item__text" }, x), a("div", { className: "row-item__icon" }, j)), S ? a("div", { className: "row-item__description" }, S) : null), w && C ? a("div", { className: "row-item__collapsible" }, C) : null);
53
+ };
54
+ d.displayName = "RowItem";
55
+ //#endregion
56
+ export { d as default };
@@ -0,0 +1 @@
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`row-item`,defaultVariants:{size:`md`,border:`none`},variants:{size:{sm:`row-item--sm`,md:`row-item--md`,lg:`row-item--lg`},border:{none:``,bottom:`row-item--border-bottom`,wrap:`row-item--border-wrap`}}});exports.rowItemVariants=e;
@@ -0,0 +1,23 @@
1
+ import { tv as e } from "tailwind-variants/lite";
2
+ //#region src/components/RowItem/rowitem.styles.ts
3
+ var t = e({
4
+ base: "row-item",
5
+ defaultVariants: {
6
+ size: "md",
7
+ border: "none"
8
+ },
9
+ variants: {
10
+ size: {
11
+ sm: "row-item--sm",
12
+ md: "row-item--md",
13
+ lg: "row-item--lg"
14
+ },
15
+ border: {
16
+ none: "",
17
+ bottom: "row-item--border-bottom",
18
+ wrap: "row-item--border-wrap"
19
+ }
20
+ }
21
+ });
22
+ //#endregion
23
+ export { t as rowItemVariants };
@@ -0,0 +1 @@
1
+ "use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../../utils/sizes.cjs`),n=require(`../../utils/floating.cjs`),r=require(`../Input/Input.cjs`),i=require(`./search-input.styles.cjs`);let a=require(`react`),o=require(`@chotot/icons`),s=require(`react/jsx-runtime`);function c(e){let{key:t,keyCode:n}=e;return n>=37&&n<=40&&t.indexOf(`Arrow`)!==0?`Arrow${t}`:t}var l=({id:l,value:u=null,options:d=[],onInput:f=null,onSelect:p=null,onChange:m=null,onFocus:h=null,inputRef:g,variant:_=`input`,allowClear:v=!0,menuMaxHeight:y=`$sm`,showSearchIcon:b=!1,className:x,...S})=>{let C=u?.text??``,w=(0,a.useRef)(null);(0,a.useImperativeHandle)(g,()=>w.current);let[T,E]=(0,a.useState)(!1),[D,O]=(0,a.useState)(-1),k=d.length>0&&T,{renderLayer:A,triggerProps:{ref:j},layerProps:M,triggerBounds:N}=n.useLayer({isOpen:k,auto:!0,snap:!0,placement:`bottom-start`,possiblePlacements:[`top-start`,`bottom-start`],triggerOffset:1,onOutsideClick:()=>{E(!1)}});j(w.current);let P=(e,t)=>(t&&e&&(e.value={text:t.text,selected:t}),E(!1),O(-1),p?.(e),m?.(e)),F=e=>{let t=e?.target?.value??``;e&&(e.value={text:t,selected:void 0}),f?.(e),m?.(e),E(!0)},I=e=>{e.preventDefault()},L=e=>{let t=c(e),n=D;switch(t){case`ArrowUp`:--n,n<0&&(n=d.length-1),e.preventDefault();break;case`ArrowDown`:n+=1,n>=d.length&&(n=0),e.preventDefault();break;case`Enter`:{let t=d[D];return P(e,t)}default:break}O(n)},R=e=>{let t=e.currentTarget,n=d[Number(t.getAttribute(`data-index`))];return P(e,n)},z=e=>{e.preventDefault();let t=(e.target?.closest?.(`[data-index]`))?.getAttribute(`data-index`);t!=null&&O(+t)},B=e=>{e.persist?.(),h?.(e),_===`dropdown`&&setTimeout(()=>{E(!0)},0)};return(0,s.jsxs)(`div`,{id:l||``,role:`combobox`,onKeyUp:I,onKeyDown:L,tabIndex:0,"aria-haspopup":`listbox`,"aria-expanded":k,"aria-controls":`search-input-listbox`,className:e.default(i.searchInputVariants({variant:_}),x),"data-clad":`Input Field - Search Bar`,children:[(0,s.jsx)(r.default,{...S,allowClear:v,inputRef:w,value:C,onChange:F,onFocus:B,icon:b?(0,s.jsx)(o.Search,{width:20,height:20}):void 0}),!!k&&A((0,s.jsx)(`ul`,{id:`search-input-listbox`,role:`listbox`,className:`search-input-menu`,...M,style:{width:N?.width,maxHeight:t.SIZES_MAP[y]||y,...M.style},onMouseOver:z,onFocus:z,children:d.map((t,n)=>(0,s.jsx)(`li`,{role:`menuitem`,"aria-label":t.text,"data-index":n,className:e.default(`search-input-option`,n===D&&`highlight`),onClick:R,dangerouslySetInnerHTML:{__html:t?.html?t.html:``}},t.text))})),_===`dropdown`&&(0,s.jsx)(`span`,{className:e.default(`search-input-dropdown-icon`,k&&`inverted`),children:(0,s.jsx)(o.ChevronDownFilled,{className:`arrow`,style:{fontSize:`1.5rem`,color:S?.disabled?`var(--color-icon-disabled)`:void 0}})})]})};l.displayName=`SearchInput`,exports.default=l;
@@ -0,0 +1,129 @@
1
+ "use client";
2
+ import e from "../../utils/cn.es.js";
3
+ import { SIZES_MAP as t } from "../../utils/sizes.es.js";
4
+ import { useLayer as n } from "../../utils/floating.es.js";
5
+ import r from "../Input/Input.es.js";
6
+ import { searchInputVariants as i } from "./search-input.styles.es.js";
7
+ import { useImperativeHandle as a, useRef as o, useState as s } from "react";
8
+ import { ChevronDownFilled as c, Search as l } from "@chotot/icons";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ //#region src/components/SearchInput/SearchInput.tsx
11
+ function f(e) {
12
+ let { key: t, keyCode: n } = e;
13
+ return n >= 37 && n <= 40 && t.indexOf("Arrow") !== 0 ? `Arrow${t}` : t;
14
+ }
15
+ var p = ({ id: p, value: m = null, options: h = [], onInput: g = null, onSelect: _ = null, onChange: v = null, onFocus: y = null, inputRef: b, variant: x = "input", allowClear: S = !0, menuMaxHeight: C = "$sm", showSearchIcon: w = !1, className: T, ...E }) => {
16
+ let D = m?.text ?? "", O = o(null);
17
+ a(b, () => O.current);
18
+ let [k, A] = s(!1), [j, M] = s(-1), N = h.length > 0 && k, { renderLayer: P, triggerProps: { ref: F }, layerProps: I, triggerBounds: L } = n({
19
+ isOpen: N,
20
+ auto: !0,
21
+ snap: !0,
22
+ placement: "bottom-start",
23
+ possiblePlacements: ["top-start", "bottom-start"],
24
+ triggerOffset: 1,
25
+ onOutsideClick: () => {
26
+ A(!1);
27
+ }
28
+ });
29
+ F(O.current);
30
+ let R = (e, t) => (t && e && (e.value = {
31
+ text: t.text,
32
+ selected: t
33
+ }), A(!1), M(-1), _?.(e), v?.(e)), z = (e) => {
34
+ let t = e?.target?.value ?? "";
35
+ e && (e.value = {
36
+ text: t,
37
+ selected: void 0
38
+ }), g?.(e), v?.(e), A(!0);
39
+ }, B = (e) => {
40
+ e.preventDefault();
41
+ }, V = (e) => {
42
+ let t = f(e), n = j;
43
+ switch (t) {
44
+ case "ArrowUp":
45
+ --n, n < 0 && (n = h.length - 1), e.preventDefault();
46
+ break;
47
+ case "ArrowDown":
48
+ n += 1, n >= h.length && (n = 0), e.preventDefault();
49
+ break;
50
+ case "Enter": {
51
+ let t = h[j];
52
+ return R(e, t);
53
+ }
54
+ default: break;
55
+ }
56
+ M(n);
57
+ }, H = (e) => {
58
+ let t = e.currentTarget, n = h[Number(t.getAttribute("data-index"))];
59
+ return R(e, n);
60
+ }, U = (e) => {
61
+ e.preventDefault();
62
+ let t = (e.target?.closest?.("[data-index]"))?.getAttribute("data-index");
63
+ t != null && M(+t);
64
+ }, W = (e) => {
65
+ e.persist?.(), y?.(e), x === "dropdown" && setTimeout(() => {
66
+ A(!0);
67
+ }, 0);
68
+ };
69
+ return /* @__PURE__ */ d("div", {
70
+ id: p || "",
71
+ role: "combobox",
72
+ onKeyUp: B,
73
+ onKeyDown: V,
74
+ tabIndex: 0,
75
+ "aria-haspopup": "listbox",
76
+ "aria-expanded": N,
77
+ "aria-controls": "search-input-listbox",
78
+ className: e(i({ variant: x }), T),
79
+ "data-clad": "Input Field - Search Bar",
80
+ children: [
81
+ /* @__PURE__ */ u(r, {
82
+ ...E,
83
+ allowClear: S,
84
+ inputRef: O,
85
+ value: D,
86
+ onChange: z,
87
+ onFocus: W,
88
+ icon: w ? /* @__PURE__ */ u(l, {
89
+ width: 20,
90
+ height: 20
91
+ }) : void 0
92
+ }),
93
+ !!N && P(/* @__PURE__ */ u("ul", {
94
+ id: "search-input-listbox",
95
+ role: "listbox",
96
+ className: "search-input-menu",
97
+ ...I,
98
+ style: {
99
+ width: L?.width,
100
+ maxHeight: t[C] || C,
101
+ ...I.style
102
+ },
103
+ onMouseOver: U,
104
+ onFocus: U,
105
+ children: h.map((t, n) => /* @__PURE__ */ u("li", {
106
+ role: "menuitem",
107
+ "aria-label": t.text,
108
+ "data-index": n,
109
+ className: e("search-input-option", n === j && "highlight"),
110
+ onClick: H,
111
+ dangerouslySetInnerHTML: { __html: t?.html ? t.html : "" }
112
+ }, t.text))
113
+ })),
114
+ x === "dropdown" && /* @__PURE__ */ u("span", {
115
+ className: e("search-input-dropdown-icon", N && "inverted"),
116
+ children: /* @__PURE__ */ u(c, {
117
+ className: "arrow",
118
+ style: {
119
+ fontSize: "1.5rem",
120
+ color: E?.disabled ? "var(--color-icon-disabled)" : void 0
121
+ }
122
+ })
123
+ })
124
+ ]
125
+ });
126
+ };
127
+ p.displayName = "SearchInput";
128
+ //#endregion
129
+ export { p as default };
@@ -0,0 +1 @@
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`search-input`,variants:{variant:{input:``,dropdown:`search-input--dropdown`}},defaultVariants:{variant:`input`}});exports.searchInputVariants=e;
@@ -0,0 +1,12 @@
1
+ import { tv as e } from "tailwind-variants/lite";
2
+ //#region src/components/SearchInput/search-input.styles.ts
3
+ var t = e({
4
+ base: "search-input",
5
+ variants: { variant: {
6
+ input: "",
7
+ dropdown: "search-input--dropdown"
8
+ } },
9
+ defaultVariants: { variant: "input" }
10
+ });
11
+ //#endregion
12
+ export { t as searchInputVariants };
@@ -0,0 +1 @@
1
+ "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/cn.cjs`),n=require(`../../types/index.cjs`),r=require(`./searchbar.styles.cjs`);let i=require(`react`);i=e.__toESM(i);let a=require(`@chotot/icons`),o=require(`react/jsx-runtime`);var s=n.forwardRef((e,n)=>{let{placeholder:s=`Tìm sản phẩm...`,value:c,classNames:l,onChange:u,defaultValue:d=``,allowClear:f=!0,disabled:p=!1,...m}=e,[h,g]=(0,i.useState)(c||d),_=(0,i.useRef)(null);(0,i.useImperativeHandle)(n,()=>_.current);let v=e=>{g(e.target.value),u?.(e)},y=()=>{g(``),u&&_.current&&u({target:{value:``},currentTarget:_.current}),_?.current?.focus()};return(0,o.jsxs)(`div`,{"data-clad":`Searchbar`,className:t.default(r.searchbarStyles(),l?.container),children:[(0,o.jsx)(a.Search,{width:20,height:20}),(0,o.jsx)(`input`,{className:l?.input,value:h,placeholder:s,disabled:p,onChange:v,...m,ref:_}),h&&f&&!p?(0,o.jsx)(`button`,{type:`button`,onClick:y,className:t.default(`searchbar-action-btn`,l?.actionBtn),children:(0,o.jsx)(a.CloseFilled,{width:24,height:24})}):null]})});s.displayName=`Searchbar`,exports.default=s;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import e from "../../utils/cn.es.js";
3
+ import { forwardRef as t } from "../../types/index.es.js";
4
+ import { searchbarStyles as n } from "./searchbar.styles.es.js";
5
+ import { useImperativeHandle as r, useRef as i, useState as a } from "react";
6
+ import { CloseFilled as o, Search as s } from "@chotot/icons";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ //#region src/components/Searchbar/Searchbar.tsx
9
+ var u = t((t, u) => {
10
+ let { placeholder: d = "Tìm sản phẩm...", value: f, classNames: p, onChange: m, defaultValue: h = "", allowClear: g = !0, disabled: _ = !1, ...v } = t, [y, b] = a(f || h), x = i(null);
11
+ r(u, () => x.current);
12
+ let S = (e) => {
13
+ b(e.target.value), m?.(e);
14
+ }, C = () => {
15
+ b(""), m && x.current && m({
16
+ target: { value: "" },
17
+ currentTarget: x.current
18
+ }), x?.current?.focus();
19
+ };
20
+ return /* @__PURE__ */ l("div", {
21
+ "data-clad": "Searchbar",
22
+ className: e(n(), p?.container),
23
+ children: [
24
+ /* @__PURE__ */ c(s, {
25
+ width: 20,
26
+ height: 20
27
+ }),
28
+ /* @__PURE__ */ c("input", {
29
+ className: p?.input,
30
+ value: y,
31
+ placeholder: d,
32
+ disabled: _,
33
+ onChange: S,
34
+ ...v,
35
+ ref: x
36
+ }),
37
+ y && g && !_ ? /* @__PURE__ */ c("button", {
38
+ type: "button",
39
+ onClick: C,
40
+ className: e("searchbar-action-btn", p?.actionBtn),
41
+ children: /* @__PURE__ */ c(o, {
42
+ width: 24,
43
+ height: 24
44
+ })
45
+ }) : null
46
+ ]
47
+ });
48
+ });
49
+ u.displayName = "Searchbar";
50
+ //#endregion
51
+ export { u as default };
@@ -0,0 +1 @@
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`searchbar-container`});exports.searchbarStyles=e;
@@ -0,0 +1,5 @@
1
+ import { tv as e } from "tailwind-variants/lite";
2
+ //#region src/components/Searchbar/searchbar.styles.ts
3
+ var t = e({ base: "searchbar-container" });
4
+ //#endregion
5
+ export { t as searchbarStyles };
@@ -0,0 +1 @@
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../../types/index.cjs`),n=require(`./shape-icon.styles.cjs`);let r=require(`react`);var i=t.forwardRef((t,i)=>{let{size:a=`sm`,radius:o=`circle`,bg:s=`none`,color:c=`primary`,className:l,children:u,as:d=`span`,...f}=t;return(0,r.createElement)(d,{ref:i,className:e.default(n.shapeIconVariants({size:a,radius:o,bg:s,color:c}),l),"data-clad":`ShapeIcon`,...f},u)});i.displayName=`ShapeIcon`,exports.default=i;
@@ -0,0 +1,22 @@
1
+ import e from "../../utils/cn.es.js";
2
+ import { forwardRef as t } from "../../types/index.es.js";
3
+ import { shapeIconVariants as n } from "./shape-icon.styles.es.js";
4
+ import { createElement as r } from "react";
5
+ //#region src/components/ShapeIcon/ShapeIcon.tsx
6
+ var i = t((t, i) => {
7
+ let { size: a = "sm", radius: o = "circle", bg: s = "none", color: c = "primary", className: l, children: u, as: d = "span", ...f } = t;
8
+ return r(d, {
9
+ ref: i,
10
+ className: e(n({
11
+ size: a,
12
+ radius: o,
13
+ bg: s,
14
+ color: c
15
+ }), l),
16
+ "data-clad": "ShapeIcon",
17
+ ...f
18
+ }, u);
19
+ });
20
+ i.displayName = "ShapeIcon";
21
+ //#endregion
22
+ export { i as default };
@@ -0,0 +1 @@
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`shape-icon`,defaultVariants:{size:`sm`,radius:`circle`,bg:`none`,color:`primary`},variants:{size:{xxxs:`shape-icon--xxxs`,xxs:`shape-icon--xxs`,xs:`shape-icon--xs`,sm:`shape-icon--sm`,md:`shape-icon--md`,lg:`shape-icon--lg`,lxl:`shape-icon--lxl`,xl:`shape-icon--xl`,xxl:`shape-icon--xxl`},radius:{none:`shape-icon--radius-none`,xs:`shape-icon--radius-xs`,sm:`shape-icon--radius-sm`,md:`shape-icon--radius-md`,lg:`shape-icon--radius-lg`,xl:`shape-icon--radius-xl`,pill:`shape-icon--radius-pill`,circle:`shape-icon--radius-circle`},bg:{none:`shape-icon--bg-none`,brand:`shape-icon--bg-brand`,"brand-light":`shape-icon--bg-brand-light`,info:`shape-icon--bg-info`,"info-light":`shape-icon--bg-info-light`,success:`shape-icon--bg-success`,"success-light":`shape-icon--bg-success-light`,error:`shape-icon--bg-error`,"error-light":`shape-icon--bg-error-light`,warning:`shape-icon--bg-warning`,"warning-light":`shape-icon--bg-warning-light`,primary:`shape-icon--bg-primary`,secondary:`shape-icon--bg-secondary`,tertiary:`shape-icon--bg-tertiary`,inverted:`shape-icon--bg-inverted`},color:{primary:`shape-icon--color-primary`,secondary:`shape-icon--color-secondary`,tertiary:`shape-icon--color-tertiary`,blank:`shape-icon--color-blank`,brand:`shape-icon--color-brand`,info:`shape-icon--color-info`,success:`shape-icon--color-success`,error:`shape-icon--color-error`,warning:`shape-icon--color-warning`,"on-background":`shape-icon--color-on-background`}}});exports.shapeIconVariants=e;
@@ -0,0 +1,65 @@
1
+ import { tv as e } from "tailwind-variants/lite";
2
+ //#region src/components/ShapeIcon/shape-icon.styles.ts
3
+ var t = e({
4
+ base: "shape-icon",
5
+ defaultVariants: {
6
+ size: "sm",
7
+ radius: "circle",
8
+ bg: "none",
9
+ color: "primary"
10
+ },
11
+ variants: {
12
+ size: {
13
+ xxxs: "shape-icon--xxxs",
14
+ xxs: "shape-icon--xxs",
15
+ xs: "shape-icon--xs",
16
+ sm: "shape-icon--sm",
17
+ md: "shape-icon--md",
18
+ lg: "shape-icon--lg",
19
+ lxl: "shape-icon--lxl",
20
+ xl: "shape-icon--xl",
21
+ xxl: "shape-icon--xxl"
22
+ },
23
+ radius: {
24
+ none: "shape-icon--radius-none",
25
+ xs: "shape-icon--radius-xs",
26
+ sm: "shape-icon--radius-sm",
27
+ md: "shape-icon--radius-md",
28
+ lg: "shape-icon--radius-lg",
29
+ xl: "shape-icon--radius-xl",
30
+ pill: "shape-icon--radius-pill",
31
+ circle: "shape-icon--radius-circle"
32
+ },
33
+ bg: {
34
+ none: "shape-icon--bg-none",
35
+ brand: "shape-icon--bg-brand",
36
+ "brand-light": "shape-icon--bg-brand-light",
37
+ info: "shape-icon--bg-info",
38
+ "info-light": "shape-icon--bg-info-light",
39
+ success: "shape-icon--bg-success",
40
+ "success-light": "shape-icon--bg-success-light",
41
+ error: "shape-icon--bg-error",
42
+ "error-light": "shape-icon--bg-error-light",
43
+ warning: "shape-icon--bg-warning",
44
+ "warning-light": "shape-icon--bg-warning-light",
45
+ primary: "shape-icon--bg-primary",
46
+ secondary: "shape-icon--bg-secondary",
47
+ tertiary: "shape-icon--bg-tertiary",
48
+ inverted: "shape-icon--bg-inverted"
49
+ },
50
+ color: {
51
+ primary: "shape-icon--color-primary",
52
+ secondary: "shape-icon--color-secondary",
53
+ tertiary: "shape-icon--color-tertiary",
54
+ blank: "shape-icon--color-blank",
55
+ brand: "shape-icon--color-brand",
56
+ info: "shape-icon--color-info",
57
+ success: "shape-icon--color-success",
58
+ error: "shape-icon--color-error",
59
+ warning: "shape-icon--color-warning",
60
+ "on-background": "shape-icon--color-on-background"
61
+ }
62
+ }
63
+ });
64
+ //#endregion
65
+ export { t as shapeIconVariants };
@@ -0,0 +1 @@
1
+ "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/cn.cjs`),n=require(`../../utils/sizes.cjs`),r=require(`../Input/Input.cjs`),i=require(`./slider.styles.cjs`);let a=require(`react`);a=e.__toESM(a);let o=require(`react/jsx-runtime`);var s=({id:e,value:s=0,min:c=0,max:l=100,disabled:u=!1,step:d=1,unit:f=``,width:p=`buttonMaxWidth`,type:m=`single`,inputField:h=!1,inputWidth:g=`xxxl`,onChange:_,className:v,style:y,...b})=>{let[x,S]=a.useState(!1),[C,w]=a.useState(!1),T=Array.isArray(s)?s[0]??c:c,E=typeof s==`number`&&m===`single`?s:Array.isArray(s)?s[1]??l:l,[D,O]=a.useState(`${T} ${f}`),[k,A]=a.useState(`${E} ${f}`),j=e=>{e.persist?.(),e.preventDefault?.(),m===`single`?e.target.id===`single-input`&&/^\d*$/.test(e.target.value)&&(e.target.value===``?(E=c,A(``)):(E=+e.target.value>l?l:+e.target.value<c?c:+e.target.value,A(`${E}`))):m===`range`&&(e.target.id===`range-input-max`&&/^\d*$/.test(e.target.value)?e.target.value===``?(E=l,A(``)):+e.target.value>l?(E=l,A(`${E}`)):+e.target.value<T+d?(E=T+d,A(`${E}`)):(E=+e.target.value,A(`${E}`)):e.target.id===`range-input-min`&&/^\d*$/.test(e.target.value)&&(e.target.value===``?(T=c,O(``)):+e.target.value<c?(T=c,O(`${T}`)):+e.target.value>E-d?(T=E-d,O(`${T}`)):(T=+e.target.value,O(`${T}`))));let t=e.shiftKey?10:1;return e.key===`ArrowDown`||e.key===`ArrowLeft`?C?(E-t*d<T+d?(E=T+d,m===`single`&&(E=c)):E-=t*d,A(`${E} ${f}`)):x&&(T-t*d<c?T=c:T-=t*d,O(`${T} ${f}`)):e.key===`ArrowUp`||e.key===`ArrowRight`?C?(E+t*d<=l?E+=t*d:E=l,A(`${E} ${f}`)):x&&(T+t*d<E?T+=t*d:T=+E-d,O(`${T} ${f}`)):e.target.className===`range-min`?E-+e.target.value<d?T=E-d:(T=+e.target.value,O(`${T} ${f}`)):e.target.className===`range-max`&&(+e.target.value-T<d?m===`single`?E=T:m===`range`&&(E=T+d):E=+e.target.value,A(`${E} ${f}`)),e.value=m===`single`?E:[T,E],_?.(e)},M=n.SIZES_MAP[p]||p;return(0,o.jsxs)(`div`,{...b,id:e,"data-clad":`Slider`,className:t.default(i.sliderStyles(),v),style:{width:M,...y},children:[(0,o.jsx)(`div`,{className:t.default(h&&m===`single`?`input-field`:`hidden`),children:(0,o.jsx)(r.default,{allowClear:!1,width:g,type:`text`,id:`single-input`,value:k,onChange:j,onFocus:()=>{A(k.slice(0,k.length-f.length-1))},onBlur:()=>{A(k===``?`${c} ${f}`:`${k} ${f}`)}})}),(0,o.jsx)(`div`,{className:t.default(h&&m===`range`?`input-field`:`hidden`),children:(0,o.jsx)(r.default,{allowClear:!1,width:g,type:`text`,id:`range-input-min`,value:D,onChange:j,onFocus:()=>{O(D.slice(0,D.length-f.length-1))},onBlur:()=>{O(D===``?`${c} ${f}`:`${D} ${f}`)}})}),(0,o.jsx)(`div`,{className:`wapper`,role:`tab`,tabIndex:-1,onKeyDown:j,children:(0,o.jsxs)(`div`,{className:`slider-inner`,children:[(0,o.jsx)(`span`,{className:t.default(`slider-limit-value`,u&&`slider-limit-value--disabled`),children:c}),(0,o.jsxs)(`div`,{className:u?`slider-range-wrapper--disabled`:`slider-range-wrapper`,children:[(0,o.jsxs)(`div`,{className:`slider-current-value`,children:[!!x&&(0,o.jsx)(`span`,{style:{left:`${Math.round((T-c)*100/(l-c))}%`},hidden:m===`single`,className:`min-value`,children:`${T} ${f}`}),!!C&&(0,o.jsx)(`span`,{style:{right:`${Math.round((l-E)*100/(l-c))}%`},className:`max-value`,children:`${E} ${f}`})]}),(0,o.jsx)(`div`,{className:`slider`,children:(0,o.jsx)(`div`,{className:`progress`,style:{left:`${Math.round((T-c)*100/(l-c))}%`,right:`${100-Math.round((E-c)*100/(l-c))}%`}})}),(0,o.jsxs)(`div`,{className:u?`slider-range-input--disabled`:`slider-range-input`,children:[(0,o.jsx)(`input`,{type:`range`,className:`range-min`,min:c,max:l,step:d,onChange:j,value:T,disabled:u,hidden:m===`single`,onFocus:()=>{S(!0)},onBlur:()=>{S(!1)},onClick:e=>{e.currentTarget.focus()}}),(0,o.jsx)(`input`,{type:`range`,className:`range-max`,min:c,max:l,step:d,value:E,onChange:j,disabled:u,onFocus:()=>{w(!0)},onBlur:()=>{w(!1)},onClick:e=>{e.currentTarget.focus()}})]})]}),(0,o.jsx)(`span`,{className:t.default(`slider-limit-value`,u&&`slider-limit-value--disabled`),children:l})]})}),(0,o.jsx)(`div`,{className:t.default(h&&m===`range`?`input-field`:`hidden`),children:(0,o.jsx)(r.default,{allowClear:!1,width:g,type:`text`,id:`range-input-max`,value:k,onChange:j,onFocus:()=>{A(k.slice(0,k.length-f.length-1))},onBlur:()=>{A(k===``?`${l} ${f}`:`${k} ${f}`)}})})]})};s.displayName=`Slider`,exports.default=s;
@@ -0,0 +1,169 @@
1
+ "use client";
2
+ import e from "../../utils/cn.es.js";
3
+ import { SIZES_MAP as t } from "../../utils/sizes.es.js";
4
+ import n from "../Input/Input.es.js";
5
+ import { sliderStyles as r } from "./slider.styles.es.js";
6
+ import * as i from "react";
7
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
+ //#region src/components/Slider/Slider.tsx
9
+ var s = ({ id: s, value: c = 0, min: l = 0, max: u = 100, disabled: d = !1, step: f = 1, unit: p = "", width: m = "buttonMaxWidth", type: h = "single", inputField: g = !1, inputWidth: _ = "xxxl", onChange: v, className: y, style: b, ...x }) => {
10
+ let [S, C] = i.useState(!1), [w, T] = i.useState(!1), E = Array.isArray(c) ? c[0] ?? l : l, D = typeof c == "number" && h === "single" ? c : Array.isArray(c) ? c[1] ?? u : u, [O, k] = i.useState(`${E} ${p}`), [A, j] = i.useState(`${D} ${p}`), M = (e) => {
11
+ e.persist?.(), e.preventDefault?.(), h === "single" ? e.target.id === "single-input" && /^\d*$/.test(e.target.value) && (e.target.value === "" ? (D = l, j("")) : (D = +e.target.value > u ? u : +e.target.value < l ? l : +e.target.value, j(`${D}`))) : h === "range" && (e.target.id === "range-input-max" && /^\d*$/.test(e.target.value) ? e.target.value === "" ? (D = u, j("")) : +e.target.value > u ? (D = u, j(`${D}`)) : +e.target.value < E + f ? (D = E + f, j(`${D}`)) : (D = +e.target.value, j(`${D}`)) : e.target.id === "range-input-min" && /^\d*$/.test(e.target.value) && (e.target.value === "" ? (E = l, k("")) : +e.target.value < l ? (E = l, k(`${E}`)) : +e.target.value > D - f ? (E = D - f, k(`${E}`)) : (E = +e.target.value, k(`${E}`))));
12
+ let t = e.shiftKey ? 10 : 1;
13
+ return e.key === "ArrowDown" || e.key === "ArrowLeft" ? w ? (D - t * f < E + f ? (D = E + f, h === "single" && (D = l)) : D -= t * f, j(`${D} ${p}`)) : S && (E - t * f < l ? E = l : E -= t * f, k(`${E} ${p}`)) : e.key === "ArrowUp" || e.key === "ArrowRight" ? w ? (D + t * f <= u ? D += t * f : D = u, j(`${D} ${p}`)) : S && (E + t * f < D ? E += t * f : E = +D - f, k(`${E} ${p}`)) : e.target.className === "range-min" ? D - +e.target.value < f ? E = D - f : (E = +e.target.value, k(`${E} ${p}`)) : e.target.className === "range-max" && (+e.target.value - E < f ? h === "single" ? D = E : h === "range" && (D = E + f) : D = +e.target.value, j(`${D} ${p}`)), e.value = h === "single" ? D : [E, D], v?.(e);
14
+ }, N = t[m] || m;
15
+ return /* @__PURE__ */ o("div", {
16
+ ...x,
17
+ id: s,
18
+ "data-clad": "Slider",
19
+ className: e(r(), y),
20
+ style: {
21
+ width: N,
22
+ ...b
23
+ },
24
+ children: [
25
+ /* @__PURE__ */ a("div", {
26
+ className: e(g && h === "single" ? "input-field" : "hidden"),
27
+ children: /* @__PURE__ */ a(n, {
28
+ allowClear: !1,
29
+ width: _,
30
+ type: "text",
31
+ id: "single-input",
32
+ value: A,
33
+ onChange: M,
34
+ onFocus: () => {
35
+ j(A.slice(0, A.length - p.length - 1));
36
+ },
37
+ onBlur: () => {
38
+ j(A === "" ? `${l} ${p}` : `${A} ${p}`);
39
+ }
40
+ })
41
+ }),
42
+ /* @__PURE__ */ a("div", {
43
+ className: e(g && h === "range" ? "input-field" : "hidden"),
44
+ children: /* @__PURE__ */ a(n, {
45
+ allowClear: !1,
46
+ width: _,
47
+ type: "text",
48
+ id: "range-input-min",
49
+ value: O,
50
+ onChange: M,
51
+ onFocus: () => {
52
+ k(O.slice(0, O.length - p.length - 1));
53
+ },
54
+ onBlur: () => {
55
+ k(O === "" ? `${l} ${p}` : `${O} ${p}`);
56
+ }
57
+ })
58
+ }),
59
+ /* @__PURE__ */ a("div", {
60
+ className: "wapper",
61
+ role: "tab",
62
+ tabIndex: -1,
63
+ onKeyDown: M,
64
+ children: /* @__PURE__ */ o("div", {
65
+ className: "slider-inner",
66
+ children: [
67
+ /* @__PURE__ */ a("span", {
68
+ className: e("slider-limit-value", d && "slider-limit-value--disabled"),
69
+ children: l
70
+ }),
71
+ /* @__PURE__ */ o("div", {
72
+ className: d ? "slider-range-wrapper--disabled" : "slider-range-wrapper",
73
+ children: [
74
+ /* @__PURE__ */ o("div", {
75
+ className: "slider-current-value",
76
+ children: [!!S && /* @__PURE__ */ a("span", {
77
+ style: { left: `${Math.round((E - l) * 100 / (u - l))}%` },
78
+ hidden: h === "single",
79
+ className: "min-value",
80
+ children: `${E} ${p}`
81
+ }), !!w && /* @__PURE__ */ a("span", {
82
+ style: { right: `${Math.round((u - D) * 100 / (u - l))}%` },
83
+ className: "max-value",
84
+ children: `${D} ${p}`
85
+ })]
86
+ }),
87
+ /* @__PURE__ */ a("div", {
88
+ className: "slider",
89
+ children: /* @__PURE__ */ a("div", {
90
+ className: "progress",
91
+ style: {
92
+ left: `${Math.round((E - l) * 100 / (u - l))}%`,
93
+ right: `${100 - Math.round((D - l) * 100 / (u - l))}%`
94
+ }
95
+ })
96
+ }),
97
+ /* @__PURE__ */ o("div", {
98
+ className: d ? "slider-range-input--disabled" : "slider-range-input",
99
+ children: [/* @__PURE__ */ a("input", {
100
+ type: "range",
101
+ className: "range-min",
102
+ min: l,
103
+ max: u,
104
+ step: f,
105
+ onChange: M,
106
+ value: E,
107
+ disabled: d,
108
+ hidden: h === "single",
109
+ onFocus: () => {
110
+ C(!0);
111
+ },
112
+ onBlur: () => {
113
+ C(!1);
114
+ },
115
+ onClick: (e) => {
116
+ e.currentTarget.focus();
117
+ }
118
+ }), /* @__PURE__ */ a("input", {
119
+ type: "range",
120
+ className: "range-max",
121
+ min: l,
122
+ max: u,
123
+ step: f,
124
+ value: D,
125
+ onChange: M,
126
+ disabled: d,
127
+ onFocus: () => {
128
+ T(!0);
129
+ },
130
+ onBlur: () => {
131
+ T(!1);
132
+ },
133
+ onClick: (e) => {
134
+ e.currentTarget.focus();
135
+ }
136
+ })]
137
+ })
138
+ ]
139
+ }),
140
+ /* @__PURE__ */ a("span", {
141
+ className: e("slider-limit-value", d && "slider-limit-value--disabled"),
142
+ children: u
143
+ })
144
+ ]
145
+ })
146
+ }),
147
+ /* @__PURE__ */ a("div", {
148
+ className: e(g && h === "range" ? "input-field" : "hidden"),
149
+ children: /* @__PURE__ */ a(n, {
150
+ allowClear: !1,
151
+ width: _,
152
+ type: "text",
153
+ id: "range-input-max",
154
+ value: A,
155
+ onChange: M,
156
+ onFocus: () => {
157
+ j(A.slice(0, A.length - p.length - 1));
158
+ },
159
+ onBlur: () => {
160
+ j(A === "" ? `${u} ${p}` : `${A} ${p}`);
161
+ }
162
+ })
163
+ })
164
+ ]
165
+ });
166
+ };
167
+ s.displayName = "Slider";
168
+ //#endregion
169
+ export { s as default };
@@ -0,0 +1 @@
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants`).tv)({base:`slider-wrapper`});exports.sliderStyles=e;