@semcore/notice 16.0.0-prerelease.6 → 16.0.0-prerelease.9
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/CHANGELOG.md +4 -0
- package/lib/cjs/Notice.js +2 -1
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/es6/Notice.js +2 -1
- package/lib/es6/Notice.js.map +1 -1
- package/lib/esm/Notice.mjs +163 -130
- package/lib/esm/NoticeSmart.mjs +35 -27
- package/lib/esm/index.mjs +4 -4
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +11 -8
- package/lib/esm/translations/en.json.mjs +11 -8
- package/lib/esm/translations/es.json.mjs +11 -8
- package/lib/esm/translations/fr.json.mjs +11 -8
- package/lib/esm/translations/it.json.mjs +11 -8
- package/lib/esm/translations/ja.json.mjs +11 -8
- package/lib/esm/translations/ko.json.mjs +11 -8
- package/lib/esm/translations/nl.json.mjs +11 -8
- package/lib/esm/translations/pl.json.mjs +11 -8
- package/lib/esm/translations/pt.json.mjs +11 -8
- package/lib/esm/translations/sv.json.mjs +11 -8
- package/lib/esm/translations/tr.json.mjs +11 -8
- package/lib/esm/translations/vi.json.mjs +11 -8
- package/lib/esm/translations/zh.json.mjs +11 -8
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,10 @@ CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangel
|
|
|
10
10
|
|
|
11
11
|
## [5.45.1] - 2025-03-20
|
|
12
12
|
|
|
13
|
+
### Removed
|
|
14
|
+
|
|
15
|
+
- `role` attribute for `muted` theme.
|
|
16
|
+
|
|
13
17
|
### Changed
|
|
14
18
|
|
|
15
19
|
- Version patch update due to children dependencies update (`@semcore/animation` [2.41.0 ~> 2.41.1], `@semcore/utils` [4.48.0 ~> 4.48.1], `@semcore/button` [5.42.0 ~> 5.42.1], `@semcore/flex-box` [5.41.0 ~> 5.41.1], `@semcore/icon` [4.60.0 ~> 4.60.1], `@semcore/core` [2.39.0 ~> 2.39.1]).
|
package/lib/cjs/Notice.js
CHANGED
|
@@ -123,11 +123,12 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
123
123
|
if (theme === 'muted') {
|
|
124
124
|
ariaLabel = undefined;
|
|
125
125
|
}
|
|
126
|
+
var role = theme === 'muted' ? undefined : 'region';
|
|
126
127
|
return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNotice, _ref9.cn("SNotice", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
127
128
|
"visible": !hidden,
|
|
128
129
|
"use:theme": useTheme,
|
|
129
130
|
"backgroundColor": color,
|
|
130
|
-
"role":
|
|
131
|
+
"role": role,
|
|
131
132
|
"aria-label": ariaLabel,
|
|
132
133
|
"ref": this.ref
|
|
133
134
|
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref9.cn("Children", {})));
|
package/lib/cjs/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notice.js","names":["_core","require","_react","_interopRequireDefault","_flexBox","_button","_m","_resolveColorEnhance","_animation","_logger","_noticeGlobal","_intergalacticDynamicLocales","_i18nEnhance","_useCssVariable","_typography","style","sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","_createClass2","key","value","componentDidMount","ref","current","process","env","NODE_ENV","props","hasTitle","node","hasAttribute","logger","warn","displayName","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref9","SNotice","FadeInOut","_this$asProps2","Children","styles","hidden","use","color","useTheme","createElement","ariaLabel","undefined","cn","_objectSpread2","assignProps","Component","i18nEnhance","localizedMessages","cssVariableEnhance","variable","fallback","map","Number","parseInt","prop","resolveColorEnhance","i18n","locale","Label","_ref17","_ref2","arguments[0]","_ref10","SLabel","Box","Title","_ref18","_ref3","_ref11","STitle","Text","NoticeText","_ref19","_ref4","_ref12","SText","Actions","_ref20","_ref5","_ref13","SActions","Content","_ref21","_ref6","_ref14","SContent","CloseIcon","_ref22","_ref7","_ref15","SCloseIcon","CloseIconM","Close","_ref23","_ref8","_ref16","Button","Notice","createComponent","_default","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/core/lib/utils/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/core/lib/utils/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport { Text } from '@semcore/typography';\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 ref = React.createRef();\n\n componentDidMount() {\n if (\n this.ref.current &&\n process.env.NODE_ENV !== 'production' &&\n !['muted', 'danger'].includes(this.props.theme)\n ) {\n const hasTitle = (node) => {\n if (node.hasAttribute('aria-label')) return true;\n if (node.hasAttribute('aria-labelledby')) return true;\n if (node.hasAttribute('title')) return true;\n\n return false;\n };\n\n logger.warn(\n !hasTitle(this.ref.current),\n `Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification`,\n this.props['data-ui-name'] || RootNotice.displayName,\n );\n }\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 color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\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 let ariaLabel = getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification');\n\n if (theme === 'muted') {\n ariaLabel = undefined;\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-label={ariaLabel}\n ref={this.ref}\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 Title({ styles }) {\n const STitle = Root;\n return sstyled(styles)(<STitle render={Text} tag='div' size={300} fontWeight={'bold'} />);\n}\n\nfunction NoticeText({ styles }) {\n const SText = Root;\n return sstyled(styles)(<SText render={Text} tag='div' />);\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\nconst Notice = createComponent(RootNotice, {\n Label,\n Title: Title,\n Text: NoticeText,\n Actions,\n Content,\n CloseIcon,\n Close,\n});\n\nexport default Notice;\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,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;AACA,IAAAa,WAAA,GAAAb,OAAA;AAA2C;AAAA,IAAAc,KAAA,+BAAAf,KAAA,CAAAgB,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI3C,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,I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ireDefault","_flexBox","_button","_m","_resolveColorEnhance","_animation","_logger","_noticeGlobal","_intergalacticDynamicLocales","_i18nEnhance","_useCssVariable","_typography","style","sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","_createClass2","key","value","componentDidMount","ref","current","process","env","NODE_ENV","props","hasTitle","node","hasAttribute","logger","warn","displayName","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref9","SNotice","FadeInOut","_this$asProps2","Children","styles","hidden","use","color","useTheme","createElement","ariaLabel","undefined","role","cn","_objectSpread2","assignProps","Component","i18nEnhance","localizedMessages","cssVariableEnhance","variable","fallback","map","Number","parseInt","prop","resolveColorEnhance","i18n","locale","Label","_ref17","_ref2","arguments[0]","_ref10","SLabel","Box","Title","_ref18","_ref3","_ref11","STitle","Text","NoticeText","_ref19","_ref4","_ref12","SText","Actions","_ref20","_ref5","_ref13","SActions","Content","_ref21","_ref6","_ref14","SContent","CloseIcon","_ref22","_ref7","_ref15","SCloseIcon","CloseIconM","Close","_ref23","_ref8","_ref16","Button","Notice","createComponent","_default","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/core/lib/utils/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/core/lib/utils/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport { Text } from '@semcore/typography';\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 ref = React.createRef();\n\n componentDidMount() {\n if (\n this.ref.current &&\n process.env.NODE_ENV !== 'production' &&\n !['muted', 'danger'].includes(this.props.theme)\n ) {\n const hasTitle = (node) => {\n if (node.hasAttribute('aria-label')) return true;\n if (node.hasAttribute('aria-labelledby')) return true;\n if (node.hasAttribute('title')) return true;\n\n return false;\n };\n\n logger.warn(\n !hasTitle(this.ref.current),\n `Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification`,\n this.props['data-ui-name'] || RootNotice.displayName,\n );\n }\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 color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\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 let ariaLabel = getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification');\n\n if (theme === 'muted') {\n ariaLabel = undefined;\n }\n\n const role = theme === 'muted' ? undefined : 'region';\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role={role}\n aria-label={ariaLabel}\n ref={this.ref}\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 Title({ styles }) {\n const STitle = Root;\n return sstyled(styles)(<STitle render={Text} tag='div' size={300} fontWeight={'bold'} />);\n}\n\nfunction NoticeText({ styles }) {\n const SText = Root;\n return sstyled(styles)(<SText render={Text} tag='div' />);\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\nconst Notice = createComponent(RootNotice, {\n Label,\n Title: Title,\n Text: NoticeText,\n Actions,\n Content,\n CloseIcon,\n Close,\n});\n\nexport default Notice;\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,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,CA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,OAAAD,MAAA,GAAO,IAAArH,aAAO,EAACuD,MAAM,CAAC,eACpBrE,MAAA,YAAA0E,aAAA,CAACoD,UAAU,EAAAK,MAAA,CAAArD,EAAA,mBAAAC,cAAA,qBAAAjF,KAAA,CAAAkF,WAAA;IAAA,aAEE+C,aAAU;IAAA,OACjB,UAAU;IAAA,SACR,OAAO;IAAA,cACDnE,WAAW,CAAC,OAAO;EAAC,GAAAsE,KAAA,IAChC;AAEN;AAEA,IAAMG,MAAM,GAAG,IAAAC,qBAAe,EAACnH,UAAU,EAAE;EACzC2E,KAAK,EAALA,KAAK;EACLO,KAAK,EAAEA,KAAK;EACZK,IAAI,EAAEC,UAAU;EAChBK,OAAO,EAAPA,OAAO;EACPK,OAAO,EAAPA,OAAO;EACPK,SAAS,EAATA,SAAS;EACTM,KAAK,EAALA;AACF,CAAC,CAAC;AAAC,IAAAO,QAAA,GAEYF,MAAM;AAAAG,OAAA,cAAAD,QAAA"}
|
package/lib/es6/Notice.js
CHANGED
|
@@ -125,11 +125,12 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
125
125
|
if (theme === 'muted') {
|
|
126
126
|
ariaLabel = undefined;
|
|
127
127
|
}
|
|
128
|
+
var role = theme === 'muted' ? undefined : 'region';
|
|
128
129
|
return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SNotice, _ref9.cn("SNotice", _objectSpread({}, _assignProps({
|
|
129
130
|
"visible": !hidden,
|
|
130
131
|
"use:theme": useTheme,
|
|
131
132
|
"backgroundColor": color,
|
|
132
|
-
"role":
|
|
133
|
+
"role": role,
|
|
133
134
|
"aria-label": ariaLabel,
|
|
134
135
|
"ref": this.ref
|
|
135
136
|
}, _ref))), /*#__PURE__*/React.createElement(Children, _ref9.cn("Children", {})));
|
package/lib/es6/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notice.js","names":["React","createComponent","Component","sstyled","Root","Box","Button","CloseIconM","resolveColorEnhance","FadeInOut","logger","NoticeGlobal","localizedMessages","i18nEnhance","cssVariableEnhance","Text","style","_sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","_createClass","key","value","componentDidMount","ref","current","process","env","NODE_ENV","props","hasTitle","node","hasAttribute","warn","displayName","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref9","SNotice","_this$asProps2","Children","styles","hidden","use","color","useTheme","createElement","ariaLabel","undefined","cn","_objectSpread","_assignProps","variable","fallback","map","Number","parseInt","prop","i18n","locale","Label","_ref17","_ref2","arguments[0]","_ref10","SLabel","_assignProps2","Title","_ref18","_ref3","_ref11","STitle","_assignProps3","NoticeText","_ref19","_ref4","_ref12","SText","_assignProps4","Actions","_ref20","_ref5","_ref13","SActions","_assignProps5","Content","_ref21","_ref6","_ref14","SContent","_assignProps6","CloseIcon","_ref22","_ref7","_ref15","SCloseIcon","_assignProps7","Close","_ref23","_ref8","_ref16","_assignProps8","Notice"],"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/core/lib/utils/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/core/lib/utils/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport { Text } from '@semcore/typography';\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 ref = React.createRef();\n\n componentDidMount() {\n if (\n this.ref.current &&\n process.env.NODE_ENV !== 'production' &&\n !['muted', 'danger'].includes(this.props.theme)\n ) {\n const hasTitle = (node) => {\n if (node.hasAttribute('aria-label')) return true;\n if (node.hasAttribute('aria-labelledby')) return true;\n if (node.hasAttribute('title')) return true;\n\n return false;\n };\n\n logger.warn(\n !hasTitle(this.ref.current),\n `Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification`,\n this.props['data-ui-name'] || RootNotice.displayName,\n );\n }\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 color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\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 let ariaLabel = getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification');\n\n if (theme === 'muted') {\n ariaLabel = undefined;\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-label={ariaLabel}\n ref={this.ref}\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 Title({ styles }) {\n const STitle = Root;\n return sstyled(styles)(<STitle render={Text} tag='div' size={300} fontWeight={'bold'} />);\n}\n\nfunction NoticeText({ styles }) {\n const SText = Root;\n return sstyled(styles)(<SText render={Text} tag='div' />);\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\nconst Notice = createComponent(RootNotice, {\n Label,\n Title: Title,\n Text: NoticeText,\n Actions,\n Content,\n CloseIcon,\n Close,\n});\n\nexport default Notice;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,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,sDAAsD;AACtF,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,OAAOC,MAAM,MAAM,gCAAgC;AACnD,OAAOC,YAAY,MAAM,wBAAwB;AACjD,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,kBAAk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EAATA,SAAS;EACTM,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeK,MAAM"}
|
|
1
|
+
{"version":3,"file":"Notice.js","names":["React","createComponent","Component","sstyled","Root","Box","Button","CloseIconM","resolveColorEnhance","FadeInOut","logger","NoticeGlobal","localizedMessages","i18nEnhance","cssVariableEnhance","Text","style","_sstyled","insert","isCustomTheme","theme","includes","RootNotice","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","_createClass","key","value","componentDidMount","ref","current","process","env","NODE_ENV","props","hasTitle","node","hasAttribute","warn","displayName","getLabelProps","_this$asProps","asProps","resolveColor","getCloseIconProps","getI18nText","getCloseProps","render","_ref","_ref9","SNotice","_this$asProps2","Children","styles","hidden","use","color","useTheme","createElement","ariaLabel","undefined","role","cn","_objectSpread","_assignProps","variable","fallback","map","Number","parseInt","prop","i18n","locale","Label","_ref17","_ref2","arguments[0]","_ref10","SLabel","_assignProps2","Title","_ref18","_ref3","_ref11","STitle","_assignProps3","NoticeText","_ref19","_ref4","_ref12","SText","_assignProps4","Actions","_ref20","_ref5","_ref13","SActions","_assignProps5","Content","_ref21","_ref6","_ref14","SContent","_assignProps6","CloseIcon","_ref22","_ref7","_ref15","SCloseIcon","_assignProps7","Close","_ref23","_ref8","_ref16","_assignProps8","Notice"],"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/core/lib/utils/enhances/resolveColorEnhance';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/core/lib/utils/logger';\nimport NoticeGlobal from '@semcore/notice-global';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport { Text } from '@semcore/typography';\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 ref = React.createRef();\n\n componentDidMount() {\n if (\n this.ref.current &&\n process.env.NODE_ENV !== 'production' &&\n !['muted', 'danger'].includes(this.props.theme)\n ) {\n const hasTitle = (node) => {\n if (node.hasAttribute('aria-label')) return true;\n if (node.hasAttribute('aria-labelledby')) return true;\n if (node.hasAttribute('title')) return true;\n\n return false;\n };\n\n logger.warn(\n !hasTitle(this.ref.current),\n `Provide unique 'title' or 'aria-label' or 'aria-labelledby' to help identify the type and importance of notification`,\n this.props['data-ui-name'] || RootNotice.displayName,\n );\n }\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 color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\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 let ariaLabel = getI18nText(theme === 'danger' ? 'criticalNotification' : 'notification');\n\n if (theme === 'muted') {\n ariaLabel = undefined;\n }\n\n const role = theme === 'muted' ? undefined : 'region';\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role={role}\n aria-label={ariaLabel}\n ref={this.ref}\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 Title({ styles }) {\n const STitle = Root;\n return sstyled(styles)(<STitle render={Text} tag='div' size={300} fontWeight={'bold'} />);\n}\n\nfunction NoticeText({ styles }) {\n const SText = Root;\n return sstyled(styles)(<SText render={Text} tag='div' />);\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\nconst Notice = createComponent(RootNotice, {\n Label,\n Title: Title,\n Text: NoticeText,\n Actions,\n Content,\n CloseIcon,\n Close,\n});\n\nexport default Notice;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,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,sDAAsD;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OAAO;IAAA,cACDsD,WAAW,CAAC,OAAO;EAAC,GAAAmE,KAAA,IAChC;AAEN;AAEA,IAAMG,MAAM,GAAGlI,eAAe,CAACqB,UAAU,EAAE;EACzCmE,KAAK,EAALA,KAAK;EACLO,KAAK,EAAEA,KAAK;EACZjF,IAAI,EAAEuF,UAAU;EAChBM,OAAO,EAAPA,OAAO;EACPM,OAAO,EAAPA,OAAO;EACPM,SAAS,EAATA,SAAS;EACTM,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeK,MAAM"}
|
package/lib/esm/Notice.mjs
CHANGED
|
@@ -1,181 +1,214 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import { Box
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { FadeInOut
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { localizedMessages
|
|
18
|
-
import
|
|
19
|
-
import { cssVariableEnhance
|
|
20
|
-
import { Text
|
|
21
|
-
var
|
|
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, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { Box } from "@semcore/flex-box";
|
|
11
|
+
import Button from "@semcore/button";
|
|
12
|
+
import CloseIconM from "@semcore/icon/Close/m";
|
|
13
|
+
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
14
|
+
import { FadeInOut } from "@semcore/animation";
|
|
15
|
+
import logger from "@semcore/core/lib/utils/logger";
|
|
16
|
+
import NoticeGlobal from "@semcore/notice-global";
|
|
17
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
18
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
19
|
+
import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
|
|
20
|
+
import { Text } from "@semcore/typography";
|
|
21
|
+
var style = (
|
|
22
22
|
/*__reshadow_css_start__*/
|
|
23
|
-
(
|
|
23
|
+
(sstyled.insert(
|
|
24
24
|
/*__inner_css_start__*/
|
|
25
25
|
".___SNotice_un6cc_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_un6cc_gg_._theme_info_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-info, #e9f7ff);border-color:var(--intergalactic-border-info, #8ecdff)}.___SNotice_un6cc_gg_._theme_info_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_info_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SNotice_un6cc_gg_._theme_danger_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7);border-color:var(--intergalactic-border-critical, #ffaeb5)}.___SNotice_un6cc_gg_._theme_danger_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_danger_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-critical-hover-active, #CC3A42)}}.___SNotice_un6cc_gg_._theme_warning_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-warning, #fff3d9);border-color:var(--intergalactic-border-warning, #ffb26e)}.___SNotice_un6cc_gg_._theme_warning_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_warning_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-warning-hover-active, #CC5024)}}.___SNotice_un6cc_gg_._theme_success_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-success, #dbfee8);border-color:var(--intergalactic-border-success, #59ddaa)}.___SNotice_un6cc_gg_._theme_success_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_success_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-success-hover-active, #037E68)}}.___SNotice_un6cc_gg_._theme_muted_un6cc_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);border-color:var(--intergalactic-border-secondary, #e0e1e9)}.___SLabel_un6cc_gg_._theme_info_un6cc_gg_,.___SNotice_un6cc_gg_._theme_muted_un6cc_gg_ .___SCloseIcon_un6cc_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}@media (hover:hover){.___SNotice_un6cc_gg_._theme_muted_un6cc_gg_ .___SCloseIcon_un6cc_gg_:hover{color:var(--intergalactic-icon-primary-neutral-hover-active, #565861)}}.___SContent_un6cc_gg_{flex:1 1 auto;width:100%}.___SActions_un6cc_gg_{flex-shrink:0;margin-top:var(--intergalactic-spacing-3x, 12px)}.___SLabel_un6cc_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_un6cc_gg_._theme_danger_un6cc_gg_{color:var(--intergalactic-icon-primary-critical, #ff4953)}.___SLabel_un6cc_gg_._theme_warning_un6cc_gg_{color:var(--intergalactic-icon-primary-warning, #ff642d)}.___SLabel_un6cc_gg_._theme_success_un6cc_gg_{color:var(--intergalactic-icon-primary-success, #009f81)}.___SLabel_un6cc_gg_._theme_muted_un6cc_gg_{color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SLabel_un6cc_gg_._theme_custom_un6cc_gg_{color:var(--color_un6cc)}.___SCloseIcon_un6cc_gg_{flex-shrink:0;margin-left:var(--intergalactic-spacing-4x, 16px)}.___SNotice_un6cc_gg_._theme_custom_un6cc_gg_{background-color:var(--backgroundColor_un6cc);border-color:var(--backgroundColor_un6cc)}.___STitle_un6cc_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}.___SText_un6cc_gg_{margin-top:var(--intergalactic-spacing-1x, 4px);margin-bottom:var(--intergalactic-spacing-1x, 4px)}",
|
|
26
26
|
"un6cc_gg_"
|
|
27
27
|
), {
|
|
28
|
-
__SNotice: "___SNotice_un6cc_gg_",
|
|
29
|
-
__SContent: "___SContent_un6cc_gg_",
|
|
30
|
-
__SActions: "___SActions_un6cc_gg_",
|
|
31
|
-
__SLabel: "___SLabel_un6cc_gg_",
|
|
32
|
-
_theme_info: "_theme_info_un6cc_gg_",
|
|
33
|
-
_theme_danger: "_theme_danger_un6cc_gg_",
|
|
34
|
-
_theme_warning: "_theme_warning_un6cc_gg_",
|
|
35
|
-
_theme_success: "_theme_success_un6cc_gg_",
|
|
36
|
-
_theme_muted: "_theme_muted_un6cc_gg_",
|
|
37
|
-
_theme_custom: "_theme_custom_un6cc_gg_",
|
|
28
|
+
"__SNotice": "___SNotice_un6cc_gg_",
|
|
29
|
+
"__SContent": "___SContent_un6cc_gg_",
|
|
30
|
+
"__SActions": "___SActions_un6cc_gg_",
|
|
31
|
+
"__SLabel": "___SLabel_un6cc_gg_",
|
|
32
|
+
"_theme_info": "_theme_info_un6cc_gg_",
|
|
33
|
+
"_theme_danger": "_theme_danger_un6cc_gg_",
|
|
34
|
+
"_theme_warning": "_theme_warning_un6cc_gg_",
|
|
35
|
+
"_theme_success": "_theme_success_un6cc_gg_",
|
|
36
|
+
"_theme_muted": "_theme_muted_un6cc_gg_",
|
|
37
|
+
"_theme_custom": "_theme_custom_un6cc_gg_",
|
|
38
38
|
"--color": "--color_un6cc",
|
|
39
|
-
__SCloseIcon: "___SCloseIcon_un6cc_gg_",
|
|
39
|
+
"__SCloseIcon": "___SCloseIcon_un6cc_gg_",
|
|
40
40
|
"--backgroundColor": "--backgroundColor_un6cc",
|
|
41
|
-
__STitle: "___STitle_un6cc_gg_",
|
|
42
|
-
__SText: "___SText_un6cc_gg_"
|
|
41
|
+
"__STitle": "___STitle_un6cc_gg_",
|
|
42
|
+
"__SText": "___SText_un6cc_gg_"
|
|
43
43
|
})
|
|
44
44
|
);
|
|
45
|
-
function
|
|
46
|
-
return !["danger", "warning", "success", "info", "muted"].includes(
|
|
45
|
+
function isCustomTheme(theme) {
|
|
46
|
+
return !["danger", "warning", "success", "info", "muted"].includes(theme);
|
|
47
47
|
}
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
function
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
for (var
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
var RootNotice = /* @__PURE__ */ function(_Component) {
|
|
49
|
+
_inherits(RootNotice2, _Component);
|
|
50
|
+
var _super = _createSuper(RootNotice2);
|
|
51
|
+
function RootNotice2() {
|
|
52
|
+
var _this;
|
|
53
|
+
_classCallCheck(this, RootNotice2);
|
|
54
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
|
+
args[_key] = arguments[_key];
|
|
56
|
+
}
|
|
57
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "ref", /* @__PURE__ */ React.createRef());
|
|
59
|
+
return _this;
|
|
57
60
|
}
|
|
58
|
-
|
|
61
|
+
_createClass(RootNotice2, [{
|
|
59
62
|
key: "componentDidMount",
|
|
60
|
-
value: function() {
|
|
63
|
+
value: function componentDidMount() {
|
|
61
64
|
if (this.ref.current && process.env.NODE_ENV !== "production" && !["muted", "danger"].includes(this.props.theme)) {
|
|
62
|
-
var
|
|
63
|
-
|
|
65
|
+
var hasTitle = function hasTitle2(node) {
|
|
66
|
+
if (node.hasAttribute("aria-label")) return true;
|
|
67
|
+
if (node.hasAttribute("aria-labelledby")) return true;
|
|
68
|
+
if (node.hasAttribute("title")) return true;
|
|
69
|
+
return false;
|
|
64
70
|
};
|
|
65
|
-
|
|
71
|
+
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);
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
}, {
|
|
69
75
|
key: "getLabelProps",
|
|
70
|
-
value: function() {
|
|
71
|
-
var
|
|
76
|
+
value: function getLabelProps() {
|
|
77
|
+
var _this$asProps = this.asProps, theme = _this$asProps.theme, resolveColor = _this$asProps.resolveColor;
|
|
72
78
|
return {
|
|
73
|
-
theme
|
|
74
|
-
resolveColor
|
|
79
|
+
theme,
|
|
80
|
+
resolveColor
|
|
75
81
|
};
|
|
76
82
|
}
|
|
77
83
|
}, {
|
|
78
84
|
key: "getCloseIconProps",
|
|
79
|
-
value: function() {
|
|
80
|
-
var
|
|
85
|
+
value: function getCloseIconProps() {
|
|
86
|
+
var getI18nText = this.asProps.getI18nText;
|
|
81
87
|
return {
|
|
82
|
-
getI18nText
|
|
88
|
+
getI18nText
|
|
83
89
|
};
|
|
84
90
|
}
|
|
85
91
|
}, {
|
|
86
92
|
key: "getCloseProps",
|
|
87
|
-
value: function() {
|
|
88
|
-
var
|
|
93
|
+
value: function getCloseProps() {
|
|
94
|
+
var getI18nText = this.asProps.getI18nText;
|
|
89
95
|
return {
|
|
90
|
-
getI18nText
|
|
96
|
+
getI18nText
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
99
|
}, {
|
|
94
100
|
key: "render",
|
|
95
|
-
value: function() {
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"use
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
value: function render() {
|
|
102
|
+
var _ref = this.asProps, _ref9;
|
|
103
|
+
var SNotice = FadeInOut;
|
|
104
|
+
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;
|
|
105
|
+
var color = resolveColor(theme);
|
|
106
|
+
var useTheme = isCustomTheme(theme) ? "custom" : theme;
|
|
107
|
+
if (use === "primary") {
|
|
108
|
+
logger.warn(true, 'Deprecated property-value pair "use=primary", use component <NoticeGlobal/> instead', RootNotice2.displayName);
|
|
109
|
+
return /* @__PURE__ */ React.createElement(NoticeGlobal, this.asProps);
|
|
110
|
+
}
|
|
111
|
+
var ariaLabel = getI18nText(theme === "danger" ? "criticalNotification" : "notification");
|
|
112
|
+
if (theme === "muted") {
|
|
113
|
+
ariaLabel = void 0;
|
|
114
|
+
}
|
|
115
|
+
var role = theme === "muted" ? void 0 : "region";
|
|
116
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SNotice, _ref9.cn("SNotice", _objectSpread({}, assignProps({
|
|
117
|
+
"visible": !hidden,
|
|
118
|
+
"use:theme": useTheme,
|
|
119
|
+
"backgroundColor": color,
|
|
120
|
+
"role": role,
|
|
121
|
+
"aria-label": ariaLabel,
|
|
122
|
+
"ref": this.ref
|
|
123
|
+
}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
|
|
108
124
|
}
|
|
109
|
-
}])
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
125
|
+
}]);
|
|
126
|
+
return RootNotice2;
|
|
127
|
+
}(Component);
|
|
128
|
+
_defineProperty(RootNotice, "displayName", "Notice");
|
|
129
|
+
_defineProperty(RootNotice, "style", style);
|
|
130
|
+
_defineProperty(RootNotice, "enhance", [i18nEnhance(localizedMessages), cssVariableEnhance({
|
|
114
131
|
variable: "--intergalactic-duration-popper",
|
|
115
132
|
fallback: "200",
|
|
116
133
|
map: Number.parseInt,
|
|
117
134
|
prop: "duration"
|
|
118
|
-
}),
|
|
119
|
-
|
|
135
|
+
}), resolveColorEnhance()]);
|
|
136
|
+
_defineProperty(RootNotice, "defaultProps", {
|
|
120
137
|
theme: "info",
|
|
121
|
-
i18n:
|
|
138
|
+
i18n: localizedMessages,
|
|
122
139
|
locale: "en"
|
|
123
140
|
});
|
|
124
|
-
function
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
function Label(_ref17) {
|
|
142
|
+
var _ref2 = arguments[0], _ref10;
|
|
143
|
+
var styles = _ref17.styles, theme = _ref17.theme, resolveColor = _ref17.resolveColor;
|
|
144
|
+
var SLabel = Box;
|
|
145
|
+
var useTheme = isCustomTheme(theme) ? "custom" : theme;
|
|
146
|
+
var color = resolveColor(theme);
|
|
147
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SLabel, _ref10.cn("SLabel", _objectSpread({}, assignProps({
|
|
148
|
+
"use:theme": useTheme,
|
|
149
|
+
"color": color
|
|
150
|
+
}, _ref2))));
|
|
130
151
|
}
|
|
131
|
-
function
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
152
|
+
function Title(_ref18) {
|
|
153
|
+
var _ref3 = arguments[0], _ref11;
|
|
154
|
+
var styles = _ref18.styles;
|
|
155
|
+
var STitle = Text;
|
|
156
|
+
return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(STitle, _ref11.cn("STitle", _objectSpread({}, assignProps({
|
|
157
|
+
"tag": "div",
|
|
158
|
+
"size": 300,
|
|
159
|
+
"fontWeight": "bold"
|
|
160
|
+
}, _ref3))));
|
|
138
161
|
}
|
|
139
|
-
function
|
|
140
|
-
var
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
162
|
+
function NoticeText(_ref19) {
|
|
163
|
+
var _ref4 = arguments[0], _ref12;
|
|
164
|
+
var styles = _ref19.styles;
|
|
165
|
+
var SText = Text;
|
|
166
|
+
return _ref12 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref12.cn("SText", _objectSpread({}, assignProps({
|
|
167
|
+
"tag": "div"
|
|
168
|
+
}, _ref4))));
|
|
144
169
|
}
|
|
145
|
-
function
|
|
146
|
-
var
|
|
147
|
-
|
|
170
|
+
function Actions(_ref20) {
|
|
171
|
+
var _ref5 = arguments[0], _ref13;
|
|
172
|
+
var styles = _ref20.styles;
|
|
173
|
+
var SActions = Box;
|
|
174
|
+
return _ref13 = sstyled(styles), /* @__PURE__ */ React.createElement(SActions, _ref13.cn("SActions", _objectSpread({}, assignProps({}, _ref5))));
|
|
148
175
|
}
|
|
149
|
-
function
|
|
150
|
-
var
|
|
151
|
-
|
|
176
|
+
function Content(_ref21) {
|
|
177
|
+
var _ref6 = arguments[0], _ref14;
|
|
178
|
+
var styles = _ref21.styles;
|
|
179
|
+
var SContent = Box;
|
|
180
|
+
return _ref14 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref14.cn("SContent", _objectSpread({}, assignProps({}, _ref6))));
|
|
152
181
|
}
|
|
153
|
-
function
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
|
|
182
|
+
function CloseIcon(_ref22) {
|
|
183
|
+
var _ref7 = arguments[0], _ref15;
|
|
184
|
+
var styles = _ref22.styles, getI18nText = _ref22.getI18nText;
|
|
185
|
+
var SCloseIcon = Box;
|
|
186
|
+
return _ref15 = sstyled(styles), /* @__PURE__ */ React.createElement(SCloseIcon, _ref15.cn("SCloseIcon", _objectSpread({}, assignProps({
|
|
187
|
+
"tag": CloseIconM,
|
|
188
|
+
"interactive": true,
|
|
189
|
+
"aria-label": getI18nText("close")
|
|
190
|
+
}, _ref7))));
|
|
160
191
|
}
|
|
161
|
-
function
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"
|
|
168
|
-
|
|
192
|
+
function Close(_ref23) {
|
|
193
|
+
var _ref8 = arguments[0], _ref16;
|
|
194
|
+
var styles = _ref23.styles, getI18nText = _ref23.getI18nText;
|
|
195
|
+
var SCloseIcon = Button;
|
|
196
|
+
return _ref16 = sstyled(styles), /* @__PURE__ */ React.createElement(SCloseIcon, _ref16.cn("SCloseIcon", _objectSpread({}, assignProps({
|
|
197
|
+
"addonLeft": CloseIconM,
|
|
198
|
+
"use": "tertiary",
|
|
199
|
+
"theme": "muted",
|
|
200
|
+
"aria-label": getI18nText("close")
|
|
201
|
+
}, _ref8))));
|
|
169
202
|
}
|
|
170
|
-
var
|
|
171
|
-
Label
|
|
172
|
-
Title
|
|
173
|
-
Text:
|
|
174
|
-
Actions
|
|
175
|
-
Content
|
|
176
|
-
CloseIcon
|
|
177
|
-
Close
|
|
203
|
+
var Notice = createComponent(RootNotice, {
|
|
204
|
+
Label,
|
|
205
|
+
Title,
|
|
206
|
+
Text: NoticeText,
|
|
207
|
+
Actions,
|
|
208
|
+
Content,
|
|
209
|
+
CloseIcon,
|
|
210
|
+
Close
|
|
178
211
|
});
|
|
179
212
|
export {
|
|
180
|
-
|
|
213
|
+
Notice as default
|
|
181
214
|
};
|
package/lib/esm/NoticeSmart.mjs
CHANGED
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { createComponent
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
|
|
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/core/lib/utils/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
|
-
|
|
17
|
+
_createClass(NoticeSmart2, [{
|
|
17
18
|
key: "render",
|
|
18
|
-
value: function() {
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
}])
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
}]);
|
|
34
|
+
return NoticeSmart2;
|
|
35
|
+
}(Component);
|
|
36
|
+
_defineProperty(NoticeSmart, "displayName", "NoticeSmart");
|
|
37
|
+
_defineProperty(NoticeSmart, "defaultProps", {
|
|
30
38
|
theme: "info"
|
|
31
39
|
});
|
|
32
|
-
const
|
|
40
|
+
const NoticeSmart$1 = createComponent(NoticeSmart);
|
|
33
41
|
export {
|
|
34
|
-
|
|
42
|
+
NoticeSmart$1 as default
|
|
35
43
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
1
|
+
import Notice from "./Notice.mjs";
|
|
2
|
+
import { default as default2 } from "./NoticeSmart.mjs";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
default2 as NoticeSmart,
|
|
5
|
+
Notice as default
|
|
6
6
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
var
|
|
16
|
-
de
|
|
17
|
-
en
|
|
18
|
-
es
|
|
19
|
-
fr
|
|
20
|
-
it
|
|
21
|
-
ja
|
|
22
|
-
ko
|
|
23
|
-
nl
|
|
24
|
-
pt
|
|
25
|
-
tr
|
|
26
|
-
vi
|
|
27
|
-
zh
|
|
28
|
-
pl
|
|
29
|
-
sv
|
|
1
|
+
import de from "./de.json.mjs";
|
|
2
|
+
import en from "./en.json.mjs";
|
|
3
|
+
import es from "./es.json.mjs";
|
|
4
|
+
import fr from "./fr.json.mjs";
|
|
5
|
+
import it from "./it.json.mjs";
|
|
6
|
+
import ja from "./ja.json.mjs";
|
|
7
|
+
import ko from "./ko.json.mjs";
|
|
8
|
+
import nl from "./nl.json.mjs";
|
|
9
|
+
import pt from "./pt.json.mjs";
|
|
10
|
+
import tr from "./tr.json.mjs";
|
|
11
|
+
import vi from "./vi.json.mjs";
|
|
12
|
+
import zh from "./zh.json.mjs";
|
|
13
|
+
import pl from "./pl.json.mjs";
|
|
14
|
+
import sv from "./sv.json.mjs";
|
|
15
|
+
var localizedMessages = {
|
|
16
|
+
de,
|
|
17
|
+
en,
|
|
18
|
+
es,
|
|
19
|
+
fr,
|
|
20
|
+
it,
|
|
21
|
+
ja,
|
|
22
|
+
ko,
|
|
23
|
+
nl,
|
|
24
|
+
pt,
|
|
25
|
+
tr,
|
|
26
|
+
vi,
|
|
27
|
+
zh,
|
|
28
|
+
pl,
|
|
29
|
+
sv
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
localizedMessages
|
|
33
33
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Benachrichtigung";
|
|
2
|
+
const criticalNotification = "Kritische Benachrichtigung";
|
|
3
|
+
const close = "Benachrichtigung schließen";
|
|
4
|
+
const de = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
de as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Notification";
|
|
2
|
+
const criticalNotification = "Critical notification";
|
|
3
|
+
const close = "Close notification";
|
|
4
|
+
const en = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
en as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Notificación";
|
|
2
|
+
const criticalNotification = "Notificación crítica";
|
|
3
|
+
const close = "Cerrar notificación";
|
|
4
|
+
const es = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
es as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Notification";
|
|
2
|
+
const criticalNotification = "Notification critique";
|
|
3
|
+
const close = "Fermer la notification";
|
|
4
|
+
const fr = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
fr as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Notifica";
|
|
2
|
+
const criticalNotification = "Notifica critica";
|
|
3
|
+
const close = "Chiudi la notifica";
|
|
4
|
+
const it = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
it as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "通知";
|
|
2
|
+
const criticalNotification = "重要な通知";
|
|
3
|
+
const close = "通知を閉じる";
|
|
4
|
+
const ja = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
ja as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "알림";
|
|
2
|
+
const criticalNotification = "중요 알림";
|
|
3
|
+
const close = "알림 닫기";
|
|
4
|
+
const ko = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
ko as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Melding";
|
|
2
|
+
const criticalNotification = "Belangrijke melding";
|
|
3
|
+
const close = "Kennisgeving sluiten";
|
|
4
|
+
const nl = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
nl as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Powiadomienie";
|
|
2
|
+
const criticalNotification = "Powiadomienie krytyczne";
|
|
3
|
+
const close = "Zamknij powiadomienie";
|
|
4
|
+
const pl = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
pl as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Notificação";
|
|
2
|
+
const criticalNotification = "Notificação urgente";
|
|
3
|
+
const close = "Fechar notificação";
|
|
4
|
+
const pt = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
pt as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Avisering";
|
|
2
|
+
const criticalNotification = "Kritisk avisering";
|
|
3
|
+
const close = "Stäng meddelande";
|
|
4
|
+
const sv = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
sv as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Bildirim";
|
|
2
|
+
const criticalNotification = "Kritik bildirim";
|
|
3
|
+
const close = "Bildirimi kapat";
|
|
4
|
+
const tr = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
tr as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "Thông báo";
|
|
2
|
+
const criticalNotification = "Thông báo quan trọng";
|
|
3
|
+
const close = "Đóng thông báo";
|
|
4
|
+
const vi = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
vi as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const notification = "通知";
|
|
2
|
+
const criticalNotification = "重要通知";
|
|
3
|
+
const close = "关闭通知";
|
|
4
|
+
const zh = {
|
|
5
|
+
notification,
|
|
6
|
+
criticalNotification,
|
|
7
|
+
close
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
close,
|
|
11
|
+
criticalNotification,
|
|
12
|
+
zh as default,
|
|
13
|
+
notification
|
|
11
14
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/notice",
|
|
3
3
|
"description": "Semrush Notice Component",
|
|
4
|
-
"version": "16.0.0-prerelease.
|
|
4
|
+
"version": "16.0.0-prerelease.9",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/button": "16.0.0-prerelease.
|
|
18
|
-
"@semcore/icon": "16.0.0-prerelease.
|
|
19
|
-
"@semcore/notice-global": "16.0.0-prerelease.
|
|
20
|
-
"@semcore/animation": "16.0.0-prerelease.
|
|
21
|
-
"@semcore/flex-box": "16.0.0-prerelease.
|
|
22
|
-
"@semcore/typography": "16.0.0-prerelease.
|
|
17
|
+
"@semcore/button": "16.0.0-prerelease.9",
|
|
18
|
+
"@semcore/icon": "16.0.0-prerelease.9",
|
|
19
|
+
"@semcore/notice-global": "16.0.0-prerelease.9",
|
|
20
|
+
"@semcore/animation": "16.0.0-prerelease.9",
|
|
21
|
+
"@semcore/flex-box": "16.0.0-prerelease.9",
|
|
22
|
+
"@semcore/typography": "16.0.0-prerelease.9"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@semcore/base-components": "^16.0.0-prerelease.
|
|
25
|
+
"@semcore/base-components": "^16.0.0-prerelease.9"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|