@magiclabs/ui-components 1.17.0 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),h=require("@styled/tokens"),w=require("../icons/ico-external-link.js");require("../primitives/button.js"),require("../primitives/checkbox.js"),require("../primitives/popover.js"),require("../primitives/radio.js"),require("../primitives/segmented-control.js"),require("../primitives/switch.js");var g=require("../primitives/text.js"),q=require("@styled/css"),a=require("@styled/jsx"),C=require("@styled/patterns"),l=require("create-slots"),t=require("react"),c=require("react-aria");const f=l.createSlot(({children:r,...s})=>e.jsx(a.Center,{children:t.Children.map(r,o=>t.cloneElement(o,s))})),x=l.createSlot(({children:r,...s})=>e.jsx(a.Center,{children:t.Children.map(r,o=>t.cloneElement(o,s))})),b=t.forwardRef((r,s)=>{const{primaryLabel:o,secondaryLabel:u,isExternalLink:m}=r,v=t.useRef(null),d=s||v,{buttonProps:j}=c.useButton(r,d),{isFocusVisible:y,focusProps:k}=c.useFocusRing();return l.createHost(r.children,p=>{const i=p.get(f),n=p.get(x);return e.jsxs("button",{...c.mergeProps(j,k),ref:d,className:C.flex({justifyContent:"space-between",alignItems:"center",w:"full",p:4,bg:"neutral.quaternary",transition:"background-color 0.2s",_hover:{bg:"neutral.secondary"},rounded:"lg",cursor:"pointer",outlineColor:"brand.base",outlineStyle:y?"solid":"none",outlineWidth:"thick",outlineOffset:.5}),children:[e.jsxs(a.HStack,{children:[i&&{...i,props:{...i.props,className:i.props.color?void 0:q.css({color:"brand.base"}),height:24}},e.jsx(g.default,{styles:{fontWeight:500},children:o}),m&&e.jsx(w.default,{width:14,height:14,color:h.token("colors.neutral.primary")})]}),e.jsxs(a.HStack,{children:[u&&e.jsx(g.default,{size:"sm",styles:{color:h.token("colors.text.tertiary")},children:u}),n&&{...n,props:{...n.props,className:n.props.color?void 0:q.css({color:"neutral.primary"}),width:16,height:16}}]})]})})});b.displayName="NavigationButton";const N=Object.assign(b,{LeadingIcon:f,TrailingIcon:x});exports.default=N;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),h=require("@styled/tokens"),C=require("../icons/ico-external-link.js");require("../primitives/button.js"),require("../primitives/checkbox.js"),require("../primitives/popover.js"),require("../primitives/radio.js"),require("../primitives/segmented-control.js"),require("../primitives/switch.js");var b=require("../primitives/text.js"),g=require("@styled/css"),a=require("@styled/jsx"),N=require("@styled/patterns"),l=require("create-slots"),t=require("react"),c=require("react-aria");const q=l.createSlot(({children:r,...s})=>e.jsx(a.Center,{children:t.Children.map(r,i=>t.cloneElement(i,s))})),v=l.createSlot(({children:r,...s})=>e.jsx(a.Center,{children:t.Children.map(r,i=>t.cloneElement(i,s))})),f=t.forwardRef((r,s)=>{const{primaryLabel:i,secondaryLabel:u,isExternalLink:x,disabled:m}=r,j=t.useRef(null),d=s||j,{buttonProps:y}=c.useButton({...r,isDisabled:m??!1},d),{isFocusVisible:k,focusProps:w}=c.useFocusRing();return l.createHost(r.children,p=>{const n=p.get(q),o=p.get(v);return e.jsxs("button",{...c.mergeProps(y,w),ref:d,className:N.flex({justifyContent:"space-between",alignItems:"center",w:"full",p:4,bg:"neutral.quaternary",transition:"background-color 0.2s",_hover:{bg:"neutral.secondary"},rounded:"lg",cursor:"pointer",outlineColor:"brand.base",outlineStyle:k?"solid":"none",outlineWidth:"thick",outlineOffset:.5,_disabled:{opacity:"0.3",pointerEvents:"none"}}),children:[e.jsxs(a.HStack,{children:[n&&{...n,props:{...n.props,className:n.props.color?void 0:g.css({color:"brand.base"}),height:24}},e.jsx(b.default,{styles:{fontWeight:500},children:i}),x&&e.jsx(C.default,{width:14,height:14,color:h.token("colors.neutral.primary")})]}),e.jsxs(a.HStack,{children:[u&&e.jsx(b.default,{size:"sm",styles:{color:h.token("colors.text.tertiary")},children:u}),o&&{...o,props:{...o.props,className:o.props.color?void 0:g.css({color:"neutral.primary"}),width:16,height:16}}]})]})})});f.displayName="NavigationButton";const S=Object.assign(f,{LeadingIcon:q,TrailingIcon:v});exports.default=S;
2
2
  //# sourceMappingURL=navigation-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-button.js","sources":["../../../../src/components/list-items/navigation-button.tsx"],"sourcesContent":["import { IcoExternalLink } from '@components/icons';\nimport { Text } from '@components/primitives';\nimport { css } from '@styled/css';\nimport { Center, HStack } from '@styled/jsx';\nimport { flex } from '@styled/patterns';\nimport { token } from '@styled/tokens';\nimport { createHost, createSlot } from 'create-slots';\nimport { Children, RefObject, cloneElement, forwardRef, useRef } from 'react';\nimport { AriaButtonProps, mergeProps, useButton, useFocusRing } from 'react-aria';\n\nexport interface NavigationButtonProps extends AriaButtonProps {\n primaryLabel: string;\n secondaryLabel?: string;\n isExternalLink?: boolean;\n}\n\nconst LeadingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst TrailingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst NavigationButtonBase = forwardRef<HTMLButtonElement, NavigationButtonProps>((props, forwardedRef) => {\n const { primaryLabel, secondaryLabel, isExternalLink } = props;\n\n const internalRef = useRef(null);\n const ref = forwardedRef || internalRef;\n\n const { buttonProps } = useButton(props, ref as RefObject<HTMLButtonElement>);\n const { isFocusVisible, focusProps } = useFocusRing();\n\n return createHost(props.children, slots => {\n const leadingIcon = slots.get(LeadingIcon);\n const trailingIcon = slots.get(TrailingIcon);\n\n return (\n <button\n {...mergeProps(buttonProps, focusProps)}\n ref={ref}\n className={flex({\n justifyContent: 'space-between',\n alignItems: 'center',\n w: 'full',\n p: 4,\n bg: 'neutral.quaternary',\n transition: 'background-color 0.2s',\n _hover: { bg: 'neutral.secondary' },\n rounded: 'lg',\n cursor: 'pointer',\n outlineColor: 'brand.base',\n outlineStyle: isFocusVisible ? 'solid' : 'none',\n outlineWidth: 'thick',\n outlineOffset: 0.5,\n })}\n >\n <HStack>\n {leadingIcon && {\n ...leadingIcon,\n props: {\n ...leadingIcon.props,\n className: !leadingIcon.props.color ? css({ color: 'brand.base' }) : undefined,\n height: 24,\n },\n }}\n <Text styles={{ fontWeight: 500 }}>{primaryLabel}</Text>\n {isExternalLink && <IcoExternalLink width={14} height={14} color={token('colors.neutral.primary')} />}\n </HStack>\n <HStack>\n {secondaryLabel && (\n <Text size=\"sm\" styles={{ color: token('colors.text.tertiary') }}>\n {secondaryLabel}\n </Text>\n )}\n {trailingIcon && {\n ...trailingIcon,\n props: {\n ...trailingIcon.props,\n className: !trailingIcon.props.color ? css({ color: 'neutral.primary' }) : undefined,\n width: 16,\n height: 16,\n },\n }}\n </HStack>\n </button>\n );\n });\n});\n\nNavigationButtonBase.displayName = 'NavigationButton';\n\nconst NavigationButton = Object.assign(NavigationButtonBase, { LeadingIcon, TrailingIcon });\n\nexport default NavigationButton;\n"],"names":["LeadingIcon","createSlot","children","props","_jsx","Center","Children","child","cloneElement","TrailingIcon","NavigationButtonBase","forwardRef","forwardedRef","primaryLabel","secondaryLabel","isExternalLink","internalRef","useRef","ref","buttonProps","useButton","isFocusVisible","focusProps","useFocusRing","createHost","slots","leadingIcon","trailingIcon","_jsxs","mergeProps","flex","HStack","css","Text","IcoExternalLink","token","NavigationButton"],"mappings":"ykBAgBA,MAAMA,EAAcC,EAAAA,WAAW,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAO,IAElDC,EAAAA,IAACC,EAAAA,OAAM,CAAA,SACJC,EAAAA,SAAS,IAAIJ,EAAUK,GACfC,EAAAA,aAAaD,EAAOJ,CAAK,CACjC,CACM,CAAA,CAEZ,EAEKM,EAAeR,aAAW,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAO,IAEnDC,EAAAA,IAACC,EAAAA,OAAM,CAAA,SACJC,EAAAA,SAAS,IAAI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CAAAjB,GACCV,MAAC6B,EAAAA,QAAK,CAAA,KAAK,KAAK,OAAQ,CAAE,MAAOE,EAAAA,MAAM,sBAAsB,CAAG,EAAA,SAC7DrB,CAAc,CAAA,EAGlBa,GAAgB,CACf,GAAGA,EACH,MAAO,CACL,GAAGA,EAAa,MAChB,UAAYA,EAAa,MAAM,MAA4C,OAApCK,EAAAA,IAAI,CAAE,MAAO,kBAAmB,EACvE,MAAO,GACP,OAAQ,EACT,EACF,CACM,CAAA,CAAA,CAAA,CAAA,CAGf,CAAC,CACH,CAAC,EAEDtB,EAAqB,YAAc,yBAE7B0B,EAAmB,OAAO,OAAO1B,EAAsB,CAAE,YAAAV,EAAa,aAAAS,CAAY,CAAE"}
1
+ {"version":3,"file":"navigation-button.js","sources":["../../../../src/components/list-items/navigation-button.tsx"],"sourcesContent":["import { IcoExternalLink } from '@components/icons';\nimport { Text } from '@components/primitives';\nimport { css } from '@styled/css';\nimport { Center, HStack } from '@styled/jsx';\nimport { flex } from '@styled/patterns';\nimport { token } from '@styled/tokens';\nimport { createHost, createSlot } from 'create-slots';\nimport { Children, RefObject, cloneElement, forwardRef, useRef } from 'react';\nimport { AriaButtonProps, mergeProps, useButton, useFocusRing } from 'react-aria';\n\nexport interface NavigationButtonProps extends AriaButtonProps {\n primaryLabel: string;\n secondaryLabel?: string;\n isExternalLink?: boolean;\n disabled?: boolean;\n}\n\nconst LeadingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst TrailingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst NavigationButtonBase = forwardRef<HTMLButtonElement, NavigationButtonProps>((props, forwardedRef) => {\n const { primaryLabel, secondaryLabel, isExternalLink, disabled } = props;\n\n const internalRef = useRef(null);\n const ref = forwardedRef || internalRef;\n\n const { buttonProps } = useButton({ ...props, isDisabled: disabled ?? false }, ref as RefObject<HTMLButtonElement>);\n const { isFocusVisible, focusProps } = useFocusRing();\n\n return createHost(props.children, slots => {\n const leadingIcon = slots.get(LeadingIcon);\n const trailingIcon = slots.get(TrailingIcon);\n\n return (\n <button\n {...mergeProps(buttonProps, focusProps)}\n ref={ref}\n className={flex({\n justifyContent: 'space-between',\n alignItems: 'center',\n w: 'full',\n p: 4,\n bg: 'neutral.quaternary',\n transition: 'background-color 0.2s',\n _hover: { bg: 'neutral.secondary' },\n rounded: 'lg',\n cursor: 'pointer',\n outlineColor: 'brand.base',\n outlineStyle: isFocusVisible ? 'solid' : 'none',\n outlineWidth: 'thick',\n outlineOffset: 0.5,\n _disabled: { opacity: '0.3', pointerEvents: 'none' },\n })}\n >\n <HStack>\n {leadingIcon && {\n ...leadingIcon,\n props: {\n ...leadingIcon.props,\n className: !leadingIcon.props.color ? css({ color: 'brand.base' }) : undefined,\n height: 24,\n },\n }}\n <Text styles={{ fontWeight: 500 }}>{primaryLabel}</Text>\n {isExternalLink && <IcoExternalLink width={14} height={14} color={token('colors.neutral.primary')} />}\n </HStack>\n <HStack>\n {secondaryLabel && (\n <Text size=\"sm\" styles={{ color: token('colors.text.tertiary') }}>\n {secondaryLabel}\n </Text>\n )}\n {trailingIcon && {\n ...trailingIcon,\n props: {\n ...trailingIcon.props,\n className: !trailingIcon.props.color ? css({ color: 'neutral.primary' }) : undefined,\n width: 16,\n height: 16,\n },\n }}\n </HStack>\n </button>\n );\n });\n});\n\nNavigationButtonBase.displayName = 'NavigationButton';\n\nconst NavigationButton = Object.assign(NavigationButtonBase, { LeadingIcon, TrailingIcon });\n\nexport default NavigationButton;\n"],"names":["LeadingIcon","createSlot","children","props","_jsx","Center","Children","child","cloneElement","TrailingIcon","NavigationButtonBase","forwardRef","forwardedRef","primaryLabel","secondaryLabel","isExternalLink","disabled","internalRef","useRef","ref","buttonProps","useButton","isFocusVisible","focusProps","useFocusRing","createHost","slots","leadingIcon","trailingIcon","_jsxs","merg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Ae,MAAQ,CACrD,CAAA,EAED,SAAA,CAAAO,EAAAA,KAACG,EAAAA,OAAM,CAAA,SAAA,CACJL,GAAe,CACd,GAAGA,EACH,MAAO,CACL,GAAGA,EAAY,MACf,UAAYA,EAAY,MAAM,MAAuC,OAA/BM,EAAAA,IAAI,CAAE,MAAO,aAAc,EACjE,OAAQ,EACT,CACF,EACD7B,EAAAA,IAAC8B,UAAK,CAAA,OAAQ,CAAE,WAAY,GAAG,EAAK,SAAArB,IACnCE,GAAkBX,EAAAA,IAAC+B,EAAAA,QAAe,CAAC,MAAO,GAAI,OAAQ,GAAI,MAAOC,QAAM,wBAAwB,CAAC,CAAA,CAAI,CAC9F,CAAA,EACTP,EAAAA,KAACG,EAAAA,OACE,CAAA,SAAA,CAAAlB,GACCV,EAAAA,IAAC8B,EAAAA,QAAK,CAAA,KAAK,KAAK,OAAQ,CAAE,MAAOE,QAAM,sBAAsB,CAAG,EAAA,SAC7DtB,CAAc,CAAA,EAGlBc,GAAgB,CACf,GAAGA,EACH,MAAO,CACL,GAAGA,EAAa,MAChB,UAAYA,EAAa,MAAM,MAA4C,OAApCK,EAAAA,IAAI,CAAE,MAAO,kBAAmB,EACvE,MAAO,GACP,OAAQ,EACT,EACF,CACM,CAAA,CAAA,CAAA,CAAA,CAGf,CAAC,CACH,CAAC,EAEDvB,EAAqB,YAAc,mBAE7B2B,MAAAA,EAAmB,OAAO,OAAO3B,EAAsB,CAAE,YAAAV,EAAa,aAAAS,CAAY,CAAE"}
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as s}from"react/jsx-runtime";import{token as p}from"@styled/tokens";import I from"../icons/ico-external-link.js";import"../primitives/button.js";import"../primitives/checkbox.js";import"../primitives/popover.js";import"../primitives/radio.js";import"../primitives/segmented-control.js";import"../primitives/switch.js";import m from"../primitives/text.js";import{css as d}from"@styled/css";import{Center as u,HStack as h}from"@styled/jsx";import{flex as L}from"@styled/patterns";import{createSlot as f,createHost as B}from"create-slots";import{Children as g,cloneElement as b,forwardRef as F,useRef as P}from"react";import{useButton as R,useFocusRing as S,mergeProps as E}from"react-aria";const y=f(({children:r,...o})=>t(u,{children:g.map(r,e=>b(e,o))})),x=f(({children:r,...o})=>t(u,{children:g.map(r,e=>b(e,o))})),j=F((r,o)=>{const{primaryLabel:e,secondaryLabel:l,isExternalLink:k}=r,w=P(null),a=o||w,{buttonProps:N}=R(r,a),{isFocusVisible:v,focusProps:C}=S();return B(r.children,c=>{const i=c.get(y),n=c.get(x);return s("button",{...E(N,C),ref:a,className:L({justifyContent:"space-between",alignItems:"center",w:"full",p:4,bg:"neutral.quaternary",transition:"background-color 0.2s",_hover:{bg:"neutral.secondary"},rounded:"lg",cursor:"pointer",outlineColor:"brand.base",outlineStyle:v?"solid":"none",outlineWidth:"thick",outlineOffset:.5}),children:[s(h,{children:[i&&{...i,props:{...i.props,className:i.props.color?void 0:d({color:"brand.base"}),height:24}},t(m,{styles:{fontWeight:500},children:e}),k&&t(I,{width:14,height:14,color:p("colors.neutral.primary")})]}),s(h,{children:[l&&t(m,{size:"sm",styles:{color:p("colors.text.tertiary")},children:l}),n&&{...n,props:{...n.props,className:n.props.color?void 0:d({color:"neutral.primary"}),width:16,height:16}}]})]})})});j.displayName="NavigationButton";const H=Object.assign(j,{LeadingIcon:y,TrailingIcon:x});export{H as default};
1
+ import{jsx as t,jsxs as s}from"react/jsx-runtime";import{token as p}from"@styled/tokens";import L from"../icons/ico-external-link.js";import"../primitives/button.js";import"../primitives/checkbox.js";import"../primitives/popover.js";import"../primitives/radio.js";import"../primitives/segmented-control.js";import"../primitives/switch.js";import m from"../primitives/text.js";import{css as d}from"@styled/css";import{Center as u,HStack as h}from"@styled/jsx";import{flex as B}from"@styled/patterns";import{createSlot as f,createHost as E}from"create-slots";import{Children as b,cloneElement as g,forwardRef as H,useRef as P}from"react";import{useButton as R,useFocusRing as S,mergeProps as F}from"react-aria";const y=f(({children:r,...o})=>t(u,{children:b.map(r,e=>g(e,o))})),x=f(({children:r,...o})=>t(u,{children:b.map(r,e=>g(e,o))})),j=H((r,o)=>{const{primaryLabel:e,secondaryLabel:l,isExternalLink:k,disabled:v}=r,w=P(null),a=o||w,{buttonProps:N}=R({...r,isDisabled:v??!1},a),{isFocusVisible:C,focusProps:I}=S();return E(r.children,c=>{const i=c.get(y),n=c.get(x);return s("button",{...F(N,I),ref:a,className:B({justifyContent:"space-between",alignItems:"center",w:"full",p:4,bg:"neutral.quaternary",transition:"background-color 0.2s",_hover:{bg:"neutral.secondary"},rounded:"lg",cursor:"pointer",outlineColor:"brand.base",outlineStyle:C?"solid":"none",outlineWidth:"thick",outlineOffset:.5,_disabled:{opacity:"0.3",pointerEvents:"none"}}),children:[s(h,{children:[i&&{...i,props:{...i.props,className:i.props.color?void 0:d({color:"brand.base"}),height:24}},t(m,{styles:{fontWeight:500},children:e}),k&&t(L,{width:14,height:14,color:p("colors.neutral.primary")})]}),s(h,{children:[l&&t(m,{size:"sm",styles:{color:p("colors.text.tertiary")},children:l}),n&&{...n,props:{...n.props,className:n.props.color?void 0:d({color:"neutral.primary"}),width:16,height:16}}]})]})})});j.displayName="NavigationButton";const O=Object.assign(j,{LeadingIcon:y,TrailingIcon:x});export{O as default};
2
2
  //# sourceMappingURL=navigation-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-button.js","sources":["../../../../src/components/list-items/navigation-button.tsx"],"sourcesContent":["import { IcoExternalLink } from '@components/icons';\nimport { Text } from '@components/primitives';\nimport { css } from '@styled/css';\nimport { Center, HStack } from '@styled/jsx';\nimport { flex } from '@styled/patterns';\nimport { token } from '@styled/tokens';\nimport { createHost, createSlot } from 'create-slots';\nimport { Children, RefObject, cloneElement, forwardRef, useRef } from 'react';\nimport { AriaButtonProps, mergeProps, useButton, useFocusRing } from 'react-aria';\n\nexport interface NavigationButtonProps extends AriaButtonProps {\n primaryLabel: string;\n secondaryLabel?: string;\n isExternalLink?: boolean;\n}\n\nconst LeadingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst TrailingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst NavigationButtonBase = forwardRef<HTMLButtonElement, NavigationButtonProps>((props, forwardedRef) => {\n const { primaryLabel, secondaryLabel, isExternalLink } = props;\n\n const internalRef = useRef(null);\n const ref = forwardedRef || internalRef;\n\n const { buttonProps } = useButton(props, ref as RefObject<HTMLButtonElement>);\n const { isFocusVisible, focusProps } = useFocusRing();\n\n return createHost(props.children, slots => {\n const leadingIcon = slots.get(LeadingIcon);\n const trailingIcon = slots.get(TrailingIcon);\n\n return (\n <button\n {...mergeProps(buttonProps, focusProps)}\n ref={ref}\n className={flex({\n justifyContent: 'space-between',\n alignItems: 'center',\n w: 'full',\n p: 4,\n bg: 'neutral.quaternary',\n transition: 'background-color 0.2s',\n _hover: { bg: 'neutral.secondary' },\n rounded: 'lg',\n cursor: 'pointer',\n outlineColor: 'brand.base',\n outlineStyle: isFocusVisible ? 'solid' : 'none',\n outlineWidth: 'thick',\n outlineOffset: 0.5,\n })}\n >\n <HStack>\n {leadingIcon && {\n ...leadingIcon,\n props: {\n ...leadingIcon.props,\n className: !leadingIcon.props.color ? css({ color: 'brand.base' }) : undefined,\n height: 24,\n },\n }}\n <Text styles={{ fontWeight: 500 }}>{primaryLabel}</Text>\n {isExternalLink && <IcoExternalLink width={14} height={14} color={token('colors.neutral.primary')} />}\n </HStack>\n <HStack>\n {secondaryLabel && (\n <Text size=\"sm\" styles={{ color: token('colors.text.tertiary') }}>\n {secondaryLabel}\n </Text>\n )}\n {trailingIcon && {\n ...trailingIcon,\n props: {\n ...trailingIcon.props,\n className: !trailingIcon.props.color ? css({ color: 'neutral.primary' }) : undefined,\n width: 16,\n height: 16,\n },\n }}\n </HStack>\n </button>\n );\n });\n});\n\nNavigationButtonBase.displayName = 'NavigationButton';\n\nconst NavigationButton = Object.assign(NavigationButtonBase, { LeadingIcon, TrailingIcon });\n\nexport default NavigationButton;\n"],"names":["LeadingIcon","createSlot","children","props","_jsx","Center","Children","child","cloneElement","TrailingIcon","NavigationButtonBase","forwardRef","forwardedRef","primaryLabel","secondaryLabel","isExternalLink","internalRef","useRef","ref","buttonProps","useButton","isFocusVisible","focusProps","useFocusRing","createHost","slots","leadingIcon","trailingIcon","_jsxs","mergeProps","flex","HStack","css","Text","IcoExternalLink","token","NavigationButton"],"mappings":"qsBAgBA,MAAMA,EAAcC,EAAW,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAO,IAElDC,EAACC,EAAM,CAAA,SACJC,EAAS,IAAIJ,EAAUK,GACfC,EAAaD,EAAOJ,CAAK,CACjC,CACM,CAAA,CAEZ,EAEKM,EAAeR,EAAW,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAO,IAEnDC,EAACC,EAAM,CAAA,SACJC,EAAS,IAAIJ,EAAUK,GACfC,EAAaD,EAAOJ,CAAK,CACjC,CACM,CAAA,CAEZ,EAEKO,EAAuBC,EAAqD,CAACR,EAAOS,IAAgB,CACxG,KAAM,CAAE,aAAAC,EAAc,eAAAC,EAAgB,eAAAC,CAAc,EAAKZ,EAEnDa,EAAcC,EAAO,IAAI,EACzBC,EAAMN,GAAgBI,EAEtB,CAAE,YAAAG,CAAW,EAAKC,EAAUjB,EAAOe,CAAmC,EACtE,CAAE,eAAAG,EAAgB,WAAAC,GAAeC,IAEvC,OAAOC,EAAWrB,EAAM,SAAUsB,GAAQ,CACxC,MAAMC,EAAcD,EAAM,IAAIzB,CAAW,EACnC2B,EAAeF,EAAM,IAAIhB,CAAY,EAE3C,OACEmB,EACM,SAAA,CAAA,GAAAC,EAAWV,EAAaG,CAAU,EACtC,IAAKJ,EACL,UAAWY,EAAK,CACd,eAAgB,gBAChB,WAAY,SACZ,EAAG,OACH,EAAG,EACH,GAAI,qBACJ,WAAY,wBACZ,OAAQ,CAAE,GAAI,mBAAqB,EACnC,QAAS,KACT,OAAQ,UACR,aAAc,aACd,aAAcT,EAAiB,QAAU,OACzC,aAAc,QACd,cAAe,EAChB,CAAA,EAED,SAAA,CAAAO,EAACG,EAAM,CAAA,SAAA,CACJL,GAAe,CACd,GAAGA,EACH,MAAO,CACL,GAAGA,EAAY,MACf,UAAYA,EAAY,MAAM,MAAuC,OAA/BM,EAAI,CAAE,MAAO,aAAc,EACjE,OAAQ,EACT,CACF,EACD5B,EAAC6B,EAAK,CAAA,OAAQ,CAAE,WAAY,GAAG,EAAK,SAAApB,IACnCE,GAAkBX,EAAC8B,EAAe,CAAC,MAAO,GAAI,OAAQ,GAAI,MAAOC,EAAM,wBAAwB,CAAC,CAAA,CAAI,CAC9F,CAAA,EACTP,EAACG,EACE,CAAA,SAAA,CAAAjB,GACCV,EAAC6B,EAAK,CAAA,KAAK,KAAK,OAAQ,CAAE,MAAOE,EAAM,sBAAsB,CAAG,EAAA,SAC7DrB,CAAc,CAAA,EAGlBa,GAAgB,CACf,GAAGA,EACH,MAAO,CACL,GAAGA,EAAa,MAChB,UAAYA,EAAa,MAAM,MAA4C,OAApCK,EAAI,CAAE,MAAO,kBAAmB,EACvE,MAAO,GACP,OAAQ,EACT,EACF,CACM,CAAA,CAAA,CAAA,CAAA,CAGf,CAAC,CACH,CAAC,EAEDtB,EAAqB,YAAc,yBAE7B0B,EAAmB,OAAO,OAAO1B,EAAsB,CAAE,YAAAV,EAAa,aAAAS,CAAY,CAAE"}
1
+ {"version":3,"file":"navigation-button.js","sources":["../../../../src/components/list-items/navigation-button.tsx"],"sourcesContent":["import { IcoExternalLink } from '@components/icons';\nimport { Text } from '@components/primitives';\nimport { css } from '@styled/css';\nimport { Center, HStack } from '@styled/jsx';\nimport { flex } from '@styled/patterns';\nimport { token } from '@styled/tokens';\nimport { createHost, createSlot } from 'create-slots';\nimport { Children, RefObject, cloneElement, forwardRef, useRef } from 'react';\nimport { AriaButtonProps, mergeProps, useButton, useFocusRing } from 'react-aria';\n\nexport interface NavigationButtonProps extends AriaButtonProps {\n primaryLabel: string;\n secondaryLabel?: string;\n isExternalLink?: boolean;\n disabled?: boolean;\n}\n\nconst LeadingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst TrailingIcon = createSlot(({ children, ...props }) => {\n return (\n <Center>\n {Children.map(children, child => {\n return cloneElement(child, props);\n })}\n </Center>\n );\n});\n\nconst NavigationButtonBase = forwardRef<HTMLButtonElement, NavigationButtonProps>((props, forwardedRef) => {\n const { primaryLabel, secondaryLabel, isExternalLink, disabled } = props;\n\n const internalRef = useRef(null);\n const ref = forwardedRef || internalRef;\n\n const { buttonProps } = useButton({ ...props, isDisabled: disabled ?? false }, ref as RefObject<HTMLButtonElement>);\n const { isFocusVisible, focusProps } = useFocusRing();\n\n return createHost(props.children, slots => {\n const leadingIcon = slots.get(LeadingIcon);\n const trailingIcon = slots.get(TrailingIcon);\n\n return (\n <button\n {...mergeProps(buttonProps, focusProps)}\n ref={ref}\n className={flex({\n justifyContent: 'space-between',\n alignItems: 'center',\n w: 'full',\n p: 4,\n bg: 'neutral.quaternary',\n transition: 'background-color 0.2s',\n _hover: { bg: 'neutral.secondary' },\n rounded: 'lg',\n cursor: 'pointer',\n outlineColor: 'brand.base',\n outlineStyle: isFocusVisible ? 'solid' : 'none',\n outlineWidth: 'thick',\n outlineOffset: 0.5,\n _disabled: { opacity: '0.3', pointerEvents: 'none' },\n })}\n >\n <HStack>\n {leadingIcon && {\n ...leadingIcon,\n props: {\n ...leadingIcon.props,\n className: !leadingIcon.props.color ? css({ color: 'brand.base' }) : undefined,\n height: 24,\n },\n }}\n <Text styles={{ fontWeight: 500 }}>{primaryLabel}</Text>\n {isExternalLink && <IcoExternalLink width={14} height={14} color={token('colors.neutral.primary')} />}\n </HStack>\n <HStack>\n {secondaryLabel && (\n <Text size=\"sm\" styles={{ color: token('colors.text.tertiary') }}>\n {secondaryLabel}\n </Text>\n )}\n {trailingIcon && {\n ...trailingIcon,\n props: {\n ...trailingIcon.props,\n className: !trailingIcon.props.color ? css({ color: 'neutral.primary' }) : undefined,\n width: 16,\n height: 16,\n },\n }}\n </HStack>\n </button>\n );\n });\n});\n\nNavigationButtonBase.displayName = 'NavigationButton';\n\nconst NavigationButton = Object.assign(NavigationButtonBase, { LeadingIcon, TrailingIcon });\n\nexport default NavigationButton;\n"],"names":["LeadingIcon","createSlot","children","props","_jsx","Center","Children","child","cloneElement","TrailingIcon","NavigationButtonBase","forwardRef","forwardedRef","primaryLabel","secondaryLabel","isExternalLink","disabled","internalRef","useRef","ref","buttonProps","useButton","isFocusVisible","focusProps","useFocusRing","createHost","slots","leadingIcon","trailingIcon","_jsxs","mergeProps","flex","HStack","css","Text","IcoExternalLink","token","NavigationButton"],"mappings":"qsBAiBA,MAAMA,EAAcC,EAAW,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAO,IAElDC,EAACC,EAAM,CAAA,SACJC,EAAS,IAAIJ,EAAUK,GACfC,EAAaD,EAAOJ,CAAK,CACjC,CACM,CAAA,CAEZ,EAEKM,EAAeR,EAAW,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAO,IAEnDC,EAACC,EAAM,CAAA,SACJC,EAAS,IAAIJ,EAAUK,GACfC,EAAaD,EAAOJ,CAAK,CACjC,CACM,CAAA,CAEZ,EAEKO,EAAuBC,EAAqD,CAACR,EAAOS,IAAgB,CACxG,KAAM,CAAE,aAAAC,EAAc,eAAAC,EAAgB,eAAAC,EAAgB,SAAAC,CAAQ,EAAKb,EAE7Dc,EAAcC,EAAO,IAAI,EACzBC,EAAMP,GAAgBK,EAEtB,CAAE,YAAAG,CAAa,EAAGC,EAAU,CAAE,GAAGlB,EAAO,WAAYa,GAAY,EAAO,EAAEG,CAAmC,EAC5G,CAAE,eAAAG,EAAgB,WAAAC,GAAeC,EAAAA,EAEvC,OAAOC,EAAWtB,EAAM,SAAUuB,GAAQ,CACxC,MAAMC,EAAcD,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@@ export interface NavigationButtonProps extends AriaButtonProps {
4
4
  primaryLabel: string;
5
5
  secondaryLabel?: string;
6
6
  isExternalLink?: boolean;
7
+ disabled?: boolean;
7
8
  }
8
9
  declare const NavigationButton: import("react").ForwardRefExoticComponent<NavigationButtonProps & import("react").RefAttributes<HTMLButtonElement>> & {
9
10
  LeadingIcon: ({ children, ...props }: any) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-button.d.ts","sourceRoot":"","sources":["../../../../src/components/list-items/navigation-button.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAuC,MAAM,YAAY,CAAC;AAElF,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA0FD,QAAA,MAAM,gBAAgB;;;CAAqE,CAAC;AAE5F,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"navigation-button.d.ts","sourceRoot":"","sources":["../../../../src/components/list-items/navigation-button.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAuC,MAAM,YAAY,CAAC;AAElF,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA2FD,QAAA,MAAM,gBAAgB;;;CAAqE,CAAC;AAE5F,eAAe,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magiclabs/ui-components",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "description": "💅 A theme-able library of reusable UI components",
5
5
  "author": "Magic Labs <open-source@magic.link>",
6
6
  "repository": {