@hyphen/hyphen-components 7.6.1 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/css/fonts.css +3 -3
- package/dist/css/index.css +108 -108
- package/dist/css/reset.css +3 -3
- package/dist/css/utilities.css +7 -7
- package/dist/css/variables.css +11 -11
- package/dist/hyphen-components.cjs.development.js +358 -359
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +3 -4
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/package.json +36 -26
- package/src/components/Calendar/Calendar.stories.tsx +1 -1
- package/src/components/Calendar/Calendar.test.tsx +7 -1
- package/src/components/Calendar/Calendar.tsx +5 -6
- package/src/components/SelectInput/SelectInput.tsx +1 -1
- package/src/components/Table/Table.stories.tsx +16 -28
- package/src/docs/GetStarted.mdx +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,13 +4,12 @@ import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
|
|
|
4
4
|
import { BorderRadiusSize as BorderRadiusSize$1, BreakpointSize, SpacingSize, WidthSize, HeightSize, BackgroundColor, BorderColor, BorderSize, FontColor, FontFamily, FontSize, FontWeight, BoxShadowSize, TextTransform, TextWrap, ZIndexSize, IconName, HeadingSize, ColorName, BaseColor, LineHeightSize } from '@hyphen/hyphen-design-tokens/build/types';
|
|
5
5
|
export { BackgroundColor, BaseColor, BorderColor, BorderSize, BoxShadowSize, BreakpointSize, ColorName, FontColor, FontFamily, FontSize, FontWeight, HeadingSize, HeightSize, IconName, LineHeightSize, SpacingSize, TextDecorationLine, TextDecorationStyle, TextTransform, TextWrap, WhiteSpace, WidthSize, WordBreak, ZIndexSize } from '@hyphen/hyphen-design-tokens/build/types';
|
|
6
6
|
import * as CSS from 'csstype';
|
|
7
|
-
import { DayPickerProps } from 'react
|
|
8
|
-
export { Matcher } from 'react
|
|
7
|
+
import { DayPickerProps } from '@daypicker/react';
|
|
8
|
+
export { Matcher } from '@daypicker/react';
|
|
9
9
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
10
10
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
11
11
|
import { FieldAttributes, FormikTouched, FormikValues, FormikErrors } from 'formik';
|
|
12
|
-
import { OnChangeValue, OptionsOrGroups } from 'react-select';
|
|
13
|
-
import { GroupBase } from 'react-select/dist/declarations/src/types';
|
|
12
|
+
import { OnChangeValue, OptionsOrGroups, GroupBase } from 'react-select';
|
|
14
13
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
15
14
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
16
15
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyphen/hyphen-components",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
|
+
"packageManager": "pnpm@10.20.0",
|
|
4
5
|
"license": "MIT",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "@hyphen"
|
|
@@ -30,8 +31,8 @@
|
|
|
30
31
|
"test": "jest --passWithNoTests",
|
|
31
32
|
"test-watch": "jest --coverage --watch",
|
|
32
33
|
"semantic-release": "semantic-release",
|
|
33
|
-
"prepare": "
|
|
34
|
-
"chromatic": "
|
|
34
|
+
"prepare": "pnpm run build",
|
|
35
|
+
"chromatic": "chromatic --project-token=chpt_8fddffb5556f0b7 --only-changed"
|
|
35
36
|
},
|
|
36
37
|
"husky": {
|
|
37
38
|
"hooks": {
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"react": ">=16"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
51
|
-
"node": ">=20"
|
|
52
|
+
"node": ">=20.19.0 <21 || >=22.12.0"
|
|
52
53
|
},
|
|
53
54
|
"size-limit": [
|
|
54
55
|
{
|
|
@@ -61,38 +62,39 @@
|
|
|
61
62
|
}
|
|
62
63
|
],
|
|
63
64
|
"dependencies": {
|
|
65
|
+
"@daypicker/react": "^10.0.1",
|
|
64
66
|
"@emotion/react": "^11.14.0",
|
|
65
|
-
"@hyphen/hyphen-design-tokens": "^7.
|
|
66
|
-
"@radix-ui/react-aspect-ratio": "^1.1.
|
|
67
|
-
"@radix-ui/react-collapsible": "^1.1.
|
|
68
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
69
|
-
"@radix-ui/react-popover": "^1.1.
|
|
70
|
-
"@radix-ui/react-slot": "^1.2.
|
|
71
|
-
"@radix-ui/react-toggle": "^1.1.
|
|
72
|
-
"@radix-ui/react-toggle-group": "^1.1.
|
|
73
|
-
"@radix-ui/react-tooltip": "^1.2.
|
|
67
|
+
"@hyphen/hyphen-design-tokens": "^7.7.0",
|
|
68
|
+
"@radix-ui/react-aspect-ratio": "^1.1.9",
|
|
69
|
+
"@radix-ui/react-collapsible": "^1.1.13",
|
|
70
|
+
"@radix-ui/react-dropdown-menu": "^2.1.17",
|
|
71
|
+
"@radix-ui/react-popover": "^1.1.16",
|
|
72
|
+
"@radix-ui/react-slot": "^1.2.5",
|
|
73
|
+
"@radix-ui/react-toggle": "^1.1.11",
|
|
74
|
+
"@radix-ui/react-toggle-group": "^1.1.12",
|
|
75
|
+
"@radix-ui/react-tooltip": "^1.2.9",
|
|
74
76
|
"@types/react-modal": "^3.16.3",
|
|
75
77
|
"classnames": "^2.5.1",
|
|
76
78
|
"date-fns": "^4.1.0",
|
|
77
|
-
"formik": "^2.4.
|
|
78
|
-
"react-day-picker": "^9.11.3",
|
|
79
|
+
"formik": "^2.4.9",
|
|
79
80
|
"react-focus-lock": "^2.13.2",
|
|
80
81
|
"react-modal": "^3.16.3",
|
|
81
|
-
"react-remove-scroll": "^2.
|
|
82
|
-
"react-router-dom": "^6.
|
|
82
|
+
"react-remove-scroll": "^2.7.2",
|
|
83
|
+
"react-router-dom": "^6.30.4",
|
|
83
84
|
"react-select": "^5.10.0",
|
|
84
85
|
"react-select-event": "^5.5.1",
|
|
85
|
-
"uuid": "^11.1.
|
|
86
|
+
"uuid": "^11.1.1"
|
|
86
87
|
},
|
|
87
88
|
"devDependencies": {
|
|
88
89
|
"@babel/core": "^7.27.4",
|
|
89
|
-
"@chromatic-com/storybook": "^
|
|
90
|
+
"@chromatic-com/storybook": "^5.2.1",
|
|
90
91
|
"@semantic-release/commit-analyzer": "^11.1.0",
|
|
91
92
|
"@size-limit/preset-small-lib": "^11.2.0",
|
|
92
|
-
"@storybook/addon-a11y": "
|
|
93
|
-
"@storybook/addon-docs": "
|
|
94
|
-
"@storybook/addon-themes": "
|
|
95
|
-
"@storybook/
|
|
93
|
+
"@storybook/addon-a11y": "10.4.2",
|
|
94
|
+
"@storybook/addon-docs": "10.4.2",
|
|
95
|
+
"@storybook/addon-themes": "10.4.2",
|
|
96
|
+
"@storybook/addon-vitest": "10.4.2",
|
|
97
|
+
"@storybook/react-vite": "10.4.2",
|
|
96
98
|
"@testing-library/jest-dom": "^6.6.3",
|
|
97
99
|
"@testing-library/react": "^16.2.0",
|
|
98
100
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -105,24 +107,31 @@
|
|
|
105
107
|
"@types/react-modal": "^3.16.3",
|
|
106
108
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
107
109
|
"@typescript-eslint/parser": "^8.0.0",
|
|
110
|
+
"@vitest/browser-playwright": "^4.1.8",
|
|
111
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
108
112
|
"autoprefixer": "^10.4.20",
|
|
109
113
|
"babel-loader": "^9.1.3",
|
|
110
|
-
"chromatic": "^13.3.
|
|
114
|
+
"chromatic": "^13.3.5",
|
|
111
115
|
"clean-webpack-plugin": "^4.0.0",
|
|
112
116
|
"cross-env": "^7.0.3",
|
|
113
117
|
"css-loader": "^6.11.0",
|
|
114
118
|
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
115
119
|
"cssnano": "^6.1.2",
|
|
116
120
|
"csstype": "^3.1.3",
|
|
121
|
+
"eslint": "^8.57.0",
|
|
117
122
|
"eslint-config-prettier": "^9.0.0",
|
|
118
123
|
"eslint-plugin-import": "^2.32.0",
|
|
119
124
|
"eslint-plugin-react": "^7.34.0",
|
|
120
125
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
126
|
+
"eslint-plugin-storybook": "10.4.2",
|
|
121
127
|
"husky": "^8.0.3",
|
|
122
128
|
"identity-obj-proxy": "^3.0.0",
|
|
129
|
+
"jest": "^29.7.0",
|
|
123
130
|
"jest-environment-jsdom": "^30.2.0",
|
|
124
131
|
"jest-preview": "^0.3.1",
|
|
125
132
|
"mini-css-extract-plugin": "^2.9.1",
|
|
133
|
+
"playwright": "^1.60.0",
|
|
134
|
+
"postcss": "^8.4.47",
|
|
126
135
|
"postcss-loader": "^7.3.4",
|
|
127
136
|
"postcss-modules": "^6.0.0",
|
|
128
137
|
"react": "^18.3.1",
|
|
@@ -132,13 +141,14 @@
|
|
|
132
141
|
"sass-loader": "^13.3.3",
|
|
133
142
|
"semantic-release": "^25.0.2",
|
|
134
143
|
"size-limit": "^11.2.0",
|
|
135
|
-
"storybook": "
|
|
144
|
+
"storybook": "10.4.2",
|
|
136
145
|
"ts-jest": "^29.4.6",
|
|
137
146
|
"tslib": "^2.8.1",
|
|
138
147
|
"tsup": "^8.0.0",
|
|
139
148
|
"typescript": "^5.9.3",
|
|
140
149
|
"url-loader": "^4.1.1",
|
|
141
|
-
"vite": "^
|
|
150
|
+
"vite": "^6.4.2",
|
|
151
|
+
"vitest": "^4.1.8",
|
|
142
152
|
"webpack": "^5.94.0",
|
|
143
153
|
"webpack-cli": "^5.1.4",
|
|
144
154
|
"webpack-fix-style-only-entries": "^0.6.1"
|
|
@@ -2,7 +2,7 @@ import { Calendar } from './Calendar';
|
|
|
2
2
|
|
|
3
3
|
import type { Meta } from '@storybook/react-vite';
|
|
4
4
|
import React, { useState, ChangeEvent } from 'react';
|
|
5
|
-
import { type DateRange } from 'react
|
|
5
|
+
import { type DateRange } from '@daypicker/react';
|
|
6
6
|
import { TextInput } from '../TextInput/TextInput';
|
|
7
7
|
import { format, isValid, parse } from 'date-fns';
|
|
8
8
|
|
|
@@ -76,7 +76,6 @@ describe('Calendar', () => {
|
|
|
76
76
|
/>
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
-
// In react-day-picker v9, we need to click the button inside the day cell
|
|
80
79
|
const dayButton = screen.getByRole('button', { name: /June 16th/i });
|
|
81
80
|
fireEvent.click(dayButton);
|
|
82
81
|
|
|
@@ -214,6 +213,13 @@ describe('Calendar', () => {
|
|
|
214
213
|
'--rdp-accent-color': 'var(--color-font-base)',
|
|
215
214
|
});
|
|
216
215
|
});
|
|
216
|
+
|
|
217
|
+
test('applies table width class to the month grid', () => {
|
|
218
|
+
const { container } = render(<Calendar />);
|
|
219
|
+
const monthGrid = container.querySelector('.rdp-month_grid');
|
|
220
|
+
|
|
221
|
+
expect(monthGrid).toHaveClass('w-100');
|
|
222
|
+
});
|
|
217
223
|
});
|
|
218
224
|
|
|
219
225
|
describe('Chevron icons', () => {
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import {
|
|
4
4
|
DayPicker,
|
|
5
|
-
DayPickerProps,
|
|
6
5
|
getDefaultClassNames,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
type DayPickerProps,
|
|
7
|
+
type Matcher,
|
|
8
|
+
} from '@daypicker/react';
|
|
9
|
+
import '@daypicker/react/style.css';
|
|
10
10
|
import { Icon } from '../Icon/Icon';
|
|
11
11
|
|
|
12
12
|
export type CalendarProps = DayPickerProps;
|
|
@@ -74,11 +74,10 @@ function Calendar({
|
|
|
74
74
|
selected: classNames(
|
|
75
75
|
'font-color-inverse background-color-inverse hover:font-color-inverse'
|
|
76
76
|
),
|
|
77
|
-
month_grid: classNames(defaultClassNames.month_grid, 'm-top-lg'),
|
|
77
|
+
month_grid: classNames(defaultClassNames.month_grid, 'm-top-lg w-100'),
|
|
78
78
|
day: classNames(defaultClassNames.day, 'hover:font-color-base'),
|
|
79
79
|
day_button: classNames(defaultClassNames.day_button),
|
|
80
80
|
range_middle: classNames(defaultClassNames.range_middle),
|
|
81
|
-
table: classNames('w-100'),
|
|
82
81
|
dropdowns: classNames(defaultClassNames.dropdowns, 'h-100'),
|
|
83
82
|
caption_label: classNames(defaultClassNames.caption_label, 'g-2xs'),
|
|
84
83
|
}}
|
|
@@ -3,6 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import Select, {
|
|
4
4
|
components,
|
|
5
5
|
ClearIndicatorProps,
|
|
6
|
+
GroupBase,
|
|
6
7
|
OptionsOrGroups,
|
|
7
8
|
OnChangeValue,
|
|
8
9
|
} from 'react-select';
|
|
@@ -16,7 +17,6 @@ import { Icon } from '../Icon/Icon';
|
|
|
16
17
|
import { FormLabel } from '../FormLabel/FormLabel';
|
|
17
18
|
import { InputValidationMessage } from '../InputValidationMessage/InputValidationMessage';
|
|
18
19
|
import styles from './SelectInput.module.scss';
|
|
19
|
-
import { GroupBase } from 'react-select/dist/declarations/src/types';
|
|
20
20
|
|
|
21
21
|
type SelectOption = {
|
|
22
22
|
value: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import { Table } from './Table';
|
|
4
4
|
import { Button } from '../Button/Button';
|
|
5
5
|
import { Badge } from '../Badge/Badge';
|
|
@@ -208,20 +208,16 @@ export const Sortable = () => {
|
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
210
|
const newSortDirection = getNewSortDirection(sortedKey, sortedColumn);
|
|
211
|
+
const sortedData =
|
|
212
|
+
newSortDirection === 'ascending'
|
|
213
|
+
? sortAscending(tableData, sortedKey)
|
|
214
|
+
: sortDescending(tableData, sortedKey);
|
|
211
215
|
setSortedColumn({
|
|
212
216
|
dataKey: sortedKey,
|
|
213
217
|
sortDirection: newSortDirection,
|
|
214
218
|
});
|
|
219
|
+
setTableData(sortedData);
|
|
215
220
|
};
|
|
216
|
-
useEffect(() => {
|
|
217
|
-
if (sortedColumn.dataKey && sortedColumn.sortDirection) {
|
|
218
|
-
const sortedData =
|
|
219
|
-
sortedColumn.sortDirection === 'ascending'
|
|
220
|
-
? sortAscending(tableData, sortedColumn.dataKey)
|
|
221
|
-
: sortDescending(tableData, sortedColumn.dataKey);
|
|
222
|
-
setTableData(sortedData);
|
|
223
|
-
}
|
|
224
|
-
}, [sortedColumn, tableData]);
|
|
225
221
|
const columnConfig = [
|
|
226
222
|
{ heading: 'ID', dataKey: 'id', isSortable: true },
|
|
227
223
|
{ heading: 'Color', dataKey: 'color', isSortable: true },
|
|
@@ -276,20 +272,16 @@ export const SortablewithDefaultSortedColumn = () => {
|
|
|
276
272
|
return;
|
|
277
273
|
}
|
|
278
274
|
const newSortDirection = getNewSortDirection(sortedKey, sortedColumn);
|
|
275
|
+
const sortedData =
|
|
276
|
+
newSortDirection === 'ascending'
|
|
277
|
+
? sortAscending(tableData, sortedKey)
|
|
278
|
+
: sortDescending(tableData, sortedKey);
|
|
279
279
|
setSortedColumn({
|
|
280
280
|
dataKey: sortedKey,
|
|
281
281
|
sortDirection: newSortDirection,
|
|
282
282
|
});
|
|
283
|
+
setTableData(sortedData);
|
|
283
284
|
};
|
|
284
|
-
useEffect(() => {
|
|
285
|
-
if (sortedColumn.dataKey && sortedColumn.sortDirection) {
|
|
286
|
-
const sortedData =
|
|
287
|
-
sortedColumn.sortDirection === 'ascending'
|
|
288
|
-
? sortAscending(tableData, sortedColumn.dataKey)
|
|
289
|
-
: sortDescending(tableData, sortedColumn.dataKey);
|
|
290
|
-
setTableData(sortedData);
|
|
291
|
-
}
|
|
292
|
-
}, [sortedColumn, tableData]);
|
|
293
285
|
const columnConfig = [
|
|
294
286
|
{ heading: 'ID', dataKey: 'id', isSortable: true },
|
|
295
287
|
{ heading: 'Color', dataKey: 'color', isSortable: true },
|
|
@@ -336,20 +328,16 @@ export const SortableAndLoading = () => {
|
|
|
336
328
|
return;
|
|
337
329
|
}
|
|
338
330
|
const newSortDirection = getNewSortDirection(sortedKey, sortedColumn);
|
|
331
|
+
const sortedData =
|
|
332
|
+
newSortDirection === 'ascending'
|
|
333
|
+
? sortAscending(tableData, sortedKey)
|
|
334
|
+
: sortDescending(tableData, sortedKey);
|
|
339
335
|
setSortedColumn({
|
|
340
336
|
dataKey: sortedKey,
|
|
341
337
|
sortDirection: newSortDirection,
|
|
342
338
|
});
|
|
339
|
+
setTableData(sortedData);
|
|
343
340
|
};
|
|
344
|
-
useEffect(() => {
|
|
345
|
-
if (sortedColumn.dataKey && sortedColumn.sortDirection) {
|
|
346
|
-
const sortedData =
|
|
347
|
-
sortedColumn.sortDirection === 'ascending'
|
|
348
|
-
? sortAscending(tableData, sortedColumn.dataKey)
|
|
349
|
-
: sortDescending(tableData, sortedColumn.dataKey);
|
|
350
|
-
setTableData(sortedData);
|
|
351
|
-
}
|
|
352
|
-
}, [sortedColumn, tableData]);
|
|
353
341
|
const columnConfig = [
|
|
354
342
|
{ heading: 'ID', dataKey: 'id', isSortable: true },
|
|
355
343
|
{ heading: 'Color', dataKey: 'color', isSortable: true },
|