@arbor-education/design-system.components 0.0.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.
Files changed (141) hide show
  1. package/.checkov.yml +10 -0
  2. package/.github/CODEOWNERS +7 -0
  3. package/.github/workflows/chromatic.yml +52 -0
  4. package/.github/workflows/pr-checks.yml +18 -0
  5. package/.github/workflows/pr-housekeeping.yaml +16 -0
  6. package/.husky/pre-commit +2 -0
  7. package/.nvmrc +1 -0
  8. package/.pre-commit-config.yaml +28 -0
  9. package/.storybook/main.ts +21 -0
  10. package/.storybook/preview.ts +23 -0
  11. package/.storybook/vitest.setup.ts +7 -0
  12. package/.tflint.hcl +13 -0
  13. package/CODEOWNERS +5 -0
  14. package/README.md +21 -0
  15. package/bin/createComponent.sh +96 -0
  16. package/dist/components/button/Button.d.ts +10 -0
  17. package/dist/components/button/Button.d.ts.map +1 -0
  18. package/dist/components/button/Button.js +8 -0
  19. package/dist/components/button/Button.js.map +1 -0
  20. package/dist/components/card/Card.d.ts +18 -0
  21. package/dist/components/card/Card.d.ts.map +1 -0
  22. package/dist/components/card/Card.js +31 -0
  23. package/dist/components/card/Card.js.map +1 -0
  24. package/dist/components/card/Card.stories.d.ts +86 -0
  25. package/dist/components/card/Card.stories.d.ts.map +1 -0
  26. package/dist/components/card/Card.stories.js +89 -0
  27. package/dist/components/card/Card.stories.js.map +1 -0
  28. package/dist/components/heading/Heading.d.ts +393 -0
  29. package/dist/components/heading/Heading.d.ts.map +1 -0
  30. package/dist/components/heading/Heading.js +12 -0
  31. package/dist/components/heading/Heading.js.map +1 -0
  32. package/dist/components/heading/Heading.stories.d.ts +35 -0
  33. package/dist/components/heading/Heading.stories.d.ts.map +1 -0
  34. package/dist/components/heading/Heading.stories.js +50 -0
  35. package/dist/components/heading/Heading.stories.js.map +1 -0
  36. package/dist/components/heading/HeadingInnerContainer.d.ts +5 -0
  37. package/dist/components/heading/HeadingInnerContainer.d.ts.map +1 -0
  38. package/dist/components/heading/HeadingInnerContainer.js +7 -0
  39. package/dist/components/heading/HeadingInnerContainer.js.map +1 -0
  40. package/dist/components/icon/Icon.d.ts +13 -0
  41. package/dist/components/icon/Icon.d.ts.map +1 -0
  42. package/dist/components/icon/Icon.js +10 -0
  43. package/dist/components/icon/Icon.js.map +1 -0
  44. package/dist/components/icon/Icon.stories.d.ts +11 -0
  45. package/dist/components/icon/Icon.stories.d.ts.map +1 -0
  46. package/dist/components/icon/Icon.stories.js +13 -0
  47. package/dist/components/icon/Icon.stories.js.map +1 -0
  48. package/dist/components/icon/allowedIcons.d.ts +110 -0
  49. package/dist/components/icon/allowedIcons.d.ts.map +1 -0
  50. package/dist/components/icon/allowedIcons.js +117 -0
  51. package/dist/components/icon/allowedIcons.js.map +1 -0
  52. package/dist/components/icon/customIcons/AskArbor.d.ts +3 -0
  53. package/dist/components/icon/customIcons/AskArbor.d.ts.map +1 -0
  54. package/dist/components/icon/customIcons/AskArbor.js +6 -0
  55. package/dist/components/icon/customIcons/AskArbor.js.map +1 -0
  56. package/dist/components/icon/customIcons/CheckSolid.d.ts +3 -0
  57. package/dist/components/icon/customIcons/CheckSolid.d.ts.map +1 -0
  58. package/dist/components/icon/customIcons/CheckSolid.js +9 -0
  59. package/dist/components/icon/customIcons/CheckSolid.js.map +1 -0
  60. package/dist/components/icon/customIcons/Google.d.ts +3 -0
  61. package/dist/components/icon/customIcons/Google.d.ts.map +1 -0
  62. package/dist/components/icon/customIcons/Google.js +7 -0
  63. package/dist/components/icon/customIcons/Google.js.map +1 -0
  64. package/dist/components/icon/customIcons/XSolid.d.ts +3 -0
  65. package/dist/components/icon/customIcons/XSolid.d.ts.map +1 -0
  66. package/dist/components/icon/customIcons/XSolid.js +8 -0
  67. package/dist/components/icon/customIcons/XSolid.js.map +1 -0
  68. package/dist/components/icon/types.d.ts +8 -0
  69. package/dist/components/icon/types.d.ts.map +1 -0
  70. package/dist/components/icon/types.js +2 -0
  71. package/dist/components/icon/types.js.map +1 -0
  72. package/dist/components/pill/Pill.d.ts +8 -0
  73. package/dist/components/pill/Pill.d.ts.map +1 -0
  74. package/dist/components/pill/Pill.js +6 -0
  75. package/dist/components/pill/Pill.js.map +1 -0
  76. package/dist/components/pill/Pill.stories.d.ts +8 -0
  77. package/dist/components/pill/Pill.stories.d.ts.map +1 -0
  78. package/dist/components/pill/Pill.stories.js +10 -0
  79. package/dist/components/pill/Pill.stories.js.map +1 -0
  80. package/dist/index.css +1557 -0
  81. package/dist/index.css.map +1 -0
  82. package/dist/index.d.ts +7 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +7 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/utils/generateUuid.d.ts +2 -0
  87. package/dist/utils/generateUuid.d.ts.map +1 -0
  88. package/dist/utils/generateUuid.js +10 -0
  89. package/dist/utils/generateUuid.js.map +1 -0
  90. package/dist/utils/hooks/useMemoGenerateUuid.d.ts +8 -0
  91. package/dist/utils/hooks/useMemoGenerateUuid.d.ts.map +1 -0
  92. package/dist/utils/hooks/useMemoGenerateUuid.js +8 -0
  93. package/dist/utils/hooks/useMemoGenerateUuid.js.map +1 -0
  94. package/dist/utils/keyboardConstants.d.ts +13 -0
  95. package/dist/utils/keyboardConstants.d.ts.map +1 -0
  96. package/dist/utils/keyboardConstants.js +13 -0
  97. package/dist/utils/keyboardConstants.js.map +1 -0
  98. package/dist/utils/waitForElement.d.ts +2 -0
  99. package/dist/utils/waitForElement.d.ts.map +1 -0
  100. package/dist/utils/waitForElement.js +18 -0
  101. package/dist/utils/waitForElement.js.map +1 -0
  102. package/eslint.config.mts +30 -0
  103. package/package.json +76 -0
  104. package/src/components/button/Button.story.tsx +116 -0
  105. package/src/components/button/Button.test.tsx +49 -0
  106. package/src/components/button/Button.tsx +37 -0
  107. package/src/components/button/button.scss +181 -0
  108. package/src/components/card/Card.stories.tsx +99 -0
  109. package/src/components/card/Card.test.tsx +231 -0
  110. package/src/components/card/Card.tsx +96 -0
  111. package/src/components/card/card.scss +68 -0
  112. package/src/components/heading/Heading.stories.tsx +85 -0
  113. package/src/components/heading/Heading.test.tsx +29 -0
  114. package/src/components/heading/Heading.tsx +17 -0
  115. package/src/components/heading/HeadingInnerContainer.tsx +18 -0
  116. package/src/components/heading/heading.scss +48 -0
  117. package/src/components/icon/Icon.stories.tsx +16 -0
  118. package/src/components/icon/Icon.test.tsx +17 -0
  119. package/src/components/icon/Icon.tsx +27 -0
  120. package/src/components/icon/allowedIcons.tsx +208 -0
  121. package/src/components/icon/customIcons/AskArbor.tsx +28 -0
  122. package/src/components/icon/customIcons/CheckSolid.tsx +43 -0
  123. package/src/components/icon/customIcons/Google.tsx +33 -0
  124. package/src/components/icon/customIcons/XSolid.tsx +32 -0
  125. package/src/components/icon/types.ts +8 -0
  126. package/src/components/pill/Pill.stories.tsx +14 -0
  127. package/src/components/pill/Pill.test.tsx +21 -0
  128. package/src/components/pill/Pill.tsx +24 -0
  129. package/src/components/pill/pill.scss +51 -0
  130. package/src/global.scss +19 -0
  131. package/src/index.scss +7 -0
  132. package/src/index.ts +6 -0
  133. package/src/tokens.scss +1249 -0
  134. package/src/utils/generateUuid.ts +9 -0
  135. package/src/utils/hooks/useMemoGenerateUuid.ts +13 -0
  136. package/src/utils/keyboardConstants.ts +12 -0
  137. package/src/utils/waitForElement.ts +22 -0
  138. package/stylelint.config.mjs +10 -0
  139. package/tsconfig.json +49 -0
  140. package/vitest.config.ts +26 -0
  141. package/vitest.shims.d.ts +1 -0
package/.checkov.yml ADDED
@@ -0,0 +1,10 @@
1
+ download-external-modules: false
2
+ evaluate-variables: true
3
+ external-modules-download-path: .external_modules
4
+ framework:
5
+ - all
6
+ quiet: true
7
+ skip-check:
8
+ - CKV_AWS_144 #Do not enforce cross-region S3 buckets
9
+ - CKV_TF_1 #Do not enforce module commit hashes - we use tags
10
+ - CKV_TF_2 #Do not enforce tag versioning - checkov does not understand our s3 module tagging approach
@@ -0,0 +1,7 @@
1
+ # Lines starting with '#' are comments.
2
+ # Each line is a file pattern followed by one or more owners.
3
+ # Order is important. The last matching pattern has the most precedence.
4
+ # The team needs to exist and have write access to the repository
5
+
6
+ .github/** @arbor-education/DevOps_Reviewers
7
+ terraform/** @arbor-education/DevOps_Reviewers
@@ -0,0 +1,52 @@
1
+ # Workflow name
2
+ name: 'Chromatic Publish'
3
+
4
+ # Event for the workflow
5
+ on:
6
+ push:
7
+ branches:
8
+ - main
9
+ pull_request:
10
+ types:
11
+ - opened
12
+ - edited
13
+ - ready_for_review
14
+ - synchronize
15
+ - reopened
16
+
17
+ # List of jobs
18
+ jobs:
19
+ test:
20
+ # Operating System
21
+ runs-on: ubuntu-latest
22
+ # Job steps
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+ - uses: actions/setup-node@v4
28
+ with:
29
+ node-version: 20
30
+ cache: 'yarn'
31
+ - run: yarn
32
+ - name: Build
33
+ run: yarn build
34
+ #👇 Adds Chromatic as a step in the workflow
35
+ - name: Chromatic
36
+ id: chromatic
37
+ uses: chromaui/action@latest
38
+ # Options required for Chromatic's GitHub Action
39
+ with:
40
+ #👇 Chromatic projectToken,
41
+ projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
42
+ token: ${{ secrets.ARBOR_AUTOMATION_ORG_GHA_TOKEN }}
43
+ - name: Create comment
44
+ uses: mshick/add-pr-comment@v2
45
+ if: github.event_name == 'pull_request'
46
+ env:
47
+ GITHUB_TOKEN: ${{ secrets.ARBOR_AUTOMATION_ORG_GHA_TOKEN }}
48
+ with:
49
+ issue-number: ${{ github.event.pull_request.number }}
50
+ message: |
51
+ ## 👀 Beep Boop! 🤖
52
+ Your PR has been deployed to Chromatic. You can view the storybook [here](${{steps.chromatic.outputs.storybookUrl}}) and the Chromatic build [here](${{steps.chromatic.outputs.buildUrl}}).
@@ -0,0 +1,18 @@
1
+ name: PR Checks
2
+ on:
3
+ pull_request:
4
+ types:
5
+ - labeled
6
+ - unlabeled
7
+ - opened
8
+ - edited
9
+ - ready_for_review
10
+ - synchronize
11
+ - reopened
12
+ workflow_dispatch:
13
+
14
+ jobs:
15
+ jira-title-and-link:
16
+ uses: arbor-education/gha.workflows/.github/workflows/pr-jira-check-template.yaml@pr-checks-v1
17
+ secrets:
18
+ jira_token: ${{ secrets.JIRA_TOKEN }}
@@ -0,0 +1,16 @@
1
+ name: 'PR Housekeeping'
2
+ on:
3
+ workflow_dispatch: {}
4
+ schedule:
5
+ - cron: '30 1 * * *'
6
+
7
+ permissions:
8
+ contents: write # only for delete-branch option
9
+ issues: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ stale:
14
+ uses: arbor-education/gha.workflows/.github/workflows/pr-housekeeping-template.yaml@v0.0.156
15
+ with:
16
+ dry_run: false
@@ -0,0 +1,2 @@
1
+ nvm install && nvm use
2
+ yarn lint-staged
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20.19.3
@@ -0,0 +1,28 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.9.6
4
+ hooks:
5
+ - id: ruff
6
+ args: [ --fix ]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/antonbabenko/pre-commit-terraform
10
+ rev: v1.71.0
11
+ hooks:
12
+ - id: terragrunt_fmt
13
+ always_run: true
14
+ - id: terraform_fmt
15
+ - id: terraform_docs
16
+ - id: terraform_tflint
17
+ args:
18
+ - --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
19
+
20
+ - repo: https://github.com/pre-commit/pre-commit-hooks
21
+ rev: v4.2.0
22
+ hooks:
23
+ - id: check-merge-conflict
24
+ - id: trailing-whitespace
25
+ - id: end-of-file-fixer
26
+ - id: check-json
27
+ - id: check-added-large-files
28
+ - id: check-yaml
@@ -0,0 +1,21 @@
1
+ import type { StorybookConfig } from '@storybook/react-vite';
2
+
3
+ const config: StorybookConfig = {
4
+ stories: [
5
+ '../src/**/*.mdx',
6
+ '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
7
+ '../src/**/*.story.@(js|jsx|mjs|ts|tsx)',
8
+ ],
9
+ addons: [
10
+ '@chromatic-com/storybook',
11
+ '@storybook/addon-docs',
12
+ '@storybook/addon-onboarding',
13
+ '@storybook/addon-a11y',
14
+ '@storybook/addon-vitest',
15
+ ],
16
+ framework: {
17
+ name: '@storybook/react-vite',
18
+ options: {},
19
+ },
20
+ };
21
+ export default config;
@@ -0,0 +1,23 @@
1
+ import type { Preview } from '@storybook/react-vite';
2
+
3
+ import '../src/index.scss';
4
+
5
+ const preview: Preview = {
6
+ parameters: {
7
+ controls: {
8
+ matchers: {
9
+ color: /(background|color)$/i,
10
+ date: /Date$/i,
11
+ },
12
+ },
13
+
14
+ a11y: {
15
+ // 'todo' - show a11y violations in the test UI only
16
+ // 'error' - fail CI on a11y violations
17
+ // 'off' - skip a11y checks entirely
18
+ test: 'todo',
19
+ },
20
+ },
21
+ };
22
+
23
+ export default preview;
@@ -0,0 +1,7 @@
1
+ import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';
2
+ import { setProjectAnnotations } from '@storybook/react-vite';
3
+ import * as projectAnnotations from './preview';
4
+
5
+ // This is an important step to apply the right configuration when testing your stories.
6
+ // More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
7
+ setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);
package/.tflint.hcl ADDED
@@ -0,0 +1,13 @@
1
+ plugin "terraform" {
2
+ # Plugin common attributes
3
+ enabled = true
4
+ preset = "recommended"
5
+ }
6
+
7
+ rule "terraform_unused_declarations" {
8
+ enabled = true
9
+ }
10
+
11
+ rule "terraform_required_version" {
12
+ enabled = false
13
+ }
package/CODEOWNERS ADDED
@@ -0,0 +1,5 @@
1
+ # Lines starting with '#' are comments.
2
+ # Each line is a file pattern followed by one or more owners.
3
+ # Order is important. The last matching pattern has the most precedence.
4
+
5
+ * @arbor-education/Frontend_Reviewers
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # <<Repo Name>>
2
+
3
+ <<A short description of what the repo is for>>
4
+
5
+ In order to use the createComponent script, run the following command:
6
+
7
+ chmod +x bin/createComponent.sh
8
+
9
+ Then you can create a new component by running
10
+
11
+ npm run createComponent <ComponentName>
12
+
13
+ ## Local Development with Yalc
14
+
15
+ To publish new changes locally with hot loading, run:
16
+
17
+ yarn build
18
+
19
+ On the consumer project run:
20
+
21
+ yalc add design-system.components
@@ -0,0 +1,96 @@
1
+ #!/bin/bash
2
+
3
+ COMPONENT_NAME=$1
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+
6
+ # Check if input is empty
7
+ if [ -z "$COMPONENT_NAME" ]; then
8
+ echo "❌ Please provide a component name."
9
+ exit 1
10
+ fi
11
+
12
+ # Validate input: must start with a letter and contain only letters and numbers
13
+ if [[ ! "$COMPONENT_NAME" =~ ^[a-zA-Z][a-zA-Z0-9]*$ ]]; then
14
+ echo "❌ Invalid component name."
15
+ echo "✅ Use only letters and numbers. The name must start with a letter and contain no spaces or special characters."
16
+ exit 1
17
+ fi
18
+
19
+ # Capitalize the first letter
20
+ capitalize() {
21
+ echo "$1" | awk '{print toupper(substr($0,1,1)) substr($0,2)}'
22
+ }
23
+
24
+ # Uncapitalize the first letter
25
+ uncapitalize() {
26
+ echo "$1" | awk '{print tolower(substr($0,1,1)) substr($0,2)}'
27
+ }
28
+
29
+ CAPITALIZED_NAME=$(capitalize "$COMPONENT_NAME") # → "Button"
30
+ LOWERCASED_NAME=$(uncapitalize "$COMPONENT_NAME") # → "button"
31
+
32
+ COMPONENT_DIR="$SCRIPT_DIR/../src/components/$LOWERCASED_NAME"
33
+ INDEX_FILE_PATH="$SCRIPT_DIR/../src/index.ts"
34
+ STYLES_INDEX_PATH="$SCRIPT_DIR/../src/index.scss"
35
+
36
+
37
+ # Create directory
38
+ mkdir -p "$COMPONENT_DIR"
39
+
40
+ # Create component file
41
+ cat <<EOF > "$COMPONENT_DIR/$CAPITALIZED_NAME.tsx"
42
+ export const ${CAPITALIZED_NAME} = () => {
43
+ return <div className="${LOWERCASED_NAME}">Hello I'm a ${CAPITALIZED_NAME}!</div>;
44
+ };
45
+ EOF
46
+
47
+ # Create test file
48
+ cat <<EOF > "$COMPONENT_DIR/$CAPITALIZED_NAME.test.tsx"
49
+ import { expect, test } from "vitest";
50
+ import { render, screen } from '@testing-library/react';
51
+ import { ${CAPITALIZED_NAME} } from './${CAPITALIZED_NAME}';
52
+ import '@testing-library/jest-dom/vitest';
53
+
54
+ test('${CAPITALIZED_NAME} says hello', () => {
55
+ render(<${CAPITALIZED_NAME} />);
56
+ expect(screen.getByText("Hello I'm a ${CAPITALIZED_NAME}!")).toBeInTheDocument();
57
+ });
58
+ EOF
59
+
60
+ # Create Storybook file
61
+ cat <<EOF > "$COMPONENT_DIR/$CAPITALIZED_NAME.stories.tsx"
62
+ import type { Meta } from '@storybook/react-vite';
63
+ import { ${CAPITALIZED_NAME} } from './${CAPITALIZED_NAME}';
64
+
65
+ const meta: Meta<typeof ${CAPITALIZED_NAME}> = {
66
+ title: 'Components/${CAPITALIZED_NAME}',
67
+ component: ${CAPITALIZED_NAME},
68
+ };
69
+
70
+ export const Default = {
71
+ args: {
72
+ title: 'titleValue',
73
+ },
74
+ };
75
+
76
+ export default meta;
77
+ EOF
78
+
79
+ # Create SCSS file
80
+ cat <<EOF > "$COMPONENT_DIR/$LOWERCASED_NAME.scss"
81
+ .${LOWERCASED_NAME} {
82
+ /* styles go here */
83
+ }
84
+ EOF
85
+
86
+ # Append component export line to index.ts
87
+ INDEX_FILE_PATH="${SCRIPT_DIR}/../src/index.ts"
88
+ EXPORT_LINE="export { ${CAPITALIZED_NAME} } from \"./components/${LOWERCASED_NAME}/${CAPITALIZED_NAME}\";"
89
+
90
+ echo "$EXPORT_LINE" >> "$INDEX_FILE_PATH"
91
+
92
+ # Append SCSS import line to index.scss
93
+ STYLES_INDEX_PATH="${SCRIPT_DIR}/../src/index.scss"
94
+ SCSS_IMPORT_LINE="@use \"./components/${LOWERCASED_NAME}/${LOWERCASED_NAME}.scss\";"
95
+
96
+ echo "$SCSS_IMPORT_LINE" >> "$STYLES_INDEX_PATH"
@@ -0,0 +1,10 @@
1
+ import React, { type ButtonHTMLAttributes } from 'react';
2
+ export type ButtonProps = {
3
+ type?: 'primary' | 'secondary' | 'tertiary' | 'primary-destructive' | 'secondary-destructive' | 'text-link';
4
+ size?: 'M' | 'S';
5
+ children?: React.ReactNode;
6
+ className?: string;
7
+ [key: string]: unknown;
8
+ } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'>;
9
+ export declare const Button: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,qBAAqB,GAAG,uBAAuB,GAAG,WAAW,CAAC;IAC5G,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,MAAM,GAAI,OAAO,WAAW,4CAyBxC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import React, {} from 'react';
4
+ export const Button = (props) => {
5
+ const { type = 'primary', size = 'M', children, onClick, disabled = false, className = '', ...rest } = props;
6
+ return (_jsx("button", { className: classNames('ds-button', `ds-button--${type}`, `ds-button--${size}`, className), onClick: onClick, disabled: disabled, ...rest, children: children }));
7
+ };
8
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAA6B,MAAM,OAAO,CAAC;AAUzD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAE,EAAE;IAC3C,MAAM,EACJ,IAAI,GAAG,SAAS,EAChB,IAAI,GAAG,GAAG,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,EAAE,EACd,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,iBACE,SAAS,EAAE,UAAU,CAAC,WAAW,EAC/B,cAAc,IAAI,EAAE,EACpB,cAAc,IAAI,EAAE,EACpB,SAAS,CACV,EACD,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,KACd,IAAI,YAEP,QAAQ,GACF,CACV,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { allowedIcons } from '../icon/allowedIcons';
2
+ import { type PillColor } from '../pill/Pill';
3
+ type CardProps = {
4
+ title?: string;
5
+ paragraph?: string;
6
+ icon?: keyof typeof allowedIcons;
7
+ iconColor?: string;
8
+ disabled?: boolean;
9
+ pillText?: string;
10
+ pillColor?: PillColor;
11
+ onClick?: (e: React.MouseEvent<HTMLElement>) => void;
12
+ onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;
13
+ arrowType?: 'chevron' | 'arrow';
14
+ iconScreenReaderText?: string;
15
+ };
16
+ export declare const Card: ({ title, paragraph, icon, iconColor, iconScreenReaderText, onClick, onKeyDown, disabled, pillText, pillColor, arrowType, }: CardProps) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=Card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/card/Card.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,4HAYlB,SAAS,4CA+DX,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { Icon } from '../icon/Icon';
4
+ import { allowedIcons } from '../icon/allowedIcons';
5
+ import { Pill } from '../pill/Pill';
6
+ export const Card = ({ title, paragraph, icon, iconColor, iconScreenReaderText, onClick, onKeyDown, disabled, pillText, pillColor, arrowType = 'chevron', }) => {
7
+ const handleClick = (e) => {
8
+ if (onClick) {
9
+ onClick(e);
10
+ }
11
+ };
12
+ const handleKeyDown = (e) => {
13
+ if (onKeyDown) {
14
+ onKeyDown(e);
15
+ }
16
+ };
17
+ const isCardClickable = onClick && !disabled;
18
+ return (_jsx("article", { className: classNames('ds-card__container', {
19
+ 'ds-card__container--clickable': isCardClickable,
20
+ 'ds-card__container--disabled': disabled,
21
+ }), onClick: (e) => {
22
+ if (isCardClickable) {
23
+ handleClick(e);
24
+ }
25
+ }, onKeyDown: (e) => {
26
+ if (isCardClickable) {
27
+ handleKeyDown(e);
28
+ }
29
+ }, "aria-label": "Card", tabIndex: isCardClickable ? 0 : -1, children: _jsxs("div", { className: "ds-card__content", children: [icon && (_jsx(Icon, { name: icon, className: "ds-card__icon-left", screenReaderText: iconScreenReaderText, color: iconColor, size: 24 })), _jsxs("div", { className: "ds-card__text", children: [title && (_jsx("span", { className: "ds-card__title-container", children: title && _jsx("h4", { className: "ds-card__title", children: title }) })), paragraph && _jsx("p", { className: "ds-card__paragraph", children: paragraph }), pillText && _jsx(Pill, { text: pillText, color: pillColor })] }), isCardClickable && (_jsx(Icon, { name: `${arrowType}-right`, className: "ds-card__icon-click", size: 24 }))] }) }));
30
+ };
31
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAgBpD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,KAAK,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EACT,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,GAAG,SAAS,GACX,EAAE,EAAE;IACd,MAAM,WAAW,GAAG,CAAC,CAAgC,EAAE,EAAE;QACvD,IAAI,OA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Q,EAAE,KAAK,EAAE,SAAS,GAAI,IACnD,EACL,eAAe,IAAI,CAClB,KAAC,IAAI,IACH,IAAI,EAAE,GAAG,SAAS,QAAQ,EAC1B,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAE,EAAE,GACR,CACH,IACG,GACE,CACX,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,86 @@
1
+ import type { Meta } from '@storybook/react-vite';
2
+ import { Card } from './Card';
3
+ declare const meta: Meta<typeof Card>;
4
+ export declare const CardWithTitleAndParagraph: {
5
+ args: {
6
+ title: string;
7
+ paragraph: string;
8
+ disabled: boolean;
9
+ onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
10
+ onKeyDown: import("@vitest/spy").Mock<(...args: any[]) => any>;
11
+ };
12
+ };
13
+ export declare const CardWithTitleParagraphAndIcon: {
14
+ args: {
15
+ title: string;
16
+ paragraph: string;
17
+ icon: string;
18
+ disabled: boolean;
19
+ onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
20
+ onKeyDown: import("@vitest/spy").Mock<(...args: any[]) => any>;
21
+ };
22
+ };
23
+ export declare const TheEverythingCard: {
24
+ args: {
25
+ title: string;
26
+ paragraph: string;
27
+ icon: string;
28
+ disabled: boolean;
29
+ pillText: string;
30
+ pillColor: string;
31
+ onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
32
+ onKeyDown: import("@vitest/spy").Mock<(...args: any[]) => any>;
33
+ };
34
+ };
35
+ export declare const CardWithTitleParagraphAndPill: {
36
+ args: {
37
+ title: string;
38
+ paragraph: string;
39
+ disabled: boolean;
40
+ pillText: string;
41
+ pillColor: string;
42
+ onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
43
+ onKeyDown: import("@vitest/spy").Mock<(...args: any[]) => any>;
44
+ };
45
+ };
46
+ export declare const CardWithTitleAndIcon: {
47
+ args: {
48
+ title: string;
49
+ icon: string;
50
+ disabled: boolean;
51
+ onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
52
+ onKeyDown: import("@vitest/spy").Mock<(...args: any[]) => any>;
53
+ };
54
+ };
55
+ export declare const CardWithParagraph: {
56
+ args: {
57
+ paragraph: string;
58
+ disabled: boolean;
59
+ onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
60
+ onKeyDown: import("@vitest/spy").Mock<(...args: any[]) => any>;
61
+ };
62
+ };
63
+ export declare const ClickableDisabledCard: {
64
+ args: {
65
+ title: string;
66
+ paragraph: string;
67
+ icon: string;
68
+ disabled: boolean;
69
+ pillText: string;
70
+ pillColor: string;
71
+ onClick: import("@vitest/spy").Mock<(...args: any[]) => any>;
72
+ onKeyDown: import("@vitest/spy").Mock<(...args: any[]) => any>;
73
+ };
74
+ };
75
+ export declare const UnclickableCard: {
76
+ args: {
77
+ title: string;
78
+ paragraph: string;
79
+ icon: string;
80
+ disabled: boolean;
81
+ pillText: string;
82
+ pillColor: string;
83
+ };
84
+ };
85
+ export default meta;
86
+ //# sourceMappingURL=Card.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.stories.d.ts","sourceRoot":"","sources":["../../../src/components/card/Card.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAG3B,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;CAQrC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;CASzC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;CAW7B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;CAUzC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;CAQhC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAO7B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;CAWjC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAS3B,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { Card } from './Card';
2
+ import { fn } from 'storybook/test';
3
+ const meta = {
4
+ title: 'Components/Card',
5
+ component: Card,
6
+ };
7
+ export const CardWithTitleAndParagraph = {
8
+ args: {
9
+ title: 'Title of Card',
10
+ paragraph: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.',
11
+ disabled: false,
12
+ onClick: fn(),
13
+ onKeyDown: fn(),
14
+ },
15
+ };
16
+ export const CardWithTitleParagraphAndIcon = {
17
+ args: {
18
+ title: 'Title of Card',
19
+ paragraph: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.',
20
+ icon: 'eye',
21
+ disabled: false,
22
+ onClick: fn(),
23
+ onKeyDown: fn(),
24
+ },
25
+ };
26
+ export const TheEverythingCard = {
27
+ args: {
28
+ title: 'Title of Card',
29
+ paragraph: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.',
30
+ icon: 'eye',
31
+ disabled: false,
32
+ pillText: 'argle bargle',
33
+ pillColor: 'orange',
34
+ onClick: fn(),
35
+ onKeyDown: fn(),
36
+ },
37
+ };
38
+ export const CardWithTitleParagraphAndPill = {
39
+ args: {
40
+ title: 'Title of Card',
41
+ paragraph: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.',
42
+ disabled: false,
43
+ pillText: 'argle bargle',
44
+ pillColor: 'orange',
45
+ onClick: fn(),
46
+ onKeyDown: fn(),
47
+ },
48
+ };
49
+ export const CardWithTitleAndIcon = {
50
+ args: {
51
+ title: 'Title of Card',
52
+ icon: 'eye',
53
+ disabled: false,
54
+ onClick: fn(),
55
+ onKeyDown: fn(),
56
+ },
57
+ };
58
+ export const CardWithParagraph = {
59
+ args: {
60
+ paragraph: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.',
61
+ disabled: false,
62
+ onClick: fn(),
63
+ onKeyDown: fn(),
64
+ },
65
+ };
66
+ export const ClickableDisabledCard = {
67
+ args: {
68
+ title: 'Title of Card',
69
+ paragraph: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.',
70
+ icon: 'eye',
71
+ disabled: true,
72
+ pillText: 'argle bargle',
73
+ pillColor: 'orange',
74
+ onClick: fn(),
75
+ onKeyDown: fn(),
76
+ },
77
+ };
78
+ export const UnclickableCard = {
79
+ args: {
80
+ title: 'Title of Card',
81
+ paragraph: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.',
82
+ icon: 'eye',
83
+ disabled: true,
84
+ pillText: 'argle bargle',
85
+ pillColor: 'orange',
86
+ },
87
+ };
88
+ export default meta;
89
+ //# sourceMappingURL=Card.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.stories.js","sourceRoot":"","sources":["../../../src/components/card/Card.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,MAAM,IAAI,GAAsB;IAC9B,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE;QACJ,KAAK,EAAE,eAAe;QACtB,SAAS,EAAE,yDAAyD;QACpE,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,EAAE,EAAE;QACb,SAAS,EAAE,EAAE,EAAE;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,IAAI,EAAE;QACJ,KAAK,EAAE,eAAe;QACtB,SAAS,EAAE,yDAAyD;QACpE,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,EAAE,EAAE;QACb,SAAS,EAAE,EAAE,EAAE;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE;QACJ,KAAK,EAAE,eAAe;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