@northslopetech/altitude-ui 2.0.14 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +809 -142
- package/dist/index.d.ts +809 -142
- package/dist/index.js +1248 -168
- package/dist/index.mjs +1228 -168
- package/package.json +4 -1
package/dist/index.mjs
CHANGED
|
@@ -1470,7 +1470,7 @@ var Statement = ({
|
|
|
1470
1470
|
)
|
|
1471
1471
|
}
|
|
1472
1472
|
);
|
|
1473
|
-
var
|
|
1473
|
+
var TableIcon = ({
|
|
1474
1474
|
className,
|
|
1475
1475
|
variant = "dark",
|
|
1476
1476
|
...props
|
|
@@ -1913,32 +1913,276 @@ var FormField = React4.forwardRef(
|
|
|
1913
1913
|
);
|
|
1914
1914
|
FormField.displayName = "FormField";
|
|
1915
1915
|
|
|
1916
|
-
// src/components/ui/
|
|
1917
|
-
import
|
|
1918
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
1919
|
-
|
|
1920
|
-
// src/components/ui/input.tsx
|
|
1921
|
-
import * as React5 from "react";
|
|
1916
|
+
// src/components/ui/field.tsx
|
|
1917
|
+
import { useMemo } from "react";
|
|
1922
1918
|
import { cva as cva5 } from "class-variance-authority";
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1919
|
+
|
|
1920
|
+
// src/components/ui/label.tsx
|
|
1921
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
1922
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1923
|
+
function Label2({
|
|
1924
|
+
className,
|
|
1925
|
+
...props
|
|
1926
|
+
}) {
|
|
1927
|
+
return /* @__PURE__ */ jsx5(
|
|
1928
|
+
LabelPrimitive.Root,
|
|
1929
|
+
{
|
|
1930
|
+
"data-slot": "label",
|
|
1931
|
+
className: cn(
|
|
1932
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
1933
|
+
className
|
|
1934
|
+
),
|
|
1935
|
+
...props
|
|
1936
|
+
}
|
|
1937
|
+
);
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
// src/components/ui/separator.tsx
|
|
1941
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
1942
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1943
|
+
function Separator2({
|
|
1944
|
+
className,
|
|
1945
|
+
orientation = "horizontal",
|
|
1946
|
+
decorative = true,
|
|
1947
|
+
...props
|
|
1948
|
+
}) {
|
|
1949
|
+
return /* @__PURE__ */ jsx6(
|
|
1950
|
+
SeparatorPrimitive.Root,
|
|
1951
|
+
{
|
|
1952
|
+
"data-slot": "separator",
|
|
1953
|
+
decorative,
|
|
1954
|
+
orientation,
|
|
1955
|
+
className: cn(
|
|
1956
|
+
"bg-subtle shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
1957
|
+
className
|
|
1958
|
+
),
|
|
1959
|
+
...props
|
|
1960
|
+
}
|
|
1961
|
+
);
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
// src/components/ui/field.tsx
|
|
1965
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1966
|
+
function FieldSet({ className, ...props }) {
|
|
1967
|
+
return /* @__PURE__ */ jsx7(
|
|
1968
|
+
"fieldset",
|
|
1969
|
+
{
|
|
1970
|
+
"data-slot": "field-set",
|
|
1971
|
+
className: cn(
|
|
1972
|
+
"flex flex-col gap-6",
|
|
1973
|
+
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
1974
|
+
className
|
|
1975
|
+
),
|
|
1976
|
+
...props
|
|
1977
|
+
}
|
|
1978
|
+
);
|
|
1979
|
+
}
|
|
1980
|
+
function FieldLegend({
|
|
1981
|
+
className,
|
|
1982
|
+
variant = "legend",
|
|
1983
|
+
...props
|
|
1984
|
+
}) {
|
|
1985
|
+
return /* @__PURE__ */ jsx7(
|
|
1986
|
+
"legend",
|
|
1987
|
+
{
|
|
1988
|
+
"data-slot": "field-legend",
|
|
1989
|
+
"data-variant": variant,
|
|
1990
|
+
className: cn(
|
|
1991
|
+
"mb-3 font-medium",
|
|
1992
|
+
"data-[variant=legend]:text-base",
|
|
1993
|
+
"data-[variant=label]:text-sm",
|
|
1994
|
+
className
|
|
1995
|
+
),
|
|
1996
|
+
...props
|
|
1997
|
+
}
|
|
1998
|
+
);
|
|
1999
|
+
}
|
|
2000
|
+
function FieldGroup({ className, ...props }) {
|
|
2001
|
+
return /* @__PURE__ */ jsx7(
|
|
2002
|
+
"div",
|
|
2003
|
+
{
|
|
2004
|
+
"data-slot": "field-group",
|
|
2005
|
+
className: cn(
|
|
2006
|
+
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
2007
|
+
className
|
|
2008
|
+
),
|
|
2009
|
+
...props
|
|
2010
|
+
}
|
|
2011
|
+
);
|
|
2012
|
+
}
|
|
2013
|
+
var fieldVariants = cva5(
|
|
2014
|
+
"group/field data-[invalid=true]:text-error flex w-full gap-3",
|
|
1926
2015
|
{
|
|
1927
2016
|
variants: {
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2017
|
+
orientation: {
|
|
2018
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
2019
|
+
horizontal: [
|
|
2020
|
+
"flex-row items-center",
|
|
2021
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
2022
|
+
"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start"
|
|
2023
|
+
],
|
|
2024
|
+
responsive: [
|
|
2025
|
+
"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto",
|
|
2026
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
2027
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
2028
|
+
]
|
|
1931
2029
|
}
|
|
1932
2030
|
},
|
|
1933
2031
|
defaultVariants: {
|
|
1934
|
-
|
|
2032
|
+
orientation: "vertical"
|
|
1935
2033
|
}
|
|
1936
2034
|
}
|
|
1937
2035
|
);
|
|
2036
|
+
function Field({
|
|
2037
|
+
className,
|
|
2038
|
+
orientation = "vertical",
|
|
2039
|
+
...props
|
|
2040
|
+
}) {
|
|
2041
|
+
return /* @__PURE__ */ jsx7(
|
|
2042
|
+
"div",
|
|
2043
|
+
{
|
|
2044
|
+
role: "group",
|
|
2045
|
+
"data-slot": "field",
|
|
2046
|
+
"data-orientation": orientation,
|
|
2047
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
2048
|
+
...props
|
|
2049
|
+
}
|
|
2050
|
+
);
|
|
2051
|
+
}
|
|
2052
|
+
function FieldContent({ className, ...props }) {
|
|
2053
|
+
return /* @__PURE__ */ jsx7(
|
|
2054
|
+
"div",
|
|
2055
|
+
{
|
|
2056
|
+
"data-slot": "field-content",
|
|
2057
|
+
className: cn(
|
|
2058
|
+
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
2059
|
+
className
|
|
2060
|
+
),
|
|
2061
|
+
...props
|
|
2062
|
+
}
|
|
2063
|
+
);
|
|
2064
|
+
}
|
|
2065
|
+
function FieldLabel({
|
|
2066
|
+
className,
|
|
2067
|
+
...props
|
|
2068
|
+
}) {
|
|
2069
|
+
return /* @__PURE__ */ jsx7(
|
|
2070
|
+
Label2,
|
|
2071
|
+
{
|
|
2072
|
+
"data-slot": "field-label",
|
|
2073
|
+
className: cn(
|
|
2074
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
2075
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4",
|
|
2076
|
+
"has-data-[state=checked]:bg-gray has-data-[state=checked]:border-dark",
|
|
2077
|
+
className
|
|
2078
|
+
),
|
|
2079
|
+
...props
|
|
2080
|
+
}
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
function FieldTitle({ className, ...props }) {
|
|
2084
|
+
return /* @__PURE__ */ jsx7(
|
|
2085
|
+
"div",
|
|
2086
|
+
{
|
|
2087
|
+
"data-slot": "field-label",
|
|
2088
|
+
className: cn(
|
|
2089
|
+
"flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
2090
|
+
className
|
|
2091
|
+
),
|
|
2092
|
+
...props
|
|
2093
|
+
}
|
|
2094
|
+
);
|
|
2095
|
+
}
|
|
2096
|
+
function FieldDescription({ className, ...props }) {
|
|
2097
|
+
return /* @__PURE__ */ jsx7(
|
|
2098
|
+
"p",
|
|
2099
|
+
{
|
|
2100
|
+
"data-slot": "field-description",
|
|
2101
|
+
className: cn(
|
|
2102
|
+
"text-secondary text-sm font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
2103
|
+
"nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5",
|
|
2104
|
+
"[&>a:hover]:text-dark [&>a]:underline [&>a]:underline-offset-4",
|
|
2105
|
+
className
|
|
2106
|
+
),
|
|
2107
|
+
...props
|
|
2108
|
+
}
|
|
2109
|
+
);
|
|
2110
|
+
}
|
|
2111
|
+
function FieldSeparator({
|
|
2112
|
+
children,
|
|
2113
|
+
className,
|
|
2114
|
+
...props
|
|
2115
|
+
}) {
|
|
2116
|
+
return /* @__PURE__ */ jsxs5(
|
|
2117
|
+
"div",
|
|
2118
|
+
{
|
|
2119
|
+
"data-slot": "field-separator",
|
|
2120
|
+
"data-content": !!children,
|
|
2121
|
+
className: cn(
|
|
2122
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
2123
|
+
className
|
|
2124
|
+
),
|
|
2125
|
+
...props,
|
|
2126
|
+
children: [
|
|
2127
|
+
/* @__PURE__ */ jsx7(Separator2, { className: "absolute inset-0 top-1/2" }),
|
|
2128
|
+
children && /* @__PURE__ */ jsx7(
|
|
2129
|
+
"span",
|
|
2130
|
+
{
|
|
2131
|
+
className: "bg-light text-secondary relative mx-auto block w-fit px-2",
|
|
2132
|
+
"data-slot": "field-separator-content",
|
|
2133
|
+
children
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
]
|
|
2137
|
+
}
|
|
2138
|
+
);
|
|
2139
|
+
}
|
|
2140
|
+
function FieldError({
|
|
2141
|
+
className,
|
|
2142
|
+
children,
|
|
2143
|
+
errors,
|
|
2144
|
+
...props
|
|
2145
|
+
}) {
|
|
2146
|
+
const content = useMemo(() => {
|
|
2147
|
+
if (children) {
|
|
2148
|
+
return children;
|
|
2149
|
+
}
|
|
2150
|
+
if (!errors) {
|
|
2151
|
+
return null;
|
|
2152
|
+
}
|
|
2153
|
+
if (errors?.length === 1 && errors[0]?.message) {
|
|
2154
|
+
return errors[0].message;
|
|
2155
|
+
}
|
|
2156
|
+
return /* @__PURE__ */ jsx7("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: errors.map(
|
|
2157
|
+
(error, index) => error?.message && /* @__PURE__ */ jsx7("li", { children: error.message }, index)
|
|
2158
|
+
) });
|
|
2159
|
+
}, [children, errors]);
|
|
2160
|
+
if (!content) {
|
|
2161
|
+
return null;
|
|
2162
|
+
}
|
|
2163
|
+
return /* @__PURE__ */ jsx7(
|
|
2164
|
+
"div",
|
|
2165
|
+
{
|
|
2166
|
+
role: "alert",
|
|
2167
|
+
"data-slot": "field-error",
|
|
2168
|
+
className: cn("text-error text-sm font-normal", className),
|
|
2169
|
+
...props,
|
|
2170
|
+
children: content
|
|
2171
|
+
}
|
|
2172
|
+
);
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
// src/components/ui/date-picker.tsx
|
|
2176
|
+
import * as React6 from "react";
|
|
2177
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2178
|
+
|
|
2179
|
+
// src/components/ui/input.tsx
|
|
2180
|
+
import * as React5 from "react";
|
|
2181
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2182
|
+
var inputBaseStyles = "flex h-10 py-2 w-full border bg-light text-dark focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:border-secondary transition-colors rounded-md px-3 min-w-80 border-secondary focus-visible:border-2 focus-visible:border-strong placeholder:text-secondary read-only:bg-gray read-only:cursor-default read-only:border-transparent read-only:text-secondary read-only:focus-visible:border-transparent";
|
|
1938
2183
|
var Input = React5.forwardRef(
|
|
1939
2184
|
({
|
|
1940
2185
|
className,
|
|
1941
|
-
variant = "input",
|
|
1942
2186
|
style,
|
|
1943
2187
|
value,
|
|
1944
2188
|
onChange,
|
|
@@ -1960,15 +2204,7 @@ var Input = React5.forwardRef(
|
|
|
1960
2204
|
if (!isControlled) {
|
|
1961
2205
|
setInternalValue(e.target.value);
|
|
1962
2206
|
}
|
|
1963
|
-
if (
|
|
1964
|
-
onChange(e);
|
|
1965
|
-
}
|
|
1966
|
-
};
|
|
1967
|
-
const handleTextareaChange = (e) => {
|
|
1968
|
-
if (!isControlled) {
|
|
1969
|
-
setInternalValue(e.target.value);
|
|
1970
|
-
}
|
|
1971
|
-
if (variant === "textarea" && onChange) {
|
|
2207
|
+
if (onChange) {
|
|
1972
2208
|
onChange(e);
|
|
1973
2209
|
}
|
|
1974
2210
|
};
|
|
@@ -1977,60 +2213,20 @@ var Input = React5.forwardRef(
|
|
|
1977
2213
|
setInternalValue("");
|
|
1978
2214
|
}
|
|
1979
2215
|
if (onChange) {
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
onChange(inputEvent);
|
|
1986
|
-
} else {
|
|
1987
|
-
const textareaEvent = {
|
|
1988
|
-
target: { value: "" },
|
|
1989
|
-
currentTarget: { value: "" }
|
|
1990
|
-
};
|
|
1991
|
-
onChange(
|
|
1992
|
-
textareaEvent
|
|
1993
|
-
);
|
|
1994
|
-
}
|
|
2216
|
+
const inputEvent = {
|
|
2217
|
+
target: { value: "" },
|
|
2218
|
+
currentTarget: { value: "" }
|
|
2219
|
+
};
|
|
2220
|
+
onChange(inputEvent);
|
|
1995
2221
|
}
|
|
1996
2222
|
onClear?.();
|
|
1997
2223
|
};
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
/* @__PURE__ */ jsx5(
|
|
2001
|
-
"textarea",
|
|
2002
|
-
{
|
|
2003
|
-
className: cn(
|
|
2004
|
-
inputVariants({ variant }),
|
|
2005
|
-
(showClear || showLock) && "pr-10",
|
|
2006
|
-
className
|
|
2007
|
-
),
|
|
2008
|
-
style: tokenStyles,
|
|
2009
|
-
ref,
|
|
2010
|
-
value: currentValue,
|
|
2011
|
-
onChange: handleTextareaChange,
|
|
2012
|
-
readOnly,
|
|
2013
|
-
...props
|
|
2014
|
-
}
|
|
2015
|
-
),
|
|
2016
|
-
showClear && /* @__PURE__ */ jsx5(
|
|
2017
|
-
"button",
|
|
2018
|
-
{
|
|
2019
|
-
type: "button",
|
|
2020
|
-
onClick: handleClear,
|
|
2021
|
-
className: "absolute right-3 top-3 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
2022
|
-
children: /* @__PURE__ */ jsx5(X, { className: "h-4 w-4" })
|
|
2023
|
-
}
|
|
2024
|
-
),
|
|
2025
|
-
showLock && /* @__PURE__ */ jsx5(Lock, { className: "absolute right-3 top-3 h-4 w-4 text-secondary" })
|
|
2026
|
-
] });
|
|
2027
|
-
}
|
|
2028
|
-
return /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
2029
|
-
/* @__PURE__ */ jsx5(
|
|
2224
|
+
return /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
|
|
2225
|
+
/* @__PURE__ */ jsx8(
|
|
2030
2226
|
"input",
|
|
2031
2227
|
{
|
|
2032
2228
|
className: cn(
|
|
2033
|
-
|
|
2229
|
+
inputBaseStyles,
|
|
2034
2230
|
(showClear || showLock) && "pr-10",
|
|
2035
2231
|
className
|
|
2036
2232
|
),
|
|
@@ -2042,24 +2238,23 @@ var Input = React5.forwardRef(
|
|
|
2042
2238
|
...props
|
|
2043
2239
|
}
|
|
2044
2240
|
),
|
|
2045
|
-
showClear && /* @__PURE__ */
|
|
2241
|
+
showClear && /* @__PURE__ */ jsx8(
|
|
2046
2242
|
"button",
|
|
2047
2243
|
{
|
|
2048
2244
|
type: "button",
|
|
2049
2245
|
onClick: handleClear,
|
|
2050
2246
|
className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
2051
|
-
children: /* @__PURE__ */
|
|
2247
|
+
children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" })
|
|
2052
2248
|
}
|
|
2053
2249
|
),
|
|
2054
|
-
showLock && /* @__PURE__ */
|
|
2250
|
+
showLock && /* @__PURE__ */ jsx8(Lock, { className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary" })
|
|
2055
2251
|
] });
|
|
2056
2252
|
}
|
|
2057
2253
|
);
|
|
2058
2254
|
Input.displayName = "Input";
|
|
2059
|
-
var TypedInput = Input;
|
|
2060
2255
|
|
|
2061
2256
|
// src/components/ui/date-picker.tsx
|
|
2062
|
-
import { jsx as
|
|
2257
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2063
2258
|
var getDayNames = () => {
|
|
2064
2259
|
const days = [];
|
|
2065
2260
|
for (let i = 0; i < 7; i++) {
|
|
@@ -2260,15 +2455,15 @@ var DatePicker = React6.forwardRef(
|
|
|
2260
2455
|
const months = getMonthNames();
|
|
2261
2456
|
const dayNames = getDayNames();
|
|
2262
2457
|
const years = generateYears();
|
|
2263
|
-
return /* @__PURE__ */
|
|
2458
|
+
return /* @__PURE__ */ jsxs7(
|
|
2264
2459
|
PopoverPrimitive.Root,
|
|
2265
2460
|
{
|
|
2266
2461
|
open: disabled ? false : open,
|
|
2267
2462
|
onOpenChange: disabled ? void 0 : setOpen,
|
|
2268
2463
|
children: [
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
|
|
2464
|
+
/* @__PURE__ */ jsxs7("div", { className: "relative", children: [
|
|
2465
|
+
/* @__PURE__ */ jsx9(
|
|
2466
|
+
Input,
|
|
2272
2467
|
{
|
|
2273
2468
|
ref,
|
|
2274
2469
|
value: inputValue,
|
|
@@ -2280,7 +2475,7 @@ var DatePicker = React6.forwardRef(
|
|
|
2280
2475
|
...props
|
|
2281
2476
|
}
|
|
2282
2477
|
),
|
|
2283
|
-
/* @__PURE__ */
|
|
2478
|
+
/* @__PURE__ */ jsx9(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx9("button", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 hover:bg-gray rounded p-0.5 transition-colors", children: /* @__PURE__ */ jsx9(
|
|
2284
2479
|
Calendar,
|
|
2285
2480
|
{
|
|
2286
2481
|
className: cn(
|
|
@@ -2290,7 +2485,7 @@ var DatePicker = React6.forwardRef(
|
|
|
2290
2485
|
}
|
|
2291
2486
|
) }) })
|
|
2292
2487
|
] }),
|
|
2293
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ jsx9(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx9(
|
|
2294
2489
|
PopoverPrimitive.Content,
|
|
2295
2490
|
{
|
|
2296
2491
|
className: "z-50 w-80 rounded-lg border border-secondary bg-light text-dark shadow-lg animate-in fade-in-0 zoom-in-95 duration-200",
|
|
@@ -2299,51 +2494,51 @@ var DatePicker = React6.forwardRef(
|
|
|
2299
2494
|
alignOffset: -12,
|
|
2300
2495
|
side: "bottom",
|
|
2301
2496
|
sticky: "always",
|
|
2302
|
-
children: /* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */
|
|
2304
|
-
/* @__PURE__ */
|
|
2497
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "p-4", children: [
|
|
2498
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between mb-4 gap-1", children: [
|
|
2499
|
+
/* @__PURE__ */ jsx9(
|
|
2305
2500
|
"button",
|
|
2306
2501
|
{
|
|
2307
2502
|
onClick: () => handleMonthChange("prev"),
|
|
2308
2503
|
className: "p-1 hover:bg-gray rounded transition-colors flex-shrink-0",
|
|
2309
|
-
children: /* @__PURE__ */
|
|
2504
|
+
children: /* @__PURE__ */ jsx9(ChevronLeft, { className: "h-4 w-4" })
|
|
2310
2505
|
}
|
|
2311
2506
|
),
|
|
2312
|
-
/* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2507
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex gap-1 flex-1 min-w-0", children: [
|
|
2508
|
+
/* @__PURE__ */ jsxs7(
|
|
2314
2509
|
Select,
|
|
2315
2510
|
{
|
|
2316
2511
|
value: currentMonth.getMonth().toString(),
|
|
2317
2512
|
onValueChange: handleMonthSelect,
|
|
2318
2513
|
children: [
|
|
2319
|
-
/* @__PURE__ */
|
|
2320
|
-
/* @__PURE__ */
|
|
2514
|
+
/* @__PURE__ */ jsx9(SelectTrigger, { className: "min-w-fit h-8 text-sm", children: /* @__PURE__ */ jsx9(SelectValue, {}) }),
|
|
2515
|
+
/* @__PURE__ */ jsx9(SelectContent, { children: months.map((month, index) => /* @__PURE__ */ jsx9(SelectItem, { value: index.toString(), children: month }, month)) })
|
|
2321
2516
|
]
|
|
2322
2517
|
}
|
|
2323
2518
|
),
|
|
2324
|
-
/* @__PURE__ */
|
|
2519
|
+
/* @__PURE__ */ jsxs7(
|
|
2325
2520
|
Select,
|
|
2326
2521
|
{
|
|
2327
2522
|
value: currentMonth.getFullYear().toString(),
|
|
2328
2523
|
onValueChange: handleYearSelect,
|
|
2329
2524
|
children: [
|
|
2330
|
-
/* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ jsx9(SelectTrigger, { className: "min-w-fit h-8 text-sm", children: /* @__PURE__ */ jsx9(SelectValue, {}) }),
|
|
2526
|
+
/* @__PURE__ */ jsx9(SelectContent, { children: years.map((year) => /* @__PURE__ */ jsx9(SelectItem, { value: year.toString(), children: year }, year)) })
|
|
2332
2527
|
]
|
|
2333
2528
|
}
|
|
2334
2529
|
)
|
|
2335
2530
|
] }),
|
|
2336
|
-
/* @__PURE__ */
|
|
2531
|
+
/* @__PURE__ */ jsx9(
|
|
2337
2532
|
"button",
|
|
2338
2533
|
{
|
|
2339
2534
|
onClick: () => handleMonthChange("next"),
|
|
2340
2535
|
className: "p-1 hover:bg-gray rounded transition-colors flex-shrink-0",
|
|
2341
|
-
children: /* @__PURE__ */
|
|
2536
|
+
children: /* @__PURE__ */ jsx9(ChevronRight, { className: "h-4 w-4" })
|
|
2342
2537
|
}
|
|
2343
2538
|
)
|
|
2344
2539
|
] }),
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2540
|
+
/* @__PURE__ */ jsxs7("div", { className: "space-y-1", children: [
|
|
2541
|
+
/* @__PURE__ */ jsx9("div", { className: "grid grid-cols-7 gap-1 mb-2", children: dayNames.map((day) => /* @__PURE__ */ jsx9(
|
|
2347
2542
|
Typography,
|
|
2348
2543
|
{
|
|
2349
2544
|
variant: "label-xs-bold",
|
|
@@ -2353,11 +2548,11 @@ var DatePicker = React6.forwardRef(
|
|
|
2353
2548
|
},
|
|
2354
2549
|
day
|
|
2355
2550
|
)) }),
|
|
2356
|
-
/* @__PURE__ */
|
|
2551
|
+
/* @__PURE__ */ jsx9("div", { className: "grid grid-cols-7 gap-1", children: days.map((date, index) => /* @__PURE__ */ jsx9(
|
|
2357
2552
|
"div",
|
|
2358
2553
|
{
|
|
2359
2554
|
className: "h-8 w-8 flex items-center justify-center",
|
|
2360
|
-
children: date && /* @__PURE__ */
|
|
2555
|
+
children: date && /* @__PURE__ */ jsx9(
|
|
2361
2556
|
"button",
|
|
2362
2557
|
{
|
|
2363
2558
|
onClick: () => handleDateSelect(date),
|
|
@@ -2371,7 +2566,7 @@ var DatePicker = React6.forwardRef(
|
|
|
2371
2566
|
isToday(date) && !isDateSelected(date) && !isDateDisabled(date) && "text-blue-600 after:content-[''] after:absolute after:bottom-1 after:left-1/2 after:-translate-x-1/2 after:w-1 after:h-1 after:bg-blue-600 after:rounded-full",
|
|
2372
2567
|
isDateDisabled(date) && "text-secondary/40 cursor-not-allowed opacity-50"
|
|
2373
2568
|
),
|
|
2374
|
-
children: /* @__PURE__ */
|
|
2569
|
+
children: /* @__PURE__ */ jsx9(Typography, { variant: "label-sm", as: "span", children: date.getDate() })
|
|
2375
2570
|
}
|
|
2376
2571
|
)
|
|
2377
2572
|
},
|
|
@@ -2391,7 +2586,7 @@ DatePicker.displayName = "DatePicker";
|
|
|
2391
2586
|
// src/components/ui/upload.tsx
|
|
2392
2587
|
import * as React7 from "react";
|
|
2393
2588
|
import { cva as cva6 } from "class-variance-authority";
|
|
2394
|
-
import { jsx as
|
|
2589
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2395
2590
|
var DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
2396
2591
|
var uploadVariants = cva6(
|
|
2397
2592
|
"relative flex flex-col items-center justify-center rounded-lg transition-all duration-200 ease-in-out overflow-hidden",
|
|
@@ -2493,17 +2688,17 @@ var Upload = React7.forwardRef(
|
|
|
2493
2688
|
const renderContent = () => {
|
|
2494
2689
|
switch (effectiveState) {
|
|
2495
2690
|
case "error":
|
|
2496
|
-
return /* @__PURE__ */
|
|
2691
|
+
return /* @__PURE__ */ jsxs8(
|
|
2497
2692
|
"div",
|
|
2498
2693
|
{
|
|
2499
2694
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
2500
2695
|
style: { gap: "32px" },
|
|
2501
2696
|
children: [
|
|
2502
|
-
/* @__PURE__ */
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2697
|
+
/* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
|
|
2698
|
+
/* @__PURE__ */ jsx10(Typography, { variant: "heading-sm", children: "Upload fail" }),
|
|
2699
|
+
/* @__PURE__ */ jsx10(Typography, { variant: "body-md", className: "text-error", children: errorMessage })
|
|
2505
2700
|
] }),
|
|
2506
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ jsx10(
|
|
2507
2702
|
Button,
|
|
2508
2703
|
{
|
|
2509
2704
|
variant: "destructive",
|
|
@@ -2517,22 +2712,22 @@ var Upload = React7.forwardRef(
|
|
|
2517
2712
|
}
|
|
2518
2713
|
);
|
|
2519
2714
|
case "uploading":
|
|
2520
|
-
return /* @__PURE__ */
|
|
2715
|
+
return /* @__PURE__ */ jsxs8(
|
|
2521
2716
|
"div",
|
|
2522
2717
|
{
|
|
2523
2718
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
2524
2719
|
style: { gap: "32px" },
|
|
2525
2720
|
children: [
|
|
2526
|
-
/* @__PURE__ */
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ jsx10(Typography, { variant: "heading-sm", className: "text-dark", children: "Uploading files" }),
|
|
2722
|
+
/* @__PURE__ */ jsxs8("div", { className: "w-full max-w-[720px] space-y-2", children: [
|
|
2723
|
+
/* @__PURE__ */ jsx10("div", { className: "w-full bg-gray rounded-full h-2", children: /* @__PURE__ */ jsx10(
|
|
2529
2724
|
"div",
|
|
2530
2725
|
{
|
|
2531
2726
|
className: "bg-canvas-primary h-2 rounded-full transition-all duration-300 ease-in-out",
|
|
2532
2727
|
style: { width: `${progress}%` }
|
|
2533
2728
|
}
|
|
2534
2729
|
) }),
|
|
2535
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsxs8(
|
|
2536
2731
|
Typography,
|
|
2537
2732
|
{
|
|
2538
2733
|
variant: "body-sm",
|
|
@@ -2548,29 +2743,29 @@ var Upload = React7.forwardRef(
|
|
|
2548
2743
|
}
|
|
2549
2744
|
);
|
|
2550
2745
|
case "success":
|
|
2551
|
-
return /* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ jsx10(
|
|
2552
2747
|
"div",
|
|
2553
2748
|
{
|
|
2554
2749
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
2555
2750
|
style: { gap: "32px" },
|
|
2556
|
-
children: /* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
selectedFiles.length > 0 && /* @__PURE__ */
|
|
2751
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
|
|
2752
|
+
/* @__PURE__ */ jsx10(Typography, { variant: "heading-sm", className: "text-success", children: "Upload successful!" }),
|
|
2753
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsx10("div", { className: "text-center", children: selectedFiles.map((file, index) => /* @__PURE__ */ jsx10(Typography, { variant: "body-sm", children: file.name }, index)) })
|
|
2559
2754
|
] })
|
|
2560
2755
|
}
|
|
2561
2756
|
);
|
|
2562
2757
|
default:
|
|
2563
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ jsxs8(
|
|
2564
2759
|
"div",
|
|
2565
2760
|
{
|
|
2566
2761
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
2567
2762
|
style: { gap: "32px" },
|
|
2568
2763
|
children: [
|
|
2569
|
-
/* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
2764
|
+
/* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
|
|
2765
|
+
/* @__PURE__ */ jsx10(Typography, { variant: "heading-sm", className: "text-dark", children: "Drag & drop files here" }),
|
|
2766
|
+
/* @__PURE__ */ jsx10(Typography, { variant: "body-md", className: "text-secondary", children: "or click to browse from your computer" })
|
|
2572
2767
|
] }),
|
|
2573
|
-
/* @__PURE__ */
|
|
2768
|
+
/* @__PURE__ */ jsx10(
|
|
2574
2769
|
Button,
|
|
2575
2770
|
{
|
|
2576
2771
|
variant: "default",
|
|
@@ -2584,10 +2779,10 @@ var Upload = React7.forwardRef(
|
|
|
2584
2779
|
children: "Choose files"
|
|
2585
2780
|
}
|
|
2586
2781
|
),
|
|
2587
|
-
/* @__PURE__ */
|
|
2782
|
+
/* @__PURE__ */ jsxs8(Typography, { variant: "body-sm", className: "text-secondary", children: [
|
|
2588
2783
|
"Supported file: ",
|
|
2589
2784
|
getFileTypeDisplay(),
|
|
2590
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ jsx10("br", {}),
|
|
2591
2786
|
"Max: ",
|
|
2592
2787
|
Math.round(maxFileSize / 1024 / 1024),
|
|
2593
2788
|
" MB each"
|
|
@@ -2597,7 +2792,7 @@ var Upload = React7.forwardRef(
|
|
|
2597
2792
|
);
|
|
2598
2793
|
}
|
|
2599
2794
|
};
|
|
2600
|
-
return /* @__PURE__ */
|
|
2795
|
+
return /* @__PURE__ */ jsxs8(
|
|
2601
2796
|
"div",
|
|
2602
2797
|
{
|
|
2603
2798
|
ref,
|
|
@@ -2621,7 +2816,7 @@ var Upload = React7.forwardRef(
|
|
|
2621
2816
|
"aria-disabled": disabled,
|
|
2622
2817
|
...props,
|
|
2623
2818
|
children: [
|
|
2624
|
-
/* @__PURE__ */
|
|
2819
|
+
/* @__PURE__ */ jsx10(
|
|
2625
2820
|
"input",
|
|
2626
2821
|
{
|
|
2627
2822
|
ref: fileInputRef,
|
|
@@ -2644,25 +2839,51 @@ Upload.displayName = "Upload";
|
|
|
2644
2839
|
import * as React8 from "react";
|
|
2645
2840
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
2646
2841
|
import { cva as cva7 } from "class-variance-authority";
|
|
2647
|
-
import { jsx as
|
|
2842
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2648
2843
|
var checkboxVariants = cva7(
|
|
2649
2844
|
"peer size-4 shrink-0 rounded-[4px] border border-strong bg-light hover:bg-info-subtle transition-colors focus-visible:outline-none focus-visible:border-2 focus-visible:border-interactive disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-light [&_svg]:pointer-events-none [&_svg]:size-3 [&_svg]:shrink-0"
|
|
2650
2845
|
);
|
|
2651
|
-
var Checkbox = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
2846
|
+
var Checkbox = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
2652
2847
|
CheckboxPrimitive.Root,
|
|
2653
2848
|
{
|
|
2654
2849
|
ref,
|
|
2655
2850
|
className: cn(checkboxVariants(), className),
|
|
2656
2851
|
...props,
|
|
2657
|
-
children: /* @__PURE__ */
|
|
2852
|
+
children: /* @__PURE__ */ jsx11(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: /* @__PURE__ */ jsx11(CheckIcon, { variant: "light", className: "size-3" }) })
|
|
2658
2853
|
}
|
|
2659
2854
|
));
|
|
2660
2855
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
2661
2856
|
|
|
2662
|
-
// src/components/ui/
|
|
2857
|
+
// src/components/ui/textarea.tsx
|
|
2663
2858
|
import * as React9 from "react";
|
|
2859
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2860
|
+
var Textarea = React9.forwardRef(
|
|
2861
|
+
({ className, style, error, ...props }, ref) => {
|
|
2862
|
+
const tokenStyles = {
|
|
2863
|
+
font: "var(--typography-label-md-regular)",
|
|
2864
|
+
...style
|
|
2865
|
+
};
|
|
2866
|
+
return /* @__PURE__ */ jsx12(
|
|
2867
|
+
"textarea",
|
|
2868
|
+
{
|
|
2869
|
+
className: cn(
|
|
2870
|
+
"flex min-h-[80px] w-full rounded-md border bg-light text-dark px-3 pt-3 pb-2 placeholder:text-secondary focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 transition-colors resize-y",
|
|
2871
|
+
error ? "border-error focus-visible:border-2 focus-visible:border-error" : "border-secondary focus-visible:border-2 focus-visible:border-strong disabled:border-secondary",
|
|
2872
|
+
className
|
|
2873
|
+
),
|
|
2874
|
+
style: tokenStyles,
|
|
2875
|
+
ref,
|
|
2876
|
+
...props
|
|
2877
|
+
}
|
|
2878
|
+
);
|
|
2879
|
+
}
|
|
2880
|
+
);
|
|
2881
|
+
Textarea.displayName = "Textarea";
|
|
2882
|
+
|
|
2883
|
+
// src/components/ui/badge.tsx
|
|
2884
|
+
import * as React10 from "react";
|
|
2664
2885
|
import { cva as cva8 } from "class-variance-authority";
|
|
2665
|
-
import { jsx as
|
|
2886
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2666
2887
|
var badgeVariants = cva8(
|
|
2667
2888
|
"inline-flex items-center justify-center gap-1 whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
2668
2889
|
{
|
|
@@ -2685,7 +2906,7 @@ var badgeVariants = cva8(
|
|
|
2685
2906
|
function getBadgeTypographyStyles() {
|
|
2686
2907
|
return { font: "var(--typography-label-sm-bold)" };
|
|
2687
2908
|
}
|
|
2688
|
-
var Badge =
|
|
2909
|
+
var Badge = React10.forwardRef(
|
|
2689
2910
|
({ className, variant, style, ...props }, ref) => {
|
|
2690
2911
|
if (!variant) {
|
|
2691
2912
|
return null;
|
|
@@ -2695,7 +2916,7 @@ var Badge = React9.forwardRef(
|
|
|
2695
2916
|
...typographyStyles,
|
|
2696
2917
|
...style
|
|
2697
2918
|
};
|
|
2698
|
-
return /* @__PURE__ */
|
|
2919
|
+
return /* @__PURE__ */ jsx13(
|
|
2699
2920
|
"span",
|
|
2700
2921
|
{
|
|
2701
2922
|
className: cn(
|
|
@@ -2713,9 +2934,9 @@ var Badge = React9.forwardRef(
|
|
|
2713
2934
|
Badge.displayName = "Badge";
|
|
2714
2935
|
|
|
2715
2936
|
// src/components/ui/tabs.tsx
|
|
2716
|
-
import * as
|
|
2937
|
+
import * as React11 from "react";
|
|
2717
2938
|
import { cva as cva9 } from "class-variance-authority";
|
|
2718
|
-
import { jsx as
|
|
2939
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2719
2940
|
var tabsVariants = cva9(
|
|
2720
2941
|
"inline-flex items-center justify-start whitespace-nowrap transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-interactive focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-10",
|
|
2721
2942
|
{
|
|
@@ -2729,17 +2950,17 @@ var tabsVariants = cva9(
|
|
|
2729
2950
|
}
|
|
2730
2951
|
}
|
|
2731
2952
|
);
|
|
2732
|
-
var TabsContext =
|
|
2953
|
+
var TabsContext = React11.createContext(
|
|
2733
2954
|
void 0
|
|
2734
2955
|
);
|
|
2735
2956
|
function useTabsContext() {
|
|
2736
|
-
const context =
|
|
2957
|
+
const context = React11.useContext(TabsContext);
|
|
2737
2958
|
if (!context) {
|
|
2738
2959
|
throw new Error("Tabs components must be used within a Tabs provider");
|
|
2739
2960
|
}
|
|
2740
2961
|
return context;
|
|
2741
2962
|
}
|
|
2742
|
-
var Tabs =
|
|
2963
|
+
var Tabs = React11.forwardRef((props, ref) => {
|
|
2743
2964
|
const {
|
|
2744
2965
|
className,
|
|
2745
2966
|
value,
|
|
@@ -2748,7 +2969,7 @@ var Tabs = React10.forwardRef((props, ref) => {
|
|
|
2748
2969
|
children,
|
|
2749
2970
|
...restProps
|
|
2750
2971
|
} = props;
|
|
2751
|
-
const contextValue =
|
|
2972
|
+
const contextValue = React11.useMemo(
|
|
2752
2973
|
() => ({
|
|
2753
2974
|
activeTab: value,
|
|
2754
2975
|
setActiveTab: onValueChange,
|
|
@@ -2756,13 +2977,13 @@ var Tabs = React10.forwardRef((props, ref) => {
|
|
|
2756
2977
|
}),
|
|
2757
2978
|
[value, onValueChange, variant]
|
|
2758
2979
|
);
|
|
2759
|
-
return /* @__PURE__ */
|
|
2980
|
+
return /* @__PURE__ */ jsx14(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx14("div", { ref, className: cn("w-full", className), ...restProps, children }) });
|
|
2760
2981
|
});
|
|
2761
2982
|
Tabs.displayName = "Tabs";
|
|
2762
|
-
var TabsList =
|
|
2983
|
+
var TabsList = React11.forwardRef(
|
|
2763
2984
|
(props, ref) => {
|
|
2764
2985
|
const { className, children, ...restProps } = props;
|
|
2765
|
-
return /* @__PURE__ */
|
|
2986
|
+
return /* @__PURE__ */ jsx14(
|
|
2766
2987
|
"div",
|
|
2767
2988
|
{
|
|
2768
2989
|
ref,
|
|
@@ -2778,7 +2999,7 @@ TabsList.displayName = "TabsList";
|
|
|
2778
2999
|
var getTabTypographyStyles = (isActive) => ({
|
|
2779
3000
|
font: isActive ? "var(--typography-label-sm-bold)" : "var(--typography-label-sm-regular)"
|
|
2780
3001
|
});
|
|
2781
|
-
var TabsTrigger =
|
|
3002
|
+
var TabsTrigger = React11.forwardRef(
|
|
2782
3003
|
(props, ref) => {
|
|
2783
3004
|
const { className, value, disabled, style, children, ...restProps } = props;
|
|
2784
3005
|
const { activeTab, setActiveTab, variant } = useTabsContext();
|
|
@@ -2786,22 +3007,22 @@ var TabsTrigger = React10.forwardRef(
|
|
|
2786
3007
|
throw new Error("TabsTrigger must have a value prop");
|
|
2787
3008
|
}
|
|
2788
3009
|
const isActive = activeTab === value;
|
|
2789
|
-
const tokenStyles =
|
|
3010
|
+
const tokenStyles = React11.useMemo(
|
|
2790
3011
|
() => ({
|
|
2791
3012
|
...getTabTypographyStyles(isActive),
|
|
2792
3013
|
...style
|
|
2793
3014
|
}),
|
|
2794
3015
|
[isActive, style]
|
|
2795
3016
|
);
|
|
2796
|
-
const triggerClassName =
|
|
3017
|
+
const triggerClassName = React11.useMemo(
|
|
2797
3018
|
() => cn(tabsVariants({ variant }), className),
|
|
2798
3019
|
[variant, className]
|
|
2799
3020
|
);
|
|
2800
|
-
const handleClick =
|
|
3021
|
+
const handleClick = React11.useCallback(() => {
|
|
2801
3022
|
if (disabled) return;
|
|
2802
3023
|
setActiveTab(value);
|
|
2803
3024
|
}, [disabled, setActiveTab, value]);
|
|
2804
|
-
return /* @__PURE__ */
|
|
3025
|
+
return /* @__PURE__ */ jsx14(
|
|
2805
3026
|
"button",
|
|
2806
3027
|
{
|
|
2807
3028
|
ref,
|
|
@@ -2815,13 +3036,13 @@ var TabsTrigger = React10.forwardRef(
|
|
|
2815
3036
|
disabled,
|
|
2816
3037
|
onClick: handleClick,
|
|
2817
3038
|
...restProps,
|
|
2818
|
-
children: /* @__PURE__ */
|
|
3039
|
+
children: /* @__PURE__ */ jsx14("span", { className: "pl-3 pr-6 py-2", children })
|
|
2819
3040
|
}
|
|
2820
3041
|
);
|
|
2821
3042
|
}
|
|
2822
3043
|
);
|
|
2823
3044
|
TabsTrigger.displayName = "TabsTrigger";
|
|
2824
|
-
var TabsContent =
|
|
3045
|
+
var TabsContent = React11.forwardRef(
|
|
2825
3046
|
(props, ref) => {
|
|
2826
3047
|
const { className, value, children, ...restProps } = props;
|
|
2827
3048
|
const { activeTab } = useTabsContext();
|
|
@@ -2832,7 +3053,7 @@ var TabsContent = React10.forwardRef(
|
|
|
2832
3053
|
if (!isActive) {
|
|
2833
3054
|
return null;
|
|
2834
3055
|
}
|
|
2835
|
-
return /* @__PURE__ */
|
|
3056
|
+
return /* @__PURE__ */ jsx14(
|
|
2836
3057
|
"div",
|
|
2837
3058
|
{
|
|
2838
3059
|
ref,
|
|
@@ -2850,11 +3071,11 @@ var TabsContent = React10.forwardRef(
|
|
|
2850
3071
|
TabsContent.displayName = "TabsContent";
|
|
2851
3072
|
|
|
2852
3073
|
// src/components/ui/dropdown-menu.tsx
|
|
2853
|
-
import * as
|
|
3074
|
+
import * as React12 from "react";
|
|
2854
3075
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2855
|
-
import { jsx as
|
|
3076
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2856
3077
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
2857
|
-
var DropdownMenuTrigger =
|
|
3078
|
+
var DropdownMenuTrigger = React12.forwardRef(({ className, icon, children, ...props }, ref) => /* @__PURE__ */ jsxs9(
|
|
2858
3079
|
DropdownMenuPrimitive.Trigger,
|
|
2859
3080
|
{
|
|
2860
3081
|
ref,
|
|
@@ -2864,7 +3085,7 @@ var DropdownMenuTrigger = React11.forwardRef(({ className, icon, children, ...pr
|
|
|
2864
3085
|
),
|
|
2865
3086
|
...props,
|
|
2866
3087
|
children: [
|
|
2867
|
-
icon || /* @__PURE__ */
|
|
3088
|
+
icon || /* @__PURE__ */ jsx15(MoreMenu, { className: "size-4" }),
|
|
2868
3089
|
children
|
|
2869
3090
|
]
|
|
2870
3091
|
}
|
|
@@ -2874,7 +3095,7 @@ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
|
2874
3095
|
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
2875
3096
|
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
2876
3097
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
2877
|
-
var DropdownMenuSubTrigger =
|
|
3098
|
+
var DropdownMenuSubTrigger = React12.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs9(
|
|
2878
3099
|
DropdownMenuPrimitive.SubTrigger,
|
|
2879
3100
|
{
|
|
2880
3101
|
ref,
|
|
@@ -2887,12 +3108,12 @@ var DropdownMenuSubTrigger = React11.forwardRef(({ className, inset, children, .
|
|
|
2887
3108
|
...props,
|
|
2888
3109
|
children: [
|
|
2889
3110
|
children,
|
|
2890
|
-
/* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ jsx15(ChevronRight, { className: "ml-auto" })
|
|
2891
3112
|
]
|
|
2892
3113
|
}
|
|
2893
3114
|
));
|
|
2894
3115
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
2895
|
-
var DropdownMenuSubContent =
|
|
3116
|
+
var DropdownMenuSubContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
2896
3117
|
DropdownMenuPrimitive.SubContent,
|
|
2897
3118
|
{
|
|
2898
3119
|
ref,
|
|
@@ -2904,7 +3125,7 @@ var DropdownMenuSubContent = React11.forwardRef(({ className, ...props }, ref) =
|
|
|
2904
3125
|
}
|
|
2905
3126
|
));
|
|
2906
3127
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
2907
|
-
var DropdownMenuContent =
|
|
3128
|
+
var DropdownMenuContent = React12.forwardRef(({ className, sideOffset = 4, align = "end", ...props }, ref) => /* @__PURE__ */ jsx15(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx15(
|
|
2908
3129
|
DropdownMenuPrimitive.Content,
|
|
2909
3130
|
{
|
|
2910
3131
|
ref,
|
|
@@ -2918,7 +3139,7 @@ var DropdownMenuContent = React11.forwardRef(({ className, sideOffset = 4, align
|
|
|
2918
3139
|
}
|
|
2919
3140
|
) }));
|
|
2920
3141
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
2921
|
-
var DropdownMenuItem =
|
|
3142
|
+
var DropdownMenuItem = React12.forwardRef(({ className, inset, style, ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
2922
3143
|
DropdownMenuPrimitive.Item,
|
|
2923
3144
|
{
|
|
2924
3145
|
ref,
|
|
@@ -2935,7 +3156,7 @@ var DropdownMenuItem = React11.forwardRef(({ className, inset, style, ...props }
|
|
|
2935
3156
|
}
|
|
2936
3157
|
));
|
|
2937
3158
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
2938
|
-
var DropdownMenuCheckboxItem =
|
|
3159
|
+
var DropdownMenuCheckboxItem = React12.forwardRef(({ className, children, style, checked, ...props }, ref) => /* @__PURE__ */ jsxs9(
|
|
2939
3160
|
DropdownMenuPrimitive.CheckboxItem,
|
|
2940
3161
|
{
|
|
2941
3162
|
ref,
|
|
@@ -2950,7 +3171,7 @@ var DropdownMenuCheckboxItem = React11.forwardRef(({ className, children, style,
|
|
|
2950
3171
|
},
|
|
2951
3172
|
...props,
|
|
2952
3173
|
children: [
|
|
2953
|
-
/* @__PURE__ */
|
|
3174
|
+
/* @__PURE__ */ jsx15(
|
|
2954
3175
|
Checkbox,
|
|
2955
3176
|
{
|
|
2956
3177
|
checked: checked === true,
|
|
@@ -2958,12 +3179,12 @@ var DropdownMenuCheckboxItem = React11.forwardRef(({ className, children, style,
|
|
|
2958
3179
|
"aria-hidden": "true"
|
|
2959
3180
|
}
|
|
2960
3181
|
),
|
|
2961
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ jsx15("span", { className: "flex-1", children })
|
|
2962
3183
|
]
|
|
2963
3184
|
}
|
|
2964
3185
|
));
|
|
2965
3186
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
2966
|
-
var DropdownMenuRadioItem =
|
|
3187
|
+
var DropdownMenuRadioItem = React12.forwardRef(({ className, children, style, ...props }, ref) => /* @__PURE__ */ jsxs9(
|
|
2967
3188
|
DropdownMenuPrimitive.RadioItem,
|
|
2968
3189
|
{
|
|
2969
3190
|
ref,
|
|
@@ -2977,13 +3198,13 @@ var DropdownMenuRadioItem = React11.forwardRef(({ className, children, style, ..
|
|
|
2977
3198
|
},
|
|
2978
3199
|
...props,
|
|
2979
3200
|
children: [
|
|
2980
|
-
/* @__PURE__ */
|
|
3201
|
+
/* @__PURE__ */ jsx15("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx15(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx15("span", { className: "h-2 w-2 rounded-full bg-current" }) }) }),
|
|
2981
3202
|
children
|
|
2982
3203
|
]
|
|
2983
3204
|
}
|
|
2984
3205
|
));
|
|
2985
3206
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
2986
|
-
var DropdownMenuLabel =
|
|
3207
|
+
var DropdownMenuLabel = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
2987
3208
|
DropdownMenuPrimitive.Label,
|
|
2988
3209
|
{
|
|
2989
3210
|
ref,
|
|
@@ -2996,7 +3217,7 @@ var DropdownMenuLabel = React11.forwardRef(({ className, inset, ...props }, ref)
|
|
|
2996
3217
|
}
|
|
2997
3218
|
));
|
|
2998
3219
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
2999
|
-
var DropdownMenuSeparator =
|
|
3220
|
+
var DropdownMenuSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
3000
3221
|
DropdownMenuPrimitive.Separator,
|
|
3001
3222
|
{
|
|
3002
3223
|
ref,
|
|
@@ -3009,7 +3230,7 @@ var DropdownMenuShortcut = ({
|
|
|
3009
3230
|
className,
|
|
3010
3231
|
...props
|
|
3011
3232
|
}) => {
|
|
3012
|
-
return /* @__PURE__ */
|
|
3233
|
+
return /* @__PURE__ */ jsx15(
|
|
3013
3234
|
"span",
|
|
3014
3235
|
{
|
|
3015
3236
|
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
@@ -3018,20 +3239,828 @@ var DropdownMenuShortcut = ({
|
|
|
3018
3239
|
);
|
|
3019
3240
|
};
|
|
3020
3241
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
3242
|
+
|
|
3243
|
+
// src/components/ui/charts/chart-legend.tsx
|
|
3244
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3245
|
+
function ChartLegend({
|
|
3246
|
+
items,
|
|
3247
|
+
x = 0,
|
|
3248
|
+
y = 550,
|
|
3249
|
+
className = ""
|
|
3250
|
+
}) {
|
|
3251
|
+
return /* @__PURE__ */ jsx16("foreignObject", { x, y, width: "100%", height: "40", children: /* @__PURE__ */ jsx16(
|
|
3252
|
+
"div",
|
|
3253
|
+
{
|
|
3254
|
+
className: `flex justify-center items-center gap-6 ${className}`,
|
|
3255
|
+
style: { height: "100%" },
|
|
3256
|
+
children: items.map(({ key, color, label }) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
3257
|
+
/* @__PURE__ */ jsx16("div", { className: "w-3 h-3", style: { backgroundColor: color } }),
|
|
3258
|
+
/* @__PURE__ */ jsx16(Typography, { variant: "body-xs", children: label || key })
|
|
3259
|
+
] }, key))
|
|
3260
|
+
}
|
|
3261
|
+
) });
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
// src/lib/chart-utils.ts
|
|
3265
|
+
var CHART_COLORS = {
|
|
3266
|
+
// Status colors
|
|
3267
|
+
SUCCESS: "var(--color-success)",
|
|
3268
|
+
ERROR: "var(--color-error)",
|
|
3269
|
+
WARNING: "var(--color-warning)",
|
|
3270
|
+
SECONDARY: "var(--color-secondary)",
|
|
3271
|
+
// Primary brand colors
|
|
3272
|
+
PRIMARY: "var(--color-primary)",
|
|
3273
|
+
// Categorical palette from altitude-tokens
|
|
3274
|
+
CATEGORICAL: [
|
|
3275
|
+
"var(--color-chart-color-palette-categorical-1)",
|
|
3276
|
+
"var(--color-chart-color-palette-categorical-2)",
|
|
3277
|
+
"var(--color-chart-color-palette-categorical-3)",
|
|
3278
|
+
"var(--color-chart-color-palette-categorical-4)",
|
|
3279
|
+
"var(--color-chart-color-palette-categorical-5)"
|
|
3280
|
+
],
|
|
3281
|
+
// Performance palette from altitude-tokens
|
|
3282
|
+
PERFORMANCE: [
|
|
3283
|
+
"var(--color-chart-color-palette-performance-1)",
|
|
3284
|
+
"var(--color-chart-color-palette-performance-2)",
|
|
3285
|
+
"var(--color-chart-color-palette-performance-3)",
|
|
3286
|
+
"var(--color-chart-color-palette-performance-4)",
|
|
3287
|
+
"var(--color-chart-color-palette-performance-5)"
|
|
3288
|
+
],
|
|
3289
|
+
// Heatmap palette from altitude-tokens
|
|
3290
|
+
HEATMAP: [
|
|
3291
|
+
"var(--color-chart-color-palette-heatmap-1)",
|
|
3292
|
+
"var(--color-chart-color-palette-heatmap-2)",
|
|
3293
|
+
"var(--color-chart-color-palette-heatmap-3)",
|
|
3294
|
+
"var(--color-chart-color-palette-heatmap-4)",
|
|
3295
|
+
"var(--color-chart-color-palette-heatmap-5)"
|
|
3296
|
+
]
|
|
3297
|
+
};
|
|
3298
|
+
var COLOR_SCHEMES = {
|
|
3299
|
+
passFail: {
|
|
3300
|
+
PASS: CHART_COLORS.SUCCESS,
|
|
3301
|
+
FAIL: CHART_COLORS.ERROR
|
|
3302
|
+
},
|
|
3303
|
+
targetVsAchieved: {
|
|
3304
|
+
TARGET: CHART_COLORS.SECONDARY,
|
|
3305
|
+
ACHIEVED: CHART_COLORS.SUCCESS
|
|
3306
|
+
},
|
|
3307
|
+
performance: {
|
|
3308
|
+
HIGH: CHART_COLORS.PERFORMANCE[0],
|
|
3309
|
+
MEDIUM_HIGH: CHART_COLORS.PERFORMANCE[1],
|
|
3310
|
+
MEDIUM: CHART_COLORS.PERFORMANCE[2],
|
|
3311
|
+
MEDIUM_LOW: CHART_COLORS.PERFORMANCE[3],
|
|
3312
|
+
LOW: CHART_COLORS.PERFORMANCE[4]
|
|
3313
|
+
}
|
|
3314
|
+
};
|
|
3315
|
+
var CHART_CONSTANTS = {
|
|
3316
|
+
// Standard chart dimensions
|
|
3317
|
+
STANDARD_HEIGHT: 400,
|
|
3318
|
+
LARGE_HEIGHT: 500,
|
|
3319
|
+
SMALL_HEIGHT: 300,
|
|
3320
|
+
// Chart margins
|
|
3321
|
+
MARGIN: {
|
|
3322
|
+
top: 20,
|
|
3323
|
+
right: 30,
|
|
3324
|
+
left: 20,
|
|
3325
|
+
bottom: 5
|
|
3326
|
+
},
|
|
3327
|
+
// Axis dimensions
|
|
3328
|
+
AXIS_HEIGHT_STANDARD: 30,
|
|
3329
|
+
AXIS_HEIGHT_ROTATED: 60,
|
|
3330
|
+
AXIS_WIDTH_STANDARD: 60,
|
|
3331
|
+
AXIS_WIDTH_YAXIS: 80,
|
|
3332
|
+
// Pie chart constants
|
|
3333
|
+
PIE_CHART_CENTER_X: 300,
|
|
3334
|
+
PIE_CHART_CENTER_Y: 200
|
|
3335
|
+
};
|
|
3336
|
+
var getSeriesColor = (index) => {
|
|
3337
|
+
return CHART_COLORS.CATEGORICAL[index % CHART_COLORS.CATEGORICAL.length] || CHART_COLORS.PRIMARY;
|
|
3338
|
+
};
|
|
3339
|
+
var getPerformanceColor = (index) => {
|
|
3340
|
+
return CHART_COLORS.PERFORMANCE[index % CHART_COLORS.PERFORMANCE.length] || CHART_COLORS.PRIMARY;
|
|
3341
|
+
};
|
|
3342
|
+
var getHeatmapColor = (index) => {
|
|
3343
|
+
return CHART_COLORS.HEATMAP[index % CHART_COLORS.HEATMAP.length] || CHART_COLORS.PRIMARY;
|
|
3344
|
+
};
|
|
3345
|
+
var createLegendItems = (colorScheme) => {
|
|
3346
|
+
return Object.entries(colorScheme).map(([key, color]) => ({
|
|
3347
|
+
key,
|
|
3348
|
+
color,
|
|
3349
|
+
label: key
|
|
3350
|
+
}));
|
|
3351
|
+
};
|
|
3352
|
+
var calculateYAxisWidth = (data, yAxisKey) => {
|
|
3353
|
+
if (!data || data.length === 0) return CHART_CONSTANTS.AXIS_WIDTH_YAXIS;
|
|
3354
|
+
const maxLength = Math.max(
|
|
3355
|
+
...data.map((item) => {
|
|
3356
|
+
const value = item[yAxisKey];
|
|
3357
|
+
return String(value || "").length;
|
|
3358
|
+
})
|
|
3359
|
+
);
|
|
3360
|
+
return Math.max(maxLength * 8 + 20, CHART_CONSTANTS.AXIS_WIDTH_YAXIS);
|
|
3361
|
+
};
|
|
3362
|
+
var formatPercentage = (value, decimals = 1) => {
|
|
3363
|
+
return `${(value * 100).toFixed(decimals)}%`;
|
|
3364
|
+
};
|
|
3365
|
+
var formatLargeNumber = (value) => {
|
|
3366
|
+
if (value >= 1e6) {
|
|
3367
|
+
return `${(value / 1e6).toFixed(1)}M`;
|
|
3368
|
+
}
|
|
3369
|
+
if (value >= 1e3) {
|
|
3370
|
+
return `${(value / 1e3).toFixed(1)}K`;
|
|
3371
|
+
}
|
|
3372
|
+
return value.toString();
|
|
3373
|
+
};
|
|
3374
|
+
|
|
3375
|
+
// src/components/ui/charts/chart-labels.tsx
|
|
3376
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3377
|
+
var createCustomXAxisLabel = (text, yOffset = 40) => {
|
|
3378
|
+
const CustomXAxisLabel = ({ viewBox }) => {
|
|
3379
|
+
if (!viewBox) return null;
|
|
3380
|
+
const { x, y, width } = viewBox;
|
|
3381
|
+
return /* @__PURE__ */ jsx17("g", { children: /* @__PURE__ */ jsx17("foreignObject", { x, y: y + yOffset, width, height: 20, children: /* @__PURE__ */ jsx17("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ jsx17(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
|
|
3382
|
+
};
|
|
3383
|
+
CustomXAxisLabel.displayName = "CustomXAxisLabel";
|
|
3384
|
+
return CustomXAxisLabel;
|
|
3385
|
+
};
|
|
3386
|
+
var createCustomYAxisLabel = (text, leftMargin) => {
|
|
3387
|
+
const CustomYAxisLabel = ({ viewBox }) => {
|
|
3388
|
+
if (!viewBox) return null;
|
|
3389
|
+
const { x, y, height } = viewBox;
|
|
3390
|
+
const offset = leftMargin ? leftMargin + 10 : 110;
|
|
3391
|
+
return /* @__PURE__ */ jsx17("g", { children: /* @__PURE__ */ jsx17("foreignObject", { x: x - offset, y, width: 100, height, children: /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center h-full transform -rotate-90 whitespace-nowrap", children: /* @__PURE__ */ jsx17(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
|
|
3392
|
+
};
|
|
3393
|
+
CustomYAxisLabel.displayName = "CustomYAxisLabel";
|
|
3394
|
+
return CustomYAxisLabel;
|
|
3395
|
+
};
|
|
3396
|
+
var createCustomYAxisRightLabel = (text) => {
|
|
3397
|
+
const CustomYAxisRightLabel = ({ viewBox }) => {
|
|
3398
|
+
if (!viewBox) return null;
|
|
3399
|
+
const { x, y, width, height } = viewBox;
|
|
3400
|
+
return /* @__PURE__ */ jsx17("g", { children: /* @__PURE__ */ jsx17("foreignObject", { x: x + width - 70, y, width: 120, height, children: /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center h-full transform rotate-90 whitespace-nowrap", children: /* @__PURE__ */ jsx17(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
|
|
3401
|
+
};
|
|
3402
|
+
CustomYAxisRightLabel.displayName = "CustomYAxisRightLabel";
|
|
3403
|
+
return CustomYAxisRightLabel;
|
|
3404
|
+
};
|
|
3405
|
+
var customXAxisTick = (props) => {
|
|
3406
|
+
const { x, y, payload } = props;
|
|
3407
|
+
return /* @__PURE__ */ jsx17("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ jsx17(
|
|
3408
|
+
"foreignObject",
|
|
3409
|
+
{
|
|
3410
|
+
x: -20,
|
|
3411
|
+
y: 5,
|
|
3412
|
+
width: 40,
|
|
3413
|
+
height: 20,
|
|
3414
|
+
style: { overflow: "visible" },
|
|
3415
|
+
children: /* @__PURE__ */ jsx17(
|
|
3416
|
+
"div",
|
|
3417
|
+
{
|
|
3418
|
+
className: "flex items-start justify-center h-full",
|
|
3419
|
+
style: { overflow: "visible" },
|
|
3420
|
+
children: /* @__PURE__ */ jsx17(
|
|
3421
|
+
Typography,
|
|
3422
|
+
{
|
|
3423
|
+
variant: "body-xs",
|
|
3424
|
+
className: "text-secondary whitespace-nowrap",
|
|
3425
|
+
children: payload.value
|
|
3426
|
+
}
|
|
3427
|
+
)
|
|
3428
|
+
}
|
|
3429
|
+
)
|
|
3430
|
+
}
|
|
3431
|
+
) });
|
|
3432
|
+
};
|
|
3433
|
+
var customXAxisTickRotated = (props) => {
|
|
3434
|
+
const { x, y, payload } = props;
|
|
3435
|
+
return /* @__PURE__ */ jsx17("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ jsx17(
|
|
3436
|
+
"text",
|
|
3437
|
+
{
|
|
3438
|
+
x: 0,
|
|
3439
|
+
y: 0,
|
|
3440
|
+
dy: 10,
|
|
3441
|
+
textAnchor: "end",
|
|
3442
|
+
fill: "currentColor",
|
|
3443
|
+
transform: "rotate(-45)",
|
|
3444
|
+
className: "text-secondary",
|
|
3445
|
+
style: { fontSize: "12px" },
|
|
3446
|
+
children: payload.value
|
|
3447
|
+
}
|
|
3448
|
+
) });
|
|
3449
|
+
};
|
|
3450
|
+
var customYAxisTick = (props) => {
|
|
3451
|
+
const { x, y, payload } = props;
|
|
3452
|
+
const text = String(payload.value);
|
|
3453
|
+
const estimatedWidth = Math.max(text.length * 8, 80);
|
|
3454
|
+
return /* @__PURE__ */ jsx17(
|
|
3455
|
+
"foreignObject",
|
|
3456
|
+
{
|
|
3457
|
+
x: x - estimatedWidth + 5,
|
|
3458
|
+
y: y - 6,
|
|
3459
|
+
width: estimatedWidth,
|
|
3460
|
+
height: 15,
|
|
3461
|
+
children: /* @__PURE__ */ jsx17("div", { className: "flex justify-end w-full", children: /* @__PURE__ */ jsx17(Typography, { variant: "body-xs", className: "text-secondary", children: payload.value }) })
|
|
3462
|
+
}
|
|
3463
|
+
);
|
|
3464
|
+
};
|
|
3465
|
+
|
|
3466
|
+
// src/components/ui/charts/chart-tooltip.tsx
|
|
3467
|
+
import { Fragment, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3468
|
+
function TooltipContainer({
|
|
3469
|
+
children,
|
|
3470
|
+
className = ""
|
|
3471
|
+
}) {
|
|
3472
|
+
return /* @__PURE__ */ jsx18(
|
|
3473
|
+
"div",
|
|
3474
|
+
{
|
|
3475
|
+
className: `bg-light border border-subtle rounded p-2.5 text-dark ${className}`,
|
|
3476
|
+
children
|
|
3477
|
+
}
|
|
3478
|
+
);
|
|
3479
|
+
}
|
|
3480
|
+
function TooltipItem({
|
|
3481
|
+
color,
|
|
3482
|
+
label,
|
|
3483
|
+
value,
|
|
3484
|
+
className = ""
|
|
3485
|
+
}) {
|
|
3486
|
+
return /* @__PURE__ */ jsxs11(Fragment, { children: [
|
|
3487
|
+
/* @__PURE__ */ jsx18("br", {}),
|
|
3488
|
+
/* @__PURE__ */ jsxs11(Typography, { variant: "label-sm", className, children: [
|
|
3489
|
+
/* @__PURE__ */ jsx18(
|
|
3490
|
+
"span",
|
|
3491
|
+
{
|
|
3492
|
+
className: "inline-block w-3 h-3 mr-1.5",
|
|
3493
|
+
style: { backgroundColor: color }
|
|
3494
|
+
}
|
|
3495
|
+
),
|
|
3496
|
+
label,
|
|
3497
|
+
": ",
|
|
3498
|
+
value
|
|
3499
|
+
] })
|
|
3500
|
+
] });
|
|
3501
|
+
}
|
|
3502
|
+
function GenericTooltip({
|
|
3503
|
+
title,
|
|
3504
|
+
items,
|
|
3505
|
+
className = ""
|
|
3506
|
+
}) {
|
|
3507
|
+
return /* @__PURE__ */ jsxs11(TooltipContainer, { className, children: [
|
|
3508
|
+
title && /* @__PURE__ */ jsx18(Typography, { variant: "label-sm-bold", children: title }),
|
|
3509
|
+
items.map((item, index) => /* @__PURE__ */ jsx18(
|
|
3510
|
+
TooltipItem,
|
|
3511
|
+
{
|
|
3512
|
+
color: item.color,
|
|
3513
|
+
label: item.label,
|
|
3514
|
+
value: item.value
|
|
3515
|
+
},
|
|
3516
|
+
index
|
|
3517
|
+
))
|
|
3518
|
+
] });
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
// src/components/ui/charts/bar-chart.tsx
|
|
3522
|
+
import { forwardRef as forwardRef13 } from "react";
|
|
3523
|
+
import {
|
|
3524
|
+
BarChart as RechartsBarChart,
|
|
3525
|
+
Bar,
|
|
3526
|
+
XAxis,
|
|
3527
|
+
YAxis,
|
|
3528
|
+
Tooltip,
|
|
3529
|
+
ResponsiveContainer
|
|
3530
|
+
} from "recharts";
|
|
3531
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3532
|
+
var BarChart = forwardRef13(
|
|
3533
|
+
({
|
|
3534
|
+
data,
|
|
3535
|
+
xAxisKey,
|
|
3536
|
+
yAxisKey,
|
|
3537
|
+
title,
|
|
3538
|
+
xAxisLabel,
|
|
3539
|
+
yAxisLabel,
|
|
3540
|
+
barColor = CHART_COLORS.PRIMARY,
|
|
3541
|
+
className = "",
|
|
3542
|
+
rotateXAxisLabels = false,
|
|
3543
|
+
showLegend = false,
|
|
3544
|
+
legendItems = [],
|
|
3545
|
+
onDataPointClick,
|
|
3546
|
+
layout = "horizontal",
|
|
3547
|
+
xAxisType = "category",
|
|
3548
|
+
yAxisType = "number",
|
|
3549
|
+
barDataKey
|
|
3550
|
+
}, ref) => {
|
|
3551
|
+
const handleClick = (data2) => {
|
|
3552
|
+
if (onDataPointClick && data2 && typeof data2 === "object") {
|
|
3553
|
+
onDataPointClick(data2);
|
|
3554
|
+
}
|
|
3555
|
+
};
|
|
3556
|
+
const defaultLegendItems = showLegend && legendItems.length === 0 ? [{ key: yAxisKey, color: barColor, label: yAxisKey }] : legendItems;
|
|
3557
|
+
const hasData = data && data.length > 0;
|
|
3558
|
+
return /* @__PURE__ */ jsxs12(
|
|
3559
|
+
"div",
|
|
3560
|
+
{
|
|
3561
|
+
ref,
|
|
3562
|
+
className: `bg-light border border-subtle mx-6 ${className}`,
|
|
3563
|
+
children: [
|
|
3564
|
+
/* @__PURE__ */ jsx19("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx19(Typography, { variant: "label-sm-bold", children: title }) }),
|
|
3565
|
+
/* @__PURE__ */ jsx19("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx19(
|
|
3566
|
+
ResponsiveContainer,
|
|
3567
|
+
{
|
|
3568
|
+
width: "100%",
|
|
3569
|
+
height: CHART_CONSTANTS.STANDARD_HEIGHT,
|
|
3570
|
+
children: /* @__PURE__ */ jsxs12(
|
|
3571
|
+
RechartsBarChart,
|
|
3572
|
+
{
|
|
3573
|
+
data,
|
|
3574
|
+
margin: {
|
|
3575
|
+
...CHART_CONSTANTS.MARGIN,
|
|
3576
|
+
left: 24,
|
|
3577
|
+
bottom: rotateXAxisLabels ? 60 : 50
|
|
3578
|
+
},
|
|
3579
|
+
onClick: handleClick,
|
|
3580
|
+
layout,
|
|
3581
|
+
children: [
|
|
3582
|
+
/* @__PURE__ */ jsx19(
|
|
3583
|
+
XAxis,
|
|
3584
|
+
{
|
|
3585
|
+
dataKey: xAxisKey,
|
|
3586
|
+
type: xAxisType,
|
|
3587
|
+
axisLine: false,
|
|
3588
|
+
tickLine: false,
|
|
3589
|
+
tick: rotateXAxisLabels ? customXAxisTickRotated : customXAxisTick,
|
|
3590
|
+
interval: 0,
|
|
3591
|
+
height: rotateXAxisLabels ? CHART_CONSTANTS.AXIS_HEIGHT_ROTATED : CHART_CONSTANTS.AXIS_HEIGHT_STANDARD,
|
|
3592
|
+
width: CHART_CONSTANTS.AXIS_WIDTH_STANDARD,
|
|
3593
|
+
label: xAxisLabel ? createCustomXAxisLabel(xAxisLabel, 80) : void 0
|
|
3594
|
+
}
|
|
3595
|
+
),
|
|
3596
|
+
/* @__PURE__ */ jsx19(
|
|
3597
|
+
YAxis,
|
|
3598
|
+
{
|
|
3599
|
+
axisLine: false,
|
|
3600
|
+
tickLine: false,
|
|
3601
|
+
tick: customYAxisTick,
|
|
3602
|
+
label: yAxisLabel ? createCustomYAxisLabel(yAxisLabel, 40) : void 0,
|
|
3603
|
+
dataKey: yAxisKey,
|
|
3604
|
+
type: yAxisType
|
|
3605
|
+
}
|
|
3606
|
+
),
|
|
3607
|
+
/* @__PURE__ */ jsx19(
|
|
3608
|
+
Tooltip,
|
|
3609
|
+
{
|
|
3610
|
+
content: ({
|
|
3611
|
+
active,
|
|
3612
|
+
payload,
|
|
3613
|
+
label
|
|
3614
|
+
}) => {
|
|
3615
|
+
if (active && payload && payload.length) {
|
|
3616
|
+
return /* @__PURE__ */ jsx19(
|
|
3617
|
+
GenericTooltip,
|
|
3618
|
+
{
|
|
3619
|
+
title: label?.toString(),
|
|
3620
|
+
items: payload.map((entry) => ({
|
|
3621
|
+
color: entry.color || barColor,
|
|
3622
|
+
label: entry.name || yAxisKey,
|
|
3623
|
+
value: entry.value || 0
|
|
3624
|
+
}))
|
|
3625
|
+
}
|
|
3626
|
+
);
|
|
3627
|
+
}
|
|
3628
|
+
return null;
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
),
|
|
3632
|
+
/* @__PURE__ */ jsx19(
|
|
3633
|
+
Bar,
|
|
3634
|
+
{
|
|
3635
|
+
dataKey: barDataKey || yAxisKey,
|
|
3636
|
+
fill: barColor,
|
|
3637
|
+
name: barDataKey || yAxisKey
|
|
3638
|
+
}
|
|
3639
|
+
),
|
|
3640
|
+
showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx19(ChartLegend, { items: defaultLegendItems })
|
|
3641
|
+
]
|
|
3642
|
+
}
|
|
3643
|
+
)
|
|
3644
|
+
}
|
|
3645
|
+
) : /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx19(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
|
|
3646
|
+
]
|
|
3647
|
+
}
|
|
3648
|
+
);
|
|
3649
|
+
}
|
|
3650
|
+
);
|
|
3651
|
+
BarChart.displayName = "BarChart";
|
|
3652
|
+
|
|
3653
|
+
// src/components/ui/charts/line-chart.tsx
|
|
3654
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
3655
|
+
import {
|
|
3656
|
+
LineChart as RechartsLineChart,
|
|
3657
|
+
Line,
|
|
3658
|
+
XAxis as XAxis2,
|
|
3659
|
+
YAxis as YAxis2,
|
|
3660
|
+
Tooltip as Tooltip2,
|
|
3661
|
+
ResponsiveContainer as ResponsiveContainer2
|
|
3662
|
+
} from "recharts";
|
|
3663
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3664
|
+
var LineChart = forwardRef14(
|
|
3665
|
+
({
|
|
3666
|
+
data,
|
|
3667
|
+
xAxisKey,
|
|
3668
|
+
series,
|
|
3669
|
+
title,
|
|
3670
|
+
xAxisLabel,
|
|
3671
|
+
yAxisLabel,
|
|
3672
|
+
onDataPointClick,
|
|
3673
|
+
className = "",
|
|
3674
|
+
showLegend = true,
|
|
3675
|
+
legendItems = []
|
|
3676
|
+
}, ref) => {
|
|
3677
|
+
const handleClick = (data2) => {
|
|
3678
|
+
if (onDataPointClick && data2 && typeof data2 === "object") {
|
|
3679
|
+
onDataPointClick(data2);
|
|
3680
|
+
}
|
|
3681
|
+
};
|
|
3682
|
+
const defaultLegendItems = legendItems.length > 0 ? legendItems : createLegendItems(
|
|
3683
|
+
series.reduce(
|
|
3684
|
+
(acc, s, index) => ({
|
|
3685
|
+
...acc,
|
|
3686
|
+
[s.dataKey]: s.color || getSeriesColor(index)
|
|
3687
|
+
}),
|
|
3688
|
+
{}
|
|
3689
|
+
)
|
|
3690
|
+
);
|
|
3691
|
+
const hasData = data && data.length > 0;
|
|
3692
|
+
return /* @__PURE__ */ jsxs13(
|
|
3693
|
+
"div",
|
|
3694
|
+
{
|
|
3695
|
+
ref,
|
|
3696
|
+
className: `bg-light border border-subtle mx-6 ${className}`,
|
|
3697
|
+
children: [
|
|
3698
|
+
/* @__PURE__ */ jsx20("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx20(Typography, { variant: "label-sm-bold", children: title }) }),
|
|
3699
|
+
/* @__PURE__ */ jsx20("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx20(
|
|
3700
|
+
ResponsiveContainer2,
|
|
3701
|
+
{
|
|
3702
|
+
width: "100%",
|
|
3703
|
+
height: CHART_CONSTANTS.STANDARD_HEIGHT,
|
|
3704
|
+
children: /* @__PURE__ */ jsxs13(
|
|
3705
|
+
RechartsLineChart,
|
|
3706
|
+
{
|
|
3707
|
+
data,
|
|
3708
|
+
margin: {
|
|
3709
|
+
...CHART_CONSTANTS.MARGIN,
|
|
3710
|
+
left: 24,
|
|
3711
|
+
bottom: 50
|
|
3712
|
+
},
|
|
3713
|
+
onClick: handleClick,
|
|
3714
|
+
children: [
|
|
3715
|
+
/* @__PURE__ */ jsx20(
|
|
3716
|
+
XAxis2,
|
|
3717
|
+
{
|
|
3718
|
+
dataKey: xAxisKey,
|
|
3719
|
+
axisLine: false,
|
|
3720
|
+
tickLine: false,
|
|
3721
|
+
tick: customXAxisTick,
|
|
3722
|
+
interval: 0,
|
|
3723
|
+
height: CHART_CONSTANTS.AXIS_HEIGHT_STANDARD,
|
|
3724
|
+
label: xAxisLabel ? createCustomXAxisLabel(xAxisLabel) : void 0
|
|
3725
|
+
}
|
|
3726
|
+
),
|
|
3727
|
+
/* @__PURE__ */ jsx20(
|
|
3728
|
+
YAxis2,
|
|
3729
|
+
{
|
|
3730
|
+
axisLine: false,
|
|
3731
|
+
tickLine: false,
|
|
3732
|
+
tick: customYAxisTick,
|
|
3733
|
+
label: yAxisLabel ? createCustomYAxisLabel(yAxisLabel, 40) : void 0
|
|
3734
|
+
}
|
|
3735
|
+
),
|
|
3736
|
+
/* @__PURE__ */ jsx20(
|
|
3737
|
+
Tooltip2,
|
|
3738
|
+
{
|
|
3739
|
+
content: ({
|
|
3740
|
+
active,
|
|
3741
|
+
payload,
|
|
3742
|
+
label
|
|
3743
|
+
}) => {
|
|
3744
|
+
if (active && payload && payload.length) {
|
|
3745
|
+
return /* @__PURE__ */ jsx20(
|
|
3746
|
+
GenericTooltip,
|
|
3747
|
+
{
|
|
3748
|
+
title: label?.toString(),
|
|
3749
|
+
items: payload.map((entry) => ({
|
|
3750
|
+
color: entry.color || CHART_COLORS.PRIMARY,
|
|
3751
|
+
label: entry.name || entry.dataKey || "",
|
|
3752
|
+
value: entry.value || 0
|
|
3753
|
+
}))
|
|
3754
|
+
}
|
|
3755
|
+
);
|
|
3756
|
+
}
|
|
3757
|
+
return null;
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
),
|
|
3761
|
+
series.map((s, index) => /* @__PURE__ */ jsx20(
|
|
3762
|
+
Line,
|
|
3763
|
+
{
|
|
3764
|
+
type: "monotone",
|
|
3765
|
+
dataKey: s.dataKey,
|
|
3766
|
+
stroke: s.color || getSeriesColor(index),
|
|
3767
|
+
strokeWidth: s.strokeWidth || 2,
|
|
3768
|
+
dot: s.dot !== false ? { r: 4 } : false,
|
|
3769
|
+
activeDot: s.activeDot !== false ? { r: 6 } : false
|
|
3770
|
+
},
|
|
3771
|
+
s.dataKey
|
|
3772
|
+
)),
|
|
3773
|
+
showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx20(ChartLegend, { items: defaultLegendItems })
|
|
3774
|
+
]
|
|
3775
|
+
}
|
|
3776
|
+
)
|
|
3777
|
+
}
|
|
3778
|
+
) : /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx20(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
|
|
3779
|
+
]
|
|
3780
|
+
}
|
|
3781
|
+
);
|
|
3782
|
+
}
|
|
3783
|
+
);
|
|
3784
|
+
LineChart.displayName = "LineChart";
|
|
3785
|
+
|
|
3786
|
+
// src/components/ui/charts/pie-chart.tsx
|
|
3787
|
+
import { forwardRef as forwardRef15 } from "react";
|
|
3788
|
+
import { PieChart as RechartsPieChart, Pie, Cell, Tooltip as Tooltip3 } from "recharts";
|
|
3789
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3790
|
+
var PieChart = forwardRef15(
|
|
3791
|
+
({
|
|
3792
|
+
data,
|
|
3793
|
+
title,
|
|
3794
|
+
onDataPointClick,
|
|
3795
|
+
className = "",
|
|
3796
|
+
showLegend = true,
|
|
3797
|
+
legendItems = [],
|
|
3798
|
+
innerRadius = "40%",
|
|
3799
|
+
outerRadius = "70%",
|
|
3800
|
+
showLabels = true
|
|
3801
|
+
}, ref) => {
|
|
3802
|
+
const handleClick = (data2) => {
|
|
3803
|
+
if (onDataPointClick && data2 && typeof data2 === "object") {
|
|
3804
|
+
onDataPointClick(data2);
|
|
3805
|
+
}
|
|
3806
|
+
};
|
|
3807
|
+
const defaultLegendItems = legendItems.length > 0 ? legendItems : createLegendItems(
|
|
3808
|
+
data.reduce(
|
|
3809
|
+
(acc, item, index) => ({
|
|
3810
|
+
...acc,
|
|
3811
|
+
[item.name]: item.color || getSeriesColor(index)
|
|
3812
|
+
}),
|
|
3813
|
+
{}
|
|
3814
|
+
)
|
|
3815
|
+
);
|
|
3816
|
+
const hasData = data && data.length > 0;
|
|
3817
|
+
return /* @__PURE__ */ jsxs14(
|
|
3818
|
+
"div",
|
|
3819
|
+
{
|
|
3820
|
+
ref,
|
|
3821
|
+
className: `bg-light border border-subtle mx-6 ${className}`,
|
|
3822
|
+
children: [
|
|
3823
|
+
/* @__PURE__ */ jsx21("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx21(Typography, { variant: "label-sm-bold", children: title }) }),
|
|
3824
|
+
/* @__PURE__ */ jsx21("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx21("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs14(
|
|
3825
|
+
RechartsPieChart,
|
|
3826
|
+
{
|
|
3827
|
+
width: 600,
|
|
3828
|
+
height: CHART_CONSTANTS.LARGE_HEIGHT,
|
|
3829
|
+
children: [
|
|
3830
|
+
/* @__PURE__ */ jsx21(
|
|
3831
|
+
Pie,
|
|
3832
|
+
{
|
|
3833
|
+
data,
|
|
3834
|
+
innerRadius,
|
|
3835
|
+
outerRadius,
|
|
3836
|
+
dataKey: "value",
|
|
3837
|
+
cy: CHART_CONSTANTS.PIE_CHART_CENTER_Y,
|
|
3838
|
+
cx: CHART_CONSTANTS.PIE_CHART_CENTER_X,
|
|
3839
|
+
label: showLabels,
|
|
3840
|
+
labelLine: false,
|
|
3841
|
+
onClick: handleClick,
|
|
3842
|
+
children: data.map((entry, index) => /* @__PURE__ */ jsx21(
|
|
3843
|
+
Cell,
|
|
3844
|
+
{
|
|
3845
|
+
fill: entry.color || getSeriesColor(index)
|
|
3846
|
+
},
|
|
3847
|
+
`cell-${index}`
|
|
3848
|
+
))
|
|
3849
|
+
}
|
|
3850
|
+
),
|
|
3851
|
+
/* @__PURE__ */ jsx21(
|
|
3852
|
+
Tooltip3,
|
|
3853
|
+
{
|
|
3854
|
+
content: ({
|
|
3855
|
+
active,
|
|
3856
|
+
payload
|
|
3857
|
+
}) => {
|
|
3858
|
+
if (active && payload && payload.length && payload[0]) {
|
|
3859
|
+
const data2 = payload[0].payload;
|
|
3860
|
+
return /* @__PURE__ */ jsx21(
|
|
3861
|
+
GenericTooltip,
|
|
3862
|
+
{
|
|
3863
|
+
title: data2.name,
|
|
3864
|
+
items: [
|
|
3865
|
+
{
|
|
3866
|
+
color: data2.color || CHART_COLORS.PRIMARY,
|
|
3867
|
+
label: "Value",
|
|
3868
|
+
value: data2.value
|
|
3869
|
+
}
|
|
3870
|
+
]
|
|
3871
|
+
}
|
|
3872
|
+
);
|
|
3873
|
+
}
|
|
3874
|
+
return null;
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
),
|
|
3878
|
+
showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx21(ChartLegend, { items: defaultLegendItems, y: 400 })
|
|
3879
|
+
]
|
|
3880
|
+
}
|
|
3881
|
+
) }) : /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx21(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
|
|
3882
|
+
]
|
|
3883
|
+
}
|
|
3884
|
+
);
|
|
3885
|
+
}
|
|
3886
|
+
);
|
|
3887
|
+
PieChart.displayName = "PieChart";
|
|
3888
|
+
|
|
3889
|
+
// src/components/ui/table.tsx
|
|
3890
|
+
import { useCallback as useCallback2 } from "react";
|
|
3891
|
+
import {
|
|
3892
|
+
flexRender
|
|
3893
|
+
} from "@tanstack/react-table";
|
|
3894
|
+
import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3895
|
+
function Table({
|
|
3896
|
+
table,
|
|
3897
|
+
className,
|
|
3898
|
+
showPagination = false,
|
|
3899
|
+
paginationClassName
|
|
3900
|
+
}) {
|
|
3901
|
+
const currentPage = table.getState().pagination.pageIndex;
|
|
3902
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
3903
|
+
const totalPages = table.getPageCount();
|
|
3904
|
+
const totalRows = table.getFilteredRowModel().rows.length;
|
|
3905
|
+
const showingText = totalRows > 0 ? "Showing " + (currentPage * pageSize + 1) + "-" + Math.min((currentPage + 1) * pageSize, totalRows) + " of " + totalRows + " results" : "No results found";
|
|
3906
|
+
const handlePreviousPage = useCallback2(() => {
|
|
3907
|
+
table.previousPage();
|
|
3908
|
+
}, [table]);
|
|
3909
|
+
const handleNextPage = useCallback2(() => {
|
|
3910
|
+
table.nextPage();
|
|
3911
|
+
}, [table]);
|
|
3912
|
+
const handlePageChange = useCallback2(
|
|
3913
|
+
(pageIndex) => {
|
|
3914
|
+
table.setPageIndex(pageIndex);
|
|
3915
|
+
},
|
|
3916
|
+
[table]
|
|
3917
|
+
);
|
|
3918
|
+
const handlePageSizeChange = useCallback2(
|
|
3919
|
+
(value) => {
|
|
3920
|
+
table.setPageSize(Number(value));
|
|
3921
|
+
},
|
|
3922
|
+
[table]
|
|
3923
|
+
);
|
|
3924
|
+
return /* @__PURE__ */ jsxs15("div", { children: [
|
|
3925
|
+
/* @__PURE__ */ jsx22("div", { className: cn("overflow-x-auto", className), children: /* @__PURE__ */ jsxs15("table", { className: "min-w-full divide-y divide-border", children: [
|
|
3926
|
+
/* @__PURE__ */ jsx22("thead", { className: "bg-dark text-light", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx22("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx22("th", { className: "px-6 py-3 text-left", children: /* @__PURE__ */ jsxs15(
|
|
3927
|
+
"div",
|
|
3928
|
+
{
|
|
3929
|
+
className: `flex items-center space-x-1 ${header.column.getCanSort() ? "cursor-pointer select-none" : ""}`,
|
|
3930
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
3931
|
+
children: [
|
|
3932
|
+
/* @__PURE__ */ jsx22(
|
|
3933
|
+
Typography,
|
|
3934
|
+
{
|
|
3935
|
+
variant: "label-xs",
|
|
3936
|
+
className: "text-light uppercase tracking-wider",
|
|
3937
|
+
children: flexRender(
|
|
3938
|
+
header.column.columnDef.header,
|
|
3939
|
+
header.getContext()
|
|
3940
|
+
)
|
|
3941
|
+
}
|
|
3942
|
+
),
|
|
3943
|
+
header.column.getCanSort() && /* @__PURE__ */ jsxs15("span", { className: "ml-1", children: [
|
|
3944
|
+
header.column.getIsSorted() === "asc" && /* @__PURE__ */ jsx22(ChevronUp, { className: "w-4 h-4 text-light" }),
|
|
3945
|
+
header.column.getIsSorted() === "desc" && /* @__PURE__ */ jsx22(ChevronDown, { className: "w-4 h-4 text-light" })
|
|
3946
|
+
] })
|
|
3947
|
+
]
|
|
3948
|
+
}
|
|
3949
|
+
) }, header.id)) }, headerGroup.id)) }),
|
|
3950
|
+
/* @__PURE__ */ jsx22("tbody", { className: "bg-light divide-y divide-border", children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx22("tr", { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx22("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx22(Typography, { variant: "body-sm", children: flexRender(
|
|
3951
|
+
cell.column.columnDef.cell,
|
|
3952
|
+
cell.getContext()
|
|
3953
|
+
) }) }, cell.id)) }, row.id)) })
|
|
3954
|
+
] }) }),
|
|
3955
|
+
showPagination && /* @__PURE__ */ jsxs15(
|
|
3956
|
+
"div",
|
|
3957
|
+
{
|
|
3958
|
+
className: cn(
|
|
3959
|
+
"flex items-center justify-between px-6 py-3 bg-light border-t border-subtle",
|
|
3960
|
+
paginationClassName
|
|
3961
|
+
),
|
|
3962
|
+
children: [
|
|
3963
|
+
/* @__PURE__ */ jsx22("div", { className: "flex items-center", children: /* @__PURE__ */ jsx22(Typography, { variant: "body-sm", className: "text-secondary", children: showingText }) }),
|
|
3964
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center space-x-1", children: [
|
|
3965
|
+
/* @__PURE__ */ jsx22(
|
|
3966
|
+
Button,
|
|
3967
|
+
{
|
|
3968
|
+
variant: "ghost",
|
|
3969
|
+
size: "sm",
|
|
3970
|
+
onClick: handlePreviousPage,
|
|
3971
|
+
disabled: !table.getCanPreviousPage(),
|
|
3972
|
+
className: "p-2",
|
|
3973
|
+
children: /* @__PURE__ */ jsx22(ChevronLeft, { className: "w-4 h-4" })
|
|
3974
|
+
}
|
|
3975
|
+
),
|
|
3976
|
+
Array.from(
|
|
3977
|
+
{ length: Math.min(5, table.getPageCount()) },
|
|
3978
|
+
(_, i) => {
|
|
3979
|
+
let pageNumber;
|
|
3980
|
+
if (totalPages <= 5) {
|
|
3981
|
+
pageNumber = i;
|
|
3982
|
+
} else if (currentPage <= 2) {
|
|
3983
|
+
pageNumber = i;
|
|
3984
|
+
} else if (currentPage >= totalPages - 3) {
|
|
3985
|
+
pageNumber = totalPages - 5 + i;
|
|
3986
|
+
} else {
|
|
3987
|
+
pageNumber = currentPage - 2 + i;
|
|
3988
|
+
}
|
|
3989
|
+
const isActive = pageNumber === currentPage;
|
|
3990
|
+
return /* @__PURE__ */ jsx22(
|
|
3991
|
+
Button,
|
|
3992
|
+
{
|
|
3993
|
+
variant: isActive ? "default" : "ghost",
|
|
3994
|
+
size: "sm",
|
|
3995
|
+
onClick: () => handlePageChange(pageNumber),
|
|
3996
|
+
className: "min-w-8 h-8 p-0",
|
|
3997
|
+
children: pageNumber + 1
|
|
3998
|
+
},
|
|
3999
|
+
pageNumber
|
|
4000
|
+
);
|
|
4001
|
+
}
|
|
4002
|
+
),
|
|
4003
|
+
table.getPageCount() > 5 && currentPage < totalPages - 3 && /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
4004
|
+
/* @__PURE__ */ jsx22("span", { className: "px-1 text-secondary", children: "..." }),
|
|
4005
|
+
/* @__PURE__ */ jsx22(Typography, { variant: "body-sm", className: "text-secondary", children: totalPages })
|
|
4006
|
+
] }),
|
|
4007
|
+
/* @__PURE__ */ jsx22(
|
|
4008
|
+
Button,
|
|
4009
|
+
{
|
|
4010
|
+
variant: "ghost",
|
|
4011
|
+
size: "sm",
|
|
4012
|
+
onClick: handleNextPage,
|
|
4013
|
+
disabled: !table.getCanNextPage(),
|
|
4014
|
+
className: "p-2",
|
|
4015
|
+
children: /* @__PURE__ */ jsx22(ChevronRight, { className: "w-4 h-4" })
|
|
4016
|
+
}
|
|
4017
|
+
)
|
|
4018
|
+
] }),
|
|
4019
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-3 w-48", children: [
|
|
4020
|
+
/* @__PURE__ */ jsx22(
|
|
4021
|
+
Typography,
|
|
4022
|
+
{
|
|
4023
|
+
variant: "body-sm",
|
|
4024
|
+
className: "text-secondary whitespace-nowrap",
|
|
4025
|
+
children: "Rows per page:"
|
|
4026
|
+
}
|
|
4027
|
+
),
|
|
4028
|
+
/* @__PURE__ */ jsxs15(
|
|
4029
|
+
Select,
|
|
4030
|
+
{
|
|
4031
|
+
value: table.getState().pagination.pageSize.toString(),
|
|
4032
|
+
onValueChange: handlePageSizeChange,
|
|
4033
|
+
children: [
|
|
4034
|
+
/* @__PURE__ */ jsx22(SelectTrigger, { className: "min-w-0 h-8", children: /* @__PURE__ */ jsx22(SelectValue, {}) }),
|
|
4035
|
+
/* @__PURE__ */ jsx22(SelectContent, { children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsx22(SelectItem, { value: size.toString(), children: size }, size)) })
|
|
4036
|
+
]
|
|
4037
|
+
}
|
|
4038
|
+
)
|
|
4039
|
+
] })
|
|
4040
|
+
]
|
|
4041
|
+
}
|
|
4042
|
+
)
|
|
4043
|
+
] });
|
|
4044
|
+
}
|
|
3021
4045
|
export {
|
|
3022
4046
|
ArrowDown,
|
|
3023
4047
|
ArrowLeft,
|
|
3024
4048
|
ArrowRight,
|
|
3025
4049
|
ArrowUp,
|
|
3026
4050
|
Badge,
|
|
4051
|
+
BarChart,
|
|
3027
4052
|
Bell,
|
|
3028
4053
|
Bookmark,
|
|
3029
4054
|
Button,
|
|
4055
|
+
CHART_COLORS,
|
|
4056
|
+
CHART_CONSTANTS,
|
|
4057
|
+
COLOR_SCHEMES,
|
|
3030
4058
|
Calendar,
|
|
3031
4059
|
CaretDown,
|
|
3032
4060
|
CaretLeft,
|
|
3033
4061
|
CaretRight,
|
|
3034
4062
|
CaretUp,
|
|
4063
|
+
ChartLegend,
|
|
3035
4064
|
Chat,
|
|
3036
4065
|
Check,
|
|
3037
4066
|
CheckIcon,
|
|
@@ -3069,9 +4098,20 @@ export {
|
|
|
3069
4098
|
Exclamation,
|
|
3070
4099
|
EyeClosed,
|
|
3071
4100
|
EyeOpen,
|
|
4101
|
+
Field,
|
|
4102
|
+
FieldContent,
|
|
4103
|
+
FieldDescription,
|
|
4104
|
+
FieldError,
|
|
4105
|
+
FieldGroup,
|
|
4106
|
+
FieldLabel,
|
|
4107
|
+
FieldLegend,
|
|
4108
|
+
FieldSeparator,
|
|
4109
|
+
FieldSet,
|
|
4110
|
+
FieldTitle,
|
|
3072
4111
|
Filter,
|
|
3073
4112
|
FilterDescending,
|
|
3074
4113
|
FormField,
|
|
4114
|
+
GenericTooltip,
|
|
3075
4115
|
GraphBar,
|
|
3076
4116
|
GraphDonut,
|
|
3077
4117
|
GraphLine,
|
|
@@ -3079,7 +4119,9 @@ export {
|
|
|
3079
4119
|
HamburgerMenu,
|
|
3080
4120
|
Home,
|
|
3081
4121
|
Information,
|
|
3082
|
-
|
|
4122
|
+
Input,
|
|
4123
|
+
Label2 as Label,
|
|
4124
|
+
LineChart,
|
|
3083
4125
|
Location,
|
|
3084
4126
|
Lock,
|
|
3085
4127
|
Logout,
|
|
@@ -3087,6 +4129,7 @@ export {
|
|
|
3087
4129
|
Minus,
|
|
3088
4130
|
MoreMenu,
|
|
3089
4131
|
Phone,
|
|
4132
|
+
PieChart,
|
|
3090
4133
|
Plus,
|
|
3091
4134
|
QuestionCircle,
|
|
3092
4135
|
Select,
|
|
@@ -3099,14 +4142,19 @@ export {
|
|
|
3099
4142
|
SelectSeparator,
|
|
3100
4143
|
SelectTrigger,
|
|
3101
4144
|
SelectValue,
|
|
4145
|
+
Separator2 as Separator,
|
|
3102
4146
|
Share,
|
|
3103
4147
|
Star,
|
|
3104
4148
|
Statement,
|
|
3105
4149
|
Table,
|
|
4150
|
+
TableIcon,
|
|
3106
4151
|
Tabs,
|
|
3107
4152
|
TabsContent,
|
|
3108
4153
|
TabsList,
|
|
3109
4154
|
TabsTrigger,
|
|
4155
|
+
Textarea,
|
|
4156
|
+
TooltipContainer,
|
|
4157
|
+
TooltipItem,
|
|
3110
4158
|
Trash,
|
|
3111
4159
|
Typography,
|
|
3112
4160
|
Upload,
|
|
@@ -3117,8 +4165,20 @@ export {
|
|
|
3117
4165
|
X,
|
|
3118
4166
|
badgeVariants,
|
|
3119
4167
|
buttonVariants,
|
|
4168
|
+
calculateYAxisWidth,
|
|
3120
4169
|
checkboxVariants,
|
|
3121
|
-
|
|
4170
|
+
createCustomXAxisLabel,
|
|
4171
|
+
createCustomYAxisLabel,
|
|
4172
|
+
createCustomYAxisRightLabel,
|
|
4173
|
+
createLegendItems,
|
|
4174
|
+
customXAxisTick,
|
|
4175
|
+
customXAxisTickRotated,
|
|
4176
|
+
customYAxisTick,
|
|
4177
|
+
formatLargeNumber,
|
|
4178
|
+
formatPercentage,
|
|
4179
|
+
getHeatmapColor,
|
|
4180
|
+
getPerformanceColor,
|
|
4181
|
+
getSeriesColor,
|
|
3122
4182
|
selectTriggerVariants,
|
|
3123
4183
|
tabsVariants,
|
|
3124
4184
|
typographyVariants,
|