untitledui 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/add.js +339 -0
- package/dist/commands/init.js +436 -0
- package/dist/helper/download-tar-api.js +129 -0
- package/dist/helper/download-tar.js +81 -0
- package/dist/helper/find-css-file.js +19 -0
- package/dist/helper/formatText.js +37 -0
- package/dist/helper/get-components-api.js +47 -0
- package/dist/helper/get-components-list.js +62 -0
- package/dist/helper/get-components.js +19 -0
- package/dist/helper/get-config.js +163 -0
- package/dist/helper/get-package-info.js +99 -0
- package/dist/helper/get-pkg-manager.js +16 -0
- package/dist/helper/get-project.js +176 -0
- package/dist/helper/install-template.js +29 -0
- package/dist/helper/match-color-css.js +82 -0
- package/dist/helper/update-color-css.js +134 -0
- package/dist/index.js +25 -0
- package/dist/package.json +50 -0
- package/dist/res/components.json +520 -0
- package/dist/res/config.json +3 -0
- package/package.json +61 -0
- package/templates/default/.prettierrc +10 -0
- package/templates/default/README.md +36 -0
- package/templates/default/eslint.config.mjs +58 -0
- package/templates/default/next.config.ts +6 -0
- package/templates/default/package.json +57 -0
- package/templates/default/postcss.config.js +5 -0
- package/templates/default/public/favicon.ico +0 -0
- package/templates/default/public/marketing/smiling-girl.png +0 -0
- package/templates/default/public/marketing/spirals.webp +0 -0
- package/templates/default/src/app/home-screen.tsx +109 -0
- package/templates/default/src/app/layout.tsx +42 -0
- package/templates/default/src/app/not-found.tsx +40 -0
- package/templates/default/src/app/page.tsx +3 -0
- package/templates/default/src/components/foundations/dot-icon.tsx +27 -0
- package/templates/default/src/components/foundations/featured-icon/featured-icons.tsx +153 -0
- package/templates/default/src/components/foundations/logo/UntitledLogo.tsx +63 -0
- package/templates/default/src/components/foundations/logo/UntitledLogoMinimal.tsx +164 -0
- package/templates/default/src/components/foundations/payment-icons/amex-icon.tsx +19 -0
- package/templates/default/src/components/foundations/payment-icons/apple-pay-icon.tsx +27 -0
- package/templates/default/src/components/foundations/payment-icons/discover-icon.tsx +34 -0
- package/templates/default/src/components/foundations/payment-icons/index.tsx +10 -0
- package/templates/default/src/components/foundations/payment-icons/mastercard-icon.tsx +39 -0
- package/templates/default/src/components/foundations/payment-icons/paypal-icon.tsx +45 -0
- package/templates/default/src/components/foundations/payment-icons/stripe-icon.tsx +27 -0
- package/templates/default/src/components/foundations/payment-icons/union-pay-icon.tsx +37 -0
- package/templates/default/src/components/foundations/payment-icons/visa-icon.tsx +27 -0
- package/templates/default/src/components/marketing/header-navigation/base-components/nav-menu-item.tsx +41 -0
- package/templates/default/src/components/marketing/header-navigation/components/header.tsx +245 -0
- package/templates/default/src/components/marketing/header-navigation/dropdown-header-navigation.tsx +53 -0
- package/templates/default/src/components/shared/avatar/avatar-label-group.tsx +32 -0
- package/templates/default/src/components/shared/avatar/avatar-profile-photo.tsx +84 -0
- package/templates/default/src/components/shared/avatar/avatar.tsx +131 -0
- package/templates/default/src/components/shared/avatar/base-components/avatar-add-button.tsx +33 -0
- package/templates/default/src/components/shared/avatar/base-components/avatar-company-icon.tsx +26 -0
- package/templates/default/src/components/shared/avatar/base-components/avatar-online-indicator.tsx +31 -0
- package/templates/default/src/components/shared/avatar/base-components/index.ts +4 -0
- package/templates/default/src/components/shared/avatar/base-components/verified-tick.tsx +34 -0
- package/templates/default/src/components/shared/avatar/utils.ts +12 -0
- package/templates/default/src/components/shared/badges/badge-groups.tsx +176 -0
- package/templates/default/src/components/shared/badges/badge-types.ts +264 -0
- package/templates/default/src/components/shared/badges/badges.tsx +479 -0
- package/templates/default/src/components/shared/button-group/button-group.tsx +97 -0
- package/templates/default/src/components/shared/buttons/app-store-buttons-outline.tsx +454 -0
- package/templates/default/src/components/shared/buttons/app-store-buttons.tsx +806 -0
- package/templates/default/src/components/shared/buttons/button-utility.tsx +87 -0
- package/templates/default/src/components/shared/buttons/button.tsx +284 -0
- package/templates/default/src/components/shared/buttons/close-button.tsx +39 -0
- package/templates/default/src/components/shared/buttons/social-button.tsx +135 -0
- package/templates/default/src/components/shared/buttons/social-logos.tsx +115 -0
- package/templates/default/src/components/shared/checkbox/checkbox.tsx +120 -0
- package/templates/default/src/components/shared/dropdown/dropdown.tsx +138 -0
- package/templates/default/src/components/shared/input-dropdown/combobox.tsx +161 -0
- package/templates/default/src/components/shared/input-dropdown/dropdown-item.tsx +98 -0
- package/templates/default/src/components/shared/input-dropdown/input-dropdown.tsx +172 -0
- package/templates/default/src/components/shared/input-dropdown/multi-select.tsx +373 -0
- package/templates/default/src/components/shared/input-dropdown/popover.tsx +36 -0
- package/templates/default/src/components/shared/input-dropdown/select.tsx +63 -0
- package/templates/default/src/components/shared/inputs/file-upload-trigger.tsx +74 -0
- package/templates/default/src/components/shared/inputs/form/form.tsx +10 -0
- package/templates/default/src/components/shared/inputs/hint-text.tsx +34 -0
- package/templates/default/src/components/shared/inputs/input/index.tsx +189 -0
- package/templates/default/src/components/shared/inputs/input/input-payment.tsx +134 -0
- package/templates/default/src/components/shared/inputs/input/input-with-button.tsx +69 -0
- package/templates/default/src/components/shared/inputs/input/input-with-dropdown.tsx +178 -0
- package/templates/default/src/components/shared/inputs/input/input-with-prefix.tsx +74 -0
- package/templates/default/src/components/shared/inputs/label.tsx +46 -0
- package/templates/default/src/components/shared/inputs/textarea/textarea.tsx +82 -0
- package/templates/default/src/components/shared/progress-indicators/progress-circles.tsx +176 -0
- package/templates/default/src/components/shared/progress-indicators/progress-indicators.tsx +86 -0
- package/templates/default/src/components/shared/progress-indicators/simple-circle.tsx +29 -0
- package/templates/default/src/components/shared/radio-buttons/radio-buttons.tsx +125 -0
- package/templates/default/src/components/shared/radio-groups/radio-group-avatar.tsx +62 -0
- package/templates/default/src/components/shared/radio-groups/radio-group-checkbox.tsx +72 -0
- package/templates/default/src/components/shared/radio-groups/radio-group-icon-card.tsx +95 -0
- package/templates/default/src/components/shared/radio-groups/radio-group-icon-simple.tsx +70 -0
- package/templates/default/src/components/shared/radio-groups/radio-group-payment-icon.tsx +71 -0
- package/templates/default/src/components/shared/radio-groups/radio-group-radio-button.tsx +76 -0
- package/templates/default/src/components/shared/radio-groups/radio-groups.tsx +8 -0
- package/templates/default/src/components/shared/slider/slider.tsx +76 -0
- package/templates/default/src/components/shared/tags/base-components/tag-checkbox.tsx +47 -0
- package/templates/default/src/components/shared/tags/base-components/tag-close-x.tsx +34 -0
- package/templates/default/src/components/shared/tags/tags.tsx +162 -0
- package/templates/default/src/components/shared/toggle/toggle.tsx +140 -0
- package/templates/default/src/components/shared/tooltips/tooltips.tsx +140 -0
- package/templates/default/src/components/utils/index.ts +48 -0
- package/templates/default/src/components/utils/isDeepEqual.ts +31 -0
- package/templates/default/src/components/utils/isReactComponent.ts +22 -0
- package/templates/default/src/components/utils/mergeRefs.ts +19 -0
- package/templates/default/src/components/utils/useBreakpoint.ts +36 -0
- package/templates/default/src/components/utils/uuid.ts +9 -0
- package/templates/default/src/fonts/GeistMonoVF.woff +0 -0
- package/templates/default/src/fonts/GeistVF.woff +0 -0
- package/templates/default/src/hooks/use-resize-observer.tsx +55 -0
- package/templates/default/src/providers/theme.tsx +11 -0
- package/templates/default/src/styles/colors.css +805 -0
- package/templates/default/src/styles/globals.css +86 -0
- package/templates/default/src/styles/text-styles.css +177 -0
- package/templates/default/src/styles/theme.css +1310 -0
- package/templates/default/src/styles/typography.css +428 -0
- package/templates/default/tsconfig.json +27 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cx } from "@/components/utils";
|
|
4
|
+
|
|
5
|
+
const sizes = {
|
|
6
|
+
xs: { root: "size-2.5", tick: "size-[4.38px" },
|
|
7
|
+
sm: { root: "size-3", tick: "size-[5.25px]" },
|
|
8
|
+
md: { root: "size-3.5", tick: "size-[6.13px]" },
|
|
9
|
+
lg: { root: "size-4", tick: "size-[7px]" },
|
|
10
|
+
xl: { root: "size-4.5", tick: "size-[7.88px]" },
|
|
11
|
+
"2xl": { root: "size-5", tick: "size-[8.75px]" },
|
|
12
|
+
"3xl": { root: "size-6", tick: "size-[10.5px]" },
|
|
13
|
+
"4xl": { root: "size-8", tick: "size-[14px]" },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
interface VerifiedTickProps {
|
|
17
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const VerifiedTick = ({ size, className }: VerifiedTickProps) => (
|
|
22
|
+
<svg data-verified className={cx("z-10 text-utility-blue-500", sizes[size].root, className)} viewBox="0 0 10 10" fill="none">
|
|
23
|
+
<path
|
|
24
|
+
d="M7.72237 1.77098C7.81734 2.00068 7.99965 2.18326 8.2292 2.27858L9.03413 2.61199C9.26384 2.70714 9.44635 2.88965 9.5415 3.11936C9.63665 3.34908 9.63665 3.60718 9.5415 3.83689L9.20833 4.64125C9.11313 4.87106 9.113 5.12943 9.20863 5.35913L9.54122 6.16325C9.58839 6.27702 9.61268 6.39897 9.6127 6.52214C9.61272 6.6453 9.58847 6.76726 9.54134 6.88105C9.4942 6.99484 9.42511 7.09823 9.33801 7.18531C9.2509 7.27238 9.14749 7.34144 9.03369 7.38854L8.22934 7.72171C7.99964 7.81669 7.81706 7.99899 7.72174 8.22855L7.38833 9.03348C7.29318 9.26319 7.11067 9.4457 6.88096 9.54085C6.65124 9.636 6.39314 9.636 6.16343 9.54085L5.35907 9.20767C5.12935 9.11276 4.87134 9.11295 4.64177 9.20821L3.83684 9.54115C3.60725 9.63608 3.34937 9.636 3.11984 9.54092C2.89032 9.44585 2.70791 9.26356 2.6127 9.03409L2.27918 8.22892C2.18421 7.99923 2.0019 7.81665 1.77235 7.72133L0.967421 7.38792C0.737807 7.29281 0.555355 7.11041 0.460169 6.88083C0.364983 6.65125 0.364854 6.39327 0.45981 6.16359L0.792984 5.35924C0.8879 5.12952 0.887707 4.87151 0.792445 4.64193L0.459749 3.83642C0.41258 3.72265 0.388291 3.60069 0.388272 3.47753C0.388252 3.35436 0.412501 3.2324 0.459634 3.11861C0.506767 3.00482 0.57586 2.90144 0.662965 2.81436C0.75007 2.72728 0.853479 2.65822 0.967283 2.61113L1.77164 2.27795C2.00113 2.18306 2.1836 2.00099 2.27899 1.7717L2.6124 0.966768C2.70755 0.737054 2.89006 0.554547 3.11978 0.459397C3.34949 0.364246 3.60759 0.364246 3.83731 0.459397L4.64166 0.792571C4.87138 0.887487 5.12939 0.887293 5.35897 0.792031L6.16424 0.459913C6.39392 0.364816 6.65197 0.364836 6.88164 0.459968C7.11131 0.555099 7.29379 0.737554 7.38895 0.967208L7.72247 1.77238L7.72237 1.77098Z"
|
|
25
|
+
className="fill-current"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
fillRule="evenodd"
|
|
29
|
+
clipRule="evenodd"
|
|
30
|
+
d="M6.95829 3.68932C7.02509 3.58439 7.04747 3.45723 7.02051 3.3358C6.99356 3.21437 6.91946 3.10862 6.81454 3.04182C6.70961 2.97502 6.58245 2.95264 6.46102 2.97959C6.33959 3.00655 6.23384 3.08064 6.16704 3.18557L4.33141 6.06995L3.49141 5.01995C3.41375 4.92281 3.30069 4.8605 3.17709 4.84673C3.05349 4.83296 2.92949 4.86885 2.83235 4.94651C2.73522 5.02417 2.67291 5.13723 2.65914 5.26083C2.64536 5.38443 2.68125 5.50843 2.75891 5.60557L4.00891 7.16807C4.0555 7.22638 4.11533 7.27271 4.18344 7.30323C4.25154 7.33375 4.32595 7.34757 4.40047 7.34353C4.47499 7.3395 4.54747 7.31773 4.61188 7.28004C4.67629 7.24234 4.73077 7.18981 4.77079 7.12682L6.95829 3.68932Z"
|
|
31
|
+
fill="white"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the initials from a full name.
|
|
3
|
+
*
|
|
4
|
+
* @param name - The full name from which to extract initials.
|
|
5
|
+
* @returns The initials of the provided name. If the name contains only one word,
|
|
6
|
+
* it returns the first character of that word. If the name contains two words,
|
|
7
|
+
* it returns the first character of each word.
|
|
8
|
+
*/
|
|
9
|
+
export const getInitials = (name: string) => {
|
|
10
|
+
const [firstName, lastName] = name.split(" ");
|
|
11
|
+
return firstName.charAt(0) + (lastName ? lastName.charAt(0) : "");
|
|
12
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { FC, ReactNode } from "react";
|
|
4
|
+
import { isValidElement } from "react";
|
|
5
|
+
import { ArrowRight } from "@untitledui/icons";
|
|
6
|
+
import { cx, sortCx } from "@/components/utils";
|
|
7
|
+
import { isReactComponent } from "@/components/utils/isReactComponent";
|
|
8
|
+
|
|
9
|
+
type Size = "md" | "lg";
|
|
10
|
+
type Color = "brand" | "warning" | "error" | "gray" | "success";
|
|
11
|
+
type Theme = "light" | "modern";
|
|
12
|
+
type Align = "leading" | "trailing";
|
|
13
|
+
|
|
14
|
+
const baseClasses: Record<Theme, { root?: string; addon?: string; icon?: string }> = {
|
|
15
|
+
light: {
|
|
16
|
+
root: "rounded-full ring-1 ring-inset",
|
|
17
|
+
addon: "rounded-full ring-1 ring-inset",
|
|
18
|
+
},
|
|
19
|
+
modern: {
|
|
20
|
+
root: "rounded-[10px] bg-primary text-secondary shadow-xs ring-1 ring-inset ring-border-primary hover:bg-secondary",
|
|
21
|
+
addon: "flex items-center rounded-md bg-primary shadow-xs ring-1 ring-inset ring-border-primary",
|
|
22
|
+
icon: "text-utility-gray-500",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getSizeClasses = (
|
|
27
|
+
theme?: Theme,
|
|
28
|
+
text?: boolean,
|
|
29
|
+
icon?: boolean,
|
|
30
|
+
): Record<Align, Record<Size, { root?: string; addon?: string; icon?: string; dot?: string }>> => ({
|
|
31
|
+
leading: {
|
|
32
|
+
md: {
|
|
33
|
+
root: cx("py-1 pr-2 pl-1 tt-xs-md", !text && !icon && "pr-1"),
|
|
34
|
+
addon: cx("px-2 py-0.5", theme === "modern" && "gap-1 px-1.5", text && "mr-2"),
|
|
35
|
+
icon: "ml-1 size-4",
|
|
36
|
+
},
|
|
37
|
+
lg: {
|
|
38
|
+
root: cx("py-1 pr-2 pl-1 tt-sm-md", !text && !icon && "pr-1"),
|
|
39
|
+
addon: cx("px-2.5 py-0.5", theme === "modern" && "gap-1.5 px-2", text && "mr-2"),
|
|
40
|
+
icon: "ml-1 size-4",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
trailing: {
|
|
44
|
+
md: {
|
|
45
|
+
root: cx("py-1 pr-1 pl-3 tt-xs-md", theme === "modern" && "pl-2.5"),
|
|
46
|
+
addon: cx("py-0.5 pr-1.5 pl-2", theme === "modern" && "pr-1.5 pl-2", text && "ml-2"),
|
|
47
|
+
icon: "ml-0.5 size-3 stroke-[3px]",
|
|
48
|
+
dot: "mr-1.5",
|
|
49
|
+
},
|
|
50
|
+
lg: {
|
|
51
|
+
root: "py-1 pr-1 pl-3 tt-sm-md",
|
|
52
|
+
addon: cx("py-0.5 pr-2 pl-2.5", theme === "modern" && "pr-1.5 pl-2", text && "ml-2"),
|
|
53
|
+
icon: "ml-1 size-3 stroke-[3px]",
|
|
54
|
+
dot: "mr-2",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const colorClasses: Record<Theme, Record<Color, { root?: string; addon?: string; icon?: string; dot?: string }>> = sortCx({
|
|
60
|
+
light: {
|
|
61
|
+
brand: {
|
|
62
|
+
root: "bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200 hover:bg-utility-brand-100",
|
|
63
|
+
addon: "bg-primary text-current ring-utility-brand-200",
|
|
64
|
+
icon: "text-utility-brand-500",
|
|
65
|
+
},
|
|
66
|
+
gray: {
|
|
67
|
+
root: "bg-utility-gray-50 text-utility-gray-700 ring-utility-gray-200 hover:bg-utility-gray-100",
|
|
68
|
+
addon: "bg-primary text-current ring-utility-gray-200",
|
|
69
|
+
icon: "text-utility-gray-500",
|
|
70
|
+
},
|
|
71
|
+
error: {
|
|
72
|
+
root: "bg-utility-error-50 text-utility-error-700 ring-utility-error-200 hover:bg-utility-error-100",
|
|
73
|
+
addon: "bg-primary text-current ring-utility-error-200",
|
|
74
|
+
icon: "text-utility-error-500",
|
|
75
|
+
},
|
|
76
|
+
warning: {
|
|
77
|
+
root: "bg-utility-warning-50 text-utility-warning-700 ring-utility-warning-200 hover:bg-utility-warning-100",
|
|
78
|
+
addon: "bg-primary text-current ring-utility-warning-200",
|
|
79
|
+
icon: "text-utility-warning-500",
|
|
80
|
+
},
|
|
81
|
+
success: {
|
|
82
|
+
root: "bg-utility-success-50 text-utility-success-700 ring-utility-success-200 hover:bg-utility-success-100",
|
|
83
|
+
addon: "bg-primary text-current ring-utility-success-200",
|
|
84
|
+
icon: "text-utility-success-500",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
modern: {
|
|
88
|
+
brand: {
|
|
89
|
+
dot: "bg-utility-brand-500 outline-3 -outline-offset-1 outline-utility-brand-100",
|
|
90
|
+
},
|
|
91
|
+
gray: {
|
|
92
|
+
dot: "bg-utility-gray-500 outline-3 -outline-offset-1 outline-utility-gray-100",
|
|
93
|
+
},
|
|
94
|
+
error: {
|
|
95
|
+
dot: "bg-utility-error-500 outline-3 -outline-offset-1 outline-utility-error-100",
|
|
96
|
+
},
|
|
97
|
+
warning: {
|
|
98
|
+
dot: "bg-utility-warning-500 outline-3 -outline-offset-1 outline-utility-warning-100",
|
|
99
|
+
},
|
|
100
|
+
success: {
|
|
101
|
+
dot: "bg-utility-success-500 outline-3 -outline-offset-1 outline-utility-success-100",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
interface BadgeGroupProps {
|
|
107
|
+
children?: string | ReactNode;
|
|
108
|
+
addonText: string;
|
|
109
|
+
size?: Size;
|
|
110
|
+
color: Color;
|
|
111
|
+
theme?: Theme;
|
|
112
|
+
/**
|
|
113
|
+
* Alignment of the badge addon element.
|
|
114
|
+
*/
|
|
115
|
+
align?: Align;
|
|
116
|
+
iconTrailing?: FC<{ className?: string }> | ReactNode;
|
|
117
|
+
className?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const BadgeGroup = ({
|
|
121
|
+
children,
|
|
122
|
+
addonText,
|
|
123
|
+
size = "md",
|
|
124
|
+
color = "brand",
|
|
125
|
+
theme = "light",
|
|
126
|
+
align = "leading",
|
|
127
|
+
className,
|
|
128
|
+
iconTrailing: IconTrailing = ArrowRight,
|
|
129
|
+
}: BadgeGroupProps) => {
|
|
130
|
+
const colors = colorClasses[theme][color];
|
|
131
|
+
const sizes = getSizeClasses(theme, !!children, !!IconTrailing)[align][size];
|
|
132
|
+
|
|
133
|
+
const rootClasses = cx(
|
|
134
|
+
"inline-flex w-max cursor-pointer items-center transition duration-100 ease-linear",
|
|
135
|
+
baseClasses[theme].root,
|
|
136
|
+
sizes.root,
|
|
137
|
+
colors.root,
|
|
138
|
+
className,
|
|
139
|
+
);
|
|
140
|
+
const addonClasses = cx("inline-flex items-center", baseClasses[theme].addon, sizes.addon, colors.addon);
|
|
141
|
+
const dotClasses = cx("inline-block size-2 shrink-0 rounded-full", sizes.dot, colors.dot);
|
|
142
|
+
const iconClasses = cx(baseClasses[theme].icon, sizes.icon, colors.icon);
|
|
143
|
+
|
|
144
|
+
if (align === "trailing") {
|
|
145
|
+
return (
|
|
146
|
+
<div className={rootClasses}>
|
|
147
|
+
{theme === "modern" && <span className={dotClasses} />}
|
|
148
|
+
|
|
149
|
+
{children}
|
|
150
|
+
|
|
151
|
+
<span className={addonClasses}>
|
|
152
|
+
{addonText}
|
|
153
|
+
|
|
154
|
+
{/* Trailing icon */}
|
|
155
|
+
{isReactComponent(IconTrailing) && <IconTrailing className={iconClasses} />}
|
|
156
|
+
{isValidElement(IconTrailing) && IconTrailing}
|
|
157
|
+
</span>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<div className={rootClasses}>
|
|
164
|
+
<span className={addonClasses}>
|
|
165
|
+
{theme === "modern" && <span className={dotClasses} />}
|
|
166
|
+
{addonText}
|
|
167
|
+
</span>
|
|
168
|
+
|
|
169
|
+
{children}
|
|
170
|
+
|
|
171
|
+
{/* Trailing icon */}
|
|
172
|
+
{isReactComponent(IconTrailing) && <IconTrailing className={iconClasses} />}
|
|
173
|
+
{isValidElement(IconTrailing) && IconTrailing}
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
};
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
export type IconComponentType = React.FunctionComponent<{ className?: string; strokeWidth?: string | number }>;
|
|
2
|
+
|
|
3
|
+
export type Sizes = "sm" | "md" | "lg";
|
|
4
|
+
|
|
5
|
+
export type BadgeColors = "gray" | "brand" | "error" | "warning" | "success" | "gray-blue" | "blue-light" | "blue" | "indigo" | "purple" | "pink" | "orange";
|
|
6
|
+
|
|
7
|
+
export type FlagTypes =
|
|
8
|
+
| "AD"
|
|
9
|
+
| "AE"
|
|
10
|
+
| "AF"
|
|
11
|
+
| "AG"
|
|
12
|
+
| "AI"
|
|
13
|
+
| "AL"
|
|
14
|
+
| "AM"
|
|
15
|
+
| "AO"
|
|
16
|
+
| "AR"
|
|
17
|
+
| "AS"
|
|
18
|
+
| "AT"
|
|
19
|
+
| "AU"
|
|
20
|
+
| "AW"
|
|
21
|
+
| "AX"
|
|
22
|
+
| "AZ"
|
|
23
|
+
| "BA"
|
|
24
|
+
| "BB"
|
|
25
|
+
| "BD"
|
|
26
|
+
| "BE"
|
|
27
|
+
| "BF"
|
|
28
|
+
| "BG"
|
|
29
|
+
| "BH"
|
|
30
|
+
| "BI"
|
|
31
|
+
| "BJ"
|
|
32
|
+
| "BL"
|
|
33
|
+
| "BM"
|
|
34
|
+
| "BN"
|
|
35
|
+
| "BO"
|
|
36
|
+
| "BQ-1"
|
|
37
|
+
| "BQ-2"
|
|
38
|
+
| "BQ"
|
|
39
|
+
| "BR"
|
|
40
|
+
| "BS"
|
|
41
|
+
| "BT"
|
|
42
|
+
| "BW"
|
|
43
|
+
| "BY"
|
|
44
|
+
| "BZ"
|
|
45
|
+
| "CA"
|
|
46
|
+
| "CC"
|
|
47
|
+
| "CD-1"
|
|
48
|
+
| "CD"
|
|
49
|
+
| "CF"
|
|
50
|
+
| "CH"
|
|
51
|
+
| "CK"
|
|
52
|
+
| "CL"
|
|
53
|
+
| "CM"
|
|
54
|
+
| "CN"
|
|
55
|
+
| "CO"
|
|
56
|
+
| "CR"
|
|
57
|
+
| "CU"
|
|
58
|
+
| "CW"
|
|
59
|
+
| "CX"
|
|
60
|
+
| "CY"
|
|
61
|
+
| "CZ"
|
|
62
|
+
| "DE"
|
|
63
|
+
| "DJ"
|
|
64
|
+
| "DK"
|
|
65
|
+
| "DM"
|
|
66
|
+
| "DO"
|
|
67
|
+
| "DS"
|
|
68
|
+
| "DZ"
|
|
69
|
+
| "earth"
|
|
70
|
+
| "EC"
|
|
71
|
+
| "EE"
|
|
72
|
+
| "EG"
|
|
73
|
+
| "EH"
|
|
74
|
+
| "ER"
|
|
75
|
+
| "ES"
|
|
76
|
+
| "ET"
|
|
77
|
+
| "FI"
|
|
78
|
+
| "FJ"
|
|
79
|
+
| "FK"
|
|
80
|
+
| "FM"
|
|
81
|
+
| "FO"
|
|
82
|
+
| "FR"
|
|
83
|
+
| "GA"
|
|
84
|
+
| "GB-2"
|
|
85
|
+
| "GB"
|
|
86
|
+
| "GD"
|
|
87
|
+
| "GE"
|
|
88
|
+
| "GG"
|
|
89
|
+
| "GH"
|
|
90
|
+
| "GI"
|
|
91
|
+
| "GL"
|
|
92
|
+
| "GM"
|
|
93
|
+
| "GN"
|
|
94
|
+
| "GQ"
|
|
95
|
+
| "GR"
|
|
96
|
+
| "GT"
|
|
97
|
+
| "GU"
|
|
98
|
+
| "GW"
|
|
99
|
+
| "GY"
|
|
100
|
+
| "HK"
|
|
101
|
+
| "HN"
|
|
102
|
+
| "HR"
|
|
103
|
+
| "HT"
|
|
104
|
+
| "HU"
|
|
105
|
+
| "ID"
|
|
106
|
+
| "IE"
|
|
107
|
+
| "IL"
|
|
108
|
+
| "IM"
|
|
109
|
+
| "IN"
|
|
110
|
+
| "IO"
|
|
111
|
+
| "IQ"
|
|
112
|
+
| "IR"
|
|
113
|
+
| "IS"
|
|
114
|
+
| "IT"
|
|
115
|
+
| "JE"
|
|
116
|
+
| "JM"
|
|
117
|
+
| "JO"
|
|
118
|
+
| "JP"
|
|
119
|
+
| "KE"
|
|
120
|
+
| "KG"
|
|
121
|
+
| "KH"
|
|
122
|
+
| "KI"
|
|
123
|
+
| "KM"
|
|
124
|
+
| "KN"
|
|
125
|
+
| "KP"
|
|
126
|
+
| "KR"
|
|
127
|
+
| "KW"
|
|
128
|
+
| "KY"
|
|
129
|
+
| "KZ"
|
|
130
|
+
| "LA"
|
|
131
|
+
| "LB"
|
|
132
|
+
| "LC"
|
|
133
|
+
| "LI"
|
|
134
|
+
| "LK"
|
|
135
|
+
| "LR"
|
|
136
|
+
| "LS"
|
|
137
|
+
| "LT"
|
|
138
|
+
| "LU"
|
|
139
|
+
| "LV"
|
|
140
|
+
| "LY"
|
|
141
|
+
| "MA"
|
|
142
|
+
| "MC"
|
|
143
|
+
| "MD"
|
|
144
|
+
| "ME"
|
|
145
|
+
| "MG"
|
|
146
|
+
| "MH"
|
|
147
|
+
| "MK"
|
|
148
|
+
| "ML"
|
|
149
|
+
| "MM"
|
|
150
|
+
| "MN"
|
|
151
|
+
| "MO"
|
|
152
|
+
| "MP"
|
|
153
|
+
| "MQ"
|
|
154
|
+
| "MR"
|
|
155
|
+
| "MS"
|
|
156
|
+
| "MT"
|
|
157
|
+
| "MU"
|
|
158
|
+
| "MV"
|
|
159
|
+
| "MW"
|
|
160
|
+
| "MX"
|
|
161
|
+
| "MY"
|
|
162
|
+
| "MZ"
|
|
163
|
+
| "NA"
|
|
164
|
+
| "NE"
|
|
165
|
+
| "NF"
|
|
166
|
+
| "NG"
|
|
167
|
+
| "NI"
|
|
168
|
+
| "NL"
|
|
169
|
+
| "NO"
|
|
170
|
+
| "NP"
|
|
171
|
+
| "NR"
|
|
172
|
+
| "NU"
|
|
173
|
+
| "NZ"
|
|
174
|
+
| "OM"
|
|
175
|
+
| "PA"
|
|
176
|
+
| "PE"
|
|
177
|
+
| "PF"
|
|
178
|
+
| "PG"
|
|
179
|
+
| "PH"
|
|
180
|
+
| "PK"
|
|
181
|
+
| "PL"
|
|
182
|
+
| "PM"
|
|
183
|
+
| "PN"
|
|
184
|
+
| "PR"
|
|
185
|
+
| "PT"
|
|
186
|
+
| "PW"
|
|
187
|
+
| "PY"
|
|
188
|
+
| "QA"
|
|
189
|
+
| "RE"
|
|
190
|
+
| "RO"
|
|
191
|
+
| "RS"
|
|
192
|
+
| "RU"
|
|
193
|
+
| "RW"
|
|
194
|
+
| "SA"
|
|
195
|
+
| "SB"
|
|
196
|
+
| "SC"
|
|
197
|
+
| "SD"
|
|
198
|
+
| "SE"
|
|
199
|
+
| "SG"
|
|
200
|
+
| "SH"
|
|
201
|
+
| "SI"
|
|
202
|
+
| "SJ"
|
|
203
|
+
| "SK"
|
|
204
|
+
| "SL"
|
|
205
|
+
| "SM"
|
|
206
|
+
| "SN"
|
|
207
|
+
| "SO"
|
|
208
|
+
| "SR"
|
|
209
|
+
| "SS"
|
|
210
|
+
| "ST"
|
|
211
|
+
| "SV"
|
|
212
|
+
| "SX"
|
|
213
|
+
| "SY"
|
|
214
|
+
| "SZ"
|
|
215
|
+
| "TC"
|
|
216
|
+
| "TD"
|
|
217
|
+
| "TF"
|
|
218
|
+
| "TG"
|
|
219
|
+
| "TH"
|
|
220
|
+
| "TJ"
|
|
221
|
+
| "TK"
|
|
222
|
+
| "TL"
|
|
223
|
+
| "TM"
|
|
224
|
+
| "TN"
|
|
225
|
+
| "TO"
|
|
226
|
+
| "TR"
|
|
227
|
+
| "TT"
|
|
228
|
+
| "TV"
|
|
229
|
+
| "TZ"
|
|
230
|
+
| "UA"
|
|
231
|
+
| "UG"
|
|
232
|
+
| "UM"
|
|
233
|
+
| "US"
|
|
234
|
+
| "UY"
|
|
235
|
+
| "UZ"
|
|
236
|
+
| "VA"
|
|
237
|
+
| "VC"
|
|
238
|
+
| "VE"
|
|
239
|
+
| "VG"
|
|
240
|
+
| "VI"
|
|
241
|
+
| "VN"
|
|
242
|
+
| "VU"
|
|
243
|
+
| "WF"
|
|
244
|
+
| "WS"
|
|
245
|
+
| "YE"
|
|
246
|
+
| "YT"
|
|
247
|
+
| "ZA"
|
|
248
|
+
| "ZM"
|
|
249
|
+
| "ZW";
|
|
250
|
+
|
|
251
|
+
export type ExtractColorKeys<T> = T extends { styles: infer C } ? keyof C : never;
|
|
252
|
+
export type ExtractBadgeKeys<T> = keyof T;
|
|
253
|
+
export type BadgeTypeToColorMap<T> = {
|
|
254
|
+
[K in ExtractBadgeKeys<T>]: ExtractColorKeys<T[K]>;
|
|
255
|
+
};
|
|
256
|
+
export type BadgeTypeColors<T> = ExtractColorKeys<T[keyof T]>;
|
|
257
|
+
|
|
258
|
+
export const badgeTypes = {
|
|
259
|
+
pillColor: "pill-color",
|
|
260
|
+
badgeColor: "color",
|
|
261
|
+
badgeModern: "modern",
|
|
262
|
+
} as const;
|
|
263
|
+
|
|
264
|
+
export type BadgeTypes = (typeof badgeTypes)[keyof typeof badgeTypes];
|