@semcore/notice 5.47.0-prerelease.0 → 5.47.1-prerelease.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.
@@ -1,184 +1,218 @@
1
- import g from "@babel/runtime/helpers/esm/objectSpread2";
2
- import L from "@babel/runtime/helpers/esm/classCallCheck";
3
- import A from "@babel/runtime/helpers/esm/createClass";
4
- import z from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import D from "@babel/runtime/helpers/esm/inherits";
6
- import M from "@babel/runtime/helpers/esm/createSuper";
7
- import m from "@babel/runtime/helpers/esm/defineProperty";
8
- import { sstyled as R } from "@semcore/utils/lib/core/index";
9
- import $, { sstyled as l, assignProps as s, Component as B } from "@semcore/core";
10
- import a from "react";
11
- import { Box as v } from "@semcore/flex-box";
12
- import G from "@semcore/button";
13
- import b from "@semcore/icon/Close/m";
14
- import O from "@semcore/utils/lib/enhances/resolveColorEnhance";
15
- import { FadeInOut as V } from "@semcore/animation";
16
- import d from "@semcore/utils/lib/logger";
17
- import j from "@semcore/notice-global";
18
- import { localizedMessages as S } from "./translations/__intergalactic-dynamic-locales.mjs";
19
- import q from "@semcore/utils/lib/enhances/i18nEnhance";
20
- import { cssVariableEnhance as F } from "@semcore/utils/lib/useCssVariable";
21
- import { Text as y } from "@semcore/typography";
22
- var W = (
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
+ import { sstyled } from "@semcore/utils/lib/core/index";
9
+ import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
10
+ import React from "react";
11
+ import { Box } from "@semcore/flex-box";
12
+ import Button from "@semcore/button";
13
+ import CloseIconM from "@semcore/icon/Close/m";
14
+ import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
15
+ import { FadeInOut } from "@semcore/animation";
16
+ import logger from "@semcore/utils/lib/logger";
17
+ import NoticeGlobal from "@semcore/notice-global";
18
+ import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
19
+ import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
20
+ import { cssVariableEnhance } from "@semcore/utils/lib/useCssVariable";
21
+ import { Text } from "@semcore/typography";
22
+ /*!__reshadow-styles__:"./style/notice.shadow.css"*/
23
+ var style = (
23
24
  /*__reshadow_css_start__*/
24
- (R.insert(
25
+ (sstyled.insert(
25
26
  /*__inner_css_start__*/
26
- ".___SNotice_inpr4_gg_{display:flex;padding:var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);box-sizing:border-box;border-style:solid;border-width:1px;border-radius:var(--intergalactic-surface-rounded, 6px);color:var(--intergalactic-text-primary, #191b23)}.___SNotice_inpr4_gg_._theme_info_inpr4_gg_{background-color:var(--intergalactic-bg-secondary-info, #e9f7ff);border-color:var(--intergalactic-border-info, #8ecdff)}.___SNotice_inpr4_gg_._theme_info_inpr4_gg_ .___SCloseIcon_inpr4_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_inpr4_gg_._theme_info_inpr4_gg_ .___SCloseIcon_inpr4_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SNotice_inpr4_gg_._theme_danger_inpr4_gg_{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7);border-color:var(--intergalactic-border-critical, #ffaeb5)}.___SNotice_inpr4_gg_._theme_danger_inpr4_gg_ .___SCloseIcon_inpr4_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}@media (hover:hover){.___SNotice_inpr4_gg_._theme_danger_inpr4_gg_ .___SCloseIcon_inpr4_gg_:hover{color:var(--intergalactic-icon-primary-critical-hover-active, #CC3A42)}}.___SNotice_inpr4_gg_._theme_warning_inpr4_gg_{background-color:var(--intergalactic-bg-secondary-warning, #fff3d9);border-color:var(--intergalactic-border-warning, #ffb26e)}.___SNotice_inpr4_gg_._theme_warning_inpr4_gg_ .___SCloseIcon_inpr4_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}@media (hover:hover){.___SNotice_inpr4_gg_._theme_warning_inpr4_gg_ .___SCloseIcon_inpr4_gg_:hover{color:var(--intergalactic-icon-primary-warning-hover-active, #CC5024)}}.___SNotice_inpr4_gg_._theme_success_inpr4_gg_{background-color:var(--intergalactic-bg-secondary-success, #dbfee8);border-color:var(--intergalactic-border-success, #59ddaa)}.___SNotice_inpr4_gg_._theme_success_inpr4_gg_ .___SCloseIcon_inpr4_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}@media (hover:hover){.___SNotice_inpr4_gg_._theme_success_inpr4_gg_ .___SCloseIcon_inpr4_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, #037E68)}}.___SNotice_inpr4_gg_._theme_muted_inpr4_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);border-color:var(--intergalactic-border-secondary, #e0e1e9)}.___SLabel_inpr4_gg_._theme_info_inpr4_gg_,.___SNotice_inpr4_gg_._theme_muted_inpr4_gg_ .___SCloseIcon_inpr4_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_inpr4_gg_._theme_muted_inpr4_gg_ .___SCloseIcon_inpr4_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SContent_inpr4_gg_{flex:1 1 auto;width:100%}.___SActions_inpr4_gg_{flex-shrink:0;margin-top:var(--intergalactic-spacing-3x, 12px)}.___SLabel_inpr4_gg_{min-height:var(--intergalactic-form-control-m, 28px);height:-moz-fit-content;height:fit-content;margin-right:var(--intergalactic-spacing-2x, 8px);display:inline-flex;align-items:center}.___SLabel_inpr4_gg_._theme_danger_inpr4_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}.___SLabel_inpr4_gg_._theme_warning_inpr4_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}.___SLabel_inpr4_gg_._theme_success_inpr4_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}.___SLabel_inpr4_gg_._theme_muted_inpr4_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SLabel_inpr4_gg_._theme_custom_inpr4_gg_{color:var(--color_inpr4)}.___SCloseIcon_inpr4_gg_{flex-shrink:0;margin-left:var(--intergalactic-spacing-4x, 16px)}.___SNotice_inpr4_gg_._theme_custom_inpr4_gg_{background-color:var(--backgroundColor_inpr4);border-color:var(--backgroundColor_inpr4)}.___STitle_inpr4_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}.___SText_inpr4_gg_{margin-top:var(--intergalactic-spacing-1x, 4px);margin-bottom:var(--intergalactic-spacing-1x, 4px)}",
27
- "inpr4_gg_"
28
- ), {
29
- __SNotice: "___SNotice_inpr4_gg_",
30
- __SContent: "___SContent_inpr4_gg_",
31
- __SActions: "___SActions_inpr4_gg_",
32
- __SLabel: "___SLabel_inpr4_gg_",
33
- _theme_info: "_theme_info_inpr4_gg_",
34
- _theme_danger: "_theme_danger_inpr4_gg_",
35
- _theme_warning: "_theme_warning_inpr4_gg_",
36
- _theme_success: "_theme_success_inpr4_gg_",
37
- _theme_muted: "_theme_muted_inpr4_gg_",
38
- _theme_custom: "_theme_custom_inpr4_gg_",
39
- "--color": "--color_inpr4",
40
- __SCloseIcon: "___SCloseIcon_inpr4_gg_",
41
- "--backgroundColor": "--backgroundColor_inpr4",
42
- __STitle: "___STitle_inpr4_gg_",
43
- __SText: "___SText_inpr4_gg_"
27
+ ".___SNotice_oj424_gg_{display:flex;padding:var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);box-sizing:border-box;border-style:solid;border-width:1px;border-radius:var(--intergalactic-surface-rounded, 6px);color:var(--intergalactic-text-primary, #191b23)}.___SNotice_oj424_gg_._theme_info_oj424_gg_{background-color:var(--intergalactic-bg-secondary-info, #e9f7ff);border-color:var(--intergalactic-border-info, #8ecdff)}.___SNotice_oj424_gg_._theme_info_oj424_gg_ .___SCloseIcon_oj424_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_oj424_gg_._theme_info_oj424_gg_ .___SCloseIcon_oj424_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SNotice_oj424_gg_._theme_danger_oj424_gg_{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7);border-color:var(--intergalactic-border-critical, #ffaeb5)}.___SNotice_oj424_gg_._theme_danger_oj424_gg_ .___SCloseIcon_oj424_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}@media (hover:hover){.___SNotice_oj424_gg_._theme_danger_oj424_gg_ .___SCloseIcon_oj424_gg_:hover{color:var(--intergalactic-icon-primary-critical-hover-active, #CC3A42)}}.___SNotice_oj424_gg_._theme_warning_oj424_gg_{background-color:var(--intergalactic-bg-secondary-warning, #fff3d9);border-color:var(--intergalactic-border-warning, #ffb26e)}.___SNotice_oj424_gg_._theme_warning_oj424_gg_ .___SCloseIcon_oj424_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}@media (hover:hover){.___SNotice_oj424_gg_._theme_warning_oj424_gg_ .___SCloseIcon_oj424_gg_:hover{color:var(--intergalactic-icon-primary-warning-hover-active, #CC5024)}}.___SNotice_oj424_gg_._theme_success_oj424_gg_{background-color:var(--intergalactic-bg-secondary-success, #dbfee8);border-color:var(--intergalactic-border-success, #59ddaa)}.___SNotice_oj424_gg_._theme_success_oj424_gg_ .___SCloseIcon_oj424_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}@media (hover:hover){.___SNotice_oj424_gg_._theme_success_oj424_gg_ .___SCloseIcon_oj424_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, #037E68)}}.___SNotice_oj424_gg_._theme_muted_oj424_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);border-color:var(--intergalactic-border-secondary, #e0e1e9)}.___SLabel_oj424_gg_._theme_info_oj424_gg_,.___SNotice_oj424_gg_._theme_muted_oj424_gg_ .___SCloseIcon_oj424_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_oj424_gg_._theme_muted_oj424_gg_ .___SCloseIcon_oj424_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SContent_oj424_gg_{flex:1 1 auto;width:100%}.___SActions_oj424_gg_{flex-shrink:0;margin-top:var(--intergalactic-spacing-3x, 12px)}.___SLabel_oj424_gg_{min-height:var(--intergalactic-form-control-m, 28px);height:-moz-fit-content;height:fit-content;margin-right:var(--intergalactic-spacing-2x, 8px);display:inline-flex;align-items:center}.___SLabel_oj424_gg_._theme_danger_oj424_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}.___SLabel_oj424_gg_._theme_warning_oj424_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}.___SLabel_oj424_gg_._theme_success_oj424_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}.___SLabel_oj424_gg_._theme_muted_oj424_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SLabel_oj424_gg_._theme_custom_oj424_gg_{color:var(--color_oj424)}.___SCloseIcon_oj424_gg_{flex-shrink:0;margin-left:var(--intergalactic-spacing-4x, 16px)}.___SNotice_oj424_gg_._theme_custom_oj424_gg_{background-color:var(--backgroundColor_oj424);border-color:var(--backgroundColor_oj424)}.___STitle_oj424_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}.___SText_oj424_gg_{margin-top:var(--intergalactic-spacing-1x, 4px);margin-bottom:var(--intergalactic-spacing-1x, 4px)}",
28
+ /*__inner_css_end__*/
29
+ "oj424_gg_"
30
+ ), /*__reshadow_css_end__*/
31
+ {
32
+ "__SNotice": "___SNotice_oj424_gg_",
33
+ "__SContent": "___SContent_oj424_gg_",
34
+ "__SActions": "___SActions_oj424_gg_",
35
+ "__SLabel": "___SLabel_oj424_gg_",
36
+ "_theme_info": "_theme_info_oj424_gg_",
37
+ "_theme_danger": "_theme_danger_oj424_gg_",
38
+ "_theme_warning": "_theme_warning_oj424_gg_",
39
+ "_theme_success": "_theme_success_oj424_gg_",
40
+ "_theme_muted": "_theme_muted_oj424_gg_",
41
+ "_theme_custom": "_theme_custom_oj424_gg_",
42
+ "--color": "--color_oj424",
43
+ "__SCloseIcon": "___SCloseIcon_oj424_gg_",
44
+ "--backgroundColor": "--backgroundColor_oj424",
45
+ "__STitle": "___STitle_oj424_gg_",
46
+ "__SText": "___SText_oj424_gg_"
44
47
  })
45
48
  );
46
- function C(_) {
47
- return !["danger", "warning", "success", "info", "muted"].includes(_);
49
+ function isCustomTheme(theme) {
50
+ return !["danger", "warning", "success", "info", "muted"].includes(theme);
48
51
  }
49
- var u = /* @__PURE__ */ function(_) {
50
- D(r, _);
51
- var i = M(r);
52
- function r() {
53
- var t;
54
- L(this, r);
55
- for (var e = arguments.length, n = new Array(e), o = 0; o < e; o++)
56
- n[o] = arguments[o];
57
- return t = i.call.apply(i, [this].concat(n)), m(z(t), "ref", /* @__PURE__ */ a.createRef()), t;
52
+ var RootNotice = /* @__PURE__ */ function(_Component) {
53
+ _inherits(RootNotice2, _Component);
54
+ var _super = _createSuper(RootNotice2);
55
+ function RootNotice2() {
56
+ var _this;
57
+ _classCallCheck(this, RootNotice2);
58
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
59
+ args[_key] = arguments[_key];
60
+ }
61
+ _this = _super.call.apply(_super, [this].concat(args));
62
+ _defineProperty(_assertThisInitialized(_this), "ref", /* @__PURE__ */ React.createRef());
63
+ return _this;
58
64
  }
59
- return A(r, [{
65
+ _createClass(RootNotice2, [{
60
66
  key: "componentDidMount",
61
- value: function() {
67
+ value: function componentDidMount() {
62
68
  if (this.ref.current && process.env.NODE_ENV !== "production" && !["muted", "danger"].includes(this.props.theme)) {
63
- var e = function(o) {
64
- return !!(o.hasAttribute("aria-label") || o.hasAttribute("aria-labelledby") || o.hasAttribute("title"));
69
+ var hasTitle = function hasTitle2(node) {
70
+ if (node.hasAttribute("aria-label")) return true;
71
+ if (node.hasAttribute("aria-labelledby")) return true;
72
+ if (node.hasAttribute("title")) return true;
73
+ return false;
65
74
  };
66
- d.warn(!e(this.ref.current), "Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification", this.props["data-ui-name"] || r.displayName);
75
+ logger.warn(!hasTitle(this.ref.current), "Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification", this.props["data-ui-name"] || RootNotice2.displayName);
67
76
  }
68
77
  }
69
78
  }, {
70
79
  key: "getLabelProps",
71
- value: function() {
72
- var e = this.asProps, n = e.theme, o = e.resolveColor;
80
+ value: function getLabelProps() {
81
+ var _this$asProps = this.asProps, theme = _this$asProps.theme, resolveColor = _this$asProps.resolveColor;
73
82
  return {
74
- theme: n,
75
- resolveColor: o
83
+ theme,
84
+ resolveColor
76
85
  };
77
86
  }
78
87
  }, {
79
88
  key: "getCloseIconProps",
80
- value: function() {
81
- var e = this.asProps.getI18nText;
89
+ value: function getCloseIconProps() {
90
+ var getI18nText = this.asProps.getI18nText;
82
91
  return {
83
- getI18nText: e
92
+ getI18nText
84
93
  };
85
94
  }
86
95
  }, {
87
96
  key: "getCloseProps",
88
- value: function() {
89
- var e = this.asProps.getI18nText;
97
+ value: function getCloseProps() {
98
+ var getI18nText = this.asProps.getI18nText;
90
99
  return {
91
- getI18nText: e
100
+ getI18nText
92
101
  };
93
102
  }
94
103
  }, {
95
104
  key: "render",
96
- value: function() {
97
- var e = this.asProps, n, o = V, c = this.asProps, f = c.Children, x = c.styles, N = c.hidden, p = c.theme, I = c.use, T = c.resolveColor, P = c.getI18nText, k = T(p), w = C(p) ? "custom" : p;
98
- if (I === "primary")
99
- return d.warn(!0, 'Deprecated property-value pair "use=primary", use component <NoticeGlobal/> instead', r.displayName), /* @__PURE__ */ a.createElement(j, this.asProps);
100
- var h = P(p === "danger" ? "criticalNotification" : "notification");
101
- p === "muted" && (h = void 0);
102
- var E = p === "muted" ? void 0 : "region";
103
- return n = l(x), /* @__PURE__ */ a.createElement(o, n.cn("SNotice", g({}, s({
104
- visible: !N,
105
- "use:theme": w,
106
- backgroundColor: k,
107
- role: E,
108
- "aria-label": h,
109
- ref: this.ref
110
- }, e))), /* @__PURE__ */ a.createElement(f, n.cn("Children", {})));
105
+ value: function render() {
106
+ var _ref = this.asProps, _ref9;
107
+ var SNotice = FadeInOut;
108
+ var _this$asProps2 = this.asProps, Children = _this$asProps2.Children, styles = _this$asProps2.styles, hidden = _this$asProps2.hidden, theme = _this$asProps2.theme, use = _this$asProps2.use, resolveColor = _this$asProps2.resolveColor, getI18nText = _this$asProps2.getI18nText;
109
+ var color = resolveColor(theme);
110
+ var useTheme = isCustomTheme(theme) ? "custom" : theme;
111
+ if (use === "primary") {
112
+ logger.warn(true, 'Deprecated property-value pair "use=primary", use component <NoticeGlobal/> instead', RootNotice2.displayName);
113
+ return /* @__PURE__ */ React.createElement(NoticeGlobal, this.asProps);
114
+ }
115
+ var ariaLabel = getI18nText(theme === "danger" ? "criticalNotification" : "notification");
116
+ if (theme === "muted") {
117
+ ariaLabel = void 0;
118
+ }
119
+ var role = theme === "muted" ? void 0 : "region";
120
+ return _ref9 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SNotice, _ref9.cn("SNotice", _objectSpread({}, assignProps({
121
+ "visible": !hidden,
122
+ "use:theme": useTheme,
123
+ "backgroundColor": color,
124
+ "role": role,
125
+ "aria-label": ariaLabel,
126
+ "ref": this.ref
127
+ }, _ref))), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
111
128
  }
112
- }]), r;
113
- }(B);
114
- m(u, "displayName", "Notice");
115
- m(u, "style", W);
116
- m(u, "enhance", [q(S), F({
129
+ }]);
130
+ return RootNotice2;
131
+ }(Component);
132
+ _defineProperty(RootNotice, "displayName", "Notice");
133
+ _defineProperty(RootNotice, "style", style);
134
+ _defineProperty(RootNotice, "enhance", [i18nEnhance(localizedMessages), cssVariableEnhance({
117
135
  variable: "--intergalactic-duration-popper",
118
136
  fallback: "200",
119
137
  map: Number.parseInt,
120
138
  prop: "duration"
121
- }), O()]);
122
- m(u, "defaultProps", {
139
+ }), resolveColorEnhance()]);
140
+ _defineProperty(RootNotice, "defaultProps", {
123
141
  theme: "info",
124
- i18n: S,
142
+ i18n: localizedMessages,
125
143
  locale: "en"
126
144
  });
127
- function H(_) {
128
- var i = arguments[0], r, t = _.styles, e = _.theme, n = _.resolveColor, o = v, c = C(e) ? "custom" : e, f = n(e);
129
- return r = l(t), /* @__PURE__ */ a.createElement(o, r.cn("SLabel", g({}, s({
130
- "use:theme": c,
131
- color: f
132
- }, i))));
145
+ function Label(_ref17) {
146
+ var _ref2 = arguments[0], _ref10;
147
+ var styles = _ref17.styles, theme = _ref17.theme, resolveColor = _ref17.resolveColor;
148
+ var SLabel = Box;
149
+ var useTheme = isCustomTheme(theme) ? "custom" : theme;
150
+ var color = resolveColor(theme);
151
+ return _ref10 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLabel, _ref10.cn("SLabel", _objectSpread({}, assignProps({
152
+ "use:theme": useTheme,
153
+ "color": color
154
+ }, _ref2))));
133
155
  }
134
- function J(_) {
135
- var i = arguments[0], r, t = _.styles, e = y;
136
- return r = l(t), /* @__PURE__ */ a.createElement(e, r.cn("STitle", g({}, s({
137
- tag: "div",
138
- size: 300,
139
- fontWeight: "bold"
140
- }, i))));
156
+ function Title(_ref18) {
157
+ var _ref3 = arguments[0], _ref11;
158
+ var styles = _ref18.styles;
159
+ var STitle = Text;
160
+ return _ref11 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STitle, _ref11.cn("STitle", _objectSpread({}, assignProps({
161
+ "tag": "div",
162
+ "size": 300,
163
+ "fontWeight": "bold"
164
+ }, _ref3))));
141
165
  }
142
- function K(_) {
143
- var i = arguments[0], r, t = _.styles, e = y;
144
- return r = l(t), /* @__PURE__ */ a.createElement(e, r.cn("SText", g({}, s({
145
- tag: "div"
146
- }, i))));
166
+ function NoticeText(_ref19) {
167
+ var _ref4 = arguments[0], _ref12;
168
+ var styles = _ref19.styles;
169
+ var SText = Text;
170
+ return _ref12 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SText, _ref12.cn("SText", _objectSpread({}, assignProps({
171
+ "tag": "div"
172
+ }, _ref4))));
147
173
  }
148
- function Q(_) {
149
- var i = arguments[0], r, t = _.styles, e = v;
150
- return r = l(t), /* @__PURE__ */ a.createElement(e, r.cn("SActions", g({}, s({}, i))));
174
+ function Actions(_ref20) {
175
+ var _ref5 = arguments[0], _ref13;
176
+ var styles = _ref20.styles;
177
+ var SActions = Box;
178
+ return _ref13 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SActions, _ref13.cn("SActions", _objectSpread({}, assignProps({}, _ref5))));
151
179
  }
152
- function U(_) {
153
- var i = arguments[0], r, t = _.styles, e = v;
154
- return r = l(t), /* @__PURE__ */ a.createElement(e, r.cn("SContent", g({}, s({}, i))));
180
+ function Content(_ref21) {
181
+ var _ref6 = arguments[0], _ref14;
182
+ var styles = _ref21.styles;
183
+ var SContent = Box;
184
+ return _ref14 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SContent, _ref14.cn("SContent", _objectSpread({}, assignProps({}, _ref6))));
155
185
  }
156
- function X(_) {
157
- var i = arguments[0], r, t = _.styles, e = _.getI18nText, n = v;
158
- return r = l(t), /* @__PURE__ */ a.createElement(n, r.cn("SCloseIcon", g({}, s({
159
- tag: b,
160
- interactive: !0,
161
- "aria-label": e("close")
162
- }, i))));
186
+ function CloseIcon(_ref22) {
187
+ var _ref7 = arguments[0], _ref15;
188
+ var styles = _ref22.styles, getI18nText = _ref22.getI18nText;
189
+ var SCloseIcon = Box;
190
+ return _ref15 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SCloseIcon, _ref15.cn("SCloseIcon", _objectSpread({}, assignProps({
191
+ "tag": CloseIconM,
192
+ "interactive": true,
193
+ "aria-label": getI18nText("close")
194
+ }, _ref7))));
163
195
  }
164
- function Y(_) {
165
- var i = arguments[0], r, t = _.styles, e = _.getI18nText, n = G;
166
- return r = l(t), /* @__PURE__ */ a.createElement(n, r.cn("SCloseIcon", g({}, s({
167
- addonLeft: b,
168
- use: "tertiary",
169
- theme: "muted",
170
- "aria-label": e("close")
171
- }, i))));
196
+ function Close(_ref23) {
197
+ var _ref8 = arguments[0], _ref16;
198
+ var styles = _ref23.styles, getI18nText = _ref23.getI18nText;
199
+ var SCloseIcon = Button;
200
+ return _ref16 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SCloseIcon, _ref16.cn("SCloseIcon", _objectSpread({}, assignProps({
201
+ "addonLeft": CloseIconM,
202
+ "use": "tertiary",
203
+ "theme": "muted",
204
+ "aria-label": getI18nText("close")
205
+ }, _ref8))));
172
206
  }
173
- var Se = $(u, {
174
- Label: H,
175
- Title: J,
176
- Text: K,
177
- Actions: Q,
178
- Content: U,
179
- CloseIcon: X,
180
- Close: Y
207
+ var Notice = createComponent(RootNotice, {
208
+ Label,
209
+ Title,
210
+ Text: NoticeText,
211
+ Actions,
212
+ Content,
213
+ CloseIcon,
214
+ Close
181
215
  });
182
216
  export {
183
- Se as default
217
+ Notice as default
184
218
  };
@@ -1,35 +1,43 @@
1
- import _ from "@babel/runtime/helpers/esm/classCallCheck";
2
- import N from "@babel/runtime/helpers/esm/createClass";
3
- import v from "@babel/runtime/helpers/esm/inherits";
4
- import P from "@babel/runtime/helpers/esm/createSuper";
5
- import u from "@babel/runtime/helpers/esm/defineProperty";
6
- import S, { assignProps as b, Component as y } from "@semcore/core";
7
- import e from "react";
8
- import l from "@semcore/utils/lib/isNode";
9
- import t from "./Notice.mjs";
10
- var m = /* @__PURE__ */ function(f) {
11
- v(o, f);
12
- var C = P(o);
13
- function o() {
14
- return _(this, o), C.apply(this, arguments);
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
+ import createComponent, { assignProps, Component } from "@semcore/core";
7
+ import React from "react";
8
+ import isNode from "@semcore/utils/lib/isNode";
9
+ import Notice from "./Notice.mjs";
10
+ var NoticeSmart = /* @__PURE__ */ function(_Component) {
11
+ _inherits(NoticeSmart2, _Component);
12
+ var _super = _createSuper(NoticeSmart2);
13
+ function NoticeSmart2() {
14
+ _classCallCheck(this, NoticeSmart2);
15
+ return _super.apply(this, arguments);
15
16
  }
16
- return N(o, [{
17
+ _createClass(NoticeSmart2, [{
17
18
  key: "render",
18
- value: function() {
19
- var d = this.asProps, h = t, r = this.asProps, n = r.Children, a = r.label, i = r.title, s = r.actions, c = r.closable, E = r.onClose, p = /* @__PURE__ */ e.createElement(n, null);
20
- return typeof n.origin == "string" && (p = l(i) || l(a) || c ? /* @__PURE__ */ e.createElement(t.Text, null, /* @__PURE__ */ e.createElement(n, null)) : /* @__PURE__ */ e.createElement(n, null)), /* @__PURE__ */ e.createElement(h, b({
21
- __excludeProps: ["title"]
22
- }, d), l(a) && /* @__PURE__ */ e.createElement(t.Label, null, a), /* @__PURE__ */ e.createElement(t.Content, null, l(i) && /* @__PURE__ */ e.createElement(t.Title, null, i), p, l(s) && /* @__PURE__ */ e.createElement(t.Actions, null, s)), c && /* @__PURE__ */ e.createElement(t.Close, {
23
- onClick: E
19
+ value: function render() {
20
+ var _ref = this.asProps;
21
+ var SNoticeSmart = Notice;
22
+ var _this$asProps = this.asProps, Children = _this$asProps.Children, label = _this$asProps.label, title = _this$asProps.title, actions = _this$asProps.actions, closable = _this$asProps.closable, onClose = _this$asProps.onClose;
23
+ var textContent = /* @__PURE__ */ React.createElement(Children, null);
24
+ if (typeof Children.origin === "string") {
25
+ textContent = isNode(title) || isNode(label) || closable ? /* @__PURE__ */ React.createElement(Notice.Text, null, /* @__PURE__ */ React.createElement(Children, null)) : /* @__PURE__ */ React.createElement(Children, null);
26
+ }
27
+ return /* @__PURE__ */ React.createElement(SNoticeSmart, assignProps({
28
+ "__excludeProps": ["title"]
29
+ }, _ref), isNode(label) && /* @__PURE__ */ React.createElement(Notice.Label, null, label), /* @__PURE__ */ React.createElement(Notice.Content, null, isNode(title) && /* @__PURE__ */ React.createElement(Notice.Title, null, title), textContent, isNode(actions) && /* @__PURE__ */ React.createElement(Notice.Actions, null, actions)), closable && /* @__PURE__ */ React.createElement(Notice.Close, {
30
+ onClick: onClose
24
31
  }));
25
32
  }
26
- }]), o;
27
- }(y);
28
- u(m, "displayName", "NoticeSmart");
29
- u(m, "defaultProps", {
33
+ }]);
34
+ return NoticeSmart2;
35
+ }(Component);
36
+ _defineProperty(NoticeSmart, "displayName", "NoticeSmart");
37
+ _defineProperty(NoticeSmart, "defaultProps", {
30
38
  theme: "info"
31
39
  });
32
- const w = S(m);
40
+ const NoticeSmart$1 = createComponent(NoticeSmart);
33
41
  export {
34
- w as default
42
+ NoticeSmart$1 as default
35
43
  };
package/lib/esm/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import o from "./Notice.mjs";
2
- import { default as a } from "./NoticeSmart.mjs";
1
+ import Notice from "./Notice.mjs";
2
+ import { default as default2 } from "./NoticeSmart.mjs";
3
3
  export {
4
- a as NoticeSmart,
5
- o as default
4
+ default2 as NoticeSmart,
5
+ Notice as default
6
6
  };
@@ -0,0 +1,138 @@
1
+ SNotice {
2
+ display: flex;
3
+ padding: var(--intergalactic-spacing-4x, 16px);
4
+ font-size: var(--intergalactic-fs-200, 14px);
5
+ line-height: var(--intergalactic-lh-200, 142%);
6
+ box-sizing: border-box;
7
+ border-style: solid;
8
+ border-width: 1px;
9
+ border-radius: var(--intergalactic-surface-rounded, 6px);
10
+ color: var(--intergalactic-text-primary, #191b23);
11
+ }
12
+
13
+ SNotice[theme='info'] {
14
+ background-color: var(--intergalactic-bg-secondary-info, #e9f7ff);
15
+ border-color: var(--intergalactic-border-info, #8ecdff);
16
+
17
+ & SCloseIcon {
18
+ color: var(--intergalactic-icon-primary-neutral, #6c6e79);
19
+
20
+ &:hover {
21
+ color: var(--intergalactic-icon-primary-neutral-hover-active, #565861);
22
+ }
23
+ }
24
+ }
25
+
26
+ SNotice[theme='danger'] {
27
+ background-color: var(--intergalactic-bg-secondary-critical, #fff0f7);
28
+ border-color: var(--intergalactic-border-critical, #ffaeb5);
29
+
30
+ & SCloseIcon {
31
+ color: var(--intergalactic-icon-primary-critical, #ff4953);
32
+
33
+ &:hover {
34
+ color: var(--intergalactic-icon-primary-critical-hover-active, #CC3A42);
35
+ }
36
+ }
37
+ }
38
+
39
+ SNotice[theme='warning'] {
40
+ background-color: var(--intergalactic-bg-secondary-warning, #fff3d9);
41
+ border-color: var(--intergalactic-border-warning, #ffb26e);
42
+
43
+ & SCloseIcon {
44
+ color: var(--intergalactic-icon-primary-warning, #ff642d);
45
+
46
+ &:hover {
47
+ color: var(--intergalactic-icon-primary-warning-hover-active, #CC5024);
48
+ }
49
+ }
50
+ }
51
+
52
+ SNotice[theme='success'] {
53
+ background-color: var(--intergalactic-bg-secondary-success, #dbfee8);
54
+ border-color: var(--intergalactic-border-success, #59ddaa);
55
+
56
+ & SCloseIcon {
57
+ color: var(--intergalactic-icon-primary-success, #009f81);
58
+
59
+ &:hover {
60
+ color: var(--intergalactic-icon-primary-success-hover-active, #037E68);
61
+ }
62
+ }
63
+ }
64
+
65
+ SNotice[theme='muted'] {
66
+ background-color: var(--intergalactic-bg-secondary-neutral, #f4f5f9);
67
+ border-color: var(--intergalactic-border-secondary, #e0e1e9);
68
+
69
+ & SCloseIcon {
70
+ color: var(--intergalactic-icon-primary-neutral, #6c6e79);
71
+
72
+ &:hover {
73
+ color: var(--intergalactic-icon-primary-neutral-hover-active, #565861);
74
+ }
75
+ }
76
+ }
77
+
78
+ SContent {
79
+ flex: 1 1 auto;
80
+ width: 100%;
81
+ }
82
+
83
+ SActions {
84
+ flex-shrink: 0;
85
+ margin-top: var(--intergalactic-spacing-3x, 12px);
86
+ }
87
+
88
+ SLabel {
89
+ min-height: var(--intergalactic-form-control-m, 28px);
90
+ height: fit-content;
91
+ margin-right: var(--intergalactic-spacing-2x, 8px);
92
+ display: inline-flex;
93
+ align-items: center;
94
+ }
95
+
96
+ SLabel[theme='info'] {
97
+ color: var(--intergalactic-icon-primary-neutral, #6c6e79);
98
+ }
99
+
100
+ SLabel[theme='danger'] {
101
+ color: var(--intergalactic-icon-primary-critical, #ff4953);
102
+ }
103
+
104
+ SLabel[theme='warning'] {
105
+ color: var(--intergalactic-icon-primary-warning, #ff642d);
106
+ }
107
+
108
+ SLabel[theme='success'] {
109
+ color: var(--intergalactic-icon-primary-success, #009f81);
110
+ }
111
+
112
+ SLabel[theme='muted'] {
113
+ color: var(--intergalactic-icon-primary-neutral, #6c6e79);
114
+ }
115
+
116
+ SLabel[theme='custom'] {
117
+ color: var(--color);
118
+ }
119
+
120
+ SCloseIcon {
121
+ flex-shrink: 0;
122
+ margin-left: var(--intergalactic-spacing-4x, 16px);
123
+ }
124
+
125
+ SNotice[theme='custom'] {
126
+ background-color: var(--backgroundColor);
127
+ border-color: var(--backgroundColor);
128
+ }
129
+
130
+ STitle {
131
+ margin-top: var(--intergalactic-spacing-05x, 2px);
132
+ margin-bottom: var(--intergalactic-spacing-05x, 2px);
133
+ }
134
+
135
+ SText {
136
+ margin-top: var(--intergalactic-spacing-1x, 4px);
137
+ margin-bottom: var(--intergalactic-spacing-1x, 4px);
138
+ }