@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.
- package/.checkov.yml +10 -0
- package/.github/CODEOWNERS +7 -0
- package/.github/workflows/chromatic.yml +52 -0
- package/.github/workflows/pr-checks.yml +18 -0
- package/.github/workflows/pr-housekeeping.yaml +16 -0
- package/.husky/pre-commit +2 -0
- package/.nvmrc +1 -0
- package/.pre-commit-config.yaml +28 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/preview.ts +23 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/.tflint.hcl +13 -0
- package/CODEOWNERS +5 -0
- package/README.md +21 -0
- package/bin/createComponent.sh +96 -0
- package/dist/components/button/Button.d.ts +10 -0
- package/dist/components/button/Button.d.ts.map +1 -0
- package/dist/components/button/Button.js +8 -0
- package/dist/components/button/Button.js.map +1 -0
- package/dist/components/card/Card.d.ts +18 -0
- package/dist/components/card/Card.d.ts.map +1 -0
- package/dist/components/card/Card.js +31 -0
- package/dist/components/card/Card.js.map +1 -0
- package/dist/components/card/Card.stories.d.ts +86 -0
- package/dist/components/card/Card.stories.d.ts.map +1 -0
- package/dist/components/card/Card.stories.js +89 -0
- package/dist/components/card/Card.stories.js.map +1 -0
- package/dist/components/heading/Heading.d.ts +393 -0
- package/dist/components/heading/Heading.d.ts.map +1 -0
- package/dist/components/heading/Heading.js +12 -0
- package/dist/components/heading/Heading.js.map +1 -0
- package/dist/components/heading/Heading.stories.d.ts +35 -0
- package/dist/components/heading/Heading.stories.d.ts.map +1 -0
- package/dist/components/heading/Heading.stories.js +50 -0
- package/dist/components/heading/Heading.stories.js.map +1 -0
- package/dist/components/heading/HeadingInnerContainer.d.ts +5 -0
- package/dist/components/heading/HeadingInnerContainer.d.ts.map +1 -0
- package/dist/components/heading/HeadingInnerContainer.js +7 -0
- package/dist/components/heading/HeadingInnerContainer.js.map +1 -0
- package/dist/components/icon/Icon.d.ts +13 -0
- package/dist/components/icon/Icon.d.ts.map +1 -0
- package/dist/components/icon/Icon.js +10 -0
- package/dist/components/icon/Icon.js.map +1 -0
- package/dist/components/icon/Icon.stories.d.ts +11 -0
- package/dist/components/icon/Icon.stories.d.ts.map +1 -0
- package/dist/components/icon/Icon.stories.js +13 -0
- package/dist/components/icon/Icon.stories.js.map +1 -0
- package/dist/components/icon/allowedIcons.d.ts +110 -0
- package/dist/components/icon/allowedIcons.d.ts.map +1 -0
- package/dist/components/icon/allowedIcons.js +117 -0
- package/dist/components/icon/allowedIcons.js.map +1 -0
- package/dist/components/icon/customIcons/AskArbor.d.ts +3 -0
- package/dist/components/icon/customIcons/AskArbor.d.ts.map +1 -0
- package/dist/components/icon/customIcons/AskArbor.js +6 -0
- package/dist/components/icon/customIcons/AskArbor.js.map +1 -0
- package/dist/components/icon/customIcons/CheckSolid.d.ts +3 -0
- package/dist/components/icon/customIcons/CheckSolid.d.ts.map +1 -0
- package/dist/components/icon/customIcons/CheckSolid.js +9 -0
- package/dist/components/icon/customIcons/CheckSolid.js.map +1 -0
- package/dist/components/icon/customIcons/Google.d.ts +3 -0
- package/dist/components/icon/customIcons/Google.d.ts.map +1 -0
- package/dist/components/icon/customIcons/Google.js +7 -0
- package/dist/components/icon/customIcons/Google.js.map +1 -0
- package/dist/components/icon/customIcons/XSolid.d.ts +3 -0
- package/dist/components/icon/customIcons/XSolid.d.ts.map +1 -0
- package/dist/components/icon/customIcons/XSolid.js +8 -0
- package/dist/components/icon/customIcons/XSolid.js.map +1 -0
- package/dist/components/icon/types.d.ts +8 -0
- package/dist/components/icon/types.d.ts.map +1 -0
- package/dist/components/icon/types.js +2 -0
- package/dist/components/icon/types.js.map +1 -0
- package/dist/components/pill/Pill.d.ts +8 -0
- package/dist/components/pill/Pill.d.ts.map +1 -0
- package/dist/components/pill/Pill.js +6 -0
- package/dist/components/pill/Pill.js.map +1 -0
- package/dist/components/pill/Pill.stories.d.ts +8 -0
- package/dist/components/pill/Pill.stories.d.ts.map +1 -0
- package/dist/components/pill/Pill.stories.js +10 -0
- package/dist/components/pill/Pill.stories.js.map +1 -0
- package/dist/index.css +1557 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/generateUuid.d.ts +2 -0
- package/dist/utils/generateUuid.d.ts.map +1 -0
- package/dist/utils/generateUuid.js +10 -0
- package/dist/utils/generateUuid.js.map +1 -0
- package/dist/utils/hooks/useMemoGenerateUuid.d.ts +8 -0
- package/dist/utils/hooks/useMemoGenerateUuid.d.ts.map +1 -0
- package/dist/utils/hooks/useMemoGenerateUuid.js +8 -0
- package/dist/utils/hooks/useMemoGenerateUuid.js.map +1 -0
- package/dist/utils/keyboardConstants.d.ts +13 -0
- package/dist/utils/keyboardConstants.d.ts.map +1 -0
- package/dist/utils/keyboardConstants.js +13 -0
- package/dist/utils/keyboardConstants.js.map +1 -0
- package/dist/utils/waitForElement.d.ts +2 -0
- package/dist/utils/waitForElement.d.ts.map +1 -0
- package/dist/utils/waitForElement.js +18 -0
- package/dist/utils/waitForElement.js.map +1 -0
- package/eslint.config.mts +30 -0
- package/package.json +76 -0
- package/src/components/button/Button.story.tsx +116 -0
- package/src/components/button/Button.test.tsx +49 -0
- package/src/components/button/Button.tsx +37 -0
- package/src/components/button/button.scss +181 -0
- package/src/components/card/Card.stories.tsx +99 -0
- package/src/components/card/Card.test.tsx +231 -0
- package/src/components/card/Card.tsx +96 -0
- package/src/components/card/card.scss +68 -0
- package/src/components/heading/Heading.stories.tsx +85 -0
- package/src/components/heading/Heading.test.tsx +29 -0
- package/src/components/heading/Heading.tsx +17 -0
- package/src/components/heading/HeadingInnerContainer.tsx +18 -0
- package/src/components/heading/heading.scss +48 -0
- package/src/components/icon/Icon.stories.tsx +16 -0
- package/src/components/icon/Icon.test.tsx +17 -0
- package/src/components/icon/Icon.tsx +27 -0
- package/src/components/icon/allowedIcons.tsx +208 -0
- package/src/components/icon/customIcons/AskArbor.tsx +28 -0
- package/src/components/icon/customIcons/CheckSolid.tsx +43 -0
- package/src/components/icon/customIcons/Google.tsx +33 -0
- package/src/components/icon/customIcons/XSolid.tsx +32 -0
- package/src/components/icon/types.ts +8 -0
- package/src/components/pill/Pill.stories.tsx +14 -0
- package/src/components/pill/Pill.test.tsx +21 -0
- package/src/components/pill/Pill.tsx +24 -0
- package/src/components/pill/pill.scss +51 -0
- package/src/global.scss +19 -0
- package/src/index.scss +7 -0
- package/src/index.ts +6 -0
- package/src/tokens.scss +1249 -0
- package/src/utils/generateUuid.ts +9 -0
- package/src/utils/hooks/useMemoGenerateUuid.ts +13 -0
- package/src/utils/keyboardConstants.ts +12 -0
- package/src/utils/waitForElement.ts +22 -0
- package/stylelint.config.mjs +10 -0
- package/tsconfig.json +49 -0
- package/vitest.config.ts +26 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMemo, type DependencyList } from 'react';
|
|
2
|
+
import { generateUuid } from '../generateUuid';
|
|
3
|
+
|
|
4
|
+
type Args = {
|
|
5
|
+
deps?: DependencyList;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const useMemoGenerateUuid = ({ deps = [], prefix }: Args) => {
|
|
10
|
+
return useMemo(() => {
|
|
11
|
+
return generateUuid(prefix);
|
|
12
|
+
}, deps);
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const BACKSPACE_KEY = 'Backspace';
|
|
2
|
+
export const TAB_KEY = 'Tab';
|
|
3
|
+
export const ENTER_KEY = 'Enter';
|
|
4
|
+
export const ESCAPE_KEY = 'Escape';
|
|
5
|
+
export const SPACE_KEY = ' ';
|
|
6
|
+
export const ARROW_LEFT_KEY = 'ArrowLeft';
|
|
7
|
+
export const ARROW_UP_KEY = 'ArrowUp';
|
|
8
|
+
export const ARROW_RIGHT_KEY = 'ArrowRight';
|
|
9
|
+
export const ARROW_DOWN_KEY = 'ArrowDown';
|
|
10
|
+
export const DELETE_KEY = 'Delete';
|
|
11
|
+
export const Z_KEY = 'z';
|
|
12
|
+
export const A_KEY = 'a';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const waitForElement = (
|
|
2
|
+
selector: string,
|
|
3
|
+
callback: (element: Element) => void,
|
|
4
|
+
) => {
|
|
5
|
+
const timeout = setTimeout(() => {
|
|
6
|
+
console.error('Element not found:', selector);
|
|
7
|
+
}, 1000);
|
|
8
|
+
|
|
9
|
+
const observer = new MutationObserver((mutations, mutObs) => {
|
|
10
|
+
const element = document.querySelector(selector);
|
|
11
|
+
if (element) {
|
|
12
|
+
mutObs.disconnect();
|
|
13
|
+
callback(element);
|
|
14
|
+
clearTimeout(timeout);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
observer.observe(document.body, {
|
|
19
|
+
childList: true,
|
|
20
|
+
subtree: true,
|
|
21
|
+
});
|
|
22
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// File Layout
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
|
|
8
|
+
// Environment Settings
|
|
9
|
+
// See also https://aka.ms/tsconfig/module
|
|
10
|
+
"module": "es2020",
|
|
11
|
+
"target": "esnext",
|
|
12
|
+
"types": ["@testing-library/jest-dom"],
|
|
13
|
+
// For nodejs:
|
|
14
|
+
// "lib": ["esnext"],
|
|
15
|
+
// "types": ["node"],
|
|
16
|
+
// and npm install -D @types/node
|
|
17
|
+
|
|
18
|
+
// Other Outputs
|
|
19
|
+
"sourceMap": true,
|
|
20
|
+
"declaration": true,
|
|
21
|
+
"declarationMap": true,
|
|
22
|
+
|
|
23
|
+
// Stricter Typechecking Options
|
|
24
|
+
"noUncheckedIndexedAccess": true,
|
|
25
|
+
"exactOptionalPropertyTypes": false,
|
|
26
|
+
|
|
27
|
+
// Style Options
|
|
28
|
+
// "noImplicitReturns": true,
|
|
29
|
+
// "noImplicitOverride": true,
|
|
30
|
+
// "noUnusedLocals": true,
|
|
31
|
+
// "noUnusedParameters": true,
|
|
32
|
+
// "noFallthroughCasesInSwitch": true,
|
|
33
|
+
// "noPropertyAccessFromIndexSignature": true,
|
|
34
|
+
|
|
35
|
+
// Recommended Options
|
|
36
|
+
"strict": true,
|
|
37
|
+
"jsx": "react-jsx",
|
|
38
|
+
"verbatimModuleSyntax": true,
|
|
39
|
+
"isolatedModules": true,
|
|
40
|
+
"noUncheckedSideEffectImports": true,
|
|
41
|
+
"moduleDetection": "force",
|
|
42
|
+
"skipLibCheck": true,
|
|
43
|
+
|
|
44
|
+
"moduleResolution": "node",
|
|
45
|
+
"allowSyntheticDefaultImports": true
|
|
46
|
+
},
|
|
47
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
48
|
+
"exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.story.tsx"]
|
|
49
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()],
|
|
6
|
+
test: {
|
|
7
|
+
environment: 'jsdom',
|
|
8
|
+
globals: true,
|
|
9
|
+
// projects: [
|
|
10
|
+
// {
|
|
11
|
+
// extends: true,
|
|
12
|
+
// plugins: [],
|
|
13
|
+
// test: {
|
|
14
|
+
// name: "storybook",
|
|
15
|
+
// browser: {
|
|
16
|
+
// enabled: true,
|
|
17
|
+
// headless: true,
|
|
18
|
+
// provider: "playwright",
|
|
19
|
+
// instances: [{ browser: "chromium" }],
|
|
20
|
+
// },
|
|
21
|
+
// setupFiles: [".storybook/vitest.setup.ts"],
|
|
22
|
+
// },
|
|
23
|
+
// },
|
|
24
|
+
// ],
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@vitest/browser/providers/playwright" />
|