@amboss/design-system 3.39.0 → 3.39.2
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/build/cjs/components/Content/ContentPictogramButton/ContentPictogramButton.d.ts +3 -1
- package/build/cjs/components/Content/ContentPictogramButton/ContentPictogramButton.js +1 -1
- package/build/cjs/components/Form/FormErrorMessages/FormErrorMessages.js +1 -1
- package/build/cjs/shared/intl/translations/de.json +3 -0
- package/build/cjs/shared/intl/translations/en.json +3 -0
- package/build/cjs/shared/intl/useIntl.d.ts +8 -0
- package/build/cjs/shared/intl/useIntl.js +1 -0
- package/build/esm/components/Content/ContentPictogramButton/ContentPictogramButton.d.ts +3 -1
- package/build/esm/components/Content/ContentPictogramButton/ContentPictogramButton.js +1 -1
- package/build/esm/components/Form/FormErrorMessages/FormErrorMessages.js +1 -1
- package/build/esm/shared/intl/translations/de.json +3 -0
- package/build/esm/shared/intl/translations/en.json +3 -0
- package/build/esm/shared/intl/useIntl.d.ts +8 -0
- package/build/esm/shared/intl/useIntl.js +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { PolymorphicComponentPropsWithRef } from "src/types";
|
|
2
3
|
import { type PictogramButtonProps } from "../../PictogramButton/PictogramButton";
|
|
3
4
|
import type { ContentColor } from "../types";
|
|
4
5
|
type ContentPictogramButtonProps = Omit<PictogramButtonProps, "ariaAttributes"> & {
|
|
@@ -6,5 +7,6 @@ type ContentPictogramButtonProps = Omit<PictogramButtonProps, "ariaAttributes">
|
|
|
6
7
|
"aria-labelledby"?: string;
|
|
7
8
|
iconColor?: ContentColor;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
type ContentPictogramButtonComponent = <C extends React.ElementType = "button">(props: PolymorphicComponentPropsWithRef<C, ContentPictogramButtonProps>) => React.ReactNode | null;
|
|
11
|
+
export declare const ContentPictogramButton: ContentPictogramButtonComponent;
|
|
10
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ContentPictogramButton",{enumerable:!0,get:function(){return ContentPictogramButton}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/_interop_require_default._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_PictogramButton=require("../../PictogramButton/PictogramButton"),_isContentColor=require("../utils/isContentColor"),StyledPictogramComponent=(0,_styled.default)(_PictogramButton.PictogramButton,{target:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ContentPictogramButton",{enumerable:!0,get:function(){return ContentPictogramButton}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=/*#__PURE__*/_interop_require_default._(require("react")),_styled=/*#__PURE__*/_interop_require_default._(require("@emotion/styled")),_PictogramButton=require("../../PictogramButton/PictogramButton"),_isContentColor=require("../utils/isContentColor"),StyledPictogramComponent=(0,_styled.default)(_PictogramButton.PictogramButton,{target:"e1m34zvw0",label:"StyledPictogramComponent"})(({theme,iconColor,disabled})=>({...iconColor&&{color:theme.values.color.content.icon[iconColor].default,...!disabled&&{"&:active":{color:theme.values.color.content.icon[iconColor].hover}}}}),"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjL2NvbXBvbmVudHMvQ29udGVudC9Db250ZW50UGljdG9ncmFtQnV0dG9uL0NvbnRlbnRQaWN0b2dyYW1CdXR0b24udHN4Iiwic291cmNlcyI6WyJzcmMvY29tcG9uZW50cy9Db250ZW50L0NvbnRlbnRQaWN0b2dyYW1CdXR0b24vQ29udGVudFBpY3RvZ3JhbUJ1dHRvbi50c3giXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gXCJyZWFjdFwiO1xuaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24v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kNvbG9yIDogdW5kZWZpbmVkO1xuICAgICAgcmV0dXJuIChcbiAgICAgICAgPFN0eWxlZFBpY3RvZ3JhbUNvbXBvbmVudFxuICAgICAgICAgIHsuLi5yZXN0fVxuICAgICAgICAgIHJlZj17cmVmfVxuICAgICAgICAgIGljb249e2ljb259XG4gICAgICAgICAgaWNvbkNvbG9yPXtjb250ZW50Q29sb3J9XG4gICAgICAgICAgZGlzYWJsZWQ9e2Rpc2FibGVkfVxuICAgICAgICAgIHNpemU9e3NpemV9XG4gICAgICAgICAgdmFyaWFudD17dmFyaWFudH1cbiAgICAgICAgLz5cbiAgICAgICk7XG4gICAgfVxuICApO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTJCaUMifQ== */"),ContentPictogramButton=_react.default.forwardRef(({icon,iconColor,disabled=!1,size="xs",variant="quaternary",...rest},ref)=>{let contentColor=(0,_isContentColor.isContentColor)(iconColor)?iconColor:void 0;return _react.default.createElement(StyledPictogramComponent,{...rest,ref:ref,icon:icon,iconColor:contentColor,disabled:disabled,size:size,variant:variant})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"FormErrorMessages",{enumerable:!0,get:function(){return FormErrorMessages}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_Stack=require("../../Stack/Stack"),_Icon=require("../../Icon/Icon"),_Box=require("../../Box/Box"),_Inline=require("../../Inline/Inline"),_Text=require("../../Typography/Text/Text");function FormErrorMessages({messages=[],"data-e2e-test-id":dataE2eTestId}){return _react.default.createElement(_Box.Box,{space:"zero",tSpace:"xxs",role:"alert","aria-atomic":"true"},_react.default.createElement(_Stack.Stack,{"data-e2e-test-id":dataE2eTestId,"data-ds-id":"FormErrorMessages",space:"xxs"},messages.map(message=>_react.default.createElement(_Inline.Inline,{key:message,noWrap:!0},_react.default.createElement(_Box.Box,{space:"zero",tSpace:"xxxs"},_react.default.createElement(_Icon.Icon,{size:"s",color:"error",name:"alert-triangle"})),_react.default.createElement(_Text.Text,{size:"s",color:"error"},message)))))}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"FormErrorMessages",{enumerable:!0,get:function(){return FormErrorMessages}});const _react=/*#__PURE__*/require("@swc/helpers/_/_interop_require_default")._(require("react")),_Stack=require("../../Stack/Stack"),_Icon=require("../../Icon/Icon"),_Box=require("../../Box/Box"),_Inline=require("../../Inline/Inline"),_Text=require("../../Typography/Text/Text"),_useIntl=require("../../../shared/intl/useIntl");function FormErrorMessages({messages=[],"data-e2e-test-id":dataE2eTestId}){let{formatMessage}=(0,_useIntl.useIntl)();return _react.default.createElement(_Box.Box,{space:"zero",tSpace:"xxs",role:"alert","aria-atomic":"true"},_react.default.createElement(_Stack.Stack,{"data-e2e-test-id":dataE2eTestId,"data-ds-id":"FormErrorMessages",space:"xxs"},messages.map(message=>_react.default.createElement(_Inline.Inline,{key:message,noWrap:!0},_react.default.createElement(_Box.Box,{space:"zero",tSpace:"xxxs"},_react.default.createElement(_Icon.Icon,{size:"s",color:"error",name:"alert-triangle","aria-label":formatMessage("FormField.ErrorIcon.AriaLabel")})),_react.default.createElement(_Text.Text,{size:"s",color:"error"},message)))))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useIntl",{enumerable:!0,get:function(){return useIntl}});const _interop_require_default=require("@swc/helpers/_/_interop_require_default"),_react=require("react"),_useWindow=require("../useWindow"),_dejson=/*#__PURE__*/_interop_require_default._(require("./translations/de.json")),_enjson=/*#__PURE__*/_interop_require_default._(require("./translations/en.json"));function useIntl(){let window=(0,_useWindow.useWindow)(),translations="de"===window?.__AMBOSS_CONFIG__?.URL_LOCALE_PREFIX?_dejson.default:_enjson.default;return(0,_react.useMemo)(()=>({formatMessage:id=>translations[id]}),[translations])}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { PolymorphicComponentPropsWithRef } from "src/types";
|
|
2
3
|
import { type PictogramButtonProps } from "../../PictogramButton/PictogramButton";
|
|
3
4
|
import type { ContentColor } from "../types";
|
|
4
5
|
type ContentPictogramButtonProps = Omit<PictogramButtonProps, "ariaAttributes"> & {
|
|
@@ -6,5 +7,6 @@ type ContentPictogramButtonProps = Omit<PictogramButtonProps, "ariaAttributes">
|
|
|
6
7
|
"aria-labelledby"?: string;
|
|
7
8
|
iconColor?: ContentColor;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
type ContentPictogramButtonComponent = <C extends React.ElementType = "button">(props: PolymorphicComponentPropsWithRef<C, ContentPictogramButtonProps>) => React.ReactNode | null;
|
|
11
|
+
export declare const ContentPictogramButton: ContentPictogramButtonComponent;
|
|
10
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from"react";import styled from"@emotion/styled";import{PictogramButton}from"../../PictogramButton/PictogramButton";import{isContentColor}from"../utils/isContentColor";let StyledPictogramComponent=styled(PictogramButton,{target:"
|
|
1
|
+
import React from"react";import styled from"@emotion/styled";import{PictogramButton}from"../../PictogramButton/PictogramButton";import{isContentColor}from"../utils/isContentColor";let StyledPictogramComponent=styled(PictogramButton,{target:"e1m34zvw0",label:"StyledPictogramComponent"})(({theme,iconColor,disabled})=>({...iconColor&&{color:theme.values.color.content.icon[iconColor].default,...!disabled&&{"&:active":{color:theme.values.color.content.icon[iconColor].hover}}}}),"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3JjL2NvbXBvbmVudHMvQ29udGVudC9Db250ZW50UGljdG9ncmFtQnV0dG9uL0NvbnRlbnRQaWN0b2dyYW1CdXR0b24udHN4Iiwic291cmNlcyI6WyJzcmMvY29tcG9uZW50cy9Db250ZW50L0NvbnRlbnRQaWN0b2dyYW1CdXR0b24vQ29udGVudFBpY3RvZ3JhbUJ1dHRvbi50c3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6IFJlYWN0LlJlYWN0RWxlbWVudCA9PiB7XG4gICAgICBjb25zdCBjb250ZW50Q29sb3IgPSBpc0NvbnRlbnRDb2xvcihpY29uQ29sb3IpID8gaWNvbkNvbG9yIDogdW5kZWZpbmVkO1xuICAgICAgcmV0dXJuIChcbiAgICAgICAgPFN0eWxlZFBpY3RvZ3JhbUNvbXBvbmVudFxuICAgICAgICAgIHsuLi5yZXN0fVxuICAgICAgICAgIHJlZj17cmVmfVxuICAgICAgICAgIGljb249e2ljb259XG4gICAgICAgICAgaWNvbkNvbG9yPXtjb250ZW50Q29sb3J9XG4gICAgICAgICAgZGlzYWJsZWQ9e2Rpc2FibGVkfVxuICAgICAgICAgIHNpemU9e3NpemV9XG4gICAgICAgICAgdmFyaWFudD17dmFyaWFudH1cbiAgICAgICAgLz5cbiAgICAgICk7XG4gICAgfVxuICApO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTJCaUMifQ== */");export const ContentPictogramButton=React.forwardRef(({icon,iconColor,disabled=!1,size="xs",variant="quaternary",...rest},ref)=>{let contentColor=isContentColor(iconColor)?iconColor:void 0;return React.createElement(StyledPictogramComponent,{...rest,ref:ref,icon:icon,iconColor:contentColor,disabled:disabled,size:size,variant:variant})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from"react";import{Stack}from"../../Stack/Stack";import{Icon}from"../../Icon/Icon";import{Box}from"../../Box/Box";import{Inline}from"../../Inline/Inline";import{Text}from"../../Typography/Text/Text";export function FormErrorMessages({messages=[],"data-e2e-test-id":dataE2eTestId}){return React.createElement(Box,{space:"zero",tSpace:"xxs",role:"alert","aria-atomic":"true"},React.createElement(Stack,{"data-e2e-test-id":dataE2eTestId,"data-ds-id":"FormErrorMessages",space:"xxs"},messages.map(message=>React.createElement(Inline,{key:message,noWrap:!0},React.createElement(Box,{space:"zero",tSpace:"xxxs"},React.createElement(Icon,{size:"s",color:"error",name:"alert-triangle"})),React.createElement(Text,{size:"s",color:"error"},message)))))}
|
|
1
|
+
import React from"react";import{Stack}from"../../Stack/Stack";import{Icon}from"../../Icon/Icon";import{Box}from"../../Box/Box";import{Inline}from"../../Inline/Inline";import{Text}from"../../Typography/Text/Text";import{useIntl}from"../../../shared/intl/useIntl";export function FormErrorMessages({messages=[],"data-e2e-test-id":dataE2eTestId}){let{formatMessage}=useIntl();return React.createElement(Box,{space:"zero",tSpace:"xxs",role:"alert","aria-atomic":"true"},React.createElement(Stack,{"data-e2e-test-id":dataE2eTestId,"data-ds-id":"FormErrorMessages",space:"xxs"},messages.map(message=>React.createElement(Inline,{key:message,noWrap:!0},React.createElement(Box,{space:"zero",tSpace:"xxxs"},React.createElement(Icon,{size:"s",color:"error",name:"alert-triangle","aria-label":formatMessage("FormField.ErrorIcon.AriaLabel")})),React.createElement(Text,{size:"s",color:"error"},message)))))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo}from"react";import{useWindow}from"../useWindow";import de from"./translations/de.json";import en from"./translations/en.json";export function useIntl(){let window=useWindow(),translations="de"===window?.__AMBOSS_CONFIG__?.URL_LOCALE_PREFIX?de:en;return useMemo(()=>({formatMessage:id=>translations[id]}),[translations])}
|