@fibery/ui-kit 1.33.0 → 1.33.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/ui-kit",
3
- "version": "1.33.0",
3
+ "version": "1.33.1",
4
4
  "private": false,
5
5
  "files": [
6
6
  "src/antd/styles.ts",
@@ -73,8 +73,8 @@
73
73
  "screenfull": "6.0.1",
74
74
  "ua-parser-js": "0.7.24",
75
75
  "@fibery/emoji-data": "2.6.0",
76
- "@fibery/react": "1.4.0",
77
- "@fibery/helpers": "1.3.0"
76
+ "@fibery/helpers": "1.3.0",
77
+ "@fibery/react": "1.4.0"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "react": "^18.2.0",
@@ -1,7 +1,6 @@
1
+ import {DropdownMenuContentProps} from "@radix-ui/react-dropdown-menu";
1
2
  import {ReactNode} from "react";
2
3
  import {ContentProps} from "../dropdown-menu";
3
- import {LinariaClassName} from "@linaria/core";
4
- import {DropdownMenuContentProps} from "@radix-ui/react-dropdown-menu";
5
4
 
6
5
  export type ActionsMenuProps = {
7
6
  /** Clicking on this node will open actions menu. Make sure that trigger forwards ref AND props to html element */
@@ -16,12 +15,13 @@ export type ActionsMenuProps = {
16
15
  open?: boolean;
17
16
  /** Event handler called when the open state of the ActionsMenu changes. */
18
17
  onOpenChange?: (state: boolean) => unknown;
19
- contentStyles?: LinariaClassName;
18
+ contentStyles?: string;
20
19
  modal?: boolean;
21
20
  alignOffset?: number;
22
21
  side?: ContentProps["side"];
23
22
  sideOffset?: number;
24
23
  collisionPadding?: number;
25
24
  autoFocusOnClose?: boolean;
25
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
26
26
  sticky?: DropdownMenuContentProps["sticky"];
27
27
  };
@@ -2,7 +2,7 @@ import {composeEventHandlers} from "@fibery/react/src/compose-event-handlers";
2
2
  import {createContext} from "@fibery/react/src/create-context";
3
3
  import {stopPropagation} from "@fibery/react/src/stop-propagation";
4
4
  import {css, cx} from "@linaria/core";
5
- import React, {RefObject, useEffect, useMemo, useRef, useState} from "react";
5
+ import React, {FunctionComponent, RefObject, useEffect, useMemo, useRef, useState} from "react";
6
6
  import {
7
7
  CommandMenuEmpty,
8
8
  CommandMenuGroup,
@@ -13,6 +13,8 @@ import {
13
13
  } from "../command-menu";
14
14
  import {ActionsMenuSubMenu} from "./actions-menu-sub-menu";
15
15
  import {useActionsMenuContext} from "./contexts/actions-menu-context";
16
+ // eslint-disable-next-line no-restricted-imports
17
+ import {IconBaseProps} from "@fibery/ui-kit/src/icons/types";
16
18
 
17
19
  const [ActionsMenuSubCommandMenuProvider, useActionsMenuSubCommandMenuCtx] = createContext<{
18
20
  subMenuOpenRef: RefObject<boolean>;
@@ -22,8 +24,14 @@ const [ActionsMenuSubCommandMenuProvider, useActionsMenuSubCommandMenuCtx] = cre
22
24
  type ActionsMenuSubCommandMenuProps = React.PropsWithChildren<{
23
25
  trigger?: React.ReactNode;
24
26
  disabled?: boolean;
27
+ Icon?: FunctionComponent<IconBaseProps>;
25
28
  }>;
26
- export const ActionsMenuSubCommandMenu: React.FC<ActionsMenuSubCommandMenuProps> = ({disabled, trigger, children}) => {
29
+ export const ActionsMenuSubCommandMenu: React.FC<ActionsMenuSubCommandMenuProps> = ({
30
+ disabled,
31
+ trigger,
32
+ children,
33
+ Icon,
34
+ }) => {
27
35
  const [open, onOpenChange] = useState(false);
28
36
  const triggerRef = useRef(null);
29
37
  const openRef = useRef(false);
@@ -45,6 +53,7 @@ export const ActionsMenuSubCommandMenu: React.FC<ActionsMenuSubCommandMenuProps>
45
53
  onOpenChange(v);
46
54
  }}
47
55
  trigger={trigger}
56
+ Icon={Icon}
48
57
  triggerRef={triggerRef}
49
58
  contentClassName={css`
50
59
  &:is(&) {
@@ -1,9 +1,11 @@
1
1
  import {stopPropagation} from "@fibery/react/src/stop-propagation";
2
2
  import {css} from "@linaria/core";
3
- import {ReactNode} from "react";
3
+ import {FunctionComponent, ReactNode} from "react";
4
4
  import {space, themeVars} from "../../src/design-system";
5
5
  import ArrowRight from "../icons/react/ArrowRight";
6
6
  import {useActionsMenuContext} from "./contexts/actions-menu-context";
7
+ // eslint-disable-next-line no-restricted-imports
8
+ import {IconBaseProps} from "@fibery/ui-kit/src/icons/types";
7
9
 
8
10
  const subTriggerClass = css`
9
11
  display: flex;
@@ -24,8 +26,27 @@ type Props = React.PropsWithChildren<{
24
26
  disabled?: boolean;
25
27
  contentClassName?: string;
26
28
  container?: HTMLElement | null;
29
+ Icon?: FunctionComponent<IconBaseProps>;
27
30
  }>;
28
31
 
32
+ const cornerCss = css`
33
+ display: flex;
34
+ align-items: center;
35
+ column-gap: ${space.s12}px;
36
+ `;
37
+
38
+ const LeftCorner = ({Icon}: {Icon: FunctionComponent<IconBaseProps> | void}) => {
39
+ return Icon ? (
40
+ <div className={cornerCss}>
41
+ <Icon color={`var(--actions-menu-item-icon-color, ${themeVars.iconColor})`} iconSize={18} />
42
+ </div>
43
+ ) : null;
44
+ };
45
+
46
+ const contentStyle = css`
47
+ flex: 1;
48
+ `;
49
+
29
50
  export const ActionsMenuSubMenu: React.FC<Props> = ({
30
51
  open,
31
52
  onOpenChange,
@@ -34,6 +55,7 @@ export const ActionsMenuSubMenu: React.FC<Props> = ({
34
55
  children,
35
56
  disabled = false,
36
57
  contentClassName,
58
+ Icon,
37
59
  }) => {
38
60
  const {MenuPrimitive, container} = useActionsMenuContext();
39
61
 
@@ -45,7 +67,8 @@ export const ActionsMenuSubMenu: React.FC<Props> = ({
45
67
  disabled={disabled}
46
68
  onClick={stopPropagation}
47
69
  >
48
- {trigger}
70
+ <LeftCorner Icon={Icon} />
71
+ <div className={contentStyle}>{trigger}</div>
49
72
  <div className={arrowClass}>
50
73
  <ArrowRight
51
74
  color={disabled ? themeVars.disabledTextColor : themeVars.iconColor}
@@ -27,6 +27,7 @@ export const ActionsMenu = ({
27
27
  collisionPadding,
28
28
  open,
29
29
  onOpenChange,
30
+ onEscapeKeyDown,
30
31
  children,
31
32
  portalled,
32
33
  container,
@@ -66,6 +67,7 @@ export const ActionsMenu = ({
66
67
  portalled={portalled}
67
68
  container={container}
68
69
  collisionPadding={collisionPadding}
70
+ onEscapeKeyDown={onEscapeKeyDown}
69
71
  onCloseAutoFocus={autoFocusOnClose ? undefined : preventDefault}
70
72
  >
71
73
  <ActionsMenuDangerousRowsProvider open={isOpen}>{children}</ActionsMenuDangerousRowsProvider>
@@ -552,7 +552,7 @@ export const themeColors = {
552
552
  // outline
553
553
  colorBorderButtonOutlineAccentDefault: [indigo.indigo8, indigoDark.indigo8],
554
554
  colorBorderButtonOutlineNeutralDefault: [slate.slate8, slateDark.slate8],
555
- colorBorderButtonOutlineDestructiveDefault: [red.red11, redDark.red11],
555
+ colorBorderButtonOutlineDestructiveDefault: [red.red7, redDark.red7],
556
556
  colorBgButtonOutlineAccentDefault: [whiteA.whiteA0, slateDark.slate1],
557
557
  colorBgButtonOutlineAccentHover: [indigo.indigo3, indigoDark.indigo8],
558
558
  colorBgButtonOutlineNeutralDefault: [whiteA.whiteA0, slateDark.slate1],
@@ -0,0 +1,8 @@
1
+
2
+ // This icon file is generated automatically.
3
+
4
+ import { IconDefinition } from '../types';
5
+
6
+ const ItemsTimeline: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"width":20,"height":20,"fill":"none"},"children":[{"type":"element","tagName":"path","properties":{"clipRule":"evenodd","d":"M4.25 4.5a.75.75 0 0 0-.75.75V7c0 .414.336.75.75.75h6.5A.75.75 0 0 0 11.5 7V5.25a.75.75 0 0 0-.75-.75h-6.5ZM2 5.25A2.25 2.25 0 0 1 4.25 3h6.5A2.25 2.25 0 0 1 13 5.25V7a2.25 2.25 0 0 1-2.25 2.25h-6.5A2.25 2.25 0 0 1 2 7V5.25Zm7.25 7a.75.75 0 0 0-.75.75v1.75c0 .414.336.75.75.75h6.5a.75.75 0 0 0 .75-.75V13a.75.75 0 0 0-.75-.75h-6.5ZM7 13a2.25 2.25 0 0 1 2.25-2.25h6.5A2.25 2.25 0 0 1 18 13v1.75A2.25 2.25 0 0 1 15.75 17h-6.5A2.25 2.25 0 0 1 7 14.75V13Z"},"children":[]}],"metadata":""}]},"name":"items-timeline"};
7
+
8
+ export default ItemsTimeline;
@@ -118,6 +118,7 @@ export { default as IntegrationsIntegrationIntercomColor } from './IntegrationsI
118
118
  export { default as IntegrationsIntegrationSlackColor } from './IntegrationsIntegrationSlackColor';
119
119
  export { default as IntegrationsIntegrationZendeskColor } from './IntegrationsIntegrationZendeskColor';
120
120
  export { default as InvitePeople } from './InvitePeople';
121
+ export { default as ItemsTimeline } from './ItemsTimeline';
121
122
  export { default as Items } from './Items';
122
123
  export { default as Jira } from './Jira';
123
124
  export { default as Key } from './Key';
@@ -0,0 +1,13 @@
1
+ // This icon file is generated automatically.
2
+
3
+ import {forwardRef} from 'react';
4
+ import ItemsTimelineSvg from '../ast/ItemsTimeline';
5
+ import { Icon } from '../Icon';
6
+ import { IconBaseProps } from '../types';
7
+
8
+ const ItemsTimeline = forwardRef<SVGSVGElement, IconBaseProps>(function ItemsTimeline(
9
+ props: IconBaseProps,
10
+ ref: React.Ref<SVGSVGElement>
11
+ ) {return <Icon {...props} className={props.className} ref={ref} icon={ItemsTimelineSvg} />});
12
+
13
+ export default ItemsTimeline;
@@ -118,6 +118,7 @@ export { default as IntegrationsIntegrationIntercomColor } from './IntegrationsI
118
118
  export { default as IntegrationsIntegrationSlackColor } from './IntegrationsIntegrationSlackColor';
119
119
  export { default as IntegrationsIntegrationZendeskColor } from './IntegrationsIntegrationZendeskColor';
120
120
  export { default as InvitePeople } from './InvitePeople';
121
+ export { default as ItemsTimeline } from './ItemsTimeline';
121
122
  export { default as Items } from './Items';
122
123
  export { default as Jira } from './Jira';
123
124
  export { default as Key } from './Key';
package/src/toggle.tsx CHANGED
@@ -34,9 +34,11 @@ const Label = styled.div<{labelPosition: "last" | "first"; disabled?: boolean}>`
34
34
  opacity: ${({disabled}) => (disabled ? 0.5 : 1)};
35
35
  line-height: ${layout.checkboxSize}px;
36
36
  width: 100%;
37
+ min-width: 0;
37
38
  `;
38
39
 
39
40
  const labelWrapperStyle = css`
41
+ min-width: 0;
40
42
  display: flex;
41
43
  position: relative;
42
44
  align-items: center;