@raketa-builder/ui 0.4.0 → 0.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.
package/dist/index.js CHANGED
@@ -173,11 +173,11 @@ var P_default = P;
173
173
  var import_react3 = __toESM(require("react"));
174
174
  var import_jsx_runtime3 = require("react/jsx-runtime");
175
175
  var Button = (_a) => {
176
- var _b = _a, { type, size, variant, className } = _b, props = __objRest(_b, ["type", "size", "variant", "className"]);
176
+ var _b = _a, { as = "button", size, variant, className } = _b, rest = __objRest(_b, ["as", "size", "variant", "className"]);
177
+ const Component = as;
177
178
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
178
- "button",
179
+ Component,
179
180
  __spreadValues({
180
- type,
181
181
  className: cn(
182
182
  "r-reset",
183
183
  "r-reset-button",
@@ -186,7 +186,7 @@ var Button = (_a) => {
186
186
  `r-button-${variant}`,
187
187
  className
188
188
  )
189
- }, props)
189
+ }, rest)
190
190
  );
191
191
  };
192
192
  Button.defaultProps = {
@@ -243,8 +243,8 @@ var Tabs_default = Tabs;
243
243
  var import_react5 = __toESM(require("react"));
244
244
  var import_jsx_runtime5 = require("react/jsx-runtime");
245
245
  var Input = (_a) => {
246
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
247
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", __spreadValues({ className: cn("r-reset", "r-input", className) }, props));
246
+ var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
247
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", __spreadValues({ className: cn("r-reset", "r-input", className) }, rest));
248
248
  };
249
249
  var Input_default = Input;
250
250
 
@@ -441,11 +441,28 @@ var CloseButton = (_a) => {
441
441
  }, props)
442
442
  );
443
443
  };
444
+ var FooterBar = (_a) => {
445
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
446
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues({ className: cn("r-reset", "r-modal-footer-bar", className) }, props));
447
+ };
444
448
  var Content = (_a) => {
445
449
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
446
450
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues({ className: cn("r-reset", "r-modal-content", className) }, props));
447
451
  };
448
- var Modal = ({ title, children, onClose }) => {
452
+ var Modal = (_a) => {
453
+ var _b = _a, {
454
+ title,
455
+ children,
456
+ customWrapper,
457
+ FooterContent,
458
+ onClose
459
+ } = _b, rest = __objRest(_b, [
460
+ "title",
461
+ "children",
462
+ "customWrapper",
463
+ "FooterContent",
464
+ "onClose"
465
+ ]);
449
466
  const handleKeyUp = ({ key }) => {
450
467
  if (key === "Escape")
451
468
  onClose();
@@ -456,15 +473,17 @@ var Modal = ({ title, children, onClose }) => {
456
473
  document.removeEventListener("keyup", handleKeyUp);
457
474
  };
458
475
  });
476
+ const ModalWrapper = customWrapper ? customWrapper : Wrapper;
459
477
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react17.default.Fragment, { children: [
460
478
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, { onClick: onClose }),
461
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Inner, { children: [
479
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModalWrapper, __spreadProps(__spreadValues({}, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Inner, { children: [
462
480
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TitleBar, { children: [
463
481
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Title, { children: title }),
464
482
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseButton, { type: "button", onClick: onClose, children: "\xD7" })
465
483
  ] }),
466
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children })
467
- ] }) })
484
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children }),
485
+ FooterContent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterBar, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterContent, {}) })
486
+ ] }) }))
468
487
  ] });
469
488
  };
470
489
  var Modal_default = Modal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/ui",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
package/src/Button.jsx CHANGED
@@ -1,20 +1,23 @@
1
1
  import React from "react";
2
2
  import cn from "./cn";
3
3
 
4
- const Button = ({ type, size, variant, className, ...props }) => (
5
- <button
6
- type={type}
7
- className={cn(
8
- "r-reset",
9
- "r-reset-button",
10
- "r-button",
11
- `r-button-${size}`,
12
- `r-button-${variant}`,
13
- className
14
- )}
15
- {...props}
16
- />
17
- );
4
+ const Button = ({ as = "button", size, variant, className, ...rest }) => {
5
+ const Component = as;
6
+
7
+ return (
8
+ <Component
9
+ className={cn(
10
+ "r-reset",
11
+ "r-reset-button",
12
+ "r-button",
13
+ `r-button-${size}`,
14
+ `r-button-${variant}`,
15
+ className
16
+ )}
17
+ {...rest}
18
+ />
19
+ );
20
+ };
18
21
 
19
22
  Button.defaultProps = {
20
23
  type: "button",
package/src/Input.jsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import cn from "./cn";
3
3
 
4
- const Input = ({ className, ...props }) => (
5
- <input className={cn("r-reset", "r-input", className)} {...props} />
4
+ const Input = ({ className, ...rest }) => (
5
+ <input className={cn("r-reset", "r-input", className)} {...rest} />
6
6
  );
7
7
 
8
8
  export default Input;
package/src/Modal.jsx CHANGED
@@ -28,11 +28,22 @@ const CloseButton = ({ className, ...props }) => (
28
28
  />
29
29
  );
30
30
 
31
+ const FooterBar = ({ className, ...props }) => (
32
+ <div className={cn("r-reset", "r-modal-footer-bar", className)} {...props} />
33
+ );
34
+
31
35
  const Content = ({ className, ...props }) => (
32
36
  <div className={cn("r-reset", "r-modal-content", className)} {...props} />
33
37
  );
34
38
 
35
- const Modal = ({ title, children, onClose }) => {
39
+ const Modal = ({
40
+ title,
41
+ children,
42
+ customWrapper,
43
+ FooterContent,
44
+ onClose,
45
+ ...rest
46
+ }) => {
36
47
  const handleKeyUp = ({ key }) => {
37
48
  if (key === "Escape") onClose();
38
49
  };
@@ -45,11 +56,13 @@ const Modal = ({ title, children, onClose }) => {
45
56
  };
46
57
  });
47
58
 
59
+ const ModalWrapper = customWrapper ? customWrapper : Wrapper;
60
+
48
61
  return (
49
62
  <React.Fragment>
50
63
  <Overlay onClick={onClose} />
51
64
 
52
- <Wrapper>
65
+ <ModalWrapper {...rest}>
53
66
  <Inner>
54
67
  <TitleBar>
55
68
  <Title>{title}</Title>
@@ -59,8 +72,14 @@ const Modal = ({ title, children, onClose }) => {
59
72
  </TitleBar>
60
73
 
61
74
  <Content>{children}</Content>
75
+
76
+ {FooterContent && (
77
+ <FooterBar>
78
+ <FooterContent />
79
+ </FooterBar>
80
+ )}
62
81
  </Inner>
63
- </Wrapper>
82
+ </ModalWrapper>
64
83
  </React.Fragment>
65
84
  );
66
85
  };
package/src/styles.css CHANGED
@@ -234,6 +234,7 @@
234
234
  width: 100%;
235
235
  height: 100%;
236
236
  }
237
+
237
238
  .r-navigation-item:hover {
238
239
  background-color: var(--r-darker-gray);
239
240
  }
@@ -254,9 +255,11 @@
254
255
  .r-panel .sortable-selected {
255
256
  background-color: var(--r-dark-green);
256
257
  }
258
+
257
259
  .r-panel-content {
258
260
  padding: 1em;
259
261
  }
262
+
260
263
  .r-panel-title {
261
264
  display: flex;
262
265
  justify-content: space-between;
@@ -286,6 +289,43 @@
286
289
  border-color: var(--r-primary);
287
290
  }
288
291
 
292
+ input.r-input[type="radio"] {
293
+ appearance: none;
294
+ width: 1rem;
295
+ height: 1rem;
296
+ padding: 0;
297
+ margin: 0;
298
+ border: 2px solid var(--r-black);
299
+ background-color: transparent;
300
+ outline: none;
301
+ border-radius: 50%;
302
+ transition: all 0.2s ease-in-out;
303
+ cursor: pointer;
304
+ }
305
+
306
+ input.r-input[type="radio"]:focus {
307
+ border: 2px solid var(--r-primary);
308
+ }
309
+
310
+ input.r-input[type="radio"]:checked {
311
+ position: relative;
312
+ border: 2px solid var(--r-primary);
313
+ color: var(--r-primary);
314
+ background: transparent;
315
+ }
316
+
317
+ input.r-input[type="radio"]:checked:after {
318
+ content: "";
319
+ position: absolute;
320
+ left: 50%;
321
+ top: 50%;
322
+ transform: translate(-50%, -50%);
323
+ width: 0.5rem;
324
+ height: 0.5rem;
325
+ border-radius: 50%;
326
+ background: var(--r-primary);
327
+ }
328
+
289
329
  .r-select {
290
330
  background-size: 16px;
291
331
  background-repeat: no-repeat;
@@ -387,7 +427,7 @@
387
427
 
388
428
  .r-stack {
389
429
  display: flex;
390
- gap: 1rem;
430
+ gap: 0.5rem;
391
431
  }
392
432
 
393
433
  .r-stack-justify-beteen {
@@ -502,6 +542,7 @@
502
542
  opacity: 0;
503
543
  transition: all ease-in-out 0.3s;
504
544
  }
545
+
505
546
  .r-language-item {
506
547
  display: flex;
507
548
  justify-content: center;
@@ -511,9 +552,11 @@
511
552
  background-color: var(--r-true-black);
512
553
  text-transform: uppercase;
513
554
  }
555
+
514
556
  .r-language-item a:hover {
515
557
  background-color: var(--r-primaryRGB06);
516
558
  }
559
+
517
560
  .r-language-item a {
518
561
  color: var(--r-true-white);
519
562
  font-weight: 500;
@@ -539,6 +582,7 @@
539
582
  font-weight: 700;
540
583
  text-decoration: none;
541
584
  }
585
+
542
586
  .r-language-new-item a:hover {
543
587
  background-color: var(--r-primaryRGB06);
544
588
  }
@@ -554,6 +598,7 @@
554
598
  font-weight: 500;
555
599
  text-decoration: none;
556
600
  }
601
+
557
602
  .r-language-current-item {
558
603
  position: relative;
559
604
  z-index: 100;
@@ -582,6 +627,7 @@
582
627
  align-items: center;
583
628
  pointer-events: none;
584
629
  }
630
+
585
631
  .r-modal-overlay {
586
632
  position: fixed;
587
633
  top: 0;
@@ -592,6 +638,7 @@
592
638
  background-color: rgba(0, 0, 0, 0.6);
593
639
  cursor: pointer;
594
640
  }
641
+
595
642
  .r-modal-inner {
596
643
  width: 80%;
597
644
  border-radius: 5px;
@@ -599,13 +646,16 @@
599
646
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
600
647
  pointer-events: all;
601
648
  }
649
+
602
650
  .r-modal-content {
603
651
  padding: 0.5em 1em 1em 1em;
604
652
  }
653
+
605
654
  .r-modal-title {
606
655
  font-size: 1.25em;
607
656
  font-weight: 500;
608
657
  }
658
+
609
659
  .r-modal-title-bar {
610
660
  display: flex;
611
661
  justify-content: space-between;
@@ -613,6 +663,16 @@
613
663
  padding: 1em;
614
664
  border-bottom: 2px solid var(--r-light-gray);
615
665
  }
666
+
667
+ .r-modal-footer-bar {
668
+ display: flex;
669
+ justify-content: flex-start;
670
+ align-items: center;
671
+ gap: 0.25rem;
672
+ padding: 1em;
673
+ border-top: 2px solid var(--r-light-gray);
674
+ }
675
+
616
676
  .r-modal-close-btn {
617
677
  position: relative;
618
678
  right: -4px;
@@ -640,17 +700,20 @@
640
700
  font-weight: 500;
641
701
  text-align: center;
642
702
  }
703
+
643
704
  .r-pagination a {
644
- color: var(--r-primary);
645
705
  border: 1px solid var(--r-light-gray);
646
706
  border-radius: 4px;
707
+ color: var(--r-primary);
647
708
  transition: all 0.2s ease-in-out;
648
709
  }
710
+
649
711
  .r-pagination a:hover {
650
712
  border-color: var(--r-primary);
651
713
  background-color: var(--r-primary);
652
714
  color: var(--r-white);
653
715
  }
716
+
654
717
  .r-pagination {
655
718
  display: flex;
656
719
  justify-content: center;
@@ -658,6 +721,20 @@
658
721
  gap: 0.25em;
659
722
  padding: 1em 0 1em 0;
660
723
  }
724
+
725
+ /* Spacings */
726
+ .r-spacing-top-sm {
727
+ padding-top: 1rem;
728
+ }
729
+
730
+ .r-spacing-bottom-sm {
731
+ padding-bottom: 1rem;
732
+ }
733
+
734
+ .r-spacing-both-sm {
735
+ padding-top: 1rem;
736
+ padding-bottom: 1rem;
737
+ }
661
738
  }
662
739
 
663
740
  :root {