@dev-crew-berlin/enter-js-utils 0.41.1 → 0.41.3

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.
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  declare type Props<Segment extends string> = {
3
3
  segments: Segment[];
4
4
  activeSegment?: Segment;
5
+ colors?: string[];
5
6
  onChange: (segment: Segment) => void;
6
7
  onFocus?: () => void;
7
8
  };
@@ -5,7 +5,7 @@ export const SegmentedControl = props => {
5
5
  const name = props.segments.join('');
6
6
  return /*#__PURE__*/React.createElement("div", {
7
7
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]]) + " " + 'segmented-controll'
8
- }, props.segments.map(segment => /*#__PURE__*/React.createElement("div", {
8
+ }, props.segments.map((segment, index) => /*#__PURE__*/React.createElement("div", {
9
9
  key: segment,
10
10
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]]) + " " + 'segment'
11
11
  }, /*#__PURE__*/React.createElement("input", {
@@ -18,6 +18,9 @@ export const SegmentedControl = props => {
18
18
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]])
19
19
  }), /*#__PURE__*/React.createElement("label", {
20
20
  htmlFor: segment,
21
+ style: props.colors && {
22
+ backgroundColor: props.colors[index] && segment === props.activeSegment ? props.colors[index] : undefined
23
+ },
21
24
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]])
22
25
  }, segment))), /*#__PURE__*/React.createElement(_JSXStyle, {
23
26
  id: "235524868",
@@ -3,6 +3,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
3
  declare const _default: ComponentMeta<(<Segment extends string>(props: {
4
4
  segments: Segment[];
5
5
  activeSegment?: Segment | undefined;
6
+ colors?: string[] | undefined;
6
7
  onChange: (segment: Segment) => void;
7
8
  onFocus?: (() => void) | undefined;
8
9
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
@@ -10,6 +11,7 @@ export default _default;
10
11
  export declare const Basic: ComponentStory<(<Segment extends string>(props: {
11
12
  segments: Segment[];
12
13
  activeSegment?: Segment | undefined;
14
+ colors?: string[] | undefined;
13
15
  onChange: (segment: Segment) => void;
14
16
  onFocus?: (() => void) | undefined;
15
17
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
@@ -9,12 +9,14 @@ export const CaretIcon = ({
9
9
  width: "100%",
10
10
  height: "100%",
11
11
  viewBox: "0 0 16 16",
12
- transform: `rotate(${rotateDeg})`,
13
12
  fill: color
13
+ }, /*#__PURE__*/React.createElement("g", {
14
+ transform: `rotate(${rotateDeg})`,
15
+ "transform-origin": "center"
14
16
  }, /*#__PURE__*/React.createElement("path", {
15
17
  color: color,
16
18
  fillRule: "evenodd",
17
19
  transform: "translate(0,0)",
18
20
  d: "M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"
19
- }));
21
+ })));
20
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.41.1",
3
+ "version": "0.41.3",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",