torch-glare 1.1.0 → 1.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/src/shared/tailwindInit.d.ts.map +1 -1
- package/dist/src/shared/tailwindInit.js +13 -2
- package/dist/src/shared/tailwindInit.js.map +1 -1
- package/lib/components/BadgeField.tsx +11 -10
- package/lib/components/ImageAttachment.tsx +2 -0
- package/lib/hooks/useClickOutside.tsx +2 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwindInit.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/tailwindInit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tailwindInit.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/tailwindInit.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI,IAAI,CAUnC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { execSync } from "child_process";
|
|
2
2
|
import { detectPackageManager } from "./detectPackageManager.js";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import fs from "fs";
|
|
3
5
|
export function tailwindInit() {
|
|
6
|
+
const LessThanV4 = IsTailwindLessThanV4();
|
|
4
7
|
const dependencies = [
|
|
5
8
|
"tailwindcss-animate",
|
|
6
9
|
"tailwind-scrollbar-hide",
|
|
7
10
|
"glare-typography",
|
|
8
|
-
"mapping-color-system",
|
|
11
|
+
LessThanV4 ? "mapping-color-system" : "mapping-color-system-v4",
|
|
9
12
|
"glare-torch-mode",
|
|
10
13
|
];
|
|
11
14
|
installDependencies(dependencies);
|
|
@@ -24,7 +27,7 @@ function installDependencies(dependencies = []) {
|
|
|
24
27
|
console.log(`📦 Detected package manager: ${packageManager}`);
|
|
25
28
|
// Generate the install command based on the package manager
|
|
26
29
|
let installCommand;
|
|
27
|
-
const latestDeps = dependencies.map(dep => `${dep}`).join(" ");
|
|
30
|
+
const latestDeps = dependencies.map(dep => `${dep}@latest`).join(" ");
|
|
28
31
|
switch (packageManager) {
|
|
29
32
|
case "pnpm":
|
|
30
33
|
installCommand = `pnpm add ${latestDeps} --prefer-offline`;
|
|
@@ -62,4 +65,12 @@ function installDependencies(dependencies = []) {
|
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
}
|
|
68
|
+
const IsTailwindLessThanV4 = () => {
|
|
69
|
+
const packageJson = fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8');
|
|
70
|
+
const parsedJson = JSON.parse(packageJson);
|
|
71
|
+
const tailwindVersion = parsedJson.devDependencies?.['tailwindcss'];
|
|
72
|
+
if (!tailwindVersion)
|
|
73
|
+
return false;
|
|
74
|
+
return tailwindVersion.startsWith('^3') || tailwindVersion.startsWith('3');
|
|
75
|
+
};
|
|
65
76
|
//# sourceMappingURL=tailwindInit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwindInit.js","sourceRoot":"","sources":["../../../cli/src/shared/tailwindInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"tailwindInit.js","sourceRoot":"","sources":["../../../cli/src/shared/tailwindInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,MAAM,UAAU,YAAY;IAC1B,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAA;IACzC,MAAM,YAAY,GAAG;QACnB,qBAAqB;QACrB,yBAAyB;QACzB,kBAAkB;QAClB,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,yBAAyB;QAC/D,kBAAkB;KACnB,CAAC;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,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,KAAK,CACX,oIAAoI,CACrI,CAAC;QACJ,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/C,OAAO,CAAC,KAAK,CACX,0GAA0G,CAC3G,CAAC;QACJ,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC,EAAE,CAAC;YACpG,OAAO,CAAC,KAAK,CACX,4HAA4H,CAC7H,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;AACH,CAAC;AAGD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;IACtF,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAQ,CAAC;IAElD,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,aAAa,CAAC,CAAC;IACpE,IAAI,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC;IAEnC,OAAO,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC5E,CAAC,CAAA"}
|
|
@@ -11,9 +11,9 @@ import { Tooltip, ToolTipSide } from "./Tooltip";
|
|
|
11
11
|
import { Popover, PopoverContent, PopoverTrigger } from "./Popover";
|
|
12
12
|
import { Themes } from "../utils/types";
|
|
13
13
|
import { Icon, Input, Group, Trilling } from "./Input";
|
|
14
|
-
import { useClickOutside } from "
|
|
14
|
+
import { useClickOutside } from "@/hooks/useClickOutside";
|
|
15
15
|
import { Badge } from "./Badge";
|
|
16
|
-
import { Tag, useTagSelection } from "
|
|
16
|
+
import { Tag, useTagSelection } from "@/hooks/useTagSelection";
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
interface Props
|
|
@@ -30,7 +30,6 @@ interface Props
|
|
|
30
30
|
actionButton?: ReactNode
|
|
31
31
|
tags: Tag[]
|
|
32
32
|
onValueChange?: (tags: Tag[]) => void
|
|
33
|
-
singleSelect?: boolean
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
|
|
@@ -51,9 +50,9 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
|
|
|
51
50
|
tags,
|
|
52
51
|
onValueChange,
|
|
53
52
|
children,
|
|
54
|
-
singleSelect = false,
|
|
55
53
|
...props
|
|
56
54
|
},
|
|
55
|
+
forwardedRef
|
|
57
56
|
) => {
|
|
58
57
|
const [dropDownListWidth, setDropDownListWidth] = useState(0);
|
|
59
58
|
const popoverContentRef = useRef<HTMLDivElement>(null);
|
|
@@ -61,8 +60,8 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
|
|
|
61
60
|
// this is used to close the popover when the user clicks outside the input group
|
|
62
61
|
const inputGroupRef = useClickOutside((e) => {
|
|
63
62
|
if (
|
|
64
|
-
!inputGroupRef?.current?.contains(e
|
|
65
|
-
!popoverContentRef?.current?.contains(e
|
|
63
|
+
!inputGroupRef?.current?.contains(e?.target as Node) &&
|
|
64
|
+
!popoverContentRef?.current?.contains(e?.target as Node)
|
|
66
65
|
) setIsPopoverOpen(false);
|
|
67
66
|
else setIsPopoverOpen(true);
|
|
68
67
|
});
|
|
@@ -80,7 +79,7 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
|
|
|
80
79
|
focusedPopoverIndex,
|
|
81
80
|
isPopoverOpen,
|
|
82
81
|
setIsPopoverOpen,
|
|
83
|
-
} = useTagSelection({ Tags: tags, onTagsChange: onValueChange, inputRef
|
|
82
|
+
} = useTagSelection({ Tags: tags, onTagsChange: onValueChange, inputRef });
|
|
84
83
|
|
|
85
84
|
return (
|
|
86
85
|
<Popover open={isPopoverOpen}>
|
|
@@ -94,17 +93,18 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
|
|
|
94
93
|
<Group
|
|
95
94
|
error={errorMessage !== undefined}
|
|
96
95
|
onTable={onTable}
|
|
96
|
+
data-theme={theme}
|
|
97
97
|
variant={variant}
|
|
98
98
|
tabIndex={isPopoverOpen ? 0 : -1}
|
|
99
99
|
onKeyDown={handleKeyDown}
|
|
100
100
|
size={size === "XS" ? "S" : size}
|
|
101
|
-
ref={inputGroupRef}
|
|
101
|
+
ref={inputGroupRef as any}
|
|
102
102
|
onFocus={(e: any) => {
|
|
103
103
|
setDropDownListWidth(e.currentTarget.offsetWidth);
|
|
104
104
|
}}
|
|
105
|
-
className={cn("flex gap-1 flex-row w-full relative p-1 flex-nowrap overflow-hidden justify-
|
|
105
|
+
className={cn("flex gap-1 flex-row w-full relative p-1 flex-nowrap overflow-hidden justify-end h-fit items-center",
|
|
106
106
|
{
|
|
107
|
-
"flex-wrap justify-start
|
|
107
|
+
"flex-wrap justify-start": isPopoverOpen,
|
|
108
108
|
},
|
|
109
109
|
className
|
|
110
110
|
)}
|
|
@@ -163,6 +163,7 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
|
|
|
163
163
|
</Tooltip>
|
|
164
164
|
|
|
165
165
|
<PopoverContent
|
|
166
|
+
data-theme={theme}
|
|
166
167
|
ref={popoverContentRef}
|
|
167
168
|
style={{ width: dropDownListWidth }}
|
|
168
169
|
variant={variant}
|
|
@@ -46,6 +46,7 @@ const ImageAttachment = forwardRef<HTMLInputElement, Props>(
|
|
|
46
46
|
) => {
|
|
47
47
|
return (
|
|
48
48
|
<section
|
|
49
|
+
|
|
49
50
|
className={cn("flex items-center justify-center gap-1 w-full", className)}>
|
|
50
51
|
{children}
|
|
51
52
|
<Button
|
|
@@ -54,6 +55,7 @@ const ImageAttachment = forwardRef<HTMLInputElement, Props>(
|
|
|
54
55
|
as="label"
|
|
55
56
|
id={props.id}
|
|
56
57
|
variant="PrimeContStyle"
|
|
58
|
+
|
|
57
59
|
className={cn(dropZoneStyles({ active: isDropAreaActive }))}
|
|
58
60
|
containerClassName="flex-col"
|
|
59
61
|
>
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
2
|
|
|
3
|
-
export function useClickOutside<T extends HTMLElement>(callback: (event?:
|
|
3
|
+
export function useClickOutside<T extends HTMLElement>(callback: (event?: MouseEvent | PointerEvent) => void) {
|
|
4
4
|
const ref = useRef<T>(null);
|
|
5
5
|
|
|
6
6
|
useEffect(() => {
|
|
7
|
-
function handleOutsideClick(event: MouseEvent) {
|
|
7
|
+
function handleOutsideClick(event: MouseEvent | PointerEvent) {
|
|
8
8
|
if (ref.current && !ref.current.contains(event.target as Node)) {
|
|
9
9
|
callback(event);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
15
14
|
document.addEventListener("pointerdown", handleOutsideClick);
|
|
16
15
|
return () => {
|