@inshapardaz/likhari-react 0.1.7-dev.79 → 0.1.7-dev.84

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.
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { Button, Checkbox, Group, Modal, NumberInput } from '@mantine/core';
4
- import { useUiStrings } from '../i18n/useStrings.js';
5
- import { usePortalTarget } from '../PortalTargetContext.js';
6
- const MIN_DIMENSION = 1;
7
- const MAX_DIMENSION = 20;
8
- const DEFAULT_ROWS = 3;
9
- const DEFAULT_COLUMNS = 3;
10
- /**
11
- * Insert-table dialog: rows x columns and an optional header row. Cell
12
- * merge/split is intentionally not offered anywhere in this dialog or the
13
- * table it creates — see the comment on `TablePlugin` in `EditorRoot.tsx`.
14
- */
15
- export function TableDialog({ opened, onSubmit, onClose }) {
16
- const strings = useUiStrings();
17
- const portalTarget = usePortalTarget();
18
- const [rows, setRows] = useState(DEFAULT_ROWS);
19
- const [columns, setColumns] = useState(DEFAULT_COLUMNS);
20
- const [headerRow, setHeaderRow] = useState(true);
21
- useEffect(() => {
22
- if (!opened)
23
- return;
24
- setRows(DEFAULT_ROWS);
25
- setColumns(DEFAULT_COLUMNS);
26
- setHeaderRow(true);
27
- }, [opened]);
28
- const handleSubmit = (e) => {
29
- e.preventDefault();
30
- onSubmit({ rows, columns, headerRow });
31
- };
32
- return (_jsx(Modal, { opened: opened, onClose: onClose, title: strings.tableDialog.title, centered: true, size: "sm", portalProps: { target: portalTarget }, children: _jsxs("form", { onSubmit: handleSubmit, children: [_jsxs(Group, { grow: true, align: "flex-end", children: [_jsx(NumberInput, { label: strings.tableDialog.rows, min: MIN_DIMENSION, max: MAX_DIMENSION, value: rows, onChange: (v) => setRows(typeof v === 'number' ? v : DEFAULT_ROWS), "data-autofocus": true }), _jsx(NumberInput, { label: strings.tableDialog.columns, min: MIN_DIMENSION, max: MAX_DIMENSION, value: columns, onChange: (v) => setColumns(typeof v === 'number' ? v : DEFAULT_COLUMNS) })] }), _jsx(Checkbox, { mt: "sm", label: strings.tableDialog.headerRow, checked: headerRow, onChange: (e) => setHeaderRow(e.currentTarget.checked) }), _jsxs(Group, { justify: "flex-end", gap: "xs", mt: "md", children: [_jsx(Button, { variant: "default", onClick: onClose, children: strings.common.cancel }), _jsx(Button, { type: "submit", children: strings.common.insert })] })] }) }));
33
- }