periplo-ui 4.15.0 → 4.15.1
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/data-display/DataTable/components/DataTableCheckbox.js +0 -1
- package/dist/components/data-display/DataTable/components/DataTableCheckbox.js.map +1 -1
- package/dist/components/inputs/Input/Input.js +1 -1
- package/dist/components/inputs/Input/Input.js.map +1 -1
- package/dist/components/inputs/MultiSelect/MultiSelect.js +0 -1
- package/dist/components/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/inputs/PhoneInput/PhoneInput.js +1 -1
- package/dist/components/inputs/PhoneInput/PhoneInput.js.map +1 -1
- package/dist/components/inputs/Select/Select.js +4 -4
- package/dist/components/inputs/Select/Select.js.map +1 -1
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js +4 -4
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/navigation/Sidebar/Sidebar.js +1 -1
- package/dist/components/navigation/Sidebar/Sidebar.js.map +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/utils/Command/Command.js +1 -1
- package/dist/components/utils/Command/Command.js.map +1 -1
- package/dist/theme.css +17 -0
- package/package.json +1 -1
|
@@ -41,7 +41,6 @@ function DataTableCheckbox(props) {
|
|
|
41
41
|
checked: selectedCount > 0 && !allSelected ? "indeterminate" : allSelected,
|
|
42
42
|
onCheckedChange: (checked) => leafIds.forEach((id) => props.handleRowSelect(id, !!checked)),
|
|
43
43
|
onClick: (event) => event.stopPropagation(),
|
|
44
|
-
className: "cursor-default",
|
|
45
44
|
disabled: leafIds.length === 0,
|
|
46
45
|
"aria-label": "Select group"
|
|
47
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableCheckbox.js","names":[],"sources":["../../../../../src/components/data-display/DataTable/components/DataTableCheckbox.tsx"],"sourcesContent":["import { Row } from '@tanstack/react-table'\nimport { ReactNode } from 'react'\n\nimport { TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger } from '@/components/data-display/Tooltip'\nimport { Checkbox } from '@/components/inputs/Checkbox'\n\ntype HeaderProps<TData> = {\n readonly variant: 'header'\n readonly isBackendPagination: boolean\n readonly selectedIds: Set<string>\n readonly data: Array<TData>\n readonly handleSelectAll: (checked: boolean) => void\n readonly isLoading: boolean\n readonly isSelectionDisabled: boolean\n readonly selectionDisabledTooltip?: string\n}\n\ntype RowProps<TData extends object> = {\n readonly variant: 'row'\n readonly row: Row<TData>\n readonly selectedIds: Set<string>\n readonly getRowId: (original: TData) => string\n readonly handleRowSelect: (rowId: string, checked: boolean) => void\n readonly isRowSelectionDisabled?: boolean | ((row: TData) => boolean)\n readonly rowSelectionDisabledTooltip?: string | ((row: TData) => string | undefined)\n}\n\ntype GroupProps<TData extends object> = {\n readonly variant: 'group'\n readonly row: Row<TData>\n readonly selectedIds: Set<string>\n readonly getRowId: (original: TData) => string\n readonly handleRowSelect: (rowId: string, checked: boolean) => void\n}\n\ntype DataTableCheckboxProps<TData extends object> = HeaderProps<TData> | RowProps<TData> | GroupProps<TData>\n\nfunction withTooltip(tooltip: string | undefined, children: ReactNode) {\n if (!tooltip) {\n return <span className=\"inline-flex\">{children}</span>\n }\n\n return (\n <TooltipProvider>\n <TooltipRoot delayDuration={200}>\n <TooltipTrigger asChild>\n <span className=\"inline-flex\">{children}</span>\n </TooltipTrigger>\n <TooltipContent>{tooltip}</TooltipContent>\n </TooltipRoot>\n </TooltipProvider>\n )\n}\n\nexport function DataTableCheckbox<TData extends object>(props: DataTableCheckboxProps<TData>) {\n if (props.variant === 'header') {\n if (props.isBackendPagination) {\n return <span className=\"inline-flex h-5 w-5 shrink-0\" aria-hidden />\n }\n\n const allSelected = props.data.length > 0 && props.selectedIds.size === props.data.length\n const someSelected = props.selectedIds.size > 0 && !allSelected\n\n return withTooltip(\n props.selectionDisabledTooltip,\n <Checkbox\n checked={someSelected ? 'indeterminate' : allSelected}\n onCheckedChange={props.handleSelectAll}\n disabled={props.isLoading || !props.data.length || props.isSelectionDisabled}\n aria-label=\"Select all rows\"\n />,\n )\n }\n\n if (props.variant === 'group') {\n const leafIds = props.row.getLeafRows().map((leaf) => props.getRowId(leaf.original))\n const selectedCount = leafIds.filter((id) => props.selectedIds.has(id)).length\n const allSelected = leafIds.length > 0 && selectedCount === leafIds.length\n const someSelected = selectedCount > 0 && !allSelected\n\n return (\n <Checkbox\n checked={someSelected ? 'indeterminate' : allSelected}\n onCheckedChange={(checked) => leafIds.forEach((id) => props.handleRowSelect(id, !!checked))}\n onClick={(event) => event.stopPropagation()}\n
|
|
1
|
+
{"version":3,"file":"DataTableCheckbox.js","names":[],"sources":["../../../../../src/components/data-display/DataTable/components/DataTableCheckbox.tsx"],"sourcesContent":["import { Row } from '@tanstack/react-table'\nimport { ReactNode } from 'react'\n\nimport { TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger } from '@/components/data-display/Tooltip'\nimport { Checkbox } from '@/components/inputs/Checkbox'\n\ntype HeaderProps<TData> = {\n readonly variant: 'header'\n readonly isBackendPagination: boolean\n readonly selectedIds: Set<string>\n readonly data: Array<TData>\n readonly handleSelectAll: (checked: boolean) => void\n readonly isLoading: boolean\n readonly isSelectionDisabled: boolean\n readonly selectionDisabledTooltip?: string\n}\n\ntype RowProps<TData extends object> = {\n readonly variant: 'row'\n readonly row: Row<TData>\n readonly selectedIds: Set<string>\n readonly getRowId: (original: TData) => string\n readonly handleRowSelect: (rowId: string, checked: boolean) => void\n readonly isRowSelectionDisabled?: boolean | ((row: TData) => boolean)\n readonly rowSelectionDisabledTooltip?: string | ((row: TData) => string | undefined)\n}\n\ntype GroupProps<TData extends object> = {\n readonly variant: 'group'\n readonly row: Row<TData>\n readonly selectedIds: Set<string>\n readonly getRowId: (original: TData) => string\n readonly handleRowSelect: (rowId: string, checked: boolean) => void\n}\n\ntype DataTableCheckboxProps<TData extends object> = HeaderProps<TData> | RowProps<TData> | GroupProps<TData>\n\nfunction withTooltip(tooltip: string | undefined, children: ReactNode) {\n if (!tooltip) {\n return <span className=\"inline-flex\">{children}</span>\n }\n\n return (\n <TooltipProvider>\n <TooltipRoot delayDuration={200}>\n <TooltipTrigger asChild>\n <span className=\"inline-flex\">{children}</span>\n </TooltipTrigger>\n <TooltipContent>{tooltip}</TooltipContent>\n </TooltipRoot>\n </TooltipProvider>\n )\n}\n\nexport function DataTableCheckbox<TData extends object>(props: DataTableCheckboxProps<TData>) {\n if (props.variant === 'header') {\n if (props.isBackendPagination) {\n return <span className=\"inline-flex h-5 w-5 shrink-0\" aria-hidden />\n }\n\n const allSelected = props.data.length > 0 && props.selectedIds.size === props.data.length\n const someSelected = props.selectedIds.size > 0 && !allSelected\n\n return withTooltip(\n props.selectionDisabledTooltip,\n <Checkbox\n checked={someSelected ? 'indeterminate' : allSelected}\n onCheckedChange={props.handleSelectAll}\n disabled={props.isLoading || !props.data.length || props.isSelectionDisabled}\n aria-label=\"Select all rows\"\n />,\n )\n }\n\n if (props.variant === 'group') {\n const leafIds = props.row.getLeafRows().map((leaf) => props.getRowId(leaf.original))\n const selectedCount = leafIds.filter((id) => props.selectedIds.has(id)).length\n const allSelected = leafIds.length > 0 && selectedCount === leafIds.length\n const someSelected = selectedCount > 0 && !allSelected\n\n return (\n <Checkbox\n checked={someSelected ? 'indeterminate' : allSelected}\n onCheckedChange={(checked) => leafIds.forEach((id) => props.handleRowSelect(id, !!checked))}\n onClick={(event) => event.stopPropagation()}\n disabled={leafIds.length === 0}\n aria-label=\"Select group\"\n />\n )\n }\n\n const isDisabled =\n typeof props.isRowSelectionDisabled === 'function'\n ? props.isRowSelectionDisabled(props.row.original)\n : (props.isRowSelectionDisabled ?? false)\n\n const tooltipText =\n typeof props.rowSelectionDisabledTooltip === 'function'\n ? props.rowSelectionDisabledTooltip(props.row.original)\n : props.rowSelectionDisabledTooltip\n\n return withTooltip(\n isDisabled ? tooltipText : undefined,\n <Checkbox\n checked={props.selectedIds.has(props.getRowId(props.row.original))}\n onCheckedChange={(checked) => props.handleRowSelect(props.getRowId(props.row.original), !!checked)}\n aria-label=\"Select row\"\n disabled={isDisabled}\n />,\n )\n}\n"],"mappings":";;;;AAqCA,SAAS,YAAY,SAA6B,UAAqB;CACrE,IAAI,CAAC,SACH,OAAO,oBAAC,QAAD;EAAM,WAAU;EAAe;CAAe,CAAA;CAGvD,OACE,oBAAC,iBAAD,EAAA,UACE,qBAAC,aAAD;EAAa,eAAe;EAA5B,UAAA,CACE,oBAAC,gBAAD;GAAgB,SAAA;GACd,UAAA,oBAAC,QAAD;IAAM,WAAU;IAAe;GAAe,CAAA;EAChC,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,QAAwB,CAAA,CAC9B;CACE,CAAA,EAAA,CAAA;AAErB;AAEA,SAAgB,kBAAwC,OAAsC;CAC5F,IAAI,MAAM,YAAY,UAAU;EAC9B,IAAI,MAAM,qBACR,OAAO,oBAAC,QAAD;GAAM,WAAU;GAA+B,eAAA;EAAa,CAAA;EAGrE,MAAM,cAAc,MAAM,KAAK,SAAS,KAAK,MAAM,YAAY,SAAS,MAAM,KAAK;EACnF,MAAM,eAAe,MAAM,YAAY,OAAO,KAAK,CAAC;EAEpD,OAAO,YACL,MAAM,0BACN,oBAAC,UAAD;GACE,SAAS,eAAe,kBAAkB;GAC1C,iBAAiB,MAAM;GACvB,UAAU,MAAM,aAAa,CAAC,MAAM,KAAK,UAAU,MAAM;GACzD,cAAW;EACZ,CAAA,CACH;CACF;CAEA,IAAI,MAAM,YAAY,SAAS;EAC7B,MAAM,UAAU,MAAM,IAAI,YAAY,CAAC,CAAC,KAAK,SAAS,MAAM,SAAS,KAAK,QAAQ,CAAC;EACnF,MAAM,gBAAgB,QAAQ,QAAQ,OAAO,MAAM,YAAY,IAAI,EAAE,CAAC,CAAC,CAAC;EACxE,MAAM,cAAc,QAAQ,SAAS,KAAK,kBAAkB,QAAQ;EAGpE,OACE,oBAAC,UAAD;GACE,SAJiB,gBAAgB,KAAK,CAAC,cAIf,kBAAkB;GAC1C,kBAAkB,YAAY,QAAQ,SAAS,OAAO,MAAM,gBAAgB,IAAI,CAAC,CAAC,OAAO,CAAC;GAC1F,UAAU,UAAU,MAAM,gBAAgB;GAC1C,UAAU,QAAQ,WAAW;GAC7B,cAAW;EACZ,CAAA;CAEL;CAEA,MAAM,aACJ,OAAO,MAAM,2BAA2B,aACpC,MAAM,uBAAuB,MAAM,IAAI,QAAQ,IAC9C,MAAM,0BAA0B;CAEvC,MAAM,cACJ,OAAO,MAAM,gCAAgC,aACzC,MAAM,4BAA4B,MAAM,IAAI,QAAQ,IACpD,MAAM;CAEZ,OAAO,YACL,aAAa,cAAc,KAAA,GAC3B,oBAAC,UAAD;EACE,SAAS,MAAM,YAAY,IAAI,MAAM,SAAS,MAAM,IAAI,QAAQ,CAAC;EACjE,kBAAkB,YAAY,MAAM,gBAAgB,MAAM,SAAS,MAAM,IAAI,QAAQ,GAAG,CAAC,CAAC,OAAO;EACjG,cAAW;EACX,UAAU;CACX,CAAA,CACH;AACF"}
|
|
@@ -40,7 +40,7 @@ var Input = React$1.forwardRef(({ className, htmlType = "text", placeholder, sta
|
|
|
40
40
|
if (!isHtmlTypePassword) return null;
|
|
41
41
|
return /* @__PURE__ */ jsx("button", {
|
|
42
42
|
type: "button",
|
|
43
|
-
className: "flex aspect-square
|
|
43
|
+
className: "flex aspect-square items-center justify-center rounded-full p-2 transition-colors hover:bg-neutral-50",
|
|
44
44
|
onClick: () => toggleType(),
|
|
45
45
|
children: type === "password" ? /* @__PURE__ */ jsx(EyeSlashIcon, {
|
|
46
46
|
size: 20,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["React"],"sources":["../../../../src/components/inputs/Input/Input.tsx"],"sourcesContent":["import { EyeIcon } from '@phosphor-icons/react/dist/ssr/Eye'\nimport { EyeSlashIcon } from '@phosphor-icons/react/dist/ssr/EyeSlash'\nimport { MinusIcon } from '@phosphor-icons/react/dist/ssr/Minus'\nimport { PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nexport type InputProps = {\n htmlType?: 'text' | 'tel' | 'email' | 'number' | 'password' | 'url'\n startContent?: React.ReactElement\n endContent?: React.ReactElement\n groupText?: string\n disabled?: boolean\n error?: boolean | string\n stepControls?: boolean\n inputClassName?: string\n /** Callback function executed when the clear button is clicked. When provided, an X button will appear on hover to clear the input. */\n onClear?: boolean | (() => void)\n} & React.InputHTMLAttributes<HTMLInputElement>\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n htmlType = 'text',\n placeholder,\n startContent,\n endContent,\n groupText,\n disabled,\n error,\n stepControls,\n value: controlledValue,\n onChange: controlledOnChange,\n inputClassName,\n onClear = true,\n ...props\n },\n ref,\n ) => {\n const isHtmlTypePassword = htmlType === 'password'\n const isHtmlTypeNumber = htmlType === 'number'\n const hasStepControls = stepControls && isHtmlTypeNumber\n\n const [type, setType] = React.useState(htmlType)\n const [internalValue, setInternalValue] = React.useState(controlledValue)\n const [isHovered, setIsHovered] = React.useState(false)\n\n React.useEffect(() => {\n setInternalValue(controlledValue)\n }, [controlledValue])\n\n const toggleType = () => {\n setType(type === 'password' ? 'text' : 'password')\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setInternalValue(event.target.value)\n if (controlledOnChange) {\n controlledOnChange(event)\n }\n }\n\n const handleStepChange = (increment: number) => {\n const currentValue = Number(internalValue ?? 0)\n const newValue = currentValue + increment\n if (newValue >= 0) {\n const event = {\n target: { value: newValue.toString() },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n }\n }\n\n const handleClear = () => {\n const event = {\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n\n if (typeof onClear === 'function') {\n onClear()\n }\n }\n\n const renderPasswordEye = () => {\n if (!isHtmlTypePassword) return null\n\n return (\n <button\n type=\"button\"\n className=\"flex aspect-square cursor-pointer items-center justify-center rounded-full p-2 transition-colors hover:bg-neutral-50\"\n onClick={() => toggleType()}\n >\n {type === 'password' ? (\n <EyeSlashIcon size={20} data-testid=\"password-eye-closed\" />\n ) : (\n <EyeIcon size={20} data-testid=\"password-eye-open\" />\n )}\n </button>\n )\n }\n\n const renderErrorIcon = () => {\n if (isHtmlTypePassword || !error || hasStepControls) return null\n return (\n <div>\n <WarningCircleIcon\n data-testid=\"exclaim-icon\"\n className={cn(\n 'text-error-500 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n size={18}\n />\n </div>\n )\n }\n\n const renderStepControlsIncrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(1)}\n className=\"p-2\"\n aria-label=\"Increment\"\n >\n <PlusIcon data-testid=\"increment-button\" />\n </button>\n )\n }\n\n const renderEndContent = () => {\n if (isHtmlTypePassword || error || hasStepControls || !endContent) return null\n return (\n <div\n className={cn(\n 'text-neutral-300 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n >\n {endContent}\n </div>\n )\n }\n\n const renderClearIcon = () => {\n if (disabled || hasStepControls || isHtmlTypePassword || !onClear) return null\n\n return (\n <div\n className={cn(\n 'absolute right-3 z-10 flex h-full w-10 items-center justify-end rounded-r-lg',\n !endContent && !error\n ? 'bg-linear-to-l from-white from-60% via-white/80 via-80% to-transparent transition-opacity duration-150'\n : 'bg-transparent',\n showClearIcon ? 'opacity-100' : 'opacity-0',\n )}\n >\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'h-4 w-4 shrink-0 cursor-pointer transition-opacity duration-150',\n showClearIcon ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onClick={handleClear}\n />\n </div>\n )\n }\n\n const renderStartContent = () => {\n if (!startContent) return null\n return <div className=\"text-neutral-300\">{startContent}</div>\n }\n\n const renderStepControlsDecrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(-1)}\n className=\"p-2\"\n aria-label=\"Decrement\"\n >\n <MinusIcon data-testid=\"decrement-button\" />\n </button>\n )\n }\n\n const hasValue = Boolean(internalValue && String(internalValue).trim() !== '')\n const showClearIcon = onClear && hasValue && isHovered && !disabled && !isHtmlTypePassword && !hasStepControls\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <div className=\"flex w-full items-center\">\n {groupText && (\n <div\n className={cn(\n 'flex h-12 items-center rounded-l-lg border-y border-l border-neutral-200 bg-neutral-50 pr-2 pl-4 text-neutral-300',\n )}\n >\n {groupText}\n </div>\n )}\n <div\n className={cn(\n 'relative flex h-12 w-full items-center rounded-lg border border-neutral-200 bg-white px-3 transition-colors focus-within:border-neutral-950',\n groupText && 'rounded-l-none',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 focus-within:border-error-700',\n className,\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {renderStartContent()}\n {renderStepControlsDecrement()}\n <input\n type={type}\n className={cn(\n 'w-full bg-transparent px-2 outline-0 transition-colors placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50',\n hasStepControls && 'text-center',\n inputClassName,\n )}\n ref={ref}\n onChange={handleChange}\n placeholder={placeholder}\n disabled={disabled}\n value={internalValue}\n onKeyDown={(event) => {\n if (isHtmlTypeNumber && (event.key === 'e' || event.key === 'E' || event.key === '-')) {\n event.preventDefault()\n }\n }}\n {...props}\n />\n {renderPasswordEye()}\n {renderClearIcon()}\n {renderErrorIcon()}\n {renderStepControlsIncrement()}\n {renderEndContent()}\n </div>\n </div>\n {typeof error === 'string' && <span className=\"text-error-500 text-sm\">{error}</span>}\n </div>\n )\n },\n)\nInput.displ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,CAAA;CAEZ;CAEA,MAAM,WAAW,QAAQ,iBAAiB,OAAO,aAAa,CAAC,CAAC,KAAK,MAAM,EAAE;CAC7E,MAAM,gBAAgB,WAAW,YAAY,aAAa,CAAC,YAAY,CAAC,sBAAsB,CAAC;CAE/F,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,aACC,oBAAC,OAAD;IACE,WAAW,GACT,mHACF;IAEC,UAAA;GACE,CAAA,GAEP,qBAAC,OAAD;IACE,WAAW,GACT,+IACA,aAAa,kBACb,YAAY,iBACZ,SAAS,kDACT,SACF;IACA,oBAAoB,aAAa,IAAI;IACrC,oBAAoB,aAAa,KAAK;IATxC,UAAA;KAWG,mBAAmB;KACnB,4BAA4B;KAC7B,oBAAC,SAAD;MACQ;MACN,WAAW,GACT,uIACA,mBAAmB,eACnB,cACF;MACK;MACL,UAAU;MACG;MACH;MACV,OAAO;MACP,YAAY,UAAU;OACpB,IAAI,qBAAqB,MAAM,QAAQ,OAAO,MAAM,QAAQ,OAAO,MAAM,QAAQ,MAC/E,MAAM,eAAe;MAEzB;MACA,GAAI;KACL,CAAA;KACA,kBAAkB;KAClB,gBAAgB;KAChB,gBAAgB;KAChB,4BAA4B;KAC5B,iBAAiB;IACf;GACF,CAAA,CAAA;EACJ,CAAA,GAAA,OAAO,UAAU,YAAY,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CACjF;;AAET,CACF;AACA,MAAM,cAAc"}
|
|
1
|
+
{"version":3,"file":"Input.js","names":["React"],"sources":["../../../../src/components/inputs/Input/Input.tsx"],"sourcesContent":["import { EyeIcon } from '@phosphor-icons/react/dist/ssr/Eye'\nimport { EyeSlashIcon } from '@phosphor-icons/react/dist/ssr/EyeSlash'\nimport { MinusIcon } from '@phosphor-icons/react/dist/ssr/Minus'\nimport { PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nexport type InputProps = {\n htmlType?: 'text' | 'tel' | 'email' | 'number' | 'password' | 'url'\n startContent?: React.ReactElement\n endContent?: React.ReactElement\n groupText?: string\n disabled?: boolean\n error?: boolean | string\n stepControls?: boolean\n inputClassName?: string\n /** Callback function executed when the clear button is clicked. When provided, an X button will appear on hover to clear the input. */\n onClear?: boolean | (() => void)\n} & React.InputHTMLAttributes<HTMLInputElement>\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n htmlType = 'text',\n placeholder,\n startContent,\n endContent,\n groupText,\n disabled,\n error,\n stepControls,\n value: controlledValue,\n onChange: controlledOnChange,\n inputClassName,\n onClear = true,\n ...props\n },\n ref,\n ) => {\n const isHtmlTypePassword = htmlType === 'password'\n const isHtmlTypeNumber = htmlType === 'number'\n const hasStepControls = stepControls && isHtmlTypeNumber\n\n const [type, setType] = React.useState(htmlType)\n const [internalValue, setInternalValue] = React.useState(controlledValue)\n const [isHovered, setIsHovered] = React.useState(false)\n\n React.useEffect(() => {\n setInternalValue(controlledValue)\n }, [controlledValue])\n\n const toggleType = () => {\n setType(type === 'password' ? 'text' : 'password')\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setInternalValue(event.target.value)\n if (controlledOnChange) {\n controlledOnChange(event)\n }\n }\n\n const handleStepChange = (increment: number) => {\n const currentValue = Number(internalValue ?? 0)\n const newValue = currentValue + increment\n if (newValue >= 0) {\n const event = {\n target: { value: newValue.toString() },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n }\n }\n\n const handleClear = () => {\n const event = {\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n\n if (typeof onClear === 'function') {\n onClear()\n }\n }\n\n const renderPasswordEye = () => {\n if (!isHtmlTypePassword) return null\n\n return (\n <button\n type=\"button\"\n className=\"flex aspect-square items-center justify-center rounded-full p-2 transition-colors hover:bg-neutral-50\"\n onClick={() => toggleType()}\n >\n {type === 'password' ? (\n <EyeSlashIcon size={20} data-testid=\"password-eye-closed\" />\n ) : (\n <EyeIcon size={20} data-testid=\"password-eye-open\" />\n )}\n </button>\n )\n }\n\n const renderErrorIcon = () => {\n if (isHtmlTypePassword || !error || hasStepControls) return null\n return (\n <div>\n <WarningCircleIcon\n data-testid=\"exclaim-icon\"\n className={cn(\n 'text-error-500 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n size={18}\n />\n </div>\n )\n }\n\n const renderStepControlsIncrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(1)}\n className=\"p-2\"\n aria-label=\"Increment\"\n >\n <PlusIcon data-testid=\"increment-button\" />\n </button>\n )\n }\n\n const renderEndContent = () => {\n if (isHtmlTypePassword || error || hasStepControls || !endContent) return null\n return (\n <div\n className={cn(\n 'text-neutral-300 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n >\n {endContent}\n </div>\n )\n }\n\n const renderClearIcon = () => {\n if (disabled || hasStepControls || isHtmlTypePassword || !onClear) return null\n\n return (\n <div\n className={cn(\n 'absolute right-3 z-10 flex h-full w-10 items-center justify-end rounded-r-lg',\n !endContent && !error\n ? 'bg-linear-to-l from-white from-60% via-white/80 via-80% to-transparent transition-opacity duration-150'\n : 'bg-transparent',\n showClearIcon ? 'opacity-100' : 'opacity-0',\n )}\n >\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'h-4 w-4 shrink-0 cursor-pointer transition-opacity duration-150',\n showClearIcon ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onClick={handleClear}\n />\n </div>\n )\n }\n\n const renderStartContent = () => {\n if (!startContent) return null\n return <div className=\"text-neutral-300\">{startContent}</div>\n }\n\n const renderStepControlsDecrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(-1)}\n className=\"p-2\"\n aria-label=\"Decrement\"\n >\n <MinusIcon data-testid=\"decrement-button\" />\n </button>\n )\n }\n\n const hasValue = Boolean(internalValue && String(internalValue).trim() !== '')\n const showClearIcon = onClear && hasValue && isHovered && !disabled && !isHtmlTypePassword && !hasStepControls\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <div className=\"flex w-full items-center\">\n {groupText && (\n <div\n className={cn(\n 'flex h-12 items-center rounded-l-lg border-y border-l border-neutral-200 bg-neutral-50 pr-2 pl-4 text-neutral-300',\n )}\n >\n {groupText}\n </div>\n )}\n <div\n className={cn(\n 'relative flex h-12 w-full items-center rounded-lg border border-neutral-200 bg-white px-3 transition-colors focus-within:border-neutral-950',\n groupText && 'rounded-l-none',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 focus-within:border-error-700',\n className,\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {renderStartContent()}\n {renderStepControlsDecrement()}\n <input\n type={type}\n className={cn(\n 'w-full bg-transparent px-2 outline-0 transition-colors placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50',\n hasStepControls && 'text-center',\n inputClassName,\n )}\n ref={ref}\n onChange={handleChange}\n placeholder={placeholder}\n disabled={disabled}\n value={internalValue}\n onKeyDown={(event) => {\n if (isHtmlTypeNumber && (event.key === 'e' || event.key === 'E' || event.key === '-')) {\n event.preventDefault()\n }\n }}\n {...props}\n />\n {renderPasswordEye()}\n {renderClearIcon()}\n {renderErrorIcon()}\n {renderStepControlsIncrement()}\n {renderEndContent()}\n </div>\n </div>\n {typeof error === 'string' && <span className=\"text-error-500 text-sm\">{error}</span>}\n </div>\n )\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,QAAQA,QAAM,YAEhB,EACE,WACA,WAAW,QACX,aACA,cACA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AgB,WAAW,YAAY,aAAa,CAAC,YAAY,CAAC,sBAAsB,CAAC;CAE/F,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,aACC,oBAAC,OAAD;IACE,WAAW,GACT,mHACF;IAEC,UAAA;GACE,CAAA,GAEP,qBAAC,OAAD;IACE,WAAW,GACT,+IACA,aAAa,kBACb,YAAY,iBACZ,SAAS,kDACT,SACF;IACA,oBAAoB,aAAa,IAAI;IACrC,oBAAoB,aAAa,KAAK;IATxC,UAAA;KAWG,mBAAmB;KACnB,4BAA4B;KAC7B,oBAAC,SAAD;MACQ;MACN,WAAW,GACT,uIACA,mBAAmB,eACnB,cACF;MACK;MACL,UAAU;MACG;MACH;MACV,OAAO;MACP,YAAY,UAAU;OACpB,IAAI,qBAAqB,MAAM,QAAQ,OAAO,MAAM,QAAQ,OAAO,MAAM,QAAQ,MAC/E,MAAM,eAAe;MAEzB;MACA,GAAI;KACL,CAAA;KACA,kBAAkB;KAClB,gBAAgB;KAChB,gBAAgB;KAChB,4BAA4B;KAC5B,iBAAiB;IACf;GACF,CAAA,CAAA;EACJ,CAAA,GAAA,OAAO,UAAU,YAAY,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CACjF;;AAET,CACF;AACA,MAAM,cAAc"}
|
|
@@ -115,7 +115,6 @@ var MultiSelect = React$1.forwardRef(({ options, onChange, chipProps, defaultVal
|
|
|
115
115
|
setSelected((prev) => [...prev, item]);
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
className: "cursor-pointer",
|
|
119
118
|
children: /* @__PURE__ */ jsxs("div", {
|
|
120
119
|
className: "flex",
|
|
121
120
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.js","names":["React"],"sources":["../../../../src/components/inputs/MultiSelect/MultiSelect.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport * as React from 'react'\nimport { ControllerFieldState } from 'react-hook-form'\n\nimport { Chip } from '../../data-display/Chip'\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { Button, buttonVariants } from '../Button'\n\nimport { cn } from '@/lib/utils'\n\n/**\n * Represents a selectable option in the MultiSelect component\n */\ntype Option = {\n /** Unique identifier for the option */\n value: string\n /** Display text for the option */\n label: string\n}\n\nexport type MultiSelectProps = {\n /**\n * Array of options to display in the select menu\n */\n options: Array<Option>\n\n /**\n * Props to be passed to the individual Chip components\n */\n chipProps?: React.ComponentProps<typeof Chip>\n\n /**\n * Callback fired when selected values change\n * @param value Array of selected option values\n */\n onChange?: (value: Array<string>) => void\n\n /**\n * Form field state from react-hook-form\n */\n fieldState?: ControllerFieldState\n\n /**\n * Initially selected option values\n */\n defaultValue?: Array<string>\n\n /**\n * Text shown in the select button when no option is selected\n * @default \"Select your options...\"\n */\n placeholder?: string\n\n /**\n * Text shown when no options match the search query\n * @default \"Options not found\"\n */\n notFoundText?: string\n\n /**\n * Placeholder text for the search input\n * @default \"Search...\"\n */\n commandInputPlaceholder?: string\n\n /**\n * Maximum number of items that can be selected\n * Shows a counter chip when specified\n */\n max?: number\n\n /**\n * Additional class names for the select button component\n */\n className?: string\n\n /**\n * Unique identifier for the select button component\n */\n id?: string\n}\n\n/**\n * A multi-select component with search functionality and chip display for selected items.\n * Supports keyboard navigation, search filtering, and maximum selection limit.\n *\n * @example\n * // Basic usage\n * <MultiSelect\n * options={[\n * { value: '1', label: 'Option 1' },\n * { value: '2', label: 'Option 2' }\n * ]}\n * onChange={(values) => console.log(values)}\n * />\n *\n * // With maximum selection limit\n * <MultiSelect\n * options={options}\n * max={3}\n * placeholder=\"Select up to 3 options\"\n * />\n *\n * // With custom chip styling\n * <MultiSelect\n * options={options}\n * chipProps={{ variant: 'primary' }}\n * />\n */\nexport const MultiSelect = React.forwardRef<HTMLInputElement, MultiSelectProps>(\n ({\n options,\n onChange,\n chipProps,\n defaultValue,\n placeholder = 'Select your options...',\n notFoundText = 'Options not found',\n fieldState,\n commandInputPlaceholder = 'Search...',\n max,\n className,\n id,\n }) => {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [open, setOpen] = React.useState(false)\n const [selected, setSelected] = React.useState<MultiSelectProps['options']>(\n options.filter((option) => defaultValue?.includes(option.value) ?? []),\n )\n const [inputValue, setInputValue] = React.useState('')\n\n const onChangeRef = React.useRef(onChange)\n React.useEffect(() => {\n onChangeRef.current = onChange\n })\n\n const handleUnselect = React.useCallback((item: Option) => {\n setSelected((prev) => prev.filter((selectedOption) => selectedOption.value !== item.value))\n }, [])\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (input) {\n if (event.key === 'Delete' || event.key === 'Backspace') {\n if (input.value === '') {\n setSelected((prev) => {\n const newSelected = [...prev]\n newSelected.pop()\n return newSelected\n })\n }\n }\n\n if (event.key === 'Escape') {\n input.blur()\n }\n }\n }, [])\n\n React.useEffect(() => {\n onChangeRef.current?.(selected.map((item) => item.value))\n }, [selected])\n\n return (\n <PopoverRoot open={open} onOpenChange={setOpen}>\n <Command onKeyDown={handleKeyDown}>\n <PopoverTrigger asChild>\n <Button\n id={id}\n variant=\"ghost\"\n role=\"combobox\"\n aria-expanded={open}\n className={cn(\n `w-full justify-between bg-white ${\n fieldState?.invalid ? 'border-error-400 focus-within:border-error-700' : ''\n }`,\n buttonVariants({ variant: 'ghost', size: 'lg' }),\n className,\n )}\n >\n {placeholder}\n <CaretUpDownIcon className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"px-0 py-0\">\n <CommandInput\n placeholder={commandInputPlaceholder}\n ref={inputRef}\n value={inputValue}\n onValueChange={setInputValue}\n >\n {max && (\n <Chip\n variant={selected.length >= max ? 'primary' : 'default'}\n size=\"sm\"\n className=\"my-1 whitespace-nowrap\"\n >\n {selected.length} / {max}\n </Chip>\n )}\n </CommandInput>\n\n <CommandList>\n <CommandEmpty>{notFoundText}</CommandEmpty>\n {open && options.length > 0 && (\n <CommandGroup>\n {options.map((item) => (\n <CommandItem\n key={`item-${item.value}`}\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onSelect={(value) => {\n const isSelected = selected.find((selectedOption) => selectedOption.label === value)\n if (isSelected) {\n handleUnselect(isSelected)\n } else if (!max || selected.length < max) {\n setInputValue('')\n setSelected((prev) => [...prev, item])\n }\n }}\n className=\"cursor-pointer\"\n >\n <div className=\"flex\">\n <div className=\"mr-2\">\n {selected.some((selectedOption) => selectedOption.value === item.value) ? (\n <CheckIcon className=\"h-4 w-4\" />\n ) : (\n <div className=\"h-4 w-4\" />\n )}\n </div>\n <div>{item.label}</div>\n </div>\n </CommandItem>\n ))}\n </CommandGroup>\n )}\n </CommandList>\n </PopoverContent>\n {selected.length > 0 && (\n <div className=\"flex flex-wrap gap-2 pt-2\">\n {selected.map((item) => (\n <Chip key={item.value} {...chipProps} className=\"gap-2 pr-1\" onRemove={() => handleUnselect(item)}>\n {item.label}\n </Chip>\n ))}\n </div>\n )}\n </Command>\n </PopoverRoot>\n )\n },\n)\n\nMultiSelect.displayName = 'MultiSelect'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,IAAA,cAAA,QAAA,YAAA,EAAA,SAAA,UAAA,WAAA,cAAA,cAAA,0BAAA,eAAA,qBAAA,YAAA,0BAAA,aAAA,KAAA,WAAA,SAAA;CAcI,MAAA,WAAA,QAAA,OAAA,IAAA;CACA,MAAA,CAAA,MAAA,WAAA,QAAA,SAAA,KAAA;CACA,MAAA,CAAA,UAAA,eAAA,QAAA,SAAA,Q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","names":["React"],"sources":["../../../../src/components/inputs/MultiSelect/MultiSelect.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport * as React from 'react'\nimport { ControllerFieldState } from 'react-hook-form'\n\nimport { Chip } from '../../data-display/Chip'\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { Button, buttonVariants } from '../Button'\n\nimport { cn } from '@/lib/utils'\n\n/**\n * Represents a selectable option in the MultiSelect component\n */\ntype Option = {\n /** Unique identifier for the option */\n value: string\n /** Display text for the option */\n label: string\n}\n\nexport type MultiSelectProps = {\n /**\n * Array of options to display in the select menu\n */\n options: Array<Option>\n\n /**\n * Props to be passed to the individual Chip components\n */\n chipProps?: React.ComponentProps<typeof Chip>\n\n /**\n * Callback fired when selected values change\n * @param value Array of selected option values\n */\n onChange?: (value: Array<string>) => void\n\n /**\n * Form field state from react-hook-form\n */\n fieldState?: ControllerFieldState\n\n /**\n * Initially selected option values\n */\n defaultValue?: Array<string>\n\n /**\n * Text shown in the select button when no option is selected\n * @default \"Select your options...\"\n */\n placeholder?: string\n\n /**\n * Text shown when no options match the search query\n * @default \"Options not found\"\n */\n notFoundText?: string\n\n /**\n * Placeholder text for the search input\n * @default \"Search...\"\n */\n commandInputPlaceholder?: string\n\n /**\n * Maximum number of items that can be selected\n * Shows a counter chip when specified\n */\n max?: number\n\n /**\n * Additional class names for the select button component\n */\n className?: string\n\n /**\n * Unique identifier for the select button component\n */\n id?: string\n}\n\n/**\n * A multi-select component with search functionality and chip display for selected items.\n * Supports keyboard navigation, search filtering, and maximum selection limit.\n *\n * @example\n * // Basic usage\n * <MultiSelect\n * options={[\n * { value: '1', label: 'Option 1' },\n * { value: '2', label: 'Option 2' }\n * ]}\n * onChange={(values) => console.log(values)}\n * />\n *\n * // With maximum selection limit\n * <MultiSelect\n * options={options}\n * max={3}\n * placeholder=\"Select up to 3 options\"\n * />\n *\n * // With custom chip styling\n * <MultiSelect\n * options={options}\n * chipProps={{ variant: 'primary' }}\n * />\n */\nexport const MultiSelect = React.forwardRef<HTMLInputElement, MultiSelectProps>(\n ({\n options,\n onChange,\n chipProps,\n defaultValue,\n placeholder = 'Select your options...',\n notFoundText = 'Options not found',\n fieldState,\n commandInputPlaceholder = 'Search...',\n max,\n className,\n id,\n }) => {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [open, setOpen] = React.useState(false)\n const [selected, setSelected] = React.useState<MultiSelectProps['options']>(\n options.filter((option) => defaultValue?.includes(option.value) ?? []),\n )\n const [inputValue, setInputValue] = React.useState('')\n\n const onChangeRef = React.useRef(onChange)\n React.useEffect(() => {\n onChangeRef.current = onChange\n })\n\n const handleUnselect = React.useCallback((item: Option) => {\n setSelected((prev) => prev.filter((selectedOption) => selectedOption.value !== item.value))\n }, [])\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (input) {\n if (event.key === 'Delete' || event.key === 'Backspace') {\n if (input.value === '') {\n setSelected((prev) => {\n const newSelected = [...prev]\n newSelected.pop()\n return newSelected\n })\n }\n }\n\n if (event.key === 'Escape') {\n input.blur()\n }\n }\n }, [])\n\n React.useEffect(() => {\n onChangeRef.current?.(selected.map((item) => item.value))\n }, [selected])\n\n return (\n <PopoverRoot open={open} onOpenChange={setOpen}>\n <Command onKeyDown={handleKeyDown}>\n <PopoverTrigger asChild>\n <Button\n id={id}\n variant=\"ghost\"\n role=\"combobox\"\n aria-expanded={open}\n className={cn(\n `w-full justify-between bg-white ${\n fieldState?.invalid ? 'border-error-400 focus-within:border-error-700' : ''\n }`,\n buttonVariants({ variant: 'ghost', size: 'lg' }),\n className,\n )}\n >\n {placeholder}\n <CaretUpDownIcon className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"px-0 py-0\">\n <CommandInput\n placeholder={commandInputPlaceholder}\n ref={inputRef}\n value={inputValue}\n onValueChange={setInputValue}\n >\n {max && (\n <Chip\n variant={selected.length >= max ? 'primary' : 'default'}\n size=\"sm\"\n className=\"my-1 whitespace-nowrap\"\n >\n {selected.length} / {max}\n </Chip>\n )}\n </CommandInput>\n\n <CommandList>\n <CommandEmpty>{notFoundText}</CommandEmpty>\n {open && options.length > 0 && (\n <CommandGroup>\n {options.map((item) => (\n <CommandItem\n key={`item-${item.value}`}\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onSelect={(value) => {\n const isSelected = selected.find((selectedOption) => selectedOption.label === value)\n if (isSelected) {\n handleUnselect(isSelected)\n } else if (!max || selected.length < max) {\n setInputValue('')\n setSelected((prev) => [...prev, item])\n }\n }}\n >\n <div className=\"flex\">\n <div className=\"mr-2\">\n {selected.some((selectedOption) => selectedOption.value === item.value) ? (\n <CheckIcon className=\"h-4 w-4\" />\n ) : (\n <div className=\"h-4 w-4\" />\n )}\n </div>\n <div>{item.label}</div>\n </div>\n </CommandItem>\n ))}\n </CommandGroup>\n )}\n </CommandList>\n </PopoverContent>\n {selected.length > 0 && (\n <div className=\"flex flex-wrap gap-2 pt-2\">\n {selected.map((item) => (\n <Chip key={item.value} {...chipProps} className=\"gap-2 pr-1\" onRemove={() => handleUnselect(item)}>\n {item.label}\n </Chip>\n ))}\n </div>\n )}\n </Command>\n </PopoverRoot>\n )\n },\n)\n\nMultiSelect.displayName = 'MultiSelect'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,IAAA,cAAA,QAAA,YAAA,EAAA,SAAA,UAAA,WAAA,cAAA,cAAA,0BAAA,eAAA,qBAAA,YAAA,0BAAA,aAAA,KAAA,WAAA,SAAA;CAcI,MAAA,WAAA,QAAA,OAAA,IAAA;CACA,MAAA,CAAA,MAAA,WAAA,QAAA,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,cAAA"}
|
|
@@ -104,7 +104,7 @@ function PhoneInput(props) {
|
|
|
104
104
|
id: id ? `${id}-country` : void 0,
|
|
105
105
|
disabled: prefixDisabled,
|
|
106
106
|
"aria-label": selectedOption ? resolveName(selectedOption) : countryAriaLabel,
|
|
107
|
-
className: cn("flex shrink-0 items-center gap-1.5 border-r border-neutral-200 px-3 text-base text-neutral-950 transition-colors outline-none", options.length > 1 && "w-28", !prefixDisabled && "
|
|
107
|
+
className: cn("flex shrink-0 items-center gap-1.5 border-r border-neutral-200 px-3 text-base text-neutral-950 transition-colors outline-none", options.length > 1 && "w-28", !prefixDisabled && "hover:bg-neutral-50", prefixDisabled && "cursor-not-allowed", disabled && "opacity-50"),
|
|
108
108
|
children: [selectedOption ? /* @__PURE__ */ jsxs(Fragment, { children: [renderFlag(selectedOption), /* @__PURE__ */ jsx("span", {
|
|
109
109
|
className: "tabular-nums",
|
|
110
110
|
children: resolveDialCode(selectedOption)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/PhoneInput/PhoneInput.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { GlobeIcon } from '@phosphor-icons/react/dist/ssr/Globe'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport * as React from 'react'\n\nimport { Flag } from '../../data-display/Flag'\nimport { Command, CommandInput } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { VirtualizedComboboxList } from '../Combobox'\n\nimport { usePhoneField } from './hooks'\nimport { exampleNational } from './phone'\nimport type { PhoneCountry, PhoneInputCountryAccessors, PhoneValue } from './types'\n\nimport { buildCountries, splitByPriority } from '@/lib/countries'\nimport { useListScroll } from '@/lib/useListScroll'\nimport { cn, createSearchMatcher } from '@/lib/utils'\n\ntype PhoneInputBaseProps = {\n /** Lands on the number input, so `<label htmlFor>` targets it. */\n id?: string\n name?: string\n className?: string\n disabled?: boolean\n error?: boolean\n inputRef?: React.Ref<HTMLInputElement>\n /** Controlled when set, otherwise seeded by `defaultCountry`. */\n country?: string\n /** National digits, no country code or separators. */\n number?: string\n onChange?: (value: PhoneValue) => void\n /** ISO code, used when `country` is uncontrolled. */\n defaultCountry?: string\n /** ISO codes pinned above the list, in order. */\n priorityCountries?: Array<string>\n numberInputProps?: Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'id' | 'name' | 'disabled' | 'value' | 'onChange' | 'onKeyDown' | 'className'\n >\n /** Defaults to the country's example number. */\n placeholder?: string\n countryAriaLabel?: string\n searchPlaceholder?: string\n emptyMessage?: string\n 'aria-describedby'?: string\n 'aria-invalid'?: boolean\n}\n\ntype ResolvedPhoneInputProps<T extends object> = PhoneInputBaseProps &\n Partial<PhoneInputCountryAccessors<T>> & {\n /** Defaults to the generated list. */\n countries?: Array<T>\n /** Names the generated list. Ignored when `countries` is passed. */\n locale?: string\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputDefaultProps = ResolvedPhoneInputProps<PhoneCountry>\n\nexport type PhoneInputCustomProps<T extends object> = PhoneInputBaseProps &\n PhoneInputCountryAccessors<T> & {\n countries: Array<T>\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputProps<T extends object = PhoneCountry> = PhoneInputDefaultProps | PhoneInputCustomProps<T>\n\nconst defaultAccessors: PhoneInputCountryAccessors<PhoneCountry> = {\n getCountryValue: (country) => country.isoCode,\n getCountryIsoCode: (country) => country.isoCode,\n getCountryDialCode: (country) => country.dialCode,\n getCountryFlag: (country) => country.flag,\n getCountryName: (country) => country.name,\n}\n\nexport function PhoneInput(props: PhoneInputDefaultProps): React.ReactElement\nexport function PhoneInput<T extends object>(props: PhoneInputCustomProps<T>): React.ReactElement\nexport function PhoneInput<T extends object>(props: ResolvedPhoneInputProps<T>): React.ReactElement {\n const {\n id,\n name,\n className,\n disabled = false,\n error = false,\n inputRef: externalInputRef,\n countries,\n country,\n onChange,\n number,\n defaultCountry,\n priorityCountries,\n locale = 'en',\n numberInputProps,\n placeholder,\n countryAriaLabel = 'Select country',\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n getCountryValue,\n getCountryIsoCode,\n getCountryDialCode,\n getCountryFlag,\n getCountryName,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n } = props\n\n const defaults = defaultAccessors as unknown as PhoneInputCountryAccessors<T>\n const options = countries ?? (buildCountries(locale) as unknown as Array<T>)\n const resolveValue = getCountryValue ?? defaults.getCountryValue\n const resolveIsoCode = getCountryIsoCode ?? defaults.getCountryIsoCode\n const resolveDialCode = getCountryDialCode ?? defaults.getCountryDialCode\n const resolveFlag = getCountryFlag ?? defaults.getCountryFlag\n const resolveName = getCountryName ?? defaults.getCountryName\n\n const {\n isoOf,\n selectedValue,\n selectedOption,\n selectedIso,\n displayValue,\n inputElRef,\n selectCountry,\n onInputChange,\n onInputKeyDown,\n } = usePhoneField({\n options,\n getCountryValue: resolveValue,\n getCountryDialCode: resolveDialCode,\n getCountryIsoCode: resolveIsoCode,\n country,\n number,\n onChange,\n defaultCountry,\n priorityCountries,\n })\n\n const [open, setOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const listRef = useListScroll({ open, searchTerm: search, selectedValue: undefined })\n\n const renderFlag = (option: T) => {\n const iso = isoOf(option)\n return iso ? <Flag iso={iso} /> : <span className=\"text-lg leading-none\">{resolveFlag(option)}</span>\n }\n\n const prefixDisabled = disabled || options.length <= 1\n\n const matches = createSearchMatcher(search)\n const filteredOptions = search.trim()\n ? options.filter((option) => matches([resolveName(option), resolveDialCode(option), isoOf(option) ?? '']))\n : options\n const { priority: priorityOptions, rest: restOptions } = splitByPriority(filteredOptions, priorityCountries, isoOf)\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next)\n if (!next) setSearch('')\n }\n\n const handleSelect = (value: string) => {\n const option = filteredOptions.find((candidate) => resolveValue(candidate) === value)\n if (option) selectCountry(option)\n handleOpenChange(false)\n }\n\n const renderOption = (option: T, isSelected: boolean) => (\n <>\n {renderFlag(option)}\n <span className=\"shrink-0 text-neutral-500\">{resolveDialCode(option)}</span>\n <span className=\"truncate\">{resolveName(option)}</span>\n {isSelected && (\n <CheckIcon data-testid=\"selected-check\" weight=\"bold\" className=\"ml-auto h-4 w-4 shrink-0 text-neutral-950\" />\n )}\n </>\n )\n\n return (\n <div className={cn('flex w-full flex-col gap-1', className)}>\n <div\n data-testid=\"phone-input-shell\"\n className={cn(\n 'flex h-12 w-full items-stretch overflow-hidden rounded-lg border border-neutral-200 bg-white transition-colors has-[input:focus]:border-neutral-950',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 has-[input:focus]:border-error-700',\n )}\n >\n <PopoverRoot open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n id={id ? `${id}-country` : undefined}\n disabled={prefixDisabled}\n aria-label={selectedOption ? resolveName(selectedOption) : countryAriaLabel}\n className={cn(\n 'flex shrink-0 items-center gap-1.5 border-r border-neutral-200 px-3 text-base text-neutral-950 transition-colors outline-none',\n options.length > 1 && 'w-28',\n !prefixDisabled && 'cursor-pointer hover:bg-neutral-50',\n prefixDisabled && 'cursor-not-allowed',\n disabled && 'opacity-50',\n )}\n >\n {selectedOption ? (\n <>\n {renderFlag(selectedOption)}\n <span className=\"tabular-nums\">{resolveDialCode(selectedOption)}</span>\n </>\n ) : (\n <GlobeIcon className=\"h-5 w-5 text-neutral-300\" aria-hidden />\n )}\n {!prefixDisabled && <CaretDownIcon className=\"ml-auto h-4 w-4 shrink-0 opacity-50\" />}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-72 overflow-hidden p-0\">\n <Command shouldFilter={false} defaultValue={selectedValue}>\n <CommandInput placeholder={searchPlaceholder} value={search} onValueChange={setSearch} />\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={restOptions}\n specialOptions={priorityOptions}\n loading={false}\n loadingPlaceholder=\"\"\n emptyMessage={emptyMessage}\n value={selectedValue}\n getOptionValue={resolveValue}\n getOptionLabel={resolveName}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={300}\n />\n </Command>\n </PopoverContent>\n </PopoverRoot>\n\n <input\n /* eslint-disable react-hooks/immutability -- merging the internal ref with the caller-supplied `inputRef` is the standard ref-forwarding idiom */\n ref={(el) => {\n inputElRef.current = el\n if (typeof externalInputRef === 'function') externalInputRef(el)\n else if (externalInputRef) externalInputRef.current = el\n }}\n /* eslint-enable react-hooks/immutability */\n id={id}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n disabled={disabled}\n value={displayValue}\n onChange={onInputChange}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder ?? exampleNational(selectedIso)}\n aria-invalid={ariaInvalid ?? (error || undefined)}\n aria-describedby={ariaDescribedBy}\n className=\"min-w-0 flex-1 bg-transparent px-3 text-base text-neutral-950 outline-none placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50\"\n {...numberInputProps}\n />\n\n {error && (\n <div className=\"flex items-center pr-3\">\n <WarningCircleIcon data-testid=\"exclaim-icon\" className=\"text-error-500\" size={18} />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nPhoneInput.displayName = 'PhoneInput'\n"],"mappings":";;;;;;;;;;;;;;;;AAoEA,IAAM,mBAA6D;CACjE,kBAAkB,YAAY,QAAQ;CACtC,oBAAoB,YAAY,QAAQ;CACxC,qBAAqB,YAAY,QAAQ;CACzC,iBAAiB,YAAY,QAAQ;CACrC,iBAAiB,YAAY,QAAQ;AACvC;AAIA,SAAgB,WAA6B,OAAuD;CAClG,MAAM,EACJ,IACA,MACA,WACA,WAAW,OACX,QAAQ,OACR,UAAU,kBACV,WACA,SACA,UACA,QACA,gBACA,mBACA,SAAS,MACT,kBACA,aACA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BAAD;MAAgB,OAAM;MAAQ,WAAU;MACtC,UAAA,qBAAC,SAAD;OAAS,cAAc;OAAO,cAAc;OAA5C,UAAA,CACE,oBAAC,cAAD;QAAc,aAAa;QAAmB,OAAO;QAAQ,eAAe;OAAY,CAAA,GACxF,oBAAC,yBAAD;QACW;QACT,cAAc;QACd,gBAAgB;QAChB,SAAS;QACT,oBAAmB;QACL;QACd,OAAO;QACP,gBAAgB;QAChB,gBAAgB;QACF;QACA;QACd,WAAW;OACZ,CAAA,CACM;;KACK,CAAA,CACL;;IAEb,oBAAC,SAAD;KAEE,MAAM,OAAO;MACX,WAAW,UAAU;MACrB,IAAI,OAAO,qBAAqB,YAAY,iBAAiB,EAAE;WAC1D,IAAI,kBAAkB,iBAAiB,UAAU;KACxD;KAEI;KACE;KACN,MAAK;KACL,WAAU;KACV,cAAa;KACH;KACV,OAAO;KACP,UAAU;KACV,WAAW;KACX,aAAa,eAAe,gBAAgB,WAAW;KACvD,gBAAc,gBAAgB,SAAS,KAAA;KACvC,oBAAkB;KAClB,WAAU;KACV,GAAI;IACL,CAAA;IAEA,SACC,oBAAC,OAAD;KAAK,WAAU;KACb,UAAA,oBAAC,mBAAD;MAAmB,eAAY;MAAe,WAAU;MAAiB,MAAM;KAAK,CAAA;IACjF,CAAA;GAEJ;;CACF,CAAA;AAET;AAEA,WAAW,cAAc"}
|
|
1
|
+
{"version":3,"file":"PhoneInput.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/PhoneInput/PhoneInput.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { GlobeIcon } from '@phosphor-icons/react/dist/ssr/Globe'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport * as React from 'react'\n\nimport { Flag } from '../../data-display/Flag'\nimport { Command, CommandInput } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { VirtualizedComboboxList } from '../Combobox'\n\nimport { usePhoneField } from './hooks'\nimport { exampleNational } from './phone'\nimport type { PhoneCountry, PhoneInputCountryAccessors, PhoneValue } from './types'\n\nimport { buildCountries, splitByPriority } from '@/lib/countries'\nimport { useListScroll } from '@/lib/useListScroll'\nimport { cn, createSearchMatcher } from '@/lib/utils'\n\ntype PhoneInputBaseProps = {\n /** Lands on the number input, so `<label htmlFor>` targets it. */\n id?: string\n name?: string\n className?: string\n disabled?: boolean\n error?: boolean\n inputRef?: React.Ref<HTMLInputElement>\n /** Controlled when set, otherwise seeded by `defaultCountry`. */\n country?: string\n /** National digits, no country code or separators. */\n number?: string\n onChange?: (value: PhoneValue) => void\n /** ISO code, used when `country` is uncontrolled. */\n defaultCountry?: string\n /** ISO codes pinned above the list, in order. */\n priorityCountries?: Array<string>\n numberInputProps?: Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'id' | 'name' | 'disabled' | 'value' | 'onChange' | 'onKeyDown' | 'className'\n >\n /** Defaults to the country's example number. */\n placeholder?: string\n countryAriaLabel?: string\n searchPlaceholder?: string\n emptyMessage?: string\n 'aria-describedby'?: string\n 'aria-invalid'?: boolean\n}\n\ntype ResolvedPhoneInputProps<T extends object> = PhoneInputBaseProps &\n Partial<PhoneInputCountryAccessors<T>> & {\n /** Defaults to the generated list. */\n countries?: Array<T>\n /** Names the generated list. Ignored when `countries` is passed. */\n locale?: string\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputDefaultProps = ResolvedPhoneInputProps<PhoneCountry>\n\nexport type PhoneInputCustomProps<T extends object> = PhoneInputBaseProps &\n PhoneInputCountryAccessors<T> & {\n countries: Array<T>\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputProps<T extends object = PhoneCountry> = PhoneInputDefaultProps | PhoneInputCustomProps<T>\n\nconst defaultAccessors: PhoneInputCountryAccessors<PhoneCountry> = {\n getCountryValue: (country) => country.isoCode,\n getCountryIsoCode: (country) => country.isoCode,\n getCountryDialCode: (country) => country.dialCode,\n getCountryFlag: (country) => country.flag,\n getCountryName: (country) => country.name,\n}\n\nexport function PhoneInput(props: PhoneInputDefaultProps): React.ReactElement\nexport function PhoneInput<T extends object>(props: PhoneInputCustomProps<T>): React.ReactElement\nexport function PhoneInput<T extends object>(props: ResolvedPhoneInputProps<T>): React.ReactElement {\n const {\n id,\n name,\n className,\n disabled = false,\n error = false,\n inputRef: externalInputRef,\n countries,\n country,\n onChange,\n number,\n defaultCountry,\n priorityCountries,\n locale = 'en',\n numberInputProps,\n placeholder,\n countryAriaLabel = 'Select country',\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n getCountryValue,\n getCountryIsoCode,\n getCountryDialCode,\n getCountryFlag,\n getCountryName,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n } = props\n\n const defaults = defaultAccessors as unknown as PhoneInputCountryAccessors<T>\n const options = countries ?? (buildCountries(locale) as unknown as Array<T>)\n const resolveValue = getCountryValue ?? defaults.getCountryValue\n const resolveIsoCode = getCountryIsoCode ?? defaults.getCountryIsoCode\n const resolveDialCode = getCountryDialCode ?? defaults.getCountryDialCode\n const resolveFlag = getCountryFlag ?? defaults.getCountryFlag\n const resolveName = getCountryName ?? defaults.getCountryName\n\n const {\n isoOf,\n selectedValue,\n selectedOption,\n selectedIso,\n displayValue,\n inputElRef,\n selectCountry,\n onInputChange,\n onInputKeyDown,\n } = usePhoneField({\n options,\n getCountryValue: resolveValue,\n getCountryDialCode: resolveDialCode,\n getCountryIsoCode: resolveIsoCode,\n country,\n number,\n onChange,\n defaultCountry,\n priorityCountries,\n })\n\n const [open, setOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const listRef = useListScroll({ open, searchTerm: search, selectedValue: undefined })\n\n const renderFlag = (option: T) => {\n const iso = isoOf(option)\n return iso ? <Flag iso={iso} /> : <span className=\"text-lg leading-none\">{resolveFlag(option)}</span>\n }\n\n const prefixDisabled = disabled || options.length <= 1\n\n const matches = createSearchMatcher(search)\n const filteredOptions = search.trim()\n ? options.filter((option) => matches([resolveName(option), resolveDialCode(option), isoOf(option) ?? '']))\n : options\n const { priority: priorityOptions, rest: restOptions } = splitByPriority(filteredOptions, priorityCountries, isoOf)\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next)\n if (!next) setSearch('')\n }\n\n const handleSelect = (value: string) => {\n const option = filteredOptions.find((candidate) => resolveValue(candidate) === value)\n if (option) selectCountry(option)\n handleOpenChange(false)\n }\n\n const renderOption = (option: T, isSelected: boolean) => (\n <>\n {renderFlag(option)}\n <span className=\"shrink-0 text-neutral-500\">{resolveDialCode(option)}</span>\n <span className=\"truncate\">{resolveName(option)}</span>\n {isSelected && (\n <CheckIcon data-testid=\"selected-check\" weight=\"bold\" className=\"ml-auto h-4 w-4 shrink-0 text-neutral-950\" />\n )}\n </>\n )\n\n return (\n <div className={cn('flex w-full flex-col gap-1', className)}>\n <div\n data-testid=\"phone-input-shell\"\n className={cn(\n 'flex h-12 w-full items-stretch overflow-hidden rounded-lg border border-neutral-200 bg-white transition-colors has-[input:focus]:border-neutral-950',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 has-[input:focus]:border-error-700',\n )}\n >\n <PopoverRoot open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n id={id ? `${id}-country` : undefined}\n disabled={prefixDisabled}\n aria-label={selectedOption ? resolveName(selectedOption) : countryAriaLabel}\n className={cn(\n 'flex shrink-0 items-center gap-1.5 border-r border-neutral-200 px-3 text-base text-neutral-950 transition-colors outline-none',\n options.length > 1 && 'w-28',\n !prefixDisabled && 'hover:bg-neutral-50',\n prefixDisabled && 'cursor-not-allowed',\n disabled && 'opacity-50',\n )}\n >\n {selectedOption ? (\n <>\n {renderFlag(selectedOption)}\n <span className=\"tabular-nums\">{resolveDialCode(selectedOption)}</span>\n </>\n ) : (\n <GlobeIcon className=\"h-5 w-5 text-neutral-300\" aria-hidden />\n )}\n {!prefixDisabled && <CaretDownIcon className=\"ml-auto h-4 w-4 shrink-0 opacity-50\" />}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-72 overflow-hidden p-0\">\n <Command shouldFilter={false} defaultValue={selectedValue}>\n <CommandInput placeholder={searchPlaceholder} value={search} onValueChange={setSearch} />\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={restOptions}\n specialOptions={priorityOptions}\n loading={false}\n loadingPlaceholder=\"\"\n emptyMessage={emptyMessage}\n value={selectedValue}\n getOptionValue={resolveValue}\n getOptionLabel={resolveName}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={300}\n />\n </Command>\n </PopoverContent>\n </PopoverRoot>\n\n <input\n /* eslint-disable react-hooks/immutability -- merging the internal ref with the caller-supplied `inputRef` is the standard ref-forwarding idiom */\n ref={(el) => {\n inputElRef.current = el\n if (typeof externalInputRef === 'function') externalInputRef(el)\n else if (externalInputRef) externalInputRef.current = el\n }}\n /* eslint-enable react-hooks/immutability */\n id={id}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n disabled={disabled}\n value={displayValue}\n onChange={onInputChange}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder ?? exampleNational(selectedIso)}\n aria-invalid={ariaInvalid ?? (error || undefined)}\n aria-describedby={ariaDescribedBy}\n className=\"min-w-0 flex-1 bg-transparent px-3 text-base text-neutral-950 outline-none placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50\"\n {...numberInputProps}\n />\n\n {error && (\n <div className=\"flex items-center pr-3\">\n <WarningCircleIcon data-testid=\"exclaim-icon\" className=\"text-error-500\" size={18} />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nPhoneInput.displayName = 'PhoneInput'\n"],"mappings":";;;;;;;;;;;;;;;;AAoEA,IAAM,mBAA6D;CACjE,kBAAkB,YAAY,QAAQ;CACtC,oBAAoB,YAAY,QAAQ;CACxC,qBAAqB,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AAM,WAAU;QAAgB,UAAA,gBAAgB,cAAc;OAAQ,CAAA,CACtE,EAAA,CAAA,IAEF,oBAAC,WAAD;QAAW,WAAU;QAA2B,eAAA;OAAa,CAAA,GAE9D,CAAC,kBAAkB,oBAAC,eAAD,EAAe,WAAU,sCAAuC,CAAA,CAC9E;;KACM,CAAA,GAChB,oBAAC,gBAAD;MAAgB,OAAM;MAAQ,WAAU;MACtC,UAAA,qBAAC,SAAD;OAAS,cAAc;OAAO,cAAc;OAA5C,UAAA,CACE,oBAAC,cAAD;QAAc,aAAa;QAAmB,OAAO;QAAQ,eAAe;OAAY,CAAA,GACxF,oBAAC,yBAAD;QACW;QACT,cAAc;QACd,gBAAgB;QAChB,SAAS;QACT,oBAAmB;QACL;QACd,OAAO;QACP,gBAAgB;QAChB,gBAAgB;QACF;QACA;QACd,WAAW;OACZ,CAAA,CACM;;KACK,CAAA,CACL;;IAEb,oBAAC,SAAD;KAEE,MAAM,OAAO;MACX,WAAW,UAAU;MACrB,IAAI,OAAO,qBAAqB,YAAY,iBAAiB,EAAE;WAC1D,IAAI,kBAAkB,iBAAiB,UAAU;KACxD;KAEI;KACE;KACN,MAAK;KACL,WAAU;KACV,cAAa;KACH;KACV,OAAO;KACP,UAAU;KACV,WAAW;KACX,aAAa,eAAe,gBAAgB,WAAW;KACvD,gBAAc,gBAAgB,SAAS,KAAA;KACvC,oBAAkB;KAClB,WAAU;KACV,GAAI;IACL,CAAA;IAEA,SACC,oBAAC,OAAD;KAAK,WAAU;KACb,UAAA,oBAAC,mBAAD;MAAmB,eAAY;MAAe,WAAU;MAAiB,MAAM;KAAK,CAAA;IACjF,CAAA;GAEJ;;CACF,CAAA;AAET;AAEA,WAAW,cAAc"}
|
|
@@ -39,13 +39,13 @@ var SelectContent = React$1.forwardRef(({ className, children, position = "poppe
|
|
|
39
39
|
children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
|
|
40
40
|
ref,
|
|
41
41
|
sideOffset: 4,
|
|
42
|
-
className: cn("text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-
|
|
42
|
+
className: cn("text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height,300px) min-w-32 overflow-hidden rounded-md border bg-[#fff] shadow-md", className),
|
|
43
43
|
position,
|
|
44
44
|
...props,
|
|
45
45
|
children: [
|
|
46
46
|
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
47
47
|
/* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
|
|
48
|
-
className: cn("p-1", position === "popper" && "w-
|
|
48
|
+
className: cn("p-1", position === "popper" && "w-(--radix-select-trigger-width) md:w-auto md:min-w-(--radix-select-trigger-width)"),
|
|
49
49
|
children
|
|
50
50
|
}),
|
|
51
51
|
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
@@ -61,7 +61,7 @@ var SelectLabel = React$1.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
61
61
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
62
62
|
var SelectItem = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
63
63
|
ref,
|
|
64
|
-
className: cn("focus:text-accent-foreground relative flex w-full
|
|
64
|
+
className: cn("focus:text-accent-foreground relative flex w-full items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50", className),
|
|
65
65
|
...props,
|
|
66
66
|
children: [/* @__PURE__ */ jsx("span", {
|
|
67
67
|
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
@@ -122,7 +122,7 @@ function Select({ onValueChange, defaultValue, value, options, placeholder, clas
|
|
|
122
122
|
value: option.value,
|
|
123
123
|
"data-testid": option.value,
|
|
124
124
|
textValue: typeof option.label === "string" ? option.label : void 0,
|
|
125
|
-
className: "focus:text-accent-foreground relative flex w-full
|
|
125
|
+
className: "focus:text-accent-foreground relative flex w-full items-start rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
126
126
|
children: [/* @__PURE__ */ jsx("span", {
|
|
127
127
|
className: "hidden",
|
|
128
128
|
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children: option.label })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["React"],"sources":["../../../../src/components/inputs/Select/Select.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { CaretUpIcon } from '@phosphor-icons/react/dist/ssr/CaretUp'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport * as SelectPrimitive from '@radix-ui/react-select'\nimport * as React from 'react'\n\nimport { buttonVariants } from '../Button'\n\nimport { cn } from '@/lib/utils'\n\nconst SelectRoot = SelectPrimitive.Root\n\nconst SelectGroup = SelectPrimitive.Group\n\nconst SelectValue = SelectPrimitive.Value\n\nconst SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger ref={ref} className={className} {...props}>\n {children}\n <SelectPrimitive.Icon asChild>\n <CaretDownIcon className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n))\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <CaretUpIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n))\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <CaretDownIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n))\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName\n\nconst SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement\n }\n>(({ className, children, position = 'popper', container, ...props }, ref) => (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content\n ref={ref}\n sideOffset={4}\n className={cn(\n 'text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-[var(--radix-select-content-available-height,300px)] min-w-[8rem] overflow-hidden rounded-md border bg-[#fff] shadow-md',\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' &&\n 'w-[var(--radix-select-trigger-width)] md:w-auto md:min-w-[var(--radix-select-trigger-width)]',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n))\nSelectContent.displayName = SelectPrimitive.Content.displayName\n\nconst SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label ref={ref} className={cn('py-1.5 pr-2 pl-8 text-sm font-semibold', className)} {...props} />\n))\nSelectLabel.displayName = SelectPrimitive.Label.displayName\n\nconst SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n 'focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none focus:bg-neutral-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n))\nSelectItem.displayName = SelectPrimitive.Item.displayName\n\nconst SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator ref={ref} className={cn('bg-muted -mx-1 my-1 h-px', className)} {...props} />\n))\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName\n\nexport type Option = {\n value: string\n label: React.ReactElement | string | number\n}\n\nexport {\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectRoot,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n\ntype Props = {\n onValueChange?: (value: string) => void\n defaultValue?: string\n value?: string\n placeholder?: string\n options: Array<Option>\n className?: string\n disabled?: boolean\n error?: boolean | string\n id?: string\n onKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void\n container?: HTMLElement\n renderOption?: (option: Option) => React.ReactNode\n}\n\nexport function Select({\n onValueChange,\n defaultValue,\n value,\n options,\n placeholder,\n className,\n disabled = false,\n error,\n id,\n onKeyDown,\n container,\n renderOption,\n ...props\n}: Readonly<Props>) {\n const [open, setOpen] = React.useState(false)\n\n const handleOpenChange = React.useCallback(\n (nextOpen: boolean) => {\n if (!disabled) setOpen(nextOpen)\n },\n [disabled],\n )\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <SelectRoot\n {...props}\n open={open}\n onOpenChange={handleOpenChange}\n onValueChange={onValueChange}\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n >\n <SelectTrigger\n id={id}\n onKeyDown={onKeyDown}\n aria-invalid={error ? 'true' : 'false'}\n className={cn(\n buttonVariants({ variant: 'input', size: 'lg' }),\n 'flex justify-between',\n error && 'ring-error-400 focus-within:ring-error-700 border-none ring-1',\n className,\n )}\n onPointerDown={(event) => {\n event.stopPropagation()\n if (open) {\n setOpen(false)\n event.preventDefault()\n } else {\n setOpen(true)\n }\n }}\n onClick={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent\n container={container}\n onPointerDownOutside={(event) => {\n if (!container) return\n const original = (event as unknown as Record<string, unknown>).detail as\n { originalEvent?: PointerEvent } | undefined\n if (!original?.originalEvent?.composedPath) return\n if (original.originalEvent.composedPath().includes(container)) {\n event.preventDefault()\n }\n }}\n >\n {options.map((option) =>\n renderOption ? (\n <SelectPrimitive.Item\n key={option.value}\n value={option.value}\n data-testid={option.value}\n textValue={typeof option.label === 'string' ? option.label : undefined}\n className=\"focus:text-accent-foreground relative flex w-full cursor-default items-start rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n >\n <span className=\"hidden\">\n <SelectPrimitive.ItemText>{option.label}</SelectPrimitive.ItemText>\n </span>\n {renderOption(option)}\n </SelectPrimitive.Item>\n ) : (\n <SelectItem key={option.value} value={option.value} data-testid={option.value}>\n {option.label}\n </SelectItem>\n ),\n )}\n </SelectContent>\n </SelectRoot>\n {typeof error === 'string' && <span className=\"text-error-500 text-sm\">{error}</span>}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAUA,IAAM,aAAa,gBAAgB;AAEnC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgBA,QAAM,YAGzB,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,qBAAC,gBAAgB,SAAjB;CAA8B;CAAgB;CAAW,GAAI;CAA7D,UAAA,CACG,UACD,oBAAC,gBAAgB,MAAjB;EAAsB,SAAA;EACpB,UAAA,oBAAC,eAAD,EAAe,WAAU,qBAAsB,CAAA;CAC3B,CAAA,CACC;AAC1B,CAAA,CAAA;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,uBAAuBA,QAAM,YAGhC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,gBAAjB;CACO;CACL,WAAW,GAAG,wDAAwD,SAAS;CAC/E,GAAI;CAEJ,UAAA,oBAAC,aAAD,EAAa,WAAU,UAAW,CAAA;AACJ,CAAA,CACjC;AACD,qBAAqB,cAAc,gBAAgB,eAAe;AAElE,IAAM,yBAAyBA,QAAM,YAGlC,EAAE,WAAW,GAAG,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ACd,eAAa,OAAO;KACpB,WAAW,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,KAAA;KAC7D,WAAU;KALZ,UAAA,CAOE,oBAAC,QAAD;MAAM,WAAU;MACd,UAAA,oBAAC,gBAAgB,UAAjB,EAAA,UAA2B,OAAO,MAAgC,CAAA;KAC9D,CAAA,GACL,aAAa,MAAM,CACA;IAVf,GAAA,OAAO,KAUQ,IAEtB,oBAAC,YAAD;KAA+B,OAAO,OAAO;KAAO,eAAa,OAAO;KACrE,UAAA,OAAO;IACE,GAFK,OAAO,KAEZ,CAEhB;GACa,CAAA,CACL;EACX,CAAA,GAAA,OAAO,UAAU,YAAY,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CACjF;;AAET"}
|
|
1
|
+
{"version":3,"file":"Select.js","names":["React"],"sources":["../../../../src/components/inputs/Select/Select.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { CaretUpIcon } from '@phosphor-icons/react/dist/ssr/CaretUp'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport * as SelectPrimitive from '@radix-ui/react-select'\nimport * as React from 'react'\n\nimport { buttonVariants } from '../Button'\n\nimport { cn } from '@/lib/utils'\n\nconst SelectRoot = SelectPrimitive.Root\n\nconst SelectGroup = SelectPrimitive.Group\n\nconst SelectValue = SelectPrimitive.Value\n\nconst SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger ref={ref} className={className} {...props}>\n {children}\n <SelectPrimitive.Icon asChild>\n <CaretDownIcon className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n))\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <CaretUpIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n))\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn('flex cursor-default items-center justify-center py-1', className)}\n {...props}\n >\n <CaretDownIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n))\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName\n\nconst SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement\n }\n>(({ className, children, position = 'popper', container, ...props }, ref) => (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content\n ref={ref}\n sideOffset={4}\n className={cn(\n 'text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height,300px) min-w-32 overflow-hidden rounded-md border bg-[#fff] shadow-md',\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' && 'w-(--radix-select-trigger-width) md:w-auto md:min-w-(--radix-select-trigger-width)',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n))\nSelectContent.displayName = SelectPrimitive.Content.displayName\n\nconst SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label ref={ref} className={cn('py-1.5 pr-2 pl-8 text-sm font-semibold', className)} {...props} />\n))\nSelectLabel.displayName = SelectPrimitive.Label.displayName\n\nconst SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n 'focus:text-accent-foreground relative flex w-full items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n))\nSelectItem.displayName = SelectPrimitive.Item.displayName\n\nconst SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator ref={ref} className={cn('bg-muted -mx-1 my-1 h-px', className)} {...props} />\n))\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName\n\nexport type Option = {\n value: string\n label: React.ReactElement | string | number\n}\n\nexport {\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectRoot,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n\ntype Props = {\n onValueChange?: (value: string) => void\n defaultValue?: string\n value?: string\n placeholder?: string\n options: Array<Option>\n className?: string\n disabled?: boolean\n error?: boolean | string\n id?: string\n onKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void\n container?: HTMLElement\n renderOption?: (option: Option) => React.ReactNode\n}\n\nexport function Select({\n onValueChange,\n defaultValue,\n value,\n options,\n placeholder,\n className,\n disabled = false,\n error,\n id,\n onKeyDown,\n container,\n renderOption,\n ...props\n}: Readonly<Props>) {\n const [open, setOpen] = React.useState(false)\n\n const handleOpenChange = React.useCallback(\n (nextOpen: boolean) => {\n if (!disabled) setOpen(nextOpen)\n },\n [disabled],\n )\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <SelectRoot\n {...props}\n open={open}\n onOpenChange={handleOpenChange}\n onValueChange={onValueChange}\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n >\n <SelectTrigger\n id={id}\n onKeyDown={onKeyDown}\n aria-invalid={error ? 'true' : 'false'}\n className={cn(\n buttonVariants({ variant: 'input', size: 'lg' }),\n 'flex justify-between',\n error && 'ring-error-400 focus-within:ring-error-700 border-none ring-1',\n className,\n )}\n onPointerDown={(event) => {\n event.stopPropagation()\n if (open) {\n setOpen(false)\n event.preventDefault()\n } else {\n setOpen(true)\n }\n }}\n onClick={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent\n container={container}\n onPointerDownOutside={(event) => {\n if (!container) return\n const original = (event as unknown as Record<string, unknown>).detail as\n { originalEvent?: PointerEvent } | undefined\n if (!original?.originalEvent?.composedPath) return\n if (original.originalEvent.composedPath().includes(container)) {\n event.preventDefault()\n }\n }}\n >\n {options.map((option) =>\n renderOption ? (\n <SelectPrimitive.Item\n key={option.value}\n value={option.value}\n data-testid={option.value}\n textValue={typeof option.label === 'string' ? option.label : undefined}\n className=\"focus:text-accent-foreground relative flex w-full items-start rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50\"\n >\n <span className=\"hidden\">\n <SelectPrimitive.ItemText>{option.label}</SelectPrimitive.ItemText>\n </span>\n {renderOption(option)}\n </SelectPrimitive.Item>\n ) : (\n <SelectItem key={option.value} value={option.value} data-testid={option.value}>\n {option.label}\n </SelectItem>\n ),\n )}\n </SelectContent>\n </SelectRoot>\n {typeof error === 'string' && <span className=\"text-error-500 text-sm\">{error}</span>}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAUA,IAAM,aAAa,gBAAgB;AAEnC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgBA,QAAM,YAGzB,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,qBAAC,gBAAgB,SAAjB;CAA8B;CAAgB;CAAW,GAAI;CAA7D,UAAA,CACG,UACD,oBAAC,gBAAgB,MAAjB;EAAsB,SAAA;EACpB,UAAA,oBAAC,eAAD,EAAe,WAAU,qBAAsB,CAAA;CAC3B,CAAA,CACC;AAC1B,CAAA,CAAA;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,uBAAuBA,QAAM,YAGhC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,gBAAjB;CACO;CACL,WAAW,GAAG,wDAAwD,SAAS;CAC/E,GAAI;CAEJ,UAAA,oBAAC,aAAD,EAAa,WAAU,UAAW,CAAA;AACJ,CAAA,CACjC;AACD,qBAAqB,cAAc,gBAAgB,eAAe;AAElE,IAAM,yBAAyBA,QAAM,YAGlC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,kBAAjB;CACO;CACL,WAAW,GAAG,wDAAwD,SAAS;CAC/E,GAAI;CAEJ,UAAA,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;AACJ,CAAA,CACnC;AACD,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jB,EAAA,UAA2B,OAAO,MAAgC,CAAA;KAC9D,CAAA,GACL,aAAa,MAAM,CACA;IAVf,GAAA,OAAO,KAUQ,IAEtB,oBAAC,YAAD;KAA+B,OAAO,OAAO;KAAO,eAAa,OAAO;KACrE,UAAA,OAAO;IACE,GAFK,OAAO,KAEZ,CAEhB;GACa,CAAA,CACL;EACX,CAAA,GAAA,OAAO,UAAU,YAAY,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CACjF;;AAET"}
|
|
@@ -14,7 +14,7 @@ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
|
14
14
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
15
15
|
var DropdownMenuSubTrigger = React$1.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
16
16
|
ref,
|
|
17
|
-
className: cn("flex
|
|
17
|
+
className: cn("flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-50 data-[state=open]:bg-neutral-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className),
|
|
18
18
|
...props,
|
|
19
19
|
children: [children, /* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-auto" })]
|
|
20
20
|
}));
|
|
@@ -34,13 +34,13 @@ var DropdownMenuContent = React$1.forwardRef(({ className, sideOffset = 4, ...pr
|
|
|
34
34
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
35
35
|
var DropdownMenuItem = React$1.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
36
36
|
ref,
|
|
37
|
-
className: cn("focus:text-accent-foreground relative flex
|
|
37
|
+
className: cn("focus:text-accent-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none select-none focus:bg-neutral-50 data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", className),
|
|
38
38
|
...props
|
|
39
39
|
}));
|
|
40
40
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
41
41
|
var DropdownMenuCheckboxItem = React$1.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
42
42
|
ref,
|
|
43
|
-
className: cn("focus:text-accent-foreground relative flex
|
|
43
|
+
className: cn("focus:text-accent-foreground relative flex items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-50 data-disabled:pointer-events-none data-disabled:opacity-50", className),
|
|
44
44
|
checked,
|
|
45
45
|
...props,
|
|
46
46
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -51,7 +51,7 @@ var DropdownMenuCheckboxItem = React$1.forwardRef(({ className, children, checke
|
|
|
51
51
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
52
52
|
var DropdownMenuRadioItem = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
53
53
|
ref,
|
|
54
|
-
className: cn("focus:text-accent-foreground relative flex
|
|
54
|
+
className: cn("focus:text-accent-foreground relative flex items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-50 data-disabled:pointer-events-none data-disabled:opacity-50", className),
|
|
55
55
|
...props,
|
|
56
56
|
children: [/* @__PURE__ */ jsx("span", {
|
|
57
57
|
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","names":["React"],"sources":["../../../../src/components/navigation/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["import { CaretRightIcon } from '@phosphor-icons/react/dist/ssr/CaretRight'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { DotIcon } from '@phosphor-icons/react/dist/ssr/Dot'\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst DropdownMenu = DropdownMenuPrimitive.Root\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","names":["React"],"sources":["../../../../src/components/navigation/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["import { CaretRightIcon } from '@phosphor-icons/react/dist/ssr/CaretRight'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { DotIcon } from '@phosphor-icons/react/dist/ssr/Dot'\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst DropdownMenu = DropdownMenuPrimitive.Root\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-50 data-[state=open]:bg-neutral-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <CaretRightIcon className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-32 overflow-hidden rounded-md border bg-white p-1 shadow-lg',\n className,\n )}\n {...props}\n />\n))\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'text-popover-foreground z-50 min-w-[min(var(--radix-dropdown-menu-trigger-width),8rem)] overflow-hidden rounded-md border bg-white p-1 shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'focus:text-accent-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none select-none focus:bg-neutral-50 data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n))\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'focus:text-accent-foreground relative flex items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-50 data-disabled:pointer-events-none data-disabled:opacity-50',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'focus:text-accent-foreground relative flex items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-50 data-disabled:pointer-events-none data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <DotIcon className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n))\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator ref={ref} className={cn('bg-muted -mx-1 my-1 h-px', className)} {...props} />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />\n}\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut'\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n}\n"],"mappings":";;;;;;;;AAQA,IAAM,eAAe,sBAAsB;AAE3C,IAAM,sBAAsB,sBAAsB;AAElD,IAAM,oBAAoB,sBAAsB;AAEhD,IAAM,qBAAqB,sBAAsB;AAEjD,IAAM,kBAAkB,sBAAsB;AAE9C,IAAM,yBAAyB,sBAAsB;AAErD,IAAM,yBAAyBA,QAAM,YAKlC,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,QAC3C,qBAAC,sBAAsB,YAAvB;CACO;CACL,WAAW,GACT,mMACA,SAAS,QACT,SACF;CACA,GAAI;CAPN,UAAA,CASG,UACD,oBAAC,gBAAD,EAAgB,WAAU,UAAW,CAAA,CACL;AACnC,CAAA,CAAA;AACD,uBAAuB,cAAc,sBAAsB,WAAW;AAEtE,IAAM,yBAAyBA,QAAM,YAGlC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,sBAAsB,YAAvB;CACO;CACL,WAAW,GACT,mbACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,uBAAuB,cAAc,sBAAsB,WAAW;AAEtE,IAAM,sBAAsBA,QAAM,YAG/B,EAAE,WAAW,aAAa,GAAG,GAAG,SAAS,QAC1C,oBAAC,sBAAsB,QAAvB,EAAA,UACE,oBAAC,sBAAsB,SAAvB;CACO;CACO;CACZ,WAAW,GACT,oJACA,oVACA,SACF;CACA,GAAI;AACL,CAAA,EAC2B,CAAA,CAC/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,WAAvB;CAAsC;CAAK,WAAW,GAAG,4BAA4B,SAAS;CAAG,GAAI;AAAQ,CAAA,CAC9G;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,wBAAwB,EAAE,WAAW,GAAG,YAAmD;CAC/F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,8CAA8C,SAAS;EAAG,GAAI;CAAQ,CAAA;AACnG;AACA,qBAAqB,cAAc"}
|
|
@@ -230,7 +230,7 @@ var SidebarLogo = React$1.forwardRef(({ className, asChild = false, tag, ...prop
|
|
|
230
230
|
children: [/* @__PURE__ */ jsx(Comp, {
|
|
231
231
|
ref,
|
|
232
232
|
"data-sidebar": "logo",
|
|
233
|
-
className: cn("focus-visible:ring-sidebar-ring flex shrink-0 items-center justify-center rounded-lg outline-hidden focus-visible:ring-2", "[
|
|
233
|
+
className: cn("focus-visible:ring-sidebar-ring flex shrink-0 items-center justify-center rounded-lg outline-hidden focus-visible:ring-2", "[&>img]:aspect-48/27 [&>img]:w-full [&>img]:object-contain [&>svg]:aspect-48/27 [&>svg]:w-full", isMobile ? "ml-(--logo-inset)" : "ml-[calc(100%-var(--sidebar-width)+1.5rem+var(--logo-inset))]", SIDEBAR_LOGO[size].logo, className),
|
|
234
234
|
...props
|
|
235
235
|
}), tag && /* @__PURE__ */ jsx(Typography, {
|
|
236
236
|
weight: "bold",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.js","names":["React"],"sources":["../../../../src/components/navigation/Sidebar/Sidebar.tsx"],"sourcesContent":["'use client'\n\nimport { ListIcon } from '@phosphor-icons/react/dist/ssr/List'\nimport { SidebarSimpleIcon } from '@phosphor-icons/react/dist/ssr/SidebarSimple'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { useIsMobile } from '../../../lib/useMobile'\nimport { Separator } from '../../data-display/Separator'\nimport { TooltipProvider } from '../../data-display/Tooltip'\nimport { Typography } from '../../data-display/Typography'\nimport { Input } from '../../inputs/Input'\nimport { SheetContent, SheetDescription, SheetHeader, SheetRoot, SheetTitle } from '../Sheet'\n\nimport { SidebarContext, useSidebar, useResolvedSize } from './context'\nimport type { SidebarSize } from './context'\nimport { MOTION, SCROLLBAR } from './styles'\n\nimport { trackInputModality } from '@/lib/inputModality'\nimport { createMarquee } from '@/lib/marquee'\nimport { cn } from '@/lib/utils'\n\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state'\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7\nconst SIDEBAR_WIDTH = '17.5rem'\nconst SIDEBAR_WIDTH_MOBILE = '18.5rem'\nconst SIDEBAR_KEYBOARD_SHORTCUT = /^b$/i\n\nconst SIDEBAR_WIDTH_ICON: Record<SidebarSize, string> = {\n small: '3.5rem',\n medium: '4rem',\n big: '4.5rem',\n}\n\nconst MARQUEE_ROW = '[data-sidebar=menu-button], [data-sidebar=menu-sub-button], [data-sidebar=user]'\nconst marquee = createMarquee({\n rows: MARQUEE_ROW,\n disabled: (row) => row.closest('[data-side][data-state=collapsed]') !== null,\n})\n\nconst SidebarProvider = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & {\n defaultOpen?: boolean\n open?: boolean\n onOpenChange?: (open: boolean) => void\n size?: SidebarSize\n }\n>(\n (\n {\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n size = 'medium',\n className,\n style,\n children,\n onPointerOver,\n onPointerOut,\n onFocus,\n onBlur,\n ...props\n },\n ref,\n ) => {\n const isMobile = useIsMobile()\n const [openMobile, setOpenMobile] = React.useState(false)\n\n const [_open, _setOpen] = React.useState(defaultOpen)\n const open = openProp ?? _open\n const setOpen = React.useCallback(\n (value: boolean) => {\n if (setOpenProp) {\n setOpenProp(value)\n } else {\n _setOpen(value)\n }\n\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${value}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\n },\n [setOpenProp],\n )\n\n const toggleSidebar = React.useCallback(() => {\n if (isMobile) {\n setOpenMobile((value) => !value)\n } else {\n setOpen(!open)\n }\n }, [isMobile, open, setOpen])\n\n const toggleSidebarRef = React.useRef(toggleSidebar)\n React.useEffect(() => {\n toggleSidebarRef.current = toggleSidebar\n }, [toggleSidebar])\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const isShortcut =\n SIDEBAR_KEYBOARD_SHORTCUT.test(event.key) &&\n (event.metaKey || event.ctrlKey) &&\n !event.shiftKey &&\n !event.altKey\n const isEditing =\n event.target instanceof HTMLElement &&\n (event.target.isContentEditable || event.target.closest('input, textarea, select') !== null)\n\n if (isShortcut && !isEditing && !event.defaultPrevented) {\n event.preventDefault()\n toggleSidebarRef.current()\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n return () => window.removeEventListener('keydown', handleKeyDown)\n }, [])\n\n React.useEffect(trackInputModality, [])\n\n React.useEffect(() => {\n if (!open) {\n marquee.stopAll()\n }\n }, [open])\n\n const state = open ? 'expanded' : 'collapsed'\n\n const contextValue = React.useMemo<SidebarContext>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n size,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar, size],\n )\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider>\n <div\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH,\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON[size],\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n 'flex min-h-svh w-full [--page-padding:1rem] sm:[--page-padding:1.5rem] lg:[--page-padding:2rem]',\n className,\n )}\n ref={ref}\n onPointerOver={(event) => {\n onPointerOver?.(event)\n marquee.onPointerOver(event)\n }}\n onPointerOut={(event) => {\n onPointerOut?.(event)\n marquee.onPointerOut(event)\n }}\n onFocus={(event) => {\n onFocus?.(event)\n marquee.onFocus(event)\n }}\n onBlur={(event) => {\n onBlur?.(event)\n marquee.onBlur(event)\n }}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n )\n },\n)\nSidebarProvider.displayName = 'SidebarProvider'\n\nconst SidebarRoot = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & {\n /** @deprecated The sidebar is always on the left; this prop is ignored. */\n side?: 'left' | 'right'\n variant?: 'default' | 'hidden'\n }\n>(({ variant = 'default', className, children, 'aria-label': ariaLabel = 'Main', ...props }, ref) => {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar()\n\n if (isMobile) {\n return (\n <SheetRoot open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n ref={ref}\n data-sidebar=\"sidebar\"\n className={cn(\n 'bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 ease-out data-[state=closed]:duration-200 data-[state=open]:duration-300 motion-reduce:data-[state=closed]:duration-0 motion-reduce:data-[state=open]:duration-0',\n className,\n )}\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n {...props}\n side=\"left\"\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <nav aria-label={ariaLabel} className=\"@container flex h-full w-full flex-col gap-3 px-3 pb-3\">\n {children}\n </nav>\n </SheetContent>\n </SheetRoot>\n )\n }\n\n return (\n <TooltipProvider delayDuration={0}>\n <div ref={ref} className=\"group text-sidebar-foreground hidden md:block\" data-state={state} data-side=\"left\">\n <div\n className={cn(\n 'w-(--sidebar-width) transition-[width]',\n MOTION,\n variant === 'default' && 'group-data-[state=collapsed]:w-(--sidebar-width-icon)',\n variant === 'hidden' && 'group-data-[state=collapsed]:w-0',\n )}\n />\n <div\n className={cn(\n 'fixed inset-y-0 left-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,width]',\n MOTION,\n variant === 'default' && 'group-data-[state=collapsed]:w-(--sidebar-width-icon)',\n variant === 'hidden' && 'group-data-[state=collapsed]:-left-(--sidebar-width)',\n className,\n )}\n {...props}\n >\n <nav\n data-sidebar=\"sidebar\"\n aria-label={ariaLabel}\n className=\"bg-sidebar @container flex h-full w-full flex-col gap-3 px-3 pb-3\"\n >\n {children}\n </nav>\n </div>\n </div>\n </TooltipProvider>\n )\n})\nSidebarRoot.displayName = 'SidebarRoot'\n\nconst SIDEBAR_TRIGGER: Record<SidebarSize, string> = {\n small: 'size-7 [&>svg]:size-4.5',\n medium: 'size-8 [&>svg]:size-5',\n big: 'size-8 [&>svg]:size-6',\n}\n\nconst SidebarTrigger = React.forwardRef<HTMLButtonElement, React.ComponentProps<'button'> & { icon?: React.ReactNode }>(\n ({ className, onClick, icon, ...props }, ref) => {\n const { isMobile, toggleSidebar, size, open, openMobile } = useSidebar()\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-sidebar=\"trigger\"\n aria-expanded={isMobile ? openMobile : open}\n className={cn(\n 'text-sidebar-foreground hover:bg-sidebar-accent focus-visible:ring-sidebar-ring relative flex shrink-0 items-center justify-center rounded-lg outline-hidden focus-visible:ring-2',\n 'transition-colors motion-reduce:transition-none',\n SIDEBAR_TRIGGER[size],\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n toggleSidebar()\n }}\n {...props}\n >\n {icon ?? (isMobile ? <ListIcon aria-hidden /> : <SidebarSimpleIcon aria-hidden />)}\n <span className=\"sr-only\">Toggle Sidebar</span>\n </button>\n )\n },\n)\nSidebarTrigger.displayName = 'SidebarTrigger'\n\nconst SIDEBAR_HEADER_TRIGGER: Record<SidebarSize, string> = {\n small: 'right-0 group-data-[state=collapsed]:right-0.5',\n medium: 'right-0 group-data-[state=collapsed]:right-1',\n big: 'right-1 group-data-[state=collapsed]:right-2',\n}\n\nconst SidebarHeaderTrigger = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof SidebarTrigger>>(\n ({ className, ...props }, ref) => {\n const { isMobile, size } = useSidebar()\n\n if (isMobile) {\n return null\n }\n\n return (\n <SidebarTrigger\n ref={ref}\n className={cn(\n 'absolute inset-y-0 my-auto transition-[right,background-color]',\n MOTION,\n SIDEBAR_HEADER_TRIGGER[size],\n className,\n )}\n {...props}\n />\n )\n },\n)\nSidebarHeaderTrigger.displayName = 'SidebarHeaderTrigger'\n\nconst SIDEBAR_LOGO: Record<SidebarSize, { frame: string; logo: string; tag: string }> = {\n small: { frame: '[--logo-inset:0.4375rem]', logo: 'h-8.5 w-10', tag: 'mb-[5.75px] ml-[3.75px] text-[8.75px]/none' },\n medium: { frame: '[--logo-inset:0.625rem]', logo: 'h-10 w-12', tag: 'mb-[6.5px] ml-[4.5px] text-[10.5px]/none' },\n big: { frame: '[--logo-inset:0.75rem]', logo: 'h-11.5 w-14', tag: 'mb-[7.25px] ml-[5.25px] text-[12.25px]/none' },\n}\n\nconst SidebarLogo = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & { asChild?: boolean; tag?: React.ReactNode }\n>(({ className, asChild = false, tag, ...props }, ref) => {\n const Comp = asChild ? Slot : 'div'\n const { size, isMobile } = useSidebar()\n\n return (\n <div\n className={cn(\n 'flex w-full items-end overflow-hidden mask-[linear-gradient(to_right,transparent,black_var(--logo-inset))] py-0.5',\n 'transition-[opacity,visibility] group-data-[state=collapsed]:invisible group-data-[state=collapsed]:opacity-0',\n MOTION,\n SIDEBAR_LOGO[size].frame,\n )}\n >\n <Comp\n ref={ref}\n data-sidebar=\"logo\"\n className={cn(\n 'focus-visible:ring-sidebar-ring flex shrink-0 items-center justify-center rounded-lg outline-hidden focus-visible:ring-2',\n '[a,button]:cursor-pointer [&>img]:aspect-48/27 [&>img]:w-full [&>img]:object-contain [&>svg]:aspect-48/27 [&>svg]:w-full',\n isMobile ? 'ml-(--logo-inset)' : 'ml-[calc(100%-var(--sidebar-width)+1.5rem+var(--logo-inset))]',\n SIDEBAR_LOGO[size].logo,\n className,\n )}\n {...props}\n />\n {tag && (\n <Typography\n weight=\"bold\"\n data-sidebar=\"logo-tag\"\n className={cn('shrink-0 whitespace-nowrap', SIDEBAR_LOGO[size].tag)}\n >\n {tag}\n </Typography>\n )}\n </div>\n )\n})\nSidebarLogo.displayName = 'SidebarLogo'\n\nconst SIDEBAR_INPUT_HEIGHT: Record<SidebarSize, string> = {\n small: 'h-8',\n medium: 'h-10',\n big: 'h-12',\n}\n\nconst SidebarInput = React.forwardRef<\n React.ComponentRef<typeof Input>,\n Omit<React.ComponentProps<typeof Input>, 'size'> & { size?: SidebarSize }\n>(({ className, size, id, onFocus, ...props }, ref) => {\n const { state, isMobile, setOpen } = useSidebar()\n const generatedId = React.useId()\n const inputId = id ?? generatedId\n const resolvedSize = useResolvedSize(size)\n const isRail = state === 'collapsed' && !isMobile\n\n return (\n <label htmlFor={inputId} className=\"block group-data-[state=collapsed]:cursor-pointer\">\n <Input\n ref={ref}\n id={inputId}\n data-sidebar=\"input\"\n className={cn('md:text-sm', SIDEBAR_INPUT_HEIGHT[resolvedSize], className)}\n onFocus={(event) => {\n onFocus?.(event)\n if (isRail) {\n setOpen(true)\n }\n }}\n {...props}\n />\n </label>\n )\n})\nSidebarInput.displayName = 'SidebarInput'\n\nconst SIDEBAR_HEADER: Record<SidebarSize, string> = {\n small: 'min-h-12',\n medium: 'min-h-14',\n big: 'min-h-16',\n}\n\nconst SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n const { size } = useSidebar()\n\n return (\n <div\n ref={ref}\n data-sidebar=\"header\"\n className={cn('relative flex shrink-0 items-center', SIDEBAR_HEADER[size], className)}\n {...props}\n />\n )\n})\nSidebarHeader.displayName = 'SidebarHeader'\n\nconst SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n return <div ref={ref} data-sidebar=\"footer\" className={cn('flex flex-col gap-3', className)} {...props} />\n})\nSidebarFooter.displayName = 'SidebarFooter'\n\nconst SidebarSeparator = React.forwardRef<React.ComponentRef<typeof Separator>, React.ComponentProps<typeof Separator>>(\n ({ className, ...props }, ref) => {\n return (\n <Separator ref={ref} data-sidebar=\"separator\" className={cn('bg-sidebar-border w-auto', className)} {...props} />\n )\n },\n)\nSidebarSeparator.displayName = 'SidebarSeparator'\n\nconst SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"content\"\n className={cn(\n '-my-1 -mr-3 -ml-1 flex min-h-0 flex-1 flex-col gap-3 overflow-x-hidden overflow-y-auto py-1 pl-1 md:mt-[calc(var(--page-padding)-15px)]',\n SCROLLBAR,\n '*:w-[min(100cqw,calc(100%-0.25rem))] *:shrink-0',\n className,\n )}\n {...props}\n />\n )\n})\nSidebarContent.displayName = 'SidebarContent'\n\nconst SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n return (\n <div ref={ref} data-sidebar=\"group\" className={cn('relative flex w-full min-w-0 flex-col', className)} {...props} />\n )\n})\nSidebarGroup.displayName = 'SidebarGroup'\n\nconst sidebarGroupLabelVariants = cva(\n [\n 'text-sidebar-foreground/70 ring-sidebar-ring flex shrink-0 items-center rounded-md transition-[margin,opacity] outline-hidden focus-visible:ring-2 [&>svg]:shrink-0 group-data-[state=collapsed]:opacity-0',\n MOTION,\n ].join(' '),\n {\n variants: {\n size: {\n small: 'h-8 pl-1.75 [&>svg]:size-4 group-data-[state=collapsed]:-mt-8',\n medium: 'h-10 pl-2.5 [&>svg]:size-4 group-data-[state=collapsed]:-mt-10',\n big: 'h-12 pl-3 [&>svg]:size-5 group-data-[state=collapsed]:-mt-12',\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n },\n)\n\nconst SIDEBAR_GROUP_LABEL_TEXT_VARIANT: Record<SidebarSize, 'label-md' | 'label-lg'> = {\n small: 'label-md',\n medium: 'label-md',\n big: 'label-lg',\n}\n\nconst SidebarGroupLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & { asChild?: boolean; size?: SidebarSize }\n>(({ className, asChild = false, size, children, ...props }, ref) => {\n const Comp = asChild ? Slot : 'div'\n const resolvedSize = useResolvedSize(size)\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-label\"\n className={cn(sidebarGroupLabelVariants({ size: resolvedSize }), className)}\n {...props}\n >\n {typeof children === 'string' ? (\n <Typography variant={SIDEBAR_GROUP_LABEL_TEXT_VARIANT[resolvedSize]} color=\"secondary\">\n {children}\n </Typography>\n ) : (\n children\n )}\n </Comp>\n )\n})\nSidebarGroupLabel.displayName = 'SidebarGroupLabel'\n\nconst sidebarGroupActionVariants = cva(\n [\n 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute flex aspect-square items-center justify-center rounded-md p-0 transition-[opacity,visibility,color,background-color] outline-hidden focus-visible:ring-2 after:absolute after:-inset-2 after:md:hidden group-data-[state=collapsed]:invisible group-data-[state=collapsed]:opacity-0 [&>svg]:shrink-0',\n MOTION,\n ].join(' '),\n {\n variants: {\n size: {\n small: 'top-1.5 right-1.5 w-5 [&>svg]:size-4',\n medium: 'top-2.5 right-1.5 w-5 [&>svg]:size-4',\n big: 'top-3 right-1.5 w-6 [&>svg]:size-5',\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n },\n)\n\nconst SidebarGroupAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<'button'> & { asChild?: boolean; size?: SidebarSize }\n>(({ className, asChild = false, size, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button'\n const resolvedSize = useResolvedSize(size)\n\n return (\n <Comp\n ref={ref}\n type={asChild ? undefined : 'button'}\n data-sidebar=\"group-action\"\n className={cn(sidebarGroupActionVariants({ size: resolvedSize }), className)}\n {...props}\n />\n )\n})\nSidebarGroupAction.displayName = 'SidebarGroupAction'\n\nconst SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} data-sidebar=\"group-content\" className={cn('w-full text-sm', className)} {...props} />\n ),\n)\nSidebarGroupContent.displayName = 'SidebarGroupContent'\n\nexport {\n SidebarRoot,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarHeaderTrigger,\n SidebarInput,\n SidebarLogo,\n SidebarProvider,\n SidebarSeparator,\n SidebarTrigger,\n sidebarGroupActionVariants,\n sidebarGroupLabelVariants,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,IAAA,sBAAA;AACA,IAAA,yBAAA;AACA,IAAA,gBAAA;AACA,IAAA,uBAAA;AACA,IAAA,4BAAA;AAEA,IAAA,qBAAA;CACE,OAAA;CACA,QAAA;CACA,KAAA;AACF;AAGA,IAAA,UAAA,cAAA;CACE,MAAA;CACA,WAAA,QAAA,IAAA,QAAA,mCAAA,MAAA;AACF,CAAA;AAEA,IAAA,kBAAA,QAAA,YAAA,EAAA,cAAA,MAAA,MAAA,UAAA,cAAA,aAAA,OAAA,UAAA,WAAA,OAAA,UAAA,eAAA,cAAA,SAAA,QAAA,GAAA,SAAA,QAAA;CA0BI,MAAA,WAAA,YAAA;CACA,MAAA,CAAA,YAAA,iBAAA,QAAA,SAAA,KAAA;CAEA,MAAA,CAAA,OAAA,YAAA,QAAA,SAAA,WAAA;CACA,MAAA,OAAA,YAAA;CACA,MAAA,UAAA,QAAA,aAAA,UAAA;EAEI,IAAA,aAAA,YAAA,KAAA;OAGE,SAAA,KAAA;EAGF,SAAA,SAAA,GAAA,oBAAA,GAAA,MAAA,oBAAA;CACF,GAAA,CAAA,WAAA,CAAA;CAIF,MAAA,gBAAA,QAAA,kBAAA;EACE,IAAA,UAAA,eAAA,UAAA,CAAA,KAAA;OAGE,QAAA,CAAA,IAAA;CAEJ,GAAA;EAAI;EAAU;EAAM;CAAO,CAAA;CAE3B,MAAA,mBAAA,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AA,YAAA;GACa,SAAA,iCAAA;GAAyD,OAAA;GAClE;EACS,CAAA,IAAA;CAIV,CAAA;AAEV,CAAA;AACA,kBAAA,cAAA;AAEA,IAAA,6BAAA,IAAA,CAAA,yZAAA,MAAA,CAAA,CAAA,KAAA,GAAA,GAAA;CAMI,UAAA,EAAA,MAAA;EAEI,OAAA;EACA,QAAA;EACA,KAAA;CACF,EAAA;CAEF,iBAAA,EAAA,MAAA,SAAA;AAGF,CAAA;AAGF,IAAA,qBAAA,QAAA,YAAA,EAAA,WAAA,UAAA,OAAA,MAAA,GAAA,SAAA,QAAA;CAIE,MAAA,OAAA,UAAA,OAAA;CACA,MAAA,eAAA,gBAAA,IAAA;CAEA,OAAA,oBAAA,MAAA;EAES;EACL,MAAA,UAAA,KAAA,IAAA;EACA,gBAAA;EACA,WAAA,GAAA,2BAAA,EAAA,MAAA,aAAA,CAAA,GAAA,SAAA;EACA,GAAA;CACD,CAAA;AAEL,CAAA;AACA,mBAAA,cAAA;AAEA,IAAA,sBAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,OAAA;CAEc;CAAK,gBAAA;CAA6B,WAAA,GAAA,kBAAA,SAAA;CAA4C,GAAA;AAAY,CAAA,CAAA;AAGxG,oBAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"Sidebar.js","names":["React"],"sources":["../../../../src/components/navigation/Sidebar/Sidebar.tsx"],"sourcesContent":["'use client'\n\nimport { ListIcon } from '@phosphor-icons/react/dist/ssr/List'\nimport { SidebarSimpleIcon } from '@phosphor-icons/react/dist/ssr/SidebarSimple'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { useIsMobile } from '../../../lib/useMobile'\nimport { Separator } from '../../data-display/Separator'\nimport { TooltipProvider } from '../../data-display/Tooltip'\nimport { Typography } from '../../data-display/Typography'\nimport { Input } from '../../inputs/Input'\nimport { SheetContent, SheetDescription, SheetHeader, SheetRoot, SheetTitle } from '../Sheet'\n\nimport { SidebarContext, useSidebar, useResolvedSize } from './context'\nimport type { SidebarSize } from './context'\nimport { MOTION, SCROLLBAR } from './styles'\n\nimport { trackInputModality } from '@/lib/inputModality'\nimport { createMarquee } from '@/lib/marquee'\nimport { cn } from '@/lib/utils'\n\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state'\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7\nconst SIDEBAR_WIDTH = '17.5rem'\nconst SIDEBAR_WIDTH_MOBILE = '18.5rem'\nconst SIDEBAR_KEYBOARD_SHORTCUT = /^b$/i\n\nconst SIDEBAR_WIDTH_ICON: Record<SidebarSize, string> = {\n small: '3.5rem',\n medium: '4rem',\n big: '4.5rem',\n}\n\nconst MARQUEE_ROW = '[data-sidebar=menu-button], [data-sidebar=menu-sub-button], [data-sidebar=user]'\nconst marquee = createMarquee({\n rows: MARQUEE_ROW,\n disabled: (row) => row.closest('[data-side][data-state=collapsed]') !== null,\n})\n\nconst SidebarProvider = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & {\n defaultOpen?: boolean\n open?: boolean\n onOpenChange?: (open: boolean) => void\n size?: SidebarSize\n }\n>(\n (\n {\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n size = 'medium',\n className,\n style,\n children,\n onPointerOver,\n onPointerOut,\n onFocus,\n onBlur,\n ...props\n },\n ref,\n ) => {\n const isMobile = useIsMobile()\n const [openMobile, setOpenMobile] = React.useState(false)\n\n const [_open, _setOpen] = React.useState(defaultOpen)\n const open = openProp ?? _open\n const setOpen = React.useCallback(\n (value: boolean) => {\n if (setOpenProp) {\n setOpenProp(value)\n } else {\n _setOpen(value)\n }\n\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${value}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\n },\n [setOpenProp],\n )\n\n const toggleSidebar = React.useCallback(() => {\n if (isMobile) {\n setOpenMobile((value) => !value)\n } else {\n setOpen(!open)\n }\n }, [isMobile, open, setOpen])\n\n const toggleSidebarRef = React.useRef(toggleSidebar)\n React.useEffect(() => {\n toggleSidebarRef.current = toggleSidebar\n }, [toggleSidebar])\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const isShortcut =\n SIDEBAR_KEYBOARD_SHORTCUT.test(event.key) &&\n (event.metaKey || event.ctrlKey) &&\n !event.shiftKey &&\n !event.altKey\n const isEditing =\n event.target instanceof HTMLElement &&\n (event.target.isContentEditable || event.target.closest('input, textarea, select') !== null)\n\n if (isShortcut && !isEditing && !event.defaultPrevented) {\n event.preventDefault()\n toggleSidebarRef.current()\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n return () => window.removeEventListener('keydown', handleKeyDown)\n }, [])\n\n React.useEffect(trackInputModality, [])\n\n React.useEffect(() => {\n if (!open) {\n marquee.stopAll()\n }\n }, [open])\n\n const state = open ? 'expanded' : 'collapsed'\n\n const contextValue = React.useMemo<SidebarContext>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n size,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar, size],\n )\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider>\n <div\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH,\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON[size],\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n 'flex min-h-svh w-full [--page-padding:1rem] sm:[--page-padding:1.5rem] lg:[--page-padding:2rem]',\n className,\n )}\n ref={ref}\n onPointerOver={(event) => {\n onPointerOver?.(event)\n marquee.onPointerOver(event)\n }}\n onPointerOut={(event) => {\n onPointerOut?.(event)\n marquee.onPointerOut(event)\n }}\n onFocus={(event) => {\n onFocus?.(event)\n marquee.onFocus(event)\n }}\n onBlur={(event) => {\n onBlur?.(event)\n marquee.onBlur(event)\n }}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n )\n },\n)\nSidebarProvider.displayName = 'SidebarProvider'\n\nconst SidebarRoot = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & {\n /** @deprecated The sidebar is always on the left; this prop is ignored. */\n side?: 'left' | 'right'\n variant?: 'default' | 'hidden'\n }\n>(({ variant = 'default', className, children, 'aria-label': ariaLabel = 'Main', ...props }, ref) => {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar()\n\n if (isMobile) {\n return (\n <SheetRoot open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n ref={ref}\n data-sidebar=\"sidebar\"\n className={cn(\n 'bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 ease-out data-[state=closed]:duration-200 data-[state=open]:duration-300 motion-reduce:data-[state=closed]:duration-0 motion-reduce:data-[state=open]:duration-0',\n className,\n )}\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n {...props}\n side=\"left\"\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <nav aria-label={ariaLabel} className=\"@container flex h-full w-full flex-col gap-3 px-3 pb-3\">\n {children}\n </nav>\n </SheetContent>\n </SheetRoot>\n )\n }\n\n return (\n <TooltipProvider delayDuration={0}>\n <div ref={ref} className=\"group text-sidebar-foreground hidden md:block\" data-state={state} data-side=\"left\">\n <div\n className={cn(\n 'w-(--sidebar-width) transition-[width]',\n MOTION,\n variant === 'default' && 'group-data-[state=collapsed]:w-(--sidebar-width-icon)',\n variant === 'hidden' && 'group-data-[state=collapsed]:w-0',\n )}\n />\n <div\n className={cn(\n 'fixed inset-y-0 left-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,width]',\n MOTION,\n variant === 'default' && 'group-data-[state=collapsed]:w-(--sidebar-width-icon)',\n variant === 'hidden' && 'group-data-[state=collapsed]:-left-(--sidebar-width)',\n className,\n )}\n {...props}\n >\n <nav\n data-sidebar=\"sidebar\"\n aria-label={ariaLabel}\n className=\"bg-sidebar @container flex h-full w-full flex-col gap-3 px-3 pb-3\"\n >\n {children}\n </nav>\n </div>\n </div>\n </TooltipProvider>\n )\n})\nSidebarRoot.displayName = 'SidebarRoot'\n\nconst SIDEBAR_TRIGGER: Record<SidebarSize, string> = {\n small: 'size-7 [&>svg]:size-4.5',\n medium: 'size-8 [&>svg]:size-5',\n big: 'size-8 [&>svg]:size-6',\n}\n\nconst SidebarTrigger = React.forwardRef<HTMLButtonElement, React.ComponentProps<'button'> & { icon?: React.ReactNode }>(\n ({ className, onClick, icon, ...props }, ref) => {\n const { isMobile, toggleSidebar, size, open, openMobile } = useSidebar()\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-sidebar=\"trigger\"\n aria-expanded={isMobile ? openMobile : open}\n className={cn(\n 'text-sidebar-foreground hover:bg-sidebar-accent focus-visible:ring-sidebar-ring relative flex shrink-0 items-center justify-center rounded-lg outline-hidden focus-visible:ring-2',\n 'transition-colors motion-reduce:transition-none',\n SIDEBAR_TRIGGER[size],\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n toggleSidebar()\n }}\n {...props}\n >\n {icon ?? (isMobile ? <ListIcon aria-hidden /> : <SidebarSimpleIcon aria-hidden />)}\n <span className=\"sr-only\">Toggle Sidebar</span>\n </button>\n )\n },\n)\nSidebarTrigger.displayName = 'SidebarTrigger'\n\nconst SIDEBAR_HEADER_TRIGGER: Record<SidebarSize, string> = {\n small: 'right-0 group-data-[state=collapsed]:right-0.5',\n medium: 'right-0 group-data-[state=collapsed]:right-1',\n big: 'right-1 group-data-[state=collapsed]:right-2',\n}\n\nconst SidebarHeaderTrigger = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof SidebarTrigger>>(\n ({ className, ...props }, ref) => {\n const { isMobile, size } = useSidebar()\n\n if (isMobile) {\n return null\n }\n\n return (\n <SidebarTrigger\n ref={ref}\n className={cn(\n 'absolute inset-y-0 my-auto transition-[right,background-color]',\n MOTION,\n SIDEBAR_HEADER_TRIGGER[size],\n className,\n )}\n {...props}\n />\n )\n },\n)\nSidebarHeaderTrigger.displayName = 'SidebarHeaderTrigger'\n\nconst SIDEBAR_LOGO: Record<SidebarSize, { frame: string; logo: string; tag: string }> = {\n small: { frame: '[--logo-inset:0.4375rem]', logo: 'h-8.5 w-10', tag: 'mb-[5.75px] ml-[3.75px] text-[8.75px]/none' },\n medium: { frame: '[--logo-inset:0.625rem]', logo: 'h-10 w-12', tag: 'mb-[6.5px] ml-[4.5px] text-[10.5px]/none' },\n big: { frame: '[--logo-inset:0.75rem]', logo: 'h-11.5 w-14', tag: 'mb-[7.25px] ml-[5.25px] text-[12.25px]/none' },\n}\n\nconst SidebarLogo = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & { asChild?: boolean; tag?: React.ReactNode }\n>(({ className, asChild = false, tag, ...props }, ref) => {\n const Comp = asChild ? Slot : 'div'\n const { size, isMobile } = useSidebar()\n\n return (\n <div\n className={cn(\n 'flex w-full items-end overflow-hidden mask-[linear-gradient(to_right,transparent,black_var(--logo-inset))] py-0.5',\n 'transition-[opacity,visibility] group-data-[state=collapsed]:invisible group-data-[state=collapsed]:opacity-0',\n MOTION,\n SIDEBAR_LOGO[size].frame,\n )}\n >\n <Comp\n ref={ref}\n data-sidebar=\"logo\"\n className={cn(\n 'focus-visible:ring-sidebar-ring flex shrink-0 items-center justify-center rounded-lg outline-hidden focus-visible:ring-2',\n '[&>img]:aspect-48/27 [&>img]:w-full [&>img]:object-contain [&>svg]:aspect-48/27 [&>svg]:w-full',\n isMobile ? 'ml-(--logo-inset)' : 'ml-[calc(100%-var(--sidebar-width)+1.5rem+var(--logo-inset))]',\n SIDEBAR_LOGO[size].logo,\n className,\n )}\n {...props}\n />\n {tag && (\n <Typography\n weight=\"bold\"\n data-sidebar=\"logo-tag\"\n className={cn('shrink-0 whitespace-nowrap', SIDEBAR_LOGO[size].tag)}\n >\n {tag}\n </Typography>\n )}\n </div>\n )\n})\nSidebarLogo.displayName = 'SidebarLogo'\n\nconst SIDEBAR_INPUT_HEIGHT: Record<SidebarSize, string> = {\n small: 'h-8',\n medium: 'h-10',\n big: 'h-12',\n}\n\nconst SidebarInput = React.forwardRef<\n React.ComponentRef<typeof Input>,\n Omit<React.ComponentProps<typeof Input>, 'size'> & { size?: SidebarSize }\n>(({ className, size, id, onFocus, ...props }, ref) => {\n const { state, isMobile, setOpen } = useSidebar()\n const generatedId = React.useId()\n const inputId = id ?? generatedId\n const resolvedSize = useResolvedSize(size)\n const isRail = state === 'collapsed' && !isMobile\n\n return (\n <label htmlFor={inputId} className=\"block group-data-[state=collapsed]:cursor-pointer\">\n <Input\n ref={ref}\n id={inputId}\n data-sidebar=\"input\"\n className={cn('md:text-sm', SIDEBAR_INPUT_HEIGHT[resolvedSize], className)}\n onFocus={(event) => {\n onFocus?.(event)\n if (isRail) {\n setOpen(true)\n }\n }}\n {...props}\n />\n </label>\n )\n})\nSidebarInput.displayName = 'SidebarInput'\n\nconst SIDEBAR_HEADER: Record<SidebarSize, string> = {\n small: 'min-h-12',\n medium: 'min-h-14',\n big: 'min-h-16',\n}\n\nconst SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n const { size } = useSidebar()\n\n return (\n <div\n ref={ref}\n data-sidebar=\"header\"\n className={cn('relative flex shrink-0 items-center', SIDEBAR_HEADER[size], className)}\n {...props}\n />\n )\n})\nSidebarHeader.displayName = 'SidebarHeader'\n\nconst SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n return <div ref={ref} data-sidebar=\"footer\" className={cn('flex flex-col gap-3', className)} {...props} />\n})\nSidebarFooter.displayName = 'SidebarFooter'\n\nconst SidebarSeparator = React.forwardRef<React.ComponentRef<typeof Separator>, React.ComponentProps<typeof Separator>>(\n ({ className, ...props }, ref) => {\n return (\n <Separator ref={ref} data-sidebar=\"separator\" className={cn('bg-sidebar-border w-auto', className)} {...props} />\n )\n },\n)\nSidebarSeparator.displayName = 'SidebarSeparator'\n\nconst SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"content\"\n className={cn(\n '-my-1 -mr-3 -ml-1 flex min-h-0 flex-1 flex-col gap-3 overflow-x-hidden overflow-y-auto py-1 pl-1 md:mt-[calc(var(--page-padding)-15px)]',\n SCROLLBAR,\n '*:w-[min(100cqw,calc(100%-0.25rem))] *:shrink-0',\n className,\n )}\n {...props}\n />\n )\n})\nSidebarContent.displayName = 'SidebarContent'\n\nconst SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {\n return (\n <div ref={ref} data-sidebar=\"group\" className={cn('relative flex w-full min-w-0 flex-col', className)} {...props} />\n )\n})\nSidebarGroup.displayName = 'SidebarGroup'\n\nconst sidebarGroupLabelVariants = cva(\n [\n 'text-sidebar-foreground/70 ring-sidebar-ring flex shrink-0 items-center rounded-md transition-[margin,opacity] outline-hidden focus-visible:ring-2 [&>svg]:shrink-0 group-data-[state=collapsed]:opacity-0',\n MOTION,\n ].join(' '),\n {\n variants: {\n size: {\n small: 'h-8 pl-1.75 [&>svg]:size-4 group-data-[state=collapsed]:-mt-8',\n medium: 'h-10 pl-2.5 [&>svg]:size-4 group-data-[state=collapsed]:-mt-10',\n big: 'h-12 pl-3 [&>svg]:size-5 group-data-[state=collapsed]:-mt-12',\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n },\n)\n\nconst SIDEBAR_GROUP_LABEL_TEXT_VARIANT: Record<SidebarSize, 'label-md' | 'label-lg'> = {\n small: 'label-md',\n medium: 'label-md',\n big: 'label-lg',\n}\n\nconst SidebarGroupLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & { asChild?: boolean; size?: SidebarSize }\n>(({ className, asChild = false, size, children, ...props }, ref) => {\n const Comp = asChild ? Slot : 'div'\n const resolvedSize = useResolvedSize(size)\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-label\"\n className={cn(sidebarGroupLabelVariants({ size: resolvedSize }), className)}\n {...props}\n >\n {typeof children === 'string' ? (\n <Typography variant={SIDEBAR_GROUP_LABEL_TEXT_VARIANT[resolvedSize]} color=\"secondary\">\n {children}\n </Typography>\n ) : (\n children\n )}\n </Comp>\n )\n})\nSidebarGroupLabel.displayName = 'SidebarGroupLabel'\n\nconst sidebarGroupActionVariants = cva(\n [\n 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute flex aspect-square items-center justify-center rounded-md p-0 transition-[opacity,visibility,color,background-color] outline-hidden focus-visible:ring-2 after:absolute after:-inset-2 after:md:hidden group-data-[state=collapsed]:invisible group-data-[state=collapsed]:opacity-0 [&>svg]:shrink-0',\n MOTION,\n ].join(' '),\n {\n variants: {\n size: {\n small: 'top-1.5 right-1.5 w-5 [&>svg]:size-4',\n medium: 'top-2.5 right-1.5 w-5 [&>svg]:size-4',\n big: 'top-3 right-1.5 w-6 [&>svg]:size-5',\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n },\n)\n\nconst SidebarGroupAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<'button'> & { asChild?: boolean; size?: SidebarSize }\n>(({ className, asChild = false, size, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button'\n const resolvedSize = useResolvedSize(size)\n\n return (\n <Comp\n ref={ref}\n type={asChild ? undefined : 'button'}\n data-sidebar=\"group-action\"\n className={cn(sidebarGroupActionVariants({ size: resolvedSize }), className)}\n {...props}\n />\n )\n})\nSidebarGroupAction.displayName = 'SidebarGroupAction'\n\nconst SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} data-sidebar=\"group-content\" className={cn('w-full text-sm', className)} {...props} />\n ),\n)\nSidebarGroupContent.displayName = 'SidebarGroupContent'\n\nexport {\n SidebarRoot,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarHeaderTrigger,\n SidebarInput,\n SidebarLogo,\n SidebarProvider,\n SidebarSeparator,\n SidebarTrigger,\n sidebarGroupActionVariants,\n sidebarGroupLabelVariants,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,IAAA,sBAAA;AACA,IAAA,yBAAA;AACA,IAAA,gBAAA;AACA,IAAA,uBAAA;AACA,IAAA,4BAAA;AAEA,IAAA,qBAAA;CACE,OAAA;CACA,QAAA;CACA,KAAA;AACF;AAGA,IAAA,UAAA,cAAA;CACE,MAAA;CACA,WAAA,QAAA,IAAA,QAAA,mCAAA,MAAA;AACF,CAAA;AAEA,IAAA,kBAAA,QAAA,YAAA,EAAA,cAAA,MAAA,MAAA,UAAA,cAAA,aAAA,OAAA,UAAA,WAAA,OAAA,UAAA,eAAA,cAAA,SAAA,QAAA,GAAA,SAAA,QAAA;CA0BI,MAAA,WAAA,YAAA;CACA,MAAA,CAAA,YAAA,iBAAA,QAAA,SAAA,KAAA;CAEA,MAAA,CAAA,OAAA,YAAA,QAAA,SAAA,WAAA;CACA,MAAA,OAAA,YAAA;CACA,MAAA,UAAA,QAAA,aAAA,UAAA;EAEI,IAAA,aAAA,YAAA,KAAA;OAGE,SAAA,KAAA;EAGF,SAAA,SAAA,GAAA,oBAAA,GAAA,MAAA,oBAAA;CACF,GAAA,CAAA,WAAA,CAAA;CAIF,MAAA,gBAAA,QAAA,kBAAA;EACE,IAAA,UAAA,eAAA,UAAA,CAAA,KAAA;OAGE,QAAA,CAAA,IAAA;CAEJ,GAAA;EAAI;EAAU;EAAM;CAAO,CAAA;CAE3B,MAAA,mBAAA,QAAA,OAAA,aAAA;CACA,QAAA,gBAAA;EACE,iBAAA,UAAA;CACF,GAAA,CAAA,aAAA,CAAA;CAEA,Q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A,kBAAA,cAAA;AAEA,IAAA,6BAAA,IAAA,CAAA,yZAAA,MAAA,CAAA,CAAA,KAAA,GAAA,GAAA;CAMI,UAAA,EAAA,MAAA;EAEI,OAAA;EACA,QAAA;EACA,KAAA;CACF,EAAA;CAEF,iBAAA,EAAA,MAAA,SAAA;AAGF,CAAA;AAGF,IAAA,qBAAA,QAAA,YAAA,EAAA,WAAA,UAAA,OAAA,MAAA,GAAA,SAAA,QAAA;CAIE,MAAA,OAAA,UAAA,OAAA;CACA,MAAA,eAAA,gBAAA,IAAA;CAEA,OAAA,oBAAA,MAAA;EAES;EACL,MAAA,UAAA,KAAA,IAAA;EACA,gBAAA;EACA,WAAA,GAAA,2BAAA,EAAA,MAAA,aAAA,CAAA,GAAA,SAAA;EACA,GAAA;CACD,CAAA;AAEL,CAAA;AACA,mBAAA,cAAA;AAEA,IAAA,sBAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,OAAA;CAEc;CAAK,gBAAA;CAA6B,WAAA,GAAA,kBAAA,SAAA;CAA4C,GAAA;AAAY,CAAA,CAAA;AAGxG,oBAAA,cAAA"}
|
|
@@ -12,7 +12,7 @@ var TAB_SCROLLBAR_HIDDEN_CLASS = [
|
|
|
12
12
|
"[-ms-overflow-style:none]",
|
|
13
13
|
"[&::-webkit-scrollbar]:hidden"
|
|
14
14
|
].join(" ");
|
|
15
|
-
var TABS_TAB_ITEM_CLASSNAME = "focus-visible:ring-ring data-[state=active]:text-foreground relative inline-flex shrink-0
|
|
15
|
+
var TABS_TAB_ITEM_CLASSNAME = "focus-visible:ring-ring data-[state=active]:text-foreground relative inline-flex shrink-0 items-center justify-center rounded-lg px-3 py-2 whitespace-nowrap text-neutral-400 ring-offset-1 transition-all after:absolute after:inset-x-3 after:bottom-0 after:h-0.75 after:scale-x-0 after:bg-[var(--tab-active-color)] hover:bg-neutral-50 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:after:scale-x-100 data-[state=active]:hover:bg-transparent";
|
|
16
16
|
var TabsList = React$1.forwardRef(({ className, fullWidth, underlined, ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.List, {
|
|
17
17
|
ref,
|
|
18
18
|
className: cn(TAB_SCROLLBAR_HIDDEN_CLASS, "flex", fullWidth ? "w-full *:flex-1" : "gap-2", underlined && "border-b border-neutral-100", className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","names":["React"],"sources":["../../../../src/components/navigation/Tabs/Tabs.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport * as React from 'react'\n\nimport { Typography } from '../../data-display/Typography'\n\nimport { cn, resolveColor, type ColorToken } from '@/lib/utils'\n\nconst Tabs = TabsPrimitive.Root\n\nconst TAB_SCROLLBAR_HIDDEN_CLASS = [\n 'overflow-x-auto',\n '[scrollbar-width:none]',\n '[-ms-overflow-style:none]',\n '[&::-webkit-scrollbar]:hidden',\n].join(' ')\n\nconst TABS_TAB_ITEM_CLASSNAME =\n 'focus-visible:ring-ring data-[state=active]:text-foreground relative inline-flex shrink-0
|
|
1
|
+
{"version":3,"file":"Tabs.js","names":["React"],"sources":["../../../../src/components/navigation/Tabs/Tabs.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport * as React from 'react'\n\nimport { Typography } from '../../data-display/Typography'\n\nimport { cn, resolveColor, type ColorToken } from '@/lib/utils'\n\nconst Tabs = TabsPrimitive.Root\n\nconst TAB_SCROLLBAR_HIDDEN_CLASS = [\n 'overflow-x-auto',\n '[scrollbar-width:none]',\n '[-ms-overflow-style:none]',\n '[&::-webkit-scrollbar]:hidden',\n].join(' ')\n\nconst TABS_TAB_ITEM_CLASSNAME =\n 'focus-visible:ring-ring data-[state=active]:text-foreground relative inline-flex shrink-0 items-center justify-center rounded-lg px-3 py-2 whitespace-nowrap text-neutral-400 ring-offset-1 transition-all after:absolute after:inset-x-3 after:bottom-0 after:h-0.75 after:scale-x-0 after:bg-[var(--tab-active-color)] hover:bg-neutral-50 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:after:scale-x-100 data-[state=active]:hover:bg-transparent'\n\ntype TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {\n fullWidth?: boolean\n underlined?: boolean\n}\n\nconst TabsList = React.forwardRef<React.ComponentRef<typeof TabsPrimitive.List>, TabsListProps>(\n ({ className, fullWidth, underlined, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n TAB_SCROLLBAR_HIDDEN_CLASS,\n 'flex',\n fullWidth ? 'w-full *:flex-1' : 'gap-2',\n underlined && 'border-b border-neutral-100',\n className,\n )}\n {...props}\n />\n ),\n)\nTabsList.displayName = TabsPrimitive.List.displayName\n\ntype TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {\n color?: ColorToken | string\n}\n\nconst TabsTrigger = React.forwardRef<React.ComponentRef<typeof TabsPrimitive.Trigger>, TabsTriggerProps>(\n ({ className, children, color, style, ...props }, ref) => (\n <TabsPrimitive.Trigger\n asChild\n ref={ref}\n className={cn(TABS_TAB_ITEM_CLASSNAME, className)}\n style={\n {\n '--tab-active-color': resolveColor(color),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n <Typography variant=\"title-md\">{children}</Typography>\n </TabsPrimitive.Trigger>\n ),\n)\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\ntype TabsLinkProps = React.ComponentPropsWithoutRef<'a'> & {\n active?: boolean\n color?: ColorToken | string\n asChild?: boolean\n}\n\nconst TabsLink = React.forwardRef<HTMLAnchorElement, TabsLinkProps>(\n ({ className, children, color, style, active = false, asChild, ...props }, ref) => {\n const Comp = asChild ? Slot : 'a'\n\n return (\n <Comp\n ref={ref}\n data-state={active ? 'active' : 'inactive'}\n aria-current={active ? 'page' : undefined}\n className={cn(TABS_TAB_ITEM_CLASSNAME, className)}\n style={\n {\n '--tab-active-color': resolveColor(color),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n {asChild ? children : <Typography variant=\"title-md\">{children}</Typography>}\n </Comp>\n )\n },\n)\nTabsLink.displayName = 'TabsLink'\n\nconst TabsContent = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n 'focus-visible:ring-offset ring-offset-background focus-visible:ring-ring mt-2 focus-visible:ring-2 focus-visible:outline-none',\n className,\n )}\n {...props}\n />\n))\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsLink, TabsContent }\n"],"mappings":";;;;;;;AAQA,IAAM,OAAO,cAAc;AAE3B,IAAM,6BAA6B;CACjC;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;AAEV,IAAM,0BACJ;AAOF,IAAM,WAAWA,QAAM,YACpB,EAAE,WAAW,WAAW,YAAY,GAAG,SAAS,QAC/C,oBAAC,cAAc,MAAf;CACO;CACL,WAAW,GACT,4BACA,QACA,YAAY,oBAAoB,SAChC,cAAc,+BACd,SACF;CACA,GAAI;AACL,CAAA,CAEL;AACA,SAAS,cAAc,cAAc,KAAK;AAM1C,IAAM,cAAcA,QAAM,YACvB,EAAE,WAAW,UAAU,OAAO,OAAO,GAAG,SAAS,QAChD,oBAAC,cAAc,SAAf;CACE,SAAA;CACK;CACL,WAAW,GAAG,yBAAyB,SAAS;CAChD,OACE;EACE,sBAAsB,aAAa,KAAK;EACxC,GAAG;CACL;CAEF,GAAI;CAEJ,UAAA,oBAAC,YAAD;EAAY,SAAQ;EAAY;CAAqB,CAAA;AAChC,CAAA,CAE3B;AACA,YAAY,cAAc,cAAc,QAAQ;AAQhD,IAAM,WAAWA,QAAM,YACpB,EAAE,WAAW,UAAU,OAAO,OAAO,SAAS,OAAO,SAAS,GAAG,SAAS,QAAQ;CAGjF,OACE,oBAHW,UAAU,OAAO,KAG5B;EACO;EACL,cAAY,SAAS,WAAW;EAChC,gBAAc,SAAS,SAAS,KAAA;EAChC,WAAW,GAAG,yBAAyB,SAAS;EAChD,OACE;GACE,sBAAsB,aAAa,KAAK;GACxC,GAAG;EACL;EAEF,GAAI;EAEH,UAAA,UAAU,WAAW,oBAAC,YAAD;GAAY,SAAQ;GAAY;EAAqB,CAAA;CACvE,CAAA;AAEV,CACF;AACA,SAAS,cAAc;AAEvB,IAAM,cAAcA,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,cAAc,SAAf;CACO;CACL,WAAW,GACT,iIACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,YAAY,cAAc,cAAc,QAAQ"}
|
|
@@ -67,7 +67,7 @@ var CommandSeparator = React$1.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
67
67
|
CommandSeparator.displayName = Command$1.Separator.displayName;
|
|
68
68
|
var CommandItem = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1.Item, {
|
|
69
69
|
ref,
|
|
70
|
-
className: cn("data-[selected=true]:text-accent-foreground relative flex min-h-12
|
|
70
|
+
className: cn("data-[selected=true]:text-accent-foreground relative flex min-h-12 items-center gap-2 rounded-sm px-2 py-3 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-neutral-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", className),
|
|
71
71
|
...props
|
|
72
72
|
}));
|
|
73
73
|
CommandItem.displayName = Command$1.Item.displayName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","names":["React","CommandPrimitive"],"sources":["../../../../src/components/utils/Command/Command.tsx"],"sourcesContent":["'use client'\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass'\nimport { type DialogProps } from '@radix-ui/react-dialog'\nimport { Command as CommandPrimitive } from 'cmdk'\nimport * as React from 'react'\n\nimport { Dialog, DialogContent } from '../../feedback/Dialog'\n\nimport { cn } from '@/lib/utils'\n\nconst Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn('text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md bg-white', className)}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\nconst CommandDialog = ({ children, ...props }: DialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0\">\n <Command className=\"[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral-400 **:[[cmdk-group]]:px-2 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, children, ...props }, ref) => (\n <div className=\"mx-2.5! my-2.5! flex h-12 items-center rounded-lg border border-neutral-200 px-3\">\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n 'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-400 disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n />\n {children && <div className=\"ml-2\">{children}</div>}\n <MagnifyingGlassIcon className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn('relative max-h-75 overflow-x-hidden overflow-y-auto', className)}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => <CommandPrimitive.Empty ref={ref} className=\"py-6 text-center text-sm\" {...props} />)\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'text-foreground overflow-hidden p-1 text-left **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-normal **:[[cmdk-group-heading]]:text-neutral-400',\n className,\n )}\n {...props}\n />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator ref={ref} className={cn('bg-border h-px', className)} {...props} />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'data-[selected=true]:text-accent-foreground relative flex min-h-12
|
|
1
|
+
{"version":3,"file":"Command.js","names":["React","CommandPrimitive"],"sources":["../../../../src/components/utils/Command/Command.tsx"],"sourcesContent":["'use client'\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass'\nimport { type DialogProps } from '@radix-ui/react-dialog'\nimport { Command as CommandPrimitive } from 'cmdk'\nimport * as React from 'react'\n\nimport { Dialog, DialogContent } from '../../feedback/Dialog'\n\nimport { cn } from '@/lib/utils'\n\nconst Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn('text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md bg-white', className)}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\nconst CommandDialog = ({ children, ...props }: DialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0\">\n <Command className=\"[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral-400 **:[[cmdk-group]]:px-2 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, children, ...props }, ref) => (\n <div className=\"mx-2.5! my-2.5! flex h-12 items-center rounded-lg border border-neutral-200 px-3\">\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n 'flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-400 disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n />\n {children && <div className=\"ml-2\">{children}</div>}\n <MagnifyingGlassIcon className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn('relative max-h-75 overflow-x-hidden overflow-y-auto', className)}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => <CommandPrimitive.Empty ref={ref} className=\"py-6 text-center text-sm\" {...props} />)\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'text-foreground overflow-hidden p-1 text-left **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-normal **:[[cmdk-group-heading]]:text-neutral-400',\n className,\n )}\n {...props}\n />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator ref={ref} className={cn('bg-border h-px', className)} {...props} />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'data-[selected=true]:text-accent-foreground relative flex min-h-12 items-center gap-2 rounded-sm px-2 py-3 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-neutral-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n className,\n )}\n {...props}\n />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-widest text-neutral-400', className)} {...props} />\n}\nCommandShortcut.displayName = 'CommandShortcut'\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n}\n"],"mappings":";;;;;;;;;AAWA,IAAA,UAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,WAAA;CAKS;CACL,WAAA,GAAA,2FAAA,SAAA;CACA,GAAA;AACD,CAAA,CAAA;AAEH,QAAA,cAAA,UAAA;AAEA,IAAA,iBAAA,EAAA,UAAA,GAAA,YAAA;CACE,OAAA,oBAAA,QAAA;EACU,GAAA;EACN,UAAA,oBAAA,eAAA;GAAe,WAAA;GACb,UAAA,oBAAA,SAAA;IAAS,WAAA;IACN;GACM,CAAA;EACI,CAAA;CACT,CAAA;AAEZ;AAEA,IAAA,eAAA,QAAA,YAAA,EAAA,WAAA,UAAA,GAAA,SAAA,QAAA,qBAAA,OAAA;CAIO,WAAA;CAAL,UAAA;EACE,oBAAA,UAAA,OAAA;GACO;GACL,WAAA,GAAA,qJAAA,SAAA;GAIA,GAAA;EACD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ply border-border outline-ring/50;
|
|
249
249
|
}
|
|
250
|
+
|
|
251
|
+
/* Enabled clickable controls get the hand, the common web convention (Tailwind v4's preflight leaves buttons with the arrow). */
|
|
252
|
+
:where(
|
|
253
|
+
button,
|
|
254
|
+
summary,
|
|
255
|
+
[role='button'],
|
|
256
|
+
[role='tab'],
|
|
257
|
+
[role='checkbox'],
|
|
258
|
+
[role='radio'],
|
|
259
|
+
[role='switch'],
|
|
260
|
+
[role='menuitem'],
|
|
261
|
+
[role='menuitemcheckbox'],
|
|
262
|
+
[role='menuitemradio'],
|
|
263
|
+
[role='option']
|
|
264
|
+
):not(:disabled, [aria-disabled='true'], [data-disabled=''], [data-disabled='true']) {
|
|
265
|
+
cursor: pointer;
|
|
266
|
+
}
|
|
250
267
|
}
|
|
251
268
|
|
|
252
269
|
@layer utilities {
|