@yahoo/uds 1.7.3 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/cli/bin/uds-darwin-arm64-baseline +0 -0
  2. package/cli/bin/uds-linux-x64-baseline +0 -0
  3. package/cli/commands/codemod/codemod.ts +12 -9
  4. package/cli/commands/login.ts +2 -0
  5. package/cli/commands/logout.ts +3 -0
  6. package/cli/commands/purge.ts +2 -0
  7. package/cli/commands/sync.ts +2 -0
  8. package/cli/commands/uds.ts +2 -0
  9. package/cli/commands/version.ts +2 -0
  10. package/cli/tsconfig.json +4 -4
  11. package/cli/utils/analytics.ts +30 -0
  12. package/cli/utils/auth.ts +2 -2
  13. package/cli/utils/configWorker.ts +3 -2
  14. package/dist/analytics/server.cjs +1 -0
  15. package/dist/analytics/server.d.cts +1 -0
  16. package/dist/analytics/server.d.ts +1 -0
  17. package/dist/analytics/server.js +1 -0
  18. package/dist/chunk-3LHMB72F.cjs +1 -2
  19. package/dist/chunk-AWEUIM22.cjs +1 -3
  20. package/dist/chunk-FK7UKIGU.js +2 -0
  21. package/dist/chunk-FRZFCKD2.js +1 -2
  22. package/dist/chunk-J6D4HCFT.cjs +1 -2
  23. package/dist/chunk-LNFRMD6G.cjs +1 -2
  24. package/dist/chunk-LPM6JKIW.js +1 -2
  25. package/dist/chunk-PECN66KD.cjs +1 -3
  26. package/dist/chunk-PSTMMXTR.js +1 -2
  27. package/dist/chunk-QELQ6JY6.cjs +2 -0
  28. package/dist/chunk-RGE634O5.js +1 -2
  29. package/dist/chunk-SSMBE7SI.cjs +1 -2
  30. package/dist/chunk-VZAZKBYK.cjs +1 -2
  31. package/dist/chunk-WLOEKYUI.cjs +2 -4
  32. package/dist/chunk-YRYDHL65.js +1 -2
  33. package/dist/client/index.cjs +2 -3
  34. package/dist/client/index.js +3 -5
  35. package/dist/experimental/index.cjs +2 -3
  36. package/dist/experimental/index.js +2 -3
  37. package/dist/fixtures.cjs +1 -1
  38. package/dist/fixtures.js +1 -1
  39. package/dist/flags.cjs +1 -0
  40. package/dist/flags.d.cts +22 -0
  41. package/dist/flags.d.ts +22 -0
  42. package/dist/flags.js +2 -0
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.d.cts +1 -22
  45. package/dist/index.d.ts +1 -22
  46. package/dist/index.js +1 -2
  47. package/dist/metafile-cjs.json +1 -1
  48. package/dist/metafile-esm.json +1 -1
  49. package/dist/tailwind/plugin.cjs +2 -3
  50. package/dist/tailwind/plugin.js +2 -3
  51. package/dist/tailwind/purger.cjs +1 -2
  52. package/dist/tailwind/tsMorph.cjs +1 -3
  53. package/dist/tailwind/tsMorph.js +1 -2
  54. package/dist/tokens/index.cjs +1 -1
  55. package/dist/tokens/index.js +1 -1
  56. package/package.json +23 -3
  57. package/cli/codemods/propsToClass.test.tsx +0 -97
  58. package/cli/utils/auth.test.ts +0 -202
  59. package/cli/utils/purgeCSS.test.ts +0 -210
  60. package/dist/chunk-KEQTRKKF.js +0 -3
  61. package/dist/chunk-RILYWBPB.cjs +0 -1
@@ -1,3 +1,2 @@
1
- "use strict";var e=require("../chunk-AWEUIM22.cjs"),t=require("../chunk-SSMBE7SI.cjs"),o=require("../chunk-PECN66KD.cjs"),i=require("../chunk-WLOEKYUI.cjs"),n=require("../chunk-3LHMB72F.cjs"),r=require("../chunk-J6D4HCFT.cjs"),a=require("../chunk-VZAZKBYK.cjs"),s=require("@yahoo/uds/fixtures"),l=require("tailwindcss/plugin"),d=require("tailwindcss/defaultTheme");function u(e){return e&&e.__esModule?e:{default:e}}var c=u(l),_=u(d);function f(e,t,o){const i=e[t],n=o?.[i];return n?`var(${i}, ${n})`:`var(${i})`}function S(e,{type:t,value:o},i){const n="color"===e?"textColor":e;if("palette"===t)return s.alwaysPaletteAliases.includes(o)?o:i(`${n}.${o}`);{const[e,t]=o.split("-");return i(`colors.${e}.${t}`)}}function A({scale:e}){return s.scaleEffectMap[e].sm}function T({backgroundColor:e,borderColor:t,color:o,borderRadius:i,borderWidth:n},a){return{[r.BUTTON_CSS_VAR_MAP.backgroundColor]:S("backgroundColor",e,a),[r.BUTTON_CSS_VAR_MAP.borderColor]:S("borderColor",t,a),[r.BUTTON_CSS_VAR_MAP.color]:S("color",o,a),...i&&{[r.BUTTON_CSS_VAR_MAP.borderRadius]:a(`borderRadius.${i}`)},...n&&{[r.BUTTON_CSS_VAR_MAP.borderWidth]:a(`borderWidth.${n}`)}}}function C(e,t){const{spacingHorizontal:o,spacingVertical:i,gap:n,textVariant:a,iconSize:s}=e,l=t(`typography.lineHeight.${a}`),d=t(`sizing.icon.${s}`);return{[r.BUTTON_CSS_VAR_MAP.padding]:`${t(`spacing[${i}]`)} ${t(`spacing[${o}]`)}`,[r.BUTTON_CSS_VAR_MAP.columnGap]:t(`spacing[${n}]`),[r.BUTTON_CSS_VAR_MAP.fontFamily]:t(`typography.fontFamily.${a}`),[r.BUTTON_CSS_VAR_MAP.fontWeight]:t(`typography.fontWeight.${a}`),[r.BUTTON_CSS_VAR_MAP.fontSize]:t(`typography.fontSize.${a}`),[r.BUTTON_CSS_VAR_MAP.lineHeight]:`max(${l}, ${d})`,[r.BUTTON_CSS_VAR_MAP.textTransform]:t(`typography.textTransform.${a}`),[r.BUTTON_CSS_VAR_MAP.iconSize]:t(`sizing.icon.${s}`)}}function g(e,t){const o=e.palette[e.defaults.palette][e.defaults.variant],i=e.size[e.defaults.size],a=o.base.scale,l=o.effect.hover.scale.value,d=o.effect.pressed.scale.value,u={...T(o.base,t),...C(i,t),[r.BUTTON_CSS_VAR_MAP.effects.scale.rest]:A({scale:a}),[r.BUTTON_CSS_VAR_MAP.effects.scale.hover]:A({scale:l}),[r.BUTTON_CSS_VAR_MAP.effects.scale.pressed]:A({scale:d})},c={borderRadius:f(r.BUTTON_CSS_VAR_MAP,"borderRadius",u),boxShadow:`inset 0 0 0 ${f(r.BUTTON_CSS_VAR_MAP,"borderWidth",u)} ${f(r.BUTTON_CSS_VAR_MAP,"borderColor",u)}`,color:f(r.BUTTON_CSS_VAR_MAP,"color",u),backgroundColor:f(r.BUTTON_CSS_VAR_MAP,"backgroundColor",u),padding:f(r.BUTTON_CSS_VAR_MAP,"padding",u),fontFamily:f(r.BUTTON_CSS_VAR_MAP,"fontFamily",u),fontWeight:f(r.BUTTON_CSS_VAR_MAP,"fontWeight",u),fontSize:f(r.BUTTON_CSS_VAR_MAP,"fontSize",u),lineHeight:f(r.BUTTON_CSS_VAR_MAP,"lineHeight",u),textTransform:f(r.BUTTON_CSS_VAR_MAP,"textTransform",u),display:"inline-flex",justifyContent:"center",overflow:"hidden",alignItems:"center",whiteSpace:"nowrap",userSelect:"none",...u,transitionProperty:"color, background-color, border-color, text-decoration-color, fill, stroke",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"220ms"},_=T(o.state.hover,t),S=T(o.state.pressed,t),g={cursor:"not-allowed",opacity:"0.2",[r.BUTTON_CSS_VAR_MAP.effects.scale.hover]:A({scale:"none"}),[r.BUTTON_CSS_VAR_MAP.effects.scale.pressed]:A({scale:"none"})},p={".uds-button":c,".uds-button .uds-button-icon":{width:f(r.BUTTON_CSS_VAR_MAP,"iconSize",u),height:f(r.BUTTON_CSS_VAR_MAP,"iconSize",u)},[`.uds-button${r.PSEUDO_STYLE_SELECTOR_MAP.hover}`]:_,[`.uds-button${r.PSEUDO_STYLE_SELECTOR_MAP.pressed}`]:S,[`.uds-button${r.PSEUDO_STYLE_SELECTOR_MAP.disabled}`]:g,".disabled .uds-button":g},h={".hover":{".uds-button":_},".pressed":{".uds-button":S}};for(const[o,i]of n.entries(e.size))p[`.uds-button-${o}`]=C(i,t);function E(o,{palette:i,variant:n}){const a=e.palette[i][n],s=a.base,l=a.state,d=a.effect,u={rest:{...T(s,t)},restScale:{[r.BUTTON_CSS_VAR_MAP.effects.scale.rest]:A({scale:s.scale}),[r.BUTTON_CSS_VAR_MAP.effects.scale.hover]:A({scale:d.hover.scale.value}),[r.BUTTON_CSS_VAR_MAP.effects.scale.pressed]:A({scale:d.pressed.scale.value})},hover:T(l.hover,t),pressed:T(l.pressed,t)};p[o]=u.rest,p[`${o}${r.PSEUDO_STYLE_SELECTOR_MAP.notDisabled}`]=u.restScale,p[`${o}${r.PSEUDO_STYLE_SELECTOR_MAP.hover}`]=u.hover,p[`${o}${r.PSEUDO_STYLE_SELECTOR_MAP.pressed}`]=u.pressed,h[".hover"][o]=u.hover,h[".pressed"][o]=u.pressed}for(const t of s.buttonPalettes){E(`.uds-button-${t}`,{palette:t,variant:e.defaults.variant});for(const o of s.buttonVariants)E(`.uds-button-${t}.uds-button-${o}`,{palette:t,variant:o}),t===e.defaults.palette&&E(`.uds-button-${o}`,{palette:t,variant:o})}return{...p,...h}}var p={outlineOffset:"var(--uds-outline-offset)",outlineWidth:"var(--uds-outline-width)",outlineColor:"var(--uds-outline-color)",outlineStyle:"var(--uds-outline-style)"};var h="44px";function E(e,t){const{spacing:o,iconSize:i}=e;return{[r.ICON_BUTTON_CSS_VAR_MAP.padding]:t(`spacing[${o}]`),[r.ICON_BUTTON_CSS_VAR_MAP.iconSize]:t(`sizing.icon.${i}`)}}function O(e,t){const o=E(e.size[e.defaults.size],t),i={".uds-icon-button":{display:"inline-flex",alignItems:"center",...{padding:f(r.ICON_BUTTON_CSS_VAR_MAP,"padding",o)}},".uds-icon-button .uds-button-icon":{width:f(r.ICON_BUTTON_CSS_VAR_MAP,"iconSize",o),height:f(r.ICON_BUTTON_CSS_VAR_MAP,"iconSize",o)}};for(const[o,r]of n.entries(e.size))i[`.uds-icon-button-${o}`]=E(r,t);return i}var M={display1:"6xl",display2:"5xl",display3:"4xl",title1:"3xl",title2:"2xl",title3:"xl",title4:"lg",headline1:"base",body1:"base",label1:"sm",label2:"sm",caption1:"xs",caption2:"xs"},b={fontSize:M,lineHeight:M,borderRadius:{xs:"sm",sm:"DEFAULT",md:"md",lg:"lg",xl:"xl"},borderWidth:{thin:"DEFAULT",medium:"2",thick:"4"}};function R(e){return e.endsWith("rem")?16*parseFloat(e):parseFloat(e)}var m={...i.defaultTokensConfig.scaleMode[i.DEFAULT_SCALE_MODE],fontSize:{...i.defaultTokensConfig.scaleMode[i.DEFAULT_SCALE_MODE].fontSize,...n.mapValues(b.fontSize,(e=>R(_.default.fontSize[e][0])))},lineHeight:{...i.defaultTokensConfig.scaleMode[i.DEFAULT_SCALE_MODE].fontSize,...n.mapValues(b.lineHeight,(e=>R(_.default.fontSize[e][1].lineHeight))),display1:R(_.default.fontSize[b.fontSize.display1][0]),display2:R(_.default.fontSize[b.fontSize.display2][0])},fontWeight:n.mapValues(i.defaultTokensConfig.scaleMode[i.DEFAULT_SCALE_MODE].fontWeight,(()=>"regular")),borderRadius:{...i.defaultTokensConfig.scaleMode[i.DEFAULT_SCALE_MODE].borderRadius,...n.mapValues(b.borderRadius,(e=>R(_.default.borderRadius[e])))},borderWidth:{...i.defaultTokensConfig.scaleMode[i.DEFAULT_SCALE_MODE].borderWidth,...n.mapValues(b.borderWidth,(e=>R(_.default.borderWidth[e])))}};function L(e){return{...i.defaultTokensConfig.scaleMode[e],fontWeight:m.fontWeight,fontSize:n.mapValues(m.fontSize,((t,o)=>t+s.fontSizeRamp[e][o])),lineHeight:n.mapValues(m.lineHeight,((t,o)=>t+s.lineHeightRamp[e][o])),borderRadius:n.mapValues(m.borderRadius,((t,o)=>t+s.borderRadiusRamp[e][o])),borderWidth:n.mapValues(m.borderWidth,((t,o)=>t+s.borderWidthRamp[e][o]))}}var U={...i.defaultTokensConfig,scaleMode:{xSmall:L("xSmall"),small:L("small"),medium:L("medium"),large:L("large"),xLarge:L("xLarge"),xxLarge:L("xxLarge"),xxxLarge:L("xxxLarge")}};var v=c.default.withOptions((function({config:n=i.defaultTokensConfig,disableFontFaceDeclarations:a=!1}){return function({addBase:s,matchUtilities:l,addComponents:d,theme:u}){const c=e.parseTokens(n),_=Object.values(n.font);if(!1===a&&t.addFontFaceDeclarations(_,s),function(e,o){o({":root":t.getFontStyles(e)})}(n.font,s),
2
- /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
3
- function(e,o){const n=t.getColorModeStyles(e);o({":root":n[i.DEFAULT_COLOR_MODE],[`.${r.LIGHT_COLOR_MODE_CLASSNAME}`]:n.light,[`.${r.DARK_COLOR_MODE_CLASSNAME}`]:n.dark})}(c,s),function(e,o){const n=t.getScaleModeStyles(e);o({":root":n[i.DEFAULT_SCALE_MODE],[`.${r.XSMALL_SCALE_MODE_CLASSNAME}`]:n.xSmall,[`.${r.SMALL_SCALE_MODE_CLASSNAME}`]:n.small,[`.${r.MEDIUM_SCALE_MODE_CLASSNAME}`]:n.medium,[`.${r.LARGE_SCALE_MODE_CLASSNAME}`]:n.large,[`.${r.XLARGE_SCALE_MODE_CLASSNAME}`]:n.xLarge,[`.${r.XXLARGE_SCALE_MODE_CLASSNAME}`]:n.xxLarge,[`.${r.XXXLARGE_SCALE_MODE_CLASSNAME}`]:n.xxxLarge})}(c,s),n.button){const e=function(e,t){return g(e,t)}(n.button,u);d(e)}if(n.iconButton){const e=function(e,t){return O(e,t)}(n.iconButton,u);d(e)}n.motion&&function(e,t){t({":root":o.getMotionStyles(e)})}(n.motion,s);s({".uds-hit-target":{position:"relative"},".uds-hit-target::before":{"@media (hover: none)":{content:"''",position:"absolute",top:"50%",left:"50%",width:`max(${h}, 100%)`,height:`max(${h}, 100%)`,transform:"translate(-50%, -50%)"}}});const f=function({theme:e}){return{".uds-ring":{"--uds-outline-offset":e("outlineOffset.DEFAULT"),"--uds-outline-width":e("outlineWidth.DEFAULT"),"--uds-outline-color":e("outlineColor.DEFAULT"),"--uds-outline-style":"solid"},[`.uds-ring${r.PSEUDO_STYLE_SELECTOR_MAP.focused}`]:p,".focused .uds-ring":p}}({theme:u});s(f),l({iconSize:e=>({width:e,height:e,fontSize:e,lineHeight:e})},{values:u("sizing.icon")}),l({avatarSize:e=>({width:e,height:e})},{values:u("sizing.avatar")}),l({case:e=>({"text-transform":e})},{values:u("typography.textTransform")}),l({"font-weight":e=>({"font-weight":e})},{values:u("typography.fontWeight")}),l({"font-size":e=>({"font-size":e})},{values:u("typography.fontSize")})}}),(function({config:t=i.defaultTokensConfig,safelist:o=[]}){const a=e.parseTokens(t),l=a.colorMode[i.DEFAULT_COLOR_MODE].tailwindConfig,d=a.scaleMode[i.DEFAULT_SCALE_MODE],u=n.mapValues(l.spectrum,((e,t)=>({...e,...s.tailwindColorsAsUds[t]}))),c=l.palette.core,_={...s.tailwindColorsAsUds,...u,...i.alwaysPalette,...c},f=l.palette.foreground,S=l.palette.background,A=l.palette.line,T=i.fromEntries(n.entries(b.fontSize).map((([e,t])=>[t,[`var(--${r.FONT_SIZE_PREFIX}-${e})`,{lineHeight:`var(--${r.LINE_HEIGHT_PREFIX}-${e})`}]]))),C=i.fromEntries(n.entries(b.borderRadius).map((([e,t])=>[t,`var(--${r.BORDER_RADIUS_PREFIX}-${e})`]))),g={...d.borderRadius.tailwindConfig,...C},p=i.fromEntries(n.entries(b.borderWidth).map((([e,t])=>[t,`var(--${r.BORDER_WIDTH_PREFIX}-${e})`]))),h={...d.borderWidth.tailwindConfig,...p};return{darkMode:["class",r.DARK_COLOR_MODE_CLASSNAME],safelist:[r.DARK_COLOR_MODE_CLASSNAME,...o],theme:{extend:{aria:{checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',invalid:'aria-invalid="true"'},data:{active:'active="true"',"active-item":'active-item="true"',autofill:'autofill="true"',backdrop:'backdrop="true"',enter:'enter="true"',leave:'leave="true"',"focus-visible":'focus-visible="true"'},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},borderRadius:g,borderWidth:h,outlineWidth:{...h,DEFAULT:"2px"},outlineOffset:{...h,DEFAULT:"2px"},outlineColor:({theme:e})=>({...A,DEFAULT:e("colors.accent")}),fontFamily:{...Object.fromEntries(s.fontAliases.map((e=>[e,`var(--${r.FONT_FAMILY_PREFIX}-${e})`]))),...Object.fromEntries(s.textVariants.map((e=>[e,`var(--${r.FONT_FAMILY_PREFIX}-${e})`])))},fontSize:T,lineHeight:d.lineHeight.tailwindConfig,colors:_,backgroundColor:S,textColor:f,borderColor:A,fill:S,caretColor:f,placeholderColor:f,textDecorationColor:f,divideColor:A,ringColor:A,ringOffsetColor:A,stroke:A,typography:{fontFamily:d.fontFamily.tailwindConfig,fontWeight:d.fontWeight.tailwindConfig,fontSize:d.fontSize.tailwindConfig,lineHeight:d.lineHeight.tailwindConfig,textTransform:d.textTransform.tailwindConfig},sizing:{icon:d.iconSizes.tailwindConfig,avatar:d.avatarSizes.tailwindConfig}}}}}));exports.defaultTailwindThemeAsUdsConfig=U,exports.getButtonColorForProperty=S,exports.getButtonStyles=g,exports.getIconButtonStyles=O,exports.getUDSContent=()=>[a.__require.resolve("@yahoo/uds"),a.__require.resolve("@yahoo/uds/client"),a.__require.resolve("@yahoo/uds/experimental")],exports.tailwindPlugin=v,exports.udsToTailwindMap=b;
1
+ "use strict";var e=require("../chunk-SSMBE7SI.cjs"),t=require("../chunk-PECN66KD.cjs"),o=require("../chunk-WLOEKYUI.cjs"),i=require("../chunk-AWEUIM22.cjs"),n=require("../chunk-3LHMB72F.cjs"),r=require("../chunk-J6D4HCFT.cjs"),a=require("../chunk-VZAZKBYK.cjs"),s=require("@yahoo/uds/fixtures"),l=require("tailwindcss/plugin"),d=require("tailwindcss/defaultTheme");function u(e){return e&&e.__esModule?e:{default:e}}var c=u(l),_=u(d);function f(e,t,o){const i=e[t],n=o?.[i];return n?`var(${i}, ${n})`:`var(${i})`}function S(e,{type:t,value:o},i){const n="color"===e?"textColor":e;if("palette"===t)return s.alwaysPaletteAliases.includes(o)?o:i(`${n}.${o}`);{const[e,t]=o.split("-");return i(`colors.${e}.${t}`)}}function A({scale:e}){return s.scaleEffectMap[e].sm}function T({backgroundColor:e,borderColor:t,color:o,borderRadius:i,borderWidth:n},a){return{[r.BUTTON_CSS_VAR_MAP.backgroundColor]:S("backgroundColor",e,a),[r.BUTTON_CSS_VAR_MAP.borderColor]:S("borderColor",t,a),[r.BUTTON_CSS_VAR_MAP.color]:S("color",o,a),...i&&{[r.BUTTON_CSS_VAR_MAP.borderRadius]:a(`borderRadius.${i}`)},...n&&{[r.BUTTON_CSS_VAR_MAP.borderWidth]:a(`borderWidth.${n}`)}}}function C(e,t){const{spacingHorizontal:o,spacingVertical:i,gap:n,textVariant:a,iconSize:s}=e,l=t(`typography.lineHeight.${a}`),d=t(`sizing.icon.${s}`);return{[r.BUTTON_CSS_VAR_MAP.padding]:`${t(`spacing[${i}]`)} ${t(`spacing[${o}]`)}`,[r.BUTTON_CSS_VAR_MAP.columnGap]:t(`spacing[${n}]`),[r.BUTTON_CSS_VAR_MAP.fontFamily]:t(`typography.fontFamily.${a}`),[r.BUTTON_CSS_VAR_MAP.fontWeight]:t(`typography.fontWeight.${a}`),[r.BUTTON_CSS_VAR_MAP.fontSize]:t(`typography.fontSize.${a}`),[r.BUTTON_CSS_VAR_MAP.lineHeight]:`max(${l}, ${d})`,[r.BUTTON_CSS_VAR_MAP.textTransform]:t(`typography.textTransform.${a}`),[r.BUTTON_CSS_VAR_MAP.iconSize]:t(`sizing.icon.${s}`)}}function g(e,t){const o=e.palette[e.defaults.palette][e.defaults.variant],i=e.size[e.defaults.size],a=o.base.scale,l=o.effect.hover.scale.value,d=o.effect.pressed.scale.value,u={...T(o.base,t),...C(i,t),[r.BUTTON_CSS_VAR_MAP.effects.scale.rest]:A({scale:a}),[r.BUTTON_CSS_VAR_MAP.effects.scale.hover]:A({scale:l}),[r.BUTTON_CSS_VAR_MAP.effects.scale.pressed]:A({scale:d})},c={borderRadius:f(r.BUTTON_CSS_VAR_MAP,"borderRadius",u),boxShadow:`inset 0 0 0 ${f(r.BUTTON_CSS_VAR_MAP,"borderWidth",u)} ${f(r.BUTTON_CSS_VAR_MAP,"borderColor",u)}`,color:f(r.BUTTON_CSS_VAR_MAP,"color",u),backgroundColor:f(r.BUTTON_CSS_VAR_MAP,"backgroundColor",u),padding:f(r.BUTTON_CSS_VAR_MAP,"padding",u),fontFamily:f(r.BUTTON_CSS_VAR_MAP,"fontFamily",u),fontWeight:f(r.BUTTON_CSS_VAR_MAP,"fontWeight",u),fontSize:f(r.BUTTON_CSS_VAR_MAP,"fontSize",u),lineHeight:f(r.BUTTON_CSS_VAR_MAP,"lineHeight",u),textTransform:f(r.BUTTON_CSS_VAR_MAP,"textTransform",u),display:"inline-flex",justifyContent:"center",overflow:"hidden",alignItems:"center",whiteSpace:"nowrap",userSelect:"none",...u,transitionProperty:"color, background-color, border-color, text-decoration-color, fill, stroke",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"220ms"},_=T(o.state.hover,t),S=T(o.state.pressed,t),g={cursor:"not-allowed",opacity:"0.2",[r.BUTTON_CSS_VAR_MAP.effects.scale.hover]:A({scale:"none"}),[r.BUTTON_CSS_VAR_MAP.effects.scale.pressed]:A({scale:"none"})},p={".uds-button":c,".uds-button .uds-button-icon":{width:f(r.BUTTON_CSS_VAR_MAP,"iconSize",u),height:f(r.BUTTON_CSS_VAR_MAP,"iconSize",u)},[`.uds-button${r.PSEUDO_STYLE_SELECTOR_MAP.hover}`]:_,[`.uds-button${r.PSEUDO_STYLE_SELECTOR_MAP.pressed}`]:S,[`.uds-button${r.PSEUDO_STYLE_SELECTOR_MAP.disabled}`]:g,".disabled .uds-button":g},h={".hover":{".uds-button":_},".pressed":{".uds-button":S}};for(const[o,i]of n.entries(e.size))p[`.uds-button-${o}`]=C(i,t);function E(o,{palette:i,variant:n}){const a=e.palette[i][n],s=a.base,l=a.state,d=a.effect,u={rest:{...T(s,t)},restScale:{[r.BUTTON_CSS_VAR_MAP.effects.scale.rest]:A({scale:s.scale}),[r.BUTTON_CSS_VAR_MAP.effects.scale.hover]:A({scale:d.hover.scale.value}),[r.BUTTON_CSS_VAR_MAP.effects.scale.pressed]:A({scale:d.pressed.scale.value})},hover:T(l.hover,t),pressed:T(l.pressed,t)};p[o]=u.rest,p[`${o}${r.PSEUDO_STYLE_SELECTOR_MAP.notDisabled}`]=u.restScale,p[`${o}${r.PSEUDO_STYLE_SELECTOR_MAP.hover}`]=u.hover,p[`${o}${r.PSEUDO_STYLE_SELECTOR_MAP.pressed}`]=u.pressed,h[".hover"][o]=u.hover,h[".pressed"][o]=u.pressed}for(const t of s.buttonPalettes){E(`.uds-button-${t}`,{palette:t,variant:e.defaults.variant});for(const o of s.buttonVariants)E(`.uds-button-${t}.uds-button-${o}`,{palette:t,variant:o}),t===e.defaults.palette&&E(`.uds-button-${o}`,{palette:t,variant:o})}return{...p,...h}}var p={outlineOffset:"var(--uds-outline-offset)",outlineWidth:"var(--uds-outline-width)",outlineColor:"var(--uds-outline-color)",outlineStyle:"var(--uds-outline-style)"};var h="44px";function E(e,t){const{spacing:o,iconSize:i}=e;return{[r.ICON_BUTTON_CSS_VAR_MAP.padding]:t(`spacing[${o}]`),[r.ICON_BUTTON_CSS_VAR_MAP.iconSize]:t(`sizing.icon.${i}`)}}function O(e,t){const o=E(e.size[e.defaults.size],t),i={".uds-icon-button":{display:"inline-flex",alignItems:"center",...{padding:f(r.ICON_BUTTON_CSS_VAR_MAP,"padding",o)}},".uds-icon-button .uds-button-icon":{width:f(r.ICON_BUTTON_CSS_VAR_MAP,"iconSize",o),height:f(r.ICON_BUTTON_CSS_VAR_MAP,"iconSize",o)}};for(const[o,r]of n.entries(e.size))i[`.uds-icon-button-${o}`]=E(r,t);return i}var M={display1:"6xl",display2:"5xl",display3:"4xl",title1:"3xl",title2:"2xl",title3:"xl",title4:"lg",headline1:"base",body1:"base",label1:"sm",label2:"sm",caption1:"xs",caption2:"xs"},b={fontSize:M,lineHeight:M,borderRadius:{xs:"sm",sm:"DEFAULT",md:"md",lg:"lg",xl:"xl"},borderWidth:{thin:"DEFAULT",medium:"2",thick:"4"}};function R(e){return e.endsWith("rem")?16*parseFloat(e):parseFloat(e)}var m={...o.defaultTokensConfig.scaleMode[o.DEFAULT_SCALE_MODE],fontSize:{...o.defaultTokensConfig.scaleMode[o.DEFAULT_SCALE_MODE].fontSize,...n.mapValues(b.fontSize,(e=>R(_.default.fontSize[e][0])))},lineHeight:{...o.defaultTokensConfig.scaleMode[o.DEFAULT_SCALE_MODE].fontSize,...n.mapValues(b.lineHeight,(e=>R(_.default.fontSize[e][1].lineHeight))),display1:R(_.default.fontSize[b.fontSize.display1][0]),display2:R(_.default.fontSize[b.fontSize.display2][0])},fontWeight:n.mapValues(o.defaultTokensConfig.scaleMode[o.DEFAULT_SCALE_MODE].fontWeight,(()=>"regular")),borderRadius:{...o.defaultTokensConfig.scaleMode[o.DEFAULT_SCALE_MODE].borderRadius,...n.mapValues(b.borderRadius,(e=>R(_.default.borderRadius[e])))},borderWidth:{...o.defaultTokensConfig.scaleMode[o.DEFAULT_SCALE_MODE].borderWidth,...n.mapValues(b.borderWidth,(e=>R(_.default.borderWidth[e])))}};function L(e){return{...o.defaultTokensConfig.scaleMode[e],fontWeight:m.fontWeight,fontSize:n.mapValues(m.fontSize,((t,o)=>t+s.fontSizeRamp[e][o])),lineHeight:n.mapValues(m.lineHeight,((t,o)=>t+s.lineHeightRamp[e][o])),borderRadius:n.mapValues(m.borderRadius,((t,o)=>t+s.borderRadiusRamp[e][o])),borderWidth:n.mapValues(m.borderWidth,((t,o)=>t+s.borderWidthRamp[e][o]))}}var U={...o.defaultTokensConfig,scaleMode:{xSmall:L("xSmall"),small:L("small"),medium:L("medium"),large:L("large"),xLarge:L("xLarge"),xxLarge:L("xxLarge"),xxxLarge:L("xxxLarge")}};var v=c.default.withOptions((function({config:n=o.defaultTokensConfig,disableFontFaceDeclarations:a=!1}){return function({addBase:s,matchUtilities:l,addComponents:d,theme:u}){const c=i.parseTokens(n),_=Object.values(n.font);if(!1===a&&e.addFontFaceDeclarations(_,s),function(t,o){o({":root":e.getFontStyles(t)})}(n.font,s),/*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
2
+ function(t,i){const n=e.getColorModeStyles(t);i({":root":n[o.DEFAULT_COLOR_MODE],[`.${r.LIGHT_COLOR_MODE_CLASSNAME}`]:n.light,[`.${r.DARK_COLOR_MODE_CLASSNAME}`]:n.dark})}(c,s),function(t,i){const n=e.getScaleModeStyles(t);i({":root":n[o.DEFAULT_SCALE_MODE],[`.${r.XSMALL_SCALE_MODE_CLASSNAME}`]:n.xSmall,[`.${r.SMALL_SCALE_MODE_CLASSNAME}`]:n.small,[`.${r.MEDIUM_SCALE_MODE_CLASSNAME}`]:n.medium,[`.${r.LARGE_SCALE_MODE_CLASSNAME}`]:n.large,[`.${r.XLARGE_SCALE_MODE_CLASSNAME}`]:n.xLarge,[`.${r.XXLARGE_SCALE_MODE_CLASSNAME}`]:n.xxLarge,[`.${r.XXXLARGE_SCALE_MODE_CLASSNAME}`]:n.xxxLarge})}(c,s),n.button){const e=function(e,t){return g(e,t)}(n.button,u);d(e)}if(n.iconButton){const e=function(e,t){return O(e,t)}(n.iconButton,u);d(e)}n.motion&&function(e,o){o({":root":t.getMotionStyles(e)})}(n.motion,s);s({".uds-hit-target":{position:"relative"},".uds-hit-target::before":{"@media (hover: none)":{content:"''",position:"absolute",top:"50%",left:"50%",width:`max(${h}, 100%)`,height:`max(${h}, 100%)`,transform:"translate(-50%, -50%)"}}});const f=function({theme:e}){return{".uds-ring":{"--uds-outline-offset":e("outlineOffset.DEFAULT"),"--uds-outline-width":e("outlineWidth.DEFAULT"),"--uds-outline-color":e("outlineColor.DEFAULT"),"--uds-outline-style":"solid"},[`.uds-ring${r.PSEUDO_STYLE_SELECTOR_MAP.focused}`]:p,".focused .uds-ring":p}}({theme:u});s(f),l({iconSize:e=>({width:e,height:e,fontSize:e,lineHeight:e})},{values:u("sizing.icon")}),l({avatarSize:e=>({width:e,height:e})},{values:u("sizing.avatar")}),l({case:e=>({"text-transform":e})},{values:u("typography.textTransform")}),l({"font-weight":e=>({"font-weight":e})},{values:u("typography.fontWeight")}),l({"font-size":e=>({"font-size":e})},{values:u("typography.fontSize")})}}),(function({config:e=o.defaultTokensConfig,safelist:t=[]}){const a=i.parseTokens(e),l=a.colorMode[o.DEFAULT_COLOR_MODE].tailwindConfig,d=a.scaleMode[o.DEFAULT_SCALE_MODE],u=n.mapValues(l.spectrum,((e,t)=>({...e,...s.tailwindColorsAsUds[t]}))),c=l.palette.core,_={...s.tailwindColorsAsUds,...u,...o.alwaysPalette,...c},f=l.palette.foreground,S=l.palette.background,A=l.palette.line,T=o.fromEntries(n.entries(b.fontSize).map((([e,t])=>[t,[`var(--${r.FONT_SIZE_PREFIX}-${e})`,{lineHeight:`var(--${r.LINE_HEIGHT_PREFIX}-${e})`}]]))),C=o.fromEntries(n.entries(b.borderRadius).map((([e,t])=>[t,`var(--${r.BORDER_RADIUS_PREFIX}-${e})`]))),g={...d.borderRadius.tailwindConfig,...C},p=o.fromEntries(n.entries(b.borderWidth).map((([e,t])=>[t,`var(--${r.BORDER_WIDTH_PREFIX}-${e})`]))),h={...d.borderWidth.tailwindConfig,...p};return{darkMode:["class",r.DARK_COLOR_MODE_CLASSNAME],safelist:[r.DARK_COLOR_MODE_CLASSNAME,...t],theme:{extend:{aria:{checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',invalid:'aria-invalid="true"'},data:{active:'active="true"',"active-item":'active-item="true"',autofill:'autofill="true"',backdrop:'backdrop="true"',enter:'enter="true"',leave:'leave="true"',"focus-visible":'focus-visible="true"'},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},borderRadius:g,borderWidth:h,outlineWidth:{...h,DEFAULT:"2px"},outlineOffset:{...h,DEFAULT:"2px"},outlineColor:({theme:e})=>({...A,DEFAULT:e("colors.accent")}),fontFamily:{...Object.fromEntries(s.fontAliases.map((e=>[e,`var(--${r.FONT_FAMILY_PREFIX}-${e})`]))),...Object.fromEntries(s.textVariants.map((e=>[e,`var(--${r.FONT_FAMILY_PREFIX}-${e})`])))},fontSize:T,lineHeight:d.lineHeight.tailwindConfig,colors:_,backgroundColor:S,textColor:f,borderColor:A,fill:S,caretColor:f,placeholderColor:f,textDecorationColor:f,divideColor:A,ringColor:A,ringOffsetColor:A,stroke:A,typography:{fontFamily:d.fontFamily.tailwindConfig,fontWeight:d.fontWeight.tailwindConfig,fontSize:d.fontSize.tailwindConfig,lineHeight:d.lineHeight.tailwindConfig,textTransform:d.textTransform.tailwindConfig},sizing:{icon:d.iconSizes.tailwindConfig,avatar:d.avatarSizes.tailwindConfig}}}}}));exports.defaultTailwindThemeAsUdsConfig=U,exports.getButtonColorForProperty=S,exports.getButtonStyles=g,exports.getIconButtonStyles=O,exports.getUDSContent=()=>[a.__require.resolve("@yahoo/uds"),a.__require.resolve("@yahoo/uds/client"),a.__require.resolve("@yahoo/uds/experimental")],exports.tailwindPlugin=v,exports.udsToTailwindMap=b;
@@ -1,3 +1,2 @@
1
- import{parseTokens as e}from"../chunk-LPM6JKIW.js";import{addFontFaceDeclarations as t,getColorModeStyles as o,getFontStyles as i,getScaleModeStyles as n}from"../chunk-FRZFCKD2.js";import{getMotionStyles as r}from"../chunk-PSTMMXTR.js";import{defaultTokensConfig as a,DEFAULT_SCALE_MODE as s,fromEntries as l,DEFAULT_COLOR_MODE as d,alwaysPalette as c}from"../chunk-YRYDHL65.js";import{mapValues as u,entries as f}from"../chunk-BEYSF2MO.js";import{FONT_SIZE_PREFIX as h,LINE_HEIGHT_PREFIX as g,BORDER_RADIUS_PREFIX as p,BORDER_WIDTH_PREFIX as b,DARK_COLOR_MODE_CLASSNAME as m,LIGHT_COLOR_MODE_CLASSNAME as v,XSMALL_SCALE_MODE_CLASSNAME as $,SMALL_SCALE_MODE_CLASSNAME as x,MEDIUM_SCALE_MODE_CLASSNAME as z,LARGE_SCALE_MODE_CLASSNAME as y,XLARGE_SCALE_MODE_CLASSNAME as S,XXLARGE_SCALE_MODE_CLASSNAME as C,XXXLARGE_SCALE_MODE_CLASSNAME as w,BUTTON_CSS_VAR_MAP as W,PSEUDO_STYLE_SELECTOR_MAP as k,ICON_BUTTON_CSS_VAR_MAP as F,FONT_FAMILY_PREFIX as L}from"../chunk-33B23P5G.js";import{__require as H}from"../chunk-HJC2LPQ4.js";import{tailwindColorsAsUds as T,alwaysPaletteAliases as R,buttonPalettes as M,buttonVariants as D,fontSizeRamp as j,lineHeightRamp as E,borderRadiusRamp as O,borderWidthRamp as U,fontAliases as A,textVariants as B,scaleEffectMap as P}from"@yahoo/uds/fixtures";import I from"tailwindcss/plugin";import Y from"tailwindcss/defaultTheme";function G(e,t,o){const i=e[t],n=o?.[i];return n?`var(${i}, ${n})`:`var(${i})`}function J(e,{type:t,value:o},i){const n="color"===e?"textColor":e;if("palette"===t)return R.includes(o)?o:i(`${n}.${o}`);{const[e,t]=o.split("-");return i(`colors.${e}.${t}`)}}function K({scale:e}){return P[e].sm}function V({backgroundColor:e,borderColor:t,color:o,borderRadius:i,borderWidth:n},r){return{[W.backgroundColor]:J("backgroundColor",e,r),[W.borderColor]:J("borderColor",t,r),[W.color]:J("color",o,r),...i&&{[W.borderRadius]:r(`borderRadius.${i}`)},...n&&{[W.borderWidth]:r(`borderWidth.${n}`)}}}function Q(e,t){const{spacingHorizontal:o,spacingVertical:i,gap:n,textVariant:r,iconSize:a}=e,s=t(`typography.lineHeight.${r}`),l=t(`sizing.icon.${a}`);return{[W.padding]:`${t(`spacing[${i}]`)} ${t(`spacing[${o}]`)}`,[W.columnGap]:t(`spacing[${n}]`),[W.fontFamily]:t(`typography.fontFamily.${r}`),[W.fontWeight]:t(`typography.fontWeight.${r}`),[W.fontSize]:t(`typography.fontSize.${r}`),[W.lineHeight]:`max(${s}, ${l})`,[W.textTransform]:t(`typography.textTransform.${r}`),[W.iconSize]:t(`sizing.icon.${a}`)}}function X(e,t){const o=e.palette[e.defaults.palette][e.defaults.variant],i=e.size[e.defaults.size],n=o.base.scale,r=o.effect.hover.scale.value,a=o.effect.pressed.scale.value,s={...V(o.base,t),...Q(i,t),[W.effects.scale.rest]:K({scale:n}),[W.effects.scale.hover]:K({scale:r}),[W.effects.scale.pressed]:K({scale:a})},l={borderRadius:G(W,"borderRadius",s),boxShadow:`inset 0 0 0 ${G(W,"borderWidth",s)} ${G(W,"borderColor",s)}`,color:G(W,"color",s),backgroundColor:G(W,"backgroundColor",s),padding:G(W,"padding",s),fontFamily:G(W,"fontFamily",s),fontWeight:G(W,"fontWeight",s),fontSize:G(W,"fontSize",s),lineHeight:G(W,"lineHeight",s),textTransform:G(W,"textTransform",s),display:"inline-flex",justifyContent:"center",overflow:"hidden",alignItems:"center",whiteSpace:"nowrap",userSelect:"none",...s,transitionProperty:"color, background-color, border-color, text-decoration-color, fill, stroke",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"220ms"},d=V(o.state.hover,t),c=V(o.state.pressed,t),u={cursor:"not-allowed",opacity:"0.2",[W.effects.scale.hover]:K({scale:"none"}),[W.effects.scale.pressed]:K({scale:"none"})},h={".uds-button":l,".uds-button .uds-button-icon":{width:G(W,"iconSize",s),height:G(W,"iconSize",s)},[`.uds-button${k.hover}`]:d,[`.uds-button${k.pressed}`]:c,[`.uds-button${k.disabled}`]:u,".disabled .uds-button":u},g={".hover":{".uds-button":d},".pressed":{".uds-button":c}};for(const[o,i]of f(e.size))h[`.uds-button-${o}`]=Q(i,t);function p(o,{palette:i,variant:n}){const r=e.palette[i][n],a=r.base,s=r.state,l=r.effect,d={rest:{...V(a,t)},restScale:{[W.effects.scale.rest]:K({scale:a.scale}),[W.effects.scale.hover]:K({scale:l.hover.scale.value}),[W.effects.scale.pressed]:K({scale:l.pressed.scale.value})},hover:V(s.hover,t),pressed:V(s.pressed,t)};h[o]=d.rest,h[`${o}${k.notDisabled}`]=d.restScale,h[`${o}${k.hover}`]=d.hover,h[`${o}${k.pressed}`]=d.pressed,g[".hover"][o]=d.hover,g[".pressed"][o]=d.pressed}for(const t of M){p(`.uds-button-${t}`,{palette:t,variant:e.defaults.variant});for(const o of D)p(`.uds-button-${t}.uds-button-${o}`,{palette:t,variant:o}),t===e.defaults.palette&&p(`.uds-button-${o}`,{palette:t,variant:o})}return{...h,...g}}var Z={outlineOffset:"var(--uds-outline-offset)",outlineWidth:"var(--uds-outline-width)",outlineColor:"var(--uds-outline-color)",outlineStyle:"var(--uds-outline-style)"};var q="44px";function N(e,t){const{spacing:o,iconSize:i}=e;return{[F.padding]:t(`spacing[${o}]`),[F.iconSize]:t(`sizing.icon.${i}`)}}function _(e,t){const o=N(e.size[e.defaults.size],t),i={".uds-icon-button":{display:"inline-flex",alignItems:"center",...{padding:G(F,"padding",o)}},".uds-icon-button .uds-button-icon":{width:G(F,"iconSize",o),height:G(F,"iconSize",o)}};for(const[o,n]of f(e.size))i[`.uds-icon-button-${o}`]=N(n,t);return i}var ee={display1:"6xl",display2:"5xl",display3:"4xl",title1:"3xl",title2:"2xl",title3:"xl",title4:"lg",headline1:"base",body1:"base",label1:"sm",label2:"sm",caption1:"xs",caption2:"xs"},te={fontSize:ee,lineHeight:ee,borderRadius:{xs:"sm",sm:"DEFAULT",md:"md",lg:"lg",xl:"xl"},borderWidth:{thin:"DEFAULT",medium:"2",thick:"4"}};function oe(e){return e.endsWith("rem")?16*parseFloat(e):parseFloat(e)}var ie={...a.scaleMode[s],fontSize:{...a.scaleMode[s].fontSize,...u(te.fontSize,(e=>oe(Y.fontSize[e][0])))},lineHeight:{...a.scaleMode[s].fontSize,...u(te.lineHeight,(e=>oe(Y.fontSize[e][1].lineHeight))),display1:oe(Y.fontSize[te.fontSize.display1][0]),display2:oe(Y.fontSize[te.fontSize.display2][0])},fontWeight:u(a.scaleMode[s].fontWeight,(()=>"regular")),borderRadius:{...a.scaleMode[s].borderRadius,...u(te.borderRadius,(e=>oe(Y.borderRadius[e])))},borderWidth:{...a.scaleMode[s].borderWidth,...u(te.borderWidth,(e=>oe(Y.borderWidth[e])))}};function ne(e){return{...a.scaleMode[e],fontWeight:ie.fontWeight,fontSize:u(ie.fontSize,((t,o)=>t+j[e][o])),lineHeight:u(ie.lineHeight,((t,o)=>t+E[e][o])),borderRadius:u(ie.borderRadius,((t,o)=>t+O[e][o])),borderWidth:u(ie.borderWidth,((t,o)=>t+U[e][o]))}}var re={...a,scaleMode:{xSmall:ne("xSmall"),small:ne("small"),medium:ne("medium"),large:ne("large"),xLarge:ne("xLarge"),xxLarge:ne("xxLarge"),xxxLarge:ne("xxxLarge")}};var ae=I.withOptions((function({config:l=a,disableFontFaceDeclarations:c=!1}){return function({addBase:a,matchUtilities:u,addComponents:f,theme:h}){const g=e(l),p=Object.values(l.font);if(!1===c&&t(p,a),function(e,t){t({":root":i(e)})}(l.font,a),
2
- /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
3
- function(e,t){const i=o(e);t({":root":i[d],[`.${v}`]:i.light,[`.${m}`]:i.dark})}(g,a),function(e,t){const o=n(e);t({":root":o[s],[`.${$}`]:o.xSmall,[`.${x}`]:o.small,[`.${z}`]:o.medium,[`.${y}`]:o.large,[`.${S}`]:o.xLarge,[`.${C}`]:o.xxLarge,[`.${w}`]:o.xxxLarge})}(g,a),l.button){const e=function(e,t){return X(e,t)}(l.button,h);f(e)}if(l.iconButton){const e=function(e,t){return _(e,t)}(l.iconButton,h);f(e)}l.motion&&function(e,t){t({":root":r(e)})}(l.motion,a);a({".uds-hit-target":{position:"relative"},".uds-hit-target::before":{"@media (hover: none)":{content:"''",position:"absolute",top:"50%",left:"50%",width:`max(${q}, 100%)`,height:`max(${q}, 100%)`,transform:"translate(-50%, -50%)"}}});const b=function({theme:e}){return{".uds-ring":{"--uds-outline-offset":e("outlineOffset.DEFAULT"),"--uds-outline-width":e("outlineWidth.DEFAULT"),"--uds-outline-color":e("outlineColor.DEFAULT"),"--uds-outline-style":"solid"},[`.uds-ring${k.focused}`]:Z,".focused .uds-ring":Z}}({theme:h});a(b),u({iconSize:e=>({width:e,height:e,fontSize:e,lineHeight:e})},{values:h("sizing.icon")}),u({avatarSize:e=>({width:e,height:e})},{values:h("sizing.avatar")}),u({case:e=>({"text-transform":e})},{values:h("typography.textTransform")}),u({"font-weight":e=>({"font-weight":e})},{values:h("typography.fontWeight")}),u({"font-size":e=>({"font-size":e})},{values:h("typography.fontSize")})}}),(function({config:t=a,safelist:o=[]}){const i=e(t),n=i.colorMode[d].tailwindConfig,r=i.scaleMode[s],v=u(n.spectrum,((e,t)=>({...e,...T[t]}))),$=n.palette.core,x={...T,...v,...c,...$},z=n.palette.foreground,y=n.palette.background,S=n.palette.line,C=l(f(te.fontSize).map((([e,t])=>[t,[`var(--${h}-${e})`,{lineHeight:`var(--${g}-${e})`}]]))),w=l(f(te.borderRadius).map((([e,t])=>[t,`var(--${p}-${e})`]))),W={...r.borderRadius.tailwindConfig,...w},k=l(f(te.borderWidth).map((([e,t])=>[t,`var(--${b}-${e})`]))),F={...r.borderWidth.tailwindConfig,...k};return{darkMode:["class",m],safelist:[m,...o],theme:{extend:{aria:{checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',invalid:'aria-invalid="true"'},data:{active:'active="true"',"active-item":'active-item="true"',autofill:'autofill="true"',backdrop:'backdrop="true"',enter:'enter="true"',leave:'leave="true"',"focus-visible":'focus-visible="true"'},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},borderRadius:W,borderWidth:F,outlineWidth:{...F,DEFAULT:"2px"},outlineOffset:{...F,DEFAULT:"2px"},outlineColor:({theme:e})=>({...S,DEFAULT:e("colors.accent")}),fontFamily:{...Object.fromEntries(A.map((e=>[e,`var(--${L}-${e})`]))),...Object.fromEntries(B.map((e=>[e,`var(--${L}-${e})`])))},fontSize:C,lineHeight:r.lineHeight.tailwindConfig,colors:x,backgroundColor:y,textColor:z,borderColor:S,fill:y,caretColor:z,placeholderColor:z,textDecorationColor:z,divideColor:S,ringColor:S,ringOffsetColor:S,stroke:S,typography:{fontFamily:r.fontFamily.tailwindConfig,fontWeight:r.fontWeight.tailwindConfig,fontSize:r.fontSize.tailwindConfig,lineHeight:r.lineHeight.tailwindConfig,textTransform:r.textTransform.tailwindConfig},sizing:{icon:r.iconSizes.tailwindConfig,avatar:r.avatarSizes.tailwindConfig}}}}})),se=()=>[H.resolve("@yahoo/uds"),H.resolve("@yahoo/uds/client"),H.resolve("@yahoo/uds/experimental")];export{re as defaultTailwindThemeAsUdsConfig,J as getButtonColorForProperty,X as getButtonStyles,_ as getIconButtonStyles,se as getUDSContent,ae as tailwindPlugin,te as udsToTailwindMap};
1
+ import{addFontFaceDeclarations as e,getColorModeStyles as t,getFontStyles as o,getScaleModeStyles as i}from"../chunk-FRZFCKD2.js";import{getMotionStyles as n}from"../chunk-PSTMMXTR.js";import{defaultTokensConfig as r,DEFAULT_SCALE_MODE as a,fromEntries as s,DEFAULT_COLOR_MODE as l,alwaysPalette as d}from"../chunk-YRYDHL65.js";import{parseTokens as c}from"../chunk-LPM6JKIW.js";import{mapValues as u,entries as f}from"../chunk-BEYSF2MO.js";import{FONT_SIZE_PREFIX as h,LINE_HEIGHT_PREFIX as g,BORDER_RADIUS_PREFIX as p,BORDER_WIDTH_PREFIX as b,DARK_COLOR_MODE_CLASSNAME as m,LIGHT_COLOR_MODE_CLASSNAME as v,XSMALL_SCALE_MODE_CLASSNAME as $,SMALL_SCALE_MODE_CLASSNAME as x,MEDIUM_SCALE_MODE_CLASSNAME as z,LARGE_SCALE_MODE_CLASSNAME as y,XLARGE_SCALE_MODE_CLASSNAME as S,XXLARGE_SCALE_MODE_CLASSNAME as C,XXXLARGE_SCALE_MODE_CLASSNAME as w,BUTTON_CSS_VAR_MAP as W,PSEUDO_STYLE_SELECTOR_MAP as k,ICON_BUTTON_CSS_VAR_MAP as F,FONT_FAMILY_PREFIX as L}from"../chunk-33B23P5G.js";import{__require as H}from"../chunk-HJC2LPQ4.js";import{tailwindColorsAsUds as T,alwaysPaletteAliases as R,buttonPalettes as M,buttonVariants as D,fontSizeRamp as j,lineHeightRamp as E,borderRadiusRamp as O,borderWidthRamp as U,fontAliases as A,textVariants as B,scaleEffectMap as P}from"@yahoo/uds/fixtures";import I from"tailwindcss/plugin";import Y from"tailwindcss/defaultTheme";function G(e,t,o){const i=e[t],n=o?.[i];return n?`var(${i}, ${n})`:`var(${i})`}function J(e,{type:t,value:o},i){const n="color"===e?"textColor":e;if("palette"===t)return R.includes(o)?o:i(`${n}.${o}`);{const[e,t]=o.split("-");return i(`colors.${e}.${t}`)}}function K({scale:e}){return P[e].sm}function V({backgroundColor:e,borderColor:t,color:o,borderRadius:i,borderWidth:n},r){return{[W.backgroundColor]:J("backgroundColor",e,r),[W.borderColor]:J("borderColor",t,r),[W.color]:J("color",o,r),...i&&{[W.borderRadius]:r(`borderRadius.${i}`)},...n&&{[W.borderWidth]:r(`borderWidth.${n}`)}}}function Q(e,t){const{spacingHorizontal:o,spacingVertical:i,gap:n,textVariant:r,iconSize:a}=e,s=t(`typography.lineHeight.${r}`),l=t(`sizing.icon.${a}`);return{[W.padding]:`${t(`spacing[${i}]`)} ${t(`spacing[${o}]`)}`,[W.columnGap]:t(`spacing[${n}]`),[W.fontFamily]:t(`typography.fontFamily.${r}`),[W.fontWeight]:t(`typography.fontWeight.${r}`),[W.fontSize]:t(`typography.fontSize.${r}`),[W.lineHeight]:`max(${s}, ${l})`,[W.textTransform]:t(`typography.textTransform.${r}`),[W.iconSize]:t(`sizing.icon.${a}`)}}function X(e,t){const o=e.palette[e.defaults.palette][e.defaults.variant],i=e.size[e.defaults.size],n=o.base.scale,r=o.effect.hover.scale.value,a=o.effect.pressed.scale.value,s={...V(o.base,t),...Q(i,t),[W.effects.scale.rest]:K({scale:n}),[W.effects.scale.hover]:K({scale:r}),[W.effects.scale.pressed]:K({scale:a})},l={borderRadius:G(W,"borderRadius",s),boxShadow:`inset 0 0 0 ${G(W,"borderWidth",s)} ${G(W,"borderColor",s)}`,color:G(W,"color",s),backgroundColor:G(W,"backgroundColor",s),padding:G(W,"padding",s),fontFamily:G(W,"fontFamily",s),fontWeight:G(W,"fontWeight",s),fontSize:G(W,"fontSize",s),lineHeight:G(W,"lineHeight",s),textTransform:G(W,"textTransform",s),display:"inline-flex",justifyContent:"center",overflow:"hidden",alignItems:"center",whiteSpace:"nowrap",userSelect:"none",...s,transitionProperty:"color, background-color, border-color, text-decoration-color, fill, stroke",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"220ms"},d=V(o.state.hover,t),c=V(o.state.pressed,t),u={cursor:"not-allowed",opacity:"0.2",[W.effects.scale.hover]:K({scale:"none"}),[W.effects.scale.pressed]:K({scale:"none"})},h={".uds-button":l,".uds-button .uds-button-icon":{width:G(W,"iconSize",s),height:G(W,"iconSize",s)},[`.uds-button${k.hover}`]:d,[`.uds-button${k.pressed}`]:c,[`.uds-button${k.disabled}`]:u,".disabled .uds-button":u},g={".hover":{".uds-button":d},".pressed":{".uds-button":c}};for(const[o,i]of f(e.size))h[`.uds-button-${o}`]=Q(i,t);function p(o,{palette:i,variant:n}){const r=e.palette[i][n],a=r.base,s=r.state,l=r.effect,d={rest:{...V(a,t)},restScale:{[W.effects.scale.rest]:K({scale:a.scale}),[W.effects.scale.hover]:K({scale:l.hover.scale.value}),[W.effects.scale.pressed]:K({scale:l.pressed.scale.value})},hover:V(s.hover,t),pressed:V(s.pressed,t)};h[o]=d.rest,h[`${o}${k.notDisabled}`]=d.restScale,h[`${o}${k.hover}`]=d.hover,h[`${o}${k.pressed}`]=d.pressed,g[".hover"][o]=d.hover,g[".pressed"][o]=d.pressed}for(const t of M){p(`.uds-button-${t}`,{palette:t,variant:e.defaults.variant});for(const o of D)p(`.uds-button-${t}.uds-button-${o}`,{palette:t,variant:o}),t===e.defaults.palette&&p(`.uds-button-${o}`,{palette:t,variant:o})}return{...h,...g}}var Z={outlineOffset:"var(--uds-outline-offset)",outlineWidth:"var(--uds-outline-width)",outlineColor:"var(--uds-outline-color)",outlineStyle:"var(--uds-outline-style)"};var q="44px";function N(e,t){const{spacing:o,iconSize:i}=e;return{[F.padding]:t(`spacing[${o}]`),[F.iconSize]:t(`sizing.icon.${i}`)}}function _(e,t){const o=N(e.size[e.defaults.size],t),i={".uds-icon-button":{display:"inline-flex",alignItems:"center",...{padding:G(F,"padding",o)}},".uds-icon-button .uds-button-icon":{width:G(F,"iconSize",o),height:G(F,"iconSize",o)}};for(const[o,n]of f(e.size))i[`.uds-icon-button-${o}`]=N(n,t);return i}var ee={display1:"6xl",display2:"5xl",display3:"4xl",title1:"3xl",title2:"2xl",title3:"xl",title4:"lg",headline1:"base",body1:"base",label1:"sm",label2:"sm",caption1:"xs",caption2:"xs"},te={fontSize:ee,lineHeight:ee,borderRadius:{xs:"sm",sm:"DEFAULT",md:"md",lg:"lg",xl:"xl"},borderWidth:{thin:"DEFAULT",medium:"2",thick:"4"}};function oe(e){return e.endsWith("rem")?16*parseFloat(e):parseFloat(e)}var ie={...r.scaleMode[a],fontSize:{...r.scaleMode[a].fontSize,...u(te.fontSize,(e=>oe(Y.fontSize[e][0])))},lineHeight:{...r.scaleMode[a].fontSize,...u(te.lineHeight,(e=>oe(Y.fontSize[e][1].lineHeight))),display1:oe(Y.fontSize[te.fontSize.display1][0]),display2:oe(Y.fontSize[te.fontSize.display2][0])},fontWeight:u(r.scaleMode[a].fontWeight,(()=>"regular")),borderRadius:{...r.scaleMode[a].borderRadius,...u(te.borderRadius,(e=>oe(Y.borderRadius[e])))},borderWidth:{...r.scaleMode[a].borderWidth,...u(te.borderWidth,(e=>oe(Y.borderWidth[e])))}};function ne(e){return{...r.scaleMode[e],fontWeight:ie.fontWeight,fontSize:u(ie.fontSize,((t,o)=>t+j[e][o])),lineHeight:u(ie.lineHeight,((t,o)=>t+E[e][o])),borderRadius:u(ie.borderRadius,((t,o)=>t+O[e][o])),borderWidth:u(ie.borderWidth,((t,o)=>t+U[e][o]))}}var re={...r,scaleMode:{xSmall:ne("xSmall"),small:ne("small"),medium:ne("medium"),large:ne("large"),xLarge:ne("xLarge"),xxLarge:ne("xxLarge"),xxxLarge:ne("xxxLarge")}};var ae=I.withOptions((function({config:s=r,disableFontFaceDeclarations:d=!1}){return function({addBase:r,matchUtilities:u,addComponents:f,theme:h}){const g=c(s),p=Object.values(s.font);if(!1===d&&e(p,r),function(e,t){t({":root":o(e)})}(s.font,r),/*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
2
+ function(e,o){const i=t(e);o({":root":i[l],[`.${v}`]:i.light,[`.${m}`]:i.dark})}(g,r),function(e,t){const o=i(e);t({":root":o[a],[`.${$}`]:o.xSmall,[`.${x}`]:o.small,[`.${z}`]:o.medium,[`.${y}`]:o.large,[`.${S}`]:o.xLarge,[`.${C}`]:o.xxLarge,[`.${w}`]:o.xxxLarge})}(g,r),s.button){const e=function(e,t){return X(e,t)}(s.button,h);f(e)}if(s.iconButton){const e=function(e,t){return _(e,t)}(s.iconButton,h);f(e)}s.motion&&function(e,t){t({":root":n(e)})}(s.motion,r);r({".uds-hit-target":{position:"relative"},".uds-hit-target::before":{"@media (hover: none)":{content:"''",position:"absolute",top:"50%",left:"50%",width:`max(${q}, 100%)`,height:`max(${q}, 100%)`,transform:"translate(-50%, -50%)"}}});const b=function({theme:e}){return{".uds-ring":{"--uds-outline-offset":e("outlineOffset.DEFAULT"),"--uds-outline-width":e("outlineWidth.DEFAULT"),"--uds-outline-color":e("outlineColor.DEFAULT"),"--uds-outline-style":"solid"},[`.uds-ring${k.focused}`]:Z,".focused .uds-ring":Z}}({theme:h});r(b),u({iconSize:e=>({width:e,height:e,fontSize:e,lineHeight:e})},{values:h("sizing.icon")}),u({avatarSize:e=>({width:e,height:e})},{values:h("sizing.avatar")}),u({case:e=>({"text-transform":e})},{values:h("typography.textTransform")}),u({"font-weight":e=>({"font-weight":e})},{values:h("typography.fontWeight")}),u({"font-size":e=>({"font-size":e})},{values:h("typography.fontSize")})}}),(function({config:e=r,safelist:t=[]}){const o=c(e),i=o.colorMode[l].tailwindConfig,n=o.scaleMode[a],v=u(i.spectrum,((e,t)=>({...e,...T[t]}))),$=i.palette.core,x={...T,...v,...d,...$},z=i.palette.foreground,y=i.palette.background,S=i.palette.line,C=s(f(te.fontSize).map((([e,t])=>[t,[`var(--${h}-${e})`,{lineHeight:`var(--${g}-${e})`}]]))),w=s(f(te.borderRadius).map((([e,t])=>[t,`var(--${p}-${e})`]))),W={...n.borderRadius.tailwindConfig,...w},k=s(f(te.borderWidth).map((([e,t])=>[t,`var(--${b}-${e})`]))),F={...n.borderWidth.tailwindConfig,...k};return{darkMode:["class",m],safelist:[m,...t],theme:{extend:{aria:{checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',invalid:'aria-invalid="true"'},data:{active:'active="true"',"active-item":'active-item="true"',autofill:'autofill="true"',backdrop:'backdrop="true"',enter:'enter="true"',leave:'leave="true"',"focus-visible":'focus-visible="true"'},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"},borderRadius:W,borderWidth:F,outlineWidth:{...F,DEFAULT:"2px"},outlineOffset:{...F,DEFAULT:"2px"},outlineColor:({theme:e})=>({...S,DEFAULT:e("colors.accent")}),fontFamily:{...Object.fromEntries(A.map((e=>[e,`var(--${L}-${e})`]))),...Object.fromEntries(B.map((e=>[e,`var(--${L}-${e})`])))},fontSize:C,lineHeight:n.lineHeight.tailwindConfig,colors:x,backgroundColor:y,textColor:z,borderColor:S,fill:y,caretColor:z,placeholderColor:z,textDecorationColor:z,divideColor:S,ringColor:S,ringOffsetColor:S,stroke:S,typography:{fontFamily:n.fontFamily.tailwindConfig,fontWeight:n.fontWeight.tailwindConfig,fontSize:n.fontSize.tailwindConfig,lineHeight:n.lineHeight.tailwindConfig,textTransform:n.textTransform.tailwindConfig},sizing:{icon:n.iconSizes.tailwindConfig,avatar:n.avatarSizes.tailwindConfig}}}}})),se=()=>[H.resolve("@yahoo/uds"),H.resolve("@yahoo/uds/client"),H.resolve("@yahoo/uds/experimental")];export{re as defaultTailwindThemeAsUdsConfig,J as getButtonColorForProperty,X as getButtonStyles,_ as getIconButtonStyles,se as getUDSContent,ae as tailwindPlugin,te as udsToTailwindMap};
@@ -1,5 +1,4 @@
1
- "use strict";
2
- /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
1
+ "use strict";/*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
3
2
  //! This file is generated by purgeCSS.ts from @yahoo/uds
4
3
  //! Do not edit directly
5
4
  //! If there is issue with this file please report to #ask-uds
@@ -1,3 +1 @@
1
- "use strict";var e=require("../chunk-LNFRMD6G.cjs"),t=require("lodash-es"),n=require("ts-morph");
2
- /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
3
- function i(e){if(n.Node.isCallExpression(e)){const t=e.getExpression();if(n.Node.isIdentifier(t)&&"forwardRef"===t.getText())return!0;if(n.Node.isPropertyAccessExpression(t)&&"React.forwardRef"===t.getText())return!0}return!1}function r(e){let t;if(n.Node.isVariableDeclaration(e)||n.Node.isFunctionDeclaration(e)||n.Node.isClassDeclaration(e))t=e.getName();else if(n.Node.isFunctionExpression(e)||n.Node.isArrowFunction(e)){const i=e.getFirstAncestorByKind(n.SyntaxKind.VariableDeclaration);t=i?.getName()}return!!t&&/[A-Z]/.test(t.charAt(0))}function s(e){if(r(e)){if(n.Node.isFunctionDeclaration(e))return e;if(n.Node.isVariableDeclaration(e)){const t=e.getInitializer();if(t)if(i(t)){const[e]=t.getArguments();if(n.Node.isFunctionDeclaration(e)||n.Node.isFunctionExpression(e)||n.Node.isArrowFunction(e))return e}else if(n.Node.isFunctionDeclaration(t)||n.Node.isFunctionExpression(t)||n.Node.isArrowFunction(t))return t}}return null}function o(e){return e.getDescendants().filter((e=>n.Node.isJsxElement(e)||n.Node.isJsxSelfClosingElement(e)))}var a=e=>{const t=e.getParentWhile((e=>!s(e))).getParent();if(!t)return;const i=s(t);if(i){const e=i.getParameters();for(let t=0;t<e.length;t++){const i=e[t],r=i.getChildrenOfKind(n.SyntaxKind.ObjectBindingPattern)[0],s=i.getChildrenOfKind(n.SyntaxKind.Identifier)[0];if(r){const e=r.getFirstDescendantByKind(n.SyntaxKind.DotDotDotToken);if(void 0!==e){const t=e?.getParent()?.getFirstChildByKindOrThrow(n.SyntaxKind.Identifier).getText();return t}}else if(s)return s.getText()}}};exports.findReferencesAsJsxElements=function(e){const t=[];for(const i of e.findReferencesAsNodes()){const e=i.getFirstAncestor((e=>n.Node.isJsxOpeningElement(e)||n.Node.isJsxSelfClosingElement(e)));e&&t.push(e)}return t},exports.getJsxElement=function(e,t){return o(e).find((e=>e.getFirstDescendantByKindOrThrow(n.SyntaxKind.Identifier).getText()===t))},exports.getJsxElements=o,exports.getParentSpreadOrParamIdentifier=a,exports.getReactFunctionDeclaration=s,exports.getUsedPropsInReference=i=>{const r=i.getAttributes(),s=[];return r.forEach((r=>{if(n.Node.isJsxAttribute(r)){const i=r.getNameNode().getText(),o=r.getDescendantsOfKind(n.SyntaxKind.StringLiteral),a=[];0!==o.length&&o.forEach((e=>a.push(e.getLiteralText())));const d=r.getFirstChildByKindOrThrow(n.SyntaxKind.Identifier).getDefinitions().map((e=>e.getDeclarationNode()?.getChildrenOfKind(n.SyntaxKind.TypeReference).pop()?.getText())).pop();d||t.isEmpty(i)?e.variants[t.camelCase(d)]&&!t.isEmpty(d)?s.push([t.camelCase(d),a]):t.isEmpty(i)||s.push([i,a]):s.push([i,a])}if(n.Node.isJsxSpreadAttribute(r)){const e=a(i),o=r.getExpression().getChildren(),d=0===o.length?r.getExpression():o.pop();if(!d||d?.getText()===e)return[];d.getType().getProperties().forEach((e=>{const i=e.getDeclarations().map((e=>{const i=e.getChildrenOfKind(n.SyntaxKind.TypeReference)[0]?.getText()??"";return t.camelCase(i)}))[0];t.isEmpty(e.getName())||s.push([e.getName(),[]]),t.isEmpty(i)||s.push([i,[]])}))}return[]})),s},exports.isForwardRefExpression=i,exports.isJsxComponent=r;
1
+ "use strict";var e=require("../chunk-LNFRMD6G.cjs"),t=require("lodash-es"),n=require("ts-morph");/*! © 2024 Yahoo, Inc. UDS v0.0.0-development */function i(e){if(n.Node.isCallExpression(e)){const t=e.getExpression();if(n.Node.isIdentifier(t)&&"forwardRef"===t.getText())return!0;if(n.Node.isPropertyAccessExpression(t)&&"React.forwardRef"===t.getText())return!0}return!1}function r(e){let t;if(n.Node.isVariableDeclaration(e)||n.Node.isFunctionDeclaration(e)||n.Node.isClassDeclaration(e))t=e.getName();else if(n.Node.isFunctionExpression(e)||n.Node.isArrowFunction(e)){const i=e.getFirstAncestorByKind(n.SyntaxKind.VariableDeclaration);t=i?.getName()}return!!t&&/[A-Z]/.test(t.charAt(0))}function s(e){if(r(e)){if(n.Node.isFunctionDeclaration(e))return e;if(n.Node.isVariableDeclaration(e)){const t=e.getInitializer();if(t)if(i(t)){const[e]=t.getArguments();if(n.Node.isFunctionDeclaration(e)||n.Node.isFunctionExpression(e)||n.Node.isArrowFunction(e))return e}else if(n.Node.isFunctionDeclaration(t)||n.Node.isFunctionExpression(t)||n.Node.isArrowFunction(t))return t}}return null}function o(e){return e.getDescendants().filter((e=>n.Node.isJsxElement(e)||n.Node.isJsxSelfClosingElement(e)))}var a=e=>{const t=e.getParentWhile((e=>!s(e))).getParent();if(!t)return;const i=s(t);if(i){const e=i.getParameters();for(let t=0;t<e.length;t++){const i=e[t],r=i.getChildrenOfKind(n.SyntaxKind.ObjectBindingPattern)[0],s=i.getChildrenOfKind(n.SyntaxKind.Identifier)[0];if(r){const e=r.getFirstDescendantByKind(n.SyntaxKind.DotDotDotToken);if(void 0!==e){const t=e?.getParent()?.getFirstChildByKindOrThrow(n.SyntaxKind.Identifier).getText();return t}}else if(s)return s.getText()}}};exports.findReferencesAsJsxElements=function(e){const t=[];for(const i of e.findReferencesAsNodes()){const e=i.getFirstAncestor((e=>n.Node.isJsxOpeningElement(e)||n.Node.isJsxSelfClosingElement(e)));e&&t.push(e)}return t},exports.getJsxElement=function(e,t){return o(e).find((e=>e.getFirstDescendantByKindOrThrow(n.SyntaxKind.Identifier).getText()===t))},exports.getJsxElements=o,exports.getParentSpreadOrParamIdentifier=a,exports.getReactFunctionDeclaration=s,exports.getUsedPropsInReference=i=>{const r=i.getAttributes(),s=[];return r.forEach((r=>{if(n.Node.isJsxAttribute(r)){const i=r.getNameNode().getText(),o=r.getDescendantsOfKind(n.SyntaxKind.StringLiteral),a=[];0!==o.length&&o.forEach((e=>a.push(e.getLiteralText())));const d=r.getFirstChildByKindOrThrow(n.SyntaxKind.Identifier).getDefinitions().map((e=>e.getDeclarationNode()?.getChildrenOfKind(n.SyntaxKind.TypeReference).pop()?.getText())).pop();d||t.isEmpty(i)?e.variants[t.camelCase(d)]&&!t.isEmpty(d)?s.push([t.camelCase(d),a]):t.isEmpty(i)||s.push([i,a]):s.push([i,a])}if(n.Node.isJsxSpreadAttribute(r)){const e=a(i),o=r.getExpression().getChildren(),d=0===o.length?r.getExpression():o.pop();if(!d||d?.getText()===e)return[];d.getType().getProperties().forEach((e=>{const i=e.getDeclarations().map((e=>{const i=e.getChildrenOfKind(n.SyntaxKind.TypeReference)[0]?.getText()??"";return t.camelCase(i)}))[0];t.isEmpty(e.getName())||s.push([e.getName(),[]]),t.isEmpty(i)||s.push([i,[]])}))}return[]})),s},exports.isForwardRefExpression=i,exports.isJsxComponent=r;
@@ -1,2 +1 @@
1
- import{variants as e}from"../chunk-RGE634O5.js";import{isEmpty as t,camelCase as n}from"lodash-es";import{Node as i,SyntaxKind as r}from"ts-morph";
2
- /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */function s(e){if(i.isCallExpression(e)){const t=e.getExpression();if(i.isIdentifier(t)&&"forwardRef"===t.getText())return!0;if(i.isPropertyAccessExpression(t)&&"React.forwardRef"===t.getText())return!0}return!1}function o(e){let t;if(i.isVariableDeclaration(e)||i.isFunctionDeclaration(e)||i.isClassDeclaration(e))t=e.getName();else if(i.isFunctionExpression(e)||i.isArrowFunction(e)){const n=e.getFirstAncestorByKind(r.VariableDeclaration);t=n?.getName()}return!!t&&/[A-Z]/.test(t.charAt(0))}function c(e){if(o(e)){if(i.isFunctionDeclaration(e))return e;if(i.isVariableDeclaration(e)){const t=e.getInitializer();if(t)if(s(t)){const[e]=t.getArguments();if(i.isFunctionDeclaration(e)||i.isFunctionExpression(e)||i.isArrowFunction(e))return e}else if(i.isFunctionDeclaration(t)||i.isFunctionExpression(t)||i.isArrowFunction(t))return t}}return null}function a(e,t){return f(e).find((e=>e.getFirstDescendantByKindOrThrow(r.Identifier).getText()===t))}function f(e){return e.getDescendants().filter((e=>i.isJsxElement(e)||i.isJsxSelfClosingElement(e)))}function g(e){const t=[];for(const n of e.findReferencesAsNodes()){const e=n.getFirstAncestor((e=>i.isJsxOpeningElement(e)||i.isJsxSelfClosingElement(e)));e&&t.push(e)}return t}var l=e=>{const t=e.getParentWhile((e=>!c(e))).getParent();if(!t)return;const n=c(t);if(n){const e=n.getParameters();for(let t=0;t<e.length;t++){const n=e[t],i=n.getChildrenOfKind(r.ObjectBindingPattern)[0],s=n.getChildrenOfKind(r.Identifier)[0];if(i){const e=i.getFirstDescendantByKind(r.DotDotDotToken);if(void 0!==e){const t=e?.getParent()?.getFirstChildByKindOrThrow(r.Identifier).getText();return t}}else if(s)return s.getText()}}},u=s=>{const o=s.getAttributes(),c=[];return o.forEach((o=>{if(i.isJsxAttribute(o)){const i=o.getNameNode().getText(),s=o.getDescendantsOfKind(r.StringLiteral),a=[];0!==s.length&&s.forEach((e=>a.push(e.getLiteralText())));const f=o.getFirstChildByKindOrThrow(r.Identifier).getDefinitions().map((e=>e.getDeclarationNode()?.getChildrenOfKind(r.TypeReference).pop()?.getText())).pop();f||t(i)?e[n(f)]&&!t(f)?c.push([n(f),a]):t(i)||c.push([i,a]):c.push([i,a])}if(i.isJsxSpreadAttribute(o)){const e=l(s),i=o.getExpression().getChildren(),a=0===i.length?o.getExpression():i.pop();if(!a||a?.getText()===e)return[];a.getType().getProperties().forEach((e=>{const i=e.getDeclarations().map((e=>{const t=e.getChildrenOfKind(r.TypeReference)[0]?.getText()??"";return n(t)}))[0];t(e.getName())||c.push([e.getName(),[]]),t(i)||c.push([i,[]])}))}return[]})),c};export{g as findReferencesAsJsxElements,a as getJsxElement,f as getJsxElements,l as getParentSpreadOrParamIdentifier,c as getReactFunctionDeclaration,u as getUsedPropsInReference,s as isForwardRefExpression,o as isJsxComponent};
1
+ import{variants as e}from"../chunk-RGE634O5.js";import{isEmpty as t,camelCase as n}from"lodash-es";import{Node as i,SyntaxKind as r}from"ts-morph";/*! © 2024 Yahoo, Inc. UDS v0.0.0-development */function s(e){if(i.isCallExpression(e)){const t=e.getExpression();if(i.isIdentifier(t)&&"forwardRef"===t.getText())return!0;if(i.isPropertyAccessExpression(t)&&"React.forwardRef"===t.getText())return!0}return!1}function o(e){let t;if(i.isVariableDeclaration(e)||i.isFunctionDeclaration(e)||i.isClassDeclaration(e))t=e.getName();else if(i.isFunctionExpression(e)||i.isArrowFunction(e)){const n=e.getFirstAncestorByKind(r.VariableDeclaration);t=n?.getName()}return!!t&&/[A-Z]/.test(t.charAt(0))}function c(e){if(o(e)){if(i.isFunctionDeclaration(e))return e;if(i.isVariableDeclaration(e)){const t=e.getInitializer();if(t)if(s(t)){const[e]=t.getArguments();if(i.isFunctionDeclaration(e)||i.isFunctionExpression(e)||i.isArrowFunction(e))return e}else if(i.isFunctionDeclaration(t)||i.isFunctionExpression(t)||i.isArrowFunction(t))return t}}return null}function a(e,t){return f(e).find((e=>e.getFirstDescendantByKindOrThrow(r.Identifier).getText()===t))}function f(e){return e.getDescendants().filter((e=>i.isJsxElement(e)||i.isJsxSelfClosingElement(e)))}function g(e){const t=[];for(const n of e.findReferencesAsNodes()){const e=n.getFirstAncestor((e=>i.isJsxOpeningElement(e)||i.isJsxSelfClosingElement(e)));e&&t.push(e)}return t}var l=e=>{const t=e.getParentWhile((e=>!c(e))).getParent();if(!t)return;const n=c(t);if(n){const e=n.getParameters();for(let t=0;t<e.length;t++){const n=e[t],i=n.getChildrenOfKind(r.ObjectBindingPattern)[0],s=n.getChildrenOfKind(r.Identifier)[0];if(i){const e=i.getFirstDescendantByKind(r.DotDotDotToken);if(void 0!==e){const t=e?.getParent()?.getFirstChildByKindOrThrow(r.Identifier).getText();return t}}else if(s)return s.getText()}}},u=s=>{const o=s.getAttributes(),c=[];return o.forEach((o=>{if(i.isJsxAttribute(o)){const i=o.getNameNode().getText(),s=o.getDescendantsOfKind(r.StringLiteral),a=[];0!==s.length&&s.forEach((e=>a.push(e.getLiteralText())));const f=o.getFirstChildByKindOrThrow(r.Identifier).getDefinitions().map((e=>e.getDeclarationNode()?.getChildrenOfKind(r.TypeReference).pop()?.getText())).pop();f||t(i)?e[n(f)]&&!t(f)?c.push([n(f),a]):t(i)||c.push([i,a]):c.push([i,a])}if(i.isJsxSpreadAttribute(o)){const e=l(s),i=o.getExpression().getChildren(),a=0===i.length?o.getExpression():i.pop();if(!a||a?.getText()===e)return[];a.getType().getProperties().forEach((e=>{const i=e.getDeclarations().map((e=>{const t=e.getChildrenOfKind(r.TypeReference)[0]?.getText()??"";return n(t)}))[0];t(e.getName())||c.push([e.getName(),[]]),t(i)||c.push([i,[]])}))}return[]})),c};export{g as findReferencesAsJsxElements,a as getJsxElement,f as getJsxElements,l as getParentSpreadOrParamIdentifier,c as getReactFunctionDeclaration,u as getUsedPropsInReference,s as isForwardRefExpression,o as isJsxComponent};
@@ -1 +1 @@
1
- "use strict";var e=require("../chunk-WLOEKYUI.cjs"),t=require("../chunk-3LHMB72F.cjs"),r=require("../chunk-LNFRMD6G.cjs"),n=require("../chunk-J6D4HCFT.cjs");Object.defineProperty(exports,"DEFAULT_COLOR_MODE",{enumerable:!0,get:function(){return e.DEFAULT_COLOR_MODE}}),Object.defineProperty(exports,"DEFAULT_COLOR_MODE_FOR_APP",{enumerable:!0,get:function(){return e.DEFAULT_COLOR_MODE_FOR_APP}}),Object.defineProperty(exports,"DEFAULT_HIGH_CONTRAST_MODE",{enumerable:!0,get:function(){return e.DEFAULT_HIGH_CONTRAST_MODE}}),Object.defineProperty(exports,"DEFAULT_REGION_MODE",{enumerable:!0,get:function(){return e.DEFAULT_REGION_MODE}}),Object.defineProperty(exports,"DEFAULT_SCALE_MODE",{enumerable:!0,get:function(){return e.DEFAULT_SCALE_MODE}}),Object.defineProperty(exports,"DEFAULT_SCALE_MODE_FOR_APP",{enumerable:!0,get:function(){return e.DEFAULT_SCALE_MODE_FOR_APP}}),Object.defineProperty(exports,"FONT_DECLARATIONS_MAP",{enumerable:!0,get:function(){return e.FONT_DECLARATIONS_MAP}}),Object.defineProperty(exports,"alwaysPalette",{enumerable:!0,get:function(){return e.alwaysPalette}}),Object.defineProperty(exports,"button",{enumerable:!0,get:function(){return e.button}}),Object.defineProperty(exports,"defaultTokensConfig",{enumerable:!0,get:function(){return e.defaultTokensConfig}}),Object.defineProperty(exports,"fromEntries",{enumerable:!0,get:function(){return e.fromEntries}}),Object.defineProperty(exports,"generateConfigCombinations",{enumerable:!0,get:function(){return e.generateConfigCombinations}}),Object.defineProperty(exports,"getDefaultButtonBaseMap",{enumerable:!0,get:function(){return e.getDefaultButtonBaseMap}}),Object.defineProperty(exports,"entries",{enumerable:!0,get:function(){return t.entries}}),Object.defineProperty(exports,"fontWeightMap",{enumerable:!0,get:function(){return t.fontWeightMap}}),Object.defineProperty(exports,"mapValues",{enumerable:!0,get:function(){return t.mapValues}}),Object.defineProperty(exports,"variants",{enumerable:!0,get:function(){return r.variants}}),Object.defineProperty(exports,"AVATAR_SIZE_PREFIX",{enumerable:!0,get:function(){return n.AVATAR_SIZE_PREFIX}}),Object.defineProperty(exports,"BORDER_RADIUS_PREFIX",{enumerable:!0,get:function(){return n.BORDER_RADIUS_PREFIX}}),Object.defineProperty(exports,"BORDER_WIDTH_PREFIX",{enumerable:!0,get:function(){return n.BORDER_WIDTH_PREFIX}}),Object.defineProperty(exports,"BUTTON_CSS_VAR_MAP",{enumerable:!0,get:function(){return n.BUTTON_CSS_VAR_MAP}}),Object.defineProperty(exports,"DARK_COLOR_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.DARK_COLOR_MODE_CLASSNAME}}),Object.defineProperty(exports,"DEFAULT_COLOR_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.DEFAULT_COLOR_MODE_CLASSNAME}}),Object.defineProperty(exports,"DEFAULT_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.DEFAULT_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"FONT_FAMILY_PREFIX",{enumerable:!0,get:function(){return n.FONT_FAMILY_PREFIX}}),Object.defineProperty(exports,"FONT_SIZE_PREFIX",{enumerable:!0,get:function(){return n.FONT_SIZE_PREFIX}}),Object.defineProperty(exports,"FONT_WEIGHT_PREFIX",{enumerable:!0,get:function(){return n.FONT_WEIGHT_PREFIX}}),Object.defineProperty(exports,"ICON_BUTTON_CSS_VAR_MAP",{enumerable:!0,get:function(){return n.ICON_BUTTON_CSS_VAR_MAP}}),Object.defineProperty(exports,"ICON_SIZE_PREFIX",{enumerable:!0,get:function(){return n.ICON_SIZE_PREFIX}}),Object.defineProperty(exports,"LARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.LARGE_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"LIGHT_COLOR_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.LIGHT_COLOR_MODE_CLASSNAME}}),Object.defineProperty(exports,"LINE_HEIGHT_PREFIX",{enumerable:!0,get:function(){return n.LINE_HEIGHT_PREFIX}}),Object.defineProperty(exports,"MEDIUM_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.MEDIUM_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"MOTION_PREFIX",{enumerable:!0,get:function(){return n.MOTION_PREFIX}}),Object.defineProperty(exports,"PSEUDO_STYLE_SELECTOR_MAP",{enumerable:!0,get:function(){return n.PSEUDO_STYLE_SELECTOR_MAP}}),Object.defineProperty(exports,"SMALL_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.SMALL_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"SPECTRUM_COLOR_PREFIX",{enumerable:!0,get:function(){return n.SPECTRUM_COLOR_PREFIX}}),Object.defineProperty(exports,"TEXT_TRANSFORM_PREFIX",{enumerable:!0,get:function(){return n.TEXT_TRANSFORM_PREFIX}}),Object.defineProperty(exports,"UDS_PREFIX",{enumerable:!0,get:function(){return n.UDS_PREFIX}}),Object.defineProperty(exports,"XLARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XLARGE_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"XSMALL_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XSMALL_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"XXLARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XXLARGE_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"XXXLARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XXXLARGE_SCALE_MODE_CLASSNAME}});
1
+ "use strict";var e=require("../chunk-WLOEKYUI.cjs"),t=require("../chunk-LNFRMD6G.cjs"),r=require("../chunk-3LHMB72F.cjs"),n=require("../chunk-J6D4HCFT.cjs");Object.defineProperty(exports,"DEFAULT_COLOR_MODE",{enumerable:!0,get:function(){return e.DEFAULT_COLOR_MODE}}),Object.defineProperty(exports,"DEFAULT_COLOR_MODE_FOR_APP",{enumerable:!0,get:function(){return e.DEFAULT_COLOR_MODE_FOR_APP}}),Object.defineProperty(exports,"DEFAULT_HIGH_CONTRAST_MODE",{enumerable:!0,get:function(){return e.DEFAULT_HIGH_CONTRAST_MODE}}),Object.defineProperty(exports,"DEFAULT_REGION_MODE",{enumerable:!0,get:function(){return e.DEFAULT_REGION_MODE}}),Object.defineProperty(exports,"DEFAULT_SCALE_MODE",{enumerable:!0,get:function(){return e.DEFAULT_SCALE_MODE}}),Object.defineProperty(exports,"DEFAULT_SCALE_MODE_FOR_APP",{enumerable:!0,get:function(){return e.DEFAULT_SCALE_MODE_FOR_APP}}),Object.defineProperty(exports,"FONT_DECLARATIONS_MAP",{enumerable:!0,get:function(){return e.FONT_DECLARATIONS_MAP}}),Object.defineProperty(exports,"alwaysPalette",{enumerable:!0,get:function(){return e.alwaysPalette}}),Object.defineProperty(exports,"button",{enumerable:!0,get:function(){return e.button}}),Object.defineProperty(exports,"defaultTokensConfig",{enumerable:!0,get:function(){return e.defaultTokensConfig}}),Object.defineProperty(exports,"fromEntries",{enumerable:!0,get:function(){return e.fromEntries}}),Object.defineProperty(exports,"generateConfigCombinations",{enumerable:!0,get:function(){return e.generateConfigCombinations}}),Object.defineProperty(exports,"getDefaultButtonBaseMap",{enumerable:!0,get:function(){return e.getDefaultButtonBaseMap}}),Object.defineProperty(exports,"variants",{enumerable:!0,get:function(){return t.variants}}),Object.defineProperty(exports,"entries",{enumerable:!0,get:function(){return r.entries}}),Object.defineProperty(exports,"fontWeightMap",{enumerable:!0,get:function(){return r.fontWeightMap}}),Object.defineProperty(exports,"mapValues",{enumerable:!0,get:function(){return r.mapValues}}),Object.defineProperty(exports,"AVATAR_SIZE_PREFIX",{enumerable:!0,get:function(){return n.AVATAR_SIZE_PREFIX}}),Object.defineProperty(exports,"BORDER_RADIUS_PREFIX",{enumerable:!0,get:function(){return n.BORDER_RADIUS_PREFIX}}),Object.defineProperty(exports,"BORDER_WIDTH_PREFIX",{enumerable:!0,get:function(){return n.BORDER_WIDTH_PREFIX}}),Object.defineProperty(exports,"BUTTON_CSS_VAR_MAP",{enumerable:!0,get:function(){return n.BUTTON_CSS_VAR_MAP}}),Object.defineProperty(exports,"DARK_COLOR_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.DARK_COLOR_MODE_CLASSNAME}}),Object.defineProperty(exports,"DEFAULT_COLOR_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.DEFAULT_COLOR_MODE_CLASSNAME}}),Object.defineProperty(exports,"DEFAULT_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.DEFAULT_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"FONT_FAMILY_PREFIX",{enumerable:!0,get:function(){return n.FONT_FAMILY_PREFIX}}),Object.defineProperty(exports,"FONT_SIZE_PREFIX",{enumerable:!0,get:function(){return n.FONT_SIZE_PREFIX}}),Object.defineProperty(exports,"FONT_WEIGHT_PREFIX",{enumerable:!0,get:function(){return n.FONT_WEIGHT_PREFIX}}),Object.defineProperty(exports,"ICON_BUTTON_CSS_VAR_MAP",{enumerable:!0,get:function(){return n.ICON_BUTTON_CSS_VAR_MAP}}),Object.defineProperty(exports,"ICON_SIZE_PREFIX",{enumerable:!0,get:function(){return n.ICON_SIZE_PREFIX}}),Object.defineProperty(exports,"LARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.LARGE_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"LIGHT_COLOR_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.LIGHT_COLOR_MODE_CLASSNAME}}),Object.defineProperty(exports,"LINE_HEIGHT_PREFIX",{enumerable:!0,get:function(){return n.LINE_HEIGHT_PREFIX}}),Object.defineProperty(exports,"MEDIUM_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.MEDIUM_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"MOTION_PREFIX",{enumerable:!0,get:function(){return n.MOTION_PREFIX}}),Object.defineProperty(exports,"PSEUDO_STYLE_SELECTOR_MAP",{enumerable:!0,get:function(){return n.PSEUDO_STYLE_SELECTOR_MAP}}),Object.defineProperty(exports,"SMALL_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.SMALL_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"SPECTRUM_COLOR_PREFIX",{enumerable:!0,get:function(){return n.SPECTRUM_COLOR_PREFIX}}),Object.defineProperty(exports,"TEXT_TRANSFORM_PREFIX",{enumerable:!0,get:function(){return n.TEXT_TRANSFORM_PREFIX}}),Object.defineProperty(exports,"UDS_PREFIX",{enumerable:!0,get:function(){return n.UDS_PREFIX}}),Object.defineProperty(exports,"XLARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XLARGE_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"XSMALL_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XSMALL_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"XXLARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XXLARGE_SCALE_MODE_CLASSNAME}}),Object.defineProperty(exports,"XXXLARGE_SCALE_MODE_CLASSNAME",{enumerable:!0,get:function(){return n.XXXLARGE_SCALE_MODE_CLASSNAME}});
@@ -1 +1 @@
1
- export{DEFAULT_COLOR_MODE,DEFAULT_COLOR_MODE_FOR_APP,DEFAULT_HIGH_CONTRAST_MODE,DEFAULT_REGION_MODE,DEFAULT_SCALE_MODE,DEFAULT_SCALE_MODE_FOR_APP,FONT_DECLARATIONS_MAP,alwaysPalette,button,defaultTokensConfig,fromEntries,generateConfigCombinations,getDefaultButtonBaseMap}from"../chunk-YRYDHL65.js";export{entries,fontWeightMap,mapValues}from"../chunk-BEYSF2MO.js";export{variants}from"../chunk-RGE634O5.js";export{AVATAR_SIZE_PREFIX,BORDER_RADIUS_PREFIX,BORDER_WIDTH_PREFIX,BUTTON_CSS_VAR_MAP,DARK_COLOR_MODE_CLASSNAME,DEFAULT_COLOR_MODE_CLASSNAME,DEFAULT_SCALE_MODE_CLASSNAME,FONT_FAMILY_PREFIX,FONT_SIZE_PREFIX,FONT_WEIGHT_PREFIX,ICON_BUTTON_CSS_VAR_MAP,ICON_SIZE_PREFIX,LARGE_SCALE_MODE_CLASSNAME,LIGHT_COLOR_MODE_CLASSNAME,LINE_HEIGHT_PREFIX,MEDIUM_SCALE_MODE_CLASSNAME,MOTION_PREFIX,PSEUDO_STYLE_SELECTOR_MAP,SMALL_SCALE_MODE_CLASSNAME,SPECTRUM_COLOR_PREFIX,TEXT_TRANSFORM_PREFIX,UDS_PREFIX,XLARGE_SCALE_MODE_CLASSNAME,XSMALL_SCALE_MODE_CLASSNAME,XXLARGE_SCALE_MODE_CLASSNAME,XXXLARGE_SCALE_MODE_CLASSNAME}from"../chunk-33B23P5G.js";
1
+ export{DEFAULT_COLOR_MODE,DEFAULT_COLOR_MODE_FOR_APP,DEFAULT_HIGH_CONTRAST_MODE,DEFAULT_REGION_MODE,DEFAULT_SCALE_MODE,DEFAULT_SCALE_MODE_FOR_APP,FONT_DECLARATIONS_MAP,alwaysPalette,button,defaultTokensConfig,fromEntries,generateConfigCombinations,getDefaultButtonBaseMap}from"../chunk-YRYDHL65.js";export{variants}from"../chunk-RGE634O5.js";export{entries,fontWeightMap,mapValues}from"../chunk-BEYSF2MO.js";export{AVATAR_SIZE_PREFIX,BORDER_RADIUS_PREFIX,BORDER_WIDTH_PREFIX,BUTTON_CSS_VAR_MAP,DARK_COLOR_MODE_CLASSNAME,DEFAULT_COLOR_MODE_CLASSNAME,DEFAULT_SCALE_MODE_CLASSNAME,FONT_FAMILY_PREFIX,FONT_SIZE_PREFIX,FONT_WEIGHT_PREFIX,ICON_BUTTON_CSS_VAR_MAP,ICON_SIZE_PREFIX,LARGE_SCALE_MODE_CLASSNAME,LIGHT_COLOR_MODE_CLASSNAME,LINE_HEIGHT_PREFIX,MEDIUM_SCALE_MODE_CLASSNAME,MOTION_PREFIX,PSEUDO_STYLE_SELECTOR_MAP,SMALL_SCALE_MODE_CLASSNAME,SPECTRUM_COLOR_PREFIX,TEXT_TRANSFORM_PREFIX,UDS_PREFIX,XLARGE_SCALE_MODE_CLASSNAME,XSMALL_SCALE_MODE_CLASSNAME,XXLARGE_SCALE_MODE_CLASSNAME,XXXLARGE_SCALE_MODE_CLASSNAME}from"../chunk-33B23P5G.js";
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@yahoo/uds",
3
3
  "description": "Yahoo Universal System",
4
- "version": "1.7.3",
4
+ "version": "1.8.0",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "uds": "./cli/uds-cli"
8
8
  },
9
9
  "files": [
10
10
  "cli/**",
11
+ "!cli/**/*.test.*",
11
12
  "dist/**",
12
- "fonts/**",
13
- "package.json"
13
+ "fonts/**"
14
14
  ],
15
15
  "sideEffects": false,
16
16
  "exports": {
@@ -24,6 +24,26 @@
24
24
  "default": "./dist/index.cjs"
25
25
  }
26
26
  },
27
+ "./analytics/server": {
28
+ "import": {
29
+ "types": "./dist/analytics/server.d.ts",
30
+ "default": "./dist/analytics/server.js"
31
+ },
32
+ "require": {
33
+ "types": "./dist/analytics/server.d.cts",
34
+ "default": "./dist/analytics/server.cjs"
35
+ }
36
+ },
37
+ "./flags": {
38
+ "import": {
39
+ "types": "./dist/flags.d.ts",
40
+ "default": "./dist/flags.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/flags.d.cts",
44
+ "default": "./dist/flags.cjs"
45
+ }
46
+ },
27
47
  "./client": {
28
48
  "import": {
29
49
  "types": "./dist/client/index.d.ts",
@@ -1,97 +0,0 @@
1
- import { unlink } from 'node:fs';
2
- import path from 'node:path';
3
-
4
- import * as bluebun from 'bluebun';
5
- import { afterEach, beforeAll, beforeEach, describe, expect, it, mock, spyOn } from 'bun:test';
6
- import { IndentationText, Project } from 'ts-morph';
7
-
8
- import { propsToClass } from './propsToClass';
9
- import { sizingPropToClassMap } from './utils/sizingPropToClassMap';
10
-
11
- const FILE_NAME = 'PropsToClass.mock.tsx';
12
- const FILE_BEFORE = `
13
- import { Button, cx, HStack, Text } from '@yahoo/uds';
14
- const textClassName = cx('text-primary');
15
- const otherProps = { height: 'fit' };
16
-
17
- export const PageA = () => {
18
- return (
19
- <HStack width="full" maxHeight="screen">
20
- <Button minWidth="full">Click me</Button>
21
- <Text width="10/12" className={textClassName}>Some text</Text>
22
- <Text {...otherProps}>Some text</Text>
23
- </HStack>
24
- );
25
- }
26
- `.trim();
27
- const FILE_AFTER = `
28
- import { Button, cx, HStack, Text } from '@yahoo/uds';
29
- const textClassName = cx('text-primary');
30
- const otherProps = { height: 'fit' };
31
-
32
- export const PageA = () => {
33
- return (
34
- <HStack className="w-full max-h-screen">
35
- <Button className="min-w-full">Click me</Button>
36
- {/* 🙏 TODO: Add w-10/12 to your className attribute */}
37
- <Text className={textClassName}>Some text</Text>
38
- <Text {...otherProps}>Some text</Text>
39
- </HStack>
40
- );
41
- }
42
- `.trim();
43
-
44
- describe('propsToClass', () => {
45
- const workspaceDir = Bun.env.PWD;
46
- const srcDir = path.join(workspaceDir, 'tsconfig.json');
47
- const project = new Project({
48
- tsConfigFilePath: srcDir,
49
- manipulationSettings: { indentationText: IndentationText.TwoSpaces },
50
- });
51
-
52
- beforeAll(async () => {
53
- // setup mocks
54
- mock.module('bluebun', () => ({ print: () => 'mocked' }));
55
- });
56
-
57
- beforeEach(async () => {
58
- // Setup files
59
- project.createSourceFile(FILE_NAME, FILE_BEFORE, {
60
- overwrite: true,
61
- });
62
- });
63
- afterEach(async () => {
64
- // teardown files
65
- unlink(FILE_NAME, (err) => {
66
- if (err) {
67
- throw err;
68
- }
69
- });
70
- });
71
-
72
- it('converts props to classNames', async () => {
73
- // Sanity check
74
- const fileBefore = project.getSourceFile(FILE_NAME)?.getText();
75
- expect(fileBefore).toEqual(FILE_BEFORE);
76
-
77
- // Apply the codemod
78
- await propsToClass({ propToClassMap: sizingPropToClassMap, project });
79
-
80
- // Confirm it's been transformed
81
- const fileAfter = project.getSourceFile(FILE_NAME)?.getText();
82
- expect(fileAfter).toEqual(FILE_AFTER);
83
- });
84
- it('logs a warning when a complex expression is found', async () => {
85
- // Spy on the bun logger
86
- const spy = spyOn(bluebun, 'print');
87
-
88
- // Apply the codemod
89
- await propsToClass({
90
- propToClassMap: sizingPropToClassMap,
91
- project,
92
- });
93
-
94
- // We print 3 times for each complex expression, and 2 times for each spread expression
95
- expect(spy).toHaveBeenCalledTimes(5);
96
- });
97
- });
@@ -1,202 +0,0 @@
1
- import path from 'node:path';
2
-
3
- import { afterAll, describe, expect, it, mock } from 'bun:test';
4
- import http from 'http';
5
- // eslint-disable-next-line n/no-unpublished-import
6
- import httpMocks from 'node-mocks-http';
7
-
8
- import {
9
- configuratorUrlOrigin,
10
- getAuthenticatedUser,
11
- getAuthorizeUrl,
12
- isYahooEmployee,
13
- login,
14
- type LoginProvider,
15
- logout,
16
- onGETHandler,
17
- onPostHandler,
18
- type User,
19
- } from './auth';
20
-
21
- const __dirname = path.resolve(import.meta.dir);
22
- const filepath = path.resolve(__dirname, '.uds/user.json');
23
-
24
- const writeCache = async (filePath: string, user: User) => {
25
- return Bun.write(filePath, JSON.stringify(user));
26
- };
27
-
28
- describe('auth', () => {
29
- describe('isYahooEmployee', () => {
30
- it('does not return a user on first use', async () => {
31
- expect(isYahooEmployee({ email: 'user@yahooinc.com' })).toBe(true);
32
- expect(isYahooEmployee({ email: 'user@test.com' })).toBe(false);
33
- });
34
- });
35
-
36
- describe('getAuthorizeUrl', () => {
37
- it('uses configurator by default', () => {
38
- expect(getAuthorizeUrl()).toEqual(
39
- `${configuratorUrlOrigin}/login?continue=http://localhost:3000/oauth2callback`,
40
- );
41
- });
42
-
43
- it('generates the google auth url for other providers', () => {
44
- (['google', 'firebase'] as LoginProvider[]).forEach((provider) => {
45
- expect(getAuthorizeUrl(provider)).toStartWith(
46
- `https://accounts.google.com/o/oauth2/v2/auth`,
47
- );
48
- });
49
- });
50
- });
51
-
52
- describe('getAuthenticatedUser', () => {
53
- it('does not return a user on first use', async () => {
54
- expect(await getAuthenticatedUser(__dirname)).toBeUndefined();
55
- });
56
-
57
- it('reads user info from cache when one exists', async () => {
58
- const user: User = { email: 'user@yahooinc.com', name: 'User' };
59
- await writeCache(filepath, user);
60
- const userInfo = await getAuthenticatedUser(__dirname);
61
- expect(userInfo).toEqual(user);
62
- });
63
-
64
- it('resets user when non @yahooinc.com email is used', async () => {
65
- await writeCache(filepath, { email: 'user@test.com', name: 'User' });
66
- expect(await Bun.file(filepath).exists()).toBeTrue();
67
- const userInfo = await getAuthenticatedUser(__dirname);
68
- expect(userInfo).toBeUndefined();
69
- expect(await Bun.file(filepath).exists()).toBeFalse();
70
- });
71
- });
72
-
73
- describe('authenticateUser', () => {
74
- const mockServer = Object.assign(Object.create(http.Server.prototype), {
75
- listen: mock(),
76
- on: mock(),
77
- close: mock(),
78
- });
79
-
80
- const mockUser = { email: 'foo@yahooinc.com' };
81
-
82
- mock.module('firebase/auth', () => ({
83
- GoogleAuthProvider: {
84
- credential: mock(),
85
- },
86
- signInWithCredential: mock(() => Promise.resolve({ user: mockUser })),
87
- }));
88
-
89
- it('returns error when no code is on callback url', async () => {
90
- const resolve = mock();
91
- const reject = mock();
92
-
93
- const request = httpMocks.createRequest({ method: 'GET', url: '/oauth2callback' });
94
- const response = httpMocks.createResponse();
95
- await onGETHandler.bind(mockServer)(request, response, resolve, reject);
96
- expect(response._getData()).toInclude('no code parameter');
97
- });
98
-
99
- it('can successfully login in user', async () => {
100
- const resolve = mock();
101
- const reject = mock();
102
-
103
- const request = httpMocks.createRequest({ method: 'GET', url: '/oauth2callback?code=123' });
104
- const response = httpMocks.createResponse();
105
- await onGETHandler.bind(mockServer)(request, response, resolve, reject);
106
- expect(response._getData()).toInclude('Authentication successful! Please close this window.');
107
- expect(resolve).toHaveBeenCalledWith(mockUser);
108
- expect(reject).not.toHaveBeenCalled();
109
- });
110
- });
111
-
112
- describe('onPostHandler', () => {
113
- const mockServer = Object.assign(Object.create(http.Server.prototype), {
114
- listen: mock(),
115
- on: mock(),
116
- close: mock(),
117
- });
118
-
119
- it('ignores non-POST requests', () => {
120
- const req = httpMocks.createRequest({ method: 'GET' });
121
- const resp = httpMocks.createResponse();
122
- onPostHandler.bind(mockServer)(req, resp, mock(), mock());
123
- expect(resp._getStatusCode()).toBe(405);
124
- expect(resp._getData()).toInclude('Method Not Allowed');
125
- });
126
-
127
- it('rejects requests from 3rd party origins', () => {
128
- const req = httpMocks.createRequest({
129
- method: 'POST',
130
- headers: { origin: 'https://bad.com' },
131
- });
132
- const resp = httpMocks.createResponse();
133
- const reject = mock();
134
- onPostHandler.bind(mockServer)(req, resp, mock(), reject);
135
- expect(reject).toHaveBeenCalledWith('Request origin not allowed.');
136
- });
137
-
138
- it('sets CORS headers', () => {
139
- const req = httpMocks.createRequest({
140
- method: 'POST',
141
- headers: { origin: configuratorUrlOrigin },
142
- // body: JSON.stringify({ email: ''}),
143
- });
144
- const resp = httpMocks.createResponse();
145
- const resolve = mock();
146
- const reject = mock();
147
- onPostHandler.bind(mockServer)(req, resp, resolve, reject);
148
- expect(resp.getHeaders()).toEqual({
149
- 'access-control-allow-origin': configuratorUrlOrigin,
150
- 'access-control-allow-methods': 'OPTIONS, GET, POST',
151
- });
152
- });
153
-
154
- it('sends a user obj', async () => {
155
- const mockUser = { email: 'foo@yahooinc.com', displayName: 'Foo' };
156
-
157
- const req = httpMocks.createRequest({
158
- method: 'POST',
159
- headers: { origin: configuratorUrlOrigin },
160
- });
161
- const resp = httpMocks.createResponse({
162
- eventEmitter: (await import('events')).EventEmitter,
163
- });
164
- const resolve = mock();
165
- const reject = mock();
166
- onPostHandler.bind(mockServer)(req, resp, resolve, reject);
167
- req.send(mockUser);
168
- expect(resp._getData()).toInclude('Authentication successful! Please close this window.');
169
- expect(reject).not.toHaveBeenCalled();
170
- expect(resolve).toHaveBeenCalledWith(mockUser);
171
- });
172
- });
173
-
174
- describe('logout', () => {
175
- it('removes the user cache', async () => {
176
- await writeCache(filepath, { email: 'user@yahooinc.com', name: 'User' });
177
- expect(await Bun.file(filepath).exists()).toBeTrue();
178
- await logout(filepath);
179
- expect(await Bun.file(filepath).exists()).toBeFalse();
180
- });
181
- });
182
-
183
- describe('login', () => {
184
- afterAll(async () => {
185
- await logout(); // cleanup
186
- });
187
-
188
- const mockFunc = mock(() => Promise.resolve({ email: 'foo@yahooinc.com' }));
189
-
190
- mock.module('./auth', () => ({
191
- authenticateUser: mockFunc,
192
- }));
193
-
194
- it('uses cache when user previously logged in', async () => {
195
- // Test multiple calls to login
196
- await login();
197
- await login();
198
- await login();
199
- expect(mockFunc).toHaveBeenCalledTimes(1);
200
- });
201
- });
202
- });