@webiny/admin-ui 6.5.2-beta.1 → 6.5.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.stories.js.map +1 -1
- package/Accordion/components/AccordionBackgroundProvider.js.map +1 -1
- package/Accordion/components/AccordionTrigger.js.map +1 -1
- package/AdminUiProvider/AdminUiProvider.js.map +1 -1
- package/Checkbox/primitives/CheckboxPrimitive.js.map +1 -1
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
- package/DataTable/DataTable.js +1 -1
- package/DataTable/DataTable.js.map +1 -1
- package/DataTable/DataTable.stories.js +1 -1
- package/DataTable/DataTable.stories.js.map +1 -1
- package/DatePicker/DatePicker.js.map +1 -1
- package/DatePicker/DatePicker.stories.js.map +1 -1
- package/DatePicker/primitives/WeekPicker.js +1 -1
- package/DatePicker/primitives/WeekPicker.js.map +1 -1
- package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
- package/DatePicker/utils/timezoneHelpers.js +1 -1
- package/DatePicker/utils/timezoneHelpers.js.map +1 -1
- package/Dialog/components/DialogContent.js.map +1 -1
- package/Dialog/components/DialogOverlay.js.map +1 -1
- package/Drawer/components/DrawerContent.js.map +1 -1
- package/Drawer/components/DrawerOverlay.js.map +1 -1
- package/DropdownMenu/DropdownMenu.js.map +1 -1
- package/DropdownMenu/DropdownMenu.stories.js +1 -1
- package/DropdownMenu/DropdownMenu.stories.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuCheckboxItem.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuContent.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuLabel.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuSubContent.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuSubTrigger.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -1
- package/Grid/Grid.js +1 -1
- package/Grid/Grid.js.map +1 -1
- package/HeaderBar/HeaderBar.stories.js.map +1 -1
- package/ImageEditor/ImageEditor.stories.js.map +1 -1
- package/Input/InputPrimitive.js.map +1 -1
- package/List/List.stories.js.map +1 -1
- package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
- package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
- package/ScrollArea/ScrollArea.js.map +1 -1
- package/SegmentedControl/SegmentedControl.stories.js.map +1 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.stories.js +6 -6
- package/SegmentedControl/primitives/SegmentedControlPrimitive.stories.js.map +1 -1
- package/Select/primitives/SelectPrimitive.js.map +1 -1
- package/Sidebar/Sidebar.stories.js.map +1 -1
- package/Sidebar/components/SidebarProvider.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuProvider.js.map +1 -1
- package/Slider/Slider.js.map +1 -1
- package/Slider/primitives/SliderPrimitive.js.map +1 -1
- package/SteppedProgress/domains/ProgressItemState.js.map +1 -1
- package/Switch/primitives/SwitchPrimitive.js.map +1 -1
- package/Tabs/Tabs.js.map +1 -1
- package/Tabs/components/Context.js.map +1 -1
- package/Toast/components/ToastIcon.js.map +1 -1
- package/Toggle/primitives/TogglePrimitive.js.map +1 -1
- package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
- package/Tooltip/Tooltip.js.map +1 -1
- package/Tree/Tree.js.map +1 -1
- package/Widget/components/WidgetActionsContext.js.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu/components/DropdownMenuItem.js","sources":["../../../src/DropdownMenu/components/DropdownMenuItem.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn, cva, makeDecoratable } from \"~/utils.js\";\nimport { DropdownMenuSubRoot } from \"./DropdownMenuSubRoot.js\";\nimport { DropdownMenuSubTrigger } from \"./DropdownMenuSubTrigger.js\";\nimport { DropdownMenuPortal } from \"./DropdownMenuPortal.js\";\nimport { DropdownMenuSubContent } from \"./DropdownMenuSubContent.js\";\nimport { DropdownMenuItemIcon, type DropdownMenuItemIconProps } from \"./DropdownMenuItemIcon.js\";\nimport { LinkComponentProps, useAdminUi } from \"~/index.js\";\n\ninterface DropdownMenuItemBaseProps {\n icon?: React.ReactNode;\n readOnly?: boolean;\n variant?: \"destructive\";\n text?: React.ReactNode;\n disabled?: boolean;\n onClick?: React.MouseEventHandler;\n /**\n * Keep the menu open after selecting this item. Useful for items that toggle a value\n * (e.g. a checkbox), where the user expects to make multiple selections in one session.\n */\n preventClose?: boolean;\n}\n\ntype DropdownMenuItemButtonProps = (DropdownMenuItemBaseProps &\n React.HTMLAttributes<HTMLDivElement>) & { to?: never };\ntype DropdownMenuItemLinkProps = DropdownMenuItemBaseProps & LinkComponentProps;\n\ntype DropdownMenuItemProps = DropdownMenuItemButtonProps | DropdownMenuItemLinkProps;\n\nconst variants = cva(\n [\n \"group relative cursor-default select-none items-center rounded-sm\",\n \"text-md text-neutral-primary no-underline!\",\n \"px-xs-plus outline-none transition-colors\",\n \"[&_svg]:fill-neutral-xstrong [&_svg]:pointer-events-none [&_svg]:size-md [&_svg]:shrink-0\",\n \"data-disabled:pointer-events-none data-disabled:text-neutral-disabled\",\n \"[&_a]:no-underline! [&_a]:text-neutral-primary!\"\n ],\n {\n variants: {\n variant: {\n destructive: [\"text-destructive-primary!\", \"[&_svg]:fill-destructive\"]\n },\n readOnly: {\n true: \"pointer-events-none\"\n }\n },\n defaultVariants: {\n readOnly: false\n }\n }\n);\n\nconst DropdownMenuItemBase = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(\n (\n {\n className,\n icon,\n text,\n readOnly,\n variant,\n disabled,\n onClick,\n preventClose,\n children,\n ...linkProps\n },\n ref\n ) => {\n const { linkComponent: LinkComponent } = useAdminUi();\n\n if (children) {\n return (\n <DropdownMenuSubRoot>\n <DropdownMenuSubTrigger>\n {icon}\n <span>{text}</span>\n </DropdownMenuSubTrigger>\n <DropdownMenuPortal>\n <DropdownMenuSubContent>{children}</DropdownMenuSubContent>\n </DropdownMenuPortal>\n </DropdownMenuSubRoot>\n );\n }\n const sharedProps = {\n className: cn(\n \"flex px-sm py-xs-plus gap-sm-extra items-center text-md rounded-sm transition-colors group-focus:bg-neutral-dimmed\",\n {\n \"[&_svg]:fill-neutral-disabled!\": disabled\n }\n )\n };\n\n const content = linkProps.to ? (\n <LinkComponent {...sharedProps} {...linkProps}>\n {icon}\n <span>{text}</span>\n </LinkComponent>\n ) : (\n <div {...sharedProps} onClick={onClick}>\n {icon}\n <span>{text}</span>\n </div>\n );\n\n return (\n <DropdownMenuPrimitive.Item\n disabled={disabled}\n ref={ref}\n className={cn(variants({ readOnly, variant }), className)}\n onSelect={preventClose ? event => event.preventDefault() : undefined}\n >\n {content}\n </DropdownMenuPrimitive.Item>\n );\n }\n);\n\nDropdownMenuItemBase.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DecoratableDropdownMenuItem = makeDecoratable(\"DropdownMenuItem\", DropdownMenuItemBase);\n\nconst DropdownMenuItem = Object.assign(DecoratableDropdownMenuItem, {\n Icon: DropdownMenuItemIcon\n});\n\nexport {\n DropdownMenuItem,\n type DropdownMenuItemProps,\n type DropdownMenuItemButtonProps,\n type DropdownMenuItemLinkProps,\n type DropdownMenuItemIconProps\n};\n"],"names":["variants","cva","DropdownMenuItemBase","React","className","icon","text","readOnly","variant","disabled","onClick","preventClose","children","linkProps","ref","LinkComponent","useAdminUi","DropdownMenuSubRoot","DropdownMenuSubTrigger","DropdownMenuPortal","DropdownMenuSubContent","sharedProps","cn","content","DropdownMenuPrimitive","event","undefined","DecoratableDropdownMenuItem","makeDecoratable","DropdownMenuItem","Object","DropdownMenuItemIcon"],"mappings":";;;;;;;;;AA8BA,MAAMA,WAAWC,IACb;IACI;IACA;IACA;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,aAAa;gBAAC;gBAA6B;aAA2B;QAC1E;QACA,UAAU;YACN,MAAM;QACV;IACJ;IACA,iBAAiB;QACb,UAAU;IACd;AACJ;AAGJ,MAAMC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"DropdownMenu/components/DropdownMenuItem.js","sources":["../../../src/DropdownMenu/components/DropdownMenuItem.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn, cva, makeDecoratable } from \"~/utils.js\";\nimport { DropdownMenuSubRoot } from \"./DropdownMenuSubRoot.js\";\nimport { DropdownMenuSubTrigger } from \"./DropdownMenuSubTrigger.js\";\nimport { DropdownMenuPortal } from \"./DropdownMenuPortal.js\";\nimport { DropdownMenuSubContent } from \"./DropdownMenuSubContent.js\";\nimport { DropdownMenuItemIcon, type DropdownMenuItemIconProps } from \"./DropdownMenuItemIcon.js\";\nimport { LinkComponentProps, useAdminUi } from \"~/index.js\";\n\ninterface DropdownMenuItemBaseProps {\n icon?: React.ReactNode;\n readOnly?: boolean;\n variant?: \"destructive\";\n text?: React.ReactNode;\n disabled?: boolean;\n onClick?: React.MouseEventHandler;\n /**\n * Keep the menu open after selecting this item. Useful for items that toggle a value\n * (e.g. a checkbox), where the user expects to make multiple selections in one session.\n */\n preventClose?: boolean;\n}\n\ntype DropdownMenuItemButtonProps = (DropdownMenuItemBaseProps &\n React.HTMLAttributes<HTMLDivElement>) & { to?: never };\ntype DropdownMenuItemLinkProps = DropdownMenuItemBaseProps & LinkComponentProps;\n\ntype DropdownMenuItemProps = DropdownMenuItemButtonProps | DropdownMenuItemLinkProps;\n\nconst variants = cva(\n [\n \"group relative cursor-default select-none items-center rounded-sm\",\n \"text-md text-neutral-primary no-underline!\",\n \"px-xs-plus outline-none transition-colors\",\n \"[&_svg]:fill-neutral-xstrong [&_svg]:pointer-events-none [&_svg]:size-md [&_svg]:shrink-0\",\n \"data-disabled:pointer-events-none data-disabled:text-neutral-disabled\",\n \"[&_a]:no-underline! [&_a]:text-neutral-primary!\"\n ],\n {\n variants: {\n variant: {\n destructive: [\"text-destructive-primary!\", \"[&_svg]:fill-destructive\"]\n },\n readOnly: {\n true: \"pointer-events-none\"\n }\n },\n defaultVariants: {\n readOnly: false\n }\n }\n);\n\nconst DropdownMenuItemBase = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(\n (\n {\n className,\n icon,\n text,\n readOnly,\n variant,\n disabled,\n onClick,\n preventClose,\n children,\n ...linkProps\n },\n ref\n ) => {\n const { linkComponent: LinkComponent } = useAdminUi();\n\n if (children) {\n return (\n <DropdownMenuSubRoot>\n <DropdownMenuSubTrigger>\n {icon}\n <span>{text}</span>\n </DropdownMenuSubTrigger>\n <DropdownMenuPortal>\n <DropdownMenuSubContent>{children}</DropdownMenuSubContent>\n </DropdownMenuPortal>\n </DropdownMenuSubRoot>\n );\n }\n const sharedProps = {\n className: cn(\n \"flex px-sm py-xs-plus gap-sm-extra items-center text-md rounded-sm transition-colors group-focus:bg-neutral-dimmed\",\n {\n \"[&_svg]:fill-neutral-disabled!\": disabled\n }\n )\n };\n\n const content = linkProps.to ? (\n <LinkComponent {...sharedProps} {...linkProps}>\n {icon}\n <span>{text}</span>\n </LinkComponent>\n ) : (\n <div {...sharedProps} onClick={onClick}>\n {icon}\n <span>{text}</span>\n </div>\n );\n\n return (\n <DropdownMenuPrimitive.Item\n disabled={disabled}\n ref={ref}\n className={cn(variants({ readOnly, variant }), className)}\n onSelect={preventClose ? event => event.preventDefault() : undefined}\n >\n {content}\n </DropdownMenuPrimitive.Item>\n );\n }\n);\n\nDropdownMenuItemBase.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DecoratableDropdownMenuItem = makeDecoratable(\"DropdownMenuItem\", DropdownMenuItemBase);\n\nconst DropdownMenuItem = Object.assign(DecoratableDropdownMenuItem, {\n Icon: DropdownMenuItemIcon\n});\n\nexport {\n DropdownMenuItem,\n type DropdownMenuItemProps,\n type DropdownMenuItemButtonProps,\n type DropdownMenuItemLinkProps,\n type DropdownMenuItemIconProps\n};\n"],"names":["variants","cva","DropdownMenuItemBase","React","className","icon","text","readOnly","variant","disabled","onClick","preventClose","children","linkProps","ref","LinkComponent","useAdminUi","DropdownMenuSubRoot","DropdownMenuSubTrigger","DropdownMenuPortal","DropdownMenuSubContent","sharedProps","cn","content","DropdownMenuPrimitive","event","undefined","DecoratableDropdownMenuItem","makeDecoratable","DropdownMenuItem","Object","DropdownMenuItemIcon"],"mappings":";;;;;;;;;AA8BA,MAAMA,WAAWC,IACb;IACI;IACA;IACA;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,aAAa;gBAAC;gBAA6B;aAA2B;QAC1E;QACA,UAAU;YACN,MAAM;QACV;IACJ;IACA,iBAAiB;QACb,UAAU;IACd;AACJ;AAGJ,MAAMC,uBAAuB,WAAvBA,GAAuBC,wBAAAA,UAAgB,CAIzC,CACI,EACIC,SAAS,EACTC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACN,EACDC;IAEA,MAAM,EAAE,eAAeC,aAAa,EAAE,GAAGC;IAEzC,IAAIJ,UACA,OAAO,WAAP,GACI,sCAACK,qBAAmBA,MAAAA,WAAAA,GAChB,sCAACC,wBAAsBA,MAClBb,MAAAA,WAAAA,GACD,sCAAC,cAAMC,QAAAA,WAAAA,GAEX,sCAACa,oBAAkBA,MAAAA,WAAAA,GACf,sCAACC,wBAAsBA,MAAER;IAKzC,MAAMS,cAAc;QAChB,WAAWC,GACP,sHACA;YACI,kCAAkCb;QACtC;IAER;IAEA,MAAMc,UAAUV,UAAU,EAAE,GAAG,WAAH,GACxB,sCAACE,eAAAA;QAAe,GAAGM,WAAW;QAAG,GAAGR,SAAS;OACxCR,MAAAA,WAAAA,GACD,sCAAC,cAAMC,SAAAA,WAAAA,GAGX,sCAAC;QAAK,GAAGe,WAAW;QAAE,SAASX;OAC1BL,MAAAA,WAAAA,GACD,sCAAC,cAAMC;IAIf,OAAO,WAAP,GACI,sCAACkB,aAAAA,IAA0B;QACvB,UAAUf;QACV,KAAKK;QACL,WAAWQ,GAAGtB,SAAS;YAAEO;YAAUC;QAAQ,IAAIJ;QAC/C,UAAUO,eAAec,CAAAA,QAASA,MAAM,cAAc,KAAKC;OAE1DH;AAGb;AAGJrB,qBAAqB,WAAW,GAAGsB,aAAAA,IAAAA,CAAAA,WAAsC;AAEzE,MAAMG,8BAA8BC,gBAAgB,oBAAoB1B;AAExE,MAAM2B,mBAAmBC,OAAO,MAAM,CAACH,6BAA6B;IAChE,MAAMI;AACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu/components/DropdownMenuLabel.js","sources":["../../../src/DropdownMenu/components/DropdownMenuLabel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\n\nexport interface DropdownMenuLabelProps extends React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Label\n> {\n text: React.ReactNode;\n}\n\nconst DropdownMenuLabelBase = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n DropdownMenuLabelProps\n>(({ className, text, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"py-sm pl-sm-extra pr-md text-sm uppercase text-neutral-strong font-semibold\",\n className\n )}\n {...props}\n >\n {text}\n </DropdownMenuPrimitive.Label>\n));\nDropdownMenuLabelBase.displayName = DropdownMenuPrimitive.Label.displayName;\n\nexport const DropdownMenuLabel = makeDecoratable(\"DropdownMenuLabel\", DropdownMenuLabelBase);\n"],"names":["DropdownMenuLabelBase","React","className","text","props","ref","DropdownMenuPrimitive","cn","DropdownMenuLabel","makeDecoratable"],"mappings":";;;AAUA,MAAMA,wBAAwB,
|
|
1
|
+
{"version":3,"file":"DropdownMenu/components/DropdownMenuLabel.js","sources":["../../../src/DropdownMenu/components/DropdownMenuLabel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\n\nexport interface DropdownMenuLabelProps extends React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Label\n> {\n text: React.ReactNode;\n}\n\nconst DropdownMenuLabelBase = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n DropdownMenuLabelProps\n>(({ className, text, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"py-sm pl-sm-extra pr-md text-sm uppercase text-neutral-strong font-semibold\",\n className\n )}\n {...props}\n >\n {text}\n </DropdownMenuPrimitive.Label>\n));\nDropdownMenuLabelBase.displayName = DropdownMenuPrimitive.Label.displayName;\n\nexport const DropdownMenuLabel = makeDecoratable(\"DropdownMenuLabel\", DropdownMenuLabelBase);\n"],"names":["DropdownMenuLabelBase","React","className","text","props","ref","DropdownMenuPrimitive","cn","DropdownMenuLabel","makeDecoratable"],"mappings":";;;AAUA,MAAMA,wBAAwB,WAAxBA,GAAwBC,wBAAAA,UAAgB,CAG5C,CAAC,EAAEC,SAAS,EAAEC,IAAI,EAAE,GAAGC,OAAO,EAAEC,MAAAA,WAAAA,GAC9B,sCAACC,aAAAA,KAA2B;QACxB,KAAKD;QACL,WAAWE,GACP,+EACAL;QAEH,GAAGE,KAAK;OAERD;AAGTH,sBAAsB,WAAW,GAAGM,aAAAA,KAAAA,CAAAA,WAAuC;AAEpE,MAAME,oBAAoBC,gBAAgB,qBAAqBT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu/components/DropdownMenuSubContent.js","sources":["../../../src/DropdownMenu/components/DropdownMenuSubContent.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n avoidCollisions={false}\n className={cn(\n \"border-sm border-solid border-neutral-muted z-popover min-w-32 overflow-hidden rounded-md border bg-white py-xs-plus text-neutral-primary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n // Added these to match alignment shown in the design.\n sideOffset={-9}\n alignOffset={-2}\n {...props}\n />\n));\n\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nexport { DropdownMenuSubContent };\n"],"names":["DropdownMenuSubContent","React","className","props","ref","DropdownMenuPrimitive","cn"],"mappings":";;;AAIA,MAAMA,yBAAyB,
|
|
1
|
+
{"version":3,"file":"DropdownMenu/components/DropdownMenuSubContent.js","sources":["../../../src/DropdownMenu/components/DropdownMenuSubContent.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n avoidCollisions={false}\n className={cn(\n \"border-sm border-solid border-neutral-muted z-popover min-w-32 overflow-hidden rounded-md border bg-white py-xs-plus text-neutral-primary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n // Added these to match alignment shown in the design.\n sideOffset={-9}\n alignOffset={-2}\n {...props}\n />\n));\n\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nexport { DropdownMenuSubContent };\n"],"names":["DropdownMenuSubContent","React","className","props","ref","DropdownMenuPrimitive","cn"],"mappings":";;;AAIA,MAAMA,yBAAyB,WAAzBA,GAAyBC,wBAAAA,UAAgB,CAG7C,CAAC,EAAEC,SAAS,EAAE,GAAGC,OAAO,EAAEC,MAAAA,WAAAA,GACxB,sCAACC,aAAAA,UAAgC;QAC7B,KAAKD;QACL,iBAAiB;QACjB,WAAWE,GACP,weACAJ;QAGJ,YAAY;QACZ,aAAa;QACZ,GAAGC,KAAK;;AAIjBH,uBAAuB,WAAW,GAAGK,aAAAA,UAAAA,CAAAA,WAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu/components/DropdownMenuSubTrigger.js","sources":["../../../src/DropdownMenu/components/DropdownMenuSubTrigger.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\nimport { ReactComponent as ChevronRight } from \"@webiny/icons/chevron_right.svg\";\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"group flex cursor-default select-none items-center rounded-sm px-xs-plus text-md outline-none\",\n className\n )}\n {...props}\n >\n <div\n className={cn(\n \"rounded-sm gap-sm-extra group-focus:bg-neutral-dimmed flex items-center w-full px-sm py-xs-plus transition-colors\",\n \"[&_svg]:pointer-events-none [&_svg]:size-md [&_svg]:shrink-0 [&_svg]:fill-neutral-xstrong\"\n )}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n));\n\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nexport { DropdownMenuSubTrigger };\n"],"names":["DropdownMenuSubTrigger","React","className","children","props","ref","DropdownMenuPrimitive","cn","ChevronRight"],"mappings":";;;;AAKA,MAAMA,yBAAyB,
|
|
1
|
+
{"version":3,"file":"DropdownMenu/components/DropdownMenuSubTrigger.js","sources":["../../../src/DropdownMenu/components/DropdownMenuSubTrigger.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\nimport { ReactComponent as ChevronRight } from \"@webiny/icons/chevron_right.svg\";\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"group flex cursor-default select-none items-center rounded-sm px-xs-plus text-md outline-none\",\n className\n )}\n {...props}\n >\n <div\n className={cn(\n \"rounded-sm gap-sm-extra group-focus:bg-neutral-dimmed flex items-center w-full px-sm py-xs-plus transition-colors\",\n \"[&_svg]:pointer-events-none [&_svg]:size-md [&_svg]:shrink-0 [&_svg]:fill-neutral-xstrong\"\n )}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n));\n\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nexport { DropdownMenuSubTrigger };\n"],"names":["DropdownMenuSubTrigger","React","className","children","props","ref","DropdownMenuPrimitive","cn","ChevronRight"],"mappings":";;;;AAKA,MAAMA,yBAAyB,WAAzBA,GAAyBC,wBAAAA,UAAgB,CAG7C,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAAO,EAAEC,MAAAA,WAAAA,GAClC,sCAACC,aAAAA,UAAgC;QAC7B,KAAKD;QACL,WAAWE,GACP,iGACAL;QAEH,GAAGE,KAAK;qBAET,sCAAC;QACG,WAAWG,GACP,qHACA;OAGHJ,UAAAA,WAAAA,GACD,sCAACK,gBAAYA;QAAC,WAAU;;AAKpCR,uBAAuB,WAAW,GAAGM,aAAAA,UAAAA,CAAAA,WAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { ReactComponent as ReplaceIcon } from \"@webiny/icons/file_upload.svg\";\nimport { ReactComponent as EditIcon } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as TrashIcon } from \"@webiny/icons/delete.svg\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Tooltip } from \"~/Tooltip/index.js\";\nimport { cn } from \"~/utils.js\";\n\ninterface ActionProps {\n icon: React.JSX.Element;\n label: string;\n onAction: () => void;\n disabled?: boolean;\n}\n\nconst Action = ({ icon, label, onAction, disabled }: ActionProps) => {\n const onClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n // The thumbnail behind these opens the file manager when clicked, so without this a\n // click on Remove would replace the file as well as remove it.\n event.stopPropagation();\n onAction();\n },\n [onAction]\n );\n\n return (\n <Tooltip\n content={label}\n trigger={\n <IconButton\n variant={\"tertiary\"}\n size={\"sm\"}\n icon={icon}\n onClick={onClick}\n disabled={disabled}\n />\n }\n />\n );\n};\n\ninterface ThumbnailActionsProps {\n onRemoveItem?: () => void;\n onEditItem?: () => void;\n onReplaceItem?: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * The file's actions laid over its thumbnail and revealed on hover, mirroring the File Manager's\n * grid so a file offers the same affordances wherever it is shown. Requires `group` and\n * `relative` on the element wrapping the thumbnail.\n */\nconst ThumbnailActions = ({\n className,\n disabled,\n onEditItem,\n onRemoveItem,\n onReplaceItem\n}: ThumbnailActionsProps) => {\n return (\n <div\n className={cn(\n \"invisible group-hover:visible\",\n \"flex items-center gap-xxs\",\n \"absolute top-xs-plus right-xs-plus\",\n className\n )}\n >\n {onReplaceItem && (\n <Action\n icon={<ReplaceIcon />}\n label={\"Replace\"}\n onAction={onReplaceItem}\n disabled={disabled}\n />\n )}\n {onEditItem && (\n <Action\n icon={<EditIcon />}\n label={\"Edit\"}\n onAction={onEditItem}\n disabled={disabled}\n />\n )}\n {onRemoveItem && (\n <Action\n icon={<TrashIcon />}\n label={\"Remove\"}\n onAction={onRemoveItem}\n disabled={disabled}\n />\n )}\n </div>\n );\n};\n\nexport { ThumbnailActions, type ThumbnailActionsProps };\n"],"names":["Action","icon","label","onAction","disabled","onClick","useCallback","event","Tooltip","IconButton","ThumbnailActions","className","onEditItem","onRemoveItem","onReplaceItem","cn","ReplaceIcon","EditIcon","TrashIcon"],"mappings":";;;;;;;AAeA,MAAMA,SAAS,CAAC,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,EAAe;IAC5D,MAAMC,UAAUC,YACZ,CAACC;QAGGA,MAAM,eAAe;QACrBJ;IACJ,GACA;QAACA;KAAS;IAGd,OAAO,WAAP,GACI,oBAACK,SAAOA;QACJ,SAASN;QACT,uBACI,oBAACO,YAAUA;YACP,SAAS;YACT,MAAM;YACN,MAAMR;YACN,SAASI;YACT,UAAUD;;;AAK9B;AAeA,MAAMM,mBAAmB,CAAC,EACtBC,SAAS,EACTP,QAAQ,EACRQ,UAAU,EACVC,YAAY,EACZC,aAAa,EACO,GACb,WAAP,GACI,oBAAC;QACG,WAAWC,GACP,iCACA,6BACA,sCACAJ;OAGHG,iBAAiB,WAAjBA,GACG,oBAACd,
|
|
1
|
+
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { ReactComponent as ReplaceIcon } from \"@webiny/icons/file_upload.svg\";\nimport { ReactComponent as EditIcon } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as TrashIcon } from \"@webiny/icons/delete.svg\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Tooltip } from \"~/Tooltip/index.js\";\nimport { cn } from \"~/utils.js\";\n\ninterface ActionProps {\n icon: React.JSX.Element;\n label: string;\n onAction: () => void;\n disabled?: boolean;\n}\n\nconst Action = ({ icon, label, onAction, disabled }: ActionProps) => {\n const onClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n // The thumbnail behind these opens the file manager when clicked, so without this a\n // click on Remove would replace the file as well as remove it.\n event.stopPropagation();\n onAction();\n },\n [onAction]\n );\n\n return (\n <Tooltip\n content={label}\n trigger={\n <IconButton\n variant={\"tertiary\"}\n size={\"sm\"}\n icon={icon}\n onClick={onClick}\n disabled={disabled}\n />\n }\n />\n );\n};\n\ninterface ThumbnailActionsProps {\n onRemoveItem?: () => void;\n onEditItem?: () => void;\n onReplaceItem?: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * The file's actions laid over its thumbnail and revealed on hover, mirroring the File Manager's\n * grid so a file offers the same affordances wherever it is shown. Requires `group` and\n * `relative` on the element wrapping the thumbnail.\n */\nconst ThumbnailActions = ({\n className,\n disabled,\n onEditItem,\n onRemoveItem,\n onReplaceItem\n}: ThumbnailActionsProps) => {\n return (\n <div\n className={cn(\n \"invisible group-hover:visible\",\n \"flex items-center gap-xxs\",\n \"absolute top-xs-plus right-xs-plus\",\n className\n )}\n >\n {onReplaceItem && (\n <Action\n icon={<ReplaceIcon />}\n label={\"Replace\"}\n onAction={onReplaceItem}\n disabled={disabled}\n />\n )}\n {onEditItem && (\n <Action\n icon={<EditIcon />}\n label={\"Edit\"}\n onAction={onEditItem}\n disabled={disabled}\n />\n )}\n {onRemoveItem && (\n <Action\n icon={<TrashIcon />}\n label={\"Remove\"}\n onAction={onRemoveItem}\n disabled={disabled}\n />\n )}\n </div>\n );\n};\n\nexport { ThumbnailActions, type ThumbnailActionsProps };\n"],"names":["Action","icon","label","onAction","disabled","onClick","useCallback","event","Tooltip","IconButton","ThumbnailActions","className","onEditItem","onRemoveItem","onReplaceItem","cn","ReplaceIcon","EditIcon","TrashIcon"],"mappings":";;;;;;;AAeA,MAAMA,SAAS,CAAC,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,EAAe;IAC5D,MAAMC,UAAUC,YACZ,CAACC;QAGGA,MAAM,eAAe;QACrBJ;IACJ,GACA;QAACA;KAAS;IAGd,OAAO,WAAP,GACI,oBAACK,SAAOA;QACJ,SAASN;QACT,uBACI,oBAACO,YAAUA;YACP,SAAS;YACT,MAAM;YACN,MAAMR;YACN,SAASI;YACT,UAAUD;;;AAK9B;AAeA,MAAMM,mBAAmB,CAAC,EACtBC,SAAS,EACTP,QAAQ,EACRQ,UAAU,EACVC,YAAY,EACZC,aAAa,EACO,GACb,WAAP,GACI,oBAAC;QACG,WAAWC,GACP,iCACA,6BACA,sCACAJ;OAGHG,iBAAiB,WAAjBA,GACG,oBAACd,QAAAA;QACG,oBAAM,oBAACgB,gBAAWA;QAClB,OAAO;QACP,UAAUF;QACV,UAAUV;QAGjBQ,cAAc,WAAdA,GACG,oBAACZ,QAAAA;QACG,oBAAM,oBAACiB,yBAAQA;QACf,OAAO;QACP,UAAUL;QACV,UAAUR;QAGjBS,gBAAgB,WAAhBA,GACG,oBAACb,QAAAA;QACG,oBAAM,oBAACkB,2BAASA;QAChB,OAAO;QACP,UAAUL;QACV,UAAUT"}
|
package/Grid/Grid.js
CHANGED
|
@@ -72,7 +72,7 @@ const GridBase = ({ gap, children, className, ...props })=>/*#__PURE__*/ react.c
|
|
|
72
72
|
}, children);
|
|
73
73
|
const DecoratableGrid = makeDecoratable("Grid", GridBase);
|
|
74
74
|
const Grid = withStaticProps(DecoratableGrid, {
|
|
75
|
-
Column
|
|
75
|
+
Column
|
|
76
76
|
});
|
|
77
77
|
export { Grid };
|
|
78
78
|
|
package/Grid/Grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid/Grid.js","sources":["../../src/Grid/Grid.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, cva, withStaticProps, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\nconst columnVariants = cva(\"\", {\n variants: {\n span: {\n auto: \"col-auto\",\n 1: \"col-span-1\",\n 2: \"col-span-2\",\n 3: \"col-span-3\",\n 4: \"col-span-4\",\n 5: \"col-span-5\",\n 6: \"col-span-6\",\n 7: \"col-span-7\",\n 8: \"col-span-8\",\n 9: \"col-span-9\",\n 10: \"col-span-10\",\n 11: \"col-span-11\",\n 12: \"col-span-12\"\n },\n offset: {\n 1: \"col-start-2\",\n 2: \"col-start-3\",\n 3: \"col-start-4\",\n 4: \"col-start-5\",\n 5: \"col-start-6\",\n 6: \"col-start-7\",\n 7: \"col-start-8\",\n 8: \"col-start-9\",\n 9: \"col-start-10\",\n 10: \"col-start-11\",\n 11: \"col-start-12\"\n },\n align: {\n top: \"self-start\",\n middle: \"self-center\",\n bottom: \"self-end\"\n }\n },\n defaultVariants: {\n span: \"auto\"\n }\n});\n\ninterface ColumnProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof columnVariants> {\n children?: React.ReactNode;\n}\n\nconst ColumnBase = ({ span, align, children, className, offset, ...props }: ColumnProps) => {\n return (\n <div {...props} className={cn(columnVariants({ span, offset, align }), className)}>\n {children}\n </div>\n );\n};\n\nconst Column = makeDecoratable(\"Column\", ColumnBase);\n\nconst gridVariants = cva(\"grid\", {\n variants: {\n gap: {\n none: \"gap-0\",\n micro: \"gap-xs\",\n small: \"gap-sm\",\n compact: \"gap-md\",\n comfortable: \"gap-lg\",\n spacious: \"gap-xl\"\n }\n },\n defaultVariants: {\n gap: \"comfortable\"\n }\n});\n\ninterface GridProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof gridVariants> {\n children:\n | null\n | React.ReactElement<ColumnProps, typeof Column>\n | Array<React.ReactElement<ColumnProps, typeof Column> | null>;\n}\n\nconst GridBase = ({ gap, children, className, ...props }: GridProps) => {\n return (\n <div {...props} className={cn(\"grid-cols-12\", gridVariants({ gap }), className)}>\n {children}\n </div>\n );\n};\n\nconst DecoratableGrid = makeDecoratable(\"Grid\", GridBase);\n\nconst Grid = withStaticProps(DecoratableGrid, { Column });\n\nexport { Grid, type GridProps, type ColumnProps };\n"],"names":["columnVariants","cva","ColumnBase","span","align","children","className","offset","props","cn","Column","makeDecoratable","gridVariants","GridBase","gap","DecoratableGrid","Grid","withStaticProps"],"mappings":";;AAGA,MAAMA,iBAAiBC,IAAI,IAAI;IAC3B,UAAU;QACN,MAAM;YACF,MAAM;YACN,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,IAAI;YACJ,IAAI;YACJ,IAAI;QACR;QACA,QAAQ;YACJ,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,IAAI;YACJ,IAAI;QACR;QACA,OAAO;YACH,KAAK;YACL,QAAQ;YACR,QAAQ;QACZ;IACJ;IACA,iBAAiB;QACb,MAAM;IACV;AACJ;AAOA,MAAMC,aAAa,CAAC,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAE,GAAGC,OAAoB,GAC5E,WAAP,GACI,oBAAC;QAAK,GAAGA,KAAK;QAAE,WAAWC,GAAGT,eAAe;YAAEG;YAAMI;YAAQH;QAAM,IAAIE;OAClED;AAKb,MAAMK,SAASC,gBAAgB,UAAUT;AAEzC,MAAMU,eAAeX,IAAI,QAAQ;IAC7B,UAAU;QACN,KAAK;YACD,MAAM;YACN,OAAO;YACP,OAAO;YACP,SAAS;YACT,aAAa;YACb,UAAU;QACd;IACJ;IACA,iBAAiB;QACb,KAAK;IACT;AACJ;AAUA,MAAMY,WAAW,CAAC,EAAEC,GAAG,EAAET,QAAQ,EAAEC,SAAS,EAAE,GAAGE,OAAkB,GACxD,WAAP,GACI,oBAAC;QAAK,GAAGA,KAAK;QAAE,WAAWC,GAAG,gBAAgBG,aAAa;YAAEE;QAAI,IAAIR;OAChED;AAKb,MAAMU,kBAAkBJ,gBAAgB,QAAQE;AAEhD,MAAMG,OAAOC,gBAAgBF,iBAAiB;IAAEL
|
|
1
|
+
{"version":3,"file":"Grid/Grid.js","sources":["../../src/Grid/Grid.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, cva, withStaticProps, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\nconst columnVariants = cva(\"\", {\n variants: {\n span: {\n auto: \"col-auto\",\n 1: \"col-span-1\",\n 2: \"col-span-2\",\n 3: \"col-span-3\",\n 4: \"col-span-4\",\n 5: \"col-span-5\",\n 6: \"col-span-6\",\n 7: \"col-span-7\",\n 8: \"col-span-8\",\n 9: \"col-span-9\",\n 10: \"col-span-10\",\n 11: \"col-span-11\",\n 12: \"col-span-12\"\n },\n offset: {\n 1: \"col-start-2\",\n 2: \"col-start-3\",\n 3: \"col-start-4\",\n 4: \"col-start-5\",\n 5: \"col-start-6\",\n 6: \"col-start-7\",\n 7: \"col-start-8\",\n 8: \"col-start-9\",\n 9: \"col-start-10\",\n 10: \"col-start-11\",\n 11: \"col-start-12\"\n },\n align: {\n top: \"self-start\",\n middle: \"self-center\",\n bottom: \"self-end\"\n }\n },\n defaultVariants: {\n span: \"auto\"\n }\n});\n\ninterface ColumnProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof columnVariants> {\n children?: React.ReactNode;\n}\n\nconst ColumnBase = ({ span, align, children, className, offset, ...props }: ColumnProps) => {\n return (\n <div {...props} className={cn(columnVariants({ span, offset, align }), className)}>\n {children}\n </div>\n );\n};\n\nconst Column = makeDecoratable(\"Column\", ColumnBase);\n\nconst gridVariants = cva(\"grid\", {\n variants: {\n gap: {\n none: \"gap-0\",\n micro: \"gap-xs\",\n small: \"gap-sm\",\n compact: \"gap-md\",\n comfortable: \"gap-lg\",\n spacious: \"gap-xl\"\n }\n },\n defaultVariants: {\n gap: \"comfortable\"\n }\n});\n\ninterface GridProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof gridVariants> {\n children:\n | null\n | React.ReactElement<ColumnProps, typeof Column>\n | Array<React.ReactElement<ColumnProps, typeof Column> | null>;\n}\n\nconst GridBase = ({ gap, children, className, ...props }: GridProps) => {\n return (\n <div {...props} className={cn(\"grid-cols-12\", gridVariants({ gap }), className)}>\n {children}\n </div>\n );\n};\n\nconst DecoratableGrid = makeDecoratable(\"Grid\", GridBase);\n\nconst Grid = withStaticProps(DecoratableGrid, { Column });\n\nexport { Grid, type GridProps, type ColumnProps };\n"],"names":["columnVariants","cva","ColumnBase","span","align","children","className","offset","props","cn","Column","makeDecoratable","gridVariants","GridBase","gap","DecoratableGrid","Grid","withStaticProps"],"mappings":";;AAGA,MAAMA,iBAAiBC,IAAI,IAAI;IAC3B,UAAU;QACN,MAAM;YACF,MAAM;YACN,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,IAAI;YACJ,IAAI;YACJ,IAAI;QACR;QACA,QAAQ;YACJ,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,IAAI;YACJ,IAAI;QACR;QACA,OAAO;YACH,KAAK;YACL,QAAQ;YACR,QAAQ;QACZ;IACJ;IACA,iBAAiB;QACb,MAAM;IACV;AACJ;AAOA,MAAMC,aAAa,CAAC,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAE,GAAGC,OAAoB,GAC5E,WAAP,GACI,oBAAC;QAAK,GAAGA,KAAK;QAAE,WAAWC,GAAGT,eAAe;YAAEG;YAAMI;YAAQH;QAAM,IAAIE;OAClED;AAKb,MAAMK,SAASC,gBAAgB,UAAUT;AAEzC,MAAMU,eAAeX,IAAI,QAAQ;IAC7B,UAAU;QACN,KAAK;YACD,MAAM;YACN,OAAO;YACP,OAAO;YACP,SAAS;YACT,aAAa;YACb,UAAU;QACd;IACJ;IACA,iBAAiB;QACb,KAAK;IACT;AACJ;AAUA,MAAMY,WAAW,CAAC,EAAEC,GAAG,EAAET,QAAQ,EAAEC,SAAS,EAAE,GAAGE,OAAkB,GACxD,WAAP,GACI,oBAAC;QAAK,GAAGA,KAAK;QAAE,WAAWC,GAAG,gBAAgBG,aAAa;YAAEE;QAAI,IAAIR;OAChED;AAKb,MAAMU,kBAAkBJ,gBAAgB,QAAQE;AAEhD,MAAMG,OAAOC,gBAAgBF,iBAAiB;IAAEL;AAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderBar/HeaderBar.stories.js","sources":["../../src/HeaderBar/HeaderBar.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { ReactComponent as KeyboardArrowRightIcon } from \"@webiny/icons/keyboard_arrow_down.svg\";\nimport { HeaderBar } from \"./HeaderBar.js\";\nimport React from \"react\";\nimport { Button, IconButton } from \"~/Button/index.js\";\nimport { Avatar } from \"~/Avatar/index.js\";\nimport { Text } from \"~/Text/index.js\";\n\nconst meta: Meta<typeof HeaderBar> = {\n title: \"Components/HeaderBar\",\n component: HeaderBar,\n decorators: [\n Story => (\n <div className=\"bg-[#f4f4f4] h-[500px] w-[850px] rounded-[5px] px-[50px] content-center\">\n <Story />\n </div>\n )\n ]\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof HeaderBar>;\n\nconst StartExample = () => (\n <Text size={\"sm\"} className={\"text-neutral-dimmed\"}>\n {\"Headless CMS / Articles / The best article ever\"}\n </Text>\n);\n\nconst MiddleExample = () => <>Content in the middle</>;\n\nconst EndExample = () => (\n <div className={\"flex gap-x-sm\"}>\n <Button variant={\"ghost\"} size={\"md\"} text={\"Root tenant\"} />\n <div className={\"flex items-center rounded-md gap-xxs py-xs px-xs bg-neutral-light\"}>\n <Avatar\n size={\"sm\"}\n variant={\"strong\"}\n image={<Avatar.Image src={\"https://i.pravatar.cc/300\"} />}\n fallback={<Avatar.Fallback delayMs={0}>W</Avatar.Fallback>}\n />\n <IconButton\n variant={\"ghost\"}\n size={\"xs\"}\n color={\"neutral-strong\"}\n icon={<KeyboardArrowRightIcon />}\n onClick={() => console.log(\"clicked\")}\n />\n </div>\n </div>\n);\n\nexport const Default: Story = {\n args: {\n start: <StartExample />,\n middle: <MiddleExample />,\n end: <EndExample />\n }\n};\n\nexport const StartContentOnly: Story = {\n args: {\n start: <StartExample />\n }\n};\n\nexport const MiddleContentOnly: Story = {\n args: {\n middle: <MiddleExample />\n }\n};\n\nexport const EndContentOnly: Story = {\n args: {\n end: <EndExample />\n }\n};\n\nexport const StartEndContentOnly: Story = {\n args: {\n start: <StartExample />,\n end: <EndExample />\n }\n};\n\nexport const MoreStartContent: Story = {\n args: {\n start: (\n <>\n <StartExample />\n <StartExample />\n <StartExample />\n </>\n ),\n middle: <MiddleExample />,\n end: <EndExample />\n }\n};\n\nexport const Documentation: Story = {\n args: {\n start: <StartExample />,\n middle: <MiddleExample />,\n end: <EndExample />\n },\n argTypes: {\n start: {\n description: \"Content displayed at the start of the header bar\"\n },\n middle: {\n description: \"Content displayed in the middle of the header bar\"\n },\n end: {\n description: \"Content displayed at the end of the header bar\"\n }\n }\n};\n"],"names":["meta","HeaderBar","Story","StartExample","Text","MiddleExample","EndExample","Button","Avatar","IconButton","KeyboardArrowRightIcon","console","Default","StartContentOnly","MiddleContentOnly","EndContentOnly","StartEndContentOnly","MoreStartContent","Documentation"],"mappings":";;;;;;AAQA,MAAMA,OAA+B;IACjC,OAAO;IACP,WAAWC;IACX,YAAY;QACRC,CAAAA,QAAAA,WAAAA,GACI,oBAAC;gBAAI,WAAU;6BACX,oBAACA,OAAAA;KAGZ;AACL;AAEA,0BAAeF;AAIf,MAAMG,eAAe,kBACjB,oBAACC,MAAIA;QAAC,MAAM;QAAM,WAAW;OACxB;AAIT,MAAMC,gBAAgB,kBAAM,0CAAE;AAE9B,MAAMC,aAAa,kBACf,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QAAC,SAAS;QAAS,MAAM;QAAM,MAAM;sBAC5C,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QACH,MAAM;QACN,SAAS;QACT,qBAAO,oBAACA,OAAO,KAAK;YAAC,KAAK;;QAC1B,wBAAU,oBAACA,OAAO,QAAQ;YAAC,SAAS;WAAG;sBAE3C,oBAACC,YAAUA;QACP,SAAS;QACT,MAAM;QACN,OAAO;QACP,oBAAM,oBAACC,gBAAsBA;QAC7B,SAAS,IAAMC,QAAQ,GAAG,CAAC;;AAMpC,MAAMC,UAAiB;IAC1B,MAAM;QACF,OAAO,WAAP,GAAO,oBAACT,
|
|
1
|
+
{"version":3,"file":"HeaderBar/HeaderBar.stories.js","sources":["../../src/HeaderBar/HeaderBar.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { ReactComponent as KeyboardArrowRightIcon } from \"@webiny/icons/keyboard_arrow_down.svg\";\nimport { HeaderBar } from \"./HeaderBar.js\";\nimport React from \"react\";\nimport { Button, IconButton } from \"~/Button/index.js\";\nimport { Avatar } from \"~/Avatar/index.js\";\nimport { Text } from \"~/Text/index.js\";\n\nconst meta: Meta<typeof HeaderBar> = {\n title: \"Components/HeaderBar\",\n component: HeaderBar,\n decorators: [\n Story => (\n <div className=\"bg-[#f4f4f4] h-[500px] w-[850px] rounded-[5px] px-[50px] content-center\">\n <Story />\n </div>\n )\n ]\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof HeaderBar>;\n\nconst StartExample = () => (\n <Text size={\"sm\"} className={\"text-neutral-dimmed\"}>\n {\"Headless CMS / Articles / The best article ever\"}\n </Text>\n);\n\nconst MiddleExample = () => <>Content in the middle</>;\n\nconst EndExample = () => (\n <div className={\"flex gap-x-sm\"}>\n <Button variant={\"ghost\"} size={\"md\"} text={\"Root tenant\"} />\n <div className={\"flex items-center rounded-md gap-xxs py-xs px-xs bg-neutral-light\"}>\n <Avatar\n size={\"sm\"}\n variant={\"strong\"}\n image={<Avatar.Image src={\"https://i.pravatar.cc/300\"} />}\n fallback={<Avatar.Fallback delayMs={0}>W</Avatar.Fallback>}\n />\n <IconButton\n variant={\"ghost\"}\n size={\"xs\"}\n color={\"neutral-strong\"}\n icon={<KeyboardArrowRightIcon />}\n onClick={() => console.log(\"clicked\")}\n />\n </div>\n </div>\n);\n\nexport const Default: Story = {\n args: {\n start: <StartExample />,\n middle: <MiddleExample />,\n end: <EndExample />\n }\n};\n\nexport const StartContentOnly: Story = {\n args: {\n start: <StartExample />\n }\n};\n\nexport const MiddleContentOnly: Story = {\n args: {\n middle: <MiddleExample />\n }\n};\n\nexport const EndContentOnly: Story = {\n args: {\n end: <EndExample />\n }\n};\n\nexport const StartEndContentOnly: Story = {\n args: {\n start: <StartExample />,\n end: <EndExample />\n }\n};\n\nexport const MoreStartContent: Story = {\n args: {\n start: (\n <>\n <StartExample />\n <StartExample />\n <StartExample />\n </>\n ),\n middle: <MiddleExample />,\n end: <EndExample />\n }\n};\n\nexport const Documentation: Story = {\n args: {\n start: <StartExample />,\n middle: <MiddleExample />,\n end: <EndExample />\n },\n argTypes: {\n start: {\n description: \"Content displayed at the start of the header bar\"\n },\n middle: {\n description: \"Content displayed in the middle of the header bar\"\n },\n end: {\n description: \"Content displayed at the end of the header bar\"\n }\n }\n};\n"],"names":["meta","HeaderBar","Story","StartExample","Text","MiddleExample","EndExample","Button","Avatar","IconButton","KeyboardArrowRightIcon","console","Default","StartContentOnly","MiddleContentOnly","EndContentOnly","StartEndContentOnly","MoreStartContent","Documentation"],"mappings":";;;;;;AAQA,MAAMA,OAA+B;IACjC,OAAO;IACP,WAAWC;IACX,YAAY;QACRC,CAAAA,QAAAA,WAAAA,GACI,oBAAC;gBAAI,WAAU;6BACX,oBAACA,OAAAA;KAGZ;AACL;AAEA,0BAAeF;AAIf,MAAMG,eAAe,kBACjB,oBAACC,MAAIA;QAAC,MAAM;QAAM,WAAW;OACxB;AAIT,MAAMC,gBAAgB,kBAAM,0CAAE;AAE9B,MAAMC,aAAa,kBACf,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QAAC,SAAS;QAAS,MAAM;QAAM,MAAM;sBAC5C,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QACH,MAAM;QACN,SAAS;QACT,qBAAO,oBAACA,OAAO,KAAK;YAAC,KAAK;;QAC1B,wBAAU,oBAACA,OAAO,QAAQ;YAAC,SAAS;WAAG;sBAE3C,oBAACC,YAAUA;QACP,SAAS;QACT,MAAM;QACN,OAAO;QACP,oBAAM,oBAACC,gBAAsBA;QAC7B,SAAS,IAAMC,QAAQ,GAAG,CAAC;;AAMpC,MAAMC,UAAiB;IAC1B,MAAM;QACF,OAAO,WAAP,GAAO,oBAACT,cAAAA;QACR,QAAQ,WAAR,GAAQ,oBAACE,eAAAA;QACT,KAAK,WAAL,GAAK,oBAACC,YAAAA;IACV;AACJ;AAEO,MAAMO,mBAA0B;IACnC,MAAM;QACF,OAAO,WAAP,GAAO,oBAACV,cAAAA;IACZ;AACJ;AAEO,MAAMW,oBAA2B;IACpC,MAAM;QACF,QAAQ,WAAR,GAAQ,oBAACT,eAAAA;IACb;AACJ;AAEO,MAAMU,iBAAwB;IACjC,MAAM;QACF,KAAK,WAAL,GAAK,oBAACT,YAAAA;IACV;AACJ;AAEO,MAAMU,sBAA6B;IACtC,MAAM;QACF,OAAO,WAAP,GAAO,oBAACb,cAAAA;QACR,KAAK,WAAL,GAAK,oBAACG,YAAAA;IACV;AACJ;AAEO,MAAMW,mBAA0B;IACnC,MAAM;QACF,OAAO,WAAP,GACI,wDACI,oBAACd,cAAAA,OAAAA,WAAAA,GACD,oBAACA,cAAAA,OAAAA,WAAAA,GACD,oBAACA,cAAAA;QAGT,QAAQ,WAAR,GAAQ,oBAACE,eAAAA;QACT,KAAK,WAAL,GAAK,oBAACC,YAAAA;IACV;AACJ;AAEO,MAAMY,gBAAuB;IAChC,MAAM;QACF,OAAO,WAAP,GAAO,oBAACf,cAAAA;QACR,QAAQ,WAAR,GAAQ,oBAACE,eAAAA;QACT,KAAK,WAAL,GAAK,oBAACC,YAAAA;IACV;IACA,UAAU;QACN,OAAO;YACH,aAAa;QACjB;QACA,QAAQ;YACJ,aAAa;QACjB;QACA,KAAK;YACD,aAAa;QACjB;IACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageEditor/ImageEditor.stories.js","sources":["../../src/ImageEditor/ImageEditor.stories.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { Button } from \"~/Button/index.js\";\nimport { ImageEditor, type ImageEditorValue } from \"./index.js\";\n\nconst meta: Meta<typeof ImageEditor> = {\n title: \"Components/ImageEditor\",\n component: ImageEditor,\n parameters: {\n layout: \"fullscreen\"\n }\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof ImageEditor>;\n\nconst DemoImage = {\n src: \"https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1600\",\n width: 1600,\n height: 1067\n};\n\nconst Demo = () => {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState<ImageEditorValue | undefined>(undefined);\n\n return (\n <div className={\"p-lg\"}>\n <Button variant={\"primary\"} text={\"Edit image\"} onClick={() => setOpen(true)} />\n <pre className={\"mt-md text-sm\"}>{JSON.stringify(value, null, 2)}</pre>\n <ImageEditor\n open={open}\n onClose={() => setOpen(false)}\n image={DemoImage}\n value={value}\n onSave={setValue}\n />\n </div>\n );\n};\n\nexport const Default: Story = {\n render: () => <Demo />\n};\n"],"names":["meta","ImageEditor","DemoImage","Demo","open","setOpen","useState","value","setValue","undefined","Button","JSON","Default"],"mappings":";;;AAKA,MAAMA,OAAiC;IACnC,OAAO;IACP,WAAWC;IACX,YAAY;QACR,QAAQ;IACZ;AACJ;AAEA,4BAAeD;AAIf,MAAME,YAAY;IACd,KAAK;IACL,OAAO;IACP,QAAQ;AACZ;AAEA,MAAMC,OAAO;IACT,MAAM,CAACC,MAAMC,QAAQ,GAAGC,SAAS;IACjC,MAAM,CAACC,OAAOC,SAAS,GAAGF,SAAuCG;IAEjE,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QAAC,SAAS;QAAW,MAAM;QAAc,SAAS,IAAML,QAAQ;sBACvE,oBAAC;QAAI,WAAW;OAAkBM,KAAK,SAAS,CAACJ,OAAO,MAAM,mBAC9D,oBAACN,aAAWA;QACR,MAAMG;QACN,SAAS,IAAMC,QAAQ;QACvB,OAAOH;QACP,OAAOK;QACP,QAAQC;;AAIxB;AAEO,MAAMI,UAAiB;IAC1B,QAAQ,kBAAM,oBAACT,
|
|
1
|
+
{"version":3,"file":"ImageEditor/ImageEditor.stories.js","sources":["../../src/ImageEditor/ImageEditor.stories.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { Button } from \"~/Button/index.js\";\nimport { ImageEditor, type ImageEditorValue } from \"./index.js\";\n\nconst meta: Meta<typeof ImageEditor> = {\n title: \"Components/ImageEditor\",\n component: ImageEditor,\n parameters: {\n layout: \"fullscreen\"\n }\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof ImageEditor>;\n\nconst DemoImage = {\n src: \"https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1600\",\n width: 1600,\n height: 1067\n};\n\nconst Demo = () => {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState<ImageEditorValue | undefined>(undefined);\n\n return (\n <div className={\"p-lg\"}>\n <Button variant={\"primary\"} text={\"Edit image\"} onClick={() => setOpen(true)} />\n <pre className={\"mt-md text-sm\"}>{JSON.stringify(value, null, 2)}</pre>\n <ImageEditor\n open={open}\n onClose={() => setOpen(false)}\n image={DemoImage}\n value={value}\n onSave={setValue}\n />\n </div>\n );\n};\n\nexport const Default: Story = {\n render: () => <Demo />\n};\n"],"names":["meta","ImageEditor","DemoImage","Demo","open","setOpen","useState","value","setValue","undefined","Button","JSON","Default"],"mappings":";;;AAKA,MAAMA,OAAiC;IACnC,OAAO;IACP,WAAWC;IACX,YAAY;QACR,QAAQ;IACZ;AACJ;AAEA,4BAAeD;AAIf,MAAME,YAAY;IACd,KAAK;IACL,OAAO;IACP,QAAQ;AACZ;AAEA,MAAMC,OAAO;IACT,MAAM,CAACC,MAAMC,QAAQ,GAAGC,SAAS;IACjC,MAAM,CAACC,OAAOC,SAAS,GAAGF,SAAuCG;IAEjE,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACC,QAAMA;QAAC,SAAS;QAAW,MAAM;QAAc,SAAS,IAAML,QAAQ;sBACvE,oBAAC;QAAI,WAAW;OAAkBM,KAAK,SAAS,CAACJ,OAAO,MAAM,mBAC9D,oBAACN,aAAWA;QACR,MAAMG;QACN,SAAS,IAAMC,QAAQ;QACvB,OAAOH;QACP,OAAOK;QACP,QAAQC;;AAIxB;AAEO,MAAMI,UAAiB;IAC1B,QAAQ,kBAAM,oBAACT,MAAAA;AACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input/InputPrimitive.js","sources":["../../src/Input/InputPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Icon as BaseIcon } from \"~/Icon/index.js\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\ninterface InputIconProps extends React.HTMLAttributes<HTMLDivElement> {\n icon: React.ReactElement;\n inputSize?: VariantProps<typeof inputVariants>[\"size\"];\n}\n\nconst InputIcon = ({ icon, inputSize, className }: InputIconProps) => {\n return (\n <div className={cn(\"fill-inherit\", className)}>\n {React.cloneElement(icon, {\n ...icon.props,\n size: inputSize === \"xl\" ? \"lg\" : \"sm\" // Map icon size based on the input size.\n })}\n </div>\n );\n};\n\n/**\n * Input\n *\n * We support both `disabled` and `data-disabled` as well as `focused` and `data-focused` variants\n * because these variants can be used by both input and div elements. The last one is used by `MultiAutocomplete` component,\n * where the `inputVariants` is used to style a div that wraps multiple elements (input, Tags, icons, etc.)\n */\nconst inputVariants = cva(\n [\n \"relative flex items-center gap-sm w-full\",\n \"border-sm text-md\",\n \"has-disabled:cursor-not-allowed data-[disabled=true]:cursor-not-allowed\"\n ],\n {\n variants: {\n size: {\n md: [\n \"rounded-md\",\n \"py-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n lg: [\n \"rounded-md\",\n \"py-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n xl: [\n \"rounded-lg leading-6\",\n \"py-[calc(var(--padding-md)-(var(--border-width-sm)))] px-[calc(var(--padding-md)-(var(--border-width-sm)))]\"\n ]\n },\n variant: {\n primary: [\n \"bg-neutral-base border-neutral-muted text-neutral-strong placeholder:text-neutral-dimmed fill-neutral-xstrong\",\n \"hover:border-neutral-strong\",\n \"focus-within:border-neutral-black!\",\n \"data-[focused=true]:border-neutral-black!\",\n \"has-disabled:bg-neutral-disabled has-disabled:border-neutral-muted has-disabled:hover:border-neutral-muted has-disabled:text-neutral-disabled has-disabled:placeholder:text-neutral-disabled has-disabled:fill-neutral-disabled\",\n \"data-[disabled=true]:bg-neutral-disabled data-[disabled=true]:border-neutral-muted data-[disabled=true]:text-neutral-disabled data-[disabled=true]:placeholder:text-neutral-disabled data-[disabled=true]:fill-neutral-disabled\"\n ],\n secondary: [\n \"bg-neutral-light border-neutral-subtle text-neutral-strong placeholder:text-neutral-dimmed fill-neutral-xstrong\",\n \"hover:bg-neutral-dimmed\",\n \"focus-within:bg-neutral-base! focus-within:border-neutral-black!\",\n \"data-[focused=true]:bg-neutral-base! data-[focused=true]:border-neutral-black!\",\n \"has-disabled:bg-neutral-disabled has-disabled:text-neutral-disabled has-disabled:placeholder:text-neutral-disabled has-disabled:fill-neutral-disabled\",\n \"data-[disabled=true]:bg-neutral-disabled data-[disabled=true]:text-neutral-disabled data-[disabled=true]:placeholder:text-neutral-disabled data-[disabled=true]:fill-neutral-disabled\"\n ],\n ghost: [\n \"bg-transparent border-transparent text-neutral-strong placeholder:text-neutral-dimmed\",\n \"hover:bg-neutral-dark/5\",\n \"focus-within:bg-neutral-dark/5!\",\n \"data-[focused=true]:bg-neutral-dark/5!\",\n \"has-disabled:bg-transparent has-disabled:text-neutral-disabled has-disabled:placeholder:text-neutral-disabled has-disabled:fill-neutral-disabled\",\n \"data-[disabled=true]:bg-transparent data-[disabled=true]:text-neutral-disabled data-[disabled=true]:placeholder:text-neutral-disabled data-[disabled=true]:fill-neutral-disabled\"\n ],\n \"ghost-negative\": [\n \"bg-transparent border-transparent text-neutral-light/50 placeholder:text-neutral-light/50 fill-neutral-base/50\",\n \"hover:bg-neutral-base/20\",\n \"focus-within:bg-neutral-base! focus-within:text-neutral-primary! focus-within:!placeholder:text-neutral-dimmed focus-within:fill-neutral-xstrong!\",\n \"data-[focused=true]:bg-neutral-base! data-[focused=true]:text-neutral-primary! data-[focused=true]:!placeholder:text-neutral-dimmed data-[focused=true]:fill-neutral-xstrong!\",\n \"has-disabled:bg-transparent has-disabled:text-neutral-disabled/50 has-disabled:placeholder:text-neutral-disabled/50\",\n \"data-[disabled=true]:bg-transparent data-[disabled=true]:text-neutral-disabled/50 data-[disabled=true]:placeholder:text-neutral-disabled/50\"\n ]\n },\n invalid: {\n true: \"\"\n }\n },\n compoundVariants: [\n // Add specific classNames in case of invalid inputs: note the difference between the ghost and the other variants.\n {\n variant: \"primary\",\n invalid: true,\n class: \"border-destructive-default!\"\n },\n {\n variant: \"secondary\",\n invalid: true,\n class: \"border-destructive-default!\"\n },\n {\n variant: \"ghost\",\n invalid: true,\n class: \"border-destructive-subtle! bg-destructive-subtle!\"\n },\n {\n variant: \"ghost-negative\",\n invalid: true,\n class: \"border-destructive-default! bg-destructive-subtle! text-neutral-primary placeholder:text-neutral-dimmed fill-neutral-xstrong!\"\n }\n ],\n defaultVariants: {\n size: \"lg\",\n variant: \"primary\"\n }\n }\n);\n\ntype InputPrimitiveProps<TValue = any> = Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"size\" | \"onChange\"\n> &\n VariantProps<typeof inputVariants> & {\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof BaseIcon> | React.ReactElement;\n /**\n * Icon to be displayed at the end of the input field.\n */\n endIcon?: React.ReactElement<typeof BaseIcon> | React.ReactElement;\n /**\n * Maximum length of the input field.\n */\n maxLength?: React.InputHTMLAttributes<HTMLInputElement>[\"size\"];\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * If true, it will pass the native `event` to the `onChange` callback\n */\n forwardEventOnChange?: boolean;\n /**\n * Callback function to be called when the Enter key is pressed.\n */\n onEnter?: InputPrimitiveProps[\"onKeyDown\"];\n /**\n * Callback function to be called when the Esc key is pressed.\n */\n onEscape?: InputPrimitiveProps[\"onKeyDown\"];\n /**\n * A callback that is executed each time a value is changed.\n */\n onChange?: (value: TValue) => void;\n /**\n * If true, will select the value in the input on focus.\n */\n autoSelect?: boolean;\n };\n\nconst DecoratableInputPrimitive = ({\n autoSelect,\n className,\n disabled,\n endIcon,\n forwardEventOnChange,\n inputRef,\n invalid,\n maxLength,\n onChange: originalOnChange,\n onEnter,\n onEscape,\n onKeyDown: originalOnKeyDown,\n onFocus: originalOnFocus,\n size,\n startIcon,\n value,\n variant,\n ...props\n}: InputPrimitiveProps) => {\n const onChange = React.useCallback(\n (event: React.SyntheticEvent<HTMLInputElement>) => {\n if (!originalOnChange) {\n return;\n }\n\n // @ts-expect-error\n originalOnChange(forwardEventOnChange ? event : event.target.value);\n },\n [forwardEventOnChange, originalOnChange]\n );\n\n const onKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (typeof onEnter === \"function\" && e.key === \"Enter\") {\n onEnter(e);\n }\n\n if (typeof onEscape === \"function\" && e.key === \"Escape\") {\n onEscape(e);\n }\n\n if (typeof originalOnKeyDown === \"function\") {\n return originalOnKeyDown(e);\n }\n },\n [originalOnKeyDown, onEnter]\n );\n\n const onFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (originalOnFocus) {\n originalOnFocus(e);\n }\n\n if (autoSelect) {\n e.target.select();\n }\n },\n [originalOnFocus, autoSelect]\n );\n\n return (\n <div className={cn(inputVariants({ variant, size, invalid }), className)}>\n {startIcon && <InputIcon icon={startIcon} />}\n <input\n {...props}\n ref={inputRef}\n className={cn([\n \"w-full bg-transparent border-none text-md peer\",\n \"focus-visible:outline-none\",\n \"disabled:cursor-not-allowed\",\n \"file:text-sm file:font-semibold\"\n ])}\n disabled={disabled}\n size={maxLength}\n onChange={onChange}\n onKeyDown={onKeyDown}\n value={value ?? \"\"}\n onFocus={onFocus}\n />\n {endIcon && <InputIcon icon={endIcon} />}\n </div>\n );\n};\n\nconst InputPrimitive = makeDecoratable(\"InputPrimitive\", DecoratableInputPrimitive);\n\nexport { InputIcon, InputPrimitive, inputVariants, type InputIconProps, type InputPrimitiveProps };\n"],"names":["InputIcon","icon","inputSize","className","cn","React","inputVariants","cva","DecoratableInputPrimitive","autoSelect","disabled","endIcon","forwardEventOnChange","inputRef","invalid","maxLength","originalOnChange","onEnter","onEscape","originalOnKeyDown","originalOnFocus","size","startIcon","value","variant","props","onChange","event","onKeyDown","e","onFocus","InputPrimitive","makeDecoratable"],"mappings":";;AASA,MAAMA,YAAY,CAAC,EAAEC,IAAI,EAAEC,SAAS,EAAEC,SAAS,EAAkB,GACtD,WAAP,GACI,sCAAC;QAAI,WAAWC,GAAG,gBAAgBD;qBAC9BE,wBAAAA,YAAkB,CAACJ,MAAM;QACtB,GAAGA,KAAK,KAAK;QACb,MAAMC,AAAc,SAAdA,YAAqB,OAAO;IACtC;AAYZ,MAAMI,gBAAgBC,IAClB;IACI;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,MAAM;YACF,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;QACL;QACA,SAAS;YACL,SAAS;gBACL;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,WAAW;gBACP;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,kBAAkB;gBACd;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;QACL;QACA,SAAS;YACL,MAAM;QACV;IACJ;IACA,kBAAkB;QAEd;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;QACA;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;QACA;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;QACA;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;KACH;IACD,iBAAiB;QACb,MAAM;QACN,SAAS;IACb;AACJ;AA8CJ,MAAMC,4BAA4B,CAAC,EAC/BC,UAAU,EACVN,SAAS,EACTO,Q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AAGzC;AAEA,MAAMoB,iBAAiBC,gBAAgB,kBAAkBxB"}
|
|
1
|
+
{"version":3,"file":"Input/InputPrimitive.js","sources":["../../src/Input/InputPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Icon as BaseIcon } from \"~/Icon/index.js\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\ninterface InputIconProps extends React.HTMLAttributes<HTMLDivElement> {\n icon: React.ReactElement;\n inputSize?: VariantProps<typeof inputVariants>[\"size\"];\n}\n\nconst InputIcon = ({ icon, inputSize, className }: InputIconProps) => {\n return (\n <div className={cn(\"fill-inherit\", className)}>\n {React.cloneElement(icon, {\n ...icon.props,\n size: inputSize === \"xl\" ? \"lg\" : \"sm\" // Map icon size based on the input size.\n })}\n </div>\n );\n};\n\n/**\n * Input\n *\n * We support both `disabled` and `data-disabled` as well as `focused` and `data-focused` variants\n * because these variants can be used by both input and div elements. The last one is used by `MultiAutocomplete` component,\n * where the `inputVariants` is used to style a div that wraps multiple elements (input, Tags, icons, etc.)\n */\nconst inputVariants = cva(\n [\n \"relative flex items-center gap-sm w-full\",\n \"border-sm text-md\",\n \"has-disabled:cursor-not-allowed data-[disabled=true]:cursor-not-allowed\"\n ],\n {\n variants: {\n size: {\n md: [\n \"rounded-md\",\n \"py-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n lg: [\n \"rounded-md\",\n \"py-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n xl: [\n \"rounded-lg leading-6\",\n \"py-[calc(var(--padding-md)-(var(--border-width-sm)))] px-[calc(var(--padding-md)-(var(--border-width-sm)))]\"\n ]\n },\n variant: {\n primary: [\n \"bg-neutral-base border-neutral-muted text-neutral-strong placeholder:text-neutral-dimmed fill-neutral-xstrong\",\n \"hover:border-neutral-strong\",\n \"focus-within:border-neutral-black!\",\n \"data-[focused=true]:border-neutral-black!\",\n \"has-disabled:bg-neutral-disabled has-disabled:border-neutral-muted has-disabled:hover:border-neutral-muted has-disabled:text-neutral-disabled has-disabled:placeholder:text-neutral-disabled has-disabled:fill-neutral-disabled\",\n \"data-[disabled=true]:bg-neutral-disabled data-[disabled=true]:border-neutral-muted data-[disabled=true]:text-neutral-disabled data-[disabled=true]:placeholder:text-neutral-disabled data-[disabled=true]:fill-neutral-disabled\"\n ],\n secondary: [\n \"bg-neutral-light border-neutral-subtle text-neutral-strong placeholder:text-neutral-dimmed fill-neutral-xstrong\",\n \"hover:bg-neutral-dimmed\",\n \"focus-within:bg-neutral-base! focus-within:border-neutral-black!\",\n \"data-[focused=true]:bg-neutral-base! data-[focused=true]:border-neutral-black!\",\n \"has-disabled:bg-neutral-disabled has-disabled:text-neutral-disabled has-disabled:placeholder:text-neutral-disabled has-disabled:fill-neutral-disabled\",\n \"data-[disabled=true]:bg-neutral-disabled data-[disabled=true]:text-neutral-disabled data-[disabled=true]:placeholder:text-neutral-disabled data-[disabled=true]:fill-neutral-disabled\"\n ],\n ghost: [\n \"bg-transparent border-transparent text-neutral-strong placeholder:text-neutral-dimmed\",\n \"hover:bg-neutral-dark/5\",\n \"focus-within:bg-neutral-dark/5!\",\n \"data-[focused=true]:bg-neutral-dark/5!\",\n \"has-disabled:bg-transparent has-disabled:text-neutral-disabled has-disabled:placeholder:text-neutral-disabled has-disabled:fill-neutral-disabled\",\n \"data-[disabled=true]:bg-transparent data-[disabled=true]:text-neutral-disabled data-[disabled=true]:placeholder:text-neutral-disabled data-[disabled=true]:fill-neutral-disabled\"\n ],\n \"ghost-negative\": [\n \"bg-transparent border-transparent text-neutral-light/50 placeholder:text-neutral-light/50 fill-neutral-base/50\",\n \"hover:bg-neutral-base/20\",\n \"focus-within:bg-neutral-base! focus-within:text-neutral-primary! focus-within:!placeholder:text-neutral-dimmed focus-within:fill-neutral-xstrong!\",\n \"data-[focused=true]:bg-neutral-base! data-[focused=true]:text-neutral-primary! data-[focused=true]:!placeholder:text-neutral-dimmed data-[focused=true]:fill-neutral-xstrong!\",\n \"has-disabled:bg-transparent has-disabled:text-neutral-disabled/50 has-disabled:placeholder:text-neutral-disabled/50\",\n \"data-[disabled=true]:bg-transparent data-[disabled=true]:text-neutral-disabled/50 data-[disabled=true]:placeholder:text-neutral-disabled/50\"\n ]\n },\n invalid: {\n true: \"\"\n }\n },\n compoundVariants: [\n // Add specific classNames in case of invalid inputs: note the difference between the ghost and the other variants.\n {\n variant: \"primary\",\n invalid: true,\n class: \"border-destructive-default!\"\n },\n {\n variant: \"secondary\",\n invalid: true,\n class: \"border-destructive-default!\"\n },\n {\n variant: \"ghost\",\n invalid: true,\n class: \"border-destructive-subtle! bg-destructive-subtle!\"\n },\n {\n variant: \"ghost-negative\",\n invalid: true,\n class: \"border-destructive-default! bg-destructive-subtle! text-neutral-primary placeholder:text-neutral-dimmed fill-neutral-xstrong!\"\n }\n ],\n defaultVariants: {\n size: \"lg\",\n variant: \"primary\"\n }\n }\n);\n\ntype InputPrimitiveProps<TValue = any> = Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"size\" | \"onChange\"\n> &\n VariantProps<typeof inputVariants> & {\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof BaseIcon> | React.ReactElement;\n /**\n * Icon to be displayed at the end of the input field.\n */\n endIcon?: React.ReactElement<typeof BaseIcon> | React.ReactElement;\n /**\n * Maximum length of the input field.\n */\n maxLength?: React.InputHTMLAttributes<HTMLInputElement>[\"size\"];\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * If true, it will pass the native `event` to the `onChange` callback\n */\n forwardEventOnChange?: boolean;\n /**\n * Callback function to be called when the Enter key is pressed.\n */\n onEnter?: InputPrimitiveProps[\"onKeyDown\"];\n /**\n * Callback function to be called when the Esc key is pressed.\n */\n onEscape?: InputPrimitiveProps[\"onKeyDown\"];\n /**\n * A callback that is executed each time a value is changed.\n */\n onChange?: (value: TValue) => void;\n /**\n * If true, will select the value in the input on focus.\n */\n autoSelect?: boolean;\n };\n\nconst DecoratableInputPrimitive = ({\n autoSelect,\n className,\n disabled,\n endIcon,\n forwardEventOnChange,\n inputRef,\n invalid,\n maxLength,\n onChange: originalOnChange,\n onEnter,\n onEscape,\n onKeyDown: originalOnKeyDown,\n onFocus: originalOnFocus,\n size,\n startIcon,\n value,\n variant,\n ...props\n}: InputPrimitiveProps) => {\n const onChange = React.useCallback(\n (event: React.SyntheticEvent<HTMLInputElement>) => {\n if (!originalOnChange) {\n return;\n }\n\n // @ts-expect-error\n originalOnChange(forwardEventOnChange ? event : event.target.value);\n },\n [forwardEventOnChange, originalOnChange]\n );\n\n const onKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (typeof onEnter === \"function\" && e.key === \"Enter\") {\n onEnter(e);\n }\n\n if (typeof onEscape === \"function\" && e.key === \"Escape\") {\n onEscape(e);\n }\n\n if (typeof originalOnKeyDown === \"function\") {\n return originalOnKeyDown(e);\n }\n },\n [originalOnKeyDown, onEnter]\n );\n\n const onFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (originalOnFocus) {\n originalOnFocus(e);\n }\n\n if (autoSelect) {\n e.target.select();\n }\n },\n [originalOnFocus, autoSelect]\n );\n\n return (\n <div className={cn(inputVariants({ variant, size, invalid }), className)}>\n {startIcon && <InputIcon icon={startIcon} />}\n <input\n {...props}\n ref={inputRef}\n className={cn([\n \"w-full bg-transparent border-none text-md peer\",\n \"focus-visible:outline-none\",\n \"disabled:cursor-not-allowed\",\n \"file:text-sm file:font-semibold\"\n ])}\n disabled={disabled}\n size={maxLength}\n onChange={onChange}\n onKeyDown={onKeyDown}\n value={value ?? \"\"}\n onFocus={onFocus}\n />\n {endIcon && <InputIcon icon={endIcon} />}\n </div>\n );\n};\n\nconst InputPrimitive = makeDecoratable(\"InputPrimitive\", DecoratableInputPrimitive);\n\nexport { InputIcon, InputPrimitive, inputVariants, type InputIconProps, type InputPrimitiveProps };\n"],"names":["InputIcon","icon","inputSize","className","cn","React","inputVariants","cva","DecoratableInputPrimitive","autoSelect","disabled","endIcon","forwardEventOnChange","inputRef","invalid","maxLength","originalOnChange","onEnter","onEscape","originalOnKeyDown","originalOnFocus","size","startIcon","value","variant","props","onChange","event","onKeyDown","e","onFocus","InputPrimitive","makeDecoratable"],"mappings":";;AASA,MAAMA,YAAY,CAAC,EAAEC,IAAI,EAAEC,SAAS,EAAEC,SAAS,EAAkB,GACtD,WAAP,GACI,sCAAC;QAAI,WAAWC,GAAG,gBAAgBD;qBAC9BE,wBAAAA,YAAkB,CAACJ,MAAM;QACtB,GAAGA,KAAK,KAAK;QACb,MAAMC,AAAc,SAAdA,YAAqB,OAAO;IACtC;AAYZ,MAAMI,gBAAgBC,IAClB;IACI;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,MAAM;YACF,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;QACL;QACA,SAAS;YACL,SAAS;gBACL;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,WAAW;gBACP;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,kBAAkB;gBACd;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;QACL;QACA,SAAS;YACL,MAAM;QACV;IACJ;IACA,kBAAkB;QAEd;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;QACA;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;QACA;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;QACA;YACI,SAAS;YACT,SAAS;YACT,OAAO;QACX;KACH;IACD,iBAAiB;QACb,MAAM;QACN,SAAS;IACb;AACJ;AA8CJ,MAAMC,4BAA4B,CAAC,EAC/BC,UAAU,EACVN,SAAS,EACTO,QAAQ,EACRC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AEA,MAAMoB,iBAAiBC,gBAAgB,kBAAkBxB"}
|
package/List/List.stories.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List/List.stories.js","sources":["../../src/List/List.stories.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as ChartIcon } from \"@webiny/icons/insert_chart.svg\";\nimport { ReactComponent as MoreIcon } from \"@webiny/icons/more_vert.svg\";\nimport { ReactComponent as OpenIcon } from \"@webiny/icons/visibility.svg\";\nimport { ReactComponent as EditIcon } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as TrashIcon } from \"@webiny/icons/delete.svg\";\nimport { ReactComponent as UserIcon } from \"@webiny/icons/person.svg\";\nimport { ReactComponent as SettingsIcon } from \"@webiny/icons/settings.svg\";\nimport { ReactComponent as HelpIcon } from \"@webiny/icons/help.svg\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { List, type ListItemProps as BaseListItemProps } from \"./List.js\";\nimport { Avatar } from \"~/Avatar/index.js\";\n\nconst meta: Meta<typeof List> = {\n title: \"Components/List\",\n component: List,\n parameters: {\n layout: \"padded\"\n }\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof List>;\n\ninterface ListItemProps extends Omit<BaseListItemProps, \"title\"> {\n index: number;\n}\n\nconst ListItem = (props: ListItemProps) => {\n return <List.Item title={`List item ${props.index}`} {...props} />;\n};\n\nexport const Default: Story = {\n args: {\n children: (\n <>\n <ListItem index={1} />\n <ListItem index={2} />\n <ListItem index={3} />\n </>\n )\n }\n};\n\nexport const WithTransparentBackground: Story = {\n args: {\n background: \"transparent\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n },\n decorators: [\n Story => (\n <div className=\"bg-neutral-light p-md\">\n <Story />\n </div>\n )\n ]\n};\n\nexport const WithBaseBackground: Story = {\n args: {\n ...Default.args,\n background: \"base\"\n }\n};\n\nexport const WithLightBackground: Story = {\n args: {\n background: \"light\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n }\n};\n\nexport const WithUnderlineVariant: Story = {\n args: {\n ...Default.args,\n variant: \"underline\"\n }\n};\n\nexport const WithContainerVariant: Story = {\n args: {\n variant: \"container\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n },\n decorators: [\n Story => (\n <div className=\"bg-neutral-light p-md\">\n <Story />\n </div>\n )\n ]\n};\n\nexport const WithDescription: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item title=\"Settings\" description=\"Configure application settings\" />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n }\n};\n\nexport const WithIcon: Story = {\n args: {\n children: (\n <>\n <List.Item icon={<UserIcon />} title=\"User Profile\" />\n <List.Item icon={<SettingsIcon />} title=\"Settings\" />\n <List.Item icon={<HelpIcon />} title=\"Help & Support\" />\n </>\n )\n }\n};\n\nexport const WithIconsAndDescriptions: Story = {\n args: {\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n }\n};\n\nexport const WithAvatar: Story = {\n args: {\n ...Default.args,\n children: (\n <>\n <ListItem\n index={1}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={\n <Avatar\n image={\n <Avatar.Image src=\"https://i.pravatar.cc/300?img=1\" alt=\"@webiny\" />\n }\n fallback={<Avatar.Fallback>W</Avatar.Fallback>}\n />\n }\n />\n <ListItem\n index={2}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={\n <Avatar\n image={\n <Avatar.Image src=\"https://i.pravatar.cc/300?img=2\" alt=\"@webiny\" />\n }\n fallback={<Avatar.Fallback>W</Avatar.Fallback>}\n />\n }\n />\n </>\n )\n }\n};\n\nexport const WithHandle: Story = {\n args: {\n ...Default.args,\n children: (\n <>\n <ListItem\n index={1}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n handle={<List.Item.Handle />}\n />\n <ListItem\n index={2}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n handle={<List.Item.Handle />}\n />\n </>\n )\n }\n};\n\nexport const WithActions: Story = {\n ...Default,\n args: {\n children: (\n <>\n <ListItem\n index={1}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={<List.Item.Icon icon={<ChartIcon />} label={\"Chart\"} />}\n actions={\n <>\n <List.Item.Action icon={<EditIcon />} />\n <List.Item.Action icon={<TrashIcon />} />\n <List.Item.Action.Separator />\n <List.Item.Action icon={<OpenIcon />} />\n <List.Item.Action icon={<MoreIcon />} />\n </>\n }\n />\n <ListItem\n index={2}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={<List.Item.Icon icon={<ChartIcon />} label={\"Chart\"} />}\n actions={\n <>\n <List.Item.Action icon={<EditIcon />} />\n <List.Item.Action icon={<TrashIcon />} />\n <List.Item.Action.Separator />\n <List.Item.Action icon={<OpenIcon />} />\n <List.Item.Action icon={<MoreIcon />} />\n </>\n }\n />\n </>\n )\n }\n};\n\nexport const WithDisabled: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n onClick={() => alert(\"User Profile clicked\")}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n disabled={true}\n onClick={() => alert(\"This alert won't show because the item is disabled\")}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => alert(\"Help & Support clicked\")}\n />\n </>\n )\n }\n};\n\nexport const WithActivated: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n activated={true}\n onClick={() => console.log(\"User Profile clicked\")}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n onClick={() => console.log(\"Settings clicked\")}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => console.log(\"Help & Support clicked\")}\n />\n </>\n )\n }\n};\n\nexport const WithClickHandlers: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n onClick={() => alert(\"User Profile clicked\")}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n onClick={() => alert(\"Settings clicked\")}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => alert(\"Help & Support clicked\")}\n />\n </>\n )\n }\n};\n\nexport const WithSelectedItem: Story = {\n render: () => {\n // Using render function to handle state\n const [selectedIndex, setSelectedIndex] = React.useState(0);\n\n return (\n <List>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n selected={selectedIndex === 0}\n onClick={() => setSelectedIndex(0)}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n selected={selectedIndex === 1}\n onClick={() => setSelectedIndex(1)}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n selected={selectedIndex === 2}\n onClick={() => setSelectedIndex(2)}\n />\n </List>\n );\n }\n};\n\nexport const Documentation: Story = {\n args: {\n variant: \"underline\",\n background: \"base\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n onClick={() => console.log(\"User Profile clicked\")}\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n onClick={() => console.log(\"Settings clicked\")}\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => console.log(\"Help & Support clicked\")}\n />\n </>\n )\n },\n argTypes: {\n variant: {\n control: \"select\",\n options: [\"underline\", \"container\"],\n description: \"The visual style of the list\"\n },\n background: {\n control: \"select\",\n options: [\"base\", \"light\", \"transparent\"],\n description: \"The background color of the list\"\n },\n children: {\n description: \"The content of the list. Please refer to the example code for details.\"\n }\n },\n parameters: {\n docs: {\n description: {\n story: \"This example shows a List with icons, titles, descriptions, and click handlers.\"\n }\n }\n }\n};\n"],"names":["meta","List","ListItem","props","Default","WithTransparentBackground","UserIcon","SettingsIcon","HelpIcon","Story","WithBaseBackground","WithLightBackground","WithUnderlineVariant","WithContainerVariant","WithDescription","WithIcon","WithIconsAndDescriptions","WithAvatar","Avatar","WithHandle","WithActions","ChartIcon","EditIcon","TrashIcon","OpenIcon","MoreIcon","WithDisabled","alert","WithActivated","console","WithClickHandlers","WithSelectedItem","selectedIndex","setSelectedIndex","React","Documentation"],"mappings":";;;;;;;;;;;AAaA,MAAMA,OAA0B;IAC5B,OAAO;IACP,WAAWC;IACX,YAAY;QACR,QAAQ;IACZ;AACJ;AAEA,qBAAeD;AAQf,MAAME,WAAW,CAACC,QACP,WAAP,GAAO,oBAACF,KAAK,IAAI;QAAC,OAAO,CAAC,UAAU,EAAEE,MAAM,KAAK,EAAE;QAAG,GAAGA,KAAK;;AAG3D,MAAMC,U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":3,"file":"List/List.stories.js","sources":["../../src/List/List.stories.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as ChartIcon } from \"@webiny/icons/insert_chart.svg\";\nimport { ReactComponent as MoreIcon } from \"@webiny/icons/more_vert.svg\";\nimport { ReactComponent as OpenIcon } from \"@webiny/icons/visibility.svg\";\nimport { ReactComponent as EditIcon } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as TrashIcon } from \"@webiny/icons/delete.svg\";\nimport { ReactComponent as UserIcon } from \"@webiny/icons/person.svg\";\nimport { ReactComponent as SettingsIcon } from \"@webiny/icons/settings.svg\";\nimport { ReactComponent as HelpIcon } from \"@webiny/icons/help.svg\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { List, type ListItemProps as BaseListItemProps } from \"./List.js\";\nimport { Avatar } from \"~/Avatar/index.js\";\n\nconst meta: Meta<typeof List> = {\n title: \"Components/List\",\n component: List,\n parameters: {\n layout: \"padded\"\n }\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof List>;\n\ninterface ListItemProps extends Omit<BaseListItemProps, \"title\"> {\n index: number;\n}\n\nconst ListItem = (props: ListItemProps) => {\n return <List.Item title={`List item ${props.index}`} {...props} />;\n};\n\nexport const Default: Story = {\n args: {\n children: (\n <>\n <ListItem index={1} />\n <ListItem index={2} />\n <ListItem index={3} />\n </>\n )\n }\n};\n\nexport const WithTransparentBackground: Story = {\n args: {\n background: \"transparent\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n },\n decorators: [\n Story => (\n <div className=\"bg-neutral-light p-md\">\n <Story />\n </div>\n )\n ]\n};\n\nexport const WithBaseBackground: Story = {\n args: {\n ...Default.args,\n background: \"base\"\n }\n};\n\nexport const WithLightBackground: Story = {\n args: {\n background: \"light\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n }\n};\n\nexport const WithUnderlineVariant: Story = {\n args: {\n ...Default.args,\n variant: \"underline\"\n }\n};\n\nexport const WithContainerVariant: Story = {\n args: {\n variant: \"container\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n },\n decorators: [\n Story => (\n <div className=\"bg-neutral-light p-md\">\n <Story />\n </div>\n )\n ]\n};\n\nexport const WithDescription: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item title=\"Settings\" description=\"Configure application settings\" />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n }\n};\n\nexport const WithIcon: Story = {\n args: {\n children: (\n <>\n <List.Item icon={<UserIcon />} title=\"User Profile\" />\n <List.Item icon={<SettingsIcon />} title=\"Settings\" />\n <List.Item icon={<HelpIcon />} title=\"Help & Support\" />\n </>\n )\n }\n};\n\nexport const WithIconsAndDescriptions: Story = {\n args: {\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n />\n </>\n )\n }\n};\n\nexport const WithAvatar: Story = {\n args: {\n ...Default.args,\n children: (\n <>\n <ListItem\n index={1}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={\n <Avatar\n image={\n <Avatar.Image src=\"https://i.pravatar.cc/300?img=1\" alt=\"@webiny\" />\n }\n fallback={<Avatar.Fallback>W</Avatar.Fallback>}\n />\n }\n />\n <ListItem\n index={2}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={\n <Avatar\n image={\n <Avatar.Image src=\"https://i.pravatar.cc/300?img=2\" alt=\"@webiny\" />\n }\n fallback={<Avatar.Fallback>W</Avatar.Fallback>}\n />\n }\n />\n </>\n )\n }\n};\n\nexport const WithHandle: Story = {\n args: {\n ...Default.args,\n children: (\n <>\n <ListItem\n index={1}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n handle={<List.Item.Handle />}\n />\n <ListItem\n index={2}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n handle={<List.Item.Handle />}\n />\n </>\n )\n }\n};\n\nexport const WithActions: Story = {\n ...Default,\n args: {\n children: (\n <>\n <ListItem\n index={1}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={<List.Item.Icon icon={<ChartIcon />} label={\"Chart\"} />}\n actions={\n <>\n <List.Item.Action icon={<EditIcon />} />\n <List.Item.Action icon={<TrashIcon />} />\n <List.Item.Action.Separator />\n <List.Item.Action icon={<OpenIcon />} />\n <List.Item.Action icon={<MoreIcon />} />\n </>\n }\n />\n <ListItem\n index={2}\n description=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n icon={<List.Item.Icon icon={<ChartIcon />} label={\"Chart\"} />}\n actions={\n <>\n <List.Item.Action icon={<EditIcon />} />\n <List.Item.Action icon={<TrashIcon />} />\n <List.Item.Action.Separator />\n <List.Item.Action icon={<OpenIcon />} />\n <List.Item.Action icon={<MoreIcon />} />\n </>\n }\n />\n </>\n )\n }\n};\n\nexport const WithDisabled: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n onClick={() => alert(\"User Profile clicked\")}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n disabled={true}\n onClick={() => alert(\"This alert won't show because the item is disabled\")}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => alert(\"Help & Support clicked\")}\n />\n </>\n )\n }\n};\n\nexport const WithActivated: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n activated={true}\n onClick={() => console.log(\"User Profile clicked\")}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n onClick={() => console.log(\"Settings clicked\")}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => console.log(\"Help & Support clicked\")}\n />\n </>\n )\n }\n};\n\nexport const WithClickHandlers: Story = {\n args: {\n children: (\n <>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n onClick={() => alert(\"User Profile clicked\")}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n onClick={() => alert(\"Settings clicked\")}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => alert(\"Help & Support clicked\")}\n />\n </>\n )\n }\n};\n\nexport const WithSelectedItem: Story = {\n render: () => {\n // Using render function to handle state\n const [selectedIndex, setSelectedIndex] = React.useState(0);\n\n return (\n <List>\n <List.Item\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n selected={selectedIndex === 0}\n onClick={() => setSelectedIndex(0)}\n />\n <List.Item\n title=\"Settings\"\n description=\"Configure application settings\"\n selected={selectedIndex === 1}\n onClick={() => setSelectedIndex(1)}\n />\n <List.Item\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n selected={selectedIndex === 2}\n onClick={() => setSelectedIndex(2)}\n />\n </List>\n );\n }\n};\n\nexport const Documentation: Story = {\n args: {\n variant: \"underline\",\n background: \"base\",\n children: (\n <>\n <List.Item\n icon={<UserIcon />}\n title=\"User Profile\"\n description=\"View and edit your profile information\"\n onClick={() => console.log(\"User Profile clicked\")}\n />\n <List.Item\n icon={<SettingsIcon />}\n title=\"Settings\"\n description=\"Configure application settings\"\n onClick={() => console.log(\"Settings clicked\")}\n />\n <List.Item\n icon={<HelpIcon />}\n title=\"Help & Support\"\n description=\"Get assistance and view documentation\"\n onClick={() => console.log(\"Help & Support clicked\")}\n />\n </>\n )\n },\n argTypes: {\n variant: {\n control: \"select\",\n options: [\"underline\", \"container\"],\n description: \"The visual style of the list\"\n },\n background: {\n control: \"select\",\n options: [\"base\", \"light\", \"transparent\"],\n description: \"The background color of the list\"\n },\n children: {\n description: \"The content of the list. Please refer to the example code for details.\"\n }\n },\n parameters: {\n docs: {\n description: {\n story: \"This example shows a List with icons, titles, descriptions, and click handlers.\"\n }\n }\n }\n};\n"],"names":["meta","List","ListItem","props","Default","WithTransparentBackground","UserIcon","SettingsIcon","HelpIcon","Story","WithBaseBackground","WithLightBackground","WithUnderlineVariant","WithContainerVariant","WithDescription","WithIcon","WithIconsAndDescriptions","WithAvatar","Avatar","WithHandle","WithActions","ChartIcon","EditIcon","TrashIcon","OpenIcon","MoreIcon","WithDisabled","alert","WithActivated","console","WithClickHandlers","WithSelectedItem","selectedIndex","setSelectedIndex","React","Documentation"],"mappings":";;;;;;;;;;;AAaA,MAAMA,OAA0B;IAC5B,OAAO;IACP,WAAWC;IACX,YAAY;QACR,QAAQ;IACZ;AACJ;AAEA,qBAAeD;AAQf,MAAME,WAAW,CAACC,QACP,WAAP,GAAO,oBAACF,KAAK,IAAI;QAAC,OAAO,CAAC,UAAU,EAAEE,MAAM,KAAK,EAAE;QAAG,GAAGA,KAAK;;AAG3D,MAAMC,UAAiB;IAC1B,MAAM;QACF,UAAU,WAAV,GACI,wDACI,oBAACF,UAAAA;YAAS,OAAO;0BACjB,oBAACA,UAAAA;YAAS,OAA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C,MAAAA,QAAc,CAAC;QAEzD,OAAO,WAAP,GACI,oBAACjC,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,IAAI;YACN,OAAM;YACN,aAAY;YACZ,UAAU+B,AAAkB,MAAlBA;YACV,SAAS,IAAMC,iBAAiB;0BAEpC,oBAAChC,KAAK,IAAI;YACN,OAAM;YACN,aAAY;YACZ,UAAU+B,AAAkB,MAAlBA;YACV,SAAS,IAAMC,iBAAiB;0BAEpC,oBAAChC,KAAK,IAAI;YACN,OAAM;YACN,aAAY;YACZ,UAAU+B,AAAkB,MAAlBA;YACV,SAAS,IAAMC,iBAAiB;;IAIhD;AACJ;AAEO,MAAME,gBAAuB;IAChC,MAAM;QACF,SAAS;QACT,YAAY;QACZ,UAAU,WAAV,GACI,wDACI,oBAAClC,KAAK,IAAI;YACN,oBAAM,oBAACK,2BAAQA;YACf,OAAM;YACN,aAAY;YACZ,SAAS,IAAMuB,QAAQ,GAAG,CAAC;0BAE/B,oBAAC5B,KAAK,IAAI;YACN,oBAAM,oBAACM,6BAAYA;YACnB,OAAM;YACN,aAAY;YACZ,SAAS,IAAMsB,QAAQ,GAAG,CAAC;0BAE/B,oBAAC5B,KAAK,IAAI;YACN,oBAAM,oBAACO,yBAAQA;YACf,OAAM;YACN,aAAY;YACZ,SAAS,IAAMqB,QAAQ,GAAG,CAAC;;IAI3C;IACA,UAAU;QACN,SAAS;YACL,SAAS;YACT,SAAS;gBAAC;gBAAa;aAAY;YACnC,aAAa;QACjB;QACA,YAAY;YACR,SAAS;YACT,SAAS;gBAAC;gBAAQ;gBAAS;aAAc;YACzC,aAAa;QACjB;QACA,UAAU;YACN,aAAa;QACjB;IACJ;IACA,YAAY;QACR,MAAM;YACF,aAAa;gBACT,OAAO;YACX;QACJ;IACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect/primitives/MultiSelectPrimitive.js","sources":["../../../src/MultiSelect/primitives/MultiSelectPrimitive.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { Popover } from \"radix-ui\";\nimport { ReactComponent as ChevronDown } from \"@webiny/icons/keyboard_arrow_down.svg\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { cn, makeDecoratable, type VariantProps } from \"~/utils.js\";\nimport { CheckboxPrimitiveRenderer } from \"~/Checkbox/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { selectTriggerVariants } from \"~/Select/primitives/components/index.js\";\nimport { ScrollArea } from \"~/ScrollArea/index.js\";\nimport { useEscapeScrollLock } from \"~/hooks/index.js\";\n\ninterface MultiSelectOptionDto {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\ninterface MultiSelectPrimitiveProps {\n options?: MultiSelectOptionDto[];\n value?: string[];\n onChange?: (values: string[]) => void;\n onValueReset?: () => void;\n placeholder?: string;\n disabled?: boolean;\n invalid?: boolean;\n displayResetAction?: boolean;\n /**\n * When `true`, shows \"{count} items selected\" in the trigger instead of the full\n * comma-separated label list.\n */\n showSelectionCount?: boolean;\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n}\n\n/**\n * MultiSelect Trigger\n */\ninterface MultiSelectTriggerProps {\n displayValue: string;\n hasValue: boolean;\n placeholder: string;\n displayResetAction: boolean;\n disabled?: boolean;\n invalid?: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n onValueReset: () => void;\n}\n\nconst MultiSelectTrigger = ({\n displayValue,\n hasValue,\n placeholder,\n displayResetAction,\n disabled,\n invalid,\n size,\n variant,\n onValueReset\n}: MultiSelectTriggerProps) => {\n const resetButton = useMemo(() => {\n if (!hasValue || !displayResetAction) {\n return undefined;\n }\n return (\n <IconButton\n onPointerDown={event => {\n event.stopPropagation();\n onValueReset();\n }}\n icon={\n <span>\n <Icon\n icon={<Close />}\n label={\"Reset\"}\n color={variant === \"ghost-negative\" ? \"neutral-negative\" : \"inherit\"}\n />\n </span>\n }\n size={\"xs\"}\n variant={variant === \"ghost-negative\" ? \"ghost-negative\" : \"secondary\"}\n disabled={disabled}\n asChild\n />\n );\n }, [hasValue, displayResetAction, onValueReset, variant, disabled]);\n\n return (\n <Popover.Trigger\n className={cn(selectTriggerVariants({ variant, size, invalid }))}\n disabled={disabled}\n >\n <div className={\"flex-1 text-left truncate\"}>\n {hasValue ? (\n displayValue\n ) : (\n <span className={\"text-neutral-disabled\"}>{placeholder}</span>\n )}\n </div>\n {resetButton}\n <span className={\"h-md w-md shrink-0 fill-neutral-xstrong\"}>\n <ChevronDown className={\"h-md w-md\"} />\n </span>\n </Popover.Trigger>\n );\n};\n\n/**\n * MultiSelect Content\n */\ninterface MultiSelectContentProps {\n options: MultiSelectOptionDto[];\n value: string[];\n onToggle: (value: string) => void;\n}\n\nconst MultiSelectContent = ({ options, value, onToggle }: MultiSelectContentProps) => {\n /*\n * This popover is built on the Radix primitive directly, so it needs the same scroll-lock\n * escape hatch that `PopoverPrimitive.Content` applies.\n */\n const contentRef = useEscapeScrollLock<HTMLDivElement>();\n\n return (\n <Popover.Portal>\n <Popover.Content\n ref={contentRef}\n className={cn(\n \"relative z-popover shadow-lg overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n \"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1\"\n )}\n style={{ width: \"var(--radix-popover-trigger-width)\" }}\n align={\"start\"}\n sideOffset={4}\n >\n {/*\n * The padding sits inside the scroller so the scrollbar runs the full height, and\n * the cap leaves room for the popover's border, so the whole dropdown fits in the\n * space Radix says is available.\n */}\n <ScrollArea\n viewportClassName={cn(\n \"py-sm\",\n \"max-h-[calc(min(250px,var(--radix-popover-content-available-height,250px))_-_2*var(--border-width-sm))]\"\n )}\n >\n {options.map(option => (\n <div\n key={option.value}\n className={cn(\n \"rounded-sm p-sm mx-sm cursor-pointer\",\n \"hover:bg-neutral-dimmed\",\n option.disabled && \"opacity-50 pointer-events-none\"\n )}\n onClick={() => onToggle(option.value)}\n >\n <div className={\"pointer-events-none\"}>\n <CheckboxPrimitiveRenderer\n id={option.value}\n label={option.label}\n value={option.value}\n checked={value.includes(option.value)}\n disabled={option.disabled ?? false}\n indeterminate={false}\n hasLabel={true}\n changeChecked={() => {}}\n />\n </div>\n </div>\n ))}\n </ScrollArea>\n </Popover.Content>\n </Popover.Portal>\n );\n};\n\n/**\n * MultiSelect Primitive\n */\nconst DecoratableMultiSelectPrimitive = ({\n options = [],\n value = [],\n onChange,\n onValueReset,\n placeholder = \"Select options\",\n disabled,\n invalid,\n displayResetAction = true,\n showSelectionCount,\n size,\n variant\n}: MultiSelectPrimitiveProps) => {\n const displayValue = useMemo(() => {\n if (value.length === 0) {\n return \"\";\n }\n if (showSelectionCount) {\n return `${value.length} items selected`;\n }\n const labelMap = new Map(options.map(o => [o.value, o.label]));\n return value.map(v => labelMap.get(v) ?? v).join(\", \");\n }, [value, options, showSelectionCount]);\n\n const toggle = useCallback(\n (optionValue: string) => {\n const next = value.includes(optionValue)\n ? value.filter(v => v !== optionValue)\n : [...value, optionValue];\n onChange?.(next);\n },\n [value, onChange]\n );\n\n const reset = useCallback(() => {\n onChange?.([]);\n onValueReset?.();\n }, [onChange, onValueReset]);\n\n return (\n <Popover.Root>\n <MultiSelectTrigger\n displayValue={displayValue}\n hasValue={value.length > 0}\n placeholder={placeholder}\n displayResetAction={displayResetAction}\n disabled={disabled}\n invalid={invalid}\n size={size}\n variant={variant}\n onValueReset={reset}\n />\n <MultiSelectContent options={options} value={value} onToggle={toggle} />\n </Popover.Root>\n );\n};\nconst MultiSelectPrimitive = makeDecoratable(\n \"MultiSelectPrimitive\",\n DecoratableMultiSelectPrimitive\n);\n\nexport { MultiSelectPrimitive, type MultiSelectPrimitiveProps, type MultiSelectOptionDto };\n"],"names":["MultiSelectTrigger","displayValue","hasValue","placeholder","displayResetAction","disabled","invalid","size","variant","onValueReset","resetButton","useMemo","IconButton","event","Icon","Close","Popover","cn","selectTriggerVariants","ChevronDown","MultiSelectContent","options","value","onToggle","contentRef","useEscapeScrollLock","ScrollArea","option","CheckboxPrimitiveRenderer","DecoratableMultiSelectPrimitive","onChange","showSelectionCount","labelMap","Map","o","v","toggle","useCallback","optionValue","next","reset","MultiSelectPrimitive","makeDecoratable"],"mappings":";;;;;;;;;;;AAmDA,MAAMA,qBAAqB,CAAC,EACxBC,YAAY,EACZC,QAAQ,EACRC,WAAW,EACXC,kBAAkB,EAClBC,QAAQ,EACRC,OAAO,EACPC,IAAI,EACJC,OAAO,EACPC,YAAY,EACU;IACtB,MAAMC,cAAcC,QAAQ;QACxB,IAAI,CAACT,YAAY,CAACE,oBACd;QAEJ,OAAO,WAAP,GACI,oBAACQ,YAAUA;YACP,eAAeC,CAAAA;gBACXA,MAAM,eAAe;gBACrBJ;YACJ;YACA,oBACI,oBAAC,4BACG,oBAACK,MAAIA;gBACD,oBAAM,oBAACC,0BAAKA;gBACZ,OAAO;gBACP,OAAOP,AAAY,qBAAZA,UAA+B,qBAAqB;;YAIvE,MAAM;YACN,SAASA,AAAY,qBAAZA,UAA+B,mBAAmB;YAC3D,UAAUH;YACV;;IAGZ,GAAG;QAACH;QAAUE;QAAoBK;QAAcD;QAASH;KAAS;IAElE,OAAO,WAAP,GACI,oBAACW,QAAQ,OAAO;QACZ,WAAWC,GAAGC,sBAAsB;YAAEV;YAASD;YAAMD;QAAQ;QAC7D,UAAUD;qBAEV,oBAAC;QAAI,WAAW;OACXH,WACGD,eAAAA,WAAAA,GAEA,oBAAC;QAAK,WA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,IAAIC,IAAIZ,QAAQ,GAAG,CAACa,CAAAA,IAAK;gBAACA,EAAE,KAAK;gBAAEA,EAAE,KAAK;aAAC;QAC5D,OAAOZ,MAAM,GAAG,CAACa,CAAAA,IAAKH,SAAS,GAAG,CAACG,MAAMA,GAAG,IAAI,CAAC;IACrD,GAAG;QAACb;QAAOD;QAASU;KAAmB;IAEvC,MAAMK,SAASC,YACX,CAACC;QACG,MAAMC,OAAOjB,MAAM,QAAQ,CAACgB,eACtBhB,MAAM,MAAM,CAACa,CAAAA,IAAKA,MAAMG,eACxB;eAAIhB;YAAOgB;SAAY;QAC7BR,WAAWS;IACf,GACA;QAACjB;QAAOQ;KAAS;IAGrB,MAAMU,QAAQH,YAAY;QACtBP,WAAW,EAAE;QACbrB;IACJ,GAAG;QAACqB;QAAUrB;KAAa;IAE3B,OAAO,WAAP,GACI,oBAACO,QAAQ,IAAI,sBACT,oBAAChB,oBAAkBA;QACf,cAAcC;QACd,UAAUqB,MAAM,MAAM,GAAG;QACzB,aAAanB;QACb,oBAAoBC;QACpB,UAAUC;QACV,SAASC;QACT,MAAMC;QACN,SAASC;QACT,cAAcgC;sBAElB,oBAACpB,oBAAkBA;QAAC,SAASC;QAAS,OAAOC;QAAO,UAAUc;;AAG1E;AACA,MAAMK,uBAAuBC,gBACzB,wBACAb"}
|
|
1
|
+
{"version":3,"file":"MultiSelect/primitives/MultiSelectPrimitive.js","sources":["../../../src/MultiSelect/primitives/MultiSelectPrimitive.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { Popover } from \"radix-ui\";\nimport { ReactComponent as ChevronDown } from \"@webiny/icons/keyboard_arrow_down.svg\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { cn, makeDecoratable, type VariantProps } from \"~/utils.js\";\nimport { CheckboxPrimitiveRenderer } from \"~/Checkbox/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { selectTriggerVariants } from \"~/Select/primitives/components/index.js\";\nimport { ScrollArea } from \"~/ScrollArea/index.js\";\nimport { useEscapeScrollLock } from \"~/hooks/index.js\";\n\ninterface MultiSelectOptionDto {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\ninterface MultiSelectPrimitiveProps {\n options?: MultiSelectOptionDto[];\n value?: string[];\n onChange?: (values: string[]) => void;\n onValueReset?: () => void;\n placeholder?: string;\n disabled?: boolean;\n invalid?: boolean;\n displayResetAction?: boolean;\n /**\n * When `true`, shows \"{count} items selected\" in the trigger instead of the full\n * comma-separated label list.\n */\n showSelectionCount?: boolean;\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n}\n\n/**\n * MultiSelect Trigger\n */\ninterface MultiSelectTriggerProps {\n displayValue: string;\n hasValue: boolean;\n placeholder: string;\n displayResetAction: boolean;\n disabled?: boolean;\n invalid?: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n onValueReset: () => void;\n}\n\nconst MultiSelectTrigger = ({\n displayValue,\n hasValue,\n placeholder,\n displayResetAction,\n disabled,\n invalid,\n size,\n variant,\n onValueReset\n}: MultiSelectTriggerProps) => {\n const resetButton = useMemo(() => {\n if (!hasValue || !displayResetAction) {\n return undefined;\n }\n return (\n <IconButton\n onPointerDown={event => {\n event.stopPropagation();\n onValueReset();\n }}\n icon={\n <span>\n <Icon\n icon={<Close />}\n label={\"Reset\"}\n color={variant === \"ghost-negative\" ? \"neutral-negative\" : \"inherit\"}\n />\n </span>\n }\n size={\"xs\"}\n variant={variant === \"ghost-negative\" ? \"ghost-negative\" : \"secondary\"}\n disabled={disabled}\n asChild\n />\n );\n }, [hasValue, displayResetAction, onValueReset, variant, disabled]);\n\n return (\n <Popover.Trigger\n className={cn(selectTriggerVariants({ variant, size, invalid }))}\n disabled={disabled}\n >\n <div className={\"flex-1 text-left truncate\"}>\n {hasValue ? (\n displayValue\n ) : (\n <span className={\"text-neutral-disabled\"}>{placeholder}</span>\n )}\n </div>\n {resetButton}\n <span className={\"h-md w-md shrink-0 fill-neutral-xstrong\"}>\n <ChevronDown className={\"h-md w-md\"} />\n </span>\n </Popover.Trigger>\n );\n};\n\n/**\n * MultiSelect Content\n */\ninterface MultiSelectContentProps {\n options: MultiSelectOptionDto[];\n value: string[];\n onToggle: (value: string) => void;\n}\n\nconst MultiSelectContent = ({ options, value, onToggle }: MultiSelectContentProps) => {\n /*\n * This popover is built on the Radix primitive directly, so it needs the same scroll-lock\n * escape hatch that `PopoverPrimitive.Content` applies.\n */\n const contentRef = useEscapeScrollLock<HTMLDivElement>();\n\n return (\n <Popover.Portal>\n <Popover.Content\n ref={contentRef}\n className={cn(\n \"relative z-popover shadow-lg overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n \"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1\"\n )}\n style={{ width: \"var(--radix-popover-trigger-width)\" }}\n align={\"start\"}\n sideOffset={4}\n >\n {/*\n * The padding sits inside the scroller so the scrollbar runs the full height, and\n * the cap leaves room for the popover's border, so the whole dropdown fits in the\n * space Radix says is available.\n */}\n <ScrollArea\n viewportClassName={cn(\n \"py-sm\",\n \"max-h-[calc(min(250px,var(--radix-popover-content-available-height,250px))_-_2*var(--border-width-sm))]\"\n )}\n >\n {options.map(option => (\n <div\n key={option.value}\n className={cn(\n \"rounded-sm p-sm mx-sm cursor-pointer\",\n \"hover:bg-neutral-dimmed\",\n option.disabled && \"opacity-50 pointer-events-none\"\n )}\n onClick={() => onToggle(option.value)}\n >\n <div className={\"pointer-events-none\"}>\n <CheckboxPrimitiveRenderer\n id={option.value}\n label={option.label}\n value={option.value}\n checked={value.includes(option.value)}\n disabled={option.disabled ?? false}\n indeterminate={false}\n hasLabel={true}\n changeChecked={() => {}}\n />\n </div>\n </div>\n ))}\n </ScrollArea>\n </Popover.Content>\n </Popover.Portal>\n );\n};\n\n/**\n * MultiSelect Primitive\n */\nconst DecoratableMultiSelectPrimitive = ({\n options = [],\n value = [],\n onChange,\n onValueReset,\n placeholder = \"Select options\",\n disabled,\n invalid,\n displayResetAction = true,\n showSelectionCount,\n size,\n variant\n}: MultiSelectPrimitiveProps) => {\n const displayValue = useMemo(() => {\n if (value.length === 0) {\n return \"\";\n }\n if (showSelectionCount) {\n return `${value.length} items selected`;\n }\n const labelMap = new Map(options.map(o => [o.value, o.label]));\n return value.map(v => labelMap.get(v) ?? v).join(\", \");\n }, [value, options, showSelectionCount]);\n\n const toggle = useCallback(\n (optionValue: string) => {\n const next = value.includes(optionValue)\n ? value.filter(v => v !== optionValue)\n : [...value, optionValue];\n onChange?.(next);\n },\n [value, onChange]\n );\n\n const reset = useCallback(() => {\n onChange?.([]);\n onValueReset?.();\n }, [onChange, onValueReset]);\n\n return (\n <Popover.Root>\n <MultiSelectTrigger\n displayValue={displayValue}\n hasValue={value.length > 0}\n placeholder={placeholder}\n displayResetAction={displayResetAction}\n disabled={disabled}\n invalid={invalid}\n size={size}\n variant={variant}\n onValueReset={reset}\n />\n <MultiSelectContent options={options} value={value} onToggle={toggle} />\n </Popover.Root>\n );\n};\nconst MultiSelectPrimitive = makeDecoratable(\n \"MultiSelectPrimitive\",\n DecoratableMultiSelectPrimitive\n);\n\nexport { MultiSelectPrimitive, type MultiSelectPrimitiveProps, type MultiSelectOptionDto };\n"],"names":["MultiSelectTrigger","displayValue","hasValue","placeholder","displayResetAction","disabled","invalid","size","variant","onValueReset","resetButton","useMemo","IconButton","event","Icon","Close","Popover","cn","selectTriggerVariants","ChevronDown","MultiSelectContent","options","value","onToggle","contentRef","useEscapeScrollLock","ScrollArea","option","CheckboxPrimitiveRenderer","DecoratableMultiSelectPrimitive","onChange","showSelectionCount","labelMap","Map","o","v","toggle","useCallback","optionValue","next","reset","MultiSelectPrimitive","makeDecoratable"],"mappings":";;;;;;;;;;;AAmDA,MAAMA,qBAAqB,CAAC,EACxBC,YAAY,EACZC,QAAQ,EACRC,WAAW,EACXC,kBAAkB,EAClBC,QAAQ,EACRC,OAAO,EACPC,IAAI,EACJC,OAAO,EACPC,YAAY,EACU;IACtB,MAAMC,cAAcC,QAAQ;QACxB,IAAI,CAACT,YAAY,CAACE,oBACd;QAEJ,OAAO,WAAP,GACI,oBAACQ,YAAUA;YACP,eAAeC,CAAAA;gBACXA,MAAM,eAAe;gBACrBJ;YACJ;YACA,oBACI,oBAAC,4BACG,oBAACK,MAAIA;gBACD,oBAAM,oBAACC,0BAAKA;gBACZ,OAAO;gBACP,OAAOP,AAAY,qBAAZA,UAA+B,qBAAqB;;YAIvE,MAAM;YACN,SAASA,AAAY,qBAAZA,UAA+B,mBAAmB;YAC3D,UAAUH;YACV;;IAGZ,GAAG;QAACH;QAAUE;QAAoBK;QAAcD;QAASH;KAAS;IAElE,OAAO,WAAP,GACI,oBAACW,QAAQ,OAAO;QACZ,WAAWC,GAAGC,sBAAsB;YAAEV;YAASD;YAAMD;QAAQ;QAC7D,UAAUD;qBAEV,oBAAC;QAAI,WAAW;OACXH,WACGD,eAAAA,WAAAA,GAEA,oBAAC;QAAK,WAAW;OAA0BE,eAGlDO,aAAAA,WAAAA,GACD,oBAAC;QAAK,WAAW;qBACb,oBAACS,gBAAWA;QAAC,WAAW;;AAIxC;AAWA,MAAMC,qBAAqB,CAAC,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAA2B;IAK7E,MAAMC,aAAaC;IAEnB,OAAO,WAAP,GACI,oBAACT,QAAQ,MAAM,sBACX,oBAACA,QAAQ,OAAO;QACZ,KAAKQ;QACL,WAAWP,GACP,8HACA,gEACA,8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AM,CAACa,CAAAA,IAAKA,MAAMG,eACxB;eAAIhB;YAAOgB;SAAY;QAC7BR,WAAWS;IACf,GACA;QAACjB;QAAOQ;KAAS;IAGrB,MAAMU,QAAQH,YAAY;QACtBP,WAAW,EAAE;QACbrB;IACJ,GAAG;QAACqB;QAAUrB;KAAa;IAE3B,OAAO,WAAP,GACI,oBAACO,QAAQ,IAAI,sBACT,oBAAChB,oBAAAA;QACG,cAAcC;QACd,UAAUqB,MAAM,MAAM,GAAG;QACzB,aAAanB;QACb,oBAAoBC;QACpB,UAAUC;QACV,SAASC;QACT,MAAMC;QACN,SAASC;QACT,cAAcgC;sBAElB,oBAACpB,oBAAAA;QAAmB,SAASC;QAAS,OAAOC;QAAO,UAAUc;;AAG1E;AACA,MAAMK,uBAAuBC,gBACzB,wBACAb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup/primitives/RadioGroupPrimitive.js","sources":["../../../src/RadioGroup/primitives/RadioGroupPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { RadioGroup as RadioGroupPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\nimport { Radio } from \"./Radio.js\";\nimport type { RadioItemParams, RadioItemFormatted } from \"../domains/index.js\";\nimport { useRadioGroup } from \"./useRadioGroup.js\";\n\n/**\n * Radio Group Root\n */\nconst RadioGroupRoot = ({ className, ...props }: RadioGroupPrimitives.RadioGroupProps) => {\n return (\n <RadioGroupPrimitives.Root\n className={cn(\"grid gap-sm-extra py-xs-plus\", className)}\n {...props}\n />\n );\n};\n\n/**\n * Radio Group Renderer\n */\ninterface RadioGroupPrimitiveProps extends Omit<\n RadioGroupPrimitives.RadioGroupProps,\n \"defaultValue\" | \"onChange\" | \"onValueChange\" | \"value\"\n> {\n items: RadioItemParams[];\n /**\n * Callback triggered when the selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Optional selected item.\n */\n value?: string;\n}\n\ninterface RadioGroupVm {\n items: RadioItemFormatted[];\n}\n\ninterface RadioGroupRendererProps extends Omit<RadioGroupPrimitiveProps, \"onChange\"> {\n items: RadioItemFormatted[];\n changeValue: (value: string) => void;\n}\n\nconst RadioGroupRenderer = ({ items, changeValue, value, disabled }: RadioGroupRendererProps) => {\n return (\n <RadioGroupRoot\n value={value ?? \"\"}\n onValueChange={value => changeValue(value)}\n disabled={disabled}\n >\n {items.map(item => (\n <Radio\n id={item.id}\n value={item.value}\n key={item.id}\n label={item.label}\n disabled={item.disabled}\n />\n ))}\n </RadioGroupRoot>\n );\n};\n\n/**\n * Radio Group Primitive\n */\nconst RadioGroupPrimitive = (props: RadioGroupPrimitiveProps) => {\n const { vm, changeValue } = useRadioGroup(props);\n return <RadioGroupRenderer {...props} items={vm.items} changeValue={changeValue} />;\n};\n\n/**\n * @deprecated\n * This component is retained in @webiny/admin-ui and used in @webiny/ui solely as a compatibility layer.\n * It is marked as deprecated because nesting `Radio` components inside `RadioGroup` is no longer the recommended approach.\n * Instead, we now pass an array of `RadioItemDto` directly to `RadioGroup` for better maintainability.\n */\nconst DeprecatedRadioGroup = RadioGroupRoot;\n\nexport {\n RadioGroupPrimitive,\n RadioGroupRenderer,\n DeprecatedRadioGroup,\n type RadioGroupPrimitiveProps,\n type RadioGroupVm\n};\n"],"names":["RadioGroupRoot","className","props","RadioGroupPrimitives","cn","RadioGroupRenderer","items","changeValue","value","disabled","item","Radio","RadioGroupPrimitive","vm","useRadioGroup","DeprecatedRadioGroup"],"mappings":";;;;;AAUA,MAAMA,iBAAiB,CAAC,EAAEC,SAAS,EAAE,GAAGC,OAA6C,GAC1E,WAAP,GACI,sCAACC,WAAAA,IAAyB;QACtB,WAAWC,GAAG,gCAAgCH;QAC7C,GAAGC,KAAK;;AAgCrB,MAAMG,qBAAqB,CAAC,EAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAEC,QAAQ,EAA2B,GACjF,WAAP,GACI,sCAACT,
|
|
1
|
+
{"version":3,"file":"RadioGroup/primitives/RadioGroupPrimitive.js","sources":["../../../src/RadioGroup/primitives/RadioGroupPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { RadioGroup as RadioGroupPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\nimport { Radio } from \"./Radio.js\";\nimport type { RadioItemParams, RadioItemFormatted } from \"../domains/index.js\";\nimport { useRadioGroup } from \"./useRadioGroup.js\";\n\n/**\n * Radio Group Root\n */\nconst RadioGroupRoot = ({ className, ...props }: RadioGroupPrimitives.RadioGroupProps) => {\n return (\n <RadioGroupPrimitives.Root\n className={cn(\"grid gap-sm-extra py-xs-plus\", className)}\n {...props}\n />\n );\n};\n\n/**\n * Radio Group Renderer\n */\ninterface RadioGroupPrimitiveProps extends Omit<\n RadioGroupPrimitives.RadioGroupProps,\n \"defaultValue\" | \"onChange\" | \"onValueChange\" | \"value\"\n> {\n items: RadioItemParams[];\n /**\n * Callback triggered when the selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Optional selected item.\n */\n value?: string;\n}\n\ninterface RadioGroupVm {\n items: RadioItemFormatted[];\n}\n\ninterface RadioGroupRendererProps extends Omit<RadioGroupPrimitiveProps, \"onChange\"> {\n items: RadioItemFormatted[];\n changeValue: (value: string) => void;\n}\n\nconst RadioGroupRenderer = ({ items, changeValue, value, disabled }: RadioGroupRendererProps) => {\n return (\n <RadioGroupRoot\n value={value ?? \"\"}\n onValueChange={value => changeValue(value)}\n disabled={disabled}\n >\n {items.map(item => (\n <Radio\n id={item.id}\n value={item.value}\n key={item.id}\n label={item.label}\n disabled={item.disabled}\n />\n ))}\n </RadioGroupRoot>\n );\n};\n\n/**\n * Radio Group Primitive\n */\nconst RadioGroupPrimitive = (props: RadioGroupPrimitiveProps) => {\n const { vm, changeValue } = useRadioGroup(props);\n return <RadioGroupRenderer {...props} items={vm.items} changeValue={changeValue} />;\n};\n\n/**\n * @deprecated\n * This component is retained in @webiny/admin-ui and used in @webiny/ui solely as a compatibility layer.\n * It is marked as deprecated because nesting `Radio` components inside `RadioGroup` is no longer the recommended approach.\n * Instead, we now pass an array of `RadioItemDto` directly to `RadioGroup` for better maintainability.\n */\nconst DeprecatedRadioGroup = RadioGroupRoot;\n\nexport {\n RadioGroupPrimitive,\n RadioGroupRenderer,\n DeprecatedRadioGroup,\n type RadioGroupPrimitiveProps,\n type RadioGroupVm\n};\n"],"names":["RadioGroupRoot","className","props","RadioGroupPrimitives","cn","RadioGroupRenderer","items","changeValue","value","disabled","item","Radio","RadioGroupPrimitive","vm","useRadioGroup","DeprecatedRadioGroup"],"mappings":";;;;;AAUA,MAAMA,iBAAiB,CAAC,EAAEC,SAAS,EAAE,GAAGC,OAA6C,GAC1E,WAAP,GACI,sCAACC,WAAAA,IAAyB;QACtB,WAAWC,GAAG,gCAAgCH;QAC7C,GAAGC,KAAK;;AAgCrB,MAAMG,qBAAqB,CAAC,EAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAEC,QAAQ,EAA2B,GACjF,WAAP,GACI,sCAACT,gBAAAA;QACG,OAAOQ,SAAS;QAChB,eAAeA,CAAAA,QAASD,YAAYC;QACpC,UAAUC;OAETH,MAAM,GAAG,CAACI,CAAAA,OAAAA,WAAAA,GACP,sCAACC,OAAKA;YACF,IAAID,KAAK,EAAE;YACX,OAAOA,KAAK,KAAK;YACjB,KAAKA,KAAK,EAAE;YACZ,OAAOA,KAAK,KAAK;YACjB,UAAUA,KAAK,QAAQ;;AAU3C,MAAME,sBAAsB,CAACV;IACzB,MAAM,EAAEW,EAAE,EAAEN,WAAW,EAAE,GAAGO,cAAcZ;IAC1C,OAAO,WAAP,GAAO,sCAACG,oBAAAA;QAAoB,GAAGH,KAAK;QAAE,OAAOW,GAAG,KAAK;QAAE,aAAaN;;AACxE;AAQA,MAAMQ,uBAAuBf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeSlider/primitives/RangeSliderPrimitive.js","sources":["../../../src/RangeSlider/primitives/RangeSliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { SliderRoot, SliderThumb, type SliderThumbProps, SliderTrack } from \"~/Slider/index.js\";\nimport { useRangeSlider } from \"./useRangeSlider.js\";\n\ninterface RangeSliderPrimitiveRootProps extends Omit<\n SliderPrimitives.SliderProps,\n \"min\" | \"max\" | \"value\"\n> {\n /**\n * Array of numbers representing the current values of the range slider.\n */\n values: number[];\n /**\n * Minimum value of the range slider.\n */\n min: number;\n /**\n * Maximum value of the range slider.\n */\n max: number;\n}\n\ninterface RangeSliderPrimitiveThumbProps extends Omit<SliderThumbProps, \"labelValue\"> {\n textValues: string[];\n}\n\ninterface RangeSliderPrimitiveVm\n extends RangeSliderPrimitiveRootProps, Omit<RangeSliderPrimitiveThumbProps, \"textValue\"> {\n textValues: string[];\n}\n\n/**\n * RangeSliderRenderer\n */\n\nconst RangeSliderPrimitiveRenderer = ({\n tooltipSide,\n textValues,\n showTooltip,\n values,\n ...sliderProps\n}: RangeSliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps} value={values}>\n <SliderTrack />\n <SliderThumb\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[0]}\n />\n <SliderThumb\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[1]}\n />\n </SliderRoot>\n </div>\n );\n};\n\n/**\n * RangeSlider\n */\ninterface RangeSliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValuesChange: (values: number[]) => void;\n onValuesCommit?: (values: number[]) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n values?: number[];\n}\n\nconst RangeSliderPrimitive = (props: RangeSliderPrimitiveProps) => {\n const { transformValue, onValuesChange, onValuesCommit, ...restProps } = props; // Rename transformValue to _ to avoid Oxlint warning\n const { vm, changeValues, commitValues } = useRangeSlider({\n ...restProps,\n transformValue,\n onValuesChange,\n onValuesCommit\n });\n\n return (\n <RangeSliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValues}\n onValueCommit={commitValues}\n />\n );\n};\n\nexport {\n RangeSliderPrimitive,\n RangeSliderPrimitiveRenderer,\n type RangeSliderPrimitiveProps,\n type RangeSliderPrimitiveVm\n};\n"],"names":["RangeSliderPrimitiveRenderer","tooltipSide","textValues","showTooltip","values","sliderProps","SliderRoot","SliderTrack","SliderThumb","RangeSliderPrimitive","props","transformValue","onValuesChange","onValuesCommit","restProps","vm","changeValues","commitValues","useRangeSlider"],"mappings":";;;AAoCA,MAAMA,+BAA+B,CAAC,EAClCC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,MAAM,EACN,GAAGC,aACkB,GACd,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,YAAUA;QAAE,GAAGD,WAAW;QAAE,OAAOD;qBAChC,sCAACG,aAAWA,OAAAA,WAAAA,GACZ,sCAACC,aAAWA;QACR,aAAaL;QACb,aAAaF;QACb,WAAWC,UAAU,CAAC,EAAE;sBAE5B,sCAACM,aAAWA;QACR,aAAaL;QACb,aAAaF;QACb,WAAWC,UAAU,CAAC,EAAE;;AAsB5C,MAAMO,uBAAuB,CAACC;IAC1B,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGJ;IACzE,MAAM,EAAEK,EAAE,EAAEC,YAAY,EAAEC,YAAY,EAAE,GAAGC,eAAe;QACtD,GAAGJ,SAAS;QACZH;QACAC;QACAC;IACJ;IAEA,OAAO,WAAP,GACI,sCAACb,
|
|
1
|
+
{"version":3,"file":"RangeSlider/primitives/RangeSliderPrimitive.js","sources":["../../../src/RangeSlider/primitives/RangeSliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { SliderRoot, SliderThumb, type SliderThumbProps, SliderTrack } from \"~/Slider/index.js\";\nimport { useRangeSlider } from \"./useRangeSlider.js\";\n\ninterface RangeSliderPrimitiveRootProps extends Omit<\n SliderPrimitives.SliderProps,\n \"min\" | \"max\" | \"value\"\n> {\n /**\n * Array of numbers representing the current values of the range slider.\n */\n values: number[];\n /**\n * Minimum value of the range slider.\n */\n min: number;\n /**\n * Maximum value of the range slider.\n */\n max: number;\n}\n\ninterface RangeSliderPrimitiveThumbProps extends Omit<SliderThumbProps, \"labelValue\"> {\n textValues: string[];\n}\n\ninterface RangeSliderPrimitiveVm\n extends RangeSliderPrimitiveRootProps, Omit<RangeSliderPrimitiveThumbProps, \"textValue\"> {\n textValues: string[];\n}\n\n/**\n * RangeSliderRenderer\n */\n\nconst RangeSliderPrimitiveRenderer = ({\n tooltipSide,\n textValues,\n showTooltip,\n values,\n ...sliderProps\n}: RangeSliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps} value={values}>\n <SliderTrack />\n <SliderThumb\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[0]}\n />\n <SliderThumb\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[1]}\n />\n </SliderRoot>\n </div>\n );\n};\n\n/**\n * RangeSlider\n */\ninterface RangeSliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValuesChange: (values: number[]) => void;\n onValuesCommit?: (values: number[]) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n values?: number[];\n}\n\nconst RangeSliderPrimitive = (props: RangeSliderPrimitiveProps) => {\n const { transformValue, onValuesChange, onValuesCommit, ...restProps } = props; // Rename transformValue to _ to avoid Oxlint warning\n const { vm, changeValues, commitValues } = useRangeSlider({\n ...restProps,\n transformValue,\n onValuesChange,\n onValuesCommit\n });\n\n return (\n <RangeSliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValues}\n onValueCommit={commitValues}\n />\n );\n};\n\nexport {\n RangeSliderPrimitive,\n RangeSliderPrimitiveRenderer,\n type RangeSliderPrimitiveProps,\n type RangeSliderPrimitiveVm\n};\n"],"names":["RangeSliderPrimitiveRenderer","tooltipSide","textValues","showTooltip","values","sliderProps","SliderRoot","SliderTrack","SliderThumb","RangeSliderPrimitive","props","transformValue","onValuesChange","onValuesCommit","restProps","vm","changeValues","commitValues","useRangeSlider"],"mappings":";;;AAoCA,MAAMA,+BAA+B,CAAC,EAClCC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,MAAM,EACN,GAAGC,aACkB,GACd,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,YAAUA;QAAE,GAAGD,WAAW;QAAE,OAAOD;qBAChC,sCAACG,aAAWA,OAAAA,WAAAA,GACZ,sCAACC,aAAWA;QACR,aAAaL;QACb,aAAaF;QACb,WAAWC,UAAU,CAAC,EAAE;sBAE5B,sCAACM,aAAWA;QACR,aAAaL;QACb,aAAaF;QACb,WAAWC,UAAU,CAAC,EAAE;;AAsB5C,MAAMO,uBAAuB,CAACC;IAC1B,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGJ;IACzE,MAAM,EAAEK,EAAE,EAAEC,YAAY,EAAEC,YAAY,EAAE,GAAGC,eAAe;QACtD,GAAGJ,SAAS;QACZH;QACAC;QACAC;IACJ;IAEA,OAAO,WAAP,GACI,sCAACb,8BAAAA;QACI,GAAGc,SAAS;QACZ,GAAGC,EAAE;QACN,eAAeC;QACf,eAAeC;;AAG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollArea/ScrollArea.js","sources":["../../src/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"~/utils.js\";\n\nexport interface ScrollPosition {\n top: number;\n left: number;\n scrollTop: number;\n scrollLeft: number;\n scrollHeight: number;\n scrollWidth: number;\n clientHeight: number;\n clientWidth: number;\n}\n\ninterface ScrollAreaProps extends Omit<\n React.ComponentProps<typeof ScrollAreaPrimitive.Root>,\n \"onScroll\"\n> {\n onScrollPositionChange?: (position: ScrollPosition) => void;\n onScroll?: (position: ScrollPosition) => void;\n /**\n * Classes for the scrolling element itself. Put the height limit here when the area has to grow\n * with its content up to a maximum, instead of filling a parent of a known height.\n */\n viewportClassName?: string;\n /**\n * Native scroll handler for the scrolling element, for callers that need the event itself.\n * `onScroll` reports positions instead.\n */\n onViewportScroll?: React.UIEventHandler<HTMLDivElement>;\n}\n\nfunction ScrollArea({\n className,\n children,\n onScrollPositionChange,\n onScroll,\n viewportClassName,\n onViewportScroll,\n /*\n * Radix would only show the scrollbar once the pointer is inside. Showing it whenever there is\n * more content is the same rule the rest of the admin follows, a Select included.\n */\n type = \"auto\",\n ...props\n}: ScrollAreaProps) {\n const viewportRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport || (!onScrollPositionChange && !onScroll)) {\n return;\n }\n\n // The Viewport component itself is the scrollable element.\n const handleScroll = () => {\n const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } =\n viewport;\n\n const position: ScrollPosition = {\n top: scrollHeight > clientHeight ? scrollTop / (scrollHeight - clientHeight) : 0,\n left: scrollWidth > clientWidth ? scrollLeft / (scrollWidth - clientWidth) : 0,\n scrollTop,\n scrollLeft,\n scrollHeight,\n scrollWidth,\n clientHeight,\n clientWidth\n };\n\n onScrollPositionChange?.(position);\n onScroll?.(position);\n };\n\n // Call handleScroll initially to provide initial position.\n handleScroll();\n\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }, [onScrollPositionChange, onScroll]);\n\n return (\n <ScrollAreaPrimitive.Root\n data-slot=\"scroll-area\"\n type={type}\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n onScroll={onViewportScroll}\n className={cn(\n \"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1\",\n viewportClassName\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = \"vertical\",\n onMouseDown,\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseDown?.(event);\n\n /*\n * Grabbing a scrollbar must not move focus. An autocomplete closes its list the moment its\n * input blurs, so without this, dragging the thumb dismisses the list under the pointer.\n */\n event.preventDefault();\n };\n\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n onMouseDown={handleMouseDown}\n className={cn(\n \"flex touch-none transition-colors select-none\",\n orientation === \"vertical\" && \"h-full w-[10px] p-[2px]\",\n orientation === \"horizontal\" && \"h-[10px] flex-col p-[2px]\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"bg-neutral-strong/70 relative flex-1 rounded-full\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n"],"names":["ScrollArea","className","children","onScrollPositionChange","onScroll","viewportClassName","onViewportScroll","type","props","viewportRef","React","viewport","handleScroll","scrollTop","scrollLeft","scrollHeight","scrollWidth","clientHeight","clientWidth","position","ScrollAreaPrimitive","cn","ScrollBar","orientation","onMouseDown","handleMouseDown","event"],"mappings":";;;AAiCA,SAASA,WAAW,EAChBC,SAAS,EACTC,QAAQ,EACRC,sBAAsB,EACtBC,QAAQ,EACRC,iBAAiB,EACjBC,gBAAgB,EAKhBC,OAAO,MAAM,EACb,GAAGC,OACW;IACd,MAAMC,cAAcC,wBAAAA,MAAY,CAAiB;IAEjDA,wBAAAA,SAAe,CAAC;QACZ,MAAMC,WAAWF,YAAY,OAAO;QACpC,IAAI,CAACE,YAAa,CAACR,0BAA0B,CAACC,UAC1C;QAIJ,MAAMQ,eAAe;YACjB,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,WAAW,EAAEC,YAAY,EAAEC,WAAW,EAAE,GACjFP;YAEJ,MAAMQ,WAA2B;gBAC7B,KAAKJ,eAAeE,eAAeJ,YAAaE,CAAAA,eAAeE,YAAW,IAAK;gBAC/E,MAAMD,cAAcE,cAAcJ,aAAcE,CAAAA,cAAcE,WAAU,IAAK;gBAC7EL;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;YACJ;YAEAf,yBAAyBgB;YACzBf,WAAWe;QACf;QAGAP;QAEAD,SAAS,gBAAgB,CAAC,UAAUC;QACpC,OAAO,IAAMD,SAAS,mBAAmB,CAAC,UAAUC;IACxD,GAAG;QAACT;QAAwBC;KAAS;IAErC,OAAO,WAAP,GACI,sCAACgB,uDAAAA,IAAwB;QACrB,aAAU;QACV,MAAMb;QACN,WAAWc,GAAG,YAAYpB;QACzB,GAAGO,KAAK;qBAET,sCAACY,uDAAAA,QAA4B;QACzB,KAAKX;QACL,aAAU;QACV,UAAUH;QACV,WAAWe,GACP,sJACAhB;OAGHH,WAAAA,WAAAA,GAEL,sCAACoB,
|
|
1
|
+
{"version":3,"file":"ScrollArea/ScrollArea.js","sources":["../../src/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"~/utils.js\";\n\nexport interface ScrollPosition {\n top: number;\n left: number;\n scrollTop: number;\n scrollLeft: number;\n scrollHeight: number;\n scrollWidth: number;\n clientHeight: number;\n clientWidth: number;\n}\n\ninterface ScrollAreaProps extends Omit<\n React.ComponentProps<typeof ScrollAreaPrimitive.Root>,\n \"onScroll\"\n> {\n onScrollPositionChange?: (position: ScrollPosition) => void;\n onScroll?: (position: ScrollPosition) => void;\n /**\n * Classes for the scrolling element itself. Put the height limit here when the area has to grow\n * with its content up to a maximum, instead of filling a parent of a known height.\n */\n viewportClassName?: string;\n /**\n * Native scroll handler for the scrolling element, for callers that need the event itself.\n * `onScroll` reports positions instead.\n */\n onViewportScroll?: React.UIEventHandler<HTMLDivElement>;\n}\n\nfunction ScrollArea({\n className,\n children,\n onScrollPositionChange,\n onScroll,\n viewportClassName,\n onViewportScroll,\n /*\n * Radix would only show the scrollbar once the pointer is inside. Showing it whenever there is\n * more content is the same rule the rest of the admin follows, a Select included.\n */\n type = \"auto\",\n ...props\n}: ScrollAreaProps) {\n const viewportRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport || (!onScrollPositionChange && !onScroll)) {\n return;\n }\n\n // The Viewport component itself is the scrollable element.\n const handleScroll = () => {\n const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } =\n viewport;\n\n const position: ScrollPosition = {\n top: scrollHeight > clientHeight ? scrollTop / (scrollHeight - clientHeight) : 0,\n left: scrollWidth > clientWidth ? scrollLeft / (scrollWidth - clientWidth) : 0,\n scrollTop,\n scrollLeft,\n scrollHeight,\n scrollWidth,\n clientHeight,\n clientWidth\n };\n\n onScrollPositionChange?.(position);\n onScroll?.(position);\n };\n\n // Call handleScroll initially to provide initial position.\n handleScroll();\n\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }, [onScrollPositionChange, onScroll]);\n\n return (\n <ScrollAreaPrimitive.Root\n data-slot=\"scroll-area\"\n type={type}\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n onScroll={onViewportScroll}\n className={cn(\n \"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1\",\n viewportClassName\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = \"vertical\",\n onMouseDown,\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseDown?.(event);\n\n /*\n * Grabbing a scrollbar must not move focus. An autocomplete closes its list the moment its\n * input blurs, so without this, dragging the thumb dismisses the list under the pointer.\n */\n event.preventDefault();\n };\n\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n onMouseDown={handleMouseDown}\n className={cn(\n \"flex touch-none transition-colors select-none\",\n orientation === \"vertical\" && \"h-full w-[10px] p-[2px]\",\n orientation === \"horizontal\" && \"h-[10px] flex-col p-[2px]\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"bg-neutral-strong/70 relative flex-1 rounded-full\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n"],"names":["ScrollArea","className","children","onScrollPositionChange","onScroll","viewportClassName","onViewportScroll","type","props","viewportRef","React","viewport","handleScroll","scrollTop","scrollLeft","scrollHeight","scrollWidth","clientHeight","clientWidth","position","ScrollAreaPrimitive","cn","ScrollBar","orientation","onMouseDown","handleMouseDown","event"],"mappings":";;;AAiCA,SAASA,WAAW,EAChBC,SAAS,EACTC,QAAQ,EACRC,sBAAsB,EACtBC,QAAQ,EACRC,iBAAiB,EACj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