@better-nds/react 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -7,6 +7,10 @@ var clsx = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
8
8
  require('react');
9
9
 
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var clsx__default = /*#__PURE__*/_interopDefault(clsx);
13
+
10
14
  function cn(...inputs) {
11
15
  return tailwindMerge.twMerge(clsx.clsx(inputs));
12
16
  }
@@ -288,6 +292,29 @@ function CardFooter({ className, ...props }) {
288
292
  });
289
293
  }
290
294
 
295
+ function Input({ className, type, size = "lg", dir, addon, ...props }) {
296
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
297
+ dir: dir,
298
+ role: "group",
299
+ className: clsx__default.default("after:bg-nds-neutral-950 has-aria-invalid:after:bg-nds-error-700 relative flex w-fit justify-center overflow-hidden rounded-sm transition-shadow [--input-border:var(--color-nds-neutral-400)] after:absolute after:bottom-0 after:h-0.5 after:w-0 after:transition-[width] not-active:focus-within:shadow-md focus-within:after:w-full active:after:w-2/5 has-disabled:shadow-none has-disabled:after:w-0 has-aria-invalid:[--input-border:var(--color-nds-error-700)] has-[input:active]:[--input-border:var(--color-nds-neutral-400)] has-[input:hover]:[--input-border:var(--color-nds-neutral-700)]", {
300
+ "h-10": size === "lg",
301
+ "h-8": size === "md"
302
+ }),
303
+ children: [
304
+ /*#__PURE__*/ jsxRuntime.jsx("input", {
305
+ type: type,
306
+ "data-slot": "input",
307
+ className: clsx__default.default("bg-nds-white text-nds-neutral-700 hover:text-nds-black placeholder:text-nds-neutral-500 active:bg-nds-neutral-100 active:text-nds-neutral-700 relative min-w-0 rounded-s-sm border border-e-0 border-(--input-border) ps-2 pe-4 text-base ring-0 transition-colors outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", className),
308
+ ...props
309
+ }),
310
+ addon && /*#__PURE__*/ jsxRuntime.jsx("div", {
311
+ className: "bg-nds-neutral-100 text-nds-neutral-500 flex h-full items-center gap-1 rounded-e-sm border border-s-0 border-(--input-border) px-4 transition-colors",
312
+ children: addon
313
+ })
314
+ ]
315
+ });
316
+ }
317
+
291
318
  exports.Button = Button;
292
319
  exports.Card = Card;
293
320
  exports.CardAction = CardAction;
@@ -296,5 +323,6 @@ exports.CardDescription = CardDescription;
296
323
  exports.CardFooter = CardFooter;
297
324
  exports.CardHeader = CardHeader;
298
325
  exports.CardTitle = CardTitle;
326
+ exports.Input = Input;
299
327
  exports.LinkVariants = LinkVariants;
300
328
  exports.cn = cn;
package/dist/index.d.ts CHANGED
@@ -2,11 +2,11 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as class_variance_authority_types from 'class-variance-authority/types';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
  import * as React from 'react';
5
- import { ComponentProps } from 'react';
5
+ import { ComponentProps, ReactNode } from 'react';
6
6
  import { ClassValue } from 'clsx';
7
7
 
8
8
  declare const buttonVariants: (props?: ({
9
- variant?: "primary" | "neutral" | "secondary-solid" | "secondary-outline" | "subtle" | "transparent" | null | undefined;
9
+ variant?: "neutral" | "primary" | "secondary-solid" | "secondary-outline" | "subtle" | "transparent" | null | undefined;
10
10
  destructive?: boolean | null | undefined;
11
11
  onColor?: boolean | null | undefined;
12
12
  size?: "lg" | "md" | "sm" | "icon-lg" | "icon-md" | "icon-sm" | null | undefined;
@@ -33,5 +33,10 @@ declare function CardAction({ className, ...props }: React.ComponentProps<"div">
33
33
  declare function CardContent({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
34
34
  declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
35
35
 
36
- export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, LinkVariants, cn };
36
+ declare function Input({ className, type, size, dir, addon, ...props }: Omit<ComponentProps<"input">, "size"> & {
37
+ addon?: ReactNode;
38
+ size?: "lg" | "md";
39
+ }): react_jsx_runtime.JSX.Element;
40
+
41
+ export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, LinkVariants, cn };
37
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../src/components/button.tsx","../src/cn.ts","../src/components/link.tsx","../src/components/card.tsx"],"mappings":";;;;;;;AAIA,cAAc,cAAc;AAC5B;AACA;AACA;AACA;AACA,IAAI,8BAA8B,CAAC,SAAS;AAC5C,iBAAiB,MAAM,wEAAwE,cAAc,aAAa,YAAY,QAAQ,cAAc;AAC5J;AACA,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO;;ACXjC,iBAAiB,EAAE,YAAY,UAAU;;ACAzC,cAAc,YAAY;AAC1B;AACA;AACA,IAAI,8BAA8B,CAAC,SAAS;;ACA5C,cAAc,YAAY;AAC1B;AACA,IAAI,8BAA8B,CAAC,SAAS;AAC5C,iBAAiB,IAAI,gCAAgC,KAAK,CAAC,cAAc,UAAU,YAAY,QAAQ,YAAY,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO;AACpJ,iBAAiB,UAAU,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AAChH,iBAAiB,SAAS,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AAC/G,iBAAiB,eAAe,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AACrH,iBAAiB,UAAU,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AAChH,iBAAiB,WAAW,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AACjH,iBAAiB,UAAU,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;;;;","names":[]}
1
+ {"version":3,"file":"index.d.ts","sources":["../src/components/button.tsx","../src/cn.ts","../src/components/link.tsx","../src/components/card.tsx","../src/components/input.tsx"],"mappings":";;;;;;;AAIA,cAAc,cAAc;AAC5B;AACA;AACA;AACA;AACA,IAAI,8BAA8B,CAAC,SAAS;AAC5C,iBAAiB,MAAM,wEAAwE,cAAc,aAAa,YAAY,QAAQ,cAAc;AAC5J;AACA,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO;;ACXjC,iBAAiB,EAAE,YAAY,UAAU;;ACAzC,cAAc,YAAY;AAC1B;AACA;AACA,IAAI,8BAA8B,CAAC,SAAS;;ACA5C,cAAc,YAAY;AAC1B;AACA,IAAI,8BAA8B,CAAC,SAAS;AAC5C,iBAAiB,IAAI,gCAAgC,KAAK,CAAC,cAAc,UAAU,YAAY,QAAQ,YAAY,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO;AACpJ,iBAAiB,UAAU,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AAChH,iBAAiB,SAAS,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AAC/G,iBAAiB,eAAe,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AACrH,iBAAiB,UAAU,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AAChH,iBAAiB,WAAW,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;AACjH,iBAAiB,UAAU,0BAA0B,KAAK,CAAC,cAAc,UAAU,iBAAiB,CAAC,GAAG,CAAC,OAAO;;ACXhH,iBAAiB,KAAK,kDAAkD,IAAI,CAAC,cAAc;AAC3F,YAAY,SAAS;AACrB;AACA,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO;;;;","names":[]}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { cva } from 'class-variance-authority';
3
3
  import { Slot } from 'radix-ui';
4
- import { clsx } from 'clsx';
4
+ import clsx$1, { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import 'react';
7
7
 
@@ -286,4 +286,27 @@ function CardFooter({ className, ...props }) {
286
286
  });
287
287
  }
288
288
 
289
- export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, LinkVariants, cn };
289
+ function Input({ className, type, size = "lg", dir, addon, ...props }) {
290
+ return /*#__PURE__*/ jsxs("div", {
291
+ dir: dir,
292
+ role: "group",
293
+ className: clsx$1("after:bg-nds-neutral-950 has-aria-invalid:after:bg-nds-error-700 relative flex w-fit justify-center overflow-hidden rounded-sm transition-shadow [--input-border:var(--color-nds-neutral-400)] after:absolute after:bottom-0 after:h-0.5 after:w-0 after:transition-[width] not-active:focus-within:shadow-md focus-within:after:w-full active:after:w-2/5 has-disabled:shadow-none has-disabled:after:w-0 has-aria-invalid:[--input-border:var(--color-nds-error-700)] has-[input:active]:[--input-border:var(--color-nds-neutral-400)] has-[input:hover]:[--input-border:var(--color-nds-neutral-700)]", {
294
+ "h-10": size === "lg",
295
+ "h-8": size === "md"
296
+ }),
297
+ children: [
298
+ /*#__PURE__*/ jsx("input", {
299
+ type: type,
300
+ "data-slot": "input",
301
+ className: clsx$1("bg-nds-white text-nds-neutral-700 hover:text-nds-black placeholder:text-nds-neutral-500 active:bg-nds-neutral-100 active:text-nds-neutral-700 relative min-w-0 rounded-s-sm border border-e-0 border-(--input-border) ps-2 pe-4 text-base ring-0 transition-colors outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", className),
302
+ ...props
303
+ }),
304
+ addon && /*#__PURE__*/ jsx("div", {
305
+ className: "bg-nds-neutral-100 text-nds-neutral-500 flex h-full items-center gap-1 rounded-e-sm border border-s-0 border-(--input-border) px-4 transition-colors",
306
+ children: addon
307
+ })
308
+ ]
309
+ });
310
+ }
311
+
312
+ export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, LinkVariants, cn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-nds/react",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "React component library for better-nds",
5
5
  "license": "MIT",
6
6
  "sideEffects": [