azeriand-library 1.4.0 → 1.5.0
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/checkbox/checkbox.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +148 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +152 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { createContext, useState, useContext, useEffect } from "react";
|
|
14
|
+
import React, { createContext, useState, useContext, useEffect } from "react";
|
|
15
15
|
function Avatar({ src, className = "", style }) {
|
|
16
16
|
return /* @__PURE__ */ jsx(
|
|
17
17
|
"img",
|
|
@@ -80,10 +80,156 @@ function Button({ children, label, icon, position = "left", onClick, size, class
|
|
|
80
80
|
function Badge({ label, ...cardProps }) {
|
|
81
81
|
return /* @__PURE__ */ jsx(Card, { noBlur: true, noPadding: true, className: "rounded-sm w-fit", ...cardProps, children: /* @__PURE__ */ jsx("div", { className: "px-0.5 py-0.10 text-[0.5rem] font-bold", children: label }) });
|
|
82
82
|
}
|
|
83
|
+
var DefaultContext = {
|
|
84
|
+
color: void 0,
|
|
85
|
+
size: void 0,
|
|
86
|
+
className: void 0,
|
|
87
|
+
style: void 0,
|
|
88
|
+
attr: void 0
|
|
89
|
+
};
|
|
90
|
+
var IconContext = React.createContext && /* @__PURE__ */ React.createContext(DefaultContext);
|
|
91
|
+
var _excluded = ["attr", "size", "title"];
|
|
92
|
+
function _objectWithoutProperties(source, excluded) {
|
|
93
|
+
if (source == null) return {};
|
|
94
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
95
|
+
var key, i;
|
|
96
|
+
if (Object.getOwnPropertySymbols) {
|
|
97
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
98
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
99
|
+
key = sourceSymbolKeys[i];
|
|
100
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
101
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
102
|
+
target[key] = source[key];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return target;
|
|
106
|
+
}
|
|
107
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
108
|
+
if (source == null) return {};
|
|
109
|
+
var target = {};
|
|
110
|
+
for (var key in source) {
|
|
111
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
112
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
113
|
+
target[key] = source[key];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return target;
|
|
117
|
+
}
|
|
118
|
+
function _extends() {
|
|
119
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
120
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
121
|
+
var source = arguments[i];
|
|
122
|
+
for (var key in source) {
|
|
123
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
124
|
+
target[key] = source[key];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return target;
|
|
129
|
+
};
|
|
130
|
+
return _extends.apply(this, arguments);
|
|
131
|
+
}
|
|
132
|
+
function ownKeys(e, r) {
|
|
133
|
+
var t = Object.keys(e);
|
|
134
|
+
if (Object.getOwnPropertySymbols) {
|
|
135
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
136
|
+
r && (o = o.filter(function(r2) {
|
|
137
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
138
|
+
})), t.push.apply(t, o);
|
|
139
|
+
}
|
|
140
|
+
return t;
|
|
141
|
+
}
|
|
142
|
+
function _objectSpread(e) {
|
|
143
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
144
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
145
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
146
|
+
_defineProperty(e, r2, t[r2]);
|
|
147
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
148
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return e;
|
|
152
|
+
}
|
|
153
|
+
function _defineProperty(obj, key, value) {
|
|
154
|
+
key = _toPropertyKey(key);
|
|
155
|
+
if (key in obj) {
|
|
156
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
157
|
+
} else {
|
|
158
|
+
obj[key] = value;
|
|
159
|
+
}
|
|
160
|
+
return obj;
|
|
161
|
+
}
|
|
162
|
+
function _toPropertyKey(t) {
|
|
163
|
+
var i = _toPrimitive(t, "string");
|
|
164
|
+
return "symbol" == typeof i ? i : i + "";
|
|
165
|
+
}
|
|
166
|
+
function _toPrimitive(t, r) {
|
|
167
|
+
if ("object" != typeof t || !t) return t;
|
|
168
|
+
var e = t[Symbol.toPrimitive];
|
|
169
|
+
if (void 0 !== e) {
|
|
170
|
+
var i = e.call(t, r);
|
|
171
|
+
if ("object" != typeof i) return i;
|
|
172
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
173
|
+
}
|
|
174
|
+
return ("string" === r ? String : Number)(t);
|
|
175
|
+
}
|
|
176
|
+
function Tree2Element(tree) {
|
|
177
|
+
return tree && tree.map((node, i) => /* @__PURE__ */ React.createElement(node.tag, _objectSpread({
|
|
178
|
+
key: i
|
|
179
|
+
}, node.attr), Tree2Element(node.child)));
|
|
180
|
+
}
|
|
181
|
+
function GenIcon(data) {
|
|
182
|
+
return (props) => /* @__PURE__ */ React.createElement(IconBase, _extends({
|
|
183
|
+
attr: _objectSpread({}, data.attr)
|
|
184
|
+
}, props), Tree2Element(data.child));
|
|
185
|
+
}
|
|
186
|
+
function IconBase(props) {
|
|
187
|
+
var elem = (conf) => {
|
|
188
|
+
var {
|
|
189
|
+
attr,
|
|
190
|
+
size,
|
|
191
|
+
title
|
|
192
|
+
} = props, svgProps = _objectWithoutProperties(props, _excluded);
|
|
193
|
+
var computedSize = size || conf.size || "1em";
|
|
194
|
+
var className;
|
|
195
|
+
if (conf.className) className = conf.className;
|
|
196
|
+
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
197
|
+
return /* @__PURE__ */ React.createElement("svg", _extends({
|
|
198
|
+
stroke: "currentColor",
|
|
199
|
+
fill: "currentColor",
|
|
200
|
+
strokeWidth: "0"
|
|
201
|
+
}, conf.attr, attr, svgProps, {
|
|
202
|
+
className,
|
|
203
|
+
style: _objectSpread(_objectSpread({
|
|
204
|
+
color: props.color || conf.color
|
|
205
|
+
}, conf.style), props.style),
|
|
206
|
+
height: computedSize,
|
|
207
|
+
width: computedSize,
|
|
208
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
209
|
+
}), title && /* @__PURE__ */ React.createElement("title", null, title), props.children);
|
|
210
|
+
};
|
|
211
|
+
return IconContext !== void 0 ? /* @__PURE__ */ React.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
|
|
212
|
+
}
|
|
213
|
+
function FaCheck(props) {
|
|
214
|
+
return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" }, "child": [] }] })(props);
|
|
215
|
+
}
|
|
216
|
+
function Checkbox({ label, checkedDefault = false, onChange }) {
|
|
217
|
+
const [checked, setChecked] = useState(checkedDefault);
|
|
218
|
+
function checkboxClicked() {
|
|
219
|
+
const newValue = !checked;
|
|
220
|
+
setChecked(newValue);
|
|
221
|
+
onChange(newValue);
|
|
222
|
+
}
|
|
223
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 w-fit", onClick: checkboxClicked, children: [
|
|
224
|
+
/* @__PURE__ */ jsx(Button, { icon: checked ? /* @__PURE__ */ jsx(FaCheck, {}) : null }),
|
|
225
|
+
label
|
|
226
|
+
] });
|
|
227
|
+
}
|
|
83
228
|
export {
|
|
84
229
|
Avatar,
|
|
85
230
|
Badge,
|
|
86
231
|
Button,
|
|
87
|
-
Card
|
|
232
|
+
Card,
|
|
233
|
+
Checkbox
|
|
88
234
|
};
|
|
89
235
|
//# sourceMappingURL=index.esm.js.map
|