@ngrok/mantle 0.1.4 → 0.1.6

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Mantle
2
2
 
3
- [Mantle](https://mantle.ngrok.com) is [ngrok](https://ngrok.com/)’s UI library and design system. It’s based on [shadcn/ui](https://ui.shadcn.com) and [Radix](https://www.radix-ui.com) with [Tailwind](https://tailwindcss.com/) providing styling. It’s documented using [Remix](https://remix.run/docs).
3
+ [Mantle](https://mantle.ngrok.com) is [ngrok](https://ngrok.com/)’s UI library and design system. It’s inspired by [shadcn/ui](https://ui.shadcn.com) and uses [Radix](https://www.radix-ui.com) with [Tailwind](https://tailwindcss.com/) for styling. It’s documented using [Remix](https://remix.run/docs).
4
4
 
5
5
  ## Get Started
6
6
 
@@ -25,37 +25,20 @@ export default {
25
25
  } satisfies Config;
26
26
  ```
27
27
 
28
- ### Installation
29
-
30
- Mantle uses `pnpm` as its package manager. First, install the dependencies in the repo’s directory by running `pnpm install`.
31
-
32
- ### Development and preview
33
-
34
- Run `pnpm run docs:dev` to run Remix's development mode, rebuilding assets on file changes.
35
-
36
- Open up [http://localhost:3000](http://localhost:3000) and you should be ready to go!
28
+ Next, check out the [Setup](https://mantle.ngrok.com/setup) and [Theme Provider](https://mantle.ngrok.com/components/theme-provider) usage docs and start using mantle components in your application!
37
29
 
38
- ## Deployment
30
+ ## Development
39
31
 
40
- First, build the app for production:
41
-
42
- ```sh
43
- pnpm run build
44
- ```
45
-
46
- Then run the app in production mode:
32
+ ### Installation
47
33
 
48
- ```sh
49
- pnpm start
50
- ```
34
+ Mantle uses [bun](https://bun.sh/) as its package manager. First, install the dependencies in the repo’s directory by running `bun install`.
51
35
 
52
- We have chosen vercel to deploy to.
36
+ ### Local Development
53
37
 
54
- ### DIY
38
+ Run `bun run docs:dev` to run Remix's development mode, rebuilding assets on file changes.
55
39
 
56
- If you're familiar with deploying node applications, the built-in Remix app server is production-ready.
40
+ Open up [http://localhost:3000](http://localhost:3000) and you should be ready to go!
57
41
 
58
- Make sure to deploy the output of `remix build`
42
+ ## Production Deployment
59
43
 
60
- - `build/`
61
- - `public/build/`
44
+ We use GitHub Actions to deploy our production site to vercel and publish to npm.
package/dist/anchor.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD3F6KEREcjs = require('./chunk-D3F6KERE.cjs');var _reactslot = require('@radix-ui/react-slot');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var n=o=>_chunkD3F6KEREcjs.a.call(void 0, "cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent",o),e= exports.Anchor =_react.forwardRef.call(void 0, ({asChild:o,className:t,...s},c)=>_jsxruntime.jsx.call(void 0, o?_reactslot.Slot:"a",{className:n(t),ref:c,...s}));e.displayName="Anchor";exports.Anchor = e; exports.anchorClassNames = n;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _react = require('react');var _jsxruntime = require('react/jsx-runtime');var s=e=>_chunkD3F6KEREcjs.a.call(void 0, "cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent",e),i= exports.Anchor =_react.forwardRef.call(void 0, ({asChild:e,className:n,rel:t,...r},c)=>{let u=e?_reactslot.Slot:"a",f=l(t);return _jsxruntime.jsx.call(void 0, u,{className:s(n),ref:c,rel:f,...r})});i.displayName="Anchor";function l(e){return Array.isArray(e)?[...new Set(e)].map(r=>_optionalChain([r, 'optionalAccess', _ => _.trim, 'call', _2 => _2()])).filter(Boolean).sort().join(" ")||void 0:_optionalChain([e, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()])||void 0}exports.Anchor = i; exports.anchorClassNames = s; exports.resolveRel = l;
2
2
  //# sourceMappingURL=anchor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/anchor/src/anchor.tsx"],"names":["Slot","forwardRef","jsx","anchorClassNames","className","cx","Anchor","asChild","props","ref"],"mappings":"yCAAA,OAAS,QAAAA,MAAY,uBACrB,OAA+B,cAAAC,MAAkB,QAwBzC,cAAAC,MAAA,oBApBR,IAAMC,EAAoBC,GACzBC,EACC,8IACAD,CACD,EAaKE,EAASL,EAA2C,CAAC,CAAE,QAAAM,EAAS,UAAAH,EAAW,GAAGI,CAAM,EAAGC,IAGrFP,EAFWK,EAAUP,EAAO,IAE3B,CAAU,UAAWG,EAAiBC,CAAS,EAAG,IAAKK,EAAM,GAAGD,EAAO,CAC/E,EACDF,EAAO,YAAc","sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { AnchorHTMLAttributes, forwardRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport { WithAsChild } from \"../../types/src/as-child\";\n\nconst anchorClassNames = (className: string | undefined) =>\n\tcx(\n\t\t\"cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent\",\n\t\tclassName,\n\t);\n\ntype AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & WithAsChild;\n\n/**\n * Fundamental component for rendering links to external addresses.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a\n *\n * @note If you need to link to an internal application route, prefer using the\n * [`react-router-dom` `<Link>`](https://reactrouter.com/en/main/components/link) or the\n * [`@remix-run/react` `<Link>`](https://remix.run/docs/en/main/components/link).\n */\nconst Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(({ asChild, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"a\";\n\n\treturn <Component className={anchorClassNames(className)} ref={ref} {...props} />;\n});\nAnchor.displayName = \"Anchor\";\n\nexport { Anchor, anchorClassNames };\n"]}
1
+ {"version":3,"sources":["../packages/anchor/src/anchor.tsx"],"names":["Slot","forwardRef","jsx","anchorClassNames","className","cx","Anchor","asChild","propRel","props","ref","Component","rel","resolveRel","item"],"mappings":"yCAAA,OAAS,QAAAA,MAAY,uBACrB,OAA+B,cAAAC,MAAkB,QAoDzC,cAAAC,MAAA,oBA5CR,IAAMC,EAAoBC,GACzBC,EACC,8IACAD,CACD,EAoCKE,EAASL,EAA2C,CAAC,CAAE,QAAAM,EAAS,UAAAH,EAAW,IAAKI,EAAS,GAAGC,CAAM,EAAGC,IAAQ,CAClH,IAAMC,EAAYJ,EAAUP,EAAO,IAC7BY,EAAMC,EAAWL,CAAO,EAE9B,OAAON,EAACS,EAAA,CAAU,UAAWR,EAAiBC,CAAS,EAAG,IAAKM,EAAK,IAAKE,EAAM,GAAGH,EAAO,CAC1F,CAAC,EACDH,EAAO,YAAc,SAOrB,SAASO,EAAWD,EAA0F,CAC7G,OAAI,MAAM,QAAQA,CAAG,EAEL,CAAC,GADE,IAAI,IAAIA,CAAG,CACD,EAC1B,IAAKE,GAASA,GAAM,KAAK,CAAC,EAC1B,OAAO,OAAO,EACd,KAAK,EACL,KAAK,GAAG,GACO,OAIXF,GAAK,KAAK,GAAK,MACvB","sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { AnchorHTMLAttributes, forwardRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport { WithAsChild } from \"../../types/src/as-child\";\nimport type { Rel, Target } from \"./types\";\n\n/**\n * The class names for the `Anchor` component which define the styles for the component.\n */\nconst anchorClassNames = (className: string | undefined) =>\n\tcx(\n\t\t\"cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent\",\n\t\tclassName,\n\t);\n\n/**\n * The props for the `Anchor` component.\n */\ntype AnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"rel\" | \"target\"> &\n\tWithAsChild & {\n\t\t/**\n\t\t * The rel attribute defines the relationship between a linked resource and the current document.\n\t\t *\n\t\t * Every keyword within a space-separated value should be unique within that value.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel\n\t\t */\n\t\trel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];\n\t\t/**\n\t\t * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).\n\t\t *\n\t\t * Note: Setting `target=\"_blank\"` on <a> elements implicitly provides the same rel behavior as setting `rel=\"noopener\"` which does not set `window.opener`.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n\t\t *\n\t\t * @default \"_self\"\n\t\t */\n\t\ttarget?: Target | undefined;\n\t};\n\n/**\n * Fundamental component for rendering links to external addresses.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a\n *\n * @note If you need to link to an internal application route, prefer using the\n * [`react-router-dom` `<Link>`](https://reactrouter.com/en/main/components/link) or the\n * [`@remix-run/react` `<Link>`](https://remix.run/docs/en/main/components/link).\n */\nconst Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(({ asChild, className, rel: propRel, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"a\";\n\tconst rel = resolveRel(propRel);\n\n\treturn <Component className={anchorClassNames(className)} ref={ref} rel={rel} {...props} />;\n});\nAnchor.displayName = \"Anchor\";\n\n/**\n * Resolves the `rel` attribute to a string.\n *\n * If the value is an array, it will be filtered for empty values, ensure uniqueness, sorted, and joined with a space.\n */\nfunction resolveRel(rel: Rel | (string & {}) | undefined | null | (Rel | (string & {}) | undefined | null)[]) {\n\tif (Array.isArray(rel)) {\n\t\tconst uniqueRel = new Set(rel);\n\t\tconst result = [...uniqueRel]\n\t\t\t.map((item) => item?.trim())\n\t\t\t.filter(Boolean)\n\t\t\t.sort()\n\t\t\t.join(\" \");\n\t\treturn result || undefined;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\treturn rel?.trim() || undefined;\n}\n\nexport { Anchor, anchorClassNames, resolveRel };\nexport type { AnchorProps };\n"]}
package/dist/anchor.d.cts CHANGED
@@ -1,8 +1,53 @@
1
1
  import * as react from 'react';
2
- import { AnchorHTMLAttributes } from 'react';
2
+ import { HTMLAttributeAnchorTarget, AnchorHTMLAttributes } from 'react';
3
3
  import { W as WithAsChild } from './as-child-BjnPZ1DU.cjs';
4
4
 
5
+ /**
6
+ * The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found.
7
+ *
8
+ * Every keyword within a space-separated value should be unique within that value.
9
+ *
10
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
11
+ */
12
+ type Rel = "alternate" | "author" | "bookmark" | "canonical" | "dns-prefetch" | "external" | "help" | "icon" | "license" | "manifest" | "me" | "modulepreload" | "next" | "nofollow" | "noopener" | "noreferrer" | "opener" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "prev" | "privacy-policy" | "search" | "stylesheet" | "tag" | "terms-of-service";
13
+ /**
14
+ * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
15
+ *
16
+ * Note: Setting target="_blank" on <a> elements implicitly provides the same rel behavior as setting rel="noopener" which does not set window.opener.
17
+ *
18
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
19
+ *
20
+ * @default "_self"
21
+ */
22
+ type Target = (HTMLAttributeAnchorTarget & "_self") | "_blank" | "_parent" | "_top" | "_unfencedTop";
23
+
24
+ /**
25
+ * The class names for the `Anchor` component which define the styles for the component.
26
+ */
5
27
  declare const anchorClassNames: (className: string | undefined) => string;
28
+ /**
29
+ * The props for the `Anchor` component.
30
+ */
31
+ type AnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "rel" | "target"> & WithAsChild & {
32
+ /**
33
+ * The rel attribute defines the relationship between a linked resource and the current document.
34
+ *
35
+ * Every keyword within a space-separated value should be unique within that value.
36
+ *
37
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
38
+ */
39
+ rel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];
40
+ /**
41
+ * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
42
+ *
43
+ * Note: Setting `target="_blank"` on <a> elements implicitly provides the same rel behavior as setting `rel="noopener"` which does not set `window.opener`.
44
+ *
45
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
46
+ *
47
+ * @default "_self"
48
+ */
49
+ target?: Target | undefined;
50
+ };
6
51
  /**
7
52
  * Fundamental component for rendering links to external addresses.
8
53
  *
@@ -12,6 +57,31 @@ declare const anchorClassNames: (className: string | undefined) => string;
12
57
  * [`react-router-dom` `<Link>`](https://reactrouter.com/en/main/components/link) or the
13
58
  * [`@remix-run/react` `<Link>`](https://remix.run/docs/en/main/components/link).
14
59
  */
15
- declare const Anchor: react.ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & WithAsChild & react.RefAttributes<HTMLAnchorElement>>;
60
+ declare const Anchor: react.ForwardRefExoticComponent<Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "rel" | "target"> & WithAsChild & {
61
+ /**
62
+ * The rel attribute defines the relationship between a linked resource and the current document.
63
+ *
64
+ * Every keyword within a space-separated value should be unique within that value.
65
+ *
66
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
67
+ */
68
+ rel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];
69
+ /**
70
+ * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
71
+ *
72
+ * Note: Setting `target="_blank"` on <a> elements implicitly provides the same rel behavior as setting `rel="noopener"` which does not set `window.opener`.
73
+ *
74
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
75
+ *
76
+ * @default "_self"
77
+ */
78
+ target?: Target | undefined;
79
+ } & react.RefAttributes<HTMLAnchorElement>>;
80
+ /**
81
+ * Resolves the `rel` attribute to a string.
82
+ *
83
+ * If the value is an array, it will be filtered for empty values, ensure uniqueness, sorted, and joined with a space.
84
+ */
85
+ declare function resolveRel(rel: Rel | (string & {}) | undefined | null | (Rel | (string & {}) | undefined | null)[]): string | undefined;
16
86
 
17
- export { Anchor, anchorClassNames };
87
+ export { Anchor, type AnchorProps, type Rel, type Target, anchorClassNames, resolveRel };
package/dist/anchor.d.ts CHANGED
@@ -1,8 +1,53 @@
1
1
  import * as react from 'react';
2
- import { AnchorHTMLAttributes } from 'react';
2
+ import { HTMLAttributeAnchorTarget, AnchorHTMLAttributes } from 'react';
3
3
  import { W as WithAsChild } from './as-child-BjnPZ1DU.js';
4
4
 
5
+ /**
6
+ * The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found.
7
+ *
8
+ * Every keyword within a space-separated value should be unique within that value.
9
+ *
10
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
11
+ */
12
+ type Rel = "alternate" | "author" | "bookmark" | "canonical" | "dns-prefetch" | "external" | "help" | "icon" | "license" | "manifest" | "me" | "modulepreload" | "next" | "nofollow" | "noopener" | "noreferrer" | "opener" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "prev" | "privacy-policy" | "search" | "stylesheet" | "tag" | "terms-of-service";
13
+ /**
14
+ * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
15
+ *
16
+ * Note: Setting target="_blank" on <a> elements implicitly provides the same rel behavior as setting rel="noopener" which does not set window.opener.
17
+ *
18
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
19
+ *
20
+ * @default "_self"
21
+ */
22
+ type Target = (HTMLAttributeAnchorTarget & "_self") | "_blank" | "_parent" | "_top" | "_unfencedTop";
23
+
24
+ /**
25
+ * The class names for the `Anchor` component which define the styles for the component.
26
+ */
5
27
  declare const anchorClassNames: (className: string | undefined) => string;
28
+ /**
29
+ * The props for the `Anchor` component.
30
+ */
31
+ type AnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "rel" | "target"> & WithAsChild & {
32
+ /**
33
+ * The rel attribute defines the relationship between a linked resource and the current document.
34
+ *
35
+ * Every keyword within a space-separated value should be unique within that value.
36
+ *
37
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
38
+ */
39
+ rel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];
40
+ /**
41
+ * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
42
+ *
43
+ * Note: Setting `target="_blank"` on <a> elements implicitly provides the same rel behavior as setting `rel="noopener"` which does not set `window.opener`.
44
+ *
45
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
46
+ *
47
+ * @default "_self"
48
+ */
49
+ target?: Target | undefined;
50
+ };
6
51
  /**
7
52
  * Fundamental component for rendering links to external addresses.
8
53
  *
@@ -12,6 +57,31 @@ declare const anchorClassNames: (className: string | undefined) => string;
12
57
  * [`react-router-dom` `<Link>`](https://reactrouter.com/en/main/components/link) or the
13
58
  * [`@remix-run/react` `<Link>`](https://remix.run/docs/en/main/components/link).
14
59
  */
15
- declare const Anchor: react.ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & WithAsChild & react.RefAttributes<HTMLAnchorElement>>;
60
+ declare const Anchor: react.ForwardRefExoticComponent<Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "rel" | "target"> & WithAsChild & {
61
+ /**
62
+ * The rel attribute defines the relationship between a linked resource and the current document.
63
+ *
64
+ * Every keyword within a space-separated value should be unique within that value.
65
+ *
66
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
67
+ */
68
+ rel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];
69
+ /**
70
+ * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
71
+ *
72
+ * Note: Setting `target="_blank"` on <a> elements implicitly provides the same rel behavior as setting `rel="noopener"` which does not set `window.opener`.
73
+ *
74
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
75
+ *
76
+ * @default "_self"
77
+ */
78
+ target?: Target | undefined;
79
+ } & react.RefAttributes<HTMLAnchorElement>>;
80
+ /**
81
+ * Resolves the `rel` attribute to a string.
82
+ *
83
+ * If the value is an array, it will be filtered for empty values, ensure uniqueness, sorted, and joined with a space.
84
+ */
85
+ declare function resolveRel(rel: Rel | (string & {}) | undefined | null | (Rel | (string & {}) | undefined | null)[]): string | undefined;
16
86
 
17
- export { Anchor, anchorClassNames };
87
+ export { Anchor, type AnchorProps, type Rel, type Target, anchorClassNames, resolveRel };
package/dist/anchor.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-A5H52ODC.js";import{Slot as i}from"@radix-ui/react-slot";import{forwardRef as h}from"react";import{jsx as m}from"react/jsx-runtime";var n=o=>r("cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent",o),e=h(({asChild:o,className:t,...s},c)=>m(o?i:"a",{className:n(t),ref:c,...s}));e.displayName="Anchor";export{e as Anchor,n as anchorClassNames};
1
+ import{a as o}from"./chunk-A5H52ODC.js";import{Slot as p}from"@radix-ui/react-slot";import{forwardRef as a}from"react";import{jsx as d}from"react/jsx-runtime";var s=e=>o("cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent",e),i=a(({asChild:e,className:n,rel:t,...r},c)=>{let u=e?p:"a",f=l(t);return d(u,{className:s(n),ref:c,rel:f,...r})});i.displayName="Anchor";function l(e){return Array.isArray(e)?[...new Set(e)].map(r=>r?.trim()).filter(Boolean).sort().join(" ")||void 0:e?.trim()||void 0}export{i as Anchor,s as anchorClassNames,l as resolveRel};
2
2
  //# sourceMappingURL=anchor.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/anchor/src/anchor.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { AnchorHTMLAttributes, forwardRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport { WithAsChild } from \"../../types/src/as-child\";\n\nconst anchorClassNames = (className: string | undefined) =>\n\tcx(\n\t\t\"cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent\",\n\t\tclassName,\n\t);\n\ntype AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & WithAsChild;\n\n/**\n * Fundamental component for rendering links to external addresses.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a\n *\n * @note If you need to link to an internal application route, prefer using the\n * [`react-router-dom` `<Link>`](https://reactrouter.com/en/main/components/link) or the\n * [`@remix-run/react` `<Link>`](https://remix.run/docs/en/main/components/link).\n */\nconst Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(({ asChild, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"a\";\n\n\treturn <Component className={anchorClassNames(className)} ref={ref} {...props} />;\n});\nAnchor.displayName = \"Anchor\";\n\nexport { Anchor, anchorClassNames };\n"],"mappings":"wCAAA,OAAS,QAAAA,MAAY,uBACrB,OAA+B,cAAAC,MAAkB,QAwBzC,cAAAC,MAAA,oBApBR,IAAMC,EAAoBC,GACzBC,EACC,8IACAD,CACD,EAaKE,EAASC,EAA2C,CAAC,CAAE,QAAAC,EAAS,UAAAJ,EAAW,GAAGK,CAAM,EAAGC,IAGrFR,EAFWM,EAAUG,EAAO,IAE3B,CAAU,UAAWR,EAAiBC,CAAS,EAAG,IAAKM,EAAM,GAAGD,EAAO,CAC/E,EACDH,EAAO,YAAc","names":["Slot","forwardRef","jsx","anchorClassNames","className","cx","Anchor","forwardRef","asChild","props","ref","Slot"]}
1
+ {"version":3,"sources":["../packages/anchor/src/anchor.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { AnchorHTMLAttributes, forwardRef } from \"react\";\nimport { cx } from \"../../cx\";\nimport { WithAsChild } from \"../../types/src/as-child\";\nimport type { Rel, Target } from \"./types\";\n\n/**\n * The class names for the `Anchor` component which define the styles for the component.\n */\nconst anchorClassNames = (className: string | undefined) =>\n\tcx(\n\t\t\"cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent\",\n\t\tclassName,\n\t);\n\n/**\n * The props for the `Anchor` component.\n */\ntype AnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"rel\" | \"target\"> &\n\tWithAsChild & {\n\t\t/**\n\t\t * The rel attribute defines the relationship between a linked resource and the current document.\n\t\t *\n\t\t * Every keyword within a space-separated value should be unique within that value.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel\n\t\t */\n\t\trel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];\n\t\t/**\n\t\t * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).\n\t\t *\n\t\t * Note: Setting `target=\"_blank\"` on <a> elements implicitly provides the same rel behavior as setting `rel=\"noopener\"` which does not set `window.opener`.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n\t\t *\n\t\t * @default \"_self\"\n\t\t */\n\t\ttarget?: Target | undefined;\n\t};\n\n/**\n * Fundamental component for rendering links to external addresses.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a\n *\n * @note If you need to link to an internal application route, prefer using the\n * [`react-router-dom` `<Link>`](https://reactrouter.com/en/main/components/link) or the\n * [`@remix-run/react` `<Link>`](https://remix.run/docs/en/main/components/link).\n */\nconst Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(({ asChild, className, rel: propRel, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"a\";\n\tconst rel = resolveRel(propRel);\n\n\treturn <Component className={anchorClassNames(className)} ref={ref} rel={rel} {...props} />;\n});\nAnchor.displayName = \"Anchor\";\n\n/**\n * Resolves the `rel` attribute to a string.\n *\n * If the value is an array, it will be filtered for empty values, ensure uniqueness, sorted, and joined with a space.\n */\nfunction resolveRel(rel: Rel | (string & {}) | undefined | null | (Rel | (string & {}) | undefined | null)[]) {\n\tif (Array.isArray(rel)) {\n\t\tconst uniqueRel = new Set(rel);\n\t\tconst result = [...uniqueRel]\n\t\t\t.map((item) => item?.trim())\n\t\t\t.filter(Boolean)\n\t\t\t.sort()\n\t\t\t.join(\" \");\n\t\treturn result || undefined;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\treturn rel?.trim() || undefined;\n}\n\nexport { Anchor, anchorClassNames, resolveRel };\nexport type { AnchorProps };\n"],"mappings":"wCAAA,OAAS,QAAAA,MAAY,uBACrB,OAA+B,cAAAC,MAAkB,QAoDzC,cAAAC,MAAA,oBA5CR,IAAMC,EAAoBC,GACzBC,EACC,8IACAD,CACD,EAoCKE,EAASC,EAA2C,CAAC,CAAE,QAAAC,EAAS,UAAAJ,EAAW,IAAKK,EAAS,GAAGC,CAAM,EAAGC,IAAQ,CAClH,IAAMC,EAAYJ,EAAUK,EAAO,IAC7BC,EAAMC,EAAWN,CAAO,EAE9B,OAAOP,EAACU,EAAA,CAAU,UAAWT,EAAiBC,CAAS,EAAG,IAAKO,EAAK,IAAKG,EAAM,GAAGJ,EAAO,CAC1F,CAAC,EACDJ,EAAO,YAAc,SAOrB,SAASS,EAAWD,EAA0F,CAC7G,OAAI,MAAM,QAAQA,CAAG,EAEL,CAAC,GADE,IAAI,IAAIA,CAAG,CACD,EAC1B,IAAKE,GAASA,GAAM,KAAK,CAAC,EAC1B,OAAO,OAAO,EACd,KAAK,EACL,KAAK,GAAG,GACO,OAIXF,GAAK,KAAK,GAAK,MACvB","names":["Slot","forwardRef","jsx","anchorClassNames","className","cx","Anchor","forwardRef","asChild","propRel","props","ref","Component","Slot","rel","resolveRel","item"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "mantle is ngrok's UI library and design system.",
4
4
  "author": "ngrok",
5
5
  "license": "MIT",
6
- "version": "0.1.4",
6
+ "version": "0.1.6",
7
7
  "homepage": "https://mantle.ngrok.com",
8
8
  "repository": {
9
9
  "type": "git",
@@ -54,12 +54,13 @@
54
54
  "@remix-run/eslint-config": "2.8.1",
55
55
  "@testing-library/react": "14.3.0",
56
56
  "@testing-library/user-event": "14.5.2",
57
- "@types/node": "20.12.5",
57
+ "@types/bun": "latest",
58
+ "@types/node": "20.12.6",
58
59
  "@types/prismjs": "1.26.3",
59
- "@types/react": "18.2.74",
60
+ "@types/react": "18.2.75",
60
61
  "@types/react-dom": "18.2.24",
61
- "@typescript-eslint/eslint-plugin": "7.5.0",
62
- "@typescript-eslint/parser": "7.5.0",
62
+ "@typescript-eslint/eslint-plugin": "7.6.0",
63
+ "@typescript-eslint/parser": "7.6.0",
63
64
  "@vitejs/plugin-react": "4.2.1",
64
65
  "@vitest/ui": "1.4.0",
65
66
  "autoprefixer": "10.4.19",
@@ -70,7 +71,6 @@
70
71
  "eslint-config-prettier": "9.1.0",
71
72
  "eslint-plugin-react": "7.34.1",
72
73
  "eslint-plugin-react-hooks": "4.6.0",
73
- "fast-glob": "3.3.2",
74
74
  "jsdom": "24.0.0",
75
75
  "postcss": "8.4.38",
76
76
  "prettier": "3.2.5",
@@ -224,6 +224,7 @@
224
224
  "types": "./dist/types.d.ts"
225
225
  }
226
226
  },
227
+ "module": "index.ts",
227
228
  "scripts": {
228
229
  "build": "rm -rf dist && tsup",
229
230
  "docs:build": "remix build",
@@ -231,7 +232,7 @@
231
232
  "docs:serve": "remix-serve ./build/index.js",
232
233
  "fmt:check": "prettier --check .",
233
234
  "fmt": "prettier --write .",
234
- "gen:docs-routes": "tsx scripts/gen-docs-routes",
235
+ "gen:docs-routes": "bun ./scripts/gen-docs-routes",
235
236
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
236
237
  "test": "TZ=UTC vitest",
237
238
  "typecheck": "tsc --incremental --noEmit --skipLibCheck"