@ngrok/mantle 0.1.8 → 0.1.10
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/package.json +9 -33
- package/dist/alert.cjs +0 -2
- package/dist/alert.cjs.map +0 -1
- package/dist/alert.d.cts +0 -26
- package/dist/anchor.cjs +0 -2
- package/dist/anchor.cjs.map +0 -1
- package/dist/anchor.d.cts +0 -87
- package/dist/as-child-BjnPZ1DU.d.cts +0 -22
- package/dist/button.cjs +0 -2
- package/dist/button.cjs.map +0 -1
- package/dist/button.d.cts +0 -92
- package/dist/card.cjs +0 -2
- package/dist/card.cjs.map +0 -1
- package/dist/card.d.cts +0 -29
- package/dist/checkbox.cjs +0 -2
- package/dist/checkbox.cjs.map +0 -1
- package/dist/checkbox.d.cts +0 -6
- package/dist/chunk-D3F6KERE.cjs +0 -2
- package/dist/chunk-D3F6KERE.cjs.map +0 -1
- package/dist/chunk-IN6SIXF2.cjs +0 -2
- package/dist/chunk-IN6SIXF2.cjs.map +0 -1
- package/dist/chunk-JGNAMNKZ.cjs +0 -2
- package/dist/chunk-JGNAMNKZ.cjs.map +0 -1
- package/dist/chunk-K4UKFOMI.cjs +0 -2
- package/dist/chunk-K4UKFOMI.cjs.map +0 -1
- package/dist/chunk-ROHPZJ5N.cjs +0 -2
- package/dist/chunk-ROHPZJ5N.cjs.map +0 -1
- package/dist/code-block.cjs +0 -4
- package/dist/code-block.cjs.map +0 -1
- package/dist/code-block.d.cts +0 -108
- package/dist/cx.cjs +0 -2
- package/dist/cx.cjs.map +0 -1
- package/dist/cx.d.cts +0 -10
- package/dist/deep-non-nullable-SmpSvoSd.d.cts +0 -8
- package/dist/dialog.cjs +0 -2
- package/dist/dialog.cjs.map +0 -1
- package/dist/dialog.d.cts +0 -26
- package/dist/dropdown-menu.cjs +0 -2
- package/dist/dropdown-menu.cjs.map +0 -1
- package/dist/dropdown-menu.d.cts +0 -37
- package/dist/hooks.cjs +0 -2
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.d.cts +0 -15
- package/dist/icon.cjs +0 -2
- package/dist/icon.cjs.map +0 -1
- package/dist/icon.d.cts +0 -23
- package/dist/inline-code.cjs +0 -2
- package/dist/inline-code.cjs.map +0 -1
- package/dist/inline-code.d.cts +0 -9
- package/dist/input.cjs +0 -2
- package/dist/input.cjs.map +0 -1
- package/dist/input.d.cts +0 -75
- package/dist/media-object.cjs +0 -2
- package/dist/media-object.cjs.map +0 -1
- package/dist/media-object.d.cts +0 -26
- package/dist/popover.cjs +0 -2
- package/dist/popover.cjs.map +0 -1
- package/dist/popover.d.cts +0 -8
- package/dist/select.cjs +0 -2
- package/dist/select.cjs.map +0 -1
- package/dist/select.d.cts +0 -19
- package/dist/separator.cjs +0 -2
- package/dist/separator.cjs.map +0 -1
- package/dist/separator.d.cts +0 -9
- package/dist/sheet.cjs +0 -2
- package/dist/sheet.cjs.map +0 -1
- package/dist/sheet.d.cts +0 -22
- package/dist/skeleton.cjs +0 -2
- package/dist/skeleton.cjs.map +0 -1
- package/dist/skeleton.d.cts +0 -14
- package/dist/table.cjs +0 -2
- package/dist/table.cjs.map +0 -1
- package/dist/table.d.cts +0 -13
- package/dist/tailwind-preset.d.cts +0 -475
- package/dist/tailwind-preset.d.ts +0 -475
- package/dist/text-area.cjs +0 -2
- package/dist/text-area.cjs.map +0 -1
- package/dist/text-area.d.cts +0 -19
- package/dist/theme-provider.cjs +0 -29
- package/dist/theme-provider.cjs.map +0 -1
- package/dist/theme-provider.d.cts +0 -75
- package/dist/tooltip.cjs +0 -2
- package/dist/tooltip.cjs.map +0 -1
- package/dist/tooltip.d.cts +0 -15
- package/dist/types.cjs +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts +0 -6
- package/dist/variant-props-DnYnbC7s.d.cts +0 -11
- package/dist/with-style-props-VnLWm0Yd.d.cts +0 -27
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/button/src/button.tsx","../packages/button/src/icon-button.tsx"],"names":["CircleNotch","Slot","cva","clsx","Children","cloneElement","forwardRef","isValidElement","invariant","jsx","jsxs","buttonVariants","Button","_ariaDisabled","appearance","asChild","children","className","propIcon","iconPlacement","isLoading","onClickCapture","priority","props","ref","ariaDisabled","icon","_onClickCapture","event","buttonProps","cx","singleChild","grandchildren","InnerContent","Icon","iconButtonVariants","IconButton","label","size","isValidChild"],"mappings":"kFAAA,OAAS,eAAAA,MAAmB,oCAC5B,OAAS,QAAAC,MAAY,uBACrB,OAAS,OAAAC,MAAW,2BACpB,OAAOC,MAAU,OACjB,OAAS,YAAAC,EAAU,gBAAAC,EAAc,cAAAC,EAAY,kBAAAC,MAAsB,QAEnE,OAAOC,MAAe,iBAkJK,cAAAC,EA4D1B,QAAAC,MA5D0B,oBA5I3B,IAAMC,EAAiBT,EACtB,uOACA,CACC,SAAU,CAIT,WAAY,CACX,OACC,iOACD,MACC,iNACD,SACC,yQACD,KAAM,gHACP,EAKA,cAAe,CACd,IAAK,SACL,MAAO,QACR,EAMA,UAAW,CACV,MAAO,GACP,KAAM,YACP,EAKA,SAAU,CACT,OAAQ,GACR,QAAS,GACT,QAAS,EACV,CACD,EACA,gBAAiB,CAChB,WAAY,WACZ,UAAW,GACX,SAAU,SACX,EACA,iBAAkB,CACjB,CACC,WAAY,QACZ,SAAU,SACV,MACC,gKACF,EACA,CACC,WAAY,WACZ,SAAU,SACV,MACC,wNACF,EACA,CACC,WAAY,SACZ,SAAU,SACV,MACC,iKACF,EACA,CACC,WAAY,OACZ,SAAU,SACV,MAAO,iDACR,EACA,CACC,WAAY,QACZ,SAAU,UACV,MACC,sJACF,EACA,CACC,WAAY,WACZ,SAAU,UACV,MACC,6QACF,EACA,CACC,WAAY,SACZ,SAAU,UACV,MACC,sKACF,EACA,CACC,WAAY,OACZ,SAAU,UACV,MAAO,6CACR,CACD,CACD,CACD,EAyBMU,EAASN,EACd,CACC,CACC,gBAAiBO,EACjB,WAAAC,EAAa,WACb,QAAAC,E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B,CAAE,EAAE,CACnG,CAIA,OACCR,EAAC,UAAQ,GAAGmB,EACX,UAAApB,EAAC,QAAK,UAAU,UAAW,SAAA4B,EAAM,EACjC5B,EAACyB,EAAA,CAAK,IALKd,EAAYX,EAACT,EAAA,CAAY,UAAU,eAAe,EAAKkB,EAKjD,GAClB,CAEF,CACD,EACAkB,EAAW,YAAc","sourcesContent":["import { CircleNotch } from \"@phosphor-icons/react/CircleNotch\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport clsx from \"clsx\";\nimport { Children, cloneElement, forwardRef, isValidElement } from \"react\";\nimport type { ButtonHTMLAttributes, MouseEvent, PropsWithChildren, ReactNode } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { cx } from \"../../cx\";\nimport { Icon } from \"../../icon\";\nimport type { WithAsChild } from \"../../types/src/as-child\";\nimport type { VariantProps } from \"../../types/src/variant-props\";\n\nconst buttonVariants = cva(\n\t\"items-center justify-center gap-1.5 whitespace-nowrap rounded-md focus-within:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50 sm:text-sm [&>*]:focus-within:outline-none\",\n\t{\n\t\tvariants: {\n\t\t\t/**\n\t\t\t * Defines the visual style of the Button.\n\t\t\t */\n\t\t\tappearance: {\n\t\t\t\tfilled:\n\t\t\t\t\t\"inline-flex h-11 border border-transparent bg-filled-accent px-3 font-medium text-on-filled hover:bg-filled-accent-hover focus-visible:border-accent-600 focus-visible:ring-focus-accent active:bg-filled-accent-active sm:h-9\",\n\t\t\t\tghost:\n\t\t\t\t\t\"inline-flex h-11 border border-transparent px-3 font-medium text-accent-600 hover:bg-accent-500/10 hover:text-accent-700 focus-visible:ring-focus-accent active:bg-accent-500/15 active:text-accent-700 sm:h-9\",\n\t\t\t\toutlined:\n\t\t\t\t\t\"inline-flex h-11 border border-accent-600 bg-form px-3 font-medium text-accent-600 hover:border-accent-700 hover:bg-accent-500/10 hover:text-accent-700 focus-visible:ring-focus-accent active:border-accent-700 active:bg-accent-500/15 active:text-accent-700 sm:h-9\",\n\t\t\t\tlink: \"group inline cursor-pointer border-transparent text-accent-600 hover:underline focus-visible:ring-focus-accent\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * The side that the icon will render on, if one is present. If `state=\"pending\"`,\n\t\t\t * then the loading icon will also render on this side.\n\t\t\t */\n\t\t\ticonPlacement: {\n\t\t\t\tend: \"pe-2.5\",\n\t\t\t\tstart: \"ps-2.5\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether or not the button is in a loading state, default `false`. Setting `isLoading` will\n\t\t\t * replace any `icon` with a spinner, or add one if an icon wasn't given.\n\t\t\t * It will also disable user interaction with the button and set `aria-disabled`.\n\t\t\t */\n\t\t\tisLoading: {\n\t\t\t\tfalse: \"\",\n\t\t\t\ttrue: \"opacity-50\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * Indicates the importance or impact level of the button, affecting its\n\t\t\t * color and styling to communicate its purpose to the user\n\t\t\t */\n\t\t\tpriority: {\n\t\t\t\tdanger: \"\",\n\t\t\t\tdefault: \"\",\n\t\t\t\tneutral: \"\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tappearance: \"outlined\",\n\t\t\tisLoading: false,\n\t\t\tpriority: \"default\",\n\t\t},\n\t\tcompoundVariants: [\n\t\t\t{\n\t\t\t\tappearance: \"ghost\",\n\t\t\t\tpriority: \"danger\",\n\t\t\t\tclass:\n\t\t\t\t\t\"border-transparent text-danger-600 hover:bg-danger-500/10 hover:text-danger-700 focus-visible:ring-focus-danger active:bg-danger-500/15 active:text-danger-700\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tappearance: \"outlined\",\n\t\t\t\tpriority: \"danger\",\n\t\t\t\tclass:\n\t\t\t\t\t\"border-danger-600 bg-form text-danger-600 hover:border-danger-700 hover:bg-danger-500/10 hover:text-danger-700 focus-visible:ring-focus-danger active:border-danger-700 active:bg-danger-500/15 active:text-danger-700\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tappearance: \"filled\",\n\t\t\t\tpriority: \"danger\",\n\t\t\t\tclass:\n\t\t\t\t\t\"border-transparent bg-filled-danger hover:bg-filled-danger-hover focus-visible:border-danger-600 focus-visible:ring-focus-danger active:bg-filled-danger-active\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tappearance: \"link\",\n\t\t\t\tpriority: \"danger\",\n\t\t\t\tclass: \"text-danger-600 focus-visible:ring-focus-danger\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tappearance: \"ghost\",\n\t\t\t\tpriority: \"neutral\",\n\t\t\t\tclass:\n\t\t\t\t\t\"border-transparent text-strong hover:bg-neutral-500/10 hover:text-strong focus-visible:ring-focus-accent active:bg-neutral-500/15 active:text-strong\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tappearance: \"outlined\",\n\t\t\t\tpriority: \"neutral\",\n\t\t\t\tclass:\n\t\t\t\t\t\"border-form bg-form text-strong hover:border-neutral-400 hover:bg-form-hover hover:text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent active:border-neutral-400 active:bg-neutral-500/10 active:text-strong focus-visible:active:border-accent-600\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tappearance: \"filled\",\n\t\t\t\tpriority: \"neutral\",\n\t\t\t\tclass:\n\t\t\t\t\t\"border-transparent bg-filled-neutral hover:bg-filled-neutral-hover focus-visible:border-neutral-600 focus-visible:ring-focus-neutral active:bg-filled-neutral-active\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tappearance: \"link\",\n\t\t\t\tpriority: \"neutral\",\n\t\t\t\tclass: \"text-strong focus-visible:ring-focus-accent\",\n\t\t\t},\n\t\t],\n\t},\n);\n\ntype ButtonVariants = VariantProps<typeof buttonVariants>;\n\n/**\n * The props for the `Button` component.\n */\ntype ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n\tWithAsChild &\n\tButtonVariants & {\n\t\t/**\n\t\t * An icon to render inside the button. If the `state` is `\"pending\"`, then\n\t\t * the icon will automatically be replaced with a spinner.\n\t\t */\n\t\ticon?: ReactNode;\n\t};\n\n/**\n * Renders a button or a component that looks like a button, an interactive\n * element activated by a user with a mouse, keyboard, finger, voice command, or\n * other assistive technology. Once activated, it then performs an action, such\n * as submitting a form or opening a dialog.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button\n */\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t(\n\t\t{\n\t\t\t\"aria-disabled\": _ariaDisabled,\n\t\t\tappearance = \"outlined\",\n\t\t\tasChild = false,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\ticon: propIcon,\n\t\t\ticonPlacement = \"start\",\n\t\t\tisLoading = false,\n\t\t\tonClickCapture,\n\t\t\tpriority = \"default\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ariaDisabled = _ariaDisabled ?? isLoading;\n\t\tconst icon = isLoading ? <CircleNotch className=\"animate-spin\" /> : propIcon;\n\n\t\tconst _onClickCapture = (event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (isLoading) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t\tonClickCapture?.(event);\n\t\t};\n\n\t\tconst buttonProps = {\n\t\t\t\"aria-disabled\": ariaDisabled,\n\t\t\tclassName: cx(\n\t\t\t\tbuttonVariants({ appearance, priority, isLoading, iconPlacement: icon ? iconPlacement : undefined }),\n\t\t\t\tclassName,\n\t\t\t),\n\t\t\t\"data-loading\": isLoading,\n\t\t\tonClickCapture: _onClickCapture,\n\t\t\tref,\n\t\t\t...props,\n\t\t};\n\n\t\tif (asChild) {\n\t\t\tconst singleChild = Children.only(children);\n\t\t\tinvariant(\n\t\t\t\tisValidElement<ButtonProps>(singleChild),\n\t\t\t\t\"When using `asChild`, Button must be passed a single child as a JSX tag.\",\n\t\t\t);\n\t\t\tconst grandchildren = singleChild.props?.children;\n\n\t\t\treturn (\n\t\t\t\t<Slot {...buttonProps}>\n\t\t\t\t\t{cloneElement(\n\t\t\t\t\t\tsingleChild,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t<InnerContent appearance={appearance} icon={icon} iconPlacement={iconPlacement}>\n\t\t\t\t\t\t\t{grandchildren}\n\t\t\t\t\t\t</InnerContent>,\n\t\t\t\t\t)}\n\t\t\t\t</Slot>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<button {...buttonProps}>\n\t\t\t\t<InnerContent appearance={appearance} icon={icon} iconPlacement={iconPlacement}>\n\t\t\t\t\t{children}\n\t\t\t\t</InnerContent>\n\t\t\t</button>\n\t\t);\n\t},\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\nexport type { ButtonProps };\n\ntype InnerContentProps = PropsWithChildren & Pick<ButtonProps, \"appearance\" | \"icon\" | \"iconPlacement\">;\n\nconst InnerContent = ({ appearance, children, icon, iconPlacement }: InnerContentProps) => (\n\t<span\n\t\tclassName={clsx(\n\t\t\t\"inline-flex items-center gap-1.5 focus-within:outline-none focus-visible:outline-none\",\n\t\t\tappearance === \"link\" && \"group-hover:underline\",\n\t\t)}\n\t>\n\t\t{icon && <Icon svg={icon} className={clsx(iconPlacement === \"end\" && \"order-last\")} />}\n\t\t{children}\n\t</span>\n);\n","import { CircleNotch } from \"@phosphor-icons/react/CircleNotch\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport { ButtonHTMLAttributes, Children, cloneElement, forwardRef, isValidElement, MouseEvent, ReactNode } from \"react\";\nimport { cx } from \"../../cx\";\nimport { Icon } from \"../../icon\";\nimport type { VariantProps, WithAsChild } from \"../../types\";\n\nconst iconButtonVariants = cva(\n\t\"inline-flex items-center justify-center rounded-md border focus-within:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50\",\n\t{\n\t\tvariants: {\n\t\t\t/**\n\t\t\t * Defines the visual style of the Button.\n\t\t\t */\n\t\t\tappearance: {\n\t\t\t\tghost:\n\t\t\t\t\t\"border-transparent text-strong hover:bg-neutral-500/10 hover:text-strong focus-visible:ring-focus-accent active:bg-neutral-500/15 active:text-strong\",\n\t\t\t\toutlined:\n\t\t\t\t\t\"border-form bg-form text-strong hover:border-neutral-400 hover:bg-form-hover hover:text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent active:border-neutral-400 active:bg-neutral-500/10 active:text-strong focus-visible:active:border-accent-600\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether or not the button is in a loading state, default `false`. Setting `isLoading` will\n\t\t\t * replace the `icon` with a spinner.\n\t\t\t * It will also disable user interaction with the button and set `aria-disabled`.\n\t\t\t */\n\t\t\tisLoading: {\n\t\t\t\tfalse: \"\",\n\t\t\t\ttrue: \"opacity-50\",\n\t\t\t},\n\t\t\t/**\n\t\t\t * The size of the IconButton.\n\t\t\t */\n\t\t\tsize: {\n\t\t\t\txs: \"size-7 sm:size-6\",\n\t\t\t\tsm: \"size-9 sm:size-7\",\n\t\t\t\tmd: \"size-11 sm:size-9\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tappearance: \"outlined\",\n\t\t\tsize: \"md\",\n\t\t},\n\t},\n);\n\ntype IconButtonVariants = VariantProps<typeof iconButtonVariants>;\n\n/**\n * The props for the `Button` component.\n */\ntype IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n\tWithAsChild &\n\tIconButtonVariants & {\n\t\t/**\n\t\t * The accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags.\n\t\t */\n\t\tlabel: string;\n\t\t/**\n\t\t * An icon to render inside the button. If the `state` is `\"pending\"`, then\n\t\t * the icon will automatically be replaced with a spinner.\n\t\t */\n\t\ticon: ReactNode;\n\t};\n\n/**\n * Renders a button or a component that looks like a button, an interactive\n * element activated by a user with a mouse, keyboard, finger, voice command, or\n * other assistive technology. Once activated, it then performs an action, such\n * as submitting a form or opening a dialog.\n * Renders only a single icon as children with an accessible, screen-reader-only label.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button\n */\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n\t(\n\t\t{\n\t\t\t\"aria-disabled\": _ariaDisabled,\n\t\t\tappearance,\n\t\t\tasChild = false,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tisLoading = false,\n\t\t\ticon: propIcon,\n\t\t\tlabel,\n\t\t\tonClickCapture,\n\t\t\tsize,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ariaDisabled = _ariaDisabled ?? isLoading;\n\n\t\tconst _onClickCapture = (event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (isLoading) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t\tonClickCapture?.(event);\n\t\t};\n\n\t\tconst buttonProps = {\n\t\t\t\"aria-disabled\": ariaDisabled,\n\t\t\tclassName: cx(iconButtonVariants({ appearance, isLoading, size }), className),\n\t\t\t\"data-loading\": isLoading,\n\t\t\tonClickCapture: _onClickCapture,\n\t\t\tref,\n\t\t\t...props,\n\t\t};\n\n\t\tif (asChild) {\n\t\t\tconst singleChild = Children.only(children);\n\t\t\tconst isValidChild = isValidElement(singleChild);\n\t\t\tconst icon = isLoading ? <CircleNotch className=\"animate-spin\" /> : propIcon;\n\n\t\t\treturn <Slot {...buttonProps}>{isValidChild && cloneElement(singleChild, {}, <Icon svg={icon} />)}</Slot>;\n\t\t}\n\n\t\tconst icon = isLoading ? <CircleNotch className=\"animate-spin\" /> : propIcon;\n\n\t\treturn (\n\t\t\t<button {...buttonProps}>\n\t\t\t\t<span className=\"sr-only\">{label}</span>\n\t\t\t\t<Icon svg={icon} />\n\t\t\t</button>\n\t\t);\n\t},\n);\nIconButton.displayName = \"IconButton\";\n\nexport { IconButton };\nexport type { IconButtonProps };\n"]}
|
package/dist/chunk-ROHPZJ5N.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkD3F6KEREcjs = require('./chunk-D3F6KERE.cjs');var _reactseparator = require('@radix-ui/react-separator'); var a = _interopRequireWildcard(_reactseparator);var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var e=_react.forwardRef.call(void 0, ({className:i,orientation:r="horizontal",decorative:o=!0,...p},m)=>_jsxruntime.jsx.call(void 0, a.Root,{ref:m,"aria-orientation":o?void 0:r,decorative:o,orientation:r,className:_chunkD3F6KEREcjs.a.call(void 0, "shrink-0 bg-gray-500/20 dark-high-contrast:bg-black high-contrast:bg-black dark:bg-gray-600/20",r==="horizontal"?"h-px w-full":"h-full w-px",i),...p}));e.displayName="Separator";exports.a = e;
|
|
2
|
-
//# sourceMappingURL=chunk-ROHPZJ5N.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/separator/src/separator.tsx"],"names":["SeparatorPrimitive","forwardRef","jsx","Separator","className","orientation","decorative","props","ref","cx"],"mappings":"yCAAA,UAAYA,MAAwB,4BACpC,OAAS,cAAAC,MAAkB,QAW1B,cAAAC,MAAA,oBAJD,IAAMC,EAAYF,EAGhB,CAAC,CAAE,UAAAG,EAAW,YAAAC,EAAc,aAAc,WAAAC,EAAa,GAAM,GAAGC,CAAM,EAAGC,IAC1EN,EAAoB,OAAnB,CACA,IAAKM,EACL,mBAAkBF,EAAa,OAAYD,EAC3C,WAAYC,EACZ,YAAaD,EACb,UAAWI,EACV,iGACAJ,IAAgB,aAAe,cAAgB,cAC/CD,CACD,EACC,GAAGG,EACL,CACA,EACDJ,EAAU,YAAc","sourcesContent":["import * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cx } from \"../../cx\";\n\n/**\n * Visually or semantically separates content.\n */\nconst Separator = forwardRef<\n\tElementRef<typeof SeparatorPrimitive.Root>,\n\tComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n\t<SeparatorPrimitive.Root\n\t\tref={ref}\n\t\taria-orientation={decorative ? undefined : orientation}\n\t\tdecorative={decorative}\n\t\torientation={orientation}\n\t\tclassName={cx(\n\t\t\t\"shrink-0 bg-gray-500/20 dark-high-contrast:bg-black high-contrast:bg-black dark:bg-gray-600/20\",\n\t\t\torientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nSeparator.displayName = \"Separator\";\n\nexport { Separator };\n"]}
|
package/dist/code-block.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkD3F6KEREcjs = require('./chunk-D3F6KERE.cjs');var _reactslot = require('@radix-ui/react-slot');var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);var _react = require('react');require('prismjs/components/prism-bash.js');require('prismjs/components/prism-csharp.js');require('prismjs/components/prism-css.js');require('prismjs/components/prism-go.js');require('prismjs/components/prism-java.js');require('prismjs/components/prism-javascript.js');require('prismjs/components/prism-json.js');require('prismjs/components/prism-jsx.js');require('prismjs/components/prism-markup.js');require('prismjs/components/prism-python.js');require('prismjs/components/prism-ruby.js');require('prismjs/components/prism-rust.js');require('prismjs/components/prism-tsx.js');require('prismjs/components/prism-typescript.js');require('prismjs/components/prism-yaml.js');var _CaretDown = require('@phosphor-icons/react/CaretDown');var _Check = require('@phosphor-icons/react/Check');var _Copy = require('@phosphor-icons/react/Copy');var _usehooks = require('@uidotdev/usehooks');var _tinyinvariant = require('tiny-invariant'); var _tinyinvariant2 = _interopRequireDefault(_tinyinvariant);var b=["bash","cs","csharp","css","dotnet","go","html","java","javascript","js","json","jsx","markup","plain","plaintext","py","python","rb","ruby","rust","sh","shell","text","ts","tsx","txt","typescript","xml","yaml","yml"];function $(e){if(!e)return"sh";let o=e.trim().slice(e.indexOf("-")+1);return S(o)?o:"sh"}var S=e=>typeof e=="string"&&b.includes(e);function L(e="sh"){return`language-${_nullishCoalesce(e, () => ("sh"))}`}var _jsxruntime = require('react/jsx-runtime');var B=_react.createContext.call(void 0, {codeId:void 0,copyText:"",hasCodeExpander:!1,isCodeExpanded:!1,registerCodeId:()=>{},setCopyText:()=>{},setHasCodeExpander:()=>{},setIsCodeExpanded:()=>{},unregisterCodeId:()=>{}}),H= exports.CodeBlock =_react.forwardRef.call(void 0, ({className:e,...o},r)=>{let[t,a]=_react.useState.call(void 0, ""),[n,i]=_react.useState.call(void 0, !1),[s,c]=_react.useState.call(void 0, !1),[d,f]=_react.useState.call(void 0, void 0),h=_react.useMemo.call(void 0, ()=>({codeId:d,copyText:t,hasCodeExpander:n,isCodeExpanded:s,registerCodeId:p=>{f(C=>(_tinyinvariant2.default.call(void 0, C==null,"You can only render a single CodeBlockCode within a CodeBlock."),p))},setCopyText:a,setHasCodeExpander:i,setIsCodeExpanded:c,unregisterCodeId:p=>{f(C=>{_tinyinvariant2.default.call(void 0, C===p,"You can only render a single CodeBlockCode within a CodeBlock.")})}}),[d,t,n,s]);return _jsxruntime.jsx.call(void 0, B.Provider,{value:h,children:_jsxruntime.jsx.call(void 0, "div",{className:_chunkD3F6KEREcjs.a.call(void 0, "overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono text-[0.8125rem]",e),ref:r,...o})})});H.displayName="CodeBlock";var I=_react.forwardRef.call(void 0, ({className:e,...o},r)=>_jsxruntime.jsx.call(void 0, "div",{className:_chunkD3F6KEREcjs.a.call(void 0, "relative",e),ref:r,...o}));I.displayName="CodeBlockBody";var N=_react.forwardRef.call(void 0, (e,o)=>{let{className:r,language:t="text",style:a,value:n}=e,i=_react.useId.call(void 0, ),{hasCodeExpander:s,isCodeExpanded:c,registerCodeId:d,setCopyText:f,unregisterCodeId:h}=_react.useContext.call(void 0, B),p=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()]), () => ("")),[C,j]=_react.useState.call(void 0, p);return _react.useEffect.call(void 0, ()=>{let E=_prismjs2.default.languages[t];_tinyinvariant2.default.call(void 0, E,`CodeBlock does not support the language "${t}". The syntax highlighter does not have a grammar for this language. The supported languages are: ${b.join(", ")}.`);let z=_prismjs2.default.highlight(p,E,t);j(z)},[p,t]),_react.useEffect.call(void 0, ()=>{f(p)},[p,f]),_react.useEffect.call(void 0, ()=>(d(i),()=>{h(i)}),[i,d,h]),_jsxruntime.jsx.call(void 0, "pre",{"aria-expanded":s?c:void 0,className:_chunkD3F6KEREcjs.a.call(void 0, L(t),"scrollbar overflow-x-auto overflow-y-hidden p-4 pr-[3.375rem] firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-['']","aria-collapsed:max-h-[13.6rem]",r),"data-lang":t,id:i,ref:o,style:{...a,tabSize:2,MozTabSize:2},children:_jsxruntime.jsx.call(void 0, "code",{dangerouslySetInnerHTML:{__html:C}})})});N.displayName="CodeBlockCode";var A=_react.forwardRef.call(void 0, ({className:e,...o},r)=>_jsxruntime.jsx.call(void 0, "div",{className:_chunkD3F6KEREcjs.a.call(void 0, "flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700",e),ref:r,...o}));A.displayName="CodeBlockHeader";var P=_react.forwardRef.call(void 0, ({asChild:e=!1,className:o,...r},t)=>_jsxruntime.jsx.call(void 0, e?_reactslot.Slot:"h3",{ref:t,className:_chunkD3F6KEREcjs.a.call(void 0, "font-mono text-[0.8125rem] font-normal",o),...r}));P.displayName="CodeBlockTitle";var D=_react.forwardRef.call(void 0, ({className:e,onCopy:o,onCopyError:r,style:t},a)=>{let{copyText:n}=_react.useContext.call(void 0, B),[,i]=_usehooks.useCopyToClipboard.call(void 0, ),[s,c]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(s){let d=window.setTimeout(()=>{c(!1)},2e3);return()=>{clearTimeout(d)}}},[s]),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:_chunkD3F6KEREcjs.a.call(void 0, "absolute right-3 top-3 z-10 flex h-7 w-7 items-center justify-center rounded border border-gray-300 bg-gray-50 shadow-[-1rem_0_0.75rem_-0.375rem_hsl(var(--gray-50)),1rem_0_0_-0.25rem_hsl(var(--gray-50))] hover:border-gray-400 hover:bg-gray-200 focus-visible:border-accent-600 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-focus-accent",s&&"w-auto gap-1 border-transparent bg-filled-success pl-2 pr-1.5 text-on-filled hover:border-transparent hover:bg-filled-success focus:bg-filled-success focus-visible:border-success-600 focus-visible:ring-focus-success",e),ref:a,style:t,onClick:async()=>{try{await i(n),_optionalChain([o, 'optionalCall', _4 => _4(n)]),c(!0)}catch(d){_optionalChain([r, 'optionalCall', _5 => _5(d)])}},children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Copy code"}),s?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:["Copied",_jsxruntime.jsx.call(void 0, _Check.Check,{className:"h-4 w-4",weight:"bold"})]}):_jsxruntime.jsx.call(void 0, _Copy.Copy,{className:"-ml-px h-5 w-5"})]})});D.displayName="CodeBlockCopyButton";var _=_react.forwardRef.call(void 0, ({className:e,onClick:o,...r},t)=>{let{codeId:a,isCodeExpanded:n,setIsCodeExpanded:i,setHasCodeExpander:s}=_react.useContext.call(void 0, B);return _react.useEffect.call(void 0, ()=>(s(!0),()=>{s(!1)}),[s]),_jsxruntime.jsxs.call(void 0, "button",{...r,"aria-controls":a,"aria-expanded":n,className:_chunkD3F6KEREcjs.a.call(void 0, "flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-gray-50 px-4 py-2 font-sans text-gray-700 hover:bg-gray-100",e),ref:t,type:"button",onClick:c=>{i(d=>!d),_optionalChain([o, 'optionalCall', _6 => _6(c)])},children:[n?"Show less":"Show more"," ",_jsxruntime.jsx.call(void 0, _CaretDown.CaretDown,{className:_chunkD3F6KEREcjs.a.call(void 0, "h-4 w-4",n&&"rotate-180","transition-all duration-150"),weight:"bold"})]})});_.displayName="CodeBlockExpanderButton";function G(e,...o){if(!U(e)||!Array.isArray(o))throw new Error("It looks like you tried to call `fmtCode` as a function. Make sure to use it as a tagged template.\n Example: fmtCode`SELECT * FROM users`, not fmtCode('SELECT * FROM users')");let r=String.raw({raw:e},...o),t=K(r);return r.trim().split(`
|
|
2
|
-
`).map(n=>/^\S+/.test(n)?n:n.slice(t)).join(`
|
|
3
|
-
`)}function K(e){let o=e.match(/^[ \t]*(?=\S)/gm);return o?o.reduce((r,t)=>Math.min(r,t.length),1/0):0}function U(e){return Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw)}var _zod = require('zod');var X=["file","cli"],Z=_zod.z.object({collapsible:_zod.z.boolean().default(!1),disableCopy:_zod.z.boolean().default(!1),mode:_zod.z.enum(X).optional(),title:_zod.z.string().trim().optional()}),k= exports.defaultMeta ={collapsible:!1,disableCopy:!1,mode:void 0,title:void 0};function ee(e){let o=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()]), () => (""));if(!o)return k;let r=oe(o).reduce((t,a)=>{let[n,i]=a.split("=");if(!n)return t;let s=te(i);return t[n]=_nullishCoalesce(s, () => (!0)),t},{});try{let t=Z.parse(r);return{...k,...t}}catch (e2){return k}}function te(e){return _optionalChain([e, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10(), 'access', _11 => _11.replace, 'call', _12 => _12(/^"(.*)"$/,"$1")])}function oe(e){let o=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ("")),r=[],t="",a=!1;for(let n of o)n===" "&&!a?t&&(r.push(t),t=""):(n==='"'&&(a=!a),t+=n);return t&&r.push(t),r}exports.CodeBlock = H; exports.CodeBlockBody = I; exports.CodeBlockCode = N; exports.CodeBlockCopyButton = D; exports.CodeBlockExpanderButton = _; exports.CodeBlockHeader = A; exports.CodeBlockTitle = P; exports.defaultMeta = k; exports.fmtCode = G; exports.formatLanguageClassName = L; exports.isSupportedLanguage = S; exports.parseLanguage = $; exports.parseMetastring = ee; exports.supportedLanguages = b;
|
|
4
|
-
//# sourceMappingURL=code-block.cjs.map
|
package/dist/code-block.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/code-block/src/code-block.tsx","../packages/code-block/src/supported-languages.ts","../packages/code-block/src/fmt-code.ts","../packages/code-block/src/parse-metastring.ts"],"names":["Slot","Prism","createContext","forwardRef","useContext","useEffect","useId","useMemo","useState","CaretDown","Check","Copy","useCopyToClipboard","assert","supportedLanguages","parseLanguage","value","maybeLanguage","isSupportedLanguage","formatLanguageClassName","language","Fragment","jsx","jsxs","CodeBlockContext","CodeBlock","className","props","ref","copyText","setCopyText","hasCodeExpander","setHasCodeExpander","isCodeExpanded","setIsCodeExpanded","codeId","setCodeId","context","id","old","cx","CodeBlockBody","CodeBlockCode","style","registerCodeId","unregisterCodeId","trimmedCode","highlightedCodeInnerHtml","setHighlightedCodeInnerHtml","grammar","newHighlightedCodeInnerHtml","CodeBlockHeader","CodeBlockTitle","asChild","CodeBlockCopyButton","onCopy","onCopyError","copyToClipboard","copied","setCopied","timeoutId","error","CodeBlockExpanderButton","onClick","event","prev","fmtCode","strings","values","isTemplateStringsArray","text","minIndent","findMinIndent","line","match","acc","curr","z","modes","metaSchema","defaultMeta","parseMetastring","metastring","metaJson","tokenizeMetastring","token","key","_value","normalizeValue","parsed","input","result","currentString","inQuotes","char"],"mappings":"yCAAA,OAAS,QAAAA,MAAY,uBACrB,OAAOC,MAAW,UAClB,OACC,iBAAAC,EAEA,cAAAC,EAGA,cAAAC,EACA,aAAAC,EACA,SAAAC,EACA,WAAAC,EACA,YAAAC,MACM,QACP,MAAO,mCACP,MAAO,mCACP,MAAO,qCACP,MAAO,kCACP,MAAO,iCACP,MAAO,mCACP,MAAO,yCACP,MAAO,mCACP,MAAO,kCACP,MAAO,qCACP,MAAO,qCACP,MAAO,mCACP,MAAO,mCACP,MAAO,kCACP,MAAO,yCACP,MAAO,mCACP,OAAS,aAAAC,MAAiB,kCAC1B,OAAS,SAAAC,MAAa,8BACtB,OAAS,QAAAC,MAAY,6BACrB,OAAS,sBAAAC,MAA0B,qBACnC,OAAOC,MAAY,iBC9BZ,IAAMC,EAAqB,CACjC,OACA,KACA,SACA,MACA,SACA,KACA,OACA,OACA,aACA,KACA,OACA,MACA,SACA,QACA,YACA,KACA,SACA,KACA,OACA,OACA,KACA,QACA,OACA,KACA,MACA,MACA,aACA,MACA,OACA,KACD,EAWA,SAASC,EAAcC,EAA+F,CACrH,GAAI,CAACA,EACJ,MAAO,KAKR,IAAMC,EAAgBD,EAAM,KAAK,EAAE,MAAMA,EAAM,QAAQ,GAAG,EAAI,CAAC,EAE/D,OAAOE,EAAoBD,CAAa,EAAIA,EAAgB,IAC7D,CAKA,IAAMC,EAAuBF,GACrB,OAAOA,GAAU,UAAYF,EAAmB,SAASE,CAA0B,EAY3F,SAASG,EAAwBC,EAA0C,KAAM,CAGhF,MADiC,YADpBA,GAAY,IACwB,EAElD,CD4BG,OAkKE,Y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AO,KAAKC,CAAa,EACzBA,EAAgB,KAEPE,IAAS,MACnBD,EAAW,CAACA,GACZD,GAAiBE,GAMnB,OAAIF,GACHD,EAAO,KAAKC,CAAa,EAGnBD,CACR","sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport Prism from \"prismjs\";\nimport {\n\tcreateContext,\n\tDispatch,\n\tforwardRef,\n\tHTMLAttributes,\n\tSetStateAction,\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseMemo,\n\tuseState,\n} from \"react\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-csharp.js\";\nimport \"prismjs/components/prism-css.js\";\nimport \"prismjs/components/prism-go.js\";\nimport \"prismjs/components/prism-java.js\";\nimport \"prismjs/components/prism-javascript.js\";\nimport \"prismjs/components/prism-json.js\";\nimport \"prismjs/components/prism-jsx.js\";\nimport \"prismjs/components/prism-markup.js\";\nimport \"prismjs/components/prism-python.js\";\nimport \"prismjs/components/prism-ruby.js\";\nimport \"prismjs/components/prism-rust.js\";\nimport \"prismjs/components/prism-tsx.js\";\nimport \"prismjs/components/prism-typescript.js\";\nimport \"prismjs/components/prism-yaml.js\";\nimport { CaretDown } from \"@phosphor-icons/react/CaretDown\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport { Copy } from \"@phosphor-icons/react/Copy\";\nimport { useCopyToClipboard } from \"@uidotdev/usehooks\";\nimport assert from \"tiny-invariant\";\nimport { cx } from \"../../cx\";\nimport type { WithStyleProps } from \"../../types/src/with-style-props\";\nimport { LineRange } from \"./line-numbers\";\nimport { formatLanguageClassName, supportedLanguages } from \"./supported-languages\";\nimport type { SupportedLanguage } from \"./supported-languages\";\n\n/**\n * TODO(cody):\n * - fix line numbers, maybe try grid instead of :before and flex?\n * - fix line hightlighting\n * - fix line wrapping? horizontal scrolling has problems w/ line highlighting :(\n */\n\ntype CodeBlockContextType = {\n\tcodeId: string | undefined;\n\tcopyText: string;\n\thasCodeExpander: boolean;\n\tisCodeExpanded: boolean;\n\tregisterCodeId: (id: string) => void;\n\tsetCopyText: (newCopyText: string) => void;\n\tsetHasCodeExpander: (value: boolean) => void;\n\tsetIsCodeExpanded: Dispatch<SetStateAction<boolean>>;\n\tunregisterCodeId: (id: string) => void;\n};\n\nconst CodeBlockContext = createContext<CodeBlockContextType>({\n\tcodeId: undefined,\n\tcopyText: \"\",\n\thasCodeExpander: false,\n\tisCodeExpanded: false,\n\tregisterCodeId: () => {},\n\tsetCopyText: () => {},\n\tsetHasCodeExpander: () => {},\n\tsetIsCodeExpanded: () => {},\n\tunregisterCodeId: () => {},\n});\n\nconst CodeBlock = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {\n\tconst [copyText, setCopyText] = useState(\"\");\n\tconst [hasCodeExpander, setHasCodeExpander] = useState(false);\n\tconst [isCodeExpanded, setIsCodeExpanded] = useState(false);\n\tconst [codeId, setCodeId] = useState<string | undefined>(undefined);\n\n\tconst context: CodeBlockContextType = useMemo(\n\t\t() =>\n\t\t\t({\n\t\t\t\tcodeId,\n\t\t\t\tcopyText,\n\t\t\t\thasCodeExpander,\n\t\t\t\tisCodeExpanded,\n\t\t\t\tregisterCodeId: (id) => {\n\t\t\t\t\tsetCodeId((old) => {\n\t\t\t\t\t\tassert(old == null, \"You can only render a single CodeBlockCode within a CodeBlock.\");\n\t\t\t\t\t\treturn id;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsetCopyText,\n\t\t\t\tsetHasCodeExpander,\n\t\t\t\tsetIsCodeExpanded,\n\t\t\t\tunregisterCodeId: (id) => {\n\t\t\t\t\tsetCodeId((old) => {\n\t\t\t\t\t\tassert(old === id, \"You can only render a single CodeBlockCode within a CodeBlock.\");\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}) as const,\n\t\t[codeId, copyText, hasCodeExpander, isCodeExpanded],\n\t);\n\n\treturn (\n\t\t<CodeBlockContext.Provider value={context}>\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono text-[0.8125rem]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</CodeBlockContext.Provider>\n\t);\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nconst CodeBlockBody = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (\n\t<div className={cx(\"relative\", className)} ref={ref} {...props} />\n));\nCodeBlockBody.displayName = \"CodeBlockBody\";\n\ntype CodeBlockCodeProps = WithStyleProps & {\n\t/**\n\t * The code to display in the code block. Should be code formatted as a string. This code will be passed to our syntax highlighter.\n\t */\n\tvalue: string;\n\t/**\n\t * @todo not implemented yet\n\t */\n\thighlightLines?: (LineRange | number)[];\n\t/**\n\t * The language of the code block. This will be used to determine how to syntax highlight the code. @default `\"text\"`.\n\t */\n\tlanguage?: SupportedLanguage;\n\t/**\n\t * @todo not implemented yet\n\t */\n\tshowLineNumbers?: boolean;\n};\n\nconst CodeBlockCode = forwardRef<HTMLPreElement, CodeBlockCodeProps>((props, ref) => {\n\tconst { className, language = \"text\", style, value } = props;\n\tconst id = useId();\n\tconst { hasCodeExpander, isCodeExpanded, registerCodeId, setCopyText, unregisterCodeId } =\n\t\tuseContext(CodeBlockContext);\n\n\t// trim any leading and trailing whitespace/empty lines\n\tconst trimmedCode = value?.trim() ?? \"\";\n\tconst [highlightedCodeInnerHtml, setHighlightedCodeInnerHtml] = useState(trimmedCode);\n\n\tuseEffect(() => {\n\t\tconst grammar = Prism.languages[language];\n\t\tassert(\n\t\t\tgrammar,\n\t\t\t`CodeBlock does not support the language \"${language}\". The syntax highlighter does not have a grammar for this language. The supported languages are: ${supportedLanguages.join(\", \")}.`,\n\t\t);\n\t\tconst newHighlightedCodeInnerHtml = Prism.highlight(trimmedCode, grammar, language);\n\t\tsetHighlightedCodeInnerHtml(newHighlightedCodeInnerHtml);\n\t}, [trimmedCode, language]);\n\n\tuseEffect(() => {\n\t\tsetCopyText(trimmedCode);\n\t}, [trimmedCode, setCopyText]);\n\n\tuseEffect(() => {\n\t\tregisterCodeId(id);\n\n\t\treturn () => {\n\t\t\tunregisterCodeId(id);\n\t\t};\n\t}, [id, registerCodeId, unregisterCodeId]);\n\n\treturn (\n\t\t<pre\n\t\t\taria-expanded={hasCodeExpander ? isCodeExpanded : undefined}\n\t\t\tclassName={cx(\n\t\t\t\tformatLanguageClassName(language),\n\t\t\t\t\"scrollbar overflow-x-auto overflow-y-hidden p-4 pr-[3.375rem] firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-['']\",\n\t\t\t\t\"aria-collapsed:max-h-[13.6rem]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdata-lang={language}\n\t\t\tid={id}\n\t\t\tref={ref}\n\t\t\tstyle={{\n\t\t\t\t...style,\n\t\t\t\ttabSize: 2,\n\t\t\t\tMozTabSize: 2,\n\t\t\t}}\n\t\t>\n\t\t\t<code dangerouslySetInnerHTML={{ __html: highlightedCodeInnerHtml }} />\n\t\t</pre>\n\t);\n});\nCodeBlockCode.displayName = \"CodeBlockCode\";\n\nconst CodeBlockHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (\n\t<div\n\t\tclassName={cx(\"flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700\", className)}\n\t\tref={ref}\n\t\t{...props}\n\t/>\n));\nCodeBlockHeader.displayName = \"CodeBlockHeader\";\n\nconst CodeBlockTitle = forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement> & { asChild?: boolean }>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"h3\";\n\t\treturn <Comp ref={ref} className={cx(\"font-mono text-[0.8125rem] font-normal\", className)} {...props} />;\n\t},\n);\nCodeBlockTitle.displayName = \"CodeBlockTitle\";\n\ntype CodeBlockCopyButtonProps = WithStyleProps & {\n\t/**\n\t * Callback fired when the copy button is clicked, passes the copied text as an argument.\n\t */\n\tonCopy?: (value: string) => void;\n\t/**\n\t * Callback fired when an error occurs during copying.\n\t */\n\tonCopyError?: (error: unknown) => void;\n};\n\nconst CodeBlockCopyButton = forwardRef<HTMLButtonElement, CodeBlockCopyButtonProps>(\n\t({ className, onCopy, onCopyError, style }, ref) => {\n\t\tconst { copyText } = useContext(CodeBlockContext);\n\t\tconst [, copyToClipboard] = useCopyToClipboard();\n\t\tconst [copied, setCopied] = useState(false);\n\n\t\tuseEffect(() => {\n\t\t\tif (copied) {\n\t\t\t\tconst timeoutId = window.setTimeout(() => {\n\t\t\t\t\tsetCopied(false);\n\t\t\t\t}, 2000);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t};\n\t\t\t}\n\t\t}, [copied]);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"absolute right-3 top-3 z-10 flex h-7 w-7 items-center justify-center rounded border border-gray-300 bg-gray-50 shadow-[-1rem_0_0.75rem_-0.375rem_hsl(var(--gray-50)),1rem_0_0_-0.25rem_hsl(var(--gray-50))] hover:border-gray-400 hover:bg-gray-200 focus-visible:border-accent-600 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-focus-accent\",\n\t\t\t\t\tcopied &&\n\t\t\t\t\t\t\"w-auto gap-1 border-transparent bg-filled-success pl-2 pr-1.5 text-on-filled hover:border-transparent hover:bg-filled-success focus:bg-filled-success focus-visible:border-success-600 focus-visible:ring-focus-success\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\tstyle={style}\n\t\t\t\tonClick={async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait copyToClipboard(copyText);\n\t\t\t\t\t\tonCopy?.(copyText);\n\t\t\t\t\t\tsetCopied(true);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tonCopyError?.(error);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span className=\"sr-only\">Copy code</span>\n\t\t\t\t{copied ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\tCopied\n\t\t\t\t\t\t<Check className=\"h-4 w-4\" weight=\"bold\" />\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<Copy className=\"-ml-px h-5 w-5\" />\n\t\t\t\t)}\n\t\t\t</button>\n\t\t);\n\t},\n);\nCodeBlockCopyButton.displayName = \"CodeBlockCopyButton\";\n\ntype CodeBlockExpanderButtonProps = Omit<\n\tHTMLAttributes<HTMLButtonElement>,\n\t\"children\" | \"aria-controls\" | \"aria-expanded\"\n>;\n\nconst CodeBlockExpanderButton = forwardRef<HTMLButtonElement, CodeBlockExpanderButtonProps>(\n\t({ className, onClick, ...props }, ref) => {\n\t\tconst { codeId, isCodeExpanded, setIsCodeExpanded, setHasCodeExpander } = useContext(CodeBlockContext);\n\n\t\tuseEffect(() => {\n\t\t\tsetHasCodeExpander(true);\n\n\t\t\treturn () => {\n\t\t\t\tsetHasCodeExpander(false);\n\t\t\t};\n\t\t}, [setHasCodeExpander]);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\t{...props}\n\t\t\t\taria-controls={codeId}\n\t\t\t\taria-expanded={isCodeExpanded}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-gray-50 px-4 py-2 font-sans text-gray-700 hover:bg-gray-100\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tsetIsCodeExpanded((prev) => !prev);\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isCodeExpanded ? \"Show less\" : \"Show more\"}{\" \"}\n\t\t\t\t<CaretDown\n\t\t\t\t\tclassName={cx(\"h-4 w-4\", isCodeExpanded && \"rotate-180\", \"transition-all duration-150\")}\n\t\t\t\t\tweight=\"bold\"\n\t\t\t\t/>\n\t\t\t</button>\n\t\t);\n\t},\n);\nCodeBlockExpanderButton.displayName = \"CodeBlockExpanderButton\";\n\nexport {\n\tCodeBlock,\n\tCodeBlockBody,\n\tCodeBlockCode,\n\tCodeBlockCopyButton,\n\tCodeBlockExpanderButton,\n\tCodeBlockHeader,\n\tCodeBlockTitle,\n};\n","/**\n * List of supported languages for syntax highlighting.\n * @private\n */\nexport const supportedLanguages = [\n\t\"bash\",\n\t\"cs\",\n\t\"csharp\",\n\t\"css\",\n\t\"dotnet\",\n\t\"go\",\n\t\"html\",\n\t\"java\",\n\t\"javascript\",\n\t\"js\",\n\t\"json\",\n\t\"jsx\",\n\t\"markup\",\n\t\"plain\",\n\t\"plaintext\",\n\t\"py\",\n\t\"python\",\n\t\"rb\",\n\t\"ruby\",\n\t\"rust\",\n\t\"sh\",\n\t\"shell\",\n\t\"text\",\n\t\"ts\",\n\t\"tsx\",\n\t\"txt\",\n\t\"typescript\",\n\t\"xml\",\n\t\"yaml\",\n\t\"yml\",\n] as const;\n\n/**\n * Supported languages for syntax highlighting.\n */\ntype SupportedLanguage = (typeof supportedLanguages)[number];\n\n/**\n * Parses a markdown code block (```) language class into a SupportedLanguage.\n * Defaults to \"sh\" if no supported language is found.\n */\nfunction parseLanguage(value: `language-${string}` | `lang-${string}` | (string & {}) | undefined): SupportedLanguage {\n\tif (!value) {\n\t\treturn \"sh\";\n\t}\n\n\t// remove leading \"language-\" and \"lang-\" prefixes\n\t// find first '-' and slice from there\n\tconst maybeLanguage = value.trim().slice(value.indexOf(\"-\") + 1);\n\n\treturn isSupportedLanguage(maybeLanguage) ? maybeLanguage : \"sh\";\n}\n\n/**\n * Type Predicate: checks if an arbitrary value is a supported syntax highlighting language.\n */\nconst isSupportedLanguage = (value: unknown): value is SupportedLanguage => {\n\treturn typeof value === \"string\" && supportedLanguages.includes(value as SupportedLanguage);\n};\n\n/**\n * A class name for a language that Prism.js can understand.\n */\ntype LanguageClass = `language-${SupportedLanguage}`;\n\n/**\n * Formats a language name into a class name that Prism.js can understand.\n * @default \"language-sh\"\n */\nfunction formatLanguageClassName(language: SupportedLanguage | undefined = \"sh\") {\n\tconst lang = language ?? \"sh\";\n\tconst className: LanguageClass = `language-${lang}`;\n\treturn className;\n}\n\nexport { isSupportedLanguage, parseLanguage, formatLanguageClassName };\nexport type { SupportedLanguage };\n","type Primitive = string | number | boolean | undefined | null;\n\n/**\n * Tagged template literal to format code blocks and normalize leading indentation\n */\nexport function fmtCode(strings: TemplateStringsArray, ...values: Primitive[]): string {\n\tif (!isTemplateStringsArray(strings) || !Array.isArray(values)) {\n\t\tthrow new Error(\n\t\t\t\"It looks like you tried to call `fmtCode` as a function. Make sure to use it as a tagged template.\\n\\tExample: fmtCode`SELECT * FROM users`, not fmtCode('SELECT * FROM users')\",\n\t\t);\n\t}\n\n\tconst text = String.raw({ raw: strings }, ...values);\n\n\t// fine the minimum indentation of the code block\n\tconst minIndent = findMinIndent(text);\n\tconst lines = text.trim().split(\"\\n\");\n\n\treturn lines\n\t\t.map((line) => {\n\t\t\t// remove nothing if the line doesn't start with indentation\n\t\t\tif (/^\\S+/.test(line)) {\n\t\t\t\treturn line;\n\t\t\t}\n\t\t\treturn line.slice(minIndent);\n\t\t})\n\t\t.join(\"\\n\");\n\t// replace all tabs with 2 spaces\n\t// .replace(/\\t/g, \" \")\n}\n\n/**\n * Find the shortest indentation of a multiline string\n */\nfunction findMinIndent(value: string): number {\n\tconst match = value.match(/^[ \\t]*(?=\\S)/gm);\n\n\tif (!match) {\n\t\treturn 0;\n\t}\n\n\treturn match.reduce((acc, curr) => Math.min(acc, curr.length), Infinity);\n}\n\n/**\n * Type guard to check if a value is a `TemplateStringsArray`\n */\nfunction isTemplateStringsArray(strings: unknown): strings is TemplateStringsArray {\n\treturn Array.isArray(strings) && \"raw\" in strings && Array.isArray(strings.raw);\n}\n","import { z } from \"zod\";\n\nconst modes = [\"file\", \"cli\"] as const;\ntype Mode = (typeof modes)[number];\n\nconst metaSchema = z.object({\n\tcollapsible: z.boolean().default(false),\n\tdisableCopy: z.boolean().default(false),\n\tmode: z.enum(modes).optional(),\n\ttitle: z.string().trim().optional(),\n});\n\ntype MetaInput = z.input<typeof metaSchema>;\n\ntype Meta = z.infer<typeof metaSchema>;\n\nconst defaultMeta = {\n\tcollapsible: false,\n\tdisableCopy: false,\n\tmode: undefined,\n\ttitle: undefined,\n} as const satisfies Meta;\n\ntype DefaultMeta = typeof defaultMeta;\n\n/**\n * Parses a markdown code block (```) metastring into a meta object.\n * Defaults to DefaultMeta if no metastring given or if metastring is invalid.\n * Useful for parsing the metastring from a markdown code block to pass into the\n * CodeBlock components as props.\n */\nfunction parseMetastring(value: string | undefined): Meta {\n\tconst metastring = value?.trim() ?? \"\";\n\tif (!metastring) {\n\t\treturn defaultMeta;\n\t}\n\n\tconst metaJson = tokenizeMetastring(metastring).reduce<Record<string, unknown>>((acc, token) => {\n\t\tconst [key, _value] = token.split(\"=\");\n\t\tif (!key) {\n\t\t\treturn acc;\n\t\t}\n\t\tconst value = normalizeValue(_value);\n\t\tacc[key] = value ?? true;\n\t\treturn acc;\n\t}, {});\n\n\ttry {\n\t\tconst parsed = metaSchema.parse(metaJson);\n\n\t\t// return the parsed meta object, with default values filled in\n\t\treturn {\n\t\t\t...defaultMeta,\n\t\t\t...parsed,\n\t\t};\n\t} catch (_) {\n\t\treturn defaultMeta;\n\t}\n}\n\nexport { defaultMeta, parseMetastring };\nexport type { Meta, MetaInput, Mode, DefaultMeta };\n\n/**\n * Remove leading and trailing `\"` quotes around value\n * @private\n */\nexport function normalizeValue(value: string | undefined) {\n\treturn value?.trim().replace(/^\"(.*)\"$/, \"$1\");\n}\n\n/**\n * Splits a metastring into an array of tokens that can be parsed into a meta object.\n * Should allow for quotes and spaces in tokens\n * @private\n */\nexport function tokenizeMetastring(value: string | undefined): string[] {\n\tconst input = value?.trim() ?? \"\";\n\tconst result: string[] = [];\n\n\tlet currentString = \"\";\n\tlet inQuotes = false;\n\n\tfor (const char of input) {\n\t\tif (char === \" \" && !inQuotes) {\n\t\t\tif (currentString) {\n\t\t\t\tresult.push(currentString);\n\t\t\t\tcurrentString = \"\";\n\t\t\t}\n\t\t} else if (char === '\"') {\n\t\t\tinQuotes = !inQuotes;\n\t\t\tcurrentString += char;\n\t\t} else {\n\t\t\tcurrentString += char;\n\t\t}\n\t}\n\n\tif (currentString) {\n\t\tresult.push(currentString);\n\t}\n\n\treturn result;\n}\n"]}
|
package/dist/code-block.d.cts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes } from 'react';
|
|
3
|
-
import { W as WithStyleProps } from './with-style-props-VnLWm0Yd.cjs';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
declare const CodeBlock: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
7
|
-
declare const CodeBlockBody: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare const CodeBlockCode: react.ForwardRefExoticComponent<WithStyleProps & {
|
|
9
|
-
/**
|
|
10
|
-
* The code to display in the code block. Should be code formatted as a string. This code will be passed to our syntax highlighter.
|
|
11
|
-
*/
|
|
12
|
-
value: string;
|
|
13
|
-
/**
|
|
14
|
-
* @todo not implemented yet
|
|
15
|
-
*/
|
|
16
|
-
highlightLines?: (number | `${number}-${number}`)[] | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* The language of the code block. This will be used to determine how to syntax highlight the code. @default `"text"`.
|
|
19
|
-
*/
|
|
20
|
-
language?: "bash" | "cs" | "csharp" | "css" | "dotnet" | "go" | "html" | "java" | "javascript" | "js" | "json" | "jsx" | "markup" | "plain" | "plaintext" | "py" | "python" | "rb" | "ruby" | "rust" | "sh" | "shell" | "text" | "ts" | "tsx" | "txt" | "typescript" | "xml" | "yaml" | "yml" | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* @todo not implemented yet
|
|
23
|
-
*/
|
|
24
|
-
showLineNumbers?: boolean | undefined;
|
|
25
|
-
} & react.RefAttributes<HTMLPreElement>>;
|
|
26
|
-
declare const CodeBlockHeader: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
27
|
-
declare const CodeBlockTitle: react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & {
|
|
28
|
-
asChild?: boolean | undefined;
|
|
29
|
-
} & react.RefAttributes<HTMLHeadingElement>>;
|
|
30
|
-
declare const CodeBlockCopyButton: react.ForwardRefExoticComponent<WithStyleProps & {
|
|
31
|
-
/**
|
|
32
|
-
* Callback fired when the copy button is clicked, passes the copied text as an argument.
|
|
33
|
-
*/
|
|
34
|
-
onCopy?: ((value: string) => void) | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Callback fired when an error occurs during copying.
|
|
37
|
-
*/
|
|
38
|
-
onCopyError?: ((error: unknown) => void) | undefined;
|
|
39
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
40
|
-
type CodeBlockExpanderButtonProps = Omit<HTMLAttributes<HTMLButtonElement>, "children" | "aria-controls" | "aria-expanded">;
|
|
41
|
-
declare const CodeBlockExpanderButton: react.ForwardRefExoticComponent<CodeBlockExpanderButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
42
|
-
|
|
43
|
-
type Primitive = string | number | boolean | undefined | null;
|
|
44
|
-
/**
|
|
45
|
-
* Tagged template literal to format code blocks and normalize leading indentation
|
|
46
|
-
*/
|
|
47
|
-
declare function fmtCode(strings: TemplateStringsArray, ...values: Primitive[]): string;
|
|
48
|
-
|
|
49
|
-
declare const modes: readonly ["file", "cli"];
|
|
50
|
-
type Mode = (typeof modes)[number];
|
|
51
|
-
declare const metaSchema: z.ZodObject<{
|
|
52
|
-
collapsible: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
-
disableCopy: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
-
mode: z.ZodOptional<z.ZodEnum<["file", "cli"]>>;
|
|
55
|
-
title: z.ZodOptional<z.ZodString>;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
collapsible: boolean;
|
|
58
|
-
disableCopy: boolean;
|
|
59
|
-
mode?: "file" | "cli" | undefined;
|
|
60
|
-
title?: string | undefined;
|
|
61
|
-
}, {
|
|
62
|
-
collapsible?: boolean | undefined;
|
|
63
|
-
disableCopy?: boolean | undefined;
|
|
64
|
-
mode?: "file" | "cli" | undefined;
|
|
65
|
-
title?: string | undefined;
|
|
66
|
-
}>;
|
|
67
|
-
type MetaInput = z.input<typeof metaSchema>;
|
|
68
|
-
type Meta = z.infer<typeof metaSchema>;
|
|
69
|
-
declare const defaultMeta: {
|
|
70
|
-
readonly collapsible: false;
|
|
71
|
-
readonly disableCopy: false;
|
|
72
|
-
readonly mode: undefined;
|
|
73
|
-
readonly title: undefined;
|
|
74
|
-
};
|
|
75
|
-
type DefaultMeta = typeof defaultMeta;
|
|
76
|
-
/**
|
|
77
|
-
* Parses a markdown code block (```) metastring into a meta object.
|
|
78
|
-
* Defaults to DefaultMeta if no metastring given or if metastring is invalid.
|
|
79
|
-
* Useful for parsing the metastring from a markdown code block to pass into the
|
|
80
|
-
* CodeBlock components as props.
|
|
81
|
-
*/
|
|
82
|
-
declare function parseMetastring(value: string | undefined): Meta;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* List of supported languages for syntax highlighting.
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
declare const supportedLanguages: readonly ["bash", "cs", "csharp", "css", "dotnet", "go", "html", "java", "javascript", "js", "json", "jsx", "markup", "plain", "plaintext", "py", "python", "rb", "ruby", "rust", "sh", "shell", "text", "ts", "tsx", "txt", "typescript", "xml", "yaml", "yml"];
|
|
89
|
-
/**
|
|
90
|
-
* Supported languages for syntax highlighting.
|
|
91
|
-
*/
|
|
92
|
-
type SupportedLanguage = (typeof supportedLanguages)[number];
|
|
93
|
-
/**
|
|
94
|
-
* Parses a markdown code block (```) language class into a SupportedLanguage.
|
|
95
|
-
* Defaults to "sh" if no supported language is found.
|
|
96
|
-
*/
|
|
97
|
-
declare function parseLanguage(value: `language-${string}` | `lang-${string}` | (string & {}) | undefined): SupportedLanguage;
|
|
98
|
-
/**
|
|
99
|
-
* Type Predicate: checks if an arbitrary value is a supported syntax highlighting language.
|
|
100
|
-
*/
|
|
101
|
-
declare const isSupportedLanguage: (value: unknown) => value is "bash" | "cs" | "csharp" | "css" | "dotnet" | "go" | "html" | "java" | "javascript" | "js" | "json" | "jsx" | "markup" | "plain" | "plaintext" | "py" | "python" | "rb" | "ruby" | "rust" | "sh" | "shell" | "text" | "ts" | "tsx" | "txt" | "typescript" | "xml" | "yaml" | "yml";
|
|
102
|
-
/**
|
|
103
|
-
* Formats a language name into a class name that Prism.js can understand.
|
|
104
|
-
* @default "language-sh"
|
|
105
|
-
*/
|
|
106
|
-
declare function formatLanguageClassName(language?: SupportedLanguage | undefined): "language-bash" | "language-cs" | "language-csharp" | "language-css" | "language-dotnet" | "language-go" | "language-html" | "language-java" | "language-javascript" | "language-js" | "language-json" | "language-jsx" | "language-markup" | "language-plain" | "language-plaintext" | "language-py" | "language-python" | "language-rb" | "language-ruby" | "language-rust" | "language-sh" | "language-shell" | "language-text" | "language-ts" | "language-tsx" | "language-txt" | "language-typescript" | "language-xml" | "language-yaml" | "language-yml";
|
|
107
|
-
|
|
108
|
-
export { CodeBlock, CodeBlockBody, CodeBlockCode, CodeBlockCopyButton, CodeBlockExpanderButton, CodeBlockHeader, CodeBlockTitle, type DefaultMeta, type Meta, type MetaInput, type Mode, type SupportedLanguage, defaultMeta, fmtCode, formatLanguageClassName, isSupportedLanguage, parseLanguage, parseMetastring, supportedLanguages };
|
package/dist/cx.cjs
DELETED
package/dist/cx.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/cx.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ClassValue } from 'clsx';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Conditionally add Tailwind (and other) CSS classes.
|
|
5
|
-
*
|
|
6
|
-
* Allows for tailwind overrides in LTR-specificity-like order of applied classes.
|
|
7
|
-
*/
|
|
8
|
-
declare function cx(...inputs: ClassValue[]): string;
|
|
9
|
-
|
|
10
|
-
export { cx };
|
package/dist/dialog.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkK4UKFOMIcjs = require('./chunk-K4UKFOMI.cjs');require('./chunk-JGNAMNKZ.cjs');var _chunkD3F6KEREcjs = require('./chunk-D3F6KERE.cjs');var _X = require('@phosphor-icons/react/X');var _reactdialog = require('@radix-ui/react-dialog'); var e = _interopRequireWildcard(_reactdialog);var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var u=e.Root,N= exports.DialogTrigger =e.Trigger,d= exports.DialogPortal =e.Portal,C= exports.DialogClose =e.Close,n= exports.DialogOverlay =_react.forwardRef.call(void 0, ({className:t,...i},l)=>_jsxruntime.jsx.call(void 0, e.Overlay,{ref:l,className:_chunkD3F6KEREcjs.a.call(void 0, "fixed inset-0 z-50 bg-overlay backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...i}));n.displayName=e.Overlay.displayName;var g=_react.forwardRef.call(void 0, ({className:t,children:i,...l},y)=>_jsxruntime.jsxs.call(void 0, d,{children:[_jsxruntime.jsx.call(void 0, n,{}),_jsxruntime.jsxs.call(void 0, e.Content,{ref:y,className:_chunkD3F6KEREcjs.a.call(void 0, "scrollbar fixed left-[50%] top-[50%] z-50 max-h-dvh w-full max-w-lg translate-x-[-50%] translate-y-[-50%] overflow-y-auto rounded-xl border border-dialog bg-dialog p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",t),...l,children:[_jsxruntime.jsx.call(void 0, e.Close,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, _chunkK4UKFOMIcjs.a,{appearance:"outlined",priority:"neutral",className:"absolute right-3.5 top-3.5 size-11 p-0 sm:size-9",children:[_jsxruntime.jsx.call(void 0, _X.X,{className:"size-5 shrink-0"}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Close"})]})}),i]})]}));g.displayName=e.Content.displayName;var p=({className:t,...i})=>_jsxruntime.jsx.call(void 0, "div",{className:_chunkD3F6KEREcjs.a.call(void 0, "flex shrink-0 flex-col gap-2 text-strong",t),...i});p.displayName="DialogHeader";var D=({className:t,...i})=>_jsxruntime.jsx.call(void 0, "div",{className:_chunkD3F6KEREcjs.a.call(void 0, "my-6 flex-1 text-body",t),...i});D.displayName="DialogBody";var f=({className:t,...i})=>_jsxruntime.jsx.call(void 0, "div",{className:_chunkD3F6KEREcjs.a.call(void 0, "flex shrink-0 flex-row-reverse gap-2",t),...i});f.displayName="DialogFooter";var c=_react.forwardRef.call(void 0, ({className:t,...i},l)=>_jsxruntime.jsx.call(void 0, e.Title,{ref:l,className:_chunkD3F6KEREcjs.a.call(void 0, "text-lg font-medium leading-none text-strong",t),...i}));c.displayName=e.Title.displayName;var v=_react.forwardRef.call(void 0, ({className:t,...i},l)=>_jsxruntime.jsx.call(void 0, e.Description,{ref:l,className:_chunkD3F6KEREcjs.a.call(void 0, "text-muted",t),...i}));v.displayName=e.Description.displayName;exports.Dialog = u; exports.DialogBody = D; exports.DialogClose = C; exports.DialogContent = g; exports.DialogDescription = v; exports.DialogFooter = f; exports.DialogHeader = p; exports.DialogOverlay = n; exports.DialogPortal = d; exports.DialogTitle = c; exports.DialogTrigger = N;
|
|
2
|
-
//# sourceMappingURL=dialog.cjs.map
|
package/dist/dialog.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/dialog/src/dialog.tsx"],"names":["X","DialogPrimitive","forwardRef","jsx","jsxs","Dialog","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","props","ref","cx","DialogContent","children","Button","DialogHeader","DialogBody","DialogFooter","DialogTitle","DialogDescription"],"mappings":"0GAAA,OAAS,KAAAA,MAAS,0BAClB,UAAYC,MAAqB,yBACjC,OAA+C,cAAAC,MAAkB,QAgBhE,cAAAC,EA0BG,QAAAC,MA1BH,oBAZD,IAAMC,EAAyB,OAEzBC,EAAgC,UAEhCC,EAA+B,SAE/BC,EAA8B,QAE9BC,EAAgBP,EAGpB,CAAC,CAAE,UAAAQ,EAAW,GAAGC,CAAM,EAAGC,IAC3BT,EAAiB,UAAhB,CACA,IAAKS,EACL,UAAWC,EACV,yKACAH,CACD,EACC,GAAGC,EACL,CACA,EACDF,EAAc,YAA8B,UAAQ,YAEpD,IAAMK,EAAgBZ,EAGpB,CAAC,CAAE,UAAAQ,EAAW,SAAAK,EAAU,GAAGJ,CAAM,EAAGC,IACrCR,EAACG,EAAA,CACA,UAAAJ,EAACM,EAAA,EAAc,EACfL,EAAiB,UAAhB,CACA,IAAKQ,EACL,UAAWC,EACV,8hBACAH,CACD,EACC,GAAGC,EAEJ,UAAAR,EAAiB,QAAhB,CAAsB,QAAO,GAC7B,SAAAC,EAACY,EAAA,CAAO,WAAW,WAAW,SAAS,UAAU,UAAU,mDAC1D,UAAAb,EAACH,EAAA,CAAE,UAAU,kBAAkB,EAC/BG,EAAC,QAAK,UAAU,UAAU,iBAAK,GAChC,EACD,EACCY,GACF,GACD,CACA,EACDD,EAAc,YAA8B,UAAQ,YAEpD,IAAMG,EAAe,CAAC,CAAE,UAAAP,EAAW,GAAGC,CAAM,IAC3CR,EAAC,OAAI,UAAWU,EAAG,2CAA4CH,CAAS,EAAI,GAAGC,EAAO,EAEvFM,EAAa,YAAc,eAE3B,IAAMC,EAAa,CAAC,CAAE,UAAAR,EAAW,GAAGC,CAAM,IACzCR,EAAC,OAAI,UAAWU,EAAG,wBAAyBH,CAAS,EAAI,GAAGC,EAAO,EAEpEO,EAAW,YAAc,aAEzB,IAAMC,EAAe,CAAC,CAAE,UAAAT,EAAW,GAAGC,CAAM,IAC3CR,EAAC,OAAI,UAAWU,EAAG,uCAAwCH,CAAS,EAAI,GAAGC,EAAO,EAEnFQ,EAAa,YAAc,eAE3B,IAAMC,EAAclB,EAGlB,CAAC,CAAE,UAAAQ,EAAW,GAAGC,CAAM,EAAGC,IAC3BT,EAAiB,QAAhB,CACA,IAAKS,EACL,UAAWC,EAAG,+CAAgDH,CAAS,EACtE,GAAGC,EACL,CACA,EACDS,EAAY,YAA8B,QAAM,YAEhD,IAAMC,EAAoBnB,EAGxB,CAAC,CAAE,UAAAQ,EAAW,GAAGC,CAAM,EAAGC,IAC3BT,EAAiB,cAAhB,CAA4B,IAAKS,EAAK,UAAWC,EAAG,aAAcH,CAAS,EAAI,GAAGC,EAAO,CAC1F,EACDU,EAAkB,YAA8B,cAAY","sourcesContent":["import { X } from \"@phosphor-icons/react/X\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { ComponentPropsWithoutRef, ElementRef, forwardRef } from \"react\";\nimport { Button } from \"../../button\";\nimport { cx } from \"../../cx\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = forwardRef<\n\tElementRef<typeof DialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Overlay\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"fixed inset-0 z-50 bg-overlay backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = forwardRef<\n\tElementRef<typeof DialogPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n\t<DialogPortal>\n\t\t<DialogOverlay />\n\t\t<DialogPrimitive.Content\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"scrollbar fixed left-[50%] top-[50%] z-50 max-h-dvh w-full max-w-lg translate-x-[-50%] translate-y-[-50%] overflow-y-auto rounded-xl border border-dialog bg-dialog p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<DialogPrimitive.Close asChild>\n\t\t\t\t<Button appearance=\"outlined\" priority=\"neutral\" className=\"absolute right-3.5 top-3.5 size-11 p-0 sm:size-9\">\n\t\t\t\t\t<X className=\"size-5 shrink-0\" />\n\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t</Button>\n\t\t\t</DialogPrimitive.Close>\n\t\t\t{children}\n\t\t</DialogPrimitive.Content>\n\t</DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"flex shrink-0 flex-col gap-2 text-strong\", className)} {...props}></div>\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogBody = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"my-6 flex-1 text-body\", className)} {...props} />\n);\nDialogBody.displayName = \"DialogBody\";\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"flex shrink-0 flex-row-reverse gap-2\", className)} {...props} />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = forwardRef<\n\tElementRef<typeof DialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\"text-lg font-medium leading-none text-strong\", className)}\n\t\t{...props}\n\t/>\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = forwardRef<\n\tElementRef<typeof DialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Description ref={ref} className={cx(\"text-muted\", className)} {...props} />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n\tDialog,\n\tDialogPortal,\n\tDialogOverlay,\n\tDialogTrigger,\n\tDialogClose,\n\tDialogContent,\n\tDialogHeader,\n\tDialogBody,\n\tDialogFooter,\n\tDialogTitle,\n\tDialogDescription,\n};\n"]}
|
package/dist/dialog.d.cts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
-
|
|
5
|
-
declare const Dialog: react.FC<DialogPrimitive.DialogProps>;
|
|
6
|
-
declare const DialogTrigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
7
|
-
declare const DialogPortal: react.FC<DialogPrimitive.DialogPortalProps>;
|
|
8
|
-
declare const DialogClose: react.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
9
|
-
declare const DialogOverlay: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
declare const DialogContent: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
11
|
-
declare const DialogHeader: {
|
|
12
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
13
|
-
displayName: string;
|
|
14
|
-
};
|
|
15
|
-
declare const DialogBody: {
|
|
16
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
17
|
-
displayName: string;
|
|
18
|
-
};
|
|
19
|
-
declare const DialogFooter: {
|
|
20
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
21
|
-
displayName: string;
|
|
22
|
-
};
|
|
23
|
-
declare const DialogTitle: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
|
|
24
|
-
declare const DialogDescription: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
|
|
25
|
-
|
|
26
|
-
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
package/dist/dropdown-menu.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkROHPZJ5Ncjs = require('./chunk-ROHPZJ5N.cjs');var _chunkD3F6KEREcjs = require('./chunk-D3F6KERE.cjs');var _react = require('@ariakit/react'); var o = _interopRequireWildcard(_react);var _Check = require('@phosphor-icons/react/Check');var _react2 = require('react');var _jsxruntime = require('react/jsx-runtime');var y=o.MenuProvider,m= exports.DropdownMenuTrigger =_react2.forwardRef.call(void 0, ({asChild:t=!1,children:e,...n},a)=>t?_jsxruntime.jsx.call(void 0, o.MenuButton,{ref:a,render:typeof e=="object"&&e!=null?e:_jsxruntime.jsx.call(void 0, "button",{})}):_jsxruntime.jsx.call(void 0, o.MenuButton,{ref:a,...n,children:e}));m.displayName="DropdownMenuTrigger";var s=_react2.forwardRef.call(void 0, ({className:t,gutter:e=8,...n},a)=>_jsxruntime.jsx.call(void 0, o.Menu,{gutter:e,ref:a,className:_chunkD3F6KEREcjs.a.call(void 0, "z-50 min-w-[8rem] overflow-hidden rounded border border-popover bg-popover p-1.25 shadow-xl outline-none 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 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",t),...n}));s.displayName="DropdownMenuContent";var u=_react2.forwardRef.call(void 0, ({className:t,...e},n)=>_jsxruntime.jsx.call(void 0, o.MenuItem,{ref:n,className:_chunkD3F6KEREcjs.a.call(void 0, "relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 text-sm font-normal text-strong outline-none data-active-item:bg-popover-hover data-disabled:pointer-events-none data-disabled:opacity-50 data-active-item:dark:bg-popover-hover",t),...e}));u.displayName="DropdownMenuItem";var l=_react2.forwardRef.call(void 0, ({className:t,children:e,...n},a)=>_jsxruntime.jsxs.call(void 0, o.MenuItemCheckbox,{ref:a,className:_chunkD3F6KEREcjs.a.call(void 0, "relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-sm font-normal text-strong outline-none data-disabled:pointer-events-none data-disabled:opacity-50","data-active-item:bg-popover-hover data-active-item:dark:bg-popover-hover","aria-checked:!bg-filled-accent aria-checked:font-medium aria-checked:text-on-filled",t),...n,children:[e,_jsxruntime.jsx.call(void 0, f,{className:"absolute right-2 flex items-center"})]}));l.displayName="DropdownMenuCheckboxItem";var c=_react2.forwardRef.call(void 0, ({className:t,children:e,...n},a)=>_jsxruntime.jsxs.call(void 0, o.MenuItemRadio,{ref:a,className:_chunkD3F6KEREcjs.a.call(void 0, "relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-sm font-normal text-strong outline-none data-disabled:pointer-events-none data-disabled:opacity-50","data-active-item:bg-popover-hover data-active-item:dark:bg-popover-hover","aria-checked:!bg-filled-accent aria-checked:font-medium aria-checked:text-on-filled",t),...n,children:[e,_jsxruntime.jsx.call(void 0, f,{className:"absolute right-2 flex items-center"})]}));c.displayName="DropdownMenuRadioItem";var f=t=>_jsxruntime.jsx.call(void 0, o.MenuItemCheck,{...t,children:_jsxruntime.jsx.call(void 0, _Check.Check,{className:"size-5",weight:"bold"})}),M= exports.DropdownMenuLabel =_react2.forwardRef.call(void 0, ({className:t,...e},n)=>_jsxruntime.jsx.call(void 0, "div",{ref:n,className:_chunkD3F6KEREcjs.a.call(void 0, "px-2 py-1.5 text-sm font-medium text-strong",t),...e}));M.displayName="DropdownMenuLabel";var h=_react2.forwardRef.call(void 0, ({className:t,...e},n)=>_jsxruntime.jsx.call(void 0, _chunkROHPZJ5Ncjs.a,{ref:n,className:_chunkD3F6KEREcjs.a.call(void 0, "-mx-2 my-1 w-auto",t),...e}));h.displayName="DropdownMenuSeparator";var k=({className:t,...e})=>_jsxruntime.jsx.call(void 0, "span",{className:_chunkD3F6KEREcjs.a.call(void 0, "ml-auto text-xs tracking-widest opacity-60",t),...e});k.displayName="DropdownMenuShortcut";exports.DropdownMenu = y; exports.DropdownMenuCheckboxItem = l; exports.DropdownMenuContent = s; exports.DropdownMenuItem = u; exports.DropdownMenuLabel = M; exports.DropdownMenuRadioItem = c; exports.DropdownMenuSeparator = h; exports.DropdownMenuShortcut = k; exports.DropdownMenuTrigger = m;
|
|
2
|
-
//# sourceMappingURL=dropdown-menu.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/dropdown-menu/src/dropdown-menu.tsx"],"names":["Ariakit","Check","forwardRef","jsx","jsxs","DropdownMenu","DropdownMenuTrigger","asChild","children","props","ref","DropdownMenuContent","className","gutter","cx","DropdownMenuItem","DropdownMenuCheckboxItem","DropdownMenuItemCheck","DropdownMenuRadioItem","DropdownMenuLabel","DropdownMenuSeparator","Separator","DropdownMenuShortcut"],"mappings":"kFAAA,UAAYA,MAAa,iBACzB,OAAS,SAAAC,MAAa,8BAEtB,OAAS,cAAAC,MAAkB,QAcuE,cAAAC,EA+ChG,QAAAC,MA/CgG,oBATlG,IAAMC,EAAuB,eAGvBC,EAAsBJ,EAC3B,CAAC,CAAE,QAAAK,EAAU,GAAO,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IACrCH,EAEFJ,EAAS,aAAR,CACA,IAAKO,EACL,OAAQ,OAAOF,GAAa,UAAYA,GAAY,KAAQA,EAAiCL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AAKO,EAAK,UAAWI,EAAG,8CAA+CF,CAAS,EAAI,GAAGH,EAAO,CAErG,EACAU,EAAkB,YAAc,oBAEhC,IAAMC,EAAwBlB,EAC7B,CAAC,CAAE,UAAAU,EAAW,GAAGH,CAAM,EAAGC,IAAQP,EAACkB,EAAA,CAAU,IAAKX,EAAK,UAAWI,EAAG,oBAAqBF,CAAS,EAAI,GAAGH,EAAO,CAClH,EACAW,EAAsB,YAAc,wBAEpC,IAAME,EAAuB,CAAC,CAAE,UAAAV,EAAW,GAAGH,CAAM,IAC5CN,EAAC,QAAK,UAAWW,EAAG,6CAA8CF,CAAS,EAAI,GAAGH,EAAO,EAEjGa,EAAqB,YAAc","sourcesContent":["import * as Ariakit from \"@ariakit/react\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport { Separator } from \"../../separator\";\nimport { WithAsChild } from \"../../types\";\n\nconst DropdownMenu = Ariakit.MenuProvider;\n\ntype DropdownMenuTriggerProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuButton>, \"render\"> & WithAsChild;\nconst DropdownMenuTrigger = forwardRef<ElementRef<\"button\">, DropdownMenuTriggerProps>(\n\t({ asChild = false, children, ...props }, ref) => {\n\t\tif (asChild) {\n\t\t\treturn (\n\t\t\t\t<Ariakit.MenuButton\n\t\t\t\t\tref={ref}\n\t\t\t\t\trender={typeof children === \"object\" && children != null ? (children as React.JSX.Element) : <button />}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<Ariakit.MenuButton ref={ref} {...props}>\n\t\t\t\t{children}\n\t\t\t</Ariakit.MenuButton>\n\t\t);\n\t},\n);\nDropdownMenuTrigger.displayName = \"DropdownMenuTrigger\";\n\nconst DropdownMenuContent = forwardRef<ElementRef<typeof Ariakit.Menu>, ComponentPropsWithoutRef<typeof Ariakit.Menu>>(\n\t({ className, gutter = 8, ...props }, ref) => (\n\t\t<Ariakit.Menu\n\t\t\tgutter={gutter}\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"z-50 min-w-[8rem] overflow-hidden rounded border border-popover bg-popover p-1.25 shadow-xl outline-none 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 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nDropdownMenuContent.displayName = \"DropdownMenuContent\";\n\nconst DropdownMenuItem = forwardRef<\n\tElementRef<typeof Ariakit.MenuItem>,\n\tComponentPropsWithoutRef<typeof Ariakit.MenuItem>\n>(({ className, ...props }, ref) => (\n\t<Ariakit.MenuItem\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 text-sm font-normal text-strong outline-none data-active-item:bg-popover-hover data-disabled:pointer-events-none data-disabled:opacity-50 data-active-item:dark:bg-popover-hover\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuItem.displayName = \"DropdownMenuItem\";\n\ntype DropdownMenuCheckboxItemProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuItemCheckbox>, \"render\">;\nconst DropdownMenuCheckboxItem = forwardRef<ElementRef<typeof Ariakit.MenuItemRadio>, DropdownMenuCheckboxItemProps>(\n\t({ className, children, ...props }, ref) => (\n\t\t<Ariakit.MenuItemCheckbox\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-sm font-normal text-strong outline-none data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\t\"data-active-item:bg-popover-hover data-active-item:dark:bg-popover-hover\",\n\t\t\t\t\"aria-checked:!bg-filled-accent aria-checked:font-medium aria-checked:text-on-filled\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<DropdownMenuItemCheck className=\"absolute right-2 flex items-center\" />\n\t\t</Ariakit.MenuItemCheckbox>\n\t),\n);\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n\ntype DropdownMenuRadioItemProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuItemRadio>, \"render\">;\nconst DropdownMenuRadioItem = forwardRef<ElementRef<typeof Ariakit.MenuItemRadio>, DropdownMenuRadioItemProps>(\n\t({ className, children, ...props }, ref) => (\n\t\t<Ariakit.MenuItemRadio\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-sm font-normal text-strong outline-none data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\t\"data-active-item:bg-popover-hover data-active-item:dark:bg-popover-hover\",\n\t\t\t\t\"aria-checked:!bg-filled-accent aria-checked:font-medium aria-checked:text-on-filled\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<DropdownMenuItemCheck className=\"absolute right-2 flex items-center\" />\n\t\t</Ariakit.MenuItemRadio>\n\t),\n);\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nconst DropdownMenuItemCheck = (props: Omit<HTMLAttributes<HTMLSpanElement>, \"children\">) => (\n\t<Ariakit.MenuItemCheck {...props}>\n\t\t<Check className=\"size-5\" weight=\"bold\" />\n\t</Ariakit.MenuItemCheck>\n);\n\nconst DropdownMenuLabel = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<\"div\">>(\n\t({ className, ...props }, ref) => (\n\t\t<div ref={ref} className={cx(\"px-2 py-1.5 text-sm font-medium text-strong\", className)} {...props} />\n\t),\n);\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\";\n\nconst DropdownMenuSeparator = forwardRef<ElementRef<typeof Separator>, ComponentPropsWithoutRef<typeof Separator>>(\n\t({ className, ...props }, ref) => <Separator ref={ref} className={cx(\"-mx-2 my-1 w-auto\", className)} {...props} />,\n);\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\";\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n\treturn <span className={cx(\"ml-auto text-xs tracking-widest opacity-60\", className)} {...props} />;\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuRadioItem,\n\tDropdownMenuLabel,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\n\t// TODO(cody): audit / add in these exports in a follow up\n\t// DropdownMenuGroup,\n\t// DropdownMenuPortal,\n\t// DropdownMenuSub,\n\t// DropdownMenuSubContent,\n\t// DropdownMenuSubTrigger,\n\t// DropdownMenuRadioGroup,\n};\n"]}
|
package/dist/dropdown-menu.d.cts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as _radix_ui_react_separator from '@radix-ui/react-separator';
|
|
3
|
-
import * as react from 'react';
|
|
4
|
-
import { HTMLAttributes, ComponentPropsWithoutRef } from 'react';
|
|
5
|
-
import * as Ariakit from '@ariakit/react';
|
|
6
|
-
import { W as WithAsChild } from './as-child-BjnPZ1DU.cjs';
|
|
7
|
-
|
|
8
|
-
declare const DropdownMenu: typeof Ariakit.MenuProvider;
|
|
9
|
-
declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<Omit<Omit<Ariakit.MenuButtonOptions<"button" | "div"> & Omit<(Omit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
11
|
-
}) | (Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
12
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
|
13
|
-
}), keyof Ariakit.MenuButtonOptions<T>> & {
|
|
14
|
-
[index: `data-${string}`]: unknown;
|
|
15
|
-
}, "ref">, "render"> & WithAsChild & react.RefAttributes<HTMLButtonElement>>;
|
|
16
|
-
declare const DropdownMenuContent: react.ForwardRefExoticComponent<Omit<Ariakit.MenuOptions<"div"> & Omit<Omit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
17
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
18
|
-
}, keyof Ariakit.MenuOptions<T>> & {
|
|
19
|
-
[index: `data-${string}`]: unknown;
|
|
20
|
-
}, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
21
|
-
declare const DropdownMenuItem: react.ForwardRefExoticComponent<Omit<Ariakit.MenuItemOptions<"div"> & Omit<Omit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
22
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
23
|
-
}, keyof Ariakit.MenuItemOptions<T>> & {
|
|
24
|
-
[index: `data-${string}`]: unknown;
|
|
25
|
-
}, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
26
|
-
type DropdownMenuCheckboxItemProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuItemCheckbox>, "render">;
|
|
27
|
-
declare const DropdownMenuCheckboxItem: react.ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
28
|
-
type DropdownMenuRadioItemProps = Omit<ComponentPropsWithoutRef<typeof Ariakit.MenuItemRadio>, "render">;
|
|
29
|
-
declare const DropdownMenuRadioItem: react.ForwardRefExoticComponent<DropdownMenuRadioItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
declare const DropdownMenuLabel: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
declare const DropdownMenuSeparator: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_separator.SeparatorProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
32
|
-
declare const DropdownMenuShortcut: {
|
|
33
|
-
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
|
|
34
|
-
displayName: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger };
|
package/dist/hooks.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIN6SIXF2cjs = require('./chunk-IN6SIXF2.cjs');var _react = require('react');var f="(prefers-reduced-motion: no-preference)";function i(){let[r,t]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let e=window.matchMedia(f);t(!e.matches);function o(n){t(!n.matches)}return e.addEventListener("change",o),()=>{e.removeEventListener("change",o)}},[]),r}var m=typeof window<"u"?_react.useLayoutEffect:_react.useEffect;exports.useIsomorphicLayoutEffect = m; exports.useMatchesMediaQuery = _chunkIN6SIXF2cjs.a; exports.usePrefersReducedMotion = i;
|
|
2
|
-
//# sourceMappingURL=hooks.cjs.map
|
package/dist/hooks.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/hooks/src/use-prefers-reduced-motion.tsx","../packages/hooks/src/use-isomorphic-layout-effect.tsx"],"names":["useEffect","useState","query","usePrefersReducedMotion","prefersReducedMotion","setPrefersReducedMotion","mediaQueryList","listener","event","useLayoutEffect","useIsomorphicLayoutEffect"],"mappings":"yCAAA,OAAS,aAAAA,EAAW,YAAAC,MAAgB,QAOpC,IAAMC,EAAQ,0CAKP,SAASC,GAA0B,CAEzC,GAAM,CAACC,EAAsBC,CAAuB,EAAIJ,EAAS,EAAI,EAErE,OAAAD,EAAU,IAAM,CACf,IAAMM,EAAiB,OAAO,WAAWJ,CAAK,EAG9CG,EAAwB,CAACC,EAAe,OAAO,EAG/C,SAASC,EAASC,EAA4B,CAC7CH,EAAwB,CAACG,EAAM,OAAO,CACvC,CAEA,OAAAF,EAAe,iBAAiB,SAAUC,CAAQ,EAE3C,IAAM,CACZD,EAAe,oBAAoB,SAAUC,CAAQ,CACtD,CACD,EAAG,CAAC,CAAC,EAEEH,CACR,CCnCA,OAAS,aAAAJ,EAAW,mBAAAS,MAAuB,QAKpC,IAAMC,EAA4B,OAAO,OAAW,IAAcD,EAAkBT","sourcesContent":["import { useEffect, useState } from \"react\";\n\n/**\n * no-preference is the default value for the prefers-reduced-motion media query.\n * Users who have never fiddled with their a11y settings will still see animations\n * (no explicit opt-in required from a user's perspective)\n */\nconst query = \"(prefers-reduced-motion: no-preference)\";\n\n/**\n * usePrefersReducedMotion returns true if the user has opted out of animations\n */\nexport function usePrefersReducedMotion() {\n\t// default to no animations, since we don't know what the user's preference is on the server\n\tconst [prefersReducedMotion, setPrefersReducedMotion] = useState(true);\n\n\tuseEffect(() => {\n\t\tconst mediaQueryList = window.matchMedia(query);\n\n\t\t// set the _real_ initial value now that we're on the client\n\t\tsetPrefersReducedMotion(!mediaQueryList.matches);\n\n\t\t// register for updates\n\t\tfunction listener(event: MediaQueryListEvent) {\n\t\t\tsetPrefersReducedMotion(!event.matches);\n\t\t}\n\n\t\tmediaQueryList.addEventListener(\"change\", listener);\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener(\"change\", listener);\n\t\t};\n\t}, []);\n\n\treturn prefersReducedMotion;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * useIsomorphicLayoutEffect is a hook that uses useLayoutEffect on the client and useEffect on the server.\n */\nexport const useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n"]}
|
package/dist/hooks.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* usePrefersReducedMotion returns true if the user has opted out of animations
|
|
5
|
-
*/
|
|
6
|
-
declare function usePrefersReducedMotion(): boolean;
|
|
7
|
-
|
|
8
|
-
declare function useMatchesMediaQuery(query: string): boolean;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* useIsomorphicLayoutEffect is a hook that uses useLayoutEffect on the client and useEffect on the server.
|
|
12
|
-
*/
|
|
13
|
-
declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
14
|
-
|
|
15
|
-
export { useIsomorphicLayoutEffect, useMatchesMediaQuery, usePrefersReducedMotion };
|
package/dist/icon.cjs
DELETED
package/dist/icon.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/icon.d.cts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode, HTMLAttributes } from 'react';
|
|
3
|
-
import { W as WithStyleProps } from './with-style-props-VnLWm0Yd.cjs';
|
|
4
|
-
|
|
5
|
-
type IconProps = WithStyleProps & {
|
|
6
|
-
/**
|
|
7
|
-
* A single SVG icon element.
|
|
8
|
-
*/
|
|
9
|
-
svg: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
type SvgAttributes = HTMLAttributes<SVGElement> & {
|
|
12
|
-
focusable?: "true" | "false";
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Decorates an svg icon with automatic sizing styles.
|
|
16
|
-
* Merges `className` selectors with the following order of precedence (last one wins):
|
|
17
|
-
* 1. Icon base classes
|
|
18
|
-
* 2. svg className
|
|
19
|
-
* 3. Icon className
|
|
20
|
-
*/
|
|
21
|
-
declare const Icon: ({ className, style, svg }: IconProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
-
|
|
23
|
-
export { Icon, type IconProps, type SvgAttributes };
|
package/dist/inline-code.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD3F6KEREcjs = require('./chunk-D3F6KERE.cjs');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var o=_react.forwardRef.call(void 0, ({className:r,...t},n)=>_jsxruntime.jsx.call(void 0, "code",{ref:n,className:_chunkD3F6KEREcjs.a.call(void 0, "rounded-md border border-card bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]",r),...t}));o.displayName="InlineCode";exports.InlineCode = o;
|
|
2
|
-
//# sourceMappingURL=inline-code.cjs.map
|
package/dist/inline-code.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/inline-code/src/inline-code.tsx"],"names":["forwardRef","jsx","InlineCode","className","props","ref","cx"],"mappings":"yCAAA,OAAS,cAAAA,MAAkC,QAO1C,cAAAC,MAAA,oBADD,IAAMC,EAAaF,EAA6D,CAAC,CAAE,UAAAG,EAAW,GAAGC,CAAM,EAAGC,IACzGJ,EAAC,QACA,IAAKI,EACL,UAAWC,EAAG,iFAAkFH,CAAS,EACxG,GAAGC,EACL,CACA,EACDF,EAAW,YAAc","sourcesContent":["import { forwardRef, HTMLAttributes } from \"react\";\nimport { cx } from \"../../cx\";\n\n/**\n * A component to render inline code.\n */\nconst InlineCode = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(({ className, ...props }, ref) => (\n\t<code\n\t\tref={ref}\n\t\tclassName={cx(\"rounded-md border border-card bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]\", className)}\n\t\t{...props}\n\t/>\n));\nInlineCode.displayName = \"InlineCode\";\n\nexport { InlineCode };\n"]}
|
package/dist/inline-code.d.cts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A component to render inline code.
|
|
6
|
-
*/
|
|
7
|
-
declare const InlineCode: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & react.RefAttributes<HTMLSpanElement>>;
|
|
8
|
-
|
|
9
|
-
export { InlineCode };
|
package/dist/input.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkD3F6KEREcjs = require('./chunk-D3F6KERE.cjs');var _Warning = require('@phosphor-icons/react/Warning');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var m=_react.forwardRef.call(void 0, ({children:n,className:p,...t},r)=>{let e=!!n,o=_react.useRef.call(void 0, null);return e?_jsxruntime.jsx.call(void 0, y,{className:p,forwardedRef:r,innerRef:o,...t,children:n}):_jsxruntime.jsx.call(void 0, y,{...t,className:p,forwardedRef:r,innerRef:o,children:_jsxruntime.jsx.call(void 0, d,{...t})})});m.displayName="Input";var d=_react.forwardRef.call(void 0, ({"aria-invalid":n,className:p,invalid:t=!1,...r},e)=>{let{"aria-invalid":o,invalid:a,forwardedRef:s,innerRef:f,...u}=_react.useContext.call(void 0, w),P=_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(o, () => (a)), () => (n)), () => (t)),v={...u,...r,type:_nullishCoalesce(_nullishCoalesce(r.type, () => (u.type)), () => ("text"))};return _jsxruntime.jsx.call(void 0, "input",{"aria-invalid":P,className:_chunkD3F6KEREcjs.a.call(void 0, "min-w-0 flex-1 bg-form placeholder:text-placeholder focus:outline-none",p),ref:l=>{typeof e=="function"?e(l):e&&(e.current=l),typeof s=="function"?s(l):s&&(s.current=l),f.current=l},...v})});d.displayName="InputCapture";var w=_react.createContext.call(void 0, {invalid:!1,innerRef:{current:null}}),y=({"aria-invalid":n,children:p,className:t,forwardedRef:r,innerRef:e,invalid:o,style:a,type:s,...f})=>{let u=_nullishCoalesce(n, () => (o));return _jsxruntime.jsx.call(void 0, w.Provider,{value:{"aria-invalid":n,invalid:o,type:s,...f,forwardedRef:r,innerRef:e},children:_jsxruntime.jsxs.call(void 0, "div",{"aria-invalid":u,className:_chunkD3F6KEREcjs.a.call(void 0, "flex h-11 w-full items-center gap-1.5 rounded-md border bg-form px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-within:outline-none focus-within:ring-4 focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 sm:h-9 sm:text-sm","has-[input:not(:first-child)]:ps-2.5 has-[input:not(:last-child)]:pe-2.5 [&>:not(input)]:shrink-0 [&_svg]:size-6 sm:[&_svg]:size-5","border-form text-strong focus-within:border-accent-600 focus-within:ring-focus-accent",u&&"border-danger-600 pe-2.5 focus-within:border-danger-600 focus-within:ring-focus-danger",t),onClick:()=>{_optionalChain([e, 'optionalAccess', _ => _.current, 'optionalAccess', _2 => _2.focus, 'call', _3 => _3()])},style:a,children:[p,o&&_jsxruntime.jsxs.call(void 0, "div",{className:"pointer-events-none order-last select-none text-danger-600",children:[_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:["The value entered for the",f.name,"input has failed validation."].filter(Boolean).join(" ")}),_jsxruntime.jsx.call(void 0, _Warning.Warning,{"aria-hidden":!0,weight:"fill"})]})]})})};var _Eye = require('@phosphor-icons/react/Eye');var _EyeClosed = require('@phosphor-icons/react/EyeClosed');var x=_react.forwardRef.call(void 0, (n,p)=>{let[t,r]=_react.useState.call(void 0, !1);return _jsxruntime.jsxs.call(void 0, m,{type:t?"text":"password",ref:p,...n,children:[_jsxruntime.jsx.call(void 0, d,{}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",tabIndex:-1,className:"ml-1 cursor-pointer bg-inherit p-0 text-body hover:text-strong",onClick:()=>{r(a=>!a)},children:[_jsxruntime.jsxs.call(void 0, "span",{className:"sr-only",children:["Turn password visibility ",t?"off":"on"]}),_jsxruntime.jsx.call(void 0, t?_Eye.Eye:_EyeClosed.EyeClosed,{"aria-hidden":!0})]})]})});x.displayName="PasswordInput";exports.Input = m; exports.InputCapture = d; exports.PasswordInput = x;
|
|
2
|
-
//# sourceMappingURL=input.cjs.map
|
package/dist/input.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../packages/input/src/input.tsx","../packages/input/src/password-input.tsx"],"names":["Warning","createContext","forwardRef","useContext","useRef","jsx","jsxs","Input","children","className","props","forwardedRef","hasChildren","innerRef","InputContainer","InputCapture","_ariaInvalid","invalid","restProps","ref","ctxAriaInvalid","ctxInvalid","ctxForwardedRef","ctxInnerRef","ctx","InputContext","ariaInvalid","cx","node","style","type","Eye","EyeClosed","useState","PasswordInput","showPassword","setShowPassword","s"],"mappings":"yCAAA,OAAS,WAAAA,MAAe,gCAExB,OAAS,iBAAAC,E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,EAchC,CAAO,cAAW,GAAC,GACrB,GACD,CAEF,CAAC,EACDE,EAAc,YAAc","sourcesContent":["import { Warning } from \"@phosphor-icons/react/Warning\";\nimport type { ForwardedRef, InputHTMLAttributes, MutableRefObject, PropsWithChildren } from \"react\";\nimport { createContext, ElementRef, forwardRef, useContext, useRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport type { WithAutoComplete, WithInputType, WithInvalid } from \"./types\";\n\ntype BaseProps = WithAutoComplete & WithInputType & WithInvalid;\n\n/**\n * The props for the `Input` component.\n */\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps & PropsWithChildren;\n\n/**\n * Used to create interactive controls for web-based forms in order to accept data from the user\n */\nconst Input = forwardRef<HTMLInputElement, InputProps>(({ children, className, ...props }, forwardedRef) => {\n\tconst hasChildren = Boolean(children);\n\tconst innerRef = useRef<ElementRef<\"input\">>(null);\n\n\tif (hasChildren) {\n\t\treturn (\n\t\t\t<InputContainer className={className} forwardedRef={forwardedRef} innerRef={innerRef} {...props}>\n\t\t\t\t{children}\n\t\t\t</InputContainer>\n\t\t);\n\t}\n\n\treturn (\n\t\t<InputContainer {...props} className={className} forwardedRef={forwardedRef} innerRef={innerRef}>\n\t\t\t<InputCapture {...props} />\n\t\t</InputContainer>\n\t);\n});\nInput.displayName = \"Input\";\n\ntype InputCaptureProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps;\n\n/**\n * The actual <input /> element that captures user input.\n */\nconst InputCapture = forwardRef<HTMLInputElement, InputCaptureProps>(\n\t({ \"aria-invalid\": _ariaInvalid, className, invalid = false, ...restProps }, ref) => {\n\t\tconst {\n\t\t\t\"aria-invalid\": ctxAriaInvalid,\n\t\t\tinvalid: ctxInvalid,\n\t\t\tforwardedRef: ctxForwardedRef,\n\t\t\tinnerRef: ctxInnerRef,\n\t\t\t...ctx\n\t\t} = useContext(InputContext);\n\t\tconst ariaInvalid = ctxAriaInvalid ?? ctxInvalid ?? _ariaInvalid ?? invalid;\n\t\tconst props = { ...ctx, ...restProps, type: restProps.type ?? ctx.type ?? \"text\" };\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(\"min-w-0 flex-1 bg-form placeholder:text-placeholder focus:outline-none\", className)}\n\t\t\t\tref={(node) => {\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof ctxForwardedRef === \"function\") {\n\t\t\t\t\t\tctxForwardedRef(node);\n\t\t\t\t\t} else if (ctxForwardedRef) {\n\t\t\t\t\t\tctxForwardedRef.current = node;\n\t\t\t\t\t}\n\t\t\t\t\tctxInnerRef.current = node;\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nInputCapture.displayName = \"InputCapture\";\n\ntype InputContextType = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tBaseProps & {\n\t\t/**\n\t\t * inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * forwarded ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef?: ForwardedRef<HTMLInputElement>;\n\t};\n\nconst InputContext = createContext<InputContextType>({ invalid: false, innerRef: { current: null } });\n\ntype InputContainerProps = InputHTMLAttributes<HTMLInputElement> &\n\tBaseProps & {\n\t\t/**\n\t\t * @private inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * @private ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef: ForwardedRef<HTMLInputElement>;\n\t};\n\n/**\n * The container for the input element.\n */\nconst InputContainer = ({\n\t\"aria-invalid\": _ariaInvalid,\n\tchildren,\n\tclassName,\n\tforwardedRef,\n\tinnerRef,\n\tinvalid,\n\tstyle,\n\ttype,\n\t...props\n}: InputContainerProps) => {\n\tconst ariaInvalid = _ariaInvalid ?? invalid;\n\n\treturn (\n\t\t<InputContext.Provider\n\t\t\tvalue={{\n\t\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\t\tinvalid,\n\t\t\t\ttype,\n\t\t\t\t...props,\n\t\t\t\tforwardedRef,\n\t\t\t\tinnerRef,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex h-11 w-full items-center gap-1.5 rounded-md border bg-form px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-within:outline-none focus-within:ring-4 focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50 sm:h-9 sm:text-sm\",\n\t\t\t\t\t\"has-[input:not(:first-child)]:ps-2.5 has-[input:not(:last-child)]:pe-2.5 [&>:not(input)]:shrink-0 [&_svg]:size-6 sm:[&_svg]:size-5\",\n\t\t\t\t\t\"border-form text-strong focus-within:border-accent-600 focus-within:ring-focus-accent\",\n\t\t\t\t\tariaInvalid && \"border-danger-600 pe-2.5 focus-within:border-danger-600 focus-within:ring-focus-danger\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tinnerRef?.current?.focus();\n\t\t\t\t}}\n\t\t\t\tstyle={style}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{invalid && (\n\t\t\t\t\t<div className=\"pointer-events-none order-last select-none text-danger-600\">\n\t\t\t\t\t\t<span className=\"sr-only\">\n\t\t\t\t\t\t\t{[\"The value entered for the\", props.name, \"input has failed validation.\"].filter(Boolean).join(\" \")}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<Warning aria-hidden weight=\"fill\" />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</InputContext.Provider>\n\t);\n};\n\nexport { Input, InputCapture };\nexport type { InputProps, InputCaptureProps };\n","import { Eye } from \"@phosphor-icons/react/Eye\";\nimport { EyeClosed } from \"@phosphor-icons/react/EyeClosed\";\nimport { forwardRef, useState } from \"react\";\nimport type { InputHTMLAttributes } from \"react\";\nimport { Input, InputCapture } from \"./input\";\nimport type { InputType, WithAutoComplete, WithInvalid } from \"./types\";\n\ntype PasswordInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tWithInvalid &\n\tWithAutoComplete;\n\ntype PasswordInputType = Extract<InputType, \"text\" | \"password\">;\n\nconst PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>((props, ref) => {\n\tconst [showPassword, setShowPassword] = useState<boolean>(false);\n\tconst type: PasswordInputType = showPassword ? \"text\" : \"password\";\n\tconst EyeCon = showPassword ? Eye : EyeClosed;\n\n\treturn (\n\t\t<Input type={type} ref={ref} {...props}>\n\t\t\t<InputCapture />\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\tclassName=\"ml-1 cursor-pointer bg-inherit p-0 text-body hover:text-strong\"\n\t\t\t\tonClick={() => {\n\t\t\t\t\tsetShowPassword((s) => !s);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span className=\"sr-only\">Turn password visibility {showPassword ? \"off\" : \"on\"}</span>\n\t\t\t\t<EyeCon aria-hidden />\n\t\t\t</button>\n\t\t</Input>\n\t);\n});\nPasswordInput.displayName = \"PasswordInput\";\n\nexport { PasswordInput };\nexport type { PasswordInputProps };\n"]}
|