@televet/kibble-ui 4.0.0-beta.90 → 4.0.0-beta.91
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.
- package/dist/chunks/{alert.types-DTNR8_C-.js → alert.types-DNeGpiVS.js} +2 -2
- package/dist/chunks/{alert.types-DTNR8_C-.js.map → alert.types-DNeGpiVS.js.map} +1 -1
- package/dist/chunks/{alert.types-BWFvYNC_.js → alert.types-DeHWvQla.js} +3 -3
- package/dist/chunks/{alert.types-BWFvYNC_.js.map → alert.types-DeHWvQla.js.map} +1 -1
- package/dist/chunks/{avatar.component-DnLr68fv.js → avatar.component-CV_95YCj.js} +2 -2
- package/dist/chunks/{avatar.component-DnLr68fv.js.map → avatar.component-CV_95YCj.js.map} +1 -1
- package/dist/chunks/{avatar.component-qXhLVNzG.js → avatar.component-SZi87lRl.js} +2 -2
- package/dist/chunks/{avatar.component-qXhLVNzG.js.map → avatar.component-SZi87lRl.js.map} +1 -1
- package/dist/chunks/{avatarGroup.component-bImv23vg.js → avatarGroup.component-Bp-_csZz.js} +2 -2
- package/dist/chunks/{avatarGroup.component-bImv23vg.js.map → avatarGroup.component-Bp-_csZz.js.map} +1 -1
- package/dist/chunks/{avatarGroup.component-CoPnZwjS.js → avatarGroup.component-CPTXS5Mp.js} +2 -2
- package/dist/chunks/{avatarGroup.component-CoPnZwjS.js.map → avatarGroup.component-CPTXS5Mp.js.map} +1 -1
- package/dist/chunks/{button.component-Dd9AfGox.js → button.component-CY55RWpS.js} +2 -2
- package/dist/chunks/{button.component-Dd9AfGox.js.map → button.component-CY55RWpS.js.map} +1 -1
- package/dist/chunks/{button.component-D7a32Wjq.js → button.component-DOAhnxbj.js} +2 -2
- package/dist/chunks/{button.component-D7a32Wjq.js.map → button.component-DOAhnxbj.js.map} +1 -1
- package/dist/chunks/{buttonGroup.component-8AcSzS3v.js → buttonGroup.component-BJl5t4CV.js} +3 -3
- package/dist/chunks/{buttonGroup.component-8AcSzS3v.js.map → buttonGroup.component-BJl5t4CV.js.map} +1 -1
- package/dist/chunks/{buttonGroup.component-0iZj3N28.js → buttonGroup.component-CHZoLKsR.js} +2 -2
- package/dist/chunks/{buttonGroup.component-0iZj3N28.js.map → buttonGroup.component-CHZoLKsR.js.map} +1 -1
- package/dist/chunks/{checkbox.component-CPHPkv89.js → checkbox.component-BpSGOInE.js} +2 -2
- package/dist/chunks/{checkbox.component-CPHPkv89.js.map → checkbox.component-BpSGOInE.js.map} +1 -1
- package/dist/chunks/{checkbox.component-BoaV-gQi.js → checkbox.component-CY7ZklEW.js} +2 -2
- package/dist/chunks/{checkbox.component-BoaV-gQi.js.map → checkbox.component-CY7ZklEW.js.map} +1 -1
- package/dist/chunks/{checkboxGroup.component-I5SdMRRF.js → checkboxGroup.component-B154cVx5.js} +3 -3
- package/dist/chunks/{checkboxGroup.component-I5SdMRRF.js.map → checkboxGroup.component-B154cVx5.js.map} +1 -1
- package/dist/chunks/{checkboxGroup.component-X2cU2KU-.js → checkboxGroup.component-DsXi7j46.js} +2 -2
- package/dist/chunks/{checkboxGroup.component-X2cU2KU-.js.map → checkboxGroup.component-DsXi7j46.js.map} +1 -1
- package/dist/chunks/{conversationCard.component-CkmCkM8o.js → conversationCard.component-CSJXjO4D.js} +2 -2
- package/dist/chunks/{conversationCard.component-CkmCkM8o.js.map → conversationCard.component-CSJXjO4D.js.map} +1 -1
- package/dist/chunks/{conversationCard.component-BcSmuiso.js → conversationCard.component-DCpGDLwc.js} +5 -5
- package/dist/chunks/{conversationCard.component-BcSmuiso.js.map → conversationCard.component-DCpGDLwc.js.map} +1 -1
- package/dist/chunks/{datePicker.component-CcL4Xf01.js → datePicker.component-DSEMVYWG.js} +5 -5
- package/dist/chunks/{datePicker.component-CcL4Xf01.js.map → datePicker.component-DSEMVYWG.js.map} +1 -1
- package/dist/chunks/{datePicker.component-3jmR0bo1.js → datePicker.component-DmxLdt_M.js} +2 -2
- package/dist/chunks/{datePicker.component-3jmR0bo1.js.map → datePicker.component-DmxLdt_M.js.map} +1 -1
- package/dist/chunks/{icon.component-CFqpWzmV.js → icon.component-DszmCnE4.js} +6 -6
- package/dist/chunks/icon.component-DszmCnE4.js.map +1 -0
- package/dist/chunks/icon.component-aJ690VpJ.js +2 -0
- package/dist/chunks/icon.component-aJ690VpJ.js.map +1 -0
- package/dist/chunks/{link.component-BlCMfkSE.js → link.component-BeuHEk8s.js} +2 -2
- package/dist/chunks/{link.component-BlCMfkSE.js.map → link.component-BeuHEk8s.js.map} +1 -1
- package/dist/chunks/{link.component-DxZHLE-2.js → link.component-COw7fL8Z.js} +2 -2
- package/dist/chunks/{link.component-DxZHLE-2.js.map → link.component-COw7fL8Z.js.map} +1 -1
- package/dist/chunks/{menu.component-q1jaihnb.js → menu.component-D38vU6MX.js} +5 -5
- package/dist/chunks/{menu.component-q1jaihnb.js.map → menu.component-D38vU6MX.js.map} +1 -1
- package/dist/chunks/{menu.component-C5NwkXGO.js → menu.component-DVKNEINC.js} +2 -2
- package/dist/chunks/{menu.component-C5NwkXGO.js.map → menu.component-DVKNEINC.js.map} +1 -1
- package/dist/chunks/{modal.types-DDwG7coD.js → modal.types-Bbh7jkHL.js} +2 -2
- package/dist/chunks/{modal.types-DDwG7coD.js.map → modal.types-Bbh7jkHL.js.map} +1 -1
- package/dist/chunks/{modal.types-CrbC8fs6.js → modal.types-mGxpGfVt.js} +2 -2
- package/dist/chunks/{modal.types-CrbC8fs6.js.map → modal.types-mGxpGfVt.js.map} +1 -1
- package/dist/chunks/{pinInput.types-DbKKHEtF.js → pinInput.types-BlHIF-kD.js} +2 -2
- package/dist/chunks/{pinInput.types-DbKKHEtF.js.map → pinInput.types-BlHIF-kD.js.map} +1 -1
- package/dist/chunks/{pinInput.types-Bm4AWHUF.js → pinInput.types-CD_tKvQm.js} +2 -2
- package/dist/chunks/{pinInput.types-Bm4AWHUF.js.map → pinInput.types-CD_tKvQm.js.map} +1 -1
- package/dist/chunks/{popover.component--S78uxTR.js → popover.component-CDvn34mM.js} +2 -2
- package/dist/chunks/{popover.component--S78uxTR.js.map → popover.component-CDvn34mM.js.map} +1 -1
- package/dist/chunks/{popover.component-DqpXC5XS.js → popover.component-DBDBFljk.js} +2 -2
- package/dist/chunks/{popover.component-DqpXC5XS.js.map → popover.component-DBDBFljk.js.map} +1 -1
- package/dist/chunks/{radioGroup.component-DhvD2nUs.js → radioGroup.component-DJsYK4YT.js} +3 -3
- package/dist/chunks/{radioGroup.component-DhvD2nUs.js.map → radioGroup.component-DJsYK4YT.js.map} +1 -1
- package/dist/chunks/{radioGroup.component-e6LsfYzG.js → radioGroup.component-SvJktaFu.js} +2 -2
- package/dist/chunks/{radioGroup.component-e6LsfYzG.js.map → radioGroup.component-SvJktaFu.js.map} +1 -1
- package/dist/chunks/{ratingDots.component-6HLw7Zp-.js → ratingDots.component-BdUvoShh.js} +2 -2
- package/dist/chunks/{ratingDots.component-6HLw7Zp-.js.map → ratingDots.component-BdUvoShh.js.map} +1 -1
- package/dist/chunks/{ratingDots.component-B_a_qO9L.js → ratingDots.component-CRiV8Gx3.js} +2 -2
- package/dist/chunks/{ratingDots.component-B_a_qO9L.js.map → ratingDots.component-CRiV8Gx3.js.map} +1 -1
- package/dist/chunks/{select.component-DzaUsqzM.js → select.component-BNMyz5Nm.js} +5 -5
- package/dist/chunks/{select.component-DzaUsqzM.js.map → select.component-BNMyz5Nm.js.map} +1 -1
- package/dist/chunks/{select.component-CPMIVkRk.js → select.component-a6mH3buQ.js} +2 -2
- package/dist/chunks/{select.component-CPMIVkRk.js.map → select.component-a6mH3buQ.js.map} +1 -1
- package/dist/chunks/{sortableList.component-Cjeqvf95.js → sortableList.component-BKthQS8R.js} +2 -2
- package/dist/chunks/{sortableList.component-Cjeqvf95.js.map → sortableList.component-BKthQS8R.js.map} +1 -1
- package/dist/chunks/{sortableList.component-DEMqxtiq.js → sortableList.component-DceIFi13.js} +2 -2
- package/dist/chunks/{sortableList.component-DEMqxtiq.js.map → sortableList.component-DceIFi13.js.map} +1 -1
- package/dist/chunks/{styledAvatar.types-zeF6AQ1t.js → styledAvatar.types-BNejv6F7.js} +2 -2
- package/dist/chunks/{styledAvatar.types-zeF6AQ1t.js.map → styledAvatar.types-BNejv6F7.js.map} +1 -1
- package/dist/chunks/{styledAvatar.types-cFMdDiqa.js → styledAvatar.types-DXwe2DPH.js} +2 -2
- package/dist/chunks/{styledAvatar.types-cFMdDiqa.js.map → styledAvatar.types-DXwe2DPH.js.map} +1 -1
- package/dist/chunks/{switch.component-C4tJUYg9.js → switch.component-DC6-XTlo.js} +2 -2
- package/dist/chunks/{switch.component-C4tJUYg9.js.map → switch.component-DC6-XTlo.js.map} +1 -1
- package/dist/chunks/{switch.component-1NMBytrm.js → switch.component-DVHjLc9H.js} +2 -2
- package/dist/chunks/{switch.component-1NMBytrm.js.map → switch.component-DVHjLc9H.js.map} +1 -1
- package/dist/chunks/{tabs.component-caMRtfBi.js → tabs.component-DKW-zlGD.js} +2 -2
- package/dist/chunks/{tabs.component-caMRtfBi.js.map → tabs.component-DKW-zlGD.js.map} +1 -1
- package/dist/chunks/{tabs.component-ClJfuErZ.js → tabs.component-b8VxTs-T.js} +2 -2
- package/dist/chunks/{tabs.component-ClJfuErZ.js.map → tabs.component-b8VxTs-T.js.map} +1 -1
- package/dist/chunks/{tagBlock.component-U-lJ5uHV.js → tagBlock.component-CfxiQgjI.js} +3 -3
- package/dist/chunks/{tagBlock.component-U-lJ5uHV.js.map → tagBlock.component-CfxiQgjI.js.map} +1 -1
- package/dist/chunks/{tagBlock.component-CC4azYDm.js → tagBlock.component-XQpgKtzp.js} +2 -2
- package/dist/chunks/{tagBlock.component-CC4azYDm.js.map → tagBlock.component-XQpgKtzp.js.map} +1 -1
- package/dist/chunks/{textInput.component-o3OfBL3Y.js → textInput.component-BPuhDvEr.js} +2 -2
- package/dist/chunks/{textInput.component-o3OfBL3Y.js.map → textInput.component-BPuhDvEr.js.map} +1 -1
- package/dist/chunks/{textInput.component-DpX3YAU9.js → textInput.component-evu71Hys.js} +3 -3
- package/dist/chunks/{textInput.component-DpX3YAU9.js.map → textInput.component-evu71Hys.js.map} +1 -1
- package/dist/chunks/{textarea.component-suXkF86X.js → textarea.component-CZQMAMYT.js} +2 -2
- package/dist/chunks/{textarea.component-suXkF86X.js.map → textarea.component-CZQMAMYT.js.map} +1 -1
- package/dist/chunks/{textarea.component-DDz3lXs_.js → textarea.component-DE-RO7Sv.js} +2 -2
- package/dist/chunks/{textarea.component-DDz3lXs_.js.map → textarea.component-DE-RO7Sv.js.map} +1 -1
- package/dist/chunks/{theme.provider-1EtPFe0L.js → theme.provider-DJi1V2F-.js} +3 -3
- package/dist/chunks/{theme.provider-1EtPFe0L.js.map → theme.provider-DJi1V2F-.js.map} +1 -1
- package/dist/chunks/{theme.provider-DHy8ThEw.js → theme.provider-Dr8GOGfI.js} +2 -2
- package/dist/chunks/{theme.provider-DHy8ThEw.js.map → theme.provider-Dr8GOGfI.js.map} +1 -1
- package/dist/chunks/{timePicker.component-WvpEbpMk.js → timePicker.component-Bk6YAjmJ.js} +4 -4
- package/dist/chunks/{timePicker.component-WvpEbpMk.js.map → timePicker.component-Bk6YAjmJ.js.map} +1 -1
- package/dist/chunks/{timePicker.component-C2BJyTLE.js → timePicker.component-CoQ_s8Vc.js} +2 -2
- package/dist/chunks/{timePicker.component-C2BJyTLE.js.map → timePicker.component-CoQ_s8Vc.js.map} +1 -1
- package/dist/chunks/{timeRange.component-D4EOdXfD.js → timeRange.component-BJRcb-HV.js} +2 -2
- package/dist/chunks/{timeRange.component-D4EOdXfD.js.map → timeRange.component-BJRcb-HV.js.map} +1 -1
- package/dist/chunks/{timeRange.component-CiRJ5ZPF.js → timeRange.component-BwJfza8q.js} +2 -2
- package/dist/chunks/{timeRange.component-CiRJ5ZPF.js.map → timeRange.component-BwJfza8q.js.map} +1 -1
- package/dist/chunks/{withFormControl-DBaRp5Zy.js → withFormControl-BUrlnWW8.js} +2 -2
- package/dist/chunks/{withFormControl-DBaRp5Zy.js.map → withFormControl-BUrlnWW8.js.map} +1 -1
- package/dist/chunks/{withFormControl-B2tHXexu.js → withFormControl-l2C92-pT.js} +2 -2
- package/dist/chunks/{withFormControl-B2tHXexu.js.map → withFormControl-l2C92-pT.js.map} +1 -1
- package/dist/cjs/components/Alert/index.cjs +1 -1
- package/dist/cjs/components/Avatar/index.cjs +1 -1
- package/dist/cjs/components/AvatarGroup/index.cjs +1 -1
- package/dist/cjs/components/Button/index.cjs +1 -1
- package/dist/cjs/components/ButtonGroup/index.cjs +1 -1
- package/dist/cjs/components/Checkbox/index.cjs +1 -1
- package/dist/cjs/components/CheckboxGroup/index.cjs +1 -1
- package/dist/cjs/components/ConversationCard/index.cjs +1 -1
- package/dist/cjs/components/DatePicker/index.cjs +1 -1
- package/dist/cjs/components/Icon/index.cjs +1 -1
- package/dist/cjs/components/Link/index.cjs +1 -1
- package/dist/cjs/components/Menu/index.cjs +1 -1
- package/dist/cjs/components/Modal/index.cjs +1 -1
- package/dist/cjs/components/PinInput/index.cjs +1 -1
- package/dist/cjs/components/Popover/index.cjs +1 -1
- package/dist/cjs/components/RadioGroup/index.cjs +1 -1
- package/dist/cjs/components/RatingDots/index.cjs +1 -1
- package/dist/cjs/components/Select/index.cjs +1 -1
- package/dist/cjs/components/SortableList/index.cjs +1 -1
- package/dist/cjs/components/StyledAvatar/index.cjs +1 -1
- package/dist/cjs/components/Switch/index.cjs +1 -1
- package/dist/cjs/components/Tabs/index.cjs +1 -1
- package/dist/cjs/components/TagBlock/index.cjs +1 -1
- package/dist/cjs/components/TextInput/index.cjs +1 -1
- package/dist/cjs/components/Textarea/index.cjs +1 -1
- package/dist/cjs/components/TimePicker/index.cjs +1 -1
- package/dist/cjs/components/TimeRange/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/theme/index.cjs +1 -1
- package/dist/esm/components/Alert/index.js +1 -1
- package/dist/esm/components/Avatar/index.js +1 -1
- package/dist/esm/components/AvatarGroup/index.js +1 -1
- package/dist/esm/components/Button/index.js +1 -1
- package/dist/esm/components/ButtonGroup/index.js +1 -1
- package/dist/esm/components/Checkbox/index.js +1 -1
- package/dist/esm/components/CheckboxGroup/index.js +1 -1
- package/dist/esm/components/ConversationCard/index.js +1 -1
- package/dist/esm/components/DatePicker/index.js +1 -1
- package/dist/esm/components/Icon/index.js +1 -1
- package/dist/esm/components/Link/index.js +1 -1
- package/dist/esm/components/Menu/index.js +1 -1
- package/dist/esm/components/Modal/index.js +1 -1
- package/dist/esm/components/PinInput/index.js +1 -1
- package/dist/esm/components/Popover/index.js +1 -1
- package/dist/esm/components/RadioGroup/index.js +1 -1
- package/dist/esm/components/RatingDots/index.js +1 -1
- package/dist/esm/components/Select/index.js +1 -1
- package/dist/esm/components/SortableList/index.js +1 -1
- package/dist/esm/components/StyledAvatar/index.js +1 -1
- package/dist/esm/components/Switch/index.js +1 -1
- package/dist/esm/components/Tabs/index.js +1 -1
- package/dist/esm/components/TagBlock/index.js +1 -1
- package/dist/esm/components/TextInput/index.js +1 -1
- package/dist/esm/components/Textarea/index.js +1 -1
- package/dist/esm/components/TimePicker/index.js +1 -1
- package/dist/esm/components/TimeRange/index.js +1 -1
- package/dist/esm/components/index.js +27 -27
- package/dist/esm/index.js +28 -28
- package/dist/esm/theme/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/icon.component-C0e0UGBw.js +0 -2
- package/dist/chunks/icon.component-C0e0UGBw.js.map +0 -1
- package/dist/chunks/icon.component-CFqpWzmV.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const c=require("./jsx-runtime-BjDatQAs.js"),p=require("./avatar.component-
|
|
2
|
-
//# sourceMappingURL=styledAvatar.types-
|
|
1
|
+
"use strict";const c=require("./jsx-runtime-BjDatQAs.js"),p=require("./avatar.component-SZi87lRl.js"),m=({type:l="Client",...e})=>{const{name:o,tooltipProps:t={placement:"top",...e.tooltipProps},onClick:s}=e,n={variant:"outlineYellow",tooltipProps:{...t,label:t?.label||`${o} (Test Client)`}},r={iconName:"cellphone",tooltipProps:{...t,label:t?.label||`Text messages sent from ${o||"unknown number"}`}},i={Automated:{iconName:"robot",backgroundColor:"background.primary",hideBorder:!0,color:"text.contrast",size:"sm",showTooltip:!1,cursor:"default"},Client:{},Clinic:{variant:"outlineAccent",name:o||"Sys"},SMS:r,TestClient:n};return c.jsxRuntimeExports.jsx(p.Avatar,{className:"StyledAvatar","data-testid":`kibble-styled-avatar-${l}`,onClick:a=>{a.stopPropagation(),s&&s(a)},...e,...i[l]})},u=["Client","SMS","TestClient","Automated","Clinic"];exports.StyledAvatar=m;exports.styledAvatarTypes=u;
|
|
2
|
+
//# sourceMappingURL=styledAvatar.types-BNejv6F7.js.map
|
package/dist/chunks/{styledAvatar.types-zeF6AQ1t.js.map → styledAvatar.types-BNejv6F7.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styledAvatar.types-
|
|
1
|
+
{"version":3,"file":"styledAvatar.types-BNejv6F7.js","sources":["../../src/components/StyledAvatar/styledAvatar.component.tsx","../../src/components/StyledAvatar/styledAvatar.types.ts"],"sourcesContent":["import React from 'react';\nimport { Avatar, AvatarProps } from 'components/Avatar/avatar.component';\nimport { StyledAvatarType } from './styledAvatar.types';\n\nexport interface StyledAvatarProps extends AvatarProps {\n type?: StyledAvatarType;\n}\n\nexport const StyledAvatar = ({ type = 'Client', ...rest }: StyledAvatarProps): React.JSX.Element => {\n const { name, tooltipProps = { placement: 'top', ...rest.tooltipProps }, onClick } = rest;\n\n const testClientStyleProps: Partial<AvatarProps> = {\n variant: 'outlineYellow',\n tooltipProps: {\n ...tooltipProps,\n label: tooltipProps?.label || `${name} (Test Client)`,\n },\n };\n\n const smsStyleProps: Partial<AvatarProps> = {\n iconName: 'cellphone',\n tooltipProps: {\n ...tooltipProps,\n label: tooltipProps?.label || `Text messages sent from ${name || 'unknown number'}`,\n },\n };\n\n const automatedStyleProps: Partial<AvatarProps> = {\n iconName: 'robot',\n backgroundColor: 'background.primary',\n hideBorder: true,\n color: 'text.contrast',\n size: 'sm',\n showTooltip: false,\n cursor: 'default',\n };\n\n const clinicStyleProps: Partial<AvatarProps> = {\n variant: 'outlineAccent',\n name: name || 'Sys',\n };\n\n const styleProps: Record<StyledAvatarType, Partial<AvatarProps>> = {\n Automated: automatedStyleProps,\n Client: {},\n Clinic: clinicStyleProps,\n SMS: smsStyleProps,\n TestClient: testClientStyleProps,\n };\n\n return (\n <Avatar\n className=\"StyledAvatar\"\n data-testid={`kibble-styled-avatar-${type}`}\n onClick={(e): void => {\n e.stopPropagation();\n if (onClick) {\n onClick(e);\n }\n }}\n {...rest}\n {...styleProps[type]}\n />\n );\n};\n","export const styledAvatarTypes = ['Client', 'SMS', 'TestClient', 'Automated', 'Clinic'] as const;\nexport type StyledAvatarType = (typeof styledAvatarTypes)[number];\n"],"names":["StyledAvatar","type","rest","name","tooltipProps","onClick","testClientStyleProps","smsStyleProps","styleProps","jsx","Avatar","e","styledAvatarTypes"],"mappings":"sGAQaA,EAAe,CAAC,CAAE,KAAAC,EAAO,SAAU,GAAGC,KAAiD,CAC5F,KAAA,CAAE,KAAAC,EAAM,aAAAC,EAAe,CAAE,UAAW,MAAO,GAAGF,EAAK,YAAA,EAAgB,QAAAG,CAAA,EAAYH,EAE/EI,EAA6C,CACjD,QAAS,gBACT,aAAc,CACZ,GAAGF,EACH,MAAOA,GAAc,OAAS,GAAGD,CAAI,gBAAA,CAEzC,EAEMI,EAAsC,CAC1C,SAAU,YACV,aAAc,CACZ,GAAGH,EACH,MAAOA,GAAc,OAAS,2BAA2BD,GAAQ,gBAAgB,EAAA,CAErF,EAiBMK,EAA6D,CACjE,UAhBgD,CAChD,SAAU,QACV,gBAAiB,qBACjB,WAAY,GACZ,MAAO,gBACP,KAAM,KACN,YAAa,GACb,OAAQ,SACV,EASE,OAAQ,CAAC,EACT,OAR6C,CAC7C,QAAS,gBACT,KAAML,GAAQ,KAChB,EAME,IAAKI,EACL,WAAYD,CACd,EAGE,OAAAG,EAAA,kBAAA,IAACC,EAAA,OAAA,CACC,UAAU,eACV,cAAa,wBAAwBT,CAAI,GACzC,QAAUU,GAAY,CACpBA,EAAE,gBAAgB,EACdN,GACFA,EAAQM,CAAC,CAEb,EACC,GAAGT,EACH,GAAGM,EAAWP,CAAI,CAAA,CACrB,CAEJ,EChEaW,EAAoB,CAAC,SAAU,MAAO,aAAc,YAAa,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as c } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
-
import { A as p } from "./avatar.component-
|
|
2
|
+
import { A as p } from "./avatar.component-CV_95YCj.js";
|
|
3
3
|
const y = ({ type: l = "Client", ...o }) => {
|
|
4
4
|
const { name: e, tooltipProps: t = { placement: "top", ...o.tooltipProps }, onClick: s } = o, n = {
|
|
5
5
|
variant: "outlineYellow",
|
|
@@ -48,4 +48,4 @@ export {
|
|
|
48
48
|
y as S,
|
|
49
49
|
C as s
|
|
50
50
|
};
|
|
51
|
-
//# sourceMappingURL=styledAvatar.types-
|
|
51
|
+
//# sourceMappingURL=styledAvatar.types-DXwe2DPH.js.map
|
package/dist/chunks/{styledAvatar.types-cFMdDiqa.js.map → styledAvatar.types-DXwe2DPH.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styledAvatar.types-
|
|
1
|
+
{"version":3,"file":"styledAvatar.types-DXwe2DPH.js","sources":["../../src/components/StyledAvatar/styledAvatar.component.tsx","../../src/components/StyledAvatar/styledAvatar.types.ts"],"sourcesContent":["import React from 'react';\nimport { Avatar, AvatarProps } from 'components/Avatar/avatar.component';\nimport { StyledAvatarType } from './styledAvatar.types';\n\nexport interface StyledAvatarProps extends AvatarProps {\n type?: StyledAvatarType;\n}\n\nexport const StyledAvatar = ({ type = 'Client', ...rest }: StyledAvatarProps): React.JSX.Element => {\n const { name, tooltipProps = { placement: 'top', ...rest.tooltipProps }, onClick } = rest;\n\n const testClientStyleProps: Partial<AvatarProps> = {\n variant: 'outlineYellow',\n tooltipProps: {\n ...tooltipProps,\n label: tooltipProps?.label || `${name} (Test Client)`,\n },\n };\n\n const smsStyleProps: Partial<AvatarProps> = {\n iconName: 'cellphone',\n tooltipProps: {\n ...tooltipProps,\n label: tooltipProps?.label || `Text messages sent from ${name || 'unknown number'}`,\n },\n };\n\n const automatedStyleProps: Partial<AvatarProps> = {\n iconName: 'robot',\n backgroundColor: 'background.primary',\n hideBorder: true,\n color: 'text.contrast',\n size: 'sm',\n showTooltip: false,\n cursor: 'default',\n };\n\n const clinicStyleProps: Partial<AvatarProps> = {\n variant: 'outlineAccent',\n name: name || 'Sys',\n };\n\n const styleProps: Record<StyledAvatarType, Partial<AvatarProps>> = {\n Automated: automatedStyleProps,\n Client: {},\n Clinic: clinicStyleProps,\n SMS: smsStyleProps,\n TestClient: testClientStyleProps,\n };\n\n return (\n <Avatar\n className=\"StyledAvatar\"\n data-testid={`kibble-styled-avatar-${type}`}\n onClick={(e): void => {\n e.stopPropagation();\n if (onClick) {\n onClick(e);\n }\n }}\n {...rest}\n {...styleProps[type]}\n />\n );\n};\n","export const styledAvatarTypes = ['Client', 'SMS', 'TestClient', 'Automated', 'Clinic'] as const;\nexport type StyledAvatarType = (typeof styledAvatarTypes)[number];\n"],"names":["StyledAvatar","type","rest","name","tooltipProps","onClick","testClientStyleProps","smsStyleProps","styleProps","jsx","Avatar","e","styledAvatarTypes"],"mappings":";;AAQO,MAAMA,IAAe,CAAC,EAAE,MAAAC,IAAO,UAAU,GAAGC,QAAiD;AAC5F,QAAA,EAAE,MAAAC,GAAM,cAAAC,IAAe,EAAE,WAAW,OAAO,GAAGF,EAAK,aAAA,GAAgB,SAAAG,EAAA,IAAYH,GAE/EI,IAA6C;AAAA,IACjD,SAAS;AAAA,IACT,cAAc;AAAA,MACZ,GAAGF;AAAA,MACH,OAAOA,GAAc,SAAS,GAAGD,CAAI;AAAA,IAAA;AAAA,EAEzC,GAEMI,IAAsC;AAAA,IAC1C,UAAU;AAAA,IACV,cAAc;AAAA,MACZ,GAAGH;AAAA,MACH,OAAOA,GAAc,SAAS,2BAA2BD,KAAQ,gBAAgB;AAAA,IAAA;AAAA,EAErF,GAiBMK,IAA6D;AAAA,IACjE,WAhBgD;AAAA,MAChD,UAAU;AAAA,MACV,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,MAAM;AAAA,MACN,aAAa;AAAA,MACb,QAAQ;AAAA,IACV;AAAA,IASE,QAAQ,CAAC;AAAA,IACT,QAR6C;AAAA,MAC7C,SAAS;AAAA,MACT,MAAML,KAAQ;AAAA,IAChB;AAAA,IAME,KAAKI;AAAA,IACL,YAAYD;AAAA,EACd;AAGE,SAAAG,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,eAAa,wBAAwBT,CAAI;AAAA,MACzC,SAAS,CAACU,MAAY;AACpB,QAAAA,EAAE,gBAAgB,GACdN,KACFA,EAAQM,CAAC;AAAA,MAEb;AAAA,MACC,GAAGT;AAAA,MACH,GAAGM,EAAWP,CAAI;AAAA,IAAA;AAAA,EACrB;AAEJ,GChEaW,IAAoB,CAAC,UAAU,OAAO,cAAc,aAAa,QAAQ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const n=require("./jsx-runtime-BjDatQAs.js"),c=require("react"),q=require("./withFormControl-
|
|
2
|
-
//# sourceMappingURL=switch.component-
|
|
1
|
+
"use strict";const n=require("./jsx-runtime-BjDatQAs.js"),c=require("react"),q=require("./withFormControl-BUrlnWW8.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-DC6-XTlo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.component-C4tJUYg9.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, { ForwardedRef, 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?: ForwardedRef<HTMLLabelElement>;\n size?: FormControlSize;\n switchRef?: React.RefObject<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,IAAA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AO,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-DC6-XTlo.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, { ForwardedRef, 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?: ForwardedRef<HTMLLabelElement>;\n size?: FormControlSize;\n switchRef?: React.RefObject<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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ardRef as n, useId as A, useMemo as L } from "react";
|
|
3
|
-
import { w as T } from "./withFormControl-
|
|
3
|
+
import { w as T } from "./withFormControl-l2C92-pT.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-
|
|
154
|
+
//# sourceMappingURL=switch.component-DVHjLc9H.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.component-1NMBytrm.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, { ForwardedRef, 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?: ForwardedRef<HTMLLabelElement>;\n size?: FormControlSize;\n switchRef?: React.RefObject<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,IAAgBN,EAAkB,GAClCO,IAAcC,EAAWF,EAAc,cAAa,GAAIF,CAAK;AACnE,SAAuBK,gBAAAA,EAAAA,IAAIC,EAAI,MAAM,EAAE,GAAGH,GA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BAAwB;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-DVHjLc9H.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, { ForwardedRef, 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?: ForwardedRef<HTMLLabelElement>;\n size?: FormControlSize;\n switchRef?: React.RefObject<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,IAAgBN,EAAkB,GAClCO,IAAcC,EAAWF,EAAc,cAAa,GAAIF,CAAK;AACnE,SAAuBK,gBAAAA,EAAAA,IAAIC,EAAI,MAAM,EAAE,GAAGH,GAAa,KAAAF,GAAK;AAC9D,CAAC;AACDS,EAAY,cAAc;ACJ1B,MAAMC,IAAY,CAACX,MAAU;AAC3B,QAAMY,IAAKC,EAAO,GACZ,EAAE,aAAAC,EAAa,IAAGC,EAAuB,GACzC,EAAE,KAAAC,EAAK,IAAGC,EAAkB,GAC5BT,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":[0,1,2,3,4,5,6,7,8]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const l=require("./jsx-runtime-BjDatQAs.js"),_=require("./icon.component-C0e0UGBw.js"),M=require("./notificationCounter.component-BhZcuBmr.js"),H=require("./heading.component-DNsKd4Gh.js"),X=require("./create-slot-recipe-context-IwVIgtBt.js"),p=require("react"),u=require("./use-locale-context-D0LByRu9.js"),x=require("./render-strategy-C_zp9LNQ.js"),n=require("./index-CHIISuTq.js");function K(e,t){const[s,a]=p.useState(e);return p.useEffect(()=>{const o=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(o)}},[e,t]),s}const[N,A]=u.createContext({name:"TabsContext",hookName:"useTabsContext",providerName:"<TabsProvider />"}),S=p.forwardRef((e,t)=>{const[s,a]=u.createSplitProps()(e,["value"]),o=A(),r=x.useRenderStrategyPropsContext(),i=u.usePresence({...r,present:K(o.value===e.value,0),immediate:!0}),g=n.mergeProps(o.getContentProps(s),i.getPresenceProps(),a);return l.jsxRuntimeExports.jsx(u.PresenceProvider,{value:i,children:i.unmounted?null:l.jsxRuntimeExports.jsx(u.ark.div,{...g,ref:u.composeRefs(i.ref,t)})})});S.displayName="TabContent";const L=p.forwardRef((e,t)=>{const s=A(),a=n.mergeProps(s.getIndicatorProps(),e);return l.jsxRuntimeExports.jsx(u.ark.div,{...a,ref:t})});L.displayName="TabIndicator";const O=p.forwardRef((e,t)=>{const s=A(),a=n.mergeProps(s.getListProps(),e);return l.jsxRuntimeExports.jsx(u.ark.div,{...a,ref:t})});O.displayName="TabList";const k=p.forwardRef((e,t)=>{const[s,a]=u.createSplitProps()(e,["disabled","value"]),o=A(),r=n.mergeProps(o.getTriggerProps(s),a);return l.jsxRuntimeExports.jsx(u.ark.button,{...r,ref:t})});k.displayName="TabTrigger";var G=n.createAnatomy("tabs").parts("root","list","trigger","content","indicator"),m=G.build(),Y=e=>e.ids?.root??`tabs:${e.id}`,R=e=>e.ids?.list??`tabs:${e.id}:list`,I=(e,t)=>e.ids?.content??`tabs:${e.id}:content-${t}`,v=(e,t)=>e.ids?.trigger??`tabs:${e.id}:trigger-${t}`,B=e=>e.ids?.indicator??`tabs:${e.id}:indicator`,z=e=>e.getById(R(e)),J=(e,t)=>e.getById(I(e,t)),V=(e,t)=>e.getById(v(e,t)),w=e=>e.getById(B(e)),y=e=>{const s=`[role=tab][data-ownedby='${CSS.escape(R(e))}']:not([disabled])`;return n.queryAll(z(e),s)},Q=e=>n.first(y(e)),Z=e=>n.last(y(e)),ee=(e,t)=>n.nextById(y(e),v(e,t.value),t.loopFocus),te=(e,t)=>n.prevById(y(e),v(e,t.value),t.loopFocus),$=e=>({left:e?.offsetLeft??0,top:e?.offsetTop??0,width:e?.offsetWidth??0,height:e?.offsetHeight??0}),ae=(e,t)=>{const s=n.itemById(y(e),v(e,t));return D($(s))},D=e=>({width:`${e.width}px`,height:`${e.height}px`,left:`${e.left}px`,top:`${e.top}px`});function se(e,t){const{state:s,send:a,context:o,prop:r,scope:i}=e,g=r("translations"),T=s.matches("focused"),P=r("orientation")==="vertical",h=r("orientation")==="horizontal",j=r("composite");function F(c){return{selected:o.get("value")===c.value,focused:o.get("focusedValue")===c.value,disabled:!!c.disabled}}return{value:o.get("value"),focusedValue:o.get("focusedValue"),setValue(c){a({type:"SET_VALUE",value:c})},clearValue(){a({type:"CLEAR_VALUE"})},setIndicatorRect(c){const d=v(i,c);a({type:"SET_INDICATOR_RECT",id:d})},syncTabIndex(){a({type:"SYNC_TAB_INDEX"})},selectNext(c){a({type:"TAB_FOCUS",value:c,src:"selectNext"}),a({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(c){a({type:"TAB_FOCUS",value:c,src:"selectPrev"}),a({type:"ARROW_PREV",src:"selectPrev"})},focus(){const c=o.get("value");c&&V(i,c)?.focus()},getRootProps(){return t.element({...m.root.attrs,id:Y(i),"data-orientation":r("orientation"),"data-focus":n.dataAttr(T),dir:r("dir")})},getListProps(){return t.element({...m.list.attrs,id:R(i),role:"tablist",dir:r("dir"),"data-focus":n.dataAttr(T),"aria-orientation":r("orientation"),"data-orientation":r("orientation"),"aria-label":g?.listLabel,onKeyDown(c){if(c.defaultPrevented||!n.isSelfTarget(c)||n.isComposingEvent(c))return;const d={ArrowDown(){h||a({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){h||a({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){P||a({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){P||a({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){a({type:"HOME"})},End(){a({type:"END"})},Enter(){a({type:"ENTER"})}};let f=n.getEventKey(c,{dir:r("dir"),orientation:r("orientation")});const b=d[f];b&&(c.preventDefault(),b(c))}})},getTriggerState:F,getTriggerProps(c){const{value:d,disabled:f}=c,b=F(c);return t.button({...m.trigger.attrs,role:"tab",type:"button",disabled:f,dir:r("dir"),"data-orientation":r("orientation"),"data-disabled":n.dataAttr(f),"aria-disabled":f,"data-value":d,"aria-selected":b.selected,"data-selected":n.dataAttr(b.selected),"data-focus":n.dataAttr(b.focused),"aria-controls":b.selected?I(i,d):void 0,"data-ownedby":R(i),"data-ssr":n.dataAttr(o.get("ssr")),id:v(i,d),tabIndex:b.selected&&j?0:-1,onFocus(){a({type:"TAB_FOCUS",value:d})},onBlur(C){C.relatedTarget?.getAttribute("role")!=="tab"&&a({type:"TAB_BLUR"})},onClick(C){C.defaultPrevented||f||(n.isSafari()&&C.currentTarget.focus(),a({type:"TAB_CLICK",value:d}))}})},getContentProps(c){const{value:d}=c,f=o.get("value")===d;return t.element({...m.content.attrs,dir:r("dir"),id:I(i,d),tabIndex:j?0:-1,"aria-labelledby":v(i,d),role:"tabpanel","data-ownedby":R(i),"data-selected":n.dataAttr(f),"data-orientation":r("orientation"),hidden:!f})},getIndicatorProps(){const c=o.get("indicatorRect"),d=o.get("indicatorTransition");return t.element({id:B(i),...m.indicator.attrs,dir:r("dir"),"data-orientation":r("orientation"),style:{"--transition-property":"left, right, top, bottom, width, height","--left":c.left,"--top":c.top,"--width":c.width,"--height":c.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:d?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[h?"left":"top"]:h?"var(--left)":"var(--top)"}})}}}var{not:re}=n.createGuards(),oe=n.createMachine({props({props:e}){return{dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(t){n.clickIfLink(t.node)},defaultValue:null,...e}},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(s){e("onValueChange")?.({value:s})}})),focusedValue:t(()=>({defaultValue:e("value")||e("defaultValue"),sync:!0,onChange(s){e("onFocusChange")?.({focusedValue:s})}})),ssr:t(()=>({defaultValue:!0})),indicatorTransition:t(()=>({defaultValue:!1})),indicatorRect:t(()=>({defaultValue:{left:"0px",top:"0px",width:"0px",height:"0px"}}))}},watch({context:e,prop:t,track:s,action:a}){s([()=>e.get("value")],()=>{a(["allowIndicatorTransition","syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),s([()=>t("dir"),()=>t("orientation")],()=>{a(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]}},entry:["syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],ENTER:{guard:re("selectOnFocus"),actions:["selectFocusedTab"]},TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e("activationMode")==="automatic"},actions:{selectFocusedTab({context:e,prop:t}){n.raf(()=>{const s=e.get("focusedValue");if(!s)return;const o=t("deselectable")&&e.get("value")===s?null:s;e.set("value",o)})},setFocusedValue({context:e,event:t,flush:s}){t.value!=null&&s(()=>{e.set("focusedValue",t.value)})},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t,prop:s}){const a=s("deselectable")&&e.get("value")===e.get("focusedValue");e.set("value",a?null:t.value)},clearValue({context:e}){e.set("value",null)},focusFirstTab({scope:e}){n.raf(()=>{Q(e)?.focus()})},focusLastTab({scope:e}){n.raf(()=>{Z(e)?.focus()})},focusNextTab({context:e,prop:t,scope:s,event:a}){const o=a.value??e.get("focusedValue");if(!o)return;const r=ee(s,{value:o,loopFocus:t("loopFocus")});n.raf(()=>{t("composite")?r?.focus():r?.dataset.value!=null&&e.set("focusedValue",r.dataset.value)})},focusPrevTab({context:e,prop:t,scope:s,event:a}){const o=a.value??e.get("focusedValue");if(!o)return;const r=te(s,{value:o,loopFocus:t("loopFocus")});n.raf(()=>{t("composite")?r?.focus():r?.dataset.value!=null&&e.set("focusedValue",r.dataset.value)})},syncTabIndex({context:e,scope:t}){n.raf(()=>{const s=e.get("value");if(!s)return;const a=J(t,s);if(!a)return;n.getFocusables(a).length>0?a.removeAttribute("tabindex"):a.setAttribute("tabindex","0")})},cleanupObserver({refs:e}){const t=e.get("indicatorCleanup");t&&t()},allowIndicatorTransition({context:e}){e.set("indicatorTransition",!0)},setIndicatorRect({context:e,event:t,scope:s}){const a=t.id??e.get("value");if(!w(s))return;if(!a){e.set("indicatorTransition",!1);return}V(s,a)&&(e.set("indicatorRect",ae(s,a)),n.nextTick(()=>{e.set("indicatorTransition",!1)}))},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,refs:t,scope:s}){const a=t.get("indicatorCleanup");a&&a();const o=e.get("value");if(!o){e.set("indicatorTransition",!1);return}const r=V(s,o),i=w(s);if(!r||!i)return;const g=n.trackElementRect([r],{measure(T){return $(T)},onEntry({rects:T}){const[P]=T;e.set("indicatorRect",D(P))}});t.set("indicatorCleanup",g)},navigateIfNeeded({context:e,prop:t,scope:s}){const a=e.get("value");if(!a)return;const o=V(s,a);n.isAnchorElement(o)&&t("navigate")?.({value:a,node:o,href:o.href})}}}});u.createProps()(["activationMode","composite","deselectable","dir","getRootNode","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value","defaultValue"]);u.createProps()(["disabled","value"]);u.createProps()(["value"]);const ne=e=>{const t=p.useId(),{getRootNode:s}=u.useEnvironmentContext(),{dir:a}=u.useLocaleContext(),o={id:t,dir:a,getRootNode:s,...e},r=u.useMachine(oe,o);return se(r,u.normalizeProps)},U=p.forwardRef((e,t)=>{const[s,a]=x.splitRenderStrategyProps(e),[o,r]=u.createSplitProps()(a,["activationMode","composite","defaultValue","deselectable","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value"]),i=ne(o),g=n.mergeProps(i.getRootProps(),r);return l.jsxRuntimeExports.jsx(N,{value:i,children:l.jsxRuntimeExports.jsx(x.RenderStrategyPropsProvider,{value:s,children:l.jsxRuntimeExports.jsx(u.ark.div,{...g,ref:t})})})});U.displayName="TabsRoot";const q=p.forwardRef((e,t)=>{const[s,a]=x.splitRenderStrategyProps(e),[{value:o},r]=u.createSplitProps()(a,["value"]),i=n.mergeProps(o.getRootProps(),r);return l.jsxRuntimeExports.jsx(N,{value:o,children:l.jsxRuntimeExports.jsx(x.RenderStrategyPropsProvider,{value:s,children:l.jsxRuntimeExports.jsx(u.ark.div,{...i,ref:t})})})});q.displayName="TabsRootProvider";const{withProvider:W,withContext:E}=X.createSlotRecipeContext({key:"tabs"});W(q,"root",{forwardAsChild:!0});const ie=W(U,"root",{forwardAsChild:!0}),ce=E(k,"trigger",{forwardAsChild:!0}),ue=E(S,"content",{forwardAsChild:!0});E("div","contentGroup");const le=E(O,"list",{forwardAsChild:!0});E(L,"indicator",{forwardAsChild:!0});const de={xs:"sm",sm:"md",md:"md",lg:"lg"},ge={xs:"xs",sm:"xs",md:"sm",lg:"md"},fe=({iconName:e,iconPosition:t="left",label:s,notificationCounterProps:a,showNotificationCounter:o,size:r="md",...i})=>l.jsxRuntimeExports.jsxs(ce,{className:"Tab","data-testid":"kibble-tab",...i,children:[!!e&&t==="left"&&l.jsxRuntimeExports.jsx(_.Icon,{className:"Tab__Icon","data-testid":"kibble-tab-icon",name:e,size:r,variant:"default"}),l.jsxRuntimeExports.jsx(H.WrappedHeading,{className:"Tab__Label","data-testid":"kibble-tab-label",size:ge[r],children:s}),!!e&&t==="right"&&l.jsxRuntimeExports.jsx(_.Icon,{className:"Tab__Icon","data-testid":"kibble-tab-icon",name:e,size:r}),o&&l.jsxRuntimeExports.jsx(M.NotificationCounter,{className:"Tab__NotificationCounter","data-testid":"kibble-tab-notification-counter",...a,size:de[r]})]}),pe=({align:e="start",onChange:t,size:s="md",tabs:a,tabsContents:o,...r})=>l.jsxRuntimeExports.jsxs(ie,{className:"Tabs","data-testid":"kibble-tabs",justify:e||r.justify,size:s,onValueChange:({value:i})=>t?.(i),...r,children:[l.jsxRuntimeExports.jsx(le,{className:"Tabs__List","data-testid":"kibble-tabs-list",children:a.map((i,g)=>l.jsxRuntimeExports.jsx(fe,{...i},`tab-${g}`))}),!!o&&o.map((i,g)=>l.jsxRuntimeExports.jsx(ue,{...i},`tabContent-${g}`))]});exports.Tabs=pe;
|
|
2
|
-
//# sourceMappingURL=tabs.component-
|
|
1
|
+
"use strict";const l=require("./jsx-runtime-BjDatQAs.js"),_=require("./icon.component-aJ690VpJ.js"),M=require("./notificationCounter.component-BhZcuBmr.js"),H=require("./heading.component-DNsKd4Gh.js"),X=require("./create-slot-recipe-context-IwVIgtBt.js"),p=require("react"),u=require("./use-locale-context-D0LByRu9.js"),x=require("./render-strategy-C_zp9LNQ.js"),n=require("./index-CHIISuTq.js");function K(e,t){const[s,a]=p.useState(e);return p.useEffect(()=>{const o=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(o)}},[e,t]),s}const[N,A]=u.createContext({name:"TabsContext",hookName:"useTabsContext",providerName:"<TabsProvider />"}),S=p.forwardRef((e,t)=>{const[s,a]=u.createSplitProps()(e,["value"]),o=A(),r=x.useRenderStrategyPropsContext(),i=u.usePresence({...r,present:K(o.value===e.value,0),immediate:!0}),g=n.mergeProps(o.getContentProps(s),i.getPresenceProps(),a);return l.jsxRuntimeExports.jsx(u.PresenceProvider,{value:i,children:i.unmounted?null:l.jsxRuntimeExports.jsx(u.ark.div,{...g,ref:u.composeRefs(i.ref,t)})})});S.displayName="TabContent";const L=p.forwardRef((e,t)=>{const s=A(),a=n.mergeProps(s.getIndicatorProps(),e);return l.jsxRuntimeExports.jsx(u.ark.div,{...a,ref:t})});L.displayName="TabIndicator";const O=p.forwardRef((e,t)=>{const s=A(),a=n.mergeProps(s.getListProps(),e);return l.jsxRuntimeExports.jsx(u.ark.div,{...a,ref:t})});O.displayName="TabList";const k=p.forwardRef((e,t)=>{const[s,a]=u.createSplitProps()(e,["disabled","value"]),o=A(),r=n.mergeProps(o.getTriggerProps(s),a);return l.jsxRuntimeExports.jsx(u.ark.button,{...r,ref:t})});k.displayName="TabTrigger";var G=n.createAnatomy("tabs").parts("root","list","trigger","content","indicator"),m=G.build(),Y=e=>e.ids?.root??`tabs:${e.id}`,R=e=>e.ids?.list??`tabs:${e.id}:list`,I=(e,t)=>e.ids?.content??`tabs:${e.id}:content-${t}`,v=(e,t)=>e.ids?.trigger??`tabs:${e.id}:trigger-${t}`,B=e=>e.ids?.indicator??`tabs:${e.id}:indicator`,z=e=>e.getById(R(e)),J=(e,t)=>e.getById(I(e,t)),V=(e,t)=>e.getById(v(e,t)),w=e=>e.getById(B(e)),y=e=>{const s=`[role=tab][data-ownedby='${CSS.escape(R(e))}']:not([disabled])`;return n.queryAll(z(e),s)},Q=e=>n.first(y(e)),Z=e=>n.last(y(e)),ee=(e,t)=>n.nextById(y(e),v(e,t.value),t.loopFocus),te=(e,t)=>n.prevById(y(e),v(e,t.value),t.loopFocus),$=e=>({left:e?.offsetLeft??0,top:e?.offsetTop??0,width:e?.offsetWidth??0,height:e?.offsetHeight??0}),ae=(e,t)=>{const s=n.itemById(y(e),v(e,t));return D($(s))},D=e=>({width:`${e.width}px`,height:`${e.height}px`,left:`${e.left}px`,top:`${e.top}px`});function se(e,t){const{state:s,send:a,context:o,prop:r,scope:i}=e,g=r("translations"),T=s.matches("focused"),P=r("orientation")==="vertical",h=r("orientation")==="horizontal",j=r("composite");function F(c){return{selected:o.get("value")===c.value,focused:o.get("focusedValue")===c.value,disabled:!!c.disabled}}return{value:o.get("value"),focusedValue:o.get("focusedValue"),setValue(c){a({type:"SET_VALUE",value:c})},clearValue(){a({type:"CLEAR_VALUE"})},setIndicatorRect(c){const d=v(i,c);a({type:"SET_INDICATOR_RECT",id:d})},syncTabIndex(){a({type:"SYNC_TAB_INDEX"})},selectNext(c){a({type:"TAB_FOCUS",value:c,src:"selectNext"}),a({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(c){a({type:"TAB_FOCUS",value:c,src:"selectPrev"}),a({type:"ARROW_PREV",src:"selectPrev"})},focus(){const c=o.get("value");c&&V(i,c)?.focus()},getRootProps(){return t.element({...m.root.attrs,id:Y(i),"data-orientation":r("orientation"),"data-focus":n.dataAttr(T),dir:r("dir")})},getListProps(){return t.element({...m.list.attrs,id:R(i),role:"tablist",dir:r("dir"),"data-focus":n.dataAttr(T),"aria-orientation":r("orientation"),"data-orientation":r("orientation"),"aria-label":g?.listLabel,onKeyDown(c){if(c.defaultPrevented||!n.isSelfTarget(c)||n.isComposingEvent(c))return;const d={ArrowDown(){h||a({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){h||a({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){P||a({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){P||a({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){a({type:"HOME"})},End(){a({type:"END"})},Enter(){a({type:"ENTER"})}};let f=n.getEventKey(c,{dir:r("dir"),orientation:r("orientation")});const b=d[f];b&&(c.preventDefault(),b(c))}})},getTriggerState:F,getTriggerProps(c){const{value:d,disabled:f}=c,b=F(c);return t.button({...m.trigger.attrs,role:"tab",type:"button",disabled:f,dir:r("dir"),"data-orientation":r("orientation"),"data-disabled":n.dataAttr(f),"aria-disabled":f,"data-value":d,"aria-selected":b.selected,"data-selected":n.dataAttr(b.selected),"data-focus":n.dataAttr(b.focused),"aria-controls":b.selected?I(i,d):void 0,"data-ownedby":R(i),"data-ssr":n.dataAttr(o.get("ssr")),id:v(i,d),tabIndex:b.selected&&j?0:-1,onFocus(){a({type:"TAB_FOCUS",value:d})},onBlur(C){C.relatedTarget?.getAttribute("role")!=="tab"&&a({type:"TAB_BLUR"})},onClick(C){C.defaultPrevented||f||(n.isSafari()&&C.currentTarget.focus(),a({type:"TAB_CLICK",value:d}))}})},getContentProps(c){const{value:d}=c,f=o.get("value")===d;return t.element({...m.content.attrs,dir:r("dir"),id:I(i,d),tabIndex:j?0:-1,"aria-labelledby":v(i,d),role:"tabpanel","data-ownedby":R(i),"data-selected":n.dataAttr(f),"data-orientation":r("orientation"),hidden:!f})},getIndicatorProps(){const c=o.get("indicatorRect"),d=o.get("indicatorTransition");return t.element({id:B(i),...m.indicator.attrs,dir:r("dir"),"data-orientation":r("orientation"),style:{"--transition-property":"left, right, top, bottom, width, height","--left":c.left,"--top":c.top,"--width":c.width,"--height":c.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:d?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[h?"left":"top"]:h?"var(--left)":"var(--top)"}})}}}var{not:re}=n.createGuards(),oe=n.createMachine({props({props:e}){return{dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(t){n.clickIfLink(t.node)},defaultValue:null,...e}},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(s){e("onValueChange")?.({value:s})}})),focusedValue:t(()=>({defaultValue:e("value")||e("defaultValue"),sync:!0,onChange(s){e("onFocusChange")?.({focusedValue:s})}})),ssr:t(()=>({defaultValue:!0})),indicatorTransition:t(()=>({defaultValue:!1})),indicatorRect:t(()=>({defaultValue:{left:"0px",top:"0px",width:"0px",height:"0px"}}))}},watch({context:e,prop:t,track:s,action:a}){s([()=>e.get("value")],()=>{a(["allowIndicatorTransition","syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),s([()=>t("dir"),()=>t("orientation")],()=>{a(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]}},entry:["syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],ENTER:{guard:re("selectOnFocus"),actions:["selectFocusedTab"]},TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e("activationMode")==="automatic"},actions:{selectFocusedTab({context:e,prop:t}){n.raf(()=>{const s=e.get("focusedValue");if(!s)return;const o=t("deselectable")&&e.get("value")===s?null:s;e.set("value",o)})},setFocusedValue({context:e,event:t,flush:s}){t.value!=null&&s(()=>{e.set("focusedValue",t.value)})},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t,prop:s}){const a=s("deselectable")&&e.get("value")===e.get("focusedValue");e.set("value",a?null:t.value)},clearValue({context:e}){e.set("value",null)},focusFirstTab({scope:e}){n.raf(()=>{Q(e)?.focus()})},focusLastTab({scope:e}){n.raf(()=>{Z(e)?.focus()})},focusNextTab({context:e,prop:t,scope:s,event:a}){const o=a.value??e.get("focusedValue");if(!o)return;const r=ee(s,{value:o,loopFocus:t("loopFocus")});n.raf(()=>{t("composite")?r?.focus():r?.dataset.value!=null&&e.set("focusedValue",r.dataset.value)})},focusPrevTab({context:e,prop:t,scope:s,event:a}){const o=a.value??e.get("focusedValue");if(!o)return;const r=te(s,{value:o,loopFocus:t("loopFocus")});n.raf(()=>{t("composite")?r?.focus():r?.dataset.value!=null&&e.set("focusedValue",r.dataset.value)})},syncTabIndex({context:e,scope:t}){n.raf(()=>{const s=e.get("value");if(!s)return;const a=J(t,s);if(!a)return;n.getFocusables(a).length>0?a.removeAttribute("tabindex"):a.setAttribute("tabindex","0")})},cleanupObserver({refs:e}){const t=e.get("indicatorCleanup");t&&t()},allowIndicatorTransition({context:e}){e.set("indicatorTransition",!0)},setIndicatorRect({context:e,event:t,scope:s}){const a=t.id??e.get("value");if(!w(s))return;if(!a){e.set("indicatorTransition",!1);return}V(s,a)&&(e.set("indicatorRect",ae(s,a)),n.nextTick(()=>{e.set("indicatorTransition",!1)}))},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,refs:t,scope:s}){const a=t.get("indicatorCleanup");a&&a();const o=e.get("value");if(!o){e.set("indicatorTransition",!1);return}const r=V(s,o),i=w(s);if(!r||!i)return;const g=n.trackElementRect([r],{measure(T){return $(T)},onEntry({rects:T}){const[P]=T;e.set("indicatorRect",D(P))}});t.set("indicatorCleanup",g)},navigateIfNeeded({context:e,prop:t,scope:s}){const a=e.get("value");if(!a)return;const o=V(s,a);n.isAnchorElement(o)&&t("navigate")?.({value:a,node:o,href:o.href})}}}});u.createProps()(["activationMode","composite","deselectable","dir","getRootNode","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value","defaultValue"]);u.createProps()(["disabled","value"]);u.createProps()(["value"]);const ne=e=>{const t=p.useId(),{getRootNode:s}=u.useEnvironmentContext(),{dir:a}=u.useLocaleContext(),o={id:t,dir:a,getRootNode:s,...e},r=u.useMachine(oe,o);return se(r,u.normalizeProps)},U=p.forwardRef((e,t)=>{const[s,a]=x.splitRenderStrategyProps(e),[o,r]=u.createSplitProps()(a,["activationMode","composite","defaultValue","deselectable","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value"]),i=ne(o),g=n.mergeProps(i.getRootProps(),r);return l.jsxRuntimeExports.jsx(N,{value:i,children:l.jsxRuntimeExports.jsx(x.RenderStrategyPropsProvider,{value:s,children:l.jsxRuntimeExports.jsx(u.ark.div,{...g,ref:t})})})});U.displayName="TabsRoot";const q=p.forwardRef((e,t)=>{const[s,a]=x.splitRenderStrategyProps(e),[{value:o},r]=u.createSplitProps()(a,["value"]),i=n.mergeProps(o.getRootProps(),r);return l.jsxRuntimeExports.jsx(N,{value:o,children:l.jsxRuntimeExports.jsx(x.RenderStrategyPropsProvider,{value:s,children:l.jsxRuntimeExports.jsx(u.ark.div,{...i,ref:t})})})});q.displayName="TabsRootProvider";const{withProvider:W,withContext:E}=X.createSlotRecipeContext({key:"tabs"});W(q,"root",{forwardAsChild:!0});const ie=W(U,"root",{forwardAsChild:!0}),ce=E(k,"trigger",{forwardAsChild:!0}),ue=E(S,"content",{forwardAsChild:!0});E("div","contentGroup");const le=E(O,"list",{forwardAsChild:!0});E(L,"indicator",{forwardAsChild:!0});const de={xs:"sm",sm:"md",md:"md",lg:"lg"},ge={xs:"xs",sm:"xs",md:"sm",lg:"md"},fe=({iconName:e,iconPosition:t="left",label:s,notificationCounterProps:a,showNotificationCounter:o,size:r="md",...i})=>l.jsxRuntimeExports.jsxs(ce,{className:"Tab","data-testid":"kibble-tab",...i,children:[!!e&&t==="left"&&l.jsxRuntimeExports.jsx(_.Icon,{className:"Tab__Icon","data-testid":"kibble-tab-icon",name:e,size:r,variant:"default"}),l.jsxRuntimeExports.jsx(H.WrappedHeading,{className:"Tab__Label","data-testid":"kibble-tab-label",size:ge[r],children:s}),!!e&&t==="right"&&l.jsxRuntimeExports.jsx(_.Icon,{className:"Tab__Icon","data-testid":"kibble-tab-icon",name:e,size:r}),o&&l.jsxRuntimeExports.jsx(M.NotificationCounter,{className:"Tab__NotificationCounter","data-testid":"kibble-tab-notification-counter",...a,size:de[r]})]}),pe=({align:e="start",onChange:t,size:s="md",tabs:a,tabsContents:o,...r})=>l.jsxRuntimeExports.jsxs(ie,{className:"Tabs","data-testid":"kibble-tabs",justify:e||r.justify,size:s,onValueChange:({value:i})=>t?.(i),...r,children:[l.jsxRuntimeExports.jsx(le,{className:"Tabs__List","data-testid":"kibble-tabs-list",children:a.map((i,g)=>l.jsxRuntimeExports.jsx(fe,{...i},`tab-${g}`))}),!!o&&o.map((i,g)=>l.jsxRuntimeExports.jsx(ue,{...i},`tabContent-${g}`))]});exports.Tabs=pe;
|
|
2
|
+
//# sourceMappingURL=tabs.component-DKW-zlGD.js.map
|