diff --git a/package.json b/package.json index 648453f4953b..33c50776c7ee 100644 --- a/package.json +++ b/package.json @@ -95,4 +95,4 @@ "packages/website", "packages/create-package" ] -} +} \ No newline at end of file diff --git a/packages/main/src/DatePicker.ts b/packages/main/src/DatePicker.ts index cb3804bbe018..d110fa52c5c2 100644 --- a/packages/main/src/DatePicker.ts +++ b/packages/main/src/DatePicker.ts @@ -326,7 +326,7 @@ class DatePicker extends DateComponentBase implements IFormElement { * Defines the open or closed state of the popover. * @public * @default false - * @since 2.0 + * @since 2.0.0 */ @property({ type: Boolean }) open!: boolean; diff --git a/packages/main/src/Form.hbs b/packages/main/src/Form.hbs new file mode 100644 index 000000000000..4da5bc003771 --- /dev/null +++ b/packages/main/src/Form.hbs @@ -0,0 +1,35 @@ +
+
+ {{#if hasCustomHeader}} + + {{else}} + {{ headerText }} + {{/if}} +
+ +
+ {{#if this.hasGroupItems}} + {{#each groupItemsInfo}} +
+
+ {{#if this.groupItem.headerText}} +
+ {{ this.groupItem.headerText }} +
+ {{/if}} + +
+ +
+
+
+ {{/each}} + {{else}} + {{#each itemsInfo}} +
+ +
+ {{/each}} + {{/if}} +
+
\ No newline at end of file diff --git a/packages/main/src/Form.ts b/packages/main/src/Form.ts new file mode 100644 index 000000000000..00625b072c4e --- /dev/null +++ b/packages/main/src/Form.ts @@ -0,0 +1,456 @@ +import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; +import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js"; +import property from "@ui5/webcomponents-base/dist/decorators/property.js"; +import slot from "@ui5/webcomponents-base/dist/decorators/slot.js"; +import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; +import Integer from "@ui5/webcomponents-base/dist/types/Integer.js"; + +// Template +import FormTemplate from "./generated/templates/FormTemplate.lit.js"; + +// Styles +import FormCss from "./generated/themes/Form.css.js"; + +import Title from "./Title.js"; +import FormItemSpacing from "./types/FormItemSpacing.js"; +import type FormGroup from "./FormGroup.js"; + +const additionalStylesMap = new Map(); + +const StepColumn = { + "S": 1, + "M": 2, + "L": 3, + "XL": 6, +}; + +interface IFormItem extends HTMLElement { + labelSpan: string + itemSpacing: `${FormItemSpacing}`; + readonly isGroup: boolean; + colsXl?: number; + colsL?: number; + colsM?: number; + colsS?: number; + columnSpan?: number; +} + +type GroupItemsInfo = { + groupItem: IFormItem, + classes: string, + items: Array, +} + +type ItemsInfo = { + item: IFormItem, + classes: string, +} + +/** + * @class + * + * ### Overview + * + * The Form is a layout component that arranges labels and form fields (like input fields) pairs + * into a specific number of columns. + * + * ### Structure + * + * - **Form** (`ui5-form`) is the top-level container component, responsible for the content layout and responsiveness. + * - **FormGroup** (`ui5-form-group`) enables the grouping of the Form content. + * - **FormItem** (`ui5-form-item`) is a pair of label and form fields and can be used directly in a Form, or as part of a FormGroup. + * + * The simplest Form (`ui5-form`) consists of a header area on top, + * displaying a header text (see the `headingText` property) and content below - an arbitrary number of FormItems (ui5-form-item), + * representing the pairs of label and form fields. + * + * And, there is also "grouping" available to assist the implementation of richer UIs. + * This is enabled by the FormGroup (`ui5-form-group`) component. + * In this case, the Form is structured into FormGroups and each FormGroup consists of FormItems. + * + * ### Responsiveness + * + * The Form component reacts and changes its layout on predefined breakpoints. + * Depending on its size, the Form content (FormGroups and FormItems) gets divided into one or more columns as follows: + * - **S** (< 600px) – 1 column is recommended (default: 1) + * - **M** (600px - 1022px) – up to 2 columns are recommended (default: 1) + * - **L** (1023px - 1439px) - up to 3 columns are recommended (default: 2) + * - **XL** (> 1439px) – up to 6 columns are recommended (default: 2) + * + * To change the layout, use the `layout` property - f.e. layout="S1 M2 L3 XL6". + * + * ### Groups + * + * To make better use of screen space, there is built-in logic to determine how many columns should a FormGroup occupy. + * + * - **Example #1** (perfect match): + * 4 columns and 4 groups: each group will use 1 column. + * + * - **Example #2** (balanced distribution): + * 4 columns and 2 groups: each group will use 2 columns. + * 6 columns and 2 groups: each group will use 3 columns. + * + * - **Example #3** (unbalanced distribution): + * 3 columns and 2 groups: the larger one will use 2 columns, the smaller 1 column. + * 5 columns and 3 groups: two of the groups will use 2 columns each, the smallest 1 column. + * + * **Note:** The size of a group element is determined by the number of FormItems assigned to it. + * In the case of equality, the first in the DOM will use more columns, and the last - fewer columns. + * + * - **Example #4** (more groups than columns): + * 3 columns and 4 groups: each FormGroup uses only 1 column, the last FormGroup will wrap on the second row. + * + * ### Groups Column Span + * + * To influence the built-in group distribution, described in the previous section, + * you can use the FormGroup's `columnSpan` property, that defines how many columns the group should expand to. + * + * ### Items Column Span + * + * FormItem's columnSpan property defines how many columns the form item should expand to inside a form group or the form. + * + * ### Items Label Span + * + * The placement of the labels depends on the size of the used column. + * If there is enough space, the labels are next to their associated fields, otherwise - above the fields. + * By default, the labels take 4/12 of the FormItem, leaving 8/12 parts to associated fields. + * You can control what space the labels should take via the `labelSpan` property. + * + * **For example:** To always place the labels on top set: `labelSpan="S12 M12 L12 XL12"` property. + * + * ### ES6 Module Import + * + * - import @ui5/webcomponents/dist/Form.js"; + * - import @ui5/webcomponents/dist/FormGroup.js"; + * - import @ui5/webcomponents/dist/FormItem.js"; + * + * @csspart header - Used to style the wrapper of the header. + * @csspart layout - Used to style the element defining the form column layout. + * @csspart column - Used to style a single column of the form column layout. + * + * @public + * @since 2.0.0 + */ +@customElement({ + tag: "ui5-form", + renderer: litRender, + styles: FormCss, + template: FormTemplate, + dependencies: [Title], +}) +class Form extends UI5Element { + /** + * Defines the number of columns to distribute the form content by breakpoint. + * + * Supported values: + * - `S` - 1 column by default (1 column is recommended) + * - `M` - 1 column by default (up to 2 columns are recommended) + * - `L` - 2 columns by default (up to 3 columns are recommended) + * - `XL` - 2 columns by default (up to 6 columns are recommended) + * + * @default "S1 M1 L2 XL2" + * @public + */ + @property({ type: String, defaultValue: "S1 M1 L2 XL2" }) + layout!: string; + + /** + * Defines the width proportion of the labels and fields of a FormItem by breakpoint. + * + * By default, the labels take 4/12 (or 1/3) of the form item in M,L and XL sizes, + * and 12/12 in S size, e.g in S the label is on top of its associated field. + * + * The supported values are between 1 and 12. Greater the number, more space the label will use. + * + * **Note:** If "12" is set, the label will be displayed on top of its assosiated field. + * @default "S12 M4 L4 XL4" + * @public + */ + @property({ type: String, defaultValue: "S12 M4 L4 XL4" }) + labelSpan!: string; + + /** + * Defines the header text of the component. + * + * **Note:** The property gets overridden by the `header` slot. + * + * @default "" + * @public + */ + @property() + headerText!: string; + + /** + * Defines the vertical spacing between form items. + * + * **Note:** If the Form is meant to be switched between "non-edit" and "edit" modes, + * we recommend using "Large" item spacing in "non-edit" mode, and "Normal" - for "edit" mode, + * to avoid "jumping" effect, caused by the hight difference between texts in "non-edit" mode and the input fields in "edit" mode. + * + * @default "Normal" + * @public + */ + @property({ type: FormItemSpacing, defaultValue: FormItemSpacing.Normal }) + itemSpacing!: `${FormItemSpacing}`; + + /** + * Defines the component header area. + * + * **Note:** When a `header` is provided, the `headerText` property is ignored. + * @public + */ + @slot({ type: HTMLElement }) + header!: Array; + + /** + * Defines the component content - FormGroups or FormItems. + * + * **Note:** Mixing FormGroups and standalone FormItems (not belonging to a group) is not supported. + * Either use FormGroups and make sure all FormItems are part of a FormGroup, or use just FormItems without any FormGroups. + * @public + */ + @slot({ + type: HTMLElement, + "default": true, + individualSlots: true, + invalidateOnChildChange: true, + }) + items!: Array; + + /** + * @private + */ + @property({ validator: Integer, defaultValue: 1 }) + columnsS!: number; + @property({ validator: Integer, defaultValue: 12 }) + labelSpanS!: number; + + @property({ validator: Integer, defaultValue: 1 }) + columnsM!: number; + @property({ validator: Integer, defaultValue: 4 }) + labelSpanM!: number; + + @property({ validator: Integer, defaultValue: 2 }) + columnsL!: number; + @property({ validator: Integer, defaultValue: 4 }) + labelSpanL!: number; + + @property({ validator: Integer, defaultValue: 2 }) + columnsXl!: number; + @property({ validator: Integer, defaultValue: 4 }) + labelSpanXl!: number; + + onBeforeRendering() { + // Parse the layout and set it to the FormGroups/FormItems. + this.setColumnLayout(); + + // Parse the labelSpan and set it to the FormGroups/FormItems. + this.setLabelSpan(); + + // Define how many columns a group should take. + this.setGroupsColSpan(); + } + + onAfterRendering() { + // Create additional CSS for number of columns that are not supported by default. + this.createAdditionalCSSStyleSheet(); + } + + setColumnLayout() { + const layoutArr = this.layout.split(" "); + layoutArr.forEach((breakpoint: string) => { + if (breakpoint.startsWith("S")) { + this.columnsS = parseInt(breakpoint.slice(1)); + } else if (breakpoint.startsWith("M")) { + this.columnsM = parseInt(breakpoint.slice(1)); + } else if (breakpoint.startsWith("L")) { + this.columnsL = parseInt(breakpoint.slice(1)); + } else if (breakpoint.startsWith("XL")) { + this.columnsXl = parseInt(breakpoint.slice(2)); + } + }); + } + + setLabelSpan() { + this.labelSpan.split(" ").forEach((breakpoint: string) => { + if (breakpoint.startsWith("S")) { + this.labelSpanS = parseInt(breakpoint.slice(1)); + } else if (breakpoint.startsWith("M")) { + this.labelSpanM = parseInt(breakpoint.slice(1)); + } else if (breakpoint.startsWith("L")) { + this.labelSpanL = parseInt(breakpoint.slice(1)); + } else if (breakpoint.startsWith("XL")) { + this.labelSpanXl = parseInt(breakpoint.slice(2)); + } + }); + + this.items.forEach((item: IFormItem) => { + item.labelSpan = this.labelSpan; + item.itemSpacing = this.itemSpacing; + }); + } + + setGroupsColSpan() { + if (!this.hasGroupItems) { + return; + } + + const itemsCount = this.items.length; + const sortedItems = [...this.items].sort((itemA: IFormItem, itemB: IFormItem) => { + return (itemB as FormGroup)?.items.length - (itemA as FormGroup)?.items.length; + }); + + sortedItems.forEach((item: IFormItem, idx: number) => { + item.colsXl = this.getGroupsColSpan(this.columnsXl, itemsCount, idx, item); + item.colsL = this.getGroupsColSpan(this.columnsL, itemsCount, idx, item); + item.colsM = this.getGroupsColSpan(this.columnsM, itemsCount, idx, item); + item.colsS = this.getGroupsColSpan(this.columnsS, itemsCount, idx, item); + }); + } + + getGroupsColSpan(cols: number, groups: number, index: number, group: IFormItem): number { + // Case 0: column span is set from outside. + if (group.columnSpan) { + return group.columnSpan; + } + + // CASE 1: The number of available columns match the number of groups, or only 1 column is available - each group takes 1 column. + // For example: 1 column - 1 group, 2 columns - 2 groups, 3 columns - 3 groups, 4columns - 4 groups + if (cols === 1 || cols <= groups) { + return 1; + } + + // CASE 2: The number of available columns IS multiple of the number of groups. + // For example: 2 column - 1 group, 3 columns - 1 groups, 4 columns - 1 group, 4 columns - 2 groups + if (cols % groups === 0) { + return cols / groups; + } + + // CASE 3: The number of available columns IS NOT multiple of the number of groups. + const MIN_COL_SPAN = 1; + const delta = cols - groups; + + // 7 cols & 4 groups => 2, 2, 2, 1 + if (delta <= groups) { + return index < delta ? MIN_COL_SPAN + 1 : MIN_COL_SPAN; + } + + // 7 cols & 3 groups => 3, 2, 2 + return index === 0 ? MIN_COL_SPAN + (delta - groups) + 1 : MIN_COL_SPAN + 1; + } + + get hasGroupItems(): boolean { + return this.items.some((item: IFormItem) => item.isGroup); + } + + get hasCustomHeader(): boolean { + return !!this.header.length; + } + + get ariaLabelledByID(): string | undefined { + return this.hasCustomHeader ? undefined : `${this._id}-header-text`; + } + + get groupItemsInfo(): Array { + return this.items.map((groupItem: IFormItem) => { + return { + groupItem, + classes: `ui5-form-column-spanL-${groupItem.colsL} ui5-form-column-spanXL-${groupItem.colsXl} ui5-form-column-spanM-${groupItem.colsM} ui5-form-column-spanS-${groupItem.colsS}`, + items: this.getItemsInfo((Array.from(groupItem.children) as Array)), + }; + }); + } + + get itemsInfo(): Array { + return this.getItemsInfo(); + } + + getItemsInfo(items?: Array): Array { + return (items || this.items).map((item: IFormItem) => { + return { + item, + classes: item.columnSpan ? `ui5-form-item-span-${item.columnSpan}` : "", + }; + }); + } + + createAdditionalCSSStyleSheet() { + [ + { breakpoint: "S", columns: this.columnsS }, + { breakpoint: "M", columns: this.columnsM }, + { breakpoint: "L", columns: this.columnsL }, + { breakpoint: "XL", columns: this.columnsXl }, + ].forEach(step => { + const additionalStyle: string | undefined = this.getAdditionalCSS(step.breakpoint, step.columns); + + if (additionalStyle) { + this.shadowRoot!.adoptedStyleSheets = [...this.shadowRoot!.adoptedStyleSheets, this.getCSSStyleSheet(additionalStyle)]; + } + }); + } + + getAdditionalCSS(step: string, colsNumber: number): string | undefined { + if (StepColumn[step as keyof typeof StepColumn] >= colsNumber) { + return; + } + + const key = `${step}-${colsNumber}`; + + if (!additionalStylesMap.has(key)) { + let containerQuery; + let supporedColumnsNumber!: number; + let stepSpanCSS = ""; + let cols = colsNumber; + + if (step === "S") { + supporedColumnsNumber = StepColumn.S; + containerQuery = `@container (max-width: 599px) {`; + } else if (step === "M") { + supporedColumnsNumber = StepColumn.M; + containerQuery = `@container (width > 599px) and (width < 1024px) {`; + } else if (step === "L") { + supporedColumnsNumber = StepColumn.L; + containerQuery = `@container (width > 1023px) and (width < 1439px) {`; + } else if (step === "XL") { + containerQuery = `@container (min-width: 1440px) {`; + supporedColumnsNumber = StepColumn.XL; + } + + while (cols > supporedColumnsNumber) { + stepSpanCSS += ` + :host([columns-${step.toLocaleLowerCase()}="${cols}"]) .ui5-form-layout { + grid-template-columns: repeat(${cols}, 1fr); + } + + .ui5-form-column-span${step}-${cols}, + .ui5-form-item-span-${cols} { + grid-column: span ${cols}; + } + + .ui5-form-column-span${step}-${cols} .ui5-form-group-layout { + grid-template-columns: repeat(${cols}, 1fr); + } + `; + cols--; + } + + const css = `${containerQuery}${stepSpanCSS}}`; + additionalStylesMap.set(key, css); + } + + return additionalStylesMap.get(key)!; + } + + getCSSStyleSheet(cssText: string): CSSStyleSheet { + const style = new CSSStyleSheet(); + style.replaceSync(cssText); + return style; + } +} + +Form.define(); + +export default Form; +export { + IFormItem, +}; diff --git a/packages/main/src/FormGroup.ts b/packages/main/src/FormGroup.ts new file mode 100644 index 000000000000..5616d913f263 --- /dev/null +++ b/packages/main/src/FormGroup.ts @@ -0,0 +1,105 @@ +import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; +import Integer from "@ui5/webcomponents-base/dist/types/Integer.js"; +import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js"; +import property from "@ui5/webcomponents-base/dist/decorators/property.js"; +import slot from "@ui5/webcomponents-base/dist/decorators/slot.js"; + +import type FormItem from "./FormItem.js"; +import type { IFormItem } from "./Form.js"; +import FormItemSpacing from "./types/FormItemSpacing.js"; + +/** + * @class + * + * ### Overview + * + * The FormGroup (ui5-form-group) represents a group inside the Form (ui5-form) component + * and it consists of FormItem (ui5-form-item) components. + * + * The layout of the FormGroup is mostly defined and controlled by the overarching Form (ui5-form) component. + * Still, one can influence the layout via the FormGroup's `columnSpan` property, + * that defines how many columns the group should expand to. + * + * ### Usage + * + * Тhe FormGroup (ui5-form-group) allows to split a Form into groups, + * e.g to group FormItems that logically belong together. + * + * ### ES6 Module Import + * + * - import @ui5/webcomponents/dist/FormGroup.js"; + * + * @public + * @since 2.0.0 + */ +@customElement("ui5-form-group") +class FormGroup extends UI5Element implements IFormItem { + /** + * Defines header text of the component. + * + * @default "" + * @public + */ + @property() + headerText!: string; + + /** + * Defines column span of the component, + * e.g how many columns the group should span to. + * + * @default undefined + * @public + */ + @property({ validator: Integer, defaultValue: undefined }) + columnSpan?: number; + + /** + * Defines the items of the component. + * @public + */ + @slot({ + type: HTMLElement, + "default": true, + }) + items!: Array; + + /** + * @private + */ + @property({ validator: Integer, defaultValue: 1 }) + colsS!: number; + + @property({ validator: Integer, defaultValue: 1 }) + colsM!: number; + + @property({ validator: Integer, defaultValue: 1 }) + colsL!: number; + + @property({ validator: Integer, defaultValue: 1 }) + colsXl!: number; + + @property({ type: FormItemSpacing, defaultValue: FormItemSpacing.Normal }) + itemSpacing!: `${FormItemSpacing}`; + + @property({ type: String, defaultValue: "S12 M4 L4 XL4" }) + labelSpan!: string; + + onBeforeRendering() { + this.processFormItems(); + } + + processFormItems() { + this.items.forEach((item: FormItem) => { + item.labelSpan = this.labelSpan; + item.itemSpacing = this.itemSpacing; + }); + } + + get isGroup() { + return true; + } +} + +FormGroup.define(); + +export default FormGroup; diff --git a/packages/main/src/FormItem.hbs b/packages/main/src/FormItem.hbs new file mode 100644 index 000000000000..f38e5da27b20 --- /dev/null +++ b/packages/main/src/FormItem.hbs @@ -0,0 +1,14 @@ +
+
+
+ +
+
+ {{#each content}} +
+ +
+ {{/each}} +
+
+
\ No newline at end of file diff --git a/packages/main/src/FormItem.ts b/packages/main/src/FormItem.ts new file mode 100644 index 000000000000..1a6b0f16831f --- /dev/null +++ b/packages/main/src/FormItem.ts @@ -0,0 +1,100 @@ +import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; +import property from "@ui5/webcomponents-base/dist/decorators/property.js"; +import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js"; +import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; +import slot from "@ui5/webcomponents-base/dist/decorators/slot.js"; +import Integer from "@ui5/webcomponents-base/dist/types/Integer.js"; + +// Template +import FormItemTemplate from "./generated/templates/FormItemTemplate.lit.js"; + +// Styles +import FormItemCss from "./generated/themes/FormItem.css.js"; + +import type { IFormItem } from "./Form.js"; +import FormItemSpacing from "./types/FormItemSpacing.js"; + +/** + * @class + * + * ### Overview + * + * The FormItem (ui5-form-item) represents pair of a label and + * one or more components (text or text fields), associated to it. + * + * ### Usage + * + * The FormItem is being used in FormGroup (ui5-form-group) or directly in Form (ui5-form). + * + * ### ES6 Module Import + * + * - import @ui5/webcomponents/dist/FormItem.js"; + * + * @csspart layout - Used to style the parent element of the label and content parts. + * @csspart label - Used to style the label part of the form item. + * @csspart content - Used to style the content part of the form item. + * + * @constructor + * @public + * @since 2.0.0 + */ +@customElement({ + tag: "ui5-form-item", + renderer: litRender, + styles: FormItemCss, + template: FormItemTemplate, +}) +class FormItem extends UI5Element implements IFormItem { + /** + * Defines the column span of the component, + * e.g how many columns the component should span to. + * + * **Note:** The column span should be a number between 1 and the available columns of the FormGroup (when items are placed in a group) + * or the Form. The available columns can be affected by the FormGroup#columnSpan and/or the Form#layout. + * A number bigger than the available columns won't take effect. + * + * @default undefined + * @public + */ + @property({ validator: Integer, defaultValue: undefined }) + columnSpan?: number; + + /** + * Defines the label of the component. + * @public + */ + @slot() + labelContent!: Array; + + /** + * Defines the content of the component, + * associated to `labelContent`. + * @public + */ + @slot({ + type: HTMLElement, + "default": true, + individualSlots: true, + }) + content!: Array; + + /** + * @private + */ + @property({ type: String, defaultValue: "S12 M4 L4 XL4" }) + labelSpan!: string; + + /** + * @private + */ + @property({ type: FormItemSpacing, defaultValue: FormItemSpacing.Normal }) + itemSpacing!: `${FormItemSpacing}`; + + get isGroup() { + return false; + } +} + +FormItem.define(); + +export default FormItem; diff --git a/packages/main/src/ListItemGroup.ts b/packages/main/src/ListItemGroup.ts index bfbfb56e76ed..73522c92aa34 100644 --- a/packages/main/src/ListItemGroup.ts +++ b/packages/main/src/ListItemGroup.ts @@ -26,7 +26,7 @@ import ListItemGroupHeader from "./ListItemGroupHeader.js"; * @constructor * @extends UI5Element * @public - * @since 2.0 + * @since 2.0.0 */ @customElement({ tag: "ui5-li-group", diff --git a/packages/main/src/Popup.ts b/packages/main/src/Popup.ts index d1c2919f0c8b..ea8b296a3449 100644 --- a/packages/main/src/Popup.ts +++ b/packages/main/src/Popup.ts @@ -177,7 +177,7 @@ abstract class Popup extends UI5Element { * Indicates whether initial focus should be prevented. * @public * @default false - * @since 2.0 + * @since 2.0.0 */ @property({ type: Boolean }) preventInitialFocus!: boolean; diff --git a/packages/main/src/Tag.ts b/packages/main/src/Tag.ts index 31d257ae913f..b009abf510f5 100644 --- a/packages/main/src/Tag.ts +++ b/packages/main/src/Tag.ts @@ -134,7 +134,7 @@ class Tag extends UI5Element { * Defines predefined size of the component. * @default "S" * @public - * @since 2.0 + * @since 2.0.0 */ @property({ type: TagSize, defaultValue: TagSize.S }) size!: `${TagSize}`; diff --git a/packages/main/src/Tokenizer.ts b/packages/main/src/Tokenizer.ts index 6cac10cdf59f..956324a2ee35 100644 --- a/packages/main/src/Tokenizer.ts +++ b/packages/main/src/Tokenizer.ts @@ -128,8 +128,8 @@ enum ClipboardDataOperation { * * @constructor * @extends sap.ui.webc.base.UI5Element - * @since 2.0 * @public + * @since 2.0.0 */ @customElement({ tag: "ui5-tokenizer", diff --git a/packages/main/src/bundle.esm.ts b/packages/main/src/bundle.esm.ts index 97a1b5bc9b6d..47ace49c7fb9 100644 --- a/packages/main/src/bundle.esm.ts +++ b/packages/main/src/bundle.esm.ts @@ -115,6 +115,9 @@ import DatePicker from "./DatePicker.js"; import DateRangePicker from "./DateRangePicker.js"; import DateTimePicker from "./DateTimePicker.js"; import Dialog from "./Dialog.js"; +import Form from "./Form.js"; +import FormItem from "./FormItem.js"; +import FormGroup from "./FormGroup.js"; import FileUploader from "./FileUploader.js"; import Icon from "./Icon.js"; import Input from "./Input.js"; diff --git a/packages/main/src/themes/Form.css b/packages/main/src/themes/Form.css new file mode 100644 index 000000000000..28fd2c90948b --- /dev/null +++ b/packages/main/src/themes/Form.css @@ -0,0 +1,50 @@ +@import "./FormLayout.css"; +@import "./FormLabelSpan.css"; + +:host { + display: block; +} + +.ui5-form-root { + display: flex; + flex-direction: column; + background-color: var(--sapGroup_ContentBackground); + border-radius: 0.75rem; + container-type: inline-size; +} + +.ui5-form-header { + display: flex; + height: 2.75rem; + align-items: center; + border-bottom: 1px solid var(--sapGroup_TitleBorderColor); + padding: 0 1rem 0 1rem; +} + +.ui5-form-layout { + display: grid; + column-gap: 1rem; + row-gap: 0.125rem; + padding: 1rem 0.75rem; +} + +.ui5-form-group-layout { + display: grid; + column-gap: 1rem; +} + +.ui5-form-group-heading { + height: var(--_ui5-form-group-heading-height); + line-height: var(--_ui5-form-group-heading-height); + padding-inline-start: 0.25rem; +} + +.ui5-form-column { + padding-top: 0.5rem; + padding-bottom: 1rem; + box-sizing: border-box; +} + +::slotted([ui5-form-group]) { + display: contents; +} diff --git a/packages/main/src/themes/FormItem.css b/packages/main/src/themes/FormItem.css new file mode 100644 index 000000000000..446eda5d6b96 --- /dev/null +++ b/packages/main/src/themes/FormItem.css @@ -0,0 +1,65 @@ +:host([column-span="1"]) { + grid-column: span 1; +} + +:host([column-span="2"]) { + grid-column: span 2; +} + +:host([column-span="3"]) { + grid-column: span 3; +} + +:host([column-span="4"]) { + grid-column: span 4; +} + +:host([column-span="5"]) { + grid-column: span 5; +} +:host([column-span="6"]) { + grid-column: span 6; +} + +.ui5-form-item-root { + container-type: inline-size; + background-color: inherit; + color: inherit; +} + +.ui5-form-item-layout { + display: grid; + grid-template-columns: var(--ui5-form-item-layout); + align-items: center; +} + +.ui5-form-item-label { + padding: var(--ui5-form-item-label-padding); + padding-inline-end: var(--ui5-form-item-label-padding-end); + justify-self: var(--ui5-form-item-label-justify); +} + +.ui5-form-item-content { + display: flex; + padding: 0 0.25rem; +} + +.ui5-form-item-content-child { + padding-inline-end: 0.5rem; + box-sizing: border-box; + width: 100%; +} + +:host([item-spacing="Large"]) .ui5-form-item-layout { + min-height: var(--_ui5_form_item_min_height); + padding-top: var(--_ui5_form_item_padding); + padding-bottom: var(--_ui5_form_item_padding); + box-sizing: border-box; +} + +::slotted([ui5-input]) { + width: 100%; +} +::slotted([ui5-select]) { + width: 100%; +} \ No newline at end of file diff --git a/packages/main/src/themes/FormLabelSpan.css b/packages/main/src/themes/FormLabelSpan.css new file mode 100644 index 000000000000..bfbe6c150755 --- /dev/null +++ b/packages/main/src/themes/FormLabelSpan.css @@ -0,0 +1,267 @@ +/* +* The Form's labels take 4 cells out 12 in M, L ans XL sizes, +* and 12 cells (whole row) in S size. +* The ratio can be changed trough the labelSpan property. +*/ + +/* S - 12 cells */ +@container (max-width: 600px) { + :host([label-span-s="1"]) .ui5-form-item, + :host([label-span-s="1"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span1); + } + + :host([label-span-s="2"]) .ui5-form-item, + :host([label-span-s="2"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span2); + } + + :host([label-span-s="3"]) .ui5-form-item, + :host([label-span-s="3"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span3); + } + + :host([label-span-s="4"]) .ui5-form-item, + :host([label-span-s="4"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span4); + } + + :host([label-span-s="5"]) .ui5-form-item, + :host([label-span-s="5"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span5); + } + + :host([label-span-s="6"]) .ui5-form-item, + :host([label-span-s="6"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span6); + } + + :host([label-span-s="7"]) .ui5-form-item, + :host([label-span-s="7"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span7); + } + + :host([label-span-s="8"]) .ui5-form-item, + :host([label-span-s="8"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span8); + } + + :host([label-span-s="9"]) .ui5-form-item, + :host([label-span-s="9"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span9); + } + + :host([label-span-s="10"]) .ui5-form-item, + :host([label-span-s="10"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span10); + } + + :host([label-span-s="11"]) .ui5-form-item, + :host([label-span-s="11"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span11); + } + + :host(:not([label-span-s])) .ui5-form-item, + :host(:not([label-span-s])) .ui5-form-group, + :host([label-span-s="12"]) .ui5-form-item, + :host([label-span-s="12"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span12); + --ui5-form-item-label-justify: var(--ui5-form-item-label-justify-span12); + --ui5-form-item-label-padding: var(--ui5-form-item-label-padding-span12); + } +} + +/* M - 4 cells by default, up to 12 cells */ +@container (width > 600px) and (width <= 1024px) { + :host([label-span-m="1"]) .ui5-form-item, + :host([label-span-m="1"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span1); + } + + :host([label-span-m="2"]) .ui5-form-item, + :host([label-span-m="2"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span2); + } + + :host([label-span-m="3"]) .ui5-form-item, + :host([label-span-m="3"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span3); + } + + :host([label-span-m="4"]) .ui5-form-item, + :host([label-span-m="4"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span4); + } + + :host([label-span-m="5"]) .ui5-form-item, + :host([label-span-m="5"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span5); + } + + :host([label-span-m="6"]) .ui5-form-item, + :host([label-span-m="6"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span6); + } + + :host([label-span-m="7"]) .ui5-form-item, + :host([label-span-m="7"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span7); + } + + :host([label-span-m="8"]) .ui5-form-item, + :host([label-span-m="8"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span8); + } + + :host([label-span-m="9"]) .ui5-form-item, + :host([label-span-m="9"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span9); + } + + :host([label-span-m="10"]) .ui5-form-item, + :host([label-span-m="10"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span10); + } + + :host([label-span-m="11"]) .ui5-form-item, + :host([label-span-m="11"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span11); + } + + :host([label-span-m="12"]) .ui5-form-item, + :host([label-span-m="12"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span12); + --ui5-form-item-label-justify: var(--ui5-form-item-label-justify-span12); + --ui5-form-item-label-padding: var(--ui5-form-item-label-padding-span12); + } +} + +/* L - 4 cells by default, up to 12 cells */ +@container (width > 1024px) and (width <= 1440px) { + :host([label-span-l="1"]) .ui5-form-item, + :host([label-span-l="1"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span1); + } + + :host([label-span-l="2"]) .ui5-form-item, + :host([label-span-l="2"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span2); + } + + :host([label-span-l="3"]) .ui5-form-item, + :host([label-span-l="3"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span3); + } + + :host([label-span-l="4"]) .ui5-form-item, + :host([label-span-l="4"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span4); + } + + :host([label-span-l="5"]) .ui5-form-item, + :host([label-span-l="5"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span5); + } + + :host([label-span-l="6"]) .ui5-form-item, + :host([label-span-l="6"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span6); + } + + :host([label-span-l="7"]) .ui5-form-item, + :host([label-span-l="7"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span7); + } + + :host([label-span-l="8"]) .ui5-form-item, + :host([label-span-l="8"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span8); + } + + :host([label-span-l="9"]) .ui5-form-item, + :host([label-span-l="9"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span9); + } + + :host([label-span-l="10"]) .ui5-form-item, + :host([label-span-l="10"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span10); + } + + :host([label-span-l="11"]) .ui5-form-item, + :host([label-span-l="11"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span11); + } + + :host([label-span-l="12"]) .ui5-form-item, + :host([label-span-l="12"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span12); + --ui5-form-item-label-justify: var(--ui5-form-item-label-justify-span12); + --ui5-form-item-label-padding: var(--ui5-form-item-label-padding-span12); + } +} + +/* XL - 4 cells by default, up to 12 cells */ +@container (min-width: 1441px) { + :host([label-span-xl="1"]) .ui5-form-item, + :host([label-span-xl="1"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span1); + } + + :host([label-span-xl="2"]) .ui5-form-item, + :host([label-span-xl="2"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span2); + } + + :host([label-span-xl="3"]) .ui5-form-item, + :host([label-span-xl="3"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span3); + } + + :host([label-span-xl="4"]) .ui5-form-item, + :host([label-span-xl="4"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span4); + } + + :host([label-span-xl="5"]) .ui5-form-item, + :host([label-span-xl="5"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span5); + } + + :host([label-span-xl="6"]) .ui5-form-item, + :host([label-span-xl="6"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span6); + } + + :host([label-span-xl="7"]) .ui5-form-item, + :host([label-span-xl="7"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span7); + } + + :host([label-span-xl="8"]) .ui5-form-item, + :host([label-span-xl="8"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span8); + } + + :host([label-span-xl="9"]) .ui5-form-item, + :host([label-span-xl="9"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span9); + } + + :host([label-span-xl="10"]) .ui5-form-item, + :host([label-span-xl="10"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span10); + } + + :host([label-span-xl="11"]) .ui5-form-item, + :host([label-span-xl="11"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span11); + } + + :host([label-span-xl="12"]) .ui5-form-item, + :host([label-span-xl="12"]) .ui5-form-group { + --ui5-form-item-layout: var(--ui5-form-item-layout-span12); + --ui5-form-item-label-justify: var(--ui5-form-item-label-justify-span12); + --ui5-form-item-label-padding: var(--ui5-form-item-label-padding-span12); + } +} \ No newline at end of file diff --git a/packages/main/src/themes/FormLayout.css b/packages/main/src/themes/FormLayout.css new file mode 100644 index 000000000000..56b87013a9dc --- /dev/null +++ b/packages/main/src/themes/FormLayout.css @@ -0,0 +1,159 @@ +/* +* The Form layout is divided into one or more columns. +* XL - max. 4 columns, L - max. 3 columns, M - max. 2 columns and S - 1 column. +*/ +/* +* S max-width: 600px - container padding 24px +*/ + +/* S - 1 column */ +@container (max-width: 600px) { + .ui5-form-layout { + grid-template-columns: 1fr; + } + + ::slotted(*) { + justify-self: start; + } + ::slotted(:nth-child(2n)){ + margin-bottom: 0.5rem; + } +} + +/* M - 1 column by default, up to 2 columns */ +@container (width > 600px) and (width <= 1024px) { + .ui5-form-layout { + grid-template-columns: 1fr; + } + :host([columns-m="1"]) .ui5-form-layout { + grid-template-columns: 1fr; + } + :host([columns-m="2"]) .ui5-form-layout { + grid-template-columns: repeat(2, 1fr); + } + + .ui5-form-column-spanM-2 { + grid-column: span 2; + } + + .ui5-form-column-spanM-2 .ui5-form-group-layout { + grid-template-columns: repeat(2, 1fr); + } +} + +/* L - 2 columns by default, up to 3 columns */ +@container (width > 1024px) and (width <= 1440px) { + + .ui5-form-layout { + grid-template-columns: repeat(2, 1fr); + } + .ui5-form-column { + grid-template-columns: 1fr; + } + + :host([columns-l="1"]) .ui5-form-layout { + grid-template-columns: 1fr; + } + :host([columns-l="2"]) .ui5-form-layout { + grid-template-columns: repeat(2, 1fr); + } + :host([columns-l="3"]) .ui5-form-layout { + grid-template-columns: repeat(3, 1fr); + } + + .ui5-form-column-spanL-2 { + grid-column: span 2; + } + .ui5-form-column-spanL-2 .ui5-form-group-layout { + grid-template-columns: repeat(2, 1fr); + } + + .ui5-form-column-spanL-3 { + grid-column: span 3; + } + .ui5-form-column-spanL-3 .ui5-form-group-layout { + grid-template-columns: repeat(3, 1fr); + } +} + +/* XL - 2 columns by default, up to 6 */ +@container (min-width: 1441px) { + .ui5-form-layout { + grid-template-columns: repeat(2, 1fr); + } + + :host([columns-xl="1"]) .ui5-form-layout { + grid-template-columns: 1fr; + } + :host([columns-xl="2"]) .ui5-form-layout { + grid-template-columns: repeat(2, 1fr); + } + :host([columns-xl="3"]) .ui5-form-layout { + grid-template-columns: repeat(3, 1fr); + } + :host([columns-xl="4"]) .ui5-form-layout { + grid-template-columns: repeat(4, 1fr); + } + :host([columns-xl="5"]) .ui5-form-layout { + grid-template-columns: repeat(5, 1fr); + } + :host([columns-xl="6"]) .ui5-form-layout { + grid-template-columns: repeat(6, 1fr); + } + + .ui5-form-column-spanXL-2 { + grid-column: span 2; + } + .ui5-form-column-spanXL-2 .ui5-form-group-layout { + grid-template-columns: repeat(2, 1fr); + } + + .ui5-form-column-spanXL-3 { + grid-column: span 3; + } + .ui5-form-column-spanXL-3 .ui5-form-group-layout { + grid-template-columns: repeat(3, 1fr); + } + + .ui5-form-column-spanXL-4 { + grid-column: span 4; + } + .ui5-form-column-spanXL-4 .ui5-form-group-layout { + grid-template-columns: repeat(4, 1fr); + + } + + .ui5-form-column-spanXL-5 { + grid-column: span 5; + } + .ui5-form-column-spanXL-5 .ui5-form-group-layout { + grid-template-columns: repeat(5, 1fr); + + } + + .ui5-form-column-spanXL-6 { + grid-column: span 6; + } + .ui5-form-column-spanXL-6 .ui5-form-group-layout { + grid-template-columns: repeat(6, 1fr); + } +} + +.ui5-form-item-span-2 { + grid-column: span 2; +} + +.ui5-form-item-span-3 { + grid-column: span 3; +} + +.ui5-form-item-span-4 { + grid-column: span 4; +} + +.ui5-form-item-span-5 { + grid-column: span 5; +} +.ui5-form-item-span-6 { + grid-column: span 6; +} diff --git a/packages/main/src/themes/base/Form-parameters.css b/packages/main/src/themes/base/Form-parameters.css new file mode 100644 index 000000000000..958e9fb34292 --- /dev/null +++ b/packages/main/src/themes/base/Form-parameters.css @@ -0,0 +1,20 @@ +:root { + --ui5-form-item-layout: 1fr 2fr; + --ui5-form-item-layout-span1: 1fr 11fr; + --ui5-form-item-layout-span2: 2fr 10fr; + --ui5-form-item-layout-span3: 3fr 9fr; + --ui5-form-item-layout-span4: 4fr 8fr; + --ui5-form-item-layout-span5: 5fr 7fr; + --ui5-form-item-layout-span6: 6fr 6fr; + --ui5-form-item-layout-span7: 7fr 5fr; + --ui5-form-item-layout-span8: 8fr 4fr; + --ui5-form-item-layout-span9: 9fr 3fr; + --ui5-form-item-layout-span10: 10fr 2fr; + --ui5-form-item-layout-span11: 11fr 1fr; + --ui5-form-item-layout-span12: 1fr; + --ui5-form-item-label-justify: end; + --ui5-form-item-label-justify-span12: start; + --ui5-form-item-label-padding: 0.125rem 0; + --ui5-form-item-label-padding-end: 0.85rem; + --ui5-form-item-label-padding-span12: 0.625rem 0.25rem 0 0.25rem; +} \ No newline at end of file diff --git a/packages/main/src/themes/base/sizes-parameters.css b/packages/main/src/themes/base/sizes-parameters.css index d46f2f1d7a2c..350b85c58062 100644 --- a/packages/main/src/themes/base/sizes-parameters.css +++ b/packages/main/src/themes/base/sizes-parameters.css @@ -79,6 +79,11 @@ --_ui5_month_picker_item_height: 3rem; --_ui5_list_buttons_left_space: 0.125rem; + /* Form */ + --_ui5_form_item_min_height: 2.813rem; + --_ui5_form_item_padding: 0.65rem; + --_ui5-form-group-heading-height: 2.75rem; + /* Popup subclasses */ --_ui5_popup_default_header_height: 2.75rem; @@ -241,6 +246,11 @@ --_ui5_dialog_content_min_height: 2.5rem; --_ui5_dialog_footer_height: 2.5rem; + /* Form */ + --_ui5_form_item_min_height: 2rem; + --_ui5_form_item_padding: 0.25rem; + --_ui5-form-group-heading-height: 2rem; + /* Input */ --_ui5_input_height: var(--sapElement_Compact_Height); --_ui5_input_inner_padding: 0 0.5rem; diff --git a/packages/main/src/themes/sap_horizon/parameters-bundle.css b/packages/main/src/themes/sap_horizon/parameters-bundle.css index 8c58c954ed7b..b84a5584b55c 100644 --- a/packages/main/src/themes/sap_horizon/parameters-bundle.css +++ b/packages/main/src/themes/sap_horizon/parameters-bundle.css @@ -19,6 +19,7 @@ @import "../base/Dialog-parameters.css"; @import "./Dialog-parameters.css"; @import "./FileUploader-parameters.css"; +@import "../base/Form-parameters.css"; @import "../base/ListItemGroupHeader-parameters.css"; @import "./Icon-parameters.css"; @import "./Input-parameters.css"; diff --git a/packages/main/src/types/FormItemSpacing.ts b/packages/main/src/types/FormItemSpacing.ts new file mode 100644 index 000000000000..cc6ffe9cc240 --- /dev/null +++ b/packages/main/src/types/FormItemSpacing.ts @@ -0,0 +1,21 @@ +/** + * Different Button designs. + * + * @public + * @since 2.0.0 + */ +enum FormItemSpacing { + /** + * Normal spacing (smaller vertical space between form items). + * @public + */ + Normal = "Normal", + + /** + * Large spacing (larger vertical space between form items). + * @public + */ + Large = "Large", +} + +export default FormItemSpacing; diff --git a/packages/main/test/pages/MessageStrip.html b/packages/main/test/pages/MessageStrip.html index f5ad0161f038..073af57ec332 100644 --- a/packages/main/test/pages/MessageStrip.html +++ b/packages/main/test/pages/MessageStrip.html @@ -6,11 +6,6 @@ MessageStrip - @@ -71,4 +66,4 @@ }); - + \ No newline at end of file diff --git a/packages/main/test/pages/form.html b/packages/main/test/pages/form.html deleted file mode 100644 index 3d1e3564adcb..000000000000 --- a/packages/main/test/pages/form.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - Form support - - - - - - - - - - -
-

Input with suggestions

- - Cozy - Compact - Condensed - - -

Input disabled

- - - - -

Input readonly

- - -

Input type 'Number'

- - -

Input type 'Password'

- - -

Input type 'Email'

- - -

Input type 'Tel'

- - -

Input type 'URL'

- - - - -
- - -
- - Cozy - Compact - Condensed - - -
- - -
- - -
- -
- - -
- - -

- - - - - -

- - - - - -

- - Option 1
- Option 2
- Option 3 - -
- Does not submit forms - - Submits forms - - - - - - -
- -
- - - - - - - Submits forms - -
- - - diff --git a/packages/main/test/pages/form/FormBasic.html b/packages/main/test/pages/form/FormBasic.html new file mode 100644 index 000000000000..62b76faa9576 --- /dev/null +++ b/packages/main/test/pages/form/FormBasic.html @@ -0,0 +1,1053 @@ + + + + + + Form Basic + + + + + + + + + + + +
+ + +
+ + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + +
+ +
+


+ +
+ + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + +
+ +
+


+ +
+ + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + Delivery address: + Newtown + + +
+ +
+


+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + +
+ +
+


+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ +
+


+ + +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ +
+


+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ +
+ +
+ + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + +
+
+ + + + + diff --git a/packages/main/test/pages/form/FormEdit.html b/packages/main/test/pages/form/FormEdit.html new file mode 100644 index 000000000000..20bdd6b3cb89 --- /dev/null +++ b/packages/main/test/pages/form/FormEdit.html @@ -0,0 +1,261 @@ + + + + + + Form + + + + + + + + + + + +
+ + +
+ Item Spacing Large/Normal: + Edit +
+ +
+ + + Name: + Red Point Stores + + + + Country: + Germany + + + + ZIP Code/City: + 411 Maintown + + + + WebSite: + sap.com + + + + Street: + Main St 1618 + + + + Delivery address: + Newtown + + +
+ +
+ +
+ + + + diff --git a/packages/main/test/pages/form/FormGroups3.html b/packages/main/test/pages/form/FormGroups3.html new file mode 100644 index 000000000000..ebe0ab6b4341 --- /dev/null +++ b/packages/main/test/pages/form/FormGroups3.html @@ -0,0 +1,585 @@ + + + + + + + Form + + + + + + + + + + + +
+ + +
+ Column Layout: + + S1 M1 L2 XL2 + S1 M2 L2 XL2 + S1 M2 L3 XL2 + S1 M2 L3 XL3 + S1 M2 L3 XL4 + S1 M2 L3 XL5 + S1 M2 L3 XL6 + + + Label span + + S1 M1 L2 XL3 + S1 M1 L2 XL4 + S12 M4 L4 XL4 + S5 M5 L5 XL5 + S6 M6 L6 XL6 + S12 M12 L12 XL12 + +
+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ +


+ +
+ +


+ +
+ + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + +
+ +


+ +
+ + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: +
+ + +
+
+ + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + + + + Label: + + + + + + + + + + + + + + + + + Label: + + +
+ + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + +
+
+ +
+ + + + + Name: + + + + + + Address: + + + + Country: + + S1 M1 L2 XL2 + S1 M2 L2 XL2 + S1 M2 L3 XL2 + + + + + + Additional Comments: + + + + + Home Address: + + + + +
+
+ + + + diff --git a/packages/main/test/pages/form/FormGroups4.html b/packages/main/test/pages/form/FormGroups4.html new file mode 100644 index 000000000000..0feb44fb9415 --- /dev/null +++ b/packages/main/test/pages/form/FormGroups4.html @@ -0,0 +1,678 @@ + + + + + + + Form + + + + + + + + + + + +
+ + +
+ Column Layout: + + S1 M1 L2 XL2 + S1 M2 L2 XL2 + S1 M2 L3 XL2 + S1 M2 L3 XL3 + S1 M2 L3 XL4 + S1 M2 L3 XL5 + S1 M2 L3 XL6 + + + Label span + + S1 M1 L2 XL3 + S1 M1 L2 XL4 + S12 M4 L4 XL4 + S5 M5 L5 XL5 + S6 M6 L6 XL6 + S12 M12 L12 XL12 + +
+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + +
+ +


+ +
+ +


+ +
+ + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + +
+ +


+ +
+ + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: +
+ + +
+
+ + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + + + + Label: + + + + + + + + + + + + + + + + + Label: + + +
+ + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + + + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+
+
+
+ + + + diff --git a/packages/main/test/pages/form/FormGroups5.html b/packages/main/test/pages/form/FormGroups5.html new file mode 100644 index 000000000000..aa9ab74fc8fb --- /dev/null +++ b/packages/main/test/pages/form/FormGroups5.html @@ -0,0 +1,970 @@ + + + + + + + Form + + + + + + + + + + + +
+ + +
+ Column Layout: + + S1 M1 L2 XL2 + S1 M2 L2 XL2 + S1 M2 L3 XL2 + S1 M2 L3 XL3 + S1 M2 L3 XL4 + S1 M2 L3 XL5 + S1 M2 L3 XL6 + + + Label span + + S1 M1 L2 XL3 + S1 M1 L2 XL4 + S12 M4 L4 XL4 + S5 M5 L5 XL5 + S6 M6 L6 XL6 + S12 M12 L12 XL12 + +
+ +
+ + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + +
+ +


+ +
+ +


+ +
+ + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + +
+ +


+ +
+ +


+ +
+ + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: +
+ + +
+
+ + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + + + + Label: + + + + + + + + + + + + + + + + + Label: + + +
+ + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + + + + + Label: + + + + + Label: + + + + + Label: + + + + + Label: + + + + + + + Label: + + + + + Label: + + + +
+
+
+ + + + diff --git a/packages/main/test/pages/form/FormGroups6.html b/packages/main/test/pages/form/FormGroups6.html new file mode 100644 index 000000000000..cd6a21d4bc84 --- /dev/null +++ b/packages/main/test/pages/form/FormGroups6.html @@ -0,0 +1,979 @@ + + + + + + + Form + + + + + + + + + + + +
+ + +
+ Column Layout: + + S1 M1 L2 XL2 + S1 M2 L2 XL2 + S1 M2 L3 XL2 + S1 M2 L3 XL3 + S1 M2 L3 XL4 + S1 M2 L3 XL5 + S1 M2 L3 XL6 + + + Label span + + S1 M1 L2 XL3 + S1 M1 L2 XL4 + S12 M4 L4 XL4 + S5 M5 L5 XL5 + S6 M6 L6 XL6 + S12 M12 L12 XL12 + +
+ +
+ + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ +


+ +
+ +


+ +
+ + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + +
+ +


+ +
+ + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: +
+ + +
+
+ + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + + + + Label: + + + + + + + + + + + + + + + + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + + + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + + + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: +
+ + +
+
+ + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + + + + Label: + + + + + + + + + + + + + + + + + Label: + + +
+
+
+
+ + + + diff --git a/packages/main/test/pages/form/FormGroupsColSpan.html b/packages/main/test/pages/form/FormGroupsColSpan.html new file mode 100644 index 000000000000..3f6831bb9c18 --- /dev/null +++ b/packages/main/test/pages/form/FormGroupsColSpan.html @@ -0,0 +1,748 @@ + + + + + + + Form + + + + + + + + + + + +
+ + +
+ Column Layout: + + S1 M1 L2 XL2 + S1 M2 L2 XL2 + S1 M2 L3 XL2 + S1 M2 L3 XL3 + S1 M2 L3 XL4 + S1 M2 L3 XL5 + S1 M2 L3 XL6 + + + Label span + + S1 M1 L2 XL3 + S1 M1 L2 XL4 + S12 M4 L4 XL4 + S5 M5 L5 XL5 + S6 M6 L6 XL6 + S12 M12 L12 XL12 + +
+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + +
+ +


+ +
+ +


+ +
+ + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + + + +
+ +


+ +
+ + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: +
+ + +
+
+ + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + + + + Label: + + + + + + + + + + + + + + + + + Label: + + +
+ + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + + + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+
+
+ + +
+ + + + + Name: + + + + + Address: + + + + + Country: + + Argentina + Bulgaria + Denmark + + + + + Additional Comments: + + + + + + + + + + + Name: + + + + + + + Address: + + + + + Country: + + Argentina + Bulgaria + Denmark + + + + + + + Additional Comments: + + + + +
+ + + + diff --git a/packages/main/test/pages/form/FormLabelSpan.html b/packages/main/test/pages/form/FormLabelSpan.html new file mode 100644 index 000000000000..6b534b8d7a80 --- /dev/null +++ b/packages/main/test/pages/form/FormLabelSpan.html @@ -0,0 +1,711 @@ + + + + + + Form + + + + + + + + + + + +
+ + +
+ Label Span + + S12 M1 L1 XL1 + S12 M2 L2 XL2 + S12 M3 L3 XL3 + S12 M4 L4 XL4 + S12 M4 L4 XL5 + S12 M4 L4 XL6 + S12 M4 L5 XL6 + S12 M4 L6 XL6 + S12 M5 L6 XL6 + S12 M6 L6 XL6 + S12 M7 L7 XL7 + S12 M8 L8 XL8 + S12 M12 L12 XL12 + + + + Top + Side + +
+ +
+ + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + Delivery address: + Newtown + + +
+ +
+ +


+ +
+ + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + +
+ + +
+ +


+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ +
+


+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ +
+


+ +
+

Label always Top

+ + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + +
+
+ + + + diff --git a/packages/main/test/pages/form/FormMultipleColumns.html b/packages/main/test/pages/form/FormMultipleColumns.html new file mode 100644 index 000000000000..ffafa7688748 --- /dev/null +++ b/packages/main/test/pages/form/FormMultipleColumns.html @@ -0,0 +1,156 @@ + + + + + + Form with Multiple Columns + + + + + + + + +
+ + +
+ Column Layout: + + S1 M3 L4 XL4 + S2 M3 L5 XL5 + S2 M3 L5 XL6 + S2 M4 L5 XL7 + S2 M3 L6 XL8 + S3 M4 L6 XL8 + S3 M4 L7 XL9 + S3 M4 L10 XL12 + + + Label span: + + S1 M1 L2 XL3 + S1 M1 L2 XL4 + S12 M4 L4 XL4 + S5 M5 L5 XL5 + S6 M6 L6 XL6 + S12 M12 L12 XL12 + +
+ +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ + + + + diff --git a/packages/main/test/pages/styles/FormLayout.css b/packages/main/test/pages/styles/FormLayout.css new file mode 100644 index 000000000000..3b34ae5a8d92 --- /dev/null +++ b/packages/main/test/pages/styles/FormLayout.css @@ -0,0 +1,39 @@ +.bg { + background-color: var(--sapBackgroundColor); +} + +:not(:defined) { + display: none; +} +.banner {height: 1rem;container-type: inline-size; margin: 1rem 0} +.banner-inner {height: 1rem;background-color: red;} +@container (max-width: 600px) {.banner-inner {background-color: darkred;}} +@container (width > 600px) and (width <= 1024px) {.banner-inner {background-color: red;}} +@container (width > 1024px) and (width <= 1440px) {.banner-inner {background-color: orange;}} +@container (min-width: 1441px) {.banner-inner {background-color: yellow;}} + +.text { + display: inline-block; + box-sizing: border-box; + white-space: pre-line; + word-wrap: break-word; + cursor: text; + font-size: .875rem; + font-family: var(--sapFontFamily); + line-height: normal; + color: var(--sapTextColor); +} + + ui5-title { + margin-bottom: 2rem; +} + +.controls { + display: flex; + align-items: center; + flex-wrap: wrap; + margin-bottom: 2rem; +} +.controls > * { + margin: 0 0.25rem; +} \ No newline at end of file diff --git a/packages/main/test/pages/styles/form.css b/packages/main/test/pages/styles/form.css deleted file mode 100644 index e3c9d8562293..000000000000 --- a/packages/main/test/pages/styles/form.css +++ /dev/null @@ -1,7 +0,0 @@ -.form1auto { - background-color: var(--sapBackgroundColor); -} - -.form2auto { - width: 100% -} diff --git a/packages/main/test/specs/Form.spec.js b/packages/main/test/specs/Form.spec.js new file mode 100644 index 000000000000..d3416c99c892 --- /dev/null +++ b/packages/main/test/specs/Form.spec.js @@ -0,0 +1,106 @@ +import { assert } from "chai"; + +describe("General API", () => { + before(async () => { + await browser.url(`test/pages/form/FormBasic.html`); + }); + + it("tests calculated state of Form with layout='S1 M2 L3 XL6' and label-span='S12 M4 L4 XL4'", async () => { + const form = await browser.$("#testForm1"); + + // Given that layout="S1 M2 L3 XL6" and label-span="S12 M4 L4 XL4" + assert.strictEqual(await form.getProperty("columnsS"), 1, "Columns in S is 1."); + assert.strictEqual(await form.getProperty("labelSpanS"), 12, "Label span in S is 12."); + + assert.strictEqual(await form.getProperty("columnsM"), 2, "Columns in M are 2."); + assert.strictEqual(await form.getProperty("labelSpanM"), 4, "Label span in M is 4."); + + assert.strictEqual(await form.getProperty("columnsL"), 3, "Columns in L are 3."); + assert.strictEqual(await form.getProperty("labelSpanL"), 4, "Label span in L is 4."); + + assert.strictEqual(await form.getProperty("columnsXl"), 6, "Columns in XL are 6."); + assert.strictEqual(await form.getProperty("labelSpanXl"), 4, "Label span in XL is 4."); + }); + + it("tests calculated state of Form with layout='S1 M2 L2 XL3' label-span='S12 M12 L12 XL12'", async () => { + const form = await browser.$("#testForm2"); + + // Given that layout="S1 M2 L3 XL6" and label-span="S12 M4 L4 XL4" + assert.strictEqual(await form.getProperty("columnsS"), 1, "Columns in S is 1."); + assert.strictEqual(await form.getProperty("labelSpanS"), 12, "Label span in S is 12."); + + assert.strictEqual(await form.getProperty("columnsM"), 2, "Columns in M are 2."); + assert.strictEqual(await form.getProperty("labelSpanM"), 12, "Label span in M is 12."); + + assert.strictEqual(await form.getProperty("columnsL"), 2, "Columns in L are 2."); + assert.strictEqual(await form.getProperty("labelSpanL"), 12, "Label span in L is 12."); + + assert.strictEqual(await form.getProperty("columnsXl"), 3, "Columns in XL are 3."); + assert.strictEqual(await form.getProperty("labelSpanXl"), 12, "Label span in XL is 12."); + }); + + it("tests calculated state of two FormGroups in layout='S1 M2 L3 XL4'", async () => { + const formGr1 = await browser.$("#testFormGroup4"); + const formGr2 = await browser.$("#testFormGroup5"); + + // Gven that there are 2 groups and layout="S1 M2 L3 XL4" + assert.strictEqual(await formGr1.getProperty("colsS"), 1, "In S both groups take by 1 column."); + assert.strictEqual(await formGr2.getProperty("colsS"), 1, "In M both groups take by 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsM"), 1, "In M both groups take by 1 column."); + assert.strictEqual(await formGr2.getProperty("colsM"), 1, "In M both groups take by 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsL"), 1, "Group1 takes 1 column in L."); + assert.strictEqual(await formGr2.getProperty("colsL"), 2, "Group1 takes 2 columns in L."); + + assert.strictEqual(await formGr1.getProperty("colsXl"), 2, "In XL both groups take 2 cols each."); + assert.strictEqual(await formGr2.getProperty("colsXl"), 2, "In XL both groups take 2 cols each."); + }); + + it("tests calculated state of three FormGroups in layout='S1 M2 L3 XL6'", async () => { + const formGr1 = await browser.$("#testFormGroup1"); + const formGr2 = await browser.$("#testFormGroup2"); + const formGr3 = await browser.$("#testFormGroup3"); + + // Gven that there are 3 groups and layout="S1 M2 L3 XL6" + assert.strictEqual(await formGr1.getProperty("colsS"), 1, "In S all groups take 1 column."); + assert.strictEqual(await formGr2.getProperty("colsS"), 1, "In S all groups take 1 column."); + assert.strictEqual(await formGr3.getProperty("colsS"), 1, "In S all groups take 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsM"), 1, "In M all groups take 1 column."); + assert.strictEqual(await formGr2.getProperty("colsM"), 1, "In M all groups take 1 column."); + assert.strictEqual(await formGr3.getProperty("colsM"), 1, "In M all groups take 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsL"), 1, "In L all groups take 1 column."); + assert.strictEqual(await formGr2.getProperty("colsL"), 1, "In L all groups take 1 column."); + assert.strictEqual(await formGr3.getProperty("colsL"), 1, "In L all groups take 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsXl"), 2, "In XL both groups take 2 cols each."); + assert.strictEqual(await formGr2.getProperty("colsXl"), 2, "In XL both groups take 2 cols each."); + assert.strictEqual(await formGr3.getProperty("colsXl"), 2, "In XL both groups take 2 cols each."); + }); + + it("tests calculated state of three FormGroups in layout='S1 M2 L3 XL4'", async () => { + const formGr1 = await browser.$("#testFormGroup6"); + const formGr2 = await browser.$("#testFormGroup7"); + const formGr3 = await browser.$("#testFormGroup8"); + + // Gven that there are 3 groups and layout="S1 M2 L3 XL4" + assert.strictEqual(await formGr1.getProperty("colsS"), 1, "In S all groups take 1 column."); + assert.strictEqual(await formGr2.getProperty("colsS"), 1, "In S all groups take 1 column."); + assert.strictEqual(await formGr3.getProperty("colsS"), 1, "In S all groups take 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsM"), 1, "In M all groups take 1 column."); + assert.strictEqual(await formGr2.getProperty("colsM"), 1, "In M all groups take 1 column."); + assert.strictEqual(await formGr3.getProperty("colsM"), 1, "In M all groups take 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsL"), 1, "In L all groups take 1 column."); + assert.strictEqual(await formGr2.getProperty("colsL"), 1, "In L all groups take 1 column."); + assert.strictEqual(await formGr3.getProperty("colsL"), 1, "In L all groups take 1 column."); + + assert.strictEqual(await formGr1.getProperty("colsXl"), 1, "In XL first group takes 1 col."); + assert.strictEqual(await formGr2.getProperty("colsXl"), 2, "In XL second group takes 2 cols."); + assert.strictEqual(await formGr3.getProperty("colsXl"), 1, "In XL third group takes 1 col."); + }); + +}); diff --git a/packages/playground/_stories/main/Form/Form.stories.ts b/packages/playground/_stories/main/Form/Form.stories.ts new file mode 100644 index 000000000000..5bc437f34d9f --- /dev/null +++ b/packages/playground/_stories/main/Form/Form.stories.ts @@ -0,0 +1,26 @@ +import type { Meta } from "@storybook/web-components"; +import argTypes from "./argTypes.js"; + +import type Form from "@ui5/webcomponents/dist/Form.js"; + +import { FormGroup as FormGroupStory } from "./FormGroup.js"; +import { FormEdit as FormEditStory } from "./FormEdit.js"; +import { FormBasic as FormBasicStory } from "./FormBasic.js"; +import { FormLabelSpan as FormLabelSpanStory } from "./FormLabelSpan.js"; +import { FormGroupColumnSpan as FormGroupColumnSpanStory } from "./FormGroupColumnSpan.js"; +import { FormSingleGroup as FormSingleGroupStory } from "./FormSingleGroup.js"; +import { FormMultipleGroups as FormMultipleGroupsStory } from "./FormMultipleGroups.js"; + +export default { + title: "Main/Form", + component: "Form", + argTypes, +} as Meta
; + +export const FormBasic = FormBasicStory; +export const FormLabelSpan = FormLabelSpanStory; +export const FormEdit = FormEditStory; +export const FormGroup = FormGroupStory; +export const FormGroupColumnSpan = FormGroupColumnSpanStory; +export const FormSingleGroup = FormSingleGroupStory; +export const FormMultipleGroups = FormMultipleGroupsStory; diff --git a/packages/playground/_stories/main/Form/FormBasic.ts b/packages/playground/_stories/main/Form/FormBasic.ts new file mode 100644 index 000000000000..5d1579ca70a6 --- /dev/null +++ b/packages/playground/_stories/main/Form/FormBasic.ts @@ -0,0 +1,52 @@ +import { html } from "lit"; +import { ifDefined } from "lit/directives/if-defined.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import type Form from "@ui5/webcomponents/dist/Form.js"; +import FormItemSpacing from "@ui5/webcomponents/dist/types/FormItemSpacing.js"; +import type { UI5StoryArgs } from "../../../types.js"; +import type { StoryArgsSlots } from "./argTypes.js"; + +const Template: UI5StoryArgs = (args) => html` + + +
+ + ${unsafeHTML(args.default)} + +
+ +`; + +const FormBasic = Template.bind({}); +FormBasic.args = { + headerText: "Address", + layout: "S1 M1 L2 XL2", + labelSpan: "S12 M4 L4 XL4", + itemSpacing: FormItemSpacing.Normal, + default: ` + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + ` +}; + +export { FormBasic }; \ No newline at end of file diff --git a/packages/playground/_stories/main/Form/FormEdit.ts b/packages/playground/_stories/main/Form/FormEdit.ts new file mode 100644 index 000000000000..8ee091e2e5e0 --- /dev/null +++ b/packages/playground/_stories/main/Form/FormEdit.ts @@ -0,0 +1,142 @@ +import { html } from "lit"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import type Form from "@ui5/webcomponents/dist/Form.js"; +import type { UI5StoryArgs } from "../../../types.js"; +import type { StoryArgsSlots } from "./argTypes.js"; + +const FormEditTemplate: UI5StoryArgs = (args) => html` + +Edit + + ${unsafeHTML(args.default)} + + +`; +const FormEdit = FormEditTemplate.bind({}); +FormEdit.args = { + default: ` + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + WebSite: + sap.com + + + + Delivery address: + Newtown + ` +}; + +export { FormEdit }; \ No newline at end of file diff --git a/packages/playground/_stories/main/Form/FormGroup.ts b/packages/playground/_stories/main/Form/FormGroup.ts new file mode 100644 index 000000000000..e42b6b6560d9 --- /dev/null +++ b/packages/playground/_stories/main/Form/FormGroup.ts @@ -0,0 +1,108 @@ +import { html } from "lit"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import type Form from "@ui5/webcomponents/dist/Form.js"; +import type { UI5StoryArgs } from "../../../types.js"; +import type { StoryArgsSlots } from "./argTypes.js"; + +const FormGroupTemplate: UI5StoryArgs = (args) => html` + + ${unsafeHTML(args.default)} +`; + +const FormGroup = FormGroupTemplate.bind({}); +FormGroup.args = { + default: ` + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + ` +}; + +export { FormGroup }; diff --git a/packages/playground/_stories/main/Form/FormGroup/FormGroup.stories.ts b/packages/playground/_stories/main/Form/FormGroup/FormGroup.stories.ts new file mode 100644 index 000000000000..36b32123db3c --- /dev/null +++ b/packages/playground/_stories/main/Form/FormGroup/FormGroup.stories.ts @@ -0,0 +1,62 @@ +import { html } from "lit"; +import { ifDefined } from "lit/directives/if-defined.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import argTypes from "./argTypes.js"; +import type { Meta } from "@storybook/web-components"; +import type FormGroup from "@ui5/webcomponents/dist/FormGroup.js"; +import type { StoryArgsSlots } from "./argTypes.js"; +import type { UI5StoryArgs } from "../../../../types.js"; + +export default { + title: "Main/Form/FormGroup", + component: "FormGroup", + argTypes, +} as Meta; + +const Template: UI5StoryArgs = (args) => { + return html` + + + ${unsafeHTML(args.default)} + + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + `; +}; + +export const Basic = Template.bind({}); +Basic.args = { + headerText: "Contact", + columnSpan: 2, + default:` + + Name: + Red Point Stores + + + + Street: + Main St 1618 + + + + ZIP Code/City: + 411 Maintown + + ` +}; \ No newline at end of file diff --git a/packages/playground/_stories/main/Form/FormGroupColumnSpan.ts b/packages/playground/_stories/main/Form/FormGroupColumnSpan.ts new file mode 100644 index 000000000000..fd6ac9d24284 --- /dev/null +++ b/packages/playground/_stories/main/Form/FormGroupColumnSpan.ts @@ -0,0 +1,81 @@ +import { html } from "lit"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import type Form from "@ui5/webcomponents/dist/Form.js"; +import type { UI5StoryArgs } from "../../../types.js"; +import type { StoryArgsSlots } from "./argTypes.js"; + +const FormGroupColumnSpanTemplate: UI5StoryArgs = (args) => html` + + ${unsafeHTML(args.default)} +`; + +const FormGroupColumnSpan = FormGroupColumnSpanTemplate.bind({}); +FormGroupColumnSpan.args = { + default: ` + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + +` +}; + +export { FormGroupColumnSpan }; diff --git a/packages/playground/_stories/main/Form/FormItem/FormItem.stories.ts b/packages/playground/_stories/main/Form/FormItem/FormItem.stories.ts new file mode 100644 index 000000000000..34fd978afcef --- /dev/null +++ b/packages/playground/_stories/main/Form/FormItem/FormItem.stories.ts @@ -0,0 +1,44 @@ +import { html } from "lit"; +import argTypes from "./argTypes.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import type { Meta } from "@storybook/web-components"; +import type { StoryArgsSlots } from "./argTypes.js"; +import type { UI5StoryArgs } from "../../../../types.js"; + +import type FormItem from "@ui5/webcomponents/dist/FormItem.js"; + +export default { + title: "Main/Form/FormItem", + component: "FormItem", + argTypes, +} as Meta; + +const Template: UI5StoryArgs = (args) => { + return html` + + ${unsafeHTML(args.labelContent)} + ${unsafeHTML(args.default)} + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + `; +}; + +export const Basic = Template.bind({}); +Basic.args = { + labelContent: `Name:`, + default: `Red Point Stores` +} \ No newline at end of file diff --git a/packages/playground/_stories/main/Form/FormLabelSpan.ts b/packages/playground/_stories/main/Form/FormLabelSpan.ts new file mode 100644 index 000000000000..d3976b5b37be --- /dev/null +++ b/packages/playground/_stories/main/Form/FormLabelSpan.ts @@ -0,0 +1,102 @@ +import { html } from "lit"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import { ifDefined } from "lit/directives/if-defined.js"; +import type Form from "@ui5/webcomponents/dist/Form.js"; +import type { UI5StoryArgs } from "../../../types.js"; +import type { StoryArgsSlots } from "./argTypes.js"; + + +const FormLabelSpanTemplate: UI5StoryArgs = (args) => html` +
+ + + ${unsafeHTML(args.default)} + + +

+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + +
+`; + +const FormLabelSpan = FormLabelSpanTemplate.bind({}); +FormLabelSpan.args = { + labelSpan: "S12 M12 L12 XL12", + layout: "S1 M2 L2 XL2", + default: ` + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + ` +}; + +export { FormLabelSpan }; diff --git a/packages/playground/_stories/main/Form/FormMultipleGroups.ts b/packages/playground/_stories/main/Form/FormMultipleGroups.ts new file mode 100644 index 000000000000..7005cc5d05e2 --- /dev/null +++ b/packages/playground/_stories/main/Form/FormMultipleGroups.ts @@ -0,0 +1,178 @@ +import { html } from "lit"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import { ifDefined } from "lit/directives/if-defined.js"; +import type Form from "@ui5/webcomponents/dist/Form.js"; +import type { UI5StoryArgs } from "../../../types.js"; +import type { StoryArgsSlots } from "./argTypes.js"; + + +const FormMultipleGroupsTemplate: UI5StoryArgs = (args) => html` +
+ + + ${unsafeHTML(args.default)} + + +
+`; + +const FormMultipleGroups = FormMultipleGroupsTemplate.bind({}); +FormMultipleGroups.args = { + labelSpan: "S12 M12 L12 XL12", + layout: "S1 M2 L3 XL3", + default: ` + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: +
+ + +
+
+ + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + + + + Label: + + + + + + + + + + + + + + + + + Label: + + +
+ + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + + + + + Label: + + + + + Label: + + + + + Label: + + + + + Label: + + + + + + + Label: + + + + + Label: + + + ` +}; + +export { FormMultipleGroups }; diff --git a/packages/playground/_stories/main/Form/FormSingleGroup.ts b/packages/playground/_stories/main/Form/FormSingleGroup.ts new file mode 100644 index 000000000000..d97cfe70c98c --- /dev/null +++ b/packages/playground/_stories/main/Form/FormSingleGroup.ts @@ -0,0 +1,52 @@ +import { html } from "lit"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; +import { ifDefined } from "lit/directives/if-defined.js"; +import type Form from "@ui5/webcomponents/dist/Form.js"; +import type { UI5StoryArgs } from "../../../types.js"; +import type { StoryArgsSlots } from "./argTypes.js"; + + +const FormSingleGroupTemplate: UI5StoryArgs = (args) => html` + + ${unsafeHTML(args.default)} + +`; + +const FormSingleGroup = FormSingleGroupTemplate.bind({}); +FormSingleGroup.args = { + labelSpan: "S12 M12 L12 XL12", + layout: "S1 M1 L1 XL1", + default: ` + + + Name: + + + + + + Address: + + + + Country: + + Australia + Germany + England + + + + + + Additional Comments: + + + + + + + ` +}; + +export { FormSingleGroup }; diff --git a/packages/website/docs/_components_pages/main/Form/Form.mdx b/packages/website/docs/_components_pages/main/Form/Form.mdx new file mode 100644 index 000000000000..505ce5678ca5 --- /dev/null +++ b/packages/website/docs/_components_pages/main/Form/Form.mdx @@ -0,0 +1,97 @@ +--- +slug: ../../Form +sidebar_class_name: newComponentBadge expComponentBadge +--- + +import Basic from "../../../_samples/main/Form/Basic/Basic.md"; +import Groups from "../../../_samples/main/Form/Groups/Groups.md"; +import Edit from "../../../_samples/main/Form/Edit/Edit.md"; +import Layout from "../../../_samples/main/Form/Layout/Layout.md"; +import LabelSpan from "../../../_samples/main/Form/LabelSpan/LabelSpan.md"; +import LabelsOnTop from "../../../_samples/main/Form/LabelsOnTop/LabelsOnTop.md"; +import GroupColumnSpan from "../../../_samples/main/Form/GroupColumnSpan/GroupColumnSpan.md"; +import ItemColumnSpan from "../../../_samples/main/Form/ItemColumnSpan/ItemColumnSpan.md"; +import FreeStyleForm from "../../../_samples/main/Form/FreeStyleForm/FreeStyleForm.md"; +import CustomHeader from "../../../_samples/main/Form/CustomHeader/CustomHeader.md"; + +:::info +The Form, FormGroup and FormItem web components are availabe since 2.0 under an experimental flag and their API and behaviour are subject to change. +::: + + +<%COMPONENT_OVERVIEW%> + +## Basic Sample + + +<%COMPONENT_METADATA%> + +## More Samples + +### Layout +Use the Form#**layout** property to define the number of columns to distribute the form content by breakpoint. + +- S1 M2 L3 XL5 - 1 cols in S, 2 cols in M, 3 cols in L and 5 cols in XL +- S1 M2 L4 XL6 - 1 cols in S, 2 cols in M, 4 cols in L and 6 cols in XL +- S2 M3 L5 XL7 - 2 cols in S, 3 cols in M, 5 cols in L and 7 cols in XL + + + + + +### Groups +You can define groups via the **ui5-form-group** web component. + + + + + +### Label Span +Use the Form#**labelSpan** property to define the width proportion of the labels and fields of a FormItem by breakpoint. + +- S12 M4 L4 XL4 - the label takes 1/3 in M, L, XL +- S12 M6 L6 XL6 - the label takes 1/2 in M, L, XL +- S12 M12 L12 XL12 - the label takes the whole line and the texts gows on the next line (in all sizes) + + + + + +### Labels On Top +Force labels always on top Form#**labelSpan=S12 M12 L12 XL12**. + + + + + +### Edit +The Form has no built-in functionality to transform texts into inputs to implement editable forms. This is delegated to the consumers as shown in the sample. +**Note:** We recommend using "Large" item spacing in "display" mode, and "Normal" for "edit" mode, to avoid "jumping" effect of switching between texts and inputs. + + + + + +### Column Span + +#### FormGroup#**columnSpan** +The FormGroup#columnSpan property defines how many columns the form group should expand to. + + + +#### FormItem#**columnSpan** +The FormItem#**columnSpan** defines to how many columns the form item should expand to. + + + + +### Custom Header + +The Form provides a **header** slot that allows the usage of custom form header. + + + + +### Freestyle Form + + diff --git a/packages/website/docs/_components_pages/main/Form/FormGroup.mdx b/packages/website/docs/_components_pages/main/Form/FormGroup.mdx new file mode 100644 index 000000000000..3adbed72a057 --- /dev/null +++ b/packages/website/docs/_components_pages/main/Form/FormGroup.mdx @@ -0,0 +1,12 @@ +--- +slug: ../../FormGroup +--- + + +:::info +The Form, FormGroup and FormItem web components are availabe since 2.0 under an experimental flag and their API and behaviour are subject to change. +::: + +<%COMPONENT_OVERVIEW%> + +<%COMPONENT_METADATA%> \ No newline at end of file diff --git a/packages/website/docs/_components_pages/main/Form/FormItem.mdx b/packages/website/docs/_components_pages/main/Form/FormItem.mdx new file mode 100644 index 000000000000..86d51d8da2f4 --- /dev/null +++ b/packages/website/docs/_components_pages/main/Form/FormItem.mdx @@ -0,0 +1,11 @@ +--- +slug: ../../FormItem +--- + +:::info +The Form, FormGroup and FormItem web components are availabe since 2.0 under an experimental flag and their API and behaviour are subject to change. +::: + +<%COMPONENT_OVERVIEW%> + +<%COMPONENT_METADATA%> \ No newline at end of file diff --git a/packages/website/docs/_components_pages/main/Tokenizer.mdx b/packages/website/docs/_components_pages/main/Tokenizer.mdx index a39a0c15f524..ada83d3bfa4e 100644 --- a/packages/website/docs/_components_pages/main/Tokenizer.mdx +++ b/packages/website/docs/_components_pages/main/Tokenizer.mdx @@ -5,6 +5,10 @@ sidebar_class_name: newComponentBadge import Basic from "../../_samples/main/Tokenizer/Basic/Basic.md"; +:::info +The Tokenizer web component is availabe since 2.0 under an experimental flag and its API and behaviour are subject to change. +::: + <%COMPONENT_OVERVIEW%> ## Basic Sample diff --git a/packages/website/docs/_samples/main/Form/Basic/Basic.md b/packages/website/docs/_samples/main/Form/Basic/Basic.md new file mode 100644 index 000000000000..17798ecc59ab --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Basic/Basic.md @@ -0,0 +1,4 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; + + diff --git a/packages/website/docs/_samples/main/Form/Basic/main.js b/packages/website/docs/_samples/main/Form/Basic/main.js new file mode 100644 index 000000000000..0818d9b83fcb --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Basic/main.js @@ -0,0 +1,29 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/Slider.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/Basic/sample.html b/packages/website/docs/_samples/main/Form/Basic/sample.html new file mode 100644 index 000000000000..15e8c03a637c --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Basic/sample.html @@ -0,0 +1,47 @@ + + + + + + + + Sample + + + + + Form LayoutS1 M3 L4 XL4
+ Page SizeL + + +
+ + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + +
+ + + + + + + + diff --git a/packages/website/docs/_samples/main/Form/CustomHeader/CustomHeader.md b/packages/website/docs/_samples/main/Form/CustomHeader/CustomHeader.md new file mode 100644 index 000000000000..ef4652628b4d --- /dev/null +++ b/packages/website/docs/_samples/main/Form/CustomHeader/CustomHeader.md @@ -0,0 +1,5 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; +import css from '!!raw-loader!./main.css'; + + diff --git a/packages/website/docs/_samples/main/Form/CustomHeader/main.css b/packages/website/docs/_samples/main/Form/CustomHeader/main.css new file mode 100644 index 000000000000..a76fdbc6008d --- /dev/null +++ b/packages/website/docs/_samples/main/Form/CustomHeader/main.css @@ -0,0 +1,3 @@ +ui5-bar { + box-shadow: none; +} \ No newline at end of file diff --git a/packages/website/docs/_samples/main/Form/CustomHeader/main.js b/packages/website/docs/_samples/main/Form/CustomHeader/main.js new file mode 100644 index 000000000000..004cc301c438 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/CustomHeader/main.js @@ -0,0 +1,13 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormGroup.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Bar.js"; +import "@ui5/webcomponents/dist/Button.js"; +import "@ui5/webcomponents/dist/Title.js"; +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Input.js"; +import "@ui5/webcomponents/dist/Select.js"; +import "@ui5/webcomponents/dist/Option.js"; \ No newline at end of file diff --git a/packages/website/docs/_samples/main/Form/CustomHeader/sample.html b/packages/website/docs/_samples/main/Form/CustomHeader/sample.html new file mode 100644 index 000000000000..562e768e10a1 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/CustomHeader/sample.html @@ -0,0 +1,65 @@ + + + + + + + + Sample + + + + + + + + + + Address + Action 1 + Action 2 + + + + Name: + + + + + Country: + + Australia + Germany + England + + + + + ZIP Code/City: + + + + + + WebSite: + + + + + Street: + + + + + + Delivery address: + + + + + + + + + + diff --git a/packages/website/docs/_samples/main/Form/Edit/Edit.md b/packages/website/docs/_samples/main/Form/Edit/Edit.md new file mode 100644 index 000000000000..17798ecc59ab --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Edit/Edit.md @@ -0,0 +1,4 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; + + diff --git a/packages/website/docs/_samples/main/Form/Edit/main.js b/packages/website/docs/_samples/main/Form/Edit/main.js new file mode 100644 index 000000000000..73c1d1774a71 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Edit/main.js @@ -0,0 +1,106 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormGroup.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Input.js"; +import "@ui5/webcomponents/dist/Select.js"; +import "@ui5/webcomponents/dist/Option.js"; +import "@ui5/webcomponents/dist/Link.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/Slider.js"; +import "@ui5/webcomponents/dist/SegmentedButton.js"; +import "@ui5/webcomponents/dist/SegmentedButtonItem.js"; + +const swEditable = document.getElementById("swEditable"); +const editableForm = document.getElementById("editableForm"); + +swEditable.addEventListener("selection-change", function () { + const selectedItem = swEditable.selectedItems[0].textContent; + const editable = selectedItem === "Edit"; + + // clear previous form items + while (editableForm.firstChild) { + editableForm.removeChild(editableForm.firstChild); + } + + // append texts or inputs depending on the edit/display mode + editableForm.insertAdjacentHTML("afterbegin", editable ? editTemplate : displayTemplate); + + // set itemSpacing Normal/Large to avoid jumping when switching from texts to inputs. + editableForm.itemSpacing = editable ? "Normal" : "Large"; +}); + + + +const displayTemplate = ` + + Name: + Red Point Stores + + + + Country: + Germany + + + + ZIP Code/City: + 411 Maintown + + + + WebSite: + sap.com + + + + Street: + Main St 1618 + + + + Delivery address: + Newtown + +`; + + const editTemplate = ` + + Name: + + + + + Country: + + Australia + Germany + England + + + + + ZIP Code/City: + + + + + + WebSite: + + + + + Street: + + + + + + Delivery address: + + + `; \ No newline at end of file diff --git a/packages/website/docs/_samples/main/Form/Edit/sample.html b/packages/website/docs/_samples/main/Form/Edit/sample.html new file mode 100644 index 000000000000..d4aa1075df71 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Edit/sample.html @@ -0,0 +1,60 @@ + + + + + + + + Sample + + + + + + + Display + Edit + + +
+ + + + Name: + Red Point Stores + + + + Country: + Germany + + + + ZIP Code/City: + 411 Maintown + + + + WebSite: + sap.com + + + + Street: + Main St 1618 + + + + Delivery address: + Newtown + + +
+ + + + + + + + diff --git a/packages/website/docs/_samples/main/Form/FreeStyleForm/FreeStyleForm.md b/packages/website/docs/_samples/main/Form/FreeStyleForm/FreeStyleForm.md new file mode 100644 index 000000000000..17798ecc59ab --- /dev/null +++ b/packages/website/docs/_samples/main/Form/FreeStyleForm/FreeStyleForm.md @@ -0,0 +1,4 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; + + diff --git a/packages/website/docs/_samples/main/Form/FreeStyleForm/main.js b/packages/website/docs/_samples/main/Form/FreeStyleForm/main.js new file mode 100644 index 000000000000..8030e02b0f5e --- /dev/null +++ b/packages/website/docs/_samples/main/Form/FreeStyleForm/main.js @@ -0,0 +1,43 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormGroup.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/CheckBox.js"; +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Switch.js"; +import "@ui5/webcomponents/dist/RadioButton.js"; +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Icon.js"; +import "@ui5/webcomponents/dist/TimePicker.js"; +import "@ui5/webcomponents/dist/FileUploader.js"; +import "@ui5/webcomponents/dist/Input.js"; +import "@ui5/webcomponents/dist/Slider.js"; +import "@ui5/webcomponents/dist/Select.js"; +import "@ui5/webcomponents/dist/Option.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/TextArea.js"; +import "@ui5/webcomponents/dist/MultiInput.js"; +import "@ui5/webcomponents/dist/Token.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/FreeStyleForm/sample.html b/packages/website/docs/_samples/main/Form/FreeStyleForm/sample.html new file mode 100644 index 000000000000..4aae25886b75 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/FreeStyleForm/sample.html @@ -0,0 +1,117 @@ + + + + + + + + Sample + + + + + + Form LayoutS1 M2 L3 XL4
+ Label SpanS12 M12 L12 XL12
+ Page SizeL + + +
+ + + + + Label: + + + + + Label: +
+ + UNIT +
+
+ + + Label: + + + + + Label: + + Browse... + + + + + Duration: + + + + + Label: + + + +
+ + + + + + + + Label: + +
+ + +
+
+ + + Label: + + +
+ + + + Label: + + Australia + Germany + England + + + + + Label: + + Australia + Germany + England + + + + + Label: + + + + + + + + +
+
+ + + + + + + diff --git a/packages/website/docs/_samples/main/Form/GroupColumnSpan/GroupColumnSpan.md b/packages/website/docs/_samples/main/Form/GroupColumnSpan/GroupColumnSpan.md new file mode 100644 index 000000000000..17798ecc59ab --- /dev/null +++ b/packages/website/docs/_samples/main/Form/GroupColumnSpan/GroupColumnSpan.md @@ -0,0 +1,4 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; + + diff --git a/packages/website/docs/_samples/main/Form/GroupColumnSpan/main.js b/packages/website/docs/_samples/main/Form/GroupColumnSpan/main.js new file mode 100644 index 000000000000..373b5f9661b1 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/GroupColumnSpan/main.js @@ -0,0 +1,31 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormGroup.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Link.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/Slider.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/GroupColumnSpan/sample.html b/packages/website/docs/_samples/main/Form/GroupColumnSpan/sample.html new file mode 100644 index 000000000000..9e012a18c77a --- /dev/null +++ b/packages/website/docs/_samples/main/Form/GroupColumnSpan/sample.html @@ -0,0 +1,123 @@ + + + + + + + + Sample + + + + + + Form LayoutS2 M2 L4 XL6
+ Label SpanS12 M12 L12 XL12
+ Page SizeXL + + +
+ + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + +
+ + + + + + + + diff --git a/packages/website/docs/_samples/main/Form/Groups/Groups.md b/packages/website/docs/_samples/main/Form/Groups/Groups.md new file mode 100644 index 000000000000..17798ecc59ab --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Groups/Groups.md @@ -0,0 +1,4 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; + + diff --git a/packages/website/docs/_samples/main/Form/Groups/main.js b/packages/website/docs/_samples/main/Form/Groups/main.js new file mode 100644 index 000000000000..373b5f9661b1 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Groups/main.js @@ -0,0 +1,31 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormGroup.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Link.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/Slider.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/Groups/sample.html b/packages/website/docs/_samples/main/Form/Groups/sample.html new file mode 100644 index 000000000000..f74b644cad5b --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Groups/sample.html @@ -0,0 +1,122 @@ + + + + + + + + Sample + + + + + + Form LayoutS1 M3 L4 XL4
+ Label SpanS12 M12 L12 XL4
+ Page SizeL + + +
+ + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ + + + + + + diff --git a/packages/website/docs/_samples/main/Form/ItemColumnSpan/ItemColumnSpan.md b/packages/website/docs/_samples/main/Form/ItemColumnSpan/ItemColumnSpan.md new file mode 100644 index 000000000000..17798ecc59ab --- /dev/null +++ b/packages/website/docs/_samples/main/Form/ItemColumnSpan/ItemColumnSpan.md @@ -0,0 +1,4 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; + + diff --git a/packages/website/docs/_samples/main/Form/ItemColumnSpan/main.js b/packages/website/docs/_samples/main/Form/ItemColumnSpan/main.js new file mode 100644 index 000000000000..5f2ba6de2302 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/ItemColumnSpan/main.js @@ -0,0 +1,35 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormGroup.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/CheckBox.js"; +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Input.js"; +import "@ui5/webcomponents/dist/Slider.js"; +import "@ui5/webcomponents/dist/Select.js"; +import "@ui5/webcomponents/dist/Option.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/TextArea.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/ItemColumnSpan/sample.html b/packages/website/docs/_samples/main/Form/ItemColumnSpan/sample.html new file mode 100644 index 000000000000..1f186fa6237e --- /dev/null +++ b/packages/website/docs/_samples/main/Form/ItemColumnSpan/sample.html @@ -0,0 +1,52 @@ + + + + + + + + Sample + + + + + + Form LayoutS2 M2 L2 XL2
+ Label SpanS12 M12 L12 XL12
+ Page SizeМ + + +
+ + + Name: + + + + + Address: + + + + + Country: + + Argentina + Bulgaria + Denmark + + + + + Additional Comments: + + + +
+ + + + + + + diff --git a/packages/website/docs/_samples/main/Form/LabelSpan/LabelSpan.md b/packages/website/docs/_samples/main/Form/LabelSpan/LabelSpan.md new file mode 100644 index 000000000000..ef4652628b4d --- /dev/null +++ b/packages/website/docs/_samples/main/Form/LabelSpan/LabelSpan.md @@ -0,0 +1,5 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; +import css from '!!raw-loader!./main.css'; + + diff --git a/packages/website/docs/_samples/main/Form/LabelSpan/main.css b/packages/website/docs/_samples/main/Form/LabelSpan/main.css new file mode 100644 index 000000000000..b1137b4e1a19 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/LabelSpan/main.css @@ -0,0 +1,6 @@ +ui5-form-item::part(layout) { + background: #72c9e1; +} +ui5-form-item::part(content) { + background: #eef9fc; +} \ No newline at end of file diff --git a/packages/website/docs/_samples/main/Form/LabelSpan/main.js b/packages/website/docs/_samples/main/Form/LabelSpan/main.js new file mode 100644 index 000000000000..0818d9b83fcb --- /dev/null +++ b/packages/website/docs/_samples/main/Form/LabelSpan/main.js @@ -0,0 +1,29 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/Slider.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/LabelSpan/sample.html b/packages/website/docs/_samples/main/Form/LabelSpan/sample.html new file mode 100644 index 000000000000..6ae8efdfc4e8 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/LabelSpan/sample.html @@ -0,0 +1,98 @@ + + + + + + + + Form Label Span Sample + + + + + + + Page SizeL + Label SpanS12 M4 L4 XL4
+ + +
+ + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + +

+ + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + +

+ + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + +
+ + + + + + + + diff --git a/packages/website/docs/_samples/main/Form/LabelsOnTop/LabelsOnTop.md b/packages/website/docs/_samples/main/Form/LabelsOnTop/LabelsOnTop.md new file mode 100644 index 000000000000..17798ecc59ab --- /dev/null +++ b/packages/website/docs/_samples/main/Form/LabelsOnTop/LabelsOnTop.md @@ -0,0 +1,4 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; + + diff --git a/packages/website/docs/_samples/main/Form/LabelsOnTop/main.js b/packages/website/docs/_samples/main/Form/LabelsOnTop/main.js new file mode 100644 index 000000000000..f6d6599bbf21 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/LabelsOnTop/main.js @@ -0,0 +1,32 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/Input.js"; +import "@ui5/webcomponents/dist/Select.js"; +import "@ui5/webcomponents/dist/Option.js"; +import "@ui5/webcomponents/dist/Slider.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/LabelsOnTop/sample.html b/packages/website/docs/_samples/main/Form/LabelsOnTop/sample.html new file mode 100644 index 000000000000..ba44e238047c --- /dev/null +++ b/packages/website/docs/_samples/main/Form/LabelsOnTop/sample.html @@ -0,0 +1,64 @@ + + + + + + + + Sample + + + + + + Form LayoutS1 M3 L4 XL4
+ Label SpanS12 M12 L12 XL12
+ Page SizeL + + +
+ + + Name: + + + + + ZIP Code/City: + + + + + + Street: + + + + + + Country: + + Australia + Germany + England + + + + + WebSite: + + + + + Delivery address: + + + +
+ + + + + + + diff --git a/packages/website/docs/_samples/main/Form/Layout/Layout.md b/packages/website/docs/_samples/main/Form/Layout/Layout.md new file mode 100644 index 000000000000..ef4652628b4d --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Layout/Layout.md @@ -0,0 +1,5 @@ +import html from '!!raw-loader!./sample.html'; +import js from '!!raw-loader!./main.js'; +import css from '!!raw-loader!./main.css'; + + diff --git a/packages/website/docs/_samples/main/Form/Layout/main.css b/packages/website/docs/_samples/main/Form/Layout/main.css new file mode 100644 index 000000000000..8a5e9176b223 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Layout/main.css @@ -0,0 +1,3 @@ +ui5-form::part(column) { + background: #eef9fc; +} \ No newline at end of file diff --git a/packages/website/docs/_samples/main/Form/Layout/main.js b/packages/website/docs/_samples/main/Form/Layout/main.js new file mode 100644 index 000000000000..373b5f9661b1 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Layout/main.js @@ -0,0 +1,31 @@ +import "@ui5/webcomponents/dist/Form.js"; +import "@ui5/webcomponents/dist/FormGroup.js"; +import "@ui5/webcomponents/dist/FormItem.js"; + + +// The following code is required only for the sample +import "@ui5/webcomponents/dist/Label.js"; +import "@ui5/webcomponents/dist/Link.js"; +import "@ui5/webcomponents/dist/Text.js"; +import "@ui5/webcomponents/dist/Slider.js"; + +const slider = document.getElementById("slider"); +const txtLayout = document.getElementById("txtLayout"); +const container = document.getElementById("container"); + +slider.addEventListener("ui5-input", () => { + const width = (slider.value / 100 * 1500); + container.style.width = `${width}px`; + txtLayout.innerHTML = getLayoutByWidth(width); +}); + +const getLayoutByWidth = (width) => { + if (width > 599 && width <= 1023) { + return "M"; + } else if (width >= 1024 && width <= 1439) { + return "L" + } else if (width >= 1440) { + return "XL" + } + return "S"; +}; diff --git a/packages/website/docs/_samples/main/Form/Layout/sample.html b/packages/website/docs/_samples/main/Form/Layout/sample.html new file mode 100644 index 000000000000..72c6b933d831 --- /dev/null +++ b/packages/website/docs/_samples/main/Form/Layout/sample.html @@ -0,0 +1,319 @@ + + + + + + + + Sample + + + + + + + Page SizeL + Label SpanS12 M12 L12 XL12
+ + +
+ + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + +

+ + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + +

+ + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + + + + Twitter: + @sap + + + + Email: + john.smith@sap.com + + + + Tel: + +49 6227 747474 + + + + SMS: + +49 6227 747474 + + + + Mobile: + +49 6227 747474 + + + + Pager: + +49 6227 747474 + + + + Fax: + +49 6227 747474 + + + + + + + Name: + Red Point Stores + + + + ZIP Code/City: + 411 Maintown + + + + Street: + Main St 1618 + + + + Country: + Germany + + + + WebSite: + sap.com + + + +
+ + + + + + + + diff --git a/packages/website/src/css/custom.css b/packages/website/src/css/custom.css index f825172385e4..7ff08c8d302b 100644 --- a/packages/website/src/css/custom.css +++ b/packages/website/src/css/custom.css @@ -194,14 +194,27 @@ code { } } -.newComponentBadge { +.newComponentBadge, +.expComponentBadge { position: relative; } +.expComponentBadge:before { + color: #fff; + position: absolute; + top: 0.25rem; + inset-inline-end: 3.25rem; + border-radius: 0.5rem; + padding: 0.125rem 0.25rem; + box-sizing: border-box; + font-size: 0.75rem; + content: "Experimental"; + background: #a100c2; + pointer-events: none; +} + .newComponentBadge:after { - content: "New"; color: #fff; - background: #334eff; position: absolute; top: 0.25rem; inset-inline-end: 1rem; @@ -209,4 +222,7 @@ code { padding: 0.125rem 0.25rem; box-sizing: border-box; font-size: 0.75rem; + content: "New"; + background: #334eff; + pointer-events: none; } \ No newline at end of file