@open-condo/ui 1.0.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/README.md ADDED
@@ -0,0 +1,29 @@
1
+ ## Table of contents
2
+ [Installation](#installation)\
3
+ [Usage](#usage)\
4
+ [Access theme colors](#access-theme-colors)
5
+
6
+ ## Installation
7
+ To install package simply run the following command if you're using npm as your package manager:
8
+ ```bash
9
+ npm i @open-condo/ui
10
+ ```
11
+ or it's yarn alternative
12
+ ```bash
13
+ yarn add @open-condo/ui
14
+ ```
15
+
16
+ ## Usage
17
+ You can import needed component with its props directly from package entry point like this:
18
+ ```typescript
19
+ import { Button } from '@open-condo/ui'
20
+ import type { ButtonProps } from '@open-condo/ui'
21
+ ```
22
+
23
+ ## Access theme colors
24
+ You also can directly access to all our theme colors as well
25
+ by specifying import sub path like this:
26
+ ```typescript
27
+ import { colors } from '@open-condo/ui/colors'
28
+ import type { ColorPalette } from '@open-condo/ui/colors'
29
+ ```
@@ -0,0 +1,49 @@
1
+ /**
2
+ * This file was generated automatically
3
+ * Do not edit directly
4
+ */
5
+ export interface ColorPalette {
6
+ white: string;
7
+ black: string;
8
+ brandGradient: {
9
+ [key: string]: string;
10
+ };
11
+ green: {
12
+ [key: string]: string;
13
+ };
14
+ red: {
15
+ [key: string]: string;
16
+ };
17
+ yellow: {
18
+ [key: string]: string;
19
+ };
20
+ orange: {
21
+ [key: string]: string;
22
+ };
23
+ blue: {
24
+ [key: string]: string;
25
+ };
26
+ purple: {
27
+ [key: string]: string;
28
+ };
29
+ pink: {
30
+ [key: string]: string;
31
+ };
32
+ brown: {
33
+ [key: string]: string;
34
+ };
35
+ teal: {
36
+ [key: string]: string;
37
+ };
38
+ cyan: {
39
+ [key: string]: string;
40
+ };
41
+ gray: {
42
+ [key: string]: string;
43
+ };
44
+ }
45
+ export declare class Convert {
46
+ static toColorPalette(json: string): ColorPalette;
47
+ static colorPaletteToJson(value: ColorPalette): string;
48
+ }
49
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,kBAAkB,CAAE,KAAK,EAAE,YAAY,GAAG,MAAM;CAGjE"}
@@ -0,0 +1,4 @@
1
+ import type { ColorPalette } from './colors';
2
+ declare const colors: ColorPalette;
3
+ export { colors, ColorPalette, };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/colors/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,QAAA,MAAM,MAAM,cAAoD,CAAA;AAEhE,OAAO,EACH,MAAM,EACN,YAAY,GACf,CAAA"}
@@ -0,0 +1,352 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["@open-condo/ui"] = factory();
8
+ else
9
+ root["@open-condo/ui"] = factory();
10
+ })(this, function() {
11
+ return /******/ (function() { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ // The require scope
14
+ /******/ var __webpack_require__ = {};
15
+ /******/
16
+ /************************************************************************/
17
+ /******/ /* webpack/runtime/define property getters */
18
+ /******/ !function() {
19
+ /******/ // define getter functions for harmony exports
20
+ /******/ __webpack_require__.d = function(exports, definition) {
21
+ /******/ for(var key in definition) {
22
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
23
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
24
+ /******/ }
25
+ /******/ }
26
+ /******/ };
27
+ /******/ }();
28
+ /******/
29
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
30
+ /******/ !function() {
31
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
32
+ /******/ }();
33
+ /******/
34
+ /******/ /* webpack/runtime/make namespace object */
35
+ /******/ !function() {
36
+ /******/ // define __esModule on exports
37
+ /******/ __webpack_require__.r = function(exports) {
38
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
39
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+ /******/ }
41
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
42
+ /******/ };
43
+ /******/ }();
44
+ /******/
45
+ /************************************************************************/
46
+ var __webpack_exports__ = {};
47
+ // ESM COMPAT FLAG
48
+ __webpack_require__.r(__webpack_exports__);
49
+
50
+ // EXPORTS
51
+ __webpack_require__.d(__webpack_exports__, {
52
+ "colors": function() { return /* binding */ colors; }
53
+ });
54
+
55
+ ;// CONCATENATED MODULE: ./src/colors/colors.json
56
+ var colors_namespaceObject = JSON.parse('{"white":"#fff","black":"#222222","brandGradient":{"1":"linear-gradient(90deg, #e2ffeb 0%, #e7f4ff 100%)","3":"linear-gradient(90deg, #85eba4 0%, #9fd5ff 100%)","5":"linear-gradient(90deg, #4cd174 0%, #6db8f2 100%)","7":"linear-gradient(90deg, #2abb56 0%, #3996dd 100%)"},"green":{"1":"#ebfaef","3":"#88e2a3","5":"#39ce66","7":"#00b538"},"red":{"1":"#ffeceb","3":"#ff938e","5":"#ff3b30","7":"#ec0000"},"yellow":{"1":"#fef8dd","3":"#fcea99","5":"#fadd56","7":"#e9c000"},"orange":{"1":"#fff5e6","3":"#ffbf66","5":"#ff9500","7":"#da7f00"},"blue":{"1":"#e7f4ff","3":"#7dc0f8","5":"#2696f3","7":"#0b78d2"},"purple":{"1":"#f2e9ff","3":"#9e7add","5":"#5e22c6","7":"#4b1c9e"},"pink":{"1":"#ffeef3","3":"#f38aa7","5":"#eb3468","7":"#d21f52"},"brown":{"1":"#f8f1e7","3":"#d2aa6e","5":"#b4710d","7":"#8d590c"},"teal":{"1":"#e9f3f2","3":"#6db8b3","5":"#1c7e79","7":"#135754"},"cyan":{"1":"#edfcf8","3":"#a0e5d2","5":"#5eceb0","7":"#249677"},"gray":{"1":"#f2f4f6","3":"#e1e5ed","5":"#d0d3e5","7":"#707695"}}');
57
+ ;// CONCATENATED MODULE: ./src/colors/colors.ts
58
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
59
+
60
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
61
+
62
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
63
+
64
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
65
+
66
+ /**
67
+ * This file was generated automatically
68
+ * Do not edit directly
69
+ */
70
+
71
+ /* eslint-disable no-empty */
72
+ // To parse this data:
73
+ //
74
+ // import { Convert, ColorPalette } from "./file";
75
+ //
76
+ // const colorPalette = Convert.toColorPalette(json);
77
+ //
78
+ // These functions will throw an error if the JSON doesn't
79
+ // match the expected interface, even if the JSON is valid.
80
+ // Converts JSON strings to/from your types
81
+ // and asserts the results of JSON.parse at runtime
82
+ var Convert = /*#__PURE__*/function () {
83
+ function Convert() {
84
+ _classCallCheck(this, Convert);
85
+ }
86
+
87
+ _createClass(Convert, null, [{
88
+ key: "toColorPalette",
89
+ value: function toColorPalette(json) {
90
+ return cast(JSON.parse(json), r('ColorPalette'));
91
+ }
92
+ }, {
93
+ key: "colorPaletteToJson",
94
+ value: function colorPaletteToJson(value) {
95
+ return JSON.stringify(uncast(value, r('ColorPalette')), null, 2);
96
+ }
97
+ }]);
98
+
99
+ return Convert;
100
+ }();
101
+
102
+ function invalidValue(typ, val) {
103
+ var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
104
+
105
+ if (key) {
106
+ throw Error("Invalid value for key \"".concat(key, "\". Expected type ").concat(JSON.stringify(typ), " but got ").concat(JSON.stringify(val)));
107
+ }
108
+
109
+ throw Error("Invalid value ".concat(JSON.stringify(val), " for type ").concat(JSON.stringify(typ)));
110
+ }
111
+
112
+ function jsonToJSProps(typ) {
113
+ if (typ.jsonToJS === undefined) {
114
+ var map = {};
115
+ typ.props.forEach(function (p) {
116
+ return map[p.json] = {
117
+ key: p.js,
118
+ typ: p.typ
119
+ };
120
+ });
121
+ typ.jsonToJS = map;
122
+ }
123
+
124
+ return typ.jsonToJS;
125
+ }
126
+
127
+ function jsToJSONProps(typ) {
128
+ if (typ.jsToJSON === undefined) {
129
+ var map = {};
130
+ typ.props.forEach(function (p) {
131
+ return map[p.js] = {
132
+ key: p.json,
133
+ typ: p.typ
134
+ };
135
+ });
136
+ typ.jsToJSON = map;
137
+ }
138
+
139
+ return typ.jsToJSON;
140
+ }
141
+
142
+ function transform(val, typ, getProps) {
143
+ var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
144
+
145
+ function transformPrimitive(typ, val) {
146
+ if (_typeof(typ) === _typeof(val)) return val;
147
+ return invalidValue(typ, val, key);
148
+ }
149
+
150
+ function transformUnion(typs, val) {
151
+ // val must validate against one typ in typs
152
+ var l = typs.length;
153
+
154
+ for (var i = 0; i < l; i++) {
155
+ var _typ = typs[i];
156
+
157
+ try {
158
+ return transform(val, _typ, getProps);
159
+ } catch (_) {}
160
+ }
161
+
162
+ return invalidValue(typs, val);
163
+ }
164
+
165
+ function transformEnum(cases, val) {
166
+ if (cases.indexOf(val) !== -1) return val;
167
+ return invalidValue(cases, val);
168
+ }
169
+
170
+ function transformArray(typ, val) {
171
+ // val must be an array with no invalid elements
172
+ if (!Array.isArray(val)) return invalidValue('array', val);
173
+ return val.map(function (el) {
174
+ return transform(el, typ, getProps);
175
+ });
176
+ }
177
+
178
+ function transformDate(val) {
179
+ if (val === null) {
180
+ return null;
181
+ }
182
+
183
+ var d = new Date(val);
184
+
185
+ if (isNaN(d.valueOf())) {
186
+ return invalidValue('Date', val);
187
+ }
188
+
189
+ return d;
190
+ }
191
+
192
+ function transformObject(props, additional, val) {
193
+ if (val === null || _typeof(val) !== 'object' || Array.isArray(val)) {
194
+ return invalidValue('object', val);
195
+ }
196
+
197
+ var result = {};
198
+ Object.getOwnPropertyNames(props).forEach(function (key) {
199
+ var prop = props[key];
200
+ var v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
201
+ result[prop.key] = transform(v, prop.typ, getProps, prop.key);
202
+ });
203
+ Object.getOwnPropertyNames(val).forEach(function (key) {
204
+ if (!Object.prototype.hasOwnProperty.call(props, key)) {
205
+ result[key] = transform(val[key], additional, getProps, key);
206
+ }
207
+ });
208
+ return result;
209
+ }
210
+
211
+ if (typ === 'any') return val;
212
+
213
+ if (typ === null) {
214
+ if (val === null) return val;
215
+ return invalidValue(typ, val);
216
+ }
217
+
218
+ if (typ === false) return invalidValue(typ, val);
219
+
220
+ while (_typeof(typ) === 'object' && typ.ref !== undefined) {
221
+ typ = typeMap[typ.ref];
222
+ }
223
+
224
+ if (Array.isArray(typ)) return transformEnum(typ, val);
225
+
226
+ if (_typeof(typ) === 'object') {
227
+ return typ.hasOwnProperty('unionMembers') ? transformUnion(typ.unionMembers, val) : typ.hasOwnProperty('arrayItems') ? transformArray(typ.arrayItems, val) : typ.hasOwnProperty('props') ? transformObject(getProps(typ), typ.additional, val) : invalidValue(typ, val);
228
+ } // Numbers can be parsed by Date but shouldn't be.
229
+
230
+
231
+ if (typ === Date && typeof val !== 'number') return transformDate(val);
232
+ return transformPrimitive(typ, val);
233
+ }
234
+
235
+ function cast(val, typ) {
236
+ return transform(val, typ, jsonToJSProps);
237
+ }
238
+
239
+ function uncast(val, typ) {
240
+ return transform(val, typ, jsToJSONProps);
241
+ } // eslint-disable-next-line @typescript-eslint/ban-ts-comment
242
+ // @ts-ignore
243
+
244
+
245
+ function a(typ) {
246
+ return {
247
+ arrayItems: typ
248
+ };
249
+ } // eslint-disable-next-line @typescript-eslint/ban-ts-comment
250
+ // @ts-ignore
251
+
252
+
253
+ function u() {
254
+ for (var _len = arguments.length, typs = new Array(_len), _key = 0; _key < _len; _key++) {
255
+ typs[_key] = arguments[_key];
256
+ }
257
+
258
+ return {
259
+ unionMembers: typs
260
+ };
261
+ }
262
+
263
+ function o(props, additional) {
264
+ return {
265
+ props: props,
266
+ additional: additional
267
+ };
268
+ } // eslint-disable-next-line @typescript-eslint/ban-ts-comment
269
+ // @ts-ignore
270
+
271
+
272
+ function m(additional) {
273
+ return {
274
+ props: [],
275
+ additional: additional
276
+ };
277
+ }
278
+
279
+ function r(name) {
280
+ return {
281
+ ref: name
282
+ };
283
+ }
284
+
285
+ var typeMap = {
286
+ 'ColorPalette': o([{
287
+ json: 'white',
288
+ js: 'white',
289
+ typ: ''
290
+ }, {
291
+ json: 'black',
292
+ js: 'black',
293
+ typ: ''
294
+ }, {
295
+ json: 'brandGradient',
296
+ js: 'brandGradient',
297
+ typ: m('')
298
+ }, {
299
+ json: 'green',
300
+ js: 'green',
301
+ typ: m('')
302
+ }, {
303
+ json: 'red',
304
+ js: 'red',
305
+ typ: m('')
306
+ }, {
307
+ json: 'yellow',
308
+ js: 'yellow',
309
+ typ: m('')
310
+ }, {
311
+ json: 'orange',
312
+ js: 'orange',
313
+ typ: m('')
314
+ }, {
315
+ json: 'blue',
316
+ js: 'blue',
317
+ typ: m('')
318
+ }, {
319
+ json: 'purple',
320
+ js: 'purple',
321
+ typ: m('')
322
+ }, {
323
+ json: 'pink',
324
+ js: 'pink',
325
+ typ: m('')
326
+ }, {
327
+ json: 'brown',
328
+ js: 'brown',
329
+ typ: m('')
330
+ }, {
331
+ json: 'teal',
332
+ js: 'teal',
333
+ typ: m('')
334
+ }, {
335
+ json: 'cyan',
336
+ js: 'cyan',
337
+ typ: m('')
338
+ }, {
339
+ json: 'gray',
340
+ js: 'gray',
341
+ typ: m('')
342
+ }], false)
343
+ };
344
+ ;// CONCATENATED MODULE: ./src/colors/index.ts
345
+
346
+
347
+ var colors = Convert.toColorPalette(JSON.stringify(colors_namespaceObject));
348
+
349
+ /******/ return __webpack_exports__;
350
+ /******/ })()
351
+ ;
352
+ });
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ButtonProps as DefaultButtonProps } from 'antd';
3
+ declare type CondoButtonProps = {
4
+ type: 'primary' | 'secondary';
5
+ children?: string;
6
+ };
7
+ export declare type ButtonProps = Omit<DefaultButtonProps, 'shape' | 'size' | 'style' | 'ghost' | 'type' | 'prefix' | 'prefixCls'> & CondoButtonProps;
8
+ declare const Button: React.ForwardRefExoticComponent<Omit<Partial<{
9
+ href: string;
10
+ target?: string | undefined;
11
+ onClick?: React.MouseEventHandler<HTMLElement> | undefined;
12
+ } & import("antd/lib/button/button").BaseButtonProps & Omit<React.AnchorHTMLAttributes<any>, "type" | "onClick"> & {
13
+ htmlType?: "button" | "submit" | "reset" | undefined;
14
+ onClick?: React.MouseEventHandler<HTMLElement> | undefined;
15
+ } & Omit<React.ButtonHTMLAttributes<any>, "type" | "onClick">>, "type" | "style" | "prefix" | "shape" | "size" | "ghost" | "prefixCls"> & CondoButtonProps & React.RefAttributes<HTMLButtonElement>>;
16
+ export { Button, };
17
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAEH,WAAW,IAAI,kBAAkB,EACpC,MAAM,MAAM,CAAA;AAKb,aAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,SAAS,GAAG,WAAW,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,oBAAY,WAAW,GAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC,GACxH,gBAAgB,CAAA;AAElB,QAAA,MAAM,MAAM;;;;;;;oMA0BV,CAAA;AAIF,OAAO,EACH,MAAM,GACT,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { Button } from './button';
2
+ import './style.less';
3
+ export type { ButtonProps } from './button';
4
+ export { Button, };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,cAAc,CAAA;AAErB,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EACH,MAAM,GACT,CAAA"}
@@ -0,0 +1,4 @@
1
+ import '@open-condo/ui/src/components/style/core/global.less';
2
+ export { Button } from './components/Button';
3
+ export type { ButtonProps } from './components/Button';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sDAAsD,CAAA;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA"}