@clubmed/trident-ui 2.0.0-alpha.29 → 2.0.0-alpha.30
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/package.json +1 -1
- package/ui/forms/Switch.d.ts +2 -3
- package/ui/forms/Switch.js.map +1 -1
package/package.json
CHANGED
package/ui/forms/Switch.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, FunctionComponent } from 'react';
|
|
2
2
|
import { Colors } from '../types/Colors';
|
|
3
|
-
interface
|
|
3
|
+
export interface SwitchProps extends ComponentPropsWithoutRef<'button'> {
|
|
4
4
|
checked: boolean;
|
|
5
5
|
color?: Colors;
|
|
6
6
|
}
|
|
7
|
-
export declare const Switch: FunctionComponent<
|
|
8
|
-
export {};
|
|
7
|
+
export declare const Switch: FunctionComponent<SwitchProps>;
|
package/ui/forms/Switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../lib/ui/forms/Switch.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ComponentPropsWithoutRef, FunctionComponent, MouseEvent } from 'react';\n\nimport { getBgColor } from '../helpers/colors/colors';\nimport type { Colors } from '../types/Colors';\n\
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../lib/ui/forms/Switch.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ComponentPropsWithoutRef, FunctionComponent, MouseEvent } from 'react';\n\nimport { getBgColor } from '../helpers/colors/colors';\nimport type { Colors } from '../types/Colors';\n\nexport interface SwitchProps extends ComponentPropsWithoutRef<'button'> {\n checked: boolean;\n color?: Colors;\n}\n\nexport const Switch: FunctionComponent<SwitchProps> = ({\n checked,\n className,\n color = 'saffron',\n onClick,\n ...attrs\n}) => {\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n if (!attrs.disabled) {\n onClick?.(e);\n }\n };\n\n return (\n <button\n {...attrs}\n aria-checked={checked}\n className={clsx(\n className,\n 'rounded-pill inline-flex min-w-56 items-center p-4 align-middle transition-colors',\n { 'bg-middleGrey': !checked },\n { [getBgColor(color)]: checked },\n )}\n data-name=\"Switch\"\n onClick={handleClick}\n role=\"switch\"\n type=\"button\"\n >\n <svg className=\"size-24\" viewBox=\"0 0 24 24\">\n <circle className=\"fill-white\" cx={12} cy={12} r={12} />\n <circle className=\"fill-middleGrey\" cx={12} cy={12} r={4} />\n <path d=\"M18.73 6c.35 0 .68.14.9.37.5.5.5 1.35 0 1.85l-8.54 8.75q-.37.38-.9.38t-.9-.38l-4.91-5.02a1.33 1.33 0 0 1 0-1.85 1.26 1.26 0 0 1 1.8 0l4.01 4.09 7.64-7.82c.23-.24.56-.37.9-.37\" />\n </svg>\n </button>\n );\n};\n"],"names":["Switch","checked","className","color","onClick","attrs","handleClick","e","jsx","clsx","getBgColor","jsxs"],"mappings":";;;;AAaO,MAAMA,IAAyC,CAAC;AAAA,EACrD,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,SAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAc,CAACC,MAAqC;AACxD,IAAKF,EAAM,YACTD,IAAUG,CAAC;AAAA,EAEf;AAEA,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGH;AAAA,MACJ,gBAAcJ;AAAA,MACd,WAAWQ;AAAA,QACTP;AAAA,QACA;AAAA,QACA,EAAE,iBAAiB,CAACD,EAAA;AAAA,QACpB,EAAE,CAACS,EAAWP,CAAK,CAAC,GAAGF,EAAA;AAAA,MAAQ;AAAA,MAEjC,aAAU;AAAA,MACV,SAASK;AAAA,MACT,MAAK;AAAA,MACL,MAAK;AAAA,MAEL,UAAA,gBAAAK,EAAC,OAAA,EAAI,WAAU,WAAU,SAAQ,aAC/B,UAAA;AAAA,QAAA,gBAAAH,EAAC,UAAA,EAAO,WAAU,cAAa,IAAI,IAAI,IAAI,IAAI,GAAG,GAAA,CAAI;AAAA,QACtD,gBAAAA,EAAC,YAAO,WAAU,mBAAkB,IAAI,IAAI,IAAI,IAAI,GAAG,EAAA,CAAG;AAAA,QAC1D,gBAAAA,EAAC,QAAA,EAAK,GAAE,iLAAA,CAAiL;AAAA,MAAA,EAAA,CAC3L;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|