ekm-ui 0.0.4 → 0.0.5
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/.turbo/turbo-build.log +37 -14
- package/CHANGELOG.md +6 -0
- package/dist/button.d.ts +9 -0
- package/dist/button.mjs +4 -0
- package/dist/chunk-3SV266EG.mjs +8 -0
- package/dist/chunk-3SV266EG.mjs.map +1 -0
- package/dist/chunk-5PBKUEAL.mjs +9 -0
- package/dist/chunk-5PBKUEAL.mjs.map +1 -0
- package/dist/chunk-7LHL2LAJ.mjs +7 -0
- package/dist/chunk-7LHL2LAJ.mjs.map +1 -0
- package/dist/chunk-G676EBCC.mjs +10 -0
- package/dist/chunk-G676EBCC.mjs.map +1 -0
- package/dist/chunk-Q6W42FIC.mjs +11 -0
- package/dist/chunk-Q6W42FIC.mjs.map +1 -0
- package/dist/chunk-RUPJ2ZHA.mjs +5 -0
- package/dist/chunk-RUPJ2ZHA.mjs.map +1 -0
- package/dist/chunk-ZIAMSFEI.mjs +18 -0
- package/dist/chunk-ZIAMSFEI.mjs.map +1 -0
- package/dist/ekm-logo.d.ts +5 -0
- package/dist/ekm-logo.mjs +4 -0
- package/dist/ekm-logo.mjs.map +1 -0
- package/dist/form-row.d.ts +10 -0
- package/dist/form-row.mjs +4 -0
- package/dist/form-row.mjs.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.mjs +7 -1
- package/dist/navbar/navbar.d.ts +9 -0
- package/dist/navbar/navbar.mjs +6 -0
- package/dist/navbar/navbar.mjs.map +1 -0
- package/dist/sidebar/sidebar.d.ts +7 -0
- package/dist/sidebar/sidebar.mjs +5 -0
- package/dist/sidebar/sidebar.mjs.map +1 -0
- package/images/ekm-logo.svg +12 -0
- package/images/run_workflow.jpg +0 -0
- package/package.json +8 -1
- package/readme.md +31 -0
- package/src/button.tsx +38 -0
- package/src/ekm-logo.tsx +37 -0
- package/src/form-row.tsx +30 -0
- package/src/helpers/is-browser.ts +5 -0
- package/src/helpers/is-small-screen.ts +7 -0
- package/src/index.tsx +4 -2
- package/src/navbar/navbar.tsx +526 -0
- package/src/sidebar/sidebar.tsx +48 -0
- package/tsconfig.json +3 -0
- package/dist/Button.d.ts +0 -22
- package/dist/Button.mjs +0 -3
- package/dist/chunk-57QDDOX4.mjs +0 -8
- package/dist/chunk-57QDDOX4.mjs.map +0 -1
- package/src/Button.tsx +0 -131
- /package/dist/{Button.mjs.map → button.mjs.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/variants.ts","../src/Button.tsx"],"names":["createElement","forwardRef","variants","config","base","compoundVariants","defaultVariants","isBooleanVariant","name","v","props","_a","res","getSelected","_b","selected","className","isSelected","variantProps","variantClassName","result","prop","jsx","buttonProps","Button","__spreadValues"],"mappings":"yVACA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QAuInC,SAASC,EAGdC,EAAqB,CACrB,GAAM,CAAE,KAAAC,EAAM,SAAAF,EAAU,iBAAAG,EAAkB,gBAAAC,CAAgB,EAAIH,EAExDI,EAAoBC,GAAkB,CAC1C,IAAMC,EAAIP,GAAA,YAAAA,EAAWM,GACrB,OAAOC,IAAM,UAAWA,GAAK,SAAUA,EACzC,EAEA,OAAQC,GAA6B,CAnJvC,IAAAC,EAoJI,IAAMC,EAAM,CAACR,CAAI,EAEXS,EAAeL,GAAe,CAtJxC,IAAAG,EAAAG,EAuJO,OAAAA,GAAAH,EAAAD,EAAcF,CAAI,IAAlB,KAAAG,EACDL,GAAA,YAAAA,EAAkBE,KADjB,KAAAM,EAEAP,EAAiBC,CAAI,EAAI,GAAQ,QAEpC,QAASA,KAAQN,EAAU,CACzB,IAAMa,EAAWF,EAAYL,CAAI,EAC7BO,IAAa,QAAWH,EAAI,MAAKD,EAAAT,EAASM,CAAI,IAAb,YAAAG,EAAiBI,EAAS,EAGjE,OAAS,CAAE,SAAAb,EAAU,UAAAc,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R,EACA,UAAW,kCACb,EACA,CACE,SAAU,CACR,MAAO,UACP,KAAM,SACR,EACA,UAAW,oCACb,EACA,CACE,SAAU,CACR,MAAO,SACP,KAAM,SACR,EACA,UAAW,8BACb,EACA,CACE,SAAU,CACR,MAAO,UACP,KAAM,MACR,EACA,UAAW,iBACb,EACA,CACE,SAAU,CACR,MAAO,UACP,KAAM,MACR,EACA,UAAW,gBACb,EACA,CACE,SAAU,CACR,MAAO,UACP,KAAM,MACR,EACA,UAAW,iBACb,EACA,CACE,SAAU,CACR,MAAO,SACP,KAAM,MACR,EACA,UAAW,cACb,CACF,EACA,gBAAiB,CACf,MAAO,UACP,KAAM,KACN,SAAU,GACV,KAAM,OACR,CACF,CAAC,EAKM,SAASM,EAAOd,EAAc,CACnC,OAAOY,EAAC,SAAAG,EAAA,GAAWF,EAAYb,CAAK,EAAG,CACzC,CAGAc,EAAO,YAAc","sourcesContent":["import type { ComponentProps, ElementType, ReactElement, Ref } from \"react\";\nimport { createElement, forwardRef } from \"react\";\n\n/**\n * Definition of the available variants and their options.\n * @example\n * {\n * color: {\n * white: \"bg-white\"\n * green: \"bg-green-500\",\n * },\n * size: {\n * small: \"text-xs\",\n * large: \"text-lg\"\n * }\n * }\n */\nexport type Variants = Record<string, Record<string, string>>;\n\n/**\n * Configuration including defaults and compound variants.\n */\nexport interface VariantsConfig<V extends Variants> {\n base?: string;\n variants: V;\n compoundVariants?: CompoundVariant<V>[];\n defaultVariants?: Partial<OptionsOf<V>>;\n}\n\n/**\n * Rules for class names that are applied for certain variant combinations.\n */\nexport interface CompoundVariant<V extends Variants> {\n variants: Partial<OptionsOf<V>>;\n className: string;\n}\n\n/**\n * Only the boolean variants, i.e. ones that have \"true\" or \"false\" as options.\n */\ntype BooleanVariants<V extends Variants> = {\n [K in keyof V as V[K] extends { true: any } | { false: any }\n ? K\n : never]: V[K];\n};\n\n/**\n * Only the variants for which a default options is set.\n */\ntype DefaultVariants<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n> = {\n [K in keyof V as K extends keyof C[\"defaultVariants\"]\n ? K\n : never]: C[\"variants\"][K];\n};\n\n/**\n * Names of all optional variants, i.e. booleans or ones with default options.\n */\ntype OptionalVariantNames<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n> = keyof BooleanVariants<V> | keyof DefaultVariants<C>;\n\n/**\n * Possible options for all the optional variants.\n *\n * @example\n * {\n * color?: \"white\" | \"green\",\n * rounded?: boolean | undefined\n * }\n */\ntype OptionalOptions<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n> = {\n [K in keyof V as K extends OptionalVariantNames<C>\n ? K\n : never]?: OptionsOf<V>[K];\n};\n\n/**\n * Possible options for all required variants.\n *\n * @example {\n * size: \"small\" | \"large\"\n * }\n */\ntype RequiredOptions<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n> = {\n [K in keyof V as K extends OptionalVariantNames<C>\n ? never\n : K]: OptionsOf<V>[K];\n};\n\n/**\n * Utility type to extract the possible options.\n * Converts \"true\" | \"false\" options into booleans.\n *\n * @example\n * OptionsOf<{\n * size: { small: \"text-xs\"; large: \"text-lg\" };\n * rounded: { true: \"rounded-full\" }\n * }>\n * ==>\n * {\n * size: \"text-xs\" | \"text-lg\";\n * rounded: boolean;\n * }\n */\ntype OptionsOf<V extends Variants> = {\n [K in keyof V]: keyof V[K] extends \"true\" | \"false\" ? boolean : keyof V[K];\n};\n\n/**\n * Extracts the possible options.\n */\nexport type VariantOptions<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n> = RequiredOptions<C> & OptionalOptions<C>;\n\n/**\n * Without this conversion step, defaultVariants and compoundVariants will\n * allow extra keys, i.e. non-existent variants.\n * See https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts\n */\nexport type Simplify<T> = {\n [K in keyof T]: T[K];\n};\n\nexport function variants<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n>(config: Simplify<C>) {\n const { base, variants, compoundVariants, defaultVariants } = config;\n\n const isBooleanVariant = (name: keyof V) => {\n const v = variants?.[name];\n return v && (\"false\" in v || \"true\" in v);\n };\n\n return (props: VariantOptions<C>) => {\n const res = [base];\n\n const getSelected = (name: keyof V) =>\n (props as any)[name] ??\n defaultVariants?.[name] ??\n (isBooleanVariant(name) ? false : undefined);\n\n for (let name in variants) {\n const selected = getSelected(name);\n if (selected !== undefined) res.push(variants[name]?.[selected]);\n }\n\n for (let { variants, className } of compoundVariants ?? []) {\n const isSelected = (name: string) => getSelected(name) === variants[name];\n if (Object.keys(variants).every(isSelected)) {\n res.push(className);\n }\n }\n return res.filter(Boolean).join(\" \");\n };\n}\n\n/**\n * Utility type to infer the first argument of a variantProps function.\n */\nexport type VariantPropsOf<T> = T extends (props: infer P) => any ? P : never;\n\n/**\n * Type for the variantProps() argument – consists of the VariantOptions and an optional className for chaining.\n */\ntype VariantProps<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n> = VariantOptions<C> & { className?: string };\n\nexport function variantProps<\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n>(config: Simplify<C>) {\n const variantClassName = variants<C>(config);\n return <P extends VariantProps<C>>(props: P) => {\n const result: any = {};\n\n // Pass-through all unrelated props\n for (let prop in props) {\n if (config.variants && !(prop in config.variants)) {\n result[prop] = props[prop];\n }\n }\n\n // Add the optionally passed className prop for chaining\n result.className = [props.className, variantClassName(props)]\n .filter(Boolean)\n .join(\" \");\n\n return result as { className: string } & Omit<P, keyof C[\"variants\"]>;\n };\n}\n\ntype AsProps<T extends ElementType = ElementType> = {\n as?: T;\n};\n\ntype PolymorphicComponentProps<T extends ElementType> = AsProps<T> &\n Omit<ComponentProps<T>, \"as\">;\n\nexport function styled<\n T extends ElementType,\n C extends VariantsConfig<V>,\n V extends Variants = C[\"variants\"]\n>(type: T, config: string | Simplify<C>) {\n const styledProps =\n typeof config === \"string\"\n ? variantProps({ base: config, variants: {} })\n : variantProps(config);\n\n const Component: <As extends ElementType = T>(\n props: PolymorphicComponentProps<As> & VariantOptions<C>\n // eslint-disable-next-line react/display-name\n ) => ReactElement | null = forwardRef(\n ({ as, ...props }: AsProps, ref: Ref<Element>) => {\n return createElement(as ?? type, { ...styledProps(props), ref });\n }\n );\n return Component;\n}\n","import * as React from \"react\";\nimport { VariantPropsOf, variantProps } from \"./variants\";\n\nconst buttonProps = variantProps({\n base: \"rounded-full font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2\",\n variants: {\n color: {\n default: \"focus-visible:outline-indigo-600\",\n primary: \"focus-visible:outline-green-600\",\n warning: \"focus-visible:outline-orange-600\",\n danger: \"focus-visible:outline-red-600\",\n },\n size: {\n xs: \"px-2.5 py-1 text-xs\",\n sm: \"px-2.5 py-1 text-sm\",\n md: \"px-3 py-1.5 text-sm\",\n lg: \"px-3.5 py-2 text-sm\",\n xl: \"px-4 py-2.5 text-sm\",\n },\n disabled: {\n true: \"cursor-not-allowed opacity-50\",\n },\n type: {\n outline: \"ring-1 ring-inset bg-white shadow-sm\",\n solid: \"text-white shadow-sm\",\n link: \"hover:underline bg-white\",\n },\n },\n compoundVariants: [\n {\n variants: {\n color: \"default\",\n type: \"solid\",\n },\n className: \"bg-indigo-600 hover:bg-indigo-500\",\n },\n {\n variants: {\n color: \"primary\",\n type: \"solid\",\n },\n className: \"bg-green-600 hover:bg-green-500\",\n },\n {\n variants: {\n color: \"warning\",\n type: \"solid\",\n },\n className: \"bg-orange-600 hover:bg-orange-500\",\n },\n {\n variants: {\n color: \"danger\",\n type: \"solid\",\n },\n className: \"bg-red-600 hover:bg-red-500\",\n },\n {\n variants: {\n color: \"default\",\n type: \"outline\",\n },\n className: \"text-indigo-600 ring-indigo-600 hover:bg-indigo-50\",\n },\n {\n variants: {\n color: \"primary\",\n type: \"outline\",\n },\n className: \"ring-green-600 hover:bg-green-50\",\n },\n {\n variants: {\n color: \"warning\",\n type: \"outline\",\n },\n className: \"ring-orange-600 hover:bg-orange-50\",\n },\n {\n variants: {\n color: \"danger\",\n type: \"outline\",\n },\n className: \"ring-red-600 hover:bg-red-50\",\n },\n {\n variants: {\n color: \"default\",\n type: \"link\",\n },\n className: \"text-indigo-600\",\n },\n {\n variants: {\n color: \"primary\",\n type: \"link\",\n },\n className: \"ring-green-600\",\n },\n {\n variants: {\n color: \"warning\",\n type: \"link\",\n },\n className: \"ring-orange-600\",\n },\n {\n variants: {\n color: \"danger\",\n type: \"link\",\n },\n className: \"ring-red-600\",\n },\n ],\n defaultVariants: {\n color: \"default\",\n size: \"md\",\n disabled: false,\n type: \"solid\",\n },\n});\n\ntype Props = JSX.IntrinsicElements[\"button\"] &\n VariantPropsOf<typeof buttonProps>;\n\nexport function Button(props: Props) {\n return <button {...buttonProps(props)} />;\n}\n\n// Set display name so that correct component name shows up in DevTools / Storybook.\nButton.displayName = \"Button\";\n"]}
|
package/src/Button.tsx
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { VariantPropsOf, variantProps } from "./variants";
|
|
3
|
-
|
|
4
|
-
const buttonProps = variantProps({
|
|
5
|
-
base: "rounded-full font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
6
|
-
variants: {
|
|
7
|
-
color: {
|
|
8
|
-
default: "focus-visible:outline-indigo-600",
|
|
9
|
-
primary: "focus-visible:outline-green-600",
|
|
10
|
-
warning: "focus-visible:outline-orange-600",
|
|
11
|
-
danger: "focus-visible:outline-red-600",
|
|
12
|
-
},
|
|
13
|
-
size: {
|
|
14
|
-
xs: "px-2.5 py-1 text-xs",
|
|
15
|
-
sm: "px-2.5 py-1 text-sm",
|
|
16
|
-
md: "px-3 py-1.5 text-sm",
|
|
17
|
-
lg: "px-3.5 py-2 text-sm",
|
|
18
|
-
xl: "px-4 py-2.5 text-sm",
|
|
19
|
-
},
|
|
20
|
-
disabled: {
|
|
21
|
-
true: "cursor-not-allowed opacity-50",
|
|
22
|
-
},
|
|
23
|
-
type: {
|
|
24
|
-
outline: "ring-1 ring-inset bg-white shadow-sm",
|
|
25
|
-
solid: "text-white shadow-sm",
|
|
26
|
-
link: "hover:underline bg-white",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
compoundVariants: [
|
|
30
|
-
{
|
|
31
|
-
variants: {
|
|
32
|
-
color: "default",
|
|
33
|
-
type: "solid",
|
|
34
|
-
},
|
|
35
|
-
className: "bg-indigo-600 hover:bg-indigo-500",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
variants: {
|
|
39
|
-
color: "primary",
|
|
40
|
-
type: "solid",
|
|
41
|
-
},
|
|
42
|
-
className: "bg-green-600 hover:bg-green-500",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
variants: {
|
|
46
|
-
color: "warning",
|
|
47
|
-
type: "solid",
|
|
48
|
-
},
|
|
49
|
-
className: "bg-orange-600 hover:bg-orange-500",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
variants: {
|
|
53
|
-
color: "danger",
|
|
54
|
-
type: "solid",
|
|
55
|
-
},
|
|
56
|
-
className: "bg-red-600 hover:bg-red-500",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
variants: {
|
|
60
|
-
color: "default",
|
|
61
|
-
type: "outline",
|
|
62
|
-
},
|
|
63
|
-
className: "text-indigo-600 ring-indigo-600 hover:bg-indigo-50",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
variants: {
|
|
67
|
-
color: "primary",
|
|
68
|
-
type: "outline",
|
|
69
|
-
},
|
|
70
|
-
className: "ring-green-600 hover:bg-green-50",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
variants: {
|
|
74
|
-
color: "warning",
|
|
75
|
-
type: "outline",
|
|
76
|
-
},
|
|
77
|
-
className: "ring-orange-600 hover:bg-orange-50",
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
variants: {
|
|
81
|
-
color: "danger",
|
|
82
|
-
type: "outline",
|
|
83
|
-
},
|
|
84
|
-
className: "ring-red-600 hover:bg-red-50",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
variants: {
|
|
88
|
-
color: "default",
|
|
89
|
-
type: "link",
|
|
90
|
-
},
|
|
91
|
-
className: "text-indigo-600",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
variants: {
|
|
95
|
-
color: "primary",
|
|
96
|
-
type: "link",
|
|
97
|
-
},
|
|
98
|
-
className: "ring-green-600",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
variants: {
|
|
102
|
-
color: "warning",
|
|
103
|
-
type: "link",
|
|
104
|
-
},
|
|
105
|
-
className: "ring-orange-600",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
variants: {
|
|
109
|
-
color: "danger",
|
|
110
|
-
type: "link",
|
|
111
|
-
},
|
|
112
|
-
className: "ring-red-600",
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
defaultVariants: {
|
|
116
|
-
color: "default",
|
|
117
|
-
size: "md",
|
|
118
|
-
disabled: false,
|
|
119
|
-
type: "solid",
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
type Props = JSX.IntrinsicElements["button"] &
|
|
124
|
-
VariantPropsOf<typeof buttonProps>;
|
|
125
|
-
|
|
126
|
-
export function Button(props: Props) {
|
|
127
|
-
return <button {...buttonProps(props)} />;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Set display name so that correct component name shows up in DevTools / Storybook.
|
|
131
|
-
Button.displayName = "Button";
|
|
File without changes
|