@transferwise/components 0.0.0-experimental-c239b44 → 0.0.0-experimental-e0993c8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/header/Header.js +79 -41
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +76 -41
- package/build/header/Header.mjs.map +1 -1
- package/build/i18n/es.json +2 -0
- package/build/i18n/es.json.js +2 -0
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +2 -0
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/index.js +1 -1
- package/build/index.mjs +1 -1
- package/build/inputs/SelectInput.js +1 -1
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +1 -1
- package/build/listItem/IconButton/ListItemIconButton.js +1 -1
- package/build/listItem/IconButton/ListItemIconButton.js.map +1 -1
- package/build/listItem/IconButton/ListItemIconButton.mjs +1 -1
- package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -1
- package/build/listItem/ListItem.js +18 -18
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +18 -18
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/ListItemContext.js.map +1 -1
- package/build/listItem/ListItemContext.mjs.map +1 -1
- package/build/main.css +32 -14
- package/build/styles/header/Header.css +32 -14
- package/build/styles/main.css +32 -14
- package/build/title/Title.js +10 -4
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +6 -4
- package/build/title/Title.mjs.map +1 -1
- package/build/types/header/Header.d.ts +28 -11
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/header/index.d.ts +1 -0
- package/build/types/header/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/listItem/ListItem.d.ts +3 -3
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/ListItemContext.d.ts +2 -2
- package/build/types/listItem/ListItemContext.d.ts.map +1 -1
- package/build/types/title/Title.d.ts +4 -5
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/header/Header.accessibility.docs.mdx +85 -0
- package/src/header/Header.css +32 -14
- package/src/header/Header.less +28 -9
- package/src/header/Header.spec.tsx +68 -50
- package/src/header/Header.story.tsx +190 -36
- package/src/header/Header.tsx +122 -70
- package/src/header/index.ts +1 -0
- package/src/i18n/es.json +2 -0
- package/src/index.ts +1 -0
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +2 -2
- package/src/listItem/IconButton/ListItemIconButton.tsx +2 -2
- package/src/listItem/ListItem.spec.tsx +279 -221
- package/src/listItem/ListItem.tsx +20 -19
- package/src/listItem/ListItemContext.tsx +2 -2
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +6 -6
- package/src/listItem/_stories/ListItem.story.tsx +19 -12
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +43 -43
- package/src/listItem/test-utils.tsx +1 -1
- package/src/main.css +32 -14
- package/src/title/Title.tsx +25 -12
|
@@ -48,8 +48,8 @@ const ListItem = ({
|
|
|
48
48
|
inverted,
|
|
49
49
|
media,
|
|
50
50
|
spotlight,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
valueTitle,
|
|
52
|
+
valueSubtitle,
|
|
53
53
|
control = null,
|
|
54
54
|
disabled,
|
|
55
55
|
className,
|
|
@@ -65,11 +65,11 @@ const ListItem = ({
|
|
|
65
65
|
...(subtitle ? {
|
|
66
66
|
subtitle: `${idPrefix}_subtitle`
|
|
67
67
|
} : {}),
|
|
68
|
-
...(
|
|
69
|
-
|
|
68
|
+
...(valueTitle ? {
|
|
69
|
+
valueTitle: `${idPrefix}_value-title`
|
|
70
70
|
} : {}),
|
|
71
|
-
...(
|
|
72
|
-
|
|
71
|
+
...(valueSubtitle ? {
|
|
72
|
+
valueSubtitle: `${idPrefix}_value-subtitle`
|
|
73
73
|
} : {}),
|
|
74
74
|
control: `${idPrefix}_control`,
|
|
75
75
|
...(prompt ? {
|
|
@@ -82,7 +82,7 @@ const ListItem = ({
|
|
|
82
82
|
const isPartiallyInteractive = Boolean((controlType === 'button' || controlType === 'icon-button') && controlProps?.partiallyInteractive);
|
|
83
83
|
const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;
|
|
84
84
|
const isButtonAsLink = (controlType === 'button' || controlType === 'icon-button') && Boolean(controlProps?.href);
|
|
85
|
-
const titlesAndValues = [inverted ? ids.subtitle : ids.title, inverted ? ids.title : ids.subtitle, inverted ? ids.
|
|
85
|
+
const titlesAndValues = [inverted ? ids.subtitle : ids.title, inverted ? ids.title : ids.subtitle, inverted ? ids.valueSubtitle : ids.valueTitle, inverted ? ids.valueTitle : ids.valueSubtitle].join(' ');
|
|
86
86
|
const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');
|
|
87
87
|
const describedByIds = useMemo(() => {
|
|
88
88
|
return isFullyInteractive && !isButtonAsLink ? additionalInfoPrompt : `${titlesAndValues} ${additionalInfoPrompt}`;
|
|
@@ -187,27 +187,27 @@ const ListItem = ({
|
|
|
187
187
|
}
|
|
188
188
|
return inverted ? [...titles].reverse() : titles;
|
|
189
189
|
})()
|
|
190
|
-
}), (
|
|
190
|
+
}), (valueTitle || valueSubtitle) && /*#__PURE__*/jsx("span", {
|
|
191
191
|
className: clsx('wds-list-item-value', {
|
|
192
|
-
'flex-column':
|
|
193
|
-
'wds-list-item-body-center':
|
|
192
|
+
'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,
|
|
193
|
+
'wds-list-item-body-center': valueTitle && !valueSubtitle || !valueTitle && valueSubtitle
|
|
194
194
|
}),
|
|
195
195
|
children: (() => {
|
|
196
196
|
const values = [];
|
|
197
|
-
if (
|
|
197
|
+
if (valueTitle) {
|
|
198
198
|
values.push(/*#__PURE__*/jsx(Body, {
|
|
199
|
-
id: ids.
|
|
199
|
+
id: ids.valueTitle,
|
|
200
200
|
type: Typography.BODY_LARGE_BOLD,
|
|
201
201
|
className: "wds-list-item-title-value",
|
|
202
|
-
children:
|
|
203
|
-
}, ids.
|
|
202
|
+
children: valueTitle
|
|
203
|
+
}, ids.valueTitle));
|
|
204
204
|
}
|
|
205
|
-
if (
|
|
205
|
+
if (valueSubtitle) {
|
|
206
206
|
values.push(/*#__PURE__*/jsx(Body, {
|
|
207
|
-
id: ids.
|
|
207
|
+
id: ids.valueSubtitle,
|
|
208
208
|
className: "wds-list-item-subtitle-value",
|
|
209
|
-
children:
|
|
210
|
-
}, ids.
|
|
209
|
+
children: valueSubtitle
|
|
210
|
+
}, ids.valueSubtitle));
|
|
211
211
|
}
|
|
212
212
|
return inverted ? [...values].reverse() : values;
|
|
213
213
|
})()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.mjs","sources":["../../src/listItem/ListItem.tsx"],"sourcesContent":["import {\n useContext,\n useId,\n useMemo,\n useState,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Typography } from '../common';\nimport Body from '../body';\nimport { AdditionalInfo } from './AdditionalInfo';\nimport { IconButton, type ListItemIconButtonProps } from './IconButton';\nimport { Checkbox, type ListItemCheckboxProps } from './Checkbox';\nimport { Navigation, type ListItemNavigationProps } from './Navigation';\nimport { clsx } from 'clsx';\nimport { Button, type ListItemButtonProps } from './Button';\nimport { Radio, type ListItemRadioProps } from './Radio';\nimport { Switch, type ListItemSwitchProps } from './Switch';\nimport { AvatarLayout } from './AvatarLayout';\nimport { AvatarView } from './AvatarView';\nimport { Image } from './Image';\nimport { Prompt } from './Prompt';\nimport { PrimitiveAnchor } from '../primitives';\nimport {\n ListItemContext,\n type ListItemContextData,\n type ListItemMediaSize,\n} from './ListItemContext';\n\nexport type ListItemTypes =\n | 'non-interactive'\n | 'navigation'\n | 'radio'\n | 'checkbox'\n | 'switch'\n | 'button'\n | 'icon-button';\n\nexport type ListItemControlProps =\n | ListItemNavigationProps\n | ListItemCheckboxProps\n | ListItemButtonProps\n | ListItemIconButtonProps\n | ListItemRadioProps\n | ListItemSwitchProps;\n\nexport type ListItemProps = {\n as?: 'li' | 'div';\n /**\n * Swaps vertical hierarchy of title and subtitle and their corresponding right values.\n */\n inverted?: boolean;\n disabled?: boolean;\n /**\n * Highlights the list item as an action to be taken or already taken. <br />\n */\n spotlight?: 'active' | 'inactive';\n title: ReactNode;\n subtitle?: ReactNode;\n /**\n * Requires `<ListItem.AdditionalInfo />` component as a sole child. <br />\n * Can be only rendered if `subtitle` is also provided.\n */\n additionalInfo?: ReactNode;\n value?: ReactNode;\n subvalue?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br />\n * `<ListItem.AvatarView />`,\n * `<ListItem.AvatarLayout />` or\n * `<ListItem.Image />`\n */\n media?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br/>\n * `<ListItem.Button />`, <br/>\n * `<ListItem.Checkbox />`, <br/>\n * `<ListItem.IconButton />`, <br/>\n * `<ListItem.Navigation />`, <br/>\n * `<ListItem.Radio />`, or\n * `<ListItem.Switch />`\n */\n control?: ReactNode;\n /**\n * Requires `<ListItem.Prompt />` component as a sole child.\n */\n prompt?: ReactNode;\n className?: string;\n /**\n * A number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration. E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`. <br />\n * Controls the width ratio of left side content (title and subtitle) to the right side content.\n */\n valueColumnWidth?: number;\n id?: string;\n};\n\n/**\n * @see [Design documentation](https://wise.design/components/list-item)\n * @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n */\nexport const ListItem = ({\n as: ListItemElement = 'li',\n title,\n subtitle,\n additionalInfo,\n prompt,\n inverted,\n media,\n spotlight,\n value,\n subvalue,\n control = null,\n disabled,\n className,\n valueColumnWidth,\n id,\n}: ListItemProps) => {\n const idPrefix = useId();\n const [controlProps, setControlProps] = useState<ListItemControlProps>({});\n const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');\n const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();\n\n const ids: ListItemContextData['ids'] = {\n title: `${idPrefix}_title`,\n ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),\n ...(value ? { value: `${idPrefix}_value` } : {}),\n ...(subvalue ? { subvalue: `${idPrefix}_subvalue` } : {}),\n control: `${idPrefix}_control`,\n ...(prompt ? { prompt: `${idPrefix}_prompt` } : {}),\n ...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),\n };\n\n const isPartiallyInteractive = Boolean(\n (controlType === 'button' || controlType === 'icon-button') &&\n (controlProps as ListItemButtonProps | ListItemIconButtonProps)?.partiallyInteractive,\n );\n const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;\n const isButtonAsLink =\n (controlType === 'button' || controlType === 'icon-button') &&\n Boolean((controlProps as ListItemButtonProps | ListItemIconButtonProps)?.href);\n\n const titlesAndValues = [\n inverted ? ids.subtitle : ids.title,\n inverted ? ids.title : ids.subtitle,\n inverted ? ids.subvalue : ids.value,\n inverted ? ids.value : ids.subvalue,\n ].join(' ');\n const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');\n\n const describedByIds = useMemo(() => {\n return isFullyInteractive && !isButtonAsLink\n ? additionalInfoPrompt\n : `${titlesAndValues} ${additionalInfoPrompt}`;\n }, [isFullyInteractive]);\n\n const listItemContext = useMemo(\n () => ({\n setControlType,\n setControlProps,\n setMediaSize,\n ids,\n props: { disabled, inverted },\n mediaSize,\n describedByIds,\n }),\n [describedByIds, mediaSize],\n );\n const gridColumnsStyle = {\n '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',\n '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr',\n } as React.CSSProperties;\n\n const getFeatureClassName = () => {\n const partials = [];\n const hasMedia = Boolean(media);\n const hasControl = Boolean(control);\n const hasInfo = Boolean(additionalInfo);\n const hasPrompt = Boolean(prompt);\n\n /* eslint-disable functional/immutable-data */\n if (hasMedia && hasControl) {\n partials.push('wds-list-item-hasMedia-hasControl');\n }\n\n if (hasMedia && !hasControl) {\n partials.push('wds-list-item-hasMedia-noControl');\n }\n\n if (!hasMedia && hasControl) {\n partials.push('wds-list-item-noMedia-hasControl');\n }\n\n if (!hasMedia && !hasControl) {\n partials.push('wds-list-item-noMedia-noControl');\n }\n\n if (hasInfo && hasPrompt) {\n partials.push('wds-list-item-hasInfo-hasPrompt');\n }\n if (hasInfo && !hasPrompt) {\n partials.push('wds-list-item-hasInfo-noPrompt');\n }\n if (!hasInfo && hasPrompt) {\n partials.push('wds-list-item-noInfo-hasPrompt');\n }\n if (!hasInfo && !hasPrompt) {\n partials.push('wds-list-item-noInfo-noPrompt');\n }\n /* eslint-enable functional/immutable-data */\n\n return partials.join(' ');\n };\n\n return (\n <ListItemContext.Provider value={listItemContext}>\n <ListItemElement\n className={clsx(\n 'wds-list-item',\n `wds-list-item-${controlType}`,\n getFeatureClassName(),\n {\n 'wds-list-item-interactive': isFullyInteractive,\n 'wds-list-item-partially-interactive': isPartiallyInteractive,\n [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:\n isFullyInteractive && !!spotlight,\n disabled,\n },\n className,\n )}\n id={id}\n aria-disabled={disabled}\n >\n {spotlight === 'inactive' && (\n <svg aria-hidden=\"true\" className=\"wds-list-item-spotlight__border\">\n <rect />\n </svg>\n )}\n\n <View\n {...{\n isPartiallyInteractive,\n subtitle,\n additionalInfo,\n disabled,\n prompt,\n controlType,\n controlProps,\n }}\n className={getFeatureClassName()}\n >\n {media && <div className=\"wds-list-item-media\">{media}</div>}\n\n {/* Title + Subtitle + Values - Group */}\n <div\n className=\"wds-list-item-body\"\n style={valueColumnWidth ? gridColumnsStyle : undefined}\n >\n {/* Title + Subtitle + Values - Group */}\n <span\n className={clsx({\n 'wds-list-item-body-center': title && !subtitle,\n })}\n >\n {(() => {\n const titles = [\n <Body\n key={ids.title}\n id={ids.title}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title\"\n >\n {title}\n </Body>,\n ];\n if (subtitle) {\n titles.push(\n <Body key={ids.subtitle} id={ids.subtitle} className=\"wds-list-item-subtitle\">\n {subtitle}\n </Body>,\n );\n }\n return inverted ? [...titles].reverse() : titles;\n })()}\n </span>\n\n {(value || subvalue) && (\n <span\n className={clsx('wds-list-item-value', {\n 'flex-column': value !== undefined || subvalue !== undefined,\n 'wds-list-item-body-center': (value && !subvalue) || (!value && subvalue),\n })}\n >\n {(() => {\n const values = [];\n if (value) {\n values.push(\n <Body\n key={ids.value}\n id={ids.value}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title-value\"\n >\n {value}\n </Body>,\n );\n }\n if (subvalue) {\n values.push(\n <Body\n key={ids.subvalue}\n id={ids.subvalue}\n className=\"wds-list-item-subtitle-value\"\n >\n {subvalue}\n </Body>,\n );\n }\n return inverted ? [...values].reverse() : values;\n })()}\n </span>\n )}\n </div>\n\n {control === null ? null : (\n <Body\n className={clsx('wds-list-item-control-wrapper', {\n 'wds-list-item-button-control': controlType === 'button',\n })}\n style={\n {\n '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto',\n } as React.CSSProperties\n }\n >\n {control}\n </Body>\n )}\n </View>\n </ListItemElement>\n </ListItemContext.Provider>\n );\n};\n\ntype ViewProps = PropsWithChildren<{\n isPartiallyInteractive: boolean;\n controlType?: ListItemTypes;\n controlProps?: ListItemControlProps;\n}> &\n Pick<ListItemProps, 'subtitle' | 'additionalInfo' | 'disabled' | 'prompt' | 'className'>;\n\nfunction View({\n children,\n subtitle,\n additionalInfo,\n prompt,\n disabled,\n isPartiallyInteractive,\n controlType = 'non-interactive',\n controlProps,\n className = '',\n}: ViewProps) {\n const { ids, describedByIds } = useContext<ListItemContextData>(ListItemContext);\n const isLinkControl = ['navigation'].includes(controlType);\n\n const isHrefProvided = isLinkControl && !!(controlProps as ListItemNavigationProps)?.href;\n\n const renderExtras = () => (\n <>\n {Boolean(subtitle) && additionalInfo}\n {prompt}\n </>\n );\n\n if (isLinkControl && isHrefProvided) {\n return (\n // for link instances of .Navigation, .IconButton, .Button\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <PrimitiveAnchor\n aria-describedby={describedByIds}\n href={(controlProps as ListItemNavigationProps)?.href}\n target={(controlProps as ListItemNavigationProps)?.target}\n className={clsx('wds-list-item-view d-flex flex-row', {\n 'wds-list-item-control': controlType === 'navigation',\n })}\n disabled={disabled}\n >\n {children}\n </PrimitiveAnchor>\n\n {renderExtras()}\n </div>\n );\n }\n\n if (isPartiallyInteractive || controlType === 'non-interactive') {\n return (\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <div className={clsx('wds-list-item-view d-flex flex-row')}>{children}</div>\n\n {renderExtras()}\n </div>\n );\n }\n\n // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc\n // Radio cannot be wrapped in a <fieldset> element to announce it as a group.\n const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';\n return (\n <InputWrapper className={clsx('wds-list-item-gridWrapper', className)}>\n <label\n htmlFor={ids.control}\n className={clsx('wds-list-item-view', {\n clickable: !disabled,\n fullyInteractive: !isPartiallyInteractive,\n })}\n >\n {children}\n </label>\n\n {renderExtras()}\n </InputWrapper>\n );\n}\n\nListItem.Image = Image;\nListItem.AvatarView = AvatarView;\nListItem.AvatarLayout = AvatarLayout;\nListItem.AdditionalInfo = AdditionalInfo;\nListItem.Checkbox = Checkbox;\nListItem.Radio = Radio;\nListItem.IconButton = IconButton;\nListItem.Navigation = Navigation;\nListItem.Button = Button;\nListItem.Switch = Switch;\nListItem.Prompt = Prompt;\n\nexport default ListItem;\n"],"names":["ListItem","as","ListItemElement","title","subtitle","additionalInfo","prompt","inverted","media","spotlight","value","subvalue","control","disabled","className","valueColumnWidth","id","idPrefix","useId","controlProps","setControlProps","useState","controlType","setControlType","mediaSize","setMediaSize","ids","isPartiallyInteractive","Boolean","partiallyInteractive","isFullyInteractive","isButtonAsLink","href","titlesAndValues","join","additionalInfoPrompt","filter","describedByIds","useMemo","listItemContext","props","gridColumnsStyle","getFeatureClassName","partials","hasMedia","hasControl","hasInfo","hasPrompt","push","_jsx","ListItemContext","Provider","children","_jsxs","clsx","View","style","undefined","titles","Body","type","Typography","BODY_LARGE_BOLD","reverse","values","useContext","isLinkControl","includes","isHrefProvided","renderExtras","_Fragment","PrimitiveAnchor","target","InputWrapper","htmlFor","clickable","fullyInteractive","Image","AvatarView","AvatarLayout","AdditionalInfo","Checkbox","Radio","IconButton","Navigation","Button","Switch","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGO,MAAMA,QAAQ,GAAGA,CAAC;EACvBC,EAAE,EAAEC,eAAe,GAAG,IAAI;EAC1BC,KAAK;EACLC,QAAQ;EACRC,cAAc;EACdC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC,QAAQ;AACRC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,SAAS;EACTC,gBAAgB;AAChBC,EAAAA;AAAE,CACY,KAAI;AAClB,EAAA,MAAMC,QAAQ,GAAGC,KAAK,EAAE;EACxB,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGC,QAAQ,CAAuB,EAAE,CAAC;EAC1E,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGF,QAAQ,CAAgB,iBAAiB,CAAC;EAChF,MAAM,CAACG,SAAS,EAAEC,YAAY,CAAC,GAAGJ,QAAQ,EAAiC;AAE3E,EAAA,MAAMK,GAAG,GAA+B;IACtCvB,KAAK,EAAE,CAAA,EAAGc,QAAQ,CAAA,MAAA,CAAQ;AAC1B,IAAA,IAAIb,QAAQ,GAAG;MAAEA,QAAQ,EAAE,GAAGa,QAAQ,CAAA,SAAA;KAAa,GAAG,EAAE,CAAC;AACzD,IAAA,IAAIP,KAAK,GAAG;MAAEA,KAAK,EAAE,GAAGO,QAAQ,CAAA,MAAA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,QAAQ;AACpB+D,QAAAA,gBAAgB,EAAE,CAACjD;AACpB,OAAA,CAAE;AAAAyB,MAAAA,QAAA,EAEFA;AAAQ,KACJ,CAEP,EAACiB,YAAY,EAAE;AAAA,GACH,CAAC;AAEnB;AAEArE,QAAQ,CAAC6E,KAAK,GAAGA,KAAK;AACtB7E,QAAQ,CAAC8E,UAAU,GAAGA,UAAU;AAChC9E,QAAQ,CAAC+E,YAAY,GAAGA,YAAY;AACpC/E,QAAQ,CAACgF,cAAc,GAAGA,cAAc;AACxChF,QAAQ,CAACiF,QAAQ,GAAGA,QAAQ;AAC5BjF,QAAQ,CAACkF,KAAK,GAAGA,KAAK;AACtBlF,QAAQ,CAACmF,UAAU,GAAGA,UAAU;AAChCnF,QAAQ,CAACoF,UAAU,GAAGA,UAAU;AAChCpF,QAAQ,CAACqF,MAAM,GAAGA,MAAM;AACxBrF,QAAQ,CAACsF,MAAM,GAAGA,MAAM;AACxBtF,QAAQ,CAACuF,MAAM,GAAGA,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"ListItem.mjs","sources":["../../src/listItem/ListItem.tsx"],"sourcesContent":["import {\n useContext,\n useId,\n useMemo,\n useState,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Typography } from '../common';\nimport Body from '../body';\nimport { AdditionalInfo } from './AdditionalInfo';\nimport { IconButton, type ListItemIconButtonProps } from './IconButton';\nimport { Checkbox, type ListItemCheckboxProps } from './Checkbox';\nimport { Navigation, type ListItemNavigationProps } from './Navigation';\nimport { clsx } from 'clsx';\nimport { Button, type ListItemButtonProps } from './Button';\nimport { Radio, type ListItemRadioProps } from './Radio';\nimport { Switch, type ListItemSwitchProps } from './Switch';\nimport { AvatarLayout } from './AvatarLayout';\nimport { AvatarView } from './AvatarView';\nimport { Image } from './Image';\nimport { Prompt } from './Prompt';\nimport { PrimitiveAnchor } from '../primitives';\nimport {\n ListItemContext,\n type ListItemContextData,\n type ListItemMediaSize,\n} from './ListItemContext';\n\nexport type ListItemTypes =\n | 'non-interactive'\n | 'navigation'\n | 'radio'\n | 'checkbox'\n | 'switch'\n | 'button'\n | 'icon-button';\n\nexport type ListItemControlProps =\n | ListItemNavigationProps\n | ListItemCheckboxProps\n | ListItemButtonProps\n | ListItemIconButtonProps\n | ListItemRadioProps\n | ListItemSwitchProps;\n\nexport type ListItemProps = {\n as?: 'li' | 'div';\n /**\n * Swaps vertical hierarchy of title and subtitle and their corresponding right values.\n */\n inverted?: boolean;\n disabled?: boolean;\n /**\n * Highlights the list item as an action to be taken or already taken. <br />\n */\n spotlight?: 'active' | 'inactive';\n title: ReactNode;\n subtitle?: ReactNode;\n /**\n * Requires `<ListItem.AdditionalInfo />` component as a sole child. <br />\n * Can be only rendered if `subtitle` is also provided.\n */\n additionalInfo?: ReactNode;\n valueTitle?: ReactNode;\n valueSubtitle?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br />\n * `<ListItem.AvatarView />`,\n * `<ListItem.AvatarLayout />` or\n * `<ListItem.Image />`\n */\n media?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br/>\n * `<ListItem.Button />`, <br/>\n * `<ListItem.Checkbox />`, <br/>\n * `<ListItem.IconButton />`, <br/>\n * `<ListItem.Navigation />`, <br/>\n * `<ListItem.Radio />`, or\n * `<ListItem.Switch />`\n */\n control?: ReactNode;\n /**\n * Requires `<ListItem.Prompt />` component as a sole child.\n */\n prompt?: ReactNode;\n className?: string;\n /**\n * A number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration. E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`. <br />\n * Controls the width ratio of left side content (title and subtitle) to the right side content.\n */\n valueColumnWidth?: number;\n id?: string;\n};\n\n/**\n * @see [Design documentation](https://wise.design/components/list-item)\n * @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n */\nexport const ListItem = ({\n as: ListItemElement = 'li',\n title,\n subtitle,\n additionalInfo,\n prompt,\n inverted,\n media,\n spotlight,\n valueTitle,\n valueSubtitle,\n control = null,\n disabled,\n className,\n valueColumnWidth,\n id,\n}: ListItemProps) => {\n const idPrefix = useId();\n const [controlProps, setControlProps] = useState<ListItemControlProps>({});\n const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');\n const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();\n\n const ids: ListItemContextData['ids'] = {\n title: `${idPrefix}_title`,\n ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),\n ...(valueTitle ? { valueTitle: `${idPrefix}_value-title` } : {}),\n ...(valueSubtitle ? { valueSubtitle: `${idPrefix}_value-subtitle` } : {}),\n control: `${idPrefix}_control`,\n ...(prompt ? { prompt: `${idPrefix}_prompt` } : {}),\n ...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),\n };\n\n const isPartiallyInteractive = Boolean(\n (controlType === 'button' || controlType === 'icon-button') &&\n (controlProps as ListItemButtonProps | ListItemIconButtonProps)?.partiallyInteractive,\n );\n const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;\n const isButtonAsLink =\n (controlType === 'button' || controlType === 'icon-button') &&\n Boolean((controlProps as ListItemButtonProps | ListItemIconButtonProps)?.href);\n\n const titlesAndValues = [\n inverted ? ids.subtitle : ids.title,\n inverted ? ids.title : ids.subtitle,\n inverted ? ids.valueSubtitle : ids.valueTitle,\n inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');\n\n const describedByIds = useMemo(() => {\n return isFullyInteractive && !isButtonAsLink\n ? additionalInfoPrompt\n : `${titlesAndValues} ${additionalInfoPrompt}`;\n }, [isFullyInteractive]);\n\n const listItemContext = useMemo(\n () => ({\n setControlType,\n setControlProps,\n setMediaSize,\n ids,\n props: { disabled, inverted },\n mediaSize,\n describedByIds,\n }),\n [describedByIds, mediaSize],\n );\n const gridColumnsStyle = {\n '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',\n '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr',\n } as React.CSSProperties;\n\n const getFeatureClassName = () => {\n const partials = [];\n const hasMedia = Boolean(media);\n const hasControl = Boolean(control);\n const hasInfo = Boolean(additionalInfo);\n const hasPrompt = Boolean(prompt);\n\n /* eslint-disable functional/immutable-data */\n if (hasMedia && hasControl) {\n partials.push('wds-list-item-hasMedia-hasControl');\n }\n\n if (hasMedia && !hasControl) {\n partials.push('wds-list-item-hasMedia-noControl');\n }\n\n if (!hasMedia && hasControl) {\n partials.push('wds-list-item-noMedia-hasControl');\n }\n\n if (!hasMedia && !hasControl) {\n partials.push('wds-list-item-noMedia-noControl');\n }\n\n if (hasInfo && hasPrompt) {\n partials.push('wds-list-item-hasInfo-hasPrompt');\n }\n if (hasInfo && !hasPrompt) {\n partials.push('wds-list-item-hasInfo-noPrompt');\n }\n if (!hasInfo && hasPrompt) {\n partials.push('wds-list-item-noInfo-hasPrompt');\n }\n if (!hasInfo && !hasPrompt) {\n partials.push('wds-list-item-noInfo-noPrompt');\n }\n /* eslint-enable functional/immutable-data */\n\n return partials.join(' ');\n };\n\n return (\n <ListItemContext.Provider value={listItemContext}>\n <ListItemElement\n className={clsx(\n 'wds-list-item',\n `wds-list-item-${controlType}`,\n getFeatureClassName(),\n {\n 'wds-list-item-interactive': isFullyInteractive,\n 'wds-list-item-partially-interactive': isPartiallyInteractive,\n [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:\n isFullyInteractive && !!spotlight,\n disabled,\n },\n className,\n )}\n id={id}\n aria-disabled={disabled}\n >\n {spotlight === 'inactive' && (\n <svg aria-hidden=\"true\" className=\"wds-list-item-spotlight__border\">\n <rect />\n </svg>\n )}\n\n <View\n {...{\n isPartiallyInteractive,\n subtitle,\n additionalInfo,\n disabled,\n prompt,\n controlType,\n controlProps,\n }}\n className={getFeatureClassName()}\n >\n {media && <div className=\"wds-list-item-media\">{media}</div>}\n\n {/* Title + Subtitle + Values - Group */}\n <div\n className=\"wds-list-item-body\"\n style={valueColumnWidth ? gridColumnsStyle : undefined}\n >\n {/* Title + Subtitle + Values - Group */}\n <span\n className={clsx({\n 'wds-list-item-body-center': title && !subtitle,\n })}\n >\n {(() => {\n const titles = [\n <Body\n key={ids.title}\n id={ids.title}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title\"\n >\n {title}\n </Body>,\n ];\n if (subtitle) {\n titles.push(\n <Body key={ids.subtitle} id={ids.subtitle} className=\"wds-list-item-subtitle\">\n {subtitle}\n </Body>,\n );\n }\n return inverted ? [...titles].reverse() : titles;\n })()}\n </span>\n\n {(valueTitle || valueSubtitle) && (\n <span\n className={clsx('wds-list-item-value', {\n 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,\n 'wds-list-item-body-center':\n (valueTitle && !valueSubtitle) || (!valueTitle && valueSubtitle),\n })}\n >\n {(() => {\n const values = [];\n if (valueTitle) {\n values.push(\n <Body\n key={ids.valueTitle}\n id={ids.valueTitle}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title-value\"\n >\n {valueTitle}\n </Body>,\n );\n }\n if (valueSubtitle) {\n values.push(\n <Body\n key={ids.valueSubtitle}\n id={ids.valueSubtitle}\n className=\"wds-list-item-subtitle-value\"\n >\n {valueSubtitle}\n </Body>,\n );\n }\n return inverted ? [...values].reverse() : values;\n })()}\n </span>\n )}\n </div>\n\n {control === null ? null : (\n <Body\n className={clsx('wds-list-item-control-wrapper', {\n 'wds-list-item-button-control': controlType === 'button',\n })}\n style={\n {\n '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto',\n } as React.CSSProperties\n }\n >\n {control}\n </Body>\n )}\n </View>\n </ListItemElement>\n </ListItemContext.Provider>\n );\n};\n\ntype ViewProps = PropsWithChildren<{\n isPartiallyInteractive: boolean;\n controlType?: ListItemTypes;\n controlProps?: ListItemControlProps;\n}> &\n Pick<ListItemProps, 'subtitle' | 'additionalInfo' | 'disabled' | 'prompt' | 'className'>;\n\nfunction View({\n children,\n subtitle,\n additionalInfo,\n prompt,\n disabled,\n isPartiallyInteractive,\n controlType = 'non-interactive',\n controlProps,\n className = '',\n}: ViewProps) {\n const { ids, describedByIds } = useContext<ListItemContextData>(ListItemContext);\n const isLinkControl = ['navigation'].includes(controlType);\n\n const isHrefProvided = isLinkControl && !!(controlProps as ListItemNavigationProps)?.href;\n\n const renderExtras = () => (\n <>\n {Boolean(subtitle) && additionalInfo}\n {prompt}\n </>\n );\n\n if (isLinkControl && isHrefProvided) {\n return (\n // for link instances of .Navigation, .IconButton, .Button\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <PrimitiveAnchor\n aria-describedby={describedByIds}\n href={(controlProps as ListItemNavigationProps)?.href}\n target={(controlProps as ListItemNavigationProps)?.target}\n className={clsx('wds-list-item-view d-flex flex-row', {\n 'wds-list-item-control': controlType === 'navigation',\n })}\n disabled={disabled}\n >\n {children}\n </PrimitiveAnchor>\n\n {renderExtras()}\n </div>\n );\n }\n\n if (isPartiallyInteractive || controlType === 'non-interactive') {\n return (\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <div className={clsx('wds-list-item-view d-flex flex-row')}>{children}</div>\n\n {renderExtras()}\n </div>\n );\n }\n\n // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc\n // Radio cannot be wrapped in a <fieldset> element to announce it as a group.\n const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';\n return (\n <InputWrapper className={clsx('wds-list-item-gridWrapper', className)}>\n <label\n htmlFor={ids.control}\n className={clsx('wds-list-item-view', {\n clickable: !disabled,\n fullyInteractive: !isPartiallyInteractive,\n })}\n >\n {children}\n </label>\n\n {renderExtras()}\n </InputWrapper>\n );\n}\n\nListItem.Image = Image;\nListItem.AvatarView = AvatarView;\nListItem.AvatarLayout = AvatarLayout;\nListItem.AdditionalInfo = AdditionalInfo;\nListItem.Checkbox = Checkbox;\nListItem.Radio = Radio;\nListItem.IconButton = IconButton;\nListItem.Navigation = Navigation;\nListItem.Button = Button;\nListItem.Switch = Switch;\nListItem.Prompt = Prompt;\n\nexport default ListItem;\n"],"names":["ListItem","as","ListItemElement","title","subtitle","additionalInfo","prompt","inverted","media","spotlight","valueTitle","valueSubtitle","control","disabled","className","valueColumnWidth","id","idPrefix","useId","controlProps","setControlProps","useState","controlType","setControlType","mediaSize","setMediaSize","ids","isPartiallyInteractive","Boolean","partiallyInteractive","isFullyInteractive","isButtonAsLink","href","titlesAndValues","join","additionalInfoPrompt","filter","describedByIds","useMemo","listItemContext","props","gridColumnsStyle","getFeatureClassName","partials","hasMedia","hasControl","hasInfo","hasPrompt","push","_jsx","ListItemContext","Provider","value","children","_jsxs","clsx","View","style","undefined","titles","Body","type","Typography","BODY_LARGE_BOLD","reverse","values","useContext","isLinkControl","includes","isHrefProvided","renderExtras","_Fragment","PrimitiveAnchor","target","InputWrapper","htmlFor","clickable","fullyInteractive","Image","AvatarView","AvatarLayout","AdditionalInfo","Checkbox","Radio","IconButton","Navigation","Button","Switch","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGO,MAAMA,QAAQ,GAAGA,CAAC;EACvBC,EAAE,EAAEC,eAAe,GAAG,IAAI;EAC1BC,KAAK;EACLC,QAAQ;EACRC,cAAc;EACdC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,UAAU;EACVC,aAAa;AACbC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,SAAS;EACTC,gBAAgB;AAChBC,EAAAA;AAAE,CACY,KAAI;AAClB,EAAA,MAAMC,QAAQ,GAAGC,KAAK,EAAE;EACxB,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGC,QAAQ,CAAuB,EAAE,CAAC;EAC1E,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGF,QAAQ,CAAgB,iBAAiB,CAAC;EAChF,MAAM,CAACG,SAAS,EAAEC,YA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AAG,KAAK,GAAG,UAAU;EACjE,oBACEgC,IAAA,CAACoB,YAAY,EAAA;AAAC5D,IAAAA,SAAS,EAAEyC,IAAI,CAAC,2BAA2B,EAAEzC,SAAS,CAAE;AAAAuC,IAAAA,QAAA,gBACpEJ,GAAA,CAAA,OAAA,EAAA;MACE0B,OAAO,EAAEjD,GAAG,CAACd,OAAQ;AACrBE,MAAAA,SAAS,EAAEyC,IAAI,CAAC,oBAAoB,EAAE;QACpCqB,SAAS,EAAE,CAAC/D,QAAQ;AACpBgE,QAAAA,gBAAgB,EAAE,CAAClD;AACpB,OAAA,CAAE;AAAA0B,MAAAA,QAAA,EAEFA;AAAQ,KACJ,CAEP,EAACiB,YAAY,EAAE;AAAA,GACH,CAAC;AAEnB;AAEAtE,QAAQ,CAAC8E,KAAK,GAAGA,KAAK;AACtB9E,QAAQ,CAAC+E,UAAU,GAAGA,UAAU;AAChC/E,QAAQ,CAACgF,YAAY,GAAGA,YAAY;AACpChF,QAAQ,CAACiF,cAAc,GAAGA,cAAc;AACxCjF,QAAQ,CAACkF,QAAQ,GAAGA,QAAQ;AAC5BlF,QAAQ,CAACmF,KAAK,GAAGA,KAAK;AACtBnF,QAAQ,CAACoF,UAAU,GAAGA,UAAU;AAChCpF,QAAQ,CAACqF,UAAU,GAAGA,UAAU;AAChCrF,QAAQ,CAACsF,MAAM,GAAGA,MAAM;AACxBtF,QAAQ,CAACuF,MAAM,GAAGA,MAAM;AACxBvF,QAAQ,CAACwF,MAAM,GAAGA,MAAM;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemContext.js","sources":["../../src/listItem/ListItemContext.tsx"],"sourcesContent":["import { createContext } from 'react';\nimport type { ListItemTypes, ListItemControlProps, ListItemProps } from './ListItem';\n\nexport type ListItemMediaSize = 32 | 40 | 48 | 56 | 72;\n\nexport type ListItemContextData = {\n setControlType: (type: ListItemTypes) => void;\n setControlProps: (props: ListItemControlProps) => void;\n setMediaSize: (size: ListItemMediaSize | undefined) => void;\n ids: {\n title: string;\n subtitle?: string;\n
|
|
1
|
+
{"version":3,"file":"ListItemContext.js","sources":["../../src/listItem/ListItemContext.tsx"],"sourcesContent":["import { createContext } from 'react';\nimport type { ListItemTypes, ListItemControlProps, ListItemProps } from './ListItem';\n\nexport type ListItemMediaSize = 32 | 40 | 48 | 56 | 72;\n\nexport type ListItemContextData = {\n setControlType: (type: ListItemTypes) => void;\n setControlProps: (props: ListItemControlProps) => void;\n setMediaSize: (size: ListItemMediaSize | undefined) => void;\n ids: {\n title: string;\n subtitle?: string;\n valueTitle?: string;\n valueSubtitle?: string;\n additionalInfo?: string;\n control: string;\n prompt?: string;\n };\n props: Pick<ListItemProps, 'disabled' | 'inverted'>;\n mediaSize?: ListItemMediaSize;\n describedByIds: string;\n};\n\nexport const ListItemContext = createContext<ListItemContextData>(\n null as unknown as ListItemContextData,\n);\n"],"names":["ListItemContext","createContext"],"mappings":";;;;MAuBaA,eAAe,gBAAGC,mBAAa,CAC1C,IAAsC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemContext.mjs","sources":["../../src/listItem/ListItemContext.tsx"],"sourcesContent":["import { createContext } from 'react';\nimport type { ListItemTypes, ListItemControlProps, ListItemProps } from './ListItem';\n\nexport type ListItemMediaSize = 32 | 40 | 48 | 56 | 72;\n\nexport type ListItemContextData = {\n setControlType: (type: ListItemTypes) => void;\n setControlProps: (props: ListItemControlProps) => void;\n setMediaSize: (size: ListItemMediaSize | undefined) => void;\n ids: {\n title: string;\n subtitle?: string;\n
|
|
1
|
+
{"version":3,"file":"ListItemContext.mjs","sources":["../../src/listItem/ListItemContext.tsx"],"sourcesContent":["import { createContext } from 'react';\nimport type { ListItemTypes, ListItemControlProps, ListItemProps } from './ListItem';\n\nexport type ListItemMediaSize = 32 | 40 | 48 | 56 | 72;\n\nexport type ListItemContextData = {\n setControlType: (type: ListItemTypes) => void;\n setControlProps: (props: ListItemControlProps) => void;\n setMediaSize: (size: ListItemMediaSize | undefined) => void;\n ids: {\n title: string;\n subtitle?: string;\n valueTitle?: string;\n valueSubtitle?: string;\n additionalInfo?: string;\n control: string;\n prompt?: string;\n };\n props: Pick<ListItemProps, 'disabled' | 'inverted'>;\n mediaSize?: ListItemMediaSize;\n describedByIds: string;\n};\n\nexport const ListItemContext = createContext<ListItemContextData>(\n null as unknown as ListItemContextData,\n);\n"],"names":["ListItemContext","createContext"],"mappings":";;MAuBaA,eAAe,gBAAGC,aAAa,CAC1C,IAAsC;;;;"}
|
package/build/main.css
CHANGED
|
@@ -2433,30 +2433,48 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2433
2433
|
fill: var(--color-interactive-primary);
|
|
2434
2434
|
}
|
|
2435
2435
|
.np-header {
|
|
2436
|
-
display:
|
|
2437
|
-
|
|
2438
|
-
|
|
2436
|
+
display: grid;
|
|
2437
|
+
grid-template-columns: 1fr auto;
|
|
2438
|
+
grid-column-gap: 24px;
|
|
2439
|
+
grid-column-gap: var(--size-24);
|
|
2440
|
+
-moz-column-gap: 24px;
|
|
2441
|
+
column-gap: 24px;
|
|
2442
|
+
-moz-column-gap: var(--size-24);
|
|
2443
|
+
column-gap: var(--size-24);
|
|
2444
|
+
align-items: center;
|
|
2445
|
+
margin-bottom: 8px;
|
|
2446
|
+
margin-bottom: var(--size-8);
|
|
2439
2447
|
max-width: 100%;
|
|
2440
2448
|
padding: 8px 0;
|
|
2441
2449
|
padding: var(--size-8) 0;
|
|
2450
|
+
width: 100%;
|
|
2451
|
+
}
|
|
2452
|
+
.np-header--group {
|
|
2453
|
+
align-items: flex-end;
|
|
2442
2454
|
border-bottom: 1px solid rgba(0,0,0,0.10196);
|
|
2443
2455
|
border-bottom: 1px solid var(--color-border-neutral);
|
|
2444
|
-
margin-bottom: 8px;
|
|
2445
|
-
margin-bottom: var(--size-8);
|
|
2446
|
-
-moz-column-gap: 24px;
|
|
2447
|
-
column-gap: 24px;
|
|
2448
|
-
-moz-column-gap: var(--size-24);
|
|
2449
|
-
column-gap: var(--size-24);
|
|
2450
2456
|
}
|
|
2451
2457
|
.np-header__title {
|
|
2452
2458
|
color: #5d7079;
|
|
2453
2459
|
color: var(--color-content-secondary);
|
|
2460
|
+
margin: 0;
|
|
2454
2461
|
}
|
|
2455
|
-
.np-
|
|
2456
|
-
margin
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2462
|
+
.np-header__action {
|
|
2463
|
+
margin: 0;
|
|
2464
|
+
height: 20px;
|
|
2465
|
+
display: flex;
|
|
2466
|
+
align-items: center;
|
|
2467
|
+
}
|
|
2468
|
+
.np-header__action-link {
|
|
2469
|
+
margin-bottom: -0.5px;
|
|
2470
|
+
}
|
|
2471
|
+
.np-header__action-button {
|
|
2472
|
+
margin-right: -17px;
|
|
2473
|
+
}
|
|
2474
|
+
@media (max-width: 320px) {
|
|
2475
|
+
.np-header__action-button {
|
|
2476
|
+
margin-right: -12.5px;
|
|
2477
|
+
}
|
|
2460
2478
|
}
|
|
2461
2479
|
.tw-image {
|
|
2462
2480
|
max-width: none;
|
|
@@ -1,26 +1,44 @@
|
|
|
1
1
|
.np-header {
|
|
2
|
-
display:
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: 1fr auto;
|
|
4
|
+
grid-column-gap: 24px;
|
|
5
|
+
grid-column-gap: var(--size-24);
|
|
6
|
+
-moz-column-gap: 24px;
|
|
7
|
+
column-gap: 24px;
|
|
8
|
+
-moz-column-gap: var(--size-24);
|
|
9
|
+
column-gap: var(--size-24);
|
|
10
|
+
align-items: center;
|
|
11
|
+
margin-bottom: 8px;
|
|
12
|
+
margin-bottom: var(--size-8);
|
|
5
13
|
max-width: 100%;
|
|
6
14
|
padding: 8px 0;
|
|
7
15
|
padding: var(--size-8) 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
.np-header--group {
|
|
19
|
+
align-items: flex-end;
|
|
8
20
|
border-bottom: 1px solid rgba(0,0,0,0.10196);
|
|
9
21
|
border-bottom: 1px solid var(--color-border-neutral);
|
|
10
|
-
margin-bottom: 8px;
|
|
11
|
-
margin-bottom: var(--size-8);
|
|
12
|
-
-moz-column-gap: 24px;
|
|
13
|
-
column-gap: 24px;
|
|
14
|
-
-moz-column-gap: var(--size-24);
|
|
15
|
-
column-gap: var(--size-24);
|
|
16
22
|
}
|
|
17
23
|
.np-header__title {
|
|
18
24
|
color: #5d7079;
|
|
19
25
|
color: var(--color-content-secondary);
|
|
26
|
+
margin: 0;
|
|
27
|
+
}
|
|
28
|
+
.np-header__action {
|
|
29
|
+
margin: 0;
|
|
30
|
+
height: 20px;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
.np-header__action-link {
|
|
35
|
+
margin-bottom: -0.5px;
|
|
36
|
+
}
|
|
37
|
+
.np-header__action-button {
|
|
38
|
+
margin-right: -17px;
|
|
20
39
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
margin-bottom: calc(var(--size-4) * -1);
|
|
40
|
+
@media (max-width: 320px) {
|
|
41
|
+
.np-header__action-button {
|
|
42
|
+
margin-right: -12.5px;
|
|
43
|
+
}
|
|
26
44
|
}
|
package/build/styles/main.css
CHANGED
|
@@ -2433,30 +2433,48 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2433
2433
|
fill: var(--color-interactive-primary);
|
|
2434
2434
|
}
|
|
2435
2435
|
.np-header {
|
|
2436
|
-
display:
|
|
2437
|
-
|
|
2438
|
-
|
|
2436
|
+
display: grid;
|
|
2437
|
+
grid-template-columns: 1fr auto;
|
|
2438
|
+
grid-column-gap: 24px;
|
|
2439
|
+
grid-column-gap: var(--size-24);
|
|
2440
|
+
-moz-column-gap: 24px;
|
|
2441
|
+
column-gap: 24px;
|
|
2442
|
+
-moz-column-gap: var(--size-24);
|
|
2443
|
+
column-gap: var(--size-24);
|
|
2444
|
+
align-items: center;
|
|
2445
|
+
margin-bottom: 8px;
|
|
2446
|
+
margin-bottom: var(--size-8);
|
|
2439
2447
|
max-width: 100%;
|
|
2440
2448
|
padding: 8px 0;
|
|
2441
2449
|
padding: var(--size-8) 0;
|
|
2450
|
+
width: 100%;
|
|
2451
|
+
}
|
|
2452
|
+
.np-header--group {
|
|
2453
|
+
align-items: flex-end;
|
|
2442
2454
|
border-bottom: 1px solid rgba(0,0,0,0.10196);
|
|
2443
2455
|
border-bottom: 1px solid var(--color-border-neutral);
|
|
2444
|
-
margin-bottom: 8px;
|
|
2445
|
-
margin-bottom: var(--size-8);
|
|
2446
|
-
-moz-column-gap: 24px;
|
|
2447
|
-
column-gap: 24px;
|
|
2448
|
-
-moz-column-gap: var(--size-24);
|
|
2449
|
-
column-gap: var(--size-24);
|
|
2450
2456
|
}
|
|
2451
2457
|
.np-header__title {
|
|
2452
2458
|
color: #5d7079;
|
|
2453
2459
|
color: var(--color-content-secondary);
|
|
2460
|
+
margin: 0;
|
|
2454
2461
|
}
|
|
2455
|
-
.np-
|
|
2456
|
-
margin
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2462
|
+
.np-header__action {
|
|
2463
|
+
margin: 0;
|
|
2464
|
+
height: 20px;
|
|
2465
|
+
display: flex;
|
|
2466
|
+
align-items: center;
|
|
2467
|
+
}
|
|
2468
|
+
.np-header__action-link {
|
|
2469
|
+
margin-bottom: -0.5px;
|
|
2470
|
+
}
|
|
2471
|
+
.np-header__action-button {
|
|
2472
|
+
margin-right: -17px;
|
|
2473
|
+
}
|
|
2474
|
+
@media (max-width: 320px) {
|
|
2475
|
+
.np-header__action-button {
|
|
2476
|
+
margin-right: -12.5px;
|
|
2477
|
+
}
|
|
2460
2478
|
}
|
|
2461
2479
|
.tw-image {
|
|
2462
2480
|
max-width: none;
|
package/build/title/Title.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var clsx = require('clsx');
|
|
6
|
+
var React = require('react');
|
|
6
7
|
require('../common/theme.js');
|
|
7
8
|
require('../common/direction.js');
|
|
8
9
|
require('../common/propsValues/control.js');
|
|
@@ -23,11 +24,14 @@ require('../common/propsValues/scroll.js');
|
|
|
23
24
|
require('../common/propsValues/markdownNodeType.js');
|
|
24
25
|
require('../common/fileType.js');
|
|
25
26
|
require('@transferwise/icons');
|
|
26
|
-
require('react');
|
|
27
27
|
require('react-intl');
|
|
28
28
|
require('../common/closeButton/CloseButton.messages.js');
|
|
29
29
|
var jsxRuntime = require('react/jsx-runtime');
|
|
30
30
|
|
|
31
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
32
|
+
|
|
33
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
34
|
+
|
|
31
35
|
const DEFAULT_TYPE = typography.Typography.TITLE_GROUP;
|
|
32
36
|
const titleTypeMapping = {
|
|
33
37
|
[typography.Typography.TITLE_SCREEN]: 'h1',
|
|
@@ -36,27 +40,29 @@ const titleTypeMapping = {
|
|
|
36
40
|
[typography.Typography.TITLE_BODY]: 'h4',
|
|
37
41
|
[typography.Typography.TITLE_GROUP]: 'h5'
|
|
38
42
|
};
|
|
39
|
-
|
|
43
|
+
const Title = /*#__PURE__*/React__default.default.forwardRef(({
|
|
40
44
|
as,
|
|
41
45
|
type = DEFAULT_TYPE,
|
|
42
46
|
className,
|
|
43
47
|
...props
|
|
44
|
-
}) {
|
|
48
|
+
}, ref) => {
|
|
45
49
|
const mapping = titleTypeMapping[type];
|
|
46
50
|
const isTypeSupported = mapping !== undefined;
|
|
47
51
|
if (isTypeSupported) {
|
|
48
52
|
const HeaderTag = as ?? mapping;
|
|
49
53
|
return /*#__PURE__*/jsxRuntime.jsx(HeaderTag, {
|
|
54
|
+
ref: ref,
|
|
50
55
|
...props,
|
|
51
56
|
className: clsx.clsx(`np-text-${type}`, className)
|
|
52
57
|
});
|
|
53
58
|
}
|
|
54
59
|
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
55
60
|
return /*#__PURE__*/jsxRuntime.jsx(HeaderTag, {
|
|
61
|
+
ref: ref,
|
|
56
62
|
...props,
|
|
57
63
|
className: clsx.clsx(`np-text-${DEFAULT_TYPE}`, className)
|
|
58
64
|
});
|
|
59
|
-
}
|
|
65
|
+
});
|
|
60
66
|
|
|
61
67
|
exports.default = Title;
|
|
62
68
|
//# sourceMappingURL=Title.js.map
|
package/build/title/Title.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.js","sources":["../../src/title/Title.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { LabelHTMLAttributes, LiHTMLAttributes
|
|
1
|
+
{"version":3,"file":"Title.js","sources":["../../src/title/Title.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { forwardRef, LabelHTMLAttributes, LiHTMLAttributes } from 'react';\n\nimport { TitleTypes, Typography, Heading } from '../common';\n\nconst DEFAULT_TYPE = Typography.TITLE_GROUP;\n\nconst titleTypeMapping = {\n [Typography.TITLE_SCREEN]: 'h1',\n [Typography.TITLE_SECTION]: 'h2',\n [Typography.TITLE_SUBSECTION]: 'h3',\n [Typography.TITLE_BODY]: 'h4',\n [Typography.TITLE_GROUP]: 'h5',\n} as const;\n\ntype Props = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement> &\n LiHTMLAttributes<HTMLLIElement> & {\n /**\n * Default value will based one `type` prop\n */\n as?: 'span' | 'label' | 'li' | 'legend' | 'header' | Heading;\n /**\n * Default value: {@link DEFAULT_TYPE}\n */\n type?: TitleTypes;\n };\n\nconst Title = React.forwardRef<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement, Props>(\n ({ as, type = DEFAULT_TYPE, className, ...props }, ref) => {\n const mapping = titleTypeMapping[type as keyof typeof titleTypeMapping];\n const isTypeSupported = mapping !== undefined;\n if (isTypeSupported) {\n const HeaderTag = as ?? mapping;\n return (\n <HeaderTag\n ref={ref as React.Ref<any>}\n {...props}\n className={clsx(`np-text-${type}`, className)}\n />\n );\n }\n const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];\n return (\n <HeaderTag\n ref={ref as React.Ref<any>}\n {...props}\n className={clsx(`np-text-${DEFAULT_TYPE}`, className)}\n />\n );\n },\n);\n\nexport default Title;\n"],"names":["DEFAULT_TYPE","Typography","TITLE_GROUP","titleTypeMapping","TITLE_SCREEN","TITLE_SECTION","TITLE_SUBSECTION","TITLE_BODY","Title","React","forwardRef","as","type","className","props","ref","mapping","isTypeSupported","undefined","HeaderTag","_jsx","clsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAMA,YAAY,GAAGC,qBAAU,CAACC,WAAW;AAE3C,MAAMC,gBAAgB,GAAG;AACvB,EAAA,CAACF,qBAAU,CAACG,YAAY,GAAG,IAAI;AAC/B,EAAA,CAACH,qBAAU,CAACI,aAAa,GAAG,IAAI;AAChC,EAAA,CAACJ,qBAAU,CAACK,gBAAgB,GAAG,IAAI;AACnC,EAAA,CAACL,qBAAU,CAACM,UAAU,GAAG,IAAI;EAC7B,CAACN,qBAAU,CAACC,WAAW,GAAG;CAClB;AAcV,MAAMM,KAAK,gBAAGC,sBAAK,CAACC,UAAU,CAC5B,CAAC;EAAEC,EAAE;AAAEC,EAAAA,IAAI,GAAGZ,YAAY;EAAEa,SAAS;EAAE,GAAGC;AAAK,CAAE,EAAEC,GAAG,KAAI;AACxD,EAAA,MAAMC,OAAO,GAAGb,gBAAgB,CAACS,IAAqC,CAAC;AACvE,EAAA,MAAMK,eAAe,GAAGD,OAAO,KAAKE,SAAS;AAC7C,EAAA,IAAID,eAAe,EAAE;AACnB,IAAA,MAAME,SAAS,GAAGR,EAAE,IAAIK,OAAO;IAC/B,oBACEI,cAAA,CAACD,SAAS,EAAA;AACRJ,MAAAA,GAAG,EAAEA,GAAsB;AAAA,MAAA,GACvBD,KAAK;AACTD,MAAAA,SAAS,EAAEQ,SAAI,CAAC,WAAWT,IAAI,CAAA,CAAE,EAAEC,SAAS;AAAE,KAAA,CAC9C;AAEN,EAAA;AACA,EAAA,MAAMM,SAAS,GAAGR,EAAE,IAAIR,gBAAgB,CAACH,YAAY,CAAC;EACtD,oBACEoB,cAAA,CAACD,SAAS,EAAA;AACRJ,IAAAA,GAAG,EAAEA,GAAsB;AAAA,IAAA,GACvBD,KAAK;AACTD,IAAAA,SAAS,EAAEQ,SAAI,CAAC,WAAWrB,YAAY,CAAA,CAAE,EAAEa,SAAS;AAAE,GAAA,CACtD;AAEN,CAAC;;;;"}
|
package/build/title/Title.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
+
import React__default from 'react';
|
|
2
3
|
import '../common/theme.mjs';
|
|
3
4
|
import '../common/direction.mjs';
|
|
4
5
|
import '../common/propsValues/control.mjs';
|
|
@@ -19,7 +20,6 @@ import '../common/propsValues/scroll.mjs';
|
|
|
19
20
|
import '../common/propsValues/markdownNodeType.mjs';
|
|
20
21
|
import '../common/fileType.mjs';
|
|
21
22
|
import '@transferwise/icons';
|
|
22
|
-
import 'react';
|
|
23
23
|
import 'react-intl';
|
|
24
24
|
import '../common/closeButton/CloseButton.messages.mjs';
|
|
25
25
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -32,27 +32,29 @@ const titleTypeMapping = {
|
|
|
32
32
|
[Typography.TITLE_BODY]: 'h4',
|
|
33
33
|
[Typography.TITLE_GROUP]: 'h5'
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
const Title = /*#__PURE__*/React__default.forwardRef(({
|
|
36
36
|
as,
|
|
37
37
|
type = DEFAULT_TYPE,
|
|
38
38
|
className,
|
|
39
39
|
...props
|
|
40
|
-
}) {
|
|
40
|
+
}, ref) => {
|
|
41
41
|
const mapping = titleTypeMapping[type];
|
|
42
42
|
const isTypeSupported = mapping !== undefined;
|
|
43
43
|
if (isTypeSupported) {
|
|
44
44
|
const HeaderTag = as ?? mapping;
|
|
45
45
|
return /*#__PURE__*/jsx(HeaderTag, {
|
|
46
|
+
ref: ref,
|
|
46
47
|
...props,
|
|
47
48
|
className: clsx(`np-text-${type}`, className)
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
51
52
|
return /*#__PURE__*/jsx(HeaderTag, {
|
|
53
|
+
ref: ref,
|
|
52
54
|
...props,
|
|
53
55
|
className: clsx(`np-text-${DEFAULT_TYPE}`, className)
|
|
54
56
|
});
|
|
55
|
-
}
|
|
57
|
+
});
|
|
56
58
|
|
|
57
59
|
export { Title as default };
|
|
58
60
|
//# sourceMappingURL=Title.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.mjs","sources":["../../src/title/Title.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { LabelHTMLAttributes, LiHTMLAttributes
|
|
1
|
+
{"version":3,"file":"Title.mjs","sources":["../../src/title/Title.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React, { forwardRef, LabelHTMLAttributes, LiHTMLAttributes } from 'react';\n\nimport { TitleTypes, Typography, Heading } from '../common';\n\nconst DEFAULT_TYPE = Typography.TITLE_GROUP;\n\nconst titleTypeMapping = {\n [Typography.TITLE_SCREEN]: 'h1',\n [Typography.TITLE_SECTION]: 'h2',\n [Typography.TITLE_SUBSECTION]: 'h3',\n [Typography.TITLE_BODY]: 'h4',\n [Typography.TITLE_GROUP]: 'h5',\n} as const;\n\ntype Props = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement> &\n LiHTMLAttributes<HTMLLIElement> & {\n /**\n * Default value will based one `type` prop\n */\n as?: 'span' | 'label' | 'li' | 'legend' | 'header' | Heading;\n /**\n * Default value: {@link DEFAULT_TYPE}\n */\n type?: TitleTypes;\n };\n\nconst Title = React.forwardRef<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement, Props>(\n ({ as, type = DEFAULT_TYPE, className, ...props }, ref) => {\n const mapping = titleTypeMapping[type as keyof typeof titleTypeMapping];\n const isTypeSupported = mapping !== undefined;\n if (isTypeSupported) {\n const HeaderTag = as ?? mapping;\n return (\n <HeaderTag\n ref={ref as React.Ref<any>}\n {...props}\n className={clsx(`np-text-${type}`, className)}\n />\n );\n }\n const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];\n return (\n <HeaderTag\n ref={ref as React.Ref<any>}\n {...props}\n className={clsx(`np-text-${DEFAULT_TYPE}`, className)}\n />\n );\n },\n);\n\nexport default Title;\n"],"names":["DEFAULT_TYPE","Typography","TITLE_GROUP","titleTypeMapping","TITLE_SCREEN","TITLE_SECTION","TITLE_SUBSECTION","TITLE_BODY","Title","React","forwardRef","as","type","className","props","ref","mapping","isTypeSupported","undefined","HeaderTag","_jsx","clsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAMA,YAAY,GAAGC,UAAU,CAACC,WAAW;AAE3C,MAAMC,gBAAgB,GAAG;AACvB,EAAA,CAACF,UAAU,CAACG,YAAY,GAAG,IAAI;AAC/B,EAAA,CAACH,UAAU,CAACI,aAAa,GAAG,IAAI;AAChC,EAAA,CAACJ,UAAU,CAACK,gBAAgB,GAAG,IAAI;AACnC,EAAA,CAACL,UAAU,CAACM,UAAU,GAAG,IAAI;EAC7B,CAACN,UAAU,CAACC,WAAW,GAAG;CAClB;AAcV,MAAMM,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAC5B,CAAC;EAAEC,EAAE;AAAEC,EAAAA,IAAI,GAAGZ,YAAY;EAAEa,SAAS;EAAE,GAAGC;AAAK,CAAE,EAAEC,GAAG,KAAI;AACxD,EAAA,MAAMC,OAAO,GAAGb,gBAAgB,CAACS,IAAqC,CAAC;AACvE,EAAA,MAAMK,eAAe,GAAGD,OAAO,KAAKE,SAAS;AAC7C,EAAA,IAAID,eAAe,EAAE;AACnB,IAAA,MAAME,SAAS,GAAGR,EAAE,IAAIK,OAAO;IAC/B,oBACEI,GAAA,CAACD,SAAS,EAAA;AACRJ,MAAAA,GAAG,EAAEA,GAAsB;AAAA,MAAA,GACvBD,KAAK;AACTD,MAAAA,SAAS,EAAEQ,IAAI,CAAC,WAAWT,IAAI,CAAA,CAAE,EAAEC,SAAS;AAAE,KAAA,CAC9C;AAEN,EAAA;AACA,EAAA,MAAMM,SAAS,GAAGR,EAAE,IAAIR,gBAAgB,CAACH,YAAY,CAAC;EACtD,oBACEoB,GAAA,CAACD,SAAS,EAAA;AACRJ,IAAAA,GAAG,EAAEA,GAAsB;AAAA,IAAA,GACvBD,KAAK;AACTD,IAAAA,SAAS,EAAEQ,IAAI,CAAC,WAAWrB,YAAY,CAAA,CAAE,EAAEa,SAAS;AAAE,GAAA,CACtD;AAEN,CAAC;;;;"}
|
|
@@ -1,29 +1,46 @@
|
|
|
1
|
-
import { ActionButtonProps } from '../actionButton/ActionButton';
|
|
2
1
|
import { AriaLabelProperty, CommonProps, Heading, LinkProps } from '../common';
|
|
3
|
-
import {
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
4
3
|
type ActionProps = AriaLabelProperty & {
|
|
5
4
|
text: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
6
|
};
|
|
7
|
-
type ButtonActionProps = ActionProps
|
|
7
|
+
type ButtonActionProps = ActionProps;
|
|
8
8
|
type LinkActionProps = ActionProps & LinkProps;
|
|
9
|
-
export
|
|
9
|
+
export interface HeaderProps extends CommonProps {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Optional prop to define the action for the header. If the `href` property
|
|
12
|
+
* is provided, a `Link` will be rendered instead of a `Button`.
|
|
12
13
|
*/
|
|
13
14
|
action?: ButtonActionProps | LinkActionProps;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Option prop to specify DOM render element of the title
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
+
* - When `as="legend"`, the `Header` will render as a `<legend>` element.
|
|
19
|
+
* **Note:** `<legend>` elements must be the first child of a `<fieldset>` to comply with HTML semantics.
|
|
20
|
+
* If this condition is not met, a warning will be logged to the console.
|
|
21
|
+
* Additionally, the `action` prop is not supported when `as="legend"`.
|
|
22
|
+
*
|
|
23
|
+
* - Other valid values include standard heading tags (`h1` to `h6`) or `header`.
|
|
18
24
|
*/
|
|
19
25
|
as?: Heading | 'legend' | 'header';
|
|
26
|
+
/** Required prop to set the title of the Header. */
|
|
20
27
|
title: string;
|
|
21
|
-
|
|
28
|
+
/** Optional prop to specify the level of the Header */
|
|
29
|
+
level?: 'section' | 'group';
|
|
30
|
+
className?: string;
|
|
31
|
+
testId?: string;
|
|
32
|
+
}
|
|
22
33
|
/**
|
|
34
|
+
* @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.
|
|
35
|
+
* @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.
|
|
36
|
+
* @param {string} title - Required prop to set the title of the section header.
|
|
37
|
+
* @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.
|
|
38
|
+
* @param {string} [className]
|
|
39
|
+
* @param {string} [testId]
|
|
23
40
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
41
|
+
* @see {@link Header } for further information.
|
|
42
|
+
* @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}
|
|
26
43
|
*/
|
|
27
|
-
|
|
44
|
+
declare const Header: FunctionComponent<HeaderProps>;
|
|
28
45
|
export default Header;
|
|
29
46
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/header/Header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/header/Header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAI3F,OAAc,EAAqB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEpE,KAAK,WAAW,GAAG,iBAAiB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,KAAK,iBAAiB,GAAG,WAAW,CAAC;AACrC,KAAK,eAAe,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/C,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAE7C;;;;;;;;;OASG;IACH,EAAE,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAEnC,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IAEd,uDAAuD;IACvD,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+CD;;;;;;;;;;GAUG;AACH,QAAA,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CAgD1C,CAAC;AAIF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/header/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/header/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type { DefinitionListProps, DefinitionListDefinition } from './definition
|
|
|
22
22
|
export type { DimmerProps } from './dimmer';
|
|
23
23
|
export type { DrawerProps } from './drawer';
|
|
24
24
|
export type { DividerProps } from './divider';
|
|
25
|
+
export type { HeaderProps } from './header';
|
|
25
26
|
export type { EmphasisProps } from './emphasis';
|
|
26
27
|
export type { FieldProps } from './field/Field';
|
|
27
28
|
export type { InfoProps } from './info';
|