@kaizen/components 3.3.14 → 3.3.16
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/dist/cjs/src/TextArea/TextArea.module.css.cjs +9 -9
- package/dist/esm/src/TextArea/TextArea.module.css.mjs +9 -9
- package/dist/styles.css +1 -1
- package/dist/types/TitleBlock/types.d.ts +5 -0
- package/package.json +14 -14
- package/src/Filter/Filter/_docs/Filter.stickersheet.stories.tsx +0 -11
- package/src/TextArea/TextArea.module.css +1 -0
- package/src/TextArea/_docs/TextArea.stickersheet.stories.tsx +14 -5
- package/src/TextAreaField/_docs/TextAreaField.stickersheet.stories.tsx +8 -0
- package/src/TitleBlock/_docs/TitleBlock--api-specification.mdx +32 -2
- package/src/TitleBlock/_docs/TitleBlock--usage-guidelines.mdx +92 -16
- package/src/TitleBlock/_docs/TitleBlock.stories.tsx +50 -28
- package/src/TitleBlock/types.ts +5 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var modules_f168227d = {
|
|
4
|
-
"wrapper": "
|
|
5
|
-
"wrapperAutogrow": "
|
|
6
|
-
"textarea": "
|
|
7
|
-
"textareaAutogrow": "
|
|
8
|
-
"default": "
|
|
9
|
-
"error": "
|
|
10
|
-
"caution": "
|
|
11
|
-
"disabled": "
|
|
12
|
-
"reversed": "
|
|
4
|
+
"wrapper": "TextArea_module_wrapper__36440826",
|
|
5
|
+
"wrapperAutogrow": "TextArea_module_wrapperAutogrow__36440826",
|
|
6
|
+
"textarea": "TextArea_module_textarea__36440826",
|
|
7
|
+
"textareaAutogrow": "TextArea_module_textareaAutogrow__36440826",
|
|
8
|
+
"default": "TextArea_module_default__36440826",
|
|
9
|
+
"error": "TextArea_module_error__36440826",
|
|
10
|
+
"caution": "TextArea_module_caution__36440826",
|
|
11
|
+
"disabled": "TextArea_module_disabled__36440826",
|
|
12
|
+
"reversed": "TextArea_module_reversed__36440826"
|
|
13
13
|
};
|
|
14
14
|
module.exports = modules_f168227d;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var modules_f168227d = {
|
|
2
|
-
"wrapper": "
|
|
3
|
-
"wrapperAutogrow": "
|
|
4
|
-
"textarea": "
|
|
5
|
-
"textareaAutogrow": "
|
|
6
|
-
"default": "
|
|
7
|
-
"error": "
|
|
8
|
-
"caution": "
|
|
9
|
-
"disabled": "
|
|
10
|
-
"reversed": "
|
|
2
|
+
"wrapper": "TextArea_module_wrapper__36440826",
|
|
3
|
+
"wrapperAutogrow": "TextArea_module_wrapperAutogrow__36440826",
|
|
4
|
+
"textarea": "TextArea_module_textarea__36440826",
|
|
5
|
+
"textareaAutogrow": "TextArea_module_textareaAutogrow__36440826",
|
|
6
|
+
"default": "TextArea_module_default__36440826",
|
|
7
|
+
"error": "TextArea_module_error__36440826",
|
|
8
|
+
"caution": "TextArea_module_caution__36440826",
|
|
9
|
+
"disabled": "TextArea_module_disabled__36440826",
|
|
10
|
+
"reversed": "TextArea_module_reversed__36440826"
|
|
11
11
|
};
|
|
12
12
|
export { modules_f168227d as default };
|
package/dist/styles.css
CHANGED
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
@layer kz-components{.Tab_module_tab__ce4d43df{display:inline-flex;align-items:center;border:2px solid transparent;border-bottom:0;border-top-left-radius:var(--border-borderless-border-radius);border-top-right-radius:var(--border-borderless-border-radius);background:transparent;white-space:nowrap;text-decoration:none;padding:var(--spacing-md) var(--spacing-md);margin:0;font-family:var(--typography-heading-4-font-family);font-size:var(--typography-heading-4-font-size);font-weight:var(--typography-heading-4-font-weight);line-height:var(--typography-heading-4-line-height);letter-spacing:var(--typography-heading-4-letter-spacing);color:var(--color-purple-800);cursor:default;&:focus{outline:none}&:focus-visible{color:var(--color-blue-500);border-color:var(--color-blue-500)}&[data-disabled]{opacity:.3}&:not(:first-child){margin-inline-start:var(--spacing-xs)}&:not([data-disabled]):hover{background:var(--color-blue-200);color:var(--color-blue-500)}&:not([data-disabled]):active{background:var(--color-blue-100)}}.Tab_module_tab__ce4d43df[data-selected]{position:relative;color:var(--color-blue-500);&:before{content:"";display:block;border-top-left-radius:5px;border-top-right-radius:5px;background-color:currentcolor;height:5px;width:100%;position:absolute;left:0;right:0;bottom:0}}.Tab_module_badge__ce4d43df{margin-inline-start:var(--spacing-sm);display:inline-flex;align-items:center}@media (forced-colors:active){.Tab_module_tab__ce4d43df{border:2px solid transparent;&:focus-visible:after{content:"";position:absolute;background:transparent;border-radius:var(--border-focus-ring-border-radius);border-width:var(--border-focus-ring-border-width);border-style:var(--border-focus-ring-border-style);border-color:transparent;inset:-2px}}.Tab_module_tab__ce4d43df[data-selected]:before{content:"";position:absolute;left:0;right:0;bottom:0;border-bottom:2px solid transparent}}}
|
|
150
150
|
@layer kz-components{.TabList_module_container__7ce81ce7{position:relative}.TabList_module_tabList__7ce81ce7{border-bottom:1px solid var(--color-gray-300);padding:var(--spacing-6) 0 0;width:100%;height:100%;overflow-x:scroll;white-space:nowrap;scrollbar-width:none;scroll-behavior:smooth}.TabList_module_noPadding__7ce81ce7{padding:0}.TabList_module_leftArrow__7ce81ce7,.TabList_module_rightArrow__7ce81ce7{--icon-size:24;display:flex;align-items:center;justify-content:center;position:absolute;z-index:1030;background:var(--color-white);inset-block:0 1px;width:48px;cursor:default;user-select:none}.TabList_module_leftArrow__7ce81ce7{left:0}.TabList_module_leftArrow__7ce81ce7,.TabList_module_leftArrow__7ce81ce7:hover{border-right:1px solid var(--color-gray-300)}.TabList_module_rightArrow__7ce81ce7{right:0}.TabList_module_rightArrow__7ce81ce7,.TabList_module_rightArrow__7ce81ce7:hover{border-left:1px solid var(--color-gray-300)}.TabList_module_leftArrow__7ce81ce7:hover,.TabList_module_rightArrow__7ce81ce7:hover{background:var(--color-blue-200);color:var(--color-blue-500)}.TabList_module_leftArrow__7ce81ce7:active,.TabList_module_rightArrow__7ce81ce7:active{background:var(--color-blue-100);color:var(--color-blue-500)}}
|
|
151
151
|
@layer kz-components{.TabPanel_module_tabPanel__931e68c3{border:2px solid transparent;&:focus{outline:none}&:focus-visible{border-color:var(--color-blue-500);border-radius:var(--border-focus-ring-border-radius)}}}
|
|
152
|
-
@layer kz-components{.
|
|
152
|
+
@layer kz-components{.TextArea_module_wrapper__36440826{font-family:var(--typography-paragraph-body-font-family);font-size:var(--typography-paragraph-body-font-size);font-weight:var(--typography-paragraph-body-font-weight);line-height:var(--typography-paragraph-body-line-height);letter-spacing:var(--typography-paragraph-body-letter-spacing);color:var(--color-purple-800-rgb)}.TextArea_module_wrapperAutogrow__36440826{display:grid}.TextArea_module_wrapperAutogrow__36440826:after{content:attr(data-value) " ";white-space:pre-wrap;visibility:hidden}.TextArea_module_textarea__36440826,.TextArea_module_wrapperAutogrow__36440826:after{border:var(--border-solid-border-width) var(--border-solid-border-style) var(--color-gray-500);border-radius:var(--border-solid-border-radius);padding:var(--spacing-sm);box-sizing:border-box;width:100%;font:inherit;overflow-wrap:anywhere}.TextArea_module_textareaAutogrow__36440826,.TextArea_module_wrapperAutogrow__36440826:after{grid-area:2/1}.TextArea_module_textarea__36440826{display:block;border:var(--border-solid-border-width) var(--border-solid-border-style) var(--color-gray-500);border-radius:var(--border-solid-border-radius);padding:var(--spacing-sm);resize:vertical;&:focus{outline:var(--border-focus-ring-border-width) var(--border-focus-ring-border-style) var(--color-blue-500);outline-offset:1px}&:disabled{border-color:rgb(var(--color-gray-500-rgb),.3);resize:none}}.TextArea_module_textareaAutogrow__36440826{overflow:hidden}.TextArea_module_default__36440826{&:not(.TextArea_module_error__36440826,.TextArea_module_caution__36440826){&:disabled{border-color:rgb(var(--color-gray-500-rgb),.3)}}&:focus:not([disabled]),&:hover:focus:not([disabled]),&:hover:not([disabled]){background-color:var(--color-gray-200);border-color:var(--color-gray-600)}&.TextArea_module_error__36440826{border-color:var(--color-red-500);&:focus:not([disabled]),&:hover:focus:not([disabled]),&:hover:not([disabled]){border-color:var(--color-red-500)}}&.TextArea_module_caution__36440826{border-color:var(--color-yellow-600);&:focus:not([disabled]),&:hover:focus:not([disabled]),&:hover:not([disabled]){border-color:var(--color-yellow-600)}}&.TextArea_module_disabled__36440826{background-color:var(--color-white);border-color:rgb(var(--color-gray-500-rgb),.3);color:rgb(var(--color-purple-800-rgb),.3)}}.TextArea_module_reversed__36440826{border-color:rgb(var(--color-white-rgb),.65);background:transparent;color:var(--color-white);&:focus{outline-color:var(--color-blue-300)}&:focus:not([disabled]),&:hover:focus:not([disabled]),&:hover:not([disabled]){background:rgb(var(--color-white-rgb),.1);border-color:var(--color-white)}&.TextArea_module_error__36440826{border-color:var(--color-red-300);&:focus:not([disabled]),&:hover:focus:not([disabled]),&:hover:not([disabled]){border-color:var(--color-red-300)}}&.TextArea_module_caution__36440826{border-color:var(--color-yellow-400);&:focus:not([disabled]),&:hover:focus:not([disabled]),&:hover:not([disabled]){border-color:var(--color-yellow-400)}}&.TextArea_module_disabled__36440826{background:transparent;border-color:rgb(var(--color-white-rgb),.3);color:rgb(var(--color-white-rgb),.3)}}}
|
|
153
153
|
@layer kz-components{.TextAreaField_module_message__095b2956.TextAreaField_module_disabled__095b2956{opacity:.3}.TextAreaField_module_textareaLabel__095b2956{margin-bottom:var(--spacing-xs,.375rem)}.TextAreaField_module_textareaLabelProminent__095b2956{margin-bottom:0}}
|
|
154
154
|
@layer kz-components{.GenericTile_module_root__8e7442cc{perspective:800px}.GenericTile_module_tile__8e7442cc{position:relative;width:330px;height:370px;transition:transform var(--animation-duration-slow,.4s) var(--animation-easing-function-ease-in-out,cubic-bezier(.455,.03,.515,.955));transform-style:preserve-3d;box-shadow:var(--shadow-small-box-shadow);border-radius:7px;background-color:var(--color-white);[data-tile-grid] &{width:auto}@media (width <= 767px){width:100%;min-width:226px;max-width:370px}@media (width <= 480px){max-width:100%}}.GenericTile_module_titleMeta__8e7442cc{padding-top:var(--spacing-4)}.GenericTile_module_face__8e7442cc{position:absolute;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;width:100%;height:100%;backface-visibility:hidden;border:var(--border-width-1) solid var(--generic-tile-border-color);border-radius:var(--border-solid-border-radius);background-color:var(--generic-tile-background-color);*{backface-visibility:hidden}}.GenericTile_module_faceFront__8e7442cc{justify-content:space-between;padding:var(--spacing-xl) var(--spacing-md) var(--spacing-md)}.GenericTile_module_faceBack__8e7442cc{--generic-tile-border-color:var(--color-blue-400);--generic-tile-background-color:var(--color-blue-100);padding-top:var(--spacing-xl);transform:rotateY(180deg)}.GenericTile_module_default__8e7442cc{--generic-tile-border-color:var(--color-gray-500);--generic-tile-background-color:var(--color-white)}.GenericTile_module_expertAdvice__8e7442cc{--generic-tile-border-color:var(--color-purple-400);--generic-tile-background-color:var(--color-purple-100)}.GenericTile_module_isFlipped__8e7442cc{transform:rotateY(179deg)}.GenericTile_module_title__8e7442cc{text-align:center;padding-bottom:var(--spacing-sm);backface-visibility:hidden}.GenericTile_module_actions__8e7442cc{display:flex}.GenericTile_module_informationBtn__8e7442cc{inset-block-start:0;inset-inline-end:0;position:absolute;color:rgb(var(--color-purple-800-rgb),.5)}.GenericTile_module_information__8e7442cc{display:flex;padding-bottom:var(--spacing-md);padding-right:var(--spacing-md);padding-left:var(--spacing-md);flex-direction:column;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;text-align:left;border-radius:0 0 7px 7px}.GenericTile_module_footer__8e7442cc{display:flex;align-items:center;justify-content:center;margin-top:var(--spacing-sm);height:var(--spacing-xl)}}
|
|
155
155
|
@layer kz-components{.MultiActionTile_module_actions__7f3718a6{display:flex}.MultiActionTile_module_secondaryAction__7f3718a6{margin-inline-end:var(--spacing-8)}}
|
|
@@ -16,6 +16,11 @@ import { type NavigationTabProps } from './subcomponents/NavigationTabs';
|
|
|
16
16
|
export type TitleBlockProps = {
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
title: string;
|
|
19
|
+
/**
|
|
20
|
+
* `light` is the recommended variant for new implementations. Leaving `variant`
|
|
21
|
+
* unset falls back to the default purple background.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
19
24
|
variant?: TitleBlockVariant;
|
|
20
25
|
breadcrumb?: TitleBlockBreadcrumbType;
|
|
21
26
|
avatar?: JSX.Element | TitleBlockAvatarProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.16",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -103,16 +103,16 @@
|
|
|
103
103
|
"lodash.debounce": "^4.0.8",
|
|
104
104
|
"nanobus": "^4.5.0",
|
|
105
105
|
"prosemirror-commands": "^1.7.2",
|
|
106
|
-
"prosemirror-history": "^1.5.
|
|
106
|
+
"prosemirror-history": "^1.5.1",
|
|
107
107
|
"prosemirror-inputrules": "^1.5.1",
|
|
108
108
|
"prosemirror-keymap": "^1.2.3",
|
|
109
|
-
"prosemirror-model": "^1.25.
|
|
110
|
-
"prosemirror-schema-basic": "^1.2.
|
|
109
|
+
"prosemirror-model": "^1.25.12",
|
|
110
|
+
"prosemirror-schema-basic": "^1.2.5",
|
|
111
111
|
"prosemirror-schema-list": "^1.5.1",
|
|
112
112
|
"prosemirror-state": "^1.4.4",
|
|
113
|
-
"prosemirror-transform": "^1.12.
|
|
113
|
+
"prosemirror-transform": "^1.12.2",
|
|
114
114
|
"prosemirror-utils": "^1.2.2",
|
|
115
|
-
"prosemirror-view": "^1.42.
|
|
115
|
+
"prosemirror-view": "^1.42.6",
|
|
116
116
|
"react-animate-height": "^3.2.4",
|
|
117
117
|
"react-aria": "^3.41.1",
|
|
118
118
|
"react-aria-components": "^1.10.1",
|
|
@@ -130,16 +130,16 @@
|
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
132
|
"@cultureamp/frontend-apis": "13.3.0",
|
|
133
|
-
"@cultureamp/i18n-react-intl": "^4.6.
|
|
133
|
+
"@cultureamp/i18n-react-intl": "^4.6.6",
|
|
134
134
|
"@cultureamp/package-bundler": "^4.1.1",
|
|
135
135
|
"@svgr/rollup": "^8.1.0",
|
|
136
|
-
"@testing-library/dom": "^10.4.
|
|
136
|
+
"@testing-library/dom": "^10.4.2",
|
|
137
137
|
"@types/jest-axe": "^3.5.9",
|
|
138
138
|
"@types/lodash.debounce": "^4.0.9",
|
|
139
139
|
"@types/react-highlight": "^0.12.8",
|
|
140
140
|
"@types/react-textfit": "^1.1.4",
|
|
141
141
|
"@types/uuid": "^11.0.0",
|
|
142
|
-
"autoprefixer": "^10.
|
|
142
|
+
"autoprefixer": "^10.6.1",
|
|
143
143
|
"concat-cli": "^4.0.0",
|
|
144
144
|
"cssnano": "^7.1.9",
|
|
145
145
|
"identity-obj-proxy": "^3.0.0",
|
|
@@ -149,21 +149,21 @@
|
|
|
149
149
|
"postcss": "^8.5.28",
|
|
150
150
|
"postcss-cli": "^11.0.1",
|
|
151
151
|
"postcss-import": "^16.2.0",
|
|
152
|
-
"postcss-preset-env": "^11.
|
|
152
|
+
"postcss-preset-env": "^11.6.0",
|
|
153
153
|
"postcss-scss": "^4.0.9",
|
|
154
154
|
"query-string": "^9.5.1",
|
|
155
155
|
"react": "19.2.8",
|
|
156
156
|
"react-dom": "19.2.8",
|
|
157
157
|
"react-highlight": "^0.15.0",
|
|
158
|
-
"react-intl": "^10.2.
|
|
159
|
-
"rollup": "^4.
|
|
158
|
+
"react-intl": "^10.2.2",
|
|
159
|
+
"rollup": "^4.64.0",
|
|
160
160
|
"sass": "1.79.6",
|
|
161
161
|
"serialize-query-params": "^2.0.4",
|
|
162
162
|
"svgo": "^4.1.0",
|
|
163
163
|
"ts-patch": "^3.3.0",
|
|
164
164
|
"tslib": "^2.8.1",
|
|
165
|
-
"tsx": "^4.23.
|
|
166
|
-
"@kaizen/design-tokens": "11.0.
|
|
165
|
+
"tsx": "^4.23.15",
|
|
166
|
+
"@kaizen/design-tokens": "11.0.20"
|
|
167
167
|
},
|
|
168
168
|
"devDependenciesComments": {
|
|
169
169
|
"sass": "Prevent deprecation warnings introduced in 1.80 as we plan to move away from sass",
|
|
@@ -10,17 +10,6 @@ const IS_CHROMATIC = isChromatic()
|
|
|
10
10
|
export default {
|
|
11
11
|
title: 'Components/Filter Base',
|
|
12
12
|
parameters: {
|
|
13
|
-
a11y: {
|
|
14
|
-
config: {
|
|
15
|
-
rules: [
|
|
16
|
-
{
|
|
17
|
-
// FIXME: dialog element should have an accessible name
|
|
18
|
-
id: 'aria-dialog-name',
|
|
19
|
-
enabled: false,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
13
|
chromatic: { disable: false },
|
|
25
14
|
controls: { disable: true },
|
|
26
15
|
},
|
|
@@ -40,11 +40,20 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
40
40
|
</StickerSheet.Row>
|
|
41
41
|
</StickerSheet>
|
|
42
42
|
<StickerSheet title="Autogrow">
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
<StickerSheet.Row header="Wraps on whitespace (container 320px)">
|
|
44
|
+
<div style={{ maxWidth: '320px', border: '1px dashed currentcolor' }}>
|
|
45
|
+
<TextArea
|
|
46
|
+
rows={1}
|
|
47
|
+
value="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque mattis nisi sit amet consectetur ultricies. Vestibulum porta arcu vitae erat egestas pulvinar."
|
|
48
|
+
autogrow
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
</StickerSheet.Row>
|
|
52
|
+
<StickerSheet.Row header="Long unbroken word (container 320px)">
|
|
53
|
+
<div style={{ maxWidth: '320px', border: '1px dashed currentcolor' }}>
|
|
54
|
+
<TextArea rows={1} value={'A'.repeat(100)} autogrow />
|
|
55
|
+
</div>
|
|
56
|
+
</StickerSheet.Row>
|
|
48
57
|
</StickerSheet>
|
|
49
58
|
</>
|
|
50
59
|
),
|
|
@@ -57,6 +57,14 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
57
57
|
</StickerSheet.Row>
|
|
58
58
|
))}
|
|
59
59
|
</StickerSheet>
|
|
60
|
+
|
|
61
|
+
<StickerSheet title="Autogrow" isReversed={isReversed}>
|
|
62
|
+
<StickerSheet.Row header="Long unbroken word (container 320px)">
|
|
63
|
+
<div style={{ width: '320px', border: '1px dashed currentcolor' }}>
|
|
64
|
+
<TextAreaField {...defaultProps} autogrow rows={1} value={'A'.repeat(150)} />
|
|
65
|
+
</div>
|
|
66
|
+
</StickerSheet.Row>
|
|
67
|
+
</StickerSheet>
|
|
60
68
|
</>
|
|
61
69
|
)
|
|
62
70
|
},
|
|
@@ -17,14 +17,15 @@ import * as TitleBlockStories from './TitleBlock.stories'
|
|
|
17
17
|
|
|
18
18
|
`TitleBlock` A consistent pattern to allow users to navigate and complete tasks easily.
|
|
19
19
|
|
|
20
|
-
<Canvas of={TitleBlockStories.
|
|
20
|
+
<Canvas of={TitleBlockStories.LightVariant} />
|
|
21
21
|
|
|
22
22
|
## Props
|
|
23
23
|
|
|
24
24
|
<Controls
|
|
25
|
-
of={TitleBlockStories.
|
|
25
|
+
of={TitleBlockStories.LightVariant}
|
|
26
26
|
include={[
|
|
27
27
|
'avatar',
|
|
28
|
+
//TODO: note as depreication per https://cultureamp.atlassian.net/browse/KZN-4538
|
|
28
29
|
'breadcrumb',
|
|
29
30
|
'defaultAction',
|
|
30
31
|
'handleHamburgerClick',
|
|
@@ -32,13 +33,30 @@ import * as TitleBlockStories from './TitleBlock.stories'
|
|
|
32
33
|
'primaryAction',
|
|
33
34
|
'secondaryActions',
|
|
34
35
|
'secondaryOverflowMenuItems',
|
|
36
|
+
'sticky',
|
|
35
37
|
'surveyStatus',
|
|
36
38
|
'title',
|
|
39
|
+
'variant',
|
|
37
40
|
]}
|
|
38
41
|
/>
|
|
39
42
|
|
|
40
43
|
## Options
|
|
41
44
|
|
|
45
|
+
### variant
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
variant?: 'light' | 'admin' | 'education'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Controls the TitleBlock's background and text colour. `light`
|
|
52
|
+
is the recommended value. Without passing it, the UI renders as the default
|
|
53
|
+
purple variant. See
|
|
54
|
+
[Usage Guidelines](/docs/components-titleblock-usage-guidelines--docs)
|
|
55
|
+
for the full guidance.
|
|
56
|
+
|
|
57
|
+
If you're rendering `NavigationTab`s alongside the TitleBlock, set the same
|
|
58
|
+
`variant` on each tab. Tabs don't inherit from the TitleBlock.
|
|
59
|
+
|
|
42
60
|
### primaryAction
|
|
43
61
|
|
|
44
62
|
The primary action (the "main" button in the top right) can either be a Button,
|
|
@@ -66,6 +84,18 @@ If you want it to be a Menu, pass in this object of type `MenuGroup`:
|
|
|
66
84
|
Using the `label`, the Title Block will render a Button with a chevron icon and your `menuItems` will appear
|
|
67
85
|
in the dropdown menu when you click it. (`MenuItemProps` is a type imported from the `Menu` component.)
|
|
68
86
|
|
|
87
|
+
### defaultAction
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
type DefaultActionProps = TitleBlockButtonProps | TitleBlockCustomButtonProps
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Renders a Button immediately to the left of `primaryAction`, in the same top
|
|
94
|
+
row. Pass the Button's props as an object, same as `primaryAction`.
|
|
95
|
+
|
|
96
|
+
Unlike `primaryAction`, `defaultAction` **can't be a menu group** There's no
|
|
97
|
+
dropdown variant of the default action, so passing `menuItems` is invalid. It can take a `badge`, but the badge only renders on the full-width button: at tablet and ≤360px widths the default action collapses into a menu item and the badge isn't shown.
|
|
98
|
+
|
|
69
99
|
### secondaryActions & secondaryOverflowMenuItems
|
|
70
100
|
|
|
71
101
|
Secondary Actions sit below the Primary Actions, and consist of
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Canvas, DocsStory, Meta, Controls } from '@storybook/blocks'
|
|
2
|
-
import { ResourceLinks, KAIOInstallation
|
|
1
|
+
import { Canvas, DocsStory, Meta, Controls, Unstyled } from '@storybook/blocks'
|
|
2
|
+
import { ResourceLinks, KAIOInstallation } from '~storybook/components'
|
|
3
|
+
import { InlineNotification } from '~components/Notification'
|
|
3
4
|
import * as TitleBlockStories from './TitleBlock.stories'
|
|
4
5
|
|
|
5
6
|
<Meta title="Components/TitleBlock/Usage Guidelines" />
|
|
@@ -18,31 +19,106 @@ import * as TitleBlockStories from './TitleBlock.stories'
|
|
|
18
19
|
|
|
19
20
|
A consistent pattern to allow users to navigate and complete tasks easily.
|
|
20
21
|
|
|
21
|
-
<Canvas of={TitleBlockStories.
|
|
22
|
+
<Canvas of={TitleBlockStories.LightVariant} sourceState="hidden" />
|
|
22
23
|
|
|
23
24
|
<Controls
|
|
24
|
-
of={TitleBlockStories.
|
|
25
|
-
include={[
|
|
25
|
+
of={TitleBlockStories.LightVariant}
|
|
26
|
+
include={[
|
|
27
|
+
'avatar',
|
|
28
|
+
'defaultAction',
|
|
29
|
+
'navigationTabs',
|
|
30
|
+
'primaryAction',
|
|
31
|
+
'sticky',
|
|
32
|
+
'title',
|
|
33
|
+
'variant',
|
|
34
|
+
]}
|
|
26
35
|
/>
|
|
27
36
|
|
|
28
|
-
##
|
|
37
|
+
## Variants
|
|
38
|
+
|
|
39
|
+
<Unstyled>
|
|
40
|
+
<InlineNotification persistent variant="cautionary">
|
|
41
|
+
{
|
|
42
|
+
<>
|
|
43
|
+
<strong>
|
|
44
|
+
Passing <code>variant="light"</code> is the ongoing recommendation.
|
|
45
|
+
</strong>{' '}
|
|
46
|
+
When a variant isn't passed, TitleBlock falls back to the default purple variant.
|
|
47
|
+
</>
|
|
48
|
+
}
|
|
49
|
+
</InlineNotification>
|
|
50
|
+
</Unstyled>
|
|
51
|
+
|
|
52
|
+
### Light (recommended)
|
|
53
|
+
|
|
54
|
+
<Canvas of={TitleBlockStories.LightVariant} sourceState="hidden" />
|
|
55
|
+
|
|
56
|
+
**If you're using navigation tabs, set `variant="light"` on each
|
|
57
|
+
`NavigationTab`** Tabs don't inherit the variant from the TitleBlock. set
|
|
58
|
+
it in both places, or the tabs keep their purple background.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<TitleBlock
|
|
62
|
+
variant="light"
|
|
63
|
+
title="Page title"
|
|
64
|
+
navigationTabs={[
|
|
65
|
+
<NavigationTab key="1" variant="light" text="Label" href="#" active />,
|
|
66
|
+
<NavigationTab key="2" variant="light" text="Label" href="#" />,
|
|
67
|
+
]}
|
|
68
|
+
/>
|
|
69
|
+
```
|
|
29
70
|
|
|
30
|
-
###
|
|
71
|
+
### Default (purple)
|
|
31
72
|
|
|
32
|
-
|
|
73
|
+
Shown for recognition only. Don't reach for this on new surfaces.
|
|
33
74
|
|
|
34
|
-
|
|
75
|
+
<Canvas of={TitleBlockStories.Playground} sourceState="hidden" />
|
|
76
|
+
|
|
77
|
+
## Sticky behavior
|
|
78
|
+
|
|
79
|
+
Setting `sticky` pins the TitleBlock's top strip to the top of its scroll
|
|
80
|
+
container as the page scrolls, instead of letting it scroll away. Full
|
|
81
|
+
mechanism, structure, and code for reserving space above the strip (for
|
|
82
|
+
example, a banner) are covered in the
|
|
83
|
+
[Sticky Banner guide](/docs/components-titleblock-sticky-banner--docs).
|
|
84
|
+
|
|
85
|
+
**If your surface is adding Coach, turn `sticky` on.** A pinned top strip is a
|
|
86
|
+
requirement when the header carries a Coach button.
|
|
87
|
+
|
|
88
|
+
### Coach button placement
|
|
35
89
|
|
|
36
|
-
|
|
90
|
+
For teams adding Coach to a surface that already has a primary Call to action CTA:
|
|
37
91
|
|
|
38
|
-
|
|
92
|
+
- **Coach is the primary action.** Pass it as `primaryAction`.
|
|
93
|
+
- **Demote the existing primary CTA to `defaultAction`.** This is the slot
|
|
94
|
+
that renders immediately to the left of `primaryAction`, in the same top
|
|
95
|
+
row. Don't use `secondaryActions` or `secondaryOverflowMenuItems` for this.
|
|
96
|
+
Those render in a separate row below, alongside the navigation tabs, not
|
|
97
|
+
next to the primary and default actions.
|
|
98
|
+
|
|
99
|
+
TitleBlock predates current naming conventions, so `defaultAction` is
|
|
100
|
+
its term for what a modern component would call a secondary action: a
|
|
101
|
+
non-primary button rendered next to the primary one.
|
|
102
|
+
|
|
103
|
+
- **Coach sits furthest right**, closest to the side panel. TitleBlock is
|
|
104
|
+
props-based and its action slots aren't reorderable, so passing Coach as
|
|
105
|
+
`primaryAction` gives you this placement automatically.
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Long titles
|
|
39
110
|
|
|
40
|
-
<Canvas of={TitleBlockStories.
|
|
111
|
+
<Canvas of={TitleBlockStories.HasLongTitleLightVariant} sourceState="hidden" />
|
|
41
112
|
|
|
42
|
-
###
|
|
113
|
+
### Default action limitations
|
|
43
114
|
|
|
44
|
-
|
|
115
|
+
`primaryAction` and `defaultAction` both render in the top row, but they don't
|
|
116
|
+
accept the same props:
|
|
45
117
|
|
|
46
|
-
|
|
118
|
+
- **`defaultAction` accepts a `badge`.** Pass `badge: { text: '3' }` alongside
|
|
119
|
+
the label. It reaches the underlying button, so you also get its optional
|
|
120
|
+
`variant` and `reversed` fields.
|
|
121
|
+
- **`defaultAction` can't be a dropdown.** Only `primaryAction` accepts a menu
|
|
122
|
+
group (`{ label, menuItems }`) and renders a button that opens a menu.
|
|
47
123
|
|
|
48
|
-
<Canvas of={TitleBlockStories.
|
|
124
|
+
<Canvas of={TitleBlockStories.WithDefaultActionBadge} sourceState="hidden" />
|
|
@@ -30,6 +30,15 @@ const SECONDARY_ACTIONS = [
|
|
|
30
30
|
},
|
|
31
31
|
]
|
|
32
32
|
|
|
33
|
+
const LIGHT_NAVIGATION_TABS = [
|
|
34
|
+
<NavigationTab key="1" variant="light" text="Label" href="#" active />,
|
|
35
|
+
<NavigationTab key="2" variant="light" text="Label" href="#" />,
|
|
36
|
+
<NavigationTab key="3" variant="light" text="Label" href="#" />,
|
|
37
|
+
<NavigationTab key="4" variant="light" text="Label" href="#" />,
|
|
38
|
+
<NavigationTab key="5" variant="light" text="Label" href="#" />,
|
|
39
|
+
<NavigationTab key="6" variant="light" text="Label" href="#" />,
|
|
40
|
+
]
|
|
41
|
+
|
|
33
42
|
const viewports = {
|
|
34
43
|
viewports: {
|
|
35
44
|
default: {
|
|
@@ -181,12 +190,6 @@ export const Playground: Story = {
|
|
|
181
190
|
},
|
|
182
191
|
}
|
|
183
192
|
|
|
184
|
-
export const Viewports: Story = {
|
|
185
|
-
parameters: {
|
|
186
|
-
viewport: viewports,
|
|
187
|
-
chromatic: chromaticViewports,
|
|
188
|
-
},
|
|
189
|
-
}
|
|
190
193
|
export const WithTabNavigation: Story = {
|
|
191
194
|
parameters: {
|
|
192
195
|
viewport: viewports,
|
|
@@ -222,6 +225,18 @@ export const HasLongTitle: Story = {
|
|
|
222
225
|
args: { title: 'A long title with over thirty characters' },
|
|
223
226
|
}
|
|
224
227
|
|
|
228
|
+
export const HasLongTitleLightVariant: Story = {
|
|
229
|
+
parameters: {
|
|
230
|
+
viewport: viewports,
|
|
231
|
+
chromatic: { disable: true },
|
|
232
|
+
},
|
|
233
|
+
args: {
|
|
234
|
+
variant: 'light',
|
|
235
|
+
title: 'A long title with over thirty characters',
|
|
236
|
+
navigationTabs: LIGHT_NAVIGATION_TABS,
|
|
237
|
+
},
|
|
238
|
+
}
|
|
239
|
+
|
|
225
240
|
export const LightVariant: Story = {
|
|
226
241
|
parameters: {
|
|
227
242
|
docs: {
|
|
@@ -235,14 +250,7 @@ export const LightVariant: Story = {
|
|
|
235
250
|
args: {
|
|
236
251
|
variant: 'light',
|
|
237
252
|
title: 'Light TitleBlock',
|
|
238
|
-
navigationTabs:
|
|
239
|
-
<NavigationTab key="1" variant="light" text="Label" href="#" active />,
|
|
240
|
-
<NavigationTab key="2" variant="light" text="Label" href="#" />,
|
|
241
|
-
<NavigationTab key="3" variant="light" text="Label" href="#" />,
|
|
242
|
-
<NavigationTab key="4" variant="light" text="Label" href="#" />,
|
|
243
|
-
<NavigationTab key="5" variant="light" text="Label" href="#" />,
|
|
244
|
-
<NavigationTab key="6" variant="light" text="Label" href="#" />,
|
|
245
|
-
],
|
|
253
|
+
navigationTabs: LIGHT_NAVIGATION_TABS,
|
|
246
254
|
},
|
|
247
255
|
}
|
|
248
256
|
|
|
@@ -553,20 +561,6 @@ export const StickerSheetBreadcrumbs: Story = {
|
|
|
553
561
|
'#Breadcrumbs-focus-example [class^="TitleBlock-TitleBlock-module__breadcrumb"]',
|
|
554
562
|
],
|
|
555
563
|
},
|
|
556
|
-
a11y: {
|
|
557
|
-
config: {
|
|
558
|
-
rules: [
|
|
559
|
-
{
|
|
560
|
-
id: 'color-contrast', // false positive from animate in on the breadcrumbs
|
|
561
|
-
enabled: false,
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
id: 'landmark-unique', // false positive from having multiple TitleBlocks on a page
|
|
565
|
-
enabled: false,
|
|
566
|
-
},
|
|
567
|
-
],
|
|
568
|
-
},
|
|
569
|
-
},
|
|
570
564
|
},
|
|
571
565
|
render: (args) => (
|
|
572
566
|
<StickerSheet>
|
|
@@ -739,6 +733,34 @@ export const WithOnlySecondaryActions: Story = {
|
|
|
739
733
|
},
|
|
740
734
|
}
|
|
741
735
|
|
|
736
|
+
export const WithDefaultActionBadge: Story = {
|
|
737
|
+
parameters: {
|
|
738
|
+
viewport: viewports,
|
|
739
|
+
chromatic: { disable: true },
|
|
740
|
+
},
|
|
741
|
+
args: {
|
|
742
|
+
variant: 'light',
|
|
743
|
+
title: 'Goals',
|
|
744
|
+
surveyStatus: undefined,
|
|
745
|
+
avatar: undefined,
|
|
746
|
+
breadcrumb: undefined,
|
|
747
|
+
secondaryActions: undefined,
|
|
748
|
+
secondaryOverflowMenuItems: undefined,
|
|
749
|
+
// Badge is supported: it passes through to the underlying button.
|
|
750
|
+
defaultAction: {
|
|
751
|
+
label: 'View drafts',
|
|
752
|
+
href: '#',
|
|
753
|
+
badge: { text: '3' },
|
|
754
|
+
},
|
|
755
|
+
// Only the primary action can be a menu group (label + menuItems).
|
|
756
|
+
primaryAction: {
|
|
757
|
+
label: 'Create goal',
|
|
758
|
+
menuItems: [{ label: 'Create a single goal' }, { label: 'Bulk create goals' }],
|
|
759
|
+
},
|
|
760
|
+
navigationTabs: LIGHT_NAVIGATION_TABS,
|
|
761
|
+
},
|
|
762
|
+
}
|
|
763
|
+
|
|
742
764
|
export const StickyTopStripInScrollableContainer: Story = {
|
|
743
765
|
name: 'Sticker Sheet (Sticky Top Strip In Scrollable Container)',
|
|
744
766
|
parameters: {
|
package/src/TitleBlock/types.ts
CHANGED
|
@@ -17,6 +17,11 @@ import { type NavigationTabProps } from './subcomponents/NavigationTabs'
|
|
|
17
17
|
export type TitleBlockProps = {
|
|
18
18
|
children?: React.ReactNode
|
|
19
19
|
title: string
|
|
20
|
+
/**
|
|
21
|
+
* `light` is the recommended variant for new implementations. Leaving `variant`
|
|
22
|
+
* unset falls back to the default purple background.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
20
25
|
variant?: TitleBlockVariant
|
|
21
26
|
breadcrumb?: TitleBlockBreadcrumbType
|
|
22
27
|
avatar?: JSX.Element | TitleBlockAvatarProps
|