@goodhood-web/ui 0.0.3 → 0.0.4
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/.babelrc +12 -0
- package/.eslintrc.json +25 -0
- package/.storybook/main.ts +31 -0
- package/.storybook/manager-head.html +1 -0
- package/.storybook/manager.ts +7 -0
- package/.storybook/nebenanTheme.ts +17 -0
- package/.storybook/preview.ts +9 -0
- package/.stylelintrc.json +14 -0
- package/README.md +7 -0
- package/__mocks__/svg.js +2 -0
- package/images/favicon.ico +0 -0
- package/images/logo.svg +11 -0
- package/jest.config.ts +16 -0
- package/package.json +1 -1
- package/project.json +88 -0
- package/{index.d.ts → src/index.ts} +25 -1
- package/src/lib/BaseButton/BaseButton.module.scss +11 -0
- package/src/lib/BaseButton/BaseButton.spec.tsx +12 -0
- package/src/lib/BaseButton/BaseButton.stories.tsx +26 -0
- package/src/lib/BaseButton/BaseButton.tsx +39 -0
- package/src/lib/Card/Card.module.scss +15 -0
- package/src/lib/Card/Card.spec.tsx +15 -0
- package/src/lib/Card/Card.stories.tsx +159 -0
- package/src/lib/Card/Card.tsx +31 -0
- package/src/lib/Card/Card.types.ts +12 -0
- package/src/lib/Card/Card.utils.spec.tsx +51 -0
- package/src/lib/Card/Card.utils.ts +23 -0
- package/src/lib/Card/CardBody/CardBody.module.scss +4 -0
- package/src/lib/Card/CardBody/CardBody.spec.tsx +15 -0
- package/src/lib/Card/CardBody/CardBody.stories.tsx +108 -0
- package/src/lib/Card/CardBody/CardBody.tsx +9 -0
- package/src/lib/Card/CardBody/CardBody.types.ts +4 -0
- package/src/lib/Card/CardHeader/CardHeader.module.scss +12 -0
- package/src/lib/Card/CardHeader/CardHeader.spec.tsx +72 -0
- package/src/lib/Card/CardHeader/CardHeader.stories.tsx +77 -0
- package/src/lib/Card/CardHeader/CardHeader.tsx +29 -0
- package/src/lib/Card/CardHeader/CardHeader.type.ts +14 -0
- package/src/lib/ContentCreatorButton/ContentCreatorButton.module.scss +13 -0
- package/src/lib/ContentCreatorButton/ContentCreatorButton.spec.tsx +14 -0
- package/src/lib/ContentCreatorButton/ContentCreatorButton.stories.tsx +29 -0
- package/src/lib/ContentCreatorButton/ContentCreatorButton.tsx +35 -0
- package/{lib/ContentCreatorButton/ContentCreatorButton.types.d.ts → src/lib/ContentCreatorButton/ContentCreatorButton.types.ts} +3 -2
- package/src/lib/Divider/Divider.module.scss +10 -0
- package/src/lib/Divider/Divider.spec.tsx +46 -0
- package/src/lib/Divider/Divider.stories.tsx +35 -0
- package/src/lib/Divider/Divider.tsx +17 -0
- package/src/lib/Divider/Divider.types.ts +6 -0
- package/src/lib/Fieldset/Fieldset.module.scss +3 -0
- package/src/lib/Fieldset/Fieldset.spec.tsx +68 -0
- package/src/lib/Fieldset/Fieldset.stories.tsx +60 -0
- package/src/lib/Fieldset/Fieldset.tsx +28 -0
- package/src/lib/Fieldset/Fieldset.types.ts +7 -0
- package/src/lib/Form/Form.spec.tsx +15 -0
- package/src/lib/Form/Form.stories.tsx +53 -0
- package/src/lib/Form/Form.tsx +14 -0
- package/src/lib/Form/Form.types.ts +11 -0
- package/src/lib/Icon/Icon.module.scss +7 -0
- package/src/lib/Icon/Icon.spec.tsx +28 -0
- package/src/lib/Icon/Icon.stories.tsx +88 -0
- package/src/lib/Icon/Icon.tsx +29 -0
- package/src/lib/Icon/Icon.types.ts +23 -0
- package/src/lib/Icon/icons/24x24/index.ts +89 -0
- package/src/lib/Icon/icons/24x24/svg/arrow_left.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/arrow_right.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/bookmark.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/bookmarked.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/burger_menu.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/camera.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/checkmark.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/checkmark_circle.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/chevron_down.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/chevron_left.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/chevron_right.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/chevron_up.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/comment_bubble.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/cross.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/cross_circle.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/envelope.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/event_calendar.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/external_link.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/eye.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/eye_crossed.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/filter.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/globe.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/heart.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/image.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/loudspeaker.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/marketplace.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/more_dots.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/more_dots_alt.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/mute.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/notification_bell.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/paperclip.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/pencil.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/pin.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/plus.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/plus_circle.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/privacy_lock.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/search.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/share_arrow.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/share_arrow_outline.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/sort.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/thanks.svg +1 -0
- package/src/lib/Icon/icons/24x24/svg/trash_can.svg +1 -0
- package/src/lib/Icon/icons/32x32/index.ts +179 -0
- package/src/lib/Icon/icons/32x32/svg/address_book.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/baby_toy.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/bicycle.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/bookmark.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/books.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/bubble_heart_filled.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/bubble_heart_outline.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/buildings.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/burger_menu.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/business.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/business_profile.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/camera.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/camera_crossed.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/car.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/carrot.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/chat.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/checkmark_circle.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/christmas_tree.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/clipboard.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/clothing.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/cocktail.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/comment_bubble.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/compass.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/computer.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/couch.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/credit_card.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/cross_circle.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/cutlery.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/drill_tool.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/email.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/envelope.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/event_calendar_check.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/event_calendar_date.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/event_calendar_plus.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/exchange.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/eye.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/eye_crossed.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/gift.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/group.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/healthcare.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/heart.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/house.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/image.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/info.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/invite_neighbour.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/key.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/kitchen_pot.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/list.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/log_out.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/loudspeaker.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/map.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/marketplace.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/miscellaneous_other.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/more_dots.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/more_dots_alt.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/music.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/nebenan.de.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/neighbour.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/notification_bell.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/organisation.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/paper_form_empty.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/paper_form_filled.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/paperclip.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/paw.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/pencil.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/pin.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/pins.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/plant.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/plus.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/plus_circle.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/post.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/privacy_lock.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/qr_code.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/search.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/settings_cog.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/shopping_bag.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/shopping_cart.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/special_place.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/suitcase.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/supporter.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/tennis_ball.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/thanks.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/trash_can.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/truck.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/user.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/user_profile.svg +1 -0
- package/src/lib/Icon/icons/32x32/svg/wellness.svg +1 -0
- package/src/lib/Icon/icons/index.ts +9 -0
- package/src/lib/IconButton/IconButton.module.scss +36 -0
- package/src/lib/IconButton/IconButton.spec.tsx +56 -0
- package/src/lib/IconButton/IconButton.stories.tsx +36 -0
- package/src/lib/IconButton/IconButton.tsx +25 -0
- package/{lib/IconButton/IconButton.types.d.ts → src/lib/IconButton/IconButton.types.ts} +10 -10
- package/src/lib/IconButton/utils.ts +6 -0
- package/src/lib/Image/Image.spec.tsx +10 -0
- package/src/lib/Image/Image.tsx +7 -0
- package/src/lib/Image/Image.type.tsx +5 -0
- package/src/lib/LabelPill/LabelPill.module.scss +33 -0
- package/src/lib/LabelPill/LabelPill.spec.tsx +23 -0
- package/src/lib/LabelPill/LabelPill.stories.tsx +31 -0
- package/src/lib/LabelPill/LabelPill.tsx +16 -0
- package/src/lib/LabelPill/LabelPill.types.ts +4 -0
- package/src/lib/Legend/Legend.module.scss +9 -0
- package/src/lib/Legend/Legend.spec.tsx +39 -0
- package/src/lib/Legend/Legend.stories.ts +39 -0
- package/src/lib/Legend/Legend.tsx +19 -0
- package/src/lib/Legend/Legend.types.ts +5 -0
- package/src/lib/MenuItem/MenuItem.module.scss +70 -0
- package/src/lib/MenuItem/MenuItem.spec.tsx +47 -0
- package/src/lib/MenuItem/MenuItem.stories.tsx +97 -0
- package/src/lib/MenuItem/MenuItem.tsx +34 -0
- package/src/lib/MenuItem/MenuItem.types.ts +10 -0
- package/src/lib/NotificationBubble/NotificationBubble.module.scss +30 -0
- package/src/lib/NotificationBubble/NotificationBubble.spec.tsx +36 -0
- package/src/lib/NotificationBubble/NotificationBubble.stories.tsx +56 -0
- package/src/lib/NotificationBubble/NotificationBubble.tsx +34 -0
- package/{lib/NotificationBubble/NotificationBubble.types.d.ts → src/lib/NotificationBubble/NotificationBubble.types.tsx} +3 -2
- package/src/lib/Thumbnail/Thumbnail.module.scss +67 -0
- package/src/lib/Thumbnail/Thumbnail.spec.tsx +51 -0
- package/src/lib/Thumbnail/Thumbnail.stories.tsx +242 -0
- package/src/lib/Thumbnail/Thumbnail.tsx +28 -0
- package/src/lib/Thumbnail/Thumbnail.type.tsx +18 -0
- package/src/lib/Toggle/Toggle.module.scss +53 -0
- package/src/lib/Toggle/Toggle.spec.tsx +23 -0
- package/src/lib/Toggle/Toggle.stories.tsx +38 -0
- package/src/lib/Toggle/Toggle.tsx +32 -0
- package/{lib/Toggle/Toggle.types.d.ts → src/lib/Toggle/Toggle.types.ts} +3 -2
- package/src/lib/ToggleInput/ToggleInput.module.scss +33 -0
- package/src/lib/ToggleInput/ToggleInput.spec.tsx +45 -0
- package/src/lib/ToggleInput/ToggleInput.stories.tsx +62 -0
- package/src/lib/ToggleInput/ToggleInput.tsx +40 -0
- package/{lib/ToggleInput/ToggleInput.types.d.ts → src/lib/ToggleInput/ToggleInput.types.ts} +5 -3
- package/src/lib/Typography/Typography.module.scss +61 -0
- package/src/lib/Typography/Typography.spec.tsx +60 -0
- package/src/lib/Typography/Typography.stories.tsx +45 -0
- package/src/lib/Typography/Typography.tsx +26 -0
- package/src/lib/Typography/Typography.types.ts +28 -0
- package/src/styles/_design-tokens.scss +1 -0
- package/src/styles/_fonts.scss +0 -0
- package/src/styles/_functions.scss +17 -0
- package/src/styles/_mixins.scss +33 -0
- package/src/styles/index.scss +3 -0
- package/src/styles/reset.scss +65 -0
- package/tsconfig.json +24 -0
- package/tsconfig.lib.json +35 -0
- package/tsconfig.spec.json +20 -0
- package/tsconfig.storybook.json +31 -0
- package/vite.config.ts +57 -0
- package/index.js +0 -93
- package/index.mjs +0 -4258
- package/lib/BaseButton/BaseButton.d.ts +0 -11
- package/lib/Card/Card.d.ts +0 -3
- package/lib/Card/Card.types.d.ts +0 -10
- package/lib/Card/Card.utils.d.ts +0 -3
- package/lib/Card/CardBody/CardBody.d.ts +0 -3
- package/lib/Card/CardBody/CardBody.types.d.ts +0 -5
- package/lib/Card/CardHeader/CardHeader.d.ts +0 -3
- package/lib/Card/CardHeader/CardHeader.type.d.ts +0 -10
- package/lib/ContentCreatorButton/ContentCreatorButton.d.ts +0 -3
- package/lib/Divider/Divider.d.ts +0 -3
- package/lib/Divider/Divider.types.d.ts +0 -6
- package/lib/Fieldset/Fieldset.d.ts +0 -3
- package/lib/Fieldset/Fieldset.types.d.ts +0 -8
- package/lib/Form/Form.d.ts +0 -3
- package/lib/Form/Form.types.d.ts +0 -10
- package/lib/Icon/Icon.d.ts +0 -4
- package/lib/Icon/Icon.types.d.ts +0 -18
- package/lib/Icon/icons/24x24/index.d.ts +0 -130
- package/lib/Icon/icons/32x32/index.d.ts +0 -265
- package/lib/Icon/icons/index.d.ts +0 -395
- package/lib/IconButton/IconButton.d.ts +0 -3
- package/lib/IconButton/utils.d.ts +0 -3
- package/lib/Image/Image.d.ts +0 -3
- package/lib/Image/Image.type.d.ts +0 -5
- package/lib/LabelPill/LabelPill.d.ts +0 -3
- package/lib/LabelPill/LabelPill.types.d.ts +0 -4
- package/lib/Legend/Legend.d.ts +0 -3
- package/lib/Legend/Legend.types.d.ts +0 -5
- package/lib/MenuItem/MenuItem.d.ts +0 -3
- package/lib/MenuItem/MenuItem.types.d.ts +0 -9
- package/lib/NotificationBubble/NotificationBubble.d.ts +0 -3
- package/lib/Toggle/Toggle.d.ts +0 -3
- package/lib/ToggleInput/ToggleInput.d.ts +0 -3
- package/lib/Typography/Typography.d.ts +0 -3
- package/lib/Typography/Typography.types.d.ts +0 -8
- package/style.css +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ImageProps } from '../Image/Image.type';
|
|
2
|
+
|
|
3
|
+
interface ThumbnailProps extends ImageProps {
|
|
4
|
+
isPlaceholder?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type TCircularSize = '28' | '32' | '40' | '48' | '56' | '80' | '120' | '280';
|
|
8
|
+
export type TSquareSize = '24' | '32' | '40' | '48' | '56' | '64' | '80' | '120';
|
|
9
|
+
|
|
10
|
+
export interface ThumbnailCircularProps extends ThumbnailProps {
|
|
11
|
+
shape: 'circular';
|
|
12
|
+
size: TCircularSize;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ThumbnailSquareProps extends ThumbnailProps {
|
|
16
|
+
shape: 'square';
|
|
17
|
+
size: TSquareSize;
|
|
18
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.toggleInput {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
padding: getSpacing('sm') getSpacing('lg');
|
|
5
|
+
background-color: getSemanticColor('surface', 'surface');
|
|
6
|
+
gap: getSpacing('md');
|
|
7
|
+
|
|
8
|
+
color: getSemanticColor('surface', 'onSurfaceVariant');
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
width: 100%;
|
|
11
|
+
|
|
12
|
+
svg {
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.textLabel {
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.switch {
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&--checked {
|
|
25
|
+
color: getSemanticColor('surface', 'onSurface');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&--withBorder {
|
|
29
|
+
padding: getSpacing('md') getSpacing('lg');
|
|
30
|
+
border-radius: getBorderRadius('lg');
|
|
31
|
+
box-shadow: inset 0px 0px 0px 1px getSemanticColor('outline', 'outlineVariant');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
|
|
3
|
+
import ToggleInput from './ToggleInput';
|
|
4
|
+
import { ToggleInputProps } from './ToggleInput.types';
|
|
5
|
+
|
|
6
|
+
describe('ToggleInput Component', () => {
|
|
7
|
+
const mockProps = {
|
|
8
|
+
checked: false,
|
|
9
|
+
defaultChecked: false,
|
|
10
|
+
disabled: false,
|
|
11
|
+
icon: 'notification_bell',
|
|
12
|
+
label: 'Test Label',
|
|
13
|
+
onChange: jest.fn(),
|
|
14
|
+
variant: 'rounded',
|
|
15
|
+
} as ToggleInputProps;
|
|
16
|
+
|
|
17
|
+
it('renders without crashing', () => {
|
|
18
|
+
render(<ToggleInput {...mockProps} />);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('renders label and icon correctly', () => {
|
|
22
|
+
render(<ToggleInput {...mockProps} />);
|
|
23
|
+
const labelElement = screen.getByText('Test Label');
|
|
24
|
+
const iconElement = screen.getByRole('presentation');
|
|
25
|
+
|
|
26
|
+
expect(labelElement).toBeInTheDocument();
|
|
27
|
+
expect(iconElement).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('calls onChange when the toggle switch is clicked', () => {
|
|
31
|
+
render(<ToggleInput {...mockProps} />);
|
|
32
|
+
const toggleSwitch = screen.getByTestId('toggle-switch');
|
|
33
|
+
|
|
34
|
+
fireEvent.click(toggleSwitch);
|
|
35
|
+
|
|
36
|
+
expect(mockProps.onChange).toHaveBeenCalledTimes(1);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders disabled state correctly', () => {
|
|
40
|
+
render(<ToggleInput {...mockProps} disabled={true} />);
|
|
41
|
+
const toggleSwitch = screen.getByTestId('toggle-switch');
|
|
42
|
+
|
|
43
|
+
expect(toggleSwitch).toBeDisabled();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import Icons32 from '../Icon/icons/32x32';
|
|
5
|
+
|
|
6
|
+
import ToggleInput from './ToggleInput';
|
|
7
|
+
import { ToggleInputProps } from './ToggleInput.types';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof ToggleInput> = {
|
|
10
|
+
argTypes: {
|
|
11
|
+
icon: {
|
|
12
|
+
control: {
|
|
13
|
+
type: 'select',
|
|
14
|
+
},
|
|
15
|
+
description: 'This will be icon of the toggle input',
|
|
16
|
+
options: [undefined, ...Object.keys(Icons32)],
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
control: {
|
|
20
|
+
type: 'text',
|
|
21
|
+
},
|
|
22
|
+
description: 'This will be text of the toggle input',
|
|
23
|
+
},
|
|
24
|
+
onChange: { action: 'clicked', description: 'On click event callback' },
|
|
25
|
+
|
|
26
|
+
withBorder: {
|
|
27
|
+
defaultValue: 'false',
|
|
28
|
+
description: 'This will be variant of the toggle input',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
component: ToggleInput,
|
|
32
|
+
title: 'Components/ToggleInput',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof ToggleInput>;
|
|
38
|
+
|
|
39
|
+
const WrapperToggle = (props: ToggleInputProps) => {
|
|
40
|
+
const [checked, setChecked] = useState(false);
|
|
41
|
+
|
|
42
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
43
|
+
setChecked(e.target.checked);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return <ToggleInput {...props} checked={checked} onChange={handleChange} />;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Primary: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
icon: 'notification_bell',
|
|
52
|
+
label: 'Toggle Input',
|
|
53
|
+
withBorder: false,
|
|
54
|
+
},
|
|
55
|
+
parameters: {
|
|
56
|
+
design: {
|
|
57
|
+
type: 'figma',
|
|
58
|
+
url: 'https://www.figma.com/file/hN7xJ3rRAemUJT9T0uEfUS/Product-Design-System?node-id=181%3A2876&mode=dev',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
render: WrapperToggle,
|
|
62
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
|
|
3
|
+
import Icon from '../Icon/Icon';
|
|
4
|
+
import Toggle from '../Toggle/Toggle';
|
|
5
|
+
import Typography from '../Typography/Typography';
|
|
6
|
+
|
|
7
|
+
import styles from './ToggleInput.module.scss';
|
|
8
|
+
import { ToggleInputProps } from './ToggleInput.types';
|
|
9
|
+
|
|
10
|
+
const ToggleInput = ({
|
|
11
|
+
checked,
|
|
12
|
+
defaultChecked,
|
|
13
|
+
disabled,
|
|
14
|
+
icon,
|
|
15
|
+
label,
|
|
16
|
+
onChange,
|
|
17
|
+
withBorder,
|
|
18
|
+
}: ToggleInputProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<label
|
|
21
|
+
className={clsx(styles.toggleInput, {
|
|
22
|
+
[styles[`toggleInput--withBorder`]]: withBorder,
|
|
23
|
+
[styles[`toggleInput--checked`]]: checked,
|
|
24
|
+
})}
|
|
25
|
+
>
|
|
26
|
+
{icon && <Icon name={icon} size="32" />}
|
|
27
|
+
<Typography type="body-large" className={styles.textLabel}>
|
|
28
|
+
{label}
|
|
29
|
+
</Typography>
|
|
30
|
+
<Toggle
|
|
31
|
+
onChange={onChange}
|
|
32
|
+
disabled={disabled}
|
|
33
|
+
defaultChecked={defaultChecked}
|
|
34
|
+
className={styles.switch}
|
|
35
|
+
/>
|
|
36
|
+
</label>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default ToggleInput;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { UseSwitchParameters } from '@mui/base';
|
|
2
|
+
|
|
2
3
|
import { Icon32 } from '../Icon/Icon.types';
|
|
4
|
+
|
|
3
5
|
export interface ToggleInputProps extends UseSwitchParameters {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
icon?: Icon32;
|
|
7
|
+
label: string;
|
|
8
|
+
withBorder?: boolean;
|
|
7
9
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.h1 {
|
|
2
|
+
@include typography('headings', 'H1');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.h2 {
|
|
6
|
+
@include typography('headings', 'H2');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.h3 {
|
|
10
|
+
@include typography('headings', 'H3');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.h4 {
|
|
14
|
+
@include typography('headings', 'H4');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.h5 {
|
|
18
|
+
@include typography('headings', 'H5');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.h6 {
|
|
22
|
+
@include typography('headings', 'H6');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.h7 {
|
|
26
|
+
@include typography('headings', 'H7');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.h8 {
|
|
30
|
+
@include typography('headings', 'H8');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Body
|
|
34
|
+
.body-large {
|
|
35
|
+
@include typography('body', 'Large');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.body-regular {
|
|
39
|
+
@include typography('body', 'Regular');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.body-semibold {
|
|
43
|
+
@include typography('body', 'Semibold');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.body-italic {
|
|
47
|
+
@include typography('body', 'Italic');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Detail
|
|
51
|
+
.detail-medium {
|
|
52
|
+
@include typography('detail', 'Medium');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.detail-bold {
|
|
56
|
+
@include typography('detail', 'Bold');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.detail-upper-case {
|
|
60
|
+
@include typography('detail', 'Upper Case');
|
|
61
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
|
|
3
|
+
import Typography from './Typography';
|
|
4
|
+
import { TypographyType } from './Typography.types';
|
|
5
|
+
|
|
6
|
+
describe('<Typography />', () => {
|
|
7
|
+
const types: TypographyType[] = [
|
|
8
|
+
'h1',
|
|
9
|
+
'h2',
|
|
10
|
+
'h3',
|
|
11
|
+
'h4',
|
|
12
|
+
'h5',
|
|
13
|
+
'h6',
|
|
14
|
+
'h7',
|
|
15
|
+
'h8',
|
|
16
|
+
'body-large',
|
|
17
|
+
'body-regular',
|
|
18
|
+
'body-semibold',
|
|
19
|
+
'body-italic',
|
|
20
|
+
'detail-medium',
|
|
21
|
+
'detail-bold',
|
|
22
|
+
'detail-upper-case',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
types.forEach((type) => {
|
|
26
|
+
it(`renders correctly for type "${type}"`, () => {
|
|
27
|
+
const { getByText } = render(<Typography type={type}>Sample Text</Typography>);
|
|
28
|
+
const element = getByText('Sample Text');
|
|
29
|
+
|
|
30
|
+
if (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(type)) {
|
|
31
|
+
expect(element.tagName).toBe(type.toUpperCase());
|
|
32
|
+
} else {
|
|
33
|
+
expect(element.tagName).toBe('SPAN');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
expect(element).toHaveClass(type);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('renders correctly with "as" prop', () => {
|
|
41
|
+
const { getByText } = render(
|
|
42
|
+
<Typography type="body-large" as="p">
|
|
43
|
+
Sample Text
|
|
44
|
+
</Typography>,
|
|
45
|
+
);
|
|
46
|
+
const element = getByText('Sample Text');
|
|
47
|
+
expect(element.tagName).toBe('P');
|
|
48
|
+
expect(element).toHaveClass('body-large');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('take a custom classname and adds it properly to the element', () => {
|
|
52
|
+
const { getByText } = render(
|
|
53
|
+
<Typography type="body-large" className="custom-classname">
|
|
54
|
+
Sample Text
|
|
55
|
+
</Typography>,
|
|
56
|
+
);
|
|
57
|
+
const element = getByText('Sample Text');
|
|
58
|
+
expect(element).toHaveClass('custom-classname');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import Typography from './Typography';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Typography> = {
|
|
6
|
+
component: Typography,
|
|
7
|
+
title: 'Components/Typography',
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Typography>;
|
|
11
|
+
|
|
12
|
+
export const Heading1: Story = {
|
|
13
|
+
args: {
|
|
14
|
+
children: 'Heading 1',
|
|
15
|
+
type: 'h1',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Heading2: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
children: 'Heading 2',
|
|
22
|
+
type: 'h2',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const BodyLarge: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
children: 'Body Large Text',
|
|
29
|
+
type: 'body-large',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const BodyRegular: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
children: 'Body Regular Text',
|
|
36
|
+
type: 'body-regular',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const DetailBold: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
children: 'Detail Bold Text',
|
|
43
|
+
type: 'detail-bold',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React, { JSX } from 'react';
|
|
3
|
+
|
|
4
|
+
import styles from './Typography.module.scss';
|
|
5
|
+
import { TypographyProps, TypographyType } from './Typography.types';
|
|
6
|
+
|
|
7
|
+
function deriveTagFromType(type: TypographyType): keyof JSX.IntrinsicElements {
|
|
8
|
+
switch (type) {
|
|
9
|
+
case 'h1':
|
|
10
|
+
case 'h2':
|
|
11
|
+
case 'h3':
|
|
12
|
+
case 'h4':
|
|
13
|
+
case 'h5':
|
|
14
|
+
case 'h6':
|
|
15
|
+
return type as keyof JSX.IntrinsicElements;
|
|
16
|
+
default:
|
|
17
|
+
return 'span';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Typography({ as, children, className, type }: TypographyProps) {
|
|
22
|
+
const ElementTag = as || deriveTagFromType(type);
|
|
23
|
+
return <ElementTag className={clsx(styles[type], className)}>{children}</ElementTag>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default Typography;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
export type TypographyType =
|
|
4
|
+
| 'h1'
|
|
5
|
+
| 'h2'
|
|
6
|
+
| 'h3'
|
|
7
|
+
| 'h4'
|
|
8
|
+
| 'h5'
|
|
9
|
+
| 'h6'
|
|
10
|
+
| 'h7'
|
|
11
|
+
| 'h8'
|
|
12
|
+
| 'body-large'
|
|
13
|
+
| 'body-regular'
|
|
14
|
+
| 'body-semibold'
|
|
15
|
+
| 'body-italic'
|
|
16
|
+
| 'detail-medium'
|
|
17
|
+
| 'detail-bold'
|
|
18
|
+
| 'detail-upper-case';
|
|
19
|
+
|
|
20
|
+
export interface TypographyProps {
|
|
21
|
+
as?: Extract<
|
|
22
|
+
keyof JSX.IntrinsicElements,
|
|
23
|
+
'span' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
24
|
+
>;
|
|
25
|
+
children: string;
|
|
26
|
+
className?: string;
|
|
27
|
+
type: TypographyType;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward '@goodhood/design-tokens/lib/web/index';
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
@function mapGet($map, $keys...) {
|
|
4
|
+
@return map.get($map, $keys...);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@function getSemanticColor($color, $shade) {
|
|
8
|
+
@return mapGet($tokens, color, semantic, $color, $shade);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@function getSpacing($spacingType) {
|
|
12
|
+
@return mapGet($tokens, spacing, $spacingType);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@function getBorderRadius($spacingType) {
|
|
16
|
+
@return mapGet($tokens, borderRadius, $spacingType);
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
@mixin spacing($properties, $map: map.get($tokens, 'spacing')) {
|
|
4
|
+
// Extract the correct spacing settings;
|
|
5
|
+
@each $size, $i in $map {
|
|
6
|
+
$value: map.get($tokens, 'spacing', $size);
|
|
7
|
+
&-#{$size} {
|
|
8
|
+
@each $property in $properties {
|
|
9
|
+
#{$property}: #{$value};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@mixin typography($type, $level) {
|
|
16
|
+
// Extract the correct typography settings based on the provided type and level
|
|
17
|
+
$typo-settings: map.get(map.get($tokens, $type), $level);
|
|
18
|
+
|
|
19
|
+
// Ensure the level exists
|
|
20
|
+
@if $typo-settings {
|
|
21
|
+
margin-bottom: mapGet($typo-settings, 'paragraphSpacing');
|
|
22
|
+
font-family: mapGet($typo-settings, 'fontFamily');
|
|
23
|
+
font-size: mapGet($typo-settings, 'fontSize');
|
|
24
|
+
font-weight: mapGet($typo-settings, 'fontWeight');
|
|
25
|
+
letter-spacing: mapGet($typo-settings, 'letterSpacing');
|
|
26
|
+
line-height: mapGet($typo-settings, 'lineHeight');
|
|
27
|
+
text-decoration: mapGet($typo-settings, 'textDecoration');
|
|
28
|
+
text-indent: mapGet($typo-settings, 'paragraphIndent');
|
|
29
|
+
text-transform: mapGet($typo-settings, 'textCase');
|
|
30
|
+
} @else {
|
|
31
|
+
@error "Unknown typography type: #{$type} or level: #{$level}.";
|
|
32
|
+
}
|
|
33
|
+
}
|