@goodhood-web/ui 0.0.4 → 0.0.5
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/{src/index.ts → index.d.ts} +1 -24
- package/index.js +48 -0
- package/index.mjs +2331 -0
- package/lib/BaseButton/BaseButton.d.ts +11 -0
- package/lib/Card/Card.d.ts +3 -0
- package/lib/Card/Card.types.d.ts +10 -0
- package/lib/Card/Card.utils.d.ts +3 -0
- package/lib/Card/CardBody/CardBody.d.ts +3 -0
- package/lib/Card/CardBody/CardBody.types.d.ts +5 -0
- package/lib/Card/CardHeader/CardHeader.d.ts +3 -0
- package/lib/Card/CardHeader/CardHeader.type.d.ts +10 -0
- package/lib/ContentCreatorButton/ContentCreatorButton.d.ts +3 -0
- package/{src/lib/ContentCreatorButton/ContentCreatorButton.types.ts → lib/ContentCreatorButton/ContentCreatorButton.types.d.ts} +2 -3
- package/lib/Divider/Divider.d.ts +3 -0
- package/lib/Divider/Divider.types.d.ts +6 -0
- package/lib/Fieldset/Fieldset.d.ts +3 -0
- package/lib/Fieldset/Fieldset.types.d.ts +8 -0
- package/lib/Form/Form.d.ts +3 -0
- package/lib/Form/Form.types.d.ts +10 -0
- package/lib/Icon/Icon.d.ts +4 -0
- package/lib/Icon/Icon.types.d.ts +18 -0
- package/lib/Icon/icons/24x24/index.d.ts +130 -0
- package/lib/Icon/icons/32x32/index.d.ts +265 -0
- package/lib/Icon/icons/index.d.ts +395 -0
- package/lib/IconButton/IconButton.d.ts +3 -0
- package/{src/lib/IconButton/IconButton.types.ts → lib/IconButton/IconButton.types.d.ts} +10 -10
- package/lib/IconButton/utils.d.ts +3 -0
- package/lib/Image/Image.d.ts +3 -0
- package/lib/Image/Image.type.d.ts +5 -0
- package/lib/LabelPill/LabelPill.d.ts +3 -0
- package/lib/LabelPill/LabelPill.types.d.ts +4 -0
- package/lib/Legend/Legend.d.ts +3 -0
- package/lib/Legend/Legend.types.d.ts +5 -0
- package/lib/MenuItem/MenuItem.d.ts +3 -0
- package/lib/MenuItem/MenuItem.types.d.ts +9 -0
- package/lib/NotificationBubble/NotificationBubble.d.ts +3 -0
- package/{src/lib/NotificationBubble/NotificationBubble.types.tsx → lib/NotificationBubble/NotificationBubble.types.d.ts} +2 -3
- package/lib/Thumbnail/Thumbnail.d.ts +3 -0
- package/{src/lib/Thumbnail/Thumbnail.type.tsx → lib/Thumbnail/Thumbnail.type.d.ts} +6 -9
- package/lib/Toggle/Toggle.d.ts +3 -0
- package/{src/lib/Toggle/Toggle.types.ts → lib/Toggle/Toggle.types.d.ts} +2 -3
- package/lib/ToggleInput/ToggleInput.d.ts +3 -0
- package/{src/lib/ToggleInput/ToggleInput.types.ts → lib/ToggleInput/ToggleInput.types.d.ts} +3 -5
- package/lib/Typography/Typography.d.ts +3 -0
- package/lib/Typography/Typography.types.d.ts +8 -0
- package/package.json +1 -1
- package/style.css +1 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -25
- package/.storybook/main.ts +0 -31
- package/.storybook/manager-head.html +0 -1
- package/.storybook/manager.ts +0 -7
- package/.storybook/nebenanTheme.ts +0 -17
- package/.storybook/preview.ts +0 -9
- package/.stylelintrc.json +0 -14
- package/README.md +0 -7
- package/__mocks__/svg.js +0 -2
- package/images/favicon.ico +0 -0
- package/images/logo.svg +0 -11
- package/jest.config.ts +0 -16
- package/project.json +0 -88
- package/src/lib/BaseButton/BaseButton.module.scss +0 -11
- package/src/lib/BaseButton/BaseButton.spec.tsx +0 -12
- package/src/lib/BaseButton/BaseButton.stories.tsx +0 -26
- package/src/lib/BaseButton/BaseButton.tsx +0 -39
- package/src/lib/Card/Card.module.scss +0 -15
- package/src/lib/Card/Card.spec.tsx +0 -15
- package/src/lib/Card/Card.stories.tsx +0 -159
- package/src/lib/Card/Card.tsx +0 -31
- package/src/lib/Card/Card.types.ts +0 -12
- package/src/lib/Card/Card.utils.spec.tsx +0 -51
- package/src/lib/Card/Card.utils.ts +0 -23
- package/src/lib/Card/CardBody/CardBody.module.scss +0 -4
- package/src/lib/Card/CardBody/CardBody.spec.tsx +0 -15
- package/src/lib/Card/CardBody/CardBody.stories.tsx +0 -108
- package/src/lib/Card/CardBody/CardBody.tsx +0 -9
- package/src/lib/Card/CardBody/CardBody.types.ts +0 -4
- package/src/lib/Card/CardHeader/CardHeader.module.scss +0 -12
- package/src/lib/Card/CardHeader/CardHeader.spec.tsx +0 -72
- package/src/lib/Card/CardHeader/CardHeader.stories.tsx +0 -77
- package/src/lib/Card/CardHeader/CardHeader.tsx +0 -29
- package/src/lib/Card/CardHeader/CardHeader.type.ts +0 -14
- package/src/lib/ContentCreatorButton/ContentCreatorButton.module.scss +0 -13
- package/src/lib/ContentCreatorButton/ContentCreatorButton.spec.tsx +0 -14
- package/src/lib/ContentCreatorButton/ContentCreatorButton.stories.tsx +0 -29
- package/src/lib/ContentCreatorButton/ContentCreatorButton.tsx +0 -35
- package/src/lib/Divider/Divider.module.scss +0 -10
- package/src/lib/Divider/Divider.spec.tsx +0 -46
- package/src/lib/Divider/Divider.stories.tsx +0 -35
- package/src/lib/Divider/Divider.tsx +0 -17
- package/src/lib/Divider/Divider.types.ts +0 -6
- package/src/lib/Fieldset/Fieldset.module.scss +0 -3
- package/src/lib/Fieldset/Fieldset.spec.tsx +0 -68
- package/src/lib/Fieldset/Fieldset.stories.tsx +0 -60
- package/src/lib/Fieldset/Fieldset.tsx +0 -28
- package/src/lib/Fieldset/Fieldset.types.ts +0 -7
- package/src/lib/Form/Form.spec.tsx +0 -15
- package/src/lib/Form/Form.stories.tsx +0 -53
- package/src/lib/Form/Form.tsx +0 -14
- package/src/lib/Form/Form.types.ts +0 -11
- package/src/lib/Icon/Icon.module.scss +0 -7
- package/src/lib/Icon/Icon.spec.tsx +0 -28
- package/src/lib/Icon/Icon.stories.tsx +0 -88
- package/src/lib/Icon/Icon.tsx +0 -29
- package/src/lib/Icon/Icon.types.ts +0 -23
- package/src/lib/Icon/icons/24x24/index.ts +0 -89
- package/src/lib/Icon/icons/24x24/svg/arrow_left.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/arrow_right.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/bookmark.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/bookmarked.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/burger_menu.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/camera.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/checkmark.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/checkmark_circle.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_down.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_left.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_right.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/chevron_up.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/comment_bubble.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/cross.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/cross_circle.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/envelope.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/event_calendar.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/external_link.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/eye.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/eye_crossed.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/filter.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/globe.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/heart.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/image.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/loudspeaker.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/marketplace.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/more_dots.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/more_dots_alt.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/mute.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/notification_bell.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/paperclip.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/pencil.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/pin.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/plus.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/plus_circle.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/privacy_lock.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/search.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/share_arrow.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/share_arrow_outline.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/sort.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/thanks.svg +0 -1
- package/src/lib/Icon/icons/24x24/svg/trash_can.svg +0 -1
- package/src/lib/Icon/icons/32x32/index.ts +0 -179
- package/src/lib/Icon/icons/32x32/svg/address_book.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/baby_toy.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bicycle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bookmark.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/books.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bubble_heart_filled.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/bubble_heart_outline.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/buildings.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/burger_menu.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/business.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/business_profile.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/camera.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/camera_crossed.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/car.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/carrot.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/chat.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/checkmark_circle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/christmas_tree.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/clipboard.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/clothing.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/cocktail.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/comment_bubble.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/compass.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/computer.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/couch.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/credit_card.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/cross_circle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/cutlery.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/drill_tool.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/email.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/envelope.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/event_calendar_check.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/event_calendar_date.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/event_calendar_plus.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/exchange.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/eye.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/eye_crossed.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/gift.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/group.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/healthcare.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/heart.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/house.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/image.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/info.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/invite_neighbour.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/key.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/kitchen_pot.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/list.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/log_out.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/loudspeaker.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/map.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/marketplace.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/miscellaneous_other.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/more_dots.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/more_dots_alt.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/music.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/nebenan.de.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/neighbour.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/notification_bell.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/organisation.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paper_form_empty.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paper_form_filled.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paperclip.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/paw.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/pencil.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/pin.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/pins.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/plant.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/plus.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/plus_circle.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/post.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/privacy_lock.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/qr_code.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/search.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/settings_cog.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/shopping_bag.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/shopping_cart.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/special_place.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/suitcase.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/supporter.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/tennis_ball.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/thanks.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/trash_can.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/truck.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/user.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/user_profile.svg +0 -1
- package/src/lib/Icon/icons/32x32/svg/wellness.svg +0 -1
- package/src/lib/Icon/icons/index.ts +0 -9
- package/src/lib/IconButton/IconButton.module.scss +0 -36
- package/src/lib/IconButton/IconButton.spec.tsx +0 -56
- package/src/lib/IconButton/IconButton.stories.tsx +0 -36
- package/src/lib/IconButton/IconButton.tsx +0 -25
- package/src/lib/IconButton/utils.ts +0 -6
- package/src/lib/Image/Image.spec.tsx +0 -10
- package/src/lib/Image/Image.tsx +0 -7
- package/src/lib/Image/Image.type.tsx +0 -5
- package/src/lib/LabelPill/LabelPill.module.scss +0 -33
- package/src/lib/LabelPill/LabelPill.spec.tsx +0 -23
- package/src/lib/LabelPill/LabelPill.stories.tsx +0 -31
- package/src/lib/LabelPill/LabelPill.tsx +0 -16
- package/src/lib/LabelPill/LabelPill.types.ts +0 -4
- package/src/lib/Legend/Legend.module.scss +0 -9
- package/src/lib/Legend/Legend.spec.tsx +0 -39
- package/src/lib/Legend/Legend.stories.ts +0 -39
- package/src/lib/Legend/Legend.tsx +0 -19
- package/src/lib/Legend/Legend.types.ts +0 -5
- package/src/lib/MenuItem/MenuItem.module.scss +0 -70
- package/src/lib/MenuItem/MenuItem.spec.tsx +0 -47
- package/src/lib/MenuItem/MenuItem.stories.tsx +0 -97
- package/src/lib/MenuItem/MenuItem.tsx +0 -34
- package/src/lib/MenuItem/MenuItem.types.ts +0 -10
- package/src/lib/NotificationBubble/NotificationBubble.module.scss +0 -30
- package/src/lib/NotificationBubble/NotificationBubble.spec.tsx +0 -36
- package/src/lib/NotificationBubble/NotificationBubble.stories.tsx +0 -56
- package/src/lib/NotificationBubble/NotificationBubble.tsx +0 -34
- package/src/lib/Thumbnail/Thumbnail.module.scss +0 -67
- package/src/lib/Thumbnail/Thumbnail.spec.tsx +0 -51
- package/src/lib/Thumbnail/Thumbnail.stories.tsx +0 -242
- package/src/lib/Thumbnail/Thumbnail.tsx +0 -28
- package/src/lib/Toggle/Toggle.module.scss +0 -53
- package/src/lib/Toggle/Toggle.spec.tsx +0 -23
- package/src/lib/Toggle/Toggle.stories.tsx +0 -38
- package/src/lib/Toggle/Toggle.tsx +0 -32
- package/src/lib/ToggleInput/ToggleInput.module.scss +0 -33
- package/src/lib/ToggleInput/ToggleInput.spec.tsx +0 -45
- package/src/lib/ToggleInput/ToggleInput.stories.tsx +0 -62
- package/src/lib/ToggleInput/ToggleInput.tsx +0 -40
- package/src/lib/Typography/Typography.module.scss +0 -61
- package/src/lib/Typography/Typography.spec.tsx +0 -60
- package/src/lib/Typography/Typography.stories.tsx +0 -45
- package/src/lib/Typography/Typography.tsx +0 -26
- package/src/lib/Typography/Typography.types.ts +0 -28
- package/src/styles/_design-tokens.scss +0 -1
- package/src/styles/_fonts.scss +0 -0
- package/src/styles/_functions.scss +0 -17
- package/src/styles/_mixins.scss +0 -33
- package/src/styles/index.scss +0 -3
- package/src/styles/reset.scss +0 -65
- package/tsconfig.json +0 -24
- package/tsconfig.lib.json +0 -35
- package/tsconfig.spec.json +0 -20
- package/tsconfig.storybook.json +0 -31
- package/vite.config.ts +0 -57
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.bubbleContent {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: inline-block;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.bubble {
|
|
7
|
-
position: absolute;
|
|
8
|
-
z-index: auto;
|
|
9
|
-
top: 6px;
|
|
10
|
-
right: 6px;
|
|
11
|
-
display: flex;
|
|
12
|
-
width: 20px;
|
|
13
|
-
height: 20px;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
border-radius: 50%;
|
|
17
|
-
background-color: getSemanticColor(highlight, highlight);
|
|
18
|
-
color: getSemanticColor(highlight, onHighlight);
|
|
19
|
-
font-size: 12px;
|
|
20
|
-
font-weight: bold;
|
|
21
|
-
text-align: center;
|
|
22
|
-
transform: translate(50%, -50%);
|
|
23
|
-
transform-origin: 100% 0;
|
|
24
|
-
white-space: nowrap;
|
|
25
|
-
|
|
26
|
-
&--empty {
|
|
27
|
-
width: 12px;
|
|
28
|
-
height: 12px;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import NotificationBubble from './NotificationBubble';
|
|
6
|
-
import { NotificationBubbleProps } from './NotificationBubble.types';
|
|
7
|
-
|
|
8
|
-
describe('NotificationBubble', () => {
|
|
9
|
-
it('renders the bubble with a value', () => {
|
|
10
|
-
const props: NotificationBubbleProps = {
|
|
11
|
-
ariaLabel: 'Notification Bubble',
|
|
12
|
-
value: 5,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
render(<NotificationBubble {...props}>Content</NotificationBubble>);
|
|
16
|
-
|
|
17
|
-
const bubble = screen.getByRole('status', { name: 'Notification Bubble' });
|
|
18
|
-
const badge = screen.getByText('5');
|
|
19
|
-
expect(bubble).toBeInTheDocument();
|
|
20
|
-
expect(badge).toBeInTheDocument();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('renders the bubble without a value', () => {
|
|
24
|
-
const props: NotificationBubbleProps = {
|
|
25
|
-
ariaLabel: 'Notification Bubble',
|
|
26
|
-
value: undefined,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
render(<NotificationBubble {...props}>Content</NotificationBubble>);
|
|
30
|
-
|
|
31
|
-
const bubble = screen.getByRole('status', { name: 'Notification Bubble' });
|
|
32
|
-
const badge = screen.queryByText('0'); // Modify this to match the expected behavior
|
|
33
|
-
expect(bubble).toBeInTheDocument();
|
|
34
|
-
expect(badge).toBeNull(); // Check that badge is not present
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import BaseButton from '../BaseButton/BaseButton';
|
|
4
|
-
import Icon from '../Icon/Icon';
|
|
5
|
-
|
|
6
|
-
import NotificationBubble from './NotificationBubble';
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof NotificationBubble> = {
|
|
9
|
-
argTypes: {
|
|
10
|
-
children: {
|
|
11
|
-
control: { type: 'select' },
|
|
12
|
-
mapping: {
|
|
13
|
-
Button: (
|
|
14
|
-
<BaseButton
|
|
15
|
-
onClick={() => {
|
|
16
|
-
// do nothing
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
Button
|
|
20
|
-
</BaseButton>
|
|
21
|
-
),
|
|
22
|
-
Icon: <Icon name="envelope" size="32" />,
|
|
23
|
-
},
|
|
24
|
-
// TODO replace with actual use case from our new design system (Icon etc)
|
|
25
|
-
options: ['Icon', 'Button'],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
children: 'Icon',
|
|
30
|
-
},
|
|
31
|
-
component: NotificationBubble,
|
|
32
|
-
parameters: {
|
|
33
|
-
design: {
|
|
34
|
-
type: 'figma',
|
|
35
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?type=design&node-id=237-3029&mode=design',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
title: 'Components/NotificationBubble',
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default meta;
|
|
42
|
-
|
|
43
|
-
type Story = StoryObj<typeof NotificationBubble>;
|
|
44
|
-
|
|
45
|
-
export const Primary: Story = {
|
|
46
|
-
args: {
|
|
47
|
-
ariaLabel: '5 new messages',
|
|
48
|
-
value: 5,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const Empty: Story = {
|
|
53
|
-
args: {
|
|
54
|
-
ariaLabel: 'Messages',
|
|
55
|
-
},
|
|
56
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Badge } from '@mui/base';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './NotificationBubble.module.scss';
|
|
5
|
-
import { NotificationBubbleProps } from './NotificationBubble.types';
|
|
6
|
-
|
|
7
|
-
const MAX_COUNT = 9;
|
|
8
|
-
|
|
9
|
-
const NotificationBubble = (props: NotificationBubbleProps) => {
|
|
10
|
-
const { ariaLabel, children, value } = props;
|
|
11
|
-
|
|
12
|
-
const displayValue = value && value < 0 ? 0 : value;
|
|
13
|
-
const classes = clsx(
|
|
14
|
-
{
|
|
15
|
-
[styles['bubble--empty']]: displayValue === undefined,
|
|
16
|
-
},
|
|
17
|
-
styles.bubble,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Badge
|
|
22
|
-
badgeContent={displayValue}
|
|
23
|
-
className={styles.bubbleContent}
|
|
24
|
-
max={MAX_COUNT}
|
|
25
|
-
slotProps={{ badge: { className: classes } }}
|
|
26
|
-
aria-label={ariaLabel}
|
|
27
|
-
role="status"
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</Badge>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default NotificationBubble;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Replace this with your own classes
|
|
3
|
-
*
|
|
4
|
-
* e.g.
|
|
5
|
-
* .container {
|
|
6
|
-
* }
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
@mixin setSizes {
|
|
10
|
-
$sizes: (24, 28, 32, 40, 48, 56, 64, 80, 120, 280);
|
|
11
|
-
|
|
12
|
-
@each $size in $sizes {
|
|
13
|
-
&--#{$size} {
|
|
14
|
-
width: #{$size}px;
|
|
15
|
-
height: #{$size}px;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.root {
|
|
21
|
-
@include setSizes;
|
|
22
|
-
position: relative;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
border: solid 1px getSemanticColor('outline', 'outlineVariant');
|
|
25
|
-
background-color: getSemanticColor('outline', 'outlineVariant');
|
|
26
|
-
|
|
27
|
-
&--square {
|
|
28
|
-
&.root--24,
|
|
29
|
-
&.root--32 {
|
|
30
|
-
border-radius: getBorderRadius('xs');
|
|
31
|
-
}
|
|
32
|
-
&.root--40,
|
|
33
|
-
&.root--48 {
|
|
34
|
-
border-radius: getBorderRadius('sm');
|
|
35
|
-
}
|
|
36
|
-
&.root--56,
|
|
37
|
-
&.root--64 {
|
|
38
|
-
border-radius: getBorderRadius('md');
|
|
39
|
-
}
|
|
40
|
-
&.root--80,
|
|
41
|
-
&.root--120 {
|
|
42
|
-
border-radius: getBorderRadius('lg');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&--circular {
|
|
47
|
-
border-radius: 50%;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&--isPlaceholder {
|
|
51
|
-
&::before {
|
|
52
|
-
position: absolute;
|
|
53
|
-
z-index: 1;
|
|
54
|
-
width: 100%;
|
|
55
|
-
height: 100%;
|
|
56
|
-
background-color: getSemanticColor('outline', 'outlineVariant');
|
|
57
|
-
content: '';
|
|
58
|
-
opacity: 0.4;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
img {
|
|
63
|
-
width: 100%;
|
|
64
|
-
height: 100%;
|
|
65
|
-
object-fit: cover;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import Thumbnail from './Thumbnail';
|
|
5
|
-
import { ThumbnailCircularProps, ThumbnailSquareProps } from './Thumbnail.type';
|
|
6
|
-
|
|
7
|
-
describe('Thumbnail component', () => {
|
|
8
|
-
it('renders a valid circular thumbnail', () => {
|
|
9
|
-
const circularProps = {
|
|
10
|
-
alt: 'Test Image',
|
|
11
|
-
shape: 'circular',
|
|
12
|
-
size: '40',
|
|
13
|
-
src: 'test.jpg',
|
|
14
|
-
};
|
|
15
|
-
const { container } = render(
|
|
16
|
-
<Thumbnail {...(circularProps as ThumbnailCircularProps)} />,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const thumbnail = container.querySelector('.root--circular');
|
|
20
|
-
expect(thumbnail).toBeInTheDocument();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('renders a valid square thumbnail', () => {
|
|
24
|
-
const squareProps = {
|
|
25
|
-
alt: 'Test Image',
|
|
26
|
-
shape: 'square',
|
|
27
|
-
size: '40',
|
|
28
|
-
src: 'test.jpg',
|
|
29
|
-
};
|
|
30
|
-
const { container } = render(
|
|
31
|
-
<Thumbnail {...(squareProps as ThumbnailSquareProps)} />,
|
|
32
|
-
);
|
|
33
|
-
const thumbnail = container.querySelector('.root--square');
|
|
34
|
-
expect(thumbnail).toBeInTheDocument();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('does not display image when src is not provided', () => {
|
|
38
|
-
const circularEmptySrcProps = {
|
|
39
|
-
alt: 'Test Image',
|
|
40
|
-
shape: 'circular',
|
|
41
|
-
size: '24',
|
|
42
|
-
src: '',
|
|
43
|
-
};
|
|
44
|
-
const { queryByAltText } = render(
|
|
45
|
-
<Thumbnail {...(circularEmptySrcProps as ThumbnailSquareProps)} />,
|
|
46
|
-
);
|
|
47
|
-
expect(queryByAltText('Test Image')).not.toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// Add more test cases for different scenarios
|
|
51
|
-
});
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import Thumbnail from './Thumbnail';
|
|
4
|
-
import { TCircularSize, TSquareSize } from './Thumbnail.type';
|
|
5
|
-
|
|
6
|
-
const circularSizes = ['28', '32', '40', '48', '56', '80', '120', '280'];
|
|
7
|
-
const squareSizes = ['24', '32', '40', '48', '56', '64', '80', '120'];
|
|
8
|
-
const imgSrc = 'https://placekitten.com/640/360';
|
|
9
|
-
const meta: Meta<typeof Thumbnail> = {
|
|
10
|
-
component: Thumbnail,
|
|
11
|
-
title: 'Components/Thumbnail',
|
|
12
|
-
};
|
|
13
|
-
export default meta;
|
|
14
|
-
|
|
15
|
-
type Story = StoryObj<typeof Thumbnail>;
|
|
16
|
-
|
|
17
|
-
export const Primary: Story = {
|
|
18
|
-
argTypes: {
|
|
19
|
-
alt: {
|
|
20
|
-
description:
|
|
21
|
-
'The "alt" attribute provides descriptive text for an image, ensuring accessibility by offering an alternative description.',
|
|
22
|
-
},
|
|
23
|
-
isPlaceholder: {
|
|
24
|
-
active: { control: 'boolean' },
|
|
25
|
-
defaultValue: { summary: false },
|
|
26
|
-
description:
|
|
27
|
-
'The isPlaceholder property is used to add a background color overlay to the component, indicating they are temporary.',
|
|
28
|
-
},
|
|
29
|
-
shape: {
|
|
30
|
-
control: { type: 'radio' },
|
|
31
|
-
description:
|
|
32
|
-
'The "shape" property defines the component\'s visual form, with options "circular" or "square."',
|
|
33
|
-
options: ['circular', 'square'],
|
|
34
|
-
},
|
|
35
|
-
size: {
|
|
36
|
-
control: {
|
|
37
|
-
readonly: true,
|
|
38
|
-
type: 'string',
|
|
39
|
-
},
|
|
40
|
-
description:
|
|
41
|
-
'To view the available sizes, please refer to the individual stories that showcase the shape variations.',
|
|
42
|
-
},
|
|
43
|
-
src: {
|
|
44
|
-
description:
|
|
45
|
-
'The "src" attribute specifies the image source, indicating the location from which the image is loaded.',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
args: {
|
|
49
|
-
alt: 'component image',
|
|
50
|
-
isPlaceholder: false,
|
|
51
|
-
shape: 'circular',
|
|
52
|
-
size: '80',
|
|
53
|
-
src: imgSrc,
|
|
54
|
-
},
|
|
55
|
-
parameters: {
|
|
56
|
-
design: {
|
|
57
|
-
type: 'figma',
|
|
58
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?type=design&node-id=116-2637&mode=design&t=0zWTONm1DR992lT9-0',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const Circular: Story = {
|
|
64
|
-
argTypes: {
|
|
65
|
-
alt: {
|
|
66
|
-
control: { readonly: true, type: 'string' },
|
|
67
|
-
},
|
|
68
|
-
isPlaceholder: {
|
|
69
|
-
control: { readonly: true, type: 'string' },
|
|
70
|
-
},
|
|
71
|
-
shape: {
|
|
72
|
-
control: { readonly: true, type: 'string' },
|
|
73
|
-
description: 'circular',
|
|
74
|
-
},
|
|
75
|
-
size: {
|
|
76
|
-
control: {
|
|
77
|
-
type: 'select',
|
|
78
|
-
},
|
|
79
|
-
description: `The size property allows you to choose from predefined options like
|
|
80
|
-
"28", "32", "40", "48", "56", "80", "120" or "280" to specify the element's dimensions or scale in pixels (px).`,
|
|
81
|
-
options: circularSizes,
|
|
82
|
-
},
|
|
83
|
-
src: {
|
|
84
|
-
control: { readonly: true, type: 'string' },
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
args: {
|
|
88
|
-
shape: 'circular',
|
|
89
|
-
size: '48',
|
|
90
|
-
src: imgSrc,
|
|
91
|
-
},
|
|
92
|
-
parameters: {
|
|
93
|
-
a11y: {
|
|
94
|
-
disable: true,
|
|
95
|
-
},
|
|
96
|
-
actions: {
|
|
97
|
-
disable: true,
|
|
98
|
-
},
|
|
99
|
-
design: {
|
|
100
|
-
type: 'figma',
|
|
101
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?node-id=116%3A2649&mode=dev',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
render: (args) => (
|
|
105
|
-
<div
|
|
106
|
-
style={{
|
|
107
|
-
display: 'flex',
|
|
108
|
-
flexWrap: 'wrap',
|
|
109
|
-
gap: '32px',
|
|
110
|
-
justifyContent: 'space-between',
|
|
111
|
-
}}
|
|
112
|
-
>
|
|
113
|
-
<div style={{ display: 'flex', height: '280px', width: '280px' }}>
|
|
114
|
-
<Thumbnail
|
|
115
|
-
shape="circular"
|
|
116
|
-
src={imgSrc}
|
|
117
|
-
size={args?.size as TCircularSize}
|
|
118
|
-
alt=""
|
|
119
|
-
/>
|
|
120
|
-
</div>
|
|
121
|
-
<div
|
|
122
|
-
style={{
|
|
123
|
-
alignItems: 'start',
|
|
124
|
-
display: 'flex',
|
|
125
|
-
flexWrap: 'wrap',
|
|
126
|
-
gap: '16px',
|
|
127
|
-
justifyContent: 'center',
|
|
128
|
-
}}
|
|
129
|
-
>
|
|
130
|
-
{circularSizes.map((size) => {
|
|
131
|
-
return (
|
|
132
|
-
<div
|
|
133
|
-
key={size}
|
|
134
|
-
style={{
|
|
135
|
-
alignItems: 'center',
|
|
136
|
-
display: 'flex',
|
|
137
|
-
flexDirection: 'column',
|
|
138
|
-
justifyContent: 'center',
|
|
139
|
-
}}
|
|
140
|
-
>
|
|
141
|
-
<h2>{size}</h2>
|
|
142
|
-
<Thumbnail
|
|
143
|
-
shape="circular"
|
|
144
|
-
src={imgSrc}
|
|
145
|
-
size={`${size}` as TCircularSize}
|
|
146
|
-
alt={size}
|
|
147
|
-
/>
|
|
148
|
-
</div>
|
|
149
|
-
);
|
|
150
|
-
})}
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
),
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export const Square: Story = {
|
|
157
|
-
argTypes: {
|
|
158
|
-
alt: {
|
|
159
|
-
control: { readonly: true, type: 'string' },
|
|
160
|
-
},
|
|
161
|
-
isPlaceholder: {
|
|
162
|
-
control: { readonly: true, type: 'string' },
|
|
163
|
-
},
|
|
164
|
-
shape: {
|
|
165
|
-
control: { readonly: true, type: 'string' },
|
|
166
|
-
description: 'square',
|
|
167
|
-
},
|
|
168
|
-
size: {
|
|
169
|
-
control: {
|
|
170
|
-
type: 'select',
|
|
171
|
-
},
|
|
172
|
-
description: `The size property allows you to choose from predefined options like
|
|
173
|
-
"24", "32", "40", "48", "56", "64", "80" or "120" to specify the element's dimensions or scale in pixels (px).`,
|
|
174
|
-
options: squareSizes,
|
|
175
|
-
},
|
|
176
|
-
src: {
|
|
177
|
-
control: { readonly: true, type: 'string' },
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
args: {
|
|
181
|
-
shape: 'square',
|
|
182
|
-
size: '48',
|
|
183
|
-
src: imgSrc,
|
|
184
|
-
},
|
|
185
|
-
parameters: {
|
|
186
|
-
a11y: {
|
|
187
|
-
disable: true,
|
|
188
|
-
},
|
|
189
|
-
actions: {
|
|
190
|
-
disable: true,
|
|
191
|
-
},
|
|
192
|
-
design: {
|
|
193
|
-
type: 'figma',
|
|
194
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?type=design&node-id=119-2453&mode=design&t=tRDkebYkaf8rn7Vz-0',
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
render: (args) => (
|
|
198
|
-
<div
|
|
199
|
-
style={{
|
|
200
|
-
display: 'flex',
|
|
201
|
-
flexWrap: 'wrap',
|
|
202
|
-
gap: '32px',
|
|
203
|
-
justifyContent: 'space-between',
|
|
204
|
-
}}
|
|
205
|
-
>
|
|
206
|
-
<div style={{ display: 'flex', height: '120px', width: '120px' }}>
|
|
207
|
-
<Thumbnail shape="square" src={imgSrc} size={args?.size as TSquareSize} alt="" />
|
|
208
|
-
</div>
|
|
209
|
-
<div
|
|
210
|
-
style={{
|
|
211
|
-
alignItems: 'start',
|
|
212
|
-
display: 'flex',
|
|
213
|
-
flexWrap: 'wrap',
|
|
214
|
-
gap: '16px',
|
|
215
|
-
justifyContent: 'center',
|
|
216
|
-
}}
|
|
217
|
-
>
|
|
218
|
-
{squareSizes.map((size) => {
|
|
219
|
-
return (
|
|
220
|
-
<div
|
|
221
|
-
key={size}
|
|
222
|
-
style={{
|
|
223
|
-
alignItems: 'center',
|
|
224
|
-
display: 'flex',
|
|
225
|
-
flexDirection: 'column',
|
|
226
|
-
justifyContent: 'center',
|
|
227
|
-
}}
|
|
228
|
-
>
|
|
229
|
-
<h2>{size}</h2>
|
|
230
|
-
<Thumbnail
|
|
231
|
-
shape="square"
|
|
232
|
-
src={imgSrc}
|
|
233
|
-
size={`${size}` as TSquareSize}
|
|
234
|
-
alt={size}
|
|
235
|
-
/>
|
|
236
|
-
</div>
|
|
237
|
-
);
|
|
238
|
-
})}
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
),
|
|
242
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
|
|
3
|
-
import Image from '../Image/Image';
|
|
4
|
-
|
|
5
|
-
import styles from './Thumbnail.module.scss';
|
|
6
|
-
import { ThumbnailCircularProps, ThumbnailSquareProps } from './Thumbnail.type';
|
|
7
|
-
|
|
8
|
-
const Thumbnail = ({
|
|
9
|
-
alt,
|
|
10
|
-
isPlaceholder,
|
|
11
|
-
shape,
|
|
12
|
-
size,
|
|
13
|
-
src,
|
|
14
|
-
}: ThumbnailCircularProps | ThumbnailSquareProps) => {
|
|
15
|
-
const thumbnailIsPlaceholder = styles['root--isPlaceholder'];
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
className={clsx(styles.root, styles[`root--${size}`], styles[`root--${shape}`], {
|
|
20
|
-
[thumbnailIsPlaceholder]: isPlaceholder,
|
|
21
|
-
})}
|
|
22
|
-
>
|
|
23
|
-
{src && <Image src={src} alt={alt} />}
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default Thumbnail;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
.switch {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: inline-block;
|
|
4
|
-
width: 48px;
|
|
5
|
-
height: 28px;
|
|
6
|
-
|
|
7
|
-
input {
|
|
8
|
-
position: absolute;
|
|
9
|
-
z-index: 2;
|
|
10
|
-
width: 48px;
|
|
11
|
-
height: 28px;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
opacity: 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.slider {
|
|
17
|
-
z-index: 1;
|
|
18
|
-
display: block;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
border-radius: 34px;
|
|
22
|
-
background-color: getSemanticColor('surface', 'surfaceDim');
|
|
23
|
-
box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2) inset;
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
transition: 0.4s;
|
|
26
|
-
|
|
27
|
-
&:before {
|
|
28
|
-
position: absolute;
|
|
29
|
-
right: 3px;
|
|
30
|
-
bottom: 2px;
|
|
31
|
-
width: 24px;
|
|
32
|
-
height: 24px;
|
|
33
|
-
border-radius: 50%;
|
|
34
|
-
background-color: getSemanticColor('surface', 'surface');
|
|
35
|
-
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.20);
|
|
36
|
-
content: '';
|
|
37
|
-
transform: translateX(-18px);
|
|
38
|
-
transition: 0.4s;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.focusVisible {
|
|
42
|
-
box-shadow: 0 0 0 3px getSemanticColor('primary', 'primary');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
input:checked + .slider {
|
|
47
|
-
background-color: getSemanticColor('primary', 'primaryVariant');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
input:checked + .slider:before {
|
|
51
|
-
transform: translateX(0px);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { render, fireEvent } from '@testing-library/react';
|
|
2
|
-
|
|
3
|
-
import Toggle from './Toggle';
|
|
4
|
-
|
|
5
|
-
describe('Toggle', () => {
|
|
6
|
-
it('renders correctly', () => {
|
|
7
|
-
const { getByRole } = render(<Toggle />);
|
|
8
|
-
const switchElement = getByRole('switch');
|
|
9
|
-
|
|
10
|
-
expect(switchElement).toBeInTheDocument();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('changes state when clicked', () => {
|
|
14
|
-
const { getByRole } = render(<Toggle />);
|
|
15
|
-
const switchElement = getByRole('switch');
|
|
16
|
-
|
|
17
|
-
expect(switchElement).not.toBeChecked();
|
|
18
|
-
|
|
19
|
-
fireEvent.click(switchElement);
|
|
20
|
-
|
|
21
|
-
expect(switchElement).toBeChecked();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import Toggle from './Toggle';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Toggle> = {
|
|
6
|
-
component: Toggle,
|
|
7
|
-
title: 'Components/Toggle',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
type Story = StoryObj<typeof Toggle>;
|
|
13
|
-
|
|
14
|
-
export const Primary: Story = {
|
|
15
|
-
argTypes: {
|
|
16
|
-
disabled: {
|
|
17
|
-
control: {
|
|
18
|
-
type: 'boolean',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
id: {
|
|
22
|
-
control: {
|
|
23
|
-
type: 'text',
|
|
24
|
-
},
|
|
25
|
-
description: `"id" prop allows providing an id for the Toggle component.`,
|
|
26
|
-
},
|
|
27
|
-
onChange: {
|
|
28
|
-
action: 'onChange',
|
|
29
|
-
description: 'onChange handler',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
parameters: {
|
|
33
|
-
design: {
|
|
34
|
-
type: 'figma',
|
|
35
|
-
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?type=design&node-id=114-2676&mode=design&t=ChoKDRpaOoYuHr92-0',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useSwitch } from '@mui/base';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import styles from './Toggle.module.scss';
|
|
6
|
-
import { ToggleProps } from './Toggle.types';
|
|
7
|
-
|
|
8
|
-
const Toggle = (props: ToggleProps) => {
|
|
9
|
-
const { checked, disabled, focusVisible, getInputProps } = useSwitch(props);
|
|
10
|
-
const { id, className } = props;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<span className={clsx(styles.switch, className)}>
|
|
14
|
-
<input
|
|
15
|
-
{...getInputProps()}
|
|
16
|
-
type="checkbox"
|
|
17
|
-
aria-checked={checked}
|
|
18
|
-
aria-disabled={disabled}
|
|
19
|
-
role="switch"
|
|
20
|
-
id={id}
|
|
21
|
-
data-testid="toggle-switch"
|
|
22
|
-
/>
|
|
23
|
-
<span
|
|
24
|
-
className={clsx(styles.slider, {
|
|
25
|
-
[styles['focusVisible']]: focusVisible,
|
|
26
|
-
})}
|
|
27
|
-
></span>
|
|
28
|
-
</span>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default Toggle;
|