@ngrok/mantle 0.0.1-alpha.0 → 0.0.1-alpha.10
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/assets/fonts/euclid-square/swisstypefaces-EULA.pdf +0 -0
- package/dist/back-to-top-button/index.d.ts +1 -0
- package/dist/back-to-top-button/index.d.ts.map +1 -0
- package/dist/button/index.d.ts +3 -2
- package/dist/button/index.d.ts.map +1 -0
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.d.ts.map +1 -0
- package/dist/{core → config}/tailwind.preset.d.ts +1 -0
- package/dist/config/tailwind.preset.d.ts.map +1 -0
- package/dist/cx/index.d.ts +1 -0
- package/dist/cx/index.d.ts.map +1 -0
- package/dist/dropdown-menu/index.d.ts +1 -0
- package/dist/dropdown-menu/index.d.ts.map +1 -0
- package/dist/hooks/use-matches-media-query.d.ts +1 -0
- package/dist/hooks/use-matches-media-query.d.ts.map +1 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +1 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +547 -0
- package/dist/index.js.map +1 -0
- package/dist/input/index.d.ts +4 -3
- package/dist/input/index.d.ts.map +1 -0
- package/dist/{types/input.d.ts → input/types.d.ts} +1 -0
- package/dist/input/types.d.ts.map +1 -0
- package/dist/media-object/index.d.ts +5 -5
- package/dist/media-object/index.d.ts.map +1 -0
- package/dist/portal/index.d.ts +1 -0
- package/dist/portal/index.d.ts.map +1 -0
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.d.ts.map +1 -0
- package/dist/tailwind.preset.js +321 -0
- package/dist/tailwind.preset.js.map +1 -0
- package/dist/theme-provider/index.d.ts +11 -9
- package/dist/theme-provider/index.d.ts.map +1 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.d.ts.map +1 -0
- package/dist/types/as-child.d.ts +1 -0
- package/dist/types/as-child.d.ts.map +1 -0
- package/dist/types/deep-non-nullable.d.ts +1 -0
- package/dist/types/deep-non-nullable.d.ts.map +1 -0
- package/dist/types/variant-props.d.ts +1 -0
- package/dist/types/variant-props.d.ts.map +1 -0
- package/dist/types/with-style-props.d.ts +1 -0
- package/dist/types/with-style-props.d.ts.map +1 -0
- package/package.json +18 -5
- package/dist/back-to-top-button/index.js +0 -22
- package/dist/button/index.js +0 -58
- package/dist/card/index.js +0 -33
- package/dist/core/tailwind.preset.js +0 -299
- package/dist/cx/index.js +0 -10
- package/dist/dropdown-menu/index.js +0 -32
- package/dist/hooks/use-matches-media-query.js +0 -21
- package/dist/hooks/use-prefers-reduced-motion.js +0 -28
- package/dist/input/index.js +0 -24
- package/dist/media-object/index.js +0 -27
- package/dist/portal/index.js +0 -3
- package/dist/select/index.js +0 -22
- package/dist/theme-provider/index.js +0 -143
- package/dist/tooltip/index.js +0 -10
- package/dist/types/as-child.js +0 -1
- package/dist/types/deep-non-nullable.js +0 -1
- package/dist/types/input.js +0 -1
- package/dist/types/variant-props.js +0 -1
- package/dist/types/with-style-props.js +0 -1
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-Bold-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-BoldItalic-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-Light-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-LightItalic-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-Medium-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-MediumItalic-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-Regular-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-RegularItalic-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-Semibold-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/euclid-square/EuclidSquare-SemiboldItalic-WebS.woff +0 -0
- /package/dist/{core → assets}/fonts/fonts.css +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-Bold.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-BoldItalic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-ExtraLight.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-ExtraLightItalic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-Italic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-Light.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-LightItalic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-Medium.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-MediumItalic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-Regular.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-SemiBold.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-SemiBoldItalic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-Text.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-TextItalic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-Thin.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/IBMPlexMono-ThinItalic.woff +0 -0
- /package/dist/{core → assets}/fonts/ibm-plex-mono/license.txt +0 -0
- /package/dist/{core → assets}/mantle.css +0 -0
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/back-to-top-button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,aAAa,EAAa,MAAM,OAAO,CAAC;AAM9D,KAAK,KAAK,GAAG;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,0CAAiD,KAAK,4CAuCjF,CAAC"}
|
package/dist/button/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const buttonVariants: (props?: ({
|
|
|
5
5
|
priority?: "default" | "primary" | "secondary" | null | undefined;
|
|
6
6
|
state?: "default" | "danger" | null | undefined;
|
|
7
7
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
9
|
type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
10
10
|
/**
|
|
11
11
|
* The props for the `Button` component.
|
|
@@ -23,5 +23,6 @@ declare const Button: import("react").ForwardRefExoticComponent<WithAsChild & Bu
|
|
|
23
23
|
priority?: "default" | "primary" | "secondary" | null | undefined;
|
|
24
24
|
state?: "default" | "danger" | null | undefined;
|
|
25
25
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
26
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
26
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string>>> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
27
27
|
export { Button, buttonVariants };
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAc,MAAM,OAAO,CAAC;AAK9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,QAAA,MAAM,cAAc;;;;mFA2CnB,CAAC;AAEF,KAAK,cAAc,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,cAAc,CAAC;AAEjG;;;;;;;GAOG;AACH,QAAA,MAAM,MAAM;;;;0IAMX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/card/index.d.ts
CHANGED
|
@@ -23,3 +23,4 @@ export type CardTitleProps = HTMLAttributes<HTMLHeadingElement> & WithAsChild;
|
|
|
23
23
|
* The title of a card. Usually composed as a direct child of a `CardHeader` component.
|
|
24
24
|
*/
|
|
25
25
|
export declare const CardTitle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & WithAsChild & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,IAAI,sGAIf,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,QAAQ,sGAInB,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,UAAU,sGAIrB,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,UAAU,sGAIrB,CAAC;AAGH,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,kBAAkB,CAAC,GAAG,WAAW,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,SAAS,mJAGpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.preset.d.ts","sourceRoot":"","sources":["../../components/config/tailwind.preset.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBAwSmB"}
|
package/dist/cx/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/cx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -25,3 +25,4 @@ declare const DropdownMenuShortcut: {
|
|
|
25
25
|
displayName: string;
|
|
26
26
|
};
|
|
27
27
|
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/dropdown-menu/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AAQvE,QAAA,MAAM,YAAY,6DAA6B,CAAC;AAEhD,QAAA,MAAM,mBAAmB,8IAAgC,CAAC;AAE1D,QAAA,MAAM,iBAAiB,yIAA8B,CAAC;AAEtD,QAAA,MAAM,kBAAkB,mEAA+B,CAAC;AAExD,QAAA,MAAM,eAAe,gEAA4B,CAAC;AAElD,QAAA,MAAM,sBAAsB,8IAAmC,CAAC;AAEhE,QAAA,MAAM,sBAAsB;;kDAkB1B,CAAC;AAGH,QAAA,MAAM,sBAAsB,2MAY1B,CAAC;AAGH,QAAA,MAAM,mBAAmB,wMAevB,CAAC;AAGH,QAAA,MAAM,gBAAgB;;kDAepB,CAAC;AAGH,QAAA,MAAM,wBAAwB,6MAoB5B,CAAC;AAGH,QAAA,MAAM,qBAAqB,0MAmBzB,CAAC;AAGH,QAAA,MAAM,iBAAiB;;kDAWrB,CAAC;AAGH,QAAA,MAAM,qBAAqB,0MAKzB,CAAC;AAGH,QAAA,MAAM,oBAAoB;8BAA6B,MAAM,cAAc,CAAC,eAAe,CAAC;;CAE3F,CAAC;AAGF,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-matches-media-query.d.ts","sourceRoot":"","sources":["../../components/hooks/use-matches-media-query.tsx"],"names":[],"mappings":"AAEA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAyBxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-prefers-reduced-motion.d.ts","sourceRoot":"","sources":["../../components/hooks/use-prefers-reduced-motion.tsx"],"names":[],"mappings":"AASA;;GAEG;AACH,wBAAgB,uBAAuB,YAuBtC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { Button } from "./button";
|
|
2
|
+
export { Card, CardBody, CardFooter, CardHeader, CardTitle } from "./card";
|
|
3
|
+
export { cx } from "./cx";
|
|
4
|
+
export { Input } from "./input";
|
|
5
|
+
export { MediaObject, MediaObjectMedia, MediaObjectContent } from "./media-object";
|
|
6
|
+
export { Select, SelectContent, SelectGroup, SelectIcon, SelectLabel, SelectOption, SelectSeparator, SelectTrigger, SelectValue, } from "./select";
|
|
7
|
+
export { ThemeProvider, PreventWrongThemeFlash, isTheme, useTheme } from "./theme-provider";
|
|
8
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./tooltip";
|
|
9
|
+
export type { ButtonProps } from "./button";
|
|
10
|
+
export type { CardProps, CardTitleProps } from "./card";
|
|
11
|
+
export type { InputProps } from "./input";
|
|
12
|
+
export type { AutoComplete, InputType } from "./input/types";
|
|
13
|
+
export type { Theme, ThemeProviderProps } from "./theme-provider";
|
|
14
|
+
export type { WithAsChild } from "./types/as-child";
|
|
15
|
+
export type { WithStyleProps } from "./types/with-style-props";
|
|
16
|
+
export type * from "./config/tailwind.preset";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../components/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EACN,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGrF,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,mBAAmB,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ngrok/mantle v0.0.1-alpha.10
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) ngrok.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
|
+
import { forwardRef, useState, useEffect, useMemo, useContext, createContext } from 'react';
|
|
13
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
14
|
+
import { cva } from 'class-variance-authority';
|
|
15
|
+
import { clsx } from 'clsx';
|
|
16
|
+
import { twMerge } from 'tailwind-merge';
|
|
17
|
+
import { CaretSortIcon, CheckIcon } from '@radix-ui/react-icons';
|
|
18
|
+
import { Trigger, Content, Label, Item, Separator, Root, Group, Value, Icon, Portal, Viewport, ItemIndicator, ItemText } from '@radix-ui/react-select';
|
|
19
|
+
import invariant from 'tiny-invariant';
|
|
20
|
+
import { Content as Content$1, Provider, Root as Root$1, Trigger as Trigger$1 } from '@radix-ui/react-tooltip';
|
|
21
|
+
|
|
22
|
+
function _extends() {
|
|
23
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
24
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
25
|
+
var source = arguments[i];
|
|
26
|
+
for (var key in source) {
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
28
|
+
target[key] = source[key];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
return _extends.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
37
|
+
if (source == null) return {};
|
|
38
|
+
var target = {};
|
|
39
|
+
var sourceKeys = Object.keys(source);
|
|
40
|
+
var key, i;
|
|
41
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
42
|
+
key = sourceKeys[i];
|
|
43
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
44
|
+
target[key] = source[key];
|
|
45
|
+
}
|
|
46
|
+
return target;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Conditionally add Tailwind (and other) CSS classes.
|
|
51
|
+
*
|
|
52
|
+
* Allows for tailwind overrides in LTR-specificity-like order of applied classes.
|
|
53
|
+
*/
|
|
54
|
+
function cx() {
|
|
55
|
+
for (var _len = arguments.length, inputs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
56
|
+
inputs[_key] = arguments[_key];
|
|
57
|
+
}
|
|
58
|
+
return twMerge(clsx(inputs));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var _excluded$4 = ["className", "priority", "size", "state", "asChild"];
|
|
62
|
+
var buttonVariants = cva("inline-flex items-center justify-center rounded-md font-medium border transition-colors focus-visible:outline-none focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50", {
|
|
63
|
+
variants: {
|
|
64
|
+
priority: {
|
|
65
|
+
default: "border-blue-500 text-blue-500 bg-white hover:bg-blue-50 active:bg-blue-100 focus-visible:ring-blue-600/25",
|
|
66
|
+
primary: "bg-blue-500 text-button hover:bg-blue-600 active:bg-blue-700 focus-visible:ring-blue-600/25",
|
|
67
|
+
secondary: "bg-blue-50 border-blue-200 text-blue-900 hover:bg-blue-100 active:bg-blue-200 focus-visible:ring-blue-600/25"
|
|
68
|
+
},
|
|
69
|
+
state: {
|
|
70
|
+
default: "",
|
|
71
|
+
danger: ""
|
|
72
|
+
},
|
|
73
|
+
size: {
|
|
74
|
+
default: "h-10 px-4 py-2",
|
|
75
|
+
sm: "h-9 rounded-md px-3 text-sm",
|
|
76
|
+
lg: "h-12 rounded-md px-6 text-lg"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
priority: "default",
|
|
81
|
+
size: "default"
|
|
82
|
+
},
|
|
83
|
+
compoundVariants: [{
|
|
84
|
+
priority: "default",
|
|
85
|
+
state: "danger",
|
|
86
|
+
class: "border-red-500 text-red-500 hover:bg-red-50 active:bg-red-100 focus-visible:ring-red-600/25"
|
|
87
|
+
}, {
|
|
88
|
+
priority: "primary",
|
|
89
|
+
state: "danger",
|
|
90
|
+
class: "bg-red-500 hover:bg-red-600 active:bg-red-700 focus-visible:ring-red-600/25"
|
|
91
|
+
}, {
|
|
92
|
+
priority: "secondary",
|
|
93
|
+
state: "danger",
|
|
94
|
+
class: "bg-red-50 border-red-200 text-red-900 hover:bg-red-100 active:bg-red-200 focus-visible:ring-red-600/25"
|
|
95
|
+
}]
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Renders a button or a component that looks like a button, an interactive
|
|
99
|
+
* element activated by a user with a mouse, keyboard, finger, voice command, or
|
|
100
|
+
* other assistive technology. Once activated, it then performs an action, such
|
|
101
|
+
* as submitting a form or opening a dialog.
|
|
102
|
+
*
|
|
103
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
|
|
104
|
+
*/
|
|
105
|
+
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
106
|
+
var className = _ref.className,
|
|
107
|
+
_ref$priority = _ref.priority,
|
|
108
|
+
priority = _ref$priority === void 0 ? "default" : _ref$priority,
|
|
109
|
+
_ref$size = _ref.size,
|
|
110
|
+
size = _ref$size === void 0 ? "default" : _ref$size,
|
|
111
|
+
_ref$state = _ref.state,
|
|
112
|
+
state = _ref$state === void 0 ? "default" : _ref$state,
|
|
113
|
+
_ref$asChild = _ref.asChild,
|
|
114
|
+
asChild = _ref$asChild === void 0 ? false : _ref$asChild,
|
|
115
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
116
|
+
var Comp = asChild ? Slot : "button";
|
|
117
|
+
return jsx(Comp, _extends({
|
|
118
|
+
className: cx(buttonVariants({
|
|
119
|
+
priority: priority,
|
|
120
|
+
size: size,
|
|
121
|
+
state: state,
|
|
122
|
+
className: className
|
|
123
|
+
})),
|
|
124
|
+
ref: ref
|
|
125
|
+
}, props));
|
|
126
|
+
});
|
|
127
|
+
Button.displayName = "Button";
|
|
128
|
+
|
|
129
|
+
var _excluded$3 = ["className", "children"],
|
|
130
|
+
_excluded2$1 = ["className", "children"],
|
|
131
|
+
_excluded3$1 = ["className", "children"],
|
|
132
|
+
_excluded4$1 = ["className", "children"],
|
|
133
|
+
_excluded5$1 = ["className", "asChild"];
|
|
134
|
+
/**
|
|
135
|
+
* A container that can be used to display content in a box resembling a playing
|
|
136
|
+
* card.
|
|
137
|
+
*/
|
|
138
|
+
var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
139
|
+
var className = _ref.className,
|
|
140
|
+
children = _ref.children,
|
|
141
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
142
|
+
return jsx("div", _extends({
|
|
143
|
+
ref: ref,
|
|
144
|
+
className: cx("relative rounded border bg-white", className)
|
|
145
|
+
}, rest, {
|
|
146
|
+
children: children
|
|
147
|
+
}));
|
|
148
|
+
});
|
|
149
|
+
Card.displayName = "Card";
|
|
150
|
+
/**
|
|
151
|
+
* The main content of a card. Usually composed as a direct child of a `Card` component.
|
|
152
|
+
*/
|
|
153
|
+
var CardBody = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
154
|
+
var className = _ref2.className,
|
|
155
|
+
children = _ref2.children,
|
|
156
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
|
|
157
|
+
return jsx("div", _extends({
|
|
158
|
+
ref: ref,
|
|
159
|
+
className: cx("p-6", className)
|
|
160
|
+
}, rest, {
|
|
161
|
+
children: children
|
|
162
|
+
}));
|
|
163
|
+
});
|
|
164
|
+
CardBody.displayName = "CardBody";
|
|
165
|
+
/**
|
|
166
|
+
* The footer container of a card. Usually composed as a direct child of a `Card` component.
|
|
167
|
+
*/
|
|
168
|
+
var CardFooter = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
169
|
+
var className = _ref3.className,
|
|
170
|
+
children = _ref3.children,
|
|
171
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3$1);
|
|
172
|
+
return jsx("div", _extends({
|
|
173
|
+
ref: ref,
|
|
174
|
+
className: cx("border-t px-6 py-3", className)
|
|
175
|
+
}, rest, {
|
|
176
|
+
children: children
|
|
177
|
+
}));
|
|
178
|
+
});
|
|
179
|
+
CardFooter.displayName = "CardFooter";
|
|
180
|
+
/**
|
|
181
|
+
* The header container of a card. Usually composed as a direct child of a `Card` component.
|
|
182
|
+
*/
|
|
183
|
+
var CardHeader = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
184
|
+
var className = _ref4.className,
|
|
185
|
+
children = _ref4.children,
|
|
186
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded4$1);
|
|
187
|
+
return jsx("div", _extends({
|
|
188
|
+
ref: ref,
|
|
189
|
+
className: cx("border-b px-6 py-3", className)
|
|
190
|
+
}, rest, {
|
|
191
|
+
children: children
|
|
192
|
+
}));
|
|
193
|
+
});
|
|
194
|
+
CardHeader.displayName = "CardHeader";
|
|
195
|
+
/**
|
|
196
|
+
* The title of a card. Usually composed as a direct child of a `CardHeader` component.
|
|
197
|
+
*/
|
|
198
|
+
var CardTitle = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
|
199
|
+
var className = _ref5.className,
|
|
200
|
+
asChild = _ref5.asChild,
|
|
201
|
+
props = _objectWithoutPropertiesLoose(_ref5, _excluded5$1);
|
|
202
|
+
var Comp = asChild ? Slot : "h3";
|
|
203
|
+
return jsx(Comp, _extends({
|
|
204
|
+
ref: ref,
|
|
205
|
+
className: cx("font-semibold leading-none tracking-tight", className)
|
|
206
|
+
}, props));
|
|
207
|
+
});
|
|
208
|
+
CardTitle.displayName = "CardTitle";
|
|
209
|
+
|
|
210
|
+
var _excluded$2 = ["className", "state", "type"];
|
|
211
|
+
var inputVariants = cva("flex h-10 w-full rounded-md border bg-white px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-4 disabled:cursor-not-allowed disabled:opacity-50", {
|
|
212
|
+
variants: {
|
|
213
|
+
state: {
|
|
214
|
+
default: "text-gray-900 border-gray-300 placeholder:text-gray-400 focus:border-blue-500 focus-visible:ring-blue-600/25",
|
|
215
|
+
danger: "text-red-900 border-red-500 placeholder:text-red-400 focus:border-red-500 focus-visible:ring-red-600/25",
|
|
216
|
+
success: "text-green-900 border-green-500 placeholder:text-green-400 focus:border-green-500 focus-visible:ring-green-600/25"
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
defaultVariants: {
|
|
220
|
+
state: "default"
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
/**
|
|
224
|
+
* Used to create interactive controls for web-based forms in order to accept data from the user
|
|
225
|
+
*/
|
|
226
|
+
var Input = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
227
|
+
var className = _ref.className,
|
|
228
|
+
_ref$state = _ref.state,
|
|
229
|
+
state = _ref$state === void 0 ? "default" : _ref$state,
|
|
230
|
+
_ref$type = _ref.type,
|
|
231
|
+
type = _ref$type === void 0 ? "text" : _ref$type,
|
|
232
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
233
|
+
return jsx("input", _extends({
|
|
234
|
+
className: cx(inputVariants({
|
|
235
|
+
state: state
|
|
236
|
+
}), className),
|
|
237
|
+
ref: ref,
|
|
238
|
+
type: type
|
|
239
|
+
}, props));
|
|
240
|
+
});
|
|
241
|
+
Input.displayName = "Input";
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The media object is an image/icon (media) to the left, with descriptive
|
|
245
|
+
* content (title and subtitle/description) to the right.
|
|
246
|
+
*
|
|
247
|
+
* Change the spacing between the media and content by passing a `gap-*` class.
|
|
248
|
+
* The default gap is `gap-4`.
|
|
249
|
+
*
|
|
250
|
+
* Use flexbox utilities to change the alignment of the media and content.
|
|
251
|
+
*
|
|
252
|
+
* Compose the media object with the `MediaObjectMedia` and `MediaObjectContent`
|
|
253
|
+
* components as direct children.
|
|
254
|
+
*/
|
|
255
|
+
var MediaObject = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
256
|
+
var className = _ref.className,
|
|
257
|
+
children = _ref.children,
|
|
258
|
+
style = _ref.style;
|
|
259
|
+
return jsx("div", {
|
|
260
|
+
ref: ref,
|
|
261
|
+
className: cx("flex gap-4", className),
|
|
262
|
+
style: style,
|
|
263
|
+
children: children
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
MediaObject.displayName = "MediaObject";
|
|
267
|
+
/**
|
|
268
|
+
* The container for an image or icon to display in the media slot of the media object.
|
|
269
|
+
*/
|
|
270
|
+
var MediaObjectMedia = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
271
|
+
var className = _ref2.className,
|
|
272
|
+
children = _ref2.children,
|
|
273
|
+
style = _ref2.style;
|
|
274
|
+
return jsx("div", {
|
|
275
|
+
ref: ref,
|
|
276
|
+
className: cx("shrink-0 leading-none", className),
|
|
277
|
+
style: style,
|
|
278
|
+
children: children
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
MediaObjectMedia.displayName = "MediaObjectMedia";
|
|
282
|
+
/**
|
|
283
|
+
* The container for the content slot of a media object.
|
|
284
|
+
*/
|
|
285
|
+
var MediaObjectContent = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
286
|
+
var className = _ref3.className,
|
|
287
|
+
children = _ref3.children,
|
|
288
|
+
style = _ref3.style;
|
|
289
|
+
return jsx("div", {
|
|
290
|
+
ref: ref,
|
|
291
|
+
className: cx("min-w-0 flex-1", className),
|
|
292
|
+
style: style,
|
|
293
|
+
children: children
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
MediaObjectContent.displayName = "MediaObjectContent";
|
|
297
|
+
|
|
298
|
+
var _excluded$1 = ["className", "children", "hideIcon"],
|
|
299
|
+
_excluded2 = ["className", "children", "position"],
|
|
300
|
+
_excluded3 = ["className"],
|
|
301
|
+
_excluded4 = ["className", "children"],
|
|
302
|
+
_excluded5 = ["className"];
|
|
303
|
+
var Select = Root;
|
|
304
|
+
var SelectGroup = Group;
|
|
305
|
+
var SelectValue = Value;
|
|
306
|
+
var SelectIcon = Icon;
|
|
307
|
+
var SelectTrigger = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
308
|
+
var className = _ref.className,
|
|
309
|
+
children = _ref.children,
|
|
310
|
+
_ref$hideIcon = _ref.hideIcon,
|
|
311
|
+
hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
|
|
312
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
313
|
+
return jsxs(Trigger, _extends({
|
|
314
|
+
ref: ref,
|
|
315
|
+
className: cx("flex h-10 w-full items-center justify-between rounded-md border border-gray-500 bg-white px-3 py-2 placeholder:text-gray-300 focus:border-blue-500 focus:outline-none focus:ring-4 focus:ring-blue-600/25 disabled:cursor-not-allowed disabled:opacity-50", className)
|
|
316
|
+
}, props, {
|
|
317
|
+
children: [children, !hideIcon && jsx(Icon, {
|
|
318
|
+
asChild: true,
|
|
319
|
+
children: jsx(CaretSortIcon, {
|
|
320
|
+
className: "h-4 w-4 opacity-50"
|
|
321
|
+
})
|
|
322
|
+
})]
|
|
323
|
+
}));
|
|
324
|
+
});
|
|
325
|
+
SelectTrigger.displayName = Trigger.displayName;
|
|
326
|
+
var SelectContent = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
327
|
+
var className = _ref2.className,
|
|
328
|
+
children = _ref2.children,
|
|
329
|
+
_ref2$position = _ref2.position,
|
|
330
|
+
position = _ref2$position === void 0 ? "popper" : _ref2$position,
|
|
331
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
332
|
+
return jsx(Portal, {
|
|
333
|
+
children: jsx(Content, _extends({
|
|
334
|
+
ref: ref,
|
|
335
|
+
className: cx("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white text-gray-900 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
336
|
+
position: position
|
|
337
|
+
}, props, {
|
|
338
|
+
children: jsx(Viewport, {
|
|
339
|
+
className: cx("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
|
|
340
|
+
children: children
|
|
341
|
+
})
|
|
342
|
+
}))
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
SelectContent.displayName = Content.displayName;
|
|
346
|
+
var SelectLabel = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
347
|
+
var className = _ref3.className,
|
|
348
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
349
|
+
return jsx(Label, _extends({
|
|
350
|
+
ref: ref,
|
|
351
|
+
className: cx("px-2 py-1.5 text-sm font-semibold", className)
|
|
352
|
+
}, props));
|
|
353
|
+
});
|
|
354
|
+
SelectLabel.displayName = Label.displayName;
|
|
355
|
+
var SelectOption = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
356
|
+
var className = _ref4.className,
|
|
357
|
+
children = _ref4.children,
|
|
358
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
|
|
359
|
+
return jsxs(Item, _extends({
|
|
360
|
+
ref: ref,
|
|
361
|
+
className: cx("relative flex w-full cursor-pointer items-center rounded-sm py-1.5 pl-2 pr-2 text-sm outline-none focus:bg-blue-500 focus:text-button data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className)
|
|
362
|
+
}, props, {
|
|
363
|
+
children: [jsx("span", {
|
|
364
|
+
className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
365
|
+
children: jsx(ItemIndicator, {
|
|
366
|
+
children: jsx(CheckIcon, {
|
|
367
|
+
className: "h-4 w-4"
|
|
368
|
+
})
|
|
369
|
+
})
|
|
370
|
+
}), jsx(ItemText, {
|
|
371
|
+
children: children
|
|
372
|
+
})]
|
|
373
|
+
}));
|
|
374
|
+
});
|
|
375
|
+
SelectOption.displayName = Item.displayName;
|
|
376
|
+
var SelectSeparator = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
|
377
|
+
var className = _ref5.className,
|
|
378
|
+
props = _objectWithoutPropertiesLoose(_ref5, _excluded5);
|
|
379
|
+
return jsx(Separator, _extends({
|
|
380
|
+
ref: ref,
|
|
381
|
+
className: cx("-mx-1 my-1 h-px bg-muted", className)
|
|
382
|
+
}, props));
|
|
383
|
+
});
|
|
384
|
+
SelectSeparator.displayName = Separator.displayName;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* prefersDarkModeMediaQuery is the media query used to detect if the user prefers dark mode.
|
|
388
|
+
*/
|
|
389
|
+
var prefersDarkModeMediaQuery = "(prefers-color-scheme: dark)";
|
|
390
|
+
/**
|
|
391
|
+
* prefersHighContrastMediaQuery is the media query used to detect if the user prefers high contrast mode.
|
|
392
|
+
*/
|
|
393
|
+
var prefersHighContrastMediaQuery = "(prefers-contrast: more)";
|
|
394
|
+
/**
|
|
395
|
+
* themes is a tuple of valid themes.
|
|
396
|
+
*/
|
|
397
|
+
var themes = ["system", "light", "dark", "light-high-contrast", "dark-high-contrast"];
|
|
398
|
+
/**
|
|
399
|
+
* Type predicate that checks if a value is a valid theme.
|
|
400
|
+
*/
|
|
401
|
+
function isTheme(value) {
|
|
402
|
+
if (typeof value !== "string") {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
return themes.includes(value);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* DEFAULT_STORAGE_KEY is the default key used to store the theme in localStorage.
|
|
409
|
+
*/
|
|
410
|
+
var DEFAULT_STORAGE_KEY = "mantle-ui-theme";
|
|
411
|
+
/**
|
|
412
|
+
* Initial state for the ThemeProviderContext.
|
|
413
|
+
*/
|
|
414
|
+
var initialState = ["system", function () {
|
|
415
|
+
return null;
|
|
416
|
+
}];
|
|
417
|
+
/**
|
|
418
|
+
* ThemeProviderContext is a React Context that provides the current theme and a function to set the theme.
|
|
419
|
+
*/
|
|
420
|
+
var ThemeProviderContext = /*#__PURE__*/createContext(initialState);
|
|
421
|
+
/**
|
|
422
|
+
* isBrowser returns true if the code is running in a browser environment.
|
|
423
|
+
*/
|
|
424
|
+
var isBrowser = function isBrowser() {
|
|
425
|
+
return typeof window !== "undefined";
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* determines the initial theme based on the default theme and the value stored in localStorage by the storageKey
|
|
429
|
+
*/
|
|
430
|
+
function determineInitialTheme(defaultTheme, storageKey) {
|
|
431
|
+
var fallback = defaultTheme != null ? defaultTheme : "system";
|
|
432
|
+
if (isBrowser()) {
|
|
433
|
+
var _window$localStorage$;
|
|
434
|
+
return (_window$localStorage$ = window.localStorage.getItem(storageKey)) != null ? _window$localStorage$ : fallback;
|
|
435
|
+
}
|
|
436
|
+
return fallback;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* ThemeProvider is a React Context Provider that provides the current theme and a function to set the theme.
|
|
440
|
+
*/
|
|
441
|
+
function ThemeProvider(_ref) {
|
|
442
|
+
var children = _ref.children,
|
|
443
|
+
_ref$defaultTheme = _ref.defaultTheme,
|
|
444
|
+
defaultTheme = _ref$defaultTheme === void 0 ? "system" : _ref$defaultTheme,
|
|
445
|
+
_ref$storageKey = _ref.storageKey,
|
|
446
|
+
storageKey = _ref$storageKey === void 0 ? DEFAULT_STORAGE_KEY : _ref$storageKey;
|
|
447
|
+
var _useState = useState(function () {
|
|
448
|
+
var initialTheme = determineInitialTheme(defaultTheme, storageKey);
|
|
449
|
+
applyTheme(initialTheme);
|
|
450
|
+
return initialTheme;
|
|
451
|
+
}),
|
|
452
|
+
theme = _useState[0],
|
|
453
|
+
setTheme = _useState[1];
|
|
454
|
+
useEffect(function () {
|
|
455
|
+
var storedTheme = window.localStorage.getItem(storageKey);
|
|
456
|
+
if (isTheme(storedTheme)) {
|
|
457
|
+
setTheme(storedTheme);
|
|
458
|
+
applyTheme(storedTheme);
|
|
459
|
+
}
|
|
460
|
+
}, [storageKey]);
|
|
461
|
+
var value = useMemo(function () {
|
|
462
|
+
return [theme, function (theme) {
|
|
463
|
+
window.localStorage.setItem(storageKey, theme);
|
|
464
|
+
setTheme(theme);
|
|
465
|
+
applyTheme(theme);
|
|
466
|
+
}];
|
|
467
|
+
}, [theme, storageKey]);
|
|
468
|
+
return jsx(ThemeProviderContext.Provider, {
|
|
469
|
+
value: value,
|
|
470
|
+
children: children
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* useTheme returns the current theme and a function to set the theme.
|
|
475
|
+
*
|
|
476
|
+
* @note This function will throw an error if used outside of a ThemeProvider context tree.
|
|
477
|
+
*/
|
|
478
|
+
function useTheme() {
|
|
479
|
+
var context = useContext(ThemeProviderContext);
|
|
480
|
+
!context ? process.env.NODE_ENV !== "production" ? invariant(false, "useTheme must be used within a ThemeProvider") : invariant(false) : void 0;
|
|
481
|
+
return context;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Applies the given theme to the <html> element.
|
|
485
|
+
*/
|
|
486
|
+
function applyTheme(theme) {
|
|
487
|
+
var _htmlElement$classLis;
|
|
488
|
+
if (!isBrowser()) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
var htmlElement = window.document.documentElement;
|
|
492
|
+
(_htmlElement$classLis = htmlElement.classList).remove.apply(_htmlElement$classLis, themes);
|
|
493
|
+
var prefersDarkMode = window.matchMedia(prefersDarkModeMediaQuery).matches;
|
|
494
|
+
var prefersContrastMore = window.matchMedia(prefersHighContrastMediaQuery).matches;
|
|
495
|
+
var newTheme = theme === "system" ? determineThemeFromMediaQuery({
|
|
496
|
+
prefersDarkMode: prefersDarkMode,
|
|
497
|
+
prefersContrastMore: prefersContrastMore
|
|
498
|
+
}) : theme;
|
|
499
|
+
htmlElement.classList.add(newTheme);
|
|
500
|
+
htmlElement.dataset.theme = newTheme;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* determineThemeFromMediaQuery returns the theme that should be used based on the user's media query preferences.
|
|
504
|
+
*/
|
|
505
|
+
function determineThemeFromMediaQuery(_ref2) {
|
|
506
|
+
var prefersDarkMode = _ref2.prefersDarkMode,
|
|
507
|
+
prefersContrastMore = _ref2.prefersContrastMore;
|
|
508
|
+
if (prefersContrastMore) {
|
|
509
|
+
return prefersDarkMode ? "dark-high-contrast" : "light-high-contrast";
|
|
510
|
+
}
|
|
511
|
+
return prefersDarkMode ? "dark" : "light";
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* PreventWrongThemeFlash is a React component that prevents the wrong theme from flashing on initial page load.
|
|
515
|
+
* Render as high as possible in the DOM, preferably in the <head> element.
|
|
516
|
+
*/
|
|
517
|
+
var PreventWrongThemeFlash = function PreventWrongThemeFlash(_ref3) {
|
|
518
|
+
var _ref3$defaultTheme = _ref3.defaultTheme,
|
|
519
|
+
defaultTheme = _ref3$defaultTheme === void 0 ? "system" : _ref3$defaultTheme,
|
|
520
|
+
_ref3$storageKey = _ref3.storageKey,
|
|
521
|
+
storageKey = _ref3$storageKey === void 0 ? DEFAULT_STORAGE_KEY : _ref3$storageKey;
|
|
522
|
+
return jsx("script", {
|
|
523
|
+
dangerouslySetInnerHTML: {
|
|
524
|
+
__html: ("\n(function() {\n\tconst themes = " + JSON.stringify(themes) + ";\n\tconst isTheme = (value) => typeof value === \"string\" && themes.includes(value);\n\tconst fallbackTheme = \"" + defaultTheme + "\" ?? \"system\";\n\tconst maybeStoredTheme = window.localStorage.getItem(\"" + storageKey + "\");\n\tconst themePreference = isTheme(maybeStoredTheme) ? maybeStoredTheme : fallbackTheme;\n\tconst prefersDarkMode = window.matchMedia(\"" + prefersDarkModeMediaQuery + "\").matches;\n\tconst prefersContrastMore = window.matchMedia(\"" + prefersHighContrastMediaQuery + "\").matches;\n\tlet initialTheme = themePreference;\n\tif (initialTheme === \"system\") {\n\t\tif (prefersContrastMore) {\n\t\t\tinitialTheme = prefersDarkMode ? \"dark-high-contrast\" : \"light-high-contrast\";\n\t\t} else {\n\t\t\tinitialTheme = prefersDarkMode ? \"dark\" : \"light\";\n\t\t}\n\t}\n\tconst htmlElement = document.documentElement;\n\thtmlElement.classList.remove(...themes);\n\thtmlElement.classList.add(initialTheme);\n\thtmlElement.dataset.theme = initialTheme;\n})();\n").trim()
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
var _excluded = ["className", "sideOffset"];
|
|
530
|
+
var TooltipProvider = Provider;
|
|
531
|
+
var Tooltip = Root$1;
|
|
532
|
+
var TooltipTrigger = Trigger$1;
|
|
533
|
+
var TooltipContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
534
|
+
var className = _ref.className,
|
|
535
|
+
_ref$sideOffset = _ref.sideOffset,
|
|
536
|
+
sideOffset = _ref$sideOffset === void 0 ? 4 : _ref$sideOffset,
|
|
537
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
538
|
+
return jsx(Content$1, _extends({
|
|
539
|
+
ref: ref,
|
|
540
|
+
sideOffset: sideOffset,
|
|
541
|
+
className: cx("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className)
|
|
542
|
+
}, props));
|
|
543
|
+
});
|
|
544
|
+
TooltipContent.displayName = Content$1.displayName;
|
|
545
|
+
|
|
546
|
+
export { Button, Card, CardBody, CardFooter, CardHeader, CardTitle, Input, MediaObject, MediaObjectContent, MediaObjectMedia, PreventWrongThemeFlash, Select, SelectContent, SelectGroup, SelectIcon, SelectLabel, SelectOption, SelectSeparator, SelectTrigger, SelectValue, ThemeProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cx, isTheme, useTheme };
|
|
547
|
+
//# sourceMappingURL=index.js.map
|