Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime', // React 17+ の新しいJSX変換用(react-in-jsx-scopeルールを自動で無効化)
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'prettier',
Expand Down
6 changes: 5 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
presets: [
'@babel/preset-env',
['@babel/preset-react', { runtime: 'automatic' }], // React 17+の新しいJSX変換を有効化
'@babel/preset-typescript',
],
plugins: ['@babel/plugin-transform-runtime'],
};
1 change: 0 additions & 1 deletion example/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import CustomFieldMaker from '../src';

Expand Down
1,474 changes: 780 additions & 694 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/components/FieldConfirmSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { TableLayoutConfirm } from './confirmLayouts/TableLayoutConfirm';

export function FieldConfirmSource() {
Expand Down
1 change: 0 additions & 1 deletion src/components/FieldGroupConfirmSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { GroupTableLayoutConfirm } from './confirmLayouts/GroupTableLayoutConfirm';

export function FieldGroupConfirmSource() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FieldGroupSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import { useEffect, useRef } from 'react';
import { GroupSection } from './layouts/GroupSection';
import { GroupTableLayout } from './layouts/GroupTableLayout';
import { useMakerContext } from '../stores/MakerContext';
Expand Down
2 changes: 1 addition & 1 deletion src/components/FieldSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import { useEffect, useRef } from 'react';
import { Section } from './layouts/Section';
import { TableLayout } from './layouts/TableLayout';
import { useMakerContext } from '../stores/MakerContext';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Highlighter.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useCallback, useState } from 'react';
import { useEffect, useCallback, useState } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { decode } from 'html-entities';
import { html as beautifyHtml } from 'js-beautify';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalDialog.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import classnames from 'classnames';

export function ModalDialog(props) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Notify.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../stores/MakerContext';

Expand Down
1 change: 0 additions & 1 deletion src/components/Tooltip.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { forwardRef } from 'react';
import { Tooltip as ReactTooltip } from 'react-tooltip';
import classnames from 'classnames';
Expand Down
1 change: 0 additions & 1 deletion src/components/UnitConfirmSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { UnitTableLayoutConfirm } from './confirmLayouts/UnitTableLayoutConfirm';

export function UnitConfirmSource() {
Expand Down
1 change: 0 additions & 1 deletion src/components/UnitGroupConfirmSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { UnitGroupTableLayoutConfirm } from './confirmLayouts/UnitGroupTableLayoutConfirm';

export function UnitGroupConfirmSource() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/UnitGroupSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import { useEffect, useRef } from 'react';
import { UnitGroupSection } from './layouts/UnitGroupSection';
import { UnitGroupTableLayout } from './layouts/UnitGroupTableLayout';
import { useMakerContext } from '../stores/MakerContext';
Expand Down
2 changes: 1 addition & 1 deletion src/components/UnitSource.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import { useEffect, useRef } from 'react';
import { UnitSection } from './layouts/UnitSection';
import { UnitTableLayout } from './layouts/UnitTableLayout';
import { useMakerContext } from '../stores/MakerContext';
Expand Down
1 change: 0 additions & 1 deletion src/components/confirmLayouts/GroupTableLayoutConfirm.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { WrapTable } from '../html/WrapTable';
Expand Down
1 change: 0 additions & 1 deletion src/components/confirmLayouts/TableLayoutConfirm.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { WrapTable } from '../html/WrapTable';
Expand Down
1 change: 0 additions & 1 deletion src/components/confirmLayouts/UnitTableLayoutConfirm.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';

Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/Field.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import { useMakerContext } from '../../stores/MakerContext';
import { ConverterModal } from './base/ConverterModal';
import { Alert } from './base/Alert';
Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/FieldGroup.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import Tooltip from '../Tooltip';
import { useMakerContext } from '../../stores/MakerContext';
import { Alert } from './base/Alert';
Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/Unit.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import { useMakerContext } from '../../stores/MakerContext';
import { ConverterModal } from './base/ConverterModal';
import { Alert } from './base/Alert';
Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/UnitGroup.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import Tooltip from '../Tooltip';
import { useMakerContext } from '../../stores/MakerContext';
import { Alert } from './base/Alert';
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/Alert.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function Alert(props) {
const {
field: { alert },
Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/base/Basic.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';
import Tooltip from '../../Tooltip';
import inputTypesJson from '../../../json/input-types.json';

Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/base/ConverterModal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useCallback, useEffect } from 'react';
import { useRef, useCallback, useEffect } from 'react';
import { ModalDialog } from '../../ModalDialog';

export function ConverterModal(props) {
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/DuplicateAlert.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function DuplicateAlert(props) {
const {
field: { duplicatedField },
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/FileOption.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function FileOption(props) {
const {
field: { extension, fileName, fileNameMethod },
Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/base/FormOption.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useMemo, useCallback } from 'react';
import { useRef, useMemo, useCallback } from 'react';
import Tooltip from '../../Tooltip';
import { NoSearchBox } from './NoSearchBox';
import { useMakerContext } from '../../../stores/MakerContext';
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/GroupAlert.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function GroupAlert(props) {
const {
field: { groupAlert },
Expand Down
1 change: 0 additions & 1 deletion src/components/generator/base/ImageOption.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import Tooltip from '../../Tooltip';

export function ImageOption(props) {
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/ImageResizeOption.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function ImageResizeOption(props) {
const {
field: { resize, alt },
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/MediaOption.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function MediaOption(props) {
const {
field: { mediaType, useDropArea, useFocusImage, dropAreaWidth, dropAreaHeight, focusImageWidth, focusImageHeight },
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/NoSearchBox.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function NoSearchBox(props) {
const { noSearch, setField } = props;

Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/base/Operator.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback } from 'react';
import { useCallback } from 'react';

const crearField = {
title: '',
Expand Down
2 changes: 0 additions & 2 deletions src/components/generator/base/OptionItem.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function OptionItem(props) {
const {
field: { option },
Expand Down
2 changes: 1 addition & 1 deletion src/components/generator/base/Snippet.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';
import Tooltip from '../../Tooltip';
import prefJson from '../../../json/pref.json';

Expand Down
1 change: 0 additions & 1 deletion src/components/html/BlockEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/Checkbox.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/FileInput.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/Heading.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useMakerContext } from '../../stores/MakerContext';

export function Heading(props) {
Expand Down
1 change: 0 additions & 1 deletion src/components/html/ImageInput.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/Media.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/OptionNoSearch.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
export function OptionNoSearch(props) {
const { noSearch, name } = props;

Expand Down
2 changes: 1 addition & 1 deletion src/components/html/OptionValidator.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment } from 'react';
import { Fragment } from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { ConditionalWrap } from '../ConditionalWrap';
Expand Down
2 changes: 1 addition & 1 deletion src/components/html/OptionValidatorFieldGroup.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment } from 'react';
import { Fragment } from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { ConditionalWrap } from '../ConditionalWrap';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/RadioButton.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/Selectbox.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/Table.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useMakerContext } from '../../stores/MakerContext';

export function Table(props) {
Expand Down
1 change: 0 additions & 1 deletion src/components/html/TextInput.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/Textarea.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';
import { OptionValidator } from './OptionValidator';
Expand Down
1 change: 0 additions & 1 deletion src/components/html/WrapTable.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useMakerContext } from '../../stores/MakerContext';
import { ConditionalWrap } from '../ConditionalWrap';

Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/GroupSection.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, Fragment } from 'react';
import { forwardRef, Fragment } from 'react';
import classnames from 'classnames';
import { Heading } from '../html/Heading';
import { TextInput } from '../html/TextInput';
Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/GroupTableLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, Fragment } from 'react';
import { forwardRef, Fragment } from 'react';
import classnames from 'classnames';
import { TextInput } from '../html/TextInput';
import { Textarea } from '../html/Textarea';
Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/Section.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from 'react';
import { forwardRef } from 'react';
import { Heading } from '../html/Heading';
import { TextInput } from '../html/TextInput';
import { Textarea } from '../html/Textarea';
Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/TableLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from 'react';
import { forwardRef } from 'react';
import classnames from 'classnames';
import { Heading } from '../html/Heading';
import { TextInput } from '../html/TextInput';
Expand Down
6 changes: 3 additions & 3 deletions src/components/layouts/UnitGroupSection.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from 'react';
import { forwardRef, Fragment } from 'react';
import { useMakerContext } from '../../stores/MakerContext';
import classnames from 'classnames';
import { Heading } from '../html/Heading';
Expand Down Expand Up @@ -475,7 +475,7 @@ export const UnitGroupSection = forwardRef((_props, ref) => {
{unitgroup.name && (
<>
{unitgroup.items.map((item, index) => (
<React.Fragment key={index}>
<Fragment key={index}>
{item.type === 'image' && (
<>
{item.square && item.squareSize && (
Expand Down Expand Up @@ -535,7 +535,7 @@ export const UnitGroupSection = forwardRef((_props, ref) => {
<input type="hidden" name="unit{id}[]" value={`${item.name}{id}`} />
<OptionValidator item={item} />
<OptionNoSearch name={`${item.name}{id}`} noSearch={item.noSearch} />
</React.Fragment>
</Fragment>
))}
<input type="hidden" name="unit{id}[]" value={`@${unitgroup.name}{id}`} />
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/UnitGroupTableLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, Fragment } from 'react';
import { forwardRef, Fragment } from 'react';
import classnames from 'classnames';
import { TextInput } from '../html/TextInput';
import { Textarea } from '../html/Textarea';
Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/UnitSection.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from 'react';
import { forwardRef } from 'react';
import { Heading } from '../html/Heading';
import { TextInput } from '../html/TextInput';
import { Textarea } from '../html/Textarea';
Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/UnitTableLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from 'react';
import { forwardRef } from 'react';
import classnames from 'classnames';
import { Heading } from '../html/Heading';
import { TextInput } from '../html/TextInput';
Expand Down
1 change: 0 additions & 1 deletion src/components/navigator/EditorModeNavigator.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useMakerContext } from '../../stores/MakerContext';

export function EditorModeNavigator() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/navigator/PreviewModeNavigator.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef } from 'react';
import { useRef } from 'react';
import classnames from 'classnames';
import { useMakerContext } from '../../stores/MakerContext';

Expand Down
1 change: 0 additions & 1 deletion src/components/navigator/PreviewNavigator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Notify } from '../Notify';
import { useMakerContext } from '../../stores/MakerContext';
import columnIcon from '../../assets/images/add_column.svg';
import rowIcon from '../../assets/images/add_row.svg';
import React from 'react';

export function PreviewNavigator() {
const {
Expand Down
6 changes: 3 additions & 3 deletions src/containers/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import { useEffect } from 'react';
import { MakerContextProvider, useMakerContext } from '../stores/MakerContext';
import { EditorModeNavigator } from '../components/navigator/EditorModeNavigator';
import { PreviewModeNavigator } from '../components/navigator/PreviewModeNavigator';
Expand Down Expand Up @@ -30,8 +30,8 @@ function CustomFieldMaker() {
};

useEffect(() => {
localStorage.setItem(STORAGENAME, JSON.stringify(state));
}, [state]);
localStorage.setItem(STORAGENAME, JSON.stringify({ state, preview }));
}, [state, preview]);

return (
<div className="customFieldContainer acms-admin-form">
Expand Down
Loading