@ngrok/mantle 0.67.0 → 0.68.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +7 -0
  2. package/dist/accordion.d.ts +9 -9
  3. package/dist/alert-dialog.d.ts +31 -31
  4. package/dist/alert-dialog.js +1 -1
  5. package/dist/alert.d.ts +10 -10
  6. package/dist/alert.js +1 -1
  7. package/dist/alert.js.map +1 -1
  8. package/dist/anchor.d.ts +2 -2
  9. package/dist/badge.d.ts +3 -3
  10. package/dist/badge.js +1 -1
  11. package/dist/badge.js.map +1 -1
  12. package/dist/button-BKykcpgJ.js +2 -0
  13. package/dist/button-BKykcpgJ.js.map +1 -0
  14. package/dist/{button-B--2eT25.d.ts → button-BaNwe1ud.d.ts} +13 -13
  15. package/dist/button.d.ts +3 -3
  16. package/dist/button.js +1 -1
  17. package/dist/calendar.d.ts +2 -2
  18. package/dist/calendar.js +1 -1
  19. package/dist/card.d.ts +6 -6
  20. package/dist/checkbox.d.ts +3 -3
  21. package/dist/checkbox.js +1 -1
  22. package/dist/checkbox.js.map +1 -1
  23. package/dist/code-block.d.ts +15 -15
  24. package/dist/code-block.js +2 -2
  25. package/dist/code-block.js.map +1 -1
  26. package/dist/code.d.ts +2 -2
  27. package/dist/code.js +1 -1
  28. package/dist/code.js.map +1 -1
  29. package/dist/color.d.ts +1 -1
  30. package/dist/color.js +1 -1
  31. package/dist/color.js.map +1 -1
  32. package/dist/combobox.d.ts +11 -11
  33. package/dist/combobox.js +1 -1
  34. package/dist/combobox.js.map +1 -1
  35. package/dist/command.d.ts +33 -33
  36. package/dist/command.js +1 -1
  37. package/dist/command.js.map +1 -1
  38. package/dist/data-table.d.ts +14 -14
  39. package/dist/data-table.js +1 -1
  40. package/dist/data-table.js.map +1 -1
  41. package/dist/description-list.d.ts +5 -5
  42. package/dist/description-list.js +1 -1
  43. package/dist/description-list.js.map +1 -1
  44. package/dist/{dialog-PqWYibMO.js → dialog-DxkpMIzB.js} +2 -2
  45. package/dist/{dialog-PqWYibMO.js.map → dialog-DxkpMIzB.js.map} +1 -1
  46. package/dist/dialog.d.ts +17 -17
  47. package/dist/dialog.js +1 -1
  48. package/dist/{direction-C_bMxZXm.d.ts → direction-MVSxfKWx.d.ts} +2 -2
  49. package/dist/{dropdown-menu-slQCdKvp.d.ts → dropdown-menu-D6MiVSR-.d.ts} +23 -23
  50. package/dist/dropdown-menu.d.ts +1 -1
  51. package/dist/flag.d.ts +2 -2
  52. package/dist/hover-card.d.ts +6 -6
  53. package/dist/{icon-BkSBkfH9.d.ts → icon-Dh1ONyO_.d.ts} +3 -3
  54. package/dist/icon-button-CxxVPiKp.js +2 -0
  55. package/dist/icon-button-CxxVPiKp.js.map +1 -0
  56. package/dist/{icon-button-DMNdrMSf.d.ts → icon-button-gO-7F_MZ.d.ts} +6 -6
  57. package/dist/icon.d.ts +2 -2
  58. package/dist/icons.d.ts +8 -8
  59. package/dist/{index-Cxmuw3UT.d.ts → index-Bw97R9Kw.d.ts} +8 -8
  60. package/dist/{index-C0yxjFyf.d.ts → index-C3IiAC5H.d.ts} +3 -3
  61. package/dist/{index-CI-RDnHZ.d.ts → index-Cj2NX2Dg.d.ts} +5 -5
  62. package/dist/input.d.ts +1 -1
  63. package/dist/kbd.d.ts +2 -2
  64. package/dist/label.d.ts +3 -3
  65. package/dist/mantle-dark-high-contrast.css +18 -9
  66. package/dist/mantle-dark.css +37 -43
  67. package/dist/mantle-light-high-contrast.css +15 -9
  68. package/dist/mantle.css +108 -74
  69. package/dist/media-object.d.ts +4 -4
  70. package/dist/multi-select.d.ts +16 -16
  71. package/dist/pagination.d.ts +8 -8
  72. package/dist/pagination.js +1 -1
  73. package/dist/popover.d.ts +7 -7
  74. package/dist/{primitive-BmWrmUz1.d.ts → primitive-BqLYh79k.d.ts} +3 -3
  75. package/dist/progress.d.ts +5 -5
  76. package/dist/radio-group.d.ts +19 -19
  77. package/dist/radio-group.js +1 -1
  78. package/dist/radio-group.js.map +1 -1
  79. package/dist/sandboxed-on-click.d.ts +3 -3
  80. package/dist/{select-B3jxZhYg.d.ts → select-DJmjfGjt.d.ts} +14 -14
  81. package/dist/select.d.ts +1 -1
  82. package/dist/separator.d.ts +4 -4
  83. package/dist/sheet.d.ts +19 -19
  84. package/dist/sheet.js +1 -1
  85. package/dist/skeleton.d.ts +5 -5
  86. package/dist/slider.d.ts +2 -2
  87. package/dist/slider.js +1 -1
  88. package/dist/slider.js.map +1 -1
  89. package/dist/slot.d.ts +3 -3
  90. package/dist/split-button.d.ts +20 -20
  91. package/dist/split-button.js +1 -1
  92. package/dist/split-button.js.map +1 -1
  93. package/dist/{svg-only-BH9PBSGl.d.ts → svg-only-Db3eUPWM.d.ts} +3 -3
  94. package/dist/switch.d.ts +4 -4
  95. package/dist/switch.js +1 -1
  96. package/dist/switch.js.map +1 -1
  97. package/dist/{table-CU7zx1pH.d.ts → table-C7BejaFW.d.ts} +11 -11
  98. package/dist/table-CnYWz6IT.js +2 -0
  99. package/dist/table-CnYWz6IT.js.map +1 -0
  100. package/dist/table.d.ts +1 -1
  101. package/dist/table.js +1 -1
  102. package/dist/tabs.d.ts +9 -9
  103. package/dist/tabs.js +1 -1
  104. package/dist/tabs.js.map +1 -1
  105. package/dist/text-area.d.ts +2 -2
  106. package/dist/theme.d.ts +6 -6
  107. package/dist/toast.d.ts +8 -8
  108. package/dist/tooltip.d.ts +6 -6
  109. package/dist/utils.d.ts +1 -1
  110. package/package.json +14 -14
  111. package/dist/button-CdPMhyKg.js +0 -2
  112. package/dist/button-CdPMhyKg.js.map +0 -1
  113. package/dist/icon-button-CeeHZOhh.js +0 -2
  114. package/dist/icon-button-CeeHZOhh.js.map +0 -1
  115. package/dist/table-OYhLMxeE.js +0 -2
  116. package/dist/table-OYhLMxeE.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-BKykcpgJ.js","names":["clsx"],"sources":["../src/components/button/button.tsx"],"sourcesContent":["import { CircleNotchIcon } from \"@phosphor-icons/react/CircleNotch\";\nimport { cva } from \"class-variance-authority\";\nimport clsx from \"clsx\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { Children, cloneElement, forwardRef, isValidElement } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { parseBooleanish } from \"../../types/index.js\";\nimport type { VariantProps } from \"../../types/variant-props.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon } from \"../icon/index.js\";\nimport { Slot } from \"../slot/index.js\";\n\nconst buttonVariants = cva(\"\", {\n\tvariants: {\n\t\t/**\n\t\t * Defines the visual style of the Button.\n\t\t */\n\t\tappearance: {\n\t\t\tfilled:\n\t\t\t\t\"bg-filled-accent text-white focus-visible:ring-focus-accent not-disabled:hover:bg-filled-accent-hover h-9 border border-transparent px-3 text-sm font-medium\",\n\t\t\tghost:\n\t\t\t\t\"text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 h-9 border border-transparent px-3 text-sm font-medium\",\n\t\t\toutlined:\n\t\t\t\t\"border-accent-600 bg-form text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-accent-700 not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 h-9 border px-3 text-sm font-medium\",\n\t\t\tlink: \"text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:underline group/button-link border-transparent\",\n\t\t},\n\t\t/**\n\t\t * Whether or not the button is in a loading state, default `false`. Setting `isLoading` will\n\t\t * replace any `icon` with a spinner, or add one if an icon wasn't given.\n\t\t * It will also disable user interaction with the button and set `disabled`.\n\t\t */\n\t\tisLoading: {\n\t\t\tfalse: \"\",\n\t\t\ttrue: \"opacity-50\",\n\t\t},\n\t\t/**\n\t\t * Indicates the importance or impact level of the button, affecting its\n\t\t * color and styling to communicate its purpose to the user\n\t\t */\n\t\tpriority: {\n\t\t\tdanger: \"\",\n\t\t\tdefault: \"\",\n\t\t\tneutral: \"\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tappearance: \"outlined\",\n\t\tisLoading: false,\n\t\tpriority: \"default\",\n\t},\n\tcompoundVariants: [\n\t\t{\n\t\t\tappearance: \"ghost\",\n\t\t\tpriority: \"danger\",\n\t\t\tclass:\n\t\t\t\t\"text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700 border-transparent\",\n\t\t},\n\t\t{\n\t\t\tappearance: \"outlined\",\n\t\t\tpriority: \"danger\",\n\t\t\tclass:\n\t\t\t\t\"border-danger-600 bg-form text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:border-danger-700 not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700\",\n\t\t},\n\t\t{\n\t\t\tappearance: \"filled\",\n\t\t\tpriority: \"danger\",\n\t\t\tclass:\n\t\t\t\t\"bg-filled-danger focus-visible:ring-focus-danger not-disabled:hover:bg-filled-danger-hover border-transparent\",\n\t\t},\n\t\t{\n\t\t\tappearance: \"link\",\n\t\t\tpriority: \"danger\",\n\t\t\tclass: \"text-danger-600 focus-visible:ring-focus-danger\",\n\t\t},\n\t\t{\n\t\t\tappearance: \"ghost\",\n\t\t\tpriority: \"neutral\",\n\t\t\tclass:\n\t\t\t\t\"text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong border-transparent\",\n\t\t},\n\t\t{\n\t\t\tappearance: \"outlined\",\n\t\t\tpriority: \"neutral\",\n\t\t\tclass:\n\t\t\t\t\"border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong focus-visible:not-disabled:hover:border-accent-600\",\n\t\t},\n\t\t{\n\t\t\tappearance: \"filled\",\n\t\t\tpriority: \"neutral\",\n\t\t\tclass:\n\t\t\t\t\"bg-filled-neutral not-disabled:hover:bg-filled-neutral-hover border-transparent focus-visible:border-transparent text-neutral-50\",\n\t\t},\n\t\t{\n\t\t\tappearance: \"link\",\n\t\t\tpriority: \"neutral\",\n\t\t\tclass: \"text-strong focus-visible:ring-focus-accent\",\n\t\t},\n\t],\n});\n\ntype ButtonVariants = VariantProps<typeof buttonVariants>;\n\ntype ButtonAppearance = Pick<ButtonVariants, \"appearance\">[\"appearance\"];\ntype ButtonPriority = Pick<ButtonVariants, \"priority\">[\"priority\"];\n\n/**\n * The props for the `Button` component.\n */\ntype ButtonProps = ComponentProps<\"button\"> &\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\t/**\n\t\t * The side that the icon will render on, if one is present. If `state=\"pending\"`,\n\t\t * then the loading icon will also render on this side.\n\t\t * @default \"start\"\n\t\t */\n\t\ticonPlacement?: \"start\" | \"end\";\n\t} & (\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * Use the `asChild` prop to compose Radix's functionality onto alternative\n\t\t\t\t * element types or your own React components.\n\t\t\t\t *\n\t\t\t\t * When `asChild` is set to `true`, mantle will not render a default DOM\n\t\t\t\t * element, instead cloning the component's child and passing it the props and\n\t\t\t\t * behavior required to make it functional.\n\t\t\t\t *\n\t\t\t\t * asChild can be used as deeply as you need to. This means it is a great way\n\t\t\t\t * to compose multiple primitive's behavior together.\n\t\t\t\t *\n\t\t\t\t * @see https://www.radix-ui.com/docs/primitives/guides/composition#composition\n\t\t\t\t */\n\t\t\t\tasChild: true;\n\t\t\t\t/**\n\t\t\t\t * The default behavior of the button. Possible values are: `\"button\"`, `\"submit\"`, and `\"reset\"`.\n\t\t\t\t *\n\t\t\t\t * if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.\n\t\t\t\t *\n\t\t\t\t * If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type\n\t\t\t\t *\n\t\t\t\t * @enum\n\t\t\t\t * - `\"button\"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.\n\t\t\t\t * - `\"reset\"`: The button resets all the controls to their initial values.\n\t\t\t\t * - `\"submit\"`: The button submits the form data to the server.\n\t\t\t\t *\n\t\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type\n\t\t\t\t */\n\t\t\t\ttype?: ComponentProps<\"button\">[\"type\"];\n\t\t }\n\t\t| {\n\t\t\t\tasChild?: false | undefined;\n\t\t\t\t/**\n\t\t\t\t * The default behavior of the button. Possible values are: `\"button\"`, `\"submit\"`, and `\"reset\"`.\n\t\t\t\t *\n\t\t\t\t * if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.\n\t\t\t\t *\n\t\t\t\t * If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type\n\t\t\t\t *\n\t\t\t\t * @enum\n\t\t\t\t * - `\"button\"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.\n\t\t\t\t * - `\"reset\"`: The button resets all the controls to their initial values.\n\t\t\t\t * - `\"submit\"`: The button submits the form data to the server.\n\t\t\t\t *\n\t\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type\n\t\t\t\t */\n\t\t\t\ttype: Exclude<ComponentProps<\"button\">[\"type\"], undefined>;\n\t\t }\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://mantle.ngrok.com/components/button\n *\n * @example\n * ```tsx\n * <Button type=\"button\" appearance=\"filled\" priority=\"default\">\n * Click me\n * </Button>\n * ```\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,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdisabled: _disabled,\n\t\t\ticon: propIcon,\n\t\t\ticonPlacement = \"start\",\n\t\t\tisLoading = false,\n\t\t\tpriority = \"default\",\n\t\t\ttype,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst disabled = parseBooleanish(_ariaDisabled ?? _disabled ?? isLoading);\n\t\tconst icon = isLoading ? <CircleNotchIcon className=\"animate-spin\" /> : propIcon;\n\n\t\t/**\n\t\t * If the button has an icon and is not a link, add padding-start or padding-end to the button depending on the icon placement.\n\t\t */\n\t\tconst hasSpecialIconPadding = icon && appearance !== \"link\";\n\n\t\tconst buttonProps = {\n\t\t\t\"aria-disabled\": disabled,\n\t\t\tclassName: cx(\n\t\t\t\t\"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md\",\n\t\t\t\t\"focus:outline-hidden focus-visible:ring-4\",\n\t\t\t\t\"disabled:cursor-default disabled:opacity-50\",\n\t\t\t\t\"not-disabled:active:scale-97 ease-out transition-transform duration-150\",\n\t\t\t\tbuttonVariants({ appearance, priority, isLoading }),\n\t\t\t\tappearance !== \"link\" && \"font-sans\", // only enforce font-sans on non-link button appearances\n\t\t\t\thasSpecialIconPadding && iconPlacement === \"start\" && \"ps-2.5\",\n\t\t\t\thasSpecialIconPadding && iconPlacement === \"end\" && \"pe-2.5\",\n\t\t\t\tclassName,\n\t\t\t),\n\t\t\t\"data-appearance\": appearance,\n\t\t\t\"data-disabled\": disabled,\n\t\t\t\"data-loading\": isLoading,\n\t\t\t\"data-priority\": priority,\n\t\t\tdisabled,\n\t\t\tref,\n\t\t\t...props,\n\t\t};\n\n\t\tif (asChild) {\n\t\t\tinvariant(\n\t\t\t\tisValidElement<{ children?: ReactNode }>(children) && Children.only(children),\n\t\t\t\t\"When using `asChild`, Button must be passed a single child as a JSX tag.\",\n\t\t\t);\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\tchildren,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{icon && (\n\t\t\t\t\t\t\t\t<Icon svg={icon} className={clsx(iconPlacement === \"end\" && \"order-last\")} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{children.props.children}\n\t\t\t\t\t\t</>,\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} type={type}>\n\t\t\t\t{icon && <Icon svg={icon} className={clsx(iconPlacement === \"end\" && \"order-last\")} />}\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t},\n);\nButton.displayName = \"Button\";\n\nexport {\n\t//,\n\tButton,\n};\n\nexport type {\n\t//,\n\tButtonAppearance,\n\tButtonPriority,\n\tButtonProps,\n};\n"],"mappings":"udAYA,MAAM,EAAiB,EAAI,GAAI,CAC9B,SAAU,CAIT,WAAY,CACX,OACC,+JACD,MACC,gLACD,SACC,4NACD,KAAM,oHACN,CAMD,UAAW,CACV,MAAO,GACP,KAAM,aACN,CAKD,SAAU,CACT,OAAQ,GACR,QAAS,GACT,QAAS,GACT,CACD,CACD,gBAAiB,CAChB,WAAY,WACZ,UAAW,GACX,SAAU,UACV,CACD,iBAAkB,CACjB,CACC,WAAY,QACZ,SAAU,SACV,MACC,4IACD,CACD,CACC,WAAY,WACZ,SAAU,SACV,MACC,wLACD,CACD,CACC,WAAY,SACZ,SAAU,SACV,MACC,gHACD,CACD,CACC,WAAY,OACZ,SAAU,SACV,MAAO,kDACP,CACD,CACC,WAAY,QACZ,SAAU,UACV,MACC,qIACD,CACD,CACC,WAAY,WACZ,SAAU,UACV,MACC,2PACD,CACD,CACC,WAAY,SACZ,SAAU,UACV,MACC,mIACD,CACD,CACC,WAAY,OACZ,SAAU,UACV,MAAO,8CACP,CACD,CACD,CAAC,CA0FI,EAAS,GAEb,CACC,gBAAiB,EACjB,aAAa,WACb,UACA,WACA,YACA,SAAU,EACV,KAAM,EACN,gBAAgB,QAChB,YAAY,GACZ,WAAW,UACX,OACA,GAAG,GAEJ,IACI,CACJ,IAAM,EAAW,EAAgB,GAAiB,GAAa,EAAU,CACnE,EAAO,EAAY,EAAC,EAAD,CAAiB,UAAU,eAAiB,CAAA,CAAG,EAKlE,EAAwB,GAAQ,IAAe,OAE/C,EAAc,CACnB,gBAAiB,EACjB,UAAW,EACV,+EACA,4CACA,8CACA,0EACA,EAAe,CAAE,aAAY,WAAU,YAAW,CAAC,CACnD,IAAe,QAAU,YACzB,GAAyB,IAAkB,SAAW,SACtD,GAAyB,IAAkB,OAAS,SACpD,EACA,CACD,kBAAmB,EACnB,gBAAiB,EACjB,eAAgB,EAChB,gBAAiB,EACjB,WACA,MACA,GAAG,EACH,CAwBD,OAtBI,GACH,EACC,EAAyC,EAAS,EAAI,EAAS,KAAK,EAAS,CAC7E,2EACA,CAGA,EAAC,EAAD,CAAM,GAAI,WACR,EACA,EACA,EAAE,CACF,EAAA,EAAA,CAAA,SAAA,CACE,GACA,EAAC,EAAD,CAAM,IAAK,EAAM,UAAWA,EAAK,IAAkB,OAAS,aAAa,CAAI,CAAA,CAE7E,EAAS,MAAM,SACd,CAAA,CAAA,CACH,CACK,CAAA,EAKR,EAAC,SAAD,CAAQ,GAAI,EAAmB,gBAA/B,CACE,GAAQ,EAAC,EAAD,CAAM,IAAK,EAAM,UAAWA,EAAK,IAAkB,OAAS,aAAa,CAAI,CAAA,CACrF,EACO,IAGX,CACD,EAAO,YAAc"}
@@ -1,16 +1,16 @@
1
1
  import { t as DeepNonNullable } from "./deep-non-nullable-BBByg3-i.js";
2
2
  import { t as VariantProps$1 } from "./variant-props-Bm6Y-jfm.js";
3
- import * as react from "react";
3
+ import * as _$react from "react";
4
4
  import { ComponentProps, ReactNode } from "react";
5
- import * as class_variance_authority0 from "class-variance-authority";
6
- import * as class_variance_authority_types0 from "class-variance-authority/types";
5
+ import * as _$class_variance_authority0 from "class-variance-authority";
6
+ import * as _$class_variance_authority_types0 from "class-variance-authority/types";
7
7
 
8
8
  //#region src/components/button/button.d.ts
9
9
  declare const buttonVariants: (props?: ({
10
- appearance?: "link" | "filled" | "ghost" | "outlined" | null | undefined;
10
+ appearance?: "filled" | "link" | "ghost" | "outlined" | null | undefined;
11
11
  isLoading?: boolean | null | undefined;
12
12
  priority?: "default" | "danger" | "neutral" | null | undefined;
13
- } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
+ } & _$class_variance_authority_types0.ClassProp) | undefined) => string;
14
14
  type ButtonVariants = VariantProps$1<typeof buttonVariants>;
15
15
  /**
16
16
  * The props for the `Button` component.
@@ -90,11 +90,11 @@ type ButtonProps = ComponentProps<"button"> & ButtonVariants & {
90
90
  * </Button>
91
91
  * ```
92
92
  */
93
- declare const Button: react.ForwardRefExoticComponent<(Omit<react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<class_variance_authority0.VariantProps<(props?: ({
94
- appearance?: "link" | "filled" | "ghost" | "outlined" | null | undefined;
93
+ declare const Button: _$react.ForwardRefExoticComponent<(Omit<_$react.ClassAttributes<HTMLButtonElement> & _$react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<_$class_variance_authority0.VariantProps<(props?: ({
94
+ appearance?: "filled" | "link" | "ghost" | "outlined" | null | undefined;
95
95
  isLoading?: boolean | null | undefined;
96
96
  priority?: "default" | "danger" | "neutral" | null | undefined;
97
- } & class_variance_authority_types0.ClassProp) | undefined) => string>>> & {
97
+ } & _$class_variance_authority_types0.ClassProp) | undefined) => string>>> & {
98
98
  /**
99
99
  * An icon to render inside the button. If the `state` is `"pending"`, then
100
100
  * the icon will automatically be replaced with a spinner.
@@ -136,11 +136,11 @@ declare const Button: react.ForwardRefExoticComponent<(Omit<react.ClassAttribute
136
136
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type
137
137
  */
138
138
  type?: ComponentProps<"button">["type"];
139
- }, "ref"> | Omit<react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<class_variance_authority0.VariantProps<(props?: ({
140
- appearance?: "link" | "filled" | "ghost" | "outlined" | null | undefined;
139
+ }, "ref"> | Omit<_$react.ClassAttributes<HTMLButtonElement> & _$react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<_$class_variance_authority0.VariantProps<(props?: ({
140
+ appearance?: "filled" | "link" | "ghost" | "outlined" | null | undefined;
141
141
  isLoading?: boolean | null | undefined;
142
142
  priority?: "default" | "danger" | "neutral" | null | undefined;
143
- } & class_variance_authority_types0.ClassProp) | undefined) => string>>> & {
143
+ } & _$class_variance_authority_types0.ClassProp) | undefined) => string>>> & {
144
144
  /**
145
145
  * An icon to render inside the button. If the `state` is `"pending"`, then
146
146
  * the icon will automatically be replaced with a spinner.
@@ -169,7 +169,7 @@ declare const Button: react.ForwardRefExoticComponent<(Omit<react.ClassAttribute
169
169
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type
170
170
  */
171
171
  type: Exclude<ComponentProps<"button">["type"], undefined>;
172
- }, "ref">) & react.RefAttributes<HTMLButtonElement>>;
172
+ }, "ref">) & _$react.RefAttributes<HTMLButtonElement>>;
173
173
  //#endregion
174
174
  export { ButtonProps as n, Button as t };
175
- //# sourceMappingURL=button-B--2eT25.d.ts.map
175
+ //# sourceMappingURL=button-BaNwe1ud.d.ts.map
package/dist/button.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as IconButtonProps, t as IconButton } from "./icon-button-DMNdrMSf.js";
2
- import { n as ButtonProps, t as Button } from "./button-B--2eT25.js";
3
- import { n as ButtonGroupProps, t as ButtonGroup } from "./index-CI-RDnHZ.js";
1
+ import { n as IconButtonProps, t as IconButton } from "./icon-button-gO-7F_MZ.js";
2
+ import { n as ButtonProps, t as Button } from "./button-BaNwe1ud.js";
3
+ import { n as ButtonGroupProps, t as ButtonGroup } from "./index-Cj2NX2Dg.js";
4
4
  export { Button, ButtonGroup, ButtonGroupProps, ButtonProps, IconButton, IconButtonProps };
package/dist/button.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./icon-button-CeeHZOhh.js";import{t}from"./button-CdPMhyKg.js";import{t as n}from"./button-eAPtlsYO.js";export{t as Button,n as ButtonGroup,e as IconButton};
1
+ import{t as e}from"./icon-button-CxxVPiKp.js";import{t}from"./button-BKykcpgJ.js";import{t as n}from"./button-eAPtlsYO.js";export{t as Button,n as ButtonGroup,e as IconButton};
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import { DateRange, DayPicker } from "react-day-picker";
4
4
 
5
5
  //#region src/components/calendar/calendar.d.ts
@@ -34,7 +34,7 @@ declare function Calendar({
34
34
  classNames,
35
35
  showOutsideDays,
36
36
  ...props
37
- }: CalendarProps): react_jsx_runtime0.JSX.Element;
37
+ }: CalendarProps): _$react_jsx_runtime0.JSX.Element;
38
38
  declare namespace Calendar {
39
39
  var displayName: string;
40
40
  }
package/dist/calendar.js CHANGED
@@ -1,2 +1,2 @@
1
- import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./icon-BMH0fD_b.js";import{n,r}from"./icon-button-CeeHZOhh.js";import{jsx as i}from"react/jsx-runtime";import{CaretLeftIcon as a}from"@phosphor-icons/react/CaretLeft";import{CaretRightIcon as o}from"@phosphor-icons/react/CaretRight";import{DayPicker as s}from"react-day-picker";function c({className:c,classNames:l,showOutsideDays:u=!1,...d}){return i(s,{animate:!1,components:{Chevron:e=>i(t,{svg:e.orientation===`left`?i(a,{}):i(o,{}),className:`size-4`})},classNames:{root:e(`isolate`,c),button_next:e(n,r({appearance:`ghost`,size:`sm`}),`absolute right-0`),button_previous:e(n,r({appearance:`ghost`,size:`sm`}),`absolute left-0`),caption_label:`text-sm font-medium`,day:e(`overflow-hidden text-center text-sm p-0 relative focus-within:relative focus-within:z-20 size-7 rounded-md`,d.mode===`range`?`first:has-aria-selected:rounded-l-md last:has-aria-selected:rounded-r-md`:``),day_button:`day size-full rounded-md not-aria-selected:not-disabled:hover:bg-filled-accent/15`,disabled:`text-muted opacity-50`,hidden:`invisible`,month:`space-y-4`,month_caption:`flex justify-center pt-1 relative items-center`,month_grid:`w-full border-collapse space-y-1`,months:`flex flex-col sm:flex-row gap-y-4 sm:gap-x-4 sm:gap-y-0 relative max-w-min`,nav:`flex items-center absolute inset-x-0 top-1 h-5 justify-between z-10`,outside:`day-outside aria-selected:text-on-filled opacity-50 text-muted`,range_end:`day-range-end [&:not(.day-range-start)]:rounded-l-none`,range_middle:`day-range-middle not-disabled:aria-selected:bg-filled-accent/15 aria-selected:text-strong rounded-none not-disabled:aria-selected:hover:bg-filled-accent/25`,range_start:`day-range-start [&:not(.day-range-end)]:rounded-r-none`,selected:`not-disabled:bg-filled-accent text-on-filled not-disabled:hover:bg-filled-accent`,today:`not-aria-selected:not-disabled:text-accent-600 font-medium not-aria-selected:not-disabled:bg-filled-accent/10 rounded-md`,week:`flex w-full mt-1`,weekday:`text-body w-7 text-[0.8rem] text-center font-normal`,weekdays:`flex`,...l},showOutsideDays:u,...d})}c.displayName=`Calendar`;export{c as Calendar};
1
+ import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./icon-BMH0fD_b.js";import{n,r}from"./icon-button-CxxVPiKp.js";import{jsx as i}from"react/jsx-runtime";import{CaretLeftIcon as a}from"@phosphor-icons/react/CaretLeft";import{CaretRightIcon as o}from"@phosphor-icons/react/CaretRight";import{DayPicker as s}from"react-day-picker";function c({className:c,classNames:l,showOutsideDays:u=!1,...d}){return i(s,{animate:!1,components:{Chevron:e=>i(t,{svg:e.orientation===`left`?i(a,{}):i(o,{}),className:`size-4`})},classNames:{root:e(`isolate`,c),button_next:e(n,r({appearance:`ghost`,size:`sm`}),`absolute right-0`),button_previous:e(n,r({appearance:`ghost`,size:`sm`}),`absolute left-0`),caption_label:`text-sm font-medium`,day:e(`overflow-hidden text-center text-sm p-0 relative focus-within:relative focus-within:z-20 size-7 rounded-md`,d.mode===`range`?`first:has-aria-selected:rounded-l-md last:has-aria-selected:rounded-r-md`:``),day_button:`day size-full rounded-md not-aria-selected:not-disabled:hover:bg-filled-accent/15`,disabled:`text-muted opacity-50`,hidden:`invisible`,month:`space-y-4`,month_caption:`flex justify-center pt-1 relative items-center`,month_grid:`w-full border-collapse space-y-1`,months:`flex flex-col sm:flex-row gap-y-4 sm:gap-x-4 sm:gap-y-0 relative max-w-min`,nav:`flex items-center absolute inset-x-0 top-1 h-5 justify-between z-10`,outside:`day-outside aria-selected:text-on-filled opacity-50 text-muted`,range_end:`day-range-end [&:not(.day-range-start)]:rounded-l-none`,range_middle:`day-range-middle not-disabled:aria-selected:bg-filled-accent/15 aria-selected:text-strong rounded-none not-disabled:aria-selected:hover:bg-filled-accent/25`,range_start:`day-range-start [&:not(.day-range-end)]:rounded-r-none`,selected:`not-disabled:bg-filled-accent text-on-filled not-disabled:hover:bg-filled-accent`,today:`not-aria-selected:not-disabled:text-accent-600 font-medium not-aria-selected:not-disabled:bg-filled-accent/10 rounded-md`,week:`flex w-full mt-1`,weekday:`text-body w-7 text-[0.8rem] text-center font-normal`,weekdays:`flex`,...l},showOutsideDays:u,...d})}c.displayName=`Calendar`;export{c as Calendar};
2
2
  //# sourceMappingURL=calendar.js.map
package/dist/card.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as WithAsChild } from "./as-child-CRRsxi3Y.js";
2
- import * as react from "react";
2
+ import * as _$react from "react";
3
3
  import { ComponentProps, HTMLAttributes } from "react";
4
4
 
5
5
  //#region src/components/card/card.d.ts
@@ -47,7 +47,7 @@ declare const Card: {
47
47
  * </Card.Root>
48
48
  * ```
49
49
  */
50
- readonly Root: react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
50
+ readonly Root: _$react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
51
51
  /**
52
52
  * The main content of a card.
53
53
  *
@@ -62,7 +62,7 @@ declare const Card: {
62
62
  * </Card.Root>
63
63
  * ```
64
64
  */
65
- readonly Body: react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
65
+ readonly Body: _$react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
66
66
  /**
67
67
  * The footer container of a card.
68
68
  *
@@ -83,7 +83,7 @@ declare const Card: {
83
83
  * </Card.Root>
84
84
  * ```
85
85
  */
86
- readonly Footer: react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
86
+ readonly Footer: _$react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
87
87
  /**
88
88
  * The header container of a card.
89
89
  *
@@ -104,7 +104,7 @@ declare const Card: {
104
104
  * </Card.Root>
105
105
  * ```
106
106
  */
107
- readonly Header: react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
107
+ readonly Header: _$react.ForwardRefExoticComponent<Omit<CardProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
108
108
  /**
109
109
  * The title of a card.
110
110
  *
@@ -125,7 +125,7 @@ declare const Card: {
125
125
  * </Card.Root>
126
126
  * ```
127
127
  */
128
- readonly Title: react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & WithAsChild & react.RefAttributes<HTMLHeadingElement>>;
128
+ readonly Title: _$react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & WithAsChild & _$react.RefAttributes<HTMLHeadingElement>>;
129
129
  };
130
130
  //#endregion
131
131
  export { Card, type CardProps, type CardTitleProps };
@@ -1,5 +1,5 @@
1
1
  import { o as WithValidation } from "./types-Cq6RWU7Q.js";
2
- import * as react from "react";
2
+ import * as _$react from "react";
3
3
 
4
4
  //#region src/components/checkbox/checkbox.d.ts
5
5
  type CheckedState = boolean | "indeterminate";
@@ -19,7 +19,7 @@ type CheckedState = boolean | "indeterminate";
19
19
  * </form>
20
20
  * ```
21
21
  */
22
- declare const Checkbox: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "defaultChecked" | "type" | "checked"> & WithValidation & {
22
+ declare const Checkbox: _$react.ForwardRefExoticComponent<Omit<Omit<_$react.DetailedHTMLProps<_$react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "defaultChecked" | "type" | "checked"> & WithValidation & {
23
23
  /**
24
24
  * The controlled checked state of the checkbox. Must be used in conjunction with onChange.
25
25
  */
@@ -28,7 +28,7 @@ declare const Checkbox: react.ForwardRefExoticComponent<Omit<Omit<react.Detailed
28
28
  * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.
29
29
  */
30
30
  defaultChecked?: CheckedState;
31
- } & react.RefAttributes<HTMLInputElement>>;
31
+ } & _$react.RefAttributes<HTMLInputElement>>;
32
32
  //#endregion
33
33
  export { Checkbox };
34
34
  //# sourceMappingURL=checkbox.d.ts.map
package/dist/checkbox.js CHANGED
@@ -1,2 +1,2 @@
1
- import{t as e}from"./compose-refs-DeIsFv68.js";import{forwardRef as t,useEffect as n,useRef as r,useState as i}from"react";import a from"clsx";import{jsx as o}from"react/jsx-runtime";const s=e=>e===`indeterminate`,c=t(({"aria-invalid":t,className:c,checked:l,defaultChecked:u,defaultValue:d=`on`,onClick:f,readOnly:p,validation:m,...h},g)=>{let _=r(null),[v]=i(u),y=t!=null&&t!==`false`?`error`:typeof m==`function`?m():m,b=t??y===`error`;return n(()=>{_.current&&(_.current.indeterminate=s(l))},[l]),n(()=>{_.current&&(_.current.indeterminate=s(v))},[v]),o(`input`,{"aria-checked":s(l)?`mixed`:l,"aria-invalid":b,className:a(`border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50`,`bg-center bg-no-repeat focus:outline-hidden`,`focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4`,`checked:border-accent-500 checked:bg-accent-500 checked:bg-checked-icon`,`indeterminate:border-accent-500 indeterminate:bg-accent-500 indeterminate:bg-indeterminate-icon`,`data-validation-success:border-success-600 data-validation-success:checked:bg-success-500 data-validation-success:indeterminate:bg-success-500 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-500 data-validation-warning:indeterminate:bg-warning-500 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-500 data-validation-error:indeterminate:bg-danger-500 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger`,`where:block where:size-4 where:p-0`,c),checked:s(l)?void 0:l,"data-validation":y||void 0,defaultChecked:s(v)?void 0:v,defaultValue:d,onClick:e=>{if(p){e.preventDefault();return}f?.(e)},readOnly:p,ref:e(_,g),type:`checkbox`,...h})});c.displayName=`Checkbox`;export{c as Checkbox};
1
+ import{t as e}from"./compose-refs-DeIsFv68.js";import{forwardRef as t,useEffect as n,useRef as r,useState as i}from"react";import a from"clsx";import{jsx as o}from"react/jsx-runtime";const s=e=>e===`indeterminate`,c=t(({"aria-invalid":t,className:c,checked:l,defaultChecked:u,defaultValue:d=`on`,onClick:f,readOnly:p,validation:m,...h},g)=>{let _=r(null),[v]=i(u),y=t!=null&&t!==`false`?`error`:typeof m==`function`?m():m,b=t??y===`error`;return n(()=>{_.current&&(_.current.indeterminate=s(l))},[l]),n(()=>{_.current&&(_.current.indeterminate=s(v))},[v]),o(`input`,{"aria-checked":s(l)?`mixed`:l,"aria-invalid":b,className:a(`border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50`,`bg-center bg-no-repeat focus:outline-hidden`,`focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4`,`checked:border-accent-600 checked:bg-accent-600 checked:bg-checked-icon`,`indeterminate:border-accent-600 indeterminate:bg-accent-600 indeterminate:bg-indeterminate-icon`,`data-validation-success:border-success-600 data-validation-success:checked:bg-success-600 data-validation-success:indeterminate:bg-success-600 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-600 data-validation-warning:indeterminate:bg-warning-600 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-600 data-validation-error:indeterminate:bg-danger-600 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger`,`where:block where:size-4 where:p-0`,c),checked:s(l)?void 0:l,"data-validation":y||void 0,defaultChecked:s(v)?void 0:v,defaultValue:d,onClick:e=>{if(p){e.preventDefault();return}f?.(e)},readOnly:p,ref:e(_,g),type:`checkbox`,...h})});c.displayName=`Checkbox`;export{c as Checkbox};
2
2
  //# sourceMappingURL=checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","names":["clsx"],"sources":["../src/components/checkbox/checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport clsx from \"clsx\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentRef } from \"react\";\nimport { composeRefs } from \"../../utils/compose-refs/index.js\";\nimport type { WithValidation } from \"../input/index.js\";\n\ntype CheckedState = boolean | \"indeterminate\";\n\nconst isIndeterminate = (checked: CheckedState | undefined): checked is \"indeterminate\" =>\n\tchecked === \"indeterminate\";\n\ntype Props = Omit<ComponentPropsWithoutRef<\"input\">, \"type\" | \"checked\" | \"defaultChecked\"> &\n\tWithValidation & {\n\t\t/**\n\t\t * The controlled checked state of the checkbox. Must be used in conjunction with onChange.\n\t\t */\n\t\tchecked?: CheckedState;\n\t\t/**\n\t\t * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n\t\t */\n\t\tdefaultChecked?: CheckedState;\n\t};\n\n/**\n * A form control that allows the user to toggle between checked and not checked.\n * Supports indeterminate state.\n *\n * @see https://mantle.ngrok.com/components/checkbox\n *\n * @example\n * ```tsx\n * <form>\n * <Label htmlFor=\"terms\" className=\"flex items-center gap-2\">\n * <Checkbox name=\"terms\" id=\"terms\" />\n * Accept terms and conditions\n * </Label>\n * </form>\n * ```\n */\nconst Checkbox = forwardRef<ComponentRef<\"input\">, Props>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tclassName,\n\t\t\tchecked: _checked,\n\t\t\tdefaultChecked: _defaultChecked,\n\t\t\tdefaultValue = \"on\",\n\t\t\tonClick,\n\t\t\treadOnly,\n\t\t\tvalidation: _validation,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst innerRef = useRef<ComponentRef<\"input\">>(null);\n\t\tconst [defaultChecked] = useState(_defaultChecked);\n\t\tconst isInvalid = _ariaInvalid != null && _ariaInvalid !== \"false\";\n\t\tconst validation = isInvalid\n\t\t\t? \"error\"\n\t\t\t: typeof _validation === \"function\"\n\t\t\t\t? _validation()\n\t\t\t\t: _validation;\n\t\tconst ariaInvalid = _ariaInvalid ?? validation === \"error\";\n\n\t\tuseEffect(() => {\n\t\t\tif (innerRef.current) {\n\t\t\t\tinnerRef.current.indeterminate = isIndeterminate(_checked);\n\t\t\t}\n\t\t}, [_checked]);\n\n\t\tuseEffect(() => {\n\t\t\tif (innerRef.current) {\n\t\t\t\tinnerRef.current.indeterminate = isIndeterminate(defaultChecked);\n\t\t\t}\n\t\t}, [defaultChecked]);\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\taria-checked={isIndeterminate(_checked) ? \"mixed\" : _checked}\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={clsx(\n\t\t\t\t\t\"border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50\",\n\t\t\t\t\t\"bg-center bg-no-repeat focus:outline-hidden\",\n\t\t\t\t\t\"focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4\",\n\t\t\t\t\t\"checked:border-accent-500 checked:bg-accent-500 checked:bg-checked-icon\",\n\t\t\t\t\t\"indeterminate:border-accent-500 indeterminate:bg-accent-500 indeterminate:bg-indeterminate-icon\",\n\t\t\t\t\t\"data-validation-success:border-success-600 data-validation-success:checked:bg-success-500 data-validation-success:indeterminate:bg-success-500 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success\",\n\t\t\t\t\t\"data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-500 data-validation-warning:indeterminate:bg-warning-500 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning\",\n\t\t\t\t\t\"data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-500 data-validation-error:indeterminate:bg-danger-500 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger\",\n\t\t\t\t\t\"where:block where:size-4 where:p-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tchecked={isIndeterminate(_checked) ? undefined : _checked}\n\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\tdefaultChecked={isIndeterminate(defaultChecked) ? undefined : defaultChecked}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tif (readOnly) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tref={composeRefs(innerRef, ref)}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nCheckbox.displayName = \"Checkbox\";\n\nexport {\n\t//,\n\tCheckbox,\n};\n"],"mappings":"uLAUA,MAAM,EAAmB,GACxB,IAAY,gBA8BP,EAAW,GAEf,CACC,eAAgB,EAChB,YACA,QAAS,EACT,eAAgB,EAChB,eAAe,KACf,UACA,WACA,WAAY,EACZ,GAAG,GAEJ,IACI,CACJ,IAAM,EAAW,EAA8B,KAAK,CAC9C,CAAC,GAAkB,EAAS,EAAgB,CAE5C,EADY,GAAgB,MAAQ,IAAiB,QAExD,QACA,OAAO,GAAgB,WACtB,GAAa,CACb,EACE,EAAc,GAAgB,IAAe,QAcnD,OAZA,MAAgB,CACX,EAAS,UACZ,EAAS,QAAQ,cAAgB,EAAgB,EAAS,GAEzD,CAAC,EAAS,CAAC,CAEd,MAAgB,CACX,EAAS,UACZ,EAAS,QAAQ,cAAgB,EAAgB,EAAe,GAE/D,CAAC,EAAe,CAAC,CAGnB,EAAC,QAAD,CACC,eAAc,EAAgB,EAAS,CAAG,QAAU,EACpD,eAAc,EACd,UAAWA,EACV,qIACA,8CACA,oHACA,0EACA,kGACA,mQACA,mQACA,oPACA,qCACA,EACA,CACD,QAAS,EAAgB,EAAS,CAAG,IAAA,GAAY,EACjD,kBAAiB,GAAc,IAAA,GAC/B,eAAgB,EAAgB,EAAe,CAAG,IAAA,GAAY,EAChD,eACd,QAAU,GAAU,CACnB,GAAI,EAAU,CACb,EAAM,gBAAgB,CACtB,OAED,IAAU,EAAM,EAEP,WACV,IAAK,EAAY,EAAU,EAAI,CAC/B,KAAK,WACL,GAAI,EACH,CAAA,EAGJ,CACD,EAAS,YAAc"}
1
+ {"version":3,"file":"checkbox.js","names":["clsx"],"sources":["../src/components/checkbox/checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport clsx from \"clsx\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentRef } from \"react\";\nimport { composeRefs } from \"../../utils/compose-refs/index.js\";\nimport type { WithValidation } from \"../input/index.js\";\n\ntype CheckedState = boolean | \"indeterminate\";\n\nconst isIndeterminate = (checked: CheckedState | undefined): checked is \"indeterminate\" =>\n\tchecked === \"indeterminate\";\n\ntype Props = Omit<ComponentPropsWithoutRef<\"input\">, \"type\" | \"checked\" | \"defaultChecked\"> &\n\tWithValidation & {\n\t\t/**\n\t\t * The controlled checked state of the checkbox. Must be used in conjunction with onChange.\n\t\t */\n\t\tchecked?: CheckedState;\n\t\t/**\n\t\t * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n\t\t */\n\t\tdefaultChecked?: CheckedState;\n\t};\n\n/**\n * A form control that allows the user to toggle between checked and not checked.\n * Supports indeterminate state.\n *\n * @see https://mantle.ngrok.com/components/checkbox\n *\n * @example\n * ```tsx\n * <form>\n * <Label htmlFor=\"terms\" className=\"flex items-center gap-2\">\n * <Checkbox name=\"terms\" id=\"terms\" />\n * Accept terms and conditions\n * </Label>\n * </form>\n * ```\n */\nconst Checkbox = forwardRef<ComponentRef<\"input\">, Props>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tclassName,\n\t\t\tchecked: _checked,\n\t\t\tdefaultChecked: _defaultChecked,\n\t\t\tdefaultValue = \"on\",\n\t\t\tonClick,\n\t\t\treadOnly,\n\t\t\tvalidation: _validation,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst innerRef = useRef<ComponentRef<\"input\">>(null);\n\t\tconst [defaultChecked] = useState(_defaultChecked);\n\t\tconst isInvalid = _ariaInvalid != null && _ariaInvalid !== \"false\";\n\t\tconst validation = isInvalid\n\t\t\t? \"error\"\n\t\t\t: typeof _validation === \"function\"\n\t\t\t\t? _validation()\n\t\t\t\t: _validation;\n\t\tconst ariaInvalid = _ariaInvalid ?? validation === \"error\";\n\n\t\tuseEffect(() => {\n\t\t\tif (innerRef.current) {\n\t\t\t\tinnerRef.current.indeterminate = isIndeterminate(_checked);\n\t\t\t}\n\t\t}, [_checked]);\n\n\t\tuseEffect(() => {\n\t\t\tif (innerRef.current) {\n\t\t\t\tinnerRef.current.indeterminate = isIndeterminate(defaultChecked);\n\t\t\t}\n\t\t}, [defaultChecked]);\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\taria-checked={isIndeterminate(_checked) ? \"mixed\" : _checked}\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={clsx(\n\t\t\t\t\t\"border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50\",\n\t\t\t\t\t\"bg-center bg-no-repeat focus:outline-hidden\",\n\t\t\t\t\t\"focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4\",\n\t\t\t\t\t\"checked:border-accent-600 checked:bg-accent-600 checked:bg-checked-icon\",\n\t\t\t\t\t\"indeterminate:border-accent-600 indeterminate:bg-accent-600 indeterminate:bg-indeterminate-icon\",\n\t\t\t\t\t\"data-validation-success:border-success-600 data-validation-success:checked:bg-success-600 data-validation-success:indeterminate:bg-success-600 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success\",\n\t\t\t\t\t\"data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-600 data-validation-warning:indeterminate:bg-warning-600 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning\",\n\t\t\t\t\t\"data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-600 data-validation-error:indeterminate:bg-danger-600 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger\",\n\t\t\t\t\t\"where:block where:size-4 where:p-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tchecked={isIndeterminate(_checked) ? undefined : _checked}\n\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\tdefaultChecked={isIndeterminate(defaultChecked) ? undefined : defaultChecked}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tif (readOnly) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tref={composeRefs(innerRef, ref)}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nCheckbox.displayName = \"Checkbox\";\n\nexport {\n\t//,\n\tCheckbox,\n};\n"],"mappings":"uLAUA,MAAM,EAAmB,GACxB,IAAY,gBA8BP,EAAW,GAEf,CACC,eAAgB,EAChB,YACA,QAAS,EACT,eAAgB,EAChB,eAAe,KACf,UACA,WACA,WAAY,EACZ,GAAG,GAEJ,IACI,CACJ,IAAM,EAAW,EAA8B,KAAK,CAC9C,CAAC,GAAkB,EAAS,EAAgB,CAE5C,EADY,GAAgB,MAAQ,IAAiB,QAExD,QACA,OAAO,GAAgB,WACtB,GAAa,CACb,EACE,EAAc,GAAgB,IAAe,QAcnD,OAZA,MAAgB,CACX,EAAS,UACZ,EAAS,QAAQ,cAAgB,EAAgB,EAAS,GAEzD,CAAC,EAAS,CAAC,CAEd,MAAgB,CACX,EAAS,UACZ,EAAS,QAAQ,cAAgB,EAAgB,EAAe,GAE/D,CAAC,EAAe,CAAC,CAGnB,EAAC,QAAD,CACC,eAAc,EAAgB,EAAS,CAAG,QAAU,EACpD,eAAc,EACd,UAAWA,EACV,qIACA,8CACA,oHACA,0EACA,kGACA,mQACA,mQACA,oPACA,qCACA,EACA,CACD,QAAS,EAAgB,EAAS,CAAG,IAAA,GAAY,EACjD,kBAAiB,GAAc,IAAA,GAC/B,eAAgB,EAAgB,EAAe,CAAG,IAAA,GAAY,EAChD,eACd,QAAU,GAAU,CACnB,GAAI,EAAU,CACb,EAAM,gBAAgB,CACtB,OAED,IAAU,EAAM,EAEP,WACV,IAAK,EAAY,EAAU,EAAI,CAC/B,KAAK,WACL,GAAI,EACH,CAAA,EAGJ,CACD,EAAS,YAAc"}
@@ -1,9 +1,9 @@
1
1
  import { t as SvgAttributes } from "./types-yU-Byhue.js";
2
2
  import { t as WithAsChild } from "./as-child-CRRsxi3Y.js";
3
3
  import { C as parseLanguage, D as LineRange, E as decorateHighlightedHtml, S as isSupportedLanguage, _ as normalizeIndentation, a as Mode, b as isIndentation, c as ResolvedPreRenderedCodeBlockProps, d as parseMetastring, f as resolvePreRenderedCodeBlockProps, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, i as MetaInput, l as defaultMeta, m as parseCodeBlockHighlightLines, n as DefaultMeta, o as ResolvePreRenderedCodeBlockPropsInput, p as tokenizeMetastring, r as Meta, s as ResolvePreRenderedCodeBlockPropsResult, t as CodeBlockPreElementInput, u as normalizeValue, v as Indentation, w as supportedLanguages, x as SupportedLanguage, y as inferIndentation } from "./resolve-pre-rendered-props-51i50IL2.js";
4
- import * as react from "react";
4
+ import * as _$react from "react";
5
5
  import { ComponentProps, HTMLAttributes, ReactNode } from "react";
6
- import * as react_jsx_runtime0 from "react/jsx-runtime";
6
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
7
  import { Content, List, Trigger } from "@radix-ui/react-tabs";
8
8
 
9
9
  //#region src/components/code-block/mantle-code.d.ts
@@ -135,7 +135,7 @@ type CodeBlockCodeProps = Omit<ComponentProps<"pre">, "children"> & {
135
135
  */
136
136
  value: MantleCodeBlockValue;
137
137
  };
138
- type CodeBlockCopyButtonProps = Omit<ComponentProps<"button">, "children" | "type"> & WithAsChild & {
138
+ type CodeBlockCopyButtonProps = Omit<ComponentProps<"button">, "children" | "type"> & {
139
139
  /**
140
140
  * Callback fired when the copy button is clicked, passes the copied text as an argument.
141
141
  */
@@ -186,7 +186,7 @@ declare function CodeBlockIconComponent({
186
186
  preset,
187
187
  svg: _svgProp,
188
188
  ...props
189
- }: CodeBlockIconProps): react_jsx_runtime0.JSX.Element;
189
+ }: CodeBlockIconProps): _$react_jsx_runtime0.JSX.Element;
190
190
  declare namespace CodeBlockIconComponent {
191
191
  var displayName: string;
192
192
  }
@@ -235,27 +235,27 @@ declare const CodeBlock: {
235
235
  /**
236
236
  * The root component of the `CodeBlock`.
237
237
  */
238
- readonly Root: react.ForwardRefExoticComponent<Omit<CodeBlockRootProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
238
+ readonly Root: _$react.ForwardRefExoticComponent<Omit<CodeBlockRootProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
239
239
  /**
240
240
  * The body of the `CodeBlock`. Contains `Code` and optional `CopyButton`.
241
241
  */
242
- readonly Body: react.ForwardRefExoticComponent<Omit<react.ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & react.RefAttributes<HTMLDivElement>>;
242
+ readonly Body: _$react.ForwardRefExoticComponent<Omit<_$react.ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
243
243
  /**
244
244
  * The code content. Renders pre-highlighted Shiki HTML when the Vite plugin is active.
245
245
  */
246
- readonly Code: react.ForwardRefExoticComponent<Omit<CodeBlockCodeProps, "ref"> & react.RefAttributes<HTMLPreElement>>;
246
+ readonly Code: _$react.ForwardRefExoticComponent<Omit<CodeBlockCodeProps, "ref"> & _$react.RefAttributes<HTMLPreElement>>;
247
247
  /**
248
248
  * The optional copy button.
249
249
  */
250
- readonly CopyButton: react.ForwardRefExoticComponent<Omit<CodeBlockCopyButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
250
+ readonly CopyButton: _$react.ForwardRefExoticComponent<Omit<CodeBlockCopyButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
251
251
  /**
252
252
  * The optional expander button for collapsible code blocks.
253
253
  */
254
- readonly ExpanderButton: react.ForwardRefExoticComponent<Omit<CodeBlockExpanderButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
254
+ readonly ExpanderButton: _$react.ForwardRefExoticComponent<Omit<CodeBlockExpanderButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
255
255
  /**
256
256
  * The optional header slot for icon and title.
257
257
  */
258
- readonly Header: react.ForwardRefExoticComponent<Omit<react.ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & react.RefAttributes<HTMLDivElement>>;
258
+ readonly Header: _$react.ForwardRefExoticComponent<Omit<_$react.ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
259
259
  /**
260
260
  * A small icon for the code block header. Use `preset` or `svg`.
261
261
  */
@@ -263,21 +263,21 @@ declare const CodeBlock: {
263
263
  /**
264
264
  * Conditionally renders children when the associated tab is active.
265
265
  */
266
- readonly TabContent: react.ForwardRefExoticComponent<Omit<CodeBlockTabContentProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
266
+ readonly TabContent: _$react.ForwardRefExoticComponent<Omit<CodeBlockTabContentProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
267
267
  /**
268
268
  * A tab list for the code block header. Renders pill-styled tabs for switching code.
269
269
  */
270
- readonly TabList: react.ForwardRefExoticComponent<Omit<CodeBlockTabListProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
270
+ readonly TabList: _$react.ForwardRefExoticComponent<Omit<CodeBlockTabListProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
271
271
  /**
272
272
  * A pill-styled tab trigger for the code block header. Must be inside `TabList`.
273
273
  */
274
- readonly TabTrigger: react.ForwardRefExoticComponent<Omit<CodeBlockTabTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
274
+ readonly TabTrigger: _$react.ForwardRefExoticComponent<Omit<CodeBlockTabTriggerProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
275
275
  /**
276
276
  * The optional title rendered in the header.
277
277
  */
278
- readonly Title: react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & {
278
+ readonly Title: _$react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & {
279
279
  asChild?: boolean;
280
- } & react.RefAttributes<HTMLHeadingElement>>;
280
+ } & _$react.RefAttributes<HTMLHeadingElement>>;
281
281
  };
282
282
  //#endregion
283
283
  //#region src/components/code-block/escape-html.d.ts
@@ -1,3 +1,3 @@
1
- import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./icon-BMH0fD_b.js";import{t as n}from"./slot-D_ZUrdEW.js";import{t as r}from"./use-copy-to-clipboard-B6wH6hDd.js";import{t as i}from"./traffic-policy-file-CroUMbsd.js";import{a,c as o,d as s,f as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y}from"./resolve-pre-rendered-props-Bu2cvS9A.js";import{CaretDownIcon as b}from"@phosphor-icons/react/CaretDown";import{createContext as x,forwardRef as S,useCallback as C,useContext as w,useEffect as T,useId as ee,useLayoutEffect as te,useMemo as E,useRef as D,useState as O}from"react";import k from"tiny-invariant";import{Fragment as ne,jsx as A,jsxs as j}from"react/jsx-runtime";import{CheckIcon as re}from"@phosphor-icons/react/Check";import{CopyIcon as ie}from"@phosphor-icons/react/Copy";import{FileTextIcon as M}from"@phosphor-icons/react/FileText";import{TerminalIcon as ae}from"@phosphor-icons/react/Terminal";import{Content as oe,List as se,Root as N,Trigger as ce}from"@radix-ui/react-tabs";function P(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&amp;`;break;case`<`:n+=`&lt;`;break;case`>`:n+=`&gt;`;break;case`"`:n+=`&quot;`;break;case`'`:n+=`&#39;`;break;default:n+=t}}return n}const F=x(null);function I(){let e=w(F);return k(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const L=S(({asChild:t=!1,className:r,defaultTab:i,activeTab:a,onActiveTabChange:o,...s},c)=>{let l=D(``),[u,d]=O(!1),[f,p]=O(!1),[m,h]=O(void 0),g=C(e=>{h(t=>(k(t==null,`You can only render a single CodeBlock.Code within a CodeBlock.`),e))},[]),_=C(e=>{h(t=>{k(t===e,`You can only render a single CodeBlock.Code within a CodeBlock.`)})},[]),v=E(()=>({codeId:m,copyTextRef:l,hasCodeExpander:u,isCodeExpanded:f,registerCodeId:g,setHasCodeExpander:d,setIsCodeExpanded:p,unregisterCodeId:_}),[m,u,f,g,_]),y=i!==void 0||a!==void 0,b=A(t?n:`div`,{"data-slot":`code-block`,className:e(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono`,`[&_svg]:shrink-0`,r),ref:c,...s});return A(F.Provider,{value:v,children:y?A(N,{asChild:!0,defaultValue:i,value:a,onValueChange:o,children:b}):b})});L.displayName=`CodeBlock`;const R=S(({asChild:t=!1,className:r,...i},a)=>A(t?n:`div`,{className:e(`relative`,r),ref:a,...i}));R.displayName=`CodeBlockBody`;const le=/SHIKI_VAL_(\d+)/g;function ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const z=new Map;function B(e){if(e==null||e.length===0)return le;let t=z.get(e);return t??(z.size>=500&&z.clear(),t=RegExp(`${ue(e)}(\\d+)__`,`g`),z.set(e,t)),t}function V(e,t,n,r){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(B(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function H(e,t,n){return V(e,t,n,e=>P(String(e)))}function de(e,t,n){return V(e,t,n,e=>String(e))}const U=S(({className:t,style:n,tabIndex:r,value:i,...a},o)=>{let s=ee(),{copyTextRef:c,hasCodeExpander:l,isCodeExpanded:u,registerCodeId:d,unregisterCodeId:f}=I(),{language:p,code:m,"~preValToken":h,"~preVals":g,"~highlightLines":_,"~lineNumberStart":v,"~preHtml":y,"~showLineNumbers":b}=i,x=_,S=v??1,C=b??!1,w=E(()=>g!=null&&g.length>0?de(m,g,h):m,[h,g,m]);te(()=>{c.current=w},[c,w]),T(()=>(d(s),()=>{f(s)}),[s,d,f]);let D=E(()=>{if(y!=null)return g!=null&&g.length>0?H(y,g,h):y},[y,h,g]),O=D!=null,k=D??P(w);return A(`pre`,{"aria-expanded":l?u:void 0,className:e(`scrollbar overflow-x-auto overflow-y-hidden py-4`,!O&&`pr-14`,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono`,`aria-collapsed:max-h-[13.6rem]`,t),"data-highlighted":O?`true`:`false`,"data-lang":p,"data-mantle-highlight-lines":O&&x!=null&&x.length>0?x.join(`,`):void 0,"data-mantle-line-number-start":O&&C?String(S):`1`,"data-mantle-line-numbers":O&&C?`true`:`false`,id:s,ref:o,style:{...n,"--mantle-line-number-start":String(S),tabSize:2,MozTabSize:2},tabIndex:r??-1,...a,children:A(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:{__html:k}})})});U.displayName=`CodeBlockCode`;const W=S(({asChild:t=!1,className:r,...i},a)=>A(t?n:`div`,{className:e(`flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700`,r),ref:a,...i}));W.displayName=`CodeBlockHeader`;const G=S(({asChild:t=!1,className:r,...i},a)=>A(t?n:`h3`,{ref:a,className:e(`text-mono m-0 font-mono font-normal`,r),...i}));G.displayName=`CodeBlockTitle`;const K=S(({asChild:i=!1,className:a,onCopy:o,onCopyError:s,onClick:c,...l},u)=>{let{copyTextRef:d}=I(),[,f]=r(),[p,m]=O(!1),h=D(void 0);return T(()=>()=>{h.current!=null&&clearTimeout(h.current)},[]),j(i?n:`button`,{type:`button`,className:e(`focus-visible:border-accent-600 focus-visible:ring-focus-accent absolute right-2.5 top-2.5 z-10 flex size-7 items-center justify-center rounded border border-gray-300 bg-gray-50 hover:border-gray-400 hover:bg-gray-200 focus-visible:outline-hidden focus-visible:ring-4`,`shadow-[-1rem_0_0.75rem_-0.375rem_var(--color-gray-50),1rem_0_0_-0.25rem_var(--color-gray-50)]`,p&&`bg-filled-success text-on-filled hover:bg-filled-success focus:bg-filled-success focus-visible:border-success-600 focus-visible:ring-focus-success w-auto gap-1 border-transparent pl-2 pr-1.5 hover:border-transparent`,a),ref:u,onClick:async e=>{try{if(c?.(e),e.defaultPrevented){h.current!=null&&clearTimeout(h.current);return}let t=d.current;await f(t),o?.(t),m(!0),h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{m(!1)},2e3)}catch(e){s?.(e)}},...l,children:[A(`span`,{className:`sr-only`,children:`Copy code`}),p?j(ne,{children:[`Copied`,A(t,{svg:A(re,{weight:`bold`}),className:`size-4`})]}):A(t,{svg:A(ie,{}),className:`-ml-px`})]})});K.displayName=`CodeBlockCopyButton`;const q=S(({asChild:r=!1,className:i,onClick:a,...o},s)=>{let{codeId:c,isCodeExpanded:l,setIsCodeExpanded:u,setHasCodeExpander:d}=I();return T(()=>(d(!0),()=>{d(!1)}),[d]),j(r?n:`button`,{...o,"aria-controls":c,"aria-expanded":l,className:e(`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`,i),ref:s,type:`button`,onClick:e=>{u(e=>!e),a?.(e)},children:[l?`Show less`:`Show more`,` `,A(t,{svg:A(b,{weight:`bold`}),className:e(`size-4`,l&&`rotate-180`,`transition-all duration-150`)})]})});q.displayName=`CodeBlockExpanderButton`;function J({className:e,preset:n,svg:r,...a}){let o=r;if(n!=null)switch(n){case`file`:o=A(M,{weight:`fill`});break;case`cli`:o=A(ae,{weight:`fill`});break;case`traffic-policy`:o=A(i,{});break}return A(t,{className:e,svg:o,...a})}J.displayName=`CodeBlockIcon`;const Y=S(({className:t,...n},r)=>A(se,{className:e(`flex items-center gap-1`,t),ref:r,...n}));Y.displayName=`CodeBlockTabList`;const X=S(({className:t,...n},r)=>A(ce,{className:e(`cursor-pointer rounded-full px-3 py-1 text-sm font-medium`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-accent-500/20 data-[state=active]:text-blue-700`,`focus-visible:ring-focus-accent focus-visible:ring-4`,t),ref:r,...n}));X.displayName=`CodeBlockTabTrigger`;const Z=S((e,t)=>A(oe,{ref:t,...e}));Z.displayName=`CodeBlockTabContent`;const Q={Root:L,Body:R,Code:U,CopyButton:K,ExpanderButton:q,Header:W,Icon:J,TabContent:Z,TabList:Y,TabTrigger:X,Title:G},fe=Symbol(`MantleCodeBlockValue`);function $({preHtml:e,preValToken:t,preVals:n,highlightLines:r,lineNumberStart:i,showLineNumbers:a,code:o,language:s}){return{[fe]:!0,language:s,code:o,"~preHtml":e,"~preValToken":t,"~preVals":n,"~highlightLines":r,"~lineNumberStart":i,"~showLineNumbers":a}}function pe(e,t){let n=``;for(let r=0;r<e.length;r+=1)n+=e[r]??``,r<t.length&&(n+=String(t[r]));return n}function me(e,t={}){return(n,...r)=>$({language:e,code:pe(n,r),preHtml:void 0,preVals:r.length>0?r:void 0,highlightLines:t.highlightLines,lineNumberStart:t.lineNumberStart,showLineNumbers:t.showLineNumbers})}function he(e,t){let n=1;if(n>t)return!0;for(let r=0;r<e.length;r++)if(e[r]===`
2
- `&&(n+=1,n>t))return!0;return!1}export{Q as CodeBlock,$ as createMantleCodeBlockValue,l as decorateHighlightedHtml,v as defaultMeta,P as escapeHtml,he as hasMoreThanNLines,h as inferIndentation,f as isIndentation,d as isSupportedLanguage,me as mantleCode,c as normalizeIndentation,p as normalizeValue,m as parseCodeBlockHighlightLines,_ as parseCodeBlockLineNumberStart,o as parseCodeBlockShowLineNumbers,y as parseLanguage,g as parseMetastring,u as resolvePreRenderedCodeBlockProps,s as supportedLanguages,a as tokenizeMetastring};
1
+ import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./icon-BMH0fD_b.js";import{t as n}from"./slot-D_ZUrdEW.js";import{t as r}from"./icon-button-CxxVPiKp.js";import{t as i}from"./use-copy-to-clipboard-B6wH6hDd.js";import{t as a}from"./traffic-policy-file-CroUMbsd.js";import{a as o,c as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./resolve-pre-rendered-props-Bu2cvS9A.js";import{CaretDownIcon as x}from"@phosphor-icons/react/CaretDown";import{createContext as S,forwardRef as C,useCallback as w,useContext as T,useEffect as E,useId as ee,useLayoutEffect as te,useMemo as D,useRef as O,useState as k}from"react";import A from"tiny-invariant";import{jsx as j,jsxs as ne}from"react/jsx-runtime";import{CheckIcon as re}from"@phosphor-icons/react/Check";import{CopyIcon as ie}from"@phosphor-icons/react/Copy";import{FileTextIcon as M}from"@phosphor-icons/react/FileText";import{TerminalIcon as ae}from"@phosphor-icons/react/Terminal";import{Content as oe,List as se,Root as N,Trigger as ce}from"@radix-ui/react-tabs";function P(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&amp;`;break;case`<`:n+=`&lt;`;break;case`>`:n+=`&gt;`;break;case`"`:n+=`&quot;`;break;case`'`:n+=`&#39;`;break;default:n+=t}}return n}const F=S(null);function I(){let e=T(F);return A(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const L=C(({asChild:t=!1,className:r,defaultTab:i,activeTab:a,onActiveTabChange:o,...s},c)=>{let l=O(``),[u,d]=k(!1),[f,p]=k(!1),[m,h]=k(void 0),g=w(e=>{h(t=>(A(t==null,`You can only render a single CodeBlock.Code within a CodeBlock.`),e))},[]),_=w(e=>{h(t=>{A(t===e,`You can only render a single CodeBlock.Code within a CodeBlock.`)})},[]),v=D(()=>({codeId:m,copyTextRef:l,hasCodeExpander:u,isCodeExpanded:f,registerCodeId:g,setHasCodeExpander:d,setIsCodeExpanded:p,unregisterCodeId:_}),[m,u,f,g,_]),y=i!==void 0||a!==void 0,b=j(t?n:`div`,{"data-slot":`code-block`,className:e(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-card font-mono`,`[&_svg]:shrink-0`,r),ref:c,...s});return j(F.Provider,{value:v,children:y?j(N,{asChild:!0,defaultValue:i,value:a,onValueChange:o,children:b}):b})});L.displayName=`CodeBlock`;const R=C(({asChild:t=!1,className:r,...i},a)=>j(t?n:`div`,{className:e(`relative`,r),ref:a,...i}));R.displayName=`CodeBlockBody`;const le=/SHIKI_VAL_(\d+)/g;function ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const z=new Map;function B(e){if(e==null||e.length===0)return le;let t=z.get(e);return t??(z.size>=500&&z.clear(),t=RegExp(`${ue(e)}(\\d+)__`,`g`),z.set(e,t)),t}function V(e,t,n,r){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(B(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function H(e,t,n){return V(e,t,n,e=>P(String(e)))}function de(e,t,n){return V(e,t,n,e=>String(e))}const U=C(({className:t,style:n,tabIndex:r,value:i,...a},o)=>{let s=ee(),{copyTextRef:c,hasCodeExpander:l,isCodeExpanded:u,registerCodeId:d,unregisterCodeId:f}=I(),{language:p,code:m,"~preValToken":h,"~preVals":g,"~highlightLines":_,"~lineNumberStart":v,"~preHtml":y,"~showLineNumbers":b}=i,x=_,S=v??1,C=b??!1,w=D(()=>g!=null&&g.length>0?de(m,g,h):m,[h,g,m]);te(()=>{c.current=w},[c,w]),E(()=>(d(s),()=>{f(s)}),[s,d,f]);let T=D(()=>{if(y!=null)return g!=null&&g.length>0?H(y,g,h):y},[y,h,g]),O=T!=null,k=T??P(w);return j(`pre`,{"aria-expanded":l?u:void 0,className:e(`scrollbar overflow-x-auto overflow-y-hidden py-4`,!O&&`pr-14`,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono`,`aria-collapsed:max-h-[13.6rem]`,t),"data-highlighted":O?`true`:`false`,"data-lang":p,"data-mantle-highlight-lines":O&&x!=null&&x.length>0?x.join(`,`):void 0,"data-mantle-line-number-start":O&&C?String(S):`1`,"data-mantle-line-numbers":O&&C?`true`:`false`,id:s,ref:o,style:{...n,"--mantle-line-number-start":String(S),tabSize:2,MozTabSize:2},tabIndex:r??-1,...a,children:j(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:{__html:k}})})});U.displayName=`CodeBlockCode`;const W=C(({asChild:t=!1,className:r,...i},a)=>j(t?n:`div`,{className:e(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,r),ref:a,...i}));W.displayName=`CodeBlockHeader`;const G=C(({asChild:t=!1,className:r,...i},a)=>j(t?n:`h3`,{ref:a,className:e(`text-mono m-0 font-mono font-normal`,r),...i}));G.displayName=`CodeBlockTitle`;const K=C(({className:e,onCopy:t,onCopyError:n,onClick:a,...o},s)=>{let{copyTextRef:c}=I(),[,l]=i(),[u,d]=k(!1),f=O(void 0);return E(()=>()=>{f.current!=null&&clearTimeout(f.current)},[]),j(`span`,{className:`absolute right-2.5 top-2.5 z-10 bg-card`,children:j(r,{type:`button`,appearance:`ghost`,size:`sm`,label:`Copy code`,icon:j(u?re:ie,{}),className:e,ref:s,onClick:async e=>{try{if(a?.(e),e.defaultPrevented){f.current!=null&&clearTimeout(f.current);return}let n=c.current;await l(n),t?.(n),d(!0),f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{d(!1)},2e3)}catch(e){n?.(e)}},...o})})});K.displayName=`CodeBlockCopyButton`;const q=C(({asChild:r=!1,className:i,onClick:a,...o},s)=>{let{codeId:c,isCodeExpanded:l,setIsCodeExpanded:u,setHasCodeExpander:d}=I();return E(()=>(d(!0),()=>{d(!1)}),[d]),ne(r?n:`button`,{...o,"aria-controls":c,"aria-expanded":l,className:e(`flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-card px-4 py-2 font-sans text-gray-700 hover:bg-gray-100`,i),ref:s,type:`button`,onClick:e=>{u(e=>!e),a?.(e)},children:[l?`Show less`:`Show more`,` `,j(t,{svg:j(x,{weight:`bold`}),className:e(`size-4`,l&&`rotate-180`,`transition-all duration-150`)})]})});q.displayName=`CodeBlockExpanderButton`;function J({className:e,preset:n,svg:r,...i}){let o=r;if(n!=null)switch(n){case`file`:o=j(M,{weight:`fill`});break;case`cli`:o=j(ae,{weight:`fill`});break;case`traffic-policy`:o=j(a,{});break}return j(t,{className:e,svg:o,...i})}J.displayName=`CodeBlockIcon`;const Y=C(({className:t,...n},r)=>j(se,{className:e(`flex items-center gap-1`,t),ref:r,...n}));Y.displayName=`CodeBlockTabList`;const X=C(({className:t,...n},r)=>j(ce,{className:e(`cursor-pointer rounded px-1.5 py-0.5 text-xs font-medium`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong`,`focus-visible:ring-focus-accent focus-visible:ring-4`,t),ref:r,...n}));X.displayName=`CodeBlockTabTrigger`;const Z=C((e,t)=>j(oe,{ref:t,...e}));Z.displayName=`CodeBlockTabContent`;const Q={Root:L,Body:R,Code:U,CopyButton:K,ExpanderButton:q,Header:W,Icon:J,TabContent:Z,TabList:Y,TabTrigger:X,Title:G},fe=Symbol(`MantleCodeBlockValue`);function $({preHtml:e,preValToken:t,preVals:n,highlightLines:r,lineNumberStart:i,showLineNumbers:a,code:o,language:s}){return{[fe]:!0,language:s,code:o,"~preHtml":e,"~preValToken":t,"~preVals":n,"~highlightLines":r,"~lineNumberStart":i,"~showLineNumbers":a}}function pe(e,t){let n=``;for(let r=0;r<e.length;r+=1)n+=e[r]??``,r<t.length&&(n+=String(t[r]));return n}function me(e,t={}){return(n,...r)=>$({language:e,code:pe(n,r),preHtml:void 0,preVals:r.length>0?r:void 0,highlightLines:t.highlightLines,lineNumberStart:t.lineNumberStart,showLineNumbers:t.showLineNumbers})}function he(e,t){let n=1;if(n>t)return!0;for(let r=0;r<e.length;r++)if(e[r]===`
2
+ `&&(n+=1,n>t))return!0;return!1}export{Q as CodeBlock,$ as createMantleCodeBlockValue,u as decorateHighlightedHtml,y as defaultMeta,P as escapeHtml,he as hasMoreThanNLines,g as inferIndentation,p as isIndentation,f as isSupportedLanguage,me as mantleCode,l as normalizeIndentation,m as normalizeValue,h as parseCodeBlockHighlightLines,v as parseCodeBlockLineNumberStart,s as parseCodeBlockShowLineNumbers,b as parseLanguage,_ as parseMetastring,d as resolvePreRenderedCodeBlockProps,c as supportedLanguages,o as tokenizeMetastring};
3
3
  //# sourceMappingURL=code-block.js.map