@lax-wp/design-system 0.13.33-beta.1 → 0.13.33-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/forms/toggle/Toggle.cjs.js +1 -1
- package/dist/components/forms/toggle/Toggle.cjs.js.map +1 -1
- package/dist/components/forms/toggle/Toggle.es.js +1 -1
- package/dist/components/forms/toggle/Toggle.es.js.map +1 -1
- package/dist/components/tooltip/Tooltip.cjs.js +1 -1
- package/dist/components/tooltip/Tooltip.cjs.js.map +1 -1
- package/dist/components/tooltip/Tooltip.es.js +19 -19
- package/dist/components/tooltip/Tooltip.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../../_virtual/index.cjs.js"),O=require("react"),T=require("framer-motion"),oe=require("antd"),ce=require("react-i18next"),f=require("../../data-display/typography/Typography.cjs.js"),b=require("../../../constants/toggle.cjs.js"),R=require("@mui/icons-material"),de=require("../../icons/AIExtractedIndicator.cjs.js"),ue=require("../../icons/AIStarIcon.cjs.js"),me=require("../../data-display/label/Label.cjs.js"),S=require("../../tooltip/Tooltip.cjs.js"),fe=require("../../icons/HelpIcon.cjs.js"),pe=require("../shared/InputLabel.cjs.js"),o=require("../../../utils/confidenceScoreUtils.cjs.js"),xe=(t,r,s,p="medium")=>{const i={small:"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5",medium:"w-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../../_virtual/index.cjs.js"),O=require("react"),T=require("framer-motion"),oe=require("antd"),ce=require("react-i18next"),f=require("../../data-display/typography/Typography.cjs.js"),b=require("../../../constants/toggle.cjs.js"),R=require("@mui/icons-material"),de=require("../../icons/AIExtractedIndicator.cjs.js"),ue=require("../../icons/AIStarIcon.cjs.js"),me=require("../../data-display/label/Label.cjs.js"),S=require("../../tooltip/Tooltip.cjs.js"),fe=require("../../icons/HelpIcon.cjs.js"),pe=require("../shared/InputLabel.cjs.js"),o=require("../../../utils/confidenceScoreUtils.cjs.js"),xe=(t,r,s,p="medium")=>{const i={small:"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5",medium:"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5",large:"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5"},x={small:"peer-checked:after:translate-x-3",medium:"peer-checked:after:translate-x-full",large:"peer-checked:after:translate-x-5"};return a("p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]",i[p],x[p],{"peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500":t,"after:bg-white dark:after:bg-black-500":!t,"text-white dark:text-black-900":r,"cursor-not-allowed opacity-70":s})},ge=({size:t=18,fill:r="#016DCF"})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",fill:r})}),he=({size:t=18,fill:r="#101828"})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z",fill:r})}),M=O.forwardRef(({isGTN:t=!1,isChecked:r,id:s,onChange:p,label:i,required:x,isRequiredConditional:P=!1,hideStatus:G=!1,labelDirection:v=b.TOGGLE_LABEL_DIRECTION.TOP,statusText:y,withIcon:E=!1,tags:z,isAiExtracted:H=!1,confidenceScore:j,confidenceType:c="high",confidenceTooltip:k,sourceMeta:$=[],onConfidenceScoreClick:V,tooltip:C="",className:W="",disabled:Y,isDisabled:U=!1,icon:g,stopClickPropagation:J=!0,gtnName:K,variant:be="primary",labelClassName:w,isLiveField:Q=!1,message:d,messageType:u="default",wrapperClassName:X,helpText:m,labelExtra:Z,size:l="medium",renderGTNAddButton:q,onAddGTNToDocument:_,inputEmphasis:N="default"},ee)=>{const{t:re}=ce.useTranslation(),ae=N==="modified",te=N==="deleted",le=N==="success",I=Y??U,h=!!I,F=typeof I=="string"?I:void 0,se=v===b.TOGGLE_LABEL_DIRECTION.TOP,ie=v===b.TOGGLE_LABEL_DIRECTION.LEFT,A=v===b.TOGGLE_LABEL_DIRECTION.RIGHT,[L,B]=O.useState(!1),D=()=>{_&&_({key:K,value:r?"Yes":"No"})},ne=()=>u==="error"?"text-red-500 dark:text-red-400":u==="success"?"text-green-500 dark:text-green-400":u==="info"?"text-primary-500 dark:text-primary-400":"text-neutral-500 dark:text-neutral-400";return e.jsxs("div",{className:a("flex gap-0.5",L&&t?"border rounded-lg border-primary-100 bg-primary-50 p-1":"",X),onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),onClick:n=>{J&&n.stopPropagation()},children:[t&&!L?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5"}):null,e.jsxs("div",{className:a("w-full flex flex-col",ae&&"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5",te&&"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5",le&&"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5"),children:[se&&i&&e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("h1",{className:a("mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap",w),children:[e.jsx(pe.InputLabel,{label:i||"",required:x||!1,isRequiredConditional:P||!1}),Q&&e.jsx(R.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),H&&!o.shouldShowConfidenceScore(j)&&e.jsx(de.AIExtractedIndicator,{}),e.jsx(me.Label,{labels:z||[]}),C&&e.jsx(S,{placement:"top",title:C,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(fe.HelpIcon,{})})}),Z]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[o.shouldShowConfidenceScore(j)&&c?e.jsx(S,{placement:"top-end",title:k??"",hideTooltip:k==null,className:"cursor-pointer",children:e.jsxs("div",{className:a("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",o.getConfidenceScoreBadgeClass(c)),onClick:()=>V?.($),children:[e.jsx(ue.AIStarIcon,{size:12,fill:o.getConfidenceScoreBadgeColor(c),fillSecondary:o.getConfidenceScoreBadgeFill(c)}),e.jsxs("span",{className:a("text-xs font-medium leading-4",o.getConfidenceScoreBadgeTextColor(c)),children:[j,"%"]})]})}):null,t&&L?q?q(D):e.jsx("button",{id:"btn-toggle-add-to-document",className:"cursor-pointer",onClick:D,type:"button",children:e.jsx(oe.Tooltip,{placement:"top",title:re("Add to document"),children:e.jsx(R.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]}),m&&e.jsx(f.Typography,{className:"mb-2 text-neutral-600 dark:text-neutral-400",appearance:"custom",size:"extra-small",variant:"regular",children:m}),e.jsxs("div",{className:"flex",children:[ie&&e.jsx(f.Typography,{size:"small",variant:"medium",className:a("mr-2 text-neutral-700 dark:text-black-200",w),appearance:"custom",children:i}),e.jsxs("label",{className:a("relative inline-flex items-center",A||y?"":"w-min",h?"cursor-not-allowed opacity-50":"cursor-pointer"),onClick:n=>n.stopPropagation(),children:[e.jsx("input",{ref:ee,type:"checkbox",id:s,onChange:n=>!h&&p(n.target.checked),value:"",disabled:h,checked:r,className:a("sr-only peer w-full",W),"aria-required":x,"aria-invalid":d&&u==="error"?"true":"false","aria-describedby":d||m?`${s}-description`:void 0}),e.jsx("div",{className:xe(r,E,h,l),children:E?e.jsx("div",{className:"flex items-center justify-center h-full w-full",children:e.jsx("div",{className:a("z-10 transition-all transform",l==="small"&&(r?"translate-x-2":"-translate-x-1.5"),l==="medium"&&(r?"translate-x-2":"-translate-x-2"),l==="large"&&(r?"translate-x-2.5":"-translate-x-2.5")),children:r?g?.checkedIcon?g.checkedIcon:e.jsx(ge,{size:18,fill:"#016DCF"}):g?.uncheckedIcon?g.uncheckedIcon:e.jsx(he,{size:18,fill:"#101828"})})}):null}),F&&e.jsx(S,{placement:"top",title:F,className:"-ml-2",children:e.jsx("span",{className:a("absolute inset-y-0 left-0",l==="small"&&"w-7",l==="medium"&&"w-9",l==="large"&&"w-11")})}),A&&e.jsx(f.Typography,{size:"small",variant:"medium",className:a("ml-2 text-neutral-700 dark:text-black-300",w),appearance:"custom",children:i}),G?null:e.jsx(f.Typography,{size:"small",variant:"medium",className:"ml-2 text-neutral-900 dark:text-black-100",appearance:"custom",children:y||(r?"Yes":"No")})]})]}),e.jsx(T.AnimatePresence,{children:d&&e.jsx(T.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},id:`${s}-description`,role:u==="error"?"alert":void 0,children:e.jsx(f.Typography,{className:a("mt-1",ne()),appearance:"custom",size:"extra-small",variant:"medium",children:d})})}),m&&!d&&e.jsx("div",{id:`${s}-description`,className:"sr-only",children:m})]})]})});M.displayName="Toggle";exports.Toggle=M;
|
|
2
2
|
//# sourceMappingURL=Toggle.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.cjs.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-9 h-5 after:h-4 after:w-4 after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement='top-end'\n title={confidenceTooltip ?? ''}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className='cursor-pointer'\n >\n <div\n className={cn(\n 'inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5',\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn('text-xs font-medium leading-4', getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div\n className={cn(\n \"z-10 transition-all transform\",\n size === \"small\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-1.5\"),\n size === \"medium\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-2\"),\n size === \"large\" &&\n (isChecked\n ? \"translate-x-2.5\"\n : \"-translate-x-2.5\")\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":"stBA+IMA,GAAsB,CAC1BC,EACAC,EACAC,EACAC,EAAqC,WAC1B,CACX,MAAMC,EAAc,CAClB,MAAO,2DACP,OAAQ,2DACR,MAAO,2DAAA,EAGHC,EAAmB,CACvB,MAAO,mCACP,OAAQ,sCACR,MAAO,kCAAA,EAGT,OAAOC,EACL,ggBACAF,EAAYD,CAAI,EAChBE,EAAiBF,CAAI,EACrB,CACE,4IACEH,EACF,yCAA0C,CAACA,EAC3C,iCAAkCC,EAClC,gCAAiCC,CAAA,CACnC,CAEJ,EAKMK,GAAY,CAAC,CAAE,KAAAJ,EAAO,GAAI,KAAAK,EAAO,SAAA,IACrCC,EAAAA,IAAC,MAAA,CAAI,MAAON,EAAM,OAAQA,EAAM,QAAQ,YAAY,KAAK,OACvD,SAAAM,EAAAA,IAAC,OAAA,C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UAAY,MACrBA,IAAS,SAAW,MAAA,EACnB,CAAA,CACL,EAGDuD,GACCjD,EAAAA,IAACuE,EAAAA,WAAA,CACC,KAAK,QACL,QAAQ,SACR,UAAW1E,EAAG,4CAA6C+B,CAAc,EACzE,WAAW,SAEV,SAAArB,CAAA,CAAA,EAIJG,EAAa,KACZV,EAAAA,IAACuE,EAAAA,WAAA,CACC,KAAK,QACL,QAAQ,SACR,UAAU,4CACV,WAAW,SAEV,SAAA1D,IAA0BtB,EAAY,MAAQ,KAAA,CAAA,CACjD,CAAA,CAAA,CAEJ,EACF,EAGAS,EAAAA,IAACwE,EAAAA,iBACE,SAAA1C,GACC9B,EAAAA,IAACyE,EAAAA,OAAO,IAAP,CACC,QAAS,CAAE,QAAS,EAAG,EAAG,GAAA,EAC1B,QAAS,CAAE,QAAS,EAAG,EAAG,CAAA,EAC1B,KAAM,CAAE,QAAS,EAAG,EAAG,GAAA,EACvB,WAAY,CAAE,SAAU,EAAA,EACxB,GAAI,GAAGpE,CAAE,eACT,KAAM0B,IAAgB,QAAU,QAAU,OAE1C,SAAA/B,EAAAA,IAACuE,EAAAA,WAAA,CACC,UAAW1E,EAAG,OAAQyD,IAA2B,EACjD,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAxB,CAAA,CAAA,CACH,CAAA,EAGN,EAGCG,GAAY,CAACH,GACZ9B,EAAAA,IAAC,MAAA,CAAI,GAAI,GAAGK,CAAE,eAAgB,UAAU,UACrC,SAAA4B,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,CAGN,CACF,EAEA/B,EAAO,YAAc"}
|
|
1
|
+
{"version":3,"file":"Toggle.cjs.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement='top-end'\n title={confidenceTooltip ?? ''}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className='cursor-pointer'\n >\n <div\n className={cn(\n 'inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5',\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn('text-xs font-medium leading-4', getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div\n className={cn(\n \"z-10 transition-all transform\",\n size === \"small\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-1.5\"),\n size === \"medium\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-2\"),\n size === \"large\" &&\n (isChecked\n ? \"translate-x-2.5\"\n : \"-translate-x-2.5\")\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":"stBA+IMA,GAAsB,CAC1BC,EACAC,EACAC,EACAC,EAAqC,WAC1B,CACX,MAAMC,EAAc,CAClB,MAAO,2DACP,OAAQ,uFACR,MAAO,2DAAA,EAGHC,EAAmB,CACvB,MAAO,mCACP,OAAQ,sCACR,MAAO,kCAAA,EAGT,OAAOC,EACL,ggBACAF,EAAYD,CAAI,EAChBE,EAAiBF,CAAI,EACrB,CACE,4IACEH,EACF,yCAA0C,CAACA,EAC3C,iCAAkCC,EAClC,gCAAiCC,CAAA,CACnC,CAEJ,EAKMK,GAAY,CAAC,CAAE,KAAAJ,EAAO,GAAI,KAAAK,EAAO,SAAA,IACrCC,EAAAA,IAAC,MAAA,CAAI,MAAON,EAAM,OAAQA,EAAM,QAAQ,YAAY,KAAK,OACvD,SAAAM,EAAAA,IAAC,OAAA,CACC,EAAE,4DACF,KAAAD,CAAA,CACF,EACF,EAMIE,GAAY,CAAC,CAAE,KAAAP,EAAO,GAAI,KAAAK,EAAO,SAAA,IACrCC,EAAAA,IAAC,MAAA,CAAI,MAAON,EAAM,OAAQA,EAAM,QAAQ,YAAY,KAAK,OACvD,SAAAM,EAAAA,IAAC,OAAA,CACC,EAAE,gHACF,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WAAA,CACC,KAAK,QACL,QAAQ,SACR,UAAU,4CACV,WAAW,SAEV,SAAA1D,IAA0BtB,EAAY,MAAQ,KAAA,CAAA,CACjD,CAAA,CAAA,CAEJ,EACF,EAGAS,EAAAA,IAACwE,EAAAA,iBACE,SAAA1C,GACC9B,EAAAA,IAACyE,EAAAA,OAAO,IAAP,CACC,QAAS,CAAE,QAAS,EAAG,EAAG,GAAA,EAC1B,QAAS,CAAE,QAAS,EAAG,EAAG,CAAA,EAC1B,KAAM,CAAE,QAAS,EAAG,EAAG,GAAA,EACvB,WAAY,CAAE,SAAU,EAAA,EACxB,GAAI,GAAGpE,CAAE,eACT,KAAM0B,IAAgB,QAAU,QAAU,OAE1C,SAAA/B,EAAAA,IAACuE,EAAAA,WAAA,CACC,UAAW1E,EAAG,OAAQyD,IAA2B,EACjD,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAxB,CAAA,CAAA,CACH,CAAA,EAGN,EAGCG,GAAY,CAACH,GACZ9B,EAAAA,IAAC,MAAA,CAAI,GAAI,GAAGK,CAAE,eAAgB,UAAU,UACrC,SAAA4B,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,CAGN,CACF,EAEA/B,EAAO,YAAc"}
|
|
@@ -17,7 +17,7 @@ import { shouldShowConfidenceScore as O, getConfidenceScoreBadgeFill as be, getC
|
|
|
17
17
|
const we = (t, r, o, u = "medium") => {
|
|
18
18
|
const n = {
|
|
19
19
|
small: "w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5",
|
|
20
|
-
medium: "w-
|
|
20
|
+
medium: "w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5",
|
|
21
21
|
large: "w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5"
|
|
22
22
|
}, g = {
|
|
23
23
|
small: "peer-checked:after:translate-x-3",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.es.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-9 h-5 after:h-4 after:w-4 after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement='top-end'\n title={confidenceTooltip ?? ''}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className='cursor-pointer'\n >\n <div\n className={cn(\n 'inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5',\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn('text-xs font-medium leading-4', getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div\n className={cn(\n \"z-10 transition-all transform\",\n size === \"small\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-1.5\"),\n size === \"medium\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-2\"),\n size === \"large\" &&\n (isChecked\n ? \"translate-x-2.5\"\n : \"-translate-x-2.5\")\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":";;;;;;;;;;;;;;;;AA+IA,MAAMA,KAAsB,CAC1BC,GACAC,GACAC,GACAC,IAAqC,aAC1B;AACX,QAAMC,IAAc;AAAA,IAClB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA,GAGHC,IAAmB;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA;AAGT,SAAOC;AAAA,IACL;AAAA,IACAF,EAAYD,CAAI;AAAA,IAChBE,EAAiBF,CAAI;AAAA,IACrB;AAAA,MACE,6IACEH;AAAA,MACF,0CAA0C,CAACA;AAAA,MAC3C,kCAAkCC;AAAA,MAClC,iCAAiCC;AAAA,IAAA;AAAA,EACnC;AAEJ,GAKMK,KAAY,CAAC,EAAE,MAAAJ,IAAO,IAAI,MAAAK,IAAO,UAAA,MACrC,gBAAAC,EAAC,OAAA,EAAI,OAAON,GAAM,Q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,EAAI,IAAI,GAAGK,CAAE,gBAAgB,WAAU,WACrC,UAAA4B,EAAA,CACH;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA/B,GAAO,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Toggle.es.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement='top-end'\n title={confidenceTooltip ?? ''}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className='cursor-pointer'\n >\n <div\n className={cn(\n 'inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5',\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn('text-xs font-medium leading-4', getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div\n className={cn(\n \"z-10 transition-all transform\",\n size === \"small\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-1.5\"),\n size === \"medium\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"-translate-x-2\"),\n size === \"large\" &&\n (isChecked\n ? \"translate-x-2.5\"\n : \"-translate-x-2.5\")\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":";;;;;;;;;;;;;;;;AA+IA,MAAMA,KAAsB,CAC1BC,GACAC,GACAC,GACAC,IAAqC,aAC1B;AACX,QAAMC,IAAc;AAAA,IAClB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA,GAGHC,IAAmB;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA;AAGT,SAAOC;AAAA,IACL;AAAA,IACAF,EAAYD,CAAI;AAAA,IAChBE,EAAiBF,CAAI;AAAA,IACrB;AA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AAAA,oBACC,WAAW1E,EAAG,QAAQyD,IAA2B;AAAA,oBACjD,YAAW;AAAA,oBACX,MAAK;AAAA,oBACL,SAAQ;AAAA,oBAEP,UAAAxB;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA,GAGN;AAAA,YAGCG,KAAY,CAACH,KACZ,gBAAA9B,EAAC,OAAA,EAAI,IAAI,GAAGK,CAAE,gBAAgB,WAAU,WACrC,UAAA4B,EAAA,CACH;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA/B,GAAO,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),p=require("react"),w=require("antd"),
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),p=require("react"),w=require("antd"),c=require("../../hooks/useOS.cjs.js");;/* empty css */const N={auto:"top","auto-start":"topLeft","auto-end":"topRight",top:"top","top-start":"topLeft","top-end":"topRight",bottom:"bottom","bottom-start":"bottomLeft","bottom-end":"bottomRight",right:"right","right-start":"rightTop","right-end":"rightBottom",left:"left","left-start":"leftTop","left-end":"leftBottom"},R=({children:d,title:s,hideTooltip:m=!1,delayShow:x=!1,whiteSpace:f="initial",placement:u="top",className:g,shortcuts:r,open:b,onOpenChange:h})=>{const i=c.useOS(),n=p.useMemo(()=>r?c.mapShortcutKeys(r,i):void 0,[r,i]),y=N[u],a=p.useMemo(()=>{if(!n)return[];const t={};return n.map(o=>(t[o]=(t[o]??0)+1,{id:`${o}-${t[o]}`,label:o}))},[n]),j=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 min-w-0",children:s}),a.length>0&&e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:a.map(t=>e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded text-[11px] font-medium leading-none",style:{backgroundColor:"rgba(255, 255, 255, 0.1)",border:"1px solid rgba(255, 255, 255, 0.2)",color:"rgba(255, 255, 255, 0.8)"},children:t.label},t.id))})]}),l=e.jsx("span",{className:g,children:d});return m?l:e.jsx(w.Tooltip,{title:s?j:null,placement:y,trigger:["hover"],mouseEnterDelay:x?1:0,mouseLeaveDelay:0,color:"#101828",open:b,onOpenChange:h,classNames:{body:"lax-tooltip-body-important-whitespace flex items-center justify-center"},styles:{body:{"--lax-tooltip-white-space":f,borderRadius:8,border:"1px solid #252525",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.18)",color:"#fff",maxWidth:"40ch",fontSize:12,fontWeight:500,wordWrap:"break-word",padding:"4px 8px"}},children:l})};module.exports=R;
|
|
2
2
|
//# sourceMappingURL=Tooltip.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.cjs.js","sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMemo } from 'react';\nimport { Tooltip as AntdTooltip } from 'antd';\nimport type { TooltipProps as AntdTooltipProps } from 'antd';\nimport { mapShortcutKeys, useOS } from '../../hooks/useOS';\nimport './Tooltip.css';\n\nexport type TooltipPlacement =\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\nexport interface TooltipProps {\n title: React.ReactNode;\n placement?: TooltipPlacement;\n children: React.ReactNode;\n className?: string;\n hideTooltip?: boolean;\n delayShow?: boolean;\n whiteSpace?: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'initial' | 'inherit';\n /** Array of keyboard shortcut keys to display (e.g., ['Cmd', 'S'] or ['Ctrl', 'Enter']) */\n shortcuts?: string[];\n /** Controlled visibility state */\n open?: boolean;\n /** Callback fired when visibility changes */\n onOpenChange?: (open: boolean) => void;\n}\n\nconst placementMap: Record<TooltipPlacement, AntdTooltipProps['placement']> = {\n auto: 'top',\n 'auto-start': 'topLeft',\n 'auto-end': 'topRight',\n top: 'top',\n 'top-start': 'topLeft',\n 'top-end': 'topRight',\n bottom: 'bottom',\n 'bottom-start': 'bottomLeft',\n 'bottom-end': 'bottomRight',\n right: 'right',\n 'right-start': 'rightTop',\n 'right-end': 'rightBottom',\n left: 'left',\n 'left-start': 'leftTop',\n 'left-end': 'leftBottom',\n};\n\nconst Tooltip = ({\n children,\n title,\n hideTooltip = false,\n delayShow = false,\n whiteSpace = 'initial',\n placement = 'top',\n className,\n shortcuts,\n open,\n onOpenChange,\n}: TooltipProps) => {\n const os = useOS();\n const mappedShortcuts = useMemo(\n () => (shortcuts ? mapShortcutKeys(shortcuts, os) : undefined),\n [shortcuts, os]\n );\n const tooltipPlacement = placementMap[placement];\n const shortcutKeys = useMemo(() => {\n if (!mappedShortcuts) return [];\n const counts: Record<string, number> = {};\n return mappedShortcuts.map((shortcut) => {\n counts[shortcut] = (counts[shortcut] ?? 0) + 1;\n return { id: `${shortcut}-${counts[shortcut]}`, label: shortcut };\n });\n }, [mappedShortcuts]);\n\n const tooltipContent = (\n <div className=\"flex items-center gap-2\">\n <span className=\"flex-1 min-w-0\">{title}</span>\n {shortcutKeys.length > 0 && (\n <span className=\"flex items-center gap-0.5 flex-shrink-0\">\n {shortcutKeys.map((shortcut) => (\n <kbd\n key={shortcut.id}\n className=\"inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded text-[11px] font-medium leading-none\"\n style={{\n backgroundColor: 'rgba(255, 255, 255, 0.1)',\n border: '1px solid rgba(255, 255, 255, 0.2)',\n color: 'rgba(255, 255, 255, 0.8)',\n }}\n >\n {shortcut.label}\n </kbd>\n ))}\n </span>\n )}\n </div>\n );\n\n const triggerNode = <span className={className}>{children}</span>;\n\n if (hideTooltip) {\n return triggerNode;\n }\n\n return (\n <AntdTooltip\n title={title ? tooltipContent : null}\n placement={tooltipPlacement}\n trigger={['hover']}\n mouseEnterDelay={delayShow ? 1 : 0}\n mouseLeaveDelay={0}\n color=\"#101828\"\n open={open}\n onOpenChange={onOpenChange}\n classNames={{\n body: 'lax-tooltip-body-important-whitespace',\n }}\n styles={{\n body: ({\n ['--lax-tooltip-white-space' as string]: whiteSpace,\n borderRadius: 8,\n border: '1px solid #252525',\n boxShadow: '0 2px 4px rgba(0, 0, 0, 0.18)',\n color: '#fff',\n maxWidth: '40ch',\n fontSize: 12,\n fontWeight: 500,\n wordWrap: 'break-word',\n padding: '4px 8px',\n } as React.CSSProperties),\n }}\n >\n {triggerNode}\n </AntdTooltip>\n );\n};\n\nexport default Tooltip;"],"names":["placementMap","Tooltip","children","title","hideTooltip","delayShow","whiteSpace","placement","className","shortcuts","open","onOpenChange","os","useOS","mappedShortcuts","useMemo","mapShortcutKeys","tooltipPlacement","shortcutKeys","counts","shortcut","tooltipContent","jsxs","jsx","triggerNode","AntdTooltip"],"mappings":"6JAwCA,MAAMA,EAAwE,CAC5E,KAAM,MACN,aAAc,UACd,WAAY,WACZ,IAAK,MACL,YAAa,UACb,UAAW,WACX,OAAQ,SACR,eAAgB,aAChB,aAAc,cACd,MAAO,QACP,cAAe,WACf,YAAa,cACb,KAAM,OACN,aAAc,UACd,WAAY,YACd,EAEMC,EAAU,CAAC,CACf,SAAAC,EACA,MAAAC,EACA,YAAAC,EAAc,GACd,UAAAC,EAAY,GACZ,WAAAC,EAAa,UACb,UAAAC,EAAY,MACZ,UAAAC,EACA,UAAAC,EACA,KAAAC,EACA,aAAAC,CACF,IAAoB,CAClB,MAAMC,EAAKC,EAAAA,MAAA,EACLC,EAAkBC,EAAAA,QACtB,IAAON,EAAYO,EAAAA,gBAAgBP,EAAWG,CAAE,EAAI,OACpD,CAACH,EAAWG,CAAE,CAAA,EAEVK,EAAmBjB,EAAaO,CAAS,EACzCW,EAAeH,EAAAA,QAAQ,IAAM,CACjC,GAAI,CAACD,EAAiB,MAAO,CAAA,EAC7B,MAAMK,EAAiC,CAAA,EACvC,OAAOL,EAAgB,IAAKM,IAC1BD,EAAOC,CAAQ,GAAKD,EAAOC,CAAQ,GAAK,GAAK,EACtC,CAAE,GAAI,GAAGA,CAAQ,IAAID,EAAOC,CAAQ,CAAC,GAAI,MAAOA,CAAA,EACxD,CACH,EAAG,CAACN,CAAe,CAAC,EAEdO,EACJC,EAAAA,KAAC,MAAA,CAAI,UAAU,0BACb,SAAA,CAAAC,EAAAA,IAAC,OAAA,CAAK,UAAU,iBAAkB,SAAApB,EAAM,EACvCe,EAAa,OAAS,GACrBK,EAAAA,IAAC,OAAA,CAAK,UAAU,0CACb,SAAAL,EAAa,IAAKE,GACjBG,EAAAA,IAAC,MAAA,CAEC,UAAU,6GACV,MAAO,CACL,gBAAiB,2BACjB,OAAQ,qCACR,MAAO,0BAAA,EAGR,SAAAH,EAAS,KAAA,EARLA,EAAS,EAAA,CAUjB,CAAA,CACH,CAAA,EAEJ,EAGII,EAAcD,EAAAA,IAAC,OAAA,CAAK,UAAAf,EAAuB,SAAAN,CAAA,CAAS,EAE1D,OAAIE,EACKoB,EAIPD,EAAAA,IAACE,EAAAA,QAAA,CACC,MAAOtB,EAAQkB,EAAiB,KAChC,UAAWJ,EACX,QAAS,CAAC,OAAO,EACjB,gBAAiBZ,EAAY,EAAI,EACjC,gBAAiB,EACjB,MAAM,UACN,KAAAK,EACA,aAAAC,EACA,WAAY,CACV,KAAM,
|
|
1
|
+
{"version":3,"file":"Tooltip.cjs.js","sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMemo } from 'react';\nimport { Tooltip as AntdTooltip } from 'antd';\nimport type { TooltipProps as AntdTooltipProps } from 'antd';\nimport { mapShortcutKeys, useOS } from '../../hooks/useOS';\nimport './Tooltip.css';\n\nexport type TooltipPlacement =\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\nexport interface TooltipProps {\n title: React.ReactNode;\n placement?: TooltipPlacement;\n children: React.ReactNode;\n className?: string;\n hideTooltip?: boolean;\n delayShow?: boolean;\n whiteSpace?: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'initial' | 'inherit';\n /** Array of keyboard shortcut keys to display (e.g., ['Cmd', 'S'] or ['Ctrl', 'Enter']) */\n shortcuts?: string[];\n /** Controlled visibility state */\n open?: boolean;\n /** Callback fired when visibility changes */\n onOpenChange?: (open: boolean) => void;\n}\n\nconst placementMap: Record<TooltipPlacement, AntdTooltipProps['placement']> = {\n auto: 'top',\n 'auto-start': 'topLeft',\n 'auto-end': 'topRight',\n top: 'top',\n 'top-start': 'topLeft',\n 'top-end': 'topRight',\n bottom: 'bottom',\n 'bottom-start': 'bottomLeft',\n 'bottom-end': 'bottomRight',\n right: 'right',\n 'right-start': 'rightTop',\n 'right-end': 'rightBottom',\n left: 'left',\n 'left-start': 'leftTop',\n 'left-end': 'leftBottom',\n};\n\nconst Tooltip = ({\n children,\n title,\n hideTooltip = false,\n delayShow = false,\n whiteSpace = 'initial',\n placement = 'top',\n className,\n shortcuts,\n open,\n onOpenChange,\n}: TooltipProps) => {\n const os = useOS();\n const mappedShortcuts = useMemo(\n () => (shortcuts ? mapShortcutKeys(shortcuts, os) : undefined),\n [shortcuts, os]\n );\n const tooltipPlacement = placementMap[placement];\n const shortcutKeys = useMemo(() => {\n if (!mappedShortcuts) return [];\n const counts: Record<string, number> = {};\n return mappedShortcuts.map((shortcut) => {\n counts[shortcut] = (counts[shortcut] ?? 0) + 1;\n return { id: `${shortcut}-${counts[shortcut]}`, label: shortcut };\n });\n }, [mappedShortcuts]);\n\n const tooltipContent = (\n <div className=\"flex items-center gap-2\">\n <span className=\"flex-1 min-w-0\">{title}</span>\n {shortcutKeys.length > 0 && (\n <span className=\"flex items-center gap-0.5 flex-shrink-0\">\n {shortcutKeys.map((shortcut) => (\n <kbd\n key={shortcut.id}\n className=\"inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded text-[11px] font-medium leading-none\"\n style={{\n backgroundColor: 'rgba(255, 255, 255, 0.1)',\n border: '1px solid rgba(255, 255, 255, 0.2)',\n color: 'rgba(255, 255, 255, 0.8)',\n }}\n >\n {shortcut.label}\n </kbd>\n ))}\n </span>\n )}\n </div>\n );\n\n const triggerNode = <span className={className}>{children}</span>;\n\n if (hideTooltip) {\n return triggerNode;\n }\n\n return (\n <AntdTooltip\n title={title ? tooltipContent : null}\n placement={tooltipPlacement}\n trigger={['hover']}\n mouseEnterDelay={delayShow ? 1 : 0}\n mouseLeaveDelay={0}\n color=\"#101828\"\n open={open}\n onOpenChange={onOpenChange}\n classNames={{\n body: 'lax-tooltip-body-important-whitespace flex items-center justify-center',\n }}\n styles={{\n body: ({\n ['--lax-tooltip-white-space' as string]: whiteSpace,\n borderRadius: 8,\n border: '1px solid #252525',\n boxShadow: '0 2px 4px rgba(0, 0, 0, 0.18)',\n color: '#fff',\n maxWidth: '40ch',\n fontSize: 12,\n fontWeight: 500,\n wordWrap: 'break-word',\n padding: '4px 8px',\n } as React.CSSProperties),\n }}\n >\n {triggerNode}\n </AntdTooltip>\n );\n};\n\nexport default Tooltip;"],"names":["placementMap","Tooltip","children","title","hideTooltip","delayShow","whiteSpace","placement","className","shortcuts","open","onOpenChange","os","useOS","mappedShortcuts","useMemo","mapShortcutKeys","tooltipPlacement","shortcutKeys","counts","shortcut","tooltipContent","jsxs","jsx","triggerNode","AntdTooltip"],"mappings":"6JAwCA,MAAMA,EAAwE,CAC5E,KAAM,MACN,aAAc,UACd,WAAY,WACZ,IAAK,MACL,YAAa,UACb,UAAW,WACX,OAAQ,SACR,eAAgB,aAChB,aAAc,cACd,MAAO,QACP,cAAe,WACf,YAAa,cACb,KAAM,OACN,aAAc,UACd,WAAY,YACd,EAEMC,EAAU,CAAC,CACf,SAAAC,EACA,MAAAC,EACA,YAAAC,EAAc,GAC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A,WAAY,CACV,KAAM,wEAAA,EAER,OAAQ,CACN,KAAO,CACJ,4BAAwCL,EACzC,aAAc,EACd,OAAQ,oBACR,UAAW,gCACX,MAAO,OACP,SAAU,OACV,SAAU,GACV,WAAY,IACZ,SAAU,aACV,QAAS,SAAA,CACX,EAGD,SAAAkB,CAAA,CAAA,CAGP"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as w, jsx as
|
|
1
|
+
import { jsxs as w, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as s } from "react";
|
|
3
3
|
import { Tooltip as N } from "antd";
|
|
4
4
|
import { useOS as S, mapShortcutKeys as T } from "../../hooks/useOS.es.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
const
|
|
6
|
+
const j = {
|
|
7
7
|
auto: "top",
|
|
8
8
|
"auto-start": "topLeft",
|
|
9
9
|
"auto-end": "topRight",
|
|
@@ -21,26 +21,26 @@ const k = {
|
|
|
21
21
|
"left-end": "leftBottom"
|
|
22
22
|
}, $ = ({
|
|
23
23
|
children: m,
|
|
24
|
-
title:
|
|
24
|
+
title: a,
|
|
25
25
|
hideTooltip: d = !1,
|
|
26
26
|
delayShow: c = !1,
|
|
27
27
|
whiteSpace: f = "initial",
|
|
28
28
|
placement: g = "top",
|
|
29
|
-
className:
|
|
29
|
+
className: x,
|
|
30
30
|
shortcuts: r,
|
|
31
|
-
open:
|
|
31
|
+
open: b,
|
|
32
32
|
onOpenChange: h
|
|
33
33
|
}) => {
|
|
34
|
-
const
|
|
35
|
-
() => r ? T(r,
|
|
36
|
-
[r,
|
|
37
|
-
), u =
|
|
38
|
-
if (!
|
|
34
|
+
const n = S(), i = s(
|
|
35
|
+
() => r ? T(r, n) : void 0,
|
|
36
|
+
[r, n]
|
|
37
|
+
), u = j[g], l = s(() => {
|
|
38
|
+
if (!i) return [];
|
|
39
39
|
const t = {};
|
|
40
|
-
return
|
|
41
|
-
}, [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
40
|
+
return i.map((e) => (t[e] = (t[e] ?? 0) + 1, { id: `${e}-${t[e]}`, label: e }));
|
|
41
|
+
}, [i]), y = /* @__PURE__ */ w("div", { className: "flex items-center gap-2", children: [
|
|
42
|
+
/* @__PURE__ */ o("span", { className: "flex-1 min-w-0", children: a }),
|
|
43
|
+
l.length > 0 && /* @__PURE__ */ o("span", { className: "flex items-center gap-0.5 flex-shrink-0", children: l.map((t) => /* @__PURE__ */ o(
|
|
44
44
|
"kbd",
|
|
45
45
|
{
|
|
46
46
|
className: "inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded text-[11px] font-medium leading-none",
|
|
@@ -53,20 +53,20 @@ const k = {
|
|
|
53
53
|
},
|
|
54
54
|
t.id
|
|
55
55
|
)) })
|
|
56
|
-
] }), p = /* @__PURE__ */
|
|
57
|
-
return d ? p : /* @__PURE__ */
|
|
56
|
+
] }), p = /* @__PURE__ */ o("span", { className: x, children: m });
|
|
57
|
+
return d ? p : /* @__PURE__ */ o(
|
|
58
58
|
N,
|
|
59
59
|
{
|
|
60
|
-
title:
|
|
60
|
+
title: a ? y : null,
|
|
61
61
|
placement: u,
|
|
62
62
|
trigger: ["hover"],
|
|
63
63
|
mouseEnterDelay: c ? 1 : 0,
|
|
64
64
|
mouseLeaveDelay: 0,
|
|
65
65
|
color: "#101828",
|
|
66
|
-
open:
|
|
66
|
+
open: b,
|
|
67
67
|
onOpenChange: h,
|
|
68
68
|
classNames: {
|
|
69
|
-
body: "lax-tooltip-body-important-whitespace"
|
|
69
|
+
body: "lax-tooltip-body-important-whitespace flex items-center justify-center"
|
|
70
70
|
},
|
|
71
71
|
styles: {
|
|
72
72
|
body: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.es.js","sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMemo } from 'react';\nimport { Tooltip as AntdTooltip } from 'antd';\nimport type { TooltipProps as AntdTooltipProps } from 'antd';\nimport { mapShortcutKeys, useOS } from '../../hooks/useOS';\nimport './Tooltip.css';\n\nexport type TooltipPlacement =\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\nexport interface TooltipProps {\n title: React.ReactNode;\n placement?: TooltipPlacement;\n children: React.ReactNode;\n className?: string;\n hideTooltip?: boolean;\n delayShow?: boolean;\n whiteSpace?: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'initial' | 'inherit';\n /** Array of keyboard shortcut keys to display (e.g., ['Cmd', 'S'] or ['Ctrl', 'Enter']) */\n shortcuts?: string[];\n /** Controlled visibility state */\n open?: boolean;\n /** Callback fired when visibility changes */\n onOpenChange?: (open: boolean) => void;\n}\n\nconst placementMap: Record<TooltipPlacement, AntdTooltipProps['placement']> = {\n auto: 'top',\n 'auto-start': 'topLeft',\n 'auto-end': 'topRight',\n top: 'top',\n 'top-start': 'topLeft',\n 'top-end': 'topRight',\n bottom: 'bottom',\n 'bottom-start': 'bottomLeft',\n 'bottom-end': 'bottomRight',\n right: 'right',\n 'right-start': 'rightTop',\n 'right-end': 'rightBottom',\n left: 'left',\n 'left-start': 'leftTop',\n 'left-end': 'leftBottom',\n};\n\nconst Tooltip = ({\n children,\n title,\n hideTooltip = false,\n delayShow = false,\n whiteSpace = 'initial',\n placement = 'top',\n className,\n shortcuts,\n open,\n onOpenChange,\n}: TooltipProps) => {\n const os = useOS();\n const mappedShortcuts = useMemo(\n () => (shortcuts ? mapShortcutKeys(shortcuts, os) : undefined),\n [shortcuts, os]\n );\n const tooltipPlacement = placementMap[placement];\n const shortcutKeys = useMemo(() => {\n if (!mappedShortcuts) return [];\n const counts: Record<string, number> = {};\n return mappedShortcuts.map((shortcut) => {\n counts[shortcut] = (counts[shortcut] ?? 0) + 1;\n return { id: `${shortcut}-${counts[shortcut]}`, label: shortcut };\n });\n }, [mappedShortcuts]);\n\n const tooltipContent = (\n <div className=\"flex items-center gap-2\">\n <span className=\"flex-1 min-w-0\">{title}</span>\n {shortcutKeys.length > 0 && (\n <span className=\"flex items-center gap-0.5 flex-shrink-0\">\n {shortcutKeys.map((shortcut) => (\n <kbd\n key={shortcut.id}\n className=\"inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded text-[11px] font-medium leading-none\"\n style={{\n backgroundColor: 'rgba(255, 255, 255, 0.1)',\n border: '1px solid rgba(255, 255, 255, 0.2)',\n color: 'rgba(255, 255, 255, 0.8)',\n }}\n >\n {shortcut.label}\n </kbd>\n ))}\n </span>\n )}\n </div>\n );\n\n const triggerNode = <span className={className}>{children}</span>;\n\n if (hideTooltip) {\n return triggerNode;\n }\n\n return (\n <AntdTooltip\n title={title ? tooltipContent : null}\n placement={tooltipPlacement}\n trigger={['hover']}\n mouseEnterDelay={delayShow ? 1 : 0}\n mouseLeaveDelay={0}\n color=\"#101828\"\n open={open}\n onOpenChange={onOpenChange}\n classNames={{\n body: 'lax-tooltip-body-important-whitespace',\n }}\n styles={{\n body: ({\n ['--lax-tooltip-white-space' as string]: whiteSpace,\n borderRadius: 8,\n border: '1px solid #252525',\n boxShadow: '0 2px 4px rgba(0, 0, 0, 0.18)',\n color: '#fff',\n maxWidth: '40ch',\n fontSize: 12,\n fontWeight: 500,\n wordWrap: 'break-word',\n padding: '4px 8px',\n } as React.CSSProperties),\n }}\n >\n {triggerNode}\n </AntdTooltip>\n );\n};\n\nexport default Tooltip;"],"names":["placementMap","Tooltip","children","title","hideTooltip","delayShow","whiteSpace","placement","className","shortcuts","open","onOpenChange","os","useOS","mappedShortcuts","useMemo","mapShortcutKeys","tooltipPlacement","shortcutKeys","counts","shortcut","tooltipContent","jsxs","jsx","triggerNode","AntdTooltip"],"mappings":";;;;;AAwCA,MAAMA,IAAwE;AAAA,EAC5E,MAAM;AAAA,EACN,cAAc;AAAA,EACd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AAiB;AAAA,UACjB,QAAQ;AAAA,UACR,OAAO;AAAA,QAAA;AAAA,QAGR,UAAAH,EAAS;AAAA,MAAA;AAAA,MARLA,EAAS;AAAA,IAAA,CAUjB,EAAA,CACH;AAAA,EAAA,GAEJ,GAGII,IAAc,gBAAAD,EAAC,QAAA,EAAK,WAAAf,GAAuB,UAAAN,EAAA,CAAS;AAE1D,SAAIE,IACKoB,IAIP,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOtB,IAAQkB,IAAiB;AAAA,MAChC,WAAWJ;AAAA,MACX,SAAS,CAAC,OAAO;AAAA,MACjB,iBAAiBZ,IAAY,IAAI;AAAA,MACjC,iBAAiB;AAAA,MACjB,OAAM;AAAA,MACN,MAAAK;AAAA,MACA,cAAAC;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,MAAA;AAAA,MAER,QAAQ;AAAA,QACN,MAAO;AAAA,UACJ,6BAAwCL;AAAA,UACzC,cAAc;AAAA,UACd,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,OAAO;AAAA,UACP,UAAU;AAAA,UACV,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,SAAS;AAAA,QAAA;AAAA,MACX;AAAA,MAGD,UAAAkB;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
1
|
+
{"version":3,"file":"Tooltip.es.js","sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMemo } from 'react';\nimport { Tooltip as AntdTooltip } from 'antd';\nimport type { TooltipProps as AntdTooltipProps } from 'antd';\nimport { mapShortcutKeys, useOS } from '../../hooks/useOS';\nimport './Tooltip.css';\n\nexport type TooltipPlacement =\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\nexport interface TooltipProps {\n title: React.ReactNode;\n placement?: TooltipPlacement;\n children: React.ReactNode;\n className?: string;\n hideTooltip?: boolean;\n delayShow?: boolean;\n whiteSpace?: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'initial' | 'inherit';\n /** Array of keyboard shortcut keys to display (e.g., ['Cmd', 'S'] or ['Ctrl', 'Enter']) */\n shortcuts?: string[];\n /** Controlled visibility state */\n open?: boolean;\n /** Callback fired when visibility changes */\n onOpenChange?: (open: boolean) => void;\n}\n\nconst placementMap: Record<TooltipPlacement, AntdTooltipProps['placement']> = {\n auto: 'top',\n 'auto-start': 'topLeft',\n 'auto-end': 'topRight',\n top: 'top',\n 'top-start': 'topLeft',\n 'top-end': 'topRight',\n bottom: 'bottom',\n 'bottom-start': 'bottomLeft',\n 'bottom-end': 'bottomRight',\n right: 'right',\n 'right-start': 'rightTop',\n 'right-end': 'rightBottom',\n left: 'left',\n 'left-start': 'leftTop',\n 'left-end': 'leftBottom',\n};\n\nconst Tooltip = ({\n children,\n title,\n hideTooltip = false,\n delayShow = false,\n whiteSpace = 'initial',\n placement = 'top',\n className,\n shortcuts,\n open,\n onOpenChange,\n}: TooltipProps) => {\n const os = useOS();\n const mappedShortcuts = useMemo(\n () => (shortcuts ? mapShortcutKeys(shortcuts, os) : undefined),\n [shortcuts, os]\n );\n const tooltipPlacement = placementMap[placement];\n const shortcutKeys = useMemo(() => {\n if (!mappedShortcuts) return [];\n const counts: Record<string, number> = {};\n return mappedShortcuts.map((shortcut) => {\n counts[shortcut] = (counts[shortcut] ?? 0) + 1;\n return { id: `${shortcut}-${counts[shortcut]}`, label: shortcut };\n });\n }, [mappedShortcuts]);\n\n const tooltipContent = (\n <div className=\"flex items-center gap-2\">\n <span className=\"flex-1 min-w-0\">{title}</span>\n {shortcutKeys.length > 0 && (\n <span className=\"flex items-center gap-0.5 flex-shrink-0\">\n {shortcutKeys.map((shortcut) => (\n <kbd\n key={shortcut.id}\n className=\"inline-flex items-center justify-center min-w-[20px] h-5 px-1 rounded text-[11px] font-medium leading-none\"\n style={{\n backgroundColor: 'rgba(255, 255, 255, 0.1)',\n border: '1px solid rgba(255, 255, 255, 0.2)',\n color: 'rgba(255, 255, 255, 0.8)',\n }}\n >\n {shortcut.label}\n </kbd>\n ))}\n </span>\n )}\n </div>\n );\n\n const triggerNode = <span className={className}>{children}</span>;\n\n if (hideTooltip) {\n return triggerNode;\n }\n\n return (\n <AntdTooltip\n title={title ? tooltipContent : null}\n placement={tooltipPlacement}\n trigger={['hover']}\n mouseEnterDelay={delayShow ? 1 : 0}\n mouseLeaveDelay={0}\n color=\"#101828\"\n open={open}\n onOpenChange={onOpenChange}\n classNames={{\n body: 'lax-tooltip-body-important-whitespace flex items-center justify-center',\n }}\n styles={{\n body: ({\n ['--lax-tooltip-white-space' as string]: whiteSpace,\n borderRadius: 8,\n border: '1px solid #252525',\n boxShadow: '0 2px 4px rgba(0, 0, 0, 0.18)',\n color: '#fff',\n maxWidth: '40ch',\n fontSize: 12,\n fontWeight: 500,\n wordWrap: 'break-word',\n padding: '4px 8px',\n } as React.CSSProperties),\n }}\n >\n {triggerNode}\n </AntdTooltip>\n );\n};\n\nexport default Tooltip;"],"names":["placementMap","Tooltip","children","title","hideTooltip","delayShow","whiteSpace","placement","className","shortcuts","open","onOpenChange","os","useOS","mappedShortcuts","useMemo","mapShortcutKeys","tooltipPlacement","shortcutKeys","counts","shortcut","tooltipContent","jsxs","jsx","triggerNode","AntdTooltip"],"mappings":";;;;;AAwCA,MAAMA,IAAwE;AAAA,EAC5E,MAAM;AAAA,EACN,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,aAAa;AAAA,EACb,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,OAAO;AAAA,EACP,eAAe;AAAA,EACf,aAAa;AAAA,EACb,MAAM;AAAA,EACN,cAAc;AAAA,EACd,YAAY;AACd,GAEMC,IAA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