@arbor-education/design-system.components 0.5.4 → 0.6.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/avatarGroup/AvatarGroup.d.ts +32 -0
  3. package/dist/components/avatarGroup/AvatarGroup.d.ts.map +1 -0
  4. package/dist/components/avatarGroup/AvatarGroup.js +37 -0
  5. package/dist/components/avatarGroup/AvatarGroup.js.map +1 -0
  6. package/dist/components/avatarGroup/AvatarGroup.stories.d.ts +14 -0
  7. package/dist/components/avatarGroup/AvatarGroup.stories.d.ts.map +1 -0
  8. package/dist/components/avatarGroup/AvatarGroup.stories.js +91 -0
  9. package/dist/components/avatarGroup/AvatarGroup.stories.js.map +1 -0
  10. package/dist/components/avatarGroup/AvatarGroup.test.d.ts +2 -0
  11. package/dist/components/avatarGroup/AvatarGroup.test.d.ts.map +1 -0
  12. package/dist/components/avatarGroup/AvatarGroup.test.js +155 -0
  13. package/dist/components/avatarGroup/AvatarGroup.test.js.map +1 -0
  14. package/dist/components/avatarGroup/avatarGroupOverflow.d.ts +8 -0
  15. package/dist/components/avatarGroup/avatarGroupOverflow.d.ts.map +1 -0
  16. package/dist/components/avatarGroup/avatarGroupOverflow.js +14 -0
  17. package/dist/components/avatarGroup/avatarGroupOverflow.js.map +1 -0
  18. package/dist/components/avatarGroup/collectAvatarGroupChildren.d.ts +4 -0
  19. package/dist/components/avatarGroup/collectAvatarGroupChildren.d.ts.map +1 -0
  20. package/dist/components/avatarGroup/collectAvatarGroupChildren.js +26 -0
  21. package/dist/components/avatarGroup/collectAvatarGroupChildren.js.map +1 -0
  22. package/dist/components/avatarGroup/useAvatarGroupItems.d.ts +9 -0
  23. package/dist/components/avatarGroup/useAvatarGroupItems.d.ts.map +1 -0
  24. package/dist/components/avatarGroup/useAvatarGroupItems.js +24 -0
  25. package/dist/components/avatarGroup/useAvatarGroupItems.js.map +1 -0
  26. package/dist/components/table/Table.d.ts +1 -0
  27. package/dist/components/table/Table.d.ts.map +1 -1
  28. package/dist/components/table/Table.js +2 -0
  29. package/dist/components/table/Table.js.map +1 -1
  30. package/dist/components/table/Table.stories.d.ts.map +1 -1
  31. package/dist/components/table/Table.stories.js +447 -77
  32. package/dist/components/table/Table.stories.js.map +1 -1
  33. package/dist/components/table/Table.test.js +1 -1
  34. package/dist/components/table/Table.test.js.map +1 -1
  35. package/dist/components/table/TableSettingsDropdown.d.ts.map +1 -0
  36. package/dist/components/table/{pagination/TableSettingsDropdown.js → TableSettingsDropdown.js} +6 -6
  37. package/dist/components/table/TableSettingsDropdown.js.map +1 -0
  38. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.d.ts +2 -5
  39. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.d.ts.map +1 -1
  40. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js +7 -5
  41. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js.map +1 -1
  42. package/dist/index.css +39 -5
  43. package/dist/index.css.map +1 -1
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -0
  47. package/dist/index.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/components/avatarGroup/AvatarGroup.stories.tsx +218 -0
  50. package/src/components/avatarGroup/AvatarGroup.test.tsx +298 -0
  51. package/src/components/avatarGroup/AvatarGroup.tsx +127 -0
  52. package/src/components/avatarGroup/avatarGroup.scss +31 -0
  53. package/src/components/avatarGroup/avatarGroupOverflow.ts +29 -0
  54. package/src/components/avatarGroup/collectAvatarGroupChildren.ts +30 -0
  55. package/src/components/avatarGroup/useAvatarGroupItems.ts +39 -0
  56. package/src/components/heading/heading.scss +4 -4
  57. package/src/components/table/Table.stories.tsx +678 -265
  58. package/src/components/table/Table.test.tsx +1 -1
  59. package/src/components/table/Table.tsx +2 -0
  60. package/src/components/table/{pagination/TableSettingsDropdown.tsx → TableSettingsDropdown.tsx} +1 -1
  61. package/src/components/table/cellRenderers/SelectDropdownCellRenderer.tsx +42 -12
  62. package/src/global.scss +8 -8
  63. package/src/index.scss +1 -0
  64. package/src/index.ts +7 -0
  65. package/src/tokens.scss +2 -0
  66. package/tokens/json/Arbor.json +13 -1
  67. package/dist/components/table/pagination/TableSettingsDropdown.d.ts.map +0 -1
  68. package/dist/components/table/pagination/TableSettingsDropdown.js.map +0 -1
  69. /package/dist/components/table/{pagination/TableSettingsDropdown.d.ts → TableSettingsDropdown.d.ts} +0 -0
@@ -4,7 +4,7 @@ import { Table, TABLE_SPACING } from './Table';
4
4
  import '@testing-library/jest-dom/vitest';
5
5
  import { BulkActionsDropdown } from 'Components/table/BulkActionsDropdown';
6
6
  import { HideColumnsDropdown } from 'Components/table/HideColumnsDropdown';
7
- import { TableSettingsDropdown } from './pagination/TableSettingsDropdown';
7
+ import { TableSettingsDropdown } from './TableSettingsDropdown';
8
8
  import userEvent from '@testing-library/user-event';
9
9
  import type { GridApi } from 'ag-grid-enterprise';
10
10
  import * as focusFirstFocusableElementModule from 'Utils/focusFirstFocusableElement';
@@ -23,6 +23,7 @@ import { tidyTheme } from './theme/tidyTheme';
23
23
  import { focusFirstFocusableElement } from 'Utils/focusFirstFocusableElement';
24
24
  import { BooleanFilter } from './columnFilters/BooleanFilter/BooleanFilter';
25
25
  import { TimeFilter } from './columnFilters/TimeFilter/TimeFilter';
26
+ import { TableSettingsDropdown } from './TableSettingsDropdown';
26
27
 
27
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
29
  type TableProps<TData = any> = {
@@ -217,3 +218,4 @@ Table.BulkActionsDropdown = BulkActionsDropdown;
217
218
  Table.HideColumnsDropdown = HideColumnsDropdown;
218
219
  Table.ButtonCellRenderer = ButtonCellRenderer;
219
220
  Table.DefaultValueFormatter = defaultValueFormatter;
221
+ Table.TableSettingsDropdown = TableSettingsDropdown;
@@ -4,7 +4,7 @@ import { CheckboxGroup } from 'Components/formField/inputs/checkbox/CheckboxGrou
4
4
  import { RadioButtonGroup } from 'Components/formField/inputs/radio/RadioButtonGroup';
5
5
  import { Separator } from 'Components/separator/Separator';
6
6
  import { useContext, type ChangeEvent } from 'react';
7
- import { TABLE_SPACING, TableSettingsContext } from '../Table';
7
+ import { TABLE_SPACING, TableSettingsContext } from './Table';
8
8
 
9
9
  const TABLE_SPACING_NAMES = {
10
10
  XS: 'X-Small',
@@ -1,18 +1,35 @@
1
1
  import { useState } from 'react';
2
- import type { CellKeyDownEvent, FullWidthCellKeyDownEvent } from 'ag-grid-community';
2
+ import type {
3
+ CellKeyDownEvent,
4
+ FullWidthCellKeyDownEvent,
5
+ } from 'ag-grid-community';
3
6
  import type { CustomCellRendererProps } from 'ag-grid-react';
4
- import type { SelectDropdownItemProps } from 'Components/formField/inputs/selectDropdown/items/item/SelectDropdownItem';
5
- import { SelectDropdown } from 'Components/formField/inputs/selectDropdown/SelectDropdown';
7
+ import {
8
+ SelectDropdown,
9
+ type SelectDropdownInputProps,
10
+ } from 'Components/formField/inputs/selectDropdown/SelectDropdown';
6
11
  import { useComponentDidMount } from 'Utils/hooks/useComponentDidMount';
7
12
 
8
- type SelectDropdownCellRendererProps = CustomCellRendererProps & {
9
- options?: SelectDropdownItemProps[];
10
- placeholder?: string;
11
- };
13
+ type SelectDropdownCellRendererProps = CustomCellRendererProps
14
+ & SelectDropdownInputProps;
12
15
 
13
- export const SelectDropdownCellRenderer = (props: SelectDropdownCellRendererProps) => {
14
- const { value, placeholder = 'Select', node, column, api } = props;
15
- const options = props.options ?? [];
16
+ export const SelectDropdownCellRenderer = (
17
+ props: SelectDropdownCellRendererProps,
18
+ ) => {
19
+ const {
20
+ value,
21
+ placeholder = 'Select',
22
+ node,
23
+ column,
24
+ api,
25
+ options = [],
26
+ disabled,
27
+ hasError,
28
+ id,
29
+ 'aria-describedBy': ariaDescribedBy,
30
+ 'aria-invalid': ariaInvalid,
31
+ alwaysShowPlaceholder = false,
32
+ } = props;
16
33
 
17
34
  const valueStr = value != null && value !== '' ? String(value) : '';
18
35
  const initialSelectedValues = valueStr ? [valueStr] : [];
@@ -20,8 +37,15 @@ export const SelectDropdownCellRenderer = (props: SelectDropdownCellRendererProp
20
37
  const [isOpen, setIsOpen] = useState(false);
21
38
 
22
39
  useComponentDidMount(() => {
23
- const handleCellKeyDown = (event: CellKeyDownEvent | FullWidthCellKeyDownEvent) => {
24
- if ('column' in event && event.node === node && event.column === column && (event.event as KeyboardEvent).key === 'Enter') {
40
+ const handleCellKeyDown = (
41
+ event: CellKeyDownEvent | FullWidthCellKeyDownEvent,
42
+ ) => {
43
+ if (
44
+ 'column' in event
45
+ && event.node === node
46
+ && event.column === column
47
+ && (event.event as KeyboardEvent).key === 'Enter'
48
+ ) {
25
49
  setIsOpen(true);
26
50
  }
27
51
  };
@@ -35,6 +59,12 @@ export const SelectDropdownCellRenderer = (props: SelectDropdownCellRendererProp
35
59
  return (
36
60
  <div className="ds-table__select-dropdown">
37
61
  <SelectDropdown
62
+ disabled={disabled}
63
+ hasError={hasError}
64
+ id={id}
65
+ aria-describedBy={ariaDescribedBy}
66
+ aria-invalid={ariaInvalid}
67
+ alwaysShowPlaceholder={alwaysShowPlaceholder}
38
68
  options={options}
39
69
  placeholder={placeholder}
40
70
  initialSelectedValues={initialSelectedValues}
package/src/global.scss CHANGED
@@ -26,11 +26,11 @@
26
26
  text-rendering: optimizeLegibility;
27
27
  }
28
28
 
29
- body {
30
- *[class^='ds-'], *[class*=' ds-'] {
31
- font-family: var(--font-family-standard);
32
- font-size: var(--type-body-p-size);
33
- font-weight: var(--font-weight-regular);
34
- box-sizing: border-box;
35
- }
36
- }
29
+
30
+ *[class^='ds-'],
31
+ *[class*=' ds-'] {
32
+ font-family: var(--font-family-standard);
33
+ font-size: var(--type-body-p-size);
34
+ font-weight: var(--font-weight-regular);
35
+ box-sizing: border-box;
36
+ }
package/src/index.scss CHANGED
@@ -35,5 +35,6 @@
35
35
  @use "components/toast/toast.scss";
36
36
  @use "components/datePicker/datePicker.scss";
37
37
  @use "components/avatar/avatar.scss";
38
+ @use "components/avatarGroup/avatarGroup.scss";
38
39
  @use "components/userDropdown/userDropdown.scss";
39
40
  @import "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";
package/src/index.ts CHANGED
@@ -32,6 +32,13 @@ export { Progress } from 'Components/progress/Progress';
32
32
  export { Toast } from 'Components/toast/Toast';
33
33
  export { DatePicker } from 'Components/datePicker/DatePicker';
34
34
  export { Avatar } from 'Components/avatar/Avatar';
35
+ export {
36
+ AvatarGroup,
37
+ type AvatarGroupItem,
38
+ type AvatarGroupListOrder,
39
+ type AvatarGroupOverflowCountProps,
40
+ type AvatarGroupProps,
41
+ } from 'Components/avatarGroup/AvatarGroup';
35
42
  export { UserDropdown } from 'Components/userDropdown/UserDropdown';
36
43
  export { SearchBar } from 'Components/searchBar/SearchBar';
37
44
  export type { UserDropdownUserInfoAction } from 'Components/userDropdown/UserDropdown';
package/src/tokens.scss CHANGED
@@ -157,6 +157,8 @@
157
157
  --avatar-small-size: 1.25rem;
158
158
  --avatar-medium-size: 2rem;
159
159
  --avatar-extra-large-size: 6rem;
160
+ --avatar-group-overlap: -2px;
161
+ --avatar-group-overflow-count-font-size: 0.8125rem;
160
162
  --border-weight: 1px;
161
163
  --page-base-color-border: var(--color-grey-050);
162
164
  --widget-notifications-read-color: #ffffff;
@@ -1793,6 +1793,18 @@
1793
1793
  }
1794
1794
  }
1795
1795
  },
1796
+ "avatar-group": {
1797
+ "overlap": {
1798
+ "$type": "dimension",
1799
+ "$value": "-2px"
1800
+ },
1801
+ "overflow-count": {
1802
+ "font-size": {
1803
+ "$type": "dimension",
1804
+ "$value": "0.8125rem"
1805
+ }
1806
+ }
1807
+ },
1796
1808
  "banner": {
1797
1809
  "info": {
1798
1810
  "color-icon": {
@@ -6326,4 +6338,4 @@
6326
6338
  "$value": "{spacing.small}"
6327
6339
  }
6328
6340
  }
6329
- }
6341
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableSettingsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/table/pagination/TableSettingsDropdown.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,qBAAqB,+CA0EjC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableSettingsDropdown.js","sourceRoot":"","sources":["../../../../src/components/table/pagination/TableSettingsDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAoB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,mBAAmB,GAAG;IAC1B,EAAE,EAAE,SAAS;IACb,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,OAAO;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,EACJ,QAAQ,EAAE,EACR,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,GACrB,EACD,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,uBAAuB,GACxB,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAErC,OAAO,CACL,MAAC,QAAQ,eACP,KAAC,QAAQ,CAAC,OAAO,cACf,KAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,aAAa,EAAC,UAAU,EACxB,yBAAyB,EAAC,gBAAgB,EAC1C,UAAU,SACV,GACe,EACnB,MAAC,QAAQ,CAAC,OAAO,eACf,KAAC,gBAAgB,IACf,MAAM,EAAC,eA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