@arbor-education/design-system.components 0.3.6 → 0.4.1
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/CHANGELOG.md +16 -0
- package/CLAUDE.md +9 -0
- package/dist/components/avatar/Avatar.d.ts +11 -0
- package/dist/components/avatar/Avatar.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.js +17 -0
- package/dist/components/avatar/Avatar.js.map +1 -0
- package/dist/components/avatar/Avatar.stories.d.ts +14 -0
- package/dist/components/avatar/Avatar.stories.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.stories.js +66 -0
- package/dist/components/avatar/Avatar.stories.js.map +1 -0
- package/dist/components/avatar/Avatar.test.d.ts +2 -0
- package/dist/components/avatar/Avatar.test.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.test.js +51 -0
- package/dist/components/avatar/Avatar.test.js.map +1 -0
- package/dist/components/banner/Banner.d.ts +19 -0
- package/dist/components/banner/Banner.d.ts.map +1 -0
- package/dist/components/banner/Banner.js +33 -0
- package/dist/components/banner/Banner.js.map +1 -0
- package/dist/components/banner/Banner.stories.d.ts +72 -0
- package/dist/components/banner/Banner.stories.d.ts.map +1 -0
- package/dist/components/banner/Banner.stories.js +84 -0
- package/dist/components/banner/Banner.stories.js.map +1 -0
- package/dist/components/banner/Banner.test.d.ts +2 -0
- package/dist/components/banner/Banner.test.d.ts.map +1 -0
- package/dist/components/banner/Banner.test.js +72 -0
- package/dist/components/banner/Banner.test.js.map +1 -0
- package/dist/components/dropdown/Dropdown.d.ts +2 -0
- package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/Dropdown.js +5 -1
- package/dist/components/dropdown/Dropdown.js.map +1 -1
- package/dist/components/dropdown/items/DropdownGroup.d.ts +3 -0
- package/dist/components/dropdown/items/DropdownGroup.d.ts.map +1 -0
- package/dist/components/dropdown/items/DropdownGroup.js +8 -0
- package/dist/components/dropdown/items/DropdownGroup.js.map +1 -0
- package/dist/components/dropdown/items/DropdownSeparator.d.ts +3 -0
- package/dist/components/dropdown/items/DropdownSeparator.d.ts.map +1 -0
- package/dist/components/dropdown/items/DropdownSeparator.js +8 -0
- package/dist/components/dropdown/items/DropdownSeparator.js.map +1 -0
- package/dist/components/userDropdown/UserDropdown.d.ts +47 -0
- package/dist/components/userDropdown/UserDropdown.d.ts.map +1 -0
- package/dist/components/userDropdown/UserDropdown.js +13 -0
- package/dist/components/userDropdown/UserDropdown.js.map +1 -0
- package/dist/components/userDropdown/UserDropdown.stories.d.ts +12 -0
- package/dist/components/userDropdown/UserDropdown.stories.d.ts.map +1 -0
- package/dist/components/userDropdown/UserDropdown.stories.js +222 -0
- package/dist/components/userDropdown/UserDropdown.stories.js.map +1 -0
- package/dist/components/userDropdown/UserDropdown.test.d.ts +2 -0
- package/dist/components/userDropdown/UserDropdown.test.d.ts.map +1 -0
- package/dist/components/userDropdown/UserDropdown.test.js +197 -0
- package/dist/components/userDropdown/UserDropdown.test.js.map +1 -0
- package/dist/components/userDropdown/assets/arbor.png +0 -0
- package/dist/components/userDropdown/assets/govhub.png +0 -0
- package/dist/components/userDropdown/assets/key.png +0 -0
- package/dist/components/userDropdown/assets/logos.d.ts +7 -0
- package/dist/components/userDropdown/assets/logos.d.ts.map +1 -0
- package/dist/components/userDropdown/assets/logos.js +13 -0
- package/dist/components/userDropdown/assets/logos.js.map +1 -0
- package/dist/components/userDropdown/assets/robin.png +0 -0
- package/dist/components/userDropdown/assets/sampeople.png +0 -0
- package/dist/components/userDropdown/assets/timetabler.png +0 -0
- package/dist/components/userDropdown/internal/UserDropdownAppItem.d.ts +3 -0
- package/dist/components/userDropdown/internal/UserDropdownAppItem.d.ts.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownAppItem.js +9 -0
- package/dist/components/userDropdown/internal/UserDropdownAppItem.js.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.d.ts +9 -0
- package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.d.ts.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.js +11 -0
- package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.js.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownSignOut.d.ts +7 -0
- package/dist/components/userDropdown/internal/UserDropdownSignOut.d.ts.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownSignOut.js +9 -0
- package/dist/components/userDropdown/internal/UserDropdownSignOut.js.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownTrigger.d.ts +11 -0
- package/dist/components/userDropdown/internal/UserDropdownTrigger.d.ts.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownTrigger.js +10 -0
- package/dist/components/userDropdown/internal/UserDropdownTrigger.js.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownUserInfo.d.ts +8 -0
- package/dist/components/userDropdown/internal/UserDropdownUserInfo.d.ts.map +1 -0
- package/dist/components/userDropdown/internal/UserDropdownUserInfo.js +17 -0
- package/dist/components/userDropdown/internal/UserDropdownUserInfo.js.map +1 -0
- package/dist/index.css +463 -53
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/components/avatar/Avatar.stories.tsx +84 -0
- package/src/components/avatar/Avatar.test.tsx +60 -0
- package/src/components/avatar/Avatar.tsx +68 -0
- package/src/components/avatar/avatar.scss +71 -0
- package/src/components/banner/Banner.stories.tsx +96 -0
- package/src/components/banner/Banner.test.tsx +86 -0
- package/src/components/banner/Banner.tsx +81 -0
- package/src/components/banner/banner.scss +67 -0
- package/src/components/button/button.scss +0 -5
- package/src/components/card/card.scss +0 -3
- package/src/components/dropdown/Dropdown.tsx +5 -1
- package/src/components/dropdown/dropdown.scss +4 -4
- package/src/components/dropdown/items/DropdownGroup.tsx +11 -0
- package/src/components/dropdown/items/DropdownSeparator.tsx +9 -0
- package/src/components/formField/fieldset/fieldset.scss +0 -2
- package/src/components/formField/formField.scss +0 -2
- package/src/components/formField/inputs/checkbox/checkboxInput.scss +0 -2
- package/src/components/formField/inputs/input.scss +0 -3
- package/src/components/formField/inputs/radio/radioButtonInput.scss +0 -2
- package/src/components/formField/inputs/selectDropdown/selectDropdown.scss +0 -1
- package/src/components/formField/label/label.scss +0 -2
- package/src/components/modal/modal.scss +0 -3
- package/src/components/pill/pill.scss +0 -3
- package/src/components/searchBar/searchBar.scss +0 -3
- package/src/components/table/columnFilters/columnFilters.scss +0 -6
- package/src/components/table/pagination/pagination.scss +0 -4
- package/src/components/tabs/tabs.scss +0 -2
- package/src/components/tag/tag.scss +0 -3
- package/src/components/toast/toast.scss +0 -1
- package/src/components/tooltip/tooltip.scss +0 -3
- package/src/components/userDropdown/UserDropdown.stories.tsx +237 -0
- package/src/components/userDropdown/UserDropdown.test.tsx +349 -0
- package/src/components/userDropdown/UserDropdown.tsx +110 -0
- package/src/components/userDropdown/assets/arbor.png +0 -0
- package/src/components/userDropdown/assets/govhub.png +0 -0
- package/src/components/userDropdown/assets/key.png +0 -0
- package/src/components/userDropdown/assets/logos.ts +13 -0
- package/src/components/userDropdown/assets/robin.png +0 -0
- package/src/components/userDropdown/assets/sampeople.png +0 -0
- package/src/components/userDropdown/assets/timetabler.png +0 -0
- package/src/components/userDropdown/internal/UserDropdownAppItem.tsx +21 -0
- package/src/components/userDropdown/internal/UserDropdownCollapsibleSection.tsx +38 -0
- package/src/components/userDropdown/internal/UserDropdownSignOut.tsx +19 -0
- package/src/components/userDropdown/internal/UserDropdownTrigger.tsx +42 -0
- package/src/components/userDropdown/internal/UserDropdownUserInfo.tsx +60 -0
- package/src/components/userDropdown/userDropdown.scss +377 -0
- package/src/global.scss +9 -1
- package/src/index.scss +3 -0
- package/src/index.ts +5 -0
- package/tsconfig.json +1 -1
- package/vite-env.d.ts +31 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#126](https://github.com/arbor-education/design-system.components/pull/126) [`3c0783e`](https://github.com/arbor-education/design-system.components/commit/3c0783e66d6babf6a835991e1c1ff2df8903d269) Thanks [@AmeeMorris](https://github.com/AmeeMorris)! - MIS-68964 UserDropdown component
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#124](https://github.com/arbor-education/design-system.components/pull/124) [`202615f`](https://github.com/arbor-education/design-system.components/commit/202615f09a42e564dd418b7bd1b9c6a3de38b33f) Thanks [@angusmglfraser](https://github.com/angusmglfraser)! - MIS-66715 add banner component
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#125](https://github.com/arbor-education/design-system.components/pull/125) [`f01b121`](https://github.com/arbor-education/design-system.components/commit/f01b1216f60898647910fd64af9262e59d7e3060) Thanks [@angusmglfraser](https://github.com/angusmglfraser)! - MIS-67797 added global default styles for DS components
|
|
18
|
+
|
|
3
19
|
## 0.3.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/CLAUDE.md
CHANGED
|
@@ -130,6 +130,15 @@ The Table component is a wrapper around AG Grid:
|
|
|
130
130
|
- lint-staged runs ESLint on TypeScript files and stylelint on SCSS files
|
|
131
131
|
- All linters run with `--fix` flag to auto-fix issues when possible
|
|
132
132
|
|
|
133
|
+
## Branch rules
|
|
134
|
+
- Never try to push directly to main, all work must be on a branch
|
|
135
|
+
- Branch namining conventions are:
|
|
136
|
+
- The branch must have a jira ticket number in it i.e. `MIS-68964`
|
|
137
|
+
- The branch should start with `feature/` `bugfix/` `issue/`
|
|
138
|
+
|
|
139
|
+
## Commit rules
|
|
140
|
+
- Each commit message should start with the same Jira ticket number as the branch name followed by a description of whats being committed. i.e. `MIS-68964 changed x prop to be a string`
|
|
141
|
+
|
|
133
142
|
## Notes for Claude
|
|
134
143
|
- This is an active production codebase serving educational institutions
|
|
135
144
|
- Changes can affect millions of users - be thoughtful and careful
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AvatarSize = 'small' | 'medium' | 'large' | 'extra-large';
|
|
3
|
+
export type AvatarProps = {
|
|
4
|
+
size?: AvatarSize;
|
|
5
|
+
src?: string;
|
|
6
|
+
alt?: string;
|
|
7
|
+
initials?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
export declare const Avatar: (props: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAEzC,eAAO,MAAM,MAAM,GAAI,OAAO,WAAW,4CAsDxC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export const Avatar = (props) => {
|
|
5
|
+
const { size = 'medium', src, alt = '', initials, className, ...rest } = props;
|
|
6
|
+
const renderContent = () => {
|
|
7
|
+
if (src) {
|
|
8
|
+
return (_jsx("img", { src: src, alt: alt, className: "ds-avatar__image" }));
|
|
9
|
+
}
|
|
10
|
+
if (initials) {
|
|
11
|
+
return (_jsx("span", { className: "ds-avatar__initials", "aria-label": alt, children: initials }));
|
|
12
|
+
}
|
|
13
|
+
return (_jsx("span", { className: "ds-avatar__placeholder", "aria-label": alt || 'User avatar', children: _jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", className: "ds-avatar__placeholder-icon", children: _jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }) }) }));
|
|
14
|
+
};
|
|
15
|
+
return (_jsx("div", { className: classNames('ds-avatar', `ds-avatar--${size}`, className), ...rest, children: renderContent() }));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAE,EAAE;IAC3C,MAAM,EACJ,IAAI,GAAG,QAAQ,EACf,GAAG,EACH,GAAG,GAAG,EAAE,EACR,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CACL,cACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,kBAAkB,GAC5B,CACH,CAAC;QACJ,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CACL,eAAM,SAAS,EAAC,qBAAqB,gBAAa,GAAG,YAClD,QAAQ,GACJ,CACR,CAAC;QACJ,CAAC;QAED,OAAO,CACL,eAAM,SAAS,EAAC,wBAAwB,gBAAa,GAAG,IAAI,aAAa,YACvE,cACE,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,cAAc,EACnB,SAAS,EAAC,6BAA6B,YAEvC,eAAM,CAAC,EAAC,+GAA+G,GAAG,GACtH,GACD,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,cACE,SAAS,EAAE,UAAU,CACnB,WAAW,EACX,cAAc,IAAI,EAAE,EACpB,SAAS,CACV,KACG,IAAI,YAEP,aAAa,EAAE,GACZ,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Avatar } from './Avatar';
|
|
3
|
+
declare const meta: Meta<typeof Avatar>;
|
|
4
|
+
type Story = StoryObj<typeof Avatar>;
|
|
5
|
+
export declare const Default: Story;
|
|
6
|
+
export declare const WithInitials: Story;
|
|
7
|
+
export declare const Placeholder: Story;
|
|
8
|
+
export declare const Small: Story;
|
|
9
|
+
export declare const Medium: Story;
|
|
10
|
+
export declare const Large: Story;
|
|
11
|
+
export declare const ExtraLarge: Story;
|
|
12
|
+
export declare const AllSizes: Story;
|
|
13
|
+
export default meta;
|
|
14
|
+
//# sourceMappingURL=Avatar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.stories.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAU7B,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAErC,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAKzB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAMpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar } from './Avatar';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/Avatar',
|
|
5
|
+
component: Avatar,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
size: {
|
|
9
|
+
control: 'select',
|
|
10
|
+
options: ['small', 'medium', 'large', 'extra-large'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export const Default = {
|
|
15
|
+
args: {
|
|
16
|
+
size: 'medium',
|
|
17
|
+
src: 'https://i.pravatar.cc/150?img=1',
|
|
18
|
+
alt: 'User avatar',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const WithInitials = {
|
|
22
|
+
args: {
|
|
23
|
+
size: 'medium',
|
|
24
|
+
initials: 'CM',
|
|
25
|
+
alt: 'Christine Montgomery',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const Placeholder = {
|
|
29
|
+
args: {
|
|
30
|
+
size: 'medium',
|
|
31
|
+
alt: 'User avatar',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export const Small = {
|
|
35
|
+
args: {
|
|
36
|
+
size: 'small',
|
|
37
|
+
src: 'https://i.pravatar.cc/150?img=2',
|
|
38
|
+
alt: 'User avatar',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export const Medium = {
|
|
42
|
+
args: {
|
|
43
|
+
size: 'medium',
|
|
44
|
+
src: 'https://i.pravatar.cc/150?img=3',
|
|
45
|
+
alt: 'User avatar',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export const Large = {
|
|
49
|
+
args: {
|
|
50
|
+
size: 'large',
|
|
51
|
+
src: 'https://i.pravatar.cc/150?img=4',
|
|
52
|
+
alt: 'User avatar',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
export const ExtraLarge = {
|
|
56
|
+
args: {
|
|
57
|
+
size: 'extra-large',
|
|
58
|
+
src: 'https://i.pravatar.cc/150?img=5',
|
|
59
|
+
alt: 'User avatar',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const AllSizes = {
|
|
63
|
+
render: () => (_jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center' }, children: [_jsx(Avatar, { size: "small", src: "https://i.pravatar.cc/150?img=6", alt: "Small avatar" }), _jsx(Avatar, { size: "medium", src: "https://i.pravatar.cc/150?img=7", alt: "Medium avatar" }), _jsx(Avatar, { size: "large", src: "https://i.pravatar.cc/150?img=8", alt: "Large avatar" }), _jsx(Avatar, { size: "extra-large", src: "https://i.pravatar.cc/150?img=9", alt: "Extra large avatar" })] })),
|
|
64
|
+
};
|
|
65
|
+
export default meta;
|
|
66
|
+
//# sourceMappingURL=Avatar.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.stories.js","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,IAAI,GAAwB;IAChC,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,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G,EAAE,CAAC,CACZ,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,aAChE,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,GAAG,EAAC,iCAAiC,EAAC,GAAG,EAAC,cAAc,GAAG,EAChF,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,iCAAiC,EAAC,GAAG,EAAC,eAAe,GAAG,EAClF,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,GAAG,EAAC,iCAAiC,EAAC,GAAG,EAAC,cAAc,GAAG,EAChF,KAAC,MAAM,IAAC,IAAI,EAAC,aAAa,EAAC,GAAG,EAAC,iCAAiC,EAAC,GAAG,EAAC,oBAAoB,GAAG,IACxF,CACP;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.test.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { expect, test, describe } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { Avatar } from './Avatar';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
describe('Avatar', () => {
|
|
7
|
+
test('renders with image when src is provided', () => {
|
|
8
|
+
render(_jsx(Avatar, { src: "https://example.com/avatar.jpg", alt: "Test User" }));
|
|
9
|
+
const image = screen.getByRole('img', { hidden: true });
|
|
10
|
+
expect(image).toBeInTheDocument();
|
|
11
|
+
expect(image).toHaveAttribute('src', 'https://example.com/avatar.jpg');
|
|
12
|
+
expect(image).toHaveAttribute('alt', 'Test User');
|
|
13
|
+
});
|
|
14
|
+
test('renders with initials when no src is provided', () => {
|
|
15
|
+
render(_jsx(Avatar, { initials: "CM", alt: "Christine Montgomery" }));
|
|
16
|
+
expect(screen.getByText('CM')).toBeInTheDocument();
|
|
17
|
+
expect(screen.getByLabelText('Christine Montgomery')).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
test('renders placeholder when no src or initials provided', () => {
|
|
20
|
+
render(_jsx(Avatar, { alt: "User avatar" }));
|
|
21
|
+
expect(screen.getByLabelText('User avatar')).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
test('renders placeholder with default label when no alt provided', () => {
|
|
24
|
+
render(_jsx(Avatar, {}));
|
|
25
|
+
expect(screen.getByLabelText('User avatar')).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
test('applies size variant class', () => {
|
|
28
|
+
const { container, rerender } = render(_jsx(Avatar, { size: "small" }));
|
|
29
|
+
expect(container.firstChild).toHaveClass('ds-avatar--small');
|
|
30
|
+
rerender(_jsx(Avatar, { size: "medium" }));
|
|
31
|
+
expect(container.firstChild).toHaveClass('ds-avatar--medium');
|
|
32
|
+
rerender(_jsx(Avatar, { size: "large" }));
|
|
33
|
+
expect(container.firstChild).toHaveClass('ds-avatar--large');
|
|
34
|
+
rerender(_jsx(Avatar, { size: "extra-large" }));
|
|
35
|
+
expect(container.firstChild).toHaveClass('ds-avatar--extra-large');
|
|
36
|
+
});
|
|
37
|
+
test('applies default medium size when no size specified', () => {
|
|
38
|
+
const { container } = render(_jsx(Avatar, {}));
|
|
39
|
+
expect(container.firstChild).toHaveClass('ds-avatar--medium');
|
|
40
|
+
});
|
|
41
|
+
test('applies custom className', () => {
|
|
42
|
+
const { container } = render(_jsx(Avatar, { className: "custom-class" }));
|
|
43
|
+
expect(container.firstChild).toHaveClass('ds-avatar');
|
|
44
|
+
expect(container.firstChild).toHaveClass('custom-class');
|
|
45
|
+
});
|
|
46
|
+
test('spreads additional HTML attributes', () => {
|
|
47
|
+
const { container } = render(_jsx(Avatar, { "data-testid": "avatar-test" }));
|
|
48
|
+
expect(container.firstChild).toHaveAttribute('data-testid', 'avatar-test');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=Avatar.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.test.js","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,KAAC,MAAM,IAAC,GAAG,EAAC,gCAAgC,EAAC,GAAG,EAAC,WAAW,GAAG,CAAC,CAAC;QACxE,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,gCAAgC,CAAC,CAAC;QACvE,MAAM,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,KAAC,MAAM,IAAC,QAAQ,EAAC,IAAI,EAAC,GAAG,EAAC,sBAAsB,GAAG,CAAC,CAAC;QAC5D,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACnD,MAAM,CAAC,MAAM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rE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC9D,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,MAAM,KAAG,CAAC,CAAC;QACzC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACpC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,MAAM,IAAC,SAAS,EAAC,cAAc,GAAG,CAAC,CAAC;QAClE,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACtD,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,MAAM,mBAAa,aAAa,GAAG,CAAC,CAAC;QACnE,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IconName } from '../icon/allowedIcons';
|
|
2
|
+
export declare enum BANNER_LEVEL {
|
|
3
|
+
INFO = "info",
|
|
4
|
+
NEUTRAL = "neutral",
|
|
5
|
+
WARNING = "warning",
|
|
6
|
+
DESTRUCTIVE = "destructive"
|
|
7
|
+
}
|
|
8
|
+
export type BannerProps = {
|
|
9
|
+
className?: string;
|
|
10
|
+
level?: BANNER_LEVEL;
|
|
11
|
+
icon?: IconName;
|
|
12
|
+
title?: string;
|
|
13
|
+
buttonText?: string;
|
|
14
|
+
buttonOnClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
text?: string;
|
|
16
|
+
hideIcon?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const Banner: (props: BannerProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=Banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../src/components/banner/Banner.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAG7D,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAoBF,eAAO,MAAM,MAAM,GAAI,OAAO,WAAW,4CAsCxC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { Button } from '../button/Button';
|
|
4
|
+
import { Icon } from '../icon/Icon';
|
|
5
|
+
export var BANNER_LEVEL;
|
|
6
|
+
(function (BANNER_LEVEL) {
|
|
7
|
+
BANNER_LEVEL["INFO"] = "info";
|
|
8
|
+
BANNER_LEVEL["NEUTRAL"] = "neutral";
|
|
9
|
+
BANNER_LEVEL["WARNING"] = "warning";
|
|
10
|
+
BANNER_LEVEL["DESTRUCTIVE"] = "destructive";
|
|
11
|
+
})(BANNER_LEVEL || (BANNER_LEVEL = {}));
|
|
12
|
+
const bannerClassName = cva(['ds-banner'], {
|
|
13
|
+
variants: {
|
|
14
|
+
level: {
|
|
15
|
+
[BANNER_LEVEL.INFO]: 'ds-banner--info',
|
|
16
|
+
[BANNER_LEVEL.NEUTRAL]: 'ds-banner--neutral',
|
|
17
|
+
[BANNER_LEVEL.WARNING]: 'ds-banner--warning',
|
|
18
|
+
[BANNER_LEVEL.DESTRUCTIVE]: 'ds-banner--destructive',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const DEFAULT_ICON_MAP = {
|
|
23
|
+
[BANNER_LEVEL.INFO]: 'info',
|
|
24
|
+
[BANNER_LEVEL.NEUTRAL]: 'info',
|
|
25
|
+
[BANNER_LEVEL.WARNING]: 'triangle-alert',
|
|
26
|
+
[BANNER_LEVEL.DESTRUCTIVE]: 'circle-alert',
|
|
27
|
+
};
|
|
28
|
+
export const Banner = (props) => {
|
|
29
|
+
const { className, level = BANNER_LEVEL.NEUTRAL, icon: rawIcon, hideIcon = false, title, buttonText, buttonOnClick, text, } = props;
|
|
30
|
+
const icon = hideIcon ? null : rawIcon ?? DEFAULT_ICON_MAP[level];
|
|
31
|
+
return (_jsxs("div", { className: bannerClassName({ level, className }), children: [icon && _jsx(Icon, { size: 24, name: icon }), _jsxs("div", { className: "ds-banner__central-container", children: [title && (_jsx("h3", { className: "ds-banner__title", children: title })), text && _jsx("span", { children: text })] }), buttonText && (_jsx(Button, { onClick: buttonOnClick, className: "ds-banner__button", variant: "text-link", children: buttonText }))] }));
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=Banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/components/banner/Banner.tsx"],"names":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,CAAC,KAAK,CAAC,CAAC;IAElE,OAAO,CACL,eACE,SAAS,EAAE,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,aAE/C,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,GAAI,EACvC,eAAK,SAAS,EAAC,8BAA8B,aAC1C,KAAK,IAAI,CACR,aAAI,SAAS,EAAC,kBAAkB,YAC7B,KAAK,GACH,CACN,EACA,IAAI,IAAI,yBAAO,IAAI,GAAQ,IACxB,EACL,UAAU,IAAI,CACb,KAAC,MAAM,IACL,OAAO,EAAE,aAAa,EACtB,SAAS,EAAC,mBAAmB,EAC7B,OAAO,EAAC,WAAW,YAElB,UAAU,GACJ,CACV,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { Banner, BANNER_LEVEL } from './Banner';
|
|
3
|
+
declare const meta: Meta<typeof Banner>;
|
|
4
|
+
export declare const Neutral: {
|
|
5
|
+
args: {
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const Info: {
|
|
10
|
+
args: {
|
|
11
|
+
level: BANNER_LEVEL;
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const Warning: {
|
|
16
|
+
args: {
|
|
17
|
+
level: BANNER_LEVEL;
|
|
18
|
+
text: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const Destructive: {
|
|
22
|
+
args: {
|
|
23
|
+
level: BANNER_LEVEL;
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const WithTitle: {
|
|
28
|
+
args: {
|
|
29
|
+
level: BANNER_LEVEL;
|
|
30
|
+
title: string;
|
|
31
|
+
text: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare const WithButton: {
|
|
35
|
+
args: {
|
|
36
|
+
level: BANNER_LEVEL;
|
|
37
|
+
text: string;
|
|
38
|
+
buttonText: string;
|
|
39
|
+
buttonOnClick: () => void;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const WithTitleAndButton: {
|
|
43
|
+
args: {
|
|
44
|
+
level: BANNER_LEVEL;
|
|
45
|
+
title: string;
|
|
46
|
+
text: string;
|
|
47
|
+
buttonText: string;
|
|
48
|
+
buttonOnClick: () => void;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare const TitleOnly: {
|
|
52
|
+
args: {
|
|
53
|
+
level: BANNER_LEVEL;
|
|
54
|
+
title: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare const CustomIcon: {
|
|
58
|
+
args: {
|
|
59
|
+
level: BANNER_LEVEL;
|
|
60
|
+
icon: string;
|
|
61
|
+
text: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const HideIcon: {
|
|
65
|
+
args: {
|
|
66
|
+
level: BANNER_LEVEL;
|
|
67
|
+
hideIcon: boolean;
|
|
68
|
+
text: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export default meta;
|
|
72
|
+
//# sourceMappingURL=Banner.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.stories.d.ts","sourceRoot":"","sources":["../../../src/components/banner/Banner.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAa7B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;CAInB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;CAKvB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;CAOtB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;CAQ9B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;CAMtB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Banner, BANNER_LEVEL } from './Banner';
|
|
2
|
+
const meta = {
|
|
3
|
+
tags: ['autodocs'],
|
|
4
|
+
title: 'Components/Banner',
|
|
5
|
+
component: Banner,
|
|
6
|
+
argTypes: {
|
|
7
|
+
level: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: Object.values(BANNER_LEVEL),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
buttonOnClick: () => { console.log('click!'); },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const Neutral = {
|
|
17
|
+
args: {
|
|
18
|
+
text: 'This is a neutral banner message with some useful information for the user.',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const Info = {
|
|
22
|
+
args: {
|
|
23
|
+
level: BANNER_LEVEL.INFO,
|
|
24
|
+
text: 'Your session will expire in 10 minutes. Save your work to avoid losing changes.',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const Warning = {
|
|
28
|
+
args: {
|
|
29
|
+
level: BANNER_LEVEL.WARNING,
|
|
30
|
+
text: 'This action may affect student records. Please review before proceeding.',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const Destructive = {
|
|
34
|
+
args: {
|
|
35
|
+
level: BANNER_LEVEL.DESTRUCTIVE,
|
|
36
|
+
text: 'Something went wrong. Please contact your system administrator.',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const WithTitle = {
|
|
40
|
+
args: {
|
|
41
|
+
level: BANNER_LEVEL.INFO,
|
|
42
|
+
title: 'Important Update',
|
|
43
|
+
text: 'A new version of the system is available. Refresh the page to apply updates.',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const WithButton = {
|
|
47
|
+
args: {
|
|
48
|
+
level: BANNER_LEVEL.WARNING,
|
|
49
|
+
text: 'You have unsaved changes that will be lost.',
|
|
50
|
+
buttonText: 'Undo changes',
|
|
51
|
+
buttonOnClick: () => { console.log('Banner button clicked'); },
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const WithTitleAndButton = {
|
|
55
|
+
args: {
|
|
56
|
+
level: BANNER_LEVEL.INFO,
|
|
57
|
+
title: 'Scheduled Maintenance',
|
|
58
|
+
text: 'The system will be unavailable on Saturday 1st March between 2am–4am.',
|
|
59
|
+
buttonText: 'Learn more',
|
|
60
|
+
buttonOnClick: () => { console.log('Banner button clicked'); },
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const TitleOnly = {
|
|
64
|
+
args: {
|
|
65
|
+
level: BANNER_LEVEL.NEUTRAL,
|
|
66
|
+
title: 'No results found for the selected filters.',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export const CustomIcon = {
|
|
70
|
+
args: {
|
|
71
|
+
level: BANNER_LEVEL.INFO,
|
|
72
|
+
icon: 'circle-check',
|
|
73
|
+
text: 'Your changes have been saved successfully.',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
export const HideIcon = {
|
|
77
|
+
args: {
|
|
78
|
+
level: BANNER_LEVEL.WARNING,
|
|
79
|
+
hideIcon: true,
|
|
80
|
+
text: 'This banner has its icon hidden.',
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
export default meta;
|
|
84
|
+
//# sourceMappingURL=Banner.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.stories.js","sourceRoot":"","sources":["../../../src/components/banner/Banner.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,IAAI,GAAwB;IAChC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;SACrC;KACF;IACD,IAAI,EAAE;QACJ,aAAa,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KAChD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,IAAI,EAAE,6EAA6E;KACpF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,IAAI;QACxB,IAAI,EAAE,iFAAiF;KACxF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,OAAO;QAC3B,IAAI,EAAE,0EAA0E;KACjF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,WAAW;QAC/B,IAAI,EAAE,iEAAiE;KACxE;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,IAAI;QACxB,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,8EAA8E;KACrF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,OAAO;QAC3B,IAAI,EAAE,6CAA6C;QACnD,UAAU,EAAE,cAAc;QAC1B,aAAa,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;KAC/D;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,IAAI;QACxB,KAAK,EAAE,uBAAuB;QAC9B,IAAI,EAAE,uEAAuE;QAC7E,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;KAC/D;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,OAAO;QAC3B,KAAK,EAAE,4CAA4C;KACpD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,IAAI;QACxB,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,4CAA4C;KACnD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC,OAAO;QAC3B,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,kCAAkC;KACzC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.test.d.ts","sourceRoot":"","sources":["../../../src/components/banner/Banner.test.tsx"],"names":[],"mappings":"AAEA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
3
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom/vitest';
|
|
5
|
+
import { Banner, BANNER_LEVEL } from './Banner';
|
|
6
|
+
describe('Banner', () => {
|
|
7
|
+
describe('text', () => {
|
|
8
|
+
test('renders text content', () => {
|
|
9
|
+
render(_jsx(Banner, { text: "Something important happened." }));
|
|
10
|
+
expect(screen.getByText('Something important happened.')).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
test('renders title', () => {
|
|
13
|
+
render(_jsx(Banner, { title: "Scheduled Maintenance" }));
|
|
14
|
+
expect(screen.getByRole('heading', { name: 'Scheduled Maintenance' })).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
test('does not render a heading when title is not provided', () => {
|
|
17
|
+
render(_jsx(Banner, { text: "No title here." }));
|
|
18
|
+
expect(screen.queryByRole('heading')).not.toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('level', () => {
|
|
22
|
+
test('applies neutral class by default', () => {
|
|
23
|
+
const { container } = render(_jsx(Banner, {}));
|
|
24
|
+
expect(container.firstChild).toHaveClass('ds-banner--neutral');
|
|
25
|
+
});
|
|
26
|
+
test.each(Object.values(BANNER_LEVEL))('applies correct class for level %s', (level) => {
|
|
27
|
+
const { container } = render(_jsx(Banner, { level: level }));
|
|
28
|
+
expect(container.firstChild).toHaveClass(`ds-banner--${level.toLowerCase()}`);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('icon', () => {
|
|
32
|
+
test('renders the default icon based on level', () => {
|
|
33
|
+
const { container } = render(_jsx(Banner, {}));
|
|
34
|
+
expect(container.querySelector('svg')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
test('renders a custom icon when icon prop is provided', () => {
|
|
37
|
+
const { container } = render(_jsx(Banner, { icon: "circle-check" }));
|
|
38
|
+
expect(container.querySelector('svg')).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
test('does not render an icon when hideIcon is true', () => {
|
|
41
|
+
const { container } = render(_jsx(Banner, { hideIcon: true }));
|
|
42
|
+
expect(container.querySelector('svg')).not.toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
test('does not render an icon when hideIcon is true even if icon prop is provided', () => {
|
|
45
|
+
const { container } = render(_jsx(Banner, { icon: "info", hideIcon: true }));
|
|
46
|
+
expect(container.querySelector('svg')).not.toBeInTheDocument();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe('button', () => {
|
|
50
|
+
test('renders a button when buttonText is provided', () => {
|
|
51
|
+
render(_jsx(Banner, { buttonText: "Learn more" }));
|
|
52
|
+
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
53
|
+
});
|
|
54
|
+
test('does not render a button when buttonText is not provided', () => {
|
|
55
|
+
render(_jsx(Banner, { text: "No button here." }));
|
|
56
|
+
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
test('calls buttonOnClick when button is clicked', () => {
|
|
59
|
+
const handleClick = vi.fn();
|
|
60
|
+
render(_jsx(Banner, { buttonText: "Learn more", buttonOnClick: handleClick }));
|
|
61
|
+
fireEvent.click(screen.getByRole('button'));
|
|
62
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('className', () => {
|
|
66
|
+
test('applies custom className', () => {
|
|
67
|
+
const { container } = render(_jsx(Banner, { className: "my-custom-class" }));
|
|
68
|
+
expect(container.firstChild).toHaveClass('my-custom-class');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=Banner.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.test.js","sourceRoot":"","sources":["../../../src/components/banner/Banner.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC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C,WAAW,EAAE,GAAG,EAAE;QACzB,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;YACpC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,MAAM,IAAC,SAAS,EAAC,iBAAiB,GAAG,CAAC,CAAC;YACrE,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -12,5 +12,7 @@ export declare const Dropdown: {
|
|
|
12
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
Item: (props: DropdownMenu.DropdownMenuItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
SelectItem: (props: import("./items/DropdownSelectItem").DropdowSelectItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
Separator: (props: DropdownMenu.DropdownMenuSeparatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Group: (props: DropdownMenu.DropdownMenuGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=Dropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAQxC,eAAO,MAAM,QAAQ;YAAW,YAAY,CAAC,iBAAiB;;;;;;;;;;;;;;CAO7D,CAAC"}
|
|
@@ -4,12 +4,16 @@ import { DropdownTrigger } from './DropdownTrigger';
|
|
|
4
4
|
import { DropdownContent } from './DropdownContent';
|
|
5
5
|
import { DropdownItem } from './items/DropdownItem';
|
|
6
6
|
import { DropdownSelectItem } from './items/DropdownSelectItem';
|
|
7
|
+
import { DropdownSeparator } from './items/DropdownSeparator';
|
|
8
|
+
import { DropdownGroup } from './items/DropdownGroup';
|
|
7
9
|
export const Dropdown = (props) => {
|
|
8
10
|
const { children, ...rest } = props;
|
|
9
|
-
return (_jsx(DropdownMenu.Root, { ...rest, children: children }));
|
|
11
|
+
return (_jsx(DropdownMenu.Root, { modal: false, ...rest, children: children }));
|
|
10
12
|
};
|
|
11
13
|
Dropdown.Trigger = DropdownTrigger;
|
|
12
14
|
Dropdown.Content = DropdownContent;
|
|
13
15
|
Dropdown.Item = DropdownItem;
|
|
14
16
|
Dropdown.SelectItem = DropdownSelectItem;
|
|
17
|
+
Dropdown.Separator = DropdownSeparator;
|
|
18
|
+
Dropdown.Group = DropdownGroup;
|
|
15
19
|
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAqC,EAAE,EAAE;IAChE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACpC,OAAO,CACL,KAAC,YAAY,CAAC,IAAI,IAAC,KAAK,EAAE,KAAK,KAAM,IAAI,YACtC,QAAQ,GACS,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,OAAO,GAAG,eAAe,CAAC;AACnC,QAAQ,CAAC,OAAO,GAAG,eAAe,CAAC;AACnC,QAAQ,CAAC,IAAI,GAAG,YAAY,CAAC;AAC7B,QAAQ,CAAC,UAAU,GAAG,kBAAkB,CAAC;AACzC,QAAQ,CAAC,SAAS,GAAG,iBAAiB,CAAC;AACvC,QAAQ,CAAC,KAAK,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/items/DropdownGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,eAAO,MAAM,aAAa,GAAI,OAAO,YAAY,CAAC,sBAAsB,4CAOvE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DropdownMenu } from 'radix-ui';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
export const DropdownGroup = (props) => {
|
|
5
|
+
const { children, className = '', ...rest } = props;
|
|
6
|
+
return (_jsx(DropdownMenu.Group, { className: classNames('ds-dropdown__group', className), ...rest, children: children }));
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=DropdownGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownGroup.js","sourceRoot":"","sources":["../../../../src/components/dropdown/items/DropdownGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAA0C,EAAE,EAAE;IAC1E,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACpD,OAAO,CACL,KAAC,YAAY,CAAC,KAAK,IAAC,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,KAAM,IAAI,YACjF,QAAQ,GACU,CACtB,CAAC;AACJ,CAAC,CAAC"}
|