@clubmed/trident-ui 1.3.0-beta.5 → 1.3.0-beta.6
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/CHANGELOG.md +7 -0
- package/chunks/_commonjsHelpers.js +24 -4
- package/chunks/_commonjsHelpers.js.map +1 -1
- package/chunks/index.js.map +1 -1
- package/chunks/plugin.js.map +1 -1
- package/contexts/Device.d.ts +2 -22
- package/contexts/Device.js +5 -59
- package/contexts/Device.js.map +1 -1
- package/contexts/Devices/Device.d.ts +11 -0
- package/contexts/Devices/Device.js +23 -0
- package/contexts/Devices/Device.js.map +1 -0
- package/contexts/Devices/hooks/useQueries.d.ts +6 -0
- package/contexts/Devices/hooks/useQueries.js +24 -0
- package/contexts/Devices/hooks/useQueries.js.map +1 -0
- package/contexts/Devices/reducers/reducer.d.ts +25 -0
- package/contexts/Devices/reducers/reducer.js +50 -0
- package/contexts/Devices/reducers/reducer.js.map +1 -0
- package/contexts/TridentUIConfig.js +228 -228
- package/contexts/TridentUIConfig.js.map +1 -1
- package/hooks/keyboard.constants.js.map +1 -1
- package/hooks/useInternalStatus.js.map +1 -1
- package/hooks/useKeyboardControls.js.map +1 -1
- package/hooks/useSafeBoop.js.map +1 -1
- package/hooks/useValue.js.map +1 -1
- package/molecules/Arrows/Arrows.js.map +1 -1
- package/molecules/Avatar.js.map +1 -1
- package/molecules/Backdrop.js.map +1 -1
- package/molecules/Breadcrumb.js.map +1 -1
- package/molecules/Buttons/ArrowButton.js +3 -3
- package/molecules/Buttons/ArrowButton.js.map +1 -1
- package/molecules/Buttons/Button.js.map +1 -1
- package/molecules/Buttons/ButtonAnchor.js +3 -3
- package/molecules/Buttons/ButtonAnchor.js.map +1 -1
- package/molecules/Buttons/ButtonContent.js.map +1 -1
- package/molecules/Buttons/{v2/FakeButton.d.ts → FakeButton.d.ts} +2 -2
- package/molecules/Buttons/{v2/FakeButton.js → FakeButton.js} +4 -4
- package/molecules/Buttons/FakeButton.js.map +1 -0
- package/molecules/Buttons/InertButton.js +4 -4
- package/molecules/Buttons/InertButton.js.map +1 -1
- package/molecules/Buttons/v2/Button.js.map +1 -1
- package/molecules/Buttons/v2/ButtonAnchor.js.map +1 -1
- package/molecules/Card.js.map +1 -1
- package/molecules/ElasticHeight.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkboxes.js.map +1 -1
- package/molecules/Forms/DateField.js +142 -115
- package/molecules/Forms/DateField.js.map +1 -1
- package/molecules/Forms/Filter.js.map +1 -1
- package/molecules/Forms/FormControl.js.map +1 -1
- package/molecules/Forms/FormLabel.js.map +1 -1
- package/molecules/Forms/NumberField.d.ts +1 -1
- package/molecules/Forms/NumberField.js.map +1 -1
- package/molecules/Forms/Password/Password.js.map +1 -1
- package/molecules/Forms/Password/ValidationMessage.js.map +1 -1
- package/molecules/Forms/Radios/Radio.js.map +1 -1
- package/molecules/Forms/Radios/RadioGroup.js +2 -2
- package/molecules/Forms/Radios/RadioGroup.js.map +1 -1
- package/molecules/Forms/Range.js.map +1 -1
- package/molecules/Forms/Select.js.map +1 -1
- package/molecules/Forms/Switch.js.map +1 -1
- package/molecules/Forms/TextField.js.map +1 -1
- package/molecules/HamburgerIcon.js.map +1 -1
- package/molecules/Link.js.map +1 -1
- package/molecules/Loader.js.map +1 -1
- package/molecules/Pagination.helper.js.map +1 -1
- package/molecules/Pagination.js +3 -3
- package/molecules/Pagination.js.map +1 -1
- package/molecules/Popin.js.map +1 -1
- package/molecules/Spinner.js.map +1 -1
- package/molecules/Tabs/Tab.js.map +1 -1
- package/molecules/Tabs/TabList.js.map +1 -1
- package/molecules/Tabs/TabPanel.js.map +1 -1
- package/molecules/Tabs/Tabs.js.map +1 -1
- package/molecules/Tabs/TabsBody.js.map +1 -1
- package/molecules/Tabs/context/TabControl.js.map +1 -1
- package/molecules/Tabs/hooks/tabControl.js.map +1 -1
- package/molecules/Tabs/theme.js.map +1 -1
- package/package.json +1 -1
- package/tailwind/plugins/animationDelay.js.map +1 -1
- package/tailwind/plugins/lineClampFix.js.map +1 -1
- package/tailwind/plugins/transitionBehavior.js.map +1 -1
- package/tailwind/tailwind.preset.js.map +1 -1
- package/types/Devices.d.ts +8 -0
- package/types/Devices.js +11 -0
- package/types/Devices.js.map +1 -0
- package/types/Direction.d.js +2 -0
- package/types/Direction.d.js.map +1 -0
- package/molecules/Buttons/v2/FakeButton.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.constants.js","sources":["../../lib/hooks/keyboard.constants.ts"],"sourcesContent":["export const enum CODE {\n ENTER = 'Enter',\n ESCAPE = 'Escape',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n SPACE = 'Space',\n END = 'End',\n HOME = 'Home',\n}\n\nexport const enum KEY {\n ENTER = 'Enter',\n ESCAPE = 'Escape',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n END = 'End',\n HOME = 'Home',\n SPACE = ' ',\n /**\n * @deprecated\n * Used by old browers, see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#whitespace_keys\n */\n SPACEBAR = 'Spacebar',\n}\n\nexport const enum KEY_CODE {\n ENTER = 13,\n ESCAPE = 27,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n SPACE = 32,\n END = 35,\n HOME = 36,\n}\n"],"names":["CODE","KEY","KEY_CODE"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyboard.constants.js","sources":["../../lib/hooks/keyboard.constants.ts"],"sourcesContent":["export const enum CODE {\n ENTER = 'Enter',\n ESCAPE = 'Escape',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n SPACE = 'Space',\n END = 'End',\n HOME = 'Home',\n}\n\nexport const enum KEY {\n ENTER = 'Enter',\n ESCAPE = 'Escape',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n END = 'End',\n HOME = 'Home',\n SPACE = ' ',\n /**\n * @deprecated\n * Used by old browers, see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#whitespace_keys\n */\n SPACEBAR = 'Spacebar',\n}\n\nexport const enum KEY_CODE {\n ENTER = 13,\n ESCAPE = 27,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n SPACE = 32,\n END = 35,\n HOME = 36,\n}\n"],"names":["CODE","KEY","KEY_CODE"],"mappings":"AAAO,IAAWA,sBAAAA,OAChBA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,aAAa,aACbA,EAAA,WAAW,WACXA,EAAA,cAAc,cACdA,EAAA,aAAa,aACbA,EAAA,QAAQ,SACRA,EAAA,MAAM,OACNA,EAAA,OAAO,QATSA,IAAAA,KAAA,CAAA,CAAA,GAYAC,sBAAAA,OAChBA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,aAAa,aACbA,EAAA,WAAW,WACXA,EAAA,cAAc,cACdA,EAAA,aAAa,aACbA,EAAA,MAAM,OACNA,EAAA,OAAO,QACPA,EAAA,QAAQ,KAKRA,EAAA,WAAW,YAdKA,IAAAA,KAAA,CAAA,CAAA,GAiBAC,sBAAAA,OAChBA,EAAAA,EAAA,QAAQ,EAAA,IAAR,SACAA,EAAAA,EAAA,SAAS,EAAA,IAAT,UACAA,EAAAA,EAAA,aAAa,EAAA,IAAb,cACAA,EAAAA,EAAA,WAAW,EAAA,IAAX,YACAA,EAAAA,EAAA,cAAc,EAAA,IAAd,eACAA,EAAAA,EAAA,aAAa,EAAA,IAAb,cACAA,EAAAA,EAAA,QAAQ,EAAA,IAAR,SACAA,EAAAA,EAAA,MAAM,EAAA,IAAN,OACAA,EAAAA,EAAA,OAAO,EAAA,IAAP,QATgBA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInternalStatus.js","sources":["../../lib/hooks/useInternalStatus.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport type ValidationStatus = 'default' | 'error' | 'success';\n\nexport const useInternalStatus = ({\n isDisabled,\n validationStatus,\n}: {\n isDisabled: boolean;\n validationStatus: ValidationStatus;\n}) => {\n const [internalStatus, setInternalStatus] = useState<ValidationStatus | 'disabled'>(\n getInternalStatus({ isDisabled, validationStatus }),\n );\n\n useEffect(() => {\n setInternalStatus(getInternalStatus({ isDisabled, validationStatus }));\n }, [isDisabled, validationStatus]);\n\n return internalStatus;\n};\n\nfunction getInternalStatus({\n isDisabled,\n validationStatus,\n}: {\n isDisabled: boolean;\n validationStatus: ValidationStatus;\n}) {\n return isDisabled ? 'disabled' : validationStatus;\n}\n"],"names":["useInternalStatus","isDisabled","validationStatus","internalStatus","setInternalStatus","useState","getInternalStatus","useEffect"],"mappings":";AAIO,MAAMA,IAAoB,CAAC;AAAA,EAChC,YAAAC;AAAA,EACA,kBAAAC;AACF,MAGM;
|
|
1
|
+
{"version":3,"file":"useInternalStatus.js","sources":["../../lib/hooks/useInternalStatus.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport type ValidationStatus = 'default' | 'error' | 'success';\n\nexport const useInternalStatus = ({\n isDisabled,\n validationStatus,\n}: {\n isDisabled: boolean;\n validationStatus: ValidationStatus;\n}) => {\n const [internalStatus, setInternalStatus] = useState<ValidationStatus | 'disabled'>(\n getInternalStatus({ isDisabled, validationStatus }),\n );\n\n useEffect(() => {\n setInternalStatus(getInternalStatus({ isDisabled, validationStatus }));\n }, [isDisabled, validationStatus]);\n\n return internalStatus;\n};\n\nfunction getInternalStatus({\n isDisabled,\n validationStatus,\n}: {\n isDisabled: boolean;\n validationStatus: ValidationStatus;\n}) {\n return isDisabled ? 'disabled' : validationStatus;\n}\n"],"names":["useInternalStatus","isDisabled","validationStatus","internalStatus","setInternalStatus","useState","getInternalStatus","useEffect"],"mappings":";AAIO,MAAMA,IAAoB,CAAC;AAAA,EAChC,YAAAC;AAAA,EACA,kBAAAC;AACF,MAGM;AACJ,QAAM,CAACC,GAAgBC,CAAiB,IAAIC;AAAA,IAC1CC,EAAkB,EAAE,YAAAL,GAAY,kBAAAC,EAAA,CAAkB;AAAA,EAAA;AAGpD,SAAAK,EAAU,MAAM;AACd,IAAAH,EAAkBE,EAAkB,EAAE,YAAAL,GAAY,kBAAAC,EAAA,CAAkB,CAAC;AAAA,EACvE,GAAG,CAACD,GAAYC,CAAgB,CAAC,GAE1BC;AACT;AAEA,SAASG,EAAkB;AAAA,EACzB,YAAAL;AAAA,EACA,kBAAAC;AACF,GAGG;AACD,SAAOD,IAAa,aAAaC;AACnC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardControls.js","sources":["../../lib/hooks/useKeyboardControls.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, type KeyboardEvent } from 'react';\nimport { CODE, KEY } from './keyboard.constants';\n\ninterface Options {\n up?: VoidFunction;\n down?: VoidFunction;\n left?: VoidFunction;\n right?: VoidFunction;\n start?: VoidFunction;\n end?: VoidFunction;\n activate?: VoidFunction;\n}\n\nconst isActivateKey = (event: KeyboardEvent<HTMLDivElement>) => {\n return (\n event.key === KEY.ENTER ||\n event.key === KEY.SPACE ||\n event.key === KEY.SPACEBAR ||\n event.code === CODE.ENTER ||\n event.code === CODE.SPACE\n );\n};\n\nconst voidFn = () => {};\n\nexport const useKeyboardControls = ({\n up = voidFn,\n down = voidFn,\n left = voidFn,\n right = voidFn,\n start = voidFn,\n end = voidFn,\n activate = voidFn,\n}: Options) => {\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (isActivateKey(event)) {\n return activate();\n }\n\n if (event.code === CODE.HOME) {\n event.preventDefault();\n\n return start();\n }\n\n if (event.code === CODE.END) {\n event.preventDefault();\n\n return end();\n }\n\n if (event.code === CODE.ARROW_UP) {\n event.preventDefault();\n\n return up();\n }\n\n if (event.code === CODE.ARROW_DOWN) {\n event.preventDefault();\n\n return down();\n }\n\n if (event.code === CODE.ARROW_RIGHT) {\n event.preventDefault();\n\n return right();\n }\n\n if (event.code === CODE.ARROW_LEFT) {\n event.preventDefault();\n\n return left();\n }\n },\n [activate, down, end, left, right, start, up],\n );\n\n return handleKeyDown;\n};\n"],"names":["isActivateKey","event","KEY","CODE","voidFn","useKeyboardControls","up","down","left","right","start","end","activate","useCallback"],"mappings":";;;AAeA,MAAMA,IAAgB,CAACC,MAEnBA,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,YAClBD,EAAM,SAASE,EAAK,SACpBF,EAAM,SAASE,EAAK,OAIlBC,IAAS,MAAM;AAAC,GAETC,IAAsB,CAAC;AAAA,EAClC,IAAAC,IAAKF;AAAA,EACL,MAAAG,IAAOH;AAAA,EACP,MAAAI,IAAOJ;AAAA,EACP,OAAAK,IAAQL;AAAA,EACR,OAAAM,IAAQN;AAAA,EACR,KAAAO,IAAMP;AAAA,EACN,UAAAQ,IAAWR;AACb,MACwBS;AAAA,EACpB,CAACZ,MAAyC;
|
|
1
|
+
{"version":3,"file":"useKeyboardControls.js","sources":["../../lib/hooks/useKeyboardControls.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, type KeyboardEvent } from 'react';\nimport { CODE, KEY } from './keyboard.constants';\n\ninterface Options {\n up?: VoidFunction;\n down?: VoidFunction;\n left?: VoidFunction;\n right?: VoidFunction;\n start?: VoidFunction;\n end?: VoidFunction;\n activate?: VoidFunction;\n}\n\nconst isActivateKey = (event: KeyboardEvent<HTMLDivElement>) => {\n return (\n event.key === KEY.ENTER ||\n event.key === KEY.SPACE ||\n event.key === KEY.SPACEBAR ||\n event.code === CODE.ENTER ||\n event.code === CODE.SPACE\n );\n};\n\nconst voidFn = () => {};\n\nexport const useKeyboardControls = ({\n up = voidFn,\n down = voidFn,\n left = voidFn,\n right = voidFn,\n start = voidFn,\n end = voidFn,\n activate = voidFn,\n}: Options) => {\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (isActivateKey(event)) {\n return activate();\n }\n\n if (event.code === CODE.HOME) {\n event.preventDefault();\n\n return start();\n }\n\n if (event.code === CODE.END) {\n event.preventDefault();\n\n return end();\n }\n\n if (event.code === CODE.ARROW_UP) {\n event.preventDefault();\n\n return up();\n }\n\n if (event.code === CODE.ARROW_DOWN) {\n event.preventDefault();\n\n return down();\n }\n\n if (event.code === CODE.ARROW_RIGHT) {\n event.preventDefault();\n\n return right();\n }\n\n if (event.code === CODE.ARROW_LEFT) {\n event.preventDefault();\n\n return left();\n }\n },\n [activate, down, end, left, right, start, up],\n );\n\n return handleKeyDown;\n};\n"],"names":["isActivateKey","event","KEY","CODE","voidFn","useKeyboardControls","up","down","left","right","start","end","activate","useCallback"],"mappings":";;;AAeA,MAAMA,IAAgB,CAACC,MAEnBA,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,YAClBD,EAAM,SAASE,EAAK,SACpBF,EAAM,SAASE,EAAK,OAIlBC,IAAS,MAAM;AAAC,GAETC,IAAsB,CAAC;AAAA,EAClC,IAAAC,IAAKF;AAAA,EACL,MAAAG,IAAOH;AAAA,EACP,MAAAI,IAAOJ;AAAA,EACP,OAAAK,IAAQL;AAAA,EACR,OAAAM,IAAQN;AAAA,EACR,KAAAO,IAAMP;AAAA,EACN,UAAAQ,IAAWR;AACb,MACwBS;AAAA,EACpB,CAACZ,MAAyC;AACxC,QAAID,EAAcC,CAAK;AACrB,aAAOW,EAAA;AAGT,QAAIX,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECS,EAAA;AAGT,QAAIT,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECU,EAAA;AAGT,QAAIV,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECK,EAAA;AAGT,QAAIL,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECM,EAAA;AAGT,QAAIN,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECQ,EAAA;AAGT,QAAIR,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECO,EAAA;AAAA,EAEX;AAAA,EACA,CAACI,GAAUL,GAAMI,GAAKH,GAAMC,GAAOC,GAAOJ,CAAE;AAAA;"}
|
package/hooks/useSafeBoop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSafeBoop.js","sources":["../../node_modules/use-boop/dist/index.es.js","../../lib/hooks/useSafeBoop.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react';\nimport { useSpring } from 'react-spring';\n\nvar QUERY = '(prefers-reduced-motion: no-preference)';\nvar getInitialState = function () {\n return typeof window === 'undefined' ? true : !window.matchMedia(QUERY).matches;\n};\nvar usePrefersReducedMotion = function () {\n var _a = useState(getInitialState), reduceMotion = _a[0], setReduceMotion = _a[1];\n useEffect(function () {\n var mediaQueryList = window.matchMedia('(prefers-reduced-motion: no-preference)');\n var listener = function (event) {\n setReduceMotion(!event.matches);\n };\n mediaQueryList.addEventListener('change', listener);\n return function () { return mediaQueryList.removeEventListener('change', listener); };\n }, []);\n return reduceMotion;\n};\n\nvar useBoop = function (_a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d, _e = _b.z, z = _e === void 0 ? 0 : _e, _f = _b.rotation, rotation = _f === void 0 ? 0 : _f, _g = _b.rx, rx = _g === void 0 ? 0 : _g, _h = _b.ry, ry = _h === void 0 ? 0 : _h, _j = _b.rz, rz = _j === void 0 ? rotation : _j, _k = _b.scale, scale = _k === void 0 ? 1 : _k, _l = _b.sx, sx = _l === void 0 ? scale || 1 : _l, _m = _b.sy, sy = _m === void 0 ? scale || 1 : _m, _o = _b.sz, sz = _o === void 0 ? scale || 1 : _o, _p = _b.skewX, skewX = _p === void 0 ? 0 : _p, _q = _b.skewY, skewY = _q === void 0 ? 0 : _q, _r = _b.timing, timing = _r === void 0 ? 150 : _r, _s = _b.springConfig, springConfig = _s === void 0 ? {\n tension: 300,\n friction: 10,\n } : _s, _t = _b.delay, delay = _t === void 0 ? 0 : _t;\n var prefersReducedMotion = usePrefersReducedMotion();\n var _u = useState(false), isBooped = _u[0], setIsBooped = _u[1];\n var _v = useState(false), isTriggered = _v[0], setIsTriggered = _v[1];\n var style = useSpring(prefersReducedMotion ? {} : {\n transform: isBooped\n ? \"translate3D(\" + x + \"px, \" + y + \"px, \" + z + \"px)\\n rotateX(\" + rx + \"deg) rotateY(\" + ry + \"deg) rotateZ(\" + rz + \"deg)\\n scale3D(\" + sx + \",\" + sy + \",\" + sz + \")\\n skew(\" + skewX + \"deg, \" + skewY + \"deg)\"\n : \"translate3D(0px, 0px, 0px)\\n rotateX(0deg) rotateY(0deg) rotateZ(0deg)\\n scale3D(1, 1, 1)\\n skew(0deg, 0deg)\",\n config: springConfig,\n immediate: prefersReducedMotion,\n });\n var trigger = useCallback(function () {\n if (!prefersReducedMotion) {\n setIsTriggered(true);\n }\n }, [prefersReducedMotion]);\n useEffect(function () {\n if (!isTriggered)\n return;\n var timeoutId = window.setTimeout(function () {\n setIsBooped(true);\n setIsTriggered(false);\n }, delay);\n return function () { return window.clearTimeout(timeoutId); };\n }, [isTriggered, delay]);\n useEffect(function () {\n if (!isBooped)\n return;\n var timeoutId = window.setTimeout(function () { return setIsBooped(false); }, timing);\n return function () { return window.clearTimeout(timeoutId); };\n }, [isBooped, timing]);\n return [style, trigger];\n};\n\nexport default useBoop;\n//# sourceMappingURL=index.es.js.map\n","import type { CSSProperties } from 'react';\nimport useBoop from 'use-boop';\n\ntype Args = Parameters<typeof useBoop>[0];\n\nexport const useSafeBoop = (boopArgs: Args): [CSSProperties, () => void] => {\n const [{ transform }, boopTrigger] = useBoop(boopArgs);\n\n return [\n {\n '--transform':\n transform ||\n `translate3D(0px, 0px, 0px)\n rotateX(0deg) rotateY(0deg) rotateZ(0deg)\n scale3D(1, 1, 1)\n skew(0deg, 0deg)`,\n transform: 'var(--transform)',\n } as CSSProperties,\n boopTrigger,\n ];\n};\n"],"names":["QUERY","getInitialState","usePrefersReducedMotion","_a","useState","reduceMotion","setReduceMotion","useEffect","mediaQueryList","listener","event","useBoop","_b","_c","x","_d","y","_e","z","_f","rotation","_g","rx","_h","ry","_j","rz","_k","scale","_l","sx","_m","sy","_o","sz","_p","skewX","_q","skewY","_r","timing","_s","springConfig","_t","delay","prefersReducedMotion","_u","isBooped","setIsBooped","_v","isTriggered","setIsTriggered","style","useSpring","trigger","useCallback","timeoutId","useSafeBoop","boopArgs","transform","boopTrigger"],"mappings":";;AAGA,IAAIA,IAAQ,2CACRC,IAAkB,WAAY;AAC9B,SAAO,OAAO,SAAW,MAAc,KAAO,CAAC,OAAO,WAAWD,CAAK,EAAE;AAC5E,GACIE,IAA0B,WAAY;AACtC,MAAIC,IAAKC,EAASH,CAAe,GAAGI,IAAeF,EAAG,CAAC,GAAGG,IAAkBH,EAAG,CAAC;AAChF,SAAAI,EAAU,WAAY;AAClB,QAAIC,IAAiB,OAAO,WAAW,yCAAyC,GAC5EC,IAAW,SAAUC,GAAO;AAC5B,MAAAJ,EAAgB,CAACI,EAAM,OAAO;AAAA,
|
|
1
|
+
{"version":3,"file":"useSafeBoop.js","sources":["../../node_modules/use-boop/dist/index.es.js","../../lib/hooks/useSafeBoop.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react';\nimport { useSpring } from 'react-spring';\n\nvar QUERY = '(prefers-reduced-motion: no-preference)';\nvar getInitialState = function () {\n return typeof window === 'undefined' ? true : !window.matchMedia(QUERY).matches;\n};\nvar usePrefersReducedMotion = function () {\n var _a = useState(getInitialState), reduceMotion = _a[0], setReduceMotion = _a[1];\n useEffect(function () {\n var mediaQueryList = window.matchMedia('(prefers-reduced-motion: no-preference)');\n var listener = function (event) {\n setReduceMotion(!event.matches);\n };\n mediaQueryList.addEventListener('change', listener);\n return function () { return mediaQueryList.removeEventListener('change', listener); };\n }, []);\n return reduceMotion;\n};\n\nvar useBoop = function (_a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d, _e = _b.z, z = _e === void 0 ? 0 : _e, _f = _b.rotation, rotation = _f === void 0 ? 0 : _f, _g = _b.rx, rx = _g === void 0 ? 0 : _g, _h = _b.ry, ry = _h === void 0 ? 0 : _h, _j = _b.rz, rz = _j === void 0 ? rotation : _j, _k = _b.scale, scale = _k === void 0 ? 1 : _k, _l = _b.sx, sx = _l === void 0 ? scale || 1 : _l, _m = _b.sy, sy = _m === void 0 ? scale || 1 : _m, _o = _b.sz, sz = _o === void 0 ? scale || 1 : _o, _p = _b.skewX, skewX = _p === void 0 ? 0 : _p, _q = _b.skewY, skewY = _q === void 0 ? 0 : _q, _r = _b.timing, timing = _r === void 0 ? 150 : _r, _s = _b.springConfig, springConfig = _s === void 0 ? {\n tension: 300,\n friction: 10,\n } : _s, _t = _b.delay, delay = _t === void 0 ? 0 : _t;\n var prefersReducedMotion = usePrefersReducedMotion();\n var _u = useState(false), isBooped = _u[0], setIsBooped = _u[1];\n var _v = useState(false), isTriggered = _v[0], setIsTriggered = _v[1];\n var style = useSpring(prefersReducedMotion ? {} : {\n transform: isBooped\n ? \"translate3D(\" + x + \"px, \" + y + \"px, \" + z + \"px)\\n rotateX(\" + rx + \"deg) rotateY(\" + ry + \"deg) rotateZ(\" + rz + \"deg)\\n scale3D(\" + sx + \",\" + sy + \",\" + sz + \")\\n skew(\" + skewX + \"deg, \" + skewY + \"deg)\"\n : \"translate3D(0px, 0px, 0px)\\n rotateX(0deg) rotateY(0deg) rotateZ(0deg)\\n scale3D(1, 1, 1)\\n skew(0deg, 0deg)\",\n config: springConfig,\n immediate: prefersReducedMotion,\n });\n var trigger = useCallback(function () {\n if (!prefersReducedMotion) {\n setIsTriggered(true);\n }\n }, [prefersReducedMotion]);\n useEffect(function () {\n if (!isTriggered)\n return;\n var timeoutId = window.setTimeout(function () {\n setIsBooped(true);\n setIsTriggered(false);\n }, delay);\n return function () { return window.clearTimeout(timeoutId); };\n }, [isTriggered, delay]);\n useEffect(function () {\n if (!isBooped)\n return;\n var timeoutId = window.setTimeout(function () { return setIsBooped(false); }, timing);\n return function () { return window.clearTimeout(timeoutId); };\n }, [isBooped, timing]);\n return [style, trigger];\n};\n\nexport default useBoop;\n//# sourceMappingURL=index.es.js.map\n","import type { CSSProperties } from 'react';\nimport useBoop from 'use-boop';\n\ntype Args = Parameters<typeof useBoop>[0];\n\nexport const useSafeBoop = (boopArgs: Args): [CSSProperties, () => void] => {\n const [{ transform }, boopTrigger] = useBoop(boopArgs);\n\n return [\n {\n '--transform':\n transform ||\n `translate3D(0px, 0px, 0px)\n rotateX(0deg) rotateY(0deg) rotateZ(0deg)\n scale3D(1, 1, 1)\n skew(0deg, 0deg)`,\n transform: 'var(--transform)',\n } as CSSProperties,\n boopTrigger,\n ];\n};\n"],"names":["QUERY","getInitialState","usePrefersReducedMotion","_a","useState","reduceMotion","setReduceMotion","useEffect","mediaQueryList","listener","event","useBoop","_b","_c","x","_d","y","_e","z","_f","rotation","_g","rx","_h","ry","_j","rz","_k","scale","_l","sx","_m","sy","_o","sz","_p","skewX","_q","skewY","_r","timing","_s","springConfig","_t","delay","prefersReducedMotion","_u","isBooped","setIsBooped","_v","isTriggered","setIsTriggered","style","useSpring","trigger","useCallback","timeoutId","useSafeBoop","boopArgs","transform","boopTrigger"],"mappings":";;AAGA,IAAIA,IAAQ,2CACRC,IAAkB,WAAY;AAC9B,SAAO,OAAO,SAAW,MAAc,KAAO,CAAC,OAAO,WAAWD,CAAK,EAAE;AAC5E,GACIE,IAA0B,WAAY;AACtC,MAAIC,IAAKC,EAASH,CAAe,GAAGI,IAAeF,EAAG,CAAC,GAAGG,IAAkBH,EAAG,CAAC;AAChF,SAAAI,EAAU,WAAY;AAClB,QAAIC,IAAiB,OAAO,WAAW,yCAAyC,GAC5EC,IAAW,SAAUC,GAAO;AAC5B,MAAAJ,EAAgB,CAACI,EAAM,OAAO;AAAA,IAClC;AACA,WAAAF,EAAe,iBAAiB,UAAUC,CAAQ,GAC3C,WAAY;AAAE,aAAOD,EAAe,oBAAoB,UAAUC,CAAQ;AAAA,IAAG;AAAA,EACxF,GAAG,CAAA,CAAE,GACEJ;AACX,GAEIM,IAAU,SAAUR,GAAI;AACxB,MAAIS,IAAKT,MAAO,SAAS,CAAA,IAAKA,GAAIU,IAAKD,EAAG,GAAGE,IAAID,MAAO,SAAS,IAAIA,GAAIE,IAAKH,EAAG,GAAGI,IAAID,MAAO,SAAS,IAAIA,GAAIE,IAAKL,EAAG,GAAGM,IAAID,MAAO,SAAS,IAAIA,GAAIE,IAAKP,EAAG,UAAUQ,IAAWD,MAAO,SAAS,IAAIA,GAAIE,IAAKT,EAAG,IAAIU,IAAKD,MAAO,SAAS,IAAIA,GAAIE,IAAKX,EAAG,IAAIY,IAAKD,MAAO,SAAS,IAAIA,GAAIE,IAAKb,EAAG,IAAIc,IAAKD,MAAO,SAASL,IAAWK,GAAIE,IAAKf,EAAG,OAAOgB,IAAQD,MAAO,SAAS,IAAIA,GAAIE,IAAKjB,EAAG,IAAIkB,IAAKD,MAAO,SAASD,KAAS,IAAIC,GAAIE,IAAKnB,EAAG,IAAIoB,IAAKD,MAAO,SAASH,KAAS,IAAIG,GAAIE,IAAKrB,EAAG,IAAIsB,IAAKD,MAAO,SAASL,KAAS,IAAIK,GAAIE,IAAKvB,EAAG,OAAOwB,IAAQD,MAAO,SAAS,IAAIA,GAAIE,IAAKzB,EAAG,OAAO0B,IAAQD,MAAO,SAAS,IAAIA,GAAIE,IAAK3B,EAAG,QAAQ4B,IAASD,MAAO,SAAS,MAAMA,GAAIE,IAAK7B,EAAG,cAAc8B,IAAeD,MAAO,SAAS;AAAA,IACrtB,SAAS;AAAA,IACT,UAAU;AAAA,EAClB,IAAQA,GAAIE,IAAK/B,EAAG,OAAOgC,IAAQD,MAAO,SAAS,IAAIA,GAC/CE,IAAuB3C,EAAuB,GAC9C4C,IAAK1C,EAAS,EAAK,GAAG2C,IAAWD,EAAG,CAAC,GAAGE,IAAcF,EAAG,CAAC,GAC1DG,IAAK7C,EAAS,EAAK,GAAG8C,IAAcD,EAAG,CAAC,GAAGE,IAAiBF,EAAG,CAAC,GAChEG,IAAQC,EAAUR,IAAuB,KAAK;AAAA,IAC9C,WAAWE,IACL,iBAAiBjC,IAAI,SAASE,IAAI,SAASE,IAAI;AAAA,qBAA2BI,IAAK,kBAAkBE,IAAK,kBAAkBE,IAAK;AAAA,qBAA4BI,IAAK,MAAME,IAAK,MAAME,IAAK;AAAA,kBAAsBE,IAAQ,UAAUE,IAAQ,SACpO;AAAA;AAAA;AAAA;AAAA,IACN,QAAQI;AAAA,IACR,WAAWG;AAAA,EACnB,CAAK,GACGS,IAAUC,EAAY,WAAY;AAClC,IAAKV,KACDM,EAAe,EAAI;AAAA,EAE3B,GAAG,CAACN,CAAoB,CAAC;AACzB,SAAAtC,EAAU,WAAY;AAClB,QAAK2C,GAEL;AAAA,UAAIM,IAAY,OAAO,WAAW,WAAY;AAC1C,QAAAR,EAAY,EAAI,GAChBG,EAAe,EAAK;AAAA,MACxB,GAAGP,CAAK;AACR,aAAO,WAAY;AAAE,eAAO,OAAO,aAAaY,CAAS;AAAA,MAAG;AAAA;AAAA,EAChE,GAAG,CAACN,GAAaN,CAAK,CAAC,GACvBrC,EAAU,WAAY;AAClB,QAAKwC,GAEL;AAAA,UAAIS,IAAY,OAAO,WAAW,WAAY;AAAE,eAAOR,EAAY,EAAK;AAAA,MAAG,GAAGR,CAAM;AACpF,aAAO,WAAY;AAAE,eAAO,OAAO,aAAagB,CAAS;AAAA,MAAG;AAAA;AAAA,EAChE,GAAG,CAACT,GAAUP,CAAM,CAAC,GACd,CAACY,GAAOE,CAAO;AAC1B;ACnDO,MAAMG,KAAc,CAACC,MAAgD;AAC1E,QAAM,CAAC,EAAE,WAAAC,EAAA,GAAaC,CAAW,IAAIjD,EAAQ+C,CAAQ;AAErD,SAAO;AAAA,IACL;AAAA,MACE,eACEC,KACA;AAAA;AAAA;AAAA;AAAA,MAIF,WAAW;AAAA,IAAA;AAAA,IAEbC;AAAA,EAAA;AAEJ;","x_google_ignoreList":[0]}
|
package/hooks/useValue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useValue.js","sources":["../../lib/hooks/useValue.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface UseValueProps<Value = string, InitialValue = Value> {\n name: string;\n initialValue?: InitialValue;\n defaultValue?: Value | string;\n formatter?: (v: Value) => Value;\n onChange?: (name: string, value: Value) => void;\n}\n\nexport function useValue<Value = string, InitialValue = Value>({\n name,\n initialValue,\n onChange,\n defaultValue = '',\n formatter = (v: Value) => v as unknown as Value,\n}: UseValueProps<Value, InitialValue>) {\n const [value, setValue] = useState<Value>(formatter((initialValue || defaultValue) as Value));\n\n useEffect(() => {\n initialValue !== undefined && setValue(formatter(initialValue as Value));\n }, [initialValue]);\n\n function setNewValue(newValue: Value) {\n newValue = formatter(newValue);\n setValue(newValue);\n onChange && onChange(name, newValue);\n }\n\n function resetValue() {\n setValue(defaultValue as Value);\n }\n\n return {\n value,\n setValue: setNewValue,\n resetValue,\n };\n}\n"],"names":["useValue","name","initialValue","onChange","defaultValue","formatter","v","value","setValue","useState","useEffect","setNewValue","newValue","resetValue"],"mappings":";AAUO,SAASA,EAA+C;AAAA,EAC7D,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,WAAAC,IAAY,CAACC,MAAaA;AAC5B,GAAuC;
|
|
1
|
+
{"version":3,"file":"useValue.js","sources":["../../lib/hooks/useValue.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface UseValueProps<Value = string, InitialValue = Value> {\n name: string;\n initialValue?: InitialValue;\n defaultValue?: Value | string;\n formatter?: (v: Value) => Value;\n onChange?: (name: string, value: Value) => void;\n}\n\nexport function useValue<Value = string, InitialValue = Value>({\n name,\n initialValue,\n onChange,\n defaultValue = '',\n formatter = (v: Value) => v as unknown as Value,\n}: UseValueProps<Value, InitialValue>) {\n const [value, setValue] = useState<Value>(formatter((initialValue || defaultValue) as Value));\n\n useEffect(() => {\n initialValue !== undefined && setValue(formatter(initialValue as Value));\n }, [initialValue]);\n\n function setNewValue(newValue: Value) {\n newValue = formatter(newValue);\n setValue(newValue);\n onChange && onChange(name, newValue);\n }\n\n function resetValue() {\n setValue(defaultValue as Value);\n }\n\n return {\n value,\n setValue: setNewValue,\n resetValue,\n };\n}\n"],"names":["useValue","name","initialValue","onChange","defaultValue","formatter","v","value","setValue","useState","useEffect","setNewValue","newValue","resetValue"],"mappings":";AAUO,SAASA,EAA+C;AAAA,EAC7D,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,WAAAC,IAAY,CAACC,MAAaA;AAC5B,GAAuC;AACrC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAgBJ,EAAWH,KAAgBE,CAAsB,CAAC;AAE5F,EAAAM,EAAU,MAAM;AACd,IAAAR,MAAiB,UAAaM,EAASH,EAAUH,CAAqB,CAAC;AAAA,EACzE,GAAG,CAACA,CAAY,CAAC;AAEjB,WAASS,EAAYC,GAAiB;AACpC,IAAAA,IAAWP,EAAUO,CAAQ,GAC7BJ,EAASI,CAAQ,GACjBT,KAAYA,EAASF,GAAMW,CAAQ;AAAA,EACrC;AAEA,WAASC,IAAa;AACpB,IAAAL,EAASJ,CAAqB;AAAA,EAChC;AAEA,SAAO;AAAA,IACL,OAAAG;AAAA,IACA,UAAUI;AAAA,IACV,YAAAE;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arrows.js","sources":["../../../lib/molecules/Arrows/Arrows.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { ComponentProps, ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport type { ArrowsLabels } from './ArrowsLabels';\n\nimport { ArrowButton } from '../Buttons/ArrowButton';\n\nexport interface ArrowsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n color?: ComponentProps<typeof ArrowButton>['color'];\n iconType?: 'ArrowDefault' | 'ArrowTail';\n isDisabledHidden?: boolean;\n isNextDisabled?: boolean;\n isPrevDisabled?: boolean;\n labels?: ArrowsLabels;\n onNext: ComponentProps<typeof ArrowButton>['onClick'];\n onPrev: ComponentProps<typeof ArrowButton>['onClick'];\n size?: ComponentProps<typeof ArrowButton>['size'];\n theme?: ComponentProps<typeof ArrowButton>['theme'];\n}\n\nexport const Arrows: FunctionComponent<ArrowsProps> = ({\n className,\n color,\n iconType = 'ArrowDefault',\n isDisabledHidden = false,\n isNextDisabled = false,\n isPrevDisabled = false,\n labels = {\n next: '',\n previous: '',\n },\n onNext,\n onPrev,\n size,\n theme,\n ...attrs\n}) => {\n return (\n <div\n {...attrs}\n className={classnames(\n 'pointer-events-none flex w-full items-center justify-between gap-x-20',\n className,\n )}\n data-name=\"Arrows\"\n >\n <ArrowButton\n className={classnames('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isPrevDisabled,\n })}\n color={color}\n disabled={isPrevDisabled}\n icon={`${iconType}Left`}\n onClick={onPrev}\n size={size}\n theme={theme}\n >\n {labels.previous}\n </ArrowButton>\n <ArrowButton\n className={classnames('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isNextDisabled,\n })}\n color={color}\n disabled={isNextDisabled}\n icon={`${iconType}Right`}\n onClick={onNext}\n size={size}\n theme={theme}\n >\n {labels.next}\n </ArrowButton>\n </div>\n );\n};\n"],"names":["Arrows","className","color","iconType","isDisabledHidden","isNextDisabled","isPrevDisabled","labels","onNext","onPrev","size","theme","attrs","jsxs","classnames","jsx","ArrowButton"],"mappings":";;;AAoBO,MAAMA,IAAyC,CAAC;AAAA,EACrD,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,kBAAAC,IAAmB;AAAA,EACnB,gBAAAC,IAAiB;AAAA,EACjB,gBAAAC,IAAiB;AAAA,EACjB,QAAAC,IAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,
|
|
1
|
+
{"version":3,"file":"Arrows.js","sources":["../../../lib/molecules/Arrows/Arrows.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { ComponentProps, ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport type { ArrowsLabels } from './ArrowsLabels';\n\nimport { ArrowButton } from '../Buttons/ArrowButton';\n\nexport interface ArrowsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n color?: ComponentProps<typeof ArrowButton>['color'];\n iconType?: 'ArrowDefault' | 'ArrowTail';\n isDisabledHidden?: boolean;\n isNextDisabled?: boolean;\n isPrevDisabled?: boolean;\n labels?: ArrowsLabels;\n onNext: ComponentProps<typeof ArrowButton>['onClick'];\n onPrev: ComponentProps<typeof ArrowButton>['onClick'];\n size?: ComponentProps<typeof ArrowButton>['size'];\n theme?: ComponentProps<typeof ArrowButton>['theme'];\n}\n\nexport const Arrows: FunctionComponent<ArrowsProps> = ({\n className,\n color,\n iconType = 'ArrowDefault',\n isDisabledHidden = false,\n isNextDisabled = false,\n isPrevDisabled = false,\n labels = {\n next: '',\n previous: '',\n },\n onNext,\n onPrev,\n size,\n theme,\n ...attrs\n}) => {\n return (\n <div\n {...attrs}\n className={classnames(\n 'pointer-events-none flex w-full items-center justify-between gap-x-20',\n className,\n )}\n data-name=\"Arrows\"\n >\n <ArrowButton\n className={classnames('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isPrevDisabled,\n })}\n color={color}\n disabled={isPrevDisabled}\n icon={`${iconType}Left`}\n onClick={onPrev}\n size={size}\n theme={theme}\n >\n {labels.previous}\n </ArrowButton>\n <ArrowButton\n className={classnames('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isNextDisabled,\n })}\n color={color}\n disabled={isNextDisabled}\n icon={`${iconType}Right`}\n onClick={onNext}\n size={size}\n theme={theme}\n >\n {labels.next}\n </ArrowButton>\n </div>\n );\n};\n"],"names":["Arrows","className","color","iconType","isDisabledHidden","isNextDisabled","isPrevDisabled","labels","onNext","onPrev","size","theme","attrs","jsxs","classnames","jsx","ArrowButton"],"mappings":";;;AAoBO,MAAMA,IAAyC,CAAC;AAAA,EACrD,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,kBAAAC,IAAmB;AAAA,EACnB,gBAAAC,IAAiB;AAAA,EACjB,gBAAAC,IAAiB;AAAA,EACjB,QAAAC,IAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,EAAA;AAAA,EAEZ,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAGD;AAAA,IACJ,WAAWE;AAAA,MACT;AAAA,MACAb;AAAA,IAAA;AAAA,IAEF,aAAU;AAAA,IAEV,UAAA;AAAA,MAAA,gBAAAc;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,WAAWF,EAAW,0CAA0C;AAAA,YAC9D,aAAaV,KAAoBE;AAAA,UAAA,CAClC;AAAA,UACD,OAAAJ;AAAA,UACA,UAAUI;AAAA,UACV,MAAM,GAAGH,CAAQ;AAAA,UACjB,SAASM;AAAA,UACT,MAAAC;AAAA,UACA,OAAAC;AAAA,UAEC,UAAAJ,EAAO;AAAA,QAAA;AAAA,MAAA;AAAA,MAEV,gBAAAQ;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,WAAWF,EAAW,0CAA0C;AAAA,YAC9D,aAAaV,KAAoBC;AAAA,UAAA,CAClC;AAAA,UACD,OAAAH;AAAA,UACA,UAAUG;AAAA,UACV,MAAM,GAAGF,CAAQ;AAAA,UACjB,SAASK;AAAA,UACT,MAAAE;AAAA,UACA,OAAAC;AAAA,UAEC,UAAAJ,EAAO;AAAA,QAAA;AAAA,MAAA;AAAA,IACV;AAAA,EAAA;AAAA;"}
|
package/molecules/Avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../lib/molecules/Avatar.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react';\nimport classnames from 'classnames';\n\nconst initial = (text = '') => {\n return text\n .split(' ')\n .map((text) => text.slice(0, 1))\n .join('');\n};\n\ninterface AvatarProps extends HTMLAttributes<HTMLDivElement> {\n alt?: string;\n src?: string | undefined;\n srcSet?: string | undefined;\n}\n\nexport function Avatar({\n alt,\n src,\n srcSet,\n style,\n children,\n className,\n ...props\n}: PropsWithChildren<AvatarProps>) {\n return (\n <div\n {...props}\n {...(src || srcSet ? { role: 'figure', 'aria-label': alt } : {})}\n className={classnames(\n 'flex items-center justify-center relative overflow-hidden',\n {\n 'rounded-full': !className?.includes('rounded-'),\n 'text-black': !className?.includes('text-'),\n 'bg-saffron': !className?.includes('bg-'),\n },\n className,\n )}\n style={{\n width: '48px',\n height: '48px',\n ...style,\n }}\n >\n <span className=\"flex items-center justify-center font-bold uppercase text-h6 h-full\">\n {src || srcSet ? (\n <img\n srcSet={srcSet}\n src={src}\n alt={alt}\n className={'w-full h-full object-cover transparent indent-[1000px]'}\n />\n ) : (\n initial(alt)\n )}\n {children}\n </span>\n </div>\n );\n}\n"],"names":["initial","text","Avatar","alt","src","srcSet","style","children","className","props","jsx","classnames","jsxs"],"mappings":";;AAGA,MAAMA,IAAU,CAACC,IAAO,OACfA,EACJ,MAAM,GAAG,EACT,IAAI,CAACA,MAASA,EAAK,MAAM,GAAG,CAAC,CAAC,EAC9B,KAAK,EAAE;AASL,SAASC,EAAO;AAAA,EACrB,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GAAmC;
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../lib/molecules/Avatar.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react';\nimport classnames from 'classnames';\n\nconst initial = (text = '') => {\n return text\n .split(' ')\n .map((text) => text.slice(0, 1))\n .join('');\n};\n\ninterface AvatarProps extends HTMLAttributes<HTMLDivElement> {\n alt?: string;\n src?: string | undefined;\n srcSet?: string | undefined;\n}\n\nexport function Avatar({\n alt,\n src,\n srcSet,\n style,\n children,\n className,\n ...props\n}: PropsWithChildren<AvatarProps>) {\n return (\n <div\n {...props}\n {...(src || srcSet ? { role: 'figure', 'aria-label': alt } : {})}\n className={classnames(\n 'flex items-center justify-center relative overflow-hidden',\n {\n 'rounded-full': !className?.includes('rounded-'),\n 'text-black': !className?.includes('text-'),\n 'bg-saffron': !className?.includes('bg-'),\n },\n className,\n )}\n style={{\n width: '48px',\n height: '48px',\n ...style,\n }}\n >\n <span className=\"flex items-center justify-center font-bold uppercase text-h6 h-full\">\n {src || srcSet ? (\n <img\n srcSet={srcSet}\n src={src}\n alt={alt}\n className={'w-full h-full object-cover transparent indent-[1000px]'}\n />\n ) : (\n initial(alt)\n )}\n {children}\n </span>\n </div>\n );\n}\n"],"names":["initial","text","Avatar","alt","src","srcSet","style","children","className","props","jsx","classnames","jsxs"],"mappings":";;AAGA,MAAMA,IAAU,CAACC,IAAO,OACfA,EACJ,MAAM,GAAG,EACT,IAAI,CAACA,MAASA,EAAK,MAAM,GAAG,CAAC,CAAC,EAC9B,KAAK,EAAE;AASL,SAASC,EAAO;AAAA,EACrB,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GAAmC;AACjC,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGD;AAAA,MACH,GAAIL,KAAOC,IAAS,EAAE,MAAM,UAAU,cAAcF,EAAA,IAAQ,CAAA;AAAA,MAC7D,WAAWQ;AAAA,QACT;AAAA,QACA;AAAA,UACE,gBAAgB,EAACH,KAAA,QAAAA,EAAW,SAAS;AAAA,UACrC,cAAc,EAACA,KAAA,QAAAA,EAAW,SAAS;AAAA,UACnC,cAAc,EAACA,KAAA,QAAAA,EAAW,SAAS;AAAA,QAAK;AAAA,QAE1CA;AAAA,MAAA;AAAA,MAEF,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,GAAGF;AAAA,MAAA;AAAA,MAGL,UAAA,gBAAAM,EAAC,QAAA,EAAK,WAAU,uEACb,UAAA;AAAA,QAAAR,KAAOC,IACN,gBAAAK;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,QAAAL;AAAA,YACA,KAAAD;AAAA,YACA,KAAAD;AAAA,YACA,WAAW;AAAA,UAAA;AAAA,QAAA,IAGbH,EAAQG,CAAG;AAAA,QAEZI;AAAA,MAAA,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.js","sources":["../../lib/molecules/Backdrop.tsx"],"sourcesContent":["import { animated, config, useTransition } from '@react-spring/web';\nimport classnames from 'classnames';\nimport type { FunctionComponent, MouseEvent, PropsWithChildren } from 'react';\n\ninterface BackdropProps {\n /**\n * On close\n * @param event\n */\n onClose?: (event: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Is visible\n */\n isVisible?: boolean;\n /**\n * Sweep Mode™\n * (makes it appear from the sides instead of from everywhere)\n */\n sweep?: boolean;\n}\n\nexport const Backdrop: FunctionComponent<PropsWithChildren<BackdropProps>> = ({\n children,\n onClose,\n isVisible,\n sweep,\n}) => {\n const transitions = useTransition(isVisible, {\n from: {\n WebkitBackdropFilter: 'blur(0px)',\n backdropFilter: 'blur(0px)',\n '--tw-bg-opacity': 0,\n x: sweep ? '-100%' : '0%',\n },\n enter: {\n WebkitBackdropFilter: 'blur(10px)',\n backdropFilter: 'blur(10px)',\n '--tw-bg-opacity': 0.8,\n x: '0%',\n },\n leave: {\n WebkitBackdropFilter: 'blur(0px)',\n backdropFilter: 'blur(0px)',\n '--tw-bg-opacity': 0,\n x: sweep ? '100%' : '0%',\n },\n config: sweep ? { tension: 200, friction: 40 } : config.gentle,\n });\n\n return transitions(\n (style, item) =>\n item && (\n <div\n role=\"presentation\"\n className=\"z-1 pointer-events-none fixed inset-0 flex items-center justify-center\"\n >\n <animated.button\n type=\"button\"\n className={classnames('-z-1 absolute inset-0 bg-white', {\n 'pointer-events-auto': isVisible,\n })}\n style={style}\n onClick={onClose}\n />\n {children}\n </div>\n ),\n );\n};\n"],"names":["Backdrop","children","onClose","isVisible","sweep","useTransition","config","style","item","jsxs","jsx","animated","classnames"],"mappings":";;;AAqBO,MAAMA,IAAgE,CAAC;AAAA,EAC5E,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AACF,MACsBC,EAAcF,GAAW;AAAA,EAC3C,MAAM;AAAA,IACJ,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,GAAGC,IAAQ,UAAU;AAAA,
|
|
1
|
+
{"version":3,"file":"Backdrop.js","sources":["../../lib/molecules/Backdrop.tsx"],"sourcesContent":["import { animated, config, useTransition } from '@react-spring/web';\nimport classnames from 'classnames';\nimport type { FunctionComponent, MouseEvent, PropsWithChildren } from 'react';\n\ninterface BackdropProps {\n /**\n * On close\n * @param event\n */\n onClose?: (event: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Is visible\n */\n isVisible?: boolean;\n /**\n * Sweep Mode™\n * (makes it appear from the sides instead of from everywhere)\n */\n sweep?: boolean;\n}\n\nexport const Backdrop: FunctionComponent<PropsWithChildren<BackdropProps>> = ({\n children,\n onClose,\n isVisible,\n sweep,\n}) => {\n const transitions = useTransition(isVisible, {\n from: {\n WebkitBackdropFilter: 'blur(0px)',\n backdropFilter: 'blur(0px)',\n '--tw-bg-opacity': 0,\n x: sweep ? '-100%' : '0%',\n },\n enter: {\n WebkitBackdropFilter: 'blur(10px)',\n backdropFilter: 'blur(10px)',\n '--tw-bg-opacity': 0.8,\n x: '0%',\n },\n leave: {\n WebkitBackdropFilter: 'blur(0px)',\n backdropFilter: 'blur(0px)',\n '--tw-bg-opacity': 0,\n x: sweep ? '100%' : '0%',\n },\n config: sweep ? { tension: 200, friction: 40 } : config.gentle,\n });\n\n return transitions(\n (style, item) =>\n item && (\n <div\n role=\"presentation\"\n className=\"z-1 pointer-events-none fixed inset-0 flex items-center justify-center\"\n >\n <animated.button\n type=\"button\"\n className={classnames('-z-1 absolute inset-0 bg-white', {\n 'pointer-events-auto': isVisible,\n })}\n style={style}\n onClick={onClose}\n />\n {children}\n </div>\n ),\n );\n};\n"],"names":["Backdrop","children","onClose","isVisible","sweep","useTransition","config","style","item","jsxs","jsx","animated","classnames"],"mappings":";;;AAqBO,MAAMA,IAAgE,CAAC;AAAA,EAC5E,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AACF,MACsBC,EAAcF,GAAW;AAAA,EAC3C,MAAM;AAAA,IACJ,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,GAAGC,IAAQ,UAAU;AAAA,EAAA;AAAA,EAEvB,OAAO;AAAA,IACL,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,GAAG;AAAA,EAAA;AAAA,EAEL,OAAO;AAAA,IACL,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,GAAGA,IAAQ,SAAS;AAAA,EAAA;AAAA,EAEtB,QAAQA,IAAQ,EAAE,SAAS,KAAK,UAAU,GAAA,IAAOE,EAAO;AAAA,CACzD;AAAA,EAGC,CAACC,GAAOC,MACNA,KACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAU;AAAA,MAEV,UAAA;AAAA,QAAA,gBAAAC;AAAA,UAACC,EAAS;AAAA,UAAT;AAAA,YACC,MAAK;AAAA,YACL,WAAWC,EAAW,kCAAkC;AAAA,cACtD,uBAAuBT;AAAA,YAAA,CACxB;AAAA,YACD,OAAAI;AAAA,YACA,SAASL;AAAA,UAAA;AAAA,QAAA;AAAA,QAEVD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.js","sources":["../../lib/molecules/Breadcrumb.tsx"],"sourcesContent":["import classnames from 'classnames';\n\nimport type { FunctionComponent, PropsWithChildren } from 'react';\n\nimport { Icon } from '@/atoms/Icons';\n\nexport interface BreadcrumbProps {\n className?: string;\n items: {\n label: string;\n href: string;\n }[];\n theme?: 'dark' | 'light';\n /**\n * Allow giving a custom component\n */\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n}\n\nconst themes = {\n light: {\n thStart: 'text-middleGrey',\n thEnd: 'text-black font-bold',\n },\n dark: {\n thStart: 'text-white',\n thEnd: 'text-white font-bold',\n },\n};\n\nexport const Breadcrumb: FunctionComponent<BreadcrumbProps> = ({\n className,\n items,\n theme = 'light',\n component = 'a',\n}) => {\n const [first, second, , ...rest] = items;\n const lastItem = rest.length ? rest[rest.length - 1] : items[items.length - 1];\n const spacer = { label: '...', href: '' };\n const itemsToRender = !rest.length ? items : [first, second, spacer, lastItem];\n const { thStart, thEnd } = themes[theme];\n const Cmp = component as FunctionComponent<PropsWithChildren<{ href: string }>>;\n\n return (\n <nav data-name=\"Breadcrumb\" aria-label=\"Breadcrumb\" className={className}>\n <ul className=\"flex items-center\">\n {itemsToRender.map(({ label, href }, index) => {\n const isLast = index === itemsToRender.length - 1;\n const isLink = href && !isLast;\n return (\n <li\n key={label}\n className={classnames('text-b4 flex items-center', {\n [thStart]: !isLast,\n [thEnd]: isLast,\n })}\n {...(isLast && { 'aria-current': 'page' })}\n >\n <span>{isLink ? <Cmp href={href}>{label}</Cmp> : label}</span>\n {!isLast && <Icon name=\"Diamond\" width=\"14px\" className=\"mx-4\" />}\n </li>\n );\n })}\n </ul>\n </nav>\n );\n};\n"],"names":["themes","Breadcrumb","className","items","theme","component","first","second","rest","lastItem","spacer","itemsToRender","thStart","thEnd","Cmp","jsx","label","href","index","isLast","isLink","jsxs","classnames","Icon"],"mappings":";;;;AAmBA,MAAMA,IAAS;AAAA,EACb,OAAO;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","sources":["../../lib/molecules/Breadcrumb.tsx"],"sourcesContent":["import classnames from 'classnames';\n\nimport type { FunctionComponent, PropsWithChildren } from 'react';\n\nimport { Icon } from '@/atoms/Icons';\n\nexport interface BreadcrumbProps {\n className?: string;\n items: {\n label: string;\n href: string;\n }[];\n theme?: 'dark' | 'light';\n /**\n * Allow giving a custom component\n */\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n}\n\nconst themes = {\n light: {\n thStart: 'text-middleGrey',\n thEnd: 'text-black font-bold',\n },\n dark: {\n thStart: 'text-white',\n thEnd: 'text-white font-bold',\n },\n};\n\nexport const Breadcrumb: FunctionComponent<BreadcrumbProps> = ({\n className,\n items,\n theme = 'light',\n component = 'a',\n}) => {\n const [first, second, , ...rest] = items;\n const lastItem = rest.length ? rest[rest.length - 1] : items[items.length - 1];\n const spacer = { label: '...', href: '' };\n const itemsToRender = !rest.length ? items : [first, second, spacer, lastItem];\n const { thStart, thEnd } = themes[theme];\n const Cmp = component as FunctionComponent<PropsWithChildren<{ href: string }>>;\n\n return (\n <nav data-name=\"Breadcrumb\" aria-label=\"Breadcrumb\" className={className}>\n <ul className=\"flex items-center\">\n {itemsToRender.map(({ label, href }, index) => {\n const isLast = index === itemsToRender.length - 1;\n const isLink = href && !isLast;\n return (\n <li\n key={label}\n className={classnames('text-b4 flex items-center', {\n [thStart]: !isLast,\n [thEnd]: isLast,\n })}\n {...(isLast && { 'aria-current': 'page' })}\n >\n <span>{isLink ? <Cmp href={href}>{label}</Cmp> : label}</span>\n {!isLast && <Icon name=\"Diamond\" width=\"14px\" className=\"mx-4\" />}\n </li>\n );\n })}\n </ul>\n </nav>\n );\n};\n"],"names":["themes","Breadcrumb","className","items","theme","component","first","second","rest","lastItem","spacer","itemsToRender","thStart","thEnd","Cmp","jsx","label","href","index","isLast","isLink","jsxs","classnames","Icon"],"mappings":";;;;AAmBA,MAAMA,IAAS;AAAA,EACb,OAAO;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAAA,EAET,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAEX,GAEaC,IAAiD,CAAC;AAAA,EAC7D,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AACd,MAAM;AACJ,QAAM,CAACC,GAAOC,KAAU,GAAGC,CAAI,IAAIL,GAC7BM,IAAWD,EAAK,SAASA,EAAKA,EAAK,SAAS,CAAC,IAAIL,EAAMA,EAAM,SAAS,CAAC,GACvEO,IAAS,EAAE,OAAO,OAAO,MAAM,GAAA,GAC/BC,IAAiBH,EAAK,SAAiB,CAACF,GAAOC,GAAQG,GAAQD,CAAQ,IAAxCN,GAC/B,EAAE,SAAAS,GAAS,OAAAC,MAAUb,EAAOI,CAAK,GACjCU,IAAMT;AAEZ,2BACG,OAAA,EAAI,aAAU,cAAa,cAAW,cAAa,WAAAH,GAClD,UAAA,gBAAAa,EAAC,MAAA,EAAG,WAAU,qBACX,YAAc,IAAI,CAAC,EAAE,OAAAC,GAAO,MAAAC,EAAA,GAAQC,MAAU;AAC7C,UAAMC,IAASD,MAAUP,EAAc,SAAS,GAC1CS,IAASH,KAAQ,CAACE;AACxB,WACE,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,WAAWC,EAAW,6BAA6B;AAAA,UACjD,CAACV,CAAO,GAAG,CAACO;AAAA,UACZ,CAACN,CAAK,GAAGM;AAAA,QAAA,CACV;AAAA,QACA,GAAIA,KAAU,EAAE,gBAAgB,OAAA;AAAA,QAEjC,UAAA;AAAA,UAAA,gBAAAJ,EAAC,UAAM,UAAAK,IAAS,gBAAAL,EAACD,KAAI,MAAAG,GAAa,UAAAD,GAAM,IAASA,EAAA,CAAM;AAAA,UACtD,CAACG,KAAU,gBAAAJ,EAACQ,GAAA,EAAK,MAAK,WAAU,OAAM,QAAO,WAAU,OAAA,CAAO;AAAA,QAAA;AAAA,MAAA;AAAA,MAR1DP;AAAA,IAAA;AAAA,EAWX,CAAC,GACH,GACF;AAEJ;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { BUTTON_VARIANT_LEGACY as a, BUTTON_THEME_LEGACY as e, Button as m } from "./Button.js";
|
|
3
3
|
const c = ({ children: r, ...t }) => {
|
|
4
4
|
const n = {
|
|
5
5
|
...t,
|
|
6
|
-
...
|
|
7
|
-
...
|
|
6
|
+
...e[t.theme] || {},
|
|
7
|
+
...a[t.variant] || {}
|
|
8
8
|
};
|
|
9
9
|
return /* @__PURE__ */ o(m, { ...n, variant: "circle", children: r && /* @__PURE__ */ o("span", { className: "sr-only", children: r }) });
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrowButton.js","sources":["../../../lib/molecules/Buttons/ArrowButton.tsx"],"sourcesContent":["import type { ComponentProps, FunctionComponent } from 'react';\n\nimport { Button } from './Button';\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY } from '@/molecules/Buttons/Button';\n\ninterface Props extends ComponentProps<typeof Button> {\n icon: 'ArrowDefaultLeft' | 'ArrowDefaultRight' | 'ArrowTailLeft' | 'ArrowTailRight';\n}\n\nexport const ArrowButton: FunctionComponent<Props> = ({ children, ...props }) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <Button {...opts} variant=\"circle\">\n {children && <span className=\"sr-only\">{children}</span>}\n </Button>\n );\n};\n"],"names":["ArrowButton","children","props","opts","BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","jsx","Button"],"mappings":";;AASO,MAAMA,IAAwC,CAAC,EAAE,UAAAC,GAAU,GAAGC,QAAY;AAC/E,QAAMC,IAAO;AAAA,IACX,GAAGD;AAAA,IACH,GAAIE,EAAoBF,EAAM,KAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"ArrowButton.js","sources":["../../../lib/molecules/Buttons/ArrowButton.tsx"],"sourcesContent":["import type { ComponentProps, FunctionComponent } from 'react';\n\nimport { Button } from './Button';\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY } from '@/molecules/Buttons/Button';\n\ninterface Props extends ComponentProps<typeof Button> {\n icon: 'ArrowDefaultLeft' | 'ArrowDefaultRight' | 'ArrowTailLeft' | 'ArrowTailRight';\n}\n\nexport const ArrowButton: FunctionComponent<Props> = ({ children, ...props }) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <Button {...opts} variant=\"circle\">\n {children && <span className=\"sr-only\">{children}</span>}\n </Button>\n );\n};\n"],"names":["ArrowButton","children","props","opts","BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","jsx","Button"],"mappings":";;AASO,MAAMA,IAAwC,CAAC,EAAE,UAAAC,GAAU,GAAGC,QAAY;AAC/E,QAAMC,IAAO;AAAA,IACX,GAAGD;AAAA,IACH,GAAIE,EAAoBF,EAAM,KAAM,KAAK,CAAA;AAAA,IACzC,GAAIG,EAAsBH,EAAM,OAAQ,KAAK,CAAA;AAAA,EAAC;AAGhD,SACE,gBAAAI,EAACC,GAAA,EAAQ,GAAGJ,GAAM,SAAQ,UACvB,UAAAF,KAAY,gBAAAK,EAAC,QAAA,EAAK,WAAU,WAAW,UAAAL,EAAA,CAAS,GACnD;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../lib/molecules/Buttons/Button.tsx"],"sourcesContent":["import { type ButtonHTMLAttributes, type FunctionComponent, type ReactNode } from 'react';\nimport type { IconicNames, IconicTypes } from '@/atoms/Icons/index.js';\nimport { Button as ButtonV2, type ButtonProps as ButtonPropsV2 } from './v2/Button.js';\n\nexport const BUTTON_THEME_LEGACY: any = {\n white: {\n color: 'white',\n theme: 'solid',\n },\n black: {\n color: 'black',\n theme: 'solid',\n },\n yellow: {\n color: 'saffron',\n theme: 'solid',\n },\n whiteStroke: {\n color: 'white',\n theme: 'outline',\n },\n blackStroke: {\n color: 'black',\n theme: 'outline',\n },\n};\n\nexport const BUTTON_VARIANT_LEGACY: any = {\n textSmall: {\n size: 'small',\n variant: undefined,\n },\n icon: {\n variant: 'circle',\n label: undefined,\n },\n arrow: {\n variant: 'circle',\n label: undefined,\n size: 'large',\n },\n};\n\nexport type ButtonPropsLegacy = {\n /**\n * Button themes defining background color and text/icon color\n */\n theme?: 'yellow' | 'white' | 'black' | 'whiteStroke' | 'blackStroke' | ButtonPropsV2['theme'];\n /**\n * Is it a text button? An icon button? An arrow button?\n */\n variant?: 'text' | 'textSmall' | 'icon' | 'arrow' | 'monogram' | ButtonPropsV2['variant'];\n /**\n * Background Color override\n * Ideally please use ONLY for the \"white\" and \"black\" themes\n * @deprecated\n */\n backgroundOverride?: string;\n /**\n * Button contents\n * @deprecated\n */\n label?: string;\n /**\n * Optional children (you might never use this, please actually try to avoid it)\n */\n children?: ReactNode;\n /**\n * Optional icon name\n */\n icon?: IconicNames;\n /**\n * Force the icon type to be svg, font or default\n */\n iconType?: IconicTypes;\n /**\n * Group name\n * Used to group buttons together (you might not need this)\n * @deprecated\n */\n groupName?: string;\n};\n\nexport type CommonButtonProps = Omit<ButtonPropsV2, 'theme' | 'variant'> & ButtonPropsLegacy;\n\ntype ButtonProps = CommonButtonProps & ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Button: FunctionComponent<ButtonProps> = (props: ButtonProps) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <ButtonV2 {...opts}>\n {opts.label}\n {props.children}\n </ButtonV2>\n );\n};\n"],"names":["BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","Button","props","opts","jsxs","ButtonV2"],"mappings":";;;AAIO,MAAMA,IAA2B;AAAA,EACtC,OAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO;AAAA,
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../lib/molecules/Buttons/Button.tsx"],"sourcesContent":["import { type ButtonHTMLAttributes, type FunctionComponent, type ReactNode } from 'react';\nimport type { IconicNames, IconicTypes } from '@/atoms/Icons/index.js';\nimport { Button as ButtonV2, type ButtonProps as ButtonPropsV2 } from './v2/Button.js';\n\nexport const BUTTON_THEME_LEGACY: any = {\n white: {\n color: 'white',\n theme: 'solid',\n },\n black: {\n color: 'black',\n theme: 'solid',\n },\n yellow: {\n color: 'saffron',\n theme: 'solid',\n },\n whiteStroke: {\n color: 'white',\n theme: 'outline',\n },\n blackStroke: {\n color: 'black',\n theme: 'outline',\n },\n};\n\nexport const BUTTON_VARIANT_LEGACY: any = {\n textSmall: {\n size: 'small',\n variant: undefined,\n },\n icon: {\n variant: 'circle',\n label: undefined,\n },\n arrow: {\n variant: 'circle',\n label: undefined,\n size: 'large',\n },\n};\n\nexport type ButtonPropsLegacy = {\n /**\n * Button themes defining background color and text/icon color\n */\n theme?: 'yellow' | 'white' | 'black' | 'whiteStroke' | 'blackStroke' | ButtonPropsV2['theme'];\n /**\n * Is it a text button? An icon button? An arrow button?\n */\n variant?: 'text' | 'textSmall' | 'icon' | 'arrow' | 'monogram' | ButtonPropsV2['variant'];\n /**\n * Background Color override\n * Ideally please use ONLY for the \"white\" and \"black\" themes\n * @deprecated\n */\n backgroundOverride?: string;\n /**\n * Button contents\n * @deprecated\n */\n label?: string;\n /**\n * Optional children (you might never use this, please actually try to avoid it)\n */\n children?: ReactNode;\n /**\n * Optional icon name\n */\n icon?: IconicNames;\n /**\n * Force the icon type to be svg, font or default\n */\n iconType?: IconicTypes;\n /**\n * Group name\n * Used to group buttons together (you might not need this)\n * @deprecated\n */\n groupName?: string;\n};\n\nexport type CommonButtonProps = Omit<ButtonPropsV2, 'theme' | 'variant'> & ButtonPropsLegacy;\n\ntype ButtonProps = CommonButtonProps & ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Button: FunctionComponent<ButtonProps> = (props: ButtonProps) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <ButtonV2 {...opts}>\n {opts.label}\n {props.children}\n </ButtonV2>\n );\n};\n"],"names":["BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","Button","props","opts","jsxs","ButtonV2"],"mappings":";;;AAIO,MAAMA,IAA2B;AAAA,EACtC,OAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,OAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,aAAa;AAAA,IACX,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,aAAa;AAAA,IACX,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX,GAEaC,IAA6B;AAAA,EACxC,WAAW;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAAA,EAEX,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAAA,EAET,OAAO;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAEV,GA8CaC,IAAyC,CAACC,MAAuB;AAC5E,QAAMC,IAAO;AAAA,IACX,GAAGD;AAAA,IACH,GAAIH,EAAoBG,EAAM,KAAM,KAAK,CAAA;AAAA,IACzC,GAAIF,EAAsBE,EAAM,OAAQ,KAAK,CAAA;AAAA,EAAC;AAGhD,SACE,gBAAAE,EAACC,GAAA,EAAU,GAAGF,GACX,UAAA;AAAA,IAAAA,EAAK;AAAA,IACLD,EAAM;AAAA,EAAA,GACT;AAEJ;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as n } from "react/jsx-runtime";
|
|
2
2
|
import { ButtonAnchor as r } from "./v2/ButtonAnchor.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BUTTON_VARIANT_LEGACY as c, BUTTON_THEME_LEGACY as e } from "./Button.js";
|
|
4
4
|
const i = (t) => {
|
|
5
5
|
const o = {
|
|
6
6
|
...t,
|
|
7
|
-
...
|
|
8
|
-
...
|
|
7
|
+
...e[t.theme] || {},
|
|
8
|
+
...c[t.variant] || {}
|
|
9
9
|
};
|
|
10
10
|
return /* @__PURE__ */ n(r, { ...o, children: [
|
|
11
11
|
o.label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonAnchor.js","sources":["../../../lib/molecules/Buttons/ButtonAnchor.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, FunctionComponent, PropsWithChildren } from 'react';\nimport { ButtonAnchor as ButtonAnchorV2 } from './v2/ButtonAnchor';\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY, type CommonButtonProps } from './Button';\n\ntype ButtonAnchorProps = CommonButtonProps & {\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n} & AnchorHTMLAttributes<HTMLAnchorElement>;\n\nexport const ButtonAnchor: FunctionComponent<ButtonAnchorProps> = (props) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <ButtonAnchorV2 {...opts}>\n {opts.label}\n {props.children}\n </ButtonAnchorV2>\n );\n};\n"],"names":["ButtonAnchor","props","opts","BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","jsxs","ButtonAnchorV2"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ButtonAnchor.js","sources":["../../../lib/molecules/Buttons/ButtonAnchor.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, FunctionComponent, PropsWithChildren } from 'react';\nimport { ButtonAnchor as ButtonAnchorV2 } from './v2/ButtonAnchor';\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY, type CommonButtonProps } from './Button';\n\ntype ButtonAnchorProps = CommonButtonProps & {\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n} & AnchorHTMLAttributes<HTMLAnchorElement>;\n\nexport const ButtonAnchor: FunctionComponent<ButtonAnchorProps> = (props) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <ButtonAnchorV2 {...opts}>\n {opts.label}\n {props.children}\n </ButtonAnchorV2>\n );\n};\n"],"names":["ButtonAnchor","props","opts","BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","jsxs","ButtonAnchorV2"],"mappings":";;;AAQO,MAAMA,IAAqD,CAACC,MAAU;AAC3E,QAAMC,IAAO;AAAA,IACX,GAAGD;AAAA,IACH,GAAIE,EAAoBF,EAAM,KAAM,KAAK,CAAA;AAAA,IACzC,GAAIG,EAAsBH,EAAM,OAAQ,KAAK,CAAA;AAAA,EAAC;AAGhD,SACE,gBAAAI,EAACC,GAAA,EAAgB,GAAGJ,GACjB,UAAA;AAAA,IAAAA,EAAK;AAAA,IACLD,EAAM;AAAA,EAAA,GACT;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonContent.js","sources":["../../../lib/molecules/Buttons/ButtonContent.tsx"],"sourcesContent":["import type { FunctionComponent, ReactNode } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\nexport type ButtonContentProps = {\n /**\n * @deprecated\n */\n showLabel?: boolean;\n /**\n * @deprecated\n */\n label?: string;\n children?: ReactNode;\n icon?: IconicNames;\n iconType?: IconicTypes;\n iconWidth?: string;\n};\n\nexport const ButtonContent: FunctionComponent<ButtonContentProps> = ({\n showLabel,\n label,\n children,\n icon,\n iconType,\n iconWidth,\n}) => {\n return (\n <span className=\"flex items-center justify-center gap-x-8 w-full\">\n {showLabel ? label : label && <span className=\"sr-only\">{label}</span>}\n {children}\n {icon && <Icon name={icon} width={iconWidth ?? '24px'} type={iconType} />}\n </span>\n );\n};\n"],"names":["ButtonContent","showLabel","label","children","icon","iconType","iconWidth","jsxs","jsx","Icon"],"mappings":";;;AAmBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AACF,MAEI,gBAAAC,EAAC,
|
|
1
|
+
{"version":3,"file":"ButtonContent.js","sources":["../../../lib/molecules/Buttons/ButtonContent.tsx"],"sourcesContent":["import type { FunctionComponent, ReactNode } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\nexport type ButtonContentProps = {\n /**\n * @deprecated\n */\n showLabel?: boolean;\n /**\n * @deprecated\n */\n label?: string;\n children?: ReactNode;\n icon?: IconicNames;\n iconType?: IconicTypes;\n iconWidth?: string;\n};\n\nexport const ButtonContent: FunctionComponent<ButtonContentProps> = ({\n showLabel,\n label,\n children,\n icon,\n iconType,\n iconWidth,\n}) => {\n return (\n <span className=\"flex items-center justify-center gap-x-8 w-full\">\n {showLabel ? label : label && <span className=\"sr-only\">{label}</span>}\n {children}\n {icon && <Icon name={icon} width={iconWidth ?? '24px'} type={iconType} />}\n </span>\n );\n};\n"],"names":["ButtonContent","showLabel","label","children","icon","iconType","iconWidth","jsxs","jsx","Icon"],"mappings":";;;AAmBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AACF,MAEI,gBAAAC,EAAC,QAAA,EAAK,WAAU,mDACb,UAAA;AAAA,EAAAN,IAAYC,IAAQA,KAAS,gBAAAM,EAAC,QAAA,EAAK,WAAU,WAAW,UAAAN,GAAM;AAAA,EAC9DC;AAAA,EACAC,uBAASK,GAAA,EAAK,MAAML,GAAM,OAAOE,KAAa,QAAQ,MAAMD,EAAA,CAAU;AAAA,GACzE;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, FunctionComponent } from 'react';
|
|
2
|
-
import { type ButtonProps } from './Button.type';
|
|
3
|
-
import './Button.css';
|
|
2
|
+
import { type ButtonProps } from './v2/Button.type';
|
|
3
|
+
import './v2/Button.css';
|
|
4
4
|
interface Props extends ButtonProps, Omit<ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
5
5
|
}
|
|
6
6
|
export declare const FakeButton: FunctionComponent<Props>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { c as l } from "
|
|
3
|
-
import { getButtonClasses as f } from "./Button.type.js";
|
|
4
|
-
import { ButtonContent as c } from "
|
|
5
|
-
/* empty css
|
|
2
|
+
import { c as l } from "../../chunks/index.js";
|
|
3
|
+
import { getButtonClasses as f } from "./v2/Button.type.js";
|
|
4
|
+
import { ButtonContent as c } from "./ButtonContent.js";
|
|
5
|
+
/* empty css */
|
|
6
6
|
const g = ({
|
|
7
7
|
className: t,
|
|
8
8
|
children: r,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeButton.js","sources":["../../../lib/molecules/Buttons/FakeButton.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport { getButtonClasses, type ButtonProps } from './v2/Button.type';\n\nimport { ButtonContent } from './ButtonContent';\n\nimport './v2/Button.css';\n\ninterface Props extends ButtonProps, Omit<ComponentPropsWithoutRef<'span'>, 'color'> {}\n\nexport const FakeButton: FunctionComponent<Props> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n ...attrs\n}) => {\n return (\n <span\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </span>\n );\n};\n"],"names":["FakeButton","className","children","color","icon","iconWidth","size","theme","variant","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;AAWO,MAAMA,IAAuC,CAAC;AAAA,EACnD,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAGD;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAT,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAElF,UAAA,gBAAAS,EAACG,GAAA,EAAc,MAAAT,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { FakeButton as m } from "./
|
|
2
|
+
import { BUTTON_VARIANT_LEGACY as n, BUTTON_THEME_LEGACY as o } from "./Button.js";
|
|
3
|
+
import { FakeButton as m } from "./FakeButton.js";
|
|
4
4
|
const c = (t) => {
|
|
5
5
|
const r = {
|
|
6
6
|
...t,
|
|
7
|
-
...
|
|
8
|
-
...
|
|
7
|
+
...o[t.theme] || {},
|
|
8
|
+
...n[t.variant] || {}
|
|
9
9
|
};
|
|
10
10
|
return /* @__PURE__ */ e(m, { ...r, children: [
|
|
11
11
|
r.label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InertButton.js","sources":["../../../lib/molecules/Buttons/InertButton.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY, type CommonButtonProps } from './Button';\nimport { FakeButton } from '@/molecules/Buttons/
|
|
1
|
+
{"version":3,"file":"InertButton.js","sources":["../../../lib/molecules/Buttons/InertButton.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY, type CommonButtonProps } from './Button';\nimport { FakeButton } from '@/molecules/Buttons/FakeButton';\n\n/**\n * @deprecated Use `FakeButton` instead.\n * @param props\n */\nexport const InertButton: FunctionComponent<CommonButtonProps> = (props) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <FakeButton {...opts}>\n {opts.label}\n {props.children}\n </FakeButton>\n );\n};\n"],"names":["InertButton","props","opts","BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","jsxs","FakeButton"],"mappings":";;;AASO,MAAMA,IAAoD,CAACC,MAAU;AAC1E,QAAMC,IAAO;AAAA,IACX,GAAGD;AAAA,IACH,GAAIE,EAAoBF,EAAM,KAAM,KAAK,CAAA;AAAA,IACzC,GAAIG,EAAsBH,EAAM,OAAQ,KAAK,CAAA;AAAA,EAAC;AAGhD,SACE,gBAAAI,EAACC,GAAA,EAAY,GAAGJ,GACb,UAAA;AAAA,IAAAA,EAAK;AAAA,IACLD,EAAM;AAAA,EAAA,GACT;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../lib/molecules/Buttons/v2/Button.tsx"],"sourcesContent":["'use client';\nimport classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport { getButtonClasses, type ButtonProps as Btn } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'button'>, 'color'> {\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n dataTestId,\n ...attrs\n}) => {\n return (\n <button\n type=\"button\"\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"Button\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </button>\n );\n};\n"],"names":["Button","className","children","color","icon","iconWidth","size","theme","variant","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAgBO,MAAMA,IAAyC,CAAC;AAAA,EACrD,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,YAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,eAAaF;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAV,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../lib/molecules/Buttons/v2/Button.tsx"],"sourcesContent":["'use client';\nimport classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport { getButtonClasses, type ButtonProps as Btn } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'button'>, 'color'> {\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n dataTestId,\n ...attrs\n}) => {\n return (\n <button\n type=\"button\"\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"Button\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </button>\n );\n};\n"],"names":["Button","className","children","color","icon","iconWidth","size","theme","variant","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAgBO,MAAMA,IAAyC,CAAC;AAAA,EACrD,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,YAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,eAAaF;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAV,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,UAAA,gBAAAU,EAACG,GAAA,EAAc,MAAAV,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonAnchor.js","sources":["../../../../lib/molecules/Buttons/v2/ButtonAnchor.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent, PropsWithChildren } from 'react';\n\nimport { getButtonClasses, type ButtonProps } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonAnchorProps\n extends ButtonProps,\n Omit<ComponentPropsWithoutRef<'a'>, 'color'> {\n href: string;\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n}\n\nexport const ButtonAnchor: FunctionComponent<ButtonAnchorProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n component = 'a',\n dataTestId,\n ...attrs\n}) => {\n const Cmp = component as FunctionComponent<PropsWithChildren<ButtonAnchorProps>>;\n return (\n <Cmp\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"ButtonAnchor\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </Cmp>\n );\n};\n"],"names":["ButtonAnchor","className","children","color","icon","iconWidth","size","theme","variant","component","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAsBO,MAAMA,IAAqD,CAAC;AAAA,EACjE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,YAAAC;AAAA,EACA,GAAGC;AACL,MAGI,gBAAAC;AAAA,EAFUH;AAAA,EAET;AAAA,IACC,eAAaC;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAX,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,
|
|
1
|
+
{"version":3,"file":"ButtonAnchor.js","sources":["../../../../lib/molecules/Buttons/v2/ButtonAnchor.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent, PropsWithChildren } from 'react';\n\nimport { getButtonClasses, type ButtonProps } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonAnchorProps\n extends ButtonProps,\n Omit<ComponentPropsWithoutRef<'a'>, 'color'> {\n href: string;\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n}\n\nexport const ButtonAnchor: FunctionComponent<ButtonAnchorProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n component = 'a',\n dataTestId,\n ...attrs\n}) => {\n const Cmp = component as FunctionComponent<PropsWithChildren<ButtonAnchorProps>>;\n return (\n <Cmp\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"ButtonAnchor\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </Cmp>\n );\n};\n"],"names":["ButtonAnchor","className","children","color","icon","iconWidth","size","theme","variant","component","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAsBO,MAAMA,IAAqD,CAAC;AAAA,EACjE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,YAAAC;AAAA,EACA,GAAGC;AACL,MAGI,gBAAAC;AAAA,EAFUH;AAAA,EAET;AAAA,IACC,eAAaC;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAX,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,UAAA,gBAAAW,EAACG,GAAA,EAAc,MAAAX,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
|
package/molecules/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../lib/molecules/Card.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { FunctionComponent, PropsWithChildren } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\ninterface CardProps {\n title: string;\n icon: IconicNames;\n iconType?: IconicTypes;\n theme?: 'light' | 'dark';\n dataName?: string;\n}\n\nexport const Card: FunctionComponent<PropsWithChildren<CardProps>> = ({\n title,\n children,\n icon,\n iconType,\n theme = 'light',\n dataName = 'Card',\n}) => {\n return (\n <div\n className=\"border-lightGrey rounded-16 flex shrink-0 flex-row gap-20 border bg-white p-20\"\n data-name={dataName}\n >\n <div\n className={classnames('flex h-48 w-48 shrink-0 items-center justify-center rounded-full', {\n 'bg-ultramarine text-white': theme === 'dark',\n 'bg-lightSand text-black': theme === 'light',\n })}\n >\n <Icon name={icon} type={iconType} width=\"24px\" />\n </div>\n <div className=\"space-y-8 font-sans\">\n <div className=\"text-b3 font-semibold\">{title}</div>\n <div className=\"text-b4 font-normal\">{children}</div>\n </div>\n </div>\n );\n};\n"],"names":["Card","title","children","icon","iconType","theme","dataName","jsxs","jsx","classnames","Icon"],"mappings":";;;;AAaO,MAAMA,IAAwD,CAAC;AAAA,EACpE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AACb,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,aAAWD;AAAA,IAEX,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC,EAAW,oEAAoE;AAAA,YACxF,6BAA6BJ,MAAU;AAAA,YACvC,2BAA2BA,MAAU;AAAA,UAAA,CACtC;AAAA,UAED,4BAACK,
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../lib/molecules/Card.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { FunctionComponent, PropsWithChildren } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\ninterface CardProps {\n title: string;\n icon: IconicNames;\n iconType?: IconicTypes;\n theme?: 'light' | 'dark';\n dataName?: string;\n}\n\nexport const Card: FunctionComponent<PropsWithChildren<CardProps>> = ({\n title,\n children,\n icon,\n iconType,\n theme = 'light',\n dataName = 'Card',\n}) => {\n return (\n <div\n className=\"border-lightGrey rounded-16 flex shrink-0 flex-row gap-20 border bg-white p-20\"\n data-name={dataName}\n >\n <div\n className={classnames('flex h-48 w-48 shrink-0 items-center justify-center rounded-full', {\n 'bg-ultramarine text-white': theme === 'dark',\n 'bg-lightSand text-black': theme === 'light',\n })}\n >\n <Icon name={icon} type={iconType} width=\"24px\" />\n </div>\n <div className=\"space-y-8 font-sans\">\n <div className=\"text-b3 font-semibold\">{title}</div>\n <div className=\"text-b4 font-normal\">{children}</div>\n </div>\n </div>\n );\n};\n"],"names":["Card","title","children","icon","iconType","theme","dataName","jsxs","jsx","classnames","Icon"],"mappings":";;;;AAaO,MAAMA,IAAwD,CAAC;AAAA,EACpE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AACb,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,aAAWD;AAAA,IAEX,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC,EAAW,oEAAoE;AAAA,YACxF,6BAA6BJ,MAAU;AAAA,YACvC,2BAA2BA,MAAU;AAAA,UAAA,CACtC;AAAA,UAED,4BAACK,GAAA,EAAK,MAAMP,GAAM,MAAMC,GAAU,OAAM,OAAA,CAAO;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjD,gBAAAG,EAAC,OAAA,EAAI,WAAU,uBACb,UAAA;AAAA,QAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAAP,GAAM;AAAA,QAC9C,gBAAAO,EAAC,OAAA,EAAI,WAAU,uBAAuB,UAAAN,EAAA,CAAS;AAAA,MAAA,EAAA,CACjD;AAAA,IAAA;AAAA,EAAA;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["import { useSpring, animated, useResize } from '@react-spring/web';\nimport classnames from 'classnames';\nimport {\n type FunctionComponent,\n type MutableRefObject,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from 'react';\n\n/**\n * This is not a Collapse component, it's a component that animates *to* the height of its children.\n * It does the *absolute* same but you Bring Your Own Height™ by applying a class to the children.\n * e.g.: <ElasticHeight className={isOpen ? \"\" : \"h-0\"}><div>...</div></ElasticHeight>\n * ID is there for accessibility purposes.\n *\n * This is in no way affiliated with Amazon ElasticSearch.\n */\n\ninterface ElasticHeightProps {\n /**\n * Id of the element\n */\n id?: string;\n /**\n * Class of the element (please provide something that sets the height)\n */\n className?: string;\n /**\n * Class of the container (to avoid CLS, mainly)\n */\n containerClassName?: string;\n /**\n * Role of the element\n */\n role?: string;\n}\n\nconst linearInterpolation = (x: number) => x;\n\nexport const ElasticHeight: FunctionComponent<PropsWithChildren<ElasticHeightProps>> = ({\n children,\n id,\n className,\n role,\n containerClassName,\n}) => {\n const ref = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { height } = useResize({ container: ref });\n\n const [styles, api] = useSpring(() => ({\n from: {\n height: height.to(linearInterpolation),\n },\n immediate: true,\n }));\n\n useEffect(() => {\n api.start({\n to: {\n height: height.to(linearInterpolation),\n },\n config: {\n tension: 170,\n friction: 26,\n },\n });\n }, [api, height]);\n\n return (\n <animated.div\n role={role}\n className={classnames('overflow-hidden', containerClassName)}\n style={{ ...styles }}\n id={id}\n >\n <div className={className} ref={ref}>\n {children}\n </div>\n </animated.div>\n );\n};\n"],"names":["linearInterpolation","x","ElasticHeight","children","id","className","role","containerClassName","ref","useRef","height","useResize","styles","api","useSpring","useEffect","jsx","animated","classnames"],"mappings":";;;;AAsCA,MAAMA,IAAsB,CAACC,MAAcA,GAE9BC,IAA0E,CAAC;AAAA,EACtF,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,oBAAAC;AACF,MAAM;
|
|
1
|
+
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["import { useSpring, animated, useResize } from '@react-spring/web';\nimport classnames from 'classnames';\nimport {\n type FunctionComponent,\n type MutableRefObject,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from 'react';\n\n/**\n * This is not a Collapse component, it's a component that animates *to* the height of its children.\n * It does the *absolute* same but you Bring Your Own Height™ by applying a class to the children.\n * e.g.: <ElasticHeight className={isOpen ? \"\" : \"h-0\"}><div>...</div></ElasticHeight>\n * ID is there for accessibility purposes.\n *\n * This is in no way affiliated with Amazon ElasticSearch.\n */\n\ninterface ElasticHeightProps {\n /**\n * Id of the element\n */\n id?: string;\n /**\n * Class of the element (please provide something that sets the height)\n */\n className?: string;\n /**\n * Class of the container (to avoid CLS, mainly)\n */\n containerClassName?: string;\n /**\n * Role of the element\n */\n role?: string;\n}\n\nconst linearInterpolation = (x: number) => x;\n\nexport const ElasticHeight: FunctionComponent<PropsWithChildren<ElasticHeightProps>> = ({\n children,\n id,\n className,\n role,\n containerClassName,\n}) => {\n const ref = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { height } = useResize({ container: ref });\n\n const [styles, api] = useSpring(() => ({\n from: {\n height: height.to(linearInterpolation),\n },\n immediate: true,\n }));\n\n useEffect(() => {\n api.start({\n to: {\n height: height.to(linearInterpolation),\n },\n config: {\n tension: 170,\n friction: 26,\n },\n });\n }, [api, height]);\n\n return (\n <animated.div\n role={role}\n className={classnames('overflow-hidden', containerClassName)}\n style={{ ...styles }}\n id={id}\n >\n <div className={className} ref={ref}>\n {children}\n </div>\n </animated.div>\n );\n};\n"],"names":["linearInterpolation","x","ElasticHeight","children","id","className","role","containerClassName","ref","useRef","height","useResize","styles","api","useSpring","useEffect","jsx","animated","classnames"],"mappings":";;;;AAsCA,MAAMA,IAAsB,CAACC,MAAcA,GAE9BC,IAA0E,CAAC;AAAA,EACtF,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,oBAAAC;AACF,MAAM;AACJ,QAAMC,IAAMC,EAAuB,IAAI,GACjC,EAAE,QAAAC,EAAA,IAAWC,EAAU,EAAE,WAAWH,GAAK,GAEzC,CAACI,GAAQC,CAAG,IAAIC,EAAU,OAAO;AAAA,IACrC,MAAM;AAAA,MACJ,QAAQJ,EAAO,GAAGV,CAAmB;AAAA,IAAA;AAAA,IAEvC,WAAW;AAAA,EAAA,EACX;AAEF,SAAAe,EAAU,MAAM;AACd,IAAAF,EAAI,MAAM;AAAA,MACR,IAAI;AAAA,QACF,QAAQH,EAAO,GAAGV,CAAmB;AAAA,MAAA;AAAA,MAEvC,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,UAAU;AAAA,MAAA;AAAA,IACZ,CACD;AAAA,EACH,GAAG,CAACa,GAAKH,CAAM,CAAC,GAGd,gBAAAM;AAAA,IAACC,EAAS;AAAA,IAAT;AAAA,MACC,MAAAX;AAAA,MACA,WAAWY,EAAW,mBAAmBX,CAAkB;AAAA,MAC3D,OAAO,EAAE,GAAGK,EAAA;AAAA,MACZ,IAAAR;AAAA,MAEA,UAAA,gBAAAY,EAAC,OAAA,EAAI,WAAAX,GAAsB,KAAAG,GACxB,UAAAL,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useId } from 'react';\nimport { Icon } from '@/atoms/Icons/index.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\n\nexport interface CheckboxProps<Value = string> extends FormControlProps<Value> {\n size?: number;\n onChange?: (name: string, value: Value | null) => void;\n}\n\nexport function Checkbox<Value = string>(props: CheckboxProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n dataTestId,\n disabled = false,\n checked: initialChecked = false,\n value,\n size = 24,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n onChange,\n ...rest\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n name,\n initialValue: initialChecked,\n onChange(name, checked) {\n onChange?.(name, checked ? ((value !== undefined ? value : checked) as Value) : null);\n },\n });\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div\n className={classnames('flex flex-col space-y-2', className)}\n data-testid={`checkbox-container-${id}`}\n >\n <label\n className={classnames('cursor-pointer relative flex text-b3 items-center', {\n 'text-grey': internalStatus === 'disabled',\n 'text-black': internalStatus !== 'default',\n })}\n >\n <span className=\"relative self-start me-8\">\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n checked={checked}\n data-name=\"Checkbox\"\n disabled={disabled}\n value={value as any}\n />\n\n <span\n style={{ height: size, width: size }}\n className={classnames({ '!border-red': internalStatus === 'error' })}\n data-testid={`check-container-${id}`}\n >\n <Icon\n name=\"CheckDefault\"\n type=\"svg\"\n width={`${size}px`}\n color=\"black\"\n className=\"absolute\"\n />\n </span>\n </span>\n\n {children}\n </label>\n\n {shouldDisplayErrorMessage && (\n <span className=\"text-red text-b4 flex items-start space-x-4 ps-20\" role=\"alert\">\n <Icon name=\"Error\" width=\"20px\" />\n {errorMessage}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Checkbox","props","internalId","useId","id","name","className","dataTestId","disabled","initialChecked","value","size","tabIndex","validationStatus","errorMessage","children","onChange","rest","checked","setValue","useValue","internalStatus","useInternalStatus","shouldDisplayErrorMessage","jsxs","classnames","jsx","Icon"],"mappings":";;;;;;;;AAaO,SAASA,EAAyBC,GAA6B;AACpE,QAAMC,IAAaC,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useId } from 'react';\nimport { Icon } from '@/atoms/Icons/index.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\n\nexport interface CheckboxProps<Value = string> extends FormControlProps<Value> {\n size?: number;\n onChange?: (name: string, value: Value | null) => void;\n}\n\nexport function Checkbox<Value = string>(props: CheckboxProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n dataTestId,\n disabled = false,\n checked: initialChecked = false,\n value,\n size = 24,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n onChange,\n ...rest\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n name,\n initialValue: initialChecked,\n onChange(name, checked) {\n onChange?.(name, checked ? ((value !== undefined ? value : checked) as Value) : null);\n },\n });\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div\n className={classnames('flex flex-col space-y-2', className)}\n data-testid={`checkbox-container-${id}`}\n >\n <label\n className={classnames('cursor-pointer relative flex text-b3 items-center', {\n 'text-grey': internalStatus === 'disabled',\n 'text-black': internalStatus !== 'default',\n })}\n >\n <span className=\"relative self-start me-8\">\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n checked={checked}\n data-name=\"Checkbox\"\n disabled={disabled}\n value={value as any}\n />\n\n <span\n style={{ height: size, width: size }}\n className={classnames({ '!border-red': internalStatus === 'error' })}\n data-testid={`check-container-${id}`}\n >\n <Icon\n name=\"CheckDefault\"\n type=\"svg\"\n width={`${size}px`}\n color=\"black\"\n className=\"absolute\"\n />\n </span>\n </span>\n\n {children}\n </label>\n\n {shouldDisplayErrorMessage && (\n <span className=\"text-red text-b4 flex items-start space-x-4 ps-20\" role=\"alert\">\n <Icon name=\"Error\" width=\"20px\" />\n {errorMessage}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Checkbox","props","internalId","useId","id","name","className","dataTestId","disabled","initialChecked","value","size","tabIndex","validationStatus","errorMessage","children","onChange","rest","checked","setValue","useValue","internalStatus","useInternalStatus","shouldDisplayErrorMessage","jsxs","classnames","jsx","Icon"],"mappings":";;;;;;;;AAaO,SAASA,EAAyBC,GAA6B;AACpE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,WAAAE;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,SAASC,IAAiB;AAAA,IAC1B,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,kBAAAC,IAAmB;AAAA,IACnB,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDhB,GAEE,EAAE,OAAOiB,GAAS,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IACrD,MAAAf;AAAA,IACA,cAAcI;AAAA,IACd,SAASJ,GAAMa,GAAS;AACtB,MAAAF,KAAA,QAAAA,EAAWX,GAAMa,IAAYR,MAAU,SAAYA,IAAQQ,IAAqB;AAAA,IAClF;AAAA,EAAA,CACD,GACKG,IAAiBC,EAAkB;AAAA,IACvC,YAAYd;AAAA,IACZ,kBAAAK;AAAA,EAAA,CACD,GAEKU,IAA4BF,MAAmB,WAAWP;AAEhE,SACE,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAW,2BAA2BnB,CAAS;AAAA,MAC1D,eAAa,sBAAsBF,CAAE;AAAA,MAErC,UAAA;AAAA,QAAA,gBAAAoB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC,EAAW,qDAAqD;AAAA,cACzE,aAAaJ,MAAmB;AAAA,cAChC,cAAcA,MAAmB;AAAA,YAAA,CAClC;AAAA,YAED,UAAA;AAAA,cAAA,gBAAAG,EAAC,QAAA,EAAK,WAAU,4BACd,UAAA;AAAA,gBAAA,gBAAAE;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACE,GAAGT;AAAA,oBACJ,MAAAZ;AAAA,oBACA,eAAaE;AAAA,oBACb,MAAK;AAAA,oBACL,UAAAK;AAAA,oBACA,UAAU,MAAM;AACd,uBAACJ,KAAYW,EAAS,CAACD,CAAO;AAAA,oBAChC;AAAA,oBACA,SAAAA;AAAA,oBACA,aAAU;AAAA,oBACV,UAAAV;AAAA,oBACA,OAAAE;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGF,gBAAAgB;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,OAAO,EAAE,QAAQf,GAAM,OAAOA,EAAA;AAAA,oBAC9B,WAAWc,EAAW,EAAE,eAAeJ,MAAmB,SAAS;AAAA,oBACnE,eAAa,mBAAmBjB,CAAE;AAAA,oBAElC,UAAA,gBAAAsB;AAAA,sBAACC;AAAA,sBAAA;AAAA,wBACC,MAAK;AAAA,wBACL,MAAK;AAAA,wBACL,OAAO,GAAGhB,CAAI;AAAA,wBACd,OAAM;AAAA,wBACN,WAAU;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACZ;AAAA,gBAAA;AAAA,cACF,GACF;AAAA,cAECI;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGFQ,KACC,gBAAAC,EAAC,QAAA,EAAK,WAAU,qDAAoD,MAAK,SACvE,UAAA;AAAA,UAAA,gBAAAE,EAACC,GAAA,EAAK,MAAK,SAAQ,OAAM,QAAO;AAAA,UAC/Bb;AAAA,QAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkboxes.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkboxes.tsx"],"sourcesContent":["import { Children, cloneElement, type HTMLAttributes, isValidElement, useId } from 'react';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport type { CheckboxProps } from './Checkbox.js';\nimport classnames from 'classnames';\n\nexport interface CheckboxesProps<Value = string>\n extends Pick<\n FormControlProps<Value[]>,\n | 'id'\n | 'name'\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'readOnly'\n | 'tabIndex'\n | 'description'\n | 'validationStatus'\n | 'errorMessage'\n >,\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {}\n\nexport function Checkboxes<Value = string>(props: CheckboxesProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n children,\n value: initialValue,\n defaultValue,\n onChange,\n disabled,\n readOnly,\n tabIndex = 0,\n ...rest\n } = props;\n\n const { value, setValue } = useValue<Value[]>({\n name,\n initialValue,\n formatter(value) {\n return value !== undefined ? ([].concat(value as never) as Value[]) : value;\n },\n defaultValue: (defaultValue as Value[]) || ([] as Value[]),\n onChange,\n });\n\n return (\n <div {...rest} className={rest.className} role=\"listbox\">\n {Children.map(children, (child, index) => {\n if (isValidElement(child)) {\n const propValue: Value = (child.props as CheckboxProps<Value>).value as Value;\n\n return cloneElement(child, {\n ...child.props,\n name,\n id: `${id}-${index}`,\n disabled,\n readOnly,\n tabIndex: tabIndex + index + 1,\n className: classnames(child.props.className || 'mt-8 first:mt-0'),\n checked: value.includes(propValue),\n onChange(_: string, item: Value | null) {\n if (item === null) {\n setValue(value.filter((v) => v !== propValue));\n } else {\n setValue(value.concat(propValue));\n }\n },\n } as CheckboxProps<Value>);\n }\n\n return child;\n })}\n </div>\n );\n}\n"],"names":["Checkboxes","props","internalId","useId","id","name","children","initialValue","defaultValue","onChange","disabled","readOnly","tabIndex","rest","value","setValue","useValue","jsx","Children","child","index","isValidElement","propValue","cloneElement","classnames","_","item","v"],"mappings":";;;;AAsBO,SAASA,EAA2BC,GAA+B;AACxE,QAAMC,IAAaC,
|
|
1
|
+
{"version":3,"file":"Checkboxes.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkboxes.tsx"],"sourcesContent":["import { Children, cloneElement, type HTMLAttributes, isValidElement, useId } from 'react';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport type { CheckboxProps } from './Checkbox.js';\nimport classnames from 'classnames';\n\nexport interface CheckboxesProps<Value = string>\n extends Pick<\n FormControlProps<Value[]>,\n | 'id'\n | 'name'\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'readOnly'\n | 'tabIndex'\n | 'description'\n | 'validationStatus'\n | 'errorMessage'\n >,\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {}\n\nexport function Checkboxes<Value = string>(props: CheckboxesProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n children,\n value: initialValue,\n defaultValue,\n onChange,\n disabled,\n readOnly,\n tabIndex = 0,\n ...rest\n } = props;\n\n const { value, setValue } = useValue<Value[]>({\n name,\n initialValue,\n formatter(value) {\n return value !== undefined ? ([].concat(value as never) as Value[]) : value;\n },\n defaultValue: (defaultValue as Value[]) || ([] as Value[]),\n onChange,\n });\n\n return (\n <div {...rest} className={rest.className} role=\"listbox\">\n {Children.map(children, (child, index) => {\n if (isValidElement(child)) {\n const propValue: Value = (child.props as CheckboxProps<Value>).value as Value;\n\n return cloneElement(child, {\n ...child.props,\n name,\n id: `${id}-${index}`,\n disabled,\n readOnly,\n tabIndex: tabIndex + index + 1,\n className: classnames(child.props.className || 'mt-8 first:mt-0'),\n checked: value.includes(propValue),\n onChange(_: string, item: Value | null) {\n if (item === null) {\n setValue(value.filter((v) => v !== propValue));\n } else {\n setValue(value.concat(propValue));\n }\n },\n } as CheckboxProps<Value>);\n }\n\n return child;\n })}\n </div>\n );\n}\n"],"names":["Checkboxes","props","internalId","useId","id","name","children","initialValue","defaultValue","onChange","disabled","readOnly","tabIndex","rest","value","setValue","useValue","jsx","Children","child","index","isValidElement","propValue","cloneElement","classnames","_","item","v"],"mappings":";;;;AAsBO,SAASA,EAA2BC,GAA+B;AACxE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,UAAAE;AAAA,IACA,OAAOC;AAAA,IACP,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,GAAGC;AAAA,EAAA,IACDZ,GAEE,EAAE,OAAAa,GAAO,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IAC5C,MAAAX;AAAA,IACA,cAAAE;AAAA,IACA,UAAUO,GAAO;AACf,aAAOA,MAAU,SAAa,CAAA,EAAG,OAAOA,CAAc,IAAgBA;AAAAA,IACxE;AAAA,IACA,cAAeN,KAA6B,CAAA;AAAA,IAC5C,UAAAC;AAAA,EAAA,CACD;AAED,SACE,gBAAAQ,EAAC,OAAA,EAAK,GAAGJ,GAAM,WAAWA,EAAK,WAAW,MAAK,WAC5C,UAAAK,EAAS,IAAIZ,GAAU,CAACa,GAAOC,MAAU;AACxC,QAAIC,EAAeF,CAAK,GAAG;AACzB,YAAMG,IAAoBH,EAAM,MAA+B;AAE/D,aAAOI,EAAaJ,GAAO;AAAA,QACzB,GAAGA,EAAM;AAAA,QACT,MAAAd;AAAA,QACA,IAAI,GAAGD,CAAE,IAAIgB,CAAK;AAAA,QAClB,UAAAV;AAAA,QACA,UAAAC;AAAA,QACA,UAAUC,IAAWQ,IAAQ;AAAA,QAC7B,WAAWI,EAAWL,EAAM,MAAM,aAAa,iBAAiB;AAAA,QAChE,SAASL,EAAM,SAASQ,CAAS;AAAA,QACjC,SAASG,GAAWC,GAAoB;AACtC,UACEX,EADEW,MAAS,OACFZ,EAAM,OAAO,CAACa,MAAMA,MAAML,CAAS,IAEnCR,EAAM,OAAOQ,CAAS,CAFc;AAAA,QAIjD;AAAA,MAAA,CACuB;AAAA,IAC3B;AAEA,WAAOH;AAAA,EACT,CAAC,EAAA,CACH;AAEJ;"}
|