Skip to content

Commit

Permalink
feat(html): add toolbar adaptive specs
Browse files Browse the repository at this point in the history
  • Loading branch information
TeyaVes committed Dec 19, 2024
1 parent 43c2da8 commit aceb477
Show file tree
Hide file tree
Showing 16 changed files with 338 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Editor } from '..';
import { Button } from '../../button';
import { ButtonGroup } from '../../button-group';
import { ToolbarSeparator } from '../../toolbar';

export const EditorResponsiveToolbar = (props) => (
<Editor toolbarResizable
Expand Down Expand Up @@ -30,6 +31,7 @@ export const EditorResponsiveToolbar = (props) => (
<Button icon="align-right"></Button>
<Button className="k-group-end" icon="align-justify"></Button>
</ButtonGroup>,
<ToolbarSeparator className="k-toolbar-button-separator" />,
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null}></Button>
]}
children={
Expand Down
2 changes: 2 additions & 0 deletions packages/html/src/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export * from './toolbar-item.spec';
export * from './toolbar-popup.spec';
export * from './templates/toolbar-normal';
export * from './templates/toolbar-resizable';
export * from './templates/toolbar-scrollable';
export * from './templates/toolbar-section';
2 changes: 2 additions & 0 deletions packages/html/src/toolbar/templates/toolbar-resizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button } from '../../button';
import { ButtonGroup } from '../../button-group';
import { MenuButton } from '../../menu-button';
import { SplitButton } from '../../split-button';
import { ToolbarSeparator } from "../toolbar-separator";

export const ToolbarResizable = (props) => (
<Toolbar resizable children={[
Expand All @@ -14,6 +15,7 @@ export const ToolbarResizable = (props) => (
<Button icon="align-center">Center</Button>
<Button className="k-group-end" icon="align-right">Right</Button>
</ButtonGroup>,
<ToolbarSeparator className="k-toolbar-button-separator" />,
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null}></Button>
]}
{...props}>
Expand Down
28 changes: 28 additions & 0 deletions packages/html/src/toolbar/templates/toolbar-scrollable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Toolbar } from "../toolbar.spec";
import { Button } from '../../button';
import { ButtonGroup } from '../../button-group';
import { MenuButton } from '../../menu-button';
import { SplitButton } from '../../split-button';

export const ToolbarScrollable = (props) => (
<Toolbar scrollable {...props} children={[
<Button key="toolbar-button">Button</Button>,
<MenuButton key="toolbar-menu-button" text="Menu button"></MenuButton>,
<SplitButton key="toolbar-split-button">Split button</SplitButton>,
<ButtonGroup key="toolbar-button-group">
<Button className="k-group-start" icon="align-left">Left</Button>
<Button icon="align-center">Center</Button>
<Button className="k-group-end" icon="align-right">Right</Button>
</ButtonGroup>,
<Button key="toolbar-button">Button</Button>,
<MenuButton key="toolbar-menu-button" text="Menu button"></MenuButton>,
<SplitButton key="toolbar-split-button">Split button</SplitButton>,
<ButtonGroup key="toolbar-button-group">
<Button className="k-group-start" icon="align-left">Left</Button>
<Button icon="align-center">Center</Button>
<Button className="k-group-end" icon="align-right">Right</Button>
</ButtonGroup>
]}
{...props}>
</Toolbar>
);
35 changes: 35 additions & 0 deletions packages/html/src/toolbar/templates/toolbar-section.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Toolbar } from "../toolbar.spec";
import { Button } from '../../button';
import { ButtonGroup } from '../../button-group';
import { MenuButton } from '../../menu-button';
import { SplitButton } from '../../split-button';
import { ToolbarSeparator } from "../toolbar-separator";
import ToolbarPopup from "../toolbar-popup.spec";

export const ToolbarSection = ({ fillMode, size, ...other }: any) => (
<>
<Toolbar section fillMode={fillMode} size={size} children={[
<Button key="toolbar-button" fillMode={fillMode} size={size}>Button</Button>,
<ButtonGroup key="toolbar-button-group" fillMode={fillMode}>
<Button className="k-group-start" icon="align-left" fillMode={fillMode} size={size}>Left</Button>
<Button icon="align-center" fillMode={fillMode} size={size}>Center</Button>
<Button className="k-group-end" icon="align-right" fillMode={fillMode} size={size}>Right</Button>
</ButtonGroup>,
<ToolbarSeparator className="k-toolbar-button-separator" />,
<Button icon="more-horizontal" className="k-toolbar-overflow-button" fillMode="flat" size={size} rounded={null}></Button>
]}
{...other}>
</Toolbar>
<ToolbarPopup size={size} fillMode={fillMode} section {...other} >
<SplitButton key="toolbar-split-button" fillMode={fillMode} size={size}>Split button</SplitButton>
<Button key="toolbar-button" fillMode={fillMode} size={size}>Button</Button>
<ToolbarSeparator />
<MenuButton key="toolbar-menu-button" text="Menu button" fillMode={fillMode} size={size}></MenuButton>
<ButtonGroup key="toolbar-button-group" fillMode={fillMode}>
<Button className="k-group-start" icon="align-left" fillMode={fillMode} size={size}>Left</Button>
<Button icon="align-center" fillMode={fillMode} size={size}>Center</Button>
<Button className="k-group-end" icon="align-right" fillMode={fillMode} size={size}>Right</Button>
</ButtonGroup>
</ToolbarPopup>
</>
);
3 changes: 2 additions & 1 deletion packages/html/src/toolbar/tests/toolbar-adaptive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button } from '../../button';
import { ButtonGroup } from '../../button-group';
import { ActionSheet, ActionSheetHeader } from '../../action-sheet';
import { MenuItem, MenuSeparator, MenuList } from '../../menu';
import { ToolbarResizable } from '..';
import { ToolbarResizable, ToolbarSeparator } from '..';

const styles = `
#test-area {
Expand Down Expand Up @@ -32,6 +32,7 @@ export default () =>(
<Button size="large" icon="align-center">Center</Button>
<Button className="k-group-end" size="large" icon="align-right">Right</Button>
</ButtonGroup>
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button size="large" icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null}></Button>
</ToolbarResizable>
<ActionSheet adaptive={true} overlay={false}>
Expand Down
48 changes: 41 additions & 7 deletions packages/html/src/toolbar/tests/toolbar-fill-modes.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import { Button } from '../../button';
import { ColorPicker } from '../../colorpicker';
import { ButtonGroup } from '../../button-group';
import { ToolbarItem, ToolbarSeparator, ToolbarResizable, Toolbar } from '../../toolbar';
import { ToolbarItem, ToolbarSeparator, ToolbarResizable, Toolbar, ToolbarScrollable } from '../../toolbar';

import { Combobox, MenuButton } from '../..';
const styles = `
#test-area {
max-width: 1330px;
}
`;

export default () =>(
<>
<style>{styles}</style>
<div id="test-area" className="k-d-grid">
{ Toolbar.options.fillMode.map((fillMode) => (
<>
Expand Down Expand Up @@ -56,6 +50,46 @@ export default () =>(
<Button fillMode={fillMode} icon="text-wrap"></Button>
</ToolbarResizable>
</section>
<span className="k-colspan-all k-col-span-full">{fillMode} with overlay</span>
<section className="k-colspan-all k-col-span-full">
<ToolbarScrollable fillMode={fillMode}>
<Button icon="arrow-rotate-ccw" fillMode={fillMode}></Button>
<Button icon="arrow-rotate-cw" fillMode={fillMode}></Button>
<ToolbarSeparator></ToolbarSeparator>
<Button icon="cut" fillMode={fillMode}></Button>
<Button icon="copy" fillMode={fillMode}></Button>
<Button icon="clipboard" fillMode={fillMode}></Button>
<ToolbarSeparator></ToolbarSeparator>
<Combobox value="Font Name" fillMode={fillMode} />
<Combobox value="Font Size" fillMode={fillMode} />
<ToolbarSeparator></ToolbarSeparator>
<ButtonGroup fillMode={fillMode}>
<Button className="k-group-start" icon="font-grow" fillMode={fillMode}></Button>
<Button className="k-group-end" icon="font-shrink" fillMode={fillMode}></Button>
</ButtonGroup>
<ToolbarSeparator></ToolbarSeparator>
<ButtonGroup fillMode={fillMode}>
<Button className="k-group-start" icon="bold" fillMode={fillMode}></Button>
<Button icon="italic" fillMode={fillMode}></Button>
<Button icon="underline" fillMode={fillMode}></Button>
<Button className="k-group-end" icon="strikethrough" fillMode={fillMode}></Button>
</ButtonGroup>
<ToolbarItem>
<ColorPicker value="red" valueIconName="foreground-color" fillMode={fillMode} />
</ToolbarItem>
<ToolbarSeparator></ToolbarSeparator>
<ToolbarItem>
<ColorPicker value="fuchsia" valueIconName="droplet" fillMode={fillMode} />
</ToolbarItem>
<ToolbarSeparator></ToolbarSeparator>
<MenuButton fillMode={fillMode} icon="borders-all" showArrow></MenuButton>
<ToolbarSeparator></ToolbarSeparator>
<MenuButton fillMode={fillMode} icon="align-left" showArrow></MenuButton>
<MenuButton fillMode={fillMode} icon="align-middle" showArrow></MenuButton>
<ToolbarSeparator></ToolbarSeparator>
<Button fillMode={fillMode} icon="text-wrap"></Button>
</ToolbarScrollable>
</section>
</>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ToolbarScrollable } from '..';


export default () =>(
<>
<div id="test-area" className="k-d-grid k-grid-cols-2">

<span className="k-colspan-all k-col-span-full">Toolbar Hidden Buttons Scroll Start</span>
<section className="k-colspan-all k-col-span-full">
<ToolbarScrollable scrollButtons="hidden" scrollingPosition="start"/>
</section>

<span className="k-colspan-all k-col-span-full">Toolbar Hidden Buttons Scroll End</span>
<section className="k-colspan-all k-col-span-full">
<ToolbarScrollable scrollButtons="hidden" scrollingPosition="end" />
</section>

<span className="k-colspan-all k-col-span-full">Toolbar Hidden Buttons Scroll Middle</span>
<section className="k-colspan-all k-col-span-full">
<ToolbarScrollable scrollButtons="hidden" />
</section>

<span className="k-colspan-all k-col-span-full">Toolbar Hidden Buttons Scroll Middle RTL</span>
<section className="k-colspan-all k-col-span-full" dir="rtl">
<ToolbarScrollable scrollButtons="hidden" />
</section>

</div>
</>
);
24 changes: 24 additions & 0 deletions packages/html/src/toolbar/tests/toolbar-scrollable-buttons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ToolbarScrollable } from '..';


export default () =>(
<>
<div id="test-area" className="k-d-grid k-grid-cols-2">

<span className="k-colspan-all k-col-span-full">Toolbar Buttons Around</span>
<section className="k-colspan-all k-col-span-full">
<ToolbarScrollable scrollButtons="around" />
</section>

<span className="k-colspan-all k-col-span-full">Toolbar Buttons Start</span>
<section className="k-colspan-all k-col-span-full">
<ToolbarScrollable scrollButtons="start" />
</section>

<span className="k-colspan-all k-col-span-full">Toolbar Buttons End</span>
<section className="k-colspan-all k-col-span-full">
<ToolbarScrollable scrollButtons="end" />
</section>
</div>
</>
);
37 changes: 37 additions & 0 deletions packages/html/src/toolbar/tests/toolbar-section-sizes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ToolbarSection } from '../templates/toolbar-section';


const styles = `
.k-animation-container {
width: 100%;
}
.toolbar-popup-section {
position: relative;
height: 200px;
}
`;

export default () =>(
<>
<style>{styles}</style>
<div id="test-area" className="k-d-grid k-grid-cols-2">

<section className="k-colspan-all k-col-span-full toolbar-popup-section">
<span>Small Toolbar Popup Section</span>
<ToolbarSection size="small" />
</section>

<section className="k-colspan-all k-col-span-full toolbar-popup-section">
<span>Medium Toolbar Popup Section</span>
<ToolbarSection size="medium" />
</section>

<section className="k-colspan-all k-col-span-full toolbar-popup-section">
<span>Large Toolbar Popup Section</span>
<ToolbarSection size="large" />
</section>

</div>
</>
);
37 changes: 37 additions & 0 deletions packages/html/src/toolbar/tests/toolbar-section.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ToolbarSection } from '../templates/toolbar-section';


const styles = `
.k-animation-container {
width: 100%;
}
.toolbar-popup-section {
position: relative;
height: 200px;
}
`;

export default () =>(
<>
<style>{styles}</style>
<div id="test-area" className="k-d-grid k-grid-cols-2">

<section className="k-colspan-all k-col-span-full toolbar-popup-section">
<span>Toolbar Popup Section</span>
<ToolbarSection />
</section>

<section className="k-colspan-all k-col-span-full toolbar-popup-section">
<span >Toolbar Popup Section Outline</span>
<ToolbarSection fillMode="outline" />
</section>

<section className="k-colspan-all k-col-span-full toolbar-popup-section">
<span>Toolbar Popup Section Flat</span>
<ToolbarSection fillMode="flat" />
</section>

</div>
</>
);
1 change: 1 addition & 0 deletions packages/html/src/toolbar/tests/toolbar-sizes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default () =>(
<ColorPicker size={size} />
</ToolbarItem>
<Switch size={size} checked />
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button size={size} icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null}></Button>
</ToolbarResizable>
</section>
Expand Down
6 changes: 6 additions & 0 deletions packages/html/src/toolbar/tests/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default () =>(
<ColorPicker />
</ToolbarItem>
<Switch checked />
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null}></Button>
</ToolbarResizable>
</section>
Expand All @@ -55,6 +56,7 @@ export default () =>(
<ColorPicker />
</ToolbarItem>
<Switch checked />
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null}></Button>
</ToolbarResizable>
</section>
Expand All @@ -76,6 +78,7 @@ export default () =>(
<Button icon="bold" active></Button>
<Button icon="bold" selected></Button>
<Button icon="bold" disabled></Button>
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null} hover></Button>
</ToolbarResizable>
</section>
Expand All @@ -87,6 +90,7 @@ export default () =>(
<Button icon="align-left" active>Active</Button>
<Button icon="align-left" selected>Selected</Button>
<Button icon="align-left" disabled>Disabled</Button>
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null} focus></Button>
</ToolbarResizable>
</section>
Expand All @@ -98,6 +102,7 @@ export default () =>(
<Button themeColor="primary" icon="align-left" active>Active</Button>
<Button themeColor="primary" icon="align-left" selected>Selected</Button>
<Button themeColor="primary" icon="align-left" disabled>Disabled</Button>
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null} active></Button>
</ToolbarResizable>
</section>
Expand All @@ -112,6 +117,7 @@ export default () =>(
<Button className="k-group-start" icon="align-left" disabled focus>Button 1</Button>
<Button className="k-group-end" icon="align-center" disabled>Button 2</Button>
</ButtonGroup>
<ToolbarSeparator className="k-toolbar-button-separator" />
<Button icon="more-vertical" className="k-toolbar-overflow-button" fillMode="flat" rounded={null} disabled focus></Button>
</ToolbarResizable>
</section>
Expand Down
Loading

0 comments on commit aceb477

Please sign in to comment.