azeriand-library 1.4.0 → 1.6.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.
@@ -0,0 +1,7 @@
1
+ type CheckboxProps = {
2
+ label?: string;
3
+ checkedDefault: boolean;
4
+ onChange: (checked: boolean) => void;
5
+ };
6
+ export declare function Checkbox({ label, checkedDefault, onChange }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ type SectionNameProps = {
2
+ section: string;
3
+ className?: string;
4
+ };
5
+ export declare function SectionName({ section, className }: SectionNameProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
package/dist/index.d.ts CHANGED
@@ -2,3 +2,5 @@ export { Avatar } from './components/avatar';
2
2
  export { Card } from './components/card/card';
3
3
  export { Button } from './components/button/button';
4
4
  export { Badge } from './components/badge/badge';
5
+ export { Checkbox } from './components/checkbox/checkbox';
6
+ export { SectionName } from './components/section-name/section-name';
package/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@
3
3
  try {
4
4
  if (typeof document != "undefined") {
5
5
  var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode(".card{\n /* border-radius: 20px; */\n color: var(--card-text-color, white);\n}\n\n.card.glass{\n background-color: color-mix(in oklch, var(--glass-color), transparent 80%);\n border: 1px solid color-mix(in oklch, var(--glass-color), transparent 40%);\n -webkit-backface-visibility: hidden;\n -webkit-perspective: 1000;\n -webkit-transform: translate3d(0,0,0);\n -webkit-transform: translateZ(0);\n backface-visibility: hidden;\n perspective: 1000;\n transform: translate3d(0,0,0);\n transform: translateZ(0);\n}\n\n.card.mate{\n background-color: var(--glass-color);\n}\n\n.card.outlined{\n border: solid white 2px;\n}\n\nbutton .card.ghost:hover, button .card.outlined:hover{\n background: color-mix(in oklch, var(--glass-color), transparent 80%);\n}\n\nbutton .card.glass:hover{\n box-shadow: 0 4px 10px color-mix(in oklch, var(--glass-color), transparent 85%);\n}\n\nbutton .card.mate:hover{\n background-color: color-mix(in oklch, var(--glass-color), white 10%) \n}\nbutton{\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n cursor: pointer;\n outline: inherit;\n font-weight: bold;\n}\n\nbutton:focus {\n outline: revert;\n}"));
6
+ elementStyle.appendChild(document.createTextNode(".card{\n /* border-radius: 20px; */\n color: var(--card-text-color, white);\n}\n\n.card.glass{\n background-color: color-mix(in oklch, var(--glass-color), transparent 80%);\n border: 1px solid color-mix(in oklch, var(--glass-color), transparent 40%);\n -webkit-backface-visibility: hidden;\n -webkit-perspective: 1000;\n -webkit-transform: translate3d(0,0,0);\n -webkit-transform: translateZ(0);\n backface-visibility: hidden;\n perspective: 1000;\n transform: translate3d(0,0,0);\n transform: translateZ(0);\n}\n\n.card.mate{\n background-color: var(--glass-color);\n}\n\n.card.outlined{\n border: solid white 2px;\n}\n\nbutton .card.ghost:hover, button .card.outlined:hover{\n background: color-mix(in oklch, var(--glass-color), transparent 80%);\n}\n\nbutton .card.glass:hover{\n box-shadow: 0 4px 10px color-mix(in oklch, var(--glass-color), transparent 85%);\n}\n\nbutton .card.mate:hover{\n background-color: color-mix(in oklch, var(--glass-color), white 10%) \n}\nbutton{\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n cursor: pointer;\n outline: inherit;\n font-weight: bold;\n}\n\nbutton:focus {\n outline: revert;\n}\n.section-name{\n color: hsla(0, 0%, 100%, 0.7);\n}"));
7
7
  document.head.appendChild(elementStyle);
8
8
  }
9
9
  } catch (e) {
@@ -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,160 @@ 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
+ }
228
+ function SectionName({ section, className }) {
229
+ return /* @__PURE__ */ jsx("div", { className: `uppercase font-bold tracking-[0.15rem] w-fit section-name ${className}`, children: section });
230
+ }
83
231
  export {
84
232
  Avatar,
85
233
  Badge,
86
234
  Button,
87
- Card
235
+ Card,
236
+ Checkbox,
237
+ SectionName
88
238
  };
89
239
  //# sourceMappingURL=index.esm.js.map