@dev-crew-berlin/enter-js-utils 0.10.5 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- export * from './result';
2
- export * as theme from './theme';
3
- export * from './not-undefined';
4
1
  export * from './api-result';
5
2
  export * from './class-names';
3
+ export * from './not-undefined';
4
+ export * from './result';
5
+ export * as theme from './theme';
6
+ export * from './translate';
package/dist/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ export * from './api-result';
2
+ export * from './class-names';
3
+ export * from './not-undefined';
1
4
  export * from './result';
2
5
  export * as theme from './theme';
3
- export * from './not-undefined';
4
- export * from './api-result';
5
- export * from './class-names';
6
+ export * from './translate';
@@ -0,0 +1,2 @@
1
+ import { ReactNode } from 'react';
2
+ export declare function translate<T extends string | ReactNode>(text: string | Record<string, T>, language?: string): T;
@@ -0,0 +1,6 @@
1
+ export function translate(text, language) {
2
+ if (typeof text === 'string') return text;
3
+ const firstValue = text[Object.keys(text)[0]];
4
+ if (language === undefined) return firstValue;
5
+ return text[language] ?? firstValue;
6
+ }
@@ -9,7 +9,7 @@ export const EnterLogo = props => {
9
9
  viewBox: "0 0 96 108"
10
10
  }, /*#__PURE__*/React.createElement("g", {
11
11
  fill: "none",
12
- "fill-rule": "nonzero"
12
+ fillRule: "nonzero"
13
13
  }, /*#__PURE__*/React.createElement("path", {
14
14
  fill: "transparent",
15
15
  d: "M0 23.668C0 10.596 10.594 0 23.669 0h48.662C85.403 0 96 10.602 96 23.668v60.664C96 97.404 85.406 108 72.331 108H0V23.668Z"
@@ -3,7 +3,7 @@ declare type Props<Segment extends string> = {
3
3
  segments: Segment[];
4
4
  activeSegment?: Segment;
5
5
  onChange: (segment: Segment) => void;
6
- onFocus: () => void;
6
+ onFocus?: () => void;
7
7
  };
8
8
  export declare const SegmentedControl: <Segment extends string>(props: Props<Segment>) => ReactElement;
9
9
  export {};
@@ -4,12 +4,12 @@ declare const _default: ComponentMeta<(<Segment extends string>(props: {
4
4
  segments: Segment[];
5
5
  activeSegment?: Segment | undefined;
6
6
  onChange: (segment: Segment) => void;
7
- onFocus: () => void;
7
+ onFocus?: (() => void) | undefined;
8
8
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
9
9
  export default _default;
10
10
  export declare const Basic: ComponentStory<(<Segment extends string>(props: {
11
11
  segments: Segment[];
12
12
  activeSegment?: Segment | undefined;
13
13
  onChange: (segment: Segment) => void;
14
- onFocus: () => void;
14
+ onFocus?: (() => void) | undefined;
15
15
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.10.5",
3
+ "version": "0.11.0",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",