@papillonarts/components 0.7.0 → 0.9.0
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/index.ts +1 -0
- package/build/primer/Alert/Alert.mdx +88 -0
- package/build/primer/Alert/Alert.prop.ts +45 -0
- package/build/primer/Alert/Alert.tsx +101 -0
- package/build/primer/Alert/__tests__/Alert.int.story.tsx +86 -0
- package/build/primer/Alert/__tests__/Alert.int.test.ts +37 -0
- package/build/primer/Alert/index.ts +2 -0
- package/build/primer/Blankslate/Blankslate.mdx +57 -0
- package/build/primer/Blankslate/Blankslate.prop.ts +26 -0
- package/build/primer/Blankslate/Blankslate.tsx +26 -0
- package/build/primer/Blankslate/__tests__/Blankslate.int.story.tsx +43 -0
- package/build/primer/Blankslate/__tests__/Blankslate.int.test.ts +29 -0
- package/build/primer/Blankslate/index.ts +2 -0
- package/build/primer/BranchName/branch-name.scss +2 -2
- package/build/primer/Breadcrumb/Breadcrumb.mdx +23 -0
- package/build/primer/Breadcrumb/Breadcrumb.prop.ts +28 -0
- package/build/primer/Breadcrumb/Breadcrumb.tsx +57 -0
- package/build/primer/Breadcrumb/__tests__/Breadcrumb.int.story.tsx +40 -0
- package/build/primer/Breadcrumb/__tests__/Breadcrumb.int.test.ts +40 -0
- package/build/primer/Breadcrumb/index.ts +2 -0
- package/build/primer/Button/Button.mdx +239 -0
- package/build/primer/Button/Button.prop.ts +77 -0
- package/build/primer/Button/Button.scss +4 -4
- package/build/primer/Button/Button.tsx +91 -0
- package/build/primer/Button/ButtonGroup.scss +2 -2
- package/build/primer/Button/__tests__/Button.int.story.tsx +173 -0
- package/build/primer/Button/__tests__/Button.int.test.ts +191 -0
- package/build/primer/Button/index.ts +2 -0
- package/build/primer/Button/misc.scss +2 -2
- package/build/primer/Dropdown/Dropdown.mdx +19 -0
- package/build/primer/Dropdown/Dropdown.prop.ts +33 -0
- package/build/primer/Dropdown/Dropdown.tsx +102 -0
- package/build/primer/Dropdown/__tests__/Dropdown.int.story.tsx +43 -0
- package/build/primer/Dropdown/__tests__/Dropdown.int.test.ts +53 -0
- package/build/primer/Dropdown/index.ts +2 -0
- package/build/primer/ErrorBoundary/ErrorBoundary.prop.ts +5 -0
- package/build/primer/ErrorBoundary/ErrorBoundary.tsx +35 -0
- package/build/primer/ErrorBoundary/__tests__/ErrorBoundary.int.story.tsx +23 -0
- package/build/primer/ErrorBoundary/__tests__/ErrorBoundary.int.test.ts +9 -0
- package/build/primer/ErrorBoundary/index.ts +1 -0
- package/build/primer/Form/Checkbox/Checkbox.prop.ts +34 -0
- package/build/primer/Form/Checkbox/Checkbox.tsx +40 -0
- package/build/primer/Form/Checkbox/__tests__/Checkbox.int.story.tsx +50 -0
- package/build/primer/Form/Checkbox/__tests__/Checkbox.int.test.ts +23 -0
- package/build/primer/Form/Checkbox/index.ts +2 -0
- package/build/primer/Form/Input/Input.prop.ts +43 -0
- package/build/primer/Form/Input/Input.tsx +43 -0
- package/build/primer/Form/Input/__tests__/Input.int.story.tsx +54 -0
- package/build/primer/Form/Input/__tests__/Input.int.test.ts +15 -0
- package/build/primer/Form/Input/index.ts +2 -0
- package/build/primer/Form/Radio/Radio.prop.ts +30 -0
- package/build/primer/Form/Radio/Radio.tsx +38 -0
- package/build/primer/Form/Radio/__tests__/Radio.int.story.tsx +42 -0
- package/build/primer/Form/Radio/__tests__/Radio.int.test.ts +13 -0
- package/build/primer/Form/Radio/index.ts +2 -0
- package/build/primer/Form/form-control.scss +4 -4
- package/build/primer/Form/form-select.scss +4 -4
- package/build/primer/Form/index.ts +19 -0
- package/build/primer/Grid/DisplayTable/DisplayTable.prop.ts +21 -0
- package/build/primer/Grid/DisplayTable/DisplayTable.tsx +68 -0
- package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.data.ts +289 -0
- package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.story.tsx +27 -0
- package/build/primer/Grid/DisplayTable/__tests__/DisplayTable.int.test.ts +9 -0
- package/build/primer/Grid/DisplayTable/index.ts +1 -0
- package/build/primer/Grid/FlexGrid/FlexGrid.prop.ts +59 -0
- package/build/primer/Grid/FlexGrid/FlexGrid.tsx +274 -0
- package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.data.ts +289 -0
- package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.story.tsx +146 -0
- package/build/primer/Grid/FlexGrid/__tests__/FlexGrid.int.test.ts +46 -0
- package/build/primer/Grid/FlexGrid/index.ts +2 -0
- package/build/primer/Grid/index.ts +9 -0
- package/build/primer/Icon/Icon.part.ts +1289 -0
- package/build/primer/Icon/Icon.prop.ts +1337 -0
- package/build/primer/Icon/Icon.tsx +49 -0
- package/build/primer/Icon/__tests__/Icon.int.story.tsx +58 -0
- package/build/primer/Icon/__tests__/Icon.int.test.ts +13 -0
- package/build/primer/Icon/index.ts +2 -0
- package/build/primer/Label/Label.mdx +13 -0
- package/build/primer/Label/Label.prop.ts +31 -0
- package/build/primer/Label/Label.tsx +27 -0
- package/build/primer/Label/__tests__/Label.int.story.tsx +19 -0
- package/build/primer/Label/__tests__/Label.int.test.ts +9 -0
- package/build/primer/Label/index.ts +1 -0
- package/build/primer/Label/mixins.scss +3 -3
- package/build/primer/Layout/container.scss +1 -1
- package/build/primer/Layout/grid-offset.scss +1 -1
- package/build/primer/Layout/grid.scss +2 -2
- package/build/primer/Loader/Loader.mdx +31 -0
- package/build/primer/Loader/Loader.prop.ts +16 -0
- package/build/primer/Loader/Loader.tsx +43 -0
- package/build/primer/Loader/__tests__/Loader.int.story.tsx +34 -0
- package/build/primer/Loader/__tests__/Loader.int.test.ts +21 -0
- package/build/primer/Loader/index.ts +2 -0
- package/build/primer/Navigation/Menu/Menu.prop.ts +26 -0
- package/build/primer/Navigation/Menu/Menu.tsx +42 -0
- package/build/primer/Navigation/Menu/__tests__/Menu.int.story.tsx +55 -0
- package/build/primer/Navigation/Menu/__tests__/Menu.int.test.ts +57 -0
- package/build/primer/Navigation/Menu/index.ts +1 -0
- package/build/primer/Navigation/TabNav/TabNav.prop.ts +39 -0
- package/build/primer/Navigation/TabNav/TabNav.tsx +105 -0
- package/build/primer/Navigation/TabNav/__tests__/TabNav.int.story.tsx +168 -0
- package/build/primer/Navigation/TabNav/__tests__/TabNav.int.test.ts +55 -0
- package/build/primer/Navigation/TabNav/index.ts +2 -0
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.ts +41 -0
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.tsx +106 -0
- package/build/primer/Navigation/UnderlineNav/__tests__/UnderlineNav.int.story.tsx +140 -0
- package/build/primer/Navigation/UnderlineNav/__tests__/UnderlineNav.int.test.ts +81 -0
- package/build/primer/Navigation/UnderlineNav/index.ts +2 -0
- package/build/primer/Navigation/index.ts +12 -0
- package/build/primer/Pagination/PreviousNext/PreviousNext.prop.ts +53 -0
- package/build/primer/Pagination/PreviousNext/PreviousNext.scss +2 -2
- package/build/primer/Pagination/PreviousNext/PreviousNext.tsx +71 -0
- package/build/primer/Pagination/PreviousNext/__tests__/PreviousNext.int.story.tsx +48 -0
- package/build/primer/Pagination/PreviousNext/__tests__/PreviousNext.int.test.ts +15 -0
- package/build/primer/Pagination/PreviousNext/index.ts +2 -0
- package/build/primer/Pagination/index.ts +6 -0
- package/build/primer/Popover/Popover.mdx +190 -0
- package/build/primer/Popover/Popover.prop.ts +49 -0
- package/build/primer/Popover/Popover.tsx +80 -0
- package/build/primer/Popover/__tests__/Popover.int.story.tsx +216 -0
- package/build/primer/Popover/__tests__/Popover.int.test.ts +71 -0
- package/build/primer/Popover/index.ts +2 -0
- package/build/primer/Progress/Progress.mdx +31 -0
- package/build/primer/Progress/Progress.prop.ts +16 -0
- package/build/primer/Progress/Progress.tsx +19 -0
- package/build/primer/Progress/__tests__/Progress.int.story.tsx +28 -0
- package/build/primer/Progress/__tests__/Progress.int.test.ts +17 -0
- package/build/primer/Progress/index.ts +2 -0
- package/build/primer/Select/Select.mdx +19 -0
- package/build/primer/Select/Select.prop.ts +24 -0
- package/build/primer/Select/Select.scss +2 -2
- package/build/primer/Select/Select.tsx +58 -0
- package/build/primer/Select/__tests__/Select.int.story.tsx +38 -0
- package/build/primer/Select/__tests__/Select.int.test.ts +42 -0
- package/build/primer/Select/index.ts +2 -0
- package/build/primer/SelectMenu/SelectMenu.mdx +13 -0
- package/build/primer/SelectMenu/SelectMenu.prop.ts +25 -0
- package/build/primer/SelectMenu/SelectMenu.scss +4 -4
- package/build/primer/SelectMenu/SelectMenu.tsx +68 -0
- package/build/primer/SelectMenu/__tests__/SelectMenu.int.story.tsx +50 -0
- package/build/primer/SelectMenu/__tests__/SelectMenu.int.test.ts +56 -0
- package/build/primer/SelectMenu/index.ts +1 -0
- package/build/primer/Subhead/Subhead.mdx +20 -0
- package/build/primer/Subhead/Subhead.prop.ts +10 -0
- package/build/primer/Subhead/Subhead.scss +3 -3
- package/build/primer/Subhead/Subhead.tsx +15 -0
- package/build/primer/Subhead/__tests__/Subhead.int.story.tsx +23 -0
- package/build/primer/Subhead/__tests__/Subhead.int.test.ts +13 -0
- package/build/primer/Subhead/index.ts +1 -0
- package/build/primer/Toast/Toast.prop.ts +21 -0
- package/build/primer/Toast/Toast.scss +3 -3
- package/build/primer/Toast/Toast.tsx +38 -0
- package/build/primer/Toast/__tests__/Toast.int.story.tsx +50 -0
- package/build/primer/Toast/__tests__/Toast.int.test.ts +25 -0
- package/build/primer/Toast/index.ts +2 -0
- package/build/primer/index.ts +83 -0
- package/package.json +4 -4
- package/build/index.js +0 -12
- package/build/primer/Alert/Alert.js +0 -121
- package/build/primer/Alert/Alert.prop.js +0 -38
- package/build/primer/Alert/index.js +0 -19
- package/build/primer/Blankslate/Blankslate.js +0 -31
- package/build/primer/Blankslate/Blankslate.prop.js +0 -26
- package/build/primer/Blankslate/index.js +0 -19
- package/build/primer/Breadcrumb/Breadcrumb.js +0 -74
- package/build/primer/Breadcrumb/Breadcrumb.prop.js +0 -29
- package/build/primer/Breadcrumb/index.js +0 -19
- package/build/primer/Button/Button.js +0 -99
- package/build/primer/Button/Button.prop.js +0 -67
- package/build/primer/Button/index.js +0 -49
- package/build/primer/Dropdown/Dropdown.js +0 -104
- package/build/primer/Dropdown/Dropdown.prop.js +0 -34
- package/build/primer/Dropdown/index.js +0 -19
- package/build/primer/ErrorBoundary/ErrorBoundary.js +0 -59
- package/build/primer/ErrorBoundary/ErrorBoundary.prop.js +0 -11
- package/build/primer/ErrorBoundary/index.js +0 -12
- package/build/primer/Form/Checkbox/Checkbox.js +0 -49
- package/build/primer/Form/Checkbox/Checkbox.prop.js +0 -36
- package/build/primer/Form/Checkbox/index.js +0 -19
- package/build/primer/Form/Input/Input.js +0 -56
- package/build/primer/Form/Input/Input.prop.js +0 -43
- package/build/primer/Form/Input/index.js +0 -25
- package/build/primer/Form/Radio/Radio.js +0 -48
- package/build/primer/Form/Radio/Radio.prop.js +0 -34
- package/build/primer/Form/Radio/index.js +0 -19
- package/build/primer/Form/index.js +0 -24
- package/build/primer/Grid/DisplayTable/DisplayTable.js +0 -58
- package/build/primer/Grid/DisplayTable/DisplayTable.prop.js +0 -18
- package/build/primer/Grid/DisplayTable/index.js +0 -12
- package/build/primer/Grid/FlexGrid/FlexGrid.js +0 -244
- package/build/primer/Grid/FlexGrid/FlexGrid.prop.js +0 -49
- package/build/primer/Grid/FlexGrid/index.js +0 -25
- package/build/primer/Grid/index.js +0 -14
- package/build/primer/Icon/Icon.js +0 -70
- package/build/primer/Icon/Icon.part.js +0 -1295
- package/build/primer/Icon/Icon.prop.js +0 -689
- package/build/primer/Icon/index.js +0 -25
- package/build/primer/Label/Label.js +0 -31
- package/build/primer/Label/Label.prop.js +0 -34
- package/build/primer/Label/index.js +0 -12
- package/build/primer/Loader/Loader.js +0 -65
- package/build/primer/Loader/Loader.prop.js +0 -21
- package/build/primer/Loader/index.js +0 -19
- package/build/primer/Navigation/Menu/Menu.js +0 -70
- package/build/primer/Navigation/Menu/Menu.prop.js +0 -28
- package/build/primer/Navigation/Menu/index.js +0 -12
- package/build/primer/Navigation/TabNav/TabNav.js +0 -125
- package/build/primer/Navigation/TabNav/TabNav.prop.js +0 -36
- package/build/primer/Navigation/TabNav/index.js +0 -19
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.js +0 -121
- package/build/primer/Navigation/UnderlineNav/UnderlineNav.prop.js +0 -41
- package/build/primer/Navigation/UnderlineNav/index.js +0 -25
- package/build/primer/Navigation/index.js +0 -17
- package/build/primer/Pagination/PreviousNext/PreviousNext.js +0 -76
- package/build/primer/Pagination/PreviousNext/PreviousNext.prop.js +0 -56
- package/build/primer/Pagination/PreviousNext/index.js +0 -19
- package/build/primer/Pagination/index.js +0 -11
- package/build/primer/Popover/Popover.js +0 -63
- package/build/primer/Popover/Popover.prop.js +0 -41
- package/build/primer/Popover/index.js +0 -25
- package/build/primer/Progress/Progress.js +0 -31
- package/build/primer/Progress/Progress.prop.js +0 -21
- package/build/primer/Progress/index.js +0 -19
- package/build/primer/Select/Select.js +0 -66
- package/build/primer/Select/Select.prop.js +0 -27
- package/build/primer/Select/index.js +0 -19
- package/build/primer/SelectMenu/SelectMenu.js +0 -95
- package/build/primer/SelectMenu/SelectMenu.prop.js +0 -26
- package/build/primer/SelectMenu/index.js +0 -12
- package/build/primer/Subhead/Subhead.js +0 -27
- package/build/primer/Subhead/Subhead.prop.js +0 -16
- package/build/primer/Subhead/index.js +0 -12
- package/build/primer/Toast/Toast.js +0 -55
- package/build/primer/Toast/Toast.prop.js +0 -26
- package/build/primer/Toast/index.js +0 -19
- package/build/primer/index.js +0 -87
- /package/build/primer/Form/Checkbox/{Checkbox.md → Checkbox.mdx} +0 -0
- /package/build/primer/Form/Checkbox/__tests__/__snapshots__/{Checkbox.int.test.js.snap → Checkbox.int.test.ts.snap} +0 -0
- /package/build/primer/Form/Input/{Input.md → Input.mdx} +0 -0
- /package/build/primer/Form/Input/__tests__/__snapshots__/{Input.int.test.js.snap → Input.int.test.ts.snap} +0 -0
- /package/build/primer/Form/Radio/{Radio.md → Radio.mdx} +0 -0
- /package/build/primer/Form/Radio/__tests__/__snapshots__/{Radio.int.test.js.snap → Radio.int.test.ts.snap} +0 -0
- /package/build/primer/Grid/DisplayTable/{DisplayTable.md → DisplayTable.mdx} +0 -0
- /package/build/primer/Grid/DisplayTable/__tests__/__snapshots__/{DisplayTable.int.test.js.snap → DisplayTable.int.test.ts.snap} +0 -0
- /package/build/primer/Grid/FlexGrid/{FlexGrid.md → FlexGrid.mdx} +0 -0
- /package/build/primer/Grid/FlexGrid/__tests__/__snapshots__/{FlexGrid.int.test.js.snap → FlexGrid.int.test.ts.snap} +0 -0
- /package/build/primer/Navigation/Menu/{Menu.md → Menu.mdx} +0 -0
- /package/build/primer/Navigation/Menu/__tests__/__snapshots__/{Menu.int.test.js.snap → Menu.int.test.ts.snap} +0 -0
- /package/build/primer/Navigation/TabNav/{TabNav.md → TabNav.mdx} +0 -0
- /package/build/primer/Navigation/TabNav/__tests__/__snapshots__/{TabNav.int.test.js.snap → TabNav.int.test.ts.snap} +0 -0
- /package/build/primer/Navigation/UnderlineNav/{UnderlineNav.md → UnderlineNav.mdx} +0 -0
- /package/build/primer/Navigation/UnderlineNav/__tests__/__snapshots__/{UnderlineNav.int.test.js.snap → UnderlineNav.int.test.ts.snap} +0 -0
- /package/build/primer/Pagination/PreviousNext/{PreviousNext.md → PreviousNext.mdx} +0 -0
- /package/build/primer/Pagination/PreviousNext/__tests__/__snapshots__/{PreviousNext.int.test.js.snap → PreviousNext.int.test.ts.snap} +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { IconProps, defaultProps, iconSize, iconAlign } from './Icon.prop'
|
|
2
|
+
import { iconComponents } from './Icon.part'
|
|
3
|
+
|
|
4
|
+
const defaultSize = [16, 16]
|
|
5
|
+
|
|
6
|
+
export function Icon({
|
|
7
|
+
className = defaultProps.className,
|
|
8
|
+
ariaLabel = defaultProps.ariaLabel,
|
|
9
|
+
icon,
|
|
10
|
+
height = defaultProps.height,
|
|
11
|
+
width = defaultProps.width,
|
|
12
|
+
size = defaultProps.size,
|
|
13
|
+
fill = defaultProps.fill,
|
|
14
|
+
verticalAlign = defaultProps.verticalAlign,
|
|
15
|
+
...otherProps
|
|
16
|
+
}: IconProps) {
|
|
17
|
+
const widthHeight = defaultSize
|
|
18
|
+
|
|
19
|
+
const attrs = {
|
|
20
|
+
className,
|
|
21
|
+
'aria-hidden': ariaLabel ? 'false' : 'true',
|
|
22
|
+
'aria-label': ariaLabel,
|
|
23
|
+
height,
|
|
24
|
+
role: 'img',
|
|
25
|
+
viewBox: [0, 0, ...widthHeight].join(' '),
|
|
26
|
+
style: {},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (width && height) {
|
|
30
|
+
Object.assign(attrs, { width, height })
|
|
31
|
+
} else {
|
|
32
|
+
const dims = { width: widthHeight[0], height: widthHeight[1] }
|
|
33
|
+
const given = width ? 'width' : 'height'
|
|
34
|
+
const computed = given === 'width' ? 'height' : 'width'
|
|
35
|
+
attrs[given] = width || height || iconSize[size] || size
|
|
36
|
+
attrs[computed] = attrs[given] * (dims[computed] / dims[given])
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
attrs.style = {
|
|
40
|
+
display: 'inline-block',
|
|
41
|
+
fill,
|
|
42
|
+
userSelect: 'none',
|
|
43
|
+
verticalAlign: iconAlign[verticalAlign] || verticalAlign,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const Element = iconComponents[icon]
|
|
47
|
+
|
|
48
|
+
return Element != null ? <Element className={className} {...attrs} {...otherProps} /> : null
|
|
49
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { withTests } from '@storybook/addon-jest'
|
|
2
|
+
import { iconNameKeys, iconNameKeysDefault, iconSizeKeys, iconSizeKeysDefault } from '../Icon.prop'
|
|
3
|
+
import results from '../../../../../../.jest-test-results.json'
|
|
4
|
+
|
|
5
|
+
const Icon =
|
|
6
|
+
process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
|
|
7
|
+
? require('../../../index').primer.Icon.Icon
|
|
8
|
+
: require('../../../../build').primer.Icon.Icon
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'Primer/Atom/Icon',
|
|
12
|
+
component: Icon,
|
|
13
|
+
decorators: [withTests({ results })],
|
|
14
|
+
parameters: { jest: ['Icon.int.test.js'] },
|
|
15
|
+
argTypes: {
|
|
16
|
+
className: {
|
|
17
|
+
control: { type: 'text' },
|
|
18
|
+
defaultValue: '',
|
|
19
|
+
},
|
|
20
|
+
icon: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'select',
|
|
23
|
+
options: iconNameKeys,
|
|
24
|
+
},
|
|
25
|
+
defaultValue: iconNameKeysDefault,
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
control: {
|
|
29
|
+
type: 'select',
|
|
30
|
+
options: iconSizeKeys,
|
|
31
|
+
},
|
|
32
|
+
defaultValue: iconSizeKeysDefault,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
excludeStories: ['custom'],
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function regular({ className = '', icon = iconNameKeysDefault, size = iconSizeKeysDefault, ...rest }) {
|
|
39
|
+
return <Icon className={className} icon={icon} size={size} {...rest} />
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function allIcons() {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
columns: '4',
|
|
47
|
+
width: '800px',
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
{iconNameKeys.map((icon) => (
|
|
51
|
+
<div key={icon} style={{ padding: '4px', fontSize: '14px', lineHeight: '21px' }}>
|
|
52
|
+
<Icon icon={icon} style={{ marginRight: '4px', verticalAlign: 'middle' }} />
|
|
53
|
+
<span style={{ display: 'inline-block', verticalAlign: 'middle' }}>{icon}</span>
|
|
54
|
+
</div>
|
|
55
|
+
))}
|
|
56
|
+
</div>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { regular, allIcons } from './Icon.int.story'
|
|
2
|
+
|
|
3
|
+
describe('<Icon />', () => {
|
|
4
|
+
describe('Render', () => {
|
|
5
|
+
test('must match regular()', () => {
|
|
6
|
+
expect(global.renderToJSON(regular({}))).toMatchSnapshot()
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test('must match allIcons()', () => {
|
|
10
|
+
expect(global.renderToJSON(allIcons())).toMatchSnapshot()
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
> Labels add metadata or indicate status of items and navigational elements. Three different types of labels are available: Labels for adding metadata, States for indicating status, and Counters for showing the count for a number of items.
|
|
4
|
+
|
|
5
|
+
# Variants
|
|
6
|
+
|
|
7
|
+
> - Default
|
|
8
|
+
|
|
9
|
+
## Default
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
<Label text="default label" />
|
|
13
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const labelVariant = {
|
|
2
|
+
regular: 'regular',
|
|
3
|
+
state: 'state',
|
|
4
|
+
counter: 'counter',
|
|
5
|
+
issue: 'issue',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const labelBackgroundColor = {
|
|
9
|
+
blue: 'blue',
|
|
10
|
+
red: 'red',
|
|
11
|
+
green: 'green',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const labelTextColor = {
|
|
15
|
+
white: 'white',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const defaultProps = {
|
|
19
|
+
className: null,
|
|
20
|
+
variant: labelVariant.issue,
|
|
21
|
+
backgroundColor: labelBackgroundColor.blue,
|
|
22
|
+
textColor: labelTextColor.white,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface LabelProps {
|
|
26
|
+
className?: string
|
|
27
|
+
text: string
|
|
28
|
+
variant?: typeof labelVariant.regular | typeof labelVariant.state | typeof labelVariant.counter | typeof labelVariant.issue
|
|
29
|
+
backgroundColor?: typeof labelBackgroundColor.blue | typeof labelBackgroundColor.red | typeof labelBackgroundColor.green
|
|
30
|
+
textColor?: typeof labelTextColor.white
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import cx from 'classnames'
|
|
2
|
+
import colorStyles from '@papillonarts/css/build/primer/utilities/colors.scss'
|
|
3
|
+
import { LabelProps, defaultProps, labelVariant, labelBackgroundColor, labelTextColor } from './Label.prop'
|
|
4
|
+
import labelsStyles from './labels.scss'
|
|
5
|
+
import issueLabelsStyles from './issue-labels.scss'
|
|
6
|
+
|
|
7
|
+
export function Label({
|
|
8
|
+
className = defaultProps.className,
|
|
9
|
+
text,
|
|
10
|
+
variant = defaultProps.variant,
|
|
11
|
+
backgroundColor = defaultProps.backgroundColor,
|
|
12
|
+
textColor = defaultProps.textColor,
|
|
13
|
+
}: LabelProps) {
|
|
14
|
+
return (
|
|
15
|
+
<span
|
|
16
|
+
title={`Label: ${text}`}
|
|
17
|
+
className={cx(className, {
|
|
18
|
+
[labelsStyles.Label]: variant === labelVariant.regular,
|
|
19
|
+
[issueLabelsStyles.IssueLabel]: variant === labelVariant.issue,
|
|
20
|
+
[colorStyles['bg-blue']]: backgroundColor === labelBackgroundColor.blue,
|
|
21
|
+
[colorStyles['text-white']]: textColor === labelTextColor.white,
|
|
22
|
+
})}
|
|
23
|
+
>
|
|
24
|
+
{text}
|
|
25
|
+
</span>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { withTests } from '@storybook/addon-jest'
|
|
2
|
+
import results from '../../../../../../.jest-test-results.json'
|
|
3
|
+
|
|
4
|
+
const Label =
|
|
5
|
+
process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
|
|
6
|
+
? require('../../../index').primer.Label
|
|
7
|
+
: require('../../../../build').primer.Label
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Primer/Atom/Label',
|
|
11
|
+
component: Label,
|
|
12
|
+
decorators: [withTests({ results })],
|
|
13
|
+
parameters: { jest: ['Label.int.test.js'] },
|
|
14
|
+
excludeStories: ['custom'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function regular() {
|
|
18
|
+
return <Label text="default label" />
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from './Label'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@import '@
|
|
2
|
-
@import '@
|
|
3
|
-
@import '@
|
|
1
|
+
@import '@papillonarts/css/build/primer/support/variables/typography.scss';
|
|
2
|
+
@import '@papillonarts/css/build/primer/support/variables/layout.scss';
|
|
3
|
+
@import '@papillonarts/css/build/primer/support/variables/misc.scss';
|
|
4
4
|
|
|
5
5
|
// Label mixins
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@import '@
|
|
2
|
-
@import '@
|
|
1
|
+
@import '@papillonarts/css/build/primer/support/variables/layout.scss';
|
|
2
|
+
@import '@papillonarts/css/build/primer/support/mixins/layout.scss';
|
|
3
3
|
|
|
4
4
|
// stylelint-disable number-max-precision
|
|
5
5
|
// stylelint-disable declaration-property-value-no-unknown
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Loader
|
|
2
|
+
|
|
3
|
+
> Loaders inform users that an action is still in progress and might take a while to complete.
|
|
4
|
+
|
|
5
|
+
## Variants
|
|
6
|
+
|
|
7
|
+
> - Heading, Text, Label, Button
|
|
8
|
+
|
|
9
|
+
## Heading
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
<Loader variant={loaderVariant.heading} text={text} />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Text
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
<Loader variant={loaderVariant.text} text={text} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Label
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<Loader variant={loaderVariant.label} text={text} />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Button
|
|
28
|
+
|
|
29
|
+
```jsx
|
|
30
|
+
<Loader variant={loaderVariant.button} text={text} />
|
|
31
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const loaderVariant = {
|
|
2
|
+
heading: 'heading',
|
|
3
|
+
text: 'text',
|
|
4
|
+
label: 'label',
|
|
5
|
+
button: 'button',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const defaultProps = {
|
|
9
|
+
className: null,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface LoaderProps {
|
|
13
|
+
className?: string
|
|
14
|
+
variant: typeof loaderVariant.heading | typeof loaderVariant.text | typeof loaderVariant.label | typeof loaderVariant.button
|
|
15
|
+
text: string
|
|
16
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import cx from 'classnames'
|
|
2
|
+
import colorStyles from '@papillonarts/css/build/primer/utilities/colors.scss'
|
|
3
|
+
import marginStyles from '@papillonarts/css/build/primer/utilities/margin.scss'
|
|
4
|
+
import { LoaderProps, defaultProps, loaderVariant } from './Loader.prop'
|
|
5
|
+
import styles from './Loader.scss'
|
|
6
|
+
import branchNameStyles from '../BranchName/branch-name.scss'
|
|
7
|
+
import buttonStyles from '../Button/Button.scss'
|
|
8
|
+
import labelStyles from '../Label/labels.scss'
|
|
9
|
+
|
|
10
|
+
export function Loader({ className = defaultProps.className, variant, text }: LoaderProps) {
|
|
11
|
+
switch (variant) {
|
|
12
|
+
case loaderVariant.heading:
|
|
13
|
+
return (
|
|
14
|
+
<h2 className={className}>
|
|
15
|
+
<span>{text}</span>
|
|
16
|
+
<span className={styles.AnimatedEllipsis} />
|
|
17
|
+
</h2>
|
|
18
|
+
)
|
|
19
|
+
case loaderVariant.text:
|
|
20
|
+
return (
|
|
21
|
+
<span className={cx(branchNameStyles['branch-name'], marginStyles['mt-2'])}>
|
|
22
|
+
<span>{text}</span>
|
|
23
|
+
<span className={styles.AnimatedEllipsis} />
|
|
24
|
+
</span>
|
|
25
|
+
)
|
|
26
|
+
case loaderVariant.label:
|
|
27
|
+
return (
|
|
28
|
+
<span className={cx(labelStyles.Label, colorStyles['bg-blue'], marginStyles['mt-3'])}>
|
|
29
|
+
<span>{text}</span>
|
|
30
|
+
<span className={styles.AnimatedEllipsis} />
|
|
31
|
+
</span>
|
|
32
|
+
)
|
|
33
|
+
case loaderVariant.button:
|
|
34
|
+
return (
|
|
35
|
+
<button type="button" className={cx(buttonStyles.btn, marginStyles['mt-3'])} aria-disabled="true">
|
|
36
|
+
<span>{text}</span>
|
|
37
|
+
<span className={styles.AnimatedEllipsis} />
|
|
38
|
+
</button>
|
|
39
|
+
)
|
|
40
|
+
default:
|
|
41
|
+
return null
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { withTests } from '@storybook/addon-jest'
|
|
2
|
+
import { loaderVariant } from '../Loader.prop'
|
|
3
|
+
import results from '../../../../../../.jest-test-results.json'
|
|
4
|
+
|
|
5
|
+
const Loader =
|
|
6
|
+
process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
|
|
7
|
+
? require('../../../index').primer.Loader.Loader
|
|
8
|
+
: require('../../../../build').primer.Loader.Loader
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'Primer/Atom/Loader',
|
|
12
|
+
component: Loader,
|
|
13
|
+
decorators: [withTests({ results })],
|
|
14
|
+
parameters: { jest: ['Loader.int.test.js'] },
|
|
15
|
+
excludeStories: ['textValue', 'custom'],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const textValue = 'Loading'
|
|
19
|
+
|
|
20
|
+
export function heading() {
|
|
21
|
+
return <Loader variant={loaderVariant.heading} text={textValue} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function text() {
|
|
25
|
+
return <Loader variant={loaderVariant.text} text={textValue} />
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function label() {
|
|
29
|
+
return <Loader variant={loaderVariant.label} text={textValue} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function button() {
|
|
33
|
+
return <Loader variant={loaderVariant.button} text={textValue} />
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { heading, text, label, button } from './Loader.int.story'
|
|
2
|
+
|
|
3
|
+
describe('<Loader />', () => {
|
|
4
|
+
describe('Render', () => {
|
|
5
|
+
test('must match heading()', () => {
|
|
6
|
+
expect(global.renderToJSON(heading())).toMatchSnapshot()
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test('must match text()', () => {
|
|
10
|
+
expect(global.renderToJSON(text())).toMatchSnapshot()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('must match label()', () => {
|
|
14
|
+
expect(global.renderToJSON(label())).toMatchSnapshot()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('must match button()', () => {
|
|
18
|
+
expect(global.renderToJSON(button())).toMatchSnapshot()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const defaultProps = {
|
|
2
|
+
className: null,
|
|
3
|
+
heading: null,
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface AriaAttrType {
|
|
7
|
+
label: string
|
|
8
|
+
labelledBy: string
|
|
9
|
+
current: boolean | false | true | 'page' | 'step' | 'location' | 'date' | 'time'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ItemType {
|
|
13
|
+
href: string
|
|
14
|
+
icon: string
|
|
15
|
+
text: string
|
|
16
|
+
html: React.ReactNode[]
|
|
17
|
+
isSelected: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface MenuProps {
|
|
21
|
+
className?: string
|
|
22
|
+
heading?: string
|
|
23
|
+
ariaAttr: AriaAttrType
|
|
24
|
+
items: ItemType[]
|
|
25
|
+
onClick: (value) => void
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import cx from 'classnames'
|
|
2
|
+
import { v1 as uuidv1 } from 'uuid'
|
|
3
|
+
import { getIndexItems, getIndexItemsWithSelected } from '@papillonarts/library/array'
|
|
4
|
+
import { useState } from '@papillonarts/library/hooks'
|
|
5
|
+
import { MenuProps, defaultProps } from './Menu.prop'
|
|
6
|
+
import styles from './Menu.scss'
|
|
7
|
+
import { Icon, iconSize } from '../../Icon'
|
|
8
|
+
|
|
9
|
+
export function Menu({ className = defaultProps.className, heading = defaultProps.heading, ariaAttr, items, onClick }: MenuProps) {
|
|
10
|
+
const [indexItems, setIndexItems] = useState(getIndexItems(items))
|
|
11
|
+
const { label, labelledBy, current } = ariaAttr
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<nav className={cx(className, styles.menu)} aria-label={label} aria-labelledby={labelledBy}>
|
|
15
|
+
{heading && <span className={styles['menu-heading']}>{heading}</span>}
|
|
16
|
+
{indexItems.map((indexItem) => {
|
|
17
|
+
const { href, icon, text, html, isSelected } = indexItem
|
|
18
|
+
|
|
19
|
+
const itemOtherProps = isSelected ? { ...{ 'aria-current': current } } : null
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<a
|
|
23
|
+
key={uuidv1()}
|
|
24
|
+
onClick={(e) => {
|
|
25
|
+
e.preventDefault()
|
|
26
|
+
const newIndexItems = getIndexItemsWithSelected(indexItems, indexItem)
|
|
27
|
+
setIndexItems(newIndexItems)
|
|
28
|
+
onClick(newIndexItems)
|
|
29
|
+
}}
|
|
30
|
+
className={styles['menu-item']}
|
|
31
|
+
href={href}
|
|
32
|
+
{...itemOtherProps}
|
|
33
|
+
>
|
|
34
|
+
{icon && <Icon className={styles.octicon} icon={icon} size={iconSize.small} />}
|
|
35
|
+
{html || null}
|
|
36
|
+
{text}
|
|
37
|
+
</a>
|
|
38
|
+
)
|
|
39
|
+
})}
|
|
40
|
+
</nav>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { action } from 'storybook/actions'
|
|
2
|
+
import { withTests } from '@storybook/addon-jest'
|
|
3
|
+
import { iconName } from '../../../Icon/Icon.prop'
|
|
4
|
+
import results from '../../../../../../../.jest-test-results.json'
|
|
5
|
+
|
|
6
|
+
const Menu =
|
|
7
|
+
process.env.NODE_ENV === 'develop' || process.env.NODE_ENV === 'test'
|
|
8
|
+
? require('../../../../index').primer.Navigation.Menu
|
|
9
|
+
: require('../../../../../build').primer.Navigation.Menu
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Primer/Molecule/Navigation/Menu',
|
|
13
|
+
component: Menu,
|
|
14
|
+
decorators: [withTests({ results })],
|
|
15
|
+
parameters: { jest: ['Menu.int.test.js'] },
|
|
16
|
+
excludeStories: ['heading', 'ariaAttr', 'defaultItems', 'iconItems', 'custom'],
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const heading = 'Menu heading'
|
|
20
|
+
|
|
21
|
+
export const ariaAttr = {
|
|
22
|
+
label: 'Person settings',
|
|
23
|
+
labelledBy: 'menu-heading',
|
|
24
|
+
current: 'page',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const defaultItems = [
|
|
28
|
+
{ href: '#url', text: 'Account', isSelected: true },
|
|
29
|
+
{ href: '#url', text: 'Profile', isSelected: false },
|
|
30
|
+
{ href: '#url', text: 'Emails', isSelected: false },
|
|
31
|
+
{ href: '#url', text: 'Notifications', isSelected: false },
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export const iconItems = [
|
|
35
|
+
{ href: '#url', icon: iconName.Tools16, text: 'Account', isSelected: true },
|
|
36
|
+
{ href: '#url', icon: iconName.Person16, text: 'Profile', isSelected: false },
|
|
37
|
+
{ href: '#url', icon: iconName.Mail16, text: 'Emails', isSelected: false },
|
|
38
|
+
{ href: '#url', icon: iconName.Broadcast16, text: 'Notifications', isSelected: false },
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
export function custom(onClick) {
|
|
42
|
+
return <Menu ariaAttr={ariaAttr} items={defaultItems} onClick={onClick} />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function regular() {
|
|
46
|
+
return <Menu ariaAttr={ariaAttr} items={defaultItems} onClick={action('onClick')} />
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function withIcons() {
|
|
50
|
+
return <Menu ariaAttr={ariaAttr} items={iconItems} onClick={action('onClick')} />
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function withHeading() {
|
|
54
|
+
return <Menu heading={heading} ariaAttr={ariaAttr} items={defaultItems} onClick={action('onClick')} />
|
|
55
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defaultItems as items, regular, withIcons, withHeading } from './Menu.int.story'
|
|
2
|
+
|
|
3
|
+
jest.mock('@papillonarts/library/array', () => ({
|
|
4
|
+
getIndexItems: () => {},
|
|
5
|
+
getIndexItemsWithSelected: () => {},
|
|
6
|
+
}))
|
|
7
|
+
|
|
8
|
+
jest.mock('@papillonarts/library/hooks', () => ({
|
|
9
|
+
useState: () => {},
|
|
10
|
+
}))
|
|
11
|
+
|
|
12
|
+
const libraryArrayMockObject = require('@papillonarts/library/array')
|
|
13
|
+
const libraryHooksMockObject = require('@papillonarts/library/hooks')
|
|
14
|
+
|
|
15
|
+
describe('<Menu />', () => {
|
|
16
|
+
let indexItemsDataObject = [
|
|
17
|
+
{ ...items[0], index: 0 },
|
|
18
|
+
{ ...items[1], index: 1 },
|
|
19
|
+
{ ...items[2], index: 2 },
|
|
20
|
+
{ ...items[3], index: 3 },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const newIndexItemsWithSelectedDataObject = [
|
|
24
|
+
{ ...items[0], index: 0, isSelected: true },
|
|
25
|
+
{ ...items[1], index: 1, isSelected: false },
|
|
26
|
+
{ ...items[2], index: 2, isSelected: false },
|
|
27
|
+
{ ...items[3], index: 3, isSelected: false },
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
const setIndexItemsMockFn = jest.fn((indexItems) => {
|
|
31
|
+
indexItemsDataObject = indexItems
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
jest.spyOn(libraryArrayMockObject, 'getIndexItems').mockReturnValue(indexItemsDataObject)
|
|
36
|
+
|
|
37
|
+
jest.spyOn(libraryArrayMockObject, 'getIndexItemsWithSelected').mockReturnValue(newIndexItemsWithSelectedDataObject)
|
|
38
|
+
|
|
39
|
+
jest.spyOn(libraryHooksMockObject, 'useState').mockImplementation(() => [indexItemsDataObject, setIndexItemsMockFn])
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
afterEach(() => jest.clearAllMocks())
|
|
43
|
+
|
|
44
|
+
describe('Render', () => {
|
|
45
|
+
test('must match regular()', () => {
|
|
46
|
+
expect(global.renderToJSON(regular())).toMatchSnapshot()
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('must match withIcons()', () => {
|
|
50
|
+
expect(global.renderToJSON(withIcons())).toMatchSnapshot()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('must match withHeading()', () => {
|
|
54
|
+
expect(global.renderToJSON(withHeading())).toMatchSnapshot()
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Menu } from './Menu'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const tabNavState = {
|
|
2
|
+
active: 'active',
|
|
3
|
+
inactive: 'inactive',
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const defaultProps = {
|
|
7
|
+
className: null,
|
|
8
|
+
actions: null,
|
|
9
|
+
children: null,
|
|
10
|
+
state: tabNavState.active,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AriaAttrType {
|
|
14
|
+
label: string
|
|
15
|
+
current: boolean | false | true | 'page' | 'step' | 'location' | 'date' | 'time'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LinkType {
|
|
19
|
+
component: React.ReactNode
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ItemType {
|
|
23
|
+
href: string
|
|
24
|
+
text: string
|
|
25
|
+
link: LinkType
|
|
26
|
+
isSelected: boolean
|
|
27
|
+
enabled: boolean
|
|
28
|
+
visible: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TabNavProps {
|
|
32
|
+
className?: string
|
|
33
|
+
ariaAttr: AriaAttrType
|
|
34
|
+
items: ItemType[]
|
|
35
|
+
actions?: React.ReactNode[]
|
|
36
|
+
onClick: (value) => void
|
|
37
|
+
children?: React.ReactNode
|
|
38
|
+
state?: typeof tabNavState.active | typeof tabNavState.inactive
|
|
39
|
+
}
|