@wistia/ui 0.5.0-beta.c2166ce5.bf657fa → 0.5.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.
- package/dist/index.cjs +1 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -56
- package/dist/index.d.ts +1 -56
- package/dist/index.mjs +1 -154
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2207,59 +2207,4 @@ type DataCardTrendProps = {
|
|
|
2207
2207
|
};
|
|
2208
2208
|
declare const DataCardTrend: ({ direction, outlook, children, ...props }: DataCardTrendProps) => JSX.Element;
|
|
2209
2209
|
|
|
2210
|
-
type
|
|
2211
|
-
/**
|
|
2212
|
-
* The initial text content of the heading.
|
|
2213
|
-
* This will be displayed and used as the starting value when editing begins.
|
|
2214
|
-
*/
|
|
2215
|
-
children: string;
|
|
2216
|
-
/**
|
|
2217
|
-
* Callback fired when editing is completed (on blur or Enter key). Does not fire if the value is empty or the same as the previous value.
|
|
2218
|
-
* @param value The new text content after editing
|
|
2219
|
-
*/
|
|
2220
|
-
onValueChange?: (value: string) => void;
|
|
2221
|
-
/**
|
|
2222
|
-
* Callback fired when the editing state changes.
|
|
2223
|
-
* @param isEditing True when entering edit mode, false when exiting
|
|
2224
|
-
*/
|
|
2225
|
-
onEditingChange?: (isEditing: boolean) => void;
|
|
2226
|
-
/**
|
|
2227
|
-
* Custom tooltip text shown when hovering over the heading.
|
|
2228
|
-
*/
|
|
2229
|
-
tooltipText?: string;
|
|
2230
|
-
/**
|
|
2231
|
-
* Sets an aria-label for the input and screen reader only button.
|
|
2232
|
-
*
|
|
2233
|
-
*/
|
|
2234
|
-
ariaLabel?: string;
|
|
2235
|
-
/**
|
|
2236
|
-
* Force editing state for testing purposes
|
|
2237
|
-
*/
|
|
2238
|
-
forceEditing?: boolean;
|
|
2239
|
-
/**
|
|
2240
|
-
* When true, prevents the heading from entering edit mode
|
|
2241
|
-
* @default false
|
|
2242
|
-
*/
|
|
2243
|
-
editingDisabled?: boolean;
|
|
2244
|
-
/**
|
|
2245
|
-
* Additional props for the heading element
|
|
2246
|
-
*/
|
|
2247
|
-
headingProps?: ComponentPropsWithoutRef<'h1'>;
|
|
2248
|
-
/**
|
|
2249
|
-
* Additional props for the textarea element
|
|
2250
|
-
*/
|
|
2251
|
-
textareaProps?: ComponentPropsWithoutRef<'textarea'>;
|
|
2252
|
-
/**
|
|
2253
|
-
* Optional data-testid attribute for testing purposes
|
|
2254
|
-
*/
|
|
2255
|
-
dataTestId?: string;
|
|
2256
|
-
};
|
|
2257
|
-
/**
|
|
2258
|
-
* A special heading component that allows for inline editing. When clicked or activated via keyboard,
|
|
2259
|
-
* it transforms into an editable text field. In its default state, it renders as a heading with
|
|
2260
|
-
* an accessible button that enables editing mode. The component handles empty values, keyboard
|
|
2261
|
-
* navigation (Enter to save, Escape to cancel), and provides callbacks for value and state changes.
|
|
2262
|
-
*/
|
|
2263
|
-
declare const EditableHeading: ({ children, onValueChange, onEditingChange, tooltipText, ariaLabel, forceEditing, editingDisabled, textareaProps, headingProps, dataTestId, }: EditableHeadingProps) => JSX.Element;
|
|
2264
|
-
|
|
2265
|
-
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, EditableHeading, type EditableHeadingProps, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
|
|
2210
|
+
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -2207,59 +2207,4 @@ type DataCardTrendProps = {
|
|
|
2207
2207
|
};
|
|
2208
2208
|
declare const DataCardTrend: ({ direction, outlook, children, ...props }: DataCardTrendProps) => JSX.Element;
|
|
2209
2209
|
|
|
2210
|
-
type
|
|
2211
|
-
/**
|
|
2212
|
-
* The initial text content of the heading.
|
|
2213
|
-
* This will be displayed and used as the starting value when editing begins.
|
|
2214
|
-
*/
|
|
2215
|
-
children: string;
|
|
2216
|
-
/**
|
|
2217
|
-
* Callback fired when editing is completed (on blur or Enter key). Does not fire if the value is empty or the same as the previous value.
|
|
2218
|
-
* @param value The new text content after editing
|
|
2219
|
-
*/
|
|
2220
|
-
onValueChange?: (value: string) => void;
|
|
2221
|
-
/**
|
|
2222
|
-
* Callback fired when the editing state changes.
|
|
2223
|
-
* @param isEditing True when entering edit mode, false when exiting
|
|
2224
|
-
*/
|
|
2225
|
-
onEditingChange?: (isEditing: boolean) => void;
|
|
2226
|
-
/**
|
|
2227
|
-
* Custom tooltip text shown when hovering over the heading.
|
|
2228
|
-
*/
|
|
2229
|
-
tooltipText?: string;
|
|
2230
|
-
/**
|
|
2231
|
-
* Sets an aria-label for the input and screen reader only button.
|
|
2232
|
-
*
|
|
2233
|
-
*/
|
|
2234
|
-
ariaLabel?: string;
|
|
2235
|
-
/**
|
|
2236
|
-
* Force editing state for testing purposes
|
|
2237
|
-
*/
|
|
2238
|
-
forceEditing?: boolean;
|
|
2239
|
-
/**
|
|
2240
|
-
* When true, prevents the heading from entering edit mode
|
|
2241
|
-
* @default false
|
|
2242
|
-
*/
|
|
2243
|
-
editingDisabled?: boolean;
|
|
2244
|
-
/**
|
|
2245
|
-
* Additional props for the heading element
|
|
2246
|
-
*/
|
|
2247
|
-
headingProps?: ComponentPropsWithoutRef<'h1'>;
|
|
2248
|
-
/**
|
|
2249
|
-
* Additional props for the textarea element
|
|
2250
|
-
*/
|
|
2251
|
-
textareaProps?: ComponentPropsWithoutRef<'textarea'>;
|
|
2252
|
-
/**
|
|
2253
|
-
* Optional data-testid attribute for testing purposes
|
|
2254
|
-
*/
|
|
2255
|
-
dataTestId?: string;
|
|
2256
|
-
};
|
|
2257
|
-
/**
|
|
2258
|
-
* A special heading component that allows for inline editing. When clicked or activated via keyboard,
|
|
2259
|
-
* it transforms into an editable text field. In its default state, it renders as a heading with
|
|
2260
|
-
* an accessible button that enables editing mode. The component handles empty values, keyboard
|
|
2261
|
-
* navigation (Enter to save, Escape to cancel), and provides callbacks for value and state changes.
|
|
2262
|
-
*/
|
|
2263
|
-
declare const EditableHeading: ({ children, onValueChange, onEditingChange, tooltipText, ariaLabel, forceEditing, editingDisabled, textareaProps, headingProps, dataTestId, }: EditableHeadingProps) => JSX.Element;
|
|
2264
|
-
|
|
2265
|
-
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, EditableHeading, type EditableHeadingProps, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
|
|
2210
|
+
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.5.0
|
|
3
|
+
* @license @wistia/ui v0.5.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -9317,158 +9317,6 @@ var DataCardTrend = ({
|
|
|
9317
9317
|
)
|
|
9318
9318
|
] });
|
|
9319
9319
|
};
|
|
9320
|
-
|
|
9321
|
-
// src/components/EditableHeading/EditableHeading.tsx
|
|
9322
|
-
import styled50, { css as css25 } from "styled-components";
|
|
9323
|
-
import { useState as useState8, useRef as useRef8 } from "react";
|
|
9324
|
-
import { Fragment as Fragment5, jsx as jsx213, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9325
|
-
var sharedInputStyles = css25`
|
|
9326
|
-
padding: var(--wui-space-02);
|
|
9327
|
-
border-radius: var(--wui-border-radius-01);
|
|
9328
|
-
overflow-wrap: anywhere;
|
|
9329
|
-
`;
|
|
9330
|
-
var StyledEditableHeadingInput = styled50.textarea`
|
|
9331
|
-
:not([rows]) {
|
|
9332
|
-
min-height: unset;
|
|
9333
|
-
}
|
|
9334
|
-
|
|
9335
|
-
${sharedInputStyles}
|
|
9336
|
-
font-size: var(--wui-typography-heading-1-size);
|
|
9337
|
-
font-weight: var(--wui-typography-heading-1-weight);
|
|
9338
|
-
line-height: var(--wui-typography-heading-1-line-height);
|
|
9339
|
-
font-family: var(--wui-typography-heading-1-family);
|
|
9340
|
-
width: 100%;
|
|
9341
|
-
box-sizing: border-box;
|
|
9342
|
-
margin: 0;
|
|
9343
|
-
display: block;
|
|
9344
|
-
overflow: hidden;
|
|
9345
|
-
resize: vertical;
|
|
9346
|
-
height: ${({ $headingHeight }) => `${$headingHeight}px`};
|
|
9347
|
-
background: transparent;
|
|
9348
|
-
border: none;
|
|
9349
|
-
outline: 2px solid var(--wui-color-focus-ring);
|
|
9350
|
-
outline-offset: -2px;
|
|
9351
|
-
|
|
9352
|
-
&:focus {
|
|
9353
|
-
outline: 2px solid var(--wui-color-focus-ring);
|
|
9354
|
-
outline-offset: -2px;
|
|
9355
|
-
}
|
|
9356
|
-
`;
|
|
9357
|
-
var StyledHeading2 = styled50(Heading)`
|
|
9358
|
-
${sharedInputStyles}
|
|
9359
|
-
transition: all var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
9360
|
-
${({ $editingDisabled }) => !$editingDisabled && css25`
|
|
9361
|
-
cursor: pointer;
|
|
9362
|
-
|
|
9363
|
-
&:hover {
|
|
9364
|
-
background: var(--wui-color-bg-surface-hover);
|
|
9365
|
-
}
|
|
9366
|
-
`}
|
|
9367
|
-
`;
|
|
9368
|
-
var EditableHeading = ({
|
|
9369
|
-
children,
|
|
9370
|
-
onValueChange,
|
|
9371
|
-
onEditingChange,
|
|
9372
|
-
tooltipText = "Click to edit title",
|
|
9373
|
-
ariaLabel = "Edit title",
|
|
9374
|
-
forceEditing = false,
|
|
9375
|
-
editingDisabled = false,
|
|
9376
|
-
textareaProps,
|
|
9377
|
-
headingProps,
|
|
9378
|
-
dataTestId
|
|
9379
|
-
}) => {
|
|
9380
|
-
const [isEditing, setIsEditing] = useState8(false);
|
|
9381
|
-
const [value, setValue] = useState8(children);
|
|
9382
|
-
const [previousValue, setPreviousValue] = useState8(children);
|
|
9383
|
-
const [headingHeight, setHeadingHeight] = useState8("60");
|
|
9384
|
-
const headingRef = useRef8(null);
|
|
9385
|
-
const handleSetEditing = (editing) => {
|
|
9386
|
-
if (editingDisabled) return;
|
|
9387
|
-
if (editing && headingRef.current) {
|
|
9388
|
-
setHeadingHeight(`${headingRef.current.offsetHeight}`);
|
|
9389
|
-
}
|
|
9390
|
-
if (editing) {
|
|
9391
|
-
setPreviousValue(value);
|
|
9392
|
-
}
|
|
9393
|
-
setIsEditing(editing);
|
|
9394
|
-
onEditingChange?.(editing);
|
|
9395
|
-
};
|
|
9396
|
-
const handleFinishEditing = () => {
|
|
9397
|
-
const trimmedValue = value.trim();
|
|
9398
|
-
if (trimmedValue === "") {
|
|
9399
|
-
setValue(previousValue);
|
|
9400
|
-
} else if (trimmedValue !== previousValue && onValueChange) {
|
|
9401
|
-
onValueChange(trimmedValue);
|
|
9402
|
-
} else {
|
|
9403
|
-
setValue(trimmedValue);
|
|
9404
|
-
}
|
|
9405
|
-
handleSetEditing(false);
|
|
9406
|
-
};
|
|
9407
|
-
const handleKeyDown = (event) => {
|
|
9408
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
9409
|
-
event.preventDefault();
|
|
9410
|
-
handleFinishEditing();
|
|
9411
|
-
}
|
|
9412
|
-
if (event.key === "Escape") {
|
|
9413
|
-
setValue(previousValue);
|
|
9414
|
-
handleSetEditing(false);
|
|
9415
|
-
}
|
|
9416
|
-
};
|
|
9417
|
-
const HeadingComponent2 = /* @__PURE__ */ jsx213(
|
|
9418
|
-
StyledHeading2,
|
|
9419
|
-
{
|
|
9420
|
-
...headingProps,
|
|
9421
|
-
ref: headingRef,
|
|
9422
|
-
$editingDisabled: editingDisabled,
|
|
9423
|
-
"data-testid": dataTestId,
|
|
9424
|
-
onClick: () => handleSetEditing(true),
|
|
9425
|
-
variant: "heading1",
|
|
9426
|
-
children: value
|
|
9427
|
-
}
|
|
9428
|
-
);
|
|
9429
|
-
if (editingDisabled) {
|
|
9430
|
-
return HeadingComponent2;
|
|
9431
|
-
}
|
|
9432
|
-
if (isEditing || forceEditing) {
|
|
9433
|
-
return /* @__PURE__ */ jsx213(
|
|
9434
|
-
StyledEditableHeadingInput,
|
|
9435
|
-
{
|
|
9436
|
-
...textareaProps,
|
|
9437
|
-
$headingHeight: headingHeight,
|
|
9438
|
-
"aria-label": ariaLabel,
|
|
9439
|
-
autoFocus: true,
|
|
9440
|
-
"data-testid": dataTestId,
|
|
9441
|
-
onBlur: handleFinishEditing,
|
|
9442
|
-
onChange: (event) => setValue(event.target.value),
|
|
9443
|
-
onFocus: (event) => {
|
|
9444
|
-
const { length } = event.currentTarget.value;
|
|
9445
|
-
event.currentTarget.setSelectionRange(length, length);
|
|
9446
|
-
},
|
|
9447
|
-
onKeyDown: handleKeyDown,
|
|
9448
|
-
value,
|
|
9449
|
-
children: value
|
|
9450
|
-
}
|
|
9451
|
-
);
|
|
9452
|
-
}
|
|
9453
|
-
return /* @__PURE__ */ jsxs33(Fragment5, { children: [
|
|
9454
|
-
/* @__PURE__ */ jsx213(
|
|
9455
|
-
Tooltip,
|
|
9456
|
-
{
|
|
9457
|
-
compact: true,
|
|
9458
|
-
content: tooltipText,
|
|
9459
|
-
children: HeadingComponent2
|
|
9460
|
-
}
|
|
9461
|
-
),
|
|
9462
|
-
/* @__PURE__ */ jsx213(ScreenReaderOnly, { children: /* @__PURE__ */ jsx213(
|
|
9463
|
-
"button",
|
|
9464
|
-
{
|
|
9465
|
-
"aria-label": ariaLabel,
|
|
9466
|
-
onClick: () => handleSetEditing(true),
|
|
9467
|
-
type: "button"
|
|
9468
|
-
}
|
|
9469
|
-
) })
|
|
9470
|
-
] });
|
|
9471
|
-
};
|
|
9472
9320
|
export {
|
|
9473
9321
|
ActionButton,
|
|
9474
9322
|
Avatar,
|
|
@@ -9487,7 +9335,6 @@ export {
|
|
|
9487
9335
|
DataCardTrend,
|
|
9488
9336
|
DataCards,
|
|
9489
9337
|
Divider,
|
|
9490
|
-
EditableHeading,
|
|
9491
9338
|
Ellipsis,
|
|
9492
9339
|
Form,
|
|
9493
9340
|
FormErrorSummary,
|