@semcore/notice 5.39.0-prerelease.0 → 5.39.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/lib/cjs/Notice.js CHANGED
@@ -70,11 +70,19 @@ var RootNotice = /*#__PURE__*/function (_Component) {
70
70
  getI18nText: getI18nText
71
71
  };
72
72
  }
73
+ }, {
74
+ key: "getCloseProps",
75
+ value: function getCloseProps() {
76
+ var getI18nText = this.asProps.getI18nText;
77
+ return {
78
+ getI18nText: getI18nText
79
+ };
80
+ }
73
81
  }, {
74
82
  key: "render",
75
83
  value: function render() {
76
84
  var _ref = this.asProps,
77
- _ref6;
85
+ _ref7;
78
86
  var SNotice = _animation.FadeInOut;
79
87
  var _this$asProps2 = this.asProps,
80
88
  Children = _this$asProps2.Children,
@@ -95,14 +103,14 @@ var RootNotice = /*#__PURE__*/function (_Component) {
95
103
  _logger["default"].warn(true, "Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead", RootNotice.displayName);
96
104
  return /*#__PURE__*/_react["default"].createElement(_noticeGlobal["default"], this.asProps);
97
105
  }
98
- return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNotice, _ref6.cn("SNotice", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
106
+ return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNotice, _ref7.cn("SNotice", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
99
107
  "visible": !hidden,
100
108
  "use:theme": useTheme,
101
109
  "backgroundColor": color,
102
110
  "role": 'region',
103
111
  "aria-live": ariaLive,
104
112
  "aria-label": getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification')
105
- }, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {})));
113
+ }, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref7.cn("Children", {})));
106
114
  }
107
115
  }]);
108
116
  return RootNotice;
@@ -120,52 +128,65 @@ var RootNotice = /*#__PURE__*/function (_Component) {
120
128
  i18n: _intergalacticDynamicLocales.localizedMessages,
121
129
  locale: 'en'
122
130
  });
123
- function Label(_ref11) {
131
+ function Label(_ref13) {
124
132
  var _ref2 = arguments[0],
125
- _ref7;
126
- var styles = _ref11.styles,
127
- theme = _ref11.theme,
128
- resolveColor = _ref11.resolveColor;
133
+ _ref8;
134
+ var styles = _ref13.styles,
135
+ theme = _ref13.theme,
136
+ resolveColor = _ref13.resolveColor;
129
137
  var SLabel = _flexBox.Box;
130
138
  var useTheme = isCustomTheme(theme) ? 'custom' : theme;
131
139
  var color = resolveColor(theme);
132
- return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLabel, _ref7.cn("SLabel", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
140
+ return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLabel, _ref8.cn("SLabel", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
133
141
  "use:theme": useTheme,
134
142
  "color": color
135
143
  }, _ref2))));
136
144
  }
137
- function Actions(_ref12) {
145
+ function Actions(_ref14) {
138
146
  var _ref3 = arguments[0],
139
- _ref8;
140
- var styles = _ref12.styles;
147
+ _ref9;
148
+ var styles = _ref14.styles;
141
149
  var SActions = _flexBox.Box;
142
- return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SActions, _ref8.cn("SActions", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref3))));
150
+ return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SActions, _ref9.cn("SActions", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref3))));
143
151
  }
144
- function Content(_ref13) {
152
+ function Content(_ref15) {
145
153
  var _ref4 = arguments[0],
146
- _ref9;
147
- var styles = _ref13.styles;
154
+ _ref10;
155
+ var styles = _ref15.styles;
148
156
  var SContent = _flexBox.Box;
149
- return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContent, _ref9.cn("SContent", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref4))));
157
+ return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContent, _ref10.cn("SContent", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref4))));
150
158
  }
151
- function CloseIcon(_ref14) {
159
+ function CloseIcon(_ref16) {
152
160
  var _ref5 = arguments[0],
153
- _ref10;
154
- var styles = _ref14.styles,
155
- getI18nText = _ref14.getI18nText;
161
+ _ref11;
162
+ var styles = _ref16.styles,
163
+ getI18nText = _ref16.getI18nText;
164
+ var SCloseIcon = _flexBox.Box;
165
+ return _ref11 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCloseIcon, _ref11.cn("SCloseIcon", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
166
+ "tag": _m["default"],
167
+ "interactive": true,
168
+ "aria-label": getI18nText('close')
169
+ }, _ref5))));
170
+ }
171
+ function Close(_ref17) {
172
+ var _ref6 = arguments[0],
173
+ _ref12;
174
+ var styles = _ref17.styles,
175
+ getI18nText = _ref17.getI18nText;
156
176
  var SCloseIcon = _button["default"];
157
- return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCloseIcon, _ref10.cn("SCloseIcon", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
177
+ return _ref12 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCloseIcon, _ref12.cn("SCloseIcon", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
158
178
  "addonLeft": _m["default"],
159
179
  "use": 'tertiary',
160
180
  "theme": 'muted',
161
181
  "aria-label": getI18nText('close')
162
- }, _ref5))));
182
+ }, _ref6))));
163
183
  }
164
184
  var _default = (0, _core["default"])(RootNotice, {
165
185
  Label: Label,
166
186
  Actions: Actions,
167
187
  Content: Content,
168
- CloseIcon: CloseIcon
188
+ CloseIcon: CloseIcon,
189
+ Close: Close
169
190
  });
170
191
  exports["default"] = _default;
171
192
  //# sourceMappingURL=Notice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notice.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_button","_m","_resolveColorEnhance","_animation","_logger","_noticeGlobal","_intergalacticDynamicLocales","_i18nEnhance","_useCssVariable","style","_index","sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","render","_ref","_ref6","SNotice","FadeInOut","_this$asProps2","Children","styles","hidden","use","isAssertive","color","useTheme","ariaLive","undefined","logger","warn","displayName","createElement","cn","_objectSpread2","assignProps","Component","_defineProperty2","i18nEnhance","localizedMessages","cssVariableEnhance","variable","fallback","map","Number","parseInt","prop","resolveColorEnhance","i18n","locale","Label","_ref11","_ref2","arguments[0]","_ref7","SLabel","Box","Actions","_ref12","_ref3","_ref8","SActions","Content","_ref13","_ref4","_ref9","SContent","CloseIcon","_ref14","_ref5","_ref10","SCloseIcon","Button","Close","_default","createComponent","exports"],"sources":["../../src/Notice.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport Close from '@semcore/icon/Close/m';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/utils/lib/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info', 'muted'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n cssVariableEnhance({\n variable: '--intergalactic-duration-popper',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ];\n static defaultProps = {\n theme: 'info',\n i18n: localizedMessages,\n locale: 'en',\n };\n\n getLabelProps() {\n const { theme, resolveColor } = this.asProps;\n\n return { theme, resolveColor };\n }\n\n getCloseIconProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, use, resolveColor, getI18nText } = this.asProps;\n const isAssertive = theme === 'danger' || theme === 'warning';\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n let ariaLive = isAssertive ? 'assertive' : 'polite';\n if (theme === 'neutral') {\n ariaLive = undefined;\n }\n\n if (use === 'primary') {\n logger.warn(\n true,\n `Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead`,\n RootNotice.displayName,\n );\n return <NoticeGlobal {...this.asProps} />;\n }\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role='region'\n aria-live={ariaLive}\n aria-label={getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification')}\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme, resolveColor }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon\n render={Button}\n addonLeft={Close}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('close')}\n />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,EAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,oBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,aAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,4BAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,eAAA,GAAAZ,OAAA;AAAuE;AAAA,IAAAa,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIvE,SAASC,aAAaA,CAACC,KAAK,EAAE;EAC5B,OAAO,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAACC,QAAQ,CAACD,KAAK,CAAC;AAC3E;AAAC,IAEKE,UAAU,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,UAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,UAAA;EAAA,SAAAA,WAAA;IAAA,IAAAK,gBAAA,mBAAAL,UAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAA,IAAAC,aAAA,aAAAR,UAAA;IAAAS,GAAA;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AACkC,QAAQ,EAAAD,KAAA,CAAAhC,EAAA,iBAAAC,cAAA,qBAAA3D,KAAA,CAAA4D,WAAA,MAAA6B,KAAA,IAAgB;AAClD;AAEA,SAASG,SAASA,CAAAC,MAAA,EAA0B;EAAA,IAAAC,KAAA,GAAAhB,YAAA;IAAAiB,MAAA;EAAA,IAAvBjD,MAAM,GAAA+C,MAAA,CAAN/C,MAAM;IAAER,WAAW,GAAAuD,MAAA,CAAXvD,WAAW;EACtC,IAAM0D,UAAU,GAGJC,kBAAM;EAFlB,OAAAF,MAAA,GAAO,IAAA9E,aAAO,EAAC6B,MAAM,CAAC,eACpB3C,MAAA,YAAAsD,aAAA,CAACuC,UAAU,EAAAD,MAAA,CAAArC,EAAA,mBAAAC,cAAA,qBAAA3D,KAAA,CAAA4D,WAAA;IAAA,aAEEsC,aAAK;IAAA,OACZ,UAAU;IAAA,SACR,OAAO;IAAA,cACD5D,WAAW,CAAC,OAAO;EAAC,GAAAwD,KAAA,IAChC;AAEN;AAAC,IAAAK,QAAA,GAEc,IAAAC,gBAAe,EAAC9E,UAAU,EAAE;EACzCqD,KAAK,EAALA,KAAK;EACLO,OAAO,EAAPA,OAAO;EACPK,OAAO,EAAPA,OAAO;EACPK,SAAS,EAATA;AACF,CAAC,CAAC;AAAAS,OAAA,cAAAF,QAAA"}
1
+ {"version":3,"file":"Notice.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_button","_m","_resolveColorEnhance","_animation","_logger","_noticeGlobal","_intergalacticDynamicLocales","_i18nEnhance","_useCssVariable","style","_index","sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref7","SNotice","FadeInOut","_this$asProps2","Children","styles","hidden","use","isAssertive","color","useTheme","ariaLive","undefined","logger","warn","displayName","createElement","cn","_objectSpread2","assignProps","Component","_defineProperty2","i18nEnhance","localizedMessages","cssVariableEnhance","variable","fallback","map","Number","parseInt","prop","resolveColorEnhance","i18n","locale","Label","_ref13","_ref2","arguments[0]","_ref8","SLabel","Box","Actions","_ref14","_ref3","_ref9","SActions","Content","_ref15","_ref4","_ref10","SContent","CloseIcon","_ref16","_ref5","_ref11","SCloseIcon","CloseIconM","Close","_ref17","_ref6","_ref12","Button","_default","createComponent","exports"],"sources":["../../src/Notice.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport CloseIconM from '@semcore/icon/Close/m';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/utils/lib/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info', 'muted'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n cssVariableEnhance({\n variable: '--intergalactic-duration-popper',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ];\n static defaultProps = {\n theme: 'info',\n i18n: localizedMessages,\n locale: 'en',\n };\n\n getLabelProps() {\n const { theme, resolveColor } = this.asProps;\n\n return { theme, resolveColor };\n }\n\n getCloseIconProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n getCloseProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, use, resolveColor, getI18nText } = this.asProps;\n const isAssertive = theme === 'danger' || theme === 'warning';\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n let ariaLive = isAssertive ? 'assertive' : 'polite';\n if (theme === 'neutral') {\n ariaLive = undefined;\n }\n\n if (use === 'primary') {\n logger.warn(\n true,\n `Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead`,\n RootNotice.displayName,\n );\n return <NoticeGlobal {...this.asProps} />;\n }\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role='region'\n aria-live={ariaLive}\n aria-label={getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification')}\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme, resolveColor }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={CloseIconM} interactive aria-label={getI18nText('close')} />,\n );\n}\n\nfunction Close({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon\n render={Button}\n addonLeft={CloseIconM}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('close')}\n />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n Close,\n});\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAA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/*#__PURE__*/function (_Component) {
33
33
  actions = _this$asProps.actions,
34
34
  closable = _this$asProps.closable,
35
35
  onClose = _this$asProps.onClose;
36
- return /*#__PURE__*/_react["default"].createElement(SNoticeSmart, (0, _core.assignProps)({}, _ref), (0, _isNode["default"])(label) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Label, null, label), /*#__PURE__*/_react["default"].createElement(_Notice["default"].Content, null, /*#__PURE__*/_react["default"].createElement(Children, null), (0, _isNode["default"])(actions) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Actions, null, actions)), closable && /*#__PURE__*/_react["default"].createElement(_Notice["default"].CloseIcon, {
36
+ return /*#__PURE__*/_react["default"].createElement(SNoticeSmart, (0, _core.assignProps)({}, _ref), (0, _isNode["default"])(label) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Label, null, label), /*#__PURE__*/_react["default"].createElement(_Notice["default"].Content, null, /*#__PURE__*/_react["default"].createElement(Children, null), (0, _isNode["default"])(actions) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Actions, null, actions)), closable && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Close, {
37
37
  onClick: onClose
38
38
  }));
39
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NoticeSmart.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_isNode","_Notice","NoticeSmart","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","render","_ref","asProps","SNoticeSmart","Notice","_this$asProps","Children","label","actions","closable","onClose","createElement","assignProps","isNode","Label","Content","Actions","CloseIcon","onClick","Component","_defineProperty2","theme","_default","createComponent","exports"],"sources":["../../src/NoticeSmart.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.CloseIcon onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA8B,IAExBK,WAAW,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,WAAA;EAAA,SAAAA,YAAA;IAAA,IAAAK,gBAAA,mBAAAL,WAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAA,IAAAC,aAAA,aAAAR,WAAA;IAAAS,GAAA;IAAAC,KAAA,EAOf,SAAAC,OAAA,EAAS;MAAA,IAAAC,IAAA,QAAAC,OAAA;MACP,IAAMC,YAAY,GAGMC,kBAAM;MAF9B,IAAAC,aAAA,GAAwD,IAAI,CAACH,OAAO;QAA5DI,QAAQ,GAAAD,aAAA,CAARC,QAAQ;QAAEC,KAAK,GAAAF,aAAA,CAALE,KAAK;QAAEC,OAAO,GAAAH,aAAA,CAAPG,OAAO;QAAEC,QAAQ,GAAAJ,aAAA,CAARI,QAAQ;QAAEC,OAAO,GAAAL,aAAA,CAAPK,OAAO;MACnD,oBACEzB,MAAA,YAAA0B,aAAA,CAACR,YAAY,MAAArB,KAAA,CAAA8B,WAAA,MAAAX,IAAA,GACV,IAAAY,kBAAM,EAACN,KAAK,CAAC,iBAAItB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC0B,KAAK,QAAEP,KAAK,CAAgB,eACtDtB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC2B,OAAO,qBACb9B,MAAA,YAAA0B,aAAA,CAACL,QAAQ,OAAG,EACX,IAAAO,kBAAM,EAACL,OAAO,CAAC,iBAAIvB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC4B,OAAO,QAAER,OAAO,CAAkB,CAC/C,EAChBC,QAAQ,iBAAIxB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC6B,SAAS;QAACC,OAAO,EAAER;MAAQ,EAAG,CACtC;IAEnB;EAAC;EAAA,OAAArB,WAAA;AAAA,EApBuB8B,eAAS;AAAA,IAAAC,gBAAA,aAA7B/B,WAAW,iBACM,aAAa;AAAA,IAAA+B,gBAAA,aAD9B/B,WAAW,kBAGO;EACpBgC,KAAK,EAAE;AACT,CAAC;AAAA,IAAAC,QAAA,GAkBY,IAAAC,gBAAe,EAAClC,WAAW,CAAC;AAAAmC,OAAA,cAAAF,QAAA"}
1
+ {"version":3,"file":"NoticeSmart.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_isNode","_Notice","NoticeSmart","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","render","_ref","asProps","SNoticeSmart","Notice","_this$asProps","Children","label","actions","closable","onClose","createElement","assignProps","isNode","Label","Content","Actions","Close","onClick","Component","_defineProperty2","theme","_default","createComponent","exports"],"sources":["../../src/NoticeSmart.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.Close onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA8B,IAExBK,WAAW,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,WAAA;EAAA,SAAAA,YAAA;IAAA,IAAAK,gBAAA,mBAAAL,WAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAA,IAAAC,aAAA,aAAAR,WAAA;IAAAS,GAAA;IAAAC,KAAA,EAOf,SAAAC,OAAA,EAAS;MAAA,IAAAC,IAAA,QAAAC,OAAA;MACP,IAAMC,YAAY,GAGMC,kBAAM;MAF9B,IAAAC,aAAA,GAAwD,IAAI,CAACH,OAAO;QAA5DI,QAAQ,GAAAD,aAAA,CAARC,QAAQ;QAAEC,KAAK,GAAAF,aAAA,CAALE,KAAK;QAAEC,OAAO,GAAAH,aAAA,CAAPG,OAAO;QAAEC,QAAQ,GAAAJ,aAAA,CAARI,QAAQ;QAAEC,OAAO,GAAAL,aAAA,CAAPK,OAAO;MACnD,oBACEzB,MAAA,YAAA0B,aAAA,CAACR,YAAY,MAAArB,KAAA,CAAA8B,WAAA,MAAAX,IAAA,GACV,IAAAY,kBAAM,EAACN,KAAK,CAAC,iBAAItB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC0B,KAAK,QAAEP,KAAK,CAAgB,eACtDtB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC2B,OAAO,qBACb9B,MAAA,YAAA0B,aAAA,CAACL,QAAQ,OAAG,EACX,IAAAO,kBAAM,EAACL,OAAO,CAAC,iBAAIvB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC4B,OAAO,QAAER,OAAO,CAAkB,CAC/C,EAChBC,QAAQ,iBAAIxB,MAAA,YAAA0B,aAAA,CAACvB,OAAA,WAAM,CAAC6B,KAAK;QAACC,OAAO,EAAER;MAAQ,EAAG,CAClC;IAEnB;EAAC;EAAA,OAAArB,WAAA;AAAA,EApBuB8B,eAAS;AAAA,IAAAC,gBAAA,aAA7B/B,WAAW,iBACM,aAAa;AAAA,IAAA+B,gBAAA,aAD9B/B,WAAW,kBAGO;EACpBgC,KAAK,EAAE;AACT,CAAC;AAAA,IAAAC,QAAA,GAkBY,IAAAC,gBAAe,EAAClC,WAAW,CAAC;AAAAmC,OAAA,cAAAF,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport { FadeInOutProps } from '@semcore/animation';\n\nexport type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | 'muted';\nexport type NoticeUse = 'primary' | 'secondary';\n\n/** @deprecated */\nexport interface INoticeProps extends NoticeProps, UnknownProperties {}\nexport type NoticeProps = BoxProps &\n FadeInOutProps & {\n /** Property for managing visibility of Notice */\n hidden?: boolean;\n /** Notice type\n * @deprecated since version ^4.1.0\n */\n use?: NoticeUse;\n /**\n * Notice theme\n * @default info\n */\n theme?: NoticeTheme;\n /** Duration of animation, ms\n * @default 250\n */\n duration?: number;\n locale?: string;\n };\n\n/** @deprecated */\nexport interface INoticeLabelProps extends NoticeLabelProps, UnknownProperties {}\nexport type NoticeLabelProps = BoxProps & {\n theme?: NoticeTheme;\n};\n\n/** @deprecated */\nexport interface INoticeContext extends NoticeContext, UnknownProperties {}\nexport type NoticeContext = {\n getLabelProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface INoticeSmartProps extends NoticeSmartProps, UnknownProperties {}\nexport type NoticeSmartProps = NoticeProps & {\n /**\n * A custom element for additional information\n */\n label?: React.ReactNode;\n /**\n * Custom action element\n */\n actions?: React.ReactNode;\n /**\n * Adds a Close icon\n */\n closable?: boolean;\n /**\n * Callback on a click on the close button\n */\n onClose?: (event: React.SyntheticEvent) => void;\n};\n\ndeclare const Notice: Intergalactic.Component<'div', NoticeProps, NoticeContext> & {\n Label: Intergalactic.Component<'div', NoticeLabelProps>;\n Actions: typeof Box;\n Content: typeof Box;\n CloseIcon: typeof Button;\n};\n\ndeclare const NoticeSmart: Intergalactic.Component<'div', NoticeSmartProps>;\n\nexport { NoticeSmart };\nexport default Notice;\n"],"mappings":""}
1
+ {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport { IconProps } from '@semcore/icon';\nimport { FadeInOutProps } from '@semcore/animation';\n\nexport type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | 'muted';\nexport type NoticeUse = 'primary' | 'secondary';\n\n/** @deprecated */\nexport interface INoticeProps extends NoticeProps, UnknownProperties {}\nexport type NoticeProps = BoxProps &\n FadeInOutProps & {\n /** Property for managing visibility of Notice */\n hidden?: boolean;\n /** Notice type\n * @deprecated since version ^4.1.0\n */\n use?: NoticeUse;\n /**\n * Notice theme\n * @default info\n */\n theme?: NoticeTheme;\n /** Duration of animation, ms\n * @default 250\n */\n duration?: number;\n locale?: string;\n };\n\n/** @deprecated */\nexport interface INoticeLabelProps extends NoticeLabelProps, UnknownProperties {}\nexport type NoticeLabelProps = BoxProps & {\n theme?: NoticeTheme;\n};\n\n/** @deprecated */\nexport interface INoticeContext extends NoticeContext, UnknownProperties {}\nexport type NoticeContext = {\n getLabelProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface INoticeSmartProps extends NoticeSmartProps, UnknownProperties {}\nexport type NoticeSmartProps = NoticeProps & {\n /**\n * A custom element for additional information\n */\n label?: React.ReactNode;\n /**\n * Custom action element\n */\n actions?: React.ReactNode;\n /**\n * Adds a Close icon\n */\n closable?: boolean;\n /**\n * Callback on a click on the close button\n */\n onClose?: (event: React.SyntheticEvent) => void;\n};\n\ndeclare const Notice: Intergalactic.Component<'div', NoticeProps, NoticeContext> & {\n Label: Intergalactic.Component<'div', NoticeLabelProps>;\n Actions: typeof Box;\n Content: typeof Box;\n /**\n * @deprecated Use Notice.Close instead of Notice.CloseIcon\n */\n CloseIcon: Intergalactic.Component<'div', IconProps>;\n Close: typeof Button;\n};\n\ndeclare const NoticeSmart: Intergalactic.Component<'div', NoticeSmartProps>;\n\nexport { NoticeSmart };\nexport default Notice;\n"],"mappings":""}
package/lib/es6/Notice.js CHANGED
@@ -5,6 +5,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _createSuper from "@babel/runtime/helpers/createSuper";
6
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
7
  import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
8
+ import { assignProps as _assignProps6 } from "@semcore/core";
8
9
  import { assignProps as _assignProps5 } from "@semcore/core";
9
10
  import { assignProps as _assignProps4 } from "@semcore/core";
10
11
  import { assignProps as _assignProps3 } from "@semcore/core";
@@ -14,7 +15,7 @@ import React from 'react';
14
15
  import createComponent, { Component, sstyled, Root } from '@semcore/core';
15
16
  import { Box } from '@semcore/flex-box';
16
17
  import Button from '@semcore/button';
17
- import Close from '@semcore/icon/Close/m';
18
+ import CloseIconM from '@semcore/icon/Close/m';
18
19
  import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
19
20
  import { FadeInOut } from '@semcore/animation';
20
21
  import logger from '@semcore/utils/lib/logger';
@@ -67,11 +68,19 @@ var RootNotice = /*#__PURE__*/function (_Component) {
67
68
  getI18nText: getI18nText
68
69
  };
69
70
  }
71
+ }, {
72
+ key: "getCloseProps",
73
+ value: function getCloseProps() {
74
+ var getI18nText = this.asProps.getI18nText;
75
+ return {
76
+ getI18nText: getI18nText
77
+ };
78
+ }
70
79
  }, {
71
80
  key: "render",
72
81
  value: function render() {
73
82
  var _ref = this.asProps,
74
- _ref6;
83
+ _ref7;
75
84
  var SNotice = FadeInOut;
76
85
  var _this$asProps2 = this.asProps,
77
86
  Children = _this$asProps2.Children,
@@ -92,14 +101,14 @@ var RootNotice = /*#__PURE__*/function (_Component) {
92
101
  logger.warn(true, "Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead", RootNotice.displayName);
93
102
  return /*#__PURE__*/React.createElement(NoticeGlobal, this.asProps);
94
103
  }
95
- return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SNotice, _ref6.cn("SNotice", _objectSpread({}, _assignProps({
104
+ return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SNotice, _ref7.cn("SNotice", _objectSpread({}, _assignProps({
96
105
  "visible": !hidden,
97
106
  "use:theme": useTheme,
98
107
  "backgroundColor": color,
99
108
  "role": 'region',
100
109
  "aria-live": ariaLive,
101
110
  "aria-label": getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification')
102
- }, _ref))), /*#__PURE__*/React.createElement(Children, _ref6.cn("Children", {})));
111
+ }, _ref))), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {})));
103
112
  }
104
113
  }]);
105
114
  return RootNotice;
@@ -117,51 +126,64 @@ _defineProperty(RootNotice, "defaultProps", {
117
126
  i18n: localizedMessages,
118
127
  locale: 'en'
119
128
  });
120
- function Label(_ref11) {
129
+ function Label(_ref13) {
121
130
  var _ref2 = arguments[0],
122
- _ref7;
123
- var styles = _ref11.styles,
124
- theme = _ref11.theme,
125
- resolveColor = _ref11.resolveColor;
131
+ _ref8;
132
+ var styles = _ref13.styles,
133
+ theme = _ref13.theme,
134
+ resolveColor = _ref13.resolveColor;
126
135
  var SLabel = Box;
127
136
  var useTheme = isCustomTheme(theme) ? 'custom' : theme;
128
137
  var color = resolveColor(theme);
129
- return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SLabel, _ref7.cn("SLabel", _objectSpread({}, _assignProps2({
138
+ return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SLabel, _ref8.cn("SLabel", _objectSpread({}, _assignProps2({
130
139
  "use:theme": useTheme,
131
140
  "color": color
132
141
  }, _ref2))));
133
142
  }
134
- function Actions(_ref12) {
143
+ function Actions(_ref14) {
135
144
  var _ref3 = arguments[0],
136
- _ref8;
137
- var styles = _ref12.styles;
145
+ _ref9;
146
+ var styles = _ref14.styles;
138
147
  var SActions = Box;
139
- return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SActions, _ref8.cn("SActions", _objectSpread({}, _assignProps3({}, _ref3))));
148
+ return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SActions, _ref9.cn("SActions", _objectSpread({}, _assignProps3({}, _ref3))));
140
149
  }
141
- function Content(_ref13) {
150
+ function Content(_ref15) {
142
151
  var _ref4 = arguments[0],
143
- _ref9;
144
- var styles = _ref13.styles;
152
+ _ref10;
153
+ var styles = _ref15.styles;
145
154
  var SContent = Box;
146
- return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SContent, _ref9.cn("SContent", _objectSpread({}, _assignProps4({}, _ref4))));
155
+ return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SContent, _ref10.cn("SContent", _objectSpread({}, _assignProps4({}, _ref4))));
147
156
  }
148
- function CloseIcon(_ref14) {
157
+ function CloseIcon(_ref16) {
149
158
  var _ref5 = arguments[0],
150
- _ref10;
151
- var styles = _ref14.styles,
152
- getI18nText = _ref14.getI18nText;
159
+ _ref11;
160
+ var styles = _ref16.styles,
161
+ getI18nText = _ref16.getI18nText;
162
+ var SCloseIcon = Box;
163
+ return _ref11 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref11.cn("SCloseIcon", _objectSpread({}, _assignProps5({
164
+ "tag": CloseIconM,
165
+ "interactive": true,
166
+ "aria-label": getI18nText('close')
167
+ }, _ref5))));
168
+ }
169
+ function Close(_ref17) {
170
+ var _ref6 = arguments[0],
171
+ _ref12;
172
+ var styles = _ref17.styles,
173
+ getI18nText = _ref17.getI18nText;
153
174
  var SCloseIcon = Button;
154
- return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, _assignProps5({
155
- "addonLeft": Close,
175
+ return _ref12 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref12.cn("SCloseIcon", _objectSpread({}, _assignProps6({
176
+ "addonLeft": CloseIconM,
156
177
  "use": 'tertiary',
157
178
  "theme": 'muted',
158
179
  "aria-label": getI18nText('close')
159
- }, _ref5))));
180
+ }, _ref6))));
160
181
  }
161
182
  export default createComponent(RootNotice, {
162
183
  Label: Label,
163
184
  Actions: Actions,
164
185
  Content: Content,
165
- CloseIcon: CloseIcon
186
+ CloseIcon: CloseIcon,
187
+ Close: Close
166
188
  });
167
189
  //# sourceMappingURL=Notice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notice.js","names":["React","createComponent","Component","sstyled","Root","Box","Button","Close","resolveColorEnhance","FadeInOut","logger","NoticeGlobal","localizedMessages","i18nEnhance","cssVariableEnhance","style","_sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","render","_ref","_ref6","SNotice","_this$asProps2","Children","styles","hidden","use","isAssertive","color","useTheme","ariaLive","undefined","warn","displayName","createElement","cn","_objectSpread","_assignProps","_defineProperty","variable","fallback","map","Number","parseInt","prop","i18n","locale","Label","_ref11","_ref2","arguments[0]","_ref7","SLabel","_assignProps2","Actions","_ref12","_ref3","_ref8","SActions","_assignProps3","Content","_ref13","_ref4","_ref9","SContent","_assignProps4","CloseIcon","_ref14","_ref5","_ref10","SCloseIcon","_assignProps5"],"sources":["../../src/Notice.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport Close from '@semcore/icon/Close/m';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/utils/lib/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info', 'muted'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n cssVariableEnhance({\n variable: '--intergalactic-duration-popper',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ];\n static defaultProps = {\n theme: 'info',\n i18n: localizedMessages,\n locale: 'en',\n };\n\n getLabelProps() {\n const { theme, resolveColor } = this.asProps;\n\n return { theme, resolveColor };\n }\n\n getCloseIconProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, use, resolveColor, getI18nText } = this.asProps;\n const isAssertive = theme === 'danger' || theme === 'warning';\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n let ariaLive = isAssertive ? 'assertive' : 'polite';\n if (theme === 'neutral') {\n ariaLive = undefined;\n }\n\n if (use === 'primary') {\n logger.warn(\n true,\n `Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead`,\n RootNotice.displayName,\n );\n return <NoticeGlobal {...this.asProps} />;\n }\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role='region'\n aria-live={ariaLive}\n aria-label={getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification')}\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme, resolveColor }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon\n render={Button}\n addonLeft={Close}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('close')}\n />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,MAAM,MAAM,iBAAiB;AACpC,OAAOC,KAAK,MAAM,uBAAuB;AACzC,OAAOC,mBAAmB,MAAM,iDAAiD;AACjF,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,OAAOC,MAAM,MAAM,2BAA2B;AAC9C,OAAOC,YAAY,MAAM,wBAAwB;AACjD,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,OAAOC,WAAW,MAAM,yCAAyC;AACjE,SAASC,kBAAkB,QAAQ,mCAAmC;AAAC;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resolveColorEnhance","FadeInOut","logger","NoticeGlobal","localizedMessages","i18nEnhance","cssVariableEnhance","style","_sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref7","SNotice","_this$asProps2","Children","styles","hidden","use","isAssertive","color","useTheme","ariaLive","undefined","warn","displayName","createElement","cn","_objectSpread","_assignProps","_defineProperty","variable","fallback","map","Number","parseInt","prop","i18n","locale","Label","_ref13","_ref2","arguments[0]","_ref8","SLabel","_assignProps2","Actions","_ref14","_ref3","_ref9","SActions","_assignProps3","Content","_ref15","_ref4","_ref10","SContent","_assignProps4","CloseIcon","_ref16","_ref5","_ref11","SCloseIcon","_assignProps5","Close","_ref17","_ref6","_ref12","_assignProps6"],"sources":["../../src/Notice.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport CloseIconM from '@semcore/icon/Close/m';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/utils/lib/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info', 'muted'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n cssVariableEnhance({\n variable: '--intergalactic-duration-popper',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ];\n static defaultProps = {\n theme: 'info',\n i18n: localizedMessages,\n locale: 'en',\n };\n\n getLabelProps() {\n const { theme, resolveColor } = this.asProps;\n\n return { theme, resolveColor };\n }\n\n getCloseIconProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n getCloseProps() {\n const { getI18nText } = this.asProps;\n\n return { getI18nText };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, use, resolveColor, getI18nText } = this.asProps;\n const isAssertive = theme === 'danger' || theme === 'warning';\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n let ariaLive = isAssertive ? 'assertive' : 'polite';\n if (theme === 'neutral') {\n ariaLive = undefined;\n }\n\n if (use === 'primary') {\n logger.warn(\n true,\n `Deprecated property-value pair \"use=primary\", use component <NoticeGlobal/> instead`,\n RootNotice.displayName,\n );\n return <NoticeGlobal {...this.asProps} />;\n }\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role='region'\n aria-live={ariaLive}\n aria-label={getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification')}\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme, resolveColor }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={CloseIconM} interactive aria-label={getI18nText('close')} />,\n );\n}\n\nfunction Close({ styles, getI18nText }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon\n render={Button}\n addonLeft={CloseIconM}\n use='tertiary'\n theme='muted'\n aria-label={getI18nText('close')}\n />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n Close,\n});\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,MAAM,MAAM,iBAAiB;AACpC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,mBAAmB,MAAM,iDAAiD;AACjF,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,OAAOC,MAAM,MAAM,2BAA2B;AAC9C,OAAOC,YAAY,MAAM,wBAAwB;AACjD,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,OAAOC,WAAW,MAAM,yCAAyC;AACjE,SAASC,kBAAkB,QAAQ,mCAAmC;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIvE,SAASC,aAAaA,CAACC,KAAK,EAAE;EAC5B,OAAO,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAACC,QAAQ,CAACD,KAAK,CAAC;AAC3E;AAAC,IAEKE,UAAU,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,UAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,UAAA;EAAA,SAAAA,WAAA;IAAAK,eAAA,OAAAL,UAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,UAAA;IAAAS,GAAA;IAAAC,KAAA,EAmBd,SAAAC,cAAA,EAAgB;MACd,IAAAC,aAAA,GAAgC,IAAI,CAACC,OAAO;QAApCf,KAA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26
26
  actions = _this$asProps.actions,
27
27
  closable = _this$asProps.closable,
28
28
  onClose = _this$asProps.onClose;
29
- return /*#__PURE__*/React.createElement(SNoticeSmart, _assignProps({}, _ref), isNode(label) && /*#__PURE__*/React.createElement(Notice.Label, null, label), /*#__PURE__*/React.createElement(Notice.Content, null, /*#__PURE__*/React.createElement(Children, null), isNode(actions) && /*#__PURE__*/React.createElement(Notice.Actions, null, actions)), closable && /*#__PURE__*/React.createElement(Notice.CloseIcon, {
29
+ return /*#__PURE__*/React.createElement(SNoticeSmart, _assignProps({}, _ref), isNode(label) && /*#__PURE__*/React.createElement(Notice.Label, null, label), /*#__PURE__*/React.createElement(Notice.Content, null, /*#__PURE__*/React.createElement(Children, null), isNode(actions) && /*#__PURE__*/React.createElement(Notice.Actions, null, actions)), closable && /*#__PURE__*/React.createElement(Notice.Close, {
30
30
  onClick: onClose
31
31
  }));
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NoticeSmart.js","names":["React","createComponent","Component","Root","isNode","Notice","NoticeSmart","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","render","_ref","asProps","SNoticeSmart","_this$asProps","Children","label","actions","closable","onClose","createElement","_assignProps","Label","Content","Actions","CloseIcon","onClick","_defineProperty","theme"],"sources":["../../src/NoticeSmart.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.CloseIcon onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n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IzB,KAAA,CAAA2B,aAAA,CAACtB,MAAM,CAAC2B,SAAS;QAACC,OAAO,EAAEP;MAAQ,EAAG,CACtC;IAEnB;EAAC;EAAA,OAAApB,WAAA;AAAA,EApBuBJ,SAAS;AAAAgC,eAAA,CAA7B5B,WAAW,iBACM,aAAa;AAAA4B,eAAA,CAD9B5B,WAAW,kBAGO;EACpB6B,KAAK,EAAE;AACT,CAAC;AAkBH,eAAelC,eAAe,CAACK,WAAW,CAAC"}
1
+ {"version":3,"file":"NoticeSmart.js","names":["React","createComponent","Component","Root","isNode","Notice","NoticeSmart","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","render","_ref","asProps","SNoticeSmart","_this$asProps","Children","label","actions","closable","onClose","createElement","_assignProps","Label","Content","Actions","Close","onClick","_defineProperty","theme"],"sources":["../../src/NoticeSmart.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.Close onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,QAAQ,eAAe;AAChE,OAAOC,MAAM,MAAM,2BAA2B;AAC9C,OAAOC,MAAM,MAAM,UAAU;AAAC,IAExBC,WAAW,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,WAAA,EAAAC,UAAA;EAAA,IAAAE,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W,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport { FadeInOutProps } from '@semcore/animation';\n\nexport type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | 'muted';\nexport type NoticeUse = 'primary' | 'secondary';\n\n/** @deprecated */\nexport interface INoticeProps extends NoticeProps, UnknownProperties {}\nexport type NoticeProps = BoxProps &\n FadeInOutProps & {\n /** Property for managing visibility of Notice */\n hidden?: boolean;\n /** Notice type\n * @deprecated since version ^4.1.0\n */\n use?: NoticeUse;\n /**\n * Notice theme\n * @default info\n */\n theme?: NoticeTheme;\n /** Duration of animation, ms\n * @default 250\n */\n duration?: number;\n locale?: string;\n };\n\n/** @deprecated */\nexport interface INoticeLabelProps extends NoticeLabelProps, UnknownProperties {}\nexport type NoticeLabelProps = BoxProps & {\n theme?: NoticeTheme;\n};\n\n/** @deprecated */\nexport interface INoticeContext extends NoticeContext, UnknownProperties {}\nexport type NoticeContext = {\n getLabelProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface INoticeSmartProps extends NoticeSmartProps, UnknownProperties {}\nexport type NoticeSmartProps = NoticeProps & {\n /**\n * A custom element for additional information\n */\n label?: React.ReactNode;\n /**\n * Custom action element\n */\n actions?: React.ReactNode;\n /**\n * Adds a Close icon\n */\n closable?: boolean;\n /**\n * Callback on a click on the close button\n */\n onClose?: (event: React.SyntheticEvent) => void;\n};\n\ndeclare const Notice: Intergalactic.Component<'div', NoticeProps, NoticeContext> & {\n Label: Intergalactic.Component<'div', NoticeLabelProps>;\n Actions: typeof Box;\n Content: typeof Box;\n CloseIcon: typeof Button;\n};\n\ndeclare const NoticeSmart: Intergalactic.Component<'div', NoticeSmartProps>;\n\nexport { NoticeSmart };\nexport default Notice;\n"],"mappings":""}
1
+ {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport Button from '@semcore/button';\nimport { IconProps } from '@semcore/icon';\nimport { FadeInOutProps } from '@semcore/animation';\n\nexport type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | 'muted';\nexport type NoticeUse = 'primary' | 'secondary';\n\n/** @deprecated */\nexport interface INoticeProps extends NoticeProps, UnknownProperties {}\nexport type NoticeProps = BoxProps &\n FadeInOutProps & {\n /** Property for managing visibility of Notice */\n hidden?: boolean;\n /** Notice type\n * @deprecated since version ^4.1.0\n */\n use?: NoticeUse;\n /**\n * Notice theme\n * @default info\n */\n theme?: NoticeTheme;\n /** Duration of animation, ms\n * @default 250\n */\n duration?: number;\n locale?: string;\n };\n\n/** @deprecated */\nexport interface INoticeLabelProps extends NoticeLabelProps, UnknownProperties {}\nexport type NoticeLabelProps = BoxProps & {\n theme?: NoticeTheme;\n};\n\n/** @deprecated */\nexport interface INoticeContext extends NoticeContext, UnknownProperties {}\nexport type NoticeContext = {\n getLabelProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface INoticeSmartProps extends NoticeSmartProps, UnknownProperties {}\nexport type NoticeSmartProps = NoticeProps & {\n /**\n * A custom element for additional information\n */\n label?: React.ReactNode;\n /**\n * Custom action element\n */\n actions?: React.ReactNode;\n /**\n * Adds a Close icon\n */\n closable?: boolean;\n /**\n * Callback on a click on the close button\n */\n onClose?: (event: React.SyntheticEvent) => void;\n};\n\ndeclare const Notice: Intergalactic.Component<'div', NoticeProps, NoticeContext> & {\n Label: Intergalactic.Component<'div', NoticeLabelProps>;\n Actions: typeof Box;\n Content: typeof Box;\n /**\n * @deprecated Use Notice.Close instead of Notice.CloseIcon\n */\n CloseIcon: Intergalactic.Component<'div', IconProps>;\n Close: typeof Button;\n};\n\ndeclare const NoticeSmart: Intergalactic.Component<'div', NoticeSmartProps>;\n\nexport { NoticeSmart };\nexport default Notice;\n"],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
2
2
  import { Box, BoxProps } from '@semcore/flex-box';
3
3
  import Button from '@semcore/button';
4
+ import { IconProps } from '@semcore/icon';
4
5
  import { FadeInOutProps } from '@semcore/animation';
5
6
 
6
7
  export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | 'muted';
@@ -65,7 +66,11 @@ declare const Notice: Intergalactic.Component<'div', NoticeProps, NoticeContext>
65
66
  Label: Intergalactic.Component<'div', NoticeLabelProps>;
66
67
  Actions: typeof Box;
67
68
  Content: typeof Box;
68
- CloseIcon: typeof Button;
69
+ /**
70
+ * @deprecated Use Notice.Close instead of Notice.CloseIcon
71
+ */
72
+ CloseIcon: Intergalactic.Component<'div', IconProps>;
73
+ Close: typeof Button;
69
74
  };
70
75
 
71
76
  declare const NoticeSmart: Intergalactic.Component<'div', NoticeSmartProps>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/notice",
3
3
  "description": "Semrush Notice Component",
4
- "version": "5.39.0-prerelease.0",
4
+ "version": "5.39.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",