dash-ui-kit 2.0.0-dev → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/components/badge/index.cjs.js +8 -3
- package/dist/react/components/badge/index.cjs.js.map +1 -1
- package/dist/react/components/badge/index.d.ts +10 -1
- package/dist/react/components/badge/index.esm.js +8 -3
- package/dist/react/components/badge/index.esm.js.map +1 -1
- package/dist/react/components/button/index.cjs.js +7 -2
- package/dist/react/components/button/index.cjs.js.map +1 -1
- package/dist/react/components/button/index.d.ts +4 -0
- package/dist/react/components/button/index.esm.js +7 -2
- package/dist/react/components/button/index.esm.js.map +1 -1
- package/dist/react/components/copyButton/index.cjs.js +7 -7
- package/dist/react/components/copyButton/index.cjs.js.map +1 -1
- package/dist/react/components/copyButton/index.esm.js +6 -6
- package/dist/react/components/copyButton/index.esm.js.map +1 -1
- package/dist/react/components/heading/index.cjs.js +7 -2
- package/dist/react/components/heading/index.cjs.js.map +1 -1
- package/dist/react/components/heading/index.d.ts +4 -1
- package/dist/react/components/heading/index.esm.js +7 -2
- package/dist/react/components/heading/index.esm.js.map +1 -1
- package/dist/react/components/index.cjs.js +47 -43
- package/dist/react/components/index.cjs.js.map +1 -1
- package/dist/react/components/index.d.ts +2 -0
- package/dist/react/components/index.esm.js +2 -0
- package/dist/react/components/index.esm.js.map +1 -1
- package/dist/react/components/input/index.cjs.js +7 -2
- package/dist/react/components/input/index.cjs.js.map +1 -1
- package/dist/react/components/input/index.d.ts +4 -0
- package/dist/react/components/input/index.esm.js +7 -2
- package/dist/react/components/input/index.esm.js.map +1 -1
- package/dist/react/components/overlayMenu/index.cjs.js +69 -25
- package/dist/react/components/overlayMenu/index.cjs.js.map +1 -1
- package/dist/react/components/overlayMenu/index.d.ts +9 -10
- package/dist/react/components/overlayMenu/index.esm.js +69 -25
- package/dist/react/components/overlayMenu/index.esm.js.map +1 -1
- package/dist/react/components/overlaySelect/index.cjs.js +7 -2
- package/dist/react/components/overlaySelect/index.cjs.js.map +1 -1
- package/dist/react/components/overlaySelect/index.d.ts +4 -0
- package/dist/react/components/overlaySelect/index.esm.js +7 -2
- package/dist/react/components/overlaySelect/index.esm.js.map +1 -1
- package/dist/react/components/popover/index.cjs.js +116 -0
- package/dist/react/components/popover/index.cjs.js.map +1 -0
- package/dist/react/components/popover/index.d.ts +23 -0
- package/dist/react/components/popover/index.esm.js +92 -0
- package/dist/react/components/popover/index.esm.js.map +1 -0
- package/dist/react/components/progressStepBar/index.cjs.js +7 -2
- package/dist/react/components/progressStepBar/index.cjs.js.map +1 -1
- package/dist/react/components/progressStepBar/index.d.ts +5 -2
- package/dist/react/components/progressStepBar/index.esm.js +7 -2
- package/dist/react/components/progressStepBar/index.esm.js.map +1 -1
- package/dist/react/components/select/index.cjs.js +7 -2
- package/dist/react/components/select/index.cjs.js.map +1 -1
- package/dist/react/components/select/index.d.ts +4 -0
- package/dist/react/components/select/index.esm.js +7 -2
- package/dist/react/components/select/index.esm.js.map +1 -1
- package/dist/react/components/text/index.cjs.js +8 -2
- package/dist/react/components/text/index.cjs.js.map +1 -1
- package/dist/react/components/text/index.d.ts +5 -0
- package/dist/react/components/text/index.esm.js +8 -2
- package/dist/react/components/text/index.esm.js.map +1 -1
- package/dist/react/components/textarea/index.cjs.js +9 -5
- package/dist/react/components/textarea/index.cjs.js.map +1 -1
- package/dist/react/components/textarea/index.d.ts +4 -0
- package/dist/react/components/textarea/index.esm.js +9 -5
- package/dist/react/components/textarea/index.esm.js.map +1 -1
- package/dist/react/components/tooltip/index.cjs.js +98 -0
- package/dist/react/components/tooltip/index.cjs.js.map +1 -0
- package/dist/react/components/tooltip/index.d.ts +21 -0
- package/dist/react/components/tooltip/index.esm.js +74 -0
- package/dist/react/components/tooltip/index.esm.js.map +1 -0
- package/dist/react/components/valueCard/index.cjs.js +7 -2
- package/dist/react/components/valueCard/index.cjs.js.map +1 -1
- package/dist/react/components/valueCard/index.d.ts +4 -0
- package/dist/react/components/valueCard/index.esm.js +7 -2
- package/dist/react/components/valueCard/index.esm.js.map +1 -1
- package/dist/react/hooks/index.d.ts +1 -0
- package/dist/react/hooks/useColorScheme.cjs.js +25 -0
- package/dist/react/hooks/useColorScheme.cjs.js.map +1 -0
- package/dist/react/hooks/useColorScheme.d.ts +9 -0
- package/dist/react/hooks/useColorScheme.esm.js +23 -0
- package/dist/react/hooks/useColorScheme.esm.js.map +1 -0
- package/dist/react/index.cjs.js +47 -43
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.esm.js +2 -0
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react-native/components/badge/index.d.ts +12 -0
- package/dist/react-native/components/button/index.d.ts +6 -0
- package/dist/react-native/components/input/index.d.ts +6 -0
- package/dist/react-native/components/valueCard/index.d.ts +4 -0
- package/dist/react-native/index.cjs.js +39 -13
- package/dist/react-native/index.cjs.js.map +1 -1
- package/dist/react-native/index.esm.js +39 -14
- package/dist/react-native/index.esm.js.map +1 -1
- package/dist/react-native/utils/index.d.ts +1 -0
- package/dist/react-native/utils/resolveColorScheme.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -1
|
@@ -8,7 +8,7 @@ var tslib = require('tslib');
|
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var React = require('react');
|
|
10
10
|
var classVarianceAuthority = require('class-variance-authority');
|
|
11
|
-
var
|
|
11
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
12
12
|
var index = require('../icons/index.cjs.js');
|
|
13
13
|
var ThemeContext = require('../../contexts/ThemeContext.cjs.js');
|
|
14
14
|
var copyToClipboard = require('../../utils/copyToClipboard.cjs.js');
|
|
@@ -30,7 +30,7 @@ function _interopNamespaceDefault(e) {
|
|
|
30
30
|
return Object.freeze(n);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(PopoverPrimitive);
|
|
34
34
|
|
|
35
35
|
const copyBtn = classVarianceAuthority.cva('p-0 flex-shrink-0 h-[max-content] min-w-0 bg-transparent transition-colors', {
|
|
36
36
|
variants: {
|
|
@@ -61,9 +61,9 @@ const CopyButton = _a => {
|
|
|
61
61
|
setOpen(true);
|
|
62
62
|
setTimeout(() => setOpen(false), 1000);
|
|
63
63
|
};
|
|
64
|
-
return jsxRuntime.jsxs(
|
|
64
|
+
return jsxRuntime.jsxs(PopoverPrimitive__namespace.Root, {
|
|
65
65
|
open: open,
|
|
66
|
-
children: [jsxRuntime.jsx(
|
|
66
|
+
children: [jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, {
|
|
67
67
|
asChild: true,
|
|
68
68
|
children: jsxRuntime.jsx("button", Object.assign({
|
|
69
69
|
type: 'button',
|
|
@@ -77,12 +77,12 @@ const CopyButton = _a => {
|
|
|
77
77
|
color: theme === 'light' ? '#000000' : '#ffffff'
|
|
78
78
|
})
|
|
79
79
|
}))
|
|
80
|
-
}), jsxRuntime.jsx(
|
|
81
|
-
children: jsxRuntime.jsxs(
|
|
80
|
+
}), jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, {
|
|
81
|
+
children: jsxRuntime.jsxs(PopoverPrimitive__namespace.Content, {
|
|
82
82
|
className: 'bg-white text-gray-900 text-sm px-2 py-1 rounded shadow-lg',
|
|
83
83
|
side: 'top',
|
|
84
84
|
sideOffset: 5,
|
|
85
|
-
children: ["Copied", jsxRuntime.jsx(
|
|
85
|
+
children: ["Copied", jsxRuntime.jsx(PopoverPrimitive__namespace.Arrow, {
|
|
86
86
|
className: 'fill-white'
|
|
87
87
|
})]
|
|
88
88
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../../src/react/components/copyButton/index.tsx"],"sourcesContent":["import React, { useState } from 'react'\nimport { cva } from 'class-variance-authority'\nimport * as Popover from '@radix-ui/react-popover'\nimport { CopyIcon } from '../icons'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport copyToClipboard, { CopyResult } from '../../utils/copyToClipboard'\n\nconst copyBtn = cva(\n 'p-0 flex-shrink-0 h-[max-content] min-w-0 bg-transparent transition-colors',\n {\n variants: {\n theme: {\n light: 'hover:text-gray-600 active:text-gray-800',\n dark: 'hover:text-gray-300 active:text-gray-100'\n }\n },\n defaultVariants: {\n theme: 'light'\n }\n }\n)\n\nexport interface CopyButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onCopy'> {\n /** Text to copy into clipboard */\n text: string\n /** Optional callback that will be called with the copy result */\n onCopy?: (result: CopyResult) => void\n}\n\nexport const CopyButton: React.FC<CopyButtonProps> = ({ text, className, onCopy, ...props }) => {\n const { theme } = useTheme()\n const [open, setOpen] = useState(false)\n\n const handleCopy = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation()\n e.preventDefault()\n copyToClipboard(text, onCopy)\n setOpen(true)\n setTimeout(() => setOpen(false), 1000)\n }\n\n return (\n <Popover.Root open={open}>\n <Popover.Trigger asChild>\n <button\n type='button'\n className={`${copyBtn({ theme })} ${className ?? ''} hover:cursor-pointer`}\n onClick={handleCopy}\n {...props}\n >\n <CopyIcon\n className='w-4 h-4 transition'\n color={theme === 'light' ? '#000000' : '#ffffff'}\n />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n className='bg-white text-gray-900 text-sm px-2 py-1 rounded shadow-lg'\n side='top'\n sideOffset={5}\n >\n Copied\n <Popover.Arrow className='fill-white' />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport default CopyButton\n"],"names":["copyBtn","cva","variants","theme","light","dark","defaultVariants","CopyButton","_a","text","className","onCopy","props","__rest","useTheme","open","setOpen","useState","handleCopy","e","stopPropagation","preventDefault","copyToClipboard","setTimeout","_jsxs","Popover","Root","children","_jsx","Trigger","asChild","Object","assign","type","onClick","CopyIcon","color","Portal","Content","side","sideOffset","Arrow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,OAAO,GAAGC,0BAAG,CACjB,4EAA4E,EAC5E;AACEC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,0CAA0C;AACjDC,MAAAA,IAAI,EAAE;AACP;GACF;AACDC,EAAAA,eAAe,EAAE;AACfH,IAAAA,KAAK,EAAE;AACR;AACF,CAAA,CACF;AASYI,MAAAA,UAAU,GAA+BC,EAAqC,IAAI;MAAzC;MAAEC,IAAI;MAAEC,SAAS;AAAEC,MAAAA;UAAkB;AAAPC,IAAAA,KAAK,GAAnCC,YAAA,CAAAL,EAAA,EAAA,CAAA,MAAA,EAAA,WAAA,EAAA,QAAA,CAAqC,CAAF;EACvF,MAAM;AAAEL,IAAAA;GAAO,GAAGW,qBAAQ,EAAE;EAC5B,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;EAEvC,MAAMC,UAAU,GAAIC,CAAsC,IAAI;IAC5DA,CAAC,CAACC,eAAe,EAAE;IACnBD,CAAC,CAACE,cAAc,EAAE;AAClBC,IAAAA,+BAAe,CAACb,IAAI,EAAEE,MAAM,CAAC;IAC7BK,OAAO,CAAC,IAAI,CAAC;IACbO,UAAU,CAAC,MAAMP,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;GACvC;AAED,EAAA,OACEQ,gBAACC,
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../src/react/components/copyButton/index.tsx"],"sourcesContent":["import React, { useState } from 'react'\nimport { cva } from 'class-variance-authority'\nimport * as Popover from '@radix-ui/react-popover'\nimport { CopyIcon } from '../icons'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport copyToClipboard, { CopyResult } from '../../utils/copyToClipboard'\n\nconst copyBtn = cva(\n 'p-0 flex-shrink-0 h-[max-content] min-w-0 bg-transparent transition-colors',\n {\n variants: {\n theme: {\n light: 'hover:text-gray-600 active:text-gray-800',\n dark: 'hover:text-gray-300 active:text-gray-100'\n }\n },\n defaultVariants: {\n theme: 'light'\n }\n }\n)\n\nexport interface CopyButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onCopy'> {\n /** Text to copy into clipboard */\n text: string\n /** Optional callback that will be called with the copy result */\n onCopy?: (result: CopyResult) => void\n}\n\nexport const CopyButton: React.FC<CopyButtonProps> = ({ text, className, onCopy, ...props }) => {\n const { theme } = useTheme()\n const [open, setOpen] = useState(false)\n\n const handleCopy = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation()\n e.preventDefault()\n copyToClipboard(text, onCopy)\n setOpen(true)\n setTimeout(() => setOpen(false), 1000)\n }\n\n return (\n <Popover.Root open={open}>\n <Popover.Trigger asChild>\n <button\n type='button'\n className={`${copyBtn({ theme })} ${className ?? ''} hover:cursor-pointer`}\n onClick={handleCopy}\n {...props}\n >\n <CopyIcon\n className='w-4 h-4 transition'\n color={theme === 'light' ? '#000000' : '#ffffff'}\n />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n className='bg-white text-gray-900 text-sm px-2 py-1 rounded shadow-lg'\n side='top'\n sideOffset={5}\n >\n Copied\n <Popover.Arrow className='fill-white' />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport default CopyButton\n"],"names":["copyBtn","cva","variants","theme","light","dark","defaultVariants","CopyButton","_a","text","className","onCopy","props","__rest","useTheme","open","setOpen","useState","handleCopy","e","stopPropagation","preventDefault","copyToClipboard","setTimeout","_jsxs","Popover","Root","children","_jsx","Trigger","asChild","Object","assign","type","onClick","CopyIcon","color","Portal","Content","side","sideOffset","Arrow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,OAAO,GAAGC,0BAAG,CACjB,4EAA4E,EAC5E;AACEC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,KAAK,EAAE;AACLC,MAA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B;OACL,EAAAN,KAAK;kBAETgB,cAAC,CAAAO,cAAQ,EACP;AAAAzB,UAAAA,SAAS,EAAC,oBAAoB;AAC9B0B,UAAAA,KAAK,EAAEjC,KAAK,KAAK,OAAO,GAAG,SAAS,GAAG;SACvC;AAAA,OAAA,CAAA;AAEY,KAAA,CAAA,EAClByB,cAAC,CAAAH,2BAAO,CAACY,MAAM,EAAA;AAAAV,MAAAA,QAAA,EACbH,eAAC,CAAAC,2BAAO,CAACa,OAAO;AACd5B,QAAAA,SAAS,EAAC,4DAA4D;AACtE6B,QAAAA,IAAI,EAAC,KAAK;AACVC,QAAAA,UAAU,EAAE,CAAC;QAGbb,QAAA,EAAA,CAAA,QAAA,EAAAC,cAAA,CAACH,2BAAO,CAACgB,KAAK,EAAC;AAAA/B,UAAAA,SAAS,EAAC;UAAe;OACxB;AAAA,KAAA,CACH;AACJ,GAAA,CAAA;AAEnB;;;;;"}
|
|
@@ -4,7 +4,7 @@ import { __rest } from 'tslib';
|
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
|
-
import * as
|
|
7
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
8
8
|
import { CopyIcon } from '../icons/index.esm.js';
|
|
9
9
|
import { useTheme } from '../../contexts/ThemeContext.esm.js';
|
|
10
10
|
import { copyToClipboard } from '../../utils/copyToClipboard.esm.js';
|
|
@@ -38,9 +38,9 @@ const CopyButton = _a => {
|
|
|
38
38
|
setOpen(true);
|
|
39
39
|
setTimeout(() => setOpen(false), 1000);
|
|
40
40
|
};
|
|
41
|
-
return jsxs(
|
|
41
|
+
return jsxs(PopoverPrimitive.Root, {
|
|
42
42
|
open: open,
|
|
43
|
-
children: [jsx(
|
|
43
|
+
children: [jsx(PopoverPrimitive.Trigger, {
|
|
44
44
|
asChild: true,
|
|
45
45
|
children: jsx("button", Object.assign({
|
|
46
46
|
type: 'button',
|
|
@@ -54,12 +54,12 @@ const CopyButton = _a => {
|
|
|
54
54
|
color: theme === 'light' ? '#000000' : '#ffffff'
|
|
55
55
|
})
|
|
56
56
|
}))
|
|
57
|
-
}), jsx(
|
|
58
|
-
children: jsxs(
|
|
57
|
+
}), jsx(PopoverPrimitive.Portal, {
|
|
58
|
+
children: jsxs(PopoverPrimitive.Content, {
|
|
59
59
|
className: 'bg-white text-gray-900 text-sm px-2 py-1 rounded shadow-lg',
|
|
60
60
|
side: 'top',
|
|
61
61
|
sideOffset: 5,
|
|
62
|
-
children: ["Copied", jsx(
|
|
62
|
+
children: ["Copied", jsx(PopoverPrimitive.Arrow, {
|
|
63
63
|
className: 'fill-white'
|
|
64
64
|
})]
|
|
65
65
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../src/react/components/copyButton/index.tsx"],"sourcesContent":["import React, { useState } from 'react'\nimport { cva } from 'class-variance-authority'\nimport * as Popover from '@radix-ui/react-popover'\nimport { CopyIcon } from '../icons'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport copyToClipboard, { CopyResult } from '../../utils/copyToClipboard'\n\nconst copyBtn = cva(\n 'p-0 flex-shrink-0 h-[max-content] min-w-0 bg-transparent transition-colors',\n {\n variants: {\n theme: {\n light: 'hover:text-gray-600 active:text-gray-800',\n dark: 'hover:text-gray-300 active:text-gray-100'\n }\n },\n defaultVariants: {\n theme: 'light'\n }\n }\n)\n\nexport interface CopyButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onCopy'> {\n /** Text to copy into clipboard */\n text: string\n /** Optional callback that will be called with the copy result */\n onCopy?: (result: CopyResult) => void\n}\n\nexport const CopyButton: React.FC<CopyButtonProps> = ({ text, className, onCopy, ...props }) => {\n const { theme } = useTheme()\n const [open, setOpen] = useState(false)\n\n const handleCopy = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation()\n e.preventDefault()\n copyToClipboard(text, onCopy)\n setOpen(true)\n setTimeout(() => setOpen(false), 1000)\n }\n\n return (\n <Popover.Root open={open}>\n <Popover.Trigger asChild>\n <button\n type='button'\n className={`${copyBtn({ theme })} ${className ?? ''} hover:cursor-pointer`}\n onClick={handleCopy}\n {...props}\n >\n <CopyIcon\n className='w-4 h-4 transition'\n color={theme === 'light' ? '#000000' : '#ffffff'}\n />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n className='bg-white text-gray-900 text-sm px-2 py-1 rounded shadow-lg'\n side='top'\n sideOffset={5}\n >\n Copied\n <Popover.Arrow className='fill-white' />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport default CopyButton\n"],"names":["copyBtn","cva","variants","theme","light","dark","defaultVariants","CopyButton","_a","text","className","onCopy","props","__rest","useTheme","open","setOpen","useState","handleCopy","e","stopPropagation","preventDefault","copyToClipboard","setTimeout","_jsxs","Popover","Root","children","_jsx","Trigger","asChild","Object","assign","type","onClick","CopyIcon","color","Portal","Content","side","sideOffset","Arrow"],"mappings":";;;;;;;;;;;AAOA,MAAMA,OAAO,GAAGC,GAAG,CACjB,4EAA4E,EAC5E;AACEC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,0CAA0C;AACjDC,MAAAA,IAAI,EAAE;AACP;GACF;AACDC,EAAAA,eAAe,EAAE;AACfH,IAAAA,KAAK,EAAE;AACR;AACF,CAAA,CACF;AASYI,MAAAA,UAAU,GAA+BC,EAAqC,IAAI;MAAzC;MAAEC,IAAI;MAAEC,SAAS;AAAEC,MAAAA;UAAkB;AAAPC,IAAAA,KAAK,GAAnCC,MAAA,CAAAL,EAAA,EAAA,CAAA,MAAA,EAAA,WAAA,EAAA,QAAA,CAAqC,CAAF;EACvF,MAAM;AAAEL,IAAAA;GAAO,GAAGW,QAAQ,EAAE;EAC5B,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC;EAEvC,MAAMC,UAAU,GAAIC,CAAsC,IAAI;IAC5DA,CAAC,CAACC,eAAe,EAAE;IACnBD,CAAC,CAACE,cAAc,EAAE;AAClBC,IAAAA,eAAe,CAACb,IAAI,EAAEE,MAAM,CAAC;IAC7BK,OAAO,CAAC,IAAI,CAAC;IACbO,UAAU,CAAC,MAAMP,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;GACvC;AAED,EAAA,OACEQ,KAACC,
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../src/react/components/copyButton/index.tsx"],"sourcesContent":["import React, { useState } from 'react'\nimport { cva } from 'class-variance-authority'\nimport * as Popover from '@radix-ui/react-popover'\nimport { CopyIcon } from '../icons'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport copyToClipboard, { CopyResult } from '../../utils/copyToClipboard'\n\nconst copyBtn = cva(\n 'p-0 flex-shrink-0 h-[max-content] min-w-0 bg-transparent transition-colors',\n {\n variants: {\n theme: {\n light: 'hover:text-gray-600 active:text-gray-800',\n dark: 'hover:text-gray-300 active:text-gray-100'\n }\n },\n defaultVariants: {\n theme: 'light'\n }\n }\n)\n\nexport interface CopyButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onCopy'> {\n /** Text to copy into clipboard */\n text: string\n /** Optional callback that will be called with the copy result */\n onCopy?: (result: CopyResult) => void\n}\n\nexport const CopyButton: React.FC<CopyButtonProps> = ({ text, className, onCopy, ...props }) => {\n const { theme } = useTheme()\n const [open, setOpen] = useState(false)\n\n const handleCopy = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation()\n e.preventDefault()\n copyToClipboard(text, onCopy)\n setOpen(true)\n setTimeout(() => setOpen(false), 1000)\n }\n\n return (\n <Popover.Root open={open}>\n <Popover.Trigger asChild>\n <button\n type='button'\n className={`${copyBtn({ theme })} ${className ?? ''} hover:cursor-pointer`}\n onClick={handleCopy}\n {...props}\n >\n <CopyIcon\n className='w-4 h-4 transition'\n color={theme === 'light' ? '#000000' : '#ffffff'}\n />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n className='bg-white text-gray-900 text-sm px-2 py-1 rounded shadow-lg'\n side='top'\n sideOffset={5}\n >\n Copied\n <Popover.Arrow className='fill-white' />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport default CopyButton\n"],"names":["copyBtn","cva","variants","theme","light","dark","defaultVariants","CopyButton","_a","text","className","onCopy","props","__rest","useTheme","open","setOpen","useState","handleCopy","e","stopPropagation","preventDefault","copyToClipboard","setTimeout","_jsxs","Popover","Root","children","_jsx","Trigger","asChild","Object","assign","type","onClick","CopyIcon","color","Portal","Content","side","sideOffset","Arrow"],"mappings":";;;;;;;;;;;AAOA,MAAMA,OAAO,GAAGC,GAAG,CACjB,4EAA4E,EAC5E;AACEC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,0CAA0C;AACjDC,MAAAA,IAAI,EAAE;AACP;GACF;AACDC,EAAAA,eAAe,EAAE;AACfH,IAAAA,KAAK,EAAE;AACR;AACF,CAAA,CACF;AASYI,MAAAA,UAAU,GAA+BC,EAAqC,IAAI;MAAzC;MAAEC,IAAI;MAAEC,SAAS;AAAEC,MAAAA;UAAkB;AAAPC,IAAAA,KAAK,GAAnCC,MAAA,CAAAL,EAAA,EAAA,CAAA,MAAA,EAAA,WAAA,EAAA,QAAA,CAAqC,CAAF;EACvF,MAAM;AAAEL,IAAAA;GAAO,GAAGW,QAAQ,EAAE;EAC5B,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC;EAEvC,MAAMC,UAAU,GAAIC,CAAsC,IAAI;IAC5DA,CAAC,CAACC,eAAe,EAAE;IACnBD,CAAC,CAACE,cAAc,EAAE;AAClBC,IAAAA,eAAe,CAACb,IAAI,EAAEE,MAAM,CAAC;IAC7BK,OAAO,CAAC,IAAI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
|
|
6
6
|
var ThemeContext = require('../../contexts/ThemeContext.cjs.js');
|
|
7
|
+
var useColorScheme = require('../../hooks/useColorScheme.cjs.js');
|
|
7
8
|
|
|
8
9
|
const sizeClasses = {
|
|
9
10
|
xs: 'text-xs',
|
|
@@ -41,15 +42,19 @@ const Heading = ({
|
|
|
41
42
|
as = 'h1',
|
|
42
43
|
size = '2xl',
|
|
43
44
|
weight = 'extrabold',
|
|
44
|
-
color
|
|
45
|
+
color,
|
|
46
|
+
colorLight,
|
|
47
|
+
colorDark,
|
|
45
48
|
className = '',
|
|
46
49
|
children
|
|
47
50
|
}) => {
|
|
51
|
+
var _a;
|
|
48
52
|
const {
|
|
49
53
|
theme
|
|
50
54
|
} = ThemeContext.useTheme();
|
|
55
|
+
const effectiveColor = (_a = useColorScheme.useColorScheme(color, colorLight, colorDark)) !== null && _a !== void 0 ? _a : 'black';
|
|
51
56
|
const Component = as;
|
|
52
|
-
const classes = [sizeClasses[size], weightClasses[weight], colorClasses[theme][
|
|
57
|
+
const classes = [sizeClasses[size], weightClasses[weight], colorClasses[theme][effectiveColor], 'tracking-[-0.4px]', className].filter(Boolean).join(' ');
|
|
53
58
|
return jsxRuntime.jsx(Component, {
|
|
54
59
|
className: classes,
|
|
55
60
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../../src/react/components/heading/index.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '../../contexts/ThemeContext'\n\ninterface HeadingProps {\n as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'\n weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold'\n color?:
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../src/react/components/heading/index.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport { useColorScheme } from '../../hooks/useColorScheme'\n\ntype HeadingColor = 'black' | 'gray' | 'blue' | 'red' | 'green'\n\ninterface HeadingProps {\n as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'\n weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold'\n color?: HeadingColor\n colorLight?: HeadingColor\n colorDark?: HeadingColor\n className?: string\n children: React.ReactNode\n}\n\nconst sizeClasses = {\n xs: 'text-xs',\n sm: 'text-sm', \n md: 'text-base',\n lg: 'text-lg',\n xl: 'text-xl',\n '2xl': 'text-[2.375rem] leading-[1.3]',\n '3xl': 'text-[3rem] leading-[1.2]'\n}\n\nconst weightClasses = {\n normal: 'font-normal',\n medium: 'font-medium', \n semibold: 'font-semibold',\n bold: 'font-bold',\n extrabold: 'font-extrabold'\n}\n\nconst colorClasses = {\n light: {\n black: 'text-black',\n gray: 'text-gray-600',\n blue: 'text-blue-600', \n red: 'text-red-600',\n green: 'text-green-600'\n },\n dark: {\n black: 'text-white',\n gray: 'text-gray-300',\n blue: 'text-blue-400', \n red: 'text-red-400',\n green: 'text-green-400'\n }\n}\n\nexport const Heading: React.FC<HeadingProps> = ({ \n as = 'h1',\n size = '2xl',\n weight = 'extrabold', \n color,\n colorLight,\n colorDark,\n className = '',\n children\n}) => {\n const { theme } = useTheme()\n const effectiveColor = useColorScheme(color, colorLight, colorDark) ?? 'black'\n const Component = as\n \n const classes = [\n sizeClasses[size],\n weightClasses[weight],\n colorClasses[theme][effectiveColor],\n 'tracking-[-0.4px]',\n className\n ].filter(Boolean).join(' ')\n\n return (\n <Component className={classes}>\n {children}\n </Component>\n )\n}\n\nexport type { HeadingProps } "],"names":["sizeClasses","xs","sm","md","lg","xl","weightClasses","normal","medium","semibold","bold","extrabold","colorClasses","light","black","gray","blue","red","green","dark","Heading","as","size","weight","color","colorLight","colorDark","className","children","theme","useTheme","effectiveColor","_a","useColorScheme","Component","classes","filter","Boolean","join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CAAC,MAAA,IAAA,IAAAM,EAAA,KAAA,MAAA,GAAAA,EAAA,GAAI,OAAO;EAC9E,MAAME,SAAS,GAAGb,EAAE;AAEpB,EAAA,MAAMc,OAAO,GAAG,CACdnC,WAAW,CAACsB,IAAI,CAAC,EACjBhB,aAAa,CAACiB,MAAM,CAAC,EACrBX,YAAY,CAACiB,KAAK,CAAC,CAACE,cAAc,CAAC,EACnC,mBAAmB,EACnBJ,SAAS,CACV,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;EAE3B,OACEC,cAAC,CAAAL,SAAS,EAAC;AAAAP,IAAAA,SAAS,EAAEQ,OAAO;AAC1BP,IAAAA,QAAA,EAAAA;AACS,GAAA,CAAA;AAEhB;;;;"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
type HeadingColor = 'black' | 'gray' | 'blue' | 'red' | 'green';
|
|
2
3
|
interface HeadingProps {
|
|
3
4
|
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
4
5
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
5
6
|
weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
|
|
6
|
-
color?:
|
|
7
|
+
color?: HeadingColor;
|
|
8
|
+
colorLight?: HeadingColor;
|
|
9
|
+
colorDark?: HeadingColor;
|
|
7
10
|
className?: string;
|
|
8
11
|
children: React.ReactNode;
|
|
9
12
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useTheme } from '../../contexts/ThemeContext.esm.js';
|
|
5
|
+
import { useColorScheme } from '../../hooks/useColorScheme.esm.js';
|
|
5
6
|
|
|
6
7
|
const sizeClasses = {
|
|
7
8
|
xs: 'text-xs',
|
|
@@ -39,15 +40,19 @@ const Heading = ({
|
|
|
39
40
|
as = 'h1',
|
|
40
41
|
size = '2xl',
|
|
41
42
|
weight = 'extrabold',
|
|
42
|
-
color
|
|
43
|
+
color,
|
|
44
|
+
colorLight,
|
|
45
|
+
colorDark,
|
|
43
46
|
className = '',
|
|
44
47
|
children
|
|
45
48
|
}) => {
|
|
49
|
+
var _a;
|
|
46
50
|
const {
|
|
47
51
|
theme
|
|
48
52
|
} = useTheme();
|
|
53
|
+
const effectiveColor = (_a = useColorScheme(color, colorLight, colorDark)) !== null && _a !== void 0 ? _a : 'black';
|
|
49
54
|
const Component = as;
|
|
50
|
-
const classes = [sizeClasses[size], weightClasses[weight], colorClasses[theme][
|
|
55
|
+
const classes = [sizeClasses[size], weightClasses[weight], colorClasses[theme][effectiveColor], 'tracking-[-0.4px]', className].filter(Boolean).join(' ');
|
|
51
56
|
return jsx(Component, {
|
|
52
57
|
className: classes,
|
|
53
58
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../src/react/components/heading/index.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '../../contexts/ThemeContext'\n\ninterface HeadingProps {\n as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'\n weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold'\n color?:
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../src/react/components/heading/index.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport { useColorScheme } from '../../hooks/useColorScheme'\n\ntype HeadingColor = 'black' | 'gray' | 'blue' | 'red' | 'green'\n\ninterface HeadingProps {\n as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'\n weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold'\n color?: HeadingColor\n colorLight?: HeadingColor\n colorDark?: HeadingColor\n className?: string\n children: React.ReactNode\n}\n\nconst sizeClasses = {\n xs: 'text-xs',\n sm: 'text-sm', \n md: 'text-base',\n lg: 'text-lg',\n xl: 'text-xl',\n '2xl': 'text-[2.375rem] leading-[1.3]',\n '3xl': 'text-[3rem] leading-[1.2]'\n}\n\nconst weightClasses = {\n normal: 'font-normal',\n medium: 'font-medium', \n semibold: 'font-semibold',\n bold: 'font-bold',\n extrabold: 'font-extrabold'\n}\n\nconst colorClasses = {\n light: {\n black: 'text-black',\n gray: 'text-gray-600',\n blue: 'text-blue-600', \n red: 'text-red-600',\n green: 'text-green-600'\n },\n dark: {\n black: 'text-white',\n gray: 'text-gray-300',\n blue: 'text-blue-400', \n red: 'text-red-400',\n green: 'text-green-400'\n }\n}\n\nexport const Heading: React.FC<HeadingProps> = ({ \n as = 'h1',\n size = '2xl',\n weight = 'extrabold', \n color,\n colorLight,\n colorDark,\n className = '',\n children\n}) => {\n const { theme } = useTheme()\n const effectiveColor = useColorScheme(color, colorLight, colorDark) ?? 'black'\n const Component = as\n \n const classes = [\n sizeClasses[size],\n weightClasses[weight],\n colorClasses[theme][effectiveColor],\n 'tracking-[-0.4px]',\n className\n ].filter(Boolean).join(' ')\n\n return (\n <Component className={classes}>\n {children}\n </Component>\n )\n}\n\nexport type { HeadingProps } "],"names":["sizeClasses","xs","sm","md","lg","xl","weightClasses","normal","medium","semibold","bold","extrabold","colorClasses","light","black","gray","blue","red","green","dark","Heading","as","size","weight","color","colorLight","colorDark","className","children","theme","useTheme","effectiveColor","_a","useColorScheme","Component","classes","filter","Boolean","join","_jsx"],"mappings":";;;;;;AAiBA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,EAAE,EAAE,WAAW;AACfC,EAAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,EAAE,EAAE,SAAS;AACb,EAAA,KAAK,EAAE,+BAA+B;AACtC,EAA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ACnC,mBAAmB,EACnBJ,SAAS,CACV,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;EAE3B,OACEC,GAAC,CAAAL,SAAS,EAAC;AAAAP,IAAAA,SAAS,EAAEQ,OAAO;AAC1BP,IAAAA,QAAA,EAAAA;AACS,GAAA,CAAA;AAEhB;;;;"}
|
|
@@ -27,7 +27,9 @@ var index$l = require('./progressStepBar/index.cjs.js');
|
|
|
27
27
|
var index$m = require('./dashLogo/index.cjs.js');
|
|
28
28
|
var index$n = require('./dialog/index.cjs.js');
|
|
29
29
|
var index$o = require('./tabs/index.cjs.js');
|
|
30
|
-
var index$p = require('./
|
|
30
|
+
var index$p = require('./tooltip/index.cjs.js');
|
|
31
|
+
var index$q = require('./popover/index.cjs.js');
|
|
32
|
+
var index$r = require('./icons/index.cjs.js');
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
|
|
@@ -56,46 +58,48 @@ exports.ProgressStepBar = index$l.ProgressStepBar;
|
|
|
56
58
|
exports.DashLogo = index$m.DashLogo;
|
|
57
59
|
exports.Dialog = index$n.DashDialog;
|
|
58
60
|
exports.Tabs = index$o.Tabs;
|
|
59
|
-
exports.
|
|
60
|
-
exports.
|
|
61
|
-
exports.
|
|
62
|
-
exports.
|
|
63
|
-
exports.
|
|
64
|
-
exports.
|
|
65
|
-
exports.
|
|
66
|
-
exports.
|
|
67
|
-
exports.
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
70
|
-
exports.
|
|
71
|
-
exports.
|
|
72
|
-
exports.
|
|
73
|
-
exports.
|
|
74
|
-
exports.
|
|
75
|
-
exports.
|
|
76
|
-
exports.
|
|
77
|
-
exports.
|
|
78
|
-
exports.
|
|
79
|
-
exports.
|
|
80
|
-
exports.
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
84
|
-
exports.
|
|
85
|
-
exports.
|
|
86
|
-
exports.
|
|
87
|
-
exports.
|
|
88
|
-
exports.
|
|
89
|
-
exports.
|
|
90
|
-
exports.
|
|
91
|
-
exports.
|
|
92
|
-
exports.
|
|
93
|
-
exports.
|
|
94
|
-
exports.
|
|
95
|
-
exports.
|
|
96
|
-
exports.
|
|
97
|
-
exports.
|
|
98
|
-
exports.
|
|
99
|
-
exports.
|
|
100
|
-
exports.
|
|
61
|
+
exports.Tooltip = index$p.Tooltip;
|
|
62
|
+
exports.Popover = index$q.Popover;
|
|
63
|
+
exports.AirplaneIcon = index$r.AirplaneIcon;
|
|
64
|
+
exports.ArrowIcon = index$r.ArrowIcon;
|
|
65
|
+
exports.BroadcastedIcon = index$r.BroadcastedIcon;
|
|
66
|
+
exports.BurgerMenuIcon = index$r.BurgerMenuIcon;
|
|
67
|
+
exports.CalendarIcon = index$r.CalendarIcon;
|
|
68
|
+
exports.ChainSmallIcon = index$r.ChainSmallIcon;
|
|
69
|
+
exports.CheckIcon = index$r.CheckIcon;
|
|
70
|
+
exports.CheckmarkIcon = index$r.CheckmarkIcon;
|
|
71
|
+
exports.ChevronIcon = index$r.ChevronIcon;
|
|
72
|
+
exports.CircleProcessIcon = index$r.CircleProcessIcon;
|
|
73
|
+
exports.CopyIcon = index$r.CopyIcon;
|
|
74
|
+
exports.CreditsIcon = index$r.CreditsIcon;
|
|
75
|
+
exports.CrossIcon = index$r.CrossIcon;
|
|
76
|
+
exports.DeleteIcon = index$r.DeleteIcon;
|
|
77
|
+
exports.DocumentIcon = index$r.DocumentIcon;
|
|
78
|
+
exports.EditIcon = index$r.EditIcon;
|
|
79
|
+
exports.ErrorIcon = index$r.ErrorIcon;
|
|
80
|
+
exports.ExternalLinkIcon = index$r.ExternalLinkIcon;
|
|
81
|
+
exports.EyeClosedIcon = index$r.EyeClosedIcon;
|
|
82
|
+
exports.EyeOpenIcon = index$r.EyeOpenIcon;
|
|
83
|
+
exports.FaceIcon = index$r.FaceIcon;
|
|
84
|
+
exports.FilterIcon = index$r.FilterIcon;
|
|
85
|
+
exports.FingerprintIcon = index$r.FingerprintIcon;
|
|
86
|
+
exports.InfoCircleIcon = index$r.InfoCircleIcon;
|
|
87
|
+
exports.KebabMenuIcon = index$r.KebabMenuIcon;
|
|
88
|
+
exports.KeyIcon = index$r.KeyIcon;
|
|
89
|
+
exports.LockIcon = index$r.LockIcon;
|
|
90
|
+
exports.PendingIcon = index$r.PendingIcon;
|
|
91
|
+
exports.PlusIcon = index$r.PlusIcon;
|
|
92
|
+
exports.PooledIcon = index$r.PooledIcon;
|
|
93
|
+
exports.ProtectedMessageIcon = index$r.ProtectedMessageIcon;
|
|
94
|
+
exports.QuestionMessageIcon = index$r.QuestionMessageIcon;
|
|
95
|
+
exports.QueuedIcon = index$r.QueuedIcon;
|
|
96
|
+
exports.SearchIcon = index$r.SearchIcon;
|
|
97
|
+
exports.SettingsIcon = index$r.SettingsIcon;
|
|
98
|
+
exports.ShieldSmallIcon = index$r.ShieldSmallIcon;
|
|
99
|
+
exports.SignIcon = index$r.SignIcon;
|
|
100
|
+
exports.SignLockIcon = index$r.SignLockIcon;
|
|
101
|
+
exports.SmartphoneIcon = index$r.SmartphoneIcon;
|
|
102
|
+
exports.SuccessIcon = index$r.SuccessIcon;
|
|
103
|
+
exports.WalletIcon = index$r.WalletIcon;
|
|
104
|
+
exports.WebIcon = index$r.WebIcon;
|
|
101
105
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -23,5 +23,7 @@ export { ProgressStepBar, type ProgressStepBarProps } from './progressStepBar';
|
|
|
23
23
|
export { DashLogo, type DashLogoProps } from './dashLogo';
|
|
24
24
|
export { Dialog, type DialogProps } from './dialog';
|
|
25
25
|
export { Tabs, type TabsProps, type TabItem } from './tabs';
|
|
26
|
+
export { Tooltip, type TooltipProps } from './tooltip';
|
|
27
|
+
export { Popover, type PopoverProps } from './popover';
|
|
26
28
|
export type { TimeDeltaFormat } from '../../shared/utils/datetime';
|
|
27
29
|
export { ArrowIcon, CopyIcon, SuccessIcon, ErrorIcon, QueuedIcon, PooledIcon, BroadcastedIcon, CalendarIcon, EyeOpenIcon, EyeClosedIcon, CheckIcon, KeyIcon, ProtectedMessageIcon, SmartphoneIcon, CrossIcon, WalletIcon, PlusIcon, FilterIcon, EditIcon, DeleteIcon, DocumentIcon, ChevronIcon, BurgerMenuIcon, KebabMenuIcon, CircleProcessIcon, CreditsIcon, WebIcon, ChainSmallIcon, SettingsIcon, ShieldSmallIcon, QuestionMessageIcon, CheckmarkIcon, FingerprintIcon, FaceIcon, SignIcon, SignLockIcon, LockIcon, PendingIcon, SearchIcon, AirplaneIcon, ExternalLinkIcon, InfoCircleIcon } from './icons';
|
|
@@ -25,5 +25,7 @@ export { ProgressStepBar } from './progressStepBar/index.esm.js';
|
|
|
25
25
|
export { DashLogo } from './dashLogo/index.esm.js';
|
|
26
26
|
export { DashDialog as Dialog } from './dialog/index.esm.js';
|
|
27
27
|
export { Tabs } from './tabs/index.esm.js';
|
|
28
|
+
export { Tooltip } from './tooltip/index.esm.js';
|
|
29
|
+
export { Popover } from './popover/index.esm.js';
|
|
28
30
|
export { AirplaneIcon, ArrowIcon, BroadcastedIcon, BurgerMenuIcon, CalendarIcon, ChainSmallIcon, CheckIcon, CheckmarkIcon, ChevronIcon, CircleProcessIcon, CopyIcon, CreditsIcon, CrossIcon, DeleteIcon, DocumentIcon, EditIcon, ErrorIcon, ExternalLinkIcon, EyeClosedIcon, EyeOpenIcon, FaceIcon, FilterIcon, FingerprintIcon, InfoCircleIcon, KebabMenuIcon, KeyIcon, LockIcon, PendingIcon, PlusIcon, PooledIcon, ProtectedMessageIcon, QuestionMessageIcon, QueuedIcon, SearchIcon, SettingsIcon, ShieldSmallIcon, SignIcon, SignLockIcon, SmartphoneIcon, SuccessIcon, WalletIcon, WebIcon } from './icons/index.esm.js';
|
|
29
31
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,6 +10,7 @@ var React = require('react');
|
|
|
10
10
|
var classVarianceAuthority = require('class-variance-authority');
|
|
11
11
|
var ThemeContext = require('../../contexts/ThemeContext.cjs.js');
|
|
12
12
|
var index = require('../icons/index.cjs.js');
|
|
13
|
+
var useColorScheme = require('../../hooks/useColorScheme.cjs.js');
|
|
13
14
|
|
|
14
15
|
const input = classVarianceAuthority.cva('w-full transition-all font-inter placeholder:text-opacity-60 text-[0.875rem] leading-[1.0625rem]', {
|
|
15
16
|
variants: {
|
|
@@ -127,9 +128,12 @@ const input = classVarianceAuthority.cva('w-full transition-all font-inter place
|
|
|
127
128
|
* />
|
|
128
129
|
*/
|
|
129
130
|
const Input = _a => {
|
|
131
|
+
var _b;
|
|
130
132
|
var {
|
|
131
133
|
className = '',
|
|
132
134
|
colorScheme,
|
|
135
|
+
colorSchemeLight,
|
|
136
|
+
colorSchemeDark,
|
|
133
137
|
size,
|
|
134
138
|
variant,
|
|
135
139
|
error = false,
|
|
@@ -140,15 +144,16 @@ const Input = _a => {
|
|
|
140
144
|
prefixClassName = '',
|
|
141
145
|
showPasswordToggle = true
|
|
142
146
|
} = _a,
|
|
143
|
-
props = tslib.__rest(_a, ["className", "colorScheme", "size", "variant", "error", "success", "disabled", "type", "prefix", "prefixClassName", "showPasswordToggle"]);
|
|
147
|
+
props = tslib.__rest(_a, ["className", "colorScheme", "colorSchemeLight", "colorSchemeDark", "size", "variant", "error", "success", "disabled", "type", "prefix", "prefixClassName", "showPasswordToggle"]);
|
|
144
148
|
const {
|
|
145
149
|
theme
|
|
146
150
|
} = ThemeContext.useTheme();
|
|
147
151
|
const [showPassword, setShowPassword] = React.useState(false);
|
|
148
152
|
const [prefixWidth, setPrefixWidth] = React.useState(0);
|
|
149
153
|
const prefixRef = React.useRef(null);
|
|
154
|
+
const effectiveColorScheme = (_b = useColorScheme.useColorScheme(colorScheme, colorSchemeLight, colorSchemeDark)) !== null && _b !== void 0 ? _b : 'default';
|
|
150
155
|
// Determine color scheme based on state
|
|
151
|
-
let finalColorScheme =
|
|
156
|
+
let finalColorScheme = effectiveColorScheme;
|
|
152
157
|
if (error) finalColorScheme = 'error';else if (success) finalColorScheme = 'success';
|
|
153
158
|
const classes = input({
|
|
154
159
|
theme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../../src/react/components/input/index.tsx"],"sourcesContent":["import React, { InputHTMLAttributes, useState, useRef, useEffect } from 'react'\nimport { cva, VariantProps } from 'class-variance-authority'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport { EyeOpenIcon, EyeClosedIcon } from '../icons'\n\nconst input = cva(\n 'w-full transition-all font-inter placeholder:text-opacity-60 text-[0.875rem] leading-[1.0625rem]',\n {\n variants: {\n theme: {\n light: 'text-[#111111] placeholder:text-[rgba(17,17,17,0.6)]',\n dark: 'text-white placeholder:text-gray-400'\n },\n colorScheme: {\n default: 'focus:ring-blue-500/20',\n brand: 'focus:ring-dash-brand/20',\n error: 'focus:ring-red-500/20',\n success: 'focus:ring-green-500/20',\n 'light-gray': 'focus:ring-[#6B7280]/20'\n },\n size: {\n sm: 'dash-block-sm font-light',\n md: 'dash-block-md font-light',\n xl: 'dash-block-xl font-light'\n },\n variant: {\n outlined: 'outline outline-1 outline-offset-[-1px]',\n filled: 'border-none'\n },\n disabled: {\n false: '',\n true: 'opacity-60 cursor-not-allowed'\n }\n },\n compoundVariants: [\n // Outlined variant colors\n {\n variant: 'outlined',\n colorScheme: 'default',\n class: 'outline-[rgba(17,17,17,0.32)] focus:outline-[rgba(17,17,17,0.6)]'\n },\n {\n variant: 'outlined',\n colorScheme: 'brand',\n class: 'outline-dash-brand/30 focus:outline-dash-brand'\n },\n {\n variant: 'outlined',\n colorScheme: 'error',\n class: 'outline-red-500 focus:outline-red-500'\n },\n {\n variant: 'outlined',\n colorScheme: 'success',\n class: 'outline-green-500 focus:outline-green-500'\n },\n {\n variant: 'outlined',\n colorScheme: 'light-gray',\n class: 'outline-[#6B7280]/50 focus:outline-[#6B7280]'\n },\n // Outlined variant with focus ring\n {\n variant: 'outlined',\n class: 'focus:ring-2'\n },\n // Outlined variant background\n {\n variant: 'outlined',\n theme: 'light',\n class: 'bg-white'\n },\n {\n variant: 'outlined',\n theme: 'dark',\n class: 'bg-gray-800'\n },\n // Filled variant colors\n {\n variant: 'filled',\n colorScheme: 'default',\n class: 'bg-[rgba(76,126,255,0.15)] focus:bg-[rgba(76,126,255,0.2)]'\n },\n {\n variant: 'filled',\n colorScheme: 'brand',\n class: 'bg-dash-brand/15 focus:bg-dash-brand/20'\n },\n {\n variant: 'filled',\n colorScheme: 'error',\n class: 'bg-red-500/15 focus:bg-red-500/20'\n },\n {\n variant: 'filled',\n colorScheme: 'success',\n class: 'bg-green-500/15 focus:bg-green-500/20'\n },\n {\n variant: 'filled',\n colorScheme: 'light-gray',\n class: 'bg-[#0C1C33]/5 focus:bg-[#0C1C33]/10'\n },\n // Filled variant with focus ring\n {\n variant: 'filled',\n class: 'focus:ring-2'\n }\n ],\n defaultVariants: {\n theme: 'light',\n colorScheme: 'default',\n size: 'xl',\n variant: 'outlined',\n disabled: false\n }\n }\n)\n\ntype InputVariants = VariantProps<typeof input>\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'>, Omit<InputVariants, 'theme' | 'disabled'> {\n className?: string\n error?: boolean\n success?: boolean\n prefix?: string | React.ReactNode\n prefixClassName?: string\n /**\n * Controls visibility toggle for password inputs. When false, the eye icon is hidden and no extra right padding is applied.\n * Defaults to true.\n */\n showPasswordToggle?: boolean\n}\n\n/**\n * A versatile input component that adapts to light/dark theme,\n * supports various color schemes, sizes, variants, and states.\n * For password inputs, includes a toggleable eye icon.\n * Supports prefix text or elements before input content.\n *\n * @example\n * <Input\n * type='password'\n * placeholder='Enter password'\n * colorScheme='brand'\n * size='xl'\n * prefix=\"https://\"\n * />\n */\nexport const Input: React.FC<InputProps> = ({\n className = '',\n colorScheme,\n size,\n variant,\n error = false,\n success = false,\n disabled = false,\n type,\n prefix,\n prefixClassName = '',\n showPasswordToggle = true,\n ...props\n}) => {\n const { theme } = useTheme()\n const [showPassword, setShowPassword] = useState(false)\n const [prefixWidth, setPrefixWidth] = useState(0)\n const prefixRef = useRef<HTMLDivElement>(null)\n\n // Determine color scheme based on state\n let finalColorScheme = colorScheme\n if (error) finalColorScheme = 'error'\n else if (success) finalColorScheme = 'success'\n\n const classes = input({\n theme,\n colorScheme: finalColorScheme,\n size,\n variant,\n disabled\n }) + ' ' + className\n\n const isPassword = type === 'password'\n const inputType = isPassword && showPassword ? 'text' : type\n const hasPrefix = Boolean(prefix)\n\n const togglePasswordVisibility = (): void => {\n setShowPassword(!showPassword)\n }\n\n // Measure actual prefix width\n useEffect(() => {\n if (prefixRef.current) {\n const width = prefixRef.current.offsetWidth\n // Convert px to rem (assuming 16px base) and add base padding (1rem) + extra space (0.5rem)\n setPrefixWidth(width / 16 + 1.5)\n }\n }, [prefix])\n\n // Render with prefix\n if (hasPrefix) {\n return (\n <div className='relative'>\n <div \n ref={prefixRef}\n className={`absolute left-4 top-1/2 -translate-y-1/2 z-10 text-[0.875rem] opacity-60 pointer-events-none select-none ${prefixClassName}`}\n >\n {prefix}\n </div>\n <input\n className={`${classes}${isPassword && showPasswordToggle ? ' pr-12' : ''}`}\n style={{ paddingLeft: prefixWidth ? `${prefixWidth}rem` : '1rem' }}\n disabled={disabled}\n type={inputType}\n {...props}\n />\n {isPassword && showPasswordToggle && (\n <button\n type='button'\n className='absolute right-4 top-1/2 -translate-y-1/2 opacity-50 hover:opacity-70 transition-opacity cursor-pointer focus:outline-none'\n onClick={togglePasswordVisibility}\n tabIndex={-1}\n >\n {showPassword\n ? <EyeClosedIcon size={16} color='#0C1C33' />\n : <EyeOpenIcon size={16} color='#0C1C33' />}\n </button>\n )}\n </div>\n )\n }\n\n // Render password input without prefix\n if (isPassword) {\n return (\n <div className='relative'>\n <input\n className={classes + (showPasswordToggle ? ' pr-12' : '')}\n disabled={disabled}\n type={inputType}\n {...props}\n />\n {showPasswordToggle && (\n <button\n type='button'\n className='absolute right-4 top-1/2 -translate-y-1/2 opacity-50 hover:opacity-70 transition-opacity cursor-pointer focus:outline-none'\n onClick={togglePasswordVisibility}\n tabIndex={-1}\n >\n {showPassword\n ? <EyeClosedIcon size={16} color='#0C1C33' />\n : <EyeOpenIcon size={16} color='#0C1C33' />}\n </button>\n )}\n </div>\n )\n }\n\n // Regular input without prefix\n return (\n <input\n className={classes}\n disabled={disabled}\n type={inputType}\n {...props}\n />\n )\n}\n\nexport default Input "],"names":["input","cva","variants","theme","light","dark","colorScheme","default","brand","error","success","size","sm","md","xl","variant","outlined","filled","disabled","false","true","compoundVariants","class","defaultVariants","Input","_a","className","type","prefix","prefixClassName","showPasswordToggle","props","__rest","useTheme","showPassword","setShowPassword","useState","prefixWidth","setPrefixWidth","prefixRef","useRef","finalColorScheme","classes","isPassword","inputType","hasPrefix","Boolean","togglePasswordVisibility","useEffect","current","width","offsetWidth","_jsxs","children","_jsx","ref","Object","assign","style","paddingLeft","onClick","tabIndex","EyeClosedIcon","color","EyeOpenIcon"],"mappings":";;;;;;;;;;;;;AAKA,MAAMA,KAAK,GAAGC,0BAAG,CACf,kGAAkG,EAClG;AACEC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,sDAAsD;AAC7DC,MAAAA,IAAI,EA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AA,KAAA,EAAA;AAAA1B,MAAAA,SAAS,EAAC,UAAU;iBACvB4B,cACE,CAAA,OAAA,EAAAE,MAAA,CAAAC,MAAA,CAAA;QAAA/B,SAAS,EAAEgB,OAAO,IAAIZ,kBAAkB,GAAG,QAAQ,GAAG,EAAE,CAAC;AACzDZ,QAAAA,QAAQ,EAAEA,QAAQ;AAClBS,QAAAA,IAAI,EAAEiB;OACF,EAAAb,KAAK,CACT,CAAA,EACDD,kBAAkB,IACjBwB,cAAA,CAAA,QAAA,EAAA;AACE3B,QAAAA,IAAI,EAAC,QAAQ;AACbD,QAAAA,SAAS,EAAC,4HAA4H;AACtIkC,QAAAA,OAAO,EAAEb,wBAAwB;QACjCc,QAAQ,EAAE,EAAE;AAAAR,QAAAA,QAAA,EAEXnB,YAAY,GACToB,cAAC,CAAAQ,mBAAa,EAAC;AAAAnD,UAAAA,IAAI,EAAE,EAAE;AAAEoD,UAAAA,KAAK,EAAC;AAAY,SAAA,CAAA,GAC3CT,cAAC,CAAAU,iBAAW,EAAC;AAAArD,UAAAA,IAAI,EAAE,EAAE;AAAEoD,UAAAA,KAAK,EAAC;SAAY;AAAA,OAAA,CAEhD;AAAA,KAAA,CACG;AAEV;AAEA;AACA,EAAA,OACET,cACE,CAAA,OAAA,EAAAE,MAAA,CAAAC,MAAA,CAAA;AAAA/B,IAAAA,SAAS,EAAEgB,OAAO;AAClBxB,IAAAA,QAAQ,EAAEA,QAAQ;AAClBS,IAAAA,IAAI,EAAEiB;KACFb,KAAK,CAAA,CACT;AAEN;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../src/react/components/input/index.tsx"],"sourcesContent":["import React, { InputHTMLAttributes, useState, useRef, useEffect } from 'react'\nimport { cva, VariantProps } from 'class-variance-authority'\nimport { useTheme } from '../../contexts/ThemeContext'\nimport { EyeOpenIcon, EyeClosedIcon } from '../icons'\nimport { useColorScheme } from '../../hooks/useColorScheme'\n\nconst input = cva(\n 'w-full transition-all font-inter placeholder:text-opacity-60 text-[0.875rem] leading-[1.0625rem]',\n {\n variants: {\n theme: {\n light: 'text-[#111111] placeholder:text-[rgba(17,17,17,0.6)]',\n dark: 'text-white placeholder:text-gray-400'\n },\n colorScheme: {\n default: 'focus:ring-blue-500/20',\n brand: 'focus:ring-dash-brand/20',\n error: 'focus:ring-red-500/20',\n success: 'focus:ring-green-500/20',\n 'light-gray': 'focus:ring-[#6B7280]/20'\n },\n size: {\n sm: 'dash-block-sm font-light',\n md: 'dash-block-md font-light',\n xl: 'dash-block-xl font-light'\n },\n variant: {\n outlined: 'outline outline-1 outline-offset-[-1px]',\n filled: 'border-none'\n },\n disabled: {\n false: '',\n true: 'opacity-60 cursor-not-allowed'\n }\n },\n compoundVariants: [\n // Outlined variant colors\n {\n variant: 'outlined',\n colorScheme: 'default',\n class: 'outline-[rgba(17,17,17,0.32)] focus:outline-[rgba(17,17,17,0.6)]'\n },\n {\n variant: 'outlined',\n colorScheme: 'brand',\n class: 'outline-dash-brand/30 focus:outline-dash-brand'\n },\n {\n variant: 'outlined',\n colorScheme: 'error',\n class: 'outline-red-500 focus:outline-red-500'\n },\n {\n variant: 'outlined',\n colorScheme: 'success',\n class: 'outline-green-500 focus:outline-green-500'\n },\n {\n variant: 'outlined',\n colorScheme: 'light-gray',\n class: 'outline-[#6B7280]/50 focus:outline-[#6B7280]'\n },\n // Outlined variant with focus ring\n {\n variant: 'outlined',\n class: 'focus:ring-2'\n },\n // Outlined variant background\n {\n variant: 'outlined',\n theme: 'light',\n class: 'bg-white'\n },\n {\n variant: 'outlined',\n theme: 'dark',\n class: 'bg-gray-800'\n },\n // Filled variant colors\n {\n variant: 'filled',\n colorScheme: 'default',\n class: 'bg-[rgba(76,126,255,0.15)] focus:bg-[rgba(76,126,255,0.2)]'\n },\n {\n variant: 'filled',\n colorScheme: 'brand',\n class: 'bg-dash-brand/15 focus:bg-dash-brand/20'\n },\n {\n variant: 'filled',\n colorScheme: 'error',\n class: 'bg-red-500/15 focus:bg-red-500/20'\n },\n {\n variant: 'filled',\n colorScheme: 'success',\n class: 'bg-green-500/15 focus:bg-green-500/20'\n },\n {\n variant: 'filled',\n colorScheme: 'light-gray',\n class: 'bg-[#0C1C33]/5 focus:bg-[#0C1C33]/10'\n },\n // Filled variant with focus ring\n {\n variant: 'filled',\n class: 'focus:ring-2'\n }\n ],\n defaultVariants: {\n theme: 'light',\n colorScheme: 'default',\n size: 'xl',\n variant: 'outlined',\n disabled: false\n }\n }\n)\n\ntype InputVariants = VariantProps<typeof input>\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'>, Omit<InputVariants, 'theme' | 'disabled'> {\n className?: string\n error?: boolean\n success?: boolean\n prefix?: string | React.ReactNode\n prefixClassName?: string\n /** Color scheme override for light theme */\n colorSchemeLight?: 'default' | 'brand' | 'error' | 'success' | 'light-gray'\n /** Color scheme override for dark theme */\n colorSchemeDark?: 'default' | 'brand' | 'error' | 'success' | 'light-gray'\n /**\n * Controls visibility toggle for password inputs. When false, the eye icon is hidden and no extra right padding is applied.\n * Defaults to true.\n */\n showPasswordToggle?: boolean\n}\n\n/**\n * A versatile input component that adapts to light/dark theme,\n * supports various color schemes, sizes, variants, and states.\n * For password inputs, includes a toggleable eye icon.\n * Supports prefix text or elements before input content.\n *\n * @example\n * <Input\n * type='password'\n * placeholder='Enter password'\n * colorScheme='brand'\n * size='xl'\n * prefix=\"https://\"\n * />\n */\nexport const Input: React.FC<InputProps> = ({\n className = '',\n colorScheme,\n colorSchemeLight,\n colorSchemeDark,\n size,\n variant,\n error = false,\n success = false,\n disabled = false,\n type,\n prefix,\n prefixClassName = '',\n showPasswordToggle = true,\n ...props\n}) => {\n const { theme } = useTheme()\n const [showPassword, setShowPassword] = useState(false)\n const [prefixWidth, setPrefixWidth] = useState(0)\n const prefixRef = useRef<HTMLDivElement>(null)\n\n const effectiveColorScheme = useColorScheme(colorScheme, colorSchemeLight, colorSchemeDark) ?? 'default'\n\n // Determine color scheme based on state\n let finalColorScheme: typeof effectiveColorScheme = effectiveColorScheme\n if (error) finalColorScheme = 'error'\n else if (success) finalColorScheme = 'success'\n\n const classes = input({\n theme,\n colorScheme: finalColorScheme,\n size,\n variant,\n disabled\n }) + ' ' + className\n\n const isPassword = type === 'password'\n const inputType = isPassword && showPassword ? 'text' : type\n const hasPrefix = Boolean(prefix)\n\n const togglePasswordVisibility = (): void => {\n setShowPassword(!showPassword)\n }\n\n // Measure actual prefix width\n useEffect(() => {\n if (prefixRef.current) {\n const width = prefixRef.current.offsetWidth\n // Convert px to rem (assuming 16px base) and add base padding (1rem) + extra space (0.5rem)\n setPrefixWidth(width / 16 + 1.5)\n }\n }, [prefix])\n\n // Render with prefix\n if (hasPrefix) {\n return (\n <div className='relative'>\n <div \n ref={prefixRef}\n className={`absolute left-4 top-1/2 -translate-y-1/2 z-10 text-[0.875rem] opacity-60 pointer-events-none select-none ${prefixClassName}`}\n >\n {prefix}\n </div>\n <input\n className={`${classes}${isPassword && showPasswordToggle ? ' pr-12' : ''}`}\n style={{ paddingLeft: prefixWidth ? `${prefixWidth}rem` : '1rem' }}\n disabled={disabled}\n type={inputType}\n {...props}\n />\n {isPassword && showPasswordToggle && (\n <button\n type='button'\n className='absolute right-4 top-1/2 -translate-y-1/2 opacity-50 hover:opacity-70 transition-opacity cursor-pointer focus:outline-none'\n onClick={togglePasswordVisibility}\n tabIndex={-1}\n >\n {showPassword\n ? <EyeClosedIcon size={16} color='#0C1C33' />\n : <EyeOpenIcon size={16} color='#0C1C33' />}\n </button>\n )}\n </div>\n )\n }\n\n // Render password input without prefix\n if (isPassword) {\n return (\n <div className='relative'>\n <input\n className={classes + (showPasswordToggle ? ' pr-12' : '')}\n disabled={disabled}\n type={inputType}\n {...props}\n />\n {showPasswordToggle && (\n <button\n type='button'\n className='absolute right-4 top-1/2 -translate-y-1/2 opacity-50 hover:opacity-70 transition-opacity cursor-pointer focus:outline-none'\n onClick={togglePasswordVisibility}\n tabIndex={-1}\n >\n {showPassword\n ? <EyeClosedIcon size={16} color='#0C1C33' />\n : <EyeOpenIcon size={16} color='#0C1C33' />}\n </button>\n )}\n </div>\n )\n }\n\n // Regular input without prefix\n return (\n <input\n className={classes}\n disabled={disabled}\n type={inputType}\n {...props}\n />\n )\n}\n\nexport default Input "],"names":["input","cva","variants","theme","light","dark","colorScheme","default","brand","error","success","size","sm","md","xl","variant","outlined","filled","disabled","false","true","compoundVariants","class","defaultVariants","Input","_a","className","colorSchemeLight","colorSchemeDark","type","prefix","prefixClassName","showPasswordToggle","props","__rest","useTheme","showPassword","setShowPassword","useState","prefixWidth","setPrefixWidth","prefixRef","useRef","effectiveColorScheme","_b","useColorScheme","finalColorScheme","classes","isPassword","inputType","hasPrefix","Boolean","togglePasswordVisibility","useEffect","current","width","offsetWidth","_jsxs","children","_jsx","ref","Object","assign","style","paddingLeft","onClick","tabIndex","EyeClosedIcon","color","EyeOpenIcon"],"mappings":";;;;;;;;;;;;;;AAMA,MAAMA,KAAK,GAAGC,0BAAG,CACf,kGAAkG,EAClG;AACEC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,sDAAsD;AAC7DC,MAAAA,IAAI,EAAE;KACP;AACDC,IAAAA,WAAW,EAAE;AACXC,MAAAA,OAAO,EAAE,wBAAwB;AACjCC,MAAAA,KAAK,EAAE,0BAA0B;AACjCC,MAAAA,KAAK,EAAE,uBAAuB;AAC9BC,MAAAA,OAAO,EAAE,yBAAyB;AAClC,MAAA,YAAY,EAAE;KACf;AACDC,IAAAA,IAAI,EAAE;AACJC,MAAAA,EAAE,EAAE,0BAA0B;AAC9BC,MAAAA,EAAE,EAAE,0BAA0B;AAC9BC,MAAAA,EAAE,EAAE;KACL;AACDC,IAAAA,OAAO,EAAE;AACPC,MAAAA,QAAQ,EAAE,yCAAyC;AACnDC,MAAAA,MAAM,EAAE;KACT;AACDC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,KAAK,EAAE,EAA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AAK,CACT,CAAA,EACDD,kBAAkB,IACjB2B,cAAA,CAAA,QAAA,EAAA;AACE9B,QAAAA,IAAI,EAAC,QAAQ;AACbH,QAAAA,SAAS,EAAC,4HAA4H;AACtIuC,QAAAA,OAAO,EAAEb,wBAAwB;QACjCc,QAAQ,EAAE,EAAE;AAAAR,QAAAA,QAAA,EAEXtB,YAAY,GACTuB,cAAC,CAAAQ,mBAAa,EAAC;AAAAxD,UAAAA,IAAI,EAAE,EAAE;AAAEyD,UAAAA,KAAK,EAAC;AAAY,SAAA,CAAA,GAC3CT,cAAC,CAAAU,iBAAW,EAAC;AAAA1D,UAAAA,IAAI,EAAE,EAAE;AAAEyD,UAAAA,KAAK,EAAC;SAAY;AAAA,OAAA,CAEhD;AAAA,KAAA,CACG;AAEV;AAEA;AACA,EAAA,OACET,cACE,CAAA,OAAA,EAAAE,MAAA,CAAAC,MAAA,CAAA;AAAApC,IAAAA,SAAS,EAAEqB,OAAO;AAClB7B,IAAAA,QAAQ,EAAEA,QAAQ;AAClBW,IAAAA,IAAI,EAAEoB;KACFhB,KAAK,CAAA,CACT;AAEN;;;;;"}
|
|
@@ -14,6 +14,10 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
14
14
|
success?: boolean;
|
|
15
15
|
prefix?: string | React.ReactNode;
|
|
16
16
|
prefixClassName?: string;
|
|
17
|
+
/** Color scheme override for light theme */
|
|
18
|
+
colorSchemeLight?: 'default' | 'brand' | 'error' | 'success' | 'light-gray';
|
|
19
|
+
/** Color scheme override for dark theme */
|
|
20
|
+
colorSchemeDark?: 'default' | 'brand' | 'error' | 'success' | 'light-gray';
|
|
17
21
|
/**
|
|
18
22
|
* Controls visibility toggle for password inputs. When false, the eye icon is hidden and no extra right padding is applied.
|
|
19
23
|
* Defaults to true.
|
|
@@ -6,6 +6,7 @@ import { useState, useRef, useEffect } from 'react';
|
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
import { useTheme } from '../../contexts/ThemeContext.esm.js';
|
|
8
8
|
import { EyeClosedIcon, EyeOpenIcon } from '../icons/index.esm.js';
|
|
9
|
+
import { useColorScheme } from '../../hooks/useColorScheme.esm.js';
|
|
9
10
|
|
|
10
11
|
const input = cva('w-full transition-all font-inter placeholder:text-opacity-60 text-[0.875rem] leading-[1.0625rem]', {
|
|
11
12
|
variants: {
|
|
@@ -123,9 +124,12 @@ const input = cva('w-full transition-all font-inter placeholder:text-opacity-60
|
|
|
123
124
|
* />
|
|
124
125
|
*/
|
|
125
126
|
const Input = _a => {
|
|
127
|
+
var _b;
|
|
126
128
|
var {
|
|
127
129
|
className = '',
|
|
128
130
|
colorScheme,
|
|
131
|
+
colorSchemeLight,
|
|
132
|
+
colorSchemeDark,
|
|
129
133
|
size,
|
|
130
134
|
variant,
|
|
131
135
|
error = false,
|
|
@@ -136,15 +140,16 @@ const Input = _a => {
|
|
|
136
140
|
prefixClassName = '',
|
|
137
141
|
showPasswordToggle = true
|
|
138
142
|
} = _a,
|
|
139
|
-
props = __rest(_a, ["className", "colorScheme", "size", "variant", "error", "success", "disabled", "type", "prefix", "prefixClassName", "showPasswordToggle"]);
|
|
143
|
+
props = __rest(_a, ["className", "colorScheme", "colorSchemeLight", "colorSchemeDark", "size", "variant", "error", "success", "disabled", "type", "prefix", "prefixClassName", "showPasswordToggle"]);
|
|
140
144
|
const {
|
|
141
145
|
theme
|
|
142
146
|
} = useTheme();
|
|
143
147
|
const [showPassword, setShowPassword] = useState(false);
|
|
144
148
|
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
145
149
|
const prefixRef = useRef(null);
|
|
150
|
+
const effectiveColorScheme = (_b = useColorScheme(colorScheme, colorSchemeLight, colorSchemeDark)) !== null && _b !== void 0 ? _b : 'default';
|
|
146
151
|
// Determine color scheme based on state
|
|
147
|
-
let finalColorScheme =
|
|
152
|
+
let finalColorScheme = effectiveColorScheme;
|
|
148
153
|
if (error) finalColorScheme = 'error';else if (success) finalColorScheme = 'success';
|
|
149
154
|
const classes = input({
|
|
150
155
|
theme,
|