@hyphen/hyphen-components 7.5.0 → 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/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-day-picker';
8
- export { Matcher } from 'react-day-picker';
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.5.0",
3
+ "version": "7.7.0",
4
+ "packageManager": "pnpm@10.20.0",
4
5
  "license": "MIT",
5
6
  "author": {
6
7
  "name": "@hyphen"
@@ -13,6 +14,10 @@
13
14
  "dist",
14
15
  "src"
15
16
  ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/Hyphen/hyphen-components.git"
20
+ },
16
21
  "scripts": {
17
22
  "build": "cross-env IS_PUBLISHING=true tsup && cross-env IS_PUBLISHING=true webpack --config webpack.config.js && node scripts/create-cjs-shim.js",
18
23
  "build-storybook": "storybook build",
@@ -26,8 +31,8 @@
26
31
  "test": "jest --passWithNoTests",
27
32
  "test-watch": "jest --coverage --watch",
28
33
  "semantic-release": "semantic-release",
29
- "prepare": "npm run build",
30
- "chromatic": "npx chromatic --project-token=chpt_8fddffb5556f0b7 --only-changed"
34
+ "prepare": "pnpm run build",
35
+ "chromatic": "chromatic --project-token=chpt_8fddffb5556f0b7 --only-changed"
31
36
  },
32
37
  "husky": {
33
38
  "hooks": {
@@ -44,7 +49,7 @@
44
49
  "react": ">=16"
45
50
  },
46
51
  "engines": {
47
- "node": ">=20"
52
+ "node": ">=20.19.0 <21 || >=22.12.0"
48
53
  },
49
54
  "size-limit": [
50
55
  {
@@ -57,38 +62,39 @@
57
62
  }
58
63
  ],
59
64
  "dependencies": {
65
+ "@daypicker/react": "^10.0.1",
60
66
  "@emotion/react": "^11.14.0",
61
- "@hyphen/hyphen-design-tokens": "^7.5.1",
62
- "@radix-ui/react-aspect-ratio": "^1.1.8",
63
- "@radix-ui/react-collapsible": "^1.1.12",
64
- "@radix-ui/react-dropdown-menu": "^2.1.16",
65
- "@radix-ui/react-popover": "^1.1.15",
66
- "@radix-ui/react-slot": "^1.2.4",
67
- "@radix-ui/react-toggle": "^1.1.10",
68
- "@radix-ui/react-toggle-group": "^1.1.11",
69
- "@radix-ui/react-tooltip": "^1.2.8",
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",
70
76
  "@types/react-modal": "^3.16.3",
71
77
  "classnames": "^2.5.1",
72
78
  "date-fns": "^4.1.0",
73
- "formik": "^2.4.6",
74
- "react-day-picker": "^9.11.3",
79
+ "formik": "^2.4.9",
75
80
  "react-focus-lock": "^2.13.2",
76
81
  "react-modal": "^3.16.3",
77
- "react-remove-scroll": "^2.6.3",
78
- "react-router-dom": "^6.26.1",
82
+ "react-remove-scroll": "^2.7.2",
83
+ "react-router-dom": "^6.30.4",
79
84
  "react-select": "^5.10.0",
80
85
  "react-select-event": "^5.5.1",
81
- "uuid": "^11.1.0"
86
+ "uuid": "^11.1.1"
82
87
  },
83
88
  "devDependencies": {
84
89
  "@babel/core": "^7.27.4",
85
- "@chromatic-com/storybook": "^4.1.3",
90
+ "@chromatic-com/storybook": "^5.2.1",
86
91
  "@semantic-release/commit-analyzer": "^11.1.0",
87
92
  "@size-limit/preset-small-lib": "^11.2.0",
88
- "@storybook/addon-a11y": "^9.1.3",
89
- "@storybook/addon-docs": "^9.1.3",
90
- "@storybook/addon-themes": "^9.1.3",
91
- "@storybook/react-vite": "^9.1.3",
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",
92
98
  "@testing-library/jest-dom": "^6.6.3",
93
99
  "@testing-library/react": "^16.2.0",
94
100
  "@testing-library/user-event": "^14.6.1",
@@ -101,24 +107,31 @@
101
107
  "@types/react-modal": "^3.16.3",
102
108
  "@typescript-eslint/eslint-plugin": "^8.0.0",
103
109
  "@typescript-eslint/parser": "^8.0.0",
110
+ "@vitest/browser-playwright": "^4.1.8",
111
+ "@vitest/coverage-v8": "^4.1.8",
104
112
  "autoprefixer": "^10.4.20",
105
113
  "babel-loader": "^9.1.3",
106
- "chromatic": "^13.3.4",
114
+ "chromatic": "^13.3.5",
107
115
  "clean-webpack-plugin": "^4.0.0",
108
116
  "cross-env": "^7.0.3",
109
117
  "css-loader": "^6.11.0",
110
118
  "css-minimizer-webpack-plugin": "^5.0.1",
111
119
  "cssnano": "^6.1.2",
112
120
  "csstype": "^3.1.3",
121
+ "eslint": "^8.57.0",
113
122
  "eslint-config-prettier": "^9.0.0",
114
123
  "eslint-plugin-import": "^2.32.0",
115
124
  "eslint-plugin-react": "^7.34.0",
116
125
  "eslint-plugin-react-hooks": "^4.6.0",
126
+ "eslint-plugin-storybook": "10.4.2",
117
127
  "husky": "^8.0.3",
118
128
  "identity-obj-proxy": "^3.0.0",
129
+ "jest": "^29.7.0",
119
130
  "jest-environment-jsdom": "^30.2.0",
120
131
  "jest-preview": "^0.3.1",
121
132
  "mini-css-extract-plugin": "^2.9.1",
133
+ "playwright": "^1.60.0",
134
+ "postcss": "^8.4.47",
122
135
  "postcss-loader": "^7.3.4",
123
136
  "postcss-modules": "^6.0.0",
124
137
  "react": "^18.3.1",
@@ -128,13 +141,14 @@
128
141
  "sass-loader": "^13.3.3",
129
142
  "semantic-release": "^25.0.2",
130
143
  "size-limit": "^11.2.0",
131
- "storybook": "^9.1.3",
144
+ "storybook": "10.4.2",
132
145
  "ts-jest": "^29.4.6",
133
146
  "tslib": "^2.8.1",
134
147
  "tsup": "^8.0.0",
135
148
  "typescript": "^5.9.3",
136
149
  "url-loader": "^4.1.1",
137
- "vite": "^5.4.19",
150
+ "vite": "^6.4.2",
151
+ "vitest": "^4.1.8",
138
152
  "webpack": "^5.94.0",
139
153
  "webpack-cli": "^5.1.4",
140
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-day-picker';
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
- Matcher,
8
- } from 'react-day-picker';
9
- import 'react-day-picker/style.css';
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, { useEffect, useState } from '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 },
@@ -6,7 +6,7 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
 
7
7
  ### 1. Install
8
8
 
9
- `yarn add @hyphen/hyphen-components`
9
+ `pnpm add @hyphen/hyphen-components`
10
10
 
11
11
  or
12
12