@ultraviolet/ui 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionBar/index.js +1 -1
- package/dist/components/ActionBar/styles.css.js +1 -0
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.js +2 -1
- package/dist/components/Avatar/styles.css.js +0 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Banner/index.d.ts.map +1 -1
- package/dist/components/Banner/index.js +2 -1
- package/dist/components/BarChart/Tooltip.js +1 -1
- package/dist/components/BarStack/index.js +1 -1
- package/dist/components/Breadcrumbs/components/Item.js +1 -1
- package/dist/components/Bullet/index.js +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +2 -1
- package/dist/components/Card/index.js +1 -1
- package/dist/components/Carousel/index.js +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +2 -1
- package/dist/components/CheckboxGroup/index.js +1 -1
- package/dist/components/Chip/ChipIcon.d.ts.map +1 -1
- package/dist/components/Chip/ChipIcon.js +1 -0
- package/dist/components/Chip/index.d.ts +1 -1
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/DateInput/components/CalendarMonthly.js +1 -1
- package/dist/components/DateInput/index.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/Expandable/index.js +1 -1
- package/dist/components/ExpandableCard/index.d.ts.map +1 -1
- package/dist/components/ExpandableCard/index.js +2 -1
- package/dist/components/FileInput/FileInputProvider.d.ts +21 -0
- package/dist/components/FileInput/FileInputProvider.d.ts.map +1 -0
- package/dist/components/FileInput/FileInputProvider.js +15 -0
- package/dist/components/FileInput/components/Button.d.ts +4 -0
- package/dist/components/FileInput/components/Button.d.ts.map +1 -0
- package/dist/components/FileInput/components/Button.js +23 -0
- package/dist/components/FileInput/components/List.d.ts +3 -0
- package/dist/components/FileInput/components/List.d.ts.map +1 -0
- package/dist/components/FileInput/components/List.js +121 -0
- package/dist/components/FileInput/helpers.d.ts +4 -0
- package/dist/components/FileInput/helpers.d.ts.map +1 -0
- package/dist/components/FileInput/helpers.js +19 -0
- package/dist/components/FileInput/index.d.ts +6 -0
- package/dist/components/FileInput/index.d.ts.map +1 -0
- package/dist/components/FileInput/index.js +298 -0
- package/dist/components/FileInput/styles.css.d.ts +31 -0
- package/dist/components/FileInput/styles.css.d.ts.map +1 -0
- package/dist/components/FileInput/styles.css.js +22 -0
- package/dist/components/FileInput/types.d.ts +72 -0
- package/dist/components/FileInput/types.d.ts.map +1 -0
- package/dist/components/GlobalAlert/index.js +1 -1
- package/dist/components/Key/index.js +1 -1
- package/dist/components/LineChart/CustomLegend.d.ts.map +1 -1
- package/dist/components/LineChart/CustomLegend.js +2 -1
- package/dist/components/LineChart/helpers.js +1 -1
- package/dist/components/Link/index.js +1 -1
- package/dist/components/List/Cell.js +1 -1
- package/dist/components/List/HeaderCell.js +1 -1
- package/dist/components/List/Row.d.ts.map +1 -1
- package/dist/components/List/Row.js +2 -1
- package/dist/components/List/SkeletonRows.js +1 -1
- package/dist/components/List/index.js +1 -1
- package/dist/components/Menu/MenuContent.js +1 -1
- package/dist/components/Menu/components/Item.js +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Modal/components/Dialog.js +1 -1
- package/dist/components/Notice/index.js +1 -1
- package/dist/components/Notification/NotificationContainer.js +1 -1
- package/dist/components/PasswordCheck/index.js +1 -1
- package/dist/components/PieChart/styles.css.d.ts.map +1 -1
- package/dist/components/Popover/index.js +1 -1
- package/dist/components/Popup/helpers.d.ts.map +1 -1
- package/dist/components/Popup/index.d.ts.map +1 -1
- package/dist/components/Popup/index.js +2 -1
- package/dist/components/ProgressBar/index.js +1 -1
- package/dist/components/Radio/index.js +1 -1
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/Row/index.d.ts.map +1 -1
- package/dist/components/Row/index.js +2 -1
- package/dist/components/SearchInput/index.d.ts.map +1 -1
- package/dist/components/SearchInput/index.js +7 -8
- package/dist/components/SelectInput/components/Dropdown.d.ts.map +1 -1
- package/dist/components/SelectInput/components/Dropdown.js +16 -9
- package/dist/components/SelectInput/components/DropdownOption.js +4 -4
- package/dist/components/SelectInput/components/SelectBar.d.ts.map +1 -1
- package/dist/components/SelectInput/components/SelectBar.js +80 -76
- package/dist/components/SelectInput/components/dropdown.css.d.ts +1 -0
- package/dist/components/SelectInput/components/dropdown.css.d.ts.map +1 -1
- package/dist/components/SelectInput/components/dropdown.css.js +17 -15
- package/dist/components/SelectInput/components/selectBar.css.d.ts +4 -2
- package/dist/components/SelectInput/components/selectBar.css.d.ts.map +1 -1
- package/dist/components/SelectInput/components/selectBar.css.js +7 -7
- package/dist/components/SelectInput/index.js +1 -1
- package/dist/components/SelectableCard/index.d.ts.map +1 -1
- package/dist/components/SelectableCard/index.js +2 -1
- package/dist/components/SelectableCardGroup/index.js +1 -1
- package/dist/components/SelectableCardOptionGroup/SelectableCardOptionGroup.js +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Image.js +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Option.js +1 -1
- package/dist/components/Separator/index.js +1 -1
- package/dist/components/Skeleton/index.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +1 -1
- package/dist/components/Slider/components/DoubleSlider.d.ts.map +1 -1
- package/dist/components/Slider/components/DoubleSlider.js +2 -1
- package/dist/components/Slider/components/SingleSlider.d.ts.map +1 -1
- package/dist/components/Slider/components/SingleSlider.js +2 -1
- package/dist/components/Snippet/index.js +1 -1
- package/dist/components/Status/index.js +1 -1
- package/dist/components/StepList/index.js +1 -1
- package/dist/components/Stepper/Step.js +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/Stepper/styles.css.d.ts.map +1 -1
- package/dist/components/Table/Cell.js +1 -1
- package/dist/components/Table/HeaderCell.js +1 -1
- package/dist/components/Table/Row.d.ts.map +1 -1
- package/dist/components/Table/Row.js +2 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Tabs/Tab.js +1 -1
- package/dist/components/Tabs/TabMenu.js +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/Tag/index.d.ts +3 -1
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +33 -6
- package/dist/components/Tag/styles.css.d.ts +0 -2
- package/dist/components/Tag/styles.css.d.ts.map +1 -1
- package/dist/components/Tag/styles.css.js +3 -3
- package/dist/components/TagInput/index.d.ts.map +1 -1
- package/dist/components/TagInput/index.js +1 -2
- package/dist/components/TagList/index.js +1 -1
- package/dist/components/Text/index.js +1 -1
- package/dist/components/TextInput/index.d.ts.map +1 -1
- package/dist/components/TextInput/index.js +1 -1
- package/dist/components/TimeInput/index.d.ts.map +1 -1
- package/dist/components/TimeInput/index.js +12 -6
- package/dist/components/Toaster/ToasterContainer.js +1 -1
- package/dist/components/Toggle/index.js +1 -1
- package/dist/components/ToggleGroup/index.js +1 -1
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +3 -1
- package/dist/components/UnitInput/index.js +1 -1
- package/dist/components/VerificationCode/index.d.ts.map +1 -1
- package/dist/components/VerificationCode/index.js +46 -43
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/ui.css +1 -1
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +9 -8
- package/dist/utils/capitalize.d.ts +0 -3
- package/dist/utils/capitalize.d.ts.map +0 -1
- package/dist/utils/ids.d.ts +0 -2
- package/dist/utils/ids.d.ts.map +0 -1
- package/dist/utils/ids.js +0 -6
- package/dist/utils/orderBy.d.ts +0 -3
- package/dist/utils/orderBy.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { Stack } from "../Stack/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { AlertCircleIcon, CheckCircleOutlineIcon, LightBulbIcon, InformationOutlineIcon, CloseIcon } from "@ultraviolet/icons";
|
|
4
|
-
import { cn } from "@ultraviolet/
|
|
4
|
+
import { cn } from "@ultraviolet/utils";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { Button } from "../Button/index.js";
|
|
7
7
|
import { Stack } from "../Stack/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,SAAS,CAAA;AAO3D;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,mIAcpB,WAAW,4CA8Db,CAAA"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { UserProductIcon } from "@ultraviolet/icons/product/UserProductIcon";
|
|
4
4
|
import { UploadIcon } from "@ultraviolet/icons/UploadIcon";
|
|
5
|
-
import { theme
|
|
5
|
+
import { theme } from "@ultraviolet/themes";
|
|
6
|
+
import { cn } from "@ultraviolet/utils";
|
|
6
7
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
7
8
|
import { Text } from "../Text/index.js";
|
|
8
9
|
import { DEFAULT_COLORS, sizes, TEXT_VARIANT_BY_SIZE } from "./constants.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
/* empty css */
|
|
3
2
|
import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
4
3
|
var containerAvatar = createRuntimeFn({ defaultClassName: "uv_19x8y1k0", variantClassNames: { shape: { circle: "uv_19x8y1k1", square: "uv_19x8y1k2" }, size: { large: "uv_19x8y1k3", medium: "uv_19x8y1k4", small: "uv_19x8y1k5", xsmall: "uv_19x8y1k6" }, sentiment: { primary: "uv_19x8y1k7", neutral: "uv_19x8y1k8" } }, defaultVariants: {}, compoundVariants: [[{ size: "large", shape: "square" }, "uv_19x8y1k9"], [{ size: "medium", shape: "square" }, "uv_19x8y1ka"], [{ size: "small", shape: "square" }, "uv_19x8y1kb"], [{ size: "xsmall", shape: "square" }, "uv_19x8y1kc"]] });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { Text } from "../Text/index.js";
|
|
6
6
|
import { TEXT_VARIANT } from "./constant.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Banner/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Banner/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAMlC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAGlD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,GAAG,cAAc,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,sKAgBpB,WAAW,mDAqHb,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { CloseIcon } from "@ultraviolet/icons";
|
|
4
|
-
import { useTheme
|
|
4
|
+
import { useTheme } from "@ultraviolet/themes";
|
|
5
|
+
import { cn } from "@ultraviolet/utils";
|
|
5
6
|
import { useMemo, useState } from "react";
|
|
6
7
|
import { Button } from "../Button/index.js";
|
|
7
8
|
import { Link } from "../Link/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { Text } from "../Text/index.js";
|
|
6
6
|
import { barColorSquare, colorBar, barTooltipContainer } from "./styles.css.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
6
|
import { Label } from "../Label/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { useMemo } from "react";
|
|
6
6
|
import { Button } from "../../Button/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,SAAS,EAEV,MAAM,OAAO,CAAA;AA8Cd;;;GAGG;AACH,eAAO,MAAM,MAAM;WA1CV,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC;gBAC1C,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC;WACzD,QAAQ;gBACH,MAAM;oBACF,MAAM;gBACV,OAAO;mBACJ,MAAM;qBACJ,OAAO;sBACN,MAAM;sBACN,OAAO;sBACP,OAAO;yBACJ,MAAM;sBACT,OAAO;qBACR,OAAO;6BACC,MAAM;0BACT,MAAM;cAClB,iBAAiB,CAAC,WAAW,CAAC;cAC9B,MAAM;eACL,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC;kBAChD,iBAAiB,CAAC,WAAW,CAAC;gBAChC,iBAAiB,CAAC,WAAW,CAAC;iBAC7B,iBAAiB,CAAC,WAAW,CAAC;aAClC,oBAAoB,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC;mBACrC,iBAAiB,CAAC,WAAW,CAAC;mBAC9B,iBAAiB,CAAC,WAAW,CAAC;oBAC7B,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,eAAe,CAAC;gBAC5D,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC;YACxD,aAAa;;;;;;;;cAIX,SAAS;WACZ,MAAM;WACN,MAAM;aACJ,MAAM;eACJ,MAAM;2CAyJlB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useTheme
|
|
3
|
+
import { useTheme } from "@ultraviolet/themes";
|
|
4
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
5
|
import { forwardRef, useMemo } from "react";
|
|
5
6
|
import { Loader } from "../Loader/index.js";
|
|
6
7
|
import { Tooltip } from "../Tooltip/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
import { Stack } from "../Stack/index.js";
|
|
6
6
|
import { Text } from "../Text/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { useRef, useEffect, useState } from "react";
|
|
6
6
|
import { beforeScroll, scrollableWrapper, afterScroll, wrapper, borderWrapper, widthVar } from "./styles.css.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAkC3D,KAAK,SAAS,GACV;IACE,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAA;CACrB,GACD;IACE,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAEL,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,eAAe,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,IAAI,CACN,mBAAmB,CAAC,gBAAgB,CAAC,EACnC,WAAW,GACX,IAAI,GACJ,MAAM,GACN,QAAQ,GACR,UAAU,GACV,SAAS,GACT,SAAS,GACT,UAAU,GACV,OAAO,GACP,OAAO,CACV,GACC,SAAS,CAAA;AAEX;;GAEG;AACH,eAAO,MAAM,QAAQ,4GAoJpB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useTheme } from "@ultraviolet/themes";
|
|
4
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
5
|
import { forwardRef, useId } from "react";
|
|
5
6
|
import { Stack } from "../Stack/index.js";
|
|
6
7
|
import { Text } from "../Text/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { useMemo, createContext, useContext } from "react";
|
|
5
5
|
import { Checkbox } from "../Checkbox/index.js";
|
|
6
6
|
import { Label } from "../Label/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipIcon.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/ChipIcon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChipIcon.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/ChipIcon.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAG1C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAA;AAIjE,KAAK,QAAQ,GAAG,8BAA8B,CAAC,MAAM,OAAO,IAAI,EAAE,MAAM,CAAC,CAAA;AAEzE,KAAK,YAAY,GAAG;IAClB;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,+CAItB,YAAY,4CA2Dd,CAAA"}
|
|
@@ -15,7 +15,7 @@ type ChipType = {
|
|
|
15
15
|
export declare const Chip: {
|
|
16
16
|
({ children, size, disabled, active, className, "data-testid": dataTestId, onClick, style, }: ChipType): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
Icon: ({ name, onClick, "data-testid": dataTestId, }: {
|
|
18
|
-
name: "search" | "anchor" | "bold" | "filter" | "sort" | "italic" | "underline" | "drag" | "address" | "audio" | "video" | "image" | "stop" | "view" | "id" | "pen" | "download" | "cancel" | "close" | "play" | "send" | "email" | "arrowLeft" | "upload" | "addressOutline" | "addressPlay" | "adjustmentsHorizontal" | "adjustmentsHorizontalOutline" | "alertCircle" | "alertCircleOutline" | "arrowDown" | "arrowLeftBottom" | "arrowLeftDouble" | "arrowRightBottom" | "arrowRightDouble" | "arrowRight" | "arrowUp" | "attach" | "autoFix" | "autoFixOutline" | "bookOpenOutline" | "bookOpenOutlineOutline" | "boxEssentials" | "boxEssentialsOutline" | "bullhorn" | "bullhornOutline" | "burger" | "calculator" | "calculatorOutline" | "calendarRange" | "calendarRangeOutline" | "chat" | "chatOutline" | "checkCircle" | "checkCircleOutline" | "check" | "clickhouse" | "lock" | "clock" | "lockOutline" | "clockOutline" | "closeCircle" | "closeCircleOutline" | "console" | "consoleOutline" | "copyContent" | "credential" | "credentialOutline" | "creditCard" | "creditCardOutline" | "database" | "databaseOutline" | "delete" | "deleteOutline" | "detach" | "doc" | "docOutline" | "docPaper" | "docPaperOutline" | "dotsHorizontal" | "dotsVertical" | "earth" | "earthOutline" | "east" | "eastShort" | "emailOutline" | "emailRemove" | "emailRemoveOutline" | "equal" | "escape" | "expand" | "expandMore" | "eye" | "eyeOff" | "eyeOffOutline" | "eyeOutline" | "filterOutline" | "folder" | "folderOutline" | "github" | "helpCircle" | "helpCircleOutline" | "idOutline" | "imageOutline" | "information" | "informationOutline" | "instagram" | "leaf" | "leafOutline" | "leftRightArrow" | "lightBulb" | "lightBulbOutline" | "linkedin" | "listBullet" | "listNumber" | "logout" | "members" | "membersOutline" | "minus" | "moon" | "moonOutline" | "mosaic" | "mosaicOutline" | "music" | "musicOutline" | "north" | "northShort" | "notification" | "notificationOutline" | "openInNew" | "organization" | "paperclip" | "partnerSpace" | "pen2" | "pen2Outline" | "pencil" | "pencilOutline" | "penOutline" | "phone" | "phoneOutline" | "pin" | "pinOutline" | "playOutline" | "plus" | "privacy" | "privacyOutline" | "profile" | "profileOutline" | "progressCheck" | "rayEndArrow" | "rayStartArrow" | "rayStartEnd" | "rayTopArrow" | "reboot" | "restore" | "revoke" | "rocket" | "rocketOutline" | "rss" | "sendOutline" | "settings" | "settingsOutline" | "sidebar" | "sidebarOutline" | "slack" | "south" | "southShort" | "sparkles" | "sparklesOutline" | "star" | "starOutline" | "stopOutline" | "sun" | "sunOutline" | "support" | "supportOutline" | "switchOrga" | "thumbsDown" | "thumbsDownOutline" | "thumbsUp" | "thumbsUpOutline" | "twitter" | "unlock" | "unlockOutline" | "unpin" | "unpinOutline" | "videoOutline" | "weatherNight" | "weatherNightOutline" | "west" | "westShort" | "youtube";
|
|
18
|
+
name: "search" | "anchor" | "bold" | "filter" | "sort" | "italic" | "underline" | "drag" | "address" | "audio" | "video" | "image" | "stop" | "view" | "id" | "pen" | "download" | "cancel" | "close" | "play" | "send" | "email" | "arrowLeft" | "upload" | "addressOutline" | "addressPlay" | "adjustmentsHorizontal" | "adjustmentsHorizontalOutline" | "alertCircle" | "alertCircleOutline" | "arrowDown" | "arrowLeftBottom" | "arrowLeftDouble" | "arrowRightBottom" | "arrowRightDouble" | "arrowRight" | "arrowUp" | "attach" | "autoFix" | "autoFixOutline" | "bookOpenOutline" | "bookOpenOutlineOutline" | "boxEssentials" | "boxEssentialsOutline" | "bullhorn" | "bullhornOutline" | "burger" | "calculator" | "calculatorOutline" | "calendarRange" | "calendarRangeOutline" | "chat" | "chatOutline" | "checkCircle" | "checkCircleOutline" | "check" | "clickhouse" | "lock" | "clock" | "lockOutline" | "clockOutline" | "closeCircle" | "closeCircleOutline" | "console" | "consoleOutline" | "copyContent" | "credential" | "credentialOutline" | "creditCard" | "creditCardOutline" | "database" | "databaseOutline" | "delete" | "deleteOutline" | "detach" | "doc" | "docOutline" | "docPaper" | "docPaperOutline" | "dotsHorizontal" | "dotsVertical" | "earth" | "earthOutline" | "east" | "eastShort" | "emailOutline" | "emailRemove" | "emailRemoveOutline" | "equal" | "escape" | "expand" | "expandMore" | "eye" | "eyeOff" | "eyeOffOutline" | "eyeOutline" | "filterOutline" | "folder" | "folderOutline" | "github" | "helpCircle" | "helpCircleOutline" | "home" | "homeOutline" | "idOutline" | "imageOutline" | "information" | "informationOutline" | "instagram" | "leaf" | "leafOutline" | "leftRightArrow" | "lightBulb" | "lightBulbOutline" | "linkedin" | "listBullet" | "listNumber" | "logout" | "members" | "membersOutline" | "minus" | "moon" | "moonOutline" | "mosaic" | "mosaicOutline" | "music" | "musicOutline" | "north" | "northShort" | "notification" | "notificationOutline" | "openInNew" | "organization" | "paperclip" | "partnerSpace" | "pen2" | "pen2Outline" | "pencil" | "pencilOutline" | "penOutline" | "phone" | "phoneOutline" | "pin" | "pinOutline" | "playOutline" | "plus" | "privacy" | "privacyOutline" | "profile" | "profileOutline" | "progressCheck" | "rayEndArrow" | "rayStartArrow" | "rayStartEnd" | "rayTopArrow" | "reboot" | "restore" | "revoke" | "rocket" | "rocketOutline" | "rss" | "sendOutline" | "settings" | "settingsOutline" | "sidebar" | "sidebarOutline" | "slack" | "south" | "southShort" | "sparkles" | "sparklesOutline" | "star" | "starOutline" | "stopOutline" | "sun" | "sunOutline" | "support" | "supportOutline" | "switchOrga" | "thumbsDown" | "thumbsDownOutline" | "thumbsUp" | "thumbsUpOutline" | "twitter" | "unlock" | "unlockOutline" | "unpin" | "unpinOutline" | "videoOutline" | "weatherNight" | "weatherNightOutline" | "west" | "westShort" | "youtube";
|
|
19
19
|
onClick?: () => void;
|
|
20
20
|
'data-testid'?: string;
|
|
21
21
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { useState, useRef, useMemo, useEffect } from "react";
|
|
5
5
|
import { Stack } from "../Stack/index.js";
|
|
6
6
|
import { Text } from "../Text/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { useContext, useState } from "react";
|
|
5
5
|
import { Button } from "../../Button/index.js";
|
|
6
6
|
import { Row } from "../../Row/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { CalendarRangeIcon } from "@ultraviolet/icons";
|
|
4
|
-
import { cn } from "@ultraviolet/
|
|
4
|
+
import { cn } from "@ultraviolet/utils";
|
|
5
5
|
import { useMemo, useState, useRef, useEffect } from "react";
|
|
6
6
|
import { Card } from "../Card/index.js";
|
|
7
7
|
import { Stack } from "../Stack/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { AlertCircleIcon, CheckIcon } from "@ultraviolet/icons";
|
|
4
|
-
import { cn } from "@ultraviolet/
|
|
4
|
+
import { cn } from "@ultraviolet/utils";
|
|
5
5
|
import { useMemo } from "react";
|
|
6
6
|
import { Bullet } from "../Bullet/index.js";
|
|
7
7
|
import { Modal } from "../Modal/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { Modal } from "../Modal/index.js";
|
|
5
5
|
import { Separator } from "../Separator/index.js";
|
|
6
6
|
import { Stack } from "../Stack/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { Link } from "../Link/index.js";
|
|
5
5
|
import { Stack } from "../Stack/index.js";
|
|
6
6
|
import { Text } from "../Text/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@ultraviolet/
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { useState, useRef, useEffect } from "react";
|
|
6
6
|
import { animationDurationVar, expandable } from "./styles.css.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableCard/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableCard/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EAGrB,aAAa,EACb,SAAS,EACV,MAAM,OAAO,CAAA;AAMd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAYvD,KAAK,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,KAAK,cAAc,GACf;IACE,SAAS,EAAE,IAAI,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;CAC3D,GACD;IACE,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,gBAAgB,CAAC,EAAE,KAAK,CAAA;IACxB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,SAAS,CAAC,EAAE,KAAK,CAAA;CAClB,CAAA;AACL,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,CAAC,EAAE,kBAAkB,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,IAAI,CAAC,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;IACxD,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,GAAG,cAAc,CAAA;AA4NlB,eAAO,MAAM,cAAc;;;;cAzNE,OAAO;oBAAkB,MAAM,IAAI;;;CA2N9D,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { DragIcon, ArrowDownIcon } from "@ultraviolet/icons";
|
|
4
|
-
import { useTheme
|
|
4
|
+
import { useTheme } from "@ultraviolet/themes";
|
|
5
|
+
import { cn } from "@ultraviolet/utils";
|
|
5
6
|
import { forwardRef, useRef, useState, useCallback } from "react";
|
|
6
7
|
import { Stack } from "../Stack/index.js";
|
|
7
8
|
import { Tooltip } from "../Tooltip/index.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Dispatch, RefObject, SetStateAction } from 'react';
|
|
2
|
+
import type { FilesType } from './types';
|
|
3
|
+
type FileInputContextType = {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
6
|
+
files: FilesType[];
|
|
7
|
+
setFiles: Dispatch<SetStateAction<FilesType[]>>;
|
|
8
|
+
onChangeFiles?: (files: FilesType[]) => void;
|
|
9
|
+
error: boolean;
|
|
10
|
+
} | undefined;
|
|
11
|
+
export declare const FileInputContext: import("react").Context<FileInputContextType>;
|
|
12
|
+
export declare const useFileInput: () => {
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
15
|
+
files: FilesType[];
|
|
16
|
+
setFiles: Dispatch<SetStateAction<FilesType[]>>;
|
|
17
|
+
onChangeFiles?: (files: FilesType[]) => void;
|
|
18
|
+
error: boolean;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=FileInputProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileInputProvider.d.ts","sourceRoot":"","sources":["../../../src/components/FileInput/FileInputProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,KAAK,oBAAoB,GACrB;IACE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;IAC5C,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAC/C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;IAC5C,KAAK,EAAE,OAAO,CAAA;CACf,GACD,SAAS,CAAA;AACb,eAAO,MAAM,gBAAgB,+CAAiD,CAAA;AAE9E,eAAO,MAAM,YAAY;eAVR,OAAO;cACR,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC;WACrC,SAAS,EAAE;cACR,QAAQ,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;oBAC/B,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI;WACrC,OAAO;CAenB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const FileInputContext = createContext(void 0);
|
|
3
|
+
const useFileInput = () => {
|
|
4
|
+
const context = useContext(FileInputContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error(
|
|
7
|
+
"FileInputContext should be inside FileInput to work properly."
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
FileInputContext,
|
|
14
|
+
useFileInput
|
|
15
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { Button } from '../../Button';
|
|
3
|
+
export declare const FileInputButton: ({ children, disabled, ...props }: ComponentProps<typeof Button>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/FileInput/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAGrC,eAAO,MAAM,eAAe,GAAI,kCAI7B,cAAc,CAAC,OAAO,MAAM,CAAC,4CAa/B,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../Button/index.js";
|
|
3
|
+
import { useFileInput } from "../FileInputProvider.js";
|
|
4
|
+
const FileInputButton = ({
|
|
5
|
+
children,
|
|
6
|
+
disabled,
|
|
7
|
+
...props
|
|
8
|
+
}) => {
|
|
9
|
+
const context = useFileInput();
|
|
10
|
+
const isDisabled = disabled || context.disabled;
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
Button,
|
|
13
|
+
{
|
|
14
|
+
...props,
|
|
15
|
+
disabled: isDisabled,
|
|
16
|
+
onClick: () => context.inputRef.current?.click(),
|
|
17
|
+
children
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
FileInputButton
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../src/components/FileInput/components/List.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,UAAU,CAAA;AAgDnD,eAAO,MAAM,SAAS,GAAI,mCAIvB,SAAS,mDAyFX,CAAA"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CloseIcon, AudioIcon, VideoIcon, ImageIcon, DocIcon } from "@ultraviolet/icons";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Button } from "../../Button/index.js";
|
|
5
|
+
import { Loader } from "../../Loader/index.js";
|
|
6
|
+
import { Stack } from "../../Stack/index.js";
|
|
7
|
+
import { Text } from "../../Text/index.js";
|
|
8
|
+
import { useFileInput } from "../FileInputProvider.js";
|
|
9
|
+
import { getMimeTypeType, formatFileSize } from "../helpers.js";
|
|
10
|
+
import { fileViewerContainer, fileInfo, fileViewerImage } from "../styles.css.js";
|
|
11
|
+
const getIllustration = (type, file, error, loading) => {
|
|
12
|
+
if (loading) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { className: fileViewerImage[error ? "error" : "default"], children: /* @__PURE__ */ jsx(Loader, { active: true, sentiment: "primary", size: "xsmall" }) });
|
|
14
|
+
}
|
|
15
|
+
if (type === "audio") {
|
|
16
|
+
return /* @__PURE__ */ jsx("div", { className: fileViewerImage[error ? "error" : "default"], children: /* @__PURE__ */ jsx(AudioIcon, { sentiment: error ? "danger" : "primary", size: "medium" }) });
|
|
17
|
+
}
|
|
18
|
+
if (type === "video") {
|
|
19
|
+
return /* @__PURE__ */ jsx("div", { className: fileViewerImage[error ? "error" : "default"], children: /* @__PURE__ */ jsx(VideoIcon, { sentiment: error ? "danger" : "primary", size: "medium" }) });
|
|
20
|
+
}
|
|
21
|
+
if (type === "image" && !error) {
|
|
22
|
+
return /* @__PURE__ */ jsx("img", { alt: "", className: fileViewerImage.default, src: file });
|
|
23
|
+
}
|
|
24
|
+
if (type === "image" && error) {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { className: fileViewerImage[error ? "error" : "default"], children: /* @__PURE__ */ jsx(ImageIcon, { sentiment: error ? "danger" : "primary", size: "medium" }) });
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsx("div", { className: fileViewerImage[error ? "error" : "default"], children: /* @__PURE__ */ jsx(DocIcon, { sentiment: error ? "danger" : "primary", size: "medium" }) });
|
|
28
|
+
};
|
|
29
|
+
const ListFiles = ({
|
|
30
|
+
limit,
|
|
31
|
+
textLimit,
|
|
32
|
+
prominence = "default"
|
|
33
|
+
}) => {
|
|
34
|
+
const [computedLimit, setLimit] = useState(limit);
|
|
35
|
+
const seeAllOnClick = () => {
|
|
36
|
+
setLimit(void 0);
|
|
37
|
+
};
|
|
38
|
+
const { files, setFiles, onChangeFiles, error } = useFileInput();
|
|
39
|
+
return files.length > 0 ? /* @__PURE__ */ jsxs(Stack, { direction: "row", gap: 1, wrap: "wrap", children: [
|
|
40
|
+
files.map((file, index) => {
|
|
41
|
+
if (!computedLimit || index < computedLimit) {
|
|
42
|
+
const fileType = getMimeTypeType(file.type);
|
|
43
|
+
const illustration = getIllustration(
|
|
44
|
+
fileType,
|
|
45
|
+
file.file,
|
|
46
|
+
!!file.error || error,
|
|
47
|
+
file.loading
|
|
48
|
+
);
|
|
49
|
+
const sentiment = file.error ? "danger" : "neutral";
|
|
50
|
+
return /* @__PURE__ */ jsxs(Stack, { "data-testid": file.fileName, gap: 0.5, children: [
|
|
51
|
+
/* @__PURE__ */ jsxs(
|
|
52
|
+
Stack,
|
|
53
|
+
{
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
className: fileViewerContainer[file.error || error ? "error" : prominence],
|
|
56
|
+
direction: "row",
|
|
57
|
+
gap: 2,
|
|
58
|
+
justifyContent: "center",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
61
|
+
illustration,
|
|
62
|
+
/* @__PURE__ */ jsxs(Stack, { className: fileInfo, direction: "column", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
Text,
|
|
65
|
+
{
|
|
66
|
+
as: "p",
|
|
67
|
+
oneLine: true,
|
|
68
|
+
sentiment,
|
|
69
|
+
variant: "bodySmallStrong",
|
|
70
|
+
children: file.fileName
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(Text, { as: "p", sentiment, variant: "caption", children: formatFileSize(file.size) })
|
|
74
|
+
] })
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
Button,
|
|
78
|
+
{
|
|
79
|
+
"data-testid": `remove-${file.fileName}`,
|
|
80
|
+
onClick: () => {
|
|
81
|
+
const newFiles = files.filter(
|
|
82
|
+
(oldFile) => file.file !== oldFile.file
|
|
83
|
+
);
|
|
84
|
+
setFiles(newFiles);
|
|
85
|
+
onChangeFiles?.(newFiles);
|
|
86
|
+
},
|
|
87
|
+
sentiment,
|
|
88
|
+
size: "xsmall",
|
|
89
|
+
variant: "ghost",
|
|
90
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
file.error ? /* @__PURE__ */ jsx(Text, { as: "p", sentiment: "danger", variant: "caption", children: file.error }) : null
|
|
97
|
+
] }, file.fileName);
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}),
|
|
101
|
+
computedLimit && files.length > computedLimit ? /* @__PURE__ */ jsxs(
|
|
102
|
+
Button,
|
|
103
|
+
{
|
|
104
|
+
"data-testid": "see-all",
|
|
105
|
+
onClick: seeAllOnClick,
|
|
106
|
+
sentiment: "primary",
|
|
107
|
+
size: "large",
|
|
108
|
+
variant: "ghost",
|
|
109
|
+
children: [
|
|
110
|
+
textLimit,
|
|
111
|
+
" (",
|
|
112
|
+
files.length,
|
|
113
|
+
")"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
) : null
|
|
117
|
+
] }) : null;
|
|
118
|
+
};
|
|
119
|
+
export {
|
|
120
|
+
ListFiles
|
|
121
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/FileInput/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,QACiB,CAAA;AAEpE,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAoB9C,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const getMimeTypeType = (mimeType) => mimeType.split("/")?.[0]?.toLowerCase() || "example";
|
|
2
|
+
const formatFileSize = (bytes) => {
|
|
3
|
+
if (bytes === 0) {
|
|
4
|
+
return "0 B";
|
|
5
|
+
}
|
|
6
|
+
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
7
|
+
let size = bytes;
|
|
8
|
+
let unitIndex = 0;
|
|
9
|
+
while (size >= 1e3 && unitIndex < units.length - 1) {
|
|
10
|
+
size /= 1e3;
|
|
11
|
+
unitIndex += 1;
|
|
12
|
+
}
|
|
13
|
+
const formattedSize = size % 1 === 0 ? size : Number.parseFloat(size.toFixed(2));
|
|
14
|
+
return `${formattedSize} ${units[unitIndex]}`;
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
formatFileSize,
|
|
18
|
+
getMimeTypeType
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FileInputProps } from './types';
|
|
2
|
+
export declare const FileInput: (({ style, className, variant, size, title, children, onDrop, label, labelDescription, disabled, accept, "aria-label": ariaLabel, defaultFiles, onChangeFiles, helper, multiple, bottom, required, error, "data-testid": dataTestid, }: FileInputProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
|
+
Button: ({ children, disabled, ...props }: import("react").ComponentProps<typeof import("..").Button>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
List: ({ limit, textLimit, prominence, }: import("./types").ListProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FileInput/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,SAAS,CAAA;AAmTxD,eAAO,MAAM,SAAS,0OAzRnB,cAAc;;;CA4Rf,CAAA"}
|