@arbor-education/design-system.components 0.0.1 → 0.0.3
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/.github/workflows/design-system-pr-checks.yml +37 -0
- package/.husky/pre-commit +2 -1
- package/.storybook/main.ts +12 -0
- package/.storybook/preview.ts +1 -1
- package/README.md +7 -4
- package/dist/components/button/Button.test.d.ts +2 -0
- package/dist/components/button/Button.test.d.ts.map +1 -0
- package/dist/components/button/Button.test.js +44 -0
- package/dist/components/button/Button.test.js.map +1 -0
- package/dist/components/card/Card.test.d.ts +2 -0
- package/dist/components/card/Card.test.d.ts.map +1 -0
- package/dist/components/card/Card.test.js +169 -0
- package/dist/components/card/Card.test.js.map +1 -0
- package/dist/components/formField/FormField.d.ts +20 -0
- package/dist/components/formField/FormField.d.ts.map +1 -0
- package/dist/components/formField/FormField.js +25 -0
- package/dist/components/formField/FormField.js.map +1 -0
- package/dist/components/formField/FormField.stories.d.ts +58 -0
- package/dist/components/formField/FormField.stories.d.ts.map +1 -0
- package/dist/components/formField/FormField.stories.js +75 -0
- package/dist/components/formField/FormField.stories.js.map +1 -0
- package/dist/components/formField/FormField.test.d.ts +2 -0
- package/dist/components/formField/FormField.test.d.ts.map +1 -0
- package/dist/components/formField/FormField.test.js +37 -0
- package/dist/components/formField/FormField.test.js.map +1 -0
- package/dist/components/formField/inputs/text/TextInput.d.ts +7 -0
- package/dist/components/formField/inputs/text/TextInput.d.ts.map +1 -0
- package/dist/components/formField/inputs/text/TextInput.js +11 -0
- package/dist/components/formField/inputs/text/TextInput.js.map +1 -0
- package/dist/components/formField/inputs/text/TextInput.stories.d.ts +31 -0
- package/dist/components/formField/inputs/text/TextInput.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/text/TextInput.stories.js +37 -0
- package/dist/components/formField/inputs/text/TextInput.stories.js.map +1 -0
- package/dist/components/formField/inputs/text/TextInput.test.d.ts +2 -0
- package/dist/components/formField/inputs/text/TextInput.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/text/TextInput.test.js +29 -0
- package/dist/components/formField/inputs/text/TextInput.test.js.map +1 -0
- package/dist/components/formField/inputs/textArea/TextArea.d.ts +7 -0
- package/dist/components/formField/inputs/textArea/TextArea.d.ts.map +1 -0
- package/dist/components/formField/inputs/textArea/TextArea.js +26 -0
- package/dist/components/formField/inputs/textArea/TextArea.js.map +1 -0
- package/dist/components/formField/inputs/textArea/TextArea.stories.d.ts +11 -0
- package/dist/components/formField/inputs/textArea/TextArea.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/textArea/TextArea.stories.js +14 -0
- package/dist/components/formField/inputs/textArea/TextArea.stories.js.map +1 -0
- package/dist/components/formField/inputs/textArea/TextArea.test.d.ts +2 -0
- package/dist/components/formField/inputs/textArea/TextArea.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/textArea/TextArea.test.js +19 -0
- package/dist/components/formField/inputs/textArea/TextArea.test.js.map +1 -0
- package/dist/components/formField/label/Label.d.ts +3 -0
- package/dist/components/formField/label/Label.d.ts.map +1 -0
- package/dist/components/formField/label/Label.js +8 -0
- package/dist/components/formField/label/Label.js.map +1 -0
- package/dist/components/formField/label/Label.stories.d.ts +10 -0
- package/dist/components/formField/label/Label.stories.d.ts.map +1 -0
- package/dist/components/formField/label/Label.stories.js +12 -0
- package/dist/components/formField/label/Label.stories.js.map +1 -0
- package/dist/components/formField/label/Label.test.d.ts +2 -0
- package/dist/components/formField/label/Label.test.d.ts.map +1 -0
- package/dist/components/formField/label/Label.test.js +10 -0
- package/dist/components/formField/label/Label.test.js.map +1 -0
- package/dist/components/heading/Heading.test.d.ts +2 -0
- package/dist/components/heading/Heading.test.d.ts.map +1 -0
- package/dist/components/heading/Heading.test.js +20 -0
- package/dist/components/heading/Heading.test.js.map +1 -0
- package/dist/components/icon/Icon.test.d.ts +2 -0
- package/dist/components/icon/Icon.test.d.ts.map +1 -0
- package/dist/components/icon/Icon.test.js +17 -0
- package/dist/components/icon/Icon.test.js.map +1 -0
- package/dist/components/icon/customIcons/CheckSolid.js.map +1 -1
- package/dist/components/icon/customIcons/XSolid.js.map +1 -1
- package/dist/components/pill/Pill.test.d.ts +2 -0
- package/dist/components/pill/Pill.test.d.ts.map +1 -0
- package/dist/components/pill/Pill.test.js +20 -0
- package/dist/components/pill/Pill.test.js.map +1 -0
- package/dist/components/tabs/Tabs.d.ts +21 -0
- package/dist/components/tabs/Tabs.d.ts.map +1 -0
- package/dist/components/tabs/Tabs.js +43 -0
- package/dist/components/tabs/Tabs.js.map +1 -0
- package/dist/components/tabs/Tabs.stories.d.ts +11 -0
- package/dist/components/tabs/Tabs.stories.d.ts.map +1 -0
- package/dist/components/tabs/Tabs.stories.js +74 -0
- package/dist/components/tabs/Tabs.stories.js.map +1 -0
- package/dist/components/tabs/Tabs.test.d.ts +2 -0
- package/dist/components/tabs/Tabs.test.d.ts.map +1 -0
- package/dist/components/tabs/Tabs.test.js +115 -0
- package/dist/components/tabs/Tabs.test.js.map +1 -0
- package/dist/index.css +132 -24
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -4
- package/src/components/card/card.scss +1 -1
- package/src/components/formField/FormField.stories.tsx +112 -0
- package/src/components/formField/FormField.test.tsx +41 -0
- package/src/components/formField/FormField.tsx +73 -0
- package/src/components/formField/formField.scss +41 -0
- package/src/components/formField/inputs/input.scss +75 -0
- package/src/components/formField/inputs/text/TextInput.stories.tsx +42 -0
- package/src/components/formField/inputs/text/TextInput.test.tsx +31 -0
- package/src/components/formField/inputs/text/TextInput.tsx +35 -0
- package/src/components/formField/inputs/textArea/TextArea.stories.tsx +18 -0
- package/src/components/formField/inputs/textArea/TextArea.test.tsx +19 -0
- package/src/components/formField/inputs/textArea/TextArea.tsx +56 -0
- package/src/components/formField/label/Label.stories.tsx +15 -0
- package/src/components/formField/label/Label.test.tsx +9 -0
- package/src/components/formField/label/Label.tsx +8 -0
- package/src/components/formField/label/label.scss +9 -0
- package/src/components/icon/customIcons/CheckSolid.tsx +1 -1
- package/src/components/icon/customIcons/XSolid.tsx +1 -1
- package/src/index.scss +10 -7
- package/src/index.ts +8 -6
- package/src/tokens.scss +25 -22
- package/tsconfig.json +8 -4
- package/vitest.config.ts +7 -16
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import {} from 'react';
|
|
4
|
+
export const TextInput = (props) => {
|
|
5
|
+
const { size = 'M', hasError, className = '', disabled = false, ...rest } = props;
|
|
6
|
+
const inputClasses = classNames('ds-text-input', 'ds-input', `ds-input--${size}`, {
|
|
7
|
+
'ds-input--error': hasError,
|
|
8
|
+
}, className);
|
|
9
|
+
return (_jsx("input", { className: inputClasses, disabled: disabled, ...rest }));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/text/TextInput.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAA4B,MAAM,OAAO,CAAC;AAOjD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,MAAM,EACJ,IAAI,GAAG,GAAG,EACV,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,QAAQ,GAAG,KAAK,EAChB,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,UAAU,CAC7B,eAAe,EACf,UAAU,EACV,aAAa,IAAI,EAAE,EACnB;QACE,iBAAiB,EAAE,QAAQ;KAC5B,EACD,SAAS,CACV,CAAC;IAEF,OAAO,CACL,gBACE,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,QAAQ,KACd,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: (props: import("./TextInput").TextInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
args: {
|
|
10
|
+
onChange: import("@vitest/spy").Mock<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
12
|
+
argTypes: {
|
|
13
|
+
size: {
|
|
14
|
+
control: "select";
|
|
15
|
+
options: string[];
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
disabled: {
|
|
19
|
+
control: "boolean";
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
placeholder: {
|
|
23
|
+
control: "text";
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
export declare const Default: Story;
|
|
31
|
+
//# sourceMappingURL=TextInput.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/text/TextInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;CAyBwB,CAAC;AAEnC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { TextInput } from './TextInput';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/FormField/Inputs/TextInput',
|
|
5
|
+
component: TextInput,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'centered',
|
|
8
|
+
},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
args: {
|
|
11
|
+
onChange: fn(),
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
size: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['M', 'S'],
|
|
17
|
+
description: 'Input size',
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
control: 'boolean',
|
|
21
|
+
description: 'Disable the input',
|
|
22
|
+
},
|
|
23
|
+
placeholder: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Input placeholder text',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default meta;
|
|
30
|
+
// Default input
|
|
31
|
+
export const Default = {
|
|
32
|
+
args: {
|
|
33
|
+
placeholder: 'Enter text...',
|
|
34
|
+
size: 'M',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=TextInput.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.stories.js","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/text/TextInput.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,uCAAuC;IAC9C,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE,EAAE;KACf;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;YACnB,WAAW,EAAE,YAAY;SAC1B;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,mBAAmB;SACjC;QACD,WAAW,EAAE;YACX,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,wBAAwB;SACtC;KACF;CAC+B,CAAC;AAEnC,eAAe,IAAI,CAAC;AAGpB,gBAAgB;AAChB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,GAAG;KACV;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/text/TextInput.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { expect, test, describe, vi } from 'vitest';
|
|
3
|
+
import { TextInput } from './TextInput';
|
|
4
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
describe('Input component', () => {
|
|
7
|
+
test('renders input element', () => {
|
|
8
|
+
render(_jsx(TextInput, { placeholder: "Enter text" }));
|
|
9
|
+
expect(screen.getByPlaceholderText('Enter text')).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
test('calls onChange when input changes', () => {
|
|
12
|
+
const onChange = vi.fn();
|
|
13
|
+
render(_jsx(TextInput, { placeholder: "Enter text", onChange: onChange }));
|
|
14
|
+
fireEvent.change(screen.getByPlaceholderText('Enter text'), { target: { value: 'Hello' } });
|
|
15
|
+
expect(onChange).toHaveBeenCalled();
|
|
16
|
+
expect(screen.getByPlaceholderText('Enter text').value).toBe('Hello');
|
|
17
|
+
});
|
|
18
|
+
test('applies default size class', () => {
|
|
19
|
+
render(_jsx(TextInput, { placeholder: "Enter text" }));
|
|
20
|
+
const input = screen.getByPlaceholderText('Enter text');
|
|
21
|
+
expect(input).toHaveClass('ds-input--M');
|
|
22
|
+
});
|
|
23
|
+
test('applies correct size class when specified', () => {
|
|
24
|
+
render(_jsx(TextInput, { size: "S", placeholder: "Enter text" }));
|
|
25
|
+
const input = screen.getByPlaceholderText('Enter text');
|
|
26
|
+
expect(input).toHaveClass('ds-input--S');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=TextInput.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.test.js","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/text/TextInput.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,KAAC,SAAS,IAAC,WAAW,EAAC,YAAY,GAAG,CAAC,CAAC;QAC/C,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC7C,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACzB,MAAM,CAAC,KAAC,SAAS,IAAC,WAAW,EAAC,YAAY,EAAC,QAAQ,EAAE,QAAQ,GAAI,CAAC,CAAC;QACnE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QAC5F,MAAM,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACpC,MAAM,CAAE,MAAM,CAAC,oBAAoB,CAAC,YAAY,CAAsB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,KAAC,SAAS,IAAC,WAAW,EAAC,YAAY,GAAG,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,KAAC,SAAS,IAAC,IAAI,EAAC,GAAG,EAAC,WAAW,EAAC,YAAY,GAAG,CAAC,CAAC;QACxD,MAAM,KAAK,GAAG,MAAM,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TextareaHTMLAttributes } from 'react';
|
|
2
|
+
export type TextAreaProps = {
|
|
3
|
+
hasError?: boolean;
|
|
4
|
+
autoSize?: boolean;
|
|
5
|
+
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>;
|
|
6
|
+
export declare const TextArea: (props: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=TextArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/textArea/TextArea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEjE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,4CA8C5C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
export const TextArea = (props) => {
|
|
5
|
+
const { hasError, className = '', disabled = false, autoSize = true, onChange, ...rest } = props;
|
|
6
|
+
const inputRef = useRef(null);
|
|
7
|
+
const inputClasses = classNames('ds-textarea', 'ds-input', {
|
|
8
|
+
'ds-input--error': hasError,
|
|
9
|
+
}, className);
|
|
10
|
+
const autosizeTextArea = () => {
|
|
11
|
+
if (inputRef.current) {
|
|
12
|
+
inputRef.current.style.height = 'auto';
|
|
13
|
+
const verticalPadding = 4;
|
|
14
|
+
const newHeight = inputRef.current.scrollHeight;
|
|
15
|
+
inputRef.current.style.height = `${newHeight + verticalPadding}px`;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const handleOnChange = (e) => {
|
|
19
|
+
onChange?.(e);
|
|
20
|
+
if (autoSize) {
|
|
21
|
+
autosizeTextArea();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return (_jsx("textarea", { ref: inputRef, className: inputClasses, disabled: disabled, onChange: handleOnChange, ...rest }));
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=TextArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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ACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { TextArea } from './TextArea';
|
|
3
|
+
declare const meta: Meta<typeof TextArea>;
|
|
4
|
+
export declare const Default: {
|
|
5
|
+
args: {
|
|
6
|
+
title: string;
|
|
7
|
+
onChange: import("@vitest/spy").Mock<(...args: any[]) => any>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
//# sourceMappingURL=TextArea.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/textArea/TextArea.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAG/B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { fn } from 'storybook/test';
|
|
2
|
+
import { TextArea } from './TextArea';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/FormField/Inputs/TextArea',
|
|
5
|
+
component: TextArea,
|
|
6
|
+
};
|
|
7
|
+
export const Default = {
|
|
8
|
+
args: {
|
|
9
|
+
title: 'titleValue',
|
|
10
|
+
onChange: fn(),
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
//# sourceMappingURL=TextArea.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.stories.js","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/textArea/TextArea.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,IAAI,GAA0B;IAClC,KAAK,EAAE,sCAAsC;IAC7C,SAAS,EAAE,QAAQ;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,EAAE,EAAE;KACf;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/textArea/TextArea.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { expect, describe, test, vi } from 'vitest';
|
|
3
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
4
|
+
import { TextArea } from './TextArea';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
describe('TextArea component', () => {
|
|
7
|
+
test('TextArea says hello', () => {
|
|
8
|
+
render(_jsx(TextArea, { placeholder: "Hello I'm a TextArea!" }));
|
|
9
|
+
expect(screen.getByPlaceholderText("Hello I'm a TextArea!")).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
test('calls onChange when input changes', () => {
|
|
12
|
+
const onChange = vi.fn();
|
|
13
|
+
render(_jsx(TextArea, { placeholder: "Enter text", onChange: onChange }));
|
|
14
|
+
fireEvent.change(screen.getByPlaceholderText('Enter text'), { target: { value: 'Hello' } });
|
|
15
|
+
expect(onChange).toHaveBeenCalled();
|
|
16
|
+
expect(screen.getByPlaceholderText('Enter text').value).toBe('Hello');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=TextArea.test.js.map
|
|
@@ -0,0 +1 @@
|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file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/components/formField/label/Label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,eAAO,MAAM,KAAK,GAAI,OAAO,SAAS,CAAC,gBAAgB,CAAC,4CAIvD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
export const Label = (props) => {
|
|
4
|
+
const { className, htmlFor, children } = props;
|
|
5
|
+
const classes = classNames('ds-label', className);
|
|
6
|
+
return _jsx("label", { className: classes, htmlFor: htmlFor, children: children });
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/formField/label/Label.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAkC,EAAE,EAAE;IAC1D,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC/C,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAClD,OAAO,gBAAO,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,YAAG,QAAQ,GAAS,CAAC;AACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { Label } from './Label';
|
|
3
|
+
declare const meta: Meta<typeof Label>;
|
|
4
|
+
export declare const Default: {
|
|
5
|
+
args: {
|
|
6
|
+
children: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
//# sourceMappingURL=Label.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/formField/label/Label.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAG5B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;CAInB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Label } from './Label';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Components/FormField/Inputs/Label',
|
|
4
|
+
component: Label,
|
|
5
|
+
};
|
|
6
|
+
export const Default = {
|
|
7
|
+
args: {
|
|
8
|
+
children: 'Label',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
//# sourceMappingURL=Label.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.stories.js","sourceRoot":"","sources":["../../../../src/components/formField/label/Label.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,mCAAmC;IAC1C,SAAS,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,QAAQ,EAAE,OAAO;KAClB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.test.d.ts","sourceRoot":"","sources":["../../../../src/components/formField/label/Label.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { Label } from './Label';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
test('Label says hello', () => {
|
|
7
|
+
render(_jsx(Label, { children: "Hello I'm a Label!" }));
|
|
8
|
+
expect(screen.getByText("Hello I'm a Label!")).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=Label.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.test.js","sourceRoot":"","sources":["../../../../src/components/formField/label/Label.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,kCAAkC,CAAC;AAE1C,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC5B,MAAM,CAAC,KAAC,KAAK,qCAA2B,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACrE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.test.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { Heading } from './Heading';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
describe('Heading', () => {
|
|
7
|
+
test('Heading renders', () => {
|
|
8
|
+
render(_jsx(Heading, { children: "Hello, World!" }));
|
|
9
|
+
expect(screen.getByText('Hello, World!')).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
test('Heading renders an h1 tag by default', () => {
|
|
12
|
+
render(_jsx(Heading, { children: "foobar" }));
|
|
13
|
+
expect(screen.getByText('foobar').tagName).toBe('H1');
|
|
14
|
+
});
|
|
15
|
+
test('Heading respects level prop', () => {
|
|
16
|
+
render(_jsx(Heading, { level: 2, children: "foobar" }));
|
|
17
|
+
expect(screen.getByText('foobar').tagName).toBe('H2');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=Heading.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.test.js","sourceRoot":"","sources":["../../../src/components/heading/Heading.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC3B,MAAM,CACJ,KAAC,OAAO,gCAEE,CACX,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAChD,MAAM,CACJ,KAAC,OAAO,yBAAiB,CAC1B,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,KAAC,OAAO,IAAC,KAAK,EAAE,CAAC,uBAAkB,CAAC,CAAC;QAE5C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.test.d.ts","sourceRoot":"","sources":["../../../src/components/icon/Icon.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { Icon } from './Icon';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
describe('Icon', () => {
|
|
7
|
+
test('Icon renders', () => {
|
|
8
|
+
render(_jsx(Icon, { name: "archive" }));
|
|
9
|
+
expect(screen.getByRole('img', { hidden: true })).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
test('Screen reader text', () => {
|
|
12
|
+
render(_jsx(Icon, { name: "arrow-right", screenReaderText: "foobar" }));
|
|
13
|
+
expect(screen.getByText('foobar')).toBeInTheDocument();
|
|
14
|
+
expect(screen.getByText('foobar')).toHaveClass('sr-only');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=Icon.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.test.js","sourceRoot":"","sources":["../../../src/components/icon/Icon.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,EAAC,gBAAgB,EAAC,QAAQ,GAAG,CAAC,CAAC;QAC9D,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACvD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckSolid.js","sourceRoot":"","sources":["../../../../src/components/icon/customIcons/CheckSolid.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CheckSolid.js","sourceRoot":"","sources":["../../../../src/components/icon/customIcons/CheckSolid.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACnD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACvD,OAAO,CACL,eACE,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,KAC9B,IAAI,aAER,2BACE,mBAAU,EAAE,EAAE,MAAM,YAClB,eAAM,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,GAAG,GACnC,EACX,gBAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC,gBAAgB,aAC1C,eAAM,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,GAAQ,EACrD,eACE,CAAC,EAAC,2BAA2B,EAC7B,MAAM,EAAC,OAAO,EACd,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,IACG,IACF,EACP,YAAG,QAAQ,EAAE,QAAQ,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,MAAM,GAAG,YACrD,eACE,CAAC,EAAC,MAAM,EACR,CAAC,EAAC,MAAM,EACR,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,EAAE,EAAC,MAAM,EACT,IAAI,EAAE,KAAK,GACX,GACA,IACA,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XSolid.js","sourceRoot":"","sources":["../../../../src/components/icon/customIcons/XSolid.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"XSolid.js","sourceRoot":"","sources":["../../../../src/components/icon/customIcons/XSolid.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAsB,EAAE,EAAE;IAC/C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACvD,OAAO,CACL,eACE,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,KAC9B,IAAI,aAER,yBACE,gBAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC,gBAAgB,aAC1C,eAAM,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,GAAQ,EACrD,eACE,CAAC,EAAC,kBAAkB,EACpB,MAAM,EAAC,OAAO,EACd,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,IACG,GACF,EACP,YAAG,IAAI,EAAE,QAAQ,MAAM,GAAG,YACxB,eAAM,CAAC,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAE,KAAK,GAAI,GAC7D,IACA,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pill.test.d.ts","sourceRoot":"","sources":["../../../src/components/pill/Pill.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { Pill } from './Pill';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
describe('Pill', () => {
|
|
7
|
+
test('Pill says hello', () => {
|
|
8
|
+
render(_jsx(Pill, { text: "Hello I'm a Pill!" }));
|
|
9
|
+
expect(screen.getByText("Hello I'm a Pill!")).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
test('Pill has default color green', () => {
|
|
12
|
+
render(_jsx(Pill, { text: "Hello I'm a Pill!" }));
|
|
13
|
+
expect(screen.getByText("Hello I'm a Pill!")).toHaveClass('ds-pill--green');
|
|
14
|
+
});
|
|
15
|
+
test('Pill has custom color', () => {
|
|
16
|
+
render(_jsx(Pill, { text: "Hello I'm a Pill!", color: "blue" }));
|
|
17
|
+
expect(screen.getByText("Hello I'm a Pill!")).toHaveClass('ds-pill--blue');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=Pill.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pill.test.js","sourceRoot":"","sources":["../../../src/components/pill/Pill.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,mBAAmB,GAAG,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,mBAAmB,GAAG,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,mBAAmB,EAAC,KAAK,EAAC,MAAM,GAAG,CAAC,CAAC;QACvD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
type TabsProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
defaultActiveTab?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
onTabChange?: (tabId: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const Tabs: {
|
|
9
|
+
({ children, defaultActiveTab, className, onTabChange, }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
Item: ({ children, tabId, label, disabled, className, }: TabsItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
};
|
|
12
|
+
type TabsItemProps = {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
tabId: string;
|
|
15
|
+
label: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const TabsItem: ({ children, tabId, label, disabled, className, }: TabsItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":"AACA,OAAc,EAAuC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBnF,KAAK,SAAS,GAAG;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,IAAI;8DAKd,SAAS;6DA+BT,aAAa;CAhBf,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,kDAMtB,aAAa,4CAiDf,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import React, { createContext, useContext, useState } from 'react';
|
|
4
|
+
const TabsContext = createContext(undefined);
|
|
5
|
+
const useTabsContext = () => {
|
|
6
|
+
const context = useContext(TabsContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error('Tabs.Item must be used within a Tabs component');
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
12
|
+
export const Tabs = ({ children, defaultActiveTab, className = '', onTabChange, }) => {
|
|
13
|
+
const [activeTab, setActiveTab] = useState(defaultActiveTab || '');
|
|
14
|
+
const handleTabChange = (tabId) => {
|
|
15
|
+
setActiveTab(tabId);
|
|
16
|
+
onTabChange?.(tabId);
|
|
17
|
+
};
|
|
18
|
+
return (_jsx(TabsContext.Provider, { value: { activeTab, setActiveTab: handleTabChange }, children: _jsx("div", { className: classNames('ds-tabs', className), children: children }) }));
|
|
19
|
+
};
|
|
20
|
+
export const TabsItem = ({ children, tabId, label, disabled = false, className = '', }) => {
|
|
21
|
+
const { activeTab, setActiveTab } = useTabsContext();
|
|
22
|
+
const isActive = activeTab === tabId;
|
|
23
|
+
const handleClick = () => {
|
|
24
|
+
if (!disabled) {
|
|
25
|
+
setActiveTab(tabId);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const handleKeyDown = (e) => {
|
|
29
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
if (!disabled) {
|
|
32
|
+
setActiveTab(tabId);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs("div", { className: classNames('ds-tabs__item', className), children: [_jsx("button", { className: classNames('ds-tabs__tab', {
|
|
37
|
+
'ds-tabs__tab--active': isActive,
|
|
38
|
+
'ds-tabs__tab--disabled': disabled,
|
|
39
|
+
}), onClick: handleClick, onKeyDown: handleKeyDown, disabled: disabled, role: "tab", "aria-selected": isActive, "aria-controls": `tabpanel-${tabId}`, id: `tab-${tabId}`, tabIndex: isActive ? 0 : -1, children: label }), isActive && (_jsx("div", { className: "ds-tabs__content", role: "tabpanel", id: `tabpanel-${tabId}`, "aria-labelledby": `tab-${tabId}`, children: children }))] }));
|
|
40
|
+
};
|
|
41
|
+
// Compound component pattern
|
|
42
|
+
Tabs.Item = TabsItem;
|
|
43
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAOnF,MAAM,WAAW,GAAG,aAAa,CAA8B,SAAS,CAAC,CAAC;AAE1E,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,O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AK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACvC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,YAAY,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,aACpD,iBACE,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE;oBACpC,sBAAsB,EAAE,QAAQ;oBAChC,wBAAwB,EAAE,QAAQ;iBACnC,CAAC,EACF,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,KAAK,mBACK,QAAQ,mBACR,YAAY,KAAK,EAAE,EAClC,EAAE,EAAE,OAAO,KAAK,EAAE,EAClB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAE1B,KAAK,GACC,EACR,QAAQ,IAAI,CACX,cACE,SAAS,EAAC,kBAAkB,EAC5B,IAAI,EAAC,UAAU,EACf,EAAE,EAAE,YAAY,KAAK,EAAE,qBACN,OAAO,KAAK,EAAE,YAE9B,QAAQ,GACL,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,6BAA6B;AAC7B,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Tabs } from './Tabs';
|
|
3
|
+
declare const meta: Meta<typeof Tabs>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithDisabledTab: Story;
|
|
8
|
+
export declare const ManyTabs: Story;
|
|
9
|
+
export declare const WithRichContent: Story;
|
|
10
|
+
export declare const CustomStyling: Story;
|
|
11
|
+
//# sourceMappingURL=Tabs.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAyB3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KA0BrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KA0B7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KA4CtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KA2D7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAqC3B,CAAC"}
|