@drivy/cobalt 1.1.4 → 1.2.0

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.
Files changed (43) hide show
  1. package/components/Callout/index.js +1 -1
  2. package/components/Callout/index.js.map +1 -1
  3. package/components/PhotoDropzone/index.js +1 -1
  4. package/components/PhotoDropzone/index.js.map +1 -1
  5. package/index.js +0 -1
  6. package/index.js.map +1 -1
  7. package/package.json +8 -8
  8. package/src/tokens/breakpoints.js +2 -2
  9. package/src/tokens/colors.js +2 -2
  10. package/src/tokens/zIndexes.js +2 -2
  11. package/styles/components/Accordion/index.scss +1 -1
  12. package/styles/components/Buttons/DefaultButton/index.scss +7 -19
  13. package/styles/components/Buttons/GhostButton/index.scss +3 -11
  14. package/styles/components/Buttons/index.scss +2 -4
  15. package/styles/components/Calendar/CalendarRangePicker/index.scss +3 -3
  16. package/styles/components/Callout/index.scss +1 -1
  17. package/styles/components/Chip/index.scss +2 -3
  18. package/styles/components/Form/Autocomplete/index.scss +1 -1
  19. package/styles/components/Form/CheckablePill.scss +3 -9
  20. package/styles/components/Form/Checkmark.scss +11 -9
  21. package/styles/components/Form/RadioWithDetails.scss +4 -16
  22. package/styles/components/Form/Select.scss +16 -4
  23. package/styles/components/Form/TextInput.scss +0 -4
  24. package/styles/components/Form/form.scss +3 -6
  25. package/styles/components/Layout/Components/index.scss +3 -3
  26. package/styles/components/PhotoDropzone/index.scss +27 -4
  27. package/styles/components/PlateNumber/index.scss +1 -1
  28. package/styles/components/Rating/index.scss +1 -1
  29. package/styles/components/TabBar/index.scss +1 -3
  30. package/styles/components/Tabs/index.scss +1 -4
  31. package/styles/components.scss +0 -1
  32. package/styles/core/text.scss +5 -1
  33. package/types/src/components/PhotoDropzone/index.d.ts +1 -1
  34. package/types/src/index.d.ts +0 -1
  35. package/utilities.css +6 -0
  36. package/utils/getCobaltTailwindcssConfig2.js +40 -6
  37. package/utils/getCobaltTailwindcssConfig2.js.map +1 -1
  38. package/utils/tailwindcssGenerators.js +5 -2
  39. package/utils/tailwindcssGenerators.js.map +1 -1
  40. package/components/Flash/index.js +0 -30
  41. package/components/Flash/index.js.map +0 -1
  42. package/styles/components/Flash/index.scss +0 -35
  43. package/types/src/components/Flash/index.d.ts +0 -7
@@ -11,7 +11,7 @@ const Callout = ({ title, children, status = "info", close, }) => (React.createE
11
11
  title && React.createElement("div", { className: "cobalt-Callout__Title" }, title),
12
12
  React.createElement("div", null, children),
13
13
  close && (React.createElement("button", { className: "cobalt-Callout__Close", onClick: close, type: "button" },
14
- React.createElement(CloseIcon, { color: "subduedInteractive", contained: true, size: 16 })))));
14
+ React.createElement(CloseIcon, { color: "subdued", size: 16, contained: true })))));
15
15
 
16
16
  export { Callout, Callout as default };
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Callout/index.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\nimport { CloseIcon } from \"../Icon\"\n\nexport interface CalloutProps {\n children: React.ReactNode\n title?: string\n status: \"info\" | \"error\" | \"success\"\n close?: () => void\n}\n\nexport const Callout = ({\n title,\n children,\n status = \"info\",\n close,\n}: CalloutProps) => (\n <div\n className={cx(\"cobalt-Callout\", {\n \"cobalt-Callout--info\": status === \"info\",\n \"cobalt-Callout--error\": status === \"error\",\n \"cobalt-Callout--success\": status === \"success\",\n })}\n >\n {title && <div className=\"cobalt-Callout__Title\">{title}</div>}\n <div>{children}</div>\n {close && (\n <button className=\"cobalt-Callout__Close\" onClick={close} type=\"button\">\n <CloseIcon color=\"subduedInteractive\" contained size={16} />\n </button>\n )}\n </div>\n)\n\nexport default Callout\n"],"names":[],"mappings":";;;;;AAWa,MAAA,OAAO,GAAG,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,MAAM,GAAG,MAAM,EACf,KAAK,GACQ,MACb,KACE,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE;QAC9B,sBAAsB,EAAE,MAAM,KAAK,MAAM;QACzC,uBAAuB,EAAE,MAAM,KAAK,OAAO;QAC3C,yBAAyB,EAAE,MAAM,KAAK,SAAS;KAChD,CAAC,EAAA;AAED,IAAA,KAAK,IAAI,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,uBAAuB,EAAA,EAAE,KAAK,CAAO;AAC9D,IAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAM,QAAQ,CAAO;AACpB,IAAA,KAAK,KACJ,KAAQ,CAAA,aAAA,CAAA,QAAA,EAAA,EAAA,SAAS,EAAC,uBAAuB,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAA;AACrE,QAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAC,EAAA,KAAK,EAAC,oBAAoB,EAAC,SAAS,EAAA,IAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA,CACrD,CACV,CACG;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Callout/index.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\nimport { CloseIcon } from \"../Icon\"\n\nexport interface CalloutProps {\n children: React.ReactNode\n title?: string\n status: \"info\" | \"error\" | \"success\"\n close?: () => void\n}\n\nexport const Callout = ({\n title,\n children,\n status = \"info\",\n close,\n}: CalloutProps) => (\n <div\n className={cx(\"cobalt-Callout\", {\n \"cobalt-Callout--info\": status === \"info\",\n \"cobalt-Callout--error\": status === \"error\",\n \"cobalt-Callout--success\": status === \"success\",\n })}\n >\n {title && <div className=\"cobalt-Callout__Title\">{title}</div>}\n <div>{children}</div>\n {close && (\n <button className=\"cobalt-Callout__Close\" onClick={close} type=\"button\">\n <CloseIcon color=\"subdued\" size={16} contained />\n </button>\n )}\n </div>\n)\n\nexport default Callout\n"],"names":[],"mappings":";;;;;AAWa,MAAA,OAAO,GAAG,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,MAAM,GAAG,MAAM,EACf,KAAK,GACQ,MACb,KACE,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE;QAC9B,sBAAsB,EAAE,MAAM,KAAK,MAAM;QACzC,uBAAuB,EAAE,MAAM,KAAK,OAAO;QAC3C,yBAAyB,EAAE,MAAM,KAAK,SAAS;KAChD,CAAC,EAAA;AAED,IAAA,KAAK,IAAI,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,uBAAuB,EAAA,EAAE,KAAK,CAAO;AAC9D,IAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAM,QAAQ,CAAO;AACpB,IAAA,KAAK,KACJ,KAAQ,CAAA,aAAA,CAAA,QAAA,EAAA,EAAA,SAAS,EAAC,uBAAuB,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAA;AACrE,QAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAC,EAAA,KAAK,EAAC,SAAS,EAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAG,IAAA,EAAA,CAAA,CAC1C,CACV,CACG;;;;"}
@@ -162,7 +162,7 @@ const PhotoDropzone = ({ className, description, deletePopoverContent, errorCont
162
162
  onTouchEnd: onDeleteButtonClick, onMouseUp: onDeleteButtonClick, onKeyUp: onDeleteKey },
163
163
  React.createElement(BinIcon, { color: "indigo" })),
164
164
  React.createElement(Popover, { targetRef: deleteButtonRef, isOpen: showDeletePopover, close: closeDeletePopover, placement: "left-start", distance: 12, bodySpacing: false, arrow: true }, deletePopoverContent(onDelete, closeDeletePopover))))) : (React.createElement("div", { className: "cobalt-photo-dropzone__description cobalt-photo-dropzone__description--strong" },
165
- React.createElement("p", null, description),
165
+ description && React.createElement("div", null, description),
166
166
  React.createElement(PlusIcon, null)))),
167
167
  React.createElement("input", { ref: fileInputRef, className: "cobalt-photo-dropzone__hidden-input", type: "file", onChange: onFileInputChanged, accept: ACCEPTED_PHOTOS_TYPES.map((ext) => `.${ext}`).join(","), multiple: false })));
168
168
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/PhotoDropzone/index.tsx"],"sourcesContent":["import React, {\n useState,\n DragEvent as ReactDragEvent,\n useRef,\n TouchEvent as ReactTouchEvent,\n ChangeEvent as ReactChangeEvent,\n MouseEvent as ReactMouseEvent,\n KeyboardEvent as ReactKeyboardEvent,\n ReactNode,\n} from \"react\"\nimport cx from \"classnames\"\nimport {\n PlusIcon,\n BinIcon,\n LoadingIcon,\n ContextualWarningCircleFilledIcon,\n} from \"../Icon\"\nimport { validateFile } from \"../utils/validateFile\"\nimport Popover from \"../Popover\"\n\nconst ACCEPTED_MAX_SIZE_MB = 10\nconst ACCEPTED_PHOTOS_TYPES = [\"jpg\", \"jpeg\", \"png\", \"gif\"]\nconst ERROR_DISPLAY_TIME = 6000\nconst ACCEPTED_TYPES_LOCALE_STRING = ACCEPTED_PHOTOS_TYPES.join(\", \")\n\nexport type PhotoDropzonePropsType = {\n className?: string\n description: string\n deletePopoverContent: (onDelete: () => void, close: () => void) => ReactNode\n errorContent: (acceptedTypes: string, maxFileSize: number) => ReactNode\n onDropped: (file: File) => Promise<void> | void\n onPhotoDelete?: () => void\n initialImageUrl?: string\n}\n\nconst preventEventDefaults = (\n e: ReactDragEvent | ReactMouseEvent | ReactKeyboardEvent | ReactTouchEvent\n) => {\n e.preventDefault && e.preventDefault()\n e.stopPropagation && e.stopPropagation()\n}\n\nconst isEnterOrSpaceKey = (event: ReactKeyboardEvent) =>\n event.key === \"Enter\" || event.key === \" \"\n\nconst PhotoDropzone = ({\n className,\n description,\n deletePopoverContent,\n errorContent,\n onDropped,\n onPhotoDelete,\n initialImageUrl = \"\",\n}: PhotoDropzonePropsType) => {\n const fileInputRef = useRef<HTMLInputElement>(null)\n const deleteButtonRef = useRef<HTMLButtonElement>(null)\n const [isDragging, setIsDragging] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n const [isErrored, setIsErrored] = useState(false)\n const [imagePreviewUrl, setImagePreviewUrl] = useState(initialImageUrl)\n const [displayDeletion, setDisplayDeletion] = useState(false)\n const [showDeletePopover, setShowDeletePopover] = useState(false)\n\n const openDeletePopover = (\n event?: ReactMouseEvent | ReactKeyboardEvent | ReactTouchEvent\n ) => {\n event && preventEventDefaults(event)\n setShowDeletePopover(true)\n }\n const closeDeletePopover = (event?: ReactMouseEvent | ReactTouchEvent) => {\n event && preventEventDefaults(event)\n setShowDeletePopover(false)\n }\n\n const onDropzoneMouseEnter = (event?: ReactMouseEvent) => {\n event && preventEventDefaults(event)\n if (imagePreviewUrl) setDisplayDeletion(true)\n }\n\n const onDropzoneMouseLeave = (event?: ReactMouseEvent) => {\n event && preventEventDefaults(event)\n if (displayDeletion && !showDeletePopover) setDisplayDeletion(false)\n }\n\n const onDropzoneClick = (event?: ReactMouseEvent | ReactTouchEvent) => {\n event && preventEventDefaults(event)\n if (isLoading) return\n if (isErrored) setIsErrored(false)\n if (imagePreviewUrl) {\n if (showDeletePopover) closeDeletePopover()\n return setDisplayDeletion(!displayDeletion)\n }\n fileInputRef.current?.click()\n }\n\n const onDropzoneKey = (event: ReactKeyboardEvent) => {\n if (showDeletePopover) return\n if (isEnterOrSpaceKey(event)) {\n onDropzoneClick()\n }\n }\n\n const onDeleteKey = (event: ReactKeyboardEvent) => {\n if (isEnterOrSpaceKey(event)) {\n openDeletePopover(event)\n }\n }\n\n const onDelete = () => {\n if (fileInputRef.current) fileInputRef.current.value = \"\"\n closeDeletePopover()\n setImagePreviewUrl(\"\")\n onPhotoDelete && onPhotoDelete()\n }\n\n const onDragEnter = (event: ReactDragEvent) => {\n preventEventDefaults(event)\n if (isErrored) setIsErrored(false)\n !imagePreviewUrl && setIsDragging(true)\n }\n\n const onDragLeave = (event: ReactDragEvent) => {\n preventEventDefaults(event)\n setIsDragging(false)\n }\n\n const processFile = async (fileToProcess: File) => {\n setIsDragging(false)\n setIsErrored(false)\n setIsLoading(true)\n\n const isValidFile = await validateFile(\n fileToProcess,\n (fileToValidate, extension) => {\n const maxFileSize = ACCEPTED_MAX_SIZE_MB * 1000 * 1000\n const acceptedFileTypes = ACCEPTED_PHOTOS_TYPES\n\n if (fileToValidate.size > maxFileSize) {\n return false\n } else if (!extension || !acceptedFileTypes.includes(extension)) {\n return false\n } else {\n return true\n }\n }\n )\n\n if (isValidFile) {\n const imageSrc = URL.createObjectURL(fileToProcess)\n setImagePreviewUrl(imageSrc)\n await onDropped(fileToProcess)\n setIsLoading(false)\n } else {\n setIsLoading(false)\n setIsErrored(true)\n setTimeout(() => {\n setIsErrored(false)\n }, ERROR_DISPLAY_TIME)\n }\n }\n\n const onFileInputChanged = (event: ReactChangeEvent<HTMLInputElement>) => {\n if (event.target.files?.length) {\n processFile(event.target.files[0])\n }\n }\n\n const onDrop = (event: ReactDragEvent<HTMLDivElement>) => {\n preventEventDefaults(event)\n if (event.dataTransfer?.files?.length && !imagePreviewUrl) {\n processFile(event.dataTransfer.files[0])\n }\n }\n\n const onDeleteButtonClick = showDeletePopover\n ? closeDeletePopover\n : openDeletePopover\n\n return (\n <div\n tabIndex={0}\n className={cx(\"cobalt-photo-dropzone\", className, {\n \"cobalt-photo-dropzone--filled\": imagePreviewUrl,\n \"cobalt-photo-dropzone--dragging\": isDragging,\n \"cobalt-photo-dropzone--loading\": isLoading,\n \"cobalt-photo-dropzone--errored\": isErrored,\n })}\n onMouseEnter={onDropzoneMouseEnter}\n onMouseLeave={onDropzoneMouseLeave}\n onDragEnter={onDragEnter}\n onDragLeave={onDragLeave}\n // Not on click because we also use mouseEnter listener\n onMouseUp={onDropzoneClick}\n onTouchEnd={onDropzoneClick}\n onKeyUp={onDropzoneKey}\n onDrop={onDrop}\n // Need to reset those listeners to avoid default browser behaviour\n onDragStart={preventEventDefaults}\n onDragEnd={preventEventDefaults}\n onDragOver={preventEventDefaults}\n >\n {isErrored && (\n <div className=\"cobalt-photo-dropzone__description\">\n <ContextualWarningCircleFilledIcon color=\"red\" />\n {errorContent(ACCEPTED_TYPES_LOCALE_STRING, ACCEPTED_MAX_SIZE_MB)}\n </div>\n )}\n {isLoading && (\n <div className=\"cobalt-photo-dropzone__description\">\n <LoadingIcon />\n </div>\n )}\n {!isLoading &&\n !isErrored &&\n (imagePreviewUrl ? (\n <>\n <img\n className=\"cobalt-photo-dropzone__preview\"\n src={imagePreviewUrl}\n />\n <div>\n <button\n className={cx(\"cobalt-photo-dropzone__delete-button\", {\n \"cobalt-photo-dropzone__delete-button--triggered\":\n displayDeletion,\n })}\n ref={deleteButtonRef}\n // Must follow the click listeners on the dropzone,\n // in order to have the correct events bubbling\n onTouchEnd={onDeleteButtonClick}\n onMouseUp={onDeleteButtonClick}\n onKeyUp={onDeleteKey}\n >\n <BinIcon color=\"indigo\" />\n </button>\n <Popover\n targetRef={deleteButtonRef}\n isOpen={showDeletePopover}\n close={closeDeletePopover}\n placement=\"left-start\"\n distance={12}\n bodySpacing={false}\n arrow\n >\n {deletePopoverContent(onDelete, closeDeletePopover)}\n </Popover>\n </div>\n </>\n ) : (\n <div className=\"cobalt-photo-dropzone__description cobalt-photo-dropzone__description--strong\">\n <p>{description}</p>\n <PlusIcon />\n </div>\n ))}\n <input\n ref={fileInputRef}\n className=\"cobalt-photo-dropzone__hidden-input\"\n type=\"file\"\n onChange={onFileInputChanged}\n accept={ACCEPTED_PHOTOS_TYPES.map((ext) => `.${ext}`).join(\",\")}\n multiple={false}\n />\n </div>\n )\n}\n\nexport default PhotoDropzone\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAC/B,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAC3D,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAC/B,MAAM,4BAA4B,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAYrE,MAAM,oB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E,kBAAkB,EAC5B,MAAM,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,IAAI,GAAG,CAAA,CAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC/D,QAAQ,EAAE,KAAK,EACf,CAAA,CACE,EACP;AACH;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/PhotoDropzone/index.tsx"],"sourcesContent":["import React, {\n useState,\n DragEvent as ReactDragEvent,\n useRef,\n TouchEvent as ReactTouchEvent,\n ChangeEvent as ReactChangeEvent,\n MouseEvent as ReactMouseEvent,\n KeyboardEvent as ReactKeyboardEvent,\n ReactNode,\n} from \"react\"\nimport cx from \"classnames\"\nimport {\n PlusIcon,\n BinIcon,\n LoadingIcon,\n ContextualWarningCircleFilledIcon,\n} from \"../Icon\"\nimport { validateFile } from \"../utils/validateFile\"\nimport Popover from \"../Popover\"\n\nconst ACCEPTED_MAX_SIZE_MB = 10\nconst ACCEPTED_PHOTOS_TYPES = [\"jpg\", \"jpeg\", \"png\", \"gif\"]\nconst ERROR_DISPLAY_TIME = 6000\nconst ACCEPTED_TYPES_LOCALE_STRING = ACCEPTED_PHOTOS_TYPES.join(\", \")\n\nexport type PhotoDropzonePropsType = {\n className?: string\n description?: string\n deletePopoverContent: (onDelete: () => void, close: () => void) => ReactNode\n errorContent: (acceptedTypes: string, maxFileSize: number) => ReactNode\n onDropped: (file: File) => Promise<void> | void\n onPhotoDelete?: () => void\n initialImageUrl?: string\n}\n\nconst preventEventDefaults = (\n e: ReactDragEvent | ReactMouseEvent | ReactKeyboardEvent | ReactTouchEvent\n) => {\n e.preventDefault && e.preventDefault()\n e.stopPropagation && e.stopPropagation()\n}\n\nconst isEnterOrSpaceKey = (event: ReactKeyboardEvent) =>\n event.key === \"Enter\" || event.key === \" \"\n\nconst PhotoDropzone = ({\n className,\n description,\n deletePopoverContent,\n errorContent,\n onDropped,\n onPhotoDelete,\n initialImageUrl = \"\",\n}: PhotoDropzonePropsType) => {\n const fileInputRef = useRef<HTMLInputElement>(null)\n const deleteButtonRef = useRef<HTMLButtonElement>(null)\n const [isDragging, setIsDragging] = useState(false)\n const [isLoading, setIsLoading] = useState(false)\n const [isErrored, setIsErrored] = useState(false)\n const [imagePreviewUrl, setImagePreviewUrl] = useState(initialImageUrl)\n const [displayDeletion, setDisplayDeletion] = useState(false)\n const [showDeletePopover, setShowDeletePopover] = useState(false)\n\n const openDeletePopover = (\n event?: ReactMouseEvent | ReactKeyboardEvent | ReactTouchEvent\n ) => {\n event && preventEventDefaults(event)\n setShowDeletePopover(true)\n }\n const closeDeletePopover = (event?: ReactMouseEvent | ReactTouchEvent) => {\n event && preventEventDefaults(event)\n setShowDeletePopover(false)\n }\n\n const onDropzoneMouseEnter = (event?: ReactMouseEvent) => {\n event && preventEventDefaults(event)\n if (imagePreviewUrl) setDisplayDeletion(true)\n }\n\n const onDropzoneMouseLeave = (event?: ReactMouseEvent) => {\n event && preventEventDefaults(event)\n if (displayDeletion && !showDeletePopover) setDisplayDeletion(false)\n }\n\n const onDropzoneClick = (event?: ReactMouseEvent | ReactTouchEvent) => {\n event && preventEventDefaults(event)\n if (isLoading) return\n if (isErrored) setIsErrored(false)\n if (imagePreviewUrl) {\n if (showDeletePopover) closeDeletePopover()\n return setDisplayDeletion(!displayDeletion)\n }\n fileInputRef.current?.click()\n }\n\n const onDropzoneKey = (event: ReactKeyboardEvent) => {\n if (showDeletePopover) return\n if (isEnterOrSpaceKey(event)) {\n onDropzoneClick()\n }\n }\n\n const onDeleteKey = (event: ReactKeyboardEvent) => {\n if (isEnterOrSpaceKey(event)) {\n openDeletePopover(event)\n }\n }\n\n const onDelete = () => {\n if (fileInputRef.current) fileInputRef.current.value = \"\"\n closeDeletePopover()\n setImagePreviewUrl(\"\")\n onPhotoDelete && onPhotoDelete()\n }\n\n const onDragEnter = (event: ReactDragEvent) => {\n preventEventDefaults(event)\n if (isErrored) setIsErrored(false)\n !imagePreviewUrl && setIsDragging(true)\n }\n\n const onDragLeave = (event: ReactDragEvent) => {\n preventEventDefaults(event)\n setIsDragging(false)\n }\n\n const processFile = async (fileToProcess: File) => {\n setIsDragging(false)\n setIsErrored(false)\n setIsLoading(true)\n\n const isValidFile = await validateFile(\n fileToProcess,\n (fileToValidate, extension) => {\n const maxFileSize = ACCEPTED_MAX_SIZE_MB * 1000 * 1000\n const acceptedFileTypes = ACCEPTED_PHOTOS_TYPES\n\n if (fileToValidate.size > maxFileSize) {\n return false\n } else if (!extension || !acceptedFileTypes.includes(extension)) {\n return false\n } else {\n return true\n }\n }\n )\n\n if (isValidFile) {\n const imageSrc = URL.createObjectURL(fileToProcess)\n setImagePreviewUrl(imageSrc)\n await onDropped(fileToProcess)\n setIsLoading(false)\n } else {\n setIsLoading(false)\n setIsErrored(true)\n setTimeout(() => {\n setIsErrored(false)\n }, ERROR_DISPLAY_TIME)\n }\n }\n\n const onFileInputChanged = (event: ReactChangeEvent<HTMLInputElement>) => {\n if (event.target.files?.length) {\n processFile(event.target.files[0])\n }\n }\n\n const onDrop = (event: ReactDragEvent<HTMLDivElement>) => {\n preventEventDefaults(event)\n if (event.dataTransfer?.files?.length && !imagePreviewUrl) {\n processFile(event.dataTransfer.files[0])\n }\n }\n\n const onDeleteButtonClick = showDeletePopover\n ? closeDeletePopover\n : openDeletePopover\n\n return (\n <div\n tabIndex={0}\n className={cx(\"cobalt-photo-dropzone\", className, {\n \"cobalt-photo-dropzone--filled\": imagePreviewUrl,\n \"cobalt-photo-dropzone--dragging\": isDragging,\n \"cobalt-photo-dropzone--loading\": isLoading,\n \"cobalt-photo-dropzone--errored\": isErrored,\n })}\n onMouseEnter={onDropzoneMouseEnter}\n onMouseLeave={onDropzoneMouseLeave}\n onDragEnter={onDragEnter}\n onDragLeave={onDragLeave}\n // Not on click because we also use mouseEnter listener\n onMouseUp={onDropzoneClick}\n onTouchEnd={onDropzoneClick}\n onKeyUp={onDropzoneKey}\n onDrop={onDrop}\n // Need to reset those listeners to avoid default browser behaviour\n onDragStart={preventEventDefaults}\n onDragEnd={preventEventDefaults}\n onDragOver={preventEventDefaults}\n >\n {isErrored && (\n <div className=\"cobalt-photo-dropzone__description\">\n <ContextualWarningCircleFilledIcon color=\"red\" />\n {errorContent(ACCEPTED_TYPES_LOCALE_STRING, ACCEPTED_MAX_SIZE_MB)}\n </div>\n )}\n {isLoading && (\n <div className=\"cobalt-photo-dropzone__description\">\n <LoadingIcon />\n </div>\n )}\n {!isLoading &&\n !isErrored &&\n (imagePreviewUrl ? (\n <>\n <img\n className=\"cobalt-photo-dropzone__preview\"\n src={imagePreviewUrl}\n />\n <div>\n <button\n className={cx(\"cobalt-photo-dropzone__delete-button\", {\n \"cobalt-photo-dropzone__delete-button--triggered\":\n displayDeletion,\n })}\n ref={deleteButtonRef}\n // Must follow the click listeners on the dropzone,\n // in order to have the correct events bubbling\n onTouchEnd={onDeleteButtonClick}\n onMouseUp={onDeleteButtonClick}\n onKeyUp={onDeleteKey}\n >\n <BinIcon color=\"indigo\" />\n </button>\n <Popover\n targetRef={deleteButtonRef}\n isOpen={showDeletePopover}\n close={closeDeletePopover}\n placement=\"left-start\"\n distance={12}\n bodySpacing={false}\n arrow\n >\n {deletePopoverContent(onDelete, closeDeletePopover)}\n </Popover>\n </div>\n </>\n ) : (\n <div className=\"cobalt-photo-dropzone__description cobalt-photo-dropzone__description--strong\">\n {description && <div>{description}</div>}\n <PlusIcon />\n </div>\n ))}\n <input\n ref={fileInputRef}\n className=\"cobalt-photo-dropzone__hidden-input\"\n type=\"file\"\n onChange={onFileInputChanged}\n accept={ACCEPTED_PHOTOS_TYPES.map((ext) => `.${ext}`).join(\",\")}\n multiple={false}\n />\n </div>\n )\n}\n\nexport default PhotoDropzone\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAC/B,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAC3D,MAAM,kBAAk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aAAA,CAAA,OAAA,EAAA,EACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAC,qCAAqC,EAC/C,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,IAAI,GAAG,CAAA,CAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC/D,QAAQ,EAAE,KAAK,EACf,CAAA,CACE,EACP;AACH;;;;"}
package/index.js CHANGED
@@ -10,7 +10,6 @@ export { Callout } from './components/Callout/index.js';
10
10
  export { default as Cell, Cells } from './components/Cell/index.js';
11
11
  export { EmptyState } from './components/EmptyState/index.js';
12
12
  export { Flag } from './components/Flag/index.js';
13
- export { Flash } from './components/Flash/index.js';
14
13
  export { default as Helper } from './components/Helper/index.js';
15
14
  export { CalendarRangePicker } from './components/Calendar/CalendarRangePicker/CalendarRangePicker.js';
16
15
  export { CalendarDayPicker } from './components/Calendar/CalendarDayPicker/CalendarDayPicker.js';
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drivy/cobalt",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "Opinionated design system for Drivy's projects.",
5
5
  "main": "src/index.js",
6
6
  "types": "types/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "date-fns": "2.30.0",
29
29
  "lodash.throttle": "4.1.1",
30
30
  "media-typer": "1.1.0",
31
- "nanoid": "5.1.4",
31
+ "nanoid": "5.1.5",
32
32
  "postcss": "8.5.3",
33
33
  "tailwindcss": "3.4.17",
34
34
  "tippy.js": "6.3.7"
@@ -59,17 +59,17 @@
59
59
  "@types/jest": "29.5.14",
60
60
  "@types/lodash.throttle": "4.1.9",
61
61
  "@types/media-typer": "1.1.3",
62
- "@types/node": "22.13.10",
62
+ "@types/node": "22.13.17",
63
63
  "@types/react": "18.3.18",
64
64
  "@types/react-dom": "18.3.5",
65
65
  "autoprefixer": "10.4.21",
66
66
  "core-js": "3.41.0",
67
67
  "css-loader": "7.1.2",
68
68
  "eslint": "8.57.1",
69
- "eslint-plugin-storybook": "^0.11.6",
69
+ "eslint-plugin-storybook": "^0.12.0",
70
70
  "file-loader": "6.2.0",
71
71
  "fs-extra": "11.3.0",
72
- "html-entities": "2.5.2",
72
+ "html-entities": "2.6.0",
73
73
  "jest": "29.7.0",
74
74
  "jest-environment-jsdom": "29.7.0",
75
75
  "nested-object-access": "^0.2.5",
@@ -82,14 +82,14 @@
82
82
  "react-dom": "18.3.1",
83
83
  "react-syntax-highlighter": "15.6.1",
84
84
  "react-test-renderer": "18.3.1",
85
- "react-textarea-autosize": "8.5.8",
85
+ "react-textarea-autosize": "8.5.9",
86
86
  "regenerator-runtime": "0.14.1",
87
87
  "remark-gfm": "^3.0.1",
88
88
  "rollup": "2.79.2",
89
89
  "rollup-plugin-copy": "3.5.0",
90
90
  "rollup-plugin-svgo": "2.0.0",
91
91
  "rollup-plugin-typescript2": "0.36.0",
92
- "sass": "1.86.0",
92
+ "sass": "1.86.1",
93
93
  "sass-loader": "13.3.3",
94
94
  "sharp": "0.33.5",
95
95
  "sharp-cli": "5.1.0",
@@ -98,7 +98,7 @@
98
98
  "stylelint": "15.11.0",
99
99
  "svg2vectordrawable": "2.9.1",
100
100
  "svgo": "3.3.2",
101
- "ts-jest": "29.2.6",
101
+ "ts-jest": "29.3.1",
102
102
  "tsx": "4.19.3",
103
103
  "typescript": "5.4.5"
104
104
  },
@@ -2,12 +2,12 @@ const xs = "480px";
2
2
  const sm = "768px";
3
3
  const md = "992px";
4
4
  const lg = "1200px";
5
- var require$$0 = {
5
+ var require$$1 = {
6
6
  xs: xs,
7
7
  sm: sm,
8
8
  md: md,
9
9
  lg: lg
10
10
  };
11
11
 
12
- export { require$$0 as default, lg, md, sm, xs };
12
+ export { require$$1 as default, lg, md, sm, xs };
13
13
  //# sourceMappingURL=breakpoints.js.map
@@ -33,7 +33,7 @@ const deprecatedSeasonLow = "#BDFFAC";
33
33
  const deprecatedSeasonMedium = "#94EA84";
34
34
  const deprecatedSeasonHigh = "#73C865";
35
35
  const deprecatedSeasonVeryHigh = "#54A949";
36
- var require$$1 = {
36
+ var require$$2 = {
37
37
  white: white,
38
38
  grey: grey,
39
39
  indigo: indigo,
@@ -53,5 +53,5 @@ var require$$1 = {
53
53
  deprecatedSeasonVeryHigh: deprecatedSeasonVeryHigh
54
54
  };
55
55
 
56
- export { amber, blue, coral, require$$1 as default, deprecatedBlueGhost, deprecatedDriver, deprecatedSeasonHigh, deprecatedSeasonLow, deprecatedSeasonMedium, deprecatedSeasonVeryHigh, graphite, green, grey, indigo, purple, red, turquoise, white };
56
+ export { amber, blue, coral, require$$2 as default, deprecatedBlueGhost, deprecatedDriver, deprecatedSeasonHigh, deprecatedSeasonLow, deprecatedSeasonMedium, deprecatedSeasonVeryHigh, graphite, green, grey, indigo, purple, red, turquoise, white };
57
57
  //# sourceMappingURL=colors.js.map
@@ -7,7 +7,7 @@ const header = 30;
7
7
  const sidepanel = 80;
8
8
  const modal = 90;
9
9
  const alert = 100;
10
- var require$$2 = {
10
+ var require$$3 = {
11
11
  below: below,
12
12
  base: base,
13
13
  above: above,
@@ -32,5 +32,5 @@ var require$$2 = {
32
32
  "autocomplete-popover": 2147483647
33
33
  };
34
34
 
35
- export { above, alert, base, below, require$$2 as default, dropdown, header, modal, nav, sidepanel };
35
+ export { above, alert, base, below, require$$3 as default, dropdown, header, modal, nav, sidepanel };
36
36
  //# sourceMappingURL=zIndexes.js.map
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  &accordion__header {
13
- @apply c-text-title-xs c-p-sm c-bg-secondary c-cursor-pointer c-gap-sm;
13
+ @apply c-text-title-xs c-p-sm c-bg-secondary c-cursor-pointer c-state-interactive c-transition-interactive c-gap-sm;
14
14
 
15
15
  width: 100%;
16
16
  display: flex;
@@ -1,19 +1,11 @@
1
1
  .cob-Button__default {
2
- @include semantic-color(
3
- buttonBackground,
4
- secondaryInteractive,
5
- background-color
6
- );
7
- @include semantic-color(stroke, baseInteractive, border-color);
8
- @include semantic-color(buttonLabel, secondaryInteractive, color);
2
+ @include semantic-color(buttonBackground, secondary, background-color);
3
+ @include semantic-color(stroke, strong, border-color);
4
+ @include semantic-color(buttonLabel, secondary, color);
9
5
 
10
6
  &--primary {
11
- @include semantic-color(
12
- buttonBackground,
13
- primaryInteractive,
14
- background-color
15
- );
16
- @include semantic-color(buttonLabel, primaryInteractive, color);
7
+ @include semantic-color(buttonBackground, primary, background-color);
8
+ @include semantic-color(buttonLabel, primary, color);
17
9
 
18
10
  border-color: transparent;
19
11
 
@@ -24,12 +16,8 @@
24
16
  }
25
17
 
26
18
  &.cob-Button__default--destructive {
27
- @include semantic-color(
28
- buttonBackground,
29
- destructiveInteractive,
30
- background-color
31
- );
32
- @include semantic-color(buttonLabel, destructiveInteractive, color);
19
+ @include semantic-color(buttonBackground, destructive, background-color);
20
+ @include semantic-color(buttonLabel, destructive, color);
33
21
 
34
22
  border-color: transparent;
35
23
  }
@@ -1,10 +1,6 @@
1
1
  .cob-Button__ghost {
2
- @include semantic-color(buttonLabel, tertiaryInteractive, color);
3
- @include semantic-color(
4
- buttonBackground,
5
- tertiaryInteractive,
6
- background-color
7
- );
2
+ @include semantic-color(buttonLabel, tertiary, color);
3
+ @include semantic-color(buttonBackground, tertiary, background-color);
8
4
  border-color: transparent;
9
5
 
10
6
  box-shadow: none;
@@ -32,11 +28,7 @@
32
28
  &[disabled],
33
29
  &[data-disabled]:not([data-disabled="false"]),
34
30
  &.cob-Button--disabled {
35
- @include semantic-color(
36
- buttonBackground,
37
- tertiaryInteractive,
38
- background-color
39
- );
31
+ @include semantic-color(buttonBackground, tertiary, background-color);
40
32
  border-color: transparent;
41
33
 
42
34
  &:hover,
@@ -24,6 +24,7 @@
24
24
  }
25
25
 
26
26
  .cob-Button {
27
+ @apply c-state-interactive c-transition;
27
28
  @include cob-button-sizing(
28
29
  $height: 40px,
29
30
  $line-height: 20px,
@@ -49,10 +50,6 @@
49
50
 
50
51
  cursor: pointer;
51
52
  user-select: none;
52
- transition-property: background-color, border, box-shadow, color, transform,
53
- fill;
54
- transition-duration: 0.15s;
55
- transition-timing-function: ease-out;
56
53
  appearance: none;
57
54
 
58
55
  &:hover {
@@ -97,6 +94,7 @@
97
94
  &[disabled],
98
95
  &[data-disabled]:not([data-disabled="false"]),
99
96
  &.cob-Button--disabled {
97
+ @apply c-state-none;
100
98
  @include semantic-color(buttonBackground, disabled, background-color);
101
99
  @include semantic-color(buttonLabel, disabled, color);
102
100
  @include semantic-color(stroke, subdued, border-color);
@@ -233,7 +233,7 @@
233
233
 
234
234
  &--endDay.cobalt-CalendarRangePicker__day--active.cobalt-CalendarRangePicker__day--invalid {
235
235
  &:after {
236
- @apply c-border-error;
236
+ @apply c-border c-border-error;
237
237
  border-width: 2px;
238
238
  }
239
239
  }
@@ -241,7 +241,7 @@
241
241
  //Start day = end day
242
242
  &--startDay.cobalt-CalendarRangePicker__day--endDay {
243
243
  &:before {
244
- @apply c-border-onAccent;
244
+ @apply c-border c-border-onAccent;
245
245
 
246
246
  position: absolute;
247
247
 
@@ -305,7 +305,7 @@
305
305
  }
306
306
 
307
307
  .tippy-box[data-theme~="range-picker"] {
308
- @apply c-border-base;
308
+ @apply c-border c-border-base;
309
309
  }
310
310
 
311
311
  .tippy-box[data-theme~="range-picker"] .tippy-arrow:after {
@@ -55,7 +55,7 @@
55
55
  cursor: pointer;
56
56
 
57
57
  .cobalt-Icon {
58
- transition: fill 0.2s;
58
+ @apply c-state-interactive c-transition-interactive;
59
59
  }
60
60
  }
61
61
  }
@@ -5,7 +5,7 @@ $chip-large-height: 50px;
5
5
 
6
6
  .cobalt- {
7
7
  &Chip {
8
- @apply c-border c-border-base c-bg-secondary;
8
+ @apply c-border c-border-base c-bg-secondary c-transition-colors;
9
9
 
10
10
  position: relative;
11
11
 
@@ -21,9 +21,8 @@ $chip-large-height: 50px;
21
21
  }
22
22
 
23
23
  &Chip--interactive {
24
- @apply c-border-baseInteractive;
25
-
26
24
  &:not([disabled]) {
25
+ @apply c-state-interactive;
27
26
  cursor: pointer;
28
27
  }
29
28
  }
@@ -108,7 +108,7 @@
108
108
  }
109
109
 
110
110
  .cobalt-TextField__Input[type][data-state="open"] {
111
- @apply c-border-accent c-border-2;
111
+ @apply c-border-accent;
112
112
  }
113
113
 
114
114
  .cobalt-TextField__Icon {
@@ -3,7 +3,6 @@
3
3
  .cobalt-CheckablePillField {
4
4
  $self: &;
5
5
  $height: 40px;
6
- $animation-duration: 100ms;
7
6
  $toggle-switch-focus-offset: math.div($height, 10);
8
7
 
9
8
  position: relative;
@@ -28,7 +27,7 @@
28
27
  }
29
28
 
30
29
  &__Label {
31
- @apply c-border-base c-border-2 c-text-base c-bg-secondary c-py-none c-px-md;
30
+ @apply c-border-base c-border-2 c-text-base c-bg-secondary c-py-none c-px-md c-state-interactive c-transition;
32
31
  position: relative;
33
32
 
34
33
  display: flex;
@@ -41,10 +40,7 @@
41
40
 
42
41
  border-radius: math.div($height, 2);
43
42
 
44
- transition: $animation-duration;
45
-
46
43
  &:hover {
47
- @apply c-border-accent;
48
44
  box-shadow: 0 4px 4px 0 rgba(#000, 0.16);
49
45
 
50
46
  transform: translateY(-1px);
@@ -71,7 +67,7 @@
71
67
  }
72
68
 
73
69
  &__Input:disabled + #{ $self }__Label {
74
- @apply c-border-base c-border-2 c-bg-disabled;
70
+ @apply c-border-base c-border-2 c-bg-disabled c-state-none;
75
71
 
76
72
  cursor: default;
77
73
  box-shadow: none;
@@ -87,9 +83,7 @@
87
83
  &--with-icon {
88
84
  .cobalt-Icon {
89
85
  @include semantic-color(icon, base, fill);
90
- @apply c-mr-xs;
91
-
92
- transition: fill $animation-duration ease-in-out;
86
+ @apply c-mr-xs c-transition-colors;
93
87
  }
94
88
 
95
89
  #{ $self }__Input:checked + #{ $self }__Label .cobalt-Icon {
@@ -21,15 +21,17 @@
21
21
  opacity: 0;
22
22
 
23
23
  & + #{ $self }__Checkmark {
24
- @apply c-border-accent c-border-2 c-mr-xs;
24
+ @apply c-border-accent c-border-2 c-mr-xs c-transition-colors;
25
25
  display: inline-block;
26
26
 
27
27
  flex: 0 0 auto;
28
28
 
29
29
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
30
30
  cursor: pointer;
31
+ }
31
32
 
32
- transition: border-color 150ms ease-in-out;
33
+ &:not([disabled]) + #{ $self }__Checkmark {
34
+ @apply c-state-interactive;
33
35
  }
34
36
 
35
37
  &[disabled] ~ .cobalt-CheckmarkField__Label {
@@ -53,7 +55,7 @@
53
55
  }
54
56
 
55
57
  & + #{ $self }__Checkmark::after {
56
- @apply c-border-accent c-bg-accentAlt c-rounded-full;
58
+ @apply c-border c-border-accent c-bg-accentAlt c-rounded-full;
57
59
 
58
60
  // Exception for radio inputs
59
61
  border-width: 5px;
@@ -75,13 +77,13 @@
75
77
  }
76
78
 
77
79
  &[disabled] + #{ $self }__Checkmark {
78
- @apply c-border-subdued;
80
+ @apply c-border c-border-subdued;
79
81
 
80
82
  box-shadow: none;
81
83
  }
82
84
 
83
85
  &[disabled]:checked ~ #{ $self }__Checkmark::after {
84
- @apply c-border-subdued c-bg-disabled;
86
+ @apply c-border c-border-subdued c-bg-disabled;
85
87
  }
86
88
  }
87
89
 
@@ -127,7 +129,7 @@
127
129
  }
128
130
 
129
131
  &[disabled] + #{ $self }__Checkmark {
130
- @apply c-border-subdued;
132
+ @apply c-border c-border-subdued;
131
133
 
132
134
  box-shadow: none;
133
135
  }
@@ -151,15 +153,15 @@
151
153
 
152
154
  &--error {
153
155
  #{ $self }__Input + #{ $self }__Checkmark {
154
- @apply c-border-error;
156
+ @apply c-border-2 c-border-error;
155
157
  }
156
158
 
157
159
  #{ $self }__Input[type="radio"]:checked + #{ $self }__Checkmark::after {
158
- @apply c-border-error c-bg-errorInteractive;
160
+ @apply c-border c-border-error c-bg-error;
159
161
  }
160
162
 
161
163
  #{ $self }__Input[type="checkbox"]:checked + #{ $self }__Checkmark {
162
- @apply c-bg-errorInteractive;
164
+ @apply c-bg-error;
163
165
  }
164
166
  }
165
167
  }
@@ -9,7 +9,7 @@
9
9
  --visual-radio-size: 18px;
10
10
 
11
11
  .cobalt-radio-with-details__inner {
12
- @apply c-border-baseInteractive c-text-base c-bg-secondary;
12
+ @apply c-border c-border-base c-rounded-lg c-text-base c-bg-secondary c-state-interactive c-transition-colors;
13
13
  height: 100%;
14
14
  display: flex;
15
15
  flex-direction: row;
@@ -18,9 +18,6 @@
18
18
  padding: spacing(sm);
19
19
 
20
20
  cursor: pointer;
21
- @apply c-rounded-lg;
22
-
23
- transition: all 120ms ease-in-out;
24
21
 
25
22
  gap: spacing(xs);
26
23
  }
@@ -43,8 +40,6 @@
43
40
  font-size: 14px;
44
41
  font-weight: 600;
45
42
  line-height: 20px;
46
-
47
- transition: color 150ms ease-in-out;
48
43
  }
49
44
 
50
45
  .cobalt-radio-with-details__description {
@@ -52,8 +47,6 @@
52
47
  font-family: font-family(base);
53
48
  font-size: 14px;
54
49
  line-height: 20px;
55
-
56
- transition: color 150ms ease-in-out;
57
50
  }
58
51
 
59
52
  .cobalt-radio-with-details__input {
@@ -79,8 +72,6 @@
79
72
 
80
73
  @apply c-rounded-full;
81
74
  cursor: pointer;
82
-
83
- transition: border-color 150ms ease-in-out;
84
75
  }
85
76
 
86
77
  &:focus-visible + #{ $self }__inner {
@@ -91,17 +82,13 @@
91
82
  }
92
83
 
93
84
  &:checked + #{ $self }__inner {
94
- @apply c-border-accent c-text-accentAlt c-bg-accentAlt;
85
+ @apply c-border c-border-accent c-text-accentAlt c-bg-accentAlt c-state-interactive c-transition-interactive;
95
86
  }
96
87
 
97
88
  &:checked + #{ $self }__inner .cobalt-Icon {
98
89
  @include fill-color(accent);
99
90
  }
100
91
 
101
- &:checked + #{ $self }__inner .cobalt-contained-icon {
102
- @apply c-bg-accentAlt;
103
- }
104
-
105
92
  &:checked + #{ $self }__inner #{ $self }__visual-input {
106
93
  @include semantic-color(icon, accentAlt, border-color);
107
94
  }
@@ -112,7 +99,7 @@
112
99
  }
113
100
 
114
101
  & + #{ $self }__inner #{ $self }__visual-input::after {
115
- @apply c-border-accent c-bg-accentAlt;
102
+ @apply c-border c-border-accent c-bg-accentAlt;
116
103
  left: 2px;
117
104
  top: 2px;
118
105
 
@@ -137,6 +124,7 @@
137
124
  }
138
125
 
139
126
  &[disabled] + #{ $self }__inner {
127
+ @apply c-state-none;
140
128
  opacity: 0.7;
141
129
  cursor: not-allowed;
142
130
  }
@@ -11,17 +11,16 @@
11
11
  &__Input {
12
12
  @include form-input-base($self);
13
13
 
14
- @apply c-pr-lg;
14
+ @apply c-pr-lg c-cursor-pointer;
15
15
 
16
16
  line-height: 20px;
17
17
 
18
+ background-color: theme("semanticStateColor.interactive.DEFAULT");
18
19
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%2000000'><polygon points='0,0 100,0 50,50'/></svg>");
19
20
  background-size: 10px;
20
21
  background-position: calc(100% - 12px) 19px;
21
22
  background-repeat: no-repeat;
22
23
 
23
- -moz-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
24
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
25
24
  appearance: none;
26
25
 
27
26
  // select placeholder
@@ -30,8 +29,21 @@
30
29
  opacity: 0.7;
31
30
  }
32
31
 
33
- &[disabled] {
32
+ &:hover,
33
+ &:focus {
34
+ background-color: theme("semanticStateColor.interactive.hover");
35
+ }
36
+
37
+ &:active {
38
+ background-color: theme("semanticStateColor.interactive.press");
39
+ }
40
+
41
+ &[disabled],
42
+ &[disabled]:hover,
43
+ &[disabled]:focus,
44
+ &[disabled]:active {
34
45
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='rgba(0,0,0,0.2)'><polygon points='0,0 100,0 50,50'/></svg>");
46
+ background-color: theme("semanticStateColor.interactive.DEFAULT");
35
47
  }
36
48
  }
37
49
  }