Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Persona: function() {
return _index.Persona;
},
personaClassNames: function() {
return _index.personaClassNames;
},
renderPersona_unstable: function() {
return _index.renderPersona_unstable;
},
usePersonaStyles_unstable: function() {
return _index.usePersonaStyles_unstable;
},
usePersona_unstable: function() {
return _index.usePersona_unstable;
}
});
const _index = require("./components/Persona/index");
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../src/Persona.ts"],"sourcesContent":["export type { PersonaProps, PersonaSlots, PersonaState } from './components/Persona/index';\nexport {\n Persona,\n personaClassNames,\n renderPersona_unstable,\n usePersonaStyles_unstable,\n usePersona_unstable,\n} from './components/Persona/index';\n"],"names":["Persona","personaClassNames","renderPersona_unstable","usePersonaStyles_unstable","usePersona_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEEA,OAAO;eAAPA,cAAO;;IACPC,iBAAiB;eAAjBA,wBAAiB;;IACjBC,sBAAsB;eAAtBA,6BAAsB;;IACtBC,yBAAyB;eAAzBA,gCAAyB;;IACzBC,mBAAmB;eAAnBA,0BAAmB;;;uBACd"}
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Persona", {
enumerable: true,
get: function() {
return Persona;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _renderPersona = require("./renderPersona");
const _usePersona = require("./usePersona");
const _usePersonaStylesstyles = require("./usePersonaStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const Persona = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _usePersona.usePersona_unstable)(props, ref);
(0, _usePersonaStylesstyles.usePersonaStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('usePersonaStyles_unstable')(state);
return (0, _renderPersona.renderPersona_unstable)(state);
});
Persona.displayName = 'Persona';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Persona/Persona.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderPersona_unstable } from './renderPersona';\nimport { usePersona_unstable } from './usePersona';\nimport { usePersonaStyles_unstable } from './usePersonaStyles.styles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { PersonaProps } from './Persona.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * A Persona is a visual representation of a person or status that showcases an Avatar, PresenceBadge,\n * or an Avatar with a PresenceBadge.\n */\nexport const Persona: ForwardRefComponent<PersonaProps> = React.forwardRef((props, ref) => {\n const state = usePersona_unstable(props, ref);\n\n usePersonaStyles_unstable(state);\n\n useCustomStyleHook_unstable('usePersonaStyles_unstable')(state);\n\n return renderPersona_unstable(state);\n});\n\nPersona.displayName = 'Persona';\n"],"names":["Persona","React","forwardRef","props","ref","state","usePersona_unstable","usePersonaStyles_unstable","useCustomStyleHook_unstable","renderPersona_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAYaA;;;eAAAA;;;;iEAZU;+BACgB;4BACH;wCACM;qCAGE;AAMrC,MAAMA,UAAAA,WAAAA,GAA6CC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACjF,MAAMC,QAAQC,IAAAA,+BAAAA,EAAoBH,OAAOC;IAEzCG,IAAAA,iDAAAA,EAA0BF;IAE1BG,IAAAA,gDAAAA,EAA4B,6BAA6BH;IAEzD,OAAOI,IAAAA,qCAAAA,EAAuBJ;AAChC;AAEAL,QAAQU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering Persona
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Persona/Persona.types.ts"],"sourcesContent":["import { Avatar } from '@fluentui/react-avatar';\nimport { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type PersonaSlots = {\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Avatar to display.\n *\n * If a PresenceBadge and an Avatar are provided, the Avatar will display the PresenceBadge as its presence.\n */\n avatar?: Slot<typeof Avatar>;\n\n /**\n * PresenceBadge to display.\n *\n * If `presenceOnly` is true, the PresenceBadge will be displayed instead of the Avatar.\n */\n presence?: Slot<typeof PresenceBadge>;\n\n /**\n * The first line of text in the Persona, larger than the rest of the lines.\n *\n * `primaryText` defaults to the `name` prop. We recomend to only use `name`, use `primaryText` when the text is\n * different than the `name` prop.\n */\n primaryText?: Slot<'span'>;\n\n /**\n * The second line of text in the Persona.\n */\n secondaryText?: Slot<'span'>;\n\n /**\n * The third line of text in the Persona.\n */\n tertiaryText?: Slot<'span'>;\n\n /**\n * The fourth line of text in the Persona.\n */\n quaternaryText?: Slot<'span'>;\n};\n\n/**\n * Persona Props\n */\nexport type PersonaProps = ComponentProps<PersonaSlots> & {\n /**\n * The name of the person or entity represented by the Persona.\n *\n * When `primaryText` is not provided, this will be used as the default value for `primaryText`.\n */\n name?: string;\n\n /**\n * Whether to display only the presence.\n *\n * @default false\n */\n presenceOnly?: boolean;\n\n /**\n * The size of a Persona and its text.\n *\n * @default medium\n */\n size?: 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | 'huge';\n\n /**\n * The position of the text relative to the avatar/presence.\n *\n * @default after\n */\n textPosition?: 'after' | 'before' | 'below';\n\n /**\n * The vertical alignment of the text relative to the avatar/presence.\n *\n * @default start\n */\n textAlignment?: 'center' | 'start';\n};\n\n/**\n * State used in rendering Persona\n */\nexport type PersonaState = ComponentState<PersonaSlots> &\n Required<Pick<PersonaProps, 'presenceOnly' | 'size' | 'textAlignment' | 'textPosition'>> & {\n /**\n * The number of text lines used.\n */\n numTextLines: number;\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAqFA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Persona: function() {
return _Persona.Persona;
},
personaClassNames: function() {
return _usePersonaStylesstyles.personaClassNames;
},
renderPersona_unstable: function() {
return _renderPersona.renderPersona_unstable;
},
usePersonaStyles_unstable: function() {
return _usePersonaStylesstyles.usePersonaStyles_unstable;
},
usePersona_unstable: function() {
return _usePersona.usePersona_unstable;
}
});
const _Persona = require("./Persona");
const _renderPersona = require("./renderPersona");
const _usePersona = require("./usePersona");
const _usePersonaStylesstyles = require("./usePersonaStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Persona/index.ts"],"sourcesContent":["export { Persona } from './Persona';\nexport type { PersonaProps, PersonaSlots, PersonaState } from './Persona.types';\nexport { renderPersona_unstable } from './renderPersona';\nexport { usePersona_unstable } from './usePersona';\nexport { personaClassNames, usePersonaStyles_unstable } from './usePersonaStyles.styles';\n"],"names":["Persona","personaClassNames","renderPersona_unstable","usePersonaStyles_unstable","usePersona_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,OAAO;eAAPA,gBAAO;;IAIPC,iBAAiB;eAAjBA,yCAAiB;;IAFjBC,sBAAsB;eAAtBA,qCAAsB;;IAEHC,yBAAyB;eAAzBA,iDAAyB;;IAD5CC,mBAAmB;eAAnBA,+BAAmB;;;yBAHJ;+BAEe;4BACH;wCACyB"}
@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderPersona_unstable", {
enumerable: true,
get: function() {
return renderPersona_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderPersona_unstable = (state)=>{
const { presenceOnly, textPosition } = state;
(0, _reactutilities.assertSlots)(state);
const coin = presenceOnly ? state.presence && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.presence, {}) : state.avatar && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.avatar, {});
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
children: [
(textPosition === 'after' || textPosition === 'below') && coin,
state.primaryText && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.primaryText, {}),
state.secondaryText && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.secondaryText, {}),
state.tertiaryText && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.tertiaryText, {}),
state.quaternaryText && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.quaternaryText, {}),
textPosition === 'before' && coin
]
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Persona/renderPersona.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { PersonaState, PersonaSlots } from './Persona.types';\n\n/**\n * Render the final JSX of Persona\n */\nexport const renderPersona_unstable = (state: PersonaState) => {\n const { presenceOnly, textPosition } = state;\n assertSlots<PersonaSlots>(state);\n\n const coin = presenceOnly ? state.presence && <state.presence /> : state.avatar && <state.avatar />;\n\n return (\n <state.root>\n {(textPosition === 'after' || textPosition === 'below') && coin}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n {state.tertiaryText && <state.tertiaryText />}\n {state.quaternaryText && <state.quaternaryText />}\n {textPosition === 'before' && coin}\n </state.root>\n );\n};\n"],"names":["renderPersona_unstable","state","presenceOnly","textPosition","assertSlots","coin","presence","_jsx","avatar","_jsxs","root","primaryText","secondaryText","tertiaryText","quaternaryText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,yBAAyB,CAACC;IACrC,MAAM,EAAEC,YAAY,EAAEC,YAAY,EAAE,GAAGF;IACvCG,IAAAA,2BAAAA,EAA0BH;IAE1B,MAAMI,OAAOH,eAAeD,MAAMK,QAAQ,IAAA,WAAA,GAAIC,IAAAA,eAAA,EAACN,MAAMK,QAAQ,EAAA,CAAA,KAAML,MAAMO,MAAM,IAAA,WAAA,GAAID,IAAAA,eAAA,EAACN,MAAMO,MAAM,EAAA,CAAA;IAEhG,OAAA,WAAA,GACEC,IAAAA,gBAAA,EAACR,MAAMS,IAAI,EAAA;;YACPP,CAAAA,iBAAiB,WAAWA,iBAAiB,OAAA,KAAYE;YAC1DJ,MAAMU,WAAW,IAAA,WAAA,GAAIJ,IAAAA,eAAA,EAACN,MAAMU,WAAW,EAAA,CAAA;YACvCV,MAAMW,aAAa,IAAA,WAAA,GAAIL,IAAAA,eAAA,EAACN,MAAMW,aAAa,EAAA,CAAA;YAC3CX,MAAMY,YAAY,IAAA,WAAA,GAAIN,IAAAA,eAAA,EAACN,MAAMY,YAAY,EAAA,CAAA;YACzCZ,MAAMa,cAAc,IAAA,WAAA,GAAIP,IAAAA,eAAA,EAACN,MAAMa,cAAc,EAAA,CAAA;YAC7CX,iBAAiB,YAAYE;;;AAGpC"}
@@ -0,0 +1,102 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "usePersona_unstable", {
enumerable: true,
get: function() {
return usePersona_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactavatar = require("@fluentui/react-avatar");
const _reactutilities = require("@fluentui/react-utilities");
const _reactbadge = require("@fluentui/react-badge");
const usePersona_unstable = (props, ref)=>{
const { name, presenceOnly = false, size = 'medium', textAlignment = 'start', textPosition = 'after' } = props;
const primaryText = _reactutilities.slot.optional(props.primaryText, {
renderByDefault: true,
defaultProps: {
children: name
},
elementType: 'span'
});
const secondaryText = _reactutilities.slot.optional(props.secondaryText, {
elementType: 'span'
});
const tertiaryText = _reactutilities.slot.optional(props.tertiaryText, {
elementType: 'span'
});
const quaternaryText = _reactutilities.slot.optional(props.quaternaryText, {
elementType: 'span'
});
const numTextLines = [
primaryText,
secondaryText,
tertiaryText,
quaternaryText
].filter(Boolean).length;
return {
numTextLines,
presenceOnly,
size,
textAlignment,
textPosition,
components: {
root: 'div',
avatar: _reactavatar.Avatar,
presence: _reactbadge.PresenceBadge,
primaryText: 'span',
secondaryText: 'span',
tertiaryText: 'span',
quaternaryText: 'span'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
...props,
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref
}, /* excludedPropNames */ [
'name'
]), {
elementType: 'div'
}),
avatar: !presenceOnly ? _reactutilities.slot.optional(props.avatar, {
renderByDefault: true,
defaultProps: {
name,
badge: props.presence,
size: avatarSizes[size]
},
elementType: _reactavatar.Avatar
}) : undefined,
presence: presenceOnly ? _reactutilities.slot.optional(props.presence, {
defaultProps: {
size: presenceSizes[size]
},
elementType: _reactbadge.PresenceBadge
}) : undefined,
primaryText,
secondaryText,
tertiaryText,
quaternaryText
};
};
const presenceSizes = {
'extra-small': 'tiny',
small: 'extra-small',
medium: 'small',
large: 'medium',
'extra-large': 'large',
huge: 'large'
};
const avatarSizes = {
'extra-small': 20,
small: 28,
medium: 32,
large: 36,
'extra-large': 40,
huge: 56
};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,273 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
personaClassNames: function() {
return personaClassNames;
},
usePersonaStyles_unstable: function() {
return usePersonaStyles_unstable;
}
});
const _react = require("@griffel/react");
const personaClassNames = {
root: 'fui-Persona',
avatar: 'fui-Persona__avatar',
presence: 'fui-Persona__presence',
primaryText: 'fui-Persona__primaryText',
secondaryText: 'fui-Persona__secondaryText',
tertiaryText: 'fui-Persona__tertiaryText',
quaternaryText: 'fui-Persona__quaternaryText'
};
const avatarSpacing = `--fui-Persona__avatar--spacing`;
const useRootClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rlroi9i", null, [
".rlroi9i{display:inline-grid;grid-auto-rows:max-content;grid-auto-flow:column;justify-items:start;grid-template-columns:max-content [middle] auto;}"
]);
/**
* Styles for the root slot
*/ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
beforeAfterCenter: {
wkccdc: "f1iantul"
},
after: {},
before: {
B7hvi0a: "f1tll2w5",
Budl1dq: "ffvkwdr"
},
below: {
Bxotwcr: "f1nkeedh",
B7hvi0a: "f1oiokrs",
Budl1dq: "f1emgwh2"
},
media: {
Ijaq50: "f1hek2iy"
},
mediaBeforeAfterCenter: {
Ijaq50: "fa4dipu"
},
start: {
qb2dma: "f9h729m"
},
center: {
qb2dma: "f7nlbp4"
},
afterAlignToPrimary: {
qb2dma: "f7nlbp4",
Ijaq50: "f1rnkkuc",
Bw0ie65: "f1warjpf"
},
beforeAlignToPrimary: {
qb2dma: "f7nlbp4",
Ijaq50: "f1rnkkuc",
Br312pm: "fwu52yu"
},
secondLineSpacing: {
B6of3ja: "f1ryq6si"
},
primary: {
Ijaq50: "f1q3ipgb"
},
secondary: {
Ijaq50: "f3drtdk"
},
tertiary: {
Ijaq50: "fa1o6s1"
},
quaternary: {
Ijaq50: "f1tuwaia"
}
}, {
d: [
".f1iantul{grid-template-rows:1fr [primary] max-content [secondary] max-content [tertiary] max-content [quaternary] max-content 1fr;}",
".f1tll2w5{justify-items:end;}",
".ffvkwdr{grid-template-columns:auto [middle] max-content;}",
".f1nkeedh{grid-auto-flow:unset;}",
".f1oiokrs{justify-items:center;}",
".f1emgwh2{grid-template-columns:unset;}",
".f1hek2iy{grid-row-start:span 5;}",
".fa4dipu{grid-row-start:span 6;}",
".f9h729m{align-self:start;}",
".f7nlbp4{align-self:center;}",
".f1rnkkuc{grid-row-start:unset;}",
".f1warjpf{grid-column-end:middle;}",
".fwu52yu{grid-column-start:middle;}",
".f1ryq6si{margin-top:-2px;}",
".f1q3ipgb{grid-row-start:primary;}",
".f3drtdk{grid-row-start:secondary;}",
".fa1o6s1{grid-row-start:tertiary;}",
".f1tuwaia{grid-row-start:quaternary;}"
]
});
const useAvatarSpacingStyles = /*#__PURE__*/ (0, _react.__styles)({
"extra-small": {
Bs1gm4r: "f1e48tse"
},
small: {
Bs1gm4r: "f18q9vkd"
},
medium: {
Bs1gm4r: "f18q9vkd"
},
large: {
Bs1gm4r: "fx34bi6"
},
"extra-large": {
Bs1gm4r: "fx34bi6"
},
huge: {
Bs1gm4r: "f1o96qtm"
},
after: {
t21cq0: [
"f103ycu4",
"f1tao51"
]
},
below: {
jrapky: "fbo7acy"
},
before: {
Frg6f3: [
"f1tao51",
"f103ycu4"
]
}
}, {
d: [
".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}",
".f18q9vkd{--fui-Persona__avatar--spacing:var(--spacingHorizontalS);}",
".fx34bi6{--fui-Persona__avatar--spacing:var(--spacingHorizontalMNudge);}",
".f1o96qtm{--fui-Persona__avatar--spacing:var(--spacingHorizontalM);}",
".f103ycu4{margin-right:var(--fui-Persona__avatar--spacing);}",
".f1tao51{margin-left:var(--fui-Persona__avatar--spacing);}",
".fbo7acy{margin-bottom:var(--fui-Persona__avatar--spacing);}"
]
});
const usePresenceSpacingStyles = /*#__PURE__*/ (0, _react.__styles)({
small: {
Bs1gm4r: "f1e48tse"
}
}, {
d: [
".f1e48tse{--fui-Persona__avatar--spacing:var(--spacingHorizontalSNudge);}"
]
});
const usePersonaStyles_unstable = (state)=>{
'use no memo';
const { presenceOnly, size, textAlignment, textPosition } = state;
const alignToPrimary = presenceOnly && textAlignment === 'start' && size !== 'extra-large' && size !== 'huge';
const alignBeforeAfterCenter = textPosition !== 'below' && textAlignment === 'center';
const { primaryTextClassName, optionalTextClassName } = useTextClassNames(state, alignToPrimary);
const rootClassName = useRootClassName();
const styles = useStyles();
const avatarSpacingStyles = useAvatarSpacingStyles();
const presenceSpacingStyles = {
...avatarSpacingStyles,
...usePresenceSpacingStyles()
};
state.root.className = (0, _react.mergeClasses)(personaClassNames.root, rootClassName, alignBeforeAfterCenter && styles.beforeAfterCenter, styles[textPosition], state.root.className);
if (state.avatar) {
state.avatar.className = (0, _react.mergeClasses)(personaClassNames.avatar, textPosition !== 'below' && styles.media, alignBeforeAfterCenter && styles.mediaBeforeAfterCenter, styles[textAlignment], avatarSpacingStyles[size], avatarSpacingStyles[textPosition], state.avatar.className);
}
if (state.presence) {
state.presence.className = (0, _react.mergeClasses)(personaClassNames.presence, textPosition !== 'below' && styles.media, alignBeforeAfterCenter && styles.mediaBeforeAfterCenter, styles[textAlignment], presenceSpacingStyles[size], presenceSpacingStyles[textPosition], textPosition === 'after' && alignToPrimary && styles.afterAlignToPrimary, textPosition === 'before' && alignToPrimary && styles.beforeAlignToPrimary, state.presence.className);
}
if (state.primaryText) {
state.primaryText.className = (0, _react.mergeClasses)(personaClassNames.primaryText, alignBeforeAfterCenter && styles.primary, primaryTextClassName, state.primaryText.className);
}
if (state.secondaryText) {
state.secondaryText.className = (0, _react.mergeClasses)(personaClassNames.secondaryText, alignBeforeAfterCenter && styles.secondary, optionalTextClassName, styles.secondLineSpacing, state.secondaryText.className);
}
if (state.tertiaryText) {
state.tertiaryText.className = (0, _react.mergeClasses)(personaClassNames.tertiaryText, alignBeforeAfterCenter && styles.tertiary, optionalTextClassName, state.tertiaryText.className);
}
if (state.quaternaryText) {
state.quaternaryText.className = (0, _react.mergeClasses)(personaClassNames.quaternaryText, alignBeforeAfterCenter && styles.quaternary, optionalTextClassName, state.quaternaryText.className);
}
return state;
};
const usePrimaryTextBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rvj41k9", null, [
".rvj41k9{display:block;color:var(--colorNeutralForeground1);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase300);}"
]);
const useOptionalTextBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("rp1pf9e", null, [
".rp1pf9e{display:block;color:var(--colorNeutralForeground2);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"
]);
const useTextStyles = /*#__PURE__*/ (0, _react.__styles)({
beforeAlignToPrimary: {
Bw0ie65: "f1warjpf"
},
afterAlignToPrimary: {
Br312pm: "fwu52yu"
},
body1: {
Bahqtrf: "fk6fouc",
Be2twd7: "fkhj508",
Bhrd7zp: "figsok6",
Bg96gwp: "f1i3iumi"
},
caption1: {
Bahqtrf: "fk6fouc",
Be2twd7: "fy9rknc",
Bhrd7zp: "figsok6",
Bg96gwp: "fwrc4pm"
},
subtitle2: {
Bahqtrf: "fk6fouc",
Be2twd7: "fod5ikn",
Bhrd7zp: "fl43uef",
Bg96gwp: "faaz57k"
}
}, {
d: [
".f1warjpf{grid-column-end:middle;}",
".fwu52yu{grid-column-start:middle;}",
".fk6fouc{font-family:var(--fontFamilyBase);}",
".fkhj508{font-size:var(--fontSizeBase300);}",
".figsok6{font-weight:var(--fontWeightRegular);}",
".f1i3iumi{line-height:var(--lineHeightBase300);}",
".fy9rknc{font-size:var(--fontSizeBase200);}",
".fwrc4pm{line-height:var(--lineHeightBase200);}",
".fod5ikn{font-size:var(--fontSizeBase400);}",
".fl43uef{font-weight:var(--fontWeightSemibold);}",
".faaz57k{line-height:var(--lineHeightBase400);}"
]
});
const useTextClassNames = (state, alignToPrimary)=>{
const { presenceOnly, size, textPosition } = state;
const primaryTextBaseClassName = usePrimaryTextBaseClassName();
const optionalTextBaseClassName = useOptionalTextBaseClassName();
const textStyles = useTextStyles();
let primaryTextSize;
let alignToPrimaryClassName;
if (presenceOnly) {
if (size === 'extra-small') {
primaryTextSize = state.numTextLines <= 1 && textStyles.caption1;
} else if (size === 'extra-large' || size === 'huge') {
primaryTextSize = textStyles.subtitle2;
}
if (alignToPrimary) {
if (textPosition === 'before') {
alignToPrimaryClassName = textStyles.beforeAlignToPrimary;
} else if (textPosition === 'after') {
alignToPrimaryClassName = textStyles.afterAlignToPrimary;
}
}
} else {
if (size === 'huge') {
primaryTextSize = textStyles.subtitle2;
} else if (size === 'extra-large') {
primaryTextSize = textStyles.subtitle2;
}
}
return {
primaryTextClassName: (0, _react.mergeClasses)(primaryTextBaseClassName, primaryTextSize, alignToPrimaryClassName),
optionalTextClassName: (0, _react.mergeClasses)(optionalTextBaseClassName, !presenceOnly && size === 'huge' && textStyles.body1, alignToPrimaryClassName)
};
};
File diff suppressed because one or more lines are too long
+28
View File
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Persona: function() {
return _Persona.Persona;
},
personaClassNames: function() {
return _Persona.personaClassNames;
},
renderPersona_unstable: function() {
return _Persona.renderPersona_unstable;
},
usePersonaStyles_unstable: function() {
return _Persona.usePersonaStyles_unstable;
},
usePersona_unstable: function() {
return _Persona.usePersona_unstable;
}
});
const _Persona = require("./Persona");
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Persona,\n personaClassNames,\n renderPersona_unstable,\n usePersonaStyles_unstable,\n usePersona_unstable,\n} from './Persona';\nexport type { PersonaProps, PersonaSlots, PersonaState } from './Persona';\n"],"names":["Persona","personaClassNames","renderPersona_unstable","usePersonaStyles_unstable","usePersona_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACEA,OAAO;eAAPA,gBAAO;;IACPC,iBAAiB;eAAjBA,0BAAiB;;IACjBC,sBAAsB;eAAtBA,+BAAsB;;IACtBC,yBAAyB;eAAzBA,kCAAyB;;IACzBC,mBAAmB;eAAnBA,4BAAmB;;;yBACd"}