@fuf-stack/pixels 0.0.5 → 0.0.8
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/dist/Button/Button.cjs +3 -3
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.js +2 -2
- package/dist/Button/index.cjs +5 -5
- package/dist/Button/index.cjs.map +1 -1
- package/dist/Button/index.js +3 -3
- package/dist/Button/index.js.map +1 -1
- package/dist/Button/subcomponents/LoadingSpinner.cjs +1 -1
- package/dist/Button/subcomponents/LoadingSpinner.cjs.map +1 -1
- package/dist/Button/subcomponents/LoadingSpinner.js +1 -1
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.cjs.map +1 -1
- package/dist/Card/Card.d.cts +3 -3
- package/dist/Card/Card.d.ts +3 -3
- package/dist/Card/Card.js +1 -1
- package/dist/Card/index.cjs +3 -3
- package/dist/Card/index.cjs.map +1 -1
- package/dist/Card/index.d.cts +1 -1
- package/dist/Card/index.d.ts +1 -1
- package/dist/Card/index.js +2 -2
- package/dist/Card/index.js.map +1 -1
- package/dist/{chunk-XWTXH2TR.js → chunk-XPTSDDXG.js} +2 -2
- package/dist/chunk-XPTSDDXG.js.map +1 -0
- package/dist/{chunk-YOPQSZ46.js → chunk-ZFEVTQWW.js} +2 -2
- package/dist/chunk-ZFEVTQWW.js.map +1 -0
- package/dist/{chunk-WQN756O7.js → chunk-ZXTDGCUF.js} +3 -3
- package/dist/chunk-ZXTDGCUF.js.map +1 -0
- package/dist/hooks/useDebounce.cjs +43 -0
- package/dist/hooks/useDebounce.cjs.map +1 -0
- package/dist/hooks/useDebounce.d.cts +3 -0
- package/dist/hooks/useDebounce.d.ts +3 -0
- package/dist/hooks/useDebounce.js +22 -0
- package/dist/hooks/useDebounce.js.map +1 -0
- package/dist/hooks/useLocalStorage.cjs +73 -0
- package/dist/hooks/useLocalStorage.cjs.map +1 -0
- package/dist/hooks/useLocalStorage.d.cts +5 -0
- package/dist/hooks/useLocalStorage.d.ts +5 -0
- package/dist/hooks/useLocalStorage.js +52 -0
- package/dist/hooks/useLocalStorage.js.map +1 -0
- package/package.json +6 -5
- package/.eslintrc +0 -16
- package/.storybook/main.ts +0 -8
- package/.storybook/preview-head.html +0 -3
- package/.storybook/preview.tsx +0 -7
- package/CHANGELOG.md +0 -36
- package/Globals.d.ts +0 -3
- package/dist/chunk-WQN756O7.js.map +0 -1
- package/dist/chunk-XWTXH2TR.js.map +0 -1
- package/dist/chunk-YOPQSZ46.js.map +0 -1
- package/src/components/Button/Button.stories.tsx +0 -75
- package/src/components/Button/Button.test.tsx +0 -9
- package/src/components/Button/Button.tsx +0 -74
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -235
- package/src/components/Button/index.ts +0 -7
- package/src/components/Button/subcomponents/LoadingSpinner.tsx +0 -26
- package/src/components/Card/Card.stories.tsx +0 -56
- package/src/components/Card/Card.test.tsx +0 -9
- package/src/components/Card/Card.tsx +0 -120
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +0 -94
- package/src/components/Card/index.ts +0 -3
- package/tailwind.config.js +0 -7
- package/tsconfig.json +0 -7
- package/tsup.config.ts +0 -15
- package/vitest.config.ts +0 -9
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/hooks/useLocalStorage.ts
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
var useLocalStorage = (key, initialValue) => {
|
|
4
|
+
const readValue = () => {
|
|
5
|
+
if (typeof window === "undefined") {
|
|
6
|
+
return initialValue;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const item = window.localStorage.getItem(key);
|
|
10
|
+
return item ? JSON.parse(item) : initialValue;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
|
|
13
|
+
return initialValue;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const [storedValue, setStoredValue] = useState(readValue);
|
|
17
|
+
const setValue = (value) => {
|
|
18
|
+
if (typeof window === "undefined") {
|
|
19
|
+
console.warn(
|
|
20
|
+
`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
25
|
+
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
26
|
+
setStoredValue(newValue);
|
|
27
|
+
window.dispatchEvent(new Event("local-storage"));
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setStoredValue(readValue());
|
|
34
|
+
}, []);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const handleStorageChange = () => {
|
|
37
|
+
setStoredValue(readValue());
|
|
38
|
+
};
|
|
39
|
+
window.addEventListener("storage", handleStorageChange);
|
|
40
|
+
window.addEventListener("local-storage", handleStorageChange);
|
|
41
|
+
return () => {
|
|
42
|
+
window.removeEventListener("storage", handleStorageChange);
|
|
43
|
+
window.removeEventListener("local-storage", handleStorageChange);
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
return [storedValue, setValue];
|
|
47
|
+
};
|
|
48
|
+
var useLocalStorage_default = useLocalStorage;
|
|
49
|
+
export {
|
|
50
|
+
useLocalStorage_default as default
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useLocalStorage.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nconst useLocalStorage = <T>(\n key: string,\n initialValue: T | (() => T),\n): [T, Dispatch<SetStateAction<T>>] => {\n // Get from local storage then\n // parse stored json or return initialValue\n const readValue = () => {\n // Prevent build error \"window is undefined\" but keep keep working\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n console.warn(`Error reading localStorage key “${key}”:`, error);\n return initialValue;\n }\n };\n\n // State to store our value\n // Pass initial state function to useState so logic is only executed once\n const [storedValue, setStoredValue] = useState<T>(readValue);\n\n // Return a wrapped version of useState's setter function that ...\n // ... persists the new value to localStorage.\n const setValue: Dispatch<SetStateAction<T>> = (value) => {\n // Prevent build error \"window is undefined\" but keeps working\n if (typeof window === 'undefined') {\n console.warn(\n `Tried setting localStorage key “${key}” even though environment is not a client`,\n );\n }\n\n try {\n // Allow value to be a function so we have the same API as useState\n const newValue = value instanceof Function ? value(storedValue) : value;\n\n // Save to local storage\n window.localStorage.setItem(key, JSON.stringify(newValue));\n\n // Save state\n setStoredValue(newValue);\n\n // We dispatch a custom event so every useLocalStorage hook are notified\n window.dispatchEvent(new Event('local-storage'));\n } catch (error) {\n console.warn(`Error setting localStorage key “${key}”:`, error);\n }\n };\n\n useEffect(() => {\n setStoredValue(readValue());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n const handleStorageChange = () => {\n setStoredValue(readValue());\n };\n\n // this only works for other documents, not the current one\n window.addEventListener('storage', handleStorageChange);\n\n // this is a custom event, triggered in writeValueToLocalStorage\n window.addEventListener('local-storage', handleStorageChange);\n\n return () => {\n window.removeEventListener('storage', handleStorageChange);\n window.removeEventListener('local-storage', handleStorageChange);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return [storedValue, setValue];\n};\n\nexport default useLocalStorage;\n"],"mappings":";AAEA,SAAS,WAAW,gBAAgB;AAEpC,IAAM,kBAAkB,CACtB,KACA,iBACqC;AAGrC,QAAM,YAAY,MAAM;AAEtB,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,QAAI;AACF,YAAM,OAAO,OAAO,aAAa,QAAQ,GAAG;AAC5C,aAAO,OAAO,KAAK,MAAM,IAAI,IAAI;AAAA,IACnC,SAAS,OAAO;AACd,cAAQ,KAAK,wCAAmC,GAAG,WAAM,KAAK;AAC9D,aAAO;AAAA,IACT;AAAA,EACF;AAIA,QAAM,CAAC,aAAa,cAAc,IAAI,SAAY,SAAS;AAI3D,QAAM,WAAwC,CAAC,UAAU;AAEvD,QAAI,OAAO,WAAW,aAAa;AACjC,cAAQ;AAAA,QACN,wCAAmC,GAAG;AAAA,MACxC;AAAA,IACF;AAEA,QAAI;AAEF,YAAM,WAAW,iBAAiB,WAAW,MAAM,WAAW,IAAI;AAGlE,aAAO,aAAa,QAAQ,KAAK,KAAK,UAAU,QAAQ,CAAC;AAGzD,qBAAe,QAAQ;AAGvB,aAAO,cAAc,IAAI,MAAM,eAAe,CAAC;AAAA,IACjD,SAAS,OAAO;AACd,cAAQ,KAAK,wCAAmC,GAAG,WAAM,KAAK;AAAA,IAChE;AAAA,EACF;AAEA,YAAU,MAAM;AACd,mBAAe,UAAU,CAAC;AAAA,EAE5B,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,UAAM,sBAAsB,MAAM;AAChC,qBAAe,UAAU,CAAC;AAAA,IAC5B;AAGA,WAAO,iBAAiB,WAAW,mBAAmB;AAGtD,WAAO,iBAAiB,iBAAiB,mBAAmB;AAE5D,WAAO,MAAM;AACX,aAAO,oBAAoB,WAAW,mBAAmB;AACzD,aAAO,oBAAoB,iBAAiB,mBAAmB;AAAA,IACjE;AAAA,EAEF,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,aAAa,QAAQ;AAC/B;AAEA,IAAO,0BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
"name": "@fuf-stack/pixels",
|
|
3
3
|
"description": "fuf react component library",
|
|
4
4
|
"author": "Hannes Tiede",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.8",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
|
-
"./": "./dist/"
|
|
9
|
-
"./components/*": "./dist/components/*/index.js"
|
|
8
|
+
"./": "./dist/"
|
|
10
9
|
},
|
|
11
10
|
"typesVersions": {
|
|
12
11
|
"*": {
|
|
@@ -15,7 +14,10 @@
|
|
|
15
14
|
]
|
|
16
15
|
}
|
|
17
16
|
},
|
|
18
|
-
"
|
|
17
|
+
"files": [
|
|
18
|
+
"./dist"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://github.com/fuf-stack/uniform/tree/main/packages/pixels",
|
|
19
21
|
"license": "MIT",
|
|
20
22
|
"publishConfig": {
|
|
21
23
|
"access": "public"
|
|
@@ -54,7 +56,6 @@
|
|
|
54
56
|
"@types/debug": "4.1.12",
|
|
55
57
|
"@types/react": "18.2.69",
|
|
56
58
|
"@types/react-dom": "18.2.22",
|
|
57
|
-
"tsup": "8.0.2",
|
|
58
59
|
"storybook-config": "0.0.1",
|
|
59
60
|
"tailwind-config": "0.0.1"
|
|
60
61
|
},
|
package/.eslintrc
DELETED
package/.storybook/main.ts
DELETED
package/.storybook/preview.tsx
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [0.0.5](https://github.com/fuf-stack/uniform/compare/pixels-v0.0.4...pixels-v0.0.5) (2024-04-12)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Bug Fixes
|
|
7
|
-
|
|
8
|
-
* **pixels:** move components into components folder ([9da42b1](https://github.com/fuf-stack/uniform/commit/9da42b10afe5a65351c93850139531659d1f6780))
|
|
9
|
-
|
|
10
|
-
## [0.0.4](https://github.com/fuf-stack/uniform/compare/pixels-v0.0.3...pixels-v0.0.4) (2024-04-12)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* **pixels:** fix exports definition ([ab58ff9](https://github.com/fuf-stack/uniform/commit/ab58ff9464fe41327fce7fd03b083e57b9fbfaaf))
|
|
16
|
-
|
|
17
|
-
## [0.0.3](https://github.com/fuf-stack/uniform/compare/pixels-v0.0.2...pixels-v0.0.3) (2024-04-12)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Bug Fixes
|
|
21
|
-
|
|
22
|
-
* **pixels:** add exports definition ([052874c](https://github.com/fuf-stack/uniform/commit/052874c5d6709b5aa31e10f6f4a34ac40dd20c3d))
|
|
23
|
-
|
|
24
|
-
## [0.0.2](https://github.com/fuf-stack/uniform/compare/pixels-v0.0.1...pixels-v0.0.2) (2024-04-12)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Bug Fixes
|
|
28
|
-
|
|
29
|
-
* **pixels:** add npm publish config ([e148803](https://github.com/fuf-stack/uniform/commit/e148803d5259943dd53e059d1fa1c506556f03d9))
|
|
30
|
-
|
|
31
|
-
## 0.0.1 (2024-04-12)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Features
|
|
35
|
-
|
|
36
|
-
* **pixels:** add inital package ([ad580ee](https://github.com/fuf-stack/uniform/commit/ad580eec37a2fefc5a61e08ce25c8e0328ba582f))
|
package/Globals.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/Button.tsx"],"sourcesContent":["import type { ButtonProps as NextButtonProps } from '@nextui-org/button';\nimport type { ReactNode } from 'react';\n\nimport { Button as NextButton } from '@nextui-org/button';\nimport cn from 'classnames';\n\nimport LoadingSpinner from './subcomponents/LoadingSpinner';\n\nexport interface ButtonProps {\n /** sets HTML aria-label attribute */\n ariaLabel?: string;\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string | string[];\n /** next ui button color */\n color?: NextButtonProps['color'];\n /** disables function of the button. */\n disabled?: boolean;\n /** If set loading animation is shown */\n loading?: boolean;\n /** optional icon */\n icon?: ReactNode;\n /** on click event */\n onClick?: NextButtonProps['onPress'];\n /** 3 size options */\n size?: NextButtonProps['size'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** sets the button type. */\n type?: 'button' | 'submit' | 'reset' | undefined;\n /** next ui button variants */\n variant?: NextButtonProps['variant'];\n}\n\n/**\n * Button component based on [NextUI Button](https://nextui.org/docs/components/button)\n */\nconst Button = ({\n ariaLabel = undefined,\n children = undefined,\n className = undefined,\n color = 'default',\n disabled = false,\n icon = undefined,\n loading = false,\n onClick = undefined,\n size = undefined,\n testId = undefined,\n type = undefined,\n variant = 'solid',\n}: ButtonProps) => {\n return (\n <NextButton\n aria-label={ariaLabel}\n className={cn(className)}\n color={color}\n data-testid={testId}\n isDisabled={disabled}\n isIconOnly={!!(icon && !children)}\n isLoading={loading}\n onPress={onClick}\n size={size}\n spinner={<LoadingSpinner />}\n type={type}\n variant={variant}\n >\n {icon}\n {children}\n </NextButton>\n );\n};\n\nexport default Button;\n"],"mappings":";;;;;AAGA,SAAS,UAAU,kBAAkB;AACrC,OAAO,QAAQ;AAiDX,SAUW,KAVX;AAfJ,IAAM,SAAS,CAAC;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AACZ,MAAmB;AACjB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,cAAY;AAAA,MACZ,WAAW,GAAG,SAAS;AAAA,MACvB;AAAA,MACA,eAAa;AAAA,MACb,YAAY;AAAA,MACZ,YAAY,CAAC,EAAE,QAAQ,CAAC;AAAA,MACxB,WAAW;AAAA,MACX,SAAS;AAAA,MACT;AAAA,MACA,SAAS,oBAAC,0BAAe;AAAA,MACzB;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,QACA;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Card/Card.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { VariantProps } from 'tailwind-variants';\n\nimport {\n Card as NextCard,\n CardBody as NextCardBody,\n CardFooter as NextCardFooter,\n CardHeader as NextCardHeader,\n} from '@nextui-org/card';\nimport { Divider as NextDivider } from '@nextui-org/divider';\nimport createDebug from 'debug';\nimport { tv } from 'tailwind-variants';\n\nconst debug = createDebug('component:Card');\n\n// card styling variants\nexport const cardVariants = tv({\n slots: {\n base: 'border border-slate-300',\n body: '',\n divider: 'my-0 bg-slate-300',\n footer: '',\n header: 'text-base font-semibold',\n },\n});\n\ntype CardVariantProps = VariantProps<typeof cardVariants>;\ntype CardVariantSlots = Partial<\n Record<keyof ReturnType<typeof cardVariants>, string>\n>;\n\nexport interface CardProps extends CardVariantProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string | CardVariantSlots;\n /** footer content */\n footer?: ReactNode;\n /** header content */\n header?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Card component based on [NextUI Card](https://nextui.org/docs/components/card)\n */\nconst Card = ({\n children = null,\n className = undefined,\n testId = undefined,\n header = undefined,\n footer = undefined,\n}: CardProps) => {\n debug('Card', { className, testId });\n const {\n base: baseSlot,\n body: bodySlot,\n divider: dividerSlot,\n footer: footerSlot,\n header: headerSlot,\n } = cardVariants();\n\n return (\n <NextCard\n data-testid={testId && `card_${testId}`}\n className={baseSlot({\n className: typeof className === 'object' ? className.base : className,\n })}\n fullWidth\n radius=\"sm\"\n shadow=\"none\"\n >\n {header && (\n <>\n <NextCardHeader\n data-testid={testId && `card_header_${testId}`}\n className={headerSlot({\n className: typeof className === 'object' && className.header,\n })}\n >\n {header}\n </NextCardHeader>\n <NextDivider\n className={dividerSlot({\n className: typeof className === 'object' && className.divider,\n })}\n />\n </>\n )}\n <NextCardBody\n data-testid={testId && `card_body_${testId}`}\n className={bodySlot({\n className: typeof className === 'object' && className.body,\n })}\n >\n {children}\n </NextCardBody>\n {footer && (\n <>\n <NextDivider\n className={dividerSlot({\n className: typeof className === 'object' && className.divider,\n })}\n />\n <NextCardFooter\n data-testid={testId && `card_footer_${testId}`}\n className={footerSlot({\n className: typeof className === 'object' && className.footer,\n })}\n >\n {footer}\n </NextCardFooter>\n </>\n )}\n </NextCard>\n );\n};\n\nexport default Card;\n"],"mappings":";AAGA;AAAA,EACE,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,cAAc;AAAA,OACT;AACP,SAAS,WAAW,mBAAmB;AACvC,OAAO,iBAAiB;AACxB,SAAS,UAAU;AA+DX,mBACE,KADF;AA7DR,IAAM,QAAQ,YAAY,gBAAgB;AAGnC,IAAM,eAAe,GAAG;AAAA,EAC7B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AACF,CAAC;AAuBD,IAAM,OAAO,CAAC;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AACX,MAAiB;AACf,QAAM,QAAQ,EAAE,WAAW,OAAO,CAAC;AACnC,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV,IAAI,aAAa;AAEjB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,UAAU,QAAQ,MAAM;AAAA,MACrC,WAAW,SAAS;AAAA,QAClB,WAAW,OAAO,cAAc,WAAW,UAAU,OAAO;AAAA,MAC9D,CAAC;AAAA,MACD,WAAS;AAAA,MACT,QAAO;AAAA,MACP,QAAO;AAAA,MAEN;AAAA,kBACC,iCACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAa,UAAU,eAAe,MAAM;AAAA,cAC5C,WAAW,WAAW;AAAA,gBACpB,WAAW,OAAO,cAAc,YAAY,UAAU;AAAA,cACxD,CAAC;AAAA,cAEA;AAAA;AAAA,UACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,WAAW,YAAY;AAAA,gBACrB,WAAW,OAAO,cAAc,YAAY,UAAU;AAAA,cACxD,CAAC;AAAA;AAAA,UACH;AAAA,WACF;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACC,eAAa,UAAU,aAAa,MAAM;AAAA,YAC1C,WAAW,SAAS;AAAA,cAClB,WAAW,OAAO,cAAc,YAAY,UAAU;AAAA,YACxD,CAAC;AAAA,YAEA;AAAA;AAAA,QACH;AAAA,QACC,UACC,iCACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAW,YAAY;AAAA,gBACrB,WAAW,OAAO,cAAc,YAAY,UAAU;AAAA,cACxD,CAAC;AAAA;AAAA,UACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,eAAa,UAAU,eAAe,MAAM;AAAA,cAC5C,WAAW,WAAW;AAAA,gBACpB,WAAW,OAAO,cAAc,YAAY,UAAU;AAAA,cACxD,CAAC;AAAA,cAEA;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,eAAQ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/subcomponents/LoadingSpinner.tsx"],"sourcesContent":["/**\n * svg loading spinner for button\n * @see https://nextui.org/docs/components/button#loading\n * */\nexport default () => (\n <svg\n className=\"animate-spin h-5 w-5 text-current\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n"],"mappings":";AAKE,SAME,KANF;AADF,IAAO,yBAAQ,MACb;AAAA,EAAC;AAAA;AAAA,IACC,WAAU;AAAA,IACV,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,OAAM;AAAA,IAEN;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,IAAG;AAAA,UACH,IAAG;AAAA,UACH,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA;AAAA,MACd;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,GAAE;AAAA,UACF,MAAK;AAAA;AAAA,MACP;AAAA;AAAA;AACF;","names":[]}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import type { ButtonProps } from './Button';
|
|
3
|
-
|
|
4
|
-
import Button from './Button';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Button> = {
|
|
7
|
-
title: 'pixels/Button',
|
|
8
|
-
component: Button,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof Button>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
children: 'Button',
|
|
17
|
-
testId: 'some-test-id',
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Disabled: StoryObj<typeof Button> = {
|
|
22
|
-
args: {
|
|
23
|
-
children: 'Button',
|
|
24
|
-
disabled: true,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Loading: StoryObj<typeof Button> = {
|
|
29
|
-
args: {
|
|
30
|
-
children: 'Button',
|
|
31
|
-
loading: true,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const AllColors: StoryObj<typeof Button> = {
|
|
36
|
-
render: () => (
|
|
37
|
-
<>
|
|
38
|
-
{['default', 'primary', 'secondary', 'success', 'warning', 'danger'].map(
|
|
39
|
-
(color) => (
|
|
40
|
-
<div key={color} style={{ marginTop: '10px' }}>
|
|
41
|
-
<Button color={color as ButtonProps['color']}>{color}</Button>
|
|
42
|
-
</div>
|
|
43
|
-
),
|
|
44
|
-
)}
|
|
45
|
-
</>
|
|
46
|
-
),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const AllSizes: StoryObj<typeof Button> = {
|
|
50
|
-
render: () => (
|
|
51
|
-
<>
|
|
52
|
-
{['sm', 'md', 'lg'].map((size) => (
|
|
53
|
-
<div key={size} style={{ marginTop: '10px' }}>
|
|
54
|
-
<Button size={size as ButtonProps['size']}>{size}</Button>
|
|
55
|
-
</div>
|
|
56
|
-
))}
|
|
57
|
-
</>
|
|
58
|
-
),
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const AllVariants: StoryObj<typeof Button> = {
|
|
62
|
-
render: () => (
|
|
63
|
-
<>
|
|
64
|
-
{['solid', 'bordered', 'light', 'flat', 'faded', 'shadow', 'ghost'].map(
|
|
65
|
-
(variant) => (
|
|
66
|
-
<div key={variant} style={{ marginTop: '10px' }}>
|
|
67
|
-
<Button variant={variant as ButtonProps['variant']}>
|
|
68
|
-
{variant}
|
|
69
|
-
</Button>
|
|
70
|
-
</div>
|
|
71
|
-
),
|
|
72
|
-
)}
|
|
73
|
-
</>
|
|
74
|
-
),
|
|
75
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { ButtonProps as NextButtonProps } from '@nextui-org/button';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
import { Button as NextButton } from '@nextui-org/button';
|
|
5
|
-
import cn from 'classnames';
|
|
6
|
-
|
|
7
|
-
import LoadingSpinner from './subcomponents/LoadingSpinner';
|
|
8
|
-
|
|
9
|
-
export interface ButtonProps {
|
|
10
|
-
/** sets HTML aria-label attribute */
|
|
11
|
-
ariaLabel?: string;
|
|
12
|
-
/** child components */
|
|
13
|
-
children?: ReactNode;
|
|
14
|
-
/** CSS class name */
|
|
15
|
-
className?: string | string[];
|
|
16
|
-
/** next ui button color */
|
|
17
|
-
color?: NextButtonProps['color'];
|
|
18
|
-
/** disables function of the button. */
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
/** If set loading animation is shown */
|
|
21
|
-
loading?: boolean;
|
|
22
|
-
/** optional icon */
|
|
23
|
-
icon?: ReactNode;
|
|
24
|
-
/** on click event */
|
|
25
|
-
onClick?: NextButtonProps['onPress'];
|
|
26
|
-
/** 3 size options */
|
|
27
|
-
size?: NextButtonProps['size'];
|
|
28
|
-
/** HTML data-testid attribute used in e2e tests */
|
|
29
|
-
testId?: string;
|
|
30
|
-
/** sets the button type. */
|
|
31
|
-
type?: 'button' | 'submit' | 'reset' | undefined;
|
|
32
|
-
/** next ui button variants */
|
|
33
|
-
variant?: NextButtonProps['variant'];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Button component based on [NextUI Button](https://nextui.org/docs/components/button)
|
|
38
|
-
*/
|
|
39
|
-
const Button = ({
|
|
40
|
-
ariaLabel = undefined,
|
|
41
|
-
children = undefined,
|
|
42
|
-
className = undefined,
|
|
43
|
-
color = 'default',
|
|
44
|
-
disabled = false,
|
|
45
|
-
icon = undefined,
|
|
46
|
-
loading = false,
|
|
47
|
-
onClick = undefined,
|
|
48
|
-
size = undefined,
|
|
49
|
-
testId = undefined,
|
|
50
|
-
type = undefined,
|
|
51
|
-
variant = 'solid',
|
|
52
|
-
}: ButtonProps) => {
|
|
53
|
-
return (
|
|
54
|
-
<NextButton
|
|
55
|
-
aria-label={ariaLabel}
|
|
56
|
-
className={cn(className)}
|
|
57
|
-
color={color}
|
|
58
|
-
data-testid={testId}
|
|
59
|
-
isDisabled={disabled}
|
|
60
|
-
isIconOnly={!!(icon && !children)}
|
|
61
|
-
isLoading={loading}
|
|
62
|
-
onPress={onClick}
|
|
63
|
-
size={size}
|
|
64
|
-
spinner={<LoadingSpinner />}
|
|
65
|
-
type={type}
|
|
66
|
-
variant={variant}
|
|
67
|
-
>
|
|
68
|
-
{icon}
|
|
69
|
-
{children}
|
|
70
|
-
</NextButton>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export default Button;
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`Story Snapshots > AllColors 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
style="margin-top: 10px;"
|
|
7
|
-
>
|
|
8
|
-
<button
|
|
9
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
10
|
-
type="button"
|
|
11
|
-
>
|
|
12
|
-
default
|
|
13
|
-
</button>
|
|
14
|
-
</div>
|
|
15
|
-
<div
|
|
16
|
-
style="margin-top: 10px;"
|
|
17
|
-
>
|
|
18
|
-
<button
|
|
19
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-primary text-primary-foreground data-[hover=true]:opacity-hover"
|
|
20
|
-
type="button"
|
|
21
|
-
>
|
|
22
|
-
primary
|
|
23
|
-
</button>
|
|
24
|
-
</div>
|
|
25
|
-
<div
|
|
26
|
-
style="margin-top: 10px;"
|
|
27
|
-
>
|
|
28
|
-
<button
|
|
29
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-secondary text-secondary-foreground data-[hover=true]:opacity-hover"
|
|
30
|
-
type="button"
|
|
31
|
-
>
|
|
32
|
-
secondary
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
<div
|
|
36
|
-
style="margin-top: 10px;"
|
|
37
|
-
>
|
|
38
|
-
<button
|
|
39
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-success text-success-foreground data-[hover=true]:opacity-hover"
|
|
40
|
-
type="button"
|
|
41
|
-
>
|
|
42
|
-
success
|
|
43
|
-
</button>
|
|
44
|
-
</div>
|
|
45
|
-
<div
|
|
46
|
-
style="margin-top: 10px;"
|
|
47
|
-
>
|
|
48
|
-
<button
|
|
49
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-warning text-warning-foreground data-[hover=true]:opacity-hover"
|
|
50
|
-
type="button"
|
|
51
|
-
>
|
|
52
|
-
warning
|
|
53
|
-
</button>
|
|
54
|
-
</div>
|
|
55
|
-
<div
|
|
56
|
-
style="margin-top: 10px;"
|
|
57
|
-
>
|
|
58
|
-
<button
|
|
59
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-danger text-danger-foreground data-[hover=true]:opacity-hover"
|
|
60
|
-
type="button"
|
|
61
|
-
>
|
|
62
|
-
danger
|
|
63
|
-
</button>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
exports[`Story Snapshots > AllSizes 1`] = `
|
|
69
|
-
<div>
|
|
70
|
-
<div
|
|
71
|
-
style="margin-top: 10px;"
|
|
72
|
-
>
|
|
73
|
-
<button
|
|
74
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-3 min-w-unit-16 h-unit-8 text-tiny gap-unit-2 rounded-small [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
75
|
-
type="button"
|
|
76
|
-
>
|
|
77
|
-
sm
|
|
78
|
-
</button>
|
|
79
|
-
</div>
|
|
80
|
-
<div
|
|
81
|
-
style="margin-top: 10px;"
|
|
82
|
-
>
|
|
83
|
-
<button
|
|
84
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
85
|
-
type="button"
|
|
86
|
-
>
|
|
87
|
-
md
|
|
88
|
-
</button>
|
|
89
|
-
</div>
|
|
90
|
-
<div
|
|
91
|
-
style="margin-top: 10px;"
|
|
92
|
-
>
|
|
93
|
-
<button
|
|
94
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-6 min-w-unit-24 h-unit-12 text-medium gap-unit-3 rounded-large [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
95
|
-
type="button"
|
|
96
|
-
>
|
|
97
|
-
lg
|
|
98
|
-
</button>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
exports[`Story Snapshots > AllVariants 1`] = `
|
|
104
|
-
<div>
|
|
105
|
-
<div
|
|
106
|
-
style="margin-top: 10px;"
|
|
107
|
-
>
|
|
108
|
-
<button
|
|
109
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
110
|
-
type="button"
|
|
111
|
-
>
|
|
112
|
-
solid
|
|
113
|
-
</button>
|
|
114
|
-
</div>
|
|
115
|
-
<div
|
|
116
|
-
style="margin-top: 10px;"
|
|
117
|
-
>
|
|
118
|
-
<button
|
|
119
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 border-medium px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-transparent border-default text-foreground data-[hover=true]:opacity-hover"
|
|
120
|
-
type="button"
|
|
121
|
-
>
|
|
122
|
-
bordered
|
|
123
|
-
</button>
|
|
124
|
-
</div>
|
|
125
|
-
<div
|
|
126
|
-
style="margin-top: 10px;"
|
|
127
|
-
>
|
|
128
|
-
<button
|
|
129
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-transparent text-default-foreground data-[hover=true]:bg-default/40"
|
|
130
|
-
type="button"
|
|
131
|
-
>
|
|
132
|
-
light
|
|
133
|
-
</button>
|
|
134
|
-
</div>
|
|
135
|
-
<div
|
|
136
|
-
style="margin-top: 10px;"
|
|
137
|
-
>
|
|
138
|
-
<button
|
|
139
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default/40 text-default-foreground data-[hover=true]:opacity-hover"
|
|
140
|
-
type="button"
|
|
141
|
-
>
|
|
142
|
-
flat
|
|
143
|
-
</button>
|
|
144
|
-
</div>
|
|
145
|
-
<div
|
|
146
|
-
style="margin-top: 10px;"
|
|
147
|
-
>
|
|
148
|
-
<button
|
|
149
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 border-medium px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none border-default bg-default-100 text-default-foreground data-[hover=true]:opacity-hover"
|
|
150
|
-
type="button"
|
|
151
|
-
>
|
|
152
|
-
faded
|
|
153
|
-
</button>
|
|
154
|
-
</div>
|
|
155
|
-
<div
|
|
156
|
-
style="margin-top: 10px;"
|
|
157
|
-
>
|
|
158
|
-
<button
|
|
159
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none shadow-lg shadow-default/50 bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
160
|
-
type="button"
|
|
161
|
-
>
|
|
162
|
-
shadow
|
|
163
|
-
</button>
|
|
164
|
-
</div>
|
|
165
|
-
<div
|
|
166
|
-
style="margin-top: 10px;"
|
|
167
|
-
>
|
|
168
|
-
<button
|
|
169
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 border-medium bg-transparent px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none border-default text-default-foreground hover:!bg-default"
|
|
170
|
-
type="button"
|
|
171
|
-
>
|
|
172
|
-
ghost
|
|
173
|
-
</button>
|
|
174
|
-
</div>
|
|
175
|
-
</div>
|
|
176
|
-
`;
|
|
177
|
-
|
|
178
|
-
exports[`Story Snapshots > Default 1`] = `
|
|
179
|
-
<div>
|
|
180
|
-
<button
|
|
181
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
182
|
-
data-testid="some-test-id"
|
|
183
|
-
type="button"
|
|
184
|
-
>
|
|
185
|
-
Button
|
|
186
|
-
</button>
|
|
187
|
-
</div>
|
|
188
|
-
`;
|
|
189
|
-
|
|
190
|
-
exports[`Story Snapshots > Disabled 1`] = `
|
|
191
|
-
<div>
|
|
192
|
-
<button
|
|
193
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium opacity-disabled pointer-events-none [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
194
|
-
data-disabled="true"
|
|
195
|
-
disabled=""
|
|
196
|
-
type="button"
|
|
197
|
-
>
|
|
198
|
-
Button
|
|
199
|
-
</button>
|
|
200
|
-
</div>
|
|
201
|
-
`;
|
|
202
|
-
|
|
203
|
-
exports[`Story Snapshots > Loading 1`] = `
|
|
204
|
-
<div>
|
|
205
|
-
<button
|
|
206
|
-
class="z-0 group relative inline-flex items-center justify-center box-border appearance-none select-none whitespace-nowrap font-normal subpixel-antialiased overflow-hidden tap-highlight-transparent outline-none data-[focus-visible=true]:z-10 data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-focus data-[focus-visible=true]:outline-offset-2 px-unit-4 min-w-unit-20 h-unit-10 text-small gap-unit-2 rounded-medium opacity-disabled pointer-events-none [&>svg]:max-w-[theme(spacing.unit-8)] data-[pressed=true]:scale-[0.97] transition-transform-colors-opacity motion-reduce:transition-none bg-default text-default-foreground data-[hover=true]:opacity-hover"
|
|
207
|
-
data-disabled="true"
|
|
208
|
-
data-loading="true"
|
|
209
|
-
disabled=""
|
|
210
|
-
type="button"
|
|
211
|
-
>
|
|
212
|
-
<svg
|
|
213
|
-
class="animate-spin h-5 w-5 text-current"
|
|
214
|
-
fill="none"
|
|
215
|
-
viewBox="0 0 24 24"
|
|
216
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
217
|
-
>
|
|
218
|
-
<circle
|
|
219
|
-
class="opacity-25"
|
|
220
|
-
cx="12"
|
|
221
|
-
cy="12"
|
|
222
|
-
r="10"
|
|
223
|
-
stroke="currentColor"
|
|
224
|
-
stroke-width="4"
|
|
225
|
-
/>
|
|
226
|
-
<path
|
|
227
|
-
class="opacity-75"
|
|
228
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
229
|
-
fill="currentColor"
|
|
230
|
-
/>
|
|
231
|
-
</svg>
|
|
232
|
-
Button
|
|
233
|
-
</button>
|
|
234
|
-
</div>
|
|
235
|
-
`;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* svg loading spinner for button
|
|
3
|
-
* @see https://nextui.org/docs/components/button#loading
|
|
4
|
-
* */
|
|
5
|
-
export default () => (
|
|
6
|
-
<svg
|
|
7
|
-
className="animate-spin h-5 w-5 text-current"
|
|
8
|
-
fill="none"
|
|
9
|
-
viewBox="0 0 24 24"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
>
|
|
12
|
-
<circle
|
|
13
|
-
className="opacity-25"
|
|
14
|
-
cx="12"
|
|
15
|
-
cy="12"
|
|
16
|
-
r="10"
|
|
17
|
-
stroke="currentColor"
|
|
18
|
-
strokeWidth="4"
|
|
19
|
-
/>
|
|
20
|
-
<path
|
|
21
|
-
className="opacity-75"
|
|
22
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
23
|
-
fill="currentColor"
|
|
24
|
-
/>
|
|
25
|
-
</svg>
|
|
26
|
-
);
|