@mesob/ui 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,9 @@ type Navigation = ReturnType<typeof createNavigation>;
8
8
  type MesobContextValue = {
9
9
  navigation: Navigation;
10
10
  linkComponent: Navigation['Link'];
11
+ goBack: () => void;
12
+ navigate: (href: string) => void;
13
+ pathname: string;
11
14
  locale: string;
12
15
  defaultLanguage: string;
13
16
  supportedLanguages: SupportedLanguage[];
package/dist/providers.js CHANGED
@@ -87,6 +87,8 @@ function MesobProvider({
87
87
  }
88
88
  const locale = useLocale();
89
89
  const navigation = useMemo(() => createNavigation(routing), [routing]);
90
+ const router = navigation.useRouter();
91
+ const pathname = navigation.usePathname();
90
92
  const value = useMemo(() => {
91
93
  const linkComponent = linkComponentProp ?? navigation?.Link;
92
94
  if (!linkComponent) {
@@ -97,6 +99,9 @@ function MesobProvider({
97
99
  return {
98
100
  navigation,
99
101
  linkComponent,
102
+ goBack: () => router.back(),
103
+ navigate: (href) => router.push(href),
104
+ pathname,
100
105
  locale,
101
106
  defaultLanguage,
102
107
  supportedLanguages
@@ -104,6 +109,8 @@ function MesobProvider({
104
109
  }, [
105
110
  navigation,
106
111
  linkComponentProp,
112
+ router,
113
+ pathname,
107
114
  locale,
108
115
  defaultLanguage,
109
116
  supportedLanguages
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/provider/mesob-provider.tsx","../src/components/ui/tooltip.tsx","../src/lib/utils.ts","../src/lib/locale.ts"],"sourcesContent":["'use client';\n\nimport { useLocale } from 'next-intl';\nimport { createNavigation } from 'next-intl/navigation';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { TooltipProvider } from '../components/ui/tooltip';\nimport {\n DEFAULT_LANGUAGE,\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 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 defaultLanguage?: string;\n supportedLanguages?: SupportedLanguage[];\n};\n\nexport function MesobProvider({\n children,\n routing,\n linkComponent: linkComponentProp,\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 = useLocale();\n const navigation = useMemo(() => createNavigation(routing), [routing]);\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 locale,\n defaultLanguage,\n supportedLanguages,\n };\n }, [\n navigation,\n linkComponentProp,\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","'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\nexport const DEFAULT_LANGUAGE = 'en';\n\nexport type SupportedLanguage = { value: string; label: string; key: string };\n\nexport const SUPPORTED_LANGUAGES: SupportedLanguage[] = [\n { value: 'en', label: 'English', key: 'En' },\n { value: 'am', label: 'አማርኛ', key: 'አማ' },\n];\n\nexport const LOCALE_INPUT_DEFAULT = Object.fromEntries(\n SUPPORTED_LANGUAGES.map(({ value }) => [value, '']),\n);\n\ntype SchemaAccumulator = {\n [key: string]: z.ZodTypeAny;\n};\n\nexport function createLocalInputSchema(\n defaultValidation: z.ZodTypeAny,\n otherValidation: z.ZodTypeAny,\n): z.ZodObject<SchemaAccumulator> {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n SUPPORTED_LANGUAGES.reduce((acc: SchemaAccumulator, { value }) => {\n acc[value] =\n value === DEFAULT_LANGUAGE ? defaultValidation : otherValidation;\n return acc;\n }, {});\n\n return z.object(schemaDefinition);\n}\n\nexport function createLocalRequiredInputSchema(\n validation: z.ZodTypeAny,\n): z.ZodEffects<z.ZodObject<SchemaAccumulator>> {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n SUPPORTED_LANGUAGES.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 SUPPORTED_LANGUAGES) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'field is required',\n path: [value],\n });\n }\n }\n });\n}\n\nexport const LOCALE_REQUIRED_INPUT_SCHEMA = createLocalRequiredInputSchema(\n z.string().optional(),\n);\n\nexport const LOCALE_OPTIONAL_INPUT_SCHEMA = createLocalInputSchema(\n z.string().optional(),\n z.string().optional(),\n);\n"],"mappings":";AAEA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,eAA+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AoB,OAAO,sBAAsB;AAAA,EACnD;AACF;","names":["jsx"]}
1
+ {"version":3,"sources":["../src/provider/mesob-provider.tsx","../src/components/ui/tooltip.tsx","../src/lib/utils.ts","../src/lib/locale.ts"],"sourcesContent":["'use client';\n\nimport { useLocale } from 'next-intl';\nimport { createNavigation } from 'next-intl/navigation';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { TooltipProvider } from '../components/ui/tooltip';\nimport {\n DEFAULT_LANGUAGE,\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 defaultLanguage?: string;\n supportedLanguages?: SupportedLanguage[];\n};\n\nexport function MesobProvider({\n children,\n routing,\n linkComponent: linkComponentProp,\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 = useLocale();\n const navigation = useMemo(() => createNavigation(routing), [routing]);\n const router = navigation.useRouter();\n const pathname = navigation.usePathname();\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: () => router.back(),\n navigate: (href: string) => router.push(href),\n pathname,\n locale,\n defaultLanguage,\n supportedLanguages,\n };\n }, [\n navigation,\n linkComponentProp,\n router,\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","'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\nexport const DEFAULT_LANGUAGE = 'en';\n\nexport type SupportedLanguage = { value: string; label: string; key: string };\n\nexport const SUPPORTED_LANGUAGES: SupportedLanguage[] = [\n { value: 'en', label: 'English', key: 'En' },\n { value: 'am', label: 'አማርኛ', key: 'አማ' },\n];\n\nexport const LOCALE_INPUT_DEFAULT = Object.fromEntries(\n SUPPORTED_LANGUAGES.map(({ value }) => [value, '']),\n);\n\ntype SchemaAccumulator = {\n [key: string]: z.ZodTypeAny;\n};\n\nexport function createLocalInputSchema(\n defaultValidation: z.ZodTypeAny,\n otherValidation: z.ZodTypeAny,\n): z.ZodObject<SchemaAccumulator> {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n SUPPORTED_LANGUAGES.reduce((acc: SchemaAccumulator, { value }) => {\n acc[value] =\n value === DEFAULT_LANGUAGE ? defaultValidation : otherValidation;\n return acc;\n }, {});\n\n return z.object(schemaDefinition);\n}\n\nexport function createLocalRequiredInputSchema(\n validation: z.ZodTypeAny,\n): z.ZodEffects<z.ZodObject<SchemaAccumulator>> {\n const schemaDefinition: { [key: string]: z.ZodTypeAny } =\n SUPPORTED_LANGUAGES.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 SUPPORTED_LANGUAGES) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'field is required',\n path: [value],\n });\n }\n }\n });\n}\n\nexport const LOCALE_REQUIRED_INPUT_SCHEMA = createLocalRequiredInputSchema(\n z.string().optional(),\n);\n\nexport const LOCALE_OPTIONAL_INPUT_SCHEMA = createLocalInputSchema(\n z.string().optional(),\n z.string().optional(),\n);\n"],"mappings":";AAEA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,eAA+B,YAAY,eAAe;;;ACFnE,SAAS,WAAW,wBAAwB;;;ACF5C,SAA0B,YAAY;AACtC,SAAS,eAAe;;;ADUpB,cAsCI,YAtCJ;AALJ,SAAS,gBAAgB;AAAA,EACvB,QAAQ;AAAA,EACR,GAAG;AACL,GAAoC;AAClC,SACE;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACC,aAAU;AAAA,MACV;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;;;AEjBA,SAAS,SAAS;AAUX,IAAM,mBAAmB;AAIzB,IAAM,sBAA2C;AAAA,EACtD,EAAE,OAAO,MAAM,OAAO,WAAW,KAAK,KAAK;AAAA,EAC3C,EAAE,OAAO,MAAM,OAAO,4BAAQ,KAAK,eAAK;AAC1C;AAEO,IAAM,uBAAuB,OAAO;AAAA,EACzC,oBAAoB,IAAI,CAAC,EAAE,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;AACpD;AAMO,SAAS,uBACd,mBACA,iBACgC;AAChC,QAAM,mBACJ,oBAAoB,OAAO,CAAC,KAAwB,EAAE,MAAM,MAAM;AAChE,QAAI,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QAAM,WAAW,WAAW,YAAY;AAExC,QAAM,QAAQ,QAAQ,MAAM;AAC1B,UAAM,gBAAgB,qBAAqB,YAAY;AACvD,QAAI,CAAC,eAAe;AAClB,YAAM,IAAI;AAAA,QACR,GAAG,SAAS;AAAA,MACd;AAAA,IACF;AACA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,QAAQ,MAAM,OAAO,KAAK;AAAA,MAC1B,UAAU,CAAC,SAAiB,OAAO,KAAK,IAAI;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;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;","names":["jsx"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mesob/ui",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -26,10 +26,16 @@
26
26
  "./lib/*": {
27
27
  "types": "./dist/lib/*.d.ts",
28
28
  "default": "./dist/lib/*.js"
29
+ },
30
+ "./styles/themes.css": {
31
+ "default": "./src/styles/themes.css",
32
+ "import": "./src/styles/themes.css",
33
+ "require": "./src/styles/themes.css"
29
34
  }
30
35
  },
31
36
  "files": [
32
- "dist"
37
+ "dist",
38
+ "src/styles"
33
39
  ],
34
40
  "dependencies": {
35
41
  "@base-ui/react": "^1.1.0",
@@ -0,0 +1,79 @@
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-button-size-xl {
40
+ @apply h-10 gap-2 px-4.5 has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4 text-sm;
41
+ }
42
+
43
+ .cn-button-size-icon-xl {
44
+ @apply size-10 [&_svg:not([class*='size-'])]:size-4.5;
45
+ }
46
+
47
+ .cn-button-size-xs {
48
+ @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;
49
+ }
50
+
51
+ .cn-button-size-sm {
52
+ @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;
53
+ }
54
+
55
+ .cn-button-size-default {
56
+ @apply h-8 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5;
57
+ }
58
+
59
+ .cn-button-size-lg {
60
+ @apply h-9 gap-2 px-3.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3;
61
+ }
62
+
63
+ .cn-button-size-icon-xs {
64
+ @apply size-6 rounded-none [&_svg:not([class*='size-'])]:size-3;
65
+ }
66
+
67
+ .cn-button-size-icon-sm {
68
+ @apply size-7 rounded-none [&_svg:not([class*='size-'])]:size-3.5;
69
+ }
70
+
71
+ .cn-button-size-icon {
72
+ @apply size-8 [&_svg:not([class*='size-'])]:size-4;
73
+ }
74
+
75
+ .cn-button-size-icon-lg {
76
+ @apply size-9 [&_svg:not([class*='size-'])]:size-4;
77
+ }
78
+
79
+ }
@@ -0,0 +1,79 @@
1
+ .style-maia {
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-4xl border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4;
5
+ }
6
+
7
+ .cn-button-variant-default {
8
+ @apply bg-primary text-primary-foreground hover:bg-primary/80;
9
+ }
10
+
11
+ .cn-button-variant-outline {
12
+ @apply border-border bg-input/30 hover:bg-input/50 hover:text-foreground 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-button-size-xl {
40
+ @apply h-12 gap-2 px-7 has-data-[icon=inline-end]:pr-5 has-data-[icon=inline-start]:pl-5 text-lg;
41
+ }
42
+
43
+ .cn-button-size-icon-xl {
44
+ @apply size-12;
45
+ }
46
+
47
+ .cn-button-size-xs {
48
+ @apply h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3;
49
+ }
50
+
51
+ .cn-button-size-sm {
52
+ @apply h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2;
53
+ }
54
+
55
+ .cn-button-size-default {
56
+ @apply h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5;
57
+ }
58
+
59
+ .cn-button-size-lg {
60
+ @apply h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3;
61
+ }
62
+
63
+ .cn-button-size-icon-xs {
64
+ @apply size-6 [&_svg:not([class*='size-'])]:size-3;
65
+ }
66
+
67
+ .cn-button-size-icon-sm {
68
+ @apply size-8;
69
+ }
70
+
71
+ .cn-button-size-icon {
72
+ @apply size-9;
73
+ }
74
+
75
+ .cn-button-size-icon-lg {
76
+ @apply size-10;
77
+ }
78
+
79
+ }
@@ -0,0 +1,79 @@
1
+ .style-mira {
2
+ /* MARK: Button */
3
+ .cn-button {
4
+ @apply focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium focus-visible:ring-2 aria-invalid:ring-2 [&_svg:not([class*='size-'])]:size-4;
5
+ }
6
+
7
+ .cn-button-variant-default {
8
+ @apply bg-primary text-primary-foreground hover:bg-primary/80;
9
+ }
10
+
11
+ .cn-button-variant-outline {
12
+ @apply border-border dark:bg-input/30 hover:bg-input/50 hover:text-foreground 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-button-size-xl {
40
+ @apply h-12 gap-2 px-7 has-data-[icon=inline-end]:pr-5 has-data-[icon=inline-start]:pl-5 text-lg;
41
+ }
42
+
43
+ .cn-button-size-icon-xl {
44
+ @apply size-12;
45
+ }
46
+
47
+ .cn-button-size-xs {
48
+ @apply h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5;
49
+ }
50
+
51
+ .cn-button-size-sm {
52
+ @apply h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3;
53
+ }
54
+
55
+ .cn-button-size-default {
56
+ @apply h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5;
57
+ }
58
+
59
+ .cn-button-size-lg {
60
+ @apply h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4;
61
+ }
62
+
63
+ .cn-button-size-icon-xs {
64
+ @apply size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5;
65
+ }
66
+
67
+ .cn-button-size-icon-sm {
68
+ @apply size-6 [&_svg:not([class*='size-'])]:size-3;
69
+ }
70
+
71
+ .cn-button-size-icon {
72
+ @apply size-7 [&_svg:not([class*='size-'])]:size-3.5;
73
+ }
74
+
75
+ .cn-button-size-icon-lg {
76
+ @apply size-8 [&_svg:not([class*='size-'])]:size-4;
77
+ }
78
+
79
+ }