@mesob/ui 0.5.4 → 0.5.6
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.d.ts +34 -21
- package/dist/components.js +698 -570
- package/dist/components.js.map +1 -1
- package/dist/providers.d.ts +2 -4
- package/dist/providers.js +7 -27
- package/dist/providers.js.map +1 -1
- package/package.json +8 -3
- package/src/styles/style-lyra.css +249 -6
- package/src/styles/style-maia.css +243 -5
- package/src/styles/style-mira.css +248 -5
- package/src/styles/style-nova.css +136 -5
- package/src/styles/style-vega.css +136 -5
- package/src/styles/themes.css +31 -0
- package/src/styles/lyra/button.css +0 -107
- package/src/styles/maia/button.css +0 -107
- package/src/styles/mira/button.css +0 -107
package/dist/providers.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ declare function AnalyticsProvider({ analytics, children, }: AnalyticsProviderPr
|
|
|
18
18
|
type Navigation = ReturnType<typeof createNavigation>;
|
|
19
19
|
type MesobContextValue = {
|
|
20
20
|
navigation: Navigation;
|
|
21
|
-
linkComponent: Navigation['Link'];
|
|
22
21
|
goBack: () => void;
|
|
23
22
|
navigate: (href: string) => void;
|
|
24
23
|
pathname: string;
|
|
@@ -29,13 +28,12 @@ type MesobContextValue = {
|
|
|
29
28
|
};
|
|
30
29
|
type MesobProviderProps = {
|
|
31
30
|
children: ReactNode;
|
|
32
|
-
|
|
33
|
-
linkComponent?: Navigation['Link'];
|
|
31
|
+
navigation: Navigation;
|
|
34
32
|
locale?: string;
|
|
35
33
|
defaultLanguage?: string;
|
|
36
34
|
supportedLanguages?: SupportedLanguage[];
|
|
37
35
|
};
|
|
38
|
-
declare function MesobProvider({ children,
|
|
36
|
+
declare function MesobProvider({ children, navigation, locale: localeProp, defaultLanguage, supportedLanguages, }: MesobProviderProps): react_jsx_runtime.JSX.Element;
|
|
39
37
|
declare function useMesob(): MesobContextValue | null;
|
|
40
38
|
declare function useLocaleConfig(): {
|
|
41
39
|
defaultLanguage: string;
|
package/dist/providers.js
CHANGED
|
@@ -81,7 +81,6 @@ function AnalyticsProvider({
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// src/provider/mesob-provider.tsx
|
|
84
|
-
import { createNavigation } from "next-intl/navigation";
|
|
85
84
|
import { createContext, useContext, useMemo } from "react";
|
|
86
85
|
import { z as z2 } from "zod";
|
|
87
86
|
|
|
@@ -154,41 +153,21 @@ function createLocalRequiredInputSchema(supportedLanguages, validation) {
|
|
|
154
153
|
// src/provider/mesob-provider.tsx
|
|
155
154
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
156
155
|
var MesobContext = createContext(null);
|
|
157
|
-
var MESOB_ERR = "[MesobProvider]";
|
|
158
156
|
function MesobProvider({
|
|
159
157
|
children,
|
|
160
|
-
|
|
161
|
-
linkComponent: linkComponentProp,
|
|
158
|
+
navigation,
|
|
162
159
|
locale: localeProp,
|
|
163
160
|
defaultLanguage = DEFAULT_LANGUAGE,
|
|
164
161
|
supportedLanguages = SUPPORTED_LANGUAGES
|
|
165
162
|
}) {
|
|
166
|
-
if (!routing) {
|
|
167
|
-
throw new Error(`${MESOB_ERR} routing is required`);
|
|
168
|
-
}
|
|
169
163
|
const locale = localeProp ?? defaultLanguage;
|
|
170
|
-
const
|
|
171
|
-
const
|
|
164
|
+
const pathname = navigation.usePathname();
|
|
165
|
+
const router = navigation.useRouter();
|
|
172
166
|
const value = useMemo(() => {
|
|
173
|
-
const linkComponent = linkComponentProp ?? navigation?.Link;
|
|
174
|
-
if (!linkComponent) {
|
|
175
|
-
throw new Error(
|
|
176
|
-
`${MESOB_ERR} linkComponent or valid createNavigation required`
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
167
|
return {
|
|
180
168
|
navigation,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (typeof window !== "undefined") {
|
|
184
|
-
window.history.back();
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
navigate: (href) => {
|
|
188
|
-
if (typeof window !== "undefined") {
|
|
189
|
-
window.location.assign(href);
|
|
190
|
-
}
|
|
191
|
-
},
|
|
169
|
+
goBack: router.back,
|
|
170
|
+
navigate: router.push,
|
|
192
171
|
pathname,
|
|
193
172
|
locale,
|
|
194
173
|
defaultLanguage,
|
|
@@ -196,7 +175,8 @@ function MesobProvider({
|
|
|
196
175
|
};
|
|
197
176
|
}, [
|
|
198
177
|
navigation,
|
|
199
|
-
|
|
178
|
+
router.back,
|
|
179
|
+
router.push,
|
|
200
180
|
pathname,
|
|
201
181
|
locale,
|
|
202
182
|
defaultLanguage,
|
package/dist/providers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/analytics/clarity.tsx","../src/components/analytics/disable-devtool.tsx","../src/components/analytics/google-analytics.tsx","../src/provider/analytics-provider.tsx","../src/provider/mesob-provider.tsx","../src/components/ui/tooltip.tsx","../src/lib/utils.ts","../src/lib/locale.ts"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\ntype ClarityProps = {\n clarityId: string;\n};\n\nexport function Clarity({ clarityId }: ClarityProps) {\n useEffect(() => {\n if (!clarityId || typeof document === 'undefined') {\n return;\n }\n const id = 'ms-clarity-script';\n if (document.getElementById(id)) {\n return;\n }\n const script = document.createElement('script');\n script.id = id;\n script.async = true;\n script.innerHTML = `(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};t=l.createElement(r);t.async=1;t.src=\"https://www.clarity.ms/tag/\"+i;y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);})(window,document,\"clarity\",\"script\",\"${clarityId.replace(/\"/g, '\\\\\"')}\");`;\n document.head.appendChild(script);\n }, [clarityId]);\n return null;\n}\n","'use client';\n\nimport { useEffect } from 'react';\n\nexport type DisableDevtoolOptions = {\n url?: string;\n md5?: string;\n tkName?: string;\n disableMenu?: boolean;\n};\n\ntype DisableDevtoolProps = {\n /** When true, loads and runs disable-devtool (e.g. process.env.NEXT_PUBLIC_ENV === '1') */\n enable: boolean;\n options?: DisableDevtoolOptions;\n};\n\nexport function DisableDevtool({ enable, options = {} }: DisableDevtoolProps) {\n useEffect(() => {\n if (!enable || typeof window === 'undefined') {\n return;\n }\n import('disable-devtool')\n .then((mod) => {\n const DisableDevtool = mod.default;\n DisableDevtool({\n url: options.url ?? '/404',\n md5: options.md5,\n tkName: options.tkName ?? 'var',\n disableMenu: options.disableMenu ?? false,\n });\n })\n .catch(() => undefined);\n }, [enable, options.url, options.md5, options.tkName, options.disableMenu]);\n return null;\n}\n","'use client';\n\nimport { useEffect } from 'react';\n\ntype GoogleAnalyticsProps = {\n gaId: string;\n};\n\nexport function GoogleAnalytics({ gaId }: GoogleAnalyticsProps) {\n useEffect(() => {\n if (!gaId || typeof document === 'undefined') {\n return;\n }\n const id = 'ms-ga-script';\n if (document.getElementById(id)) {\n return;\n }\n window.dataLayer = window.dataLayer ?? [];\n function gtag(...args: unknown[]) {\n window.dataLayer?.push(args);\n }\n (window as unknown as { gtag: typeof gtag }).gtag = gtag;\n gtag('js', new Date());\n gtag('config', gaId);\n const script = document.createElement('script');\n script.id = id;\n script.async = true;\n script.src = `https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(gaId)}`;\n document.head.appendChild(script);\n }, [gaId]);\n return null;\n}\n\ndeclare global {\n interface Window {\n dataLayer?: unknown[];\n }\n}\n","'use client';\n\nimport { type ReactNode, Suspense } from 'react';\nimport { Clarity, GoogleAnalytics } from '../components/analytics';\n\nexport type MesobAnalyticsIds = {\n clarityId?: string | null;\n gaId?: string | null;\n};\n\ntype AnalyticsProviderProps = {\n analytics?: MesobAnalyticsIds;\n children?: ReactNode;\n};\n\nexport function AnalyticsProvider({\n analytics = {},\n children,\n}: AnalyticsProviderProps) {\n const { clarityId, gaId } = analytics;\n\n return (\n <>\n {clarityId ? (\n <Suspense fallback={null}>\n <Clarity clarityId={clarityId} />\n </Suspense>\n ) : null}\n {gaId ? (\n <Suspense fallback={null}>\n <GoogleAnalytics gaId={gaId} />\n </Suspense>\n ) : null}\n {children}\n </>\n );\n}\n","'use client';\n\nimport { createNavigation } from 'next-intl/navigation';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { z } from 'zod';\nimport { TooltipProvider } from '../components/ui/tooltip';\nimport {\n createLocalInputSchema,\n createLocalRequiredInputSchema,\n DEFAULT_LANGUAGE,\n getLocaleInputDefault,\n SUPPORTED_LANGUAGES,\n type SupportedLanguage,\n} from '../lib/locale';\n\ntype Navigation = ReturnType<typeof createNavigation>;\n\ntype MesobContextValue = {\n navigation: Navigation;\n linkComponent: Navigation['Link'];\n goBack: () => void;\n navigate: (href: string) => void;\n pathname: string;\n locale: string;\n defaultLanguage: string;\n supportedLanguages: SupportedLanguage[];\n t?: (key: string, params?: Record<string, string | number>) => string;\n};\n\nconst MesobContext = createContext<MesobContextValue | null>(null);\n\nconst MESOB_ERR = '[MesobProvider]';\n\nexport type MesobProviderProps = {\n children: ReactNode;\n routing: Parameters<typeof createNavigation>[0];\n linkComponent?: Navigation['Link'];\n locale?: string;\n defaultLanguage?: string;\n supportedLanguages?: SupportedLanguage[];\n};\n\nexport function MesobProvider({\n children,\n routing,\n linkComponent: linkComponentProp,\n locale: localeProp,\n defaultLanguage = DEFAULT_LANGUAGE,\n supportedLanguages = SUPPORTED_LANGUAGES,\n}: MesobProviderProps) {\n if (!routing) {\n throw new Error(`${MESOB_ERR} routing is required`);\n }\n\n const locale = localeProp ?? defaultLanguage;\n const navigation = useMemo(() => createNavigation(routing), [routing]);\n const pathname =\n typeof window === 'undefined' ? '/' : window.location.pathname;\n\n const value = useMemo(() => {\n const linkComponent = linkComponentProp ?? navigation?.Link;\n if (!linkComponent) {\n throw new Error(\n `${MESOB_ERR} linkComponent or valid createNavigation required`,\n );\n }\n return {\n navigation,\n linkComponent,\n goBack: () => {\n if (typeof window !== 'undefined') {\n window.history.back();\n }\n },\n navigate: (href: string) => {\n if (typeof window !== 'undefined') {\n window.location.assign(href);\n }\n },\n pathname,\n locale,\n defaultLanguage,\n supportedLanguages,\n };\n }, [\n navigation,\n linkComponentProp,\n pathname,\n locale,\n defaultLanguage,\n supportedLanguages,\n ]);\n\n return (\n <MesobContext.Provider value={value}>\n <TooltipProvider delay={0}>{children}</TooltipProvider>\n </MesobContext.Provider>\n );\n}\n\nexport function useMesob(): MesobContextValue | null {\n return useContext(MesobContext);\n}\n\nexport function useLocaleConfig(): {\n defaultLanguage: string;\n supportedLanguages: SupportedLanguage[];\n} {\n const mesob = useMesob();\n return {\n defaultLanguage: mesob?.defaultLanguage ?? DEFAULT_LANGUAGE,\n supportedLanguages: mesob?.supportedLanguages ?? SUPPORTED_LANGUAGES,\n };\n}\n\nexport function useLocaleSchemas(): {\n localeInputDefault: Record<string, string>;\n requiredSchema: ReturnType<typeof createLocalRequiredInputSchema>;\n optionalSchema: ReturnType<typeof createLocalInputSchema>;\n} {\n const { defaultLanguage, supportedLanguages } = useLocaleConfig();\n return useMemo(\n () => ({\n localeInputDefault: getLocaleInputDefault(supportedLanguages),\n requiredSchema: createLocalRequiredInputSchema(\n supportedLanguages,\n z.string().optional(),\n ),\n optionalSchema: createLocalInputSchema(\n defaultLanguage,\n supportedLanguages,\n z.string().optional(),\n z.string().optional(),\n ),\n }),\n [defaultLanguage, supportedLanguages],\n );\n}\n","'use client';\n\nimport { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';\n\nimport { cn } from '../../lib/utils';\n\nfunction TooltipProvider({\n delay = 0,\n ...props\n}: TooltipPrimitive.Provider.Props) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delay={delay}\n {...props}\n />\n );\n}\n\nfunction Tooltip({ ...props }: TooltipPrimitive.Root.Props) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />;\n}\n\nfunction TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />;\n}\n\nfunction TooltipContent({\n className,\n side = 'top',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n children,\n ...props\n}: TooltipPrimitive.Popup.Props &\n Pick<\n TooltipPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n >) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <TooltipPrimitive.Popup\n data-slot=\"tooltip-content\"\n className={cn(\n 'cn-tooltip-content cn-tooltip-content-logical bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"cn-tooltip-arrow cn-tooltip-arrow-logical bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5\" />\n </TooltipPrimitive.Popup>\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n );\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { z } from 'zod';\n\nexport type LocaleKey = 'am' | 'en' | 'om' | 'ti' | 'so' | 'sw' | 'fr' | 'ar';\n\nexport type Locale = {\n [Key in LocaleKey | string]?: string;\n};\n\nexport type Translation = (key: string) => string;\n\n/** Fallback when MesobProvider does not receive defaultLanguage/supportedLanguages */\nexport const DEFAULT_LANGUAGE = 'en';\n\nexport type SupportedLanguage = { value: string; label: string; key: string };\n\n/** Fallback when MesobProvider does not receive supportedLanguages */\nexport const SUPPORTED_LANGUAGES: SupportedLanguage[] = [\n { value: 'en', label: 'English', key: 'En' },\n { value: 'am', label: 'አማርኛ', key: 'አማ' },\n];\n\nconst localeRecord = z.record(z.string(), z.string());\nexport const LOCALE_INPUT_DEFAULT: Locale = {};\nexport const LOCALE_REQUIRED_INPUT_SCHEMA = localeRecord.refine(\n (o) => Object.keys(o).length > 0,\n { message: 'At least one locale required' },\n);\nexport const LOCALE_OPTIONAL_INPUT_SCHEMA = localeRecord;\n\nexport function getLocaleInputDefault(\n supportedLanguages: SupportedLanguage[],\n): Record<string, string> {\n return Object.fromEntries(supportedLanguages.map(({ value }) => [value, '']));\n}\n\ntype SchemaAccumulator = {\n [key: string]: z.ZodTypeAny;\n};\n\nexport function createLocalInputSchema(\n defaultLanguage: string,\n supportedLanguages: SupportedLanguage[],\n defaultValidation: z.ZodTypeAny,\n otherValidation: z.ZodTypeAny,\n): z.ZodObject<SchemaAccumulator> {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n supportedLanguages.reduce((acc: SchemaAccumulator, { value }) => {\n acc[value] =\n value === defaultLanguage ? defaultValidation : otherValidation;\n return acc;\n }, {});\n\n return z.object(schemaDefinition);\n}\n\nexport function createLocalRequiredInputSchema(\n supportedLanguages: SupportedLanguage[],\n validation: z.ZodTypeAny,\n): z.ZodTypeAny {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n supportedLanguages.reduce((acc: SchemaAccumulator, { value }) => {\n acc[value] = validation;\n return acc;\n }, {});\n\n return z.object(schemaDefinition).superRefine((data, ctx) => {\n const hasValue = Object.values(data).some(\n (value) => typeof value === 'string' && value.trim().length > 0,\n );\n\n if (!hasValue) {\n for (const { value } of supportedLanguages) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'field is required',\n path: [value],\n });\n }\n }\n });\n}\n"],"mappings":";AAEA,SAAS,iBAAiB;AAMnB,SAAS,QAAQ,EAAE,UAAU,GAAiB;AACnD,YAAU,MAAM;AACd,QAAI,CAAC,aAAa,OAAO,aAAa,aAAa;AACjD;AAAA,IACF;AACA,UAAM,KAAK;AACX,QAAI,SAAS,eA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AAAA,MACtB;AAAA,MACA,gBAAgB;AAAA,QACd;AAAA,QACA;AAAA,QACAA,GAAE,OAAO,EAAE,SAAS;AAAA,QACpBA,GAAE,OAAO,EAAE,SAAS;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC,iBAAiB,kBAAkB;AAAA,EACtC;AACF;","names":["useEffect","DisableDevtool","useEffect","z","jsx","jsxs","jsx","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/analytics/clarity.tsx","../src/components/analytics/disable-devtool.tsx","../src/components/analytics/google-analytics.tsx","../src/provider/analytics-provider.tsx","../src/provider/mesob-provider.tsx","../src/components/ui/tooltip.tsx","../src/lib/utils.ts","../src/lib/locale.ts"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\ntype ClarityProps = {\n clarityId: string;\n};\n\nexport function Clarity({ clarityId }: ClarityProps) {\n useEffect(() => {\n if (!clarityId || typeof document === 'undefined') {\n return;\n }\n const id = 'ms-clarity-script';\n if (document.getElementById(id)) {\n return;\n }\n const script = document.createElement('script');\n script.id = id;\n script.async = true;\n script.innerHTML = `(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};t=l.createElement(r);t.async=1;t.src=\"https://www.clarity.ms/tag/\"+i;y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);})(window,document,\"clarity\",\"script\",\"${clarityId.replace(/\"/g, '\\\\\"')}\");`;\n document.head.appendChild(script);\n }, [clarityId]);\n return null;\n}\n","'use client';\n\nimport { useEffect } from 'react';\n\nexport type DisableDevtoolOptions = {\n url?: string;\n md5?: string;\n tkName?: string;\n disableMenu?: boolean;\n};\n\ntype DisableDevtoolProps = {\n /** When true, loads and runs disable-devtool (e.g. process.env.NEXT_PUBLIC_ENV === '1') */\n enable: boolean;\n options?: DisableDevtoolOptions;\n};\n\nexport function DisableDevtool({ enable, options = {} }: DisableDevtoolProps) {\n useEffect(() => {\n if (!enable || typeof window === 'undefined') {\n return;\n }\n import('disable-devtool')\n .then((mod) => {\n const DisableDevtool = mod.default;\n DisableDevtool({\n url: options.url ?? '/404',\n md5: options.md5,\n tkName: options.tkName ?? 'var',\n disableMenu: options.disableMenu ?? false,\n });\n })\n .catch(() => undefined);\n }, [enable, options.url, options.md5, options.tkName, options.disableMenu]);\n return null;\n}\n","'use client';\n\nimport { useEffect } from 'react';\n\ntype GoogleAnalyticsProps = {\n gaId: string;\n};\n\nexport function GoogleAnalytics({ gaId }: GoogleAnalyticsProps) {\n useEffect(() => {\n if (!gaId || typeof document === 'undefined') {\n return;\n }\n const id = 'ms-ga-script';\n if (document.getElementById(id)) {\n return;\n }\n window.dataLayer = window.dataLayer ?? [];\n function gtag(...args: unknown[]) {\n window.dataLayer?.push(args);\n }\n (window as unknown as { gtag: typeof gtag }).gtag = gtag;\n gtag('js', new Date());\n gtag('config', gaId);\n const script = document.createElement('script');\n script.id = id;\n script.async = true;\n script.src = `https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(gaId)}`;\n document.head.appendChild(script);\n }, [gaId]);\n return null;\n}\n\ndeclare global {\n interface Window {\n dataLayer?: unknown[];\n }\n}\n","'use client';\n\nimport { type ReactNode, Suspense } from 'react';\nimport { Clarity, GoogleAnalytics } from '../components/analytics';\n\nexport type MesobAnalyticsIds = {\n clarityId?: string | null;\n gaId?: string | null;\n};\n\ntype AnalyticsProviderProps = {\n analytics?: MesobAnalyticsIds;\n children?: ReactNode;\n};\n\nexport function AnalyticsProvider({\n analytics = {},\n children,\n}: AnalyticsProviderProps) {\n const { clarityId, gaId } = analytics;\n\n return (\n <>\n {clarityId ? (\n <Suspense fallback={null}>\n <Clarity clarityId={clarityId} />\n </Suspense>\n ) : null}\n {gaId ? (\n <Suspense fallback={null}>\n <GoogleAnalytics gaId={gaId} />\n </Suspense>\n ) : null}\n {children}\n </>\n );\n}\n","'use client';\n\nimport type { createNavigation } from 'next-intl/navigation';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { z } from 'zod';\nimport { TooltipProvider } from '../components/ui/tooltip';\nimport {\n createLocalInputSchema,\n createLocalRequiredInputSchema,\n DEFAULT_LANGUAGE,\n getLocaleInputDefault,\n SUPPORTED_LANGUAGES,\n type SupportedLanguage,\n} from '../lib/locale';\n\ntype Navigation = ReturnType<typeof createNavigation>;\n\ntype MesobContextValue = {\n navigation: Navigation;\n goBack: () => void;\n navigate: (href: string) => void;\n pathname: string;\n locale: string;\n defaultLanguage: string;\n supportedLanguages: SupportedLanguage[];\n t?: (key: string, params?: Record<string, string | number>) => string;\n};\n\nconst MesobContext = createContext<MesobContextValue | null>(null);\n\nexport type MesobProviderProps = {\n children: ReactNode;\n navigation: Navigation;\n locale?: string;\n defaultLanguage?: string;\n supportedLanguages?: SupportedLanguage[];\n};\n\nexport function MesobProvider({\n children,\n navigation,\n locale: localeProp,\n defaultLanguage = DEFAULT_LANGUAGE,\n supportedLanguages = SUPPORTED_LANGUAGES,\n}: MesobProviderProps) {\n const locale = localeProp ?? defaultLanguage;\n const pathname = navigation.usePathname();\n const router = navigation.useRouter();\n\n const value = useMemo(() => {\n return {\n navigation,\n goBack: router.back,\n navigate: router.push,\n pathname,\n locale,\n defaultLanguage,\n supportedLanguages,\n };\n }, [\n navigation,\n router.back,\n router.push,\n pathname,\n locale,\n defaultLanguage,\n supportedLanguages,\n ]);\n\n return (\n <MesobContext.Provider value={value}>\n <TooltipProvider delay={0}>{children}</TooltipProvider>\n </MesobContext.Provider>\n );\n}\n\nexport function useMesob(): MesobContextValue | null {\n return useContext(MesobContext);\n}\n\nexport function useLocaleConfig(): {\n defaultLanguage: string;\n supportedLanguages: SupportedLanguage[];\n} {\n const mesob = useMesob();\n return {\n defaultLanguage: mesob?.defaultLanguage ?? DEFAULT_LANGUAGE,\n supportedLanguages: mesob?.supportedLanguages ?? SUPPORTED_LANGUAGES,\n };\n}\n\nexport function useLocaleSchemas(): {\n localeInputDefault: Record<string, string>;\n requiredSchema: ReturnType<typeof createLocalRequiredInputSchema>;\n optionalSchema: ReturnType<typeof createLocalInputSchema>;\n} {\n const { defaultLanguage, supportedLanguages } = useLocaleConfig();\n return useMemo(\n () => ({\n localeInputDefault: getLocaleInputDefault(supportedLanguages),\n requiredSchema: createLocalRequiredInputSchema(\n supportedLanguages,\n z.string().optional(),\n ),\n optionalSchema: createLocalInputSchema(\n defaultLanguage,\n supportedLanguages,\n z.string().optional(),\n z.string().optional(),\n ),\n }),\n [defaultLanguage, supportedLanguages],\n );\n}\n","'use client';\n\nimport { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';\nimport type { ReactNode } from 'react';\n\nimport { cn } from '../../lib/utils';\n\nfunction TooltipProvider({\n delay = 0,\n ...props\n}: TooltipPrimitive.Provider.Props) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delay={delay}\n {...props}\n />\n );\n}\n\ntype TooltipProps = Omit<TooltipPrimitive.Root.Props, 'children'> & {\n children: ReactNode;\n label?: ReactNode;\n contentProps?: Omit<\n TooltipPrimitive.Popup.Props &\n Pick<\n TooltipPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n >,\n 'children'\n >;\n triggerProps?: Omit<TooltipPrimitive.Trigger.Props, 'children'>;\n};\n\nfunction Tooltip({\n label,\n contentProps,\n triggerProps,\n children,\n ...props\n}: TooltipProps) {\n if (label !== undefined) {\n return (\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props}>\n <TooltipTrigger\n render={<span className=\"inline-block\" />}\n {...triggerProps}\n >\n {children}\n </TooltipTrigger>\n <TooltipContent {...contentProps}>{label}</TooltipContent>\n </TooltipPrimitive.Root>\n );\n }\n\n return (\n <TooltipPrimitive.Root data-slot=\"tooltip\" {...props}>\n {children}\n </TooltipPrimitive.Root>\n );\n}\n\nfunction TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />;\n}\n\nfunction TooltipContent({\n className,\n side = 'top',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n children,\n ...props\n}: TooltipPrimitive.Popup.Props &\n Pick<\n TooltipPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n >) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <TooltipPrimitive.Popup\n data-slot=\"tooltip-content\"\n className={cn(\n 'cn-tooltip-content cn-tooltip-content-logical bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"cn-tooltip-arrow cn-tooltip-arrow-logical bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5\" />\n </TooltipPrimitive.Popup>\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n );\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { z } from 'zod';\n\nexport type LocaleKey = 'am' | 'en' | 'om' | 'ti' | 'so' | 'sw' | 'fr' | 'ar';\n\nexport type Locale = {\n [Key in LocaleKey | string]?: string;\n};\n\nexport type Translation = (key: string) => string;\n\n/** Fallback when MesobProvider does not receive defaultLanguage/supportedLanguages */\nexport const DEFAULT_LANGUAGE = 'en';\n\nexport type SupportedLanguage = { value: string; label: string; key: string };\n\n/** Fallback when MesobProvider does not receive supportedLanguages */\nexport const SUPPORTED_LANGUAGES: SupportedLanguage[] = [\n { value: 'en', label: 'English', key: 'En' },\n { value: 'am', label: 'አማርኛ', key: 'አማ' },\n];\n\nconst localeRecord = z.record(z.string(), z.string());\nexport const LOCALE_INPUT_DEFAULT: Locale = {};\nexport const LOCALE_REQUIRED_INPUT_SCHEMA = localeRecord.refine(\n (o) => Object.keys(o).length > 0,\n { message: 'At least one locale required' },\n);\nexport const LOCALE_OPTIONAL_INPUT_SCHEMA = localeRecord;\n\nexport function getLocaleInputDefault(\n supportedLanguages: SupportedLanguage[],\n): Record<string, string> {\n return Object.fromEntries(supportedLanguages.map(({ value }) => [value, '']));\n}\n\ntype SchemaAccumulator = {\n [key: string]: z.ZodTypeAny;\n};\n\nexport function createLocalInputSchema(\n defaultLanguage: string,\n supportedLanguages: SupportedLanguage[],\n defaultValidation: z.ZodTypeAny,\n otherValidation: z.ZodTypeAny,\n): z.ZodObject<SchemaAccumulator> {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n supportedLanguages.reduce((acc: SchemaAccumulator, { value }) => {\n acc[value] =\n value === defaultLanguage ? defaultValidation : otherValidation;\n return acc;\n }, {});\n\n return z.object(schemaDefinition);\n}\n\nexport function createLocalRequiredInputSchema(\n supportedLanguages: SupportedLanguage[],\n validation: z.ZodTypeAny,\n): z.ZodTypeAny {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n supportedLanguages.reduce((acc: SchemaAccumulator, { value }) => {\n acc[value] = validation;\n return acc;\n }, {});\n\n return z.object(schemaDefinition).superRefine((data, ctx) => {\n const hasValue = Object.values(data).some(\n (value) => typeof value === 'string' && value.trim().length > 0,\n );\n\n if (!hasValue) {\n for (const { value } of supportedLanguages) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'field is required',\n path: [value],\n });\n }\n }\n });\n}\n"],"mappings":";AAEA,SAAS,iBAAiB;AAMnB,SAAS,QAAQ,EAAE,UAAU,GAAiB;AACnD,YAAU,MAAM;AACd,QAAI,CAAC,aAAa,OAAO,aAAa,aAAa;AACjD;AAAA,IACF;AACA,UAAM,KAAK;AACX,QAAI,SAAS,eAAe,EAAE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;AAC1B,WAAO;AAAA,MACL;AAAA,MACA,QAAQ,OAAO;AAAA,MACf,UAAU,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA,OAAO;AAAA,IACP,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE,gBAAAA,KAAC,aAAa,UAAb,EAAsB,OACrB,0BAAAA,KAAC,mBAAgB,OAAO,GAAI,UAAS,GACvC;AAEJ;AAEO,SAAS,WAAqC;AACnD,SAAO,WAAW,YAAY;AAChC;AAEO,SAAS,kBAGd;AACA,QAAM,QAAQ,SAAS;AACvB,SAAO;AAAA,IACL,iBAAiB,OAAO,mBAAmB;AAAA,IAC3C,oBAAoB,OAAO,sBAAsB;AAAA,EACnD;AACF;AAEO,SAAS,mBAId;AACA,QAAM,EAAE,iBAAiB,mBAAmB,IAAI,gBAAgB;AAChE,SAAO;AAAA,IACL,OAAO;AAAA,MACL,oBAAoB,sBAAsB,kBAAkB;AAAA,MAC5D,gBAAgB;AAAA,QACd;AAAA,QACAC,GAAE,OAAO,EAAE,SAAS;AAAA,MACtB;AAAA,MACA,gBAAgB;AAAA,QACd;AAAA,QACA;AAAA,QACAA,GAAE,OAAO,EAAE,SAAS;AAAA,QACpBA,GAAE,OAAO,EAAE,SAAS;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC,iBAAiB,kBAAkB;AAAA,EACtC;AACF;","names":["useEffect","DisableDevtool","useEffect","z","jsx","jsxs","jsx","z"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mesob/ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
"default": "./src/styles/themes.css",
|
|
32
32
|
"import": "./src/styles/themes.css",
|
|
33
33
|
"require": "./src/styles/themes.css"
|
|
34
|
+
},
|
|
35
|
+
"./styles/*": {
|
|
36
|
+
"default": "./src/styles/*",
|
|
37
|
+
"import": "./src/styles/*",
|
|
38
|
+
"require": "./src/styles/*"
|
|
34
39
|
}
|
|
35
40
|
},
|
|
36
41
|
"files": [
|
|
@@ -40,6 +45,7 @@
|
|
|
40
45
|
"dependencies": {
|
|
41
46
|
"@base-ui/react": "^1.1.0",
|
|
42
47
|
"@hookform/resolvers": "^5.2.2",
|
|
48
|
+
"@mesob/common": "0.5.6",
|
|
43
49
|
"@tabler/icons-react": "^3.35.0",
|
|
44
50
|
"@tanstack/react-table": "^8.21.3",
|
|
45
51
|
"@tiptap/core": "^3.18.0",
|
|
@@ -79,8 +85,7 @@
|
|
|
79
85
|
"sonner": "^2.0.7",
|
|
80
86
|
"tailwind-merge": "^3.3.1",
|
|
81
87
|
"tw-animate-css": "^1.4.0",
|
|
82
|
-
"zod": "^4.3.6"
|
|
83
|
-
"@mesob/common": "0.5.4"
|
|
88
|
+
"zod": "^4.3.6"
|
|
84
89
|
},
|
|
85
90
|
"devDependencies": {
|
|
86
91
|
"@tailwindcss/postcss": "^4.1.11",
|
|
@@ -1,4 +1,111 @@
|
|
|
1
|
-
|
|
1
|
+
.style-lyra {
|
|
2
|
+
/* MARK: Button */
|
|
3
|
+
.cn-button {
|
|
4
|
+
@apply focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-none border border-transparent bg-clip-padding text-xs font-medium focus-visible:ring-1 aria-invalid:ring-1 [&_svg:not([class*='size-'])]:size-4;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.cn-button-variant-default {
|
|
8
|
+
@apply bg-primary text-primary-foreground [a]:hover:bg-primary/80;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.cn-button-variant-outline {
|
|
12
|
+
@apply border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cn-button-variant-secondary {
|
|
16
|
+
@apply bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cn-button-variant-ghost {
|
|
20
|
+
@apply hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.cn-button-variant-destructive {
|
|
24
|
+
@apply bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.cn-button-variant-link {
|
|
28
|
+
@apply text-primary underline-offset-4 hover:underline;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cn-button-variant-light {
|
|
32
|
+
@apply bg-primary/12 text-primary hover:bg-primary/18 dark:bg-primary/20 dark:hover:bg-primary/28;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.cn-button-variant-destructive-filled {
|
|
36
|
+
@apply bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.cn-dropdown-button-shell {
|
|
40
|
+
@apply inline-flex w-fit items-stretch isolate overflow-hidden align-middle;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.cn-dropdown-button-main {
|
|
44
|
+
@apply rounded-r-none! border-r-0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.cn-dropdown-button-trigger {
|
|
48
|
+
@apply relative -ml-px rounded-l-none! border-l-0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.cn-dropdown-button-trigger::before {
|
|
52
|
+
@apply bg-border absolute top-1 bottom-1 left-0 w-px content-[''];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.cn-dropdown-button-trigger[data-size='xs']::before {
|
|
56
|
+
@apply top-0.5 bottom-0.5;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cn-dropdown-button-trigger[data-size='sm']::before {
|
|
60
|
+
@apply top-0.5 bottom-0.5;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.cn-dropdown-button-variant-danger {
|
|
64
|
+
@apply bg-destructive text-destructive-foreground hover:bg-destructive/90;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.cn-button-size-xl {
|
|
68
|
+
@apply h-10 gap-2 px-4.5 has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4 text-sm;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.cn-button-size-icon-xl {
|
|
72
|
+
@apply size-10 [&_svg:not([class*='size-'])]:size-4.5;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.cn-button-size-xs {
|
|
76
|
+
@apply h-6 gap-1 rounded-none px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.cn-button-size-sm {
|
|
80
|
+
@apply h-7 gap-1.5 rounded-none px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3.5;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.cn-button-size-default {
|
|
84
|
+
@apply h-8 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.cn-button-size-lg {
|
|
88
|
+
@apply h-9 gap-2 px-3.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.cn-button-size-icon-xs {
|
|
92
|
+
@apply size-6 rounded-none [&_svg:not([class*='size-'])]:size-3;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.cn-button-size-icon-sm {
|
|
96
|
+
@apply size-7 rounded-none [&_svg:not([class*='size-'])]:size-3.5;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.cn-button-size-icon {
|
|
100
|
+
@apply size-8 [&_svg:not([class*='size-'])]:size-4;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.cn-button-size-icon-lg {
|
|
104
|
+
@apply size-9 [&_svg:not([class*='size-'])]:size-4;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
2
109
|
|
|
3
110
|
.style-lyra {
|
|
4
111
|
/* MARK: Accordion */
|
|
@@ -388,7 +495,15 @@
|
|
|
388
495
|
|
|
389
496
|
/* MARK: Card */
|
|
390
497
|
.cn-card {
|
|
391
|
-
@apply ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-none
|
|
498
|
+
@apply ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-none text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 *:[img:first-child]:rounded-none *:[img:last-child]:rounded-none;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.cn-card:not([data-sectioned]) {
|
|
502
|
+
@apply py-2 has-data-[slot=card-footer]:pb-0;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.cn-card[data-sectioned] {
|
|
506
|
+
@apply gap-0 py-0;
|
|
392
507
|
}
|
|
393
508
|
|
|
394
509
|
.cn-card-with-border {
|
|
@@ -404,23 +519,151 @@
|
|
|
404
519
|
}
|
|
405
520
|
|
|
406
521
|
.cn-card-header {
|
|
407
|
-
@apply gap-1 rounded-none px-
|
|
522
|
+
@apply gap-1 items-start rounded-none px-3 [.border-b]:pb-4 has-data-[slot=card-action]:gap-x-4 has-data-[slot=card-action]:gap-y-1;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.cn-card-header:has([data-slot='card-action']):not(:has([data-slot='card-description'])) {
|
|
526
|
+
@apply items-center py-1.5;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.cn-card-header:has([data-slot='card-action']):not(:has([data-slot='card-description']))
|
|
530
|
+
.cn-card-title {
|
|
531
|
+
@apply flex items-center;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.cn-card[data-size='xs']
|
|
535
|
+
.cn-card-header:has([data-slot='card-action']):not(:has([data-slot='card-description']))
|
|
536
|
+
.cn-card-title {
|
|
537
|
+
@apply min-h-6 leading-6;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.cn-card[data-size='sm']
|
|
541
|
+
.cn-card-header:has([data-slot='card-action']):not(:has([data-slot='card-description']))
|
|
542
|
+
.cn-card-title {
|
|
543
|
+
@apply min-h-7 leading-7;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.cn-card[data-size='md']
|
|
547
|
+
.cn-card-header:has([data-slot='card-action']):not(:has([data-slot='card-description']))
|
|
548
|
+
.cn-card-title {
|
|
549
|
+
@apply min-h-7 leading-7;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.cn-card[data-size='lg']
|
|
553
|
+
.cn-card-header:has([data-slot='card-action']):not(:has([data-slot='card-description']))
|
|
554
|
+
.cn-card-title {
|
|
555
|
+
@apply min-h-8 leading-8;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.cn-card[data-size='xl']
|
|
559
|
+
.cn-card-header:has([data-slot='card-action']):not(:has([data-slot='card-description']))
|
|
560
|
+
.cn-card-title {
|
|
561
|
+
@apply min-h-9 leading-9;
|
|
408
562
|
}
|
|
409
563
|
|
|
410
564
|
.cn-card-title {
|
|
411
|
-
@apply text-sm font-medium
|
|
565
|
+
@apply text-sm font-medium;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.cn-card[data-size='xs'] .cn-card-title {
|
|
569
|
+
@apply text-xs leading-tight;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.cn-card[data-size='sm'] .cn-card-title {
|
|
573
|
+
@apply text-xs font-medium;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.cn-card[data-size='md'] .cn-card-title {
|
|
577
|
+
@apply text-sm;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.cn-card[data-size='lg'] .cn-card-title {
|
|
581
|
+
@apply text-base;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.cn-card[data-size='xl'] .cn-card-title {
|
|
585
|
+
@apply text-lg;
|
|
412
586
|
}
|
|
413
587
|
|
|
414
588
|
.cn-card-description {
|
|
415
589
|
@apply text-muted-foreground text-xs/relaxed;
|
|
416
590
|
}
|
|
417
591
|
|
|
592
|
+
.cn-card[data-size='lg'] .cn-card-description,
|
|
593
|
+
.cn-card[data-size='xl'] .cn-card-description {
|
|
594
|
+
@apply text-sm;
|
|
595
|
+
}
|
|
596
|
+
|
|
418
597
|
.cn-card-content {
|
|
419
|
-
@apply px-4
|
|
598
|
+
@apply px-4 py-4;
|
|
420
599
|
}
|
|
421
600
|
|
|
422
601
|
.cn-card-footer {
|
|
423
|
-
@apply rounded-none border-t
|
|
602
|
+
@apply rounded-none border-t;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.cn-card:not([data-sectioned]) .cn-card-footer {
|
|
606
|
+
@apply p-3;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.cn-card[data-sectioned][data-size='xs'] [data-slot='card-header'] {
|
|
610
|
+
@apply px-2.5 py-2 has-data-[slot=card-action]:gap-x-3;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.cn-card[data-sectioned][data-size='xs'] [data-slot='card-content'] {
|
|
614
|
+
@apply px-2.5 py-3;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.cn-card[data-sectioned][data-size='xs'] [data-slot='card-footer'] {
|
|
618
|
+
@apply px-2.5 py-2;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.cn-card[data-sectioned][data-size='sm'] [data-slot='card-header'] {
|
|
622
|
+
@apply px-2.5 py-2 has-data-[slot=card-action]:gap-x-3;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.cn-card[data-sectioned][data-size='sm'] [data-slot='card-content'] {
|
|
626
|
+
@apply px-2.5 py-3;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.cn-card[data-sectioned][data-size='sm'] [data-slot='card-footer'] {
|
|
630
|
+
@apply px-2.5 py-2;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.cn-card[data-sectioned][data-size='md'] [data-slot='card-header'] {
|
|
634
|
+
@apply px-3 py-2 has-data-[slot=card-action]:gap-x-4;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.cn-card[data-sectioned][data-size='md'] [data-slot='card-content'] {
|
|
638
|
+
@apply px-3 py-4;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.cn-card[data-sectioned][data-size='md'] [data-slot='card-footer'] {
|
|
642
|
+
@apply px-3 py-2;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.cn-card[data-sectioned][data-size='lg'] [data-slot='card-header'] {
|
|
646
|
+
@apply px-4 py-4 has-data-[slot=card-action]:gap-x-4;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.cn-card[data-sectioned][data-size='lg'] [data-slot='card-content'] {
|
|
650
|
+
@apply px-4 py-5;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.cn-card[data-sectioned][data-size='lg'] [data-slot='card-footer'] {
|
|
654
|
+
@apply px-4 py-4;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
.cn-card[data-sectioned][data-size='xl'] [data-slot='card-header'] {
|
|
658
|
+
@apply px-5 py-5 has-data-[slot=card-action]:gap-x-4;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.cn-card[data-sectioned][data-size='xl'] [data-slot='card-content'] {
|
|
662
|
+
@apply px-5 py-6;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.cn-card[data-sectioned][data-size='xl'] [data-slot='card-footer'] {
|
|
666
|
+
@apply px-5 py-5;
|
|
424
667
|
}
|
|
425
668
|
|
|
426
669
|
/* MARK: Chart */
|