@pushwoosh/dumb-components 2.5.0 → 2.6.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.
Files changed (43) hide show
  1. package/Banner/Banner.js +0 -1
  2. package/Banner/styles.d.ts +1 -3
  3. package/Banner/styles.js +3 -5
  4. package/Chip/Chip.d.ts +3 -0
  5. package/Chip/Chip.js +30 -7
  6. package/Chip/Chip.types.d.ts +4 -2
  7. package/Chip/__tests__/Chip.test.d.ts +1 -0
  8. package/Chip/__tests__/Chip.test.js +101 -0
  9. package/Chip/polyglot/index.d.ts +3 -0
  10. package/Chip/polyglot/index.js +33 -0
  11. package/Chip/polyglot/messages_ar.d.ts +3 -0
  12. package/Chip/polyglot/messages_ar.js +3 -0
  13. package/Chip/polyglot/messages_bn.d.ts +3 -0
  14. package/Chip/polyglot/messages_bn.js +3 -0
  15. package/Chip/polyglot/messages_de.d.ts +3 -0
  16. package/Chip/polyglot/messages_de.js +3 -0
  17. package/Chip/polyglot/messages_en.d.ts +3 -0
  18. package/Chip/polyglot/messages_en.js +3 -0
  19. package/Chip/polyglot/messages_es.d.ts +3 -0
  20. package/Chip/polyglot/messages_es.js +3 -0
  21. package/Chip/polyglot/messages_fr.d.ts +3 -0
  22. package/Chip/polyglot/messages_fr.js +3 -0
  23. package/Chip/polyglot/messages_he.d.ts +3 -0
  24. package/Chip/polyglot/messages_he.js +3 -0
  25. package/Chip/polyglot/messages_hi.d.ts +3 -0
  26. package/Chip/polyglot/messages_hi.js +3 -0
  27. package/Chip/polyglot/messages_ja.d.ts +3 -0
  28. package/Chip/polyglot/messages_ja.js +3 -0
  29. package/Chip/polyglot/messages_ko.d.ts +3 -0
  30. package/Chip/polyglot/messages_ko.js +3 -0
  31. package/Chip/polyglot/messages_pt.d.ts +3 -0
  32. package/Chip/polyglot/messages_pt.js +3 -0
  33. package/Chip/polyglot/messages_ru.d.ts +3 -0
  34. package/Chip/polyglot/messages_ru.js +3 -0
  35. package/Chip/polyglot/messages_th.d.ts +3 -0
  36. package/Chip/polyglot/messages_th.js +3 -0
  37. package/Chip/polyglot/messages_zh.d.ts +3 -0
  38. package/Chip/polyglot/messages_zh.js +3 -0
  39. package/Chip/polyglot/types.d.ts +4 -0
  40. package/Chip/polyglot/types.js +1 -0
  41. package/Chip/styles.d.ts +3 -1
  42. package/Chip/styles.js +22 -12
  43. package/package.json +1 -1
package/Banner/Banner.js CHANGED
@@ -80,7 +80,6 @@ export function Banner(props) {
80
80
  view: "filled"
81
81
  })
82
82
  }), _jsxs(BannerContent, {
83
- "$hasTitleAndChildren": hasTitle && hasChildren,
84
83
  children: [hasTitle && _jsx(H4, {
85
84
  children: title
86
85
  }), hasChildren && _jsx("div", {
@@ -11,9 +11,7 @@ export declare const BannerBox: import("styled-components").StyledComponent<"div
11
11
  $isOpen?: boolean;
12
12
  $isLoading: boolean;
13
13
  }, never>;
14
- export declare const BannerContent: import("styled-components").StyledComponent<"div", any, {
15
- $hasTitleAndChildren?: boolean;
16
- }, never>;
14
+ export declare const BannerContent: import("styled-components").StyledComponent<"div", any, {}, never>;
17
15
  export declare const IconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
18
16
  export declare const BannerShape: import("styled-components").StyledComponent<"div", any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
19
17
  $isOpen?: boolean;
package/Banner/styles.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import styled from 'styled-components';
2
- import { ShapeRadius, FontWeight } from '@pushwoosh/kit-constants';
2
+ import { FontSize, FontWeight, LineHeight, ShapeRadius } from '@pushwoosh/kit-constants';
3
3
  import { colors } from './colors';
4
4
  export const BannerSpinner = styled.div.withConfig({
5
5
  displayName: "BannerSpinner",
@@ -8,7 +8,7 @@ export const BannerSpinner = styled.div.withConfig({
8
8
  export const ActionButton = styled.button.withConfig({
9
9
  displayName: "ActionButton",
10
10
  componentId: "sc-9uu4ap-1"
11
- })(["appearance:none !important;border:none;background:initial;cursor:pointer;padding:6px;position:relative;font-weight:", ";white-space:nowrap;height:fit-content;> span{visibility:", ";}opacity:", ";"], FontWeight.BOLD, ({
11
+ })(["appearance:none !important;border:none;background:initial;cursor:pointer;padding:6px;position:relative;font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;white-space:nowrap;height:fit-content;> span{visibility:", ";}opacity:", ";"], FontSize.SMALL, LineHeight.SMALL, FontWeight.BOLD, ({
12
12
  $isLoading
13
13
  }) => $isLoading ? 'hidden' : 'visible', ({
14
14
  $isPressed,
@@ -27,9 +27,7 @@ export const BannerBox = styled.div.withConfig({
27
27
  export const BannerContent = styled.div.withConfig({
28
28
  displayName: "BannerContent",
29
29
  componentId: "sc-9uu4ap-4"
30
- })(["flex-grow:1;padding:", ";color:", ";"], ({
31
- $hasTitleAndChildren
32
- }) => $hasTitleAndChildren ? '16px' : '8px 16px', colors.error.shape.base.color);
30
+ })(["flex-grow:1;padding:12px 16px;color:", ";"], colors.error.shape.base.color);
33
31
  export const IconContainer = styled.div.withConfig({
34
32
  displayName: "IconContainer",
35
33
  componentId: "sc-9uu4ap-5"
package/Chip/Chip.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Compact tag/filter pill with color variants, an optional leading icon, a close
3
3
  * button or a help tooltip, and ellipsis truncation via `$maxWidth`.
4
+ * With `onClick` and no `$onClose` it renders as a toggle `<button aria-pressed>`.
4
5
  *
5
6
  * @example
6
7
  * <Chip $variant="primary" $onClose={() => remove(tag)}>{tag}</Chip>
8
+ * <Chip $selected={active} onClick={toggle}>{label}</Chip>
7
9
  */
8
10
  export declare const Chip: import("react").ForwardRefExoticComponent<{
9
11
  $variant?: import("./Chip.types").ChipVariant;
@@ -13,6 +15,7 @@ export declare const Chip: import("react").ForwardRefExoticComponent<{
13
15
  $maxWidth?: string;
14
16
  $icon?: import("react").ReactNode;
15
17
  $tooltip?: import("react").ReactNode;
18
+ disabled?: boolean;
16
19
  as?: string;
17
20
  } & {
18
21
  children?: import("react").ReactNode | undefined;
package/Chip/Chip.js CHANGED
@@ -1,13 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { TooltipTrigger } from '../Tooltip';
4
- import { ChipCloseIcon, ChipLabel, ChipSlotIcon, ChipStyled } from './styles';
4
+ import { useLang } from './polyglot';
5
+ import { ChipCloseButton, ChipCloseIcon, ChipLabel, ChipSlotIcon, ChipStyled } from './styles';
5
6
  /**
6
7
  * Compact tag/filter pill with color variants, an optional leading icon, a close
7
8
  * button or a help tooltip, and ellipsis truncation via `$maxWidth`.
9
+ * With `onClick` and no `$onClose` it renders as a toggle `<button aria-pressed>`.
8
10
  *
9
11
  * @example
10
12
  * <Chip $variant="primary" $onClose={() => remove(tag)}>{tag}</Chip>
13
+ * <Chip $selected={active} onClick={toggle}>{label}</Chip>
11
14
  */
12
15
  export const Chip = forwardRef(({
13
16
  $variant = 'primary',
@@ -17,12 +20,21 @@ export const Chip = forwardRef(({
17
20
  $maxWidth,
18
21
  $icon,
19
22
  $tooltip,
23
+ disabled,
20
24
  children,
21
25
  as,
22
26
  ...rest
23
27
  }, ref) => {
28
+ const lang = useLang();
24
29
  const isCloseable = !!$onClose && !$readOnly;
25
30
  const hasTooltip = !isCloseable && $tooltip !== undefined;
31
+ const element = as ?? (rest.onClick && !$onClose && !$readOnly ? 'button' : undefined);
32
+ const isButton = element === 'button';
33
+ const buttonProps = isButton ? {
34
+ type: 'button',
35
+ 'aria-pressed': !!$selected,
36
+ disabled
37
+ } : {};
26
38
  if ($readOnly && $onClose) {
27
39
  console.error('[Chip]: $onClose is ignored when $readOnly is true — read-only chips have no close button.');
28
40
  }
@@ -32,19 +44,30 @@ export const Chip = forwardRef(({
32
44
  "$selected": $selected,
33
45
  "$hasLeadingIcon": !!$icon,
34
46
  "$hasTrailingSlot": isCloseable || hasTooltip,
35
- "$readOnly": $readOnly,
47
+ "$muted": $readOnly || isButton && disabled,
48
+ "$interactive": isButton && !disabled,
36
49
  "$maxWidth": $maxWidth,
37
- as: as,
50
+ as: element,
51
+ ...buttonProps,
38
52
  ...rest,
39
53
  children: [$icon && _jsx(ChipSlotIcon, {
40
54
  children: $icon
41
55
  }), _jsx(ChipLabel, {
42
56
  "$truncated": $maxWidth !== undefined,
43
57
  children: children
44
- }), isCloseable && _jsx(ChipCloseIcon, {
45
- size: "small",
46
- onClick: $onClose,
47
- forwardedAs: "span"
58
+ }), isCloseable && _jsx(ChipCloseButton, {
59
+ type: "button",
60
+ "aria-label": lang({
61
+ message: 'DUMB.CHIP.REMOVE'
62
+ }),
63
+ onClick: event => {
64
+ event.stopPropagation();
65
+ $onClose(event);
66
+ },
67
+ children: _jsx(ChipCloseIcon, {
68
+ size: "small",
69
+ forwardedAs: "span"
70
+ })
48
71
  }), hasTooltip && _jsx(ChipSlotIcon, {
49
72
  children: _jsx(TooltipTrigger, {
50
73
  view: "question",
@@ -1,7 +1,7 @@
1
1
  import { type HTMLAttributes, type PropsWithChildren, type ReactNode } from 'react';
2
2
  /** Color variant of a {@link Chip}. */
3
3
  export type ChipVariant = 'primary' | 'danger' | 'warning';
4
- /** Props of {@link Chip} — all `<div>` attributes plus the chip-specific ones. */
4
+ /** Props of {@link Chip} — all `<div>` attributes plus the chip-specific ones; `onClick` without `$onClose` makes it a toggle button. */
5
5
  export type ChipProps = PropsWithChildren<{
6
6
  /** Color variant (default `primary`). */
7
7
  $variant?: ChipVariant;
@@ -17,6 +17,8 @@ export type ChipProps = PropsWithChildren<{
17
17
  $icon?: ReactNode;
18
18
  /** Help tooltip shown via a trailing question-mark icon (only when not closeable). */
19
19
  $tooltip?: ReactNode;
20
- /** Render as a different element/tag. */
20
+ /** Disables an interactive chip: passed to the `<button>`, muted like `$readOnly`. */
21
+ disabled?: boolean;
22
+ /** Render as a different element/tag; `button` gives the same result as the automatic interactive mode. */
21
23
  as?: string;
22
24
  }> & HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,101 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { fireEvent, render, screen } from '@testing-library/react';
3
+ import { Chip } from '../Chip';
4
+ describe('Chip', () => {
5
+ it('renders a passive chip as a div without a button role', () => {
6
+ const {
7
+ container
8
+ } = render(_jsx(Chip, {
9
+ children: "Tag"
10
+ }));
11
+ expect(container.firstChild?.nodeName).toBe('DIV');
12
+ expect(screen.queryByRole('button')).toBeNull();
13
+ });
14
+ it('renders a chip with onClick as a toggle button reflecting $selected', () => {
15
+ const onClick = jest.fn();
16
+ const {
17
+ rerender
18
+ } = render(_jsx(Chip, {
19
+ onClick: onClick,
20
+ children: "All"
21
+ }));
22
+ const chip = screen.getByRole('button', {
23
+ name: 'All'
24
+ });
25
+ expect(chip).toHaveAttribute('type', 'button');
26
+ expect(chip).toHaveAttribute('aria-pressed', 'false');
27
+ fireEvent.click(chip);
28
+ expect(onClick).toHaveBeenCalledTimes(1);
29
+ rerender(_jsx(Chip, {
30
+ onClick: onClick,
31
+ "$selected": true,
32
+ children: "All"
33
+ }));
34
+ expect(screen.getByRole('button', {
35
+ name: 'All'
36
+ })).toHaveAttribute('aria-pressed', 'true');
37
+ });
38
+ it('passes disabled to the button and blocks clicks', () => {
39
+ const onClick = jest.fn();
40
+ render(_jsx(Chip, {
41
+ onClick: onClick,
42
+ disabled: true,
43
+ children: "All"
44
+ }));
45
+ const chip = screen.getByRole('button', {
46
+ name: 'All'
47
+ });
48
+ expect(chip).toBeDisabled();
49
+ fireEvent.click(chip);
50
+ expect(onClick).not.toHaveBeenCalled();
51
+ });
52
+ it('keeps a closeable chip a div and exposes only the close button', () => {
53
+ const onClose = jest.fn();
54
+ const {
55
+ container
56
+ } = render(_jsx(Chip, {
57
+ onClick: () => {},
58
+ "$onClose": onClose,
59
+ children: "Tag"
60
+ }));
61
+ expect(container.firstChild?.nodeName).toBe('DIV');
62
+ const buttons = screen.getAllByRole('button');
63
+ expect(buttons).toHaveLength(1);
64
+ expect(buttons[0]).toHaveAccessibleName('Remove');
65
+ fireEvent.click(buttons[0]);
66
+ expect(onClose).toHaveBeenCalledTimes(1);
67
+ });
68
+ it('does not bubble a close click to the chip onClick', () => {
69
+ const onClick = jest.fn();
70
+ const onClose = jest.fn();
71
+ render(_jsx(Chip, {
72
+ onClick: onClick,
73
+ "$onClose": onClose,
74
+ children: "Tag"
75
+ }));
76
+ fireEvent.click(screen.getByRole('button', {
77
+ name: 'Remove'
78
+ }));
79
+ expect(onClose).toHaveBeenCalledTimes(1);
80
+ expect(onClick).not.toHaveBeenCalled();
81
+ });
82
+ it('treats explicit as="button" like the automatic interactive mode', () => {
83
+ render(_jsx(Chip, {
84
+ as: "button",
85
+ children: "Tag"
86
+ }));
87
+ const chip = screen.getByRole('button', {
88
+ name: 'Tag'
89
+ });
90
+ expect(chip).toHaveAttribute('type', 'button');
91
+ expect(chip).toHaveAttribute('aria-pressed', 'false');
92
+ });
93
+ it('does not become a button when read-only', () => {
94
+ render(_jsx(Chip, {
95
+ onClick: () => {},
96
+ "$readOnly": true,
97
+ children: "Tag"
98
+ }));
99
+ expect(screen.queryByRole('button')).toBeNull();
100
+ });
101
+ });
@@ -0,0 +1,3 @@
1
+ export declare const useLang: () => (props: {
2
+ message: "DUMB.CHIP.REMOVE";
3
+ } & import("../../polyglot").NoParams) => string;
@@ -0,0 +1,33 @@
1
+ import { messages as ar } from './messages_ar';
2
+ import { messages as bn } from './messages_bn';
3
+ import { messages as de } from './messages_de';
4
+ import { messages as en } from './messages_en';
5
+ import { messages as es } from './messages_es';
6
+ import { messages as fr } from './messages_fr';
7
+ import { messages as he } from './messages_he';
8
+ import { messages as hi } from './messages_hi';
9
+ import { messages as ja } from './messages_ja';
10
+ import { messages as ko } from './messages_ko';
11
+ import { messages as pt } from './messages_pt';
12
+ import { messages as ru } from './messages_ru';
13
+ import { messages as th } from './messages_th';
14
+ import { messages as zh } from './messages_zh';
15
+ import { createLang } from '../../polyglot';
16
+ export const {
17
+ useLang
18
+ } = createLang({
19
+ ar,
20
+ bn,
21
+ de,
22
+ en,
23
+ es,
24
+ fr,
25
+ he,
26
+ hi,
27
+ ja,
28
+ ko,
29
+ pt,
30
+ ru,
31
+ th,
32
+ zh
33
+ });
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'إزالة'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'সরান'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'Entfernen'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'Remove'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'Eliminar'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'Supprimer'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'הסרה'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'हटाएँ'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': '削除'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': '제거'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'Remover'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'Удалить'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': 'ลบ'
3
+ };
@@ -0,0 +1,3 @@
1
+ import { type ChipMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<ChipMessages>;
@@ -0,0 +1,3 @@
1
+ export const messages = {
2
+ 'DUMB.CHIP.REMOVE': '移除'
3
+ };
@@ -0,0 +1,4 @@
1
+ import type { NoParams } from '../../polyglot';
2
+ export type ChipMessages = {
3
+ 'DUMB.CHIP.REMOVE': NoParams;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
package/Chip/styles.d.ts CHANGED
@@ -4,11 +4,13 @@ export declare const ChipStyled: import("styled-components").StyledComponent<"di
4
4
  $selected?: boolean;
5
5
  $hasLeadingIcon?: boolean;
6
6
  $hasTrailingSlot?: boolean;
7
- $readOnly?: boolean;
7
+ $muted?: boolean;
8
+ $interactive?: boolean;
8
9
  $maxWidth?: string;
9
10
  }, never>;
10
11
  export declare const ChipSlotIcon: import("styled-components").StyledComponent<"span", any, {}, never>;
11
12
  export declare const ChipLabel: import("styled-components").StyledComponent<"span", any, {
12
13
  $truncated?: boolean;
13
14
  }, never>;
15
+ export declare const ChipCloseButton: import("styled-components").StyledComponent<"button", any, {}, never>;
14
16
  export declare const ChipCloseIcon: import("styled-components").StyledComponent<import("react").FC<import("@pushwoosh/kit-icons").CloseIconProps>, any, {}, never>;
package/Chip/styles.js CHANGED
@@ -2,45 +2,51 @@ import styled from 'styled-components';
2
2
  import { Color } from '@pushwoosh/kit-constants';
3
3
  import { CloseIcon } from '@pushwoosh/kit-icons';
4
4
  import { variants } from './Chip.constants';
5
+ const focusRing = `
6
+ &:focus-visible {
7
+ outline: 1px solid ${Color.BRIGHT};
8
+ outline-offset: 2px;
9
+ }
10
+ `;
5
11
  export const ChipStyled = styled.div.withConfig({
6
12
  displayName: "ChipStyled",
7
13
  componentId: "sc-e2g39l-0"
8
- })(["display:inline-flex;min-height:24px;", " padding:0 ", " 0 ", ";align-items:center;gap:4px;cursor:", ";border-radius:4px;color:", ";background:", ";font-weight:400;line-height:140%;", ""], ({
14
+ })(["appearance:none;margin:0;border:0;font:inherit;text-align:inherit;display:inline-flex;min-height:24px;", " padding:0 ", " 0 ", ";align-items:center;gap:4px;cursor:", ";border-radius:4px;color:", ";background:", ";font-weight:400;line-height:140%;", " ", ""], ({
9
15
  $maxWidth
10
16
  }) => $maxWidth !== undefined && `max-width: ${$maxWidth};`, ({
11
17
  $hasTrailingSlot
12
18
  }) => $hasTrailingSlot ? '4px' : '8px', ({
13
19
  $hasLeadingIcon
14
20
  }) => $hasLeadingIcon ? '4px' : '8px', ({
15
- $readOnly
16
- }) => $readOnly ? 'default' : 'pointer', ({
21
+ $interactive
22
+ }) => $interactive ? 'pointer' : 'default', ({
17
23
  $variant,
18
24
  $selected,
19
- $readOnly
25
+ $muted
20
26
  }) => {
21
- if ($readOnly) {
27
+ if ($muted) {
22
28
  return Color.MAIN;
23
29
  }
24
30
  return $selected ? Color.CLEAR : variants[$variant].color;
25
31
  }, ({
26
32
  $variant,
27
33
  $selected,
28
- $readOnly
34
+ $muted
29
35
  }) => {
30
- if ($readOnly) {
36
+ if ($muted) {
31
37
  return Color.SOFT_LIGHT;
32
38
  }
33
39
  return $selected ? Color.MAIN : variants[$variant].background;
34
40
  }, ({
35
41
  $variant,
36
42
  $selected,
37
- $readOnly
38
- }) => !$selected && !$readOnly && `
43
+ $muted
44
+ }) => !$selected && !$muted && `
39
45
  &:hover {
40
46
  color: ${variants[$variant].hoverColor};
41
47
  background: ${variants[$variant].hoverBackground};
42
48
  }
43
- `);
49
+ `, focusRing);
44
50
  export const ChipSlotIcon = styled.span.withConfig({
45
51
  displayName: "ChipSlotIcon",
46
52
  componentId: "sc-e2g39l-1"
@@ -57,7 +63,11 @@ export const ChipLabel = styled.span.withConfig({
57
63
  text-overflow: ellipsis;
58
64
  white-space: nowrap;
59
65
  `);
66
+ export const ChipCloseButton = styled.button.withConfig({
67
+ displayName: "ChipCloseButton",
68
+ componentId: "sc-e2g39l-3"
69
+ })(["appearance:none;display:inline-flex;flex-shrink:0;margin:0;padding:0;border:0;border-radius:2px;background:none;color:inherit;cursor:pointer;", ""], focusRing);
60
70
  export const ChipCloseIcon = styled(CloseIcon).withConfig({
61
71
  displayName: "ChipCloseIcon",
62
- componentId: "sc-e2g39l-3"
63
- })(["flex-shrink:0;transition:transform 0.2s;&:hover{transform:scale(1.3);}"]);
72
+ componentId: "sc-e2g39l-4"
73
+ })(["transition:transform 0.2s;", ":hover &{transform:scale(1.3);}"], ChipCloseButton);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",