Comparing version 0.0.6 to 0.0.7
import React, { MouseEventHandler } from "react"; | ||
type Variant = "primary" | "secondary" | "tertiary"; | ||
import { IconsTypeEnum } from "../icon/"; | ||
type Type = "primary" | "primaryInverse" | "primaryDestructive" | "secondary" | "tertiary" | "tertiaryInverse" | "tertiaryDestructive"; | ||
type Size = "small" | "medium" | "large"; | ||
type Colors = "inverse" | "destructive"; | ||
export interface Button extends React.ButtonHTMLAttributes<HTMLButtonElement> { | ||
export interface iButton extends React.HTMLAttributes<HTMLElement> { | ||
className?: string; | ||
variant?: Variant; | ||
type?: Type; | ||
size?: Size; | ||
disabled?: boolean; | ||
fullWidth?: boolean; | ||
onClick?: MouseEventHandler; | ||
leadingIcon?: keyof typeof IconsTypeEnum; | ||
trailingIcon?: keyof typeof IconsTypeEnum; | ||
} | ||
type Destructive = { | ||
variant?: "secondary"; | ||
variantColor?: never; | ||
} | { | ||
variant?: "primary" | "tertiary"; | ||
variantColor?: Colors; | ||
}; | ||
type AriaLabel = { | ||
@@ -26,4 +22,4 @@ icon?: false; | ||
}; | ||
export type ButtonProps = Button & AriaLabel & Destructive; | ||
export type ButtonProps = iButton & AriaLabel; | ||
export declare const Button: (props: ButtonProps) => JSX.Element; | ||
export {}; |
@@ -1,2 +0,4 @@ | ||
import { Button } from "./components/button/Button"; | ||
export { Button }; | ||
import { Button } from "./components/button"; | ||
import { Icon } from "./components/icon"; | ||
import { Heading } from "./components/heading"; | ||
export { Button, Icon, Heading }; |
103
index.js
@@ -1,26 +0,83 @@ | ||
import u from "react"; | ||
const g = "_kbutton_50pmg_1", y = "_primary_50pmg_16", b = "_destructive_50pmg_32", v = "_secondary_50pmg_47", $ = "_tertiary_50pmg_66", k = "_inverse_50pmg_86", C = "_large_50pmg_101", f = "_icon_50pmg_106", h = "_medium_50pmg_109", x = "_small_50pmg_117", t = { | ||
kbutton: g, | ||
primary: y, | ||
destructive: b, | ||
secondary: v, | ||
tertiary: $, | ||
inverse: k, | ||
large: C, | ||
icon: f, | ||
medium: h, | ||
small: x | ||
}, B = (n) => { | ||
const { variant: o = "secondary", size: r = "medium", className: e, variantColor: s, icon: c, ariaLabel: a, disabled: i, onClick: _, style: m, children: l } = n, p = s, d = ` | ||
${t.kbutton} | ||
${t[o]} | ||
${t[r]} | ||
${t[p]} | ||
${e != null ? e : ""} | ||
${c && t.icon} | ||
`; | ||
return u.createElement("button", { disabled: i, "aria-label": a, className: d, onClick: _, style: m }, l); | ||
import _ from "react"; | ||
const b = "_fullWidth_1sp1z_19", g = "_large_1sp1z_22", I = "_icon_1sp1z_27", N = "_medium_1sp1z_30", x = "_small_1sp1z_38", D = "_primary_1sp1z_47", E = "_primaryDestructive_1sp1z_65", M = "_primaryInverse_1sp1z_83", S = "_secondary_1sp1z_102", w = "_tertiary_1sp1z_123", C = "_tertiaryDestructive_1sp1z_144", j = "_tertiaryInverse_1sp1z_163", l = { | ||
"k-button": "_k-button_1sp1z_1", | ||
fullWidth: b, | ||
large: g, | ||
icon: I, | ||
medium: N, | ||
small: x, | ||
primary: D, | ||
primaryDestructive: E, | ||
primaryInverse: M, | ||
secondary: S, | ||
tertiary: w, | ||
tertiaryDestructive: C, | ||
tertiaryInverse: j | ||
}; | ||
var d = { exports: {} }; | ||
/*! | ||
Copyright (c) 2018 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
(function(a) { | ||
(function() { | ||
var r = {}.hasOwnProperty; | ||
function t() { | ||
for (var e = [], n = 0; n < arguments.length; n++) { | ||
var s = arguments[n]; | ||
if (!!s) { | ||
var o = typeof s; | ||
if (o === "string" || o === "number") | ||
e.push(s); | ||
else if (Array.isArray(s)) { | ||
if (s.length) { | ||
var c = t.apply(null, s); | ||
c && e.push(c); | ||
} | ||
} else if (o === "object") { | ||
if (s.toString !== Object.prototype.toString && !s.toString.toString().includes("[native code]")) { | ||
e.push(s.toString()); | ||
continue; | ||
} | ||
for (var i in s) | ||
r.call(s, i) && s[i] && e.push(i); | ||
} | ||
} | ||
} | ||
return e.join(" "); | ||
} | ||
a.exports ? (t.default = t, a.exports = t) : window.classNames = t; | ||
})(); | ||
})(d); | ||
const p = d.exports, f = (a) => { | ||
const { icon: r, style: t, className: e } = a, n = p(`k-icon-${r}`, e); | ||
return _.createElement("span", { className: n, style: t }); | ||
}, V = (a) => { | ||
const { type: r = "secondary", size: t = "medium", className: e, icon: n, ariaLabel: s, disabled: o, onClick: c, style: i, children: h, leadingIcon: u, trailingIcon: y, fullWidth: m } = a, z = p(l["k-button"], l[r], l[t], (n != null ? n : !1) && l.icon, (m != null ? m : !1) && l.fullWidth, e); | ||
return _.createElement( | ||
"button", | ||
{ disabled: o, "aria-label": s, className: z, onClick: c, style: i }, | ||
u != null && _.createElement(f, { icon: u, style: { marginRight: "12px" } }), | ||
h, | ||
y != null && _.createElement(f, { icon: y, style: { marginLeft: "12px" } }) | ||
); | ||
}, k = "_s200_1a35o_10", H = "_hasMargin_1a35o_20", O = "_s300_1a35o_24", W = "_s400_1a35o_38", $ = "_s500_1a35o_52", A = "_s600_1a35o_66", L = "_s700_1a35o_80", R = "_s800_1a35o_94", B = "_s900_1a35o_108", v = { | ||
s200: k, | ||
hasMargin: H, | ||
s300: O, | ||
s400: W, | ||
s500: $, | ||
s600: A, | ||
s700: L, | ||
s800: R, | ||
s900: B | ||
}, q = (a) => { | ||
const { as: r = "h1", children: t, className: e, size: n, hasMargin: s } = a, o = `s${n}`, c = p(v[o], s && v.hasMargin, e); | ||
return _.createElement(r, { className: c }, t); | ||
}; | ||
export { | ||
B as Button | ||
V as Button, | ||
q as Heading, | ||
f as Icon | ||
}; |
{ | ||
"name": "kzkzkz", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"type": "module", | ||
"main": "index.js", | ||
"sideEffects": "false", | ||
"scripts": { | ||
"build": "tsc && vite build", | ||
"sass": "sass ./src/static/index.scss ./dist/static/kibble.css ", | ||
"build": "tsc && vite build && npm run sass", | ||
"storybook": "start-storybook -p 6006", | ||
"build-storybook": "build-storybook -o public " | ||
"build-storybook": "build-storybook -o public", | ||
"prepare": "husky install" | ||
}, | ||
@@ -14,17 +17,30 @@ "devDependencies": { | ||
"@rollup/plugin-typescript": "^9.0.2", | ||
"@storybook/addon-a11y": "^6.5.13", | ||
"@storybook/addon-actions": "^6.5.13", | ||
"@storybook/addon-essentials": "^6.5.13", | ||
"@storybook/addon-interactions": "^6.5.13", | ||
"@storybook/addon-links": "^6.5.13", | ||
"@storybook/builder-vite": "^0.2.5", | ||
"@storybook/addon-a11y": "^6.5.15", | ||
"@storybook/addon-actions": "^6.5.15", | ||
"@storybook/addon-essentials": "^6.5.15", | ||
"@storybook/addon-interactions": "^6.5.15", | ||
"@storybook/addon-links": "^6.5.15", | ||
"@storybook/builder-vite": "^0.2.6", | ||
"@storybook/jest": "^0.0.10", | ||
"@storybook/react": "^6.5.13", | ||
"@storybook/react": "^6.5.15", | ||
"@storybook/testing-library": "^0.0.13", | ||
"@types/react": "^18.0.25", | ||
"@typescript-eslint/eslint-plugin": "^5.47.1", | ||
"babel-loader": "^8.3.0", | ||
"classnames": "^2.3.2", | ||
"eslint": "^8.30.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-config-standard-with-typescript": "^24.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-n": "^15.6.0", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"eslint-plugin-react": "^7.31.11", | ||
"husky": "^8.0.2", | ||
"lint-staged": "^13.1.0", | ||
"prettier": "2.8.1", | ||
"react": "^17.0.2", | ||
"react-docgen-typescript": "^2.2.2", | ||
"react-dom": "^17.0.2", | ||
"sass": "^1.56.1", | ||
"typescript": "^4.6.4", | ||
"typescript": "^4.9.4", | ||
"vite": "^3.2.3", | ||
@@ -36,3 +52,10 @@ "vite-plugin-static-copy": "^0.12.0" | ||
"react-dom": ">=17.0.2" | ||
}, | ||
"prettier": { | ||
"semi": false | ||
}, | ||
"lint-staged": { | ||
"*.{ts,tsx,scss}": "eslint --cache --fix", | ||
"*.{ts,tsx,scss,md}": "prettier --write" | ||
} | ||
} |
# kz | ||
Here will be the content of README file. | ||
Here will be the content of README file. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
99034
21
1002
4
32
1