@brightlocal/ui-components 0.1.0
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/LICENSE +21 -0
- package/README.md +349 -0
- package/dist/accordion.cjs +1 -0
- package/dist/accordion.d.ts +32 -0
- package/dist/accordion.d.ts.map +1 -0
- package/dist/accordion.js +107 -0
- package/dist/alert-dialog.cjs +1 -0
- package/dist/alert-dialog.d.ts +15 -0
- package/dist/alert-dialog.d.ts.map +1 -0
- package/dist/alert-dialog.js +146 -0
- package/dist/alert.cjs +1 -0
- package/dist/alert.d.ts +16 -0
- package/dist/alert.d.ts.map +1 -0
- package/dist/alert.js +174 -0
- package/dist/aspect-ratio.cjs +1 -0
- package/dist/aspect-ratio.d.ts +10 -0
- package/dist/aspect-ratio.d.ts.map +1 -0
- package/dist/aspect-ratio.js +22 -0
- package/dist/avatar.cjs +1 -0
- package/dist/avatar.d.ts +11 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +46 -0
- package/dist/badge.cjs +1 -0
- package/dist/badge.d.ts +19 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +50 -0
- package/dist/blocks/data-table.cjs +1 -0
- package/dist/blocks/data-table.d.ts +303 -0
- package/dist/blocks/data-table.d.ts.map +1 -0
- package/dist/blocks/data-table.js +555 -0
- package/dist/blocks/sidebar.cjs +1 -0
- package/dist/blocks/sidebar.d.ts +744 -0
- package/dist/blocks/sidebar.d.ts.map +1 -0
- package/dist/blocks/sidebar.js +839 -0
- package/dist/breadcrumb.cjs +1 -0
- package/dist/breadcrumb.d.ts +12 -0
- package/dist/breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb.js +102 -0
- package/dist/button.cjs +1 -0
- package/dist/button.d.ts +73 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +195 -0
- package/dist/calendar.cjs +1 -0
- package/dist/calendar.d.ts +28 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +191 -0
- package/dist/card.cjs +1 -0
- package/dist/card.d.ts +28 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +131 -0
- package/dist/carousel.cjs +1 -0
- package/dist/carousel.d.ts +21 -0
- package/dist/carousel.d.ts.map +1 -0
- package/dist/carousel.js +185 -0
- package/dist/centred-layout.cjs +1 -0
- package/dist/centred-layout.d.ts +49 -0
- package/dist/centred-layout.d.ts.map +1 -0
- package/dist/centred-layout.js +35 -0
- package/dist/chart.cjs +10 -0
- package/dist/chart.d.ts +83 -0
- package/dist/chart.d.ts.map +1 -0
- package/dist/chart.js +254 -0
- package/dist/checkbox.cjs +1 -0
- package/dist/checkbox.d.ts +15 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +96 -0
- package/dist/collapsible.cjs +1 -0
- package/dist/collapsible.d.ts +18 -0
- package/dist/collapsible.d.ts.map +1 -0
- package/dist/collapsible.js +58 -0
- package/dist/combobox.cjs +1 -0
- package/dist/combobox.d.ts +65 -0
- package/dist/combobox.d.ts.map +1 -0
- package/dist/combobox.js +203 -0
- package/dist/command.cjs +1 -0
- package/dist/command.d.ts +44 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +166 -0
- package/dist/context-menu.cjs +1 -0
- package/dist/context-menu.d.ts +42 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +226 -0
- package/dist/date-picker.cjs +1 -0
- package/dist/date-picker.d.ts +54 -0
- package/dist/date-picker.d.ts.map +1 -0
- package/dist/date-picker.js +95 -0
- package/dist/dialog.cjs +1 -0
- package/dist/dialog.d.ts +20 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +130 -0
- package/dist/drawer.cjs +1 -0
- package/dist/drawer.d.ts +22 -0
- package/dist/drawer.d.ts.map +1 -0
- package/dist/drawer.js +149 -0
- package/dist/dropdown-menu.cjs +1 -0
- package/dist/dropdown-menu.d.ts +253 -0
- package/dist/dropdown-menu.d.ts.map +1 -0
- package/dist/dropdown-menu.js +325 -0
- package/dist/field.cjs +1 -0
- package/dist/field.d.ts +21 -0
- package/dist/field.d.ts.map +1 -0
- package/dist/field.js +148 -0
- package/dist/global-layout.cjs +1 -0
- package/dist/global-layout.d.ts +60 -0
- package/dist/global-layout.d.ts.map +1 -0
- package/dist/global-layout.js +87 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/hover-card.cjs +1 -0
- package/dist/hover-card.d.ts +43 -0
- package/dist/hover-card.d.ts.map +1 -0
- package/dist/hover-card.js +71 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +412 -0
- package/dist/input-base.cjs +1 -0
- package/dist/input-base.d.ts +28 -0
- package/dist/input-base.d.ts.map +1 -0
- package/dist/input-base.js +56 -0
- package/dist/input-group.cjs +1 -0
- package/dist/input-group.d.ts +26 -0
- package/dist/input-group.d.ts.map +1 -0
- package/dist/input-group.js +116 -0
- package/dist/input-otp.cjs +1 -0
- package/dist/input-otp.d.ts +45 -0
- package/dist/input-otp.d.ts.map +1 -0
- package/dist/input-otp.js +186 -0
- package/dist/input-password.cjs +1 -0
- package/dist/input-password.d.ts +38 -0
- package/dist/input-password.d.ts.map +1 -0
- package/dist/input-password.js +101 -0
- package/dist/input.cjs +1 -0
- package/dist/input.d.ts +32 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +146 -0
- package/dist/label.cjs +1 -0
- package/dist/label.d.ts +12 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +34 -0
- package/dist/lib/utils.cjs +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +8 -0
- package/dist/link.cjs +1 -0
- package/dist/link.d.ts +29 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.figma.d.ts +2 -0
- package/dist/link.figma.d.ts.map +1 -0
- package/dist/link.js +71 -0
- package/dist/logo.cjs +1 -0
- package/dist/logo.d.ts +25 -0
- package/dist/logo.d.ts.map +1 -0
- package/dist/logo.js +71 -0
- package/dist/menubar.cjs +1 -0
- package/dist/menubar.d.ts +106 -0
- package/dist/menubar.d.ts.map +1 -0
- package/dist/menubar.js +270 -0
- package/dist/navigation-menu.cjs +1 -0
- package/dist/navigation-menu.d.ts +108 -0
- package/dist/navigation-menu.d.ts.map +1 -0
- package/dist/navigation-menu.js +175 -0
- package/dist/pagination.cjs +1 -0
- package/dist/pagination.d.ts +81 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +216 -0
- package/dist/popover.cjs +1 -0
- package/dist/popover.d.ts +8 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +44 -0
- package/dist/progress.cjs +1 -0
- package/dist/progress.d.ts +29 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +64 -0
- package/dist/radio-group.cjs +1 -0
- package/dist/radio-group.d.ts +33 -0
- package/dist/radio-group.d.ts.map +1 -0
- package/dist/radio-group.js +193 -0
- package/dist/rating.cjs +1 -0
- package/dist/rating.d.ts +22 -0
- package/dist/rating.d.ts.map +1 -0
- package/dist/rating.js +51 -0
- package/dist/resizable.cjs +1 -0
- package/dist/resizable.d.ts +14 -0
- package/dist/resizable.d.ts.map +1 -0
- package/dist/resizable.js +46 -0
- package/dist/scroll-area.cjs +1 -0
- package/dist/scroll-area.d.ts +12 -0
- package/dist/scroll-area.d.ts.map +1 -0
- package/dist/scroll-area.js +67 -0
- package/dist/select.cjs +1 -0
- package/dist/select.d.ts +77 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +259 -0
- package/dist/separator.cjs +1 -0
- package/dist/separator.d.ts +14 -0
- package/dist/separator.d.ts.map +1 -0
- package/dist/separator.js +43 -0
- package/dist/sheet.cjs +1 -0
- package/dist/sheet.d.ts +38 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +190 -0
- package/dist/skeleton.cjs +1 -0
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.d.ts.map +1 -0
- package/dist/skeleton.js +15 -0
- package/dist/slider.cjs +1 -0
- package/dist/slider.d.ts +19 -0
- package/dist/slider.d.ts.map +1 -0
- package/dist/slider.js +69 -0
- package/dist/sonner.cjs +1 -0
- package/dist/sonner.d.ts +188 -0
- package/dist/sonner.d.ts.map +1 -0
- package/dist/sonner.js +150 -0
- package/dist/split-layout.cjs +1 -0
- package/dist/split-layout.d.ts +42 -0
- package/dist/split-layout.d.ts.map +1 -0
- package/dist/split-layout.js +108 -0
- package/dist/switch.cjs +1 -0
- package/dist/switch.d.ts +43 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.figma.d.ts +2 -0
- package/dist/switch.figma.d.ts.map +1 -0
- package/dist/switch.js +110 -0
- package/dist/table.cjs +1 -0
- package/dist/table.d.ts +95 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +164 -0
- package/dist/tabs.cjs +1 -0
- package/dist/tabs.d.ts +29 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +96 -0
- package/dist/textarea.cjs +1 -0
- package/dist/textarea.d.ts +23 -0
- package/dist/textarea.d.ts.map +1 -0
- package/dist/textarea.js +47 -0
- package/dist/toggle-group.cjs +1 -0
- package/dist/toggle-group.d.ts +25 -0
- package/dist/toggle-group.d.ts.map +1 -0
- package/dist/toggle-group.js +74 -0
- package/dist/toggle.cjs +1 -0
- package/dist/toggle.d.ts +44 -0
- package/dist/toggle.d.ts.map +1 -0
- package/dist/toggle.figma.d.ts +2 -0
- package/dist/toggle.figma.d.ts.map +1 -0
- package/dist/toggle.js +57 -0
- package/dist/tooltip.cjs +1 -0
- package/dist/tooltip.d.ts +66 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +78 -0
- package/package.json +184 -0
- package/src/blocks/data-table.tsx +1166 -0
- package/src/blocks/sidebar.tsx +1830 -0
- package/src/components/.gitkeep +0 -0
- package/src/components/accordion.tsx +142 -0
- package/src/components/alert-dialog.tsx +157 -0
- package/src/components/alert.tsx +199 -0
- package/src/components/aspect-ratio.tsx +30 -0
- package/src/components/avatar.tsx +56 -0
- package/src/components/badge.tsx +72 -0
- package/src/components/breadcrumb.tsx +109 -0
- package/src/components/button.tsx +296 -0
- package/src/components/calendar.tsx +234 -0
- package/src/components/card.tsx +158 -0
- package/src/components/carousel.tsx +256 -0
- package/src/components/centred-layout.tsx +91 -0
- package/src/components/chart.tsx +456 -0
- package/src/components/checkbox.tsx +132 -0
- package/src/components/collapsible.tsx +68 -0
- package/src/components/combobox.tsx +321 -0
- package/src/components/command.tsx +220 -0
- package/src/components/context-menu.tsx +305 -0
- package/src/components/date-picker.tsx +155 -0
- package/src/components/dialog.tsx +152 -0
- package/src/components/drawer.tsx +168 -0
- package/src/components/dropdown-menu.tsx +575 -0
- package/src/components/field.tsx +155 -0
- package/src/components/global-layout.tsx +153 -0
- package/src/components/hover-card.tsx +121 -0
- package/src/components/input-base.tsx +86 -0
- package/src/components/input-group.tsx +158 -0
- package/src/components/input-otp.tsx +327 -0
- package/src/components/input-password.tsx +191 -0
- package/src/components/input.tsx +220 -0
- package/src/components/label.tsx +42 -0
- package/src/components/link.figma.tsx +71 -0
- package/src/components/link.tsx +105 -0
- package/src/components/logo.tsx +97 -0
- package/src/components/menubar.tsx +379 -0
- package/src/components/navigation-menu.tsx +324 -0
- package/src/components/pagination.tsx +368 -0
- package/src/components/popover.tsx +46 -0
- package/src/components/progress.tsx +100 -0
- package/src/components/radio-group.tsx +281 -0
- package/src/components/rating.tsx +87 -0
- package/src/components/resizable.tsx +66 -0
- package/src/components/scroll-area.tsx +72 -0
- package/src/components/select.tsx +442 -0
- package/src/components/separator.tsx +53 -0
- package/src/components/sheet.tsx +220 -0
- package/src/components/skeleton.tsx +17 -0
- package/src/components/slider.tsx +86 -0
- package/src/components/sonner.tsx +396 -0
- package/src/components/split-layout.tsx +155 -0
- package/src/components/switch.figma.tsx +115 -0
- package/src/components/switch.tsx +173 -0
- package/src/components/table.tsx +277 -0
- package/src/components/tabs.tsx +142 -0
- package/src/components/textarea.tsx +77 -0
- package/src/components/toggle-group.tsx +109 -0
- package/src/components/toggle.figma.tsx +81 -0
- package/src/components/toggle.tsx +103 -0
- package/src/components/tooltip.tsx +156 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/index.ts +67 -0
- package/src/lib/utils.ts +6 -0
- package/src/types/external-modules.d.ts +16 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Shared input variant styles
|
|
4
|
+
* These can be reused across different input components
|
|
5
|
+
*/
|
|
6
|
+
export declare const inputVariants: (props?: ({
|
|
7
|
+
hasIcon?: boolean | null | undefined;
|
|
8
|
+
hasSecondaryIcon?: boolean | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Base input element without label/description wrapper
|
|
12
|
+
* Use this for composing custom input components
|
|
13
|
+
*
|
|
14
|
+
* For inputs with label/description, compose with Field, FieldLabel, FieldDescription
|
|
15
|
+
* For full-featured input with all props, use the Input component
|
|
16
|
+
*/
|
|
17
|
+
export interface BaseInputElementProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
18
|
+
/**
|
|
19
|
+
* Whether the input has an icon (adds left padding)
|
|
20
|
+
*/
|
|
21
|
+
hasIcon?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the input has a secondary icon (adds right padding)
|
|
24
|
+
*/
|
|
25
|
+
hasSecondaryIcon?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const BaseInputElement: React.ForwardRefExoticComponent<BaseInputElementProps & React.RefAttributes<HTMLInputElement>>;
|
|
28
|
+
//# sourceMappingURL=input-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-base.d.ts","sourceRoot":"","sources":["../../src/components/input-base.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;GAGG;AACH,eAAO,MAAM,aAAa;;;8EAsCzB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC3C,MAAM,CACP;IACC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,gBAAgB,gGAY3B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { cva as l } from "class-variance-authority";
|
|
4
|
+
import { cn as i } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
const d = l(
|
|
6
|
+
[
|
|
7
|
+
// Layout & Size
|
|
8
|
+
"flex w-full min-w-0 h-9",
|
|
9
|
+
// Appearance
|
|
10
|
+
"border border-input bg-background rounded-sm",
|
|
11
|
+
"outline-none transition-all",
|
|
12
|
+
// Typography
|
|
13
|
+
"text-sm font-sans",
|
|
14
|
+
"text-foreground",
|
|
15
|
+
"overflow-hidden text-ellipsis",
|
|
16
|
+
// States - Focus
|
|
17
|
+
"focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background",
|
|
18
|
+
"focus-visible:shadow-default",
|
|
19
|
+
// States - Disabled
|
|
20
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
21
|
+
// Pseudo-elements
|
|
22
|
+
"placeholder:text-muted-foreground",
|
|
23
|
+
"placeholder:overflow-hidden placeholder:text-ellipsis",
|
|
24
|
+
// Text input alignment - uses design token for text/sm line-height (20px)
|
|
25
|
+
"items-center px-3 pb-[1px] leading-5"
|
|
26
|
+
],
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
hasIcon: {
|
|
30
|
+
true: "pl-9",
|
|
31
|
+
false: ""
|
|
32
|
+
},
|
|
33
|
+
hasSecondaryIcon: {
|
|
34
|
+
true: "pr-9",
|
|
35
|
+
false: ""
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
hasIcon: !1,
|
|
40
|
+
hasSecondaryIcon: !1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
), f = n.forwardRef(({ className: e, hasIcon: o = !1, hasSecondaryIcon: a = !1, ...t }, s) => /* @__PURE__ */ r(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
ref: s,
|
|
47
|
+
className: i(d({ hasIcon: o, hasSecondaryIcon: a }), e),
|
|
48
|
+
"data-slot": "input",
|
|
49
|
+
...t
|
|
50
|
+
}
|
|
51
|
+
));
|
|
52
|
+
f.displayName = "BaseInputElement";
|
|
53
|
+
export {
|
|
54
|
+
f as BaseInputElement,
|
|
55
|
+
d as inputVariants
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("react"),h=require("@radix-ui/react-slot"),a=require("class-variance-authority"),s=require("@brightlocal/ui-components/lib/utils"),G=require("@brightlocal/ui-components/input-base");function I(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const i=I(g),u=a.cva("relative flex w-full items-center overflow-hidden rounded-md border border-input bg-background transition-colors has-[:focus-visible]:border-ring has-[:focus-visible]:shadow-default has-[:disabled]:opacity-50",{variants:{size:{default:"h-9",sm:"h-8",lg:"h-10"}},defaultVariants:{size:"default"}}),l=i.forwardRef(({className:t,size:n,...e},r)=>o.jsx("div",{ref:r,className:s.cn(u({size:n}),t),...e}));l.displayName="InputGroup";const c=i.forwardRef(({className:t,...n},e)=>o.jsx(G.BaseInputElement,{ref:e,className:s.cn("border-0 focus-visible:border-0 focus-visible:shadow-[none]","h-full",t),...n}));c.displayName="InputGroupInput";const x=a.cva("flex shrink-0 items-center",{variants:{align:{"inline-start":"","inline-end":"ml-auto","block-start":"self-start","block-end":"self-end"}},defaultVariants:{align:"inline-start"}}),d=i.forwardRef(({className:t,align:n,...e},r)=>o.jsx("div",{ref:r,className:s.cn(x({align:n}),t),...e}));d.displayName="InputGroupAddon";const p=a.cva(["inline-flex items-center justify-center gap-2","text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","text-muted-foreground hover:text-foreground","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"],{variants:{variant:{default:"hover:bg-accent",ghost:""},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-4",icon:"h-9 w-9","icon-xs":"h-6 w-6","icon-sm":"h-8 w-8","icon-lg":"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),f=i.forwardRef(({className:t,variant:n,size:e,asChild:r=!1,...b},v)=>{const m=r?h.Slot:"button";return o.jsx(m,{ref:v,className:s.cn(p({variant:n,size:e,className:t})),type:r?void 0:"button",...b})});f.displayName="InputGroupButton";exports.InputGroup=l;exports.InputGroupAddon=d;exports.InputGroupButton=f;exports.InputGroupInput=c;exports.inputGroupButtonVariants=p;exports.inputGroupVariants=u;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const inputGroupVariants: (props?: ({
|
|
4
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
interface InputGroupProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof inputGroupVariants> {
|
|
7
|
+
}
|
|
8
|
+
declare const InputGroup: React.ForwardRefExoticComponent<InputGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const InputGroupInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
|
10
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
11
|
+
align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
|
|
12
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
13
|
+
interface InputGroupAddonProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof inputGroupAddonVariants> {
|
|
14
|
+
}
|
|
15
|
+
declare const InputGroupAddon: React.ForwardRefExoticComponent<InputGroupAddonProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
17
|
+
variant?: "default" | "ghost" | null | undefined;
|
|
18
|
+
size?: "default" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
19
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
20
|
+
interface InputGroupButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof inputGroupButtonVariants> {
|
|
21
|
+
asChild?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const InputGroupButton: React.ForwardRefExoticComponent<InputGroupButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
export { InputGroup, InputGroupInput, InputGroupAddon, InputGroupButton, inputGroupVariants, inputGroupButtonVariants, };
|
|
25
|
+
export type { InputGroupProps, InputGroupAddonProps, InputGroupButtonProps };
|
|
26
|
+
//# sourceMappingURL=input-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../src/components/input-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,QAAA,MAAM,kBAAkB;;8EAcvB,CAAC;AAEF,UAAU,eACR,SACE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,YAAY,CAAC,OAAO,kBAAkB,CAAC;CAAG;AAE9C,QAAA,MAAM,UAAU,wFAUf,CAAC;AAGF,QAAA,MAAM,eAAe,sHAgBnB,CAAC;AAGH,QAAA,MAAM,uBAAuB;;8EAY3B,CAAC;AAEH,UAAU,oBACR,SACE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,YAAY,CAAC,OAAO,uBAAuB,CAAC;CAAG;AAEnD,QAAA,MAAM,eAAe,6FAUpB,CAAC;AAGF,QAAA,MAAM,wBAAwB;;;8EA8B7B,CAAC;AAEF,UAAU,qBACR,SACE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,YAAY,CAAC,OAAO,wBAAwB,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,gBAAgB,iGAapB,CAAC;AAGH,OAAO,EACL,UAAU,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACzB,CAAC;AACF,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { Slot as d } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as a } from "class-variance-authority";
|
|
5
|
+
import { cn as i } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { BaseInputElement as p } from "@brightlocal/ui-components/input-base";
|
|
7
|
+
const f = a(
|
|
8
|
+
"relative flex w-full items-center overflow-hidden rounded-md border border-input bg-background transition-colors has-[:focus-visible]:border-ring has-[:focus-visible]:shadow-default has-[:disabled]:opacity-50",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
default: "h-9",
|
|
13
|
+
sm: "h-8",
|
|
14
|
+
lg: "h-10"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: "default"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
), c = s.forwardRef(
|
|
22
|
+
({ className: t, size: e, ...n }, o) => /* @__PURE__ */ r(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
ref: o,
|
|
26
|
+
className: i(f({ size: e }), t),
|
|
27
|
+
...n
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
c.displayName = "InputGroup";
|
|
32
|
+
const m = s.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ r(
|
|
33
|
+
p,
|
|
34
|
+
{
|
|
35
|
+
ref: n,
|
|
36
|
+
className: i(
|
|
37
|
+
// Override border and focus styles since InputGroup handles them
|
|
38
|
+
"border-0 focus-visible:border-0 focus-visible:shadow-[none]",
|
|
39
|
+
"h-full",
|
|
40
|
+
t
|
|
41
|
+
),
|
|
42
|
+
...e
|
|
43
|
+
}
|
|
44
|
+
));
|
|
45
|
+
m.displayName = "InputGroupInput";
|
|
46
|
+
const v = a("flex shrink-0 items-center", {
|
|
47
|
+
variants: {
|
|
48
|
+
align: {
|
|
49
|
+
"inline-start": "",
|
|
50
|
+
"inline-end": "ml-auto",
|
|
51
|
+
"block-start": "self-start",
|
|
52
|
+
"block-end": "self-end"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
align: "inline-start"
|
|
57
|
+
}
|
|
58
|
+
}), b = s.forwardRef(
|
|
59
|
+
({ className: t, align: e, ...n }, o) => /* @__PURE__ */ r(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref: o,
|
|
63
|
+
className: i(v({ align: e }), t),
|
|
64
|
+
...n
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
b.displayName = "InputGroupAddon";
|
|
69
|
+
const h = a(
|
|
70
|
+
[
|
|
71
|
+
"inline-flex items-center justify-center gap-2",
|
|
72
|
+
"text-sm font-medium transition-colors",
|
|
73
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
74
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
75
|
+
"text-muted-foreground hover:text-foreground",
|
|
76
|
+
"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"
|
|
77
|
+
],
|
|
78
|
+
{
|
|
79
|
+
variants: {
|
|
80
|
+
variant: {
|
|
81
|
+
default: "hover:bg-accent",
|
|
82
|
+
ghost: ""
|
|
83
|
+
},
|
|
84
|
+
size: {
|
|
85
|
+
default: "h-9 px-3",
|
|
86
|
+
sm: "h-8 px-2",
|
|
87
|
+
lg: "h-10 px-4",
|
|
88
|
+
icon: "h-9 w-9",
|
|
89
|
+
"icon-xs": "h-6 w-6",
|
|
90
|
+
"icon-sm": "h-8 w-8",
|
|
91
|
+
"icon-lg": "h-10 w-10"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
defaultVariants: {
|
|
95
|
+
variant: "default",
|
|
96
|
+
size: "default"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
), g = s.forwardRef(({ className: t, variant: e, size: n, asChild: o = !1, ...u }, l) => /* @__PURE__ */ r(
|
|
100
|
+
o ? d : "button",
|
|
101
|
+
{
|
|
102
|
+
ref: l,
|
|
103
|
+
className: i(h({ variant: e, size: n, className: t })),
|
|
104
|
+
type: o ? void 0 : "button",
|
|
105
|
+
...u
|
|
106
|
+
}
|
|
107
|
+
));
|
|
108
|
+
g.displayName = "InputGroupButton";
|
|
109
|
+
export {
|
|
110
|
+
c as InputGroup,
|
|
111
|
+
b as InputGroupAddon,
|
|
112
|
+
g as InputGroupButton,
|
|
113
|
+
m as InputGroupInput,
|
|
114
|
+
h as inputGroupButtonVariants,
|
|
115
|
+
f as inputGroupVariants
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("react"),l=require("input-otp"),_=require("lucide-react"),O=require("@brightlocal/ui-components/lib/utils"),N=require("@brightlocal/ui-components/label");function R(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const d=R(y),x=d.forwardRef(({trackingEl:e,trackingLabel:n,dataHook:r,containerClassName:i,...a},o)=>{const c=a.id||a["aria-label"]?a["aria-label"]:"One-time password";return t.jsx(l.OTPInput,{ref:o,"aria-label":c,className:"disabled:cursor-not-allowed",containerClassName:O.cn("group flex items-center gap-2 has-disabled:opacity-50 w-fit",i),"data-hook":r,"data-slot":"input-otp","data-tracking-el":e,"data-tracking-label":n,...a})});x.displayName="InputOTP";function m({className:e,...n}){return t.jsx("div",{className:O.cn("flex items-center rounded-md shadow-xs",e),"data-slot":"input-otp-group",...n})}function p({index:e,className:n,...r}){const i=d.useContext(l.OTPInputContext),{char:a,hasFakeCaret:o,isActive:s}=i?.slots[e]??{};return t.jsxs("div",{className:O.cn("relative flex h-9 w-9 items-center justify-center","border-input bg-background border-y border-r","text-foreground text-sm font-normal transition-all outline-none","first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:border-ring data-[active=true]:z-10","data-[active=true]:shadow-default","group-has-[input[aria-invalid=true]]:border-destructive","group-has-[input[aria-invalid=true]]:data-[active=true]:shadow-destructive","group-has-[input[aria-invalid=true]]:data-[active=true]:border-destructive","dark:bg-input/30",n),"data-active":s,"data-slot":"input-otp-slot",...r,children:[a,o&&t.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:t.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function j({...e}){return t.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...e,children:t.jsx(_.MinusIcon,{})})}const f=d.forwardRef(({label:e,id:n,dataHook:r,trackingEl:i,trackingLabel:a,containerClassName:o,children:s,"aria-label":c,...h},b)=>{const g=d.useId(),u=n||g,S=c||(e?void 0:"One-time password");return t.jsxs("div",{className:"w-fit",children:[e&&t.jsx(N.Label,{className:"mb-2","data-hook":r?`${r}-label`:void 0,htmlFor:u,children:e}),t.jsx(x,{ref:b,"aria-label":S,containerClassName:o,dataHook:r,id:e?u:void 0,trackingEl:i,trackingLabel:a,...h,children:s})]})});f.displayName="InputOTPField";const I=d.forwardRef(({maxLength:e=6,pattern:n=l.REGEXP_ONLY_DIGITS,...r},i)=>t.jsx(f,{ref:i,inputMode:"numeric",maxLength:e,pasteTransformer:a=>a.replace(/\D+/g,"").slice(0,e),pattern:n,...r,children:t.jsx(m,{children:Array.from({length:e},(a,o)=>t.jsx(p,{index:o},o))})}));I.displayName="InputOTPDigitsOnly";const P=d.forwardRef(({maxLength:e=4,...n},r)=>t.jsx(f,{ref:r,containerClassName:"gap-2",maxLength:e,...n,children:Array.from({length:e},(i,a)=>t.jsx(p,{className:"rounded-md border-l shadow-xs",index:a},a))}));P.displayName="InputOTPWithSpacing";const T=d.forwardRef(({maxLength:e=6,...n},r)=>{const i=Math.ceil(e/2),a=e-i;return t.jsxs(f,{ref:r,maxLength:e,...n,children:[t.jsx(m,{children:Array.from({length:i},(o,s)=>t.jsx(p,{index:s},s))}),t.jsx(j,{}),t.jsx(m,{children:Array.from({length:a},(o,s)=>t.jsx(p,{index:s+i},s+i))})]})});T.displayName="InputOTPSimple";const v=d.forwardRef(({maxLength:e=6,...n},r)=>{const a=Math.ceil(e/2);return t.jsx(f,{ref:r,maxLength:e,...n,children:Array.from({length:a},(o,s)=>{const c=s*2,b=Math.min(c+2,e)-c;return t.jsxs(d.Fragment,{children:[s>0&&t.jsx(j,{}),t.jsx(m,{children:Array.from({length:b},(g,u)=>t.jsx(p,{index:c+u},c+u))})]},s)})})});v.displayName="InputOTPWithSeparator";Object.defineProperty(exports,"REGEXP_ONLY_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_CHARS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS_AND_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS_AND_CHARS});exports.InputOTPDigitsOnly=I;exports.InputOTPSimple=T;exports.InputOTPWithSeparator=v;exports.InputOTPWithSpacing=P;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { OTPInput, REGEXP_ONLY_DIGITS, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type InputOTPProps = React.ComponentProps<typeof OTPInput> & {
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
trackingEl?: string;
|
|
6
|
+
dataHook: string;
|
|
7
|
+
trackingLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
type InputOTPGroupProps = React.ComponentProps<"div">;
|
|
10
|
+
type InputOTPSlotProps = React.ComponentProps<"div"> & {
|
|
11
|
+
index: number;
|
|
12
|
+
};
|
|
13
|
+
interface InputOTPFieldProps {
|
|
14
|
+
id?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
dataHook: string;
|
|
17
|
+
trackingEl?: string;
|
|
18
|
+
trackingLabel?: string;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
maxLength: number;
|
|
21
|
+
containerClassName?: string;
|
|
22
|
+
inputMode?: "numeric" | "text" | "none" | "tel" | "url" | "email" | "decimal";
|
|
23
|
+
pasteTransformer?: (p: string) => string;
|
|
24
|
+
pattern?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
}
|
|
29
|
+
interface VariantInputOTPProps extends Omit<InputOTPFieldProps, "children" | "maxLength"> {
|
|
30
|
+
maxLength?: number;
|
|
31
|
+
dataHook: string;
|
|
32
|
+
trackingEl?: string;
|
|
33
|
+
trackingLabel?: string;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
autoFocus?: boolean;
|
|
36
|
+
pattern?: string;
|
|
37
|
+
"aria-label"?: string;
|
|
38
|
+
}
|
|
39
|
+
declare const InputOTPDigitsOnly: React.ForwardRefExoticComponent<VariantInputOTPProps & React.RefAttributes<HTMLInputElement>>;
|
|
40
|
+
declare const InputOTPWithSpacing: React.ForwardRefExoticComponent<VariantInputOTPProps & React.RefAttributes<HTMLInputElement>>;
|
|
41
|
+
declare const InputOTPSimple: React.ForwardRefExoticComponent<VariantInputOTPProps & React.RefAttributes<HTMLInputElement>>;
|
|
42
|
+
declare const InputOTPWithSeparator: React.ForwardRefExoticComponent<VariantInputOTPProps & React.RefAttributes<HTMLInputElement>>;
|
|
43
|
+
export { InputOTPDigitsOnly, InputOTPWithSpacing, InputOTPSimple, InputOTPWithSeparator, REGEXP_ONLY_DIGITS, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS_AND_CHARS, };
|
|
44
|
+
export type { VariantInputOTPProps, InputOTPProps, InputOTPGroupProps, InputOTPSlotProps, };
|
|
45
|
+
//# sourceMappingURL=input-otp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-otp.d.ts","sourceRoot":"","sources":["../../src/components/input-otp.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EAGR,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,EAC7B,MAAM,WAAW,CAAC;AAMnB,KAAK,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,GAAG;IAC3D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAkCF,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAYtD,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACrD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkDF,UAAU,kBAAkB;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;IAC9E,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAsDD,UAAU,oBAAqB,SAAQ,IAAI,CACzC,kBAAkB,EAClB,UAAU,GAAG,WAAW,CACzB;IACC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,kBAAkB,+FAsBtB,CAAC;AAIH,QAAA,MAAM,mBAAmB,+FAoBvB,CAAC;AAIH,QAAA,MAAM,cAAc,+FAwBnB,CAAC;AAIF,QAAA,MAAM,qBAAqB,+FA2BzB,CAAC;AAIH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,GAC7B,CAAC;AAEF,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { REGEXP_ONLY_DIGITS as T, OTPInputContext as N, OTPInput as y } from "input-otp";
|
|
4
|
+
import { REGEXP_ONLY_CHARS as L, REGEXP_ONLY_DIGITS as M, REGEXP_ONLY_DIGITS_AND_CHARS as j } from "input-otp";
|
|
5
|
+
import { MinusIcon as w } from "lucide-react";
|
|
6
|
+
import { cn as g } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { Label as S } from "@brightlocal/ui-components/label";
|
|
8
|
+
const v = d.forwardRef(
|
|
9
|
+
({ trackingEl: e, trackingLabel: a, dataHook: n, containerClassName: i, ...r }, s) => {
|
|
10
|
+
const l = r.id || r["aria-label"] ? r["aria-label"] : "One-time password";
|
|
11
|
+
return /* @__PURE__ */ t(
|
|
12
|
+
y,
|
|
13
|
+
{
|
|
14
|
+
ref: s,
|
|
15
|
+
"aria-label": l,
|
|
16
|
+
className: "disabled:cursor-not-allowed",
|
|
17
|
+
containerClassName: g(
|
|
18
|
+
"group flex items-center gap-2 has-disabled:opacity-50 w-fit",
|
|
19
|
+
i
|
|
20
|
+
),
|
|
21
|
+
"data-hook": n,
|
|
22
|
+
"data-slot": "input-otp",
|
|
23
|
+
"data-tracking-el": e,
|
|
24
|
+
"data-tracking-label": a,
|
|
25
|
+
...r
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
v.displayName = "InputOTP";
|
|
31
|
+
function m({ className: e, ...a }) {
|
|
32
|
+
return /* @__PURE__ */ t(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: g("flex items-center rounded-md shadow-xs", e),
|
|
36
|
+
"data-slot": "input-otp-group",
|
|
37
|
+
...a
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function u({ index: e, className: a, ...n }) {
|
|
42
|
+
const i = d.useContext(
|
|
43
|
+
N
|
|
44
|
+
), { char: r, hasFakeCaret: s, isActive: o } = i?.slots[e] ?? {};
|
|
45
|
+
return /* @__PURE__ */ f(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: g(
|
|
49
|
+
// Base styles
|
|
50
|
+
"relative flex h-9 w-9 items-center justify-center",
|
|
51
|
+
"border-input bg-background border-y border-r",
|
|
52
|
+
"text-foreground text-sm font-normal transition-all outline-none",
|
|
53
|
+
"first:rounded-l-md first:border-l last:rounded-r-md",
|
|
54
|
+
// Focus state
|
|
55
|
+
"data-[active=true]:border-ring data-[active=true]:z-10",
|
|
56
|
+
"data-[active=true]:shadow-default",
|
|
57
|
+
// Error state
|
|
58
|
+
"group-has-[input[aria-invalid=true]]:border-destructive",
|
|
59
|
+
"group-has-[input[aria-invalid=true]]:data-[active=true]:shadow-destructive",
|
|
60
|
+
"group-has-[input[aria-invalid=true]]:data-[active=true]:border-destructive",
|
|
61
|
+
// Dark mode
|
|
62
|
+
"dark:bg-input/30",
|
|
63
|
+
a
|
|
64
|
+
),
|
|
65
|
+
"data-active": o,
|
|
66
|
+
"data-slot": "input-otp-slot",
|
|
67
|
+
...n,
|
|
68
|
+
children: [
|
|
69
|
+
r,
|
|
70
|
+
s && /* @__PURE__ */ t("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ t("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function O({ ...e }) {
|
|
76
|
+
return /* @__PURE__ */ t("div", { "data-slot": "input-otp-separator", role: "separator", ...e, children: /* @__PURE__ */ t(w, {}) });
|
|
77
|
+
}
|
|
78
|
+
const p = d.forwardRef(
|
|
79
|
+
({
|
|
80
|
+
label: e,
|
|
81
|
+
id: a,
|
|
82
|
+
dataHook: n,
|
|
83
|
+
trackingEl: i,
|
|
84
|
+
trackingLabel: r,
|
|
85
|
+
containerClassName: s,
|
|
86
|
+
children: o,
|
|
87
|
+
"aria-label": l,
|
|
88
|
+
...b
|
|
89
|
+
}, h) => {
|
|
90
|
+
const I = d.useId(), c = a || I, P = l || (e ? void 0 : "One-time password");
|
|
91
|
+
return /* @__PURE__ */ f("div", { className: "w-fit", children: [
|
|
92
|
+
e && /* @__PURE__ */ t(
|
|
93
|
+
S,
|
|
94
|
+
{
|
|
95
|
+
className: "mb-2",
|
|
96
|
+
"data-hook": n ? `${n}-label` : void 0,
|
|
97
|
+
htmlFor: c,
|
|
98
|
+
children: e
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ t(
|
|
102
|
+
v,
|
|
103
|
+
{
|
|
104
|
+
ref: h,
|
|
105
|
+
"aria-label": P,
|
|
106
|
+
containerClassName: s,
|
|
107
|
+
dataHook: n,
|
|
108
|
+
id: e ? c : void 0,
|
|
109
|
+
trackingEl: i,
|
|
110
|
+
trackingLabel: r,
|
|
111
|
+
...b,
|
|
112
|
+
children: o
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
p.displayName = "InputOTPField";
|
|
119
|
+
const _ = d.forwardRef(({ maxLength: e = 6, pattern: a = T, ...n }, i) => /* @__PURE__ */ t(
|
|
120
|
+
p,
|
|
121
|
+
{
|
|
122
|
+
ref: i,
|
|
123
|
+
inputMode: "numeric",
|
|
124
|
+
maxLength: e,
|
|
125
|
+
pasteTransformer: (r) => r.replace(/\D+/g, "").slice(0, e),
|
|
126
|
+
pattern: a,
|
|
127
|
+
...n,
|
|
128
|
+
children: /* @__PURE__ */ t(m, { children: Array.from({ length: e }, (r, s) => /* @__PURE__ */ t(u, { index: s }, s)) })
|
|
129
|
+
}
|
|
130
|
+
));
|
|
131
|
+
_.displayName = "InputOTPDigitsOnly";
|
|
132
|
+
const x = d.forwardRef(({ maxLength: e = 4, ...a }, n) => /* @__PURE__ */ t(
|
|
133
|
+
p,
|
|
134
|
+
{
|
|
135
|
+
ref: n,
|
|
136
|
+
containerClassName: "gap-2",
|
|
137
|
+
maxLength: e,
|
|
138
|
+
...a,
|
|
139
|
+
children: Array.from({ length: e }, (i, r) => /* @__PURE__ */ t(
|
|
140
|
+
u,
|
|
141
|
+
{
|
|
142
|
+
className: "rounded-md border-l shadow-xs",
|
|
143
|
+
index: r
|
|
144
|
+
},
|
|
145
|
+
r
|
|
146
|
+
))
|
|
147
|
+
}
|
|
148
|
+
));
|
|
149
|
+
x.displayName = "InputOTPWithSpacing";
|
|
150
|
+
const A = d.forwardRef(
|
|
151
|
+
({ maxLength: e = 6, ...a }, n) => {
|
|
152
|
+
const i = Math.ceil(e / 2), r = e - i;
|
|
153
|
+
return /* @__PURE__ */ f(p, { ref: n, maxLength: e, ...a, children: [
|
|
154
|
+
/* @__PURE__ */ t(m, { children: Array.from({ length: i }, (s, o) => /* @__PURE__ */ t(u, { index: o }, o)) }),
|
|
155
|
+
/* @__PURE__ */ t(O, {}),
|
|
156
|
+
/* @__PURE__ */ t(m, { children: Array.from({ length: r }, (s, o) => /* @__PURE__ */ t(
|
|
157
|
+
u,
|
|
158
|
+
{
|
|
159
|
+
index: o + i
|
|
160
|
+
},
|
|
161
|
+
o + i
|
|
162
|
+
)) })
|
|
163
|
+
] });
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
A.displayName = "InputOTPSimple";
|
|
167
|
+
const R = d.forwardRef(({ maxLength: e = 6, ...a }, n) => {
|
|
168
|
+
const r = Math.ceil(e / 2);
|
|
169
|
+
return /* @__PURE__ */ t(p, { ref: n, maxLength: e, ...a, children: Array.from({ length: r }, (s, o) => {
|
|
170
|
+
const l = o * 2, h = Math.min(l + 2, e) - l;
|
|
171
|
+
return /* @__PURE__ */ f(d.Fragment, { children: [
|
|
172
|
+
o > 0 && /* @__PURE__ */ t(O, {}),
|
|
173
|
+
/* @__PURE__ */ t(m, { children: Array.from({ length: h }, (I, c) => /* @__PURE__ */ t(u, { index: l + c }, l + c)) })
|
|
174
|
+
] }, o);
|
|
175
|
+
}) });
|
|
176
|
+
});
|
|
177
|
+
R.displayName = "InputOTPWithSeparator";
|
|
178
|
+
export {
|
|
179
|
+
_ as InputOTPDigitsOnly,
|
|
180
|
+
A as InputOTPSimple,
|
|
181
|
+
R as InputOTPWithSeparator,
|
|
182
|
+
x as InputOTPWithSpacing,
|
|
183
|
+
L as REGEXP_ONLY_CHARS,
|
|
184
|
+
M as REGEXP_ONLY_DIGITS,
|
|
185
|
+
j as REGEXP_ONLY_DIGITS_AND_CHARS
|
|
186
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),q=require("react"),h=require("lucide-react"),A=require("@brightlocal/ui-components/progress"),E=require("@brightlocal/ui-components/lib/utils"),l=require("@brightlocal/ui-components/input-group");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=_(q),p={meter:{label:"Meter",value:0,color:"bg-muted"},weak:{label:"Weak",value:25,color:"bg-red-500"},ok:{label:"Ok",value:50,color:"bg-orange-500"},good:{label:"Good",value:75,color:"bg-green-500"},great:{label:"Great",value:100,color:"bg-green-600"}};function m(e){if(!e||e.length===0)return"meter";let t=0;return e.length>=8&&(t+=1),e.length>=12&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[^a-zA-Z0-9]/.test(e)&&(t+=1),t<=2?"weak":t<=3?"ok":t<=4?"good":"great"}const b=o.forwardRef(({className:e,showStrength:t=!0,onStrengthChange:n,dataHook:s,trackingEl:w,trackingLabel:S,onChange:x,value:i,id:j,...u},v)=>{const[c,P]=o.useState(!1),[I,y]=o.useState("meter"),[N,O]=o.useState(""),k=o.useId(),G=j||k,d=i!==void 0?String(i):N;o.useEffect(()=>{const a=setTimeout(()=>{const f=m(d);y(f),n?.(f)},180);return()=>clearTimeout(a)},[d,n]);const R=a=>{O(a.target.value),x?.(a)},T=()=>{P(a=>!a)},g=p[I];return r.jsxs("div",{className:"w-full",children:[r.jsxs(l.InputGroup,{className:e,children:[r.jsx(l.InputGroupInput,{ref:v,"data-hook":s,"data-tracking-el":w,"data-tracking-label":S,id:G,type:c?"text":"password",value:i,onChange:R,...u}),r.jsx(l.InputGroupAddon,{align:"inline-end",children:r.jsx(l.InputGroupButton,{"aria-label":c?"Hide password":"Show password","data-hook":s?`${s}-toggle`:void 0,disabled:u.disabled,size:"icon",variant:"ghost",onClick:T,children:c?r.jsx(h.EyeOff,{className:"h-4 w-4"}):r.jsx(h.Eye,{className:"h-4 w-4"})})})]}),t&&r.jsx("div",{className:"mt-1 space-y-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(A.Progress,{className:E.cn("h-2 flex-1"),dataHook:s?`${s}-strength-progress`:"password-strength-progress",value:g.value}),r.jsx("span",{className:"text-foreground w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap","data-hook":s?`${s}-strength-label`:void 0,children:g.label})]})})]})});b.displayName="InputPassword";exports.InputPassword=b;exports.PASSWORD_STRENGTH=p;exports.calculatePasswordStrength=m;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type PasswordStrength = "meter" | "weak" | "ok" | "good" | "great";
|
|
3
|
+
interface PasswordStrengthConfig {
|
|
4
|
+
label: string;
|
|
5
|
+
value: number;
|
|
6
|
+
color: string;
|
|
7
|
+
}
|
|
8
|
+
declare const PASSWORD_STRENGTH: Record<PasswordStrength, PasswordStrengthConfig>;
|
|
9
|
+
interface InputPasswordProps extends Omit<React.ComponentProps<"input">, "type"> {
|
|
10
|
+
/**
|
|
11
|
+
* Show password strength indicator below the input
|
|
12
|
+
*/
|
|
13
|
+
showStrength?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Callback when password strength changes
|
|
16
|
+
*/
|
|
17
|
+
onStrengthChange?: (strength: PasswordStrength) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Required data-hook attribute for testing
|
|
20
|
+
*/
|
|
21
|
+
dataHook: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional tracking element identifier
|
|
24
|
+
*/
|
|
25
|
+
trackingEl?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional tracking label
|
|
28
|
+
*/
|
|
29
|
+
trackingLabel?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Calculate password strength based on various criteria
|
|
33
|
+
*/
|
|
34
|
+
declare function calculatePasswordStrength(password: string): PasswordStrength;
|
|
35
|
+
declare const InputPassword: React.ForwardRefExoticComponent<Omit<InputPasswordProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
36
|
+
export { InputPassword, calculatePasswordStrength, PASSWORD_STRENGTH };
|
|
37
|
+
export type { InputPasswordProps, PasswordStrength };
|
|
38
|
+
//# sourceMappingURL=input-password.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-password.d.ts","sourceRoot":"","sources":["../../src/components/input-password.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,KAAK,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnE,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,EAAE,sBAAsB,CAMvE,CAAC;AAEF,UAAU,kBAAmB,SAAQ,IAAI,CACvC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAC7B,MAAM,CACP;IACC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,iBAAS,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAsBrE;AAED,QAAA,MAAM,aAAa,0GAsGlB,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { EyeOff as A, Eye as E } from "lucide-react";
|
|
4
|
+
import { Progress as R } from "@brightlocal/ui-components/progress";
|
|
5
|
+
import { cn as T } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { InputGroup as V, InputGroupInput as z, InputGroupAddon as C, InputGroupButton as O } from "@brightlocal/ui-components/input-group";
|
|
7
|
+
const $ = {
|
|
8
|
+
meter: { label: "Meter", value: 0, color: "bg-muted" },
|
|
9
|
+
weak: { label: "Weak", value: 25, color: "bg-red-500" },
|
|
10
|
+
ok: { label: "Ok", value: 50, color: "bg-orange-500" },
|
|
11
|
+
good: { label: "Good", value: 75, color: "bg-green-500" },
|
|
12
|
+
great: { label: "Great", value: 100, color: "bg-green-600" }
|
|
13
|
+
};
|
|
14
|
+
function j(t) {
|
|
15
|
+
if (!t || t.length === 0)
|
|
16
|
+
return "meter";
|
|
17
|
+
let e = 0;
|
|
18
|
+
return t.length >= 8 && (e += 1), t.length >= 12 && (e += 1), /[a-z]/.test(t) && (e += 1), /[A-Z]/.test(t) && (e += 1), /[0-9]/.test(t) && (e += 1), /[^a-zA-Z0-9]/.test(t) && (e += 1), e <= 2 ? "weak" : e <= 3 ? "ok" : e <= 4 ? "good" : "great";
|
|
19
|
+
}
|
|
20
|
+
const W = s.forwardRef(
|
|
21
|
+
({
|
|
22
|
+
className: t,
|
|
23
|
+
showStrength: e = !0,
|
|
24
|
+
onStrengthChange: c,
|
|
25
|
+
dataHook: n,
|
|
26
|
+
trackingEl: m,
|
|
27
|
+
trackingLabel: f,
|
|
28
|
+
onChange: p,
|
|
29
|
+
value: o,
|
|
30
|
+
id: b,
|
|
31
|
+
...u
|
|
32
|
+
}, w) => {
|
|
33
|
+
const [l, v] = s.useState(!1), [I, S] = s.useState("meter"), [x, N] = s.useState(""), k = s.useId(), P = b || k, g = o !== void 0 ? String(o) : x;
|
|
34
|
+
s.useEffect(() => {
|
|
35
|
+
const a = setTimeout(() => {
|
|
36
|
+
const h = j(g);
|
|
37
|
+
S(h), c?.(h);
|
|
38
|
+
}, 180);
|
|
39
|
+
return () => clearTimeout(a);
|
|
40
|
+
}, [g, c]);
|
|
41
|
+
const G = (a) => {
|
|
42
|
+
N(a.target.value), p?.(a);
|
|
43
|
+
}, y = () => {
|
|
44
|
+
v((a) => !a);
|
|
45
|
+
}, d = $[I];
|
|
46
|
+
return /* @__PURE__ */ i("div", { className: "w-full", children: [
|
|
47
|
+
/* @__PURE__ */ i(V, { className: t, children: [
|
|
48
|
+
/* @__PURE__ */ r(
|
|
49
|
+
z,
|
|
50
|
+
{
|
|
51
|
+
ref: w,
|
|
52
|
+
"data-hook": n,
|
|
53
|
+
"data-tracking-el": m,
|
|
54
|
+
"data-tracking-label": f,
|
|
55
|
+
id: P,
|
|
56
|
+
type: l ? "text" : "password",
|
|
57
|
+
value: o,
|
|
58
|
+
onChange: G,
|
|
59
|
+
...u
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ r(C, { align: "inline-end", children: /* @__PURE__ */ r(
|
|
63
|
+
O,
|
|
64
|
+
{
|
|
65
|
+
"aria-label": l ? "Hide password" : "Show password",
|
|
66
|
+
"data-hook": n ? `${n}-toggle` : void 0,
|
|
67
|
+
disabled: u.disabled,
|
|
68
|
+
size: "icon",
|
|
69
|
+
variant: "ghost",
|
|
70
|
+
onClick: y,
|
|
71
|
+
children: l ? /* @__PURE__ */ r(A, { className: "h-4 w-4" }) : /* @__PURE__ */ r(E, { className: "h-4 w-4" })
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
] }),
|
|
75
|
+
e && /* @__PURE__ */ r("div", { className: "mt-1 space-y-2", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
76
|
+
/* @__PURE__ */ r(
|
|
77
|
+
R,
|
|
78
|
+
{
|
|
79
|
+
className: T("h-2 flex-1"),
|
|
80
|
+
dataHook: n ? `${n}-strength-progress` : "password-strength-progress",
|
|
81
|
+
value: d.value
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ r(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
className: "text-foreground w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap",
|
|
88
|
+
"data-hook": n ? `${n}-strength-label` : void 0,
|
|
89
|
+
children: d.label
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] }) })
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
W.displayName = "InputPassword";
|
|
97
|
+
export {
|
|
98
|
+
W as InputPassword,
|
|
99
|
+
$ as PASSWORD_STRENGTH,
|
|
100
|
+
j as calculatePasswordStrength
|
|
101
|
+
};
|
package/dist/input.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("react"),p=require("class-variance-authority"),o=require("@brightlocal/ui-components/lib/utils"),z=require("@brightlocal/ui-components/label"),V=require("@brightlocal/ui-components/input-base");function _(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,c.get?c:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const b=_(T);var j=(t=>(t.VERTICAL="vertical",t.HORIZONTAL="horizontal",t))(j||{});const $=p.cva(["text-sm mt-2 text-left"],{variants:{state:{normal:"text-muted-foreground"}},defaultVariants:{state:"normal"}}),g=p.cva(["block text-sm font-normal leading-none text-muted-foreground font-sans mb-2","text-foreground hover:text-green-900","underline transition-colors cursor-pointer"]),N=b.forwardRef(({className:t,type:a,label:n,description:c,link:i,icon:d,secondaryIcon:u,optional:I,layout:m="vertical",dataHook:r,trackingEl:k,trackingLabel:y,id:O,...s},E)=>{const S=b.useId(),f=O||S,q=`${f}-description`,w=s["aria-invalid"]===!0||s["aria-invalid"]==="true",h=e.jsxs("div",{className:"relative flex items-center",children:[d&&e.jsx("div",{className:o.cn("text-muted-foreground pointer-events-none absolute left-3 flex items-center",s.disabled&&"opacity-50"),children:d}),e.jsx(V.BaseInputElement,{ref:E,"aria-label":n?void 0:s["aria-label"],className:o.cn(w&&"border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",a==="time"&&"appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none",t),"data-hook":r,"data-tracking-el":k,"data-tracking-label":y,hasIcon:!!d,hasSecondaryIcon:!!u,id:f,type:a,...s}),u&&e.jsx("div",{className:o.cn("text-muted-foreground pointer-events-none absolute right-3 flex items-center",s.disabled&&"opacity-50"),children:u})]}),v=n&&e.jsx(z.Label,{className:o.cn(m==="vertical"&&"mb-2"),"data-hook":r?`${r}-label`:void 0,htmlFor:f,optional:I,children:n}),x=c&&e.jsx("div",{className:o.cn($({state:"normal"}),m==="horizontal"&&"mt-2"),"data-hook":r?`${r}-description`:void 0,id:q,children:c}),l=i?.text?.trim(),R=l&&e.jsx("div",{children:i?.href?e.jsx("a",{className:g(),"data-hook":r?`${r}-link`:void 0,href:i.href,target:i.target,...i.target==="_blank"&&{rel:"noopener noreferrer"},children:l}):l?e.jsx("button",{"aria-label":l,className:g(),"data-hook":r?`${r}-link`:void 0,type:"button",onClick:i?.onClick,children:l}):null});return m==="horizontal"?e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-9 flex-shrink-0 items-center",children:v}),e.jsxs("div",{className:"flex-1",children:[h,x]})]}):e.jsxs("div",{children:[i?e.jsxs("div",{className:"flex items-end justify-between",children:[v,R]}):v,h,x]})});N.displayName="Input";exports.Input=N;exports.InputLayout=j;
|