@indico-data/design-system 1.0.52 → 1.0.53
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/jest.config.js +1 -2
- package/lib/components/Icon/Icon.stories.d.ts +2 -2
- package/lib/components/Icon/indicons.d.ts +1 -0
- package/lib/components/Navigation/Drawer/constants.d.ts +3 -0
- package/lib/components/index.d.ts +1 -1
- package/lib/components/inputs/DatePicker/DatePicker.d.ts +15 -0
- package/lib/components/inputs/DatePicker/DatePicker.stories.d.ts +6 -0
- package/lib/components/inputs/DatePicker/DatePicker.styles.d.ts +2 -0
- package/lib/components/inputs/DatePicker/index.d.ts +1 -0
- package/lib/components/inputs/NoInputDatePicker/NoInputDatePicker.d.ts +19 -0
- package/lib/components/inputs/NoInputDatePicker/NoInputDatePicker.stories.d.ts +7 -0
- package/lib/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +2 -0
- package/lib/components/inputs/NoInputDatePicker/__tests__/NoInputDatePicker.test.d.ts +1 -0
- package/lib/components/inputs/NoInputDatePicker/index.d.ts +1 -0
- package/lib/components/inputs/index.d.ts +2 -0
- package/lib/components/text-truncate/TextTruncate.d.ts +1 -1
- package/lib/index.d.ts +61 -28
- package/lib/index.esm.js +21441 -13325
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +21462 -13328
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +1 -0
- package/lib/utils/color.d.ts +21 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/number.d.ts +21 -0
- package/lib/utils/string.d.ts +12 -0
- package/package.json +10 -3
- package/src/components/Icon/indicons.tsx +6 -0
- package/src/components/ListTable/Header/Header.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/basic-section/SectionTable/SectionTable.styles.ts +1 -2
- package/src/components/basic-section/SectionTable/SectionTable.tsx +12 -10
- package/src/components/dropdowns/MultiCombobox/MultiCombobox.stories.tsx +1 -1
- package/src/components/dropdowns/MultiCombobox/MultiCombobox.tsx +1 -1
- package/src/components/dropdowns/SingleCombobox/SingleCombobox.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/components/inputs/DatePicker/DatePicker.stories.tsx +30 -0
- package/src/components/inputs/DatePicker/DatePicker.styles.ts +437 -0
- package/src/components/inputs/DatePicker/DatePicker.tsx +165 -0
- package/src/components/inputs/DatePicker/index.ts +1 -0
- package/src/components/inputs/EditableInput/EditableInput.tsx +1 -1
- package/src/components/inputs/NoInputDatePicker/NoInputDatePicker.stories.tsx +52 -0
- package/src/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.ts +449 -0
- package/src/components/inputs/NoInputDatePicker/NoInputDatePicker.tsx +204 -0
- package/src/components/inputs/NoInputDatePicker/__tests__/NoInputDatePicker.test.tsx +126 -0
- package/src/components/inputs/NoInputDatePicker/index.ts +1 -0
- package/src/components/inputs/TextInput/TextInput.stories.tsx +1 -1
- package/src/components/inputs/index.ts +2 -0
- package/src/components/modals/ModalBase/ModalBase.styles.tsx +1 -1
- package/src/components/text-truncate/TextTruncate.test.tsx +3 -4
- package/src/components/text-truncate/TextTruncate.tsx +3 -2
- package/src/index.ts +2 -0
- package/src/styles/globals/forms.ts +1 -9
- package/src/styles/globals/tables.ts +1 -5
- package/src/utils/color.ts +139 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/number.ts +29 -0
- package/src/utils/string.ts +87 -0
package/lib/types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare const allIcons: {
|
|
|
12
12
|
readonly bookmarks: import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
readonly 'bookmark-saved': import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
readonly branch: import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
readonly calendar: import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
readonly 'check-circle': import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
readonly 'circle-help': import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
readonly check: import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const mix: (color_1: string, color_2: string, weight: number) => string;
|
|
2
|
+
export declare const shade: (color: string, percentage: number) => string;
|
|
3
|
+
export declare const tint: (color: string, percentage: number) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Converts hex color values to rgb or rgba values if a opacity is supplied
|
|
6
|
+
* @param hex
|
|
7
|
+
* @returns {*}
|
|
8
|
+
*/
|
|
9
|
+
export declare const hexToRgb: (hex: string, opacity?: number) => string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Takes a 3- or 6-character hex color value, and returns an object containing
|
|
12
|
+
* its equivalent HSL values.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://css-tricks.com/converting-color-spaces-in-javascript/}
|
|
15
|
+
* @see {@link https://gist.github.com/mjackson/5311256}
|
|
16
|
+
*/
|
|
17
|
+
export declare function hexToHsl(hexColor: string): {
|
|
18
|
+
hue: number;
|
|
19
|
+
saturation: number;
|
|
20
|
+
lightness: number;
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takes a number and formats it nicely.
|
|
3
|
+
*
|
|
4
|
+
* @example numberWithCommas(12345)
|
|
5
|
+
* // returns 12,345
|
|
6
|
+
*/
|
|
7
|
+
export declare function numberWithCommas(value: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Takes a number and returns it, rounded up to the maximum decimal places specified.
|
|
10
|
+
*
|
|
11
|
+
* @example maxDecimalPlaces(0.1694915254237288, 2)
|
|
12
|
+
* // returns 0.17
|
|
13
|
+
*
|
|
14
|
+
* @example maxDecimalPlaces(0.1694915254237288, 3)
|
|
15
|
+
* // returns 0.169
|
|
16
|
+
*
|
|
17
|
+
* @example maxDecimalPlaces(12.902, 2)
|
|
18
|
+
* // returns 12.9
|
|
19
|
+
*/
|
|
20
|
+
export declare function maxDecimalPlaces(value: number, decimalPlaces: number): number;
|
|
21
|
+
export declare function formatConfidence(confidence: number): number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const camelCaseToUpperUnderscore: (string: string) => string;
|
|
2
|
+
export declare const camelCaseToSpaceUpper: (string: string) => string;
|
|
3
|
+
export declare const underscoreToCapitalize: (string: string) => string;
|
|
4
|
+
export declare const snakeCaseToCamelCase: (string: string) => string;
|
|
5
|
+
export declare function capitalize(string: string): string;
|
|
6
|
+
export declare function capitalizeFirstOnly(string: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Generates a random string of English alphabet characters. Defaults to a length of 8.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createRandomString(length?: number): string;
|
|
11
|
+
export declare const maxLengthWithEllipse: (string: string, maxLength: number) => string;
|
|
12
|
+
export declare const maxLengthWithMiddleEllipsis: (string: string, maxLength: number) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indico-data/design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"build": "rollup -c",
|
|
13
13
|
"build storybook": "storybook build",
|
|
14
14
|
"test-storybook": "test-storybook",
|
|
15
|
-
"test": "jest",
|
|
16
|
-
"test:watch": "jest --watch"
|
|
15
|
+
"test": "DEBUG_PRINT_LIMIT=10000 jest",
|
|
16
|
+
"test:watch": "DEBUG_PRINT_LIMIT=10000 jest --watch"
|
|
17
17
|
},
|
|
18
18
|
"lint-staged": {
|
|
19
19
|
"**/*": "prettier --write --ignore-unknown"
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@fortawesome/free-regular-svg-icons": "^6.5.1",
|
|
24
24
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
25
25
|
"@indico-data/utils": "^0.0.5",
|
|
26
|
+
"@popperjs/core": "^2.11.8",
|
|
26
27
|
"@react-aria/radio": "^3.10.0",
|
|
27
28
|
"@react-aria/visually-hidden": "^3.8.8",
|
|
28
29
|
"@react-types/button": "^3.9.1",
|
|
@@ -30,12 +31,17 @@
|
|
|
30
31
|
"@react-types/radio": "^3.7.0",
|
|
31
32
|
"classnames": "^2.5.1",
|
|
32
33
|
"date-fns": "^3.3.1",
|
|
34
|
+
"focus-trap-react": "^10.2.3",
|
|
33
35
|
"html-webpack-plugin": "^5.6.0",
|
|
36
|
+
"prop-types": "^15.8.1",
|
|
34
37
|
"react-aria-components": "^1.0.1",
|
|
38
|
+
"react-day-picker": "^8.10.0",
|
|
35
39
|
"react-modal": "^3.16.1",
|
|
40
|
+
"react-popper": "^2.3.0",
|
|
36
41
|
"react-stately": "^3.29.1",
|
|
37
42
|
"simple-zustand-devtools": "^1.1.0",
|
|
38
43
|
"svgo": "^3.2.0",
|
|
44
|
+
"ts-jest": "^29.1.2",
|
|
39
45
|
"tslib": "^2.6.2",
|
|
40
46
|
"uuid": "^9.0.1",
|
|
41
47
|
"webpack": "^5.90.1",
|
|
@@ -74,6 +80,7 @@
|
|
|
74
80
|
"@testing-library/react": "^14.2.1",
|
|
75
81
|
"@testing-library/user-event": "^14.5.2",
|
|
76
82
|
"@types/jest": "^29.5.12",
|
|
83
|
+
"@types/prop-types": "^15",
|
|
77
84
|
"@types/react": "^18.2.55",
|
|
78
85
|
"@types/react-dom": "^18.2.18",
|
|
79
86
|
"@types/react-modal": "^3.16.3",
|
|
@@ -70,6 +70,12 @@ const indicons = {
|
|
|
70
70
|
/>
|
|
71
71
|
</svg>
|
|
72
72
|
),
|
|
73
|
+
calendar: (
|
|
74
|
+
<svg viewBox="0 0 24 24">
|
|
75
|
+
<path d="M12 12c-.6 0-1 .5-1 1 0 .6.5 1 1 1s1-.5 1-1-.4-1-1-1M12 17c-.6 0-1 .5-1 1 0 .6.5 1 1 1s1-.5 1-1-.4-1-1-1M7.1 12c-.6 0-1 .5-1 1 0 .6.5 1 1 1 .6 0 1-.5 1-1 .1-.5-.4-1-1-1M7.1 17c-.6 0-1 .5-1 1 0 .6.5 1 1 1 .6 0 1-.5 1-1 .1-.5-.4-1-1-1M16.9 17c-.6 0-1 .5-1 1 0 .6.5 1 1 1 .6 0 1-.5 1-1s-.5-1-1-1M16.9 12c-.6 0-1 .5-1 1 0 .6.5 1 1 1 .6 0 1-.5 1-1s-.5-1-1-1" />
|
|
76
|
+
<path d="M19.1 2.4h-1.2V1c0-.6-.4-1-1-1s-1 .4-1 1v1.4H8.1V1c0-.6-.4-1-1-1s-1 .4-1 1v1.4H4.9c-2.1 0-3.7 1.7-3.7 3.7v14.1c0 2.1 1.7 3.7 3.7 3.7h14.3c2.1 0 3.7-1.7 3.7-3.7V6.1c0-2-1.7-3.7-3.8-3.7m-14.2 2h14.3c1 0 1.7.8 1.7 1.7v1.3H3.1V6.1c0-.9.8-1.7 1.8-1.7M19.1 22H4.9c-1 0-1.7-.8-1.7-1.7V9.4h17.7v10.9c0 .9-.8 1.7-1.8 1.7" />
|
|
77
|
+
</svg>
|
|
78
|
+
),
|
|
73
79
|
'check-circle': (
|
|
74
80
|
<svg viewBox="0 0 100 100" fill="currentColor">
|
|
75
81
|
<path d="M100 50c0 27.6-22.4 50-50 50S0 77.6 0 50 22.4 0 50 0s50 22.4 50 50zM78 30.7c-.7-1-1.9-1.5-3.5-1.5-1.2 0-2.3.5-3.3 1.5C65 37 45.3 56.6 42.4 59.4L28.8 48c-1-.9-2.2-1.3-3.5-1.2-1.3.1-2.5.7-3.3 1.8-.9 1-1.3 2.2-1.2 3.5.1 1.3.7 2.5 1.8 3.3l16.8 14.2c.9.7 2 1.1 3.1 1.1 1.3 0 2.5-.5 3.4-1.4 6.8-6.6 28.7-28.7 32-32 1.8-1.7 1.8-4.6.1-6.6z" />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled, { keyframes } from 'styled-components';
|
|
2
2
|
|
|
3
|
-
import { colorUtils } from '
|
|
3
|
+
import { colorUtils } from '@/utils';
|
|
4
4
|
|
|
5
5
|
import { MEDIA_QUERIES, COLORS } from '@/tokens';
|
|
6
6
|
|
|
@@ -188,7 +188,6 @@ export const StyledSectionTable = styled.div`
|
|
|
188
188
|
|
|
189
189
|
@media ${MEDIA_QUERIES.mediumScreen} {
|
|
190
190
|
position: static;
|
|
191
|
-
// border-bottom: 0.5px solid ${colorUtils.hexToRgb(COLORS.defaultFontColor, 0.1)};
|
|
192
191
|
padding: 20px 15px;
|
|
193
192
|
}
|
|
194
193
|
}
|
|
@@ -9,25 +9,25 @@ import { BorderSelect } from '@/components/dropdowns';
|
|
|
9
9
|
|
|
10
10
|
import { StyledSectionTable } from './SectionTable.styles';
|
|
11
11
|
|
|
12
|
-
const createTitle = (item) => {
|
|
12
|
+
const createTitle = (item: any) => {
|
|
13
13
|
return typeof item === 'string' || typeof item === 'number' ? item : null;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const SectionTable = (props) => {
|
|
16
|
+
export const SectionTable = (props: any) => {
|
|
17
17
|
const [openRowOptions, changeOpenRowOptions] = useState([]);
|
|
18
18
|
|
|
19
|
-
const handleRowClick = (link) => {
|
|
19
|
+
const handleRowClick = (link: any) => {
|
|
20
20
|
if (!link) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
return (e) => {
|
|
23
|
+
return (e: any) => {
|
|
24
24
|
e.stopPropagation();
|
|
25
25
|
props.history.push(link);
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const handleRowOptionToggleClick = (id) => {
|
|
30
|
-
if (openRowOptions.indexOf(id) === -1) {
|
|
29
|
+
const handleRowOptionToggleClick = (id: any) => {
|
|
30
|
+
if (openRowOptions.indexOf(id as never) === -1) {
|
|
31
31
|
changeOpenRowOptions([].concat(openRowOptions, id));
|
|
32
32
|
} else {
|
|
33
33
|
changeOpenRowOptions(openRowOptions.filter((option) => option !== id));
|
|
@@ -49,7 +49,7 @@ export const SectionTable = (props) => {
|
|
|
49
49
|
<BorderSelect
|
|
50
50
|
onChange={(e) => props.sortColumnHandler(e.target.value)}
|
|
51
51
|
value={props.sortedColumn}
|
|
52
|
-
options={[].concat(
|
|
52
|
+
options={([] as { name: string; value: string }[]).concat(
|
|
53
53
|
{ name: 'Choose Sorting Option', value: '' },
|
|
54
54
|
headers.map((item) => {
|
|
55
55
|
return { name: item, value: item };
|
|
@@ -102,7 +102,7 @@ export const SectionTable = (props) => {
|
|
|
102
102
|
)}
|
|
103
103
|
</tr>
|
|
104
104
|
))
|
|
105
|
-
: props.tableObjects.map((obj, i) => {
|
|
105
|
+
: props.tableObjects.map((obj: any, i: any) => {
|
|
106
106
|
let rowStyle = obj.rowStyleCondition;
|
|
107
107
|
|
|
108
108
|
if (rowStyle) {
|
|
@@ -149,7 +149,9 @@ export const SectionTable = (props) => {
|
|
|
149
149
|
name="chevron-down"
|
|
150
150
|
style={{
|
|
151
151
|
transform:
|
|
152
|
-
openRowOptions.indexOf(obj.id) !== -1
|
|
152
|
+
openRowOptions.indexOf(obj.id as never) !== -1
|
|
153
|
+
? 'rotate(180deg)'
|
|
154
|
+
: '',
|
|
153
155
|
}}
|
|
154
156
|
/>
|
|
155
157
|
</td>
|
|
@@ -171,7 +173,7 @@ export const SectionTable = (props) => {
|
|
|
171
173
|
</tr>
|
|
172
174
|
<tr
|
|
173
175
|
className={classNames('row-option', {
|
|
174
|
-
open: openRowOptions.indexOf(obj.id) !== -1,
|
|
176
|
+
open: openRowOptions.indexOf(obj.id as never) !== -1,
|
|
175
177
|
})}
|
|
176
178
|
>
|
|
177
179
|
<td className="inner-table-cell" colSpan={headers.length + 1}>
|
|
@@ -103,7 +103,7 @@ export const MultiCombobox = React.forwardRef((props: Props, ref: any) => {
|
|
|
103
103
|
isLoading={loading}
|
|
104
104
|
menuIsOpen={menuIsOpen}
|
|
105
105
|
noOptionsMessage={() => noOptionsMessage}
|
|
106
|
-
onChange={onChange}
|
|
106
|
+
onChange={onChange as any}
|
|
107
107
|
options={options}
|
|
108
108
|
placeholder={placeholder}
|
|
109
109
|
// validationErrors={validationErrors}
|
|
@@ -83,7 +83,7 @@ export const SingleCombobox = React.forwardRef((props: Props, ref: any) => {
|
|
|
83
83
|
isMulti={false}
|
|
84
84
|
menuIsOpen={menuIsOpen}
|
|
85
85
|
noOptionsMessage={() => noOptionsMessage}
|
|
86
|
-
onChange={onChange}
|
|
86
|
+
onChange={onChange as any}
|
|
87
87
|
options={options}
|
|
88
88
|
placeholder={placeholder}
|
|
89
89
|
// validationErrors={validationErrors}
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { DatePicker } from '@/components/inputs/DatePicker';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof DatePicker> = {
|
|
7
|
+
component: DatePicker,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
title: 'Inputs/DatePicker',
|
|
10
|
+
decorators: [(Story) => <Story />],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof DatePicker>;
|
|
16
|
+
|
|
17
|
+
const today = new Date();
|
|
18
|
+
|
|
19
|
+
export const Normal: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
id: 'date-picker',
|
|
22
|
+
label: 'Pick a date:',
|
|
23
|
+
placeholder: 'This Week',
|
|
24
|
+
value: today,
|
|
25
|
+
onChange: (date: Date | undefined) => {
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.log(date);
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|