periplo-ui 4.22.1 → 4.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/inputs/Button/Button.js +2 -2
- package/dist/components/inputs/Button/Button.js.map +1 -1
- package/dist/components/inputs/Checkbox/Checkbox.js +1 -1
- package/dist/components/inputs/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/inputs/Combobox/hooks/useDebouncedState.js +10 -6
- package/dist/components/inputs/Combobox/hooks/useDebouncedState.js.map +1 -1
- package/dist/components/inputs/Command/Command.js +2 -2
- package/dist/components/inputs/Command/Command.js.map +1 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +1 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/inputs/Select/Select.js +1 -1
- package/dist/components/inputs/Select/Select.js.map +1 -1
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js +12 -12
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/navigation/Sidebar/SidebarPage.d.ts +4 -1
- package/dist/components/navigation/Sidebar/SidebarPage.js +5 -3
- package/dist/components/navigation/Sidebar/SidebarPage.js.map +1 -1
- package/dist/components/navigation/Sidebar/SidebarUser.js +3 -3
- package/dist/components/navigation/Sidebar/SidebarUser.js.map +1 -1
- package/dist/theme.css +3 -4
- package/package.json +1 -1
|
@@ -49,8 +49,8 @@ var buttonVariants = cva(`
|
|
|
49
49
|
active:bg-neutral-100
|
|
50
50
|
disabled:bg-neutral-50
|
|
51
51
|
aria-expanded:border-neutral-950
|
|
52
|
-
aria-invalid:border-error-400
|
|
53
|
-
aria-invalid:focus-visible:border-error-700
|
|
52
|
+
aria-invalid:border-error-400 aria-invalid:outline-error-400
|
|
53
|
+
aria-invalid:focus-visible:border-error-700
|
|
54
54
|
`
|
|
55
55
|
},
|
|
56
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["React"],"sources":["../../../../src/components/inputs/Button/Button.tsx"],"sourcesContent":["import type { Icon, IconWeight, IconProps } from '@phosphor-icons/react'\nimport { SpinnerGapIcon } from '@phosphor-icons/react/dist/ssr/SpinnerGap'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../../../lib/utils'\nimport { typographyVariants } from '../../data-display/Typography'\n\nconst buttonVariants = cva(\n `\n inline-flex h-(--control-height) items-center justify-center gap-2 rounded-lg px-(--control-px) font-medium\n transition-colors\n disabled:pointer-events-none disabled:opacity-50\n `,\n {\n variants: {\n /**\n * Defines the visual style of the button\n */\n variant: {\n primary:\n 'bg-primary-500 text-primary-foreground hover:bg-primary-700 active:bg-primary-900 disabled:bg-background-200',\n secondary: `\n bg-neutral-950 text-neutral-foreground\n hover:bg-neutral-800\n active:bg-neutral-700\n disabled:bg-neutral-200 disabled:text-neutral-600\n `,\n ghost: `\n border border-neutral-500 text-primary-foreground\n hover:bg-neutral-100/50\n active:bg-neutral-200/50\n disabled:border-neutral-500 disabled:text-neutral-500\n `,\n 'inverse-ghost': `\n border border-neutral-50 text-neutral-50\n hover:border-neutral-50 hover:bg-neutral/50\n active:bg-neutral-600/50\n disabled:border-neutral-300 disabled:text-neutral-300\n `,\n text: 'text-primary-foreground hover:bg-neutral-50 active:bg-neutral-100 disabled:text-neutral-500',\n error:\n 'bg-error text-white hover:bg-error-800 active:bg-error-900 disabled:bg-error-200 disabled:text-neutral-600',\n success: `\n bg-success text-white\n hover:bg-success-800\n active:bg-success-900\n disabled:bg-success-200 disabled:text-neutral-600\n `,\n input: `\n border border-neutral-200 bg-white text-neutral-950\n hover:bg-neutral-50\n focus-visible:border-neutral-950\n active:bg-neutral-100\n disabled:bg-neutral-50\n aria-expanded:border-neutral-950\n aria-invalid:border-error-400
|
|
1
|
+
{"version":3,"file":"Button.js","names":["React"],"sources":["../../../../src/components/inputs/Button/Button.tsx"],"sourcesContent":["import type { Icon, IconWeight, IconProps } from '@phosphor-icons/react'\nimport { SpinnerGapIcon } from '@phosphor-icons/react/dist/ssr/SpinnerGap'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../../../lib/utils'\nimport { typographyVariants } from '../../data-display/Typography'\n\nconst buttonVariants = cva(\n `\n inline-flex h-(--control-height) items-center justify-center gap-2 rounded-lg px-(--control-px) font-medium\n transition-colors\n disabled:pointer-events-none disabled:opacity-50\n `,\n {\n variants: {\n /**\n * Defines the visual style of the button\n */\n variant: {\n primary:\n 'bg-primary-500 text-primary-foreground hover:bg-primary-700 active:bg-primary-900 disabled:bg-background-200',\n secondary: `\n bg-neutral-950 text-neutral-foreground\n hover:bg-neutral-800\n active:bg-neutral-700\n disabled:bg-neutral-200 disabled:text-neutral-600\n `,\n ghost: `\n border border-neutral-500 text-primary-foreground\n hover:bg-neutral-100/50\n active:bg-neutral-200/50\n disabled:border-neutral-500 disabled:text-neutral-500\n `,\n 'inverse-ghost': `\n border border-neutral-50 text-neutral-50\n hover:border-neutral-50 hover:bg-neutral/50\n active:bg-neutral-600/50\n disabled:border-neutral-300 disabled:text-neutral-300\n `,\n text: 'text-primary-foreground hover:bg-neutral-50 active:bg-neutral-100 disabled:text-neutral-500',\n error:\n 'bg-error text-white hover:bg-error-800 active:bg-error-900 disabled:bg-error-200 disabled:text-neutral-600',\n success: `\n bg-success text-white\n hover:bg-success-800\n active:bg-success-900\n disabled:bg-success-200 disabled:text-neutral-600\n `,\n input: `\n border border-neutral-200 bg-white text-neutral-950\n hover:bg-neutral-50\n focus-visible:border-neutral-950\n active:bg-neutral-100\n disabled:bg-neutral-50\n aria-expanded:border-neutral-950\n aria-invalid:border-error-400 aria-invalid:outline-error-400\n aria-invalid:focus-visible:border-error-700\n `,\n },\n /**\n * Controls the size and padding of the button\n */\n size: {\n sm: 'text-(length:--control-text-sm) leading-(--control-leading-sm) control-sm',\n md: 'text-sm control-md',\n lg: 'text-base control-lg',\n },\n iconOnly: {\n true: 'w-(--control-height) rounded-full p-0',\n },\n },\n compoundVariants: [\n {\n variant: 'input',\n className: [\n typographyVariants({ variant: 'body-lg' }),\n 'px-(--control-inset) text-(length:--control-text) leading-(--control-leading)',\n ],\n },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n)\n\nexport type ControlSize = 'sm' | 'md' | 'lg'\n\nexport type ButtonProps = {\n /**\n * The visual style of the button.\n * @default primary\n */\n variant?: 'primary' | 'secondary' | 'ghost' | 'inverse-ghost' | 'text' | 'error' | 'success' | 'input'\n\n /**\n * The size of the button, affecting height, padding, and font size.\n * @default md\n */\n size?: ControlSize\n\n /**\n * Icon component to display at the start of the button content.\n * Use Phosphor icons for consistent styling.\n * @example <Button StartIcon={House}>Home</Button>\n */\n StartIcon?: Icon\n\n /**\n * Icon component to display at the end of the button content.\n * Use Phosphor icons for consistent styling.\n * @example <Button EndIcon={ArrowRight}>Next</Button>\n */\n EndIcon?: Icon\n\n /**\n * When true, displays a loading spinner and disables the button.\n * The spinner replaces the StartIcon if present.\n * @default false\n */\n loading?: boolean\n\n /**\n * When true, creates a circular button with only the StartIcon visible.\n * @default false\n */\n iconOnly?: boolean\n\n /**\n * The content to display inside the button.\n * Not displayed when iconOnly is true.\n */\n children?: React.ReactNode\n\n /**\n * Custom props to pass to the icons (StartIcon, EndIcon, SpinnerGap).\n * Allows overriding size, weight, color, etc.\n */\n iconProps?: Partial<IconProps>\n} & React.ButtonHTMLAttributes<HTMLButtonElement> &\n VariantProps<typeof buttonVariants>\n\n/**\n * A versatile button component that supports multiple variants, sizes, and icon placements.\n *\n * @example\n * // Basic usage\n * <Button>Click me</Button>\n *\n * // With icon\n * <Button StartIcon={House}>Home</Button>\n *\n * // Icon only button\n * <Button StartIcon={Plus} iconOnly aria-label=\"Add item\" />\n *\n * // Loading state\n * <Button loading>Processing...</Button>\n */\nconst Button = React.forwardRef<HTMLButtonElement, Readonly<ButtonProps>>(\n (\n { className, variant = 'primary', size = 'md', StartIcon, EndIcon, loading, iconOnly, iconProps = {}, ...props },\n ref,\n ) => {\n const defaultIconProps = (): { size: number; weight: IconWeight } => {\n switch (size) {\n case 'sm':\n return { size: 16, weight: 'regular' }\n case 'lg':\n return { size: 20, weight: 'regular' }\n default:\n return { size: 18, weight: 'regular' }\n }\n }\n const mergedIconProps = { ...defaultIconProps(), ...iconProps }\n return (\n <button\n className={cn(buttonVariants({ variant, size, iconOnly }), className)}\n ref={ref}\n disabled={loading}\n {...props}\n >\n {loading && <SpinnerGapIcon {...defaultIconProps()} className=\"animate-spin\" aria-label=\"Loading\" />}\n {StartIcon && !loading && <StartIcon {...mergedIconProps} className=\"shrink-0\" />}\n {iconOnly ? <span className=\"sr-only\">{props.children}</span> : props.children}\n {EndIcon && !iconOnly && <EndIcon {...mergedIconProps} className=\"shrink-0\" />}\n </button>\n )\n },\n)\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;AAQA,IAAM,iBAAiB,IACrB;;;;KAKA;CACE,UAAU;;;;EAIR,SAAS;GACP,SACE;GACF,WAAW;;;;;;GAMX,OAAO;;;;;;GAMP,iBAAiB;;;;;;GAMjB,MAAM;GACN,OACE;GACF,SAAS;;;;;;GAMT,OAAO;;;;;;;;;;EAUT;;;;EAIA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,UAAU,EACR,MAAM,wCACR;CACF;CACA,kBAAkB,CAChB;EACE,SAAS;EACT,WAAW,CACT,mBAAmB,EAAE,SAAS,UAAU,CAAC,GACzC,+EACF;CACF,CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CACF;;;;;;;;;;;;;;;;;AA0EA,IAAM,SAASA,QAAM,YAEjB,EAAE,WAAW,UAAU,WAAW,OAAO,MAAM,WAAW,SAAS,SAAS,UAAU,YAAY,CAAC,GAAG,GAAG,SACzG,QACG;CACH,MAAM,yBAA+D;EACnE,QAAQ,MAAR;GACE,KAAK,MACH,OAAO;IAAE,MAAM;IAAI,QAAQ;GAAU;GACvC,KAAK,MACH,OAAO;IAAE,MAAM;IAAI,QAAQ;GAAU;GACvC,SACE,OAAO;IAAE,MAAM;IAAI,QAAQ;GAAU;EACzC;CACF;CACA,MAAM,kBAAkB;EAAE,GAAG,iBAAiB;EAAG,GAAG;CAAU;CAC9D,OACE,qBAAC,UAAD;EACE,WAAW,GAAG,eAAe;GAAE;GAAS;GAAM;EAAS,CAAC,GAAG,SAAS;EAC/D;EACL,UAAU;EACV,GAAI;EAJN,UAAA;GAMG,WAAW,oBAAC,gBAAD;IAAgB,GAAI,iBAAiB;IAAG,WAAU;IAAe,cAAW;GAAW,CAAA;GAClG,aAAa,CAAC,WAAW,oBAAC,WAAD;IAAW,GAAI;IAAiB,WAAU;GAAY,CAAA;GAC/E,WAAW,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,MAAM;GAAe,CAAA,IAAI,MAAM;GACrE,WAAW,CAAC,YAAY,oBAAC,SAAD;IAAS,GAAI;IAAiB,WAAU;GAAY,CAAA;EACvE;;AAEZ,CACF;AACA,OAAO,cAAc"}
|
|
@@ -33,7 +33,7 @@ var Checkbox = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
33
33
|
hover:border-neutral-600
|
|
34
34
|
disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-100 disabled:opacity-50
|
|
35
35
|
disabled:hover:border-neutral-200
|
|
36
|
-
aria-invalid:
|
|
36
|
+
aria-invalid:outline-error-400
|
|
37
37
|
pointer-coarse:hit-area-x-3.5 pointer-coarse:hit-area-y-1.5
|
|
38
38
|
data-[state=checked]:border-neutral-600 data-[state=checked]:bg-white
|
|
39
39
|
data-[state=checked]:hover:border-neutral-600
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":["React"],"sources":["../../../../src/components/inputs/Checkbox/Checkbox.tsx"],"sourcesContent":["import { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { MinusIcon } from '@phosphor-icons/react/dist/ssr/Minus'\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\ntype CheckboxProps = {\n /** Additional CSS classes to be applied to the checkbox */\n className?: string\n /** The controlled checked state of the checkbox. `'indeterminate'` renders a partial (dash) state. */\n checked?: CheckboxPrimitive.CheckedState\n /** The default checked state when initially rendered */\n defaultChecked?: boolean\n /** Whether the checkbox is disabled */\n disabled?: boolean\n /** Whether the checkbox is required in a form */\n required?: boolean\n /** The name of the checkbox when used in a form */\n name?: string\n /** The value of the checkbox when used in a form */\n value?: string\n /** Handler called when the checked state changes */\n onCheckedChange?: (checked: boolean) => void\n} & React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n\n/**\n * A controlled checkbox component built on top of Radix UI Checkbox.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Checkbox />\n *\n * // With controlled state\n * <Checkbox checked={checked} onCheckedChange={setChecked} />\n *\n * // With form integration\n * <Checkbox name=\"terms\" required />\n *\n * // With label\n * <div className=\"flex items-center gap-2\">\n * <Checkbox id=\"terms\" />\n * <label htmlFor=\"terms\">Accept terms</label>\n * </div>\n * ```\n */\nconst Checkbox = React.forwardRef<React.ComponentRef<typeof CheckboxPrimitive.Root>, Readonly<CheckboxProps>>(\n ({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n `\n peer relative h-5 w-5 shrink-0 rounded border border-neutral-300 bg-white transition-colors\n hover:border-neutral-600\n disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-100 disabled:opacity-50\n disabled:hover:border-neutral-200\n aria-invalid:
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["React"],"sources":["../../../../src/components/inputs/Checkbox/Checkbox.tsx"],"sourcesContent":["import { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { MinusIcon } from '@phosphor-icons/react/dist/ssr/Minus'\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\ntype CheckboxProps = {\n /** Additional CSS classes to be applied to the checkbox */\n className?: string\n /** The controlled checked state of the checkbox. `'indeterminate'` renders a partial (dash) state. */\n checked?: CheckboxPrimitive.CheckedState\n /** The default checked state when initially rendered */\n defaultChecked?: boolean\n /** Whether the checkbox is disabled */\n disabled?: boolean\n /** Whether the checkbox is required in a form */\n required?: boolean\n /** The name of the checkbox when used in a form */\n name?: string\n /** The value of the checkbox when used in a form */\n value?: string\n /** Handler called when the checked state changes */\n onCheckedChange?: (checked: boolean) => void\n} & React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n\n/**\n * A controlled checkbox component built on top of Radix UI Checkbox.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Checkbox />\n *\n * // With controlled state\n * <Checkbox checked={checked} onCheckedChange={setChecked} />\n *\n * // With form integration\n * <Checkbox name=\"terms\" required />\n *\n * // With label\n * <div className=\"flex items-center gap-2\">\n * <Checkbox id=\"terms\" />\n * <label htmlFor=\"terms\">Accept terms</label>\n * </div>\n * ```\n */\nconst Checkbox = React.forwardRef<React.ComponentRef<typeof CheckboxPrimitive.Root>, Readonly<CheckboxProps>>(\n ({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n `\n peer relative h-5 w-5 shrink-0 rounded border border-neutral-300 bg-white transition-colors\n hover:border-neutral-600\n disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-100 disabled:opacity-50\n disabled:hover:border-neutral-200\n aria-invalid:outline-error-400\n pointer-coarse:hit-area-x-3.5 pointer-coarse:hit-area-y-1.5\n data-[state=checked]:border-neutral-600 data-[state=checked]:bg-white\n data-[state=checked]:hover:border-neutral-600\n data-[state=indeterminate]:border-neutral-600 data-[state=indeterminate]:bg-white\n `,\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className=\"\n absolute inset-0 flex animate-in items-center justify-center duration-150 ease-out-strong fade-in-0 zoom-in-90\n motion-reduce:zoom-in-100\n \"\n >\n {props.checked === 'indeterminate' ? (\n <MinusIcon className=\"h-3.5 w-3.5 text-neutral-600\" weight=\"bold\" />\n ) : (\n <CheckIcon className=\"h-3.5 w-3.5 text-neutral-600\" weight=\"bold\" />\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n ),\n)\n\nCheckbox.displayName = 'Checkbox'\n\nexport type { CheckboxProps }\nexport { Checkbox }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAM,WAAWA,QAAM,YACpB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,kBAAkB,MAAnB;CACO;CACL,WAAW,GACT;;;;;;;;;;WAWA,SACF;CACA,GAAI;CAEJ,UAAA,oBAAC,kBAAkB,WAAnB;EACE,WAAU;EAKT,UAAA,MAAM,YAAY,kBACjB,oBAAC,WAAD;GAAW,WAAU;GAA+B,QAAO;EAAQ,CAAA,IAEnE,oBAAC,WAAD;GAAW,WAAU;GAA+B,QAAO;EAAQ,CAAA;CAE1C,CAAA;AACP,CAAA,CAE5B;AAEA,SAAS,cAAc"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { useCallback, useRef, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
//#region src/components/inputs/Combobox/hooks/useDebouncedState.ts
|
|
3
3
|
function useDebouncedState(initial, delay = 300) {
|
|
4
4
|
const [value, setImmediateValue] = useState(initial);
|
|
5
5
|
const [debouncedValue, setDebouncedValue] = useState(initial);
|
|
6
6
|
const timerRef = useRef(null);
|
|
7
|
+
const setValue = useCallback((next) => {
|
|
8
|
+
setImmediateValue(next);
|
|
9
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
10
|
+
timerRef.current = setTimeout(() => setDebouncedValue(next), delay);
|
|
11
|
+
}, [delay]);
|
|
12
|
+
useEffect(() => () => {
|
|
13
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
14
|
+
}, []);
|
|
7
15
|
return {
|
|
8
16
|
value,
|
|
9
17
|
debouncedValue,
|
|
10
|
-
setValue
|
|
11
|
-
setImmediateValue(next);
|
|
12
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
13
|
-
timerRef.current = setTimeout(() => setDebouncedValue(next), delay);
|
|
14
|
-
}, [delay])
|
|
18
|
+
setValue
|
|
15
19
|
};
|
|
16
20
|
}
|
|
17
21
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebouncedState.js","names":[],"sources":["../../../../../src/components/inputs/Combobox/hooks/useDebouncedState.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react'\n\nexport function useDebouncedState<T>(initial: T, delay: number = 300) {\n const [value, setImmediateValue] = useState<T>(initial)\n const [debouncedValue, setDebouncedValue] = useState<T>(initial)\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const setValue = useCallback(\n (next: T) => {\n setImmediateValue(next)\n if (timerRef.current) clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setDebouncedValue(next), delay)\n },\n [delay],\n )\n\n return { value, debouncedValue, setValue }\n}\n"],"mappings":";;AAEA,SAAgB,kBAAqB,SAAY,QAAgB,KAAK;CACpE,MAAM,CAAC,OAAO,qBAAqB,SAAY,OAAO;CACtD,MAAM,CAAC,gBAAgB,qBAAqB,SAAY,OAAO;CAC/D,MAAM,WAAW,OAA6C,IAAI;
|
|
1
|
+
{"version":3,"file":"useDebouncedState.js","names":[],"sources":["../../../../../src/components/inputs/Combobox/hooks/useDebouncedState.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\nexport function useDebouncedState<T>(initial: T, delay: number = 300) {\n const [value, setImmediateValue] = useState<T>(initial)\n const [debouncedValue, setDebouncedValue] = useState<T>(initial)\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const setValue = useCallback(\n (next: T) => {\n setImmediateValue(next)\n if (timerRef.current) clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setDebouncedValue(next), delay)\n },\n [delay],\n )\n\n useEffect(\n () => () => {\n if (timerRef.current) clearTimeout(timerRef.current)\n },\n [],\n )\n\n return { value, debouncedValue, setValue }\n}\n"],"mappings":";;AAEA,SAAgB,kBAAqB,SAAY,QAAgB,KAAK;CACpE,MAAM,CAAC,OAAO,qBAAqB,SAAY,OAAO;CACtD,MAAM,CAAC,gBAAgB,qBAAqB,SAAY,OAAO;CAC/D,MAAM,WAAW,OAA6C,IAAI;CAElE,MAAM,WAAW,aACd,SAAY;EACX,kBAAkB,IAAI;EACtB,IAAI,SAAS,SAAS,aAAa,SAAS,OAAO;EACnD,SAAS,UAAU,iBAAiB,kBAAkB,IAAI,GAAG,KAAK;CACpE,GACA,CAAC,KAAK,CACR;CAEA,sBACc;EACV,IAAI,SAAS,SAAS,aAAa,SAAS,OAAO;CACrD,GACA,CAAC,CACH;CAEA,OAAO;EAAE;EAAO;EAAgB;CAAS;AAC3C"}
|
|
@@ -79,10 +79,10 @@ var CommandItem = React$1.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
79
79
|
ref,
|
|
80
80
|
className: cn(`
|
|
81
81
|
relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))
|
|
82
|
-
items-center gap-2 surface-item press-fill px-3 py-1.5 text-(length:--control-option-text,0.875rem)
|
|
82
|
+
items-center gap-2 surface-item press-fill-strong px-3 py-1.5 text-(length:--control-option-text,0.875rem)
|
|
83
83
|
leading-(--control-option-leading,1.25rem) outline-hidden select-none
|
|
84
84
|
data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50
|
|
85
|
-
data-[selected=true]:bg-neutral-
|
|
85
|
+
data-[selected=true]:bg-neutral-100
|
|
86
86
|
[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0
|
|
87
87
|
`, className),
|
|
88
88
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","names":["React","CommandPrimitive"],"sources":["../../../../src/components/inputs/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 Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn('flex h-full w-full flex-col overflow-hidden bg-white text-popover-foreground', className)}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\nconst CommandDialog = ({ children, ...props }: Readonly<DialogProps>) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden surface p-0 surface-list\">\n <Command\n className=\"\n **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium\n **:[[cmdk-group-heading]]:text-neutral-400\n **:[[cmdk-group]]:px-2\n **:[[cmdk-input]]:h-12\n **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3\n [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0\n [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5\n [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\n \"\n >\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>>\n>(({ className, children, ...props }, ref) => (\n <div\n className=\"\n m-[calc(var(--surface-inset)*2)] flex\n h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) items-center rounded-lg\n border border-neutral-200 px-3 transition-colors\n focus-within:border-neutral-950\n \"\n >\n <MagnifyingGlassIcon className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n `\n flex h-full w-full rounded-md bg-transparent py-3 text-(length:--control-option-text,0.875rem)\n leading-(--control-option-leading,1.25rem)\n placeholder:text-neutral-500\n disabled:cursor-not-allowed disabled:opacity-50\n pointer-coarse:text-base\n `,\n className,\n )}\n {...props}\n />\n {children && <div className=\"ml-2\">{children}</div>}\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\n 'relative max-h-75 scrollbar-subtle overflow-x-hidden overflow-y-auto px-(--surface-inset) pb-(--surface-inset)',\n className,\n )}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n Readonly<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 Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n `\n overflow-hidden text-left text-foreground\n **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm\n **:[[cmdk-group-heading]]:font-normal **:[[cmdk-group-heading]]:text-neutral-400\n `,\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 Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator ref={ref} className={cn('my-1 h-px bg-border', className)} {...props} />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))\n items-center gap-2 surface-item press-fill px-3 py-1.5 text-(length:--control-option-text,0.875rem)\n leading-(--control-option-leading,1.25rem) outline-hidden select-none\n data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50\n data-[selected=true]:bg-neutral-
|
|
1
|
+
{"version":3,"file":"Command.js","names":["React","CommandPrimitive"],"sources":["../../../../src/components/inputs/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 Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn('flex h-full w-full flex-col overflow-hidden bg-white text-popover-foreground', className)}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\nconst CommandDialog = ({ children, ...props }: Readonly<DialogProps>) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden surface p-0 surface-list\">\n <Command\n className=\"\n **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium\n **:[[cmdk-group-heading]]:text-neutral-400\n **:[[cmdk-group]]:px-2\n **:[[cmdk-input]]:h-12\n **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3\n [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0\n [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5\n [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\n \"\n >\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>>\n>(({ className, children, ...props }, ref) => (\n <div\n className=\"\n m-[calc(var(--surface-inset)*2)] flex\n h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) items-center rounded-lg\n border border-neutral-200 px-3 transition-colors\n focus-within:border-neutral-950\n \"\n >\n <MagnifyingGlassIcon className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n `\n flex h-full w-full rounded-md bg-transparent py-3 text-(length:--control-option-text,0.875rem)\n leading-(--control-option-leading,1.25rem)\n placeholder:text-neutral-500\n disabled:cursor-not-allowed disabled:opacity-50\n pointer-coarse:text-base\n `,\n className,\n )}\n {...props}\n />\n {children && <div className=\"ml-2\">{children}</div>}\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\n 'relative max-h-75 scrollbar-subtle overflow-x-hidden overflow-y-auto px-(--surface-inset) pb-(--surface-inset)',\n className,\n )}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n Readonly<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 Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n `\n overflow-hidden text-left text-foreground\n **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm\n **:[[cmdk-group-heading]]:font-normal **:[[cmdk-group-heading]]:text-neutral-400\n `,\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 Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator ref={ref} className={cn('my-1 h-px bg-border', className)} {...props} />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n Readonly<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height)))\n items-center gap-2 surface-item press-fill-strong px-3 py-1.5 text-(length:--control-option-text,0.875rem)\n leading-(--control-option-leading,1.25rem) outline-hidden select-none\n data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50\n data-[selected=true]:bg-neutral-100\n [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\n `,\n className,\n )}\n {...props}\n />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({ className, ...props }: Readonly<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,gFAAA,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;IACE,WAAA;IAWC;GACM,CAAA;EACI,CAAA;CACT,CAAA;AAEZ;AAEA,IAAA,eAAA,QAAA,YAAA,EAAA,WAAA,UAAA,GAAA,SAAA,QAAA,qBAAA,OAAA;CAKI,WAAA;CADF,UAAA;EAQE,oBAAA,qBAAA,EAAA,WAAA,mCAAA,CAAA;EACA,oBAAA,UAAA,OAAA;GACO;GACL,WAAA,GAAA;;;;;;WAQE,SAAA;GAEF,GAAA;EACD,CAAA;EACA,YAAA,oBAAA,OAAA;GAAiB,WAAA;GAAkB;EAAc,CAAA;CAC/C;AACN,CAAA,CAAA;AAED,aAAA,cAAA,UAAA,MAAA;AAEA,IAAA,cAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,MAAA;CAKS;CACL,WAAA,GAAA,kHAAA,SAAA;CAIA,GAAA;AACD,CAAA,CAAA;AAGH,YAAA,cAAA,UAAA,KAAA;AAEA,IAAA,eAAA,QAAA,YAAA,OAAA,QAAA,oBAAA,UAAA,OAAA;CAG+C;CAAK,WAAA;CAAqC,GAAA;AAAY,CAAA,CAAA;AAErG,aAAA,cAAA,UAAA,MAAA;AAEA,IAAA,eAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,OAAA;CAKS;CACL,WAAA,GAAA;;;;SAME,SAAA;CAEF,GAAA;AACD,CAAA,CAAA;AAGH,aAAA,cAAA,UAAA,MAAA;AAEA,IAAA,mBAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,WAAA;CAImC;CAAK,WAAA,GAAA,uBAAA,SAAA;CAAiD,GAAA;AAAY,CAAA,CAAA;AAErG,iBAAA,cAAA,UAAA,UAAA;AAEA,IAAA,cAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA,oBAAA,UAAA,MAAA;CAKS;CACL,WAAA,GAAA;;;;;;;SASE,SAAA;CAEF,GAAA;AACD,CAAA,CAAA;AAGH,YAAA,cAAA,UAAA,KAAA;AAEA,IAAA,mBAAA,EAAA,WAAA,GAAA,YAAA;CACE,OAAA,oBAAA,QAAA;EAAa,WAAA,GAAA,oDAAA,SAAA;EAA8E,GAAA;CAAY,CAAA;AACzG;AACA,gBAAA,cAAA"}
|
|
@@ -31,8 +31,7 @@ var RadioGroupItem = React$1.forwardRef(({ className, label, helperText, error,
|
|
|
31
31
|
group relative aspect-square h-4 w-4 shrink-0 rounded-full border border-neutral-500 transition-colors
|
|
32
32
|
enabled:hover:border-neutral-800
|
|
33
33
|
disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-50
|
|
34
|
-
data-invalid:border-error-400
|
|
35
|
-
data-invalid:focus-visible:outline-error-400
|
|
34
|
+
data-invalid:border-error-400 data-invalid:outline-error-400
|
|
36
35
|
data-invalid:enabled:hover:border-error-500
|
|
37
36
|
pointer-coarse:hit-area-x-3.5 pointer-coarse:hit-area-y-1.5
|
|
38
37
|
`, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","names":["React"],"sources":["../../../../src/components/inputs/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport * as React from 'react'\nimport type { ReactNode } from 'react'\n\nimport { FieldError } from '../Field'\nimport { isFieldInvalid } from '../shared'\n\nimport { cn } from '@/lib/utils'\n\nconst RadioGroup = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n Readonly<React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nexport type RadioGroupItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {\n /** Label displayed next to the radio control. */\n label?: ReactNode\n\n /** Informational text displayed below the label. Not shown while `error` is set. */\n helperText?: ReactNode\n\n /**\n * Marks the item as invalid and applies error styling. Pass a string to\n * also display it as the message below the label, replacing `helperText`.\n */\n error?: boolean | string\n}\n\nconst RadioGroupItem = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Item>,\n Readonly<RadioGroupItemProps>\n>(({ className, label, helperText, error, 'aria-invalid': ariaInvalid, id, disabled, ...props }, ref) => {\n const generatedId = React.useId()\n const isError = isFieldInvalid(error, ariaInvalid)\n\n let secondaryText: ReactNode\n if (isError) {\n secondaryText = typeof error === 'string' ? error : undefined\n } else {\n secondaryText = helperText\n }\n\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- an explicit empty string must still count as \"no content\"\n const hasContent = Boolean(label || secondaryText)\n const itemId = id ?? (hasContent ? generatedId : undefined)\n\n const item = (\n <RadioGroupPrimitive.Item\n ref={ref}\n id={itemId}\n disabled={disabled}\n data-invalid={(isError && !disabled) || undefined}\n aria-invalid={isError || undefined}\n className={cn(\n `\n group relative aspect-square h-4 w-4 shrink-0 rounded-full border border-neutral-500 transition-colors\n enabled:hover:border-neutral-800\n disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-50\n data-invalid:border-error-400
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","names":["React"],"sources":["../../../../src/components/inputs/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport * as React from 'react'\nimport type { ReactNode } from 'react'\n\nimport { FieldError } from '../Field'\nimport { isFieldInvalid } from '../shared'\n\nimport { cn } from '@/lib/utils'\n\nconst RadioGroup = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n Readonly<React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nexport type RadioGroupItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {\n /** Label displayed next to the radio control. */\n label?: ReactNode\n\n /** Informational text displayed below the label. Not shown while `error` is set. */\n helperText?: ReactNode\n\n /**\n * Marks the item as invalid and applies error styling. Pass a string to\n * also display it as the message below the label, replacing `helperText`.\n */\n error?: boolean | string\n}\n\nconst RadioGroupItem = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Item>,\n Readonly<RadioGroupItemProps>\n>(({ className, label, helperText, error, 'aria-invalid': ariaInvalid, id, disabled, ...props }, ref) => {\n const generatedId = React.useId()\n const isError = isFieldInvalid(error, ariaInvalid)\n\n let secondaryText: ReactNode\n if (isError) {\n secondaryText = typeof error === 'string' ? error : undefined\n } else {\n secondaryText = helperText\n }\n\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- an explicit empty string must still count as \"no content\"\n const hasContent = Boolean(label || secondaryText)\n const itemId = id ?? (hasContent ? generatedId : undefined)\n\n const item = (\n <RadioGroupPrimitive.Item\n ref={ref}\n id={itemId}\n disabled={disabled}\n data-invalid={(isError && !disabled) || undefined}\n aria-invalid={isError || undefined}\n className={cn(\n `\n group relative aspect-square h-4 w-4 shrink-0 rounded-full border border-neutral-500 transition-colors\n enabled:hover:border-neutral-800\n disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-50\n data-invalid:border-error-400 data-invalid:outline-error-400\n data-invalid:enabled:hover:border-error-500\n pointer-coarse:hit-area-x-3.5 pointer-coarse:hit-area-y-1.5\n `,\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n className=\"\n flex animate-in items-center justify-center duration-150 ease-out-strong fade-in-0 zoom-in-50\n motion-reduce:zoom-in-100\n \"\n >\n <span\n className=\"\n block h-2 w-2 rounded-full bg-neutral-500\n group-enabled:group-hover:bg-neutral-800\n group-disabled:bg-neutral-200\n group-data-invalid:bg-error-400\n group-data-invalid:group-enabled:group-hover:bg-error-500\n \"\n />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n\n if (!hasContent) {\n return item\n }\n\n return (\n <div\n data-disabled={disabled ? '' : undefined}\n data-invalid={isError || undefined}\n className=\"group/radio flex items-start gap-2\"\n >\n <span className=\"mt-0.5 inline-flex\">{item}</span>\n <div className=\"flex flex-col gap-0.5\">\n {label ? (\n <label htmlFor={itemId} className=\"text-sm text-neutral-950 group-data-disabled/radio:opacity-50\">\n {label}\n </label>\n ) : null}\n {secondaryText && isError && (\n <FieldError className=\"group-data-disabled/radio:opacity-50\">{secondaryText}</FieldError>\n )}\n {secondaryText && !isError && (\n <span className=\"text-xs text-neutral-500 group-data-disabled/radio:opacity-50\">{secondaryText}</span>\n )}\n </div>\n </div>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport { RadioGroup, RadioGroupItem }\n"],"mappings":";;;;;;;AASA,IAAM,aAAaA,QAAM,YAGtB,EA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WAAU;KAAiE,UAAA;IAAoB,CAAA;GAEpG;EACF,CAAA,CAAA;;AAET,CAAC;AACD,eAAe,cAAc,oBAAoB,KAAK"}
|
|
@@ -11,7 +11,7 @@ import { CaretUpIcon } from "@phosphor-icons/react/dist/ssr/CaretUp";
|
|
|
11
11
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
12
12
|
//#region src/components/inputs/Select/Select.tsx
|
|
13
13
|
var SelectRoot = SelectPrimitive.Root;
|
|
14
|
-
var selectItemClassName = "surface-item press-fill-strong relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) w-full py-1.5 text-(length:--control-option-text,0.875rem) leading-(--control-option-leading,1.25rem) select-none
|
|
14
|
+
var selectItemClassName = "surface-item press-fill-strong relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) w-full py-1.5 text-(length:--control-option-text,0.875rem) leading-(--control-option-leading,1.25rem) outline-hidden select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50";
|
|
15
15
|
var SelectGroup = SelectPrimitive.Group;
|
|
16
16
|
var SelectValue = SelectPrimitive.Value;
|
|
17
17
|
var SelectTrigger = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
|
|
@@ -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, type ControlSize } from '../Button'\nimport { FieldError } from '../Field'\nimport { isFieldInvalid } from '../shared'\n\nimport { restoreFocusWithoutRing, useTrackInputModality } from '@/lib/inputModality'\nimport { cn } from '@/lib/utils'\n\nconst SelectRoot = SelectPrimitive.Root\n\nconst selectItemClassName =\n 'surface-item press-fill-strong relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) w-full py-1.5 text-(length:--control-option-text,0.875rem) leading-(--control-option-leading,1.25rem) select-none in-data-[input-modality=pointer]:focus:bg-neutral-100 [--focus-ring-offset:-2px] data-disabled:pointer-events-none data-disabled:opacity-50'\n\nconst SelectGroup = SelectPrimitive.Group\n\nconst SelectValue = SelectPrimitive.Value\n\nconst SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n Readonly<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 Readonly<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 Readonly<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 Readonly<\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement\n }\n >\n>(({ className, children, position = 'popper', container, onCloseAutoFocus, ...props }, ref) => {\n useTrackInputModality()\n\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content\n ref={ref}\n sideOffset={4}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event)\n restoreFocusWithoutRing(event)\n }}\n className={cn(\n `\n relative z-50 max-h-(--radix-select-content-available-height,300px) min-w-32\n origin-(--radix-select-content-transform-origin) overflow-hidden surface border bg-[#fff]\n text-popover-foreground shadow-md outline-hidden ease-out-strong surface-list\n motion-reduce:data-[side=bottom]:slide-in-from-top-0\n motion-reduce:data-[side=left]:slide-in-from-right-0\n motion-reduce:data-[side=right]:slide-in-from-left-0\n motion-reduce:data-[side=top]:slide-in-from-bottom-0\n motion-reduce:data-[state=closed]:zoom-out-100\n motion-reduce:data-[state=open]:zoom-in-100\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\n data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\n `,\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={\n position === 'popper'\n ? `\n w-(--radix-select-trigger-width) scrollbar-subtle p-(--surface-inset)\n md:w-auto md:min-w-(--radix-select-trigger-width)\n `\n : 'scrollbar-subtle p-(--surface-inset)'\n }\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n})\nSelectContent.displayName = SelectPrimitive.Content.displayName\n\nconst SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n Readonly<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 Readonly<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(`${selectItemClassName} items-center pr-3 pl-10`, className)}\n {...props}\n >\n <span className=\"absolute left-3 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 Readonly<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-neutral-100', 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 'aria-invalid'?: React.AriaAttributes['aria-invalid']\n 'aria-describedby'?: string\n id?: string\n onKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void\n container?: HTMLElement\n renderOption?: (option: Option) => React.ReactNode\n /**\n * Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).\n * @default lg\n */\n size?: ControlSize\n}\n\nexport function Select({\n onValueChange,\n defaultValue,\n value,\n options,\n placeholder,\n className,\n disabled = false,\n error,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n id,\n onKeyDown,\n container,\n renderOption,\n size = 'lg',\n ...props\n}: Readonly<Props>) {\n useTrackInputModality()\n const [open, setOpen] = React.useState(false)\n const invalid = isFieldInvalid(error, ariaInvalid)\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={invalid ? 'true' : 'false'}\n aria-describedby={ariaDescribedBy}\n className={cn(\n buttonVariants({\n variant: 'input',\n size,\n className: 'flex justify-between data-placeholder:text-neutral-500',\n }),\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 data-size={size}\n className=\"control\"\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={`${selectItemClassName} items-start px-3`}\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' && <FieldError>{error}</FieldError>}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAM,aAAa,gBAAgB;AAEnC,IAAM,sBACJ;AAEF,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,uBAAu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eAAe;IAEzB;IAEC,UAAA,QAAQ,KAAK,WACZ,eACE,qBAAC,gBAAgB,MAAjB;KAEE,OAAO,OAAO;KACd,eAAa,OAAO;KACpB,WAAW,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,KAAA;KAC7D,WAAW,GAAG,oBAAoB;KALpC,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,YAAD,EAAA,UAAa,MAAkB,CAAA,CAC1D;;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, type ControlSize } from '../Button'\nimport { FieldError } from '../Field'\nimport { isFieldInvalid } from '../shared'\n\nimport { restoreFocusWithoutRing, useTrackInputModality } from '@/lib/inputModality'\nimport { cn } from '@/lib/utils'\n\nconst SelectRoot = SelectPrimitive.Root\n\nconst selectItemClassName =\n 'surface-item press-fill-strong relative flex min-h-(--control-option-height,max(var(--control-height-md),var(--control-touch-height))) w-full py-1.5 text-(length:--control-option-text,0.875rem) leading-(--control-option-leading,1.25rem) outline-hidden select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50'\n\nconst SelectGroup = SelectPrimitive.Group\n\nconst SelectValue = SelectPrimitive.Value\n\nconst SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n Readonly<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 Readonly<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 Readonly<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 Readonly<\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement\n }\n >\n>(({ className, children, position = 'popper', container, onCloseAutoFocus, ...props }, ref) => {\n useTrackInputModality()\n\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content\n ref={ref}\n sideOffset={4}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event)\n restoreFocusWithoutRing(event)\n }}\n className={cn(\n `\n relative z-50 max-h-(--radix-select-content-available-height,300px) min-w-32\n origin-(--radix-select-content-transform-origin) overflow-hidden surface border bg-[#fff]\n text-popover-foreground shadow-md outline-hidden ease-out-strong surface-list\n motion-reduce:data-[side=bottom]:slide-in-from-top-0\n motion-reduce:data-[side=left]:slide-in-from-right-0\n motion-reduce:data-[side=right]:slide-in-from-left-0\n motion-reduce:data-[side=top]:slide-in-from-bottom-0\n motion-reduce:data-[state=closed]:zoom-out-100\n motion-reduce:data-[state=open]:zoom-in-100\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\n data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\n `,\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={\n position === 'popper'\n ? `\n w-(--radix-select-trigger-width) scrollbar-subtle p-(--surface-inset)\n md:w-auto md:min-w-(--radix-select-trigger-width)\n `\n : 'scrollbar-subtle p-(--surface-inset)'\n }\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n )\n})\nSelectContent.displayName = SelectPrimitive.Content.displayName\n\nconst SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n Readonly<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 Readonly<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(`${selectItemClassName} items-center pr-3 pl-10`, className)}\n {...props}\n >\n <span className=\"absolute left-3 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 Readonly<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-neutral-100', 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 'aria-invalid'?: React.AriaAttributes['aria-invalid']\n 'aria-describedby'?: string\n id?: string\n onKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void\n container?: HTMLElement\n renderOption?: (option: Option) => React.ReactNode\n /**\n * Control height. sm 32px, md 40px, lg 48px. Heights are the `--control-height-*` tokens, so an app can change them (for example on touch).\n * @default lg\n */\n size?: ControlSize\n}\n\nexport function Select({\n onValueChange,\n defaultValue,\n value,\n options,\n placeholder,\n className,\n disabled = false,\n error,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n id,\n onKeyDown,\n container,\n renderOption,\n size = 'lg',\n ...props\n}: Readonly<Props>) {\n useTrackInputModality()\n const [open, setOpen] = React.useState(false)\n const invalid = isFieldInvalid(error, ariaInvalid)\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={invalid ? 'true' : 'false'}\n aria-describedby={ariaDescribedBy}\n className={cn(\n buttonVariants({\n variant: 'input',\n size,\n className: 'flex justify-between data-placeholder:text-neutral-500',\n }),\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 data-size={size}\n className=\"control\"\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={`${selectItemClassName} items-start px-3`}\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 )}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A,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,YAAD,EAAA,UAAa,MAAkB,CAAA,CAC1D;;AAET"}
|
|
@@ -19,9 +19,9 @@ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
|
19
19
|
var DropdownMenuSubTrigger = React$1.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
20
20
|
ref,
|
|
21
21
|
className: cn(`
|
|
22
|
-
flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill px-2 py-1.5 text-sm
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill-strong px-2 py-1.5 text-sm
|
|
23
|
+
outline-hidden select-none
|
|
24
|
+
focus:bg-neutral-100
|
|
25
25
|
[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0
|
|
26
26
|
`, inset && "pl-8", className),
|
|
27
27
|
...props,
|
|
@@ -83,10 +83,10 @@ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
|
83
83
|
var DropdownMenuItem = React$1.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
84
84
|
ref,
|
|
85
85
|
className: cn(`
|
|
86
|
-
relative flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill px-2 py-1.5
|
|
87
|
-
transition-colors select-none
|
|
86
|
+
relative flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill-strong px-2 py-1.5
|
|
87
|
+
text-sm outline-hidden transition-colors select-none
|
|
88
|
+
focus:bg-neutral-100
|
|
88
89
|
data-disabled:pointer-events-none data-disabled:opacity-50
|
|
89
|
-
in-data-[input-modality=pointer]:focus:bg-neutral-50
|
|
90
90
|
[&>svg]:size-4 [&>svg]:shrink-0
|
|
91
91
|
`, inset && "pl-8", className),
|
|
92
92
|
...props
|
|
@@ -95,10 +95,10 @@ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
|
95
95
|
var DropdownMenuCheckboxItem = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
96
96
|
ref,
|
|
97
97
|
className: cn(`
|
|
98
|
-
relative flex min-h-(--control-touch-height) items-center surface-item press-fill py-1.5 pr-2 pl-8
|
|
99
|
-
transition-colors select-none
|
|
98
|
+
relative flex min-h-(--control-touch-height) items-center surface-item press-fill-strong py-1.5 pr-2 pl-8
|
|
99
|
+
text-sm outline-hidden transition-colors select-none
|
|
100
|
+
focus:bg-neutral-100
|
|
100
101
|
data-disabled:pointer-events-none data-disabled:opacity-50
|
|
101
|
-
in-data-[input-modality=pointer]:focus:bg-neutral-50
|
|
102
102
|
`, className),
|
|
103
103
|
...props,
|
|
104
104
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -110,10 +110,10 @@ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displa
|
|
|
110
110
|
var DropdownMenuRadioItem = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
111
111
|
ref,
|
|
112
112
|
className: cn(`
|
|
113
|
-
relative flex min-h-(--control-touch-height) items-center surface-item press-fill py-1.5 pr-2 pl-8
|
|
114
|
-
transition-colors select-none
|
|
113
|
+
relative flex min-h-(--control-touch-height) items-center surface-item press-fill-strong py-1.5 pr-2 pl-8
|
|
114
|
+
text-sm outline-hidden transition-colors select-none
|
|
115
|
+
focus:bg-neutral-100
|
|
115
116
|
data-disabled:pointer-events-none data-disabled:opacity-50
|
|
116
|
-
in-data-[input-modality=pointer]:focus:bg-neutral-50
|
|
117
117
|
`, className),
|
|
118
118
|
...props,
|
|
119
119
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -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 { restoreFocusWithoutRing, useTrackInputModality } from '@/lib/inputModality'\nimport { cn } from '@/lib/utils'\n\nconst DropdownMenu = (props: Readonly<React.ComponentProps<typeof DropdownMenuPrimitive.Root>>) => {\n useTrackInputModality()\n\n return <DropdownMenuPrimitive.Root {...props} />\n}\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 Readonly<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n >\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n `\n flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill px-2 py-1.5 text-sm select-none\n [--focus-ring-offset:-2px]\n in-data-[input-modality=pointer]:focus:bg-neutral-50\n [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\n `,\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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>>\n>(({ className, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n `\n z-50 min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden surface border bg-white\n p-(--surface-inset) text-popover-foreground shadow-lg outline-hidden ease-out-strong surface-inset\n motion-reduce:data-[side=bottom]:slide-in-from-top-0\n motion-reduce:data-[side=left]:slide-in-from-right-0\n motion-reduce:data-[side=right]:slide-in-from-left-0\n motion-reduce:data-[side=top]:slide-in-from-bottom-0\n motion-reduce:data-[state=closed]:zoom-out-100\n motion-reduce:data-[state=open]:zoom-in-100\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\n data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\n `,\n className,\n )}\n {...props}\n />\n )\n})\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>>\n>(({ className, sideOffset = 4, onCloseAutoFocus, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event)\n restoreFocusWithoutRing(event)\n }}\n className={cn(\n `\n z-50 min-w-[min(var(--radix-dropdown-menu-trigger-width),8rem)]\n origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden surface border bg-white\n p-(--surface-inset) text-popover-foreground shadow-md outline-hidden ease-out-strong surface-inset\n motion-reduce:data-[side=bottom]:slide-in-from-top-0\n motion-reduce:data-[side=left]:slide-in-from-right-0\n motion-reduce:data-[side=right]:slide-in-from-left-0\n motion-reduce:data-[side=top]:slide-in-from-bottom-0\n motion-reduce:data-[state=closed]:zoom-out-100\n motion-reduce:data-[state=open]:zoom-in-100\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\n data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\n `,\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n )\n})\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n Readonly<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n }\n >\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill px-2 py-1.5 text-sm\n transition-colors select-none [--focus-ring-offset:-2px]\n data-disabled:pointer-events-none data-disabled:opacity-50\n in-data-[input-modality=pointer]:focus:bg-neutral-50\n [&>svg]:size-4 [&>svg]:shrink-0\n `,\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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-touch-height) items-center surface-item press-fill py-1.5 pr-2 pl-8 text-sm\n transition-colors select-none [--focus-ring-offset:-2px]\n data-disabled:pointer-events-none data-disabled:opacity-50\n in-data-[input-modality=pointer]:focus:bg-neutral-50\n `,\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 <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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-touch-height) items-center surface-item press-fill py-1.5 pr-2 pl-8 text-sm\n transition-colors select-none [--focus-ring-offset:-2px]\n data-disabled:pointer-events-none data-disabled:opacity-50\n in-data-[input-modality=pointer]:focus:bg-neutral-50\n `,\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 Readonly<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-neutral-100', className)} {...props} />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({ className, ...props }: Readonly<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":";;;;;;;;;AASA,IAAM,gBAAgB,UAA6E;CACjG,sBAAsB;CAEtB,OAAO,oBAAC,sBAAsB,MAAvB,EAA4B,GAAI,MAAQ,CAAA;AACjD;AAEA,IAAM,sBAAsB,sBAAsB;AAElD,IAAM,oBAAoB,sBAAsB;AAEhD,IAAM,qBAAqB,sBAAsB;AAEjD,IAAM,kBAAkB,sBAAsB;AAE9C,IAAM,yBAAyB,sBAAsB;AAErD,IAAM,yBAAyBA,QAAM,YAOl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sBAAsB,eAAvB,EAAA,UACE,oBAAC,WAAD,EAAW,WAAU,UAAW,CAAA,EACG,CAAA;CACjC,CAAA,GACL,QACiC;AACrC,CAAA,CAAA;AACD,yBAAyB,cAAc,sBAAsB,aAAa;AAE1E,IAAM,wBAAwBA,QAAM,YAGjC,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,qBAAC,sBAAsB,WAAvB;CACO;CACL,WAAW,GACT;;;;;SAMA,SACF;CACA,GAAI;CAXN,UAAA,CAaE,oBAAC,QAAD;EAAM,WAAU;EACd,UAAA,oBAAC,sBAAsB,eAAvB,EAAA,UACE,oBAAC,SAAD,EAAS,WAAU,uBAAwB,CAAA,EACR,CAAA;CACjC,CAAA,GACL,QAC8B;AAClC,CAAA,CAAA;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,oBAAoBA,QAAM,YAO7B,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC,oBAAC,sBAAsB,OAAvB;CACO;CACL,WAAW,GAAG,qCAAqC,SAAS,QAAQ,SAAS;CAC7E,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc,sBAAsB,MAAM;AAE5D,IAAM,wBAAwBA,QAAM,YAGjC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,sBAAsB,WAAvB;CAAsC;CAAK,WAAW,GAAG,kCAAkC,SAAS;CAAG,GAAI;AAAQ,CAAA,CACpH;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,wBAAwB,EAAE,WAAW,GAAG,YAA6D;CACzG,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,8CAA8C,SAAS;EAAG,GAAI;CAAQ,CAAA;AACnG;AACA,qBAAqB,cAAc"}
|
|
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 { restoreFocusWithoutRing, useTrackInputModality } from '@/lib/inputModality'\nimport { cn } from '@/lib/utils'\n\nconst DropdownMenu = (props: Readonly<React.ComponentProps<typeof DropdownMenuPrimitive.Root>>) => {\n useTrackInputModality()\n\n return <DropdownMenuPrimitive.Root {...props} />\n}\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 Readonly<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n >\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n `\n flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill-strong px-2 py-1.5 text-sm\n outline-hidden select-none\n focus:bg-neutral-100\n [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\n `,\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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>>\n>(({ className, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n `\n z-50 min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden surface border bg-white\n p-(--surface-inset) text-popover-foreground shadow-lg outline-hidden ease-out-strong surface-inset\n motion-reduce:data-[side=bottom]:slide-in-from-top-0\n motion-reduce:data-[side=left]:slide-in-from-right-0\n motion-reduce:data-[side=right]:slide-in-from-left-0\n motion-reduce:data-[side=top]:slide-in-from-bottom-0\n motion-reduce:data-[state=closed]:zoom-out-100\n motion-reduce:data-[state=open]:zoom-in-100\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\n data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\n `,\n className,\n )}\n {...props}\n />\n )\n})\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>>\n>(({ className, sideOffset = 4, onCloseAutoFocus, ...props }, ref) => {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event)\n restoreFocusWithoutRing(event)\n }}\n className={cn(\n `\n z-50 min-w-[min(var(--radix-dropdown-menu-trigger-width),8rem)]\n origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden surface border bg-white\n p-(--surface-inset) text-popover-foreground shadow-md outline-hidden ease-out-strong surface-inset\n motion-reduce:data-[side=bottom]:slide-in-from-top-0\n motion-reduce:data-[side=left]:slide-in-from-right-0\n motion-reduce:data-[side=right]:slide-in-from-left-0\n motion-reduce:data-[side=top]:slide-in-from-bottom-0\n motion-reduce:data-[state=closed]:zoom-out-100\n motion-reduce:data-[state=open]:zoom-in-100\n data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\n data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\n `,\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n )\n})\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n Readonly<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n }\n >\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-touch-height) items-center gap-2 surface-item press-fill-strong px-2 py-1.5\n text-sm outline-hidden transition-colors select-none\n focus:bg-neutral-100\n data-disabled:pointer-events-none data-disabled:opacity-50\n [&>svg]:size-4 [&>svg]:shrink-0\n `,\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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-touch-height) items-center surface-item press-fill-strong py-1.5 pr-2 pl-8\n text-sm outline-hidden transition-colors select-none\n focus:bg-neutral-100\n data-disabled:pointer-events-none data-disabled:opacity-50\n `,\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 <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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n `\n relative flex min-h-(--control-touch-height) items-center surface-item press-fill-strong py-1.5 pr-2 pl-8\n text-sm outline-hidden transition-colors select-none\n focus:bg-neutral-100\n data-disabled:pointer-events-none data-disabled:opacity-50\n `,\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 Readonly<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\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 Readonly<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-neutral-100', className)} {...props} />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({ className, ...props }: Readonly<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":";;;;;;;;;AASA,IAAM,gBAAgB,UAA6E;CACjG,sBAAsB;CAEtB,OAAO,oBAAC,sBAAsB,MAAvB,EAA4B,GAAI,MAAQ,CAAA;AACjD;AAEA,IAAM,sBAAsB,sBAAsB;AAElD,IAAM,oBAAoB,sBAAsB;AAEhD,IAAM,qBAAqB,sBAAsB;AAEjD,IAAM,kBAAkB,sBAAsB;AAE9C,IAAM,yBAAyB,sBAAsB;AAErD,IAAM,yBAAyBA,QAAM,YAOlC,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,QAC3C,qBAAC,sBAAsB,YAAvB;CACO;CACL,WAAW,GACT;;;;;SAMA,SAAS,QACT,SACF;CACA,GAAI;CAZN,UAAA,CAcG,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,QAAQ;CAClC,OACE,oBAAC,sBAAsB,YAAvB;EACO;EACL,WAAW,GACT;;;;;;;;;;;;;;;WAgBA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;AACD,uBAAuB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GACL,QAC8B;AAClC,CAAA,CAAA;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,oBAAoBA,QAAM,YAO7B,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC,oBAAC,sBAAsB,OAAvB;CACO;CACL,WAAW,GAAG,qCAAqC,SAAS,QAAQ,SAAS;CAC7E,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc,sBAAsB,MAAM;AAE5D,IAAM,wBAAwBA,QAAM,YAGjC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,sBAAsB,WAAvB;CAAsC;CAAK,WAAW,GAAG,kCAAkC,SAAS;CAAG,GAAI;AAAQ,CAAA,CACpH;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,wBAAwB,EAAE,WAAW,GAAG,YAA6D;CACzG,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,8CAA8C,SAAS;EAAG,GAAI;CAAQ,CAAA;AACnG;AACA,qBAAqB,cAAc"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
declare const SidebarInset: React.ForwardRefExoticComponent<Omit<Readonly<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
3
3
|
declare const SidebarPageHeader: React.ForwardRefExoticComponent<Omit<Readonly<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
4
|
-
|
|
4
|
+
type SidebarPageContentProps = React.ComponentProps<'div'> & {
|
|
5
|
+
boundHeight?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const SidebarPageContent: React.ForwardRefExoticComponent<Omit<Readonly<SidebarPageContentProps>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
8
|
export { SidebarInset, SidebarPageContent, SidebarPageHeader };
|
|
@@ -14,6 +14,7 @@ var SidebarInset = React$1.forwardRef(({ className, ...props }, ref) => {
|
|
|
14
14
|
className: cn(`
|
|
15
15
|
relative flex w-full min-w-0 flex-1 flex-col bg-white
|
|
16
16
|
max-md:min-h-dvh
|
|
17
|
+
max-md:has-data-bound-height:h-dvh max-md:has-data-bound-height:overflow-hidden
|
|
17
18
|
md:h-svh md:overflow-hidden md:bg-sidebar
|
|
18
19
|
md:not-has-data-[sidebar=page-content]:h-auto md:not-has-data-[sidebar=page-content]:overflow-visible
|
|
19
20
|
md:not-has-data-[sidebar=page-content]:bg-white
|
|
@@ -59,12 +60,13 @@ var SidebarPageHeader = React$1.forwardRef(({ className, children, ...props }, r
|
|
|
59
60
|
});
|
|
60
61
|
});
|
|
61
62
|
SidebarPageHeader.displayName = "SidebarPageHeader";
|
|
62
|
-
var SidebarPageContent = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
63
|
-
className: "\n flex flex-1 flex-col bg-white\n md:min-h-0 md:overflow-hidden md:rounded-tl-2xl md:border-t md:border-l md:border-neutral-100\n ",
|
|
63
|
+
var SidebarPageContent = React$1.forwardRef(({ className, children, boundHeight = false, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
64
|
+
className: "\n flex flex-1 flex-col bg-white\n has-data-bound-height:min-h-0 has-data-bound-height:overflow-hidden\n md:min-h-0 md:overflow-hidden md:rounded-tl-2xl md:border-t md:border-l md:border-neutral-100\n ",
|
|
64
65
|
children: /* @__PURE__ */ jsx("div", {
|
|
65
66
|
ref,
|
|
66
67
|
"data-sidebar": "page-content",
|
|
67
|
-
|
|
68
|
+
"data-bound-height": boundHeight || void 0,
|
|
69
|
+
className: "\n flex flex-1 scrollbar-subtle flex-col [--focus-ring-offset:-2px]\n data-bound-height:min-h-0 data-bound-height:overflow-y-auto\n md:min-h-0 md:scrollbar-gutter-stable md:overflow-y-auto md:rounded-tl-[15px]\n ",
|
|
68
70
|
...props,
|
|
69
71
|
children: /* @__PURE__ */ jsx("div", {
|
|
70
72
|
className: cn("flex-1 p-(--page-padding)", className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarPage.js","names":["React"],"sources":["../../../../src/components/navigation/Sidebar/SidebarPage.tsx"],"sourcesContent":["'use client'\n\nimport { ListIcon } from '@phosphor-icons/react/dist/ssr/List'\nimport * as React from 'react'\n\nimport { Separator } from '../../data-display/Separator'\n\nimport { useSidebar } from './context'\nimport type { SidebarSize } from './context'\nimport { SidebarTrigger } from './Sidebar'\n\nimport { cn } from '@/lib/utils'\n\nconst SidebarInset = React.forwardRef<HTMLElement, Readonly<React.ComponentProps<'main'>>>(\n ({ className, ...props }, ref) => {\n return (\n <main\n ref={ref}\n className={cn(\n `\n relative flex w-full min-w-0 flex-1 flex-col bg-white\n max-md:min-h-dvh\n md:h-svh md:overflow-hidden md:bg-sidebar\n md:not-has-data-[sidebar=page-content]:h-auto md:not-has-data-[sidebar=page-content]:overflow-visible\n md:not-has-data-[sidebar=page-content]:bg-white\n `,\n className,\n )}\n {...props}\n />\n )\n },\n)\nSidebarInset.displayName = 'SidebarInset'\n\nconst SIDEBAR_PAGE_HEADER: Record<SidebarSize, string> = {\n small: 'h-12',\n medium: 'h-14',\n big: 'h-14 md:h-16',\n}\n\nconst SidebarPageHeader = React.forwardRef<HTMLElement, Readonly<React.ComponentProps<'header'>>>(\n ({ className, children, ...props }, ref) => {\n const { size } = useSidebar()\n const [scrolled, setScrolled] = React.useState(false)\n\n React.useEffect(() => {\n const handleScroll = () => setScrolled(window.scrollY > 0)\n handleScroll()\n window.addEventListener('scroll', handleScroll, { passive: true })\n return () => window.removeEventListener('scroll', handleScroll)\n }, [])\n\n return (\n <header\n ref={ref}\n data-sidebar=\"page-header\"\n data-size={size}\n className={cn(\n `\n group/page-header sticky top-0 z-10 flex shrink-0 items-center gap-3 bg-white px-(--page-padding)\n md:border-l md:border-transparent md:bg-sidebar\n `,\n SIDEBAR_PAGE_HEADER[size],\n className,\n )}\n {...props}\n >\n <SidebarTrigger\n icon={<ListIcon aria-hidden />}\n className=\"\n md:hidden\n group-data-[size=big]/page-header:-ml-2.75\n group-data-[size=medium]/page-header:ml-[-8.5px]\n group-data-[size=small]/page-header:ml-[-7.25px]\n \"\n />\n {children}\n <Separator\n data-scrolled={scrolled || undefined}\n className=\"\n absolute inset-x-0 bottom-0 w-auto opacity-0 transition-opacity\n data-scrolled:opacity-100\n motion-reduce:transition-none\n md:hidden\n \"\n />\n </header>\n )\n },\n)\nSidebarPageHeader.displayName = 'SidebarPageHeader'\n\nconst SidebarPageContent = React.forwardRef<HTMLDivElement, Readonly<
|
|
1
|
+
{"version":3,"file":"SidebarPage.js","names":["React"],"sources":["../../../../src/components/navigation/Sidebar/SidebarPage.tsx"],"sourcesContent":["'use client'\n\nimport { ListIcon } from '@phosphor-icons/react/dist/ssr/List'\nimport * as React from 'react'\n\nimport { Separator } from '../../data-display/Separator'\n\nimport { useSidebar } from './context'\nimport type { SidebarSize } from './context'\nimport { SidebarTrigger } from './Sidebar'\n\nimport { cn } from '@/lib/utils'\n\nconst SidebarInset = React.forwardRef<HTMLElement, Readonly<React.ComponentProps<'main'>>>(\n ({ className, ...props }, ref) => {\n return (\n <main\n ref={ref}\n className={cn(\n `\n relative flex w-full min-w-0 flex-1 flex-col bg-white\n max-md:min-h-dvh\n max-md:has-data-bound-height:h-dvh max-md:has-data-bound-height:overflow-hidden\n md:h-svh md:overflow-hidden md:bg-sidebar\n md:not-has-data-[sidebar=page-content]:h-auto md:not-has-data-[sidebar=page-content]:overflow-visible\n md:not-has-data-[sidebar=page-content]:bg-white\n `,\n className,\n )}\n {...props}\n />\n )\n },\n)\nSidebarInset.displayName = 'SidebarInset'\n\nconst SIDEBAR_PAGE_HEADER: Record<SidebarSize, string> = {\n small: 'h-12',\n medium: 'h-14',\n big: 'h-14 md:h-16',\n}\n\nconst SidebarPageHeader = React.forwardRef<HTMLElement, Readonly<React.ComponentProps<'header'>>>(\n ({ className, children, ...props }, ref) => {\n const { size } = useSidebar()\n const [scrolled, setScrolled] = React.useState(false)\n\n React.useEffect(() => {\n const handleScroll = () => setScrolled(window.scrollY > 0)\n handleScroll()\n window.addEventListener('scroll', handleScroll, { passive: true })\n return () => window.removeEventListener('scroll', handleScroll)\n }, [])\n\n return (\n <header\n ref={ref}\n data-sidebar=\"page-header\"\n data-size={size}\n className={cn(\n `\n group/page-header sticky top-0 z-10 flex shrink-0 items-center gap-3 bg-white px-(--page-padding)\n md:border-l md:border-transparent md:bg-sidebar\n `,\n SIDEBAR_PAGE_HEADER[size],\n className,\n )}\n {...props}\n >\n <SidebarTrigger\n icon={<ListIcon aria-hidden />}\n className=\"\n md:hidden\n group-data-[size=big]/page-header:-ml-2.75\n group-data-[size=medium]/page-header:ml-[-8.5px]\n group-data-[size=small]/page-header:ml-[-7.25px]\n \"\n />\n {children}\n <Separator\n data-scrolled={scrolled || undefined}\n className=\"\n absolute inset-x-0 bottom-0 w-auto opacity-0 transition-opacity\n data-scrolled:opacity-100\n motion-reduce:transition-none\n md:hidden\n \"\n />\n </header>\n )\n },\n)\nSidebarPageHeader.displayName = 'SidebarPageHeader'\n\ntype SidebarPageContentProps = React.ComponentProps<'div'> & {\n boundHeight?: boolean\n}\n\nconst SidebarPageContent = React.forwardRef<HTMLDivElement, Readonly<SidebarPageContentProps>>(\n ({ className, children, boundHeight = false, ...props }, ref) => (\n <div\n className=\"\n flex flex-1 flex-col bg-white\n has-data-bound-height:min-h-0 has-data-bound-height:overflow-hidden\n md:min-h-0 md:overflow-hidden md:rounded-tl-2xl md:border-t md:border-l md:border-neutral-100\n \"\n >\n <div\n ref={ref}\n data-sidebar=\"page-content\"\n data-bound-height={boundHeight || undefined}\n className=\"\n flex flex-1 scrollbar-subtle flex-col [--focus-ring-offset:-2px]\n data-bound-height:min-h-0 data-bound-height:overflow-y-auto\n md:min-h-0 md:scrollbar-gutter-stable md:overflow-y-auto md:rounded-tl-[15px]\n \"\n {...props}\n >\n <div className={cn('flex-1 p-(--page-padding)', className)}>{children}</div>\n </div>\n </div>\n ),\n)\nSidebarPageContent.displayName = 'SidebarPageContent'\n\nexport { SidebarInset, SidebarPageContent, SidebarPageHeader }\n"],"mappings":";;;;;;;;;;AAaA,IAAA,eAAA,QAAA,YAAA,EAAA,WAAA,GAAA,SAAA,QAAA;CAEI,OAAA,oBAAA,QAAA;EAES;EACL,WAAA,GAAA;;;;;;;aASE,SAAA;EAEF,GAAA;CACD,CAAA;AAEL,CAAA;AAEF,aAAA,cAAA;AAEA,IAAA,sBAAA;CACE,OAAA;CACA,QAAA;CACA,KAAA;AACF;AAEA,IAAA,oBAAA,QAAA,YAAA,EAAA,WAAA,UAAA,GAAA,SAAA,QAAA;CAEI,MAAA,EAAA,SAAA,WAAA;CACA,MAAA,CAAA,UAAA,eAAA,QAAA,SAAA,KAAA;CAEA,QAAA,gBAAA;EACE,MAAA,qBAAA,YAAA,OAAA,UAAA,CAAA;EACA,aAAA;EACA,OAAA,iBAAA,UAAA,cAAA,EAAA,SAAA,KAAA,CAAA;EACA,aAAA,OAAA,oBAAA,UAAA,YAAA;CACF,GAAA,CAAA,CAAA;CAEA,OAAA,qBAAA,UAAA;EAES;EACL,gBAAA;EACA,aAAA;EACA,WAAA,GAAA;;;aAKE,oBAAA,OAAA,SAAA;EAGF,GAAA;EAZF,UAAA;GAcE,oBAAA,gBAAA;IACE,MAAA,oBAAA,UAAA,EAAA,eAAA,KAAA,CAAA;IACA,WAAA;GAMD,CAAA;GACA;GACD,oBAAA,WAAA;IACE,iBAAA,YAAA,KAAA;IACA,WAAA;GAMD,CAAA;EACK;;AAEZ,CAAA;AAEF,kBAAA,cAAA;AAMA,IAAA,qBAAA,QAAA,YAAA,EAAA,WAAA,UAAA,cAAA,OAAA,GAAA,SAAA,QAAA,oBAAA,OAAA;CAGM,WAAA;CAMA,UAAA,oBAAA,OAAA;EACO;EACL,gBAAA;EACA,qBAAA,eAAA,KAAA;EACA,WAAA;EAKA,GAAA;EAEA,UAAA,oBAAA,OAAA;GAAK,WAAA,GAAA,6BAAA,SAAA;GAAwD;EAAc,CAAA;CACxE,CAAA;AACF,CAAA,CAAA;AAGT,mBAAA,cAAA"}
|
|
@@ -129,8 +129,8 @@ var SidebarUserMenuItem = React$1.forwardRef(({ className, ...props }, ref) => /
|
|
|
129
129
|
className: cn(`
|
|
130
130
|
h-9 gap-3 px-3 py-0 text-sm transition-colors
|
|
131
131
|
hover:bg-neutral-100
|
|
132
|
+
focus:bg-neutral-100
|
|
132
133
|
motion-reduce:transition-none
|
|
133
|
-
in-data-[input-modality=pointer]:focus:bg-neutral-100
|
|
134
134
|
[&>svg]:size-5
|
|
135
135
|
`, className),
|
|
136
136
|
...props
|
|
@@ -147,8 +147,8 @@ var SidebarUserMenuRadioItem = React$1.forwardRef(({ className, ...props }, ref)
|
|
|
147
147
|
className: cn(`
|
|
148
148
|
h-9 gap-3 px-3 py-0 text-sm transition-colors
|
|
149
149
|
hover:bg-neutral-100
|
|
150
|
+
focus:bg-neutral-100
|
|
150
151
|
motion-reduce:transition-none
|
|
151
|
-
in-data-[input-modality=pointer]:focus:bg-neutral-100
|
|
152
152
|
data-[state=checked]:font-semibold
|
|
153
153
|
[&>span:first-child]:hidden
|
|
154
154
|
[&>svg]:size-5
|
|
@@ -161,8 +161,8 @@ var SidebarUserMenuSubTrigger = React$1.forwardRef(({ className, children, value
|
|
|
161
161
|
className: cn(`
|
|
162
162
|
h-9 gap-3 px-3 py-0 text-sm transition-colors
|
|
163
163
|
hover:bg-neutral-100
|
|
164
|
+
focus:bg-neutral-100
|
|
164
165
|
motion-reduce:transition-none
|
|
165
|
-
in-data-[input-modality=pointer]:focus:bg-neutral-100
|
|
166
166
|
[&>svg]:size-5
|
|
167
167
|
[&>svg:last-child]:size-4
|
|
168
168
|
`, value !== void 0 && "[&>svg:last-child]:ml-0", className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarUser.js","names":["React","_Fragment"],"sources":["../../../../src/components/navigation/Sidebar/SidebarUser.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport * as React from 'react'\n\nimport { Avatar, AvatarFallback } from '../../data-display/Avatar'\nimport { Typography } from '../../data-display/Typography'\nimport { Skeleton } from '../../feedback/Skeleton'\nimport {\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n} from '../DropdownMenu'\n\nimport { useSidebar } from './context'\nimport type { SidebarSize } from './context'\n\nimport { cn } from '@/lib/utils'\n\nconst SIDEBAR_USER: Record<SidebarSize, string> = {\n small: 'h-10 group-data-[state=collapsed]:h-8',\n medium: 'h-12 group-data-[state=collapsed]:h-10',\n big: 'h-14 group-data-[state=collapsed]:h-12',\n}\n\nconst WHITESPACE = /\\s+/\n\nconst getUserInitials = (name?: string, lastName?: string) =>\n `${name?.trim()[0] ?? ''}${lastName?.trim().split(WHITESPACE)[0]?.[0] ?? ''}`.toUpperCase()\n\ntype SidebarUserProps = React.ComponentProps<'button'> & {\n name?: string\n lastName?: string\n email?: string\n loading?: boolean\n}\n\nconst SidebarUser = React.forwardRef<HTMLButtonElement, Readonly<SidebarUserProps>>(\n ({ name, lastName, email, loading = false, className, ...props }, ref) => {\n const { size } = useSidebar()\n const fullName = [name, lastName].filter(Boolean).join(' ')\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-sidebar=\"user\"\n data-size={size}\n aria-busy={loading || undefined}\n className={cn(\n `\n group/user flex w-full items-center gap-2 overflow-hidden rounded-xl press-fill py-2 pr-2 pl-1 text-left\n whitespace-nowrap text-sidebar-foreground transition-[height,padding,background-color] layout-motion\n [--focus-ring-offset:-2px]\n hover:bg-sidebar-accent\n group-data-[state=collapsed]:py-0 group-data-[state=collapsed]:pr-0\n `,\n SIDEBAR_USER[size],\n className,\n )}\n {...props}\n >\n {loading ? (\n <Skeleton\n aria-hidden\n className=\"\n shrink-0 rounded-full\n group-data-[size=big]/user:size-10\n group-data-[size=medium]/user:size-8\n group-data-[size=small]/user:size-6\n \"\n />\n ) : (\n <Avatar\n aria-hidden\n className=\"\n shrink-0\n group-data-[size=big]/user:size-10\n group-data-[size=medium]/user:size-8\n group-data-[size=small]/user:size-6\n \"\n >\n <AvatarFallback className=\"bg-background-200 text-xs font-semibold\">\n {getUserInitials(name, lastName)}\n </AvatarFallback>\n </Avatar>\n )}\n <div className=\"grid min-w-0 flex-1 transition-opacity layout-motion group-data-[state=collapsed]:opacity-0\">\n {loading ? (\n <>\n <span className=\"sr-only\">Loading user</span>\n <Skeleton aria-hidden className=\"h-4 w-24\" />\n <Skeleton aria-hidden className=\"mt-1 h-3 w-36\" />\n </>\n ) : (\n <>\n <Typography variant=\"body-md\" weight=\"semibold\" className=\"fade-text\">\n {fullName}\n </Typography>\n <Typography variant=\"body-sm\" className=\"fade-text text-neutral-700\">\n {email}\n </Typography>\n </>\n )}\n </div>\n <CaretUpDownIcon\n aria-hidden\n className=\"size-4 shrink-0 transition-opacity layout-motion group-data-[state=collapsed]:opacity-0\"\n />\n </button>\n )\n },\n)\nSidebarUser.displayName = 'SidebarUser'\n\nconst MENU_ITEM_SELECTOR = '[role^=menuitem]:not([data-disabled])'\n\nconst focusMenuItemOnTab = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const menu = event.currentTarget\n if (event.key !== 'Tab' || !(event.target instanceof Element) || event.target.closest('[role=menu]') !== menu) {\n return\n }\n event.preventDefault()\n const items = [...menu.querySelectorAll<HTMLElement>(MENU_ITEM_SELECTOR)]\n const step = event.shiftKey ? -1 : 1\n const current = items.indexOf(document.activeElement as HTMLElement)\n const from = current === -1 ? Math.min(0, -step) : current\n items[(from + step + items.length) % items.length]?.focus()\n}\n\nconst SidebarUserMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuContent>,\n Readonly<React.ComponentProps<typeof DropdownMenuContent>>\n>(({ className, onKeyDown, ...props }, ref) => {\n const { state, isMobile } = useSidebar()\n const expandedLayout = state === 'expanded' || isMobile\n\n return (\n <DropdownMenuContent\n ref={ref}\n side={expandedLayout ? 'top' : 'right'}\n align={expandedLayout ? 'start' : 'end'}\n sideOffset={4}\n collisionPadding={12}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n focusMenuItemOnTab(event)\n }}\n className={cn(\n `\n surface border border-neutral-100 bg-white p-(--surface-inset) text-left shadow-[0_8px_16px_rgb(0_0_0/0.1)]\n surface-inset [--surface-radius:1rem]\n [&>[role=menuitem]+[role=menuitem]]:mt-1\n `,\n expandedLayout ? 'w-(--radix-dropdown-menu-trigger-width) min-w-0' : 'w-60 min-w-60',\n className,\n )}\n {...props}\n />\n )\n})\nSidebarUserMenuContent.displayName = 'SidebarUserMenuContent'\n\nconst SidebarUserMenuLabel = React.forwardRef<HTMLDivElement, Readonly<React.ComponentProps<'div'>>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('grid grid-cols-1 px-3 pt-3 pb-2 wrap-anywhere', className)} {...props} />\n ),\n)\nSidebarUserMenuLabel.displayName = 'SidebarUserMenuLabel'\n\nconst SidebarUserMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuSeparator>,\n Readonly<React.ComponentProps<typeof DropdownMenuSeparator>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuSeparator ref={ref} className={cn('mx-3 my-1 bg-neutral-100', className)} {...props} />\n))\nSidebarUserMenuSeparator.displayName = 'SidebarUserMenuSeparator'\n\nconst SidebarUserMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuItem>,\n Readonly<React.ComponentProps<typeof DropdownMenuItem>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuItem\n ref={ref}\n className={cn(\n `\n h-9 gap-3 px-3 py-0 text-sm transition-colors\n hover:bg-neutral-100\n motion-reduce:transition-none\n in-data-[input-modality=pointer]:focus:bg-neutral-100\n [&>svg]:size-5\n `,\n className,\n )}\n {...props}\n />\n))\nSidebarUserMenuItem.displayName = 'SidebarUserMenuItem'\n\nconst SidebarUserMenuRadioGroup = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuRadioGroup>,\n Readonly<React.ComponentProps<typeof DropdownMenuRadioGroup>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuRadioGroup ref={ref} className={cn('flex flex-col gap-1', className)} {...props} />\n))\nSidebarUserMenuRadioGroup.displayName = 'SidebarUserMenuRadioGroup'\n\nconst SidebarUserMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuRadioItem>,\n Readonly<React.ComponentProps<typeof DropdownMenuRadioItem>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuRadioItem\n ref={ref}\n className={cn(\n `\n h-9 gap-3 px-3 py-0 text-sm transition-colors\n hover:bg-neutral-100\n motion-reduce:transition-none\n in-data-[input-modality=pointer]:focus:bg-neutral-100\n data-[state=checked]:font-semibold\n [&>span:first-child]:hidden\n [&>svg]:size-5\n `,\n className,\n )}\n {...props}\n />\n))\nSidebarUserMenuRadioItem.displayName = 'SidebarUserMenuRadioItem'\n\nconst SidebarUserMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuSubTrigger>,\n Readonly<React.ComponentProps<typeof DropdownMenuSubTrigger> & { value?: React.ReactNode }>\n>(({ className, children, value, ...props }, ref) => (\n <DropdownMenuSubTrigger\n ref={ref}\n className={cn(\n `\n h-9 gap-3 px-3 py-0 text-sm transition-colors\n hover:bg-neutral-100\n motion-reduce:transition-none\n in-data-[input-modality=pointer]:focus:bg-neutral-100\n [&>svg]:size-5\n [&>svg:last-child]:size-4\n `,\n value !== undefined && '[&>svg:last-child]:ml-0',\n className,\n )}\n {...props}\n >\n {children}\n {value !== undefined && <span className=\"ml-auto text-sm text-neutral-500\">{value}</span>}\n </DropdownMenuSubTrigger>\n))\nSidebarUserMenuSubTrigger.displayName = 'SidebarUserMenuSubTrigger'\n\nconst SidebarUserMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuSubContent>,\n Readonly<React.ComponentProps<typeof DropdownMenuSubContent>>\n>(({ className, onKeyDown, ...props }, ref) => {\n return (\n <DropdownMenuPortal>\n <DropdownMenuSubContent\n ref={ref}\n sideOffset={9}\n alignOffset={-5}\n collisionPadding={12}\n className={cn(\n `\n min-w-40 surface border border-neutral-100 bg-white p-(--surface-inset) text-left\n shadow-[0_8px_16px_rgb(0_0_0/0.1)] surface-inset [--surface-radius:1rem]\n [&>[role=menuitem]+[role=menuitem]]:mt-1\n `,\n className,\n )}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n focusMenuItemOnTab(event)\n }}\n {...props}\n />\n </DropdownMenuPortal>\n )\n})\nSidebarUserMenuSubContent.displayName = 'SidebarUserMenuSubContent'\n\nexport {\n SidebarUser,\n SidebarUserMenuContent,\n SidebarUserMenuItem,\n SidebarUserMenuLabel,\n SidebarUserMenuRadioGroup,\n SidebarUserMenuRadioItem,\n SidebarUserMenuSeparator,\n SidebarUserMenuSubContent,\n SidebarUserMenuSubTrigger,\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,IAAA,eAAA;CACE,OAAA;CACA,QAAA;CACA,KAAA;AACF;AAEA,IAAA,aAAA;AAEA,IAAA,mBAAA,MAAA,aAAA,GAAA,MAAA,KAAA,CAAA,CAAA,MAAA,KAAA,UAAA,KAAA,CAAA,CAAA,MAAA,UAAA,CAAA,CAAA,EAAA,GAAA,MAAA,KAAA,YAAA;AAUA,IAAA,cAAA,QAAA,YAAA,EAAA,MAAA,UAAA,OAAA,UAAA,OAAA,WAAA,GAAA,SAAA,QAAA;CAEI,MAAA,EAAA,SAAA,WAAA;CACA,MAAA,WAAA,CAAA,MAAA,QAAA,CAAA,CAAA,OAAA,OAAA,CAAA,CAAA,KAAA,GAAA;CAEA,OAAA,qBAAA,UAAA;EAES;EACL,MAAA;EACA,gBAAA;EACA,aAAA;EACA,aAAA,WAAA,KAAA;EACA,WAAA,GAAA;;;;;;aAQE,aAAA,OAAA,SAA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AAA,WAAA,UAAA,OAAA,GAAA,SAAA,QAAA,qBAAA,wBAAA;CAKS;CACL,WAAA,GAAA;;;;;;;SASE,UAAA,KAAA,KAAA,2BAAA,SAAA;CAGF,GAAA;CAdF,UAAA,CAAA,UAAA,UAAA,KAAA,KAAA,oBAAA,QAAA;EAiBgC,WAAA;EAA8C,UAAA;CAAY,CAAA,CAAA;AAE3F,CAAA,CAAA;AACD,0BAAA,cAAA;AAEA,IAAA,4BAAA,QAAA,YAAA,EAAA,WAAA,WAAA,GAAA,SAAA,QAAA;CAIE,OAAA,oBAAA,oBAAA,EAAA,UAAA,oBAAA,wBAAA;EAGW;EACL,YAAA;EACA,aAAA;EACA,kBAAA;EACA,WAAA,GAAA;;;;aAME,SAAA;EAEF,YAAA,UAAA;GACE,YAAA,KAAA;GACA,mBAAA,KAAA;EACF;EACA,GAAA;CACD,CAAA,EAAA,CAAA;AAGP,CAAA;AACA,0BAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"SidebarUser.js","names":["React","_Fragment"],"sources":["../../../../src/components/navigation/Sidebar/SidebarUser.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport * as React from 'react'\n\nimport { Avatar, AvatarFallback } from '../../data-display/Avatar'\nimport { Typography } from '../../data-display/Typography'\nimport { Skeleton } from '../../feedback/Skeleton'\nimport {\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n} from '../DropdownMenu'\n\nimport { useSidebar } from './context'\nimport type { SidebarSize } from './context'\n\nimport { cn } from '@/lib/utils'\n\nconst SIDEBAR_USER: Record<SidebarSize, string> = {\n small: 'h-10 group-data-[state=collapsed]:h-8',\n medium: 'h-12 group-data-[state=collapsed]:h-10',\n big: 'h-14 group-data-[state=collapsed]:h-12',\n}\n\nconst WHITESPACE = /\\s+/\n\nconst getUserInitials = (name?: string, lastName?: string) =>\n `${name?.trim()[0] ?? ''}${lastName?.trim().split(WHITESPACE)[0]?.[0] ?? ''}`.toUpperCase()\n\ntype SidebarUserProps = React.ComponentProps<'button'> & {\n name?: string\n lastName?: string\n email?: string\n loading?: boolean\n}\n\nconst SidebarUser = React.forwardRef<HTMLButtonElement, Readonly<SidebarUserProps>>(\n ({ name, lastName, email, loading = false, className, ...props }, ref) => {\n const { size } = useSidebar()\n const fullName = [name, lastName].filter(Boolean).join(' ')\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-sidebar=\"user\"\n data-size={size}\n aria-busy={loading || undefined}\n className={cn(\n `\n group/user flex w-full items-center gap-2 overflow-hidden rounded-xl press-fill py-2 pr-2 pl-1 text-left\n whitespace-nowrap text-sidebar-foreground transition-[height,padding,background-color] layout-motion\n [--focus-ring-offset:-2px]\n hover:bg-sidebar-accent\n group-data-[state=collapsed]:py-0 group-data-[state=collapsed]:pr-0\n `,\n SIDEBAR_USER[size],\n className,\n )}\n {...props}\n >\n {loading ? (\n <Skeleton\n aria-hidden\n className=\"\n shrink-0 rounded-full\n group-data-[size=big]/user:size-10\n group-data-[size=medium]/user:size-8\n group-data-[size=small]/user:size-6\n \"\n />\n ) : (\n <Avatar\n aria-hidden\n className=\"\n shrink-0\n group-data-[size=big]/user:size-10\n group-data-[size=medium]/user:size-8\n group-data-[size=small]/user:size-6\n \"\n >\n <AvatarFallback className=\"bg-background-200 text-xs font-semibold\">\n {getUserInitials(name, lastName)}\n </AvatarFallback>\n </Avatar>\n )}\n <div className=\"grid min-w-0 flex-1 transition-opacity layout-motion group-data-[state=collapsed]:opacity-0\">\n {loading ? (\n <>\n <span className=\"sr-only\">Loading user</span>\n <Skeleton aria-hidden className=\"h-4 w-24\" />\n <Skeleton aria-hidden className=\"mt-1 h-3 w-36\" />\n </>\n ) : (\n <>\n <Typography variant=\"body-md\" weight=\"semibold\" className=\"fade-text\">\n {fullName}\n </Typography>\n <Typography variant=\"body-sm\" className=\"fade-text text-neutral-700\">\n {email}\n </Typography>\n </>\n )}\n </div>\n <CaretUpDownIcon\n aria-hidden\n className=\"size-4 shrink-0 transition-opacity layout-motion group-data-[state=collapsed]:opacity-0\"\n />\n </button>\n )\n },\n)\nSidebarUser.displayName = 'SidebarUser'\n\nconst MENU_ITEM_SELECTOR = '[role^=menuitem]:not([data-disabled])'\n\nconst focusMenuItemOnTab = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const menu = event.currentTarget\n if (event.key !== 'Tab' || !(event.target instanceof Element) || event.target.closest('[role=menu]') !== menu) {\n return\n }\n event.preventDefault()\n const items = [...menu.querySelectorAll<HTMLElement>(MENU_ITEM_SELECTOR)]\n const step = event.shiftKey ? -1 : 1\n const current = items.indexOf(document.activeElement as HTMLElement)\n const from = current === -1 ? Math.min(0, -step) : current\n items[(from + step + items.length) % items.length]?.focus()\n}\n\nconst SidebarUserMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuContent>,\n Readonly<React.ComponentProps<typeof DropdownMenuContent>>\n>(({ className, onKeyDown, ...props }, ref) => {\n const { state, isMobile } = useSidebar()\n const expandedLayout = state === 'expanded' || isMobile\n\n return (\n <DropdownMenuContent\n ref={ref}\n side={expandedLayout ? 'top' : 'right'}\n align={expandedLayout ? 'start' : 'end'}\n sideOffset={4}\n collisionPadding={12}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n focusMenuItemOnTab(event)\n }}\n className={cn(\n `\n surface border border-neutral-100 bg-white p-(--surface-inset) text-left shadow-[0_8px_16px_rgb(0_0_0/0.1)]\n surface-inset [--surface-radius:1rem]\n [&>[role=menuitem]+[role=menuitem]]:mt-1\n `,\n expandedLayout ? 'w-(--radix-dropdown-menu-trigger-width) min-w-0' : 'w-60 min-w-60',\n className,\n )}\n {...props}\n />\n )\n})\nSidebarUserMenuContent.displayName = 'SidebarUserMenuContent'\n\nconst SidebarUserMenuLabel = React.forwardRef<HTMLDivElement, Readonly<React.ComponentProps<'div'>>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('grid grid-cols-1 px-3 pt-3 pb-2 wrap-anywhere', className)} {...props} />\n ),\n)\nSidebarUserMenuLabel.displayName = 'SidebarUserMenuLabel'\n\nconst SidebarUserMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuSeparator>,\n Readonly<React.ComponentProps<typeof DropdownMenuSeparator>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuSeparator ref={ref} className={cn('mx-3 my-1 bg-neutral-100', className)} {...props} />\n))\nSidebarUserMenuSeparator.displayName = 'SidebarUserMenuSeparator'\n\nconst SidebarUserMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuItem>,\n Readonly<React.ComponentProps<typeof DropdownMenuItem>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuItem\n ref={ref}\n className={cn(\n `\n h-9 gap-3 px-3 py-0 text-sm transition-colors\n hover:bg-neutral-100\n focus:bg-neutral-100\n motion-reduce:transition-none\n [&>svg]:size-5\n `,\n className,\n )}\n {...props}\n />\n))\nSidebarUserMenuItem.displayName = 'SidebarUserMenuItem'\n\nconst SidebarUserMenuRadioGroup = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuRadioGroup>,\n Readonly<React.ComponentProps<typeof DropdownMenuRadioGroup>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuRadioGroup ref={ref} className={cn('flex flex-col gap-1', className)} {...props} />\n))\nSidebarUserMenuRadioGroup.displayName = 'SidebarUserMenuRadioGroup'\n\nconst SidebarUserMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuRadioItem>,\n Readonly<React.ComponentProps<typeof DropdownMenuRadioItem>>\n>(({ className, ...props }, ref) => (\n <DropdownMenuRadioItem\n ref={ref}\n className={cn(\n `\n h-9 gap-3 px-3 py-0 text-sm transition-colors\n hover:bg-neutral-100\n focus:bg-neutral-100\n motion-reduce:transition-none\n data-[state=checked]:font-semibold\n [&>span:first-child]:hidden\n [&>svg]:size-5\n `,\n className,\n )}\n {...props}\n />\n))\nSidebarUserMenuRadioItem.displayName = 'SidebarUserMenuRadioItem'\n\nconst SidebarUserMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuSubTrigger>,\n Readonly<React.ComponentProps<typeof DropdownMenuSubTrigger> & { value?: React.ReactNode }>\n>(({ className, children, value, ...props }, ref) => (\n <DropdownMenuSubTrigger\n ref={ref}\n className={cn(\n `\n h-9 gap-3 px-3 py-0 text-sm transition-colors\n hover:bg-neutral-100\n focus:bg-neutral-100\n motion-reduce:transition-none\n [&>svg]:size-5\n [&>svg:last-child]:size-4\n `,\n value !== undefined && '[&>svg:last-child]:ml-0',\n className,\n )}\n {...props}\n >\n {children}\n {value !== undefined && <span className=\"ml-auto text-sm text-neutral-500\">{value}</span>}\n </DropdownMenuSubTrigger>\n))\nSidebarUserMenuSubTrigger.displayName = 'SidebarUserMenuSubTrigger'\n\nconst SidebarUserMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuSubContent>,\n Readonly<React.ComponentProps<typeof DropdownMenuSubContent>>\n>(({ className, onKeyDown, ...props }, ref) => {\n return (\n <DropdownMenuPortal>\n <DropdownMenuSubContent\n ref={ref}\n sideOffset={9}\n alignOffset={-5}\n collisionPadding={12}\n className={cn(\n `\n min-w-40 surface border border-neutral-100 bg-white p-(--surface-inset) text-left\n shadow-[0_8px_16px_rgb(0_0_0/0.1)] surface-inset [--surface-radius:1rem]\n [&>[role=menuitem]+[role=menuitem]]:mt-1\n `,\n className,\n )}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n focusMenuItemOnTab(event)\n }}\n {...props}\n />\n </DropdownMenuPortal>\n )\n})\nSidebarUserMenuSubContent.displayName = 'SidebarUserMenuSubContent'\n\nexport {\n SidebarUser,\n SidebarUserMenuContent,\n SidebarUserMenuItem,\n SidebarUserMenuLabel,\n SidebarUserMenuRadioGroup,\n SidebarUserMenuRadioItem,\n SidebarUserMenuSeparator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
CHANGED
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
outline-offset: var(--focus-ring-offset, 2px);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
:
|
|
244
|
+
:is(
|
|
245
245
|
input:not(
|
|
246
246
|
[type='checkbox'],
|
|
247
247
|
[type='radio'],
|
|
@@ -257,9 +257,8 @@
|
|
|
257
257
|
[contenteditable]:not([contenteditable='false']),
|
|
258
258
|
[role='spinbutton'],
|
|
259
259
|
[role='textbox']
|
|
260
|
-
)
|
|
261
|
-
outline:
|
|
262
|
-
outline-offset: 2px;
|
|
260
|
+
) {
|
|
261
|
+
outline-color: transparent;
|
|
263
262
|
}
|
|
264
263
|
|
|
265
264
|
[data-input-modality='pointer']
|