@indico-data/design-system 1.0.56 → 1.0.58

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -24,29 +24,30 @@
24
24
  "@fortawesome/free-solid-svg-icons": "^6.5.1",
25
25
  "@indico-data/utils": "^0.0.5",
26
26
  "@popperjs/core": "^2.11.8",
27
- "@react-aria/radio": "^3.10.0",
28
- "@react-aria/visually-hidden": "^3.8.8",
29
- "@react-types/button": "^3.9.1",
30
- "@react-types/checkbox": "^3.6.0",
31
- "@react-types/radio": "^3.7.0",
27
+ "@react-aria/radio": "^3.10.2",
28
+ "@react-aria/visually-hidden": "^3.8.10",
29
+ "@react-types/button": "^3.9.2",
30
+ "@react-types/checkbox": "^3.7.1",
31
+ "@react-types/radio": "^3.7.1",
32
32
  "classnames": "^2.5.1",
33
33
  "date-fns": "^3.3.1",
34
34
  "focus-trap-react": "^10.2.3",
35
35
  "html-webpack-plugin": "^5.6.0",
36
36
  "prop-types": "^15.8.1",
37
- "react-aria-components": "^1.0.1",
37
+ "react-aria-components": "^1.1.1",
38
38
  "react-day-picker": "^8.10.0",
39
39
  "react-modal": "^3.16.1",
40
40
  "react-popper": "^2.3.0",
41
- "react-stately": "^3.29.1",
41
+ "react-stately": "^3.30.1",
42
+ "react-tooltip": "5.26.3",
42
43
  "simple-zustand-devtools": "^1.1.0",
43
44
  "svgo": "^3.2.0",
44
45
  "ts-jest": "^29.1.2",
45
46
  "tslib": "^2.6.2",
46
47
  "uuid": "^9.0.1",
47
- "webpack": "^5.90.1",
48
+ "webpack": "^5.90.3",
48
49
  "webpack-cli": "^5.1.4",
49
- "webpack-dev-server": "^4.15.1"
50
+ "webpack-dev-server": "^5.0.2"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@babel/core": "^7.23.9",
@@ -54,40 +55,40 @@
54
55
  "@babel/preset-env": "^7.23.9",
55
56
  "@babel/preset-react": "^7.23.3",
56
57
  "@babel/preset-typescript": "^7.23.3",
57
- "@react-aria/button": "^3.9.1",
58
- "@react-aria/focus": "^3.16.0",
58
+ "@react-aria/button": "^3.9.3",
59
+ "@react-aria/focus": "^3.16.2",
59
60
  "@rollup/plugin-babel": "^6.0.4",
60
61
  "@rollup/plugin-commonjs": "^25.0.7",
61
62
  "@rollup/plugin-node-resolve": "^15.2.3",
62
63
  "@rollup/plugin-terser": "^0.4.4",
63
64
  "@rollup/plugin-typescript": "^11.1.6",
64
- "@storybook/addon-a11y": "^7.6.13",
65
- "@storybook/addon-docs": "^7.6.13",
66
- "@storybook/addon-essentials": "^7.6.13",
67
- "@storybook/addon-interactions": "^7.6.13",
68
- "@storybook/addon-links": "^7.6.13",
65
+ "@storybook/addon-a11y": "^7.6.17",
66
+ "@storybook/addon-docs": "^7.6.17",
67
+ "@storybook/addon-essentials": "^7.6.17",
68
+ "@storybook/addon-interactions": "^7.6.17",
69
+ "@storybook/addon-links": "^7.6.17",
69
70
  "@storybook/addon-onboarding": "^1.0.11",
70
71
  "@storybook/addon-styling": "^1.3.7",
71
72
  "@storybook/addon-styling-webpack": "^0.0.6",
72
- "@storybook/addon-themes": "^7.6.13",
73
- "@storybook/blocks": "^7.6.13",
74
- "@storybook/react": "^7.6.13",
75
- "@storybook/react-webpack5": "^7.6.13",
76
- "@storybook/test": "^7.6.13",
73
+ "@storybook/addon-themes": "^7.6.17",
74
+ "@storybook/blocks": "^7.6.17",
75
+ "@storybook/react": "^7.6.17",
76
+ "@storybook/react-webpack5": "^7.6.17",
77
+ "@storybook/test": "^7.6.17",
77
78
  "@storybook/test-runner": "^0.16.0",
78
79
  "@testing-library/dom": "^9.3.4",
79
80
  "@testing-library/jest-dom": "^6.4.2",
80
81
  "@testing-library/react": "^14.2.1",
81
82
  "@testing-library/user-event": "^14.5.2",
82
83
  "@types/jest": "^29.5.12",
83
- "@types/prop-types": "^15",
84
- "@types/react": "^18.2.55",
85
- "@types/react-dom": "^18.2.18",
84
+ "@types/prop-types": "^15.7.11",
85
+ "@types/react": "^18.2.57",
86
+ "@types/react-dom": "^18.2.19",
86
87
  "@types/react-modal": "^3.16.3",
87
88
  "@types/styled-components": "^5.1.34",
88
89
  "@types/uuid": "^9.0.8",
89
- "@typescript-eslint/eslint-plugin": "^6.21.0",
90
- "@typescript-eslint/parser": "^6.21.0",
90
+ "@typescript-eslint/eslint-plugin": "^7.0.2",
91
+ "@typescript-eslint/parser": "^7.0.2",
91
92
  "babel-loader": "^9.1.3",
92
93
  "babel-plugin-styled-components": "^2.1.4",
93
94
  "babel-preset-react-app": "^10.0.1",
@@ -97,17 +98,17 @@
97
98
  "jest": "^29.7.0",
98
99
  "jest-environment-jsdom": "^29.7.0",
99
100
  "lint-staged": "^15.2.2",
100
- "postcss": "^8.4.34",
101
+ "postcss": "^8.4.35",
101
102
  "prettier": "3.2.5",
102
103
  "react": "^18.2.0",
103
104
  "react-dom": "^18.2.0",
104
- "react-router-dom": "^6.22.0",
105
+ "react-router-dom": "^6.22.1",
105
106
  "react-select": "^5.8.0",
106
- "rollup": "^4.9.6",
107
+ "rollup": "^4.12.0",
107
108
  "rollup-plugin-dts": "^6.1.0",
108
109
  "rollup-plugin-peer-deps-external": "^2.2.4",
109
110
  "rollup-plugin-postcss": "^4.0.2",
110
- "storybook": "^7.6.13",
111
+ "storybook": "^7.6.17",
111
112
  "styled-components": "^6.1.8",
112
113
  "ts-loader": "^9.5.1",
113
114
  "tsconfig-paths-webpack-plugin": "^4.1.0",
@@ -0,0 +1,107 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
3
+
4
+ import { Tooltip } from './Tooltip';
5
+
6
+ const meta: Meta<typeof Tooltip> = {
7
+ component: Tooltip,
8
+ tags: ['autodocs'],
9
+ title: 'Tooltip',
10
+ args: {},
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof Tooltip>;
15
+
16
+ function RenderQuestionMark(props: any) {
17
+ return (
18
+ <div style={{ height: '500px' }}>
19
+ <Tooltip for="example-tooltip" {...props}>
20
+ This is a paragraph
21
+ </Tooltip>
22
+
23
+ <p data-tip data-for="example-tooltip">
24
+ Hover on text to see tooltip
25
+ </p>
26
+ </div>
27
+ );
28
+ }
29
+
30
+ function RenderNoQuestionMark(props: any) {
31
+ return (
32
+ <>
33
+ <Tooltip for="example-tooltip">
34
+ <p>This is a paragraph</p>
35
+ </Tooltip>
36
+
37
+ <p
38
+ data-tooltip-id="example-tooltip"
39
+ data-tooltip-place={props.place}
40
+ style={{ display: 'inline-block', marginTop: '100px' }}
41
+ >
42
+ Hover on text to see tooltip
43
+ </p>
44
+ </>
45
+ );
46
+ }
47
+
48
+ export const Single: Story = {
49
+ args: {
50
+ questionMark: true,
51
+ for: 'example-tooltip',
52
+ place: 'top',
53
+ clickToShow: false,
54
+ delayHide: 0,
55
+ questionMarkClassName: 'question-mark',
56
+ children: 'This is a paragraph',
57
+ block: false,
58
+ },
59
+ render: (args) => {
60
+ return <RenderQuestionMark {...args} />;
61
+ },
62
+ };
63
+
64
+ export const NoQuestionMark: Story = {
65
+ args: {
66
+ questionMark: false,
67
+ for: 'example-tooltip',
68
+ place: 'top',
69
+ clickToShow: false,
70
+ delayHide: 0,
71
+ children: 'This is a paragraph',
72
+ block: false,
73
+ },
74
+ render: (args) => {
75
+ return <RenderNoQuestionMark {...args} />;
76
+ },
77
+ };
78
+
79
+ export const Bottom: Story = {
80
+ args: {
81
+ questionMark: false,
82
+ for: 'example-tooltip',
83
+ place: 'bottom',
84
+ clickToShow: false,
85
+ delayHide: 0,
86
+ children: 'This is a paragraph',
87
+ block: false,
88
+ },
89
+ render: (args) => {
90
+ return <RenderNoQuestionMark {...args} />;
91
+ },
92
+ };
93
+
94
+ export const Right: Story = {
95
+ args: {
96
+ questionMark: false,
97
+ for: 'example-tooltip',
98
+ place: 'right',
99
+ clickToShow: false,
100
+ delayHide: 0,
101
+ children: 'This is a paragraph',
102
+ block: false,
103
+ },
104
+ render: (args) => {
105
+ return <RenderNoQuestionMark {...args} />;
106
+ },
107
+ };
@@ -0,0 +1,76 @@
1
+ import styled from 'styled-components';
2
+
3
+ import { COLORS } from '@/index';
4
+
5
+ export const StyledTooltip = styled.div`
6
+ display: inline-block;
7
+
8
+ i:hover {
9
+ cursor: pointer;
10
+ }
11
+
12
+ p {
13
+ line-height: 1.4;
14
+ font-size: 13px;
15
+ }
16
+
17
+ .tool {
18
+ background: ${COLORS.oxfordBlue} !important;
19
+ border: 1px solid ${COLORS.baliHai} !important;
20
+ border-radius: 2px !important;
21
+ padding: 8px 11px !important;
22
+ opacity: 1 !important;
23
+
24
+ &.place-left:after {
25
+ border-left-color: ${COLORS.oxfordBlue} !important;
26
+ border-top: 5px solid transparent !important;
27
+ border-bottom: 5px solid transparent !important;
28
+ right: -6px !important;
29
+ top: 50% !important;
30
+ margin-top: -9px !important;
31
+ }
32
+
33
+ &.place-left:before {
34
+ border-left-color: ${COLORS.baliHai} !important;
35
+ border-left-width: 8px !important;
36
+ border-left-style: solid !important;
37
+ margin-top: -10px !important;
38
+ }
39
+
40
+ &.place-right:after {
41
+ border-right-color: ${COLORS.oxfordBlue} !important;
42
+ border-top: 5px solid transparent !important;
43
+ border-bottom: 5px solid transparent !important;
44
+ left: -6px !important;
45
+ top: 50% !important;
46
+ margin-top: -9px !important;
47
+ }
48
+
49
+ &.place-right:before {
50
+ border-right-color: ${COLORS.baliHai} !important;
51
+ border-right-width: 8px !important;
52
+ border-right-style: solid !important;
53
+ margin-top: -10px !important;
54
+ }
55
+
56
+ &.place-top:after {
57
+ border-top-color: ${COLORS.oxfordBlue} !important;
58
+ }
59
+
60
+ &.place-top:before {
61
+ border-top-color: ${COLORS.baliHai} !important;
62
+ border-top-width: 8px !important;
63
+ border-top-style: solid !important;
64
+ }
65
+
66
+ &.place-bottom:after {
67
+ border-bottom-color: ${COLORS.oxfordBlue} !important;
68
+ }
69
+
70
+ &.place-bottom:before {
71
+ border-bottom-color: ${COLORS.baliHai} !important;
72
+ border-bottom-width: 8px !important;
73
+ border-bottom-style: solid !important;
74
+ }
75
+ }
76
+ `;
@@ -0,0 +1,71 @@
1
+ // TODO: This component's migration was fast-tracked for Insights. Assess for potential refactor and documentation.
2
+
3
+ import React from 'react';
4
+
5
+ import { Icon, COLORS } from '@/index';
6
+ import { PermafrostComponent } from '@/types';
7
+ import { Tooltip as ReactTooltip } from 'react-tooltip';
8
+
9
+ import { StyledTooltip } from './Tooltip.styles';
10
+
11
+ enum PlacesType {
12
+ top = 'top',
13
+ 'top-start' = 'top-start',
14
+ 'top-end' = 'top-end',
15
+ right = 'right',
16
+ 'right-start' = 'right-start',
17
+ 'right-end' = 'right-end',
18
+ bottom = 'bottom',
19
+ 'bottom-start' = 'bottom-start',
20
+ 'bottom-end' = 'bottom-end',
21
+ left = 'left',
22
+ 'left-start' = 'left-start',
23
+ 'left-end' = 'left-end',
24
+ }
25
+
26
+ type Props = PermafrostComponent & {
27
+ questionMark?: boolean;
28
+ for?: string | null;
29
+ place?: string;
30
+ clickToShow?: boolean;
31
+ delayShow?: number;
32
+ delayHide?: number;
33
+ questionMarkClassName?: string;
34
+ children: React.ReactNode;
35
+ block?: boolean;
36
+ };
37
+
38
+ export const Tooltip = (props: Props) => {
39
+ return (
40
+ <StyledTooltip
41
+ className={props.className}
42
+ data-cy={props['data-cy']}
43
+ id={props.id}
44
+ // this was done in a hurry, consider refactor on next pass.
45
+ style={{ display: props.block ? 'block' : 'inline-block' }}
46
+ >
47
+ {props.questionMark && (
48
+ <i
49
+ style={{ color: COLORS.curiousBlue }}
50
+ className={props.questionMarkClassName}
51
+ // data-tip={props.clickToShow ? 'custom show' : ''}
52
+ data-tooltip-id={props.for as string | undefined}
53
+ data-tooltip-place={(props.place as PlacesType) || 'top'}
54
+ >
55
+ <Icon name="fa-question-circle" />
56
+ </i>
57
+ )}
58
+ <ReactTooltip
59
+ className="tool"
60
+ // globalEventOff={props.clickToShow ? 'click' : ''}
61
+ // place={(props.place as PlacesType) || 'top'}
62
+ openOnClick={props.clickToShow}
63
+ id={props.for as string | undefined}
64
+ delayShow={props.delayShow}
65
+ delayHide={props.delayHide}
66
+ >
67
+ {props.children}
68
+ </ReactTooltip>
69
+ </StyledTooltip>
70
+ );
71
+ };
@@ -95,7 +95,7 @@ function StoryRender(props: any) {
95
95
 
96
96
  <WizardSection>
97
97
  <h2 className="section-heading">
98
- Team{' '}
98
+ Team
99
99
  <span className="supporting-text" style={{ marginLeft: '0.25em' }}>
100
100
  1
101
101
  </span>
@@ -10,12 +10,13 @@ export const StyledWizardWithSidebar = styled.div<{
10
10
  ['data-cy']?: string;
11
11
  id?: string;
12
12
  }>`
13
- display: inline-flex;
13
+ height: 750px;
14
+ display: flex;
15
+ /* display: flex;
14
16
  /* min-height: 455px; */
15
17
  background-color: ${(props) => (props.backgroundcolor ? props.backgroundcolor : 'currentColor')};
16
18
  color: ${(props) => (props.color ? props.color : 'inherit')};
17
19
  border-radius: 4px;
18
-
19
20
  h2 {
20
21
  font-size: ${TYPOGRAPHY.fontSize.subheadLarge};
21
22
  margin-bottom: ${SPACING.md};
@@ -63,18 +64,32 @@ export const StyledWizardWithSidebar = styled.div<{
63
64
  }
64
65
  }
65
66
 
67
+ .wizard-content__wrapper {
68
+ display: flex;
69
+ justify-content: space-between;
70
+ flex-wrap: wrap;
71
+ flex-direction: column;
72
+ height: 100%;
73
+ }
66
74
  .wizard-content {
67
- /* min-width: 660px; */
75
+ width: 100%;
68
76
  padding: 30px;
69
77
 
70
78
  .wizard-content__header {
71
- /* min-height: 70px; */
79
+ flex: 0 0 100%;
72
80
  }
73
81
  .wizard-content__body {
74
- /* min-height: 520px; */
82
+ flex: 0 0 100%;
75
83
  }
76
84
  }
77
85
 
86
+ .wizard-actions {
87
+ width: 100%;
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: end;
91
+ }
92
+
78
93
  nav {
79
94
  display: flex;
80
95
  align-items: center;
@@ -84,19 +99,22 @@ export const StyledWizardWithSidebar = styled.div<{
84
99
  padding-right: 0 !important;
85
100
  margin-top: ${SPACING.md};
86
101
  }
87
-
88
102
  .wizard-buttons {
89
103
  display: flex;
90
104
  align-items: center;
91
105
  font-size: ${TYPOGRAPHY.fontSize.subheadSmall};
92
106
 
93
107
  button {
108
+ width: 200px;
109
+ text-align: center;
110
+ display: flex;
111
+ justify-content: center;
94
112
  ${(props) =>
95
113
  props.buttoncolor &&
96
114
  css`
97
115
  background-color: ${props.buttoncolor};
98
116
  color: ${props.backgroundcolor || 'inherit'};
99
- `}
117
+ `};
100
118
  }
101
119
 
102
120
  button.outline {
@@ -113,6 +131,7 @@ export const StyledWizardWithSidebar = styled.div<{
113
131
  font-size: inherit;
114
132
  margin-right: 1em;
115
133
  background-color: inherit;
134
+ width: auto;
116
135
  ${(props) =>
117
136
  props.buttoncolor &&
118
137
  css`
@@ -200,51 +200,53 @@ export function WizardWithSidebar(props: Props) {
200
200
  );
201
201
  })}
202
202
  </div>
203
-
204
203
  <div className="wizard-content">
205
- <div className="wizard-content__header">
206
- <h2>{currentStep}</h2>
207
- </div>
208
- <div className="wizard-content__body">{children}</div>
209
-
210
- <nav>
211
- <div className="wizard-buttons">
212
- <Button onClick={() => setOpenCancelConfirm(true)} variant="link-style">
213
- Cancel
214
- </Button>
204
+ <div className="wizard-content__wrapper">
205
+ <div className="wizard-content__items">
206
+ <div className="wizard-content__header">
207
+ <h2>{currentStep}</h2>
208
+ </div>
209
+ <div className="wizard-content__body">{children}</div>
210
+ </div>
211
+ <nav className="wizard-actions">
212
+ <div className="wizard-buttons">
213
+ <Button onClick={() => setOpenCancelConfirm(true)} variant="link-style">
214
+ Cancel
215
+ </Button>
215
216
 
216
- {steps.indexOf(currentStep) !== 0 && (
217
- <IconButton
218
- variant="outline"
219
- iconName="fa-arrow-left"
220
- label="Previous Step"
221
- onPress={prevStep}
222
- isDisabled={disablePrevStep}
223
- />
224
- )}
217
+ {steps.indexOf(currentStep) !== 0 && (
218
+ <IconButton
219
+ variant="outline"
220
+ iconName="fa-arrow-left"
221
+ label="Previous Step"
222
+ onPress={prevStep}
223
+ isDisabled={disablePrevStep}
224
+ />
225
+ )}
225
226
 
226
- {onLastStep ? (
227
- <IconButton
228
- variant="primary"
229
- iconName="check"
230
- busy={isBusy}
231
- label={isBusy ? submitProcessing : submitButtonLabel}
232
- onPress={handleNextPress}
233
- isDisabled={disableSubmit}
234
- />
235
- ) : (
236
- <IconButton
237
- variant="primary"
238
- iconSide="end"
239
- iconName="fa-arrow-right"
240
- label="Next Step"
241
- onPress={handleNextPress}
242
- isDisabled={disableNextStep}
243
- {...nextButtonProps}
244
- />
245
- )}
246
- </div>
247
- </nav>
227
+ {onLastStep ? (
228
+ <IconButton
229
+ variant="primary"
230
+ iconName="check"
231
+ busy={isBusy}
232
+ label={isBusy ? submitProcessing : submitButtonLabel}
233
+ onPress={handleNextPress}
234
+ isDisabled={disableSubmit}
235
+ />
236
+ ) : (
237
+ <IconButton
238
+ variant="primary"
239
+ iconSide="end"
240
+ iconName="fa-arrow-right"
241
+ label="Next Step"
242
+ onPress={handleNextPress}
243
+ isDisabled={disableNextStep}
244
+ {...nextButtonProps}
245
+ />
246
+ )}
247
+ </div>
248
+ </nav>
249
+ </div>
248
250
  </div>
249
251
 
250
252
  <ConfirmModal
@@ -1,3 +1,5 @@
1
+ import { Tooltip } from 'react-aria-components';
2
+
1
3
  export { Accordion } from './Accordion';
2
4
  export { Section, SectionBlock, SectionBody, SectionHeader, SectionTable } from './basic-section';
3
5
  export { Button, IconButton } from './buttons';
@@ -34,3 +36,4 @@ export { WizardWithSidebar } from './WizardWithSidebar';
34
36
  export { Drawer } from './Navigation/Drawer';
35
37
  export { TextTruncate } from './text-truncate';
36
38
  export { Toggle } from './Toggle';
39
+ export { Tooltip } from './Tooltip';
@@ -5,11 +5,12 @@ interface TextTruncateProps {
5
5
  string: string;
6
6
  maxChars: number;
7
7
  children?: any;
8
+ noTitle?: boolean;
8
9
  }
9
10
 
10
- export function TextTruncate({ string, maxChars, children }: TextTruncateProps) {
11
+ export function TextTruncate({ string, maxChars, children, noTitle }: TextTruncateProps) {
11
12
  return string.length > maxChars ? (
12
- <StyledTextTruncate title={string}>
13
+ <StyledTextTruncate title={noTitle ? undefined : string}>
13
14
  {`${string.substring(0, maxChars)}...`}
14
15
  {children}
15
16
  </StyledTextTruncate>
package/src/index.ts CHANGED
@@ -58,6 +58,7 @@ export {
58
58
  StyledWizard,
59
59
  TextTruncate,
60
60
  Toggle,
61
+ Tooltip,
61
62
  WizardWithSidebar,
62
63
  } from './components';
63
64
 
@@ -1,3 +0,0 @@
1
- import { ListItem } from './types';
2
- export declare const navigationItems: ListItem[];
3
- export declare const footerItems: ListItem[];
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { PermafrostComponent } from '@/types';
3
- type Props = PermafrostComponent & {
4
- questionMark?: boolean;
5
- for?: string | null;
6
- place?: string;
7
- clickToShow?: boolean;
8
- delayShow?: number;
9
- delayHide?: number;
10
- questionMarkClassName?: string;
11
- children: React.ReactNode;
12
- block?: boolean;
13
- };
14
- export declare const Tooltip: (props: Props) => import("react/jsx-runtime").JSX.Element;
15
- export {};
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Tooltip } from './Tooltip';
3
- declare const meta: Meta<typeof Tooltip>;
4
- export default meta;
5
- type Story = StoryObj<typeof Tooltip>;
6
- export declare const Single: Story;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const StyledTooltip: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;