@instructure/ui-editable 11.7.2-snapshot-23 → 11.7.2-snapshot-25

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.
@@ -0,0 +1,61 @@
1
+ import { Component } from 'react';
2
+ import type { IconButtonProps } from '@instructure/ui-buttons/latest';
3
+ import type { InPlaceEditProps } from './props';
4
+ import type { EditableRenderProps } from '../../Editable/v1/props';
5
+ /**
6
+ ---
7
+ category: components
8
+ ---
9
+ **/
10
+ declare class InPlaceEdit extends Component<InPlaceEditProps> {
11
+ static readonly componentId = "InPlaceEdit";
12
+ static allowedProps: readonly (keyof {
13
+ renderViewer: () => React.ReactNode;
14
+ renderEditor: (data: {
15
+ onBlur: () => void;
16
+ editorRef: (el: HTMLElement | null) => void;
17
+ }) => React.ReactNode;
18
+ renderEditButton: (props: {
19
+ elementRef?: (el: HTMLButtonElement) => void;
20
+ onClick: () => void;
21
+ onFocus: () => void;
22
+ onBlur: () => void;
23
+ isVisible: boolean;
24
+ readOnly?: boolean;
25
+ }) => React.ReactNode | null;
26
+ mode: "view" | "edit";
27
+ onChangeMode: import("../../exports/a").EditableProps["onChangeMode"];
28
+ value?: any;
29
+ onChange?: import("../../exports/a").EditableProps["onChange"];
30
+ readOnly?: boolean;
31
+ showFocusRing?: boolean;
32
+ editButtonPlacement?: "start" | "end";
33
+ inline?: boolean;
34
+ })[];
35
+ static defaultProps: {
36
+ readOnly: boolean;
37
+ showFocusRing: boolean;
38
+ inline: boolean;
39
+ editButtonPlacement: string;
40
+ };
41
+ ref: Element | null;
42
+ _editButtonRef: HTMLButtonElement | null;
43
+ handleRef: (el: Element | null) => void;
44
+ constructor(props: InPlaceEditProps);
45
+ componentDidMount(): void;
46
+ componentDidUpdate(): void;
47
+ handleEditButtonRef: (el: HTMLButtonElement) => void;
48
+ renderEditor({ mode, onBlur, editorRef, readOnly }: ReturnType<EditableRenderProps['getEditorProps']>): import("@emotion/react/jsx-runtime").JSX.Element | null;
49
+ renderViewer({ readOnly, mode }: ReturnType<EditableRenderProps['getViewerProps']>): import("react").ReactNode;
50
+ renderEditButton({ buttonRef, ...rest }: ReturnType<EditableRenderProps['getEditButtonProps']>): import("react").ReactNode;
51
+ static renderDefaultEditButton: ({ isVisible, readOnly, label, ...buttonProps }: {
52
+ isVisible: boolean;
53
+ readOnly?: boolean;
54
+ label: string;
55
+ } & Partial<IconButtonProps>) => import("@emotion/react/jsx-runtime").JSX.Element | null;
56
+ renderAll: ({ getContainerProps, getViewerProps, getEditorProps, getEditButtonProps }: EditableRenderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
57
+ render(): import("@emotion/react/jsx-runtime").JSX.Element;
58
+ }
59
+ export default InPlaceEdit;
60
+ export { InPlaceEdit };
61
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/InPlaceEdit/v2/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAWrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAElE;;;;GAIG;AACH,cACM,WAAY,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IACnD,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAgB;IAC3C,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;MAKlB;IAED,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAC1B,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAO;IAE/C,SAAS,GAAI,IAAI,OAAO,GAAG,IAAI,UAE9B;gBAEW,KAAK,EAAE,gBAAgB;IASnC,iBAAiB;IAIjB,kBAAkB;IAIlB,mBAAmB,GAAI,IAAI,iBAAiB,UAE3C;IAED,YAAY,CAAC,EACX,IAAI,EACJ,MAAM,EACN,SAAS,EACT,QAAQ,EACT,EAAE,UAAU,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAmBpD,YAAY,CAAC,EACX,QAAQ,EACR,IAAI,EACL,EAAE,UAAU,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAIpD,gBAAgB,CAAC,EACf,SAAS,EACT,GAAG,IAAI,EACR,EAAE,UAAU,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;IASxD,MAAM,CAAC,uBAAuB,GAAI,gDAK/B;QACD,SAAS,EAAE,OAAO,CAAA;QAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;KACd,GAAG,OAAO,CAAC,eAAe,CAAC,6DAe3B;IAED,SAAS,GAAI,2EAKV,mBAAmB,sDAwBrB;IAED,MAAM;CAeP;AAED,eAAe,WAAW,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,103 @@
1
+ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
2
+ import type { EditableProps } from '../../Editable/v1/props';
3
+ import React from 'react';
4
+ type ExtendedRenderEditButton = {
5
+ elementRef?: (el: HTMLButtonElement) => void;
6
+ onClick: () => void;
7
+ onFocus: () => void;
8
+ onBlur: () => void;
9
+ isVisible: boolean;
10
+ readOnly?: boolean;
11
+ };
12
+ type InPlaceEditOwnProps = {
13
+ /**
14
+ * Function to render the view mode component.
15
+ * It is the consumer's responsibility to provide the
16
+ * current value or children.
17
+ *
18
+ * Return value:
19
+ * - element: the viewer DOM sub-tree.
20
+ */
21
+ renderViewer: () => React.ReactNode;
22
+ /**
23
+ * Function to render the edit mode component
24
+ * It is the consumer's responsibility to provide the
25
+ * current value, and to attach the appropriate onChange
26
+ * event handler needed to capture the updated value. This
27
+ * new value must then be forwarded to the view mode component.
28
+ *
29
+ * Return value:
30
+ * - element: the editor DOM sub-tree.
31
+ */
32
+ renderEditor: (data: {
33
+ onBlur: () => void;
34
+ editorRef: (el: HTMLElement | null) => void;
35
+ }) => React.ReactNode;
36
+ /**
37
+ * Function to render the edit button.
38
+ *
39
+ * Parameters:
40
+ * - object: { isVisible, onClick, onFocus, onBlur, buttonRef }
41
+ *
42
+ * Return value:
43
+ *
44
+ * - element: the edit button DOM sub-tree
45
+ *
46
+ * If you choose to use the default edit button, add `label` to the
47
+ * incoming `props` parameter and call `InPlaceEdit.renderDefaultEditButton(props)`
48
+ *
49
+ * If you choose to render a custom button, attach the on* event handlers
50
+ * and set `buttonRef` as a `ref` type property on the `button` element.
51
+ *
52
+ * `isVisible` is a hint as to whether the button is _typically_ shown,
53
+ * but you're free to ignore it for your use-case.
54
+ */
55
+ renderEditButton: (props: ExtendedRenderEditButton) => React.ReactNode | null;
56
+ /**
57
+ * If `'view'`: the view component is rendered,
58
+ * if `'edit'`: the edit component is rendered
59
+ */
60
+ mode: 'view' | 'edit';
61
+ /**
62
+ * Called when the component's mode changes
63
+ * Parameter:
64
+ * - newMode: string
65
+ */
66
+ onChangeMode: EditableProps['onChangeMode'];
67
+ /**
68
+ * The current value.
69
+ * The value is managed by the consuming app, but we need to tell InPlaceEdit
70
+ * it's changed or it won't re-render
71
+ */
72
+ value?: any;
73
+ /**
74
+ * Called when Editable switches from edit to view mode and the value has changed.
75
+ * Parameter:
76
+ * - value: any
77
+ */
78
+ onChange?: EditableProps['onChange'];
79
+ /**
80
+ * The mode is fixed as 'view'
81
+ */
82
+ readOnly?: boolean;
83
+ /**
84
+ * Show a focus outline when the input is focused
85
+ */
86
+ showFocusRing?: boolean;
87
+ /**
88
+ * Put the edit button before or after the view
89
+ */
90
+ editButtonPlacement?: 'start' | 'end';
91
+ /**
92
+ * Render outermost element inline v. block
93
+ */
94
+ inline?: boolean;
95
+ };
96
+ type PropKeys = keyof InPlaceEditOwnProps;
97
+ type AllowedPropKeys = Readonly<Array<PropKeys>>;
98
+ type InPlaceEditProps = InPlaceEditOwnProps & WithStyleProps<null, InPlaceEditStyle>;
99
+ type InPlaceEditStyle = ComponentStyle<'inPlaceEdit'>;
100
+ declare const allowedProps: AllowedPropKeys;
101
+ export type { InPlaceEditProps, InPlaceEditStyle };
102
+ export { allowedProps };
103
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/InPlaceEdit/v2/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,wBAAwB,GAAG;IAC9B,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB;;;;;;;OAOG;IACH,YAAY,EAAE,MAAM,KAAK,CAAC,SAAS,CAAA;IACnC;;;;;;;;;OASG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE;QACnB,MAAM,EAAE,MAAM,IAAI,CAAA;QAClB,SAAS,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;KAC5C,KAAK,KAAK,CAAC,SAAS,CAAA;IACrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,KAAK,CAAC,SAAS,GAAG,IAAI,CAAA;IAC7E;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB;;;;OAIG;IACH,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC3C;;;;OAIG;IACH,KAAK,CAAC,EAAE,GAAG,CAAA;IACX;;;;OAIG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IACrC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,KAAK,QAAQ,GAAG,MAAM,mBAAmB,CAAA;AAEzC,KAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,KAAK,gBAAgB,GAAG,mBAAmB,GACzC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;AAExC,KAAK,gBAAgB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAA;AACrD,QAAA,MAAM,YAAY,EAAE,eAYnB,CAAA;AAED,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { InPlaceEditStyle } from './props';
2
+ /**
3
+ * ---
4
+ * private: true
5
+ * ---
6
+ * Generates the style object from the theme and provided additional information
7
+ * @param {Object} componentTheme The theme variable object.
8
+ * @param {Object} props the props of the component, the style is applied to
9
+ * @param {Object} state the state of the component, the style is applied to
10
+ * @return {Object} The final style object, which will be used in the component
11
+ */
12
+ declare const generateStyle: () => InPlaceEditStyle;
13
+ export default generateStyle;
14
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/InPlaceEdit/v2/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C;;;;;;;;;GASG;AACH,QAAA,MAAM,aAAa,QAAO,gBAmBzB,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,5 @@
1
+ export { Editable } from '../Editable/v1';
2
+ export { InPlaceEdit } from '../InPlaceEdit/v2';
3
+ export type { EditableProps } from '../Editable/v1/props';
4
+ export type { InPlaceEditProps } from '../InPlaceEdit/v2/props';
5
+ //# sourceMappingURL=b.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"b.d.ts","sourceRoot":"","sources":["../../src/exports/b.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA"}