@team-monolith/cds 1.3.2 → 1.3.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.
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
13
  /** @jsxImportSource @emotion/react */
14
+ import styled from "@emotion/styled";
14
15
  import { css } from "@emotion/react";
15
16
  import React, { useContext } from "react";
16
17
  import { SegmentedControlGroupPropsContext } from "./SegmentedControlGroupPropsContext";
@@ -29,10 +30,22 @@ export const SegmentedControlButton = React.forwardRef(function SegmentedControl
29
30
  const isActive = context.multiSelect
30
31
  ? context.value.includes(props.value)
31
32
  : context.value === props.value;
32
- return (_jsx(Button, Object.assign({ css: css `
33
- display: flex;
34
- justify-content: center;
35
- flex-grow: 1;
36
- ${isActive && `box-shadow: ${shadows.shadow04};`}
37
- ` }, other, { ref: ref, color: isActive ? "white" : "textNeutral", size: context.size, onClick: handleClick })));
33
+ return (_jsx(StyledButton, Object.assign({}, other, { ref: ref, isActive: isActive, color: isActive ? "white" : "textNeutral", size: context.size, onClick: handleClick })));
38
34
  });
35
+ const StyledButton = styled(Button, {
36
+ shouldForwardProp: (prop) => prop !== "isActive",
37
+ })(({ theme, isActive }) => css `
38
+ display: flex;
39
+ justify-content: center;
40
+ flex-grow: 1;
41
+ ${isActive &&
42
+ `
43
+ box-shadow: ${shadows.shadow04};
44
+ svg {
45
+ color: ${theme.color.foreground.primary};
46
+ }
47
+ span {
48
+ font-weight: 700;
49
+ }
50
+ `}
51
+ `);
@@ -1,5 +1,5 @@
1
- import { SquareButtonProps } from "../..";
2
1
  import React from "react";
2
+ import { SquareButtonProps } from "../..";
3
3
  export interface SegmentedControlSquareButtonProps extends Omit<SquareButtonProps, "color" | "size"> {
4
4
  value: string;
5
5
  }
@@ -1,33 +1,51 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
13
  /** @jsxImportSource @emotion/react */
3
14
  import styled from "@emotion/styled";
4
- import { useContext } from "react";
15
+ import { css } from "@emotion/react";
16
+ import React, { useContext } from "react";
5
17
  import { shadows, SquareButton } from "../..";
6
18
  import { SegmentedControlGroupPropsContext } from "./SegmentedControlGroupPropsContext";
7
- import React from "react";
8
19
  /**
9
20
  * [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?node-id=181%3A89883)
10
21
  */
11
22
  export const SegmentedControlSquareButton = React.forwardRef(function SegmentedControlSquareButton(props, ref) {
23
+ const { onClick } = props, other = __rest(props, ["onClick"]);
12
24
  const context = useContext(SegmentedControlGroupPropsContext);
25
+ const handleClick = () => {
26
+ var _a;
27
+ (_a = context.onClick) === null || _a === void 0 ? void 0 : _a.call(context, props.value);
28
+ onClick === null || onClick === void 0 ? void 0 : onClick();
29
+ };
13
30
  const isActive = context.multiSelect
14
31
  ? context.value.includes(props.value)
15
32
  : context.value === props.value;
16
- return (_jsx(StyledSquareButton, Object.assign({}, props, { ref: ref, isActive: isActive, color: isActive ? "primary" : "icon", size: context.size, fullWidth: context.fullWidth, onClick: () => {
17
- var _a;
18
- if (context.onClick) {
19
- context.onClick(props.value);
20
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
21
- }
22
- } })));
33
+ return (_jsx(StyledSquareButton, Object.assign({}, other, { ref: ref, isActive: isActive, color: isActive ? "white" : "icon", size: context.size, fullWidth: context.fullWidth, onClick: handleClick })));
23
34
  });
24
35
  const StyledSquareButton = styled(SquareButton, {
25
36
  shouldForwardProp: (prop) => prop !== "isActive",
26
- }) `
27
- display: flex;
28
- justify-content: center;
29
- flex-grow: 1;
30
- button {
31
- ${({ isActive }) => isActive && `box-shadow: ${shadows.shadow04};`}
32
- }
33
- `;
37
+ })(({ theme, isActive }) => css `
38
+ display: flex;
39
+ justify-content: center;
40
+ flex-grow: 1;
41
+ ${isActive &&
42
+ `
43
+ box-shadow: ${shadows.shadow04};
44
+ svg {
45
+ color: ${theme.color.foreground.primary};
46
+ }
47
+ span {
48
+ font-weight: 700;
49
+ }
50
+ `}
51
+ `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,