@economic/taco 2.21.0 → 2.21.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ export declare type KeyDownHandlerOptions = {
5
5
  shift?: boolean;
6
6
  };
7
7
  export declare function isEventTriggeredOnInteractiveElement(eventTarget: EventTarget | null): boolean;
8
+ export declare function isPressingMetaKey<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>): boolean;
8
9
  export declare function shouldTriggerShortcut<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>, key: string | KeyDownHandlerOptions): boolean;
9
10
  export declare function createShortcutKeyDownHandler<T = Element>(key: string | KeyDownHandlerOptions, handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void, stopPropagation?: boolean): (event: KeyboardEvent | React.KeyboardEvent<T>) => void;
10
11
  export declare const isMacOs: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@economic/taco",
3
- "version": "2.21.0",
3
+ "version": "2.21.2",
4
4
  "description": "> TODO: description",
5
5
  "author": "Matt Daly <matthew.daly@visma.com>",
6
6
  "homepage": "https://github.com/e-conomic/taco#readme",
@@ -131,5 +131,5 @@
131
131
  "not ie < 11"
132
132
  ]
133
133
  },
134
- "gitHead": "c07bbb36a8e3067a913495f0746afdace9b02d2f"
134
+ "gitHead": "7792154aadc9ec74dcc9d1534f0ca6d1a336f83e"
135
135
  }
package/types.json CHANGED
@@ -529494,7 +529494,7 @@
529494
529494
  ]
529495
529495
  }
529496
529496
  },
529497
- "defaultValue": "React.memo(function MemoedCell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { row, table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const actions = tableMeta.rowActions.rowActions;\n const actionsLength = tableMeta.rowActions.rowActionsLength;\n\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === row.index;\n const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;\n const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;\n const { isHovered } = React.useContext(RowContext);\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && (isActiveRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n return (\n <Actions\n actions={actions}\n actionsLength={actionsLength}\n data={row.original}\n fontSize={tableMeta.fontSize.size}\n isActiveRow={isActiveRow}\n />\n );\n }\n\n return null;\n}) as <TType = unknown>(context: ReactTableCellContext<TType, unknown>) => JSX.Element"
529497
+ "defaultValue": "React.memo(function MemoedCell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const actions = tableMeta.rowActions.rowActions;\n const actionsLength = tableMeta.rowActions.rowActionsLength;\n\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;\n const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;\n const { isHovered } = React.useContext(RowContext);\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && (isActiveRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n return (\n <Actions\n actions={actions}\n actionsLength={actionsLength}\n data={row.original}\n fontSize={tableMeta.fontSize.size}\n isActiveRow={isActiveRow}\n />\n );\n }\n\n return null;\n}) as <TType = unknown>(context: ReactTableCellContext<TType, unknown>) => JSX.Element"
529498
529498
  },
529499
529499
  {
529500
529500
  "id": 5794,
@@ -580923,7 +580923,7 @@
580923
580923
  ],
580924
580924
  "name": "ForwardRefExoticComponent"
580925
580925
  },
580926
- "defaultValue": "React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in textarea\n if (event.key.length === 1) {\n event.stopPropagation();\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n})"
580926
+ "defaultValue": "React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in textarea\n if (event.key.length === 1 && !isPressingMetaKey(event)) {\n event.stopPropagation();\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n})"
580927
580927
  }
580928
580928
  ],
580929
580929
  "groups": [