@televet/kibble-ui 4.0.0-beta.121 → 4.0.0-beta.123

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 (111) hide show
  1. package/dist/chunks/{buttonGroup.component-qXm5eq0l.js → buttonGroup.component-B6Ebjoh6.js} +2 -2
  2. package/dist/chunks/{buttonGroup.component-qXm5eq0l.js.map → buttonGroup.component-B6Ebjoh6.js.map} +1 -1
  3. package/dist/chunks/{buttonGroup.component-BVRTatwS.js → buttonGroup.component-BHDnteYx.js} +2 -2
  4. package/dist/chunks/{buttonGroup.component-BVRTatwS.js.map → buttonGroup.component-BHDnteYx.js.map} +1 -1
  5. package/dist/chunks/{checkbox.component-BdIZ3GiD.js → checkbox.component-BR65eR9h.js} +2 -2
  6. package/dist/chunks/{checkbox.component-BdIZ3GiD.js.map → checkbox.component-BR65eR9h.js.map} +1 -1
  7. package/dist/chunks/{checkbox.component-CvTfrYob.js → checkbox.component-u7MR3n4o.js} +2 -2
  8. package/dist/chunks/{checkbox.component-CvTfrYob.js.map → checkbox.component-u7MR3n4o.js.map} +1 -1
  9. package/dist/chunks/{checkboxGroup.component-DJKgkD87.js → checkboxGroup.component-CNnlDoOR.js} +2 -2
  10. package/dist/chunks/{checkboxGroup.component-DJKgkD87.js.map → checkboxGroup.component-CNnlDoOR.js.map} +1 -1
  11. package/dist/chunks/{checkboxGroup.component-CYmE3l6I.js → checkboxGroup.component-Ch2eLuiA.js} +3 -3
  12. package/dist/chunks/{checkboxGroup.component-CYmE3l6I.js.map → checkboxGroup.component-Ch2eLuiA.js.map} +1 -1
  13. package/dist/chunks/{conversationCard.component-B9-73MvR.js → conversationCard.component-D5UsucDp.js} +2 -2
  14. package/dist/chunks/{conversationCard.component-B9-73MvR.js.map → conversationCard.component-D5UsucDp.js.map} +1 -1
  15. package/dist/chunks/{conversationCard.component-BoR-pGix.js → conversationCard.component-DQqpy-FX.js} +2 -2
  16. package/dist/chunks/{conversationCard.component-BoR-pGix.js.map → conversationCard.component-DQqpy-FX.js.map} +1 -1
  17. package/dist/chunks/{datePicker.component-_-ci5_PJ.js → datePicker.component-CBYLerCE.js} +2 -2
  18. package/dist/chunks/{datePicker.component-_-ci5_PJ.js.map → datePicker.component-CBYLerCE.js.map} +1 -1
  19. package/dist/chunks/{datePicker.component-BhlcO3Qa.js → datePicker.component-Dwu1QDNa.js} +3 -3
  20. package/dist/chunks/{datePicker.component-BhlcO3Qa.js.map → datePicker.component-Dwu1QDNa.js.map} +1 -1
  21. package/dist/chunks/{menu.component-BEEsicXT.js → menu.component-OwlCMqw2.js} +2 -2
  22. package/dist/chunks/{menu.component-BEEsicXT.js.map → menu.component-OwlCMqw2.js.map} +1 -1
  23. package/dist/chunks/{menu.component-BFL1WXRS.js → menu.component-fFdY9cMO.js} +3 -3
  24. package/dist/chunks/{menu.component-BFL1WXRS.js.map → menu.component-fFdY9cMO.js.map} +1 -1
  25. package/dist/chunks/{pinInput.types-CLgxXzKy.js → pinInput.types-BW8TUMvl.js} +2 -2
  26. package/dist/chunks/{pinInput.types-CLgxXzKy.js.map → pinInput.types-BW8TUMvl.js.map} +1 -1
  27. package/dist/chunks/{pinInput.types-CnU27QDl.js → pinInput.types-DoQJLvWY.js} +2 -2
  28. package/dist/chunks/{pinInput.types-CnU27QDl.js.map → pinInput.types-DoQJLvWY.js.map} +1 -1
  29. package/dist/chunks/{radioGroup.types-B3a66q9p.js → radioGroup.types-Bm6SHbbS.js} +2 -2
  30. package/dist/chunks/{radioGroup.types-B3a66q9p.js.map → radioGroup.types-Bm6SHbbS.js.map} +1 -1
  31. package/dist/chunks/{radioGroup.types-DdX1SZnQ.js → radioGroup.types-CA2oK1Am.js} +3 -3
  32. package/dist/chunks/{radioGroup.types-DdX1SZnQ.js.map → radioGroup.types-CA2oK1Am.js.map} +1 -1
  33. package/dist/chunks/{ratingDots.component-Dxhfd6qE.js → ratingDots.component-CuKKpqru.js} +2 -2
  34. package/dist/chunks/{ratingDots.component-Dxhfd6qE.js.map → ratingDots.component-CuKKpqru.js.map} +1 -1
  35. package/dist/chunks/{ratingDots.component-BAtcU4JC.js → ratingDots.component-TPth4wKQ.js} +2 -2
  36. package/dist/chunks/{ratingDots.component-BAtcU4JC.js.map → ratingDots.component-TPth4wKQ.js.map} +1 -1
  37. package/dist/chunks/{select.component-29vEA8EQ.js → select.component-91EorPLw.js} +2 -2
  38. package/dist/chunks/{select.component-29vEA8EQ.js.map → select.component-91EorPLw.js.map} +1 -1
  39. package/dist/chunks/{select.component-o2RuJ5R1.js → select.component-DEf5MiUc.js} +3 -3
  40. package/dist/chunks/{select.component-o2RuJ5R1.js.map → select.component-DEf5MiUc.js.map} +1 -1
  41. package/dist/chunks/{switch.component-DghHmo1Q.js → switch.component-CJ3nDOQj.js} +2 -2
  42. package/dist/chunks/{switch.component-DghHmo1Q.js.map → switch.component-CJ3nDOQj.js.map} +1 -1
  43. package/dist/chunks/{switch.component-C2SVRVqH.js → switch.component-NP_hIh2c.js} +2 -2
  44. package/dist/chunks/{switch.component-C2SVRVqH.js.map → switch.component-NP_hIh2c.js.map} +1 -1
  45. package/dist/chunks/{tagBlock.component-BQNwnshc.js → tagBlock.component-jWG9O22v.js} +2 -2
  46. package/dist/chunks/{tagBlock.component-BQNwnshc.js.map → tagBlock.component-jWG9O22v.js.map} +1 -1
  47. package/dist/chunks/{tagBlock.component-BcdJnkIB.js → tagBlock.component-lQeyNLgK.js} +2 -2
  48. package/dist/chunks/{tagBlock.component-BcdJnkIB.js.map → tagBlock.component-lQeyNLgK.js.map} +1 -1
  49. package/dist/chunks/{textInput.component-Dg0NjMGd.js → textInput.component-Bw1lEr8q.js} +2 -2
  50. package/dist/chunks/{textInput.component-Dg0NjMGd.js.map → textInput.component-Bw1lEr8q.js.map} +1 -1
  51. package/dist/chunks/{textInput.component-DBOBy5dT.js → textInput.component-C8R6bZLW.js} +2 -2
  52. package/dist/chunks/{textInput.component-DBOBy5dT.js.map → textInput.component-C8R6bZLW.js.map} +1 -1
  53. package/dist/chunks/{textarea.component-DQAMtD62.js → textarea.component-DDYGwqlz.js} +2 -2
  54. package/dist/chunks/{textarea.component-DQAMtD62.js.map → textarea.component-DDYGwqlz.js.map} +1 -1
  55. package/dist/chunks/{textarea.component-BNiipjT7.js → textarea.component-DMisQzyb.js} +2 -2
  56. package/dist/chunks/{textarea.component-BNiipjT7.js.map → textarea.component-DMisQzyb.js.map} +1 -1
  57. package/dist/chunks/{theme.provider-CWlAUk5a.js → theme.provider-B0zBjo_b.js} +5 -1
  58. package/dist/chunks/{theme.provider-CWlAUk5a.js.map → theme.provider-B0zBjo_b.js.map} +1 -1
  59. package/dist/chunks/{theme.provider-BWaTybbq.js → theme.provider-Bhx8UNwC.js} +5 -1
  60. package/dist/chunks/{theme.provider-BWaTybbq.js.map → theme.provider-Bhx8UNwC.js.map} +1 -1
  61. package/dist/chunks/{timePicker.component-CbfNMKHg.js → timePicker.component-3lHlD-Sl.js} +2 -2
  62. package/dist/chunks/{timePicker.component-CbfNMKHg.js.map → timePicker.component-3lHlD-Sl.js.map} +1 -1
  63. package/dist/chunks/{timePicker.component-9uhrYSK_.js → timePicker.component-B8Md1wxz.js} +2 -2
  64. package/dist/chunks/{timePicker.component-9uhrYSK_.js.map → timePicker.component-B8Md1wxz.js.map} +1 -1
  65. package/dist/chunks/{timeRange.component-BSAMk2js.js → timeRange.component-DtNIkrsw.js} +2 -2
  66. package/dist/chunks/{timeRange.component-BSAMk2js.js.map → timeRange.component-DtNIkrsw.js.map} +1 -1
  67. package/dist/chunks/{timeRange.component-CL5z9FRa.js → timeRange.component-l8jhl4Vv.js} +2 -2
  68. package/dist/chunks/{timeRange.component-CL5z9FRa.js.map → timeRange.component-l8jhl4Vv.js.map} +1 -1
  69. package/dist/chunks/{withFormControl-D0tbS4T0.js → withFormControl-CCJImQAG.js} +37 -29
  70. package/dist/chunks/{withFormControl-D0tbS4T0.js.map → withFormControl-CCJImQAG.js.map} +1 -1
  71. package/dist/chunks/{withFormControl-ClG2Nbcf.js → withFormControl-COwU1OTv.js} +2 -2
  72. package/dist/chunks/{withFormControl-ClG2Nbcf.js.map → withFormControl-COwU1OTv.js.map} +1 -1
  73. package/dist/cjs/components/ButtonGroup/index.cjs +1 -1
  74. package/dist/cjs/components/Checkbox/index.cjs +1 -1
  75. package/dist/cjs/components/CheckboxGroup/index.cjs +1 -1
  76. package/dist/cjs/components/ConversationCard/index.cjs +1 -1
  77. package/dist/cjs/components/DatePicker/index.cjs +1 -1
  78. package/dist/cjs/components/Menu/index.cjs +1 -1
  79. package/dist/cjs/components/PinInput/index.cjs +1 -1
  80. package/dist/cjs/components/RadioGroup/index.cjs +1 -1
  81. package/dist/cjs/components/RatingDots/index.cjs +1 -1
  82. package/dist/cjs/components/Select/index.cjs +1 -1
  83. package/dist/cjs/components/Switch/index.cjs +1 -1
  84. package/dist/cjs/components/TagBlock/index.cjs +1 -1
  85. package/dist/cjs/components/TextInput/index.cjs +1 -1
  86. package/dist/cjs/components/Textarea/index.cjs +1 -1
  87. package/dist/cjs/components/TimePicker/index.cjs +1 -1
  88. package/dist/cjs/components/TimeRange/index.cjs +1 -1
  89. package/dist/cjs/components/index.cjs +1 -1
  90. package/dist/cjs/index.cjs +1 -1
  91. package/dist/cjs/theme/index.cjs +1 -1
  92. package/dist/esm/components/ButtonGroup/index.js +1 -1
  93. package/dist/esm/components/Checkbox/index.js +1 -1
  94. package/dist/esm/components/CheckboxGroup/index.js +1 -1
  95. package/dist/esm/components/ConversationCard/index.js +1 -1
  96. package/dist/esm/components/DatePicker/index.js +1 -1
  97. package/dist/esm/components/Menu/index.js +1 -1
  98. package/dist/esm/components/PinInput/index.js +1 -1
  99. package/dist/esm/components/RadioGroup/index.js +1 -1
  100. package/dist/esm/components/RatingDots/index.js +1 -1
  101. package/dist/esm/components/Select/index.js +1 -1
  102. package/dist/esm/components/Switch/index.js +1 -1
  103. package/dist/esm/components/TagBlock/index.js +1 -1
  104. package/dist/esm/components/TextInput/index.js +1 -1
  105. package/dist/esm/components/Textarea/index.js +1 -1
  106. package/dist/esm/components/TimePicker/index.js +1 -1
  107. package/dist/esm/components/TimeRange/index.js +1 -1
  108. package/dist/esm/components/index.js +16 -16
  109. package/dist/esm/index.js +17 -17
  110. package/dist/esm/theme/index.js +1 -1
  111. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("./jsx-runtime-BjDatQAs.js"),c=require("react"),q=require("./withFormControl-ClG2Nbcf.js"),w=require("./attr-BMs6szZx.js"),N=require("./create-slot-recipe-context-IwVIgtBt.js"),m=require("./factory-D6tdBUPG.js"),i=require("./use-locale-context-D0LByRu9.js"),f=require("./use-field-context-CArmgHPP.js"),l=require("./index-CHIISuTq.js"),x=require("./index-DBk0LkcO.js"),I=t=>t&&t.__esModule?t:{default:t},_=I(c),[S,u]=i.createContext({name:"SwitchContext",hookName:"useSwitchContext",providerName:"<SwitchProvider />"}),R=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getControlProps(),t);return n.jsxRuntimeExports.jsx(i.ark.span,{...s,ref:r})});R.displayName="SwitchControl";const C=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getHiddenInputProps(),t),o=f.useFieldContext();return n.jsxRuntimeExports.jsx(i.ark.input,{"aria-describedby":o?.ariaDescribedby,...s,ref:r})});C.displayName="SwitchHiddenInput";const b=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getLabelProps(),t);return n.jsxRuntimeExports.jsx(i.ark.span,{...s,ref:r})});b.displayName="SwitchLabel";const A=t=>{const r=c.useId(),{getRootNode:e}=i.useEnvironmentContext(),{dir:s}=i.useLocaleContext(),o=f.useFieldContext(),a={id:r,ids:{label:o?.ids.label,hiddenInput:o?.ids.control},dir:s,disabled:o?.disabled,readOnly:o?.readOnly,invalid:o?.invalid,required:o?.required,getRootNode:e,...t},d=i.useMachine(x.machine,a);return x.connect(d,i.normalizeProps)},j=c.forwardRef((t,r)=>{const[e,s]=i.createSplitProps()(t,["checked","defaultChecked","disabled","form","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]),o=A(e),a=l.mergeProps(o.getRootProps(),s);return n.jsxRuntimeExports.jsx(S,{value:o,children:n.jsxRuntimeExports.jsx(i.ark.label,{...a,ref:r})})});j.displayName="SwitchRoot";const P=c.forwardRef((t,r)=>{const[{value:e},s]=i.createSplitProps()(t,["value"]),o=l.mergeProps(e.getRootProps(),s);return n.jsxRuntimeExports.jsx(S,{value:e,children:n.jsxRuntimeExports.jsx(i.ark.label,{...o,ref:r})})});P.displayName="SwitchRootProvider";const k=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getThumbProps(),t);return n.jsxRuntimeExports.jsx(i.ark.span,{...s,ref:r})});k.displayName="SwitchThumb";const{withProvider:g,withContext:p,useStyles:L}=N.createSlotRecipeContext({key:"switch"});g(P,"root",{forwardAsChild:!0});const $=g(j,"root",{forwardAsChild:!0}),F=p(b,"label",{forwardAsChild:!0}),T=p(k,"thumb",{forwardAsChild:!0}),H=p(R,"control",{forwardAsChild:!0,defaultProps:{children:n.jsxRuntimeExports.jsx(T,{})}});c.forwardRef(function(r,e){const s=u(),o=L(),{fallback:a,children:d,...h}=r;return n.jsxRuntimeExports.jsx(m.chakra.span,{ref:e,"data-checked":w.dataAttr(s.checked),...h,css:[o.indicator,r.css],children:s.checked?d:a})});c.forwardRef(function(r,e){const s=u(),{fallback:o,children:a,...d}=r;return n.jsxRuntimeExports.jsx(m.chakra.span,{ref:e,"data-checked":w.dataAttr(s.checked),...d,children:s.checked?a:o})});const O=C,v=_.default.forwardRef(({children:t,indeterminate:r=!1,onContrast:e,label:s,rootRef:o,size:a="md",switchRef:d,...h},y)=>{const E=c.useMemo(()=>r?e?"indeterminateOnContrast":"indeterminate":e?"onContrast":"default",[r,e]);return n.jsxRuntimeExports.jsxs($,{className:"Switch","data-testid":"kibble-switch",ref:o,size:a,variant:E,...h,children:[n.jsxRuntimeExports.jsx(O,{className:"Switch_Input","data-testid":"kibble-switch-input",ref:d||y}),n.jsxRuntimeExports.jsx(H,{className:"Switch_Control","data-testid":"kibble-switch-control"}),!!t&&n.jsxRuntimeExports.jsx(F,{children:t})]})});v.displayName="Switch";const M=q.withFormControl(v);exports.WrappedSwitch=M;
2
- //# sourceMappingURL=switch.component-DghHmo1Q.js.map
1
+ "use strict";const n=require("./jsx-runtime-BjDatQAs.js"),c=require("react"),q=require("./withFormControl-COwU1OTv.js"),w=require("./attr-BMs6szZx.js"),N=require("./create-slot-recipe-context-IwVIgtBt.js"),m=require("./factory-D6tdBUPG.js"),i=require("./use-locale-context-D0LByRu9.js"),f=require("./use-field-context-CArmgHPP.js"),l=require("./index-CHIISuTq.js"),x=require("./index-DBk0LkcO.js"),I=t=>t&&t.__esModule?t:{default:t},_=I(c),[S,u]=i.createContext({name:"SwitchContext",hookName:"useSwitchContext",providerName:"<SwitchProvider />"}),R=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getControlProps(),t);return n.jsxRuntimeExports.jsx(i.ark.span,{...s,ref:r})});R.displayName="SwitchControl";const C=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getHiddenInputProps(),t),o=f.useFieldContext();return n.jsxRuntimeExports.jsx(i.ark.input,{"aria-describedby":o?.ariaDescribedby,...s,ref:r})});C.displayName="SwitchHiddenInput";const b=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getLabelProps(),t);return n.jsxRuntimeExports.jsx(i.ark.span,{...s,ref:r})});b.displayName="SwitchLabel";const A=t=>{const r=c.useId(),{getRootNode:e}=i.useEnvironmentContext(),{dir:s}=i.useLocaleContext(),o=f.useFieldContext(),a={id:r,ids:{label:o?.ids.label,hiddenInput:o?.ids.control},dir:s,disabled:o?.disabled,readOnly:o?.readOnly,invalid:o?.invalid,required:o?.required,getRootNode:e,...t},d=i.useMachine(x.machine,a);return x.connect(d,i.normalizeProps)},j=c.forwardRef((t,r)=>{const[e,s]=i.createSplitProps()(t,["checked","defaultChecked","disabled","form","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]),o=A(e),a=l.mergeProps(o.getRootProps(),s);return n.jsxRuntimeExports.jsx(S,{value:o,children:n.jsxRuntimeExports.jsx(i.ark.label,{...a,ref:r})})});j.displayName="SwitchRoot";const P=c.forwardRef((t,r)=>{const[{value:e},s]=i.createSplitProps()(t,["value"]),o=l.mergeProps(e.getRootProps(),s);return n.jsxRuntimeExports.jsx(S,{value:e,children:n.jsxRuntimeExports.jsx(i.ark.label,{...o,ref:r})})});P.displayName="SwitchRootProvider";const k=c.forwardRef((t,r)=>{const e=u(),s=l.mergeProps(e.getThumbProps(),t);return n.jsxRuntimeExports.jsx(i.ark.span,{...s,ref:r})});k.displayName="SwitchThumb";const{withProvider:g,withContext:p,useStyles:L}=N.createSlotRecipeContext({key:"switch"});g(P,"root",{forwardAsChild:!0});const $=g(j,"root",{forwardAsChild:!0}),F=p(b,"label",{forwardAsChild:!0}),T=p(k,"thumb",{forwardAsChild:!0}),H=p(R,"control",{forwardAsChild:!0,defaultProps:{children:n.jsxRuntimeExports.jsx(T,{})}});c.forwardRef(function(r,e){const s=u(),o=L(),{fallback:a,children:d,...h}=r;return n.jsxRuntimeExports.jsx(m.chakra.span,{ref:e,"data-checked":w.dataAttr(s.checked),...h,css:[o.indicator,r.css],children:s.checked?d:a})});c.forwardRef(function(r,e){const s=u(),{fallback:o,children:a,...d}=r;return n.jsxRuntimeExports.jsx(m.chakra.span,{ref:e,"data-checked":w.dataAttr(s.checked),...d,children:s.checked?a:o})});const O=C,v=_.default.forwardRef(({children:t,indeterminate:r=!1,onContrast:e,label:s,rootRef:o,size:a="md",switchRef:d,...h},y)=>{const E=c.useMemo(()=>r?e?"indeterminateOnContrast":"indeterminate":e?"onContrast":"default",[r,e]);return n.jsxRuntimeExports.jsxs($,{className:"Switch","data-testid":"kibble-switch",ref:o,size:a,variant:E,...h,children:[n.jsxRuntimeExports.jsx(O,{className:"Switch_Input","data-testid":"kibble-switch-input",ref:d||y}),n.jsxRuntimeExports.jsx(H,{className:"Switch_Control","data-testid":"kibble-switch-control"}),!!t&&n.jsxRuntimeExports.jsx(F,{children:t})]})});v.displayName="Switch";const M=q.withFormControl(v);exports.WrappedSwitch=M;
2
+ //# sourceMappingURL=switch.component-CJ3nDOQj.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.component-DghHmo1Q.js","sources":["../../node_modules/@ark-ui/react/dist/components/switch/use-switch-context.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-control.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-label.js","../../node_modules/@ark-ui/react/dist/components/switch/use-switch.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root-provider.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-thumb.js","../../node_modules/@chakra-ui/react/dist/esm/components/switch/switch.js","../../src/components/Switch/switch.component.tsx"],"sourcesContent":["'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [SwitchProvider, useSwitchContext] = createContext({\n name: \"SwitchContext\",\n hookName: \"useSwitchContext\",\n providerName: \"<SwitchProvider />\"\n});\n\nexport { SwitchProvider, useSwitchContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchControl = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getControlProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchControl.displayName = \"SwitchControl\";\n\nexport { SwitchControl };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from '../field/use-field-context.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchHiddenInput = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getHiddenInputProps(), props);\n const field = useFieldContext();\n return /* @__PURE__ */ jsx(ark.input, { \"aria-describedby\": field?.ariaDescribedby, ...mergedProps, ref });\n});\nSwitchHiddenInput.displayName = \"SwitchHiddenInput\";\n\nexport { SwitchHiddenInput };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchLabel = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getLabelProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchLabel.displayName = \"SwitchLabel\";\n\nexport { SwitchLabel };\n","'use client';\nimport { useMachine, normalizeProps } from '@zag-js/react';\nimport * as zagSwitch from '@zag-js/switch';\nimport { useId } from 'react';\nimport { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';\nimport { useLocaleContext } from '../../providers/locale/use-locale-context.js';\nimport { useFieldContext } from '../field/use-field-context.js';\n\nconst useSwitch = (props) => {\n const id = useId();\n const { getRootNode } = useEnvironmentContext();\n const { dir } = useLocaleContext();\n const field = useFieldContext();\n const machineProps = {\n id,\n ids: {\n label: field?.ids.label,\n hiddenInput: field?.ids.control\n },\n dir,\n disabled: field?.disabled,\n readOnly: field?.readOnly,\n invalid: field?.invalid,\n required: field?.required,\n getRootNode,\n ...props\n };\n const service = useMachine(zagSwitch.machine, machineProps);\n return zagSwitch.connect(service, normalizeProps);\n};\n\nexport { useSwitch };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useSwitch } from './use-switch.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRoot = forwardRef((props, ref) => {\n const [switchProps, localProps] = createSplitProps()(props, [\n \"checked\",\n \"defaultChecked\",\n \"disabled\",\n \"form\",\n \"id\",\n \"ids\",\n \"invalid\",\n \"label\",\n \"name\",\n \"onCheckedChange\",\n \"readOnly\",\n \"required\",\n \"value\"\n ]);\n const switchContext = useSwitch(switchProps);\n const mergedProps = mergeProps(switchContext.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: switchContext, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRoot.displayName = \"SwitchRoot\";\n\nexport { SwitchRoot };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRootProvider = forwardRef((props, ref) => {\n const [{ value: api }, localProps] = createSplitProps()(props, [\"value\"]);\n const mergedProps = mergeProps(api.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: api, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRootProvider.displayName = \"SwitchRootProvider\";\n\nexport { SwitchRootProvider };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchThumb = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getThumbProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchThumb.displayName = \"SwitchThumb\";\n\nexport { SwitchThumb };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { Switch, useSwitchContext } from '@ark-ui/react/switch';\nimport { forwardRef } from 'react';\nimport { dataAttr } from '../../utils/attr.js';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { chakra } from '../../styled-system/factory.js';\n\nconst {\n withProvider,\n withContext,\n useStyles: useSwitchStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"switch\" });\nconst SwitchRootProvider = withProvider(Switch.RootProvider, \"root\", { forwardAsChild: true });\nconst SwitchRoot = withProvider(\n Switch.Root,\n \"root\",\n { forwardAsChild: true }\n);\nconst SwitchPropsProvider = PropsProvider;\nconst SwitchLabel = withContext(\n Switch.Label,\n \"label\",\n { forwardAsChild: true }\n);\nconst SwitchThumb = withContext(\n Switch.Thumb,\n \"thumb\",\n { forwardAsChild: true }\n);\nconst SwitchControl = withContext(\n Switch.Control,\n \"control\",\n {\n forwardAsChild: true,\n defaultProps: { children: /* @__PURE__ */ jsx(SwitchThumb, {}) }\n }\n);\nconst SwitchIndicator = forwardRef(function SwitchIndicator2(props, ref) {\n const api = useSwitchContext();\n const styles = useSwitchStyles();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(\n chakra.span,\n {\n ref,\n \"data-checked\": dataAttr(api.checked),\n ...rest,\n css: [styles.indicator, props.css],\n children: api.checked ? children : fallback\n }\n );\n});\nconst SwitchThumbIndicator = forwardRef(function SwitchThumbIndicator2(props, ref) {\n const api = useSwitchContext();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(chakra.span, { ref, \"data-checked\": dataAttr(api.checked), ...rest, children: api.checked ? children : fallback });\n});\nconst SwitchContext = Switch.Context;\nconst SwitchHiddenInput = Switch.HiddenInput;\n\nexport { SwitchContext, SwitchControl, SwitchHiddenInput, SwitchIndicator, SwitchLabel, SwitchPropsProvider, SwitchRoot, SwitchRootProvider, SwitchThumb, SwitchThumbIndicator, useSwitchStyles };\n","import React, { useMemo } from 'react';\nimport { Switch as CSwitch } from '@chakra-ui/react/switch';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport interface SwitchProps extends WithFormControlProps, Omit<CSwitch.RootProps, 'label' | 'onChange'> {\n indeterminate?: boolean;\n rootRef?: React.Ref<HTMLLabelElement | null>;\n size?: FormControlSize;\n switchRef?: React.Ref<HTMLInputElement | null>;\n}\n\nconst Switch = React.forwardRef<HTMLInputElement, SwitchProps>(\n (\n {\n children,\n indeterminate = false,\n onContrast,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n label,\n rootRef,\n size = 'md',\n switchRef,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const _computedVariant = useMemo(() => {\n if (indeterminate) {\n return onContrast ? 'indeterminateOnContrast' : 'indeterminate';\n } else {\n return onContrast ? 'onContrast' : 'default';\n }\n }, [indeterminate, onContrast]);\n\n return (\n <CSwitch.Root\n className=\"Switch\"\n data-testid=\"kibble-switch\"\n ref={rootRef}\n size={size}\n variant={_computedVariant}\n {...rest}\n >\n <CSwitch.HiddenInput className=\"Switch_Input\" data-testid=\"kibble-switch-input\" ref={switchRef || ref} />\n <CSwitch.Control className=\"Switch_Control\" data-testid=\"kibble-switch-control\" />\n {!!children && <CSwitch.Label>{children}</CSwitch.Label>}\n </CSwitch.Root>\n );\n },\n);\n\nSwitch.displayName = 'Switch';\nconst WrappedSwitch = withFormControl<SwitchProps>(Switch);\n\nexport { WrappedSwitch as Switch };\n"],"names":["SwitchProvider","useSwitchContext","createContext","SwitchControl","forwardRef","props","ref","switchContext","mergedProps","mergeProps","jsx","ark","SwitchHiddenInput","field","useFieldContext","SwitchLabel","useSwitch","id","useId","getRootNode","useEnvironmentContext","dir","useLocaleContext","machineProps","service","useMachine","zagSwitch.machine","zagSwitch.connect","normalizeProps","SwitchRoot","switchProps","localProps","createSplitProps","SwitchRootProvider","api","SwitchThumb","withProvider","withContext","useSwitchStyles","createSlotRecipeContext","Switch.RootProvider","Switch.Root","Switch.Label","Switch.Thumb","Switch.Control","styles","fallback","children","rest","chakra","dataAttr","Switch.HiddenInput","Switch","React","indeterminate","onContrast","label","rootRef","size","switchRef","_computedVariant","useMemo","jsxs","CSwitch.Root","CSwitch.HiddenInput","CSwitch.Control","CSwitch.Label","WrappedSwitch","withFormControl"],"mappings":"wbAGM,CAACA,EAAgBC,CAAgB,EAAIC,gBAAc,CACvD,KAAM,gBACN,SAAU,mBACV,aAAc,oBAChB,CAAC,ECAKC,EAAgBC,EAAU,WAAC,CAACC,EAAOC,IAAQ,CAC/C,MAAMC,EAAgBN,EAAkB,EAClCO,EAAcC,EAAU,WAACF,EAAc,gBAAe,EAAIF,CAAK,EACrE,OAAuBK,EAAAA,kBAAAA,IAAIC,EAAAA,IAAI,KAAM,CAAE,GAAGH,EAAa,IAAAF,EAAK,CAC9D,CAAC,EACDH,EAAc,YAAc,gBCJ5B,MAAMS,EAAoBR,EAAU,WAAC,CAACC,EAAOC,IAAQ,CACnD,MAAMC,EAAgBN,EAAkB,EAClCO,EAAcC,EAAU,WAACF,EAAc,oBAAmB,EAAIF,CAAK,EACnEQ,EAAQC,EAAAA,gBAAiB,EAC/B,OAAuBJ,EAAG,kBAAA,IAACC,MAAI,MAAO,CAAE,mBAAoBE,GAAO,gBAAiB,GAAGL,EAAa,IAAAF,EAAK,CAC3G,CAAC,EACDM,EAAkB,YAAc,oBCPhC,MAAMG,EAAcX,EAAU,WAAC,CAACC,EAAOC,IAAQ,CAC7C,MAAMC,EAAgBN,EAAkB,EAClCO,EAAcC,EAAU,WAACF,EAAc,cAAa,EAAIF,CAAK,EACnE,OAAuBK,EAAAA,kBAAAA,IAAIC,EAAAA,IAAI,KAAM,CAAE,GAAGH,EAAa,IAAAF,EAAK,CAC9D,CAAC,EACDS,EAAY,YAAc,cCJ1B,MAAMC,EAAaX,GAAU,CAC3B,MAAMY,EAAKC,EAAAA,MAAO,EACZ,CAAE,YAAAC,CAAa,EAAGC,wBAAuB,EACzC,CAAE,IAAAC,CAAK,EAAGC,mBAAkB,EAC5BT,EAAQC,EAAAA,gBAAiB,E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KAAM,CAAE,IAAA3C,EAAK,eAAgB4C,EAAAA,SAAShB,EAAI,OAAO,EAAG,GAAGc,EAAM,SAAUd,EAAI,QAAUa,EAAWD,EAAU,CAC9I,CAAC,EAED,MAAMlC,EAAoBuC,ECjDpBC,EAASC,EAAM,QAAA,WACnB,CACE,CACE,SAAAN,EACA,cAAAO,EAAgB,GAChB,WAAAC,EAEA,MAAAC,EACA,QAAAC,EACA,KAAAC,EAAO,KACP,UAAAC,EACA,GAAGX,GAEL1C,IACsB,CAChB,MAAAsD,EAAmBC,EAAAA,QAAQ,IAC3BP,EACKC,EAAa,0BAA4B,gBAEzCA,EAAa,aAAe,UAEpC,CAACD,EAAeC,CAAU,CAAC,EAG5B,OAAAO,EAAA,kBAAA,KAACC,EAAA,CACC,UAAU,SACV,cAAY,gBACZ,IAAKN,EACL,KAAAC,EACA,QAASE,EACR,GAAGZ,EAEJ,SAAA,CAACtC,wBAAAsD,EAAA,CAAoB,UAAU,eAAe,cAAY,sBAAsB,IAAKL,GAAarD,EAAK,0BACtG2D,EAAA,CAAgB,UAAU,iBAAiB,cAAY,wBAAwB,EAC/E,CAAC,CAAClB,2BAAamB,EAAA,CAAe,SAAAnB,CAAS,CAAA,CAAA,CAAA,CAC1C,CAAA,CAGN,EAEAK,EAAO,YAAc,SACf,MAAAe,EAAgBC,kBAA6BhB,CAAM","x_google_ignoreList":[0,1,2,3,4,5,6,7,8]}
1
+ {"version":3,"file":"switch.component-CJ3nDOQj.js","sources":["../../node_modules/@ark-ui/react/dist/components/switch/use-switch-context.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-control.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-label.js","../../node_modules/@ark-ui/react/dist/components/switch/use-switch.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root-provider.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-thumb.js","../../node_modules/@chakra-ui/react/dist/esm/components/switch/switch.js","../../src/components/Switch/switch.component.tsx"],"sourcesContent":["'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [SwitchProvider, useSwitchContext] = createContext({\n name: \"SwitchContext\",\n hookName: \"useSwitchContext\",\n providerName: \"<SwitchProvider />\"\n});\n\nexport { SwitchProvider, useSwitchContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchControl = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getControlProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchControl.displayName = \"SwitchControl\";\n\nexport { SwitchControl };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from '../field/use-field-context.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchHiddenInput = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getHiddenInputProps(), props);\n const field = useFieldContext();\n return /* @__PURE__ */ jsx(ark.input, { \"aria-describedby\": field?.ariaDescribedby, ...mergedProps, ref });\n});\nSwitchHiddenInput.displayName = \"SwitchHiddenInput\";\n\nexport { SwitchHiddenInput };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchLabel = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getLabelProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchLabel.displayName = \"SwitchLabel\";\n\nexport { SwitchLabel };\n","'use client';\nimport { useMachine, normalizeProps } from '@zag-js/react';\nimport * as zagSwitch from '@zag-js/switch';\nimport { useId } from 'react';\nimport { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';\nimport { useLocaleContext } from '../../providers/locale/use-locale-context.js';\nimport { useFieldContext } from '../field/use-field-context.js';\n\nconst useSwitch = (props) => {\n const id = useId();\n const { getRootNode } = useEnvironmentContext();\n const { dir } = useLocaleContext();\n const field = useFieldContext();\n const machineProps = {\n id,\n ids: {\n label: field?.ids.label,\n hiddenInput: field?.ids.control\n },\n dir,\n disabled: field?.disabled,\n readOnly: field?.readOnly,\n invalid: field?.invalid,\n required: field?.required,\n getRootNode,\n ...props\n };\n const service = useMachine(zagSwitch.machine, machineProps);\n return zagSwitch.connect(service, normalizeProps);\n};\n\nexport { useSwitch };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useSwitch } from './use-switch.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRoot = forwardRef((props, ref) => {\n const [switchProps, localProps] = createSplitProps()(props, [\n \"checked\",\n \"defaultChecked\",\n \"disabled\",\n \"form\",\n \"id\",\n \"ids\",\n \"invalid\",\n \"label\",\n \"name\",\n \"onCheckedChange\",\n \"readOnly\",\n \"required\",\n \"value\"\n ]);\n const switchContext = useSwitch(switchProps);\n const mergedProps = mergeProps(switchContext.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: switchContext, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRoot.displayName = \"SwitchRoot\";\n\nexport { SwitchRoot };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRootProvider = forwardRef((props, ref) => {\n const [{ value: api }, localProps] = createSplitProps()(props, [\"value\"]);\n const mergedProps = mergeProps(api.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: api, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRootProvider.displayName = \"SwitchRootProvider\";\n\nexport { SwitchRootProvider };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchThumb = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getThumbProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchThumb.displayName = \"SwitchThumb\";\n\nexport { SwitchThumb };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { Switch, useSwitchContext } from '@ark-ui/react/switch';\nimport { forwardRef } from 'react';\nimport { dataAttr } from '../../utils/attr.js';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { chakra } from '../../styled-system/factory.js';\n\nconst {\n withProvider,\n withContext,\n useStyles: useSwitchStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"switch\" });\nconst SwitchRootProvider = withProvider(Switch.RootProvider, \"root\", { forwardAsChild: true });\nconst SwitchRoot = withProvider(\n Switch.Root,\n \"root\",\n { forwardAsChild: true }\n);\nconst SwitchPropsProvider = PropsProvider;\nconst SwitchLabel = withContext(\n Switch.Label,\n \"label\",\n { forwardAsChild: true }\n);\nconst SwitchThumb = withContext(\n Switch.Thumb,\n \"thumb\",\n { forwardAsChild: true }\n);\nconst SwitchControl = withContext(\n Switch.Control,\n \"control\",\n {\n forwardAsChild: true,\n defaultProps: { children: /* @__PURE__ */ jsx(SwitchThumb, {}) }\n }\n);\nconst SwitchIndicator = forwardRef(function SwitchIndicator2(props, ref) {\n const api = useSwitchContext();\n const styles = useSwitchStyles();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(\n chakra.span,\n {\n ref,\n \"data-checked\": dataAttr(api.checked),\n ...rest,\n css: [styles.indicator, props.css],\n children: api.checked ? children : fallback\n }\n );\n});\nconst SwitchThumbIndicator = forwardRef(function SwitchThumbIndicator2(props, ref) {\n const api = useSwitchContext();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(chakra.span, { ref, \"data-checked\": dataAttr(api.checked), ...rest, children: api.checked ? children : fallback });\n});\nconst SwitchContext = Switch.Context;\nconst SwitchHiddenInput = Switch.HiddenInput;\n\nexport { SwitchContext, SwitchControl, SwitchHiddenInput, SwitchIndicator, SwitchLabel, SwitchPropsProvider, SwitchRoot, SwitchRootProvider, SwitchThumb, SwitchThumbIndicator, useSwitchStyles };\n","import React, { useMemo } from 'react';\nimport { Switch as CSwitch } from '@chakra-ui/react/switch';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport interface SwitchProps extends WithFormControlProps, Omit<CSwitch.RootProps, 'label' | 'onChange'> {\n indeterminate?: boolean;\n rootRef?: React.Ref<HTMLLabelElement | null>;\n size?: FormControlSize;\n switchRef?: React.Ref<HTMLInputElement | null>;\n}\n\nconst Switch = React.forwardRef<HTMLInputElement, SwitchProps>(\n (\n {\n children,\n indeterminate = false,\n onContrast,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n label,\n rootRef,\n size = 'md',\n switchRef,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const _computedVariant = useMemo(() => {\n if (indeterminate) {\n return onContrast ? 'indeterminateOnContrast' : 'indeterminate';\n } else {\n return onContrast ? 'onContrast' : 'default';\n }\n }, [indeterminate, onContrast]);\n\n return (\n <CSwitch.Root\n className=\"Switch\"\n data-testid=\"kibble-switch\"\n ref={rootRef}\n size={size}\n variant={_computedVariant}\n {...rest}\n >\n <CSwitch.HiddenInput className=\"Switch_Input\" data-testid=\"kibble-switch-input\" ref={switchRef || ref} />\n <CSwitch.Control className=\"Switch_Control\" data-testid=\"kibble-switch-control\" />\n {!!children && <CSwitch.Label>{children}</CSwitch.Label>}\n </CSwitch.Root>\n );\n },\n);\n\nSwitch.displayName = 'Switch';\nconst WrappedSwitch = withFormControl<SwitchProps>(Switch);\n\nexport { WrappedSwitch as Switch };\n"],"names":["SwitchProvider","useSwitchContext","createContext","SwitchControl","forwardRef","props","ref","switchContext","mergedProps","mergeProps","jsx","ark","SwitchHiddenInput","field","useFieldContext","SwitchLabel","useSwitch","id","useId","getRootNode","useEnvironmentContext","dir","useLocaleContext","machineProps","service","useMachine","zagSwitch.machine","zagSwitch.connect","normalizeProps","SwitchRoot","switchProps","localProps","createSplitProps","SwitchRootProvider","api","SwitchThumb","withProvider","withContext","useSwitchStyles","createSlotRecipeContext","Switch.RootProvider","Switch.Root","Switch.Label","Switch.Thumb","Switch.Control","styles","fallback","children","rest","chakra","dataAttr","Switch.HiddenInput","Switch","React","indeterminate","onContrast","label","rootRef","size","switchRef","_computedVariant","useMemo","jsxs","CSwitch.Root","CSwitch.HiddenInput","CSwitch.Control","CSwitch.Label","WrappedSwitch","withFormControl"],"mappings":"wbAGM,CAACA,EAAgBC,CAAgB,EAAIC,gBAAc,CACvD,KAAM,gBACN,SAAU,mBACV,aAAc,oBAChB,CAAC,ECAKC,EAAgBC,EAAU,WAAC,CAACC,EAAOC,IAAQ,CAC/C,MAAMC,EAAgBN,EAAkB,EAClCO,EAAcC,EAAU,WAACF,EAAc,gBAAe,EAAIF,CAAK,EACrE,OAAuBK,EAAAA,kBAAAA,IAAIC,EAAAA,IAAI,KAAM,CAAE,GAAGH,EAAa,IAAAF,EAAK,CAC9D,CAAC,EACDH,EAAc,YAAc,gBCJ5B,MAAMS,EAAoBR,EAAU,WAAC,CAACC,EAAOC,I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,GAAGZ,EAEJ,SAAA,CAACtC,wBAAAsD,EAAA,CAAoB,UAAU,eAAe,cAAY,sBAAsB,IAAKL,GAAarD,EAAK,0BACtG2D,EAAA,CAAgB,UAAU,iBAAiB,cAAY,wBAAwB,EAC/E,CAAC,CAAClB,2BAAamB,EAAA,CAAe,SAAAnB,CAAS,CAAA,CAAA,CAAA,CAC1C,CAAA,CAGN,EAEAK,EAAO,YAAc,SACf,MAAAe,EAAgBC,kBAA6BhB,CAAM","x_google_ignoreList":[0,1,2,3,4,5,6,7,8]}
@@ -1,6 +1,6 @@
1
1
  import { j as c } from "./jsx-runtime-C5mzlN2N.js";
2
2
  import I, { forwardRef as n, useId as A, useMemo as L } from "react";
3
- import { w as T } from "./withFormControl-D0tbS4T0.js";
3
+ import { w as T } from "./withFormControl-CCJImQAG.js";
4
4
  import { d as u } from "./attr-sm10PXOd.js";
5
5
  import { c as _ } from "./create-slot-recipe-context-BJmsuxih.js";
6
6
  import { c as w } from "./factory-Ctbv0Ozn.js";
@@ -151,4 +151,4 @@ const rt = T(g);
151
151
  export {
152
152
  rt as W
153
153
  };
154
- //# sourceMappingURL=switch.component-C2SVRVqH.js.map
154
+ //# sourceMappingURL=switch.component-NP_hIh2c.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.component-C2SVRVqH.js","sources":["../../node_modules/@ark-ui/react/dist/components/switch/use-switch-context.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-control.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-label.js","../../node_modules/@ark-ui/react/dist/components/switch/use-switch.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root-provider.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-thumb.js","../../node_modules/@chakra-ui/react/dist/esm/components/switch/switch.js","../../src/components/Switch/switch.component.tsx"],"sourcesContent":["'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [SwitchProvider, useSwitchContext] = createContext({\n name: \"SwitchContext\",\n hookName: \"useSwitchContext\",\n providerName: \"<SwitchProvider />\"\n});\n\nexport { SwitchProvider, useSwitchContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchControl = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getControlProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchControl.displayName = \"SwitchControl\";\n\nexport { SwitchControl };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from '../field/use-field-context.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchHiddenInput = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getHiddenInputProps(), props);\n const field = useFieldContext();\n return /* @__PURE__ */ jsx(ark.input, { \"aria-describedby\": field?.ariaDescribedby, ...mergedProps, ref });\n});\nSwitchHiddenInput.displayName = \"SwitchHiddenInput\";\n\nexport { SwitchHiddenInput };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchLabel = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getLabelProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchLabel.displayName = \"SwitchLabel\";\n\nexport { SwitchLabel };\n","'use client';\nimport { useMachine, normalizeProps } from '@zag-js/react';\nimport * as zagSwitch from '@zag-js/switch';\nimport { useId } from 'react';\nimport { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';\nimport { useLocaleContext } from '../../providers/locale/use-locale-context.js';\nimport { useFieldContext } from '../field/use-field-context.js';\n\nconst useSwitch = (props) => {\n const id = useId();\n const { getRootNode } = useEnvironmentContext();\n const { dir } = useLocaleContext();\n const field = useFieldContext();\n const machineProps = {\n id,\n ids: {\n label: field?.ids.label,\n hiddenInput: field?.ids.control\n },\n dir,\n disabled: field?.disabled,\n readOnly: field?.readOnly,\n invalid: field?.invalid,\n required: field?.required,\n getRootNode,\n ...props\n };\n const service = useMachine(zagSwitch.machine, machineProps);\n return zagSwitch.connect(service, normalizeProps);\n};\n\nexport { useSwitch };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useSwitch } from './use-switch.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRoot = forwardRef((props, ref) => {\n const [switchProps, localProps] = createSplitProps()(props, [\n \"checked\",\n \"defaultChecked\",\n \"disabled\",\n \"form\",\n \"id\",\n \"ids\",\n \"invalid\",\n \"label\",\n \"name\",\n \"onCheckedChange\",\n \"readOnly\",\n \"required\",\n \"value\"\n ]);\n const switchContext = useSwitch(switchProps);\n const mergedProps = mergeProps(switchContext.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: switchContext, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRoot.displayName = \"SwitchRoot\";\n\nexport { SwitchRoot };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRootProvider = forwardRef((props, ref) => {\n const [{ value: api }, localProps] = createSplitProps()(props, [\"value\"]);\n const mergedProps = mergeProps(api.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: api, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRootProvider.displayName = \"SwitchRootProvider\";\n\nexport { SwitchRootProvider };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchThumb = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getThumbProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchThumb.displayName = \"SwitchThumb\";\n\nexport { SwitchThumb };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { Switch, useSwitchContext } from '@ark-ui/react/switch';\nimport { forwardRef } from 'react';\nimport { dataAttr } from '../../utils/attr.js';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { chakra } from '../../styled-system/factory.js';\n\nconst {\n withProvider,\n withContext,\n useStyles: useSwitchStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"switch\" });\nconst SwitchRootProvider = withProvider(Switch.RootProvider, \"root\", { forwardAsChild: true });\nconst SwitchRoot = withProvider(\n Switch.Root,\n \"root\",\n { forwardAsChild: true }\n);\nconst SwitchPropsProvider = PropsProvider;\nconst SwitchLabel = withContext(\n Switch.Label,\n \"label\",\n { forwardAsChild: true }\n);\nconst SwitchThumb = withContext(\n Switch.Thumb,\n \"thumb\",\n { forwardAsChild: true }\n);\nconst SwitchControl = withContext(\n Switch.Control,\n \"control\",\n {\n forwardAsChild: true,\n defaultProps: { children: /* @__PURE__ */ jsx(SwitchThumb, {}) }\n }\n);\nconst SwitchIndicator = forwardRef(function SwitchIndicator2(props, ref) {\n const api = useSwitchContext();\n const styles = useSwitchStyles();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(\n chakra.span,\n {\n ref,\n \"data-checked\": dataAttr(api.checked),\n ...rest,\n css: [styles.indicator, props.css],\n children: api.checked ? children : fallback\n }\n );\n});\nconst SwitchThumbIndicator = forwardRef(function SwitchThumbIndicator2(props, ref) {\n const api = useSwitchContext();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(chakra.span, { ref, \"data-checked\": dataAttr(api.checked), ...rest, children: api.checked ? children : fallback });\n});\nconst SwitchContext = Switch.Context;\nconst SwitchHiddenInput = Switch.HiddenInput;\n\nexport { SwitchContext, SwitchControl, SwitchHiddenInput, SwitchIndicator, SwitchLabel, SwitchPropsProvider, SwitchRoot, SwitchRootProvider, SwitchThumb, SwitchThumbIndicator, useSwitchStyles };\n","import React, { useMemo } from 'react';\nimport { Switch as CSwitch } from '@chakra-ui/react/switch';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport interface SwitchProps extends WithFormControlProps, Omit<CSwitch.RootProps, 'label' | 'onChange'> {\n indeterminate?: boolean;\n rootRef?: React.Ref<HTMLLabelElement | null>;\n size?: FormControlSize;\n switchRef?: React.Ref<HTMLInputElement | null>;\n}\n\nconst Switch = React.forwardRef<HTMLInputElement, SwitchProps>(\n (\n {\n children,\n indeterminate = false,\n onContrast,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n label,\n rootRef,\n size = 'md',\n switchRef,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const _computedVariant = useMemo(() => {\n if (indeterminate) {\n return onContrast ? 'indeterminateOnContrast' : 'indeterminate';\n } else {\n return onContrast ? 'onContrast' : 'default';\n }\n }, [indeterminate, onContrast]);\n\n return (\n <CSwitch.Root\n className=\"Switch\"\n data-testid=\"kibble-switch\"\n ref={rootRef}\n size={size}\n variant={_computedVariant}\n {...rest}\n >\n <CSwitch.HiddenInput className=\"Switch_Input\" data-testid=\"kibble-switch-input\" ref={switchRef || ref} />\n <CSwitch.Control className=\"Switch_Control\" data-testid=\"kibble-switch-control\" />\n {!!children && <CSwitch.Label>{children}</CSwitch.Label>}\n </CSwitch.Root>\n );\n },\n);\n\nSwitch.displayName = 'Switch';\nconst WrappedSwitch = withFormControl<SwitchProps>(Switch);\n\nexport { WrappedSwitch as Switch };\n"],"names":["SwitchProvider","useSwitchContext","createContext","SwitchControl","forwardRef","props","ref","switchContext","mergedProps","mergeProps","jsx","ark","SwitchHiddenInput","field","useFieldContext","SwitchLabel","useSwitch","id","useId","getRootNode","useEnvironmentContext","dir","useLocaleContext","machineProps","service","useMachine","zagSwitch.machine","zagSwitch.connect","normalizeProps","SwitchRoot","switchProps","localProps","createSplitProps","SwitchRootProvider","api","SwitchThumb","withProvider","withContext","useSwitchStyles","createSlotRecipeContext","Switch.RootProvider","Switch.Root","Switch.Label","Switch.Thumb","Switch.Control","styles","fallback","children","rest","chakra","dataAttr","Switch.HiddenInput","Switch","React","indeterminate","onContrast","label","rootRef","size","switchRef","_computedVariant","useMemo","jsxs","CSwitch.Root","CSwitch.HiddenInput","CSwitch.Control","CSwitch.Label","WrappedSwitch","withFormControl"],"mappings":";;;;;;;;;;AAGA,MAAM,CAACA,GAAgBC,CAAgB,IAAIC,EAAc;AAAA,EACvD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAChB,CAAC,GCAKC,IAAgBC,EAAW,CAACC,GAAOC,MAAQ;AAC/C,QAAMC,IAAgBN,EAAkB,GAClCO,IAAcC,EAAWF,EAAc,gBAAe,GAAIF,CAAK;AACrE,SAAuBK,gBAAAA,EAAAA,IAAIC,EAAI,MAAM,EAAE,GAAGH,GAAa,KAAAF,GAAK;AAC9D,CAAC;AACDH,EAAc,cAAc;ACJ5B,MAAMS,IAAoBR,EAAW,CAACC,GAAOC,MAAQ;AACnD,QAAMC,IAAgBN,EAAkB,GAClCO,IAAcC,EAAWF,EAAc,oBAAmB,GAAIF,CAAK,GACnEQ,IAA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AeC,CAAU,CAAC;AAG5B,WAAAO,gBAAAA,EAAA;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,eAAY;AAAA,QACZ,KAAKN;AAAA,QACL,MAAAC;AAAA,QACA,SAASE;AAAA,QACR,GAAGZ;AAAA,QAEJ,UAAA;AAAA,UAACtC,gBAAAA,MAAAsD,GAAA,EAAoB,WAAU,gBAAe,eAAY,uBAAsB,KAAKL,KAAarD,GAAK;AAAA,gCACtG2D,GAAA,EAAgB,WAAU,kBAAiB,eAAY,yBAAwB;AAAA,UAC/E,CAAC,CAAClB,2BAAamB,GAAA,EAAe,UAAAnB,EAAS,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAC1C;AAAA,EAAA;AAGN;AAEAK,EAAO,cAAc;AACf,MAAAe,KAAgBC,EAA6BhB,CAAM;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8]}
1
+ {"version":3,"file":"switch.component-NP_hIh2c.js","sources":["../../node_modules/@ark-ui/react/dist/components/switch/use-switch-context.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-control.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-label.js","../../node_modules/@ark-ui/react/dist/components/switch/use-switch.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-root-provider.js","../../node_modules/@ark-ui/react/dist/components/switch/switch-thumb.js","../../node_modules/@chakra-ui/react/dist/esm/components/switch/switch.js","../../src/components/Switch/switch.component.tsx"],"sourcesContent":["'use client';\nimport { createContext } from '../../utils/create-context.js';\n\nconst [SwitchProvider, useSwitchContext] = createContext({\n name: \"SwitchContext\",\n hookName: \"useSwitchContext\",\n providerName: \"<SwitchProvider />\"\n});\n\nexport { SwitchProvider, useSwitchContext };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchControl = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getControlProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchControl.displayName = \"SwitchControl\";\n\nexport { SwitchControl };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from '../field/use-field-context.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchHiddenInput = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getHiddenInputProps(), props);\n const field = useFieldContext();\n return /* @__PURE__ */ jsx(ark.input, { \"aria-describedby\": field?.ariaDescribedby, ...mergedProps, ref });\n});\nSwitchHiddenInput.displayName = \"SwitchHiddenInput\";\n\nexport { SwitchHiddenInput };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchLabel = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getLabelProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchLabel.displayName = \"SwitchLabel\";\n\nexport { SwitchLabel };\n","'use client';\nimport { useMachine, normalizeProps } from '@zag-js/react';\nimport * as zagSwitch from '@zag-js/switch';\nimport { useId } from 'react';\nimport { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';\nimport { useLocaleContext } from '../../providers/locale/use-locale-context.js';\nimport { useFieldContext } from '../field/use-field-context.js';\n\nconst useSwitch = (props) => {\n const id = useId();\n const { getRootNode } = useEnvironmentContext();\n const { dir } = useLocaleContext();\n const field = useFieldContext();\n const machineProps = {\n id,\n ids: {\n label: field?.ids.label,\n hiddenInput: field?.ids.control\n },\n dir,\n disabled: field?.disabled,\n readOnly: field?.readOnly,\n invalid: field?.invalid,\n required: field?.required,\n getRootNode,\n ...props\n };\n const service = useMachine(zagSwitch.machine, machineProps);\n return zagSwitch.connect(service, normalizeProps);\n};\n\nexport { useSwitch };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { useSwitch } from './use-switch.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRoot = forwardRef((props, ref) => {\n const [switchProps, localProps] = createSplitProps()(props, [\n \"checked\",\n \"defaultChecked\",\n \"disabled\",\n \"form\",\n \"id\",\n \"ids\",\n \"invalid\",\n \"label\",\n \"name\",\n \"onCheckedChange\",\n \"readOnly\",\n \"required\",\n \"value\"\n ]);\n const switchContext = useSwitch(switchProps);\n const mergedProps = mergeProps(switchContext.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: switchContext, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRoot.displayName = \"SwitchRoot\";\n\nexport { SwitchRoot };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { createSplitProps } from '../../utils/create-split-props.js';\nimport { ark } from '../factory.js';\nimport { SwitchProvider } from './use-switch-context.js';\n\nconst SwitchRootProvider = forwardRef((props, ref) => {\n const [{ value: api }, localProps] = createSplitProps()(props, [\"value\"]);\n const mergedProps = mergeProps(api.getRootProps(), localProps);\n return /* @__PURE__ */ jsx(SwitchProvider, { value: api, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref }) });\n});\nSwitchRootProvider.displayName = \"SwitchRootProvider\";\n\nexport { SwitchRootProvider };\n","'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useSwitchContext } from './use-switch-context.js';\n\nconst SwitchThumb = forwardRef((props, ref) => {\n const switchContext = useSwitchContext();\n const mergedProps = mergeProps(switchContext.getThumbProps(), props);\n return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });\n});\nSwitchThumb.displayName = \"SwitchThumb\";\n\nexport { SwitchThumb };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { Switch, useSwitchContext } from '@ark-ui/react/switch';\nimport { forwardRef } from 'react';\nimport { dataAttr } from '../../utils/attr.js';\nimport { createSlotRecipeContext } from '../../styled-system/create-slot-recipe-context.js';\nimport { chakra } from '../../styled-system/factory.js';\n\nconst {\n withProvider,\n withContext,\n useStyles: useSwitchStyles,\n PropsProvider\n} = createSlotRecipeContext({ key: \"switch\" });\nconst SwitchRootProvider = withProvider(Switch.RootProvider, \"root\", { forwardAsChild: true });\nconst SwitchRoot = withProvider(\n Switch.Root,\n \"root\",\n { forwardAsChild: true }\n);\nconst SwitchPropsProvider = PropsProvider;\nconst SwitchLabel = withContext(\n Switch.Label,\n \"label\",\n { forwardAsChild: true }\n);\nconst SwitchThumb = withContext(\n Switch.Thumb,\n \"thumb\",\n { forwardAsChild: true }\n);\nconst SwitchControl = withContext(\n Switch.Control,\n \"control\",\n {\n forwardAsChild: true,\n defaultProps: { children: /* @__PURE__ */ jsx(SwitchThumb, {}) }\n }\n);\nconst SwitchIndicator = forwardRef(function SwitchIndicator2(props, ref) {\n const api = useSwitchContext();\n const styles = useSwitchStyles();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(\n chakra.span,\n {\n ref,\n \"data-checked\": dataAttr(api.checked),\n ...rest,\n css: [styles.indicator, props.css],\n children: api.checked ? children : fallback\n }\n );\n});\nconst SwitchThumbIndicator = forwardRef(function SwitchThumbIndicator2(props, ref) {\n const api = useSwitchContext();\n const { fallback, children, ...rest } = props;\n return /* @__PURE__ */ jsx(chakra.span, { ref, \"data-checked\": dataAttr(api.checked), ...rest, children: api.checked ? children : fallback });\n});\nconst SwitchContext = Switch.Context;\nconst SwitchHiddenInput = Switch.HiddenInput;\n\nexport { SwitchContext, SwitchControl, SwitchHiddenInput, SwitchIndicator, SwitchLabel, SwitchPropsProvider, SwitchRoot, SwitchRootProvider, SwitchThumb, SwitchThumbIndicator, useSwitchStyles };\n","import React, { useMemo } from 'react';\nimport { Switch as CSwitch } from '@chakra-ui/react/switch';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport interface SwitchProps extends WithFormControlProps, Omit<CSwitch.RootProps, 'label' | 'onChange'> {\n indeterminate?: boolean;\n rootRef?: React.Ref<HTMLLabelElement | null>;\n size?: FormControlSize;\n switchRef?: React.Ref<HTMLInputElement | null>;\n}\n\nconst Switch = React.forwardRef<HTMLInputElement, SwitchProps>(\n (\n {\n children,\n indeterminate = false,\n onContrast,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n label,\n rootRef,\n size = 'md',\n switchRef,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const _computedVariant = useMemo(() => {\n if (indeterminate) {\n return onContrast ? 'indeterminateOnContrast' : 'indeterminate';\n } else {\n return onContrast ? 'onContrast' : 'default';\n }\n }, [indeterminate, onContrast]);\n\n return (\n <CSwitch.Root\n className=\"Switch\"\n data-testid=\"kibble-switch\"\n ref={rootRef}\n size={size}\n variant={_computedVariant}\n {...rest}\n >\n <CSwitch.HiddenInput className=\"Switch_Input\" data-testid=\"kibble-switch-input\" ref={switchRef || ref} />\n <CSwitch.Control className=\"Switch_Control\" data-testid=\"kibble-switch-control\" />\n {!!children && <CSwitch.Label>{children}</CSwitch.Label>}\n </CSwitch.Root>\n );\n },\n);\n\nSwitch.displayName = 'Switch';\nconst WrappedSwitch = withFormControl<SwitchProps>(Switch);\n\nexport { WrappedSwitch as Switch };\n"],"names":["SwitchProvider","useSwitchContext","createContext","SwitchControl","forwardRef","props","ref","switchContext","mergedProps","mergeProps","jsx","ark","SwitchHiddenInput","field","useFieldContext","SwitchLabel","useSwitch","id","useId","getRootNode","useEnvironmentContext","dir","useLocaleContext","machineProps","service","useMachine","zagSwitch.machine","zagSwitch.connect","normalizeProps","SwitchRoot","switchProps","localProps","createSplitProps","SwitchRootProvider","api","SwitchThumb","withProvider","withContext","useSwitchStyles","createSlotRecipeContext","Switch.RootProvider","Switch.Root","Switch.Label","Switch.Thumb","Switch.Control","styles","fallback","children","rest","chakra","dataAttr","Switch.HiddenInput","Switch","React","indeterminate","onContrast","label","rootRef","size","switchRef","_computedVariant","useMemo","jsxs","CSwitch.Root","CSwitch.HiddenInput","CSwitch.Control","CSwitch.Label","WrappedSwitch","withFormControl"],"mappings":";;;;;;;;;;AAGA,MAAM,CAACA,GAAgBC,CAAgB,IAAIC,EAAc;AAAA,EACvD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAChB,CAAC,GCAKC,IAAgBC,EAAW,CAACC,GAAOC,MAAQ;AAC/C,QAAMC,IAAgBN,EAAkB,GAClCO,IAAcC,EAAWF,EAAc,gBAAe,GAAIF,CAAK;AACrE,SAAuBK,gBAAAA,EAAAA,IAAIC,EAAI,MAAM,EAAE,GAAGH,GAAa,KAAAF,GAAK;AAC9D,CAAC;AACDH,EAAc,cAAc;ACJ5B,MAAMS,IAAoBR,EAAW,CAACC,GAAOC,MAAQ;AACnD,QAAMC,IAAgBN,EAAkB,GAClCO,IAAcC,EAAWF,EAAc,oBAAmB,GAAIF,CAAK,GACnEQ,IAAQC,EAAiB;AAC/B,SAAuBJ,gBAAAA,EAAG,IAACC,EAAI,OAAO,EAAE,oBAAoBE,GAAO,iBAAiB,GAAGL,GAAa,KAAAF,GAAK;AAC3G,CAAC;AACDM,EAAkB,cAAc;ACPhC,MAAMG,IAAcX,EAAW,CAACC,GAAOC,MAAQ;AAC7C,QAAMC,IAA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AA,MAAAsD,GAAA,EAAoB,WAAU,gBAAe,eAAY,uBAAsB,KAAKL,KAAarD,GAAK;AAAA,gCACtG2D,GAAA,EAAgB,WAAU,kBAAiB,eAAY,yBAAwB;AAAA,UAC/E,CAAC,CAAClB,2BAAamB,GAAA,EAAe,UAAAnB,EAAS,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAC1C;AAAA,EAAA;AAGN;AAEAK,EAAO,cAAc;AACf,MAAAe,KAAgBC,EAA6BhB,CAAM;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8]}
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
2
  import T, { useCallback as g } from "react";
3
3
  import { B as k } from "./button.component-Br9jCpBx.js";
4
4
  import { W as N } from "./heading.component-D02MeQPl.js";
5
- import { M as v } from "./menu.component-BFL1WXRS.js";
5
+ import { M as v } from "./menu.component-fFdY9cMO.js";
6
6
  import { S as w } from "./spinner.component-BcOsuuIq.js";
7
7
  import { T as W } from "./tag.component-BAH11mPX.js";
8
8
  import { W as h } from "./text.component-BthmuMFV.js";
@@ -166,4 +166,4 @@ export {
166
166
  q as T,
167
167
  d as a
168
168
  };
169
- //# sourceMappingURL=tagBlock.component-BQNwnshc.js.map
169
+ //# sourceMappingURL=tagBlock.component-jWG9O22v.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tagBlock.component-BQNwnshc.js","sources":["../../src/components/TagBlock/tagBlock.types.ts","../../src/components/TagBlock/tagBlock.component.tsx"],"sourcesContent":["export enum TagDisabledState {\n Inactive = 'Inactive',\n Deleted = 'Deleted',\n}\n\nexport interface TagBlockTag {\n label: string;\n value: string;\n groupLabel?: string;\n}\n","import React, { useCallback } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { Button } from 'components/Button/button.component';\nimport { Heading } from 'components/Heading/heading.component';\nimport { Menu, MenuProps } from 'components/Menu/menu.component';\nimport { Spinner } from 'components/Spinner/spinner.component';\nimport { Tag } from 'components/Tag/tag.component';\nimport { Text } from 'components/Text/text.component';\nimport { TagBlockTag, TagDisabledState } from './tagBlock.types';\nimport { MenuButtonProps } from 'components/Menu/components/MenuButton/menuButton.components';\n\ninterface BaseTagBlockProps {\n displayTagsInGroups?: boolean;\n errorText?: string;\n hasError?: boolean;\n loading?: boolean;\n menuProps?: MenuProps;\n onClearAll?: () => void;\n onRemoveTag?: (tag: string, selectedTags: TagBlockTag[]) => void;\n tags: TagBlockTag[];\n title?: string;\n}\n\ninterface DefaultTagBlockProps extends BaseTagBlockProps {\n canBeDeleted?: false;\n onDelete?: never;\n}\n\ninterface DeletableTagBlockProps extends BaseTagBlockProps {\n canBeDeleted: true;\n onDelete: () => void;\n}\n\nexport type TagBlockProps = DefaultTagBlockProps | DeletableTagBlockProps;\n\nconst defaultMenuButtonProps: MenuButtonProps = {\n size: 'sm',\n variant: 'secondarySubtle',\n iconName: 'plus',\n text: 'Add',\n hideCaret: true,\n};\n\nexport const TagBlock = ({\n title,\n menuProps,\n tags,\n canBeDeleted = false,\n onClearAll,\n onRemoveTag,\n onDelete,\n hasError = false,\n errorText = 'This field contains an error',\n displayTagsInGroups,\n loading = false,\n}: TagBlockProps): React.JSX.Element => {\n const handleRemoveTag = useCallback(\n (value: string): void => {\n if (onRemoveTag) {\n onRemoveTag(value, tags);\n }\n },\n [onRemoveTag, tags],\n );\n\n const tagsByGroup = React.useMemo(() => {\n if (!displayTagsInGroups) {\n return [];\n }\n const grouped = {} as Record<string, TagBlockTag[]>;\n for (const tag of tags) {\n const group = tag.groupLabel || '-';\n if (!grouped[group]) {\n grouped[group] = [];\n }\n grouped[group].push(tag);\n }\n return Object.entries(grouped).map(([groupLabel, tags]) => ({\n groupLabel,\n tags,\n }));\n }, [tags, displayTagsInGroups]);\n\n const renderTags = useCallback(\n (tags: TagBlockTag[]) => {\n return tags.map((tag) => {\n const isDisabled =\n tag.label.includes(TagDisabledState.Inactive) || tag.label.includes(TagDisabledState.Deleted);\n\n return (\n <Tag\n className=\"TagBlock__Tag\"\n data-testid=\"kibble-tag-block-tag\"\n mr={1}\n mb={1}\n key={tag.value}\n label={tag.label}\n onClose={(): void => handleRemoveTag(tag.value)}\n closeButtonDisplay=\"always\"\n fontWeight=\"normal\"\n color={isDisabled ? 'text.placeholder' : 'text'}\n size=\"md\"\n />\n );\n });\n },\n [handleRemoveTag],\n );\n\n return (\n <Box\n className=\"TagBlock\"\n data-testid=\"kibble-tag-block\"\n position=\"relative\"\n mb={3}\n py={2}\n pl={4}\n pr={2}\n bg=\"background.subtle\"\n borderRadius=\"lg\"\n boxShadow={hasError ? `0 0 0 2px var(--chakra-colors-border-danger)` : ''}\n border=\"1px\"\n borderColor=\"border\"\n overflow={loading ? 'hidden' : undefined}\n >\n <Flex\n className=\"TagBlock__ButtonContainer\"\n data-testid=\"kibble-tag-block-button-container\"\n justifyContent=\"space-between\"\n >\n <HStack gap={1} minH={10}>\n {title && (\n <Text className=\"TagBlock__Title\" mr={2} fontWeight=\"bold\">\n {title}\n </Text>\n )}\n <Menu\n data-testid=\"kibble-tag-block-menu\"\n {...menuProps}\n buttonProps={menuProps?.buttonProps || defaultMenuButtonProps}\n />\n <Button\n className=\"TagBlock__Button--ClearAll\"\n data-testid=\"kibble-tag-block-clear-all-button\"\n size=\"sm\"\n iconName=\"arrowCircle\"\n variant=\"ghostNeutral\"\n onClick={onClearAll}\n disabled={tags.length <= 0}\n >\n Clear All\n </Button>\n </HStack>\n {canBeDeleted && (\n <Box>\n <Button\n className=\"TagBlock__Button--Delete\"\n data-testid=\"kibble-tag-block-delete-button\"\n iconName=\"trashcan\"\n variant=\"ghostNeutral\"\n onClick={onDelete}\n justifySelf=\"flex-end\"\n />\n </Box>\n )}\n </Flex>\n {Boolean(tags.length) && (\n <Flex\n className=\"TagBlock__TagContainer\"\n data-testid=\"kibble-tag-block-tag-container\"\n mt={2}\n pb={1}\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {displayTagsInGroups && tagsByGroup.length ? (\n <Flex direction=\"column\">\n {tagsByGroup.map(({ groupLabel, tags }) => (\n <Box key={groupLabel} mb={2}>\n <Box className=\"TagBlock__GroupTitle\" data-testid=\"kibble-tag-block-group-title\">\n <Heading size=\"xs\" pb={2}>\n {groupLabel}\n </Heading>\n </Box>\n <Flex\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {renderTags(tags)}\n </Flex>\n </Box>\n ))}\n </Flex>\n ) : (\n renderTags(tags)\n )}\n </Flex>\n )}\n {loading && <Spinner fullScreen />}\n {hasError && (\n <Text className=\"TagBlock__Error\" data-testid=\"kibble-tag-block-error\" mt={2} size=\"xs\" variant=\"danger\">\n {errorText}\n </Text>\n )}\n </Box>\n );\n};\n"],"names":["TagDisabledState","defaultMenuButtonProps","TagBlock","title","menuProps","tags","canBeDeleted","onClearAll","onRemoveTag","onDelete","hasError","errorText","displayTagsInGroups","loading","handleRemoveTag","useCallback","value","tagsByGroup","React","grouped","tag","group","groupLabel","renderTags","isDisabled","jsx","Tag","jsxs","Box","Flex","HStack","Text","Menu","Button","Heading","Spinner"],"mappings":";;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACVA,EAAA,WAAW,YACXA,EAAA,UAAU,WAFAA,IAAAA,KAAA,CAAA,CAAA;ACqCZ,MAAMC,IAA0C;AAAA,EAC9C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AAAA,EACN,WAAW;AACb,GAEaC,IAAW,CAAC;AAAA,EACvB,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,qBAAAC;A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AAA;AAAA,QAEJ;AAAA,QACC,EAAQJ,EAAK,UACZoB,gBAAAA,EAAA;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAY;AAAA,YACZ,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,cAAa;AAAA,YACb,UAAS;AAAA,YACT,gBAAe;AAAA,YACf,YAAW;AAAA,YAEV,eAAuBZ,EAAY,+BACjCY,GAAK,EAAA,WAAU,UACb,UAAYZ,EAAA,IAAI,CAAC,EAAE,YAAAK,GAAY,MAAAjB,QAC7BsB,gBAAAA,OAAAC,GAAA,EAAqB,IAAI,GACxB,UAAA;AAAA,cAAAH,gBAAAA,EAAA,IAACG,GAAI,EAAA,WAAU,wBAAuB,eAAY,gCAChD,UAAAH,gBAAAA,EAAA,IAACS,GAAQ,EAAA,MAAK,MAAK,IAAI,GACpB,UAAAZ,EACH,CAAA,GACF;AAAA,cACAG,gBAAAA,EAAA;AAAA,gBAACI;AAAA,gBAAA;AAAA,kBACC,cAAa;AAAA,kBACb,UAAS;AAAA,kBACT,gBAAe;AAAA,kBACf,YAAW;AAAA,kBAEV,YAAWxB,CAAI;AAAA,gBAAA;AAAA,cAAA;AAAA,YAClB,EAAA,GAbQiB,CAcV,CACD,GACH,IAEAC,EAAWlB,CAAI;AAAA,UAAA;AAAA,QAEnB;AAAA,QAEDQ,KAAWY,gBAAAA,EAAAA,IAACU,GAAQ,EAAA,YAAU,GAAC,CAAA;AAAA,QAC/BzB,KACCe,gBAAAA,EAAA,IAACM,GAAK,EAAA,WAAU,mBAAkB,eAAY,0BAAyB,IAAI,GAAG,MAAK,MAAK,SAAQ,UAC7F,UACHpB,EAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ;AAEJ;"}
1
+ {"version":3,"file":"tagBlock.component-jWG9O22v.js","sources":["../../src/components/TagBlock/tagBlock.types.ts","../../src/components/TagBlock/tagBlock.component.tsx"],"sourcesContent":["export enum TagDisabledState {\n Inactive = 'Inactive',\n Deleted = 'Deleted',\n}\n\nexport interface TagBlockTag {\n label: string;\n value: string;\n groupLabel?: string;\n}\n","import React, { useCallback } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { Button } from 'components/Button/button.component';\nimport { Heading } from 'components/Heading/heading.component';\nimport { Menu, MenuProps } from 'components/Menu/menu.component';\nimport { Spinner } from 'components/Spinner/spinner.component';\nimport { Tag } from 'components/Tag/tag.component';\nimport { Text } from 'components/Text/text.component';\nimport { TagBlockTag, TagDisabledState } from './tagBlock.types';\nimport { MenuButtonProps } from 'components/Menu/components/MenuButton/menuButton.components';\n\ninterface BaseTagBlockProps {\n displayTagsInGroups?: boolean;\n errorText?: string;\n hasError?: boolean;\n loading?: boolean;\n menuProps?: MenuProps;\n onClearAll?: () => void;\n onRemoveTag?: (tag: string, selectedTags: TagBlockTag[]) => void;\n tags: TagBlockTag[];\n title?: string;\n}\n\ninterface DefaultTagBlockProps extends BaseTagBlockProps {\n canBeDeleted?: false;\n onDelete?: never;\n}\n\ninterface DeletableTagBlockProps extends BaseTagBlockProps {\n canBeDeleted: true;\n onDelete: () => void;\n}\n\nexport type TagBlockProps = DefaultTagBlockProps | DeletableTagBlockProps;\n\nconst defaultMenuButtonProps: MenuButtonProps = {\n size: 'sm',\n variant: 'secondarySubtle',\n iconName: 'plus',\n text: 'Add',\n hideCaret: true,\n};\n\nexport const TagBlock = ({\n title,\n menuProps,\n tags,\n canBeDeleted = false,\n onClearAll,\n onRemoveTag,\n onDelete,\n hasError = false,\n errorText = 'This field contains an error',\n displayTagsInGroups,\n loading = false,\n}: TagBlockProps): React.JSX.Element => {\n const handleRemoveTag = useCallback(\n (value: string): void => {\n if (onRemoveTag) {\n onRemoveTag(value, tags);\n }\n },\n [onRemoveTag, tags],\n );\n\n const tagsByGroup = React.useMemo(() => {\n if (!displayTagsInGroups) {\n return [];\n }\n const grouped = {} as Record<string, TagBlockTag[]>;\n for (const tag of tags) {\n const group = tag.groupLabel || '-';\n if (!grouped[group]) {\n grouped[group] = [];\n }\n grouped[group].push(tag);\n }\n return Object.entries(grouped).map(([groupLabel, tags]) => ({\n groupLabel,\n tags,\n }));\n }, [tags, displayTagsInGroups]);\n\n const renderTags = useCallback(\n (tags: TagBlockTag[]) => {\n return tags.map((tag) => {\n const isDisabled =\n tag.label.includes(TagDisabledState.Inactive) || tag.label.includes(TagDisabledState.Deleted);\n\n return (\n <Tag\n className=\"TagBlock__Tag\"\n data-testid=\"kibble-tag-block-tag\"\n mr={1}\n mb={1}\n key={tag.value}\n label={tag.label}\n onClose={(): void => handleRemoveTag(tag.value)}\n closeButtonDisplay=\"always\"\n fontWeight=\"normal\"\n color={isDisabled ? 'text.placeholder' : 'text'}\n size=\"md\"\n />\n );\n });\n },\n [handleRemoveTag],\n );\n\n return (\n <Box\n className=\"TagBlock\"\n data-testid=\"kibble-tag-block\"\n position=\"relative\"\n mb={3}\n py={2}\n pl={4}\n pr={2}\n bg=\"background.subtle\"\n borderRadius=\"lg\"\n boxShadow={hasError ? `0 0 0 2px var(--chakra-colors-border-danger)` : ''}\n border=\"1px\"\n borderColor=\"border\"\n overflow={loading ? 'hidden' : undefined}\n >\n <Flex\n className=\"TagBlock__ButtonContainer\"\n data-testid=\"kibble-tag-block-button-container\"\n justifyContent=\"space-between\"\n >\n <HStack gap={1} minH={10}>\n {title && (\n <Text className=\"TagBlock__Title\" mr={2} fontWeight=\"bold\">\n {title}\n </Text>\n )}\n <Menu\n data-testid=\"kibble-tag-block-menu\"\n {...menuProps}\n buttonProps={menuProps?.buttonProps || defaultMenuButtonProps}\n />\n <Button\n className=\"TagBlock__Button--ClearAll\"\n data-testid=\"kibble-tag-block-clear-all-button\"\n size=\"sm\"\n iconName=\"arrowCircle\"\n variant=\"ghostNeutral\"\n onClick={onClearAll}\n disabled={tags.length <= 0}\n >\n Clear All\n </Button>\n </HStack>\n {canBeDeleted && (\n <Box>\n <Button\n className=\"TagBlock__Button--Delete\"\n data-testid=\"kibble-tag-block-delete-button\"\n iconName=\"trashcan\"\n variant=\"ghostNeutral\"\n onClick={onDelete}\n justifySelf=\"flex-end\"\n />\n </Box>\n )}\n </Flex>\n {Boolean(tags.length) && (\n <Flex\n className=\"TagBlock__TagContainer\"\n data-testid=\"kibble-tag-block-tag-container\"\n mt={2}\n pb={1}\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {displayTagsInGroups && tagsByGroup.length ? (\n <Flex direction=\"column\">\n {tagsByGroup.map(({ groupLabel, tags }) => (\n <Box key={groupLabel} mb={2}>\n <Box className=\"TagBlock__GroupTitle\" data-testid=\"kibble-tag-block-group-title\">\n <Heading size=\"xs\" pb={2}>\n {groupLabel}\n </Heading>\n </Box>\n <Flex\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {renderTags(tags)}\n </Flex>\n </Box>\n ))}\n </Flex>\n ) : (\n renderTags(tags)\n )}\n </Flex>\n )}\n {loading && <Spinner fullScreen />}\n {hasError && (\n <Text className=\"TagBlock__Error\" data-testid=\"kibble-tag-block-error\" mt={2} size=\"xs\" variant=\"danger\">\n {errorText}\n </Text>\n )}\n </Box>\n );\n};\n"],"names":["TagDisabledState","defaultMenuButtonProps","TagBlock","title","menuProps","tags","canBeDeleted","onClearAll","onRemoveTag","onDelete","hasError","errorText","displayTagsInGroups","loading","handleRemoveTag","useCallback","value","tagsByGroup","React","grouped","tag","group","groupLabel","renderTags","isDisabled","jsx","Tag","jsxs","Box","Flex","HStack","Text","Menu","Button","Heading","Spinner"],"mappings":";;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACVA,EAAA,WAAW,YACXA,EAAA,UAAU,WAFAA,IAAAA,KAAA,CAAA,CAAA;ACqCZ,MAAMC,IAA0C;AAAA,EAC9C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU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B,eAAY,0BAAyB,IAAI,GAAG,MAAK,MAAK,SAAQ,UAC7F,UACHpB,EAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./jsx-runtime-BjDatQAs.js"),x=require("react"),k=require("./button.component-CsJxgblU.js"),C=require("./heading.component-BMvc5kM8.js"),E=require("./menu.component-BEEsicXT.js"),T=require("./spinner.component-CzOv8dIY.js"),N=require("./tag.component-DcEASytC.js"),f=require("./text.component-waIIFgwB.js"),r=require("./box-Baq7UBls.js"),l=require("./flex-D14H6HbP.js"),v=require("./h-stack-Bjx9hlJo.js"),q=n=>n&&n.__esModule?n:{default:n},w=q(x);var i=(n=>(n.Inactive="Inactive",n.Deleted="Deleted",n))(i||{});const y={size:"sm",variant:"secondarySubtle",iconName:"plus",text:"Add",hideCaret:!0},D=({title:n,menuProps:d,tags:o,canBeDeleted:h=!1,onClearAll:_,onRemoveTag:c,onDelete:B,hasError:b=!1,errorText:R="This field contains an error",displayTagsInGroups:u,loading:p=!1})=>{const m=x.useCallback(s=>{c&&c(s,o)},[c,o]),j=w.default.useMemo(()=>{if(!u)return[];const s={};for(const t of o){const a=t.groupLabel||"-";s[a]||(s[a]=[]),s[a].push(t)}return Object.entries(s).map(([t,a])=>({groupLabel:t,tags:a}))},[o,u]),g=x.useCallback(s=>s.map(t=>{const a=t.label.includes(i.Inactive)||t.label.includes(i.Deleted);return e.jsxRuntimeExports.jsx(N.Tag,{className:"TagBlock__Tag","data-testid":"kibble-tag-block-tag",mr:1,mb:1,label:t.label,onClose:()=>m(t.value),closeButtonDisplay:"always",fontWeight:"normal",color:a?"text.placeholder":"text",size:"md"},t.value)}),[m]);return e.jsxRuntimeExports.jsxs(r.Box,{className:"TagBlock","data-testid":"kibble-tag-block",position:"relative",mb:3,py:2,pl:4,pr:2,bg:"background.subtle",borderRadius:"lg",boxShadow:b?"0 0 0 2px var(--chakra-colors-border-danger)":"",border:"1px",borderColor:"border",overflow:p?"hidden":void 0,children:[e.jsxRuntimeExports.jsxs(l.Flex,{className:"TagBlock__ButtonContainer","data-testid":"kibble-tag-block-button-container",justifyContent:"space-between",children:[e.jsxRuntimeExports.jsxs(v.HStack,{gap:1,minH:10,children:[n&&e.jsxRuntimeExports.jsx(f.WrappedText,{className:"TagBlock__Title",mr:2,fontWeight:"bold",children:n}),e.jsxRuntimeExports.jsx(E.Menu,{"data-testid":"kibble-tag-block-menu",...d,buttonProps:d?.buttonProps||y}),e.jsxRuntimeExports.jsx(k.Button,{className:"TagBlock__Button--ClearAll","data-testid":"kibble-tag-block-clear-all-button",size:"sm",iconName:"arrowCircle",variant:"ghostNeutral",onClick:_,disabled:o.length<=0,children:"Clear All"})]}),h&&e.jsxRuntimeExports.jsx(r.Box,{children:e.jsxRuntimeExports.jsx(k.Button,{className:"TagBlock__Button--Delete","data-testid":"kibble-tag-block-delete-button",iconName:"trashcan",variant:"ghostNeutral",onClick:B,justifySelf:"flex-end"})})]}),!!o.length&&e.jsxRuntimeExports.jsx(l.Flex,{className:"TagBlock__TagContainer","data-testid":"kibble-tag-block-tag-container",mt:2,pb:1,alignContent:"space-between",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",children:u&&j.length?e.jsxRuntimeExports.jsx(l.Flex,{direction:"column",children:j.map(({groupLabel:s,tags:t})=>e.jsxRuntimeExports.jsxs(r.Box,{mb:2,children:[e.jsxRuntimeExports.jsx(r.Box,{className:"TagBlock__GroupTitle","data-testid":"kibble-tag-block-group-title",children:e.jsxRuntimeExports.jsx(C.WrappedHeading,{size:"xs",pb:2,children:s})}),e.jsxRuntimeExports.jsx(l.Flex,{alignContent:"space-between",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",children:g(t)})]},s))}):g(o)}),p&&e.jsxRuntimeExports.jsx(T.Spinner,{fullScreen:!0}),b&&e.jsxRuntimeExports.jsx(f.WrappedText,{className:"TagBlock__Error","data-testid":"kibble-tag-block-error",mt:2,size:"xs",variant:"danger",children:R})]})};exports.TagBlock=D;exports.TagDisabledState=i;
2
- //# sourceMappingURL=tagBlock.component-BcdJnkIB.js.map
1
+ "use strict";const e=require("./jsx-runtime-BjDatQAs.js"),x=require("react"),k=require("./button.component-CsJxgblU.js"),C=require("./heading.component-BMvc5kM8.js"),E=require("./menu.component-OwlCMqw2.js"),T=require("./spinner.component-CzOv8dIY.js"),N=require("./tag.component-DcEASytC.js"),f=require("./text.component-waIIFgwB.js"),r=require("./box-Baq7UBls.js"),l=require("./flex-D14H6HbP.js"),v=require("./h-stack-Bjx9hlJo.js"),q=n=>n&&n.__esModule?n:{default:n},w=q(x);var i=(n=>(n.Inactive="Inactive",n.Deleted="Deleted",n))(i||{});const y={size:"sm",variant:"secondarySubtle",iconName:"plus",text:"Add",hideCaret:!0},D=({title:n,menuProps:d,tags:o,canBeDeleted:h=!1,onClearAll:_,onRemoveTag:c,onDelete:B,hasError:b=!1,errorText:R="This field contains an error",displayTagsInGroups:u,loading:p=!1})=>{const m=x.useCallback(s=>{c&&c(s,o)},[c,o]),j=w.default.useMemo(()=>{if(!u)return[];const s={};for(const t of o){const a=t.groupLabel||"-";s[a]||(s[a]=[]),s[a].push(t)}return Object.entries(s).map(([t,a])=>({groupLabel:t,tags:a}))},[o,u]),g=x.useCallback(s=>s.map(t=>{const a=t.label.includes(i.Inactive)||t.label.includes(i.Deleted);return e.jsxRuntimeExports.jsx(N.Tag,{className:"TagBlock__Tag","data-testid":"kibble-tag-block-tag",mr:1,mb:1,label:t.label,onClose:()=>m(t.value),closeButtonDisplay:"always",fontWeight:"normal",color:a?"text.placeholder":"text",size:"md"},t.value)}),[m]);return e.jsxRuntimeExports.jsxs(r.Box,{className:"TagBlock","data-testid":"kibble-tag-block",position:"relative",mb:3,py:2,pl:4,pr:2,bg:"background.subtle",borderRadius:"lg",boxShadow:b?"0 0 0 2px var(--chakra-colors-border-danger)":"",border:"1px",borderColor:"border",overflow:p?"hidden":void 0,children:[e.jsxRuntimeExports.jsxs(l.Flex,{className:"TagBlock__ButtonContainer","data-testid":"kibble-tag-block-button-container",justifyContent:"space-between",children:[e.jsxRuntimeExports.jsxs(v.HStack,{gap:1,minH:10,children:[n&&e.jsxRuntimeExports.jsx(f.WrappedText,{className:"TagBlock__Title",mr:2,fontWeight:"bold",children:n}),e.jsxRuntimeExports.jsx(E.Menu,{"data-testid":"kibble-tag-block-menu",...d,buttonProps:d?.buttonProps||y}),e.jsxRuntimeExports.jsx(k.Button,{className:"TagBlock__Button--ClearAll","data-testid":"kibble-tag-block-clear-all-button",size:"sm",iconName:"arrowCircle",variant:"ghostNeutral",onClick:_,disabled:o.length<=0,children:"Clear All"})]}),h&&e.jsxRuntimeExports.jsx(r.Box,{children:e.jsxRuntimeExports.jsx(k.Button,{className:"TagBlock__Button--Delete","data-testid":"kibble-tag-block-delete-button",iconName:"trashcan",variant:"ghostNeutral",onClick:B,justifySelf:"flex-end"})})]}),!!o.length&&e.jsxRuntimeExports.jsx(l.Flex,{className:"TagBlock__TagContainer","data-testid":"kibble-tag-block-tag-container",mt:2,pb:1,alignContent:"space-between",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",children:u&&j.length?e.jsxRuntimeExports.jsx(l.Flex,{direction:"column",children:j.map(({groupLabel:s,tags:t})=>e.jsxRuntimeExports.jsxs(r.Box,{mb:2,children:[e.jsxRuntimeExports.jsx(r.Box,{className:"TagBlock__GroupTitle","data-testid":"kibble-tag-block-group-title",children:e.jsxRuntimeExports.jsx(C.WrappedHeading,{size:"xs",pb:2,children:s})}),e.jsxRuntimeExports.jsx(l.Flex,{alignContent:"space-between",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",children:g(t)})]},s))}):g(o)}),p&&e.jsxRuntimeExports.jsx(T.Spinner,{fullScreen:!0}),b&&e.jsxRuntimeExports.jsx(f.WrappedText,{className:"TagBlock__Error","data-testid":"kibble-tag-block-error",mt:2,size:"xs",variant:"danger",children:R})]})};exports.TagBlock=D;exports.TagDisabledState=i;
2
+ //# sourceMappingURL=tagBlock.component-lQeyNLgK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tagBlock.component-BcdJnkIB.js","sources":["../../src/components/TagBlock/tagBlock.types.ts","../../src/components/TagBlock/tagBlock.component.tsx"],"sourcesContent":["export enum TagDisabledState {\n Inactive = 'Inactive',\n Deleted = 'Deleted',\n}\n\nexport interface TagBlockTag {\n label: string;\n value: string;\n groupLabel?: string;\n}\n","import React, { useCallback } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { Button } from 'components/Button/button.component';\nimport { Heading } from 'components/Heading/heading.component';\nimport { Menu, MenuProps } from 'components/Menu/menu.component';\nimport { Spinner } from 'components/Spinner/spinner.component';\nimport { Tag } from 'components/Tag/tag.component';\nimport { Text } from 'components/Text/text.component';\nimport { TagBlockTag, TagDisabledState } from './tagBlock.types';\nimport { MenuButtonProps } from 'components/Menu/components/MenuButton/menuButton.components';\n\ninterface BaseTagBlockProps {\n displayTagsInGroups?: boolean;\n errorText?: string;\n hasError?: boolean;\n loading?: boolean;\n menuProps?: MenuProps;\n onClearAll?: () => void;\n onRemoveTag?: (tag: string, selectedTags: TagBlockTag[]) => void;\n tags: TagBlockTag[];\n title?: string;\n}\n\ninterface DefaultTagBlockProps extends BaseTagBlockProps {\n canBeDeleted?: false;\n onDelete?: never;\n}\n\ninterface DeletableTagBlockProps extends BaseTagBlockProps {\n canBeDeleted: true;\n onDelete: () => void;\n}\n\nexport type TagBlockProps = DefaultTagBlockProps | DeletableTagBlockProps;\n\nconst defaultMenuButtonProps: MenuButtonProps = {\n size: 'sm',\n variant: 'secondarySubtle',\n iconName: 'plus',\n text: 'Add',\n hideCaret: true,\n};\n\nexport const TagBlock = ({\n title,\n menuProps,\n tags,\n canBeDeleted = false,\n onClearAll,\n onRemoveTag,\n onDelete,\n hasError = false,\n errorText = 'This field contains an error',\n displayTagsInGroups,\n loading = false,\n}: TagBlockProps): React.JSX.Element => {\n const handleRemoveTag = useCallback(\n (value: string): void => {\n if (onRemoveTag) {\n onRemoveTag(value, tags);\n }\n },\n [onRemoveTag, tags],\n );\n\n const tagsByGroup = React.useMemo(() => {\n if (!displayTagsInGroups) {\n return [];\n }\n const grouped = {} as Record<string, TagBlockTag[]>;\n for (const tag of tags) {\n const group = tag.groupLabel || '-';\n if (!grouped[group]) {\n grouped[group] = [];\n }\n grouped[group].push(tag);\n }\n return Object.entries(grouped).map(([groupLabel, tags]) => ({\n groupLabel,\n tags,\n }));\n }, [tags, displayTagsInGroups]);\n\n const renderTags = useCallback(\n (tags: TagBlockTag[]) => {\n return tags.map((tag) => {\n const isDisabled =\n tag.label.includes(TagDisabledState.Inactive) || tag.label.includes(TagDisabledState.Deleted);\n\n return (\n <Tag\n className=\"TagBlock__Tag\"\n data-testid=\"kibble-tag-block-tag\"\n mr={1}\n mb={1}\n key={tag.value}\n label={tag.label}\n onClose={(): void => handleRemoveTag(tag.value)}\n closeButtonDisplay=\"always\"\n fontWeight=\"normal\"\n color={isDisabled ? 'text.placeholder' : 'text'}\n size=\"md\"\n />\n );\n });\n },\n [handleRemoveTag],\n );\n\n return (\n <Box\n className=\"TagBlock\"\n data-testid=\"kibble-tag-block\"\n position=\"relative\"\n mb={3}\n py={2}\n pl={4}\n pr={2}\n bg=\"background.subtle\"\n borderRadius=\"lg\"\n boxShadow={hasError ? `0 0 0 2px var(--chakra-colors-border-danger)` : ''}\n border=\"1px\"\n borderColor=\"border\"\n overflow={loading ? 'hidden' : undefined}\n >\n <Flex\n className=\"TagBlock__ButtonContainer\"\n data-testid=\"kibble-tag-block-button-container\"\n justifyContent=\"space-between\"\n >\n <HStack gap={1} minH={10}>\n {title && (\n <Text className=\"TagBlock__Title\" mr={2} fontWeight=\"bold\">\n {title}\n </Text>\n )}\n <Menu\n data-testid=\"kibble-tag-block-menu\"\n {...menuProps}\n buttonProps={menuProps?.buttonProps || defaultMenuButtonProps}\n />\n <Button\n className=\"TagBlock__Button--ClearAll\"\n data-testid=\"kibble-tag-block-clear-all-button\"\n size=\"sm\"\n iconName=\"arrowCircle\"\n variant=\"ghostNeutral\"\n onClick={onClearAll}\n disabled={tags.length <= 0}\n >\n Clear All\n </Button>\n </HStack>\n {canBeDeleted && (\n <Box>\n <Button\n className=\"TagBlock__Button--Delete\"\n data-testid=\"kibble-tag-block-delete-button\"\n iconName=\"trashcan\"\n variant=\"ghostNeutral\"\n onClick={onDelete}\n justifySelf=\"flex-end\"\n />\n </Box>\n )}\n </Flex>\n {Boolean(tags.length) && (\n <Flex\n className=\"TagBlock__TagContainer\"\n data-testid=\"kibble-tag-block-tag-container\"\n mt={2}\n pb={1}\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {displayTagsInGroups && tagsByGroup.length ? (\n <Flex direction=\"column\">\n {tagsByGroup.map(({ groupLabel, tags }) => (\n <Box key={groupLabel} mb={2}>\n <Box className=\"TagBlock__GroupTitle\" data-testid=\"kibble-tag-block-group-title\">\n <Heading size=\"xs\" pb={2}>\n {groupLabel}\n </Heading>\n </Box>\n <Flex\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {renderTags(tags)}\n </Flex>\n </Box>\n ))}\n </Flex>\n ) : (\n renderTags(tags)\n )}\n </Flex>\n )}\n {loading && <Spinner fullScreen />}\n {hasError && (\n <Text className=\"TagBlock__Error\" data-testid=\"kibble-tag-block-error\" mt={2} size=\"xs\" variant=\"danger\">\n {errorText}\n </Text>\n )}\n </Box>\n );\n};\n"],"names":["TagDisabledState","defaultMenuButtonProps","TagBlock","title","menuProps","tags","canBeDeleted","onClearAll","onRemoveTag","onDelete","hasError","errorText","displayTagsInGroups","loading","handleRemoveTag","useCallback","value","tagsByGroup","React","grouped","tag","group","groupLabel","renderTags","isDisabled","jsx","Tag","jsxs","Box","Flex","HStack","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AAuBZ,EAAY,+BACjCY,EAAK,KAAA,CAAA,UAAU,SACb,SAAYZ,EAAA,IAAI,CAAC,CAAE,WAAAK,EAAY,KAAAjB,KAC7BsB,yBAAAC,EAAAA,IAAA,CAAqB,GAAI,EACxB,SAAA,CAAAH,EAAA,kBAAA,IAACG,EAAI,IAAA,CAAA,UAAU,uBAAuB,cAAY,+BAChD,SAAAH,EAAA,kBAAA,IAACS,EAAQ,eAAA,CAAA,KAAK,KAAK,GAAI,EACpB,SAAAZ,CACH,CAAA,EACF,EACAG,EAAA,kBAAA,IAACI,EAAA,KAAA,CACC,aAAa,gBACb,SAAS,OACT,eAAe,aACf,WAAW,aAEV,WAAWxB,CAAI,CAAA,CAAA,CAClB,CAAA,EAbQiB,CAcV,CACD,EACH,EAEAC,EAAWlB,CAAI,CAAA,CAEnB,EAEDQ,GAAWY,EAAAA,kBAAAA,IAACU,EAAAA,QAAQ,CAAA,WAAU,EAAC,CAAA,EAC/BzB,GACCe,EAAA,kBAAA,IAACM,EAAK,YAAA,CAAA,UAAU,kBAAkB,cAAY,yBAAyB,GAAI,EAAG,KAAK,KAAK,QAAQ,SAC7F,SACHpB,CAAA,CAAA,CAAA,CAAA,CAEJ,CAEJ"}
1
+ {"version":3,"file":"tagBlock.component-lQeyNLgK.js","sources":["../../src/components/TagBlock/tagBlock.types.ts","../../src/components/TagBlock/tagBlock.component.tsx"],"sourcesContent":["export enum TagDisabledState {\n Inactive = 'Inactive',\n Deleted = 'Deleted',\n}\n\nexport interface TagBlockTag {\n label: string;\n value: string;\n groupLabel?: string;\n}\n","import React, { useCallback } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { Flex } from '@chakra-ui/react/flex';\nimport { HStack } from '@chakra-ui/react/stack';\nimport { Button } from 'components/Button/button.component';\nimport { Heading } from 'components/Heading/heading.component';\nimport { Menu, MenuProps } from 'components/Menu/menu.component';\nimport { Spinner } from 'components/Spinner/spinner.component';\nimport { Tag } from 'components/Tag/tag.component';\nimport { Text } from 'components/Text/text.component';\nimport { TagBlockTag, TagDisabledState } from './tagBlock.types';\nimport { MenuButtonProps } from 'components/Menu/components/MenuButton/menuButton.components';\n\ninterface BaseTagBlockProps {\n displayTagsInGroups?: boolean;\n errorText?: string;\n hasError?: boolean;\n loading?: boolean;\n menuProps?: MenuProps;\n onClearAll?: () => void;\n onRemoveTag?: (tag: string, selectedTags: TagBlockTag[]) => void;\n tags: TagBlockTag[];\n title?: string;\n}\n\ninterface DefaultTagBlockProps extends BaseTagBlockProps {\n canBeDeleted?: false;\n onDelete?: never;\n}\n\ninterface DeletableTagBlockProps extends BaseTagBlockProps {\n canBeDeleted: true;\n onDelete: () => void;\n}\n\nexport type TagBlockProps = DefaultTagBlockProps | DeletableTagBlockProps;\n\nconst defaultMenuButtonProps: MenuButtonProps = {\n size: 'sm',\n variant: 'secondarySubtle',\n iconName: 'plus',\n text: 'Add',\n hideCaret: true,\n};\n\nexport const TagBlock = ({\n title,\n menuProps,\n tags,\n canBeDeleted = false,\n onClearAll,\n onRemoveTag,\n onDelete,\n hasError = false,\n errorText = 'This field contains an error',\n displayTagsInGroups,\n loading = false,\n}: TagBlockProps): React.JSX.Element => {\n const handleRemoveTag = useCallback(\n (value: string): void => {\n if (onRemoveTag) {\n onRemoveTag(value, tags);\n }\n },\n [onRemoveTag, tags],\n );\n\n const tagsByGroup = React.useMemo(() => {\n if (!displayTagsInGroups) {\n return [];\n }\n const grouped = {} as Record<string, TagBlockTag[]>;\n for (const tag of tags) {\n const group = tag.groupLabel || '-';\n if (!grouped[group]) {\n grouped[group] = [];\n }\n grouped[group].push(tag);\n }\n return Object.entries(grouped).map(([groupLabel, tags]) => ({\n groupLabel,\n tags,\n }));\n }, [tags, displayTagsInGroups]);\n\n const renderTags = useCallback(\n (tags: TagBlockTag[]) => {\n return tags.map((tag) => {\n const isDisabled =\n tag.label.includes(TagDisabledState.Inactive) || tag.label.includes(TagDisabledState.Deleted);\n\n return (\n <Tag\n className=\"TagBlock__Tag\"\n data-testid=\"kibble-tag-block-tag\"\n mr={1}\n mb={1}\n key={tag.value}\n label={tag.label}\n onClose={(): void => handleRemoveTag(tag.value)}\n closeButtonDisplay=\"always\"\n fontWeight=\"normal\"\n color={isDisabled ? 'text.placeholder' : 'text'}\n size=\"md\"\n />\n );\n });\n },\n [handleRemoveTag],\n );\n\n return (\n <Box\n className=\"TagBlock\"\n data-testid=\"kibble-tag-block\"\n position=\"relative\"\n mb={3}\n py={2}\n pl={4}\n pr={2}\n bg=\"background.subtle\"\n borderRadius=\"lg\"\n boxShadow={hasError ? `0 0 0 2px var(--chakra-colors-border-danger)` : ''}\n border=\"1px\"\n borderColor=\"border\"\n overflow={loading ? 'hidden' : undefined}\n >\n <Flex\n className=\"TagBlock__ButtonContainer\"\n data-testid=\"kibble-tag-block-button-container\"\n justifyContent=\"space-between\"\n >\n <HStack gap={1} minH={10}>\n {title && (\n <Text className=\"TagBlock__Title\" mr={2} fontWeight=\"bold\">\n {title}\n </Text>\n )}\n <Menu\n data-testid=\"kibble-tag-block-menu\"\n {...menuProps}\n buttonProps={menuProps?.buttonProps || defaultMenuButtonProps}\n />\n <Button\n className=\"TagBlock__Button--ClearAll\"\n data-testid=\"kibble-tag-block-clear-all-button\"\n size=\"sm\"\n iconName=\"arrowCircle\"\n variant=\"ghostNeutral\"\n onClick={onClearAll}\n disabled={tags.length <= 0}\n >\n Clear All\n </Button>\n </HStack>\n {canBeDeleted && (\n <Box>\n <Button\n className=\"TagBlock__Button--Delete\"\n data-testid=\"kibble-tag-block-delete-button\"\n iconName=\"trashcan\"\n variant=\"ghostNeutral\"\n onClick={onDelete}\n justifySelf=\"flex-end\"\n />\n </Box>\n )}\n </Flex>\n {Boolean(tags.length) && (\n <Flex\n className=\"TagBlock__TagContainer\"\n data-testid=\"kibble-tag-block-tag-container\"\n mt={2}\n pb={1}\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {displayTagsInGroups && tagsByGroup.length ? (\n <Flex direction=\"column\">\n {tagsByGroup.map(({ groupLabel, tags }) => (\n <Box key={groupLabel} mb={2}>\n <Box className=\"TagBlock__GroupTitle\" data-testid=\"kibble-tag-block-group-title\">\n <Heading size=\"xs\" pb={2}>\n {groupLabel}\n </Heading>\n </Box>\n <Flex\n alignContent=\"space-between\"\n flexWrap=\"wrap\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {renderTags(tags)}\n </Flex>\n </Box>\n ))}\n </Flex>\n ) : (\n renderTags(tags)\n )}\n </Flex>\n )}\n {loading && <Spinner fullScreen />}\n {hasError && (\n <Text className=\"TagBlock__Error\" data-testid=\"kibble-tag-block-error\" mt={2} size=\"xs\" variant=\"danger\">\n {errorText}\n </Text>\n )}\n </Box>\n );\n};\n"],"names":["TagDisabledState","defaultMenuButtonProps","TagBlock","title","menuProps","tags","canBeDeleted","onClearAll","onRemoveTag","onDelete","hasError","errorText","displayTagsInGroups","loading","handleRemoveTag","useCallback","value","tagsByGroup","React","grouped","tag","group","groupLabel","renderTags","isDisabled","jsx","Tag","jsxs","Box","Flex","HStack","Text","Menu","Button","Heading","Spinner"],"mappings":"4dAAY,IAAAA,GAAAA,IACVA,EAAA,SAAW,WACXA,EAAA,QAAU,UAFAA,IAAAA,GAAA,CAAA,CAAA,ECqCZ,MAAMC,EAA0C,CAC9C,KAAM,KACN,QAAS,kBACT,SAAU,OACV,KAAM,MACN,UAAW,EACb,EAEaC,EAAW,CAAC,CACvB,MAAAC,EACA,UAAAC,EACA,KAAAC,EACA,aAAAC,EAAe,GACf,WAAAC,EACA,YAAAC,EACA,SAAAC,EACA,SAAAC,EAAW,GACX,UAAAC,EAAY,+BACZ,oBAAAC,EACA,QAAAC,EAAU,EACZ,IAAwC,CACtC,MAAMC,EAAkBC,EAAA,YACrBC,GAAwB,CACnBR,GACFA,EAAYQ,EAAOX,CAAI,CAE3B,EACA,CAACG,EAAaH,CAAI,CACpB,EAEMY,EAAcC,UAAM,QAAQ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AA,IAACU,EAAAA,QAAQ,CAAA,WAAU,EAAC,CAAA,EAC/BzB,GACCe,EAAA,kBAAA,IAACM,EAAK,YAAA,CAAA,UAAU,kBAAkB,cAAY,yBAAyB,GAAI,EAAG,KAAK,KAAK,QAAQ,SAC7F,SACHpB,CAAA,CAAA,CAAA,CAAA,CAEJ,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("./jsx-runtime-BjDatQAs.js"),u=require("react"),y=require("./withFormControl-ClG2Nbcf.js"),P=require("./button.component-CsJxgblU.js"),b=require("./characterCounter.component-DXmly18j.js"),T=require("./box-Baq7UBls.js"),k=require("./empty-B5_AO6Pg.js"),C=require("./factory-D6tdBUPG.js"),w=require("./use-recipe-DaPWl_pL.js"),A=require("./group-Cv7AQw1b.js"),v=require("./create-recipe-context-sESms8Eo.js"),N=require("./use-locale-context-D0LByRu9.js"),S=require("./use-field-context-CArmgHPP.js"),F=require("./index-CHIISuTq.js"),B=e=>e&&e.__esModule?e:{default:e},G=B(u),_=u.forwardRef((e,o)=>{const n=S.useFieldContext(),r=F.mergeProps(n?.getInputProps(),e);return t.jsxRuntimeExports.jsx(N.ark.input,{...r,ref:o})});_.displayName="FieldInput";const{withContext:M}=v.createRecipeContext({key:"input"}),z=M(_),R=u.forwardRef(function({unstyled:o,...n},r){const p=w.useRecipe({key:"inputAddon",recipe:n.recipe}),[i,a]=p.splitVariantProps(n),s=o?k.EMPTY_SLOT_STYLES:p(i);return t.jsxRuntimeExports.jsx(C.chakra.div,{ref:r,...a,css:[s,n.css]})}),I=C.chakra("div",{base:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",zIndex:2,color:"fg.muted",height:"full",fontSize:"sm",px:"3"},variants:{placement:{start:{insetInlineStart:"0"},end:{insetInlineEnd:"0"}}}}),D=u.forwardRef(function(o,n){const{startElement:r,startElementProps:p,endElement:i,endElementProps:a,startAddon:s,startAddonProps:m,endAddon:d,endAddonProps:x,children:l,startOffset:c="0px",endOffset:f="0px",...h}=o,j=u.Children.only(l),E=!!(s||d);return t.jsxRuntimeExports.jsxs(A.Group,{width:"full",ref:n,attached:E,skip:q=>q.type===I,...h,children:[s&&t.jsxRuntimeExports.jsx(R,{...m,children:s}),r&&t.jsxRuntimeExports.jsx(I,{pointerEvents:"none",...p,children:r}),u.cloneElement(j,{...r&&{ps:`calc(var(--input-height) - ${c})`},...i&&{pe:`calc(var(--input-height) - ${f})`},...l.props}),i&&t.jsxRuntimeExports.jsx(I,{placement:"end",...a,children:i}),d&&t.jsxRuntimeExports.jsx(R,{...x,children:d})]})}),L={sm:"xs",md:"sm",lg:"md"},g=G.default.forwardRef(({charLimit:e=void 0,clearable:o=!1,disabled:n=!1,inputRef:r,invalid:p,leftAddon:i,leftElement:a,onClear:s,onContrast:m,rightAddon:d,rightElement:x,size:l="md",value:c,...f},h)=>{const j=()=>{s&&s(c||"")};o&&c&&!n&&(x=t.jsxRuntimeExports.jsx(P.Button,{className:"TextInput__ClearButton","data-testid":"kibble-text-input-clear-button",size:L[l],variant:"ghostNeutral",onClick:j,iconName:"close"}));const E=u.useMemo(()=>c?.toString()?.length||0,[c]);return t.jsxRuntimeExports.jsxs(T.Box,{className:"TextInput__Wrapper",position:"relative",w:"100%",children:[t.jsxRuntimeExports.jsx(D,{className:"TextInput__InputGroup","data-testid":"kibble-text-input-group",startElement:a,startElementProps:{color:"inherit",_groupDisabled:{opacity:.6}},endElement:x,endElementProps:{color:"inherit",paddingInline:1.5,_groupDisabled:{opacity:.6}},startAddon:i,endAddon:d,children:t.jsxRuntimeExports.jsx(z,{"data-testid":"kibble-text-input",className:"TextInput",ref:r||h,value:c,size:l,disabled:n,...p&&{"aria-invalid":!0},variant:m?"onContrast":"default",...f})}),!!e&&t.jsxRuntimeExports.jsx(b.CharacterCounter,{withLimit:!0,limit:e,currentCount:E})]})});g.displayName="TextInput";const O=y.withFormControl(g);exports.WrappedTextInput=O;
2
- //# sourceMappingURL=textInput.component-Dg0NjMGd.js.map
1
+ "use strict";const t=require("./jsx-runtime-BjDatQAs.js"),u=require("react"),y=require("./withFormControl-COwU1OTv.js"),P=require("./button.component-CsJxgblU.js"),b=require("./characterCounter.component-DXmly18j.js"),T=require("./box-Baq7UBls.js"),k=require("./empty-B5_AO6Pg.js"),C=require("./factory-D6tdBUPG.js"),w=require("./use-recipe-DaPWl_pL.js"),A=require("./group-Cv7AQw1b.js"),v=require("./create-recipe-context-sESms8Eo.js"),N=require("./use-locale-context-D0LByRu9.js"),S=require("./use-field-context-CArmgHPP.js"),F=require("./index-CHIISuTq.js"),B=e=>e&&e.__esModule?e:{default:e},G=B(u),_=u.forwardRef((e,o)=>{const n=S.useFieldContext(),r=F.mergeProps(n?.getInputProps(),e);return t.jsxRuntimeExports.jsx(N.ark.input,{...r,ref:o})});_.displayName="FieldInput";const{withContext:M}=v.createRecipeContext({key:"input"}),z=M(_),R=u.forwardRef(function({unstyled:o,...n},r){const p=w.useRecipe({key:"inputAddon",recipe:n.recipe}),[i,a]=p.splitVariantProps(n),s=o?k.EMPTY_SLOT_STYLES:p(i);return t.jsxRuntimeExports.jsx(C.chakra.div,{ref:r,...a,css:[s,n.css]})}),I=C.chakra("div",{base:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",zIndex:2,color:"fg.muted",height:"full",fontSize:"sm",px:"3"},variants:{placement:{start:{insetInlineStart:"0"},end:{insetInlineEnd:"0"}}}}),D=u.forwardRef(function(o,n){const{startElement:r,startElementProps:p,endElement:i,endElementProps:a,startAddon:s,startAddonProps:m,endAddon:d,endAddonProps:x,children:l,startOffset:c="0px",endOffset:f="0px",...h}=o,j=u.Children.only(l),E=!!(s||d);return t.jsxRuntimeExports.jsxs(A.Group,{width:"full",ref:n,attached:E,skip:q=>q.type===I,...h,children:[s&&t.jsxRuntimeExports.jsx(R,{...m,children:s}),r&&t.jsxRuntimeExports.jsx(I,{pointerEvents:"none",...p,children:r}),u.cloneElement(j,{...r&&{ps:`calc(var(--input-height) - ${c})`},...i&&{pe:`calc(var(--input-height) - ${f})`},...l.props}),i&&t.jsxRuntimeExports.jsx(I,{placement:"end",...a,children:i}),d&&t.jsxRuntimeExports.jsx(R,{...x,children:d})]})}),L={sm:"xs",md:"sm",lg:"md"},g=G.default.forwardRef(({charLimit:e=void 0,clearable:o=!1,disabled:n=!1,inputRef:r,invalid:p,leftAddon:i,leftElement:a,onClear:s,onContrast:m,rightAddon:d,rightElement:x,size:l="md",value:c,...f},h)=>{const j=()=>{s&&s(c||"")};o&&c&&!n&&(x=t.jsxRuntimeExports.jsx(P.Button,{className:"TextInput__ClearButton","data-testid":"kibble-text-input-clear-button",size:L[l],variant:"ghostNeutral",onClick:j,iconName:"close"}));const E=u.useMemo(()=>c?.toString()?.length||0,[c]);return t.jsxRuntimeExports.jsxs(T.Box,{className:"TextInput__Wrapper",position:"relative",w:"100%",children:[t.jsxRuntimeExports.jsx(D,{className:"TextInput__InputGroup","data-testid":"kibble-text-input-group",startElement:a,startElementProps:{color:"inherit",_groupDisabled:{opacity:.6}},endElement:x,endElementProps:{color:"inherit",paddingInline:1.5,_groupDisabled:{opacity:.6}},startAddon:i,endAddon:d,children:t.jsxRuntimeExports.jsx(z,{"data-testid":"kibble-text-input",className:"TextInput",ref:r||h,value:c,size:l,disabled:n,...p&&{"aria-invalid":!0},variant:m?"onContrast":"default",...f})}),!!e&&t.jsxRuntimeExports.jsx(b.CharacterCounter,{withLimit:!0,limit:e,currentCount:E})]})});g.displayName="TextInput";const O=y.withFormControl(g);exports.WrappedTextInput=O;
2
+ //# sourceMappingURL=textInput.component-Bw1lEr8q.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"textInput.component-Dg0NjMGd.js","sources":["../../node_modules/@ark-ui/react/dist/components/field/field-input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-addon.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-element.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-group.js","../../src/components/TextInput/textInput.records.ts","../../src/components/TextInput/textInput.component.tsx"],"sourcesContent":["'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from './use-field-context.js';\n\nconst FieldInput = forwardRef((props, ref) => {\n const field = useFieldContext();\n const mergedProps = mergeProps(field?.getInputProps(), props);\n return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });\n});\nFieldInput.displayName = \"FieldInput\";\n\nexport { FieldInput };\n","\"use strict\";\n\"use client\";\nimport { Field } from '@ark-ui/react/field';\nimport { createRecipeContext } from '../../styled-system/create-recipe-context.js';\n\nconst { withContext, PropsProvider } = createRecipeContext({\n key: \"input\"\n});\nconst Input = withContext(Field.Input);\nconst InputPropsProvider = PropsProvider;\n\nexport { Input, InputPropsProvider };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\nimport { EMPTY_SLOT_STYLES } from '../../styled-system/empty.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { useRecipe } from '../../styled-system/use-recipe.js';\n\nconst InputAddon = forwardRef(\n function InputAddon2({ unstyled, ...props }, ref) {\n const recipe = useRecipe({ key: \"inputAddon\", recipe: props.recipe });\n const [variantProps, localProps] = recipe.splitVariantProps(props);\n const styles = unstyled ? EMPTY_SLOT_STYLES : recipe(variantProps);\n return /* @__PURE__ */ jsx(chakra.div, { ref, ...localProps, css: [styles, props.css] });\n }\n);\n\nexport { InputAddon };\n","\"use strict\";\n\"use client\";\nimport { chakra } from '../../styled-system/factory.js';\n\nconst InputElement = chakra(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n position: \"absolute\",\n zIndex: 2,\n color: \"fg.muted\",\n height: \"full\",\n fontSize: \"sm\",\n px: \"3\"\n },\n variants: {\n placement: {\n start: {\n insetInlineStart: \"0\"\n },\n end: {\n insetInlineEnd: \"0\"\n }\n }\n }\n});\n\nexport { InputElement };\n","\"use strict\";\n\"use client\";\nimport { jsxs, jsx } from 'react/jsx-runtime';\nimport { forwardRef, Children, cloneElement } from 'react';\nimport { InputAddon } from './input-addon.js';\nimport { InputElement } from './input-element.js';\nimport { Group } from '../group/group.js';\n\nconst InputGroup = forwardRef(\n function InputGroup2(props, ref) {\n const {\n startElement,\n startElementProps,\n endElement,\n endElementProps,\n startAddon,\n startAddonProps,\n endAddon,\n endAddonProps,\n children,\n startOffset = \"0px\",\n endOffset = \"0px\",\n ...rest\n } = props;\n const child = Children.only(children);\n const attached = Boolean(startAddon || endAddon);\n return /* @__PURE__ */ jsxs(\n Group,\n {\n width: \"full\",\n ref,\n attached,\n skip: (el) => el.type === InputElement,\n ...rest,\n children: [\n startAddon && /* @__PURE__ */ jsx(InputAddon, { ...startAddonProps, children: startAddon }),\n startElement && /* @__PURE__ */ jsx(InputElement, { pointerEvents: \"none\", ...startElementProps, children: startElement }),\n cloneElement(child, {\n ...startElement && {\n ps: `calc(var(--input-height) - ${startOffset})`\n },\n ...endElement && { pe: `calc(var(--input-height) - ${endOffset})` },\n ...children.props\n }),\n endElement && /* @__PURE__ */ jsx(InputElement, { placement: \"end\", ...endElementProps, children: endElement }),\n endAddon && /* @__PURE__ */ jsx(InputAddon, { ...endAddonProps, children: endAddon })\n ]\n }\n );\n }\n);\n\nexport { InputGroup };\n","import { ButtonSize } from 'components/Button/button.types';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport const closeButtonSizeMap: Record<FormControlSize, ButtonSize> = {\n sm: 'xs',\n md: 'sm',\n lg: 'md',\n};\n","import React, { useMemo } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Input as CInput, InputProps as CInputProps, InputGroup } from '@chakra-ui/react/input';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { Button } from 'components/Button/button.component';\nimport { CharacterCounter } from 'components/CharacterCounter/characterCounter.component';\nimport { closeButtonSizeMap } from './textInput.records';\n\nexport interface TextInputBaseProps extends WithFormControlProps {\n charLimit?: number;\n inputRef?: React.Ref<HTMLInputElement | null>;\n leftAddon?: React.ReactNode;\n leftElement?: React.ReactNode;\n onContrast?: boolean;\n rightAddon?: React.ReactNode;\n rightElement?: React.ReactNode;\n size?: FormControlSize;\n}\n\nexport interface DefaultTextInputProps extends TextInputBaseProps {\n clearable?: never;\n onClear?: never;\n}\n\nexport interface ClearableTextInputProps extends TextInputBaseProps {\n clearable?: boolean;\n onClear?: (val: string | number | readonly string[]) => void;\n}\n\nexport type KTextInputProps = DefaultTextInputProps | ClearableTextInputProps;\n\nexport type TextInputProps = KTextInputProps & CInputProps;\n\nconst TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n charLimit = undefined,\n clearable = false,\n disabled = false,\n inputRef,\n invalid,\n leftAddon,\n leftElement,\n onClear,\n onContrast,\n rightAddon,\n rightElement,\n size = 'md',\n value,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const handleClear = (): void => {\n if (onClear) {\n onClear(value || '');\n }\n };\n\n if (clearable && !!value && !disabled) {\n rightElement = (\n <Button\n className=\"TextInput__ClearButton\"\n data-testid=\"kibble-text-input-clear-button\"\n size={closeButtonSizeMap[size as FormControlSize]}\n variant=\"ghostNeutral\"\n onClick={handleClear}\n iconName=\"close\"\n />\n );\n }\n\n const currentCharCount = useMemo(() => value?.toString()?.length || 0, [value]);\n\n return (\n <Box className=\"TextInput__Wrapper\" position=\"relative\" w=\"100%\">\n <InputGroup\n className=\"TextInput__InputGroup\"\n data-testid=\"kibble-text-input-group\"\n startElement={leftElement}\n startElementProps={{\n color: 'inherit',\n _groupDisabled: { opacity: 0.6 },\n }}\n endElement={rightElement}\n endElementProps={{\n color: 'inherit',\n paddingInline: 1.5,\n _groupDisabled: { opacity: 0.6 },\n }}\n startAddon={leftAddon}\n endAddon={rightAddon}\n >\n <CInput\n data-testid=\"kibble-text-input\"\n className=\"TextInput\"\n ref={inputRef || ref}\n value={value}\n size={size}\n disabled={disabled}\n {...(invalid && { 'aria-invalid': true })}\n variant={onContrast ? 'onContrast' : 'default'}\n {...rest}\n />\n </InputGroup>\n {!!charLimit && <CharacterCounter withLimit={true} limit={charLimit} currentCount={currentCharCount} />}\n </Box>\n );\n },\n);\n\nTextInput.displayName = 'TextInput';\nconst WrappedTextInput = withFormControl<TextInputProps>(TextInput);\n\nexport { WrappedTextInput as TextInput };\n"],"names":["FieldInput","forwardRef","props","ref","field","useFieldContext","mergedProps","mergeProps","jsx","ark","withContext","createRecipeContext","Input","Field.Input","InputAddon","unstyled","recipe","useRecipe","variantProps","localProps","styles","EMPTY_SLOT_STYLES","chakra","InputElement","InputGroup","startElement","startElementProps","endElement","endElementProps","startAddon","startAddonProps","endAddon","endAddonProps","children","startOffset","endOffset","rest","child","Children","attached","jsxs","Group","el","cloneElement","closeButtonSizeMap","TextInput","React","charLimit","clearable","disabled","inputRef","invalid","leftAddon","leftElement","onClear","onContrast","rightAddon","rightElement","size","value","handleClear","Button","currentCharCount","useMemo","Box","CInput","CharacterCounter","WrappedTextInput","withFormControl"],"mappings":"2lBAOMA,EAAaC,EAAU,WAAC,CAACC,EAAOC,IAAQ,CAC5C,MAAMC,EAAQC,EAAAA,gBAAiB,EACzBC,EAAcC,EAAU,WAACH,GAAO,cAAa,EAAIF,CAAK,EAC5D,OAAuBM,EAAAA,kBAAAA,IAAIC,EAAAA,IAAI,MAAO,CAAE,GAAGH,EAAa,IAAAH,EAAK,CAC/D,CAAC,EACDH,EAAW,YAAc,aCPzB,KAAM,CAAE,YAAAU,CAA2B,EAAIC,sBAAoB,CACzD,IAAK,OACP,CAAC,EACKC,EAAQF,EAAYG,CAAW,ECA/BC,EAAab,EAAU,WAC3B,SAAqB,CAAE,SAAAc,EAAU,GAAGb,CAAK,EAAIC,EAAK,CAChD,MAAMa,EAASC,EAAS,UAAC,CAAE,IAAK,aAAc,OAAQf,EAAM,O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yD,EAAA,CACC,cAAY,oBACZ,UAAU,YACV,IAAKf,GAAY/C,EACjB,MAAAwD,EACA,KAAAD,EACA,SAAAT,EACC,GAAIE,GAAW,CAAE,eAAgB,EAAK,EACvC,QAASI,EAAa,aAAe,UACpC,GAAGnB,CAAA,CAAA,CACN,CACF,EACC,CAAC,CAACW,GAAcvC,wBAAA0D,EAAAA,iBAAA,CAAiB,UAAW,GAAM,MAAOnB,EAAW,aAAce,CAAkB,CAAA,CAAA,EACvG,CAAA,CAGN,EAEAjB,EAAU,YAAc,YAClB,MAAAsB,EAAmBC,kBAAgCvB,CAAS","x_google_ignoreList":[0,1,2,3,4]}
1
+ {"version":3,"file":"textInput.component-Bw1lEr8q.js","sources":["../../node_modules/@ark-ui/react/dist/components/field/field-input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-addon.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-element.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-group.js","../../src/components/TextInput/textInput.records.ts","../../src/components/TextInput/textInput.component.tsx"],"sourcesContent":["'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from './use-field-context.js';\n\nconst FieldInput = forwardRef((props, ref) => {\n const field = useFieldContext();\n const mergedProps = mergeProps(field?.getInputProps(), props);\n return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });\n});\nFieldInput.displayName = \"FieldInput\";\n\nexport { FieldInput };\n","\"use strict\";\n\"use client\";\nimport { Field } from '@ark-ui/react/field';\nimport { createRecipeContext } from '../../styled-system/create-recipe-context.js';\n\nconst { withContext, PropsProvider } = createRecipeContext({\n key: \"input\"\n});\nconst Input = withContext(Field.Input);\nconst InputPropsProvider = PropsProvider;\n\nexport { Input, InputPropsProvider };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\nimport { EMPTY_SLOT_STYLES } from '../../styled-system/empty.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { useRecipe } from '../../styled-system/use-recipe.js';\n\nconst InputAddon = forwardRef(\n function InputAddon2({ unstyled, ...props }, ref) {\n const recipe = useRecipe({ key: \"inputAddon\", recipe: props.recipe });\n const [variantProps, localProps] = recipe.splitVariantProps(props);\n const styles = unstyled ? EMPTY_SLOT_STYLES : recipe(variantProps);\n return /* @__PURE__ */ jsx(chakra.div, { ref, ...localProps, css: [styles, props.css] });\n }\n);\n\nexport { InputAddon };\n","\"use strict\";\n\"use client\";\nimport { chakra } from '../../styled-system/factory.js';\n\nconst InputElement = chakra(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n position: \"absolute\",\n zIndex: 2,\n color: \"fg.muted\",\n height: \"full\",\n fontSize: \"sm\",\n px: \"3\"\n },\n variants: {\n placement: {\n start: {\n insetInlineStart: \"0\"\n },\n end: {\n insetInlineEnd: \"0\"\n }\n }\n }\n});\n\nexport { InputElement };\n","\"use strict\";\n\"use client\";\nimport { jsxs, jsx } from 'react/jsx-runtime';\nimport { forwardRef, Children, cloneElement } from 'react';\nimport { InputAddon } from './input-addon.js';\nimport { InputElement } from './input-element.js';\nimport { Group } from '../group/group.js';\n\nconst InputGroup = forwardRef(\n function InputGroup2(props, ref) {\n const {\n startElement,\n startElementProps,\n endElement,\n endElementProps,\n startAddon,\n startAddonProps,\n endAddon,\n endAddonProps,\n children,\n startOffset = \"0px\",\n endOffset = \"0px\",\n ...rest\n } = props;\n const child = Children.only(children);\n const attached = Boolean(startAddon || endAddon);\n return /* @__PURE__ */ jsxs(\n Group,\n {\n width: \"full\",\n ref,\n attached,\n skip: (el) => el.type === InputElement,\n ...rest,\n children: [\n startAddon && /* @__PURE__ */ jsx(InputAddon, { ...startAddonProps, children: startAddon }),\n startElement && /* @__PURE__ */ jsx(InputElement, { pointerEvents: \"none\", ...startElementProps, children: startElement }),\n cloneElement(child, {\n ...startElement && {\n ps: `calc(var(--input-height) - ${startOffset})`\n },\n ...endElement && { pe: `calc(var(--input-height) - ${endOffset})` },\n ...children.props\n }),\n endElement && /* @__PURE__ */ jsx(InputElement, { placement: \"end\", ...endElementProps, children: endElement }),\n endAddon && /* @__PURE__ */ jsx(InputAddon, { ...endAddonProps, children: endAddon })\n ]\n }\n );\n }\n);\n\nexport { InputGroup };\n","import { ButtonSize } from 'components/Button/button.types';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport const closeButtonSizeMap: Record<FormControlSize, ButtonSize> = {\n sm: 'xs',\n md: 'sm',\n lg: 'md',\n};\n","import React, { useMemo } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Input as CInput, InputProps as CInputProps, InputGroup } from '@chakra-ui/react/input';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { Button } from 'components/Button/button.component';\nimport { CharacterCounter } from 'components/CharacterCounter/characterCounter.component';\nimport { closeButtonSizeMap } from './textInput.records';\n\nexport interface TextInputBaseProps extends WithFormControlProps {\n charLimit?: number;\n inputRef?: React.Ref<HTMLInputElement | null>;\n leftAddon?: React.ReactNode;\n leftElement?: React.ReactNode;\n onContrast?: boolean;\n rightAddon?: React.ReactNode;\n rightElement?: React.ReactNode;\n size?: FormControlSize;\n}\n\nexport interface DefaultTextInputProps extends TextInputBaseProps {\n clearable?: never;\n onClear?: never;\n}\n\nexport interface ClearableTextInputProps extends TextInputBaseProps {\n clearable?: boolean;\n onClear?: (val: string | number | readonly string[]) => void;\n}\n\nexport type KTextInputProps = DefaultTextInputProps | ClearableTextInputProps;\n\nexport type TextInputProps = KTextInputProps & CInputProps;\n\nconst TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n charLimit = undefined,\n clearable = false,\n disabled = false,\n inputRef,\n invalid,\n leftAddon,\n leftElement,\n onClear,\n onContrast,\n rightAddon,\n rightElement,\n size = 'md',\n value,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const handleClear = (): void => {\n if (onClear) {\n onClear(value || '');\n }\n };\n\n if (clearable && !!value && !disabled) {\n rightElement = (\n <Button\n className=\"TextInput__ClearButton\"\n data-testid=\"kibble-text-input-clear-button\"\n size={closeButtonSizeMap[size as FormControlSize]}\n variant=\"ghostNeutral\"\n onClick={handleClear}\n iconName=\"close\"\n />\n );\n }\n\n const currentCharCount = useMemo(() => value?.toString()?.length || 0, [value]);\n\n return (\n <Box className=\"TextInput__Wrapper\" position=\"relative\" w=\"100%\">\n <InputGroup\n className=\"TextInput__InputGroup\"\n data-testid=\"kibble-text-input-group\"\n startElement={leftElement}\n startElementProps={{\n color: 'inherit',\n _groupDisabled: { opacity: 0.6 },\n }}\n endElement={rightElement}\n endElementProps={{\n color: 'inherit',\n paddingInline: 1.5,\n _groupDisabled: { opacity: 0.6 },\n }}\n startAddon={leftAddon}\n endAddon={rightAddon}\n >\n <CInput\n data-testid=\"kibble-text-input\"\n className=\"TextInput\"\n ref={inputRef || ref}\n value={value}\n size={size}\n disabled={disabled}\n {...(invalid && { 'aria-invalid': true })}\n variant={onContrast ? 'onContrast' : 'default'}\n {...rest}\n />\n </InputGroup>\n {!!charLimit && <CharacterCounter withLimit={true} limit={charLimit} currentCount={currentCharCount} />}\n </Box>\n );\n },\n);\n\nTextInput.displayName = 'TextInput';\nconst WrappedTextInput = withFormControl<TextInputProps>(TextInput);\n\nexport { WrappedTextInput as TextInput };\n"],"names":["FieldInput","forwardRef","props","ref","field","useFieldContext","mergedProps","mergeProps","jsx","ark","withContext","createRecipeContext","Input","Field.Input","InputAddon","unstyled","recipe","useRecipe","variantProps","localProps","styles","EMPTY_SLOT_STYLES","chakra","InputElement","InputGroup","startElement","startElementProps","endElement","endElementProps","startAddon","startAddonProps","endAddon","endAddonProps","children","startOffset","endOffset","rest","child","Children","attached","jsxs","Group","el","cloneElement","closeButtonSizeMap","TextInput","React","charLimit","clearable","disabled","inputRef","invalid","leftAddon","leftElement","onClear","onContrast","rightAddon","rightElement","size","value","handleClear","Button","currentCharCount","useMemo","Box","CInput","CharacterCounter","WrappedTextInput","withFormControl"],"mappings":"2lBAOMA,EAAaC,EAAU,WAAC,CAACC,EAAOC,IAAQ,CAC5C,MAAMC,EAAQC,EAAAA,gBAAiB,EACzBC,EAAcC,EAAU,WAACH,GAAO,cAAa,EAAIF,CAAK,EAC5D,OAAuBM,EAAAA,kBAAAA,IAAIC,EAAAA,IAAI,MAAO,CAAE,GAAGH,EAAa,IAAAH,EAAK,CAC/D,CAAC,EACDH,EAAW,YAAc,aCPzB,KAAM,CAAE,YAAAU,CAA2B,EAAIC,sBAAoB,CACzD,IAAK,OACP,CAAC,EACKC,EAAQF,EAAYG,CAAW,ECA/BC,EAAab,EAAU,WAC3B,SAAqB,CAAE,SAAAc,EAAU,GAAGb,CAAK,EAAIC,EAAK,CAChD,MAAMa,EAASC,EAAS,UAAC,CAAE,IAAK,aAAc,OAAQf,EAAM,OAAQ,EAC9D,CAACgB,EAAcC,CAAU,EAAIH,EAAO,kBAAkBd,CAAK,EAC3DkB,EAASL,EAAWM,oBAAoBL,EAAOE,CAAY,EACjE,OAAuBV,wBAAIc,EAAAA,OAAO,IAAK,CAAE,IAAAnB,EAAK,GAAGgB,EAAY,IAAK,CAACC,EAAQlB,EAAM,GAAG,CAAC,CAAE,CAC3F,CACA,ECXMqB,EAAeD,EAAM,OAAC,MAAO,CACjC,KAAM,CACJ,QAAS,OACT,WAAY,SACZ,eAAgB,SAChB,SAAU,WACV,OAAQ,EACR,MAAO,WACP,OAAQ,OACR,SAAU,KACV,GAAI,GACL,EACD,SAAU,CACR,UAAW,CACT,MAAO,CACL,iBAAkB,GACnB,EACD,IAAK,CACH,eAAgB,GACxB,CACA,CACA,CACA,CAAC,EClBKE,EAAavB,EAAU,WAC3B,SAAqBC,EAAOC,EAAK,CAC/B,KAAM,CACJ,aAAAsB,E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EAAc,IAAY,CAC1BN,GACFA,EAAQK,GAAS,EAAE,CAEvB,EAEIX,GAAeW,GAAS,CAACV,IAEzBQ,EAAAjD,EAAA,kBAAA,IAACqD,EAAA,OAAA,CACC,UAAU,yBACV,cAAY,iCACZ,KAAMjB,EAAmBc,CAAuB,EAChD,QAAQ,eACR,QAASE,EACT,SAAS,OAAA,CACX,GAIE,MAAAE,EAAmBC,UAAQ,IAAMJ,GAAO,YAAY,QAAU,EAAG,CAACA,CAAK,CAAC,EAE9E,gCACGK,MAAI,CAAA,UAAU,qBAAqB,SAAS,WAAW,EAAE,OACxD,SAAA,CAAAxD,EAAA,kBAAA,IAACgB,EAAA,CACC,UAAU,wBACV,cAAY,0BACZ,aAAc6B,EACd,kBAAmB,CACjB,MAAO,UACP,eAAgB,CAAE,QAAS,EAAI,CACjC,EACA,WAAYI,EACZ,gBAAiB,CACf,MAAO,UACP,cAAe,IACf,eAAgB,CAAE,QAAS,EAAI,CACjC,EACA,WAAYL,EACZ,SAAUI,EAEV,SAAAhD,EAAA,kBAAA,IAACyD,EAAA,CACC,cAAY,oBACZ,UAAU,YACV,IAAKf,GAAY/C,EACjB,MAAAwD,EACA,KAAAD,EACA,SAAAT,EACC,GAAIE,GAAW,CAAE,eAAgB,EAAK,EACvC,QAASI,EAAa,aAAe,UACpC,GAAGnB,CAAA,CAAA,CACN,CACF,EACC,CAAC,CAACW,GAAcvC,wBAAA0D,EAAAA,iBAAA,CAAiB,UAAW,GAAM,MAAOnB,EAAW,aAAce,CAAkB,CAAA,CAAA,EACvG,CAAA,CAGN,EAEAjB,EAAU,YAAc,YAClB,MAAAsB,EAAmBC,kBAAgCvB,CAAS","x_google_ignoreList":[0,1,2,3,4]}
@@ -1,6 +1,6 @@
1
1
  import { j as t } from "./jsx-runtime-C5mzlN2N.js";
2
2
  import b, { forwardRef as j, Children as T, cloneElement as k, useMemo as A } from "react";
3
- import { w as v } from "./withFormControl-D0tbS4T0.js";
3
+ import { w as v } from "./withFormControl-CCJImQAG.js";
4
4
  import { B as w } from "./button.component-Br9jCpBx.js";
5
5
  import { C as N } from "./characterCounter.component-vK94fENA.js";
6
6
  import { B } from "./box-Ck9I7FYv.js";
@@ -166,4 +166,4 @@ const rt = v(_);
166
166
  export {
167
167
  rt as W
168
168
  };
169
- //# sourceMappingURL=textInput.component-DBOBy5dT.js.map
169
+ //# sourceMappingURL=textInput.component-C8R6bZLW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"textInput.component-DBOBy5dT.js","sources":["../../node_modules/@ark-ui/react/dist/components/field/field-input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-addon.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-element.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-group.js","../../src/components/TextInput/textInput.records.ts","../../src/components/TextInput/textInput.component.tsx"],"sourcesContent":["'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from './use-field-context.js';\n\nconst FieldInput = forwardRef((props, ref) => {\n const field = useFieldContext();\n const mergedProps = mergeProps(field?.getInputProps(), props);\n return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });\n});\nFieldInput.displayName = \"FieldInput\";\n\nexport { FieldInput };\n","\"use strict\";\n\"use client\";\nimport { Field } from '@ark-ui/react/field';\nimport { createRecipeContext } from '../../styled-system/create-recipe-context.js';\n\nconst { withContext, PropsProvider } = createRecipeContext({\n key: \"input\"\n});\nconst Input = withContext(Field.Input);\nconst InputPropsProvider = PropsProvider;\n\nexport { Input, InputPropsProvider };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\nimport { EMPTY_SLOT_STYLES } from '../../styled-system/empty.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { useRecipe } from '../../styled-system/use-recipe.js';\n\nconst InputAddon = forwardRef(\n function InputAddon2({ unstyled, ...props }, ref) {\n const recipe = useRecipe({ key: \"inputAddon\", recipe: props.recipe });\n const [variantProps, localProps] = recipe.splitVariantProps(props);\n const styles = unstyled ? EMPTY_SLOT_STYLES : recipe(variantProps);\n return /* @__PURE__ */ jsx(chakra.div, { ref, ...localProps, css: [styles, props.css] });\n }\n);\n\nexport { InputAddon };\n","\"use strict\";\n\"use client\";\nimport { chakra } from '../../styled-system/factory.js';\n\nconst InputElement = chakra(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n position: \"absolute\",\n zIndex: 2,\n color: \"fg.muted\",\n height: \"full\",\n fontSize: \"sm\",\n px: \"3\"\n },\n variants: {\n placement: {\n start: {\n insetInlineStart: \"0\"\n },\n end: {\n insetInlineEnd: \"0\"\n }\n }\n }\n});\n\nexport { InputElement };\n","\"use strict\";\n\"use client\";\nimport { jsxs, jsx } from 'react/jsx-runtime';\nimport { forwardRef, Children, cloneElement } from 'react';\nimport { InputAddon } from './input-addon.js';\nimport { InputElement } from './input-element.js';\nimport { Group } from '../group/group.js';\n\nconst InputGroup = forwardRef(\n function InputGroup2(props, ref) {\n const {\n startElement,\n startElementProps,\n endElement,\n endElementProps,\n startAddon,\n startAddonProps,\n endAddon,\n endAddonProps,\n children,\n startOffset = \"0px\",\n endOffset = \"0px\",\n ...rest\n } = props;\n const child = Children.only(children);\n const attached = Boolean(startAddon || endAddon);\n return /* @__PURE__ */ jsxs(\n Group,\n {\n width: \"full\",\n ref,\n attached,\n skip: (el) => el.type === InputElement,\n ...rest,\n children: [\n startAddon && /* @__PURE__ */ jsx(InputAddon, { ...startAddonProps, children: startAddon }),\n startElement && /* @__PURE__ */ jsx(InputElement, { pointerEvents: \"none\", ...startElementProps, children: startElement }),\n cloneElement(child, {\n ...startElement && {\n ps: `calc(var(--input-height) - ${startOffset})`\n },\n ...endElement && { pe: `calc(var(--input-height) - ${endOffset})` },\n ...children.props\n }),\n endElement && /* @__PURE__ */ jsx(InputElement, { placement: \"end\", ...endElementProps, children: endElement }),\n endAddon && /* @__PURE__ */ jsx(InputAddon, { ...endAddonProps, children: endAddon })\n ]\n }\n );\n }\n);\n\nexport { InputGroup };\n","import { ButtonSize } from 'components/Button/button.types';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport const closeButtonSizeMap: Record<FormControlSize, ButtonSize> = {\n sm: 'xs',\n md: 'sm',\n lg: 'md',\n};\n","import React, { useMemo } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Input as CInput, InputProps as CInputProps, InputGroup } from '@chakra-ui/react/input';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { Button } from 'components/Button/button.component';\nimport { CharacterCounter } from 'components/CharacterCounter/characterCounter.component';\nimport { closeButtonSizeMap } from './textInput.records';\n\nexport interface TextInputBaseProps extends WithFormControlProps {\n charLimit?: number;\n inputRef?: React.Ref<HTMLInputElement | null>;\n leftAddon?: React.ReactNode;\n leftElement?: React.ReactNode;\n onContrast?: boolean;\n rightAddon?: React.ReactNode;\n rightElement?: React.ReactNode;\n size?: FormControlSize;\n}\n\nexport interface DefaultTextInputProps extends TextInputBaseProps {\n clearable?: never;\n onClear?: never;\n}\n\nexport interface ClearableTextInputProps extends TextInputBaseProps {\n clearable?: boolean;\n onClear?: (val: string | number | readonly string[]) => void;\n}\n\nexport type KTextInputProps = DefaultTextInputProps | ClearableTextInputProps;\n\nexport type TextInputProps = KTextInputProps & CInputProps;\n\nconst TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n charLimit = undefined,\n clearable = false,\n disabled = false,\n inputRef,\n invalid,\n leftAddon,\n leftElement,\n onClear,\n onContrast,\n rightAddon,\n rightElement,\n size = 'md',\n value,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const handleClear = (): void => {\n if (onClear) {\n onClear(value || '');\n }\n };\n\n if (clearable && !!value && !disabled) {\n rightElement = (\n <Button\n className=\"TextInput__ClearButton\"\n data-testid=\"kibble-text-input-clear-button\"\n size={closeButtonSizeMap[size as FormControlSize]}\n variant=\"ghostNeutral\"\n onClick={handleClear}\n iconName=\"close\"\n />\n );\n }\n\n const currentCharCount = useMemo(() => value?.toString()?.length || 0, [value]);\n\n return (\n <Box className=\"TextInput__Wrapper\" position=\"relative\" w=\"100%\">\n <InputGroup\n className=\"TextInput__InputGroup\"\n data-testid=\"kibble-text-input-group\"\n startElement={leftElement}\n startElementProps={{\n color: 'inherit',\n _groupDisabled: { opacity: 0.6 },\n }}\n endElement={rightElement}\n endElementProps={{\n color: 'inherit',\n paddingInline: 1.5,\n _groupDisabled: { opacity: 0.6 },\n }}\n startAddon={leftAddon}\n endAddon={rightAddon}\n >\n <CInput\n data-testid=\"kibble-text-input\"\n className=\"TextInput\"\n ref={inputRef || ref}\n value={value}\n size={size}\n disabled={disabled}\n {...(invalid && { 'aria-invalid': true })}\n variant={onContrast ? 'onContrast' : 'default'}\n {...rest}\n />\n </InputGroup>\n {!!charLimit && <CharacterCounter withLimit={true} limit={charLimit} currentCount={currentCharCount} />}\n </Box>\n );\n },\n);\n\nTextInput.displayName = 'TextInput';\nconst WrappedTextInput = withFormControl<TextInputProps>(TextInput);\n\nexport { WrappedTextInput as TextInput };\n"],"names":["FieldInput","forwardRef","props","ref","field","useFieldContext","mergedProps","mergeProps","jsx","ark","withContext","createRecipeContext","Input","Field.Input","InputAddon","unstyled","recipe","useRecipe","variantProps","localProps","styles","EMPTY_SLOT_STYLES","chakra","InputElement","InputGroup","startElement","startElementProps","endElement","endElementProps","startAddon","startAddonProps","endAddon","endAddonProps","children","startOffset","endOffset","rest","child","Children","attached","jsxs","Group","el","cloneElement","closeButtonSizeMap","TextInput","React","charLimit","clearable","disabled","inputRef","invalid","leftAddon","leftElement","onClear","onContrast","rightAddon","rightElement","size","value","handleClear","Button","currentCharCount","useMemo","Box","CInput","CharacterCounter","WrappedText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jB,OAAAwD;AAAA,cACA,MAAAD;AAAA,cACA,UAAAT;AAAA,cACC,GAAIE,KAAW,EAAE,gBAAgB,GAAK;AAAA,cACvC,SAASI,IAAa,eAAe;AAAA,cACpC,GAAGnB;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MACF;AAAA,MACC,CAAC,CAACW,KAAcvC,gBAAAA,MAAA0D,GAAA,EAAiB,WAAW,IAAM,OAAOnB,GAAW,cAAce,EAAkB,CAAA;AAAA,IAAA,GACvG;AAAA,EAAA;AAGN;AAEAjB,EAAU,cAAc;AAClB,MAAAsB,KAAmBC,EAAgCvB,CAAS;","x_google_ignoreList":[0,1,2,3,4]}
1
+ {"version":3,"file":"textInput.component-C8R6bZLW.js","sources":["../../node_modules/@ark-ui/react/dist/components/field/field-input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-addon.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-element.js","../../node_modules/@chakra-ui/react/dist/esm/components/input/input-group.js","../../src/components/TextInput/textInput.records.ts","../../src/components/TextInput/textInput.component.tsx"],"sourcesContent":["'use client';\nimport { jsx } from 'react/jsx-runtime';\nimport { mergeProps } from '@zag-js/react';\nimport { forwardRef } from 'react';\nimport { ark } from '../factory.js';\nimport { useFieldContext } from './use-field-context.js';\n\nconst FieldInput = forwardRef((props, ref) => {\n const field = useFieldContext();\n const mergedProps = mergeProps(field?.getInputProps(), props);\n return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });\n});\nFieldInput.displayName = \"FieldInput\";\n\nexport { FieldInput };\n","\"use strict\";\n\"use client\";\nimport { Field } from '@ark-ui/react/field';\nimport { createRecipeContext } from '../../styled-system/create-recipe-context.js';\n\nconst { withContext, PropsProvider } = createRecipeContext({\n key: \"input\"\n});\nconst Input = withContext(Field.Input);\nconst InputPropsProvider = PropsProvider;\n\nexport { Input, InputPropsProvider };\n","\"use strict\";\n\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\nimport { EMPTY_SLOT_STYLES } from '../../styled-system/empty.js';\nimport { chakra } from '../../styled-system/factory.js';\nimport { useRecipe } from '../../styled-system/use-recipe.js';\n\nconst InputAddon = forwardRef(\n function InputAddon2({ unstyled, ...props }, ref) {\n const recipe = useRecipe({ key: \"inputAddon\", recipe: props.recipe });\n const [variantProps, localProps] = recipe.splitVariantProps(props);\n const styles = unstyled ? EMPTY_SLOT_STYLES : recipe(variantProps);\n return /* @__PURE__ */ jsx(chakra.div, { ref, ...localProps, css: [styles, props.css] });\n }\n);\n\nexport { InputAddon };\n","\"use strict\";\n\"use client\";\nimport { chakra } from '../../styled-system/factory.js';\n\nconst InputElement = chakra(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n position: \"absolute\",\n zIndex: 2,\n color: \"fg.muted\",\n height: \"full\",\n fontSize: \"sm\",\n px: \"3\"\n },\n variants: {\n placement: {\n start: {\n insetInlineStart: \"0\"\n },\n end: {\n insetInlineEnd: \"0\"\n }\n }\n }\n});\n\nexport { InputElement };\n","\"use strict\";\n\"use client\";\nimport { jsxs, jsx } from 'react/jsx-runtime';\nimport { forwardRef, Children, cloneElement } from 'react';\nimport { InputAddon } from './input-addon.js';\nimport { InputElement } from './input-element.js';\nimport { Group } from '../group/group.js';\n\nconst InputGroup = forwardRef(\n function InputGroup2(props, ref) {\n const {\n startElement,\n startElementProps,\n endElement,\n endElementProps,\n startAddon,\n startAddonProps,\n endAddon,\n endAddonProps,\n children,\n startOffset = \"0px\",\n endOffset = \"0px\",\n ...rest\n } = props;\n const child = Children.only(children);\n const attached = Boolean(startAddon || endAddon);\n return /* @__PURE__ */ jsxs(\n Group,\n {\n width: \"full\",\n ref,\n attached,\n skip: (el) => el.type === InputElement,\n ...rest,\n children: [\n startAddon && /* @__PURE__ */ jsx(InputAddon, { ...startAddonProps, children: startAddon }),\n startElement && /* @__PURE__ */ jsx(InputElement, { pointerEvents: \"none\", ...startElementProps, children: startElement }),\n cloneElement(child, {\n ...startElement && {\n ps: `calc(var(--input-height) - ${startOffset})`\n },\n ...endElement && { pe: `calc(var(--input-height) - ${endOffset})` },\n ...children.props\n }),\n endElement && /* @__PURE__ */ jsx(InputElement, { placement: \"end\", ...endElementProps, children: endElement }),\n endAddon && /* @__PURE__ */ jsx(InputAddon, { ...endAddonProps, children: endAddon })\n ]\n }\n );\n }\n);\n\nexport { InputGroup };\n","import { ButtonSize } from 'components/Button/button.types';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\n\nexport const closeButtonSizeMap: Record<FormControlSize, ButtonSize> = {\n sm: 'xs',\n md: 'sm',\n lg: 'md',\n};\n","import React, { useMemo } from 'react';\nimport { Box } from '@chakra-ui/react/box';\nimport { withFormControl, WithFormControlProps } from 'hocs/withFormControl/withFormControl';\nimport { Input as CInput, InputProps as CInputProps, InputGroup } from '@chakra-ui/react/input';\nimport { FormControlSize } from 'hocs/withFormControl/withFormControl.types';\nimport { Button } from 'components/Button/button.component';\nimport { CharacterCounter } from 'components/CharacterCounter/characterCounter.component';\nimport { closeButtonSizeMap } from './textInput.records';\n\nexport interface TextInputBaseProps extends WithFormControlProps {\n charLimit?: number;\n inputRef?: React.Ref<HTMLInputElement | null>;\n leftAddon?: React.ReactNode;\n leftElement?: React.ReactNode;\n onContrast?: boolean;\n rightAddon?: React.ReactNode;\n rightElement?: React.ReactNode;\n size?: FormControlSize;\n}\n\nexport interface DefaultTextInputProps extends TextInputBaseProps {\n clearable?: never;\n onClear?: never;\n}\n\nexport interface ClearableTextInputProps extends TextInputBaseProps {\n clearable?: boolean;\n onClear?: (val: string | number | readonly string[]) => void;\n}\n\nexport type KTextInputProps = DefaultTextInputProps | ClearableTextInputProps;\n\nexport type TextInputProps = KTextInputProps & CInputProps;\n\nconst TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n charLimit = undefined,\n clearable = false,\n disabled = false,\n inputRef,\n invalid,\n leftAddon,\n leftElement,\n onClear,\n onContrast,\n rightAddon,\n rightElement,\n size = 'md',\n value,\n ...rest\n },\n ref,\n ): React.JSX.Element => {\n const handleClear = (): void => {\n if (onClear) {\n onClear(value || '');\n }\n };\n\n if (clearable && !!value && !disabled) {\n rightElement = (\n <Button\n className=\"TextInput__ClearButton\"\n data-testid=\"kibble-text-input-clear-button\"\n size={closeButtonSizeMap[size as FormControlSize]}\n variant=\"ghostNeutral\"\n onClick={handleClear}\n iconName=\"close\"\n />\n );\n }\n\n const currentCharCount = useMemo(() => value?.toString()?.length || 0, [value]);\n\n return (\n <Box className=\"TextInput__Wrapper\" position=\"relative\" w=\"100%\">\n <InputGroup\n className=\"TextInput__InputGroup\"\n data-testid=\"kibble-text-input-group\"\n startElement={leftElement}\n startElementProps={{\n color: 'inherit',\n _groupDisabled: { opacity: 0.6 },\n }}\n endElement={rightElement}\n endElementProps={{\n color: 'inherit',\n paddingInline: 1.5,\n _groupDisabled: { opacity: 0.6 },\n }}\n startAddon={leftAddon}\n endAddon={rightAddon}\n >\n <CInput\n data-testid=\"kibble-text-input\"\n className=\"TextInput\"\n ref={inputRef || ref}\n value={value}\n size={size}\n disabled={disabled}\n {...(invalid && { 'aria-invalid': true })}\n variant={onContrast ? 'onContrast' : 'default'}\n {...rest}\n />\n </InputGroup>\n {!!charLimit && <CharacterCounter withLimit={true} limit={charLimit} currentCount={currentCharCount} />}\n </Box>\n );\n },\n);\n\nTextInput.displayName = 'TextInput';\nconst WrappedTextInput = withFormControl<TextInputProps>(TextInput);\n\nexport { WrappedTextInput as TextInput };\n"],"names":["FieldInput","forwardRef","props","ref","field","useFieldContext","mergedProps","mergeProps","jsx","ark","withContext","createRecipeContext","Input","Field.Input","InputAddon","unstyled","recipe","useRecipe","variantProps","localProps","styles","EMPTY_SLOT_STYLES","chakra","InputElement","InputGroup","startElement","startElementProps","endElement","endElementProps","startAddon","startAddonProps","endAddon","endAddonProps","children","startOffset","endOffset","rest","child","Children","attached","jsxs","Group","el","cloneElement","closeButtonSizeMap","TextInput","React","charLimit","clearable","disabled","inputRef","invalid","leftAddon","leftElement","onClear","onContrast","rightAddon","rightElement","size","value","handleClear","Button","currentCharCount","useMemo","Box","CInput","CharacterCounter","WrappedTextInput","withFormControl"],"mappings":";;;;;;;;;;;;;;AAOA,MAAMA,IAAaC,EAAW,CAACC,GAAOC,MAAQ;AAC5C,QAAMC,IAAQC,EAAiB,GACzBC,IAAcC,EAAWH,GAAO,cAAa,GAAIF,CAAK;AAC5D,SAAuBM,gBAAAA,EAAAA,IAAIC,EAAI,OAAO,EAAE,GAAGH,GAAa,KAAAH,GAAK;AAC/D,CAAC;AACDH,EAAW,cAAc;ACPzB,MAAM,EAAE,aAAAU,EAA2B,IAAIC,EAAoB;AAAA,EACzD,KAAK;AACP,CAAC,GACKC,IAAQF,EAAYG,CAAW,GCA/BC,IAAab;AAAA,EACjB,SAAqB,EAAE,UAAAc,GAAU,GAAGb,EAAK,GAAIC,GAAK;AAChD,UAAMa,IAASC,EAAU,EAAE,KAAK,cAAc,QAAQf,EAAM,QAAQ,GAC9D,CAACgB,GAAcC,CAAU,IAAIH,EAAO,kBAAkBd,CAAK,GAC3DkB,IAASL,IAAWM,IAAoBL,EAAOE,CAAY;AACjE,WAAuBV,gBAAAA,MAAIc,EAAO,KAAK,EAAE,KAAAnB,GAAK,GAAGgB,GAAY,KAAK,CAACC,GAAQlB,EAAM,GAAG,EAAC,CAAE;AAAA,EAC3F;AACA,GCXMqB,IAAeD,EAAO,OAAO;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,IAAI;AAAA,EACL;AAAA,EACD,UAAU;AAAA,IACR,WAAW;AAAA,MACT,OAAO;AAAA,QACL,kBAAkB;AAAA,MACnB;AAAA,MACD,KAAK;AAAA,QACH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AA,UACZ,UAAUI;AAAA,UAEV,UAAAhD,gBAAAA,EAAA;AAAA,YAACyD;AAAAA,YAAA;AAAA,cACC,eAAY;AAAA,cACZ,WAAU;AAAA,cACV,KAAKf,KAAY/C;AAAA,cACjB,OAAAwD;AAAA,cACA,MAAAD;AAAA,cACA,UAAAT;AAAA,cACC,GAAIE,KAAW,EAAE,gBAAgB,GAAK;AAAA,cACvC,SAASI,IAAa,eAAe;AAAA,cACpC,GAAGnB;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MACF;AAAA,MACC,CAAC,CAACW,KAAcvC,gBAAAA,MAAA0D,GAAA,EAAiB,WAAW,IAAM,OAAOnB,GAAW,cAAce,EAAkB,CAAA;AAAA,IAAA,GACvG;AAAA,EAAA;AAGN;AAEAjB,EAAU,cAAc;AAClB,MAAAsB,KAAmBC,EAAgCvB,CAAS;","x_google_ignoreList":[0,1,2,3,4]}
@@ -1,2 +1,2 @@
1
- "use strict";const p=require("./jsx-runtime-BjDatQAs.js"),c=require("react"),h=require("./withFormControl-ClG2Nbcf.js"),v=require("./characterCounter.component-DXmly18j.js"),g=require("./flex-D14H6HbP.js"),w=require("./create-recipe-context-sESms8Eo.js"),x=require("./index-CHIISuTq.js"),l=require("./use-locale-context-D0LByRu9.js"),b=require("./use-field-context-CArmgHPP.js"),C=e=>e&&e.__esModule?e:{default:e},F=C(c);var y=e=>{if(!e)return;const t=x.getComputedStyle(e),o=x.getWindow(e),a=x.getDocument(e),r=()=>{requestAnimationFrame(()=>{e.style.height="auto";let s;t.boxSizing==="content-box"?s=e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):s=e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),t.maxHeight!=="none"&&s>parseFloat(t.maxHeight)?(t.overflowY==="hidden"&&(e.style.overflowY="scroll"),s=parseFloat(t.maxHeight)):t.overflowY!=="hidden"&&(e.style.overflowY="hidden"),e.style.height=`${s}px`})};e.addEventListener("input",r),e.form?.addEventListener("reset",r);const n=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(n,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),r()}});const u=new o.ResizeObserver(()=>{requestAnimationFrame(()=>r())});u.observe(e);const d=new o.MutationObserver(()=>r());return d.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),a.fonts?.addEventListener("loadingdone",r),()=>{e.removeEventListener("input",r),e.form?.removeEventListener("reset",r),a.fonts?.removeEventListener("loadingdone",r),u.disconnect(),d.disconnect()}};const m=c.forwardRef((e,t)=>{const{autoresize:o,...a}=e,r=c.useRef(null),n=b.useFieldContext(),i=x.mergeProps(n?.getTextareaProps(),{style:{resize:o?"none":void 0}},a);return c.useEffect(()=>{if(o)return y(r.current)},[o]),p.jsxRuntimeExports.jsx(l.ark.textarea,{...i,ref:l.composeRefs(t,r)})});m.displayName="FieldTextarea";const{withContext:R}=w.createRecipeContext({key:"textarea"}),T=R(m),f=F.default.forwardRef(({charLimit:e=void 0,invalid:t,onContrast:o,resize:a="none",textareaRef:r,value:n,...i},u)=>{const d=o?"onContrast":"default",s=c.useMemo(()=>n?.toString()?.length||0,[n]);return p.jsxRuntimeExports.jsxs(g.Flex,{className:"Textarea__Wrapper",position:"relative",w:"100%",children:[p.jsxRuntimeExports.jsx(T,{className:"Textarea","data-testid":"kibble-textarea",ref:r||u,resize:a,variant:d,value:n,...t&&{"aria-invalid":!0},minH:"140px",...i}),!!e&&p.jsxRuntimeExports.jsx(v.CharacterCounter,{withLimit:!0,limit:e,currentCount:s})]})});f.displayName="Textarea";const j=h.withFormControl(f);exports.WrappedTextarea=j;
2
- //# sourceMappingURL=textarea.component-DQAMtD62.js.map
1
+ "use strict";const p=require("./jsx-runtime-BjDatQAs.js"),c=require("react"),h=require("./withFormControl-COwU1OTv.js"),v=require("./characterCounter.component-DXmly18j.js"),g=require("./flex-D14H6HbP.js"),w=require("./create-recipe-context-sESms8Eo.js"),x=require("./index-CHIISuTq.js"),l=require("./use-locale-context-D0LByRu9.js"),b=require("./use-field-context-CArmgHPP.js"),C=e=>e&&e.__esModule?e:{default:e},F=C(c);var y=e=>{if(!e)return;const t=x.getComputedStyle(e),o=x.getWindow(e),a=x.getDocument(e),r=()=>{requestAnimationFrame(()=>{e.style.height="auto";let s;t.boxSizing==="content-box"?s=e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):s=e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),t.maxHeight!=="none"&&s>parseFloat(t.maxHeight)?(t.overflowY==="hidden"&&(e.style.overflowY="scroll"),s=parseFloat(t.maxHeight)):t.overflowY!=="hidden"&&(e.style.overflowY="hidden"),e.style.height=`${s}px`})};e.addEventListener("input",r),e.form?.addEventListener("reset",r);const n=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(n,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),r()}});const u=new o.ResizeObserver(()=>{requestAnimationFrame(()=>r())});u.observe(e);const d=new o.MutationObserver(()=>r());return d.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),a.fonts?.addEventListener("loadingdone",r),()=>{e.removeEventListener("input",r),e.form?.removeEventListener("reset",r),a.fonts?.removeEventListener("loadingdone",r),u.disconnect(),d.disconnect()}};const m=c.forwardRef((e,t)=>{const{autoresize:o,...a}=e,r=c.useRef(null),n=b.useFieldContext(),i=x.mergeProps(n?.getTextareaProps(),{style:{resize:o?"none":void 0}},a);return c.useEffect(()=>{if(o)return y(r.current)},[o]),p.jsxRuntimeExports.jsx(l.ark.textarea,{...i,ref:l.composeRefs(t,r)})});m.displayName="FieldTextarea";const{withContext:R}=w.createRecipeContext({key:"textarea"}),T=R(m),f=F.default.forwardRef(({charLimit:e=void 0,invalid:t,onContrast:o,resize:a="none",textareaRef:r,value:n,...i},u)=>{const d=o?"onContrast":"default",s=c.useMemo(()=>n?.toString()?.length||0,[n]);return p.jsxRuntimeExports.jsxs(g.Flex,{className:"Textarea__Wrapper",position:"relative",w:"100%",children:[p.jsxRuntimeExports.jsx(T,{className:"Textarea","data-testid":"kibble-textarea",ref:r||u,resize:a,variant:d,value:n,...t&&{"aria-invalid":!0},minH:"140px",...i}),!!e&&p.jsxRuntimeExports.jsx(v.CharacterCounter,{withLimit:!0,limit:e,currentCount:s})]})});f.displayName="Textarea";const j=h.withFormControl(f);exports.WrappedTextarea=j;
2
+ //# sourceMappingURL=textarea.component-DDYGwqlz.js.map