@spaced-out/ui-design-system 0.4.14 → 0.4.15
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/.cspell/custom-words.txt +1 -0
- package/CHANGELOG.md +7 -0
- package/eslint.config.mjs +193 -0
- package/lib/components/Accordion/Accordion.js +4 -4
- package/lib/components/Accordion/Accordion.js.flow +5 -6
- package/lib/components/Accordion/AccordionGroup.js +9 -9
- package/lib/components/Accordion/AccordionGroup.js.flow +13 -11
- package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +1 -1
- package/lib/components/Charts/ColumnChart/ColumnChart.js.flow +1 -1
- package/lib/components/Charts/DonutChart/DonutChart.js.flow +1 -1
- package/lib/components/Charts/FunnelChart/FunnelChart.js.flow +1 -1
- package/lib/components/Charts/LineChart/LineChart.js.flow +1 -1
- package/lib/components/Charts/SpiderChart/SpiderChart.js.flow +1 -1
- package/lib/components/Dropdown/Dropdown.js.flow +1 -1
- package/lib/components/FileUpload/FileUpload.js.flow +1 -1
- package/lib/components/InlineDropdown/InlineDropdown.js.flow +1 -1
- package/lib/components/Table/Table.js +1 -1
- package/lib/components/Table/Table.js.flow +1 -1
- package/lib/components/Toggle/Toggle.js +2 -1
- package/lib/components/Toggle/Toggle.js.flow +2 -0
- package/lib/components/Tooltip/Tooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js.flow +1 -1
- package/lib/components/Typeahead/Typeahead.js.flow +1 -1
- package/lib/hooks/useLockedBody/useLockedBody.js +0 -1
- package/lib/hooks/useLockedBody/useLockedBody.js.flow +0 -1
- package/lib/hooks/usePagination/usePagination.js +2 -2
- package/lib/hooks/usePagination/usePagination.js.flow +2 -2
- package/package.json +13 -12
- package/.eslintignore +0 -2
- package/.eslintrc.yml +0 -122
package/.cspell/custom-words.txt
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.4.15](https://github.com/spaced-out/ui-design-system/compare/v0.4.14...v0.4.15) (2025-08-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* toggle checked control ([#389](https://github.com/spaced-out/ui-design-system/issues/389)) ([a56ea7c](https://github.com/spaced-out/ui-design-system/commit/a56ea7c7819cd0789c0909472499004fc2ce36e6))
|
|
11
|
+
|
|
5
12
|
### [0.4.14](https://github.com/spaced-out/ui-design-system/compare/v0.4.13...v0.4.14) (2025-08-11)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// ESLint 9 flat config for @spaced-out/ui-design-system
|
|
2
|
+
// Uses Babel parser to support Flow and JSX
|
|
3
|
+
// Install these dependencies with:
|
|
4
|
+
// yarn add -D @babel/eslint-parser eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-flowtype eslint-plugin-simple-import-sort eslint-plugin-unused-imports eslint-plugin-jest eslint-plugin-storybook globals
|
|
5
|
+
|
|
6
|
+
import babelParser from '@babel/eslint-parser';
|
|
7
|
+
import reactPlugin from 'eslint-plugin-react';
|
|
8
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
9
|
+
import importPlugin from 'eslint-plugin-import';
|
|
10
|
+
import ftFlowPlugin from 'eslint-plugin-ft-flow';
|
|
11
|
+
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
|
|
12
|
+
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
|
|
13
|
+
import jestPlugin from 'eslint-plugin-jest';
|
|
14
|
+
import storybookPlugin from 'eslint-plugin-storybook';
|
|
15
|
+
import globals from 'globals';
|
|
16
|
+
|
|
17
|
+
export default [
|
|
18
|
+
// Global ignores (replaces .eslintignore)
|
|
19
|
+
{
|
|
20
|
+
ignores: [
|
|
21
|
+
'node_modules/**',
|
|
22
|
+
'lib/**',
|
|
23
|
+
'dist/**',
|
|
24
|
+
'storybook-static/**',
|
|
25
|
+
'src/assets/fontawesome/**',
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
// Lint project source
|
|
30
|
+
{
|
|
31
|
+
files: ['src/**/*.{js,jsx}'],
|
|
32
|
+
languageOptions: {
|
|
33
|
+
parser: babelParser,
|
|
34
|
+
parserOptions: {
|
|
35
|
+
requireConfigFile: true,
|
|
36
|
+
ecmaVersion: 'latest',
|
|
37
|
+
sourceType: 'module',
|
|
38
|
+
ecmaFeatures: { jsx: true },
|
|
39
|
+
},
|
|
40
|
+
globals: {
|
|
41
|
+
...globals.browser,
|
|
42
|
+
...globals.node,
|
|
43
|
+
Iterator: 'readonly',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
settings: {
|
|
47
|
+
react: { version: 'detect' },
|
|
48
|
+
},
|
|
49
|
+
plugins: {
|
|
50
|
+
react: reactPlugin,
|
|
51
|
+
'react-hooks': reactHooksPlugin,
|
|
52
|
+
import: importPlugin,
|
|
53
|
+
'ft-flow': ftFlowPlugin,
|
|
54
|
+
'simple-import-sort': simpleImportSortPlugin,
|
|
55
|
+
'unused-imports': unusedImportsPlugin,
|
|
56
|
+
jest: jestPlugin,
|
|
57
|
+
storybook: storybookPlugin,
|
|
58
|
+
},
|
|
59
|
+
rules: {
|
|
60
|
+
// Core
|
|
61
|
+
'arrow-body-style': ['warn', 'as-needed'],
|
|
62
|
+
curly: ['warn', 'all'],
|
|
63
|
+
'comma-spacing': ['warn', { before: false, after: true }],
|
|
64
|
+
'eol-last': 'warn',
|
|
65
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
66
|
+
indent: ['error', 2],
|
|
67
|
+
'max-params': ['warn', { max: 4 }],
|
|
68
|
+
'no-alert': 'warn',
|
|
69
|
+
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
70
|
+
'no-const-assign': 'error',
|
|
71
|
+
'no-dupe-args': 'error',
|
|
72
|
+
'no-dupe-keys': 'error',
|
|
73
|
+
'no-duplicate-case': 'error',
|
|
74
|
+
'no-dupe-class-members': 'error',
|
|
75
|
+
'no-empty-function': 'warn',
|
|
76
|
+
'no-empty-pattern': 'error',
|
|
77
|
+
'no-eval': 'error',
|
|
78
|
+
'no-extend-native': 'error',
|
|
79
|
+
'no-extra-boolean-cast': 'error',
|
|
80
|
+
'no-fallthrough': 'error',
|
|
81
|
+
'no-floating-decimal': 'error',
|
|
82
|
+
'no-inner-declarations': 'error',
|
|
83
|
+
'no-loop-func': 'error',
|
|
84
|
+
'no-mixed-requires': 'off',
|
|
85
|
+
'no-nested-ternary': 'off',
|
|
86
|
+
'no-new-symbol': 'error',
|
|
87
|
+
'no-redeclare': 'error',
|
|
88
|
+
'no-restricted-globals': ['error', 'event', 'location'],
|
|
89
|
+
'no-sparse-arrays': 'error',
|
|
90
|
+
'no-tabs': 'warn',
|
|
91
|
+
'no-this-before-super': 'error',
|
|
92
|
+
'no-trailing-spaces': 'warn',
|
|
93
|
+
'no-underscore-dangle': 'off',
|
|
94
|
+
'no-unmodified-loop-condition': 'warn',
|
|
95
|
+
'no-undef': ['error', { typeof: true }],
|
|
96
|
+
'no-unreachable': 'warn',
|
|
97
|
+
'no-useless-constructor': 'error',
|
|
98
|
+
'no-var': 'error',
|
|
99
|
+
'no-with': 'error',
|
|
100
|
+
'object-shorthand': 'error',
|
|
101
|
+
'prefer-arrow-callback': 'error',
|
|
102
|
+
'prefer-const': 'warn',
|
|
103
|
+
'prefer-spread': 'warn',
|
|
104
|
+
quotes: ['warn', 'single', { allowTemplateLiterals: true }],
|
|
105
|
+
'require-yield': 'error',
|
|
106
|
+
'rest-spread-spacing': 'error',
|
|
107
|
+
strict: ['warn', 'never'],
|
|
108
|
+
|
|
109
|
+
// import
|
|
110
|
+
'import/newline-after-import': ['warn', { count: 2 }],
|
|
111
|
+
'import/no-duplicates': 'error',
|
|
112
|
+
|
|
113
|
+
// react
|
|
114
|
+
'react/jsx-no-undef': 'error',
|
|
115
|
+
'react/jsx-pascal-case': 'warn',
|
|
116
|
+
'react/jsx-uses-react': 'error',
|
|
117
|
+
'react/jsx-uses-vars': 'error',
|
|
118
|
+
'react/no-array-index-key': 'warn',
|
|
119
|
+
'react/no-deprecated': 'error',
|
|
120
|
+
'react/no-direct-mutation-state': 'error',
|
|
121
|
+
'react/no-string-refs': 'warn',
|
|
122
|
+
'react/prop-types': 'off',
|
|
123
|
+
'react/react-in-jsx-scope': 'error',
|
|
124
|
+
|
|
125
|
+
// flowtype
|
|
126
|
+
'ft-flow/define-flow-type': 'error',
|
|
127
|
+
'ft-flow/delimiter-dangle': ['warn', 'always-multiline'],
|
|
128
|
+
'ft-flow/no-existential-type': 'warn',
|
|
129
|
+
'ft-flow/no-weak-types': 'warn',
|
|
130
|
+
'ft-flow/semi': ['warn', 'always'],
|
|
131
|
+
|
|
132
|
+
// hooks //NOTE:(diwaker) temp disable for migration fix this later
|
|
133
|
+
'react-hooks/rules-of-hooks': 'warn',
|
|
134
|
+
|
|
135
|
+
// sorting
|
|
136
|
+
'simple-import-sort/imports': 'error',
|
|
137
|
+
'simple-import-sort/exports': 'error',
|
|
138
|
+
|
|
139
|
+
// unused
|
|
140
|
+
'unused-imports/no-unused-imports': 'error',
|
|
141
|
+
'unused-imports/no-unused-vars': [
|
|
142
|
+
'warn',
|
|
143
|
+
{
|
|
144
|
+
vars: 'all',
|
|
145
|
+
varsIgnorePattern: '^_',
|
|
146
|
+
args: 'after-used',
|
|
147
|
+
argsIgnorePattern: '^_',
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
// Tests
|
|
154
|
+
{
|
|
155
|
+
files: ['**/__tests__/*.{js,jsx}'],
|
|
156
|
+
languageOptions: {
|
|
157
|
+
globals: globals.jest,
|
|
158
|
+
},
|
|
159
|
+
plugins: {
|
|
160
|
+
jest: jestPlugin,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// Storybook specifics
|
|
165
|
+
{
|
|
166
|
+
files: ['**/*.stories.jsx'],
|
|
167
|
+
rules: {
|
|
168
|
+
semi: ['warn', 'always'],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
// Project import sort groups
|
|
173
|
+
{
|
|
174
|
+
files: ['*.{js,jsx}', '**/*.{js,jsx}'],
|
|
175
|
+
rules: {
|
|
176
|
+
'simple-import-sort/imports': [
|
|
177
|
+
'error',
|
|
178
|
+
{
|
|
179
|
+
groups: [
|
|
180
|
+
['^react', '^@?\\w'],
|
|
181
|
+
['^(@|components)(/.*|$)'],
|
|
182
|
+
['^\\u0000'],
|
|
183
|
+
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
|
184
|
+
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
|
185
|
+
['^.+\\.?(css)$'],
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
|
|
@@ -21,13 +21,12 @@ const Accordion = exports.Accordion = /*#__PURE__*/React.forwardRef((_ref, ref)
|
|
|
21
21
|
classNames,
|
|
22
22
|
isOpen = false,
|
|
23
23
|
showToggle = false,
|
|
24
|
+
checked = false,
|
|
24
25
|
children
|
|
25
26
|
} = _ref;
|
|
26
27
|
const [accordionIsOpen, setAccordionIsOpen] = React.useState(isOpen);
|
|
27
|
-
const [checked, setChecked] = React.useState(false);
|
|
28
28
|
const handleToggle = () => {
|
|
29
|
-
|
|
30
|
-
onToggle?.(id, !checked);
|
|
29
|
+
onToggle?.(!checked);
|
|
31
30
|
};
|
|
32
31
|
const handleAccordionClick = () => {
|
|
33
32
|
if (!disabled) {
|
|
@@ -54,7 +53,8 @@ const Accordion = exports.Accordion = /*#__PURE__*/React.forwardRef((_ref, ref)
|
|
|
54
53
|
}, /*#__PURE__*/React.createElement(_Toggle.Toggle, {
|
|
55
54
|
checked: checked,
|
|
56
55
|
onChange: handleToggle,
|
|
57
|
-
ariaLabel: 'toggle'
|
|
56
|
+
ariaLabel: 'toggle',
|
|
57
|
+
disabled: disabled
|
|
58
58
|
})), header), /*#__PURE__*/React.createElement(_Button.Button, {
|
|
59
59
|
iconLeftName: accordionIsOpen ? 'chevron-up' : 'chevron-down',
|
|
60
60
|
disabled: disabled,
|
|
@@ -25,7 +25,8 @@ export type AccordionPropsType = {
|
|
|
25
25
|
disabled?: boolean,
|
|
26
26
|
showToggle?: boolean,
|
|
27
27
|
onChange?: ?(id?: string, isOpen: boolean) => mixed,
|
|
28
|
-
|
|
28
|
+
checked?: boolean,
|
|
29
|
+
onToggle?: (checked: boolean) => mixed,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export const Accordion: React$AbstractComponent<
|
|
@@ -42,17 +43,14 @@ export const Accordion: React$AbstractComponent<
|
|
|
42
43
|
classNames,
|
|
43
44
|
isOpen = false,
|
|
44
45
|
showToggle = false,
|
|
46
|
+
checked = false,
|
|
45
47
|
children,
|
|
46
48
|
}: AccordionPropsType,
|
|
47
49
|
ref,
|
|
48
50
|
) => {
|
|
49
51
|
const [accordionIsOpen, setAccordionIsOpen] = React.useState(isOpen);
|
|
50
|
-
|
|
51
|
-
const [checked, setChecked] = React.useState<boolean>(false);
|
|
52
|
-
|
|
53
52
|
const handleToggle = () => {
|
|
54
|
-
|
|
55
|
-
onToggle?.(id, !checked);
|
|
53
|
+
onToggle?.(!checked);
|
|
56
54
|
};
|
|
57
55
|
|
|
58
56
|
const handleAccordionClick = () => {
|
|
@@ -87,6 +85,7 @@ export const Accordion: React$AbstractComponent<
|
|
|
87
85
|
checked={checked}
|
|
88
86
|
onChange={handleToggle}
|
|
89
87
|
ariaLabel={'toggle'}
|
|
88
|
+
disabled={disabled}
|
|
90
89
|
/>
|
|
91
90
|
</div>
|
|
92
91
|
)}
|
|
@@ -14,18 +14,15 @@ const AccordionGroup = _ref => {
|
|
|
14
14
|
children,
|
|
15
15
|
onAccordionClick,
|
|
16
16
|
onToggle,
|
|
17
|
-
enabledToggleIds = [],
|
|
18
17
|
initialOpenId = '',
|
|
19
18
|
classNames
|
|
20
19
|
} = _ref;
|
|
21
20
|
const [openId, setOpenedId] = React.useState(initialOpenId);
|
|
22
|
-
const [checks, setChecks] = React.useState(enabledToggleIds);
|
|
23
21
|
const handleAccordionChange = (id, isOpen) => {
|
|
24
22
|
setOpenedId(isOpen ? id : '');
|
|
25
23
|
onAccordionClick?.(id, isOpen);
|
|
26
24
|
};
|
|
27
25
|
const handleToggle = (id, checked) => {
|
|
28
|
-
setChecks(prev => checked ? [...prev, id] : prev.filter(x => x !== id));
|
|
29
26
|
setOpenedId(prev => checked ? id : prev === id ? '' : prev);
|
|
30
27
|
onToggle?.(id, checked);
|
|
31
28
|
};
|
|
@@ -34,18 +31,21 @@ const AccordionGroup = _ref => {
|
|
|
34
31
|
return null;
|
|
35
32
|
}
|
|
36
33
|
const childId = child.props.id;
|
|
37
|
-
const isDisabled = !checks.includes(childId);
|
|
38
34
|
const isOpen = openId === childId;
|
|
35
|
+
const accordionOnToggle = checked => {
|
|
36
|
+
handleToggle(childId, checked); // parents onToggle, pass id as well.
|
|
37
|
+
child.props.onToggle?.(checked);
|
|
38
|
+
};
|
|
39
39
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
40
40
|
classNames: {
|
|
41
|
-
|
|
42
|
-
wrapper: _AccordionGroupModule.default.accordionWrapper
|
|
41
|
+
...child.props.classNames,
|
|
42
|
+
wrapper: (0, _classify.default)(_AccordionGroupModule.default.accordionWrapper, child.props.classNames?.wrapper)
|
|
43
43
|
},
|
|
44
44
|
onChange: handleAccordionChange,
|
|
45
|
-
onToggle:
|
|
45
|
+
onToggle: accordionOnToggle,
|
|
46
46
|
showToggle: true,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
isOpen,
|
|
48
|
+
key: childId
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -24,20 +24,16 @@ export const AccordionGroup = ({
|
|
|
24
24
|
children,
|
|
25
25
|
onAccordionClick,
|
|
26
26
|
onToggle,
|
|
27
|
-
enabledToggleIds = [],
|
|
28
27
|
initialOpenId = '',
|
|
29
28
|
classNames,
|
|
30
29
|
}: AccordionGroupPropsType): React.Node => {
|
|
31
30
|
const [openId, setOpenedId] = React.useState(initialOpenId);
|
|
32
|
-
|
|
31
|
+
|
|
33
32
|
const handleAccordionChange = (id, isOpen) => {
|
|
34
33
|
setOpenedId(isOpen ? id : '');
|
|
35
34
|
onAccordionClick?.(id, isOpen);
|
|
36
35
|
};
|
|
37
36
|
const handleToggle = (id, checked) => {
|
|
38
|
-
setChecks((prev) =>
|
|
39
|
-
checked ? [...prev, id] : prev.filter((x) => x !== id),
|
|
40
|
-
);
|
|
41
37
|
setOpenedId((prev) => (checked ? id : prev === id ? '' : prev));
|
|
42
38
|
onToggle?.(id, checked);
|
|
43
39
|
};
|
|
@@ -48,20 +44,26 @@ export const AccordionGroup = ({
|
|
|
48
44
|
|
|
49
45
|
const childId = child.props.id;
|
|
50
46
|
|
|
51
|
-
const isDisabled = !checks.includes(childId);
|
|
52
|
-
|
|
53
47
|
const isOpen = openId === childId;
|
|
54
48
|
|
|
49
|
+
const accordionOnToggle = (checked) => {
|
|
50
|
+
handleToggle(childId, checked); // parents onToggle, pass id as well.
|
|
51
|
+
child.props.onToggle?.(checked);
|
|
52
|
+
};
|
|
53
|
+
|
|
55
54
|
return React.cloneElement(child, {
|
|
56
55
|
classNames: {
|
|
57
|
-
|
|
58
|
-
wrapper:
|
|
56
|
+
...child.props.classNames,
|
|
57
|
+
wrapper: classify(
|
|
58
|
+
css.accordionWrapper,
|
|
59
|
+
child.props.classNames?.wrapper,
|
|
60
|
+
),
|
|
59
61
|
},
|
|
60
62
|
onChange: handleAccordionChange,
|
|
61
|
-
onToggle:
|
|
63
|
+
onToggle: accordionOnToggle,
|
|
62
64
|
showToggle: true,
|
|
63
|
-
disabled: isDisabled,
|
|
64
65
|
isOpen,
|
|
66
|
+
key: childId,
|
|
65
67
|
});
|
|
66
68
|
});
|
|
67
69
|
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {useReferenceElementWidth} from '../../hooks';
|
|
22
22
|
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
23
23
|
import {classify} from '../../utils/classify';
|
|
24
|
-
import {type ClickAwayRefType
|
|
24
|
+
import {ClickAway, type ClickAwayRefType} from '../../utils/click-away';
|
|
25
25
|
import {mergeRefs} from '../../utils/merge-refs';
|
|
26
26
|
import type {ButtonProps} from '../Button';
|
|
27
27
|
import {Button} from '../Button';
|
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
} from '../../../utils/charts';
|
|
20
20
|
import classify from '../../../utils/classify';
|
|
21
21
|
import {
|
|
22
|
+
ChartWrapper,
|
|
22
23
|
type ChartWrapperClassNames,
|
|
23
24
|
type ExportOptionType,
|
|
24
|
-
ChartWrapper,
|
|
25
25
|
} from '../ChartWrapper';
|
|
26
26
|
|
|
27
27
|
import css from './ColumnChart.module.css';
|
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
} from '../../../utils/charts';
|
|
20
20
|
import classify from '../../../utils/classify';
|
|
21
21
|
import {
|
|
22
|
+
ChartWrapper,
|
|
22
23
|
type ChartWrapperClassNames,
|
|
23
24
|
type ExportOptionType,
|
|
24
|
-
ChartWrapper,
|
|
25
25
|
} from '../ChartWrapper';
|
|
26
26
|
|
|
27
27
|
import typographyCss from '../../../styles/typography.module.css';
|
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
} from '../../../utils/charts/funnelChart';
|
|
22
22
|
import classify from '../../../utils/classify';
|
|
23
23
|
import {
|
|
24
|
+
ChartWrapper,
|
|
24
25
|
type ChartWrapperClassNames,
|
|
25
26
|
type ExportOptionType,
|
|
26
|
-
ChartWrapper,
|
|
27
27
|
} from '../ChartWrapper';
|
|
28
28
|
|
|
29
29
|
import css from './FunnelChart.module.css';
|
|
@@ -18,9 +18,9 @@ import {
|
|
|
18
18
|
} from '../../../utils/charts';
|
|
19
19
|
import classify from '../../../utils/classify';
|
|
20
20
|
import {
|
|
21
|
+
ChartWrapper,
|
|
21
22
|
type ChartWrapperClassNames,
|
|
22
23
|
type ExportOptionType,
|
|
23
|
-
ChartWrapper,
|
|
24
24
|
} from '../ChartWrapper';
|
|
25
25
|
|
|
26
26
|
import css from './LineChart.module.css';
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
} from '../../../utils/charts';
|
|
17
17
|
import classify from '../../../utils/classify';
|
|
18
18
|
import {
|
|
19
|
+
ChartWrapper,
|
|
19
20
|
type ChartWrapperClassNames,
|
|
20
21
|
type ExportOptionType,
|
|
21
|
-
ChartWrapper,
|
|
22
22
|
} from '../ChartWrapper';
|
|
23
23
|
|
|
24
24
|
import css from './SpiderChart.module.css';
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {useReferenceElementWidth} from '../../hooks';
|
|
20
20
|
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
21
21
|
import {classify} from '../../utils/classify';
|
|
22
|
-
import {type ClickAwayRefType
|
|
22
|
+
import {ClickAway, type ClickAwayRefType} from '../../utils/click-away';
|
|
23
23
|
import {mergeRefs} from '../../utils/merge-refs';
|
|
24
24
|
import type {InputProps} from '../Input';
|
|
25
25
|
import {Input} from '../Input';
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
// $FlowFixMe[untyped-import] -- this should be fixed soon
|
|
5
5
|
import {
|
|
6
|
-
type UseFileUploadReturnProps,
|
|
7
6
|
useFileUpload,
|
|
7
|
+
type UseFileUploadReturnProps,
|
|
8
8
|
} from '../../hooks/useFileUpload';
|
|
9
9
|
import classify from '../../utils/classify';
|
|
10
10
|
import {UnstyledButton} from '../Button';
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {useReferenceElementWidth} from '../../hooks';
|
|
22
22
|
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
23
23
|
import {classify} from '../../utils/classify';
|
|
24
|
-
import {type ClickAwayRefType
|
|
24
|
+
import {ClickAway, type ClickAwayRefType} from '../../utils/click-away';
|
|
25
25
|
import {mergeRefs} from '../../utils/merge-refs';
|
|
26
26
|
import type {UnstyledButtonProps} from '../Button';
|
|
27
27
|
import {UnstyledButton} from '../Button';
|
|
@@ -118,7 +118,7 @@ export function Table<Data: GenericObject, Extras: GenericObject>(
|
|
|
118
118
|
/**
|
|
119
119
|
*
|
|
120
120
|
*/
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
const {sortedEntries, sortedKeys, ...sortableProps} = useSortableEntries(
|
|
123
123
|
entries,
|
|
124
124
|
idName,
|
|
@@ -75,4 +75,5 @@ const Toggle = exports.Toggle = /*#__PURE__*/React.forwardRef((_ref, forwardRef)
|
|
|
75
75
|
})), labelPosition === 'right' && React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
76
76
|
className: (0, _classify.default)(_ToggleModule.default.toggleLabel, classNames?.label)
|
|
77
77
|
}, children));
|
|
78
|
-
});
|
|
78
|
+
});
|
|
79
|
+
Toggle.name = Toggle.displayName = 'Toggle';
|
|
@@ -16,7 +16,7 @@ var _TooltipModule = _interopRequireDefault(require("./Tooltip.module.css"));
|
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
18
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
|
-
/* eslint-disable
|
|
19
|
+
/* eslint-disable ft-flow/no-weak-types */
|
|
20
20
|
|
|
21
21
|
const DELAY_MOTION_DURATION_TYPES = exports.DELAY_MOTION_DURATION_TYPES = Object.freeze({
|
|
22
22
|
none: 'none',
|
|
@@ -37,7 +37,7 @@ import {Truncate} from '../Truncate';
|
|
|
37
37
|
|
|
38
38
|
import css from './Tooltip.module.css';
|
|
39
39
|
|
|
40
|
-
/* eslint-disable
|
|
40
|
+
/* eslint-disable ft-flow/no-weak-types */
|
|
41
41
|
type ClassNames = $ReadOnly<{tooltip?: string, title?: string, body?: string}>;
|
|
42
42
|
|
|
43
43
|
export const DELAY_MOTION_DURATION_TYPES = Object.freeze({
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {useReferenceElementWidth} from '../../hooks';
|
|
20
20
|
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
21
21
|
import {classify} from '../../utils/classify';
|
|
22
|
-
import {type ClickAwayRefType
|
|
22
|
+
import {ClickAway, type ClickAwayRefType} from '../../utils/click-away';
|
|
23
23
|
import {mergeRefs} from '../../utils/merge-refs';
|
|
24
24
|
import type {InputProps} from '../Input';
|
|
25
25
|
import type {MenuOption, MenuProps} from '../Menu';
|
|
@@ -48,12 +48,12 @@ const usePagination = props => {
|
|
|
48
48
|
if (style === 'primary') {
|
|
49
49
|
itemList = [...(showFirstButton ? ['first'] : []), ...(hidePrevButton ? [] : ['previous']), ...startPages,
|
|
50
50
|
// Start ellipsis
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
...(siblingsStart > boundaryCount + 2 ? ['start-ellipsis'] : boundaryCount + 1 < totalPages - boundaryCount ? [boundaryCount + 1] : []),
|
|
53
53
|
// Sibling pages
|
|
54
54
|
...(0, _helpers.range)(siblingsStart, siblingsEnd),
|
|
55
55
|
// End ellipsis
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
...(siblingsEnd < totalPages - boundaryCount - 1 ? ['end-ellipsis'] : totalPages - boundaryCount > boundaryCount ? [totalPages - boundaryCount] : []), ...endPages, ...(hideNextButton ? [] : ['next']), ...(showLastButton ? ['last'] : [])];
|
|
58
58
|
} else if (style === 'secondary') {
|
|
59
59
|
itemList = [...(showFirstButton ? ['first'] : []), ...(hidePrevButton ? [] : ['previous']), ...(hideNextButton ? [] : ['next']), ...(showLastButton ? ['last'] : [])];
|
|
@@ -72,7 +72,7 @@ export const usePagination = (
|
|
|
72
72
|
...startPages,
|
|
73
73
|
|
|
74
74
|
// Start ellipsis
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
...(siblingsStart > boundaryCount + 2
|
|
77
77
|
? ['start-ellipsis']
|
|
78
78
|
: boundaryCount + 1 < totalPages - boundaryCount
|
|
@@ -83,7 +83,7 @@ export const usePagination = (
|
|
|
83
83
|
...range(siblingsStart, siblingsEnd),
|
|
84
84
|
|
|
85
85
|
// End ellipsis
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
...(siblingsEnd < totalPages - boundaryCount - 1
|
|
88
88
|
? ['end-ellipsis']
|
|
89
89
|
: totalPages - boundaryCount > boundaryCount
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spaced-out/ui-design-system",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Sense UI components library",
|
|
6
6
|
"author": {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/cli": "^7.18.10",
|
|
60
60
|
"@babel/core": "^7.18.13",
|
|
61
|
-
"@babel/eslint-parser": "^7.
|
|
62
|
-
"@babel/eslint-plugin": "^7.
|
|
61
|
+
"@babel/eslint-parser": "^7.28.0",
|
|
62
|
+
"@babel/eslint-plugin": "^7.25.9",
|
|
63
63
|
"@babel/preset-env": "^7.18.10",
|
|
64
64
|
"@babel/preset-flow": "^7.18.6",
|
|
65
65
|
"@babel/preset-react": "^7.18.6",
|
|
@@ -80,16 +80,17 @@
|
|
|
80
80
|
"chalk": "^5.0.1",
|
|
81
81
|
"chromatic": "^6.11.4",
|
|
82
82
|
"cspell": "^9.1.2",
|
|
83
|
-
"eslint": "^
|
|
84
|
-
"eslint-plugin-
|
|
85
|
-
"eslint-plugin-import": "^2.
|
|
86
|
-
"eslint-plugin-jest": "^
|
|
87
|
-
"eslint-plugin-react": "^7.
|
|
88
|
-
"eslint-plugin-react-hooks": "^
|
|
89
|
-
"eslint-plugin-simple-import-sort": "^
|
|
90
|
-
"eslint-plugin-storybook": "^9.
|
|
91
|
-
"eslint-plugin-unused-imports": "^
|
|
83
|
+
"eslint": "^9.9.0",
|
|
84
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
85
|
+
"eslint-plugin-import": "^2.32.0",
|
|
86
|
+
"eslint-plugin-jest": "^29.0.1",
|
|
87
|
+
"eslint-plugin-react": "^7.37.5",
|
|
88
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
89
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
90
|
+
"eslint-plugin-storybook": "^9.1.2",
|
|
91
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
92
92
|
"flow-bin": "^0.184.0",
|
|
93
|
+
"globals": "^16.3.0",
|
|
93
94
|
"gulp": "^4.0.2",
|
|
94
95
|
"gulp-babel": "^8.0.0",
|
|
95
96
|
"gulp-rename": "^2.0.0",
|
package/.eslintignore
DELETED
package/.eslintrc.yml
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
'root': true,
|
|
3
|
-
'env': {'browser': true, 'node': true, 'es2020': true},
|
|
4
|
-
'parser': '@babel/eslint-parser',
|
|
5
|
-
'plugins':
|
|
6
|
-
['flowtype', '@babel', 'react', 'import', 'unused-imports', 'react-hooks','simple-import-sort'],
|
|
7
|
-
'settings': {'react': {'version': 'detect'}},
|
|
8
|
-
'globals': {'Iterator': 'readonly'},
|
|
9
|
-
'rules':
|
|
10
|
-
{
|
|
11
|
-
'arrow-body-style': ['warn', 'as-needed'],
|
|
12
|
-
'curly': ['warn', 'all'],
|
|
13
|
-
comma-spacing: ["warn", { "before": false, "after": true }],
|
|
14
|
-
'eol-last': 'warn',
|
|
15
|
-
'eqeqeq': ['error', 'always', {'null': 'ignore'}],
|
|
16
|
-
indent: ["error", 2],
|
|
17
|
-
'max-params': ['warn', {'max': 4}],
|
|
18
|
-
'no-alert': 'warn',
|
|
19
|
-
'no-console': ['error', {allow: ['warn', 'error']}],
|
|
20
|
-
|
|
21
|
-
'no-const-assign': 'error',
|
|
22
|
-
'no-dupe-args': 'error',
|
|
23
|
-
'no-dupe-keys': 'error',
|
|
24
|
-
'no-duplicate-case': 'error',
|
|
25
|
-
'no-dupe-class-members': 'error',
|
|
26
|
-
'no-empty-function': 'warn',
|
|
27
|
-
'no-empty-pattern': 'error',
|
|
28
|
-
'no-eval': 'error',
|
|
29
|
-
'no-extend-native': 'error',
|
|
30
|
-
'no-extra-boolean-cast': 'error',
|
|
31
|
-
'no-fallthrough': 'error',
|
|
32
|
-
'no-floating-decimal': 'error',
|
|
33
|
-
'no-inner-declarations': 'error',
|
|
34
|
-
'no-loop-func': 'error',
|
|
35
|
-
'no-mixed-requires': 'off',
|
|
36
|
-
'no-nested-ternary': 'off',
|
|
37
|
-
'no-new-symbol': 'error',
|
|
38
|
-
'no-redeclare': 'error',
|
|
39
|
-
'no-restricted-globals': ['error', 'event', 'location'],
|
|
40
|
-
'no-sparse-arrays': 'error',
|
|
41
|
-
'no-tabs': 'warn',
|
|
42
|
-
'no-this-before-super': 'error',
|
|
43
|
-
'no-trailing-spaces': 'warn',
|
|
44
|
-
'no-underscore-dangle': 'off',
|
|
45
|
-
'no-unmodified-loop-condition': 'warn',
|
|
46
|
-
'no-undef': ['error', {'typeof': true}],
|
|
47
|
-
'no-unreachable': 'warn',
|
|
48
|
-
'unused-imports/no-unused-imports': 'error',
|
|
49
|
-
'unused-imports/no-unused-vars':
|
|
50
|
-
[
|
|
51
|
-
'warn',
|
|
52
|
-
{
|
|
53
|
-
'vars': 'all',
|
|
54
|
-
'varsIgnorePattern': '^_',
|
|
55
|
-
'args': 'after-used',
|
|
56
|
-
'argsIgnorePattern': '^_',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
'no-useless-constructor': 'error',
|
|
60
|
-
'no-var': 'error',
|
|
61
|
-
'no-with': 'error',
|
|
62
|
-
'object-shorthand': 'error',
|
|
63
|
-
'prefer-arrow-callback': 'error',
|
|
64
|
-
'prefer-const': 'warn',
|
|
65
|
-
'prefer-spread': 'warn',
|
|
66
|
-
'quotes': ['warn', 'single', {'allowTemplateLiterals': true}],
|
|
67
|
-
'require-yield': 'error',
|
|
68
|
-
'rest-spread-spacing': 'error',
|
|
69
|
-
'strict': ['warn', 'never'],
|
|
70
|
-
|
|
71
|
-
'import/newline-after-import': ['warn', {'count': 2}],
|
|
72
|
-
'import/no-duplicates': 'error',
|
|
73
|
-
|
|
74
|
-
'react/jsx-no-undef': 'error',
|
|
75
|
-
'react/jsx-pascal-case': 'warn',
|
|
76
|
-
'react/jsx-uses-react': 'error',
|
|
77
|
-
'react/jsx-uses-vars': 'error',
|
|
78
|
-
'react/no-array-index-key': 'warn',
|
|
79
|
-
'react/no-deprecated': 'error',
|
|
80
|
-
'react/no-direct-mutation-state': 'error',
|
|
81
|
-
'react/no-string-refs': 'warn',
|
|
82
|
-
'react/prop-types': 'off',
|
|
83
|
-
'react/react-in-jsx-scope': 'error',
|
|
84
|
-
|
|
85
|
-
'flowtype/define-flow-type': 'error',
|
|
86
|
-
'flowtype/delimiter-dangle': ['warn', 'always-multiline'],
|
|
87
|
-
'flowtype/no-existential-type': 'warn',
|
|
88
|
-
'flowtype/no-weak-types': 'warn',
|
|
89
|
-
'flowtype/semi': ['warn', 'always'],
|
|
90
|
-
|
|
91
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
92
|
-
"simple-import-sort/imports": "error",
|
|
93
|
-
"simple-import-sort/exports": "error"
|
|
94
|
-
},
|
|
95
|
-
'overrides':
|
|
96
|
-
[
|
|
97
|
-
{
|
|
98
|
-
'files': ['**/__tests__/*.js', '**/__tests__/*.jsx'],
|
|
99
|
-
'env': {'jest': true},
|
|
100
|
-
'plugins': ['jest'],
|
|
101
|
-
},
|
|
102
|
-
{'files': ['**/*.stories.jsx'], 'rules': {'semi': ['warn', 'always']}},
|
|
103
|
-
{
|
|
104
|
-
"files": ["*.js", "*.jsx", "*.ts", "*.tsx"],
|
|
105
|
-
"rules": {
|
|
106
|
-
"simple-import-sort/imports": [
|
|
107
|
-
"error",
|
|
108
|
-
{
|
|
109
|
-
"groups": [
|
|
110
|
-
["^react", "^@?\\w"],
|
|
111
|
-
["^(@|components)(/.*|$)"],
|
|
112
|
-
["^\\u0000"],
|
|
113
|
-
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
114
|
-
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
|
115
|
-
["^.+\\.?(css)$"]
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
}
|