@grantbii/design-system 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +0,0 @@
1
- import { type BadgeProps } from "../molecules/Badge";
2
- type BadgesProps = {
3
- allBadgeProps: BadgeProps[];
4
- scrollable?: boolean;
5
- vertical?: boolean;
6
- };
7
- declare const Badges: ({ allBadgeProps, scrollable, vertical }: BadgesProps) => import("react/jsx-runtime").JSX.Element;
8
- export default Badges;
@@ -1,59 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createElement as _createElement } from "react";
3
- import styled, { css } from "styled-components";
4
- import { Responsive } from "../atoms";
5
- import Badge, {} from "../molecules/Badge";
6
- const Badges = ({ allBadgeProps, scrollable, vertical }) => (_jsx(BaseBadges, { "$scrollable": scrollable, "$vertical": vertical, children: allBadgeProps.map((badgeProps) => (_createElement(Badge, { ...badgeProps, key: `badge-${badgeProps.label}` }))) }));
7
- export default Badges;
8
- const BaseBadges = styled.div `
9
- display: flex;
10
- flex-direction: ${({ $vertical = false }) => ($vertical ? "column" : "row")};
11
- gap: ${({ $vertical = false }) => ($vertical ? "4px" : "8px")};
12
-
13
- ${({ $scrollable = false, $vertical = false }) => deriveCSS($scrollable, $vertical)}
14
- `;
15
- const deriveCSS = (scrollable, vertical) => {
16
- if (vertical && scrollable) {
17
- return ScrollableVerticalCSS;
18
- }
19
- else if (vertical) {
20
- return UnscrollableVerticalCSS;
21
- }
22
- else if (scrollable) {
23
- return ScrollableHorizontalCSS;
24
- }
25
- else {
26
- return UnscrollableHorizontalCSS;
27
- }
28
- };
29
- const ScrollableVerticalCSS = css `
30
- overflow-y: auto;
31
-
32
- /* show 3 badges max */
33
- @media (width < ${Responsive.widthBreakpoint.laptop}) {
34
- /* 3.5 * 27px (badge height) + 2 * 4px (gap) = 89 */
35
- height: 103px;
36
- }
37
-
38
- @media (width >= ${Responsive.widthBreakpoint.laptop}) {
39
- /* 3.5 * 30px (badge height) + 2 * 4px (gap) = 113 */
40
- height: 113px;
41
- }
42
- `;
43
- const UnscrollableVerticalCSS = css ``;
44
- const ScrollableHorizontalCSS = css `
45
- flex-wrap: nowrap;
46
- overflow-x: auto;
47
-
48
- /* hide scrollbar but still allow for scrolling */
49
- -ms-overflow-style: none;
50
- scrollbar-width: none;
51
- ::-webkit-scrollbar {
52
- display: none;
53
- }
54
- `;
55
- const UnscrollableHorizontalCSS = css `
56
- flex-wrap: wrap;
57
- overflow-x: visible;
58
- `;
59
- //# sourceMappingURL=Badges.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Badges.js","sourceRoot":"","sources":["../../../core/archive/Badges.tsx"],"names":[],"mappings":";;AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,EAAmB,MAAM,oBAAoB,CAAC;AAQ5D,MAAM,MAAM,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAe,EAAE,EAAE,CAAC,CACvE,KAAC,UAAU,mBAAc,UAAU,eAAa,QAAQ,YACrD,aAAa,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CACjC,eAAC,KAAK,OAAK,UAAU,EAAE,GAAG,EAAE,SAAS,UAAU,CAAC,KAAK,EAAE,GAAI,CAC5D,CAAC,GACS,CACd,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAgD;;oBAEzD,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;SACpE,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;;IAE3D,CAAC,EAAE,WAAW,GAAG,KAAK,EAAE,SAAS,GAAG,KAAK,EAAE,EAAE,EAAE,CAC/C,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC;CACpC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,UAAmB,EAAE,QAAiB,EAAW,EAAE;IACpE,IAAI,QAAQ,IAAI,UAAU,EAAE,CAAC;QAC3B,OAAO,qBAAqB,CAAC;IAC/B,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,OAAO,uBAAuB,CAAC;IACjC,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACtB,OAAO,uBAAuB,CAAC;IACjC,CAAC;SAAM,CAAC;QACN,OAAO,yBAAyB,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;oBAIb,UAAU,CAAC,eAAe,CAAC,MAAM;;;;;qBAKhC,UAAU,CAAC,eAAe,CAAC,MAAM;;;;CAIrD,CAAC;AAEF,MAAM,uBAAuB,GAAG,GAAG,CAAA,EAAE,CAAC;AAEtC,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;;;;;;;CAUlC,CAAC;AAEF,MAAM,yBAAyB,GAAG,GAAG,CAAA;;;CAGpC,CAAC","sourcesContent":["import styled, { css, type RuleSet } from \"styled-components\";\nimport { Responsive } from \"../atoms\";\nimport Badge, { type BadgeProps } from \"../molecules/Badge\";\n\ntype BadgesProps = {\n allBadgeProps: BadgeProps[];\n scrollable?: boolean;\n vertical?: boolean;\n};\n\nconst Badges = ({ allBadgeProps, scrollable, vertical }: BadgesProps) => (\n <BaseBadges $scrollable={scrollable} $vertical={vertical}>\n {allBadgeProps.map((badgeProps) => (\n <Badge {...badgeProps} key={`badge-${badgeProps.label}`} />\n ))}\n </BaseBadges>\n);\n\nexport default Badges;\n\nconst BaseBadges = styled.div<{ $scrollable?: boolean; $vertical?: boolean }>`\n display: flex;\n flex-direction: ${({ $vertical = false }) => ($vertical ? \"column\" : \"row\")};\n gap: ${({ $vertical = false }) => ($vertical ? \"4px\" : \"8px\")};\n\n ${({ $scrollable = false, $vertical = false }) =>\n deriveCSS($scrollable, $vertical)}\n`;\n\nconst deriveCSS = (scrollable: boolean, vertical: boolean): RuleSet => {\n if (vertical && scrollable) {\n return ScrollableVerticalCSS;\n } else if (vertical) {\n return UnscrollableVerticalCSS;\n } else if (scrollable) {\n return ScrollableHorizontalCSS;\n } else {\n return UnscrollableHorizontalCSS;\n }\n};\n\nconst ScrollableVerticalCSS = css`\n overflow-y: auto;\n\n /* show 3 badges max */\n @media (width < ${Responsive.widthBreakpoint.laptop}) {\n /* 3.5 * 27px (badge height) + 2 * 4px (gap) = 89 */\n height: 103px;\n }\n\n @media (width >= ${Responsive.widthBreakpoint.laptop}) {\n /* 3.5 * 30px (badge height) + 2 * 4px (gap) = 113 */\n height: 113px;\n }\n`;\n\nconst UnscrollableVerticalCSS = css``;\n\nconst ScrollableHorizontalCSS = css`\n flex-wrap: nowrap;\n overflow-x: auto;\n\n /* hide scrollbar but still allow for scrolling */\n -ms-overflow-style: none;\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n`;\n\nconst UnscrollableHorizontalCSS = css`\n flex-wrap: wrap;\n overflow-x: visible;\n`;\n"]}
@@ -1,9 +0,0 @@
1
- import { Badges } from "@/.";
2
- import type { Meta, StoryObj } from "@storybook/nextjs-vite";
3
- declare const meta: Meta<typeof Badges>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const ScrollableVertical: Story;
7
- export declare const UnscrollableVertical: Story;
8
- export declare const ScrollableHorizontal: Story;
9
- export declare const UnscrollableHorizontal: Story;
@@ -1,38 +0,0 @@
1
- import { Badges, enumToOptions } from "@/.";
2
- import { Objective } from "@grantbii/ui-core/grant/enums";
3
- const meta = {
4
- title: "Archive/Badges",
5
- component: Badges,
6
- tags: ["autodocs"],
7
- };
8
- export default meta;
9
- const allBadgeProps = enumToOptions(Objective);
10
- export const ScrollableVertical = {
11
- args: {
12
- allBadgeProps,
13
- scrollable: true,
14
- vertical: true,
15
- },
16
- };
17
- export const UnscrollableVertical = {
18
- args: {
19
- allBadgeProps,
20
- scrollable: false,
21
- vertical: true,
22
- },
23
- };
24
- export const ScrollableHorizontal = {
25
- args: {
26
- allBadgeProps,
27
- scrollable: true,
28
- vertical: false,
29
- },
30
- };
31
- export const UnscrollableHorizontal = {
32
- args: {
33
- allBadgeProps,
34
- scrollable: false,
35
- vertical: false,
36
- },
37
- };
38
- //# sourceMappingURL=Badges.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Badges.stories.js","sourceRoot":"","sources":["../../../stories/archive/Badges.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAmB,MAAM,KAAK,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,MAAM,IAAI,GAAwB;IAChC,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,aAAa,GAAiB,aAAa,CAAC,SAAS,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,kBAAkB,GAAU;IACvC,IAAI,EAAE;QACJ,aAAa;QACb,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAU;IACzC,IAAI,EAAE;QACJ,aAAa;QACb,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAU;IACzC,IAAI,EAAE;QACJ,aAAa;QACb,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAU;IAC3C,IAAI,EAAE;QACJ,aAAa;QACb,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","sourcesContent":["import { Badges, enumToOptions, type BadgeProps } from \"@/.\";\nimport { Objective } from \"@grantbii/ui-core/grant/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\n\nconst meta: Meta<typeof Badges> = {\n title: \"Archive/Badges\",\n component: Badges,\n tags: [\"autodocs\"],\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nconst allBadgeProps: BadgeProps[] = enumToOptions(Objective);\n\nexport const ScrollableVertical: Story = {\n args: {\n allBadgeProps,\n scrollable: true,\n vertical: true,\n },\n};\n\nexport const UnscrollableVertical: Story = {\n args: {\n allBadgeProps,\n scrollable: false,\n vertical: true,\n },\n};\n\nexport const ScrollableHorizontal: Story = {\n args: {\n allBadgeProps,\n scrollable: true,\n vertical: false,\n },\n};\n\nexport const UnscrollableHorizontal: Story = {\n args: {\n allBadgeProps,\n scrollable: false,\n vertical: false,\n },\n};\n"]}