diff --git a/packages/html/src/coloreditor/color-editor.spec.tsx b/packages/html/src/coloreditor/color-editor.spec.tsx new file mode 100644 index 00000000000..89114f7f102 --- /dev/null +++ b/packages/html/src/coloreditor/color-editor.spec.tsx @@ -0,0 +1,93 @@ +import { classNames, stateClassNames, States } from '../utils'; +import { ActionButtons } from '../action-buttons'; +import { Button } from '../button'; +import { ButtonGroup } from '../button-group'; +import { ColorGradient } from '../colorgradient'; +import { ColorPalette } from '../colorpalette'; +import { ColorPreview } from '../color-preview'; +import { PALETTEPRESETS } from '../colorpalette/colorpalette-presets'; + +const COLOREDITOR_CLASSNAME = 'k-coloreditor'; + +const states = [ + States.focus +]; + +const options = {}; + +export type KendoColorEditorProps = { + view?: 'gradient' | 'palette'; + color?: string; + currentColor?: string; + focusView?: boolean; + dir?: 'ltr' | 'rtl'; + group?: boolean; + palette?: Array | any; +}; + +export type KendoColorEditorState = { [K in (typeof states)[number]]?: boolean }; + +const defaultProps = { + view: 'gradient', + currentColor: 'fuchsia', + palette: PALETTEPRESETS.office +}; + +export const ColorEditor = ( + props: KendoColorEditorProps & + KendoColorEditorState & + React.HTMLAttributes +) => { + const { + view = defaultProps.view, + color, + currentColor = defaultProps.currentColor, + focus, + focusView, + dir, + group, + palette = defaultProps.palette + } = props; + + return ( +
+
+
+ { group && + + + + + } +
+
+
+ +
+ + +
+
+
+
+ { view === 'gradient' ? : } +
+ + + + +
+ ); +}; + +ColorEditor.states = states; +ColorEditor.options = options; +ColorEditor.className = COLOREDITOR_CLASSNAME; +ColorEditor.defaultProps = defaultProps; + +export default ColorEditor; diff --git a/packages/html/src/coloreditor/index.ts b/packages/html/src/coloreditor/index.ts new file mode 100644 index 00000000000..74b5e8edbb7 --- /dev/null +++ b/packages/html/src/coloreditor/index.ts @@ -0,0 +1 @@ +export * from './color-editor.spec'; diff --git a/packages/html/src/coloreditor/tests/coloreditor-focused-colorgradient.tsx b/packages/html/src/coloreditor/tests/coloreditor-focused-colorgradient.tsx index 501b4b9e3a0..b37065c7f97 100644 --- a/packages/html/src/coloreditor/tests/coloreditor-focused-colorgradient.tsx +++ b/packages/html/src/coloreditor/tests/coloreditor-focused-colorgradient.tsx @@ -1,8 +1,5 @@ import ReactDOM from 'react-dom/client'; -import { ActionButtons } from '../../action-buttons'; -import { Button } from '../../button'; -import { ColorPreview } from '../../color-preview'; -import { NumericTextbox } from '../../numerictextbox'; +import { ColorEditor } from '../../coloreditor'; const root = ReactDOM.createRoot( document.getElementById('app') as HTMLElement @@ -27,78 +24,7 @@ root.render( Focused Cologradient Inside ColorEditor
-
-
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
- - - - - -
+
diff --git a/packages/html/src/coloreditor/tests/coloreditor-rtl.tsx b/packages/html/src/coloreditor/tests/coloreditor-rtl.tsx index 8096efd371b..97f6192d254 100644 --- a/packages/html/src/coloreditor/tests/coloreditor-rtl.tsx +++ b/packages/html/src/coloreditor/tests/coloreditor-rtl.tsx @@ -1,10 +1,5 @@ import ReactDOM from 'react-dom/client'; -import { ActionButtons } from '../../action-buttons'; -import { Button } from '../../button'; -import { ColorPalette } from '../../colorpalette'; -import { ColorPreview } from '../../color-preview'; -import { NumericTextbox } from '../../numerictextbox'; -import { PALETTEPRESETS } from '../../colorpalette/colorpalette-presets'; +import { ColorEditor } from '../../coloreditor'; const root = ReactDOM.createRoot( document.getElementById('app') as HTMLElement @@ -30,110 +25,11 @@ root.render( ColorPalette View
-
-
-
-
- - -
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
- - - - -
+
-
-
-
-
- - -
-
-
-
- -
- - -
-
-
-
- -
- - - - -
+
diff --git a/packages/html/src/coloreditor/tests/coloreditor-states.tsx b/packages/html/src/coloreditor/tests/coloreditor-states.tsx index c4a1702575e..65be534599a 100644 --- a/packages/html/src/coloreditor/tests/coloreditor-states.tsx +++ b/packages/html/src/coloreditor/tests/coloreditor-states.tsx @@ -1,8 +1,5 @@ import ReactDOM from 'react-dom/client'; -import { ActionButtons } from '../../action-buttons'; -import { Button } from '../../button'; -import { ColorPreview } from '../../color-preview'; -import { NumericTextbox } from '../../numerictextbox'; +import { ColorEditor } from '../../coloreditor'; const root = ReactDOM.createRoot( document.getElementById('app') as HTMLElement @@ -27,79 +24,7 @@ root.render( Focus
-
-
-
-
-
- -
- - -
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
- - - - - -
+
diff --git a/packages/html/src/coloreditor/tests/coloreditor-views.tsx b/packages/html/src/coloreditor/tests/coloreditor-views.tsx index 32e57a394db..b77f88f8b21 100644 --- a/packages/html/src/coloreditor/tests/coloreditor-views.tsx +++ b/packages/html/src/coloreditor/tests/coloreditor-views.tsx @@ -1,10 +1,5 @@ import ReactDOM from 'react-dom/client'; -import { ActionButtons } from '../../action-buttons'; -import { Button } from '../../button'; -import { ColorPalette } from '../../colorpalette'; -import { ColorPreview } from '../../color-preview'; -import { NumericTextbox } from '../../numerictextbox'; -import { PALETTEPRESETS } from '../../colorpalette/colorpalette-presets'; +import { ColorEditor } from '../../coloreditor'; const root = ReactDOM.createRoot( document.getElementById('app') as HTMLElement @@ -30,110 +25,11 @@ root.render( ColorPalette View
-
-
-
-
- - -
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
- - - - -
+
-
-
-
-
- - -
-
-
-
- -
- - -
-
-
-
- -
- - - - -
+
diff --git a/packages/html/src/coloreditor/tests/coloreditor.tsx b/packages/html/src/coloreditor/tests/coloreditor.tsx index 0ee06302f2f..e2b7cb526dc 100644 --- a/packages/html/src/coloreditor/tests/coloreditor.tsx +++ b/packages/html/src/coloreditor/tests/coloreditor.tsx @@ -1,8 +1,5 @@ import ReactDOM from 'react-dom/client'; -import { ActionButtons } from '../../action-buttons'; -import { Button } from '../../button'; -import { ColorPreview } from '../../color-preview'; -import { NumericTextbox } from '../../numerictextbox'; +import { ColorEditor } from '../../coloreditor'; const root = ReactDOM.createRoot( document.getElementById('app') as HTMLElement @@ -27,80 +24,8 @@ root.render( Single View
-
-
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
- - - - - -
+
- ); diff --git a/packages/html/src/index.ts b/packages/html/src/index.ts index c3299c24032..157d0e5429c 100644 --- a/packages/html/src/index.ts +++ b/packages/html/src/index.ts @@ -38,6 +38,7 @@ export * from './floating-label/index'; export * from './autocomplete/index'; export * from './colorpalette/index'; export * from './colorgradient/index'; +export * from './coloreditor/index'; export * from './captcha/index'; export * from './colorpicker/index'; export * from './combobox/index';