diff --git a/projects/demo/src/modules/app/app.routes.ts b/projects/demo/src/modules/app/app.routes.ts index e07ad4f1c191..21eee25270ea 100644 --- a/projects/demo/src/modules/app/app.routes.ts +++ b/projects/demo/src/modules/app/app.routes.ts @@ -325,7 +325,7 @@ export const ROUTES: Routes = [ title: 'InputColor', }), route({ - path: DemoRoute.FormLayout, + path: DemoRoute.Form, loadComponent: async () => import('../components/form'), title: 'Form', }), @@ -748,11 +748,6 @@ export const ROUTES: Routes = [ loadComponent: async () => import('../markup/colors'), title: 'Colors', }), - route({ - path: DemoRoute.Form, - loadComponent: async () => import('../markup/form'), - title: 'Form ', - }), route({ path: DemoRoute.Lists, loadComponent: async () => import('../markup/lists'), diff --git a/projects/demo/src/modules/app/demo-routes.ts b/projects/demo/src/modules/app/demo-routes.ts index e056dd65fac4..01037bc17b95 100644 --- a/projects/demo/src/modules/app/demo-routes.ts +++ b/projects/demo/src/modules/app/demo-routes.ts @@ -59,7 +59,7 @@ export const DemoRoute = { Expand: '/components/expand', ElasticContainer: '/components/elastic-container', FieldError: '/pipes/field-error', - FormLayout: '/components/form', + Form: '/layout/form', InputFiles: '/components/input-files', InputColor: '/components/input-color', Group: '/components/group', @@ -148,7 +148,6 @@ export const DemoRoute = { PieChart: '/charts/pie-chart', RingChart: '/charts/ring-chart', Colors: '/colors', - Form: '/form', Lists: '/lists', Shadows: '/shadows', Spaces: '/spaces', diff --git a/projects/demo/src/modules/app/pages.ts b/projects/demo/src/modules/app/pages.ts index d96e7120f696..32422d280645 100644 --- a/projects/demo/src/modules/app/pages.ts +++ b/projects/demo/src/modules/app/pages.ts @@ -150,12 +150,6 @@ export const pages: DocRoutePages = [ 'layout, markup, отступы, margin, padding, маржин, падинг, spaces', route: DemoRoute.Spaces, }, - { - section: 'Foundations', - title: 'Form', - keywords: 'верстка, markup, форма, ввод, пример, input, form', - route: DemoRoute.Form, - }, ], }, // Components @@ -422,10 +416,10 @@ export const pages: DocRoutePages = [ route: DemoRoute.Filter, }, { - section: 'Components', + section: 'Layout', title: 'Form', keywords: 'форма, поле, кнопка, группировка, группа', - route: DemoRoute.FormLayout, + route: DemoRoute.Form, meta: {scheme: 'beaver', name: 'form'}, }, { diff --git a/projects/demo/src/modules/components/form/examples/2/index.html b/projects/demo/src/modules/components/form/examples/2/index.html new file mode 100644 index 000000000000..b8dc70016d7e --- /dev/null +++ b/projects/demo/src/modules/components/form/examples/2/index.html @@ -0,0 +1,315 @@ +
+
+ + + + + + +
+ +
+
+

A header

+
+ + + Textfield + + + + + + + Input date + + + + +
+
+ Input password + +
+
+ + Input money + + +
+
+
+ + Some slider + +
+ from 50 000 ₽ + to 3 000 000 ₽ +
+
Some additional text
+ +
+
+
+ + Choose a person + + + +
{{ data.firstName }} {{ data.lastName }}
+
+ +
+
+ Input phone + +
+
+
+

Header

+
+
+ + +
+
+ Input time +
+
+ + + + +
+
+

Header

+
+ + +
+

Header

+
+
+ + Textfield + + + +
+
+ + +
+ + + + +
diff --git a/projects/demo/src/modules/components/form/examples/2/index.less b/projects/demo/src/modules/components/form/examples/2/index.less new file mode 100644 index 000000000000..67edd78faf28 --- /dev/null +++ b/projects/demo/src/modules/components/form/examples/2/index.less @@ -0,0 +1,127 @@ +@import '@taiga-ui/core/styles/taiga-ui-local'; + +@fields-space: 1.25rem; +@fields-space-mobile: 1rem; +@fields-space-large: 0.75rem; +@fields-space-large-mobile: 1.5rem; + +:host { + display: block; +} + +.stepper { + margin-bottom: 2rem; +} + +.uppercase-name { + text-transform: uppercase; +} + +.account { + display: flex; + flex: 1; + justify-content: space-between; +} + +.ticks-labels { + .tui-slider-ticks-labels(); + + color: var(--tui-text-secondary); + margin-top: 0.25rem; +} + +.example2-form { + .multi-fields { + display: flex; + + @media @tui-mobile { + flex-wrap: wrap; + } + + .multi-field { + flex: 1 1 0; + min-inline-size: 0; + margin-left: @fields-space; + + &:first-child { + margin-left: 0; + } + + @media @tui-mobile { + flex-basis: 100%; + margin-top: @fields-space-mobile; + margin-left: 0; + + &:first-child { + margin-top: 0; + } + } + } + } + + .field-note { + font: var(--tui-font-text-s); + margin-top: 0.25rem; + color: var(--tui-text-secondary); + } + + .half-width { + inline-size: ~'calc(50% - (@{fields-space} / 2))'; + + @media @tui-mobile { + inline-size: 100%; + } + } + + .checkboxes { + display: flex; + flex-wrap: wrap; + + .checkbox { + flex: ~'1 1 calc(50% - 0.625rem)'; + + &:nth-child(even) { + margin-left: 1.25rem; + } + + &:nth-child(n + 3) { + margin-top: 1rem; + } + } + } + + .text-normal { + font: var(--tui-font-text-s); + } + + .buttons { + display: flex; + margin-top: @fields-space-large; + + &_align_end { + justify-content: flex-end; + } + + &_align_center { + justify-content: center; + } + + @media @tui-mobile { + flex-direction: column; + margin-top: @fields-space-large-mobile; + } + + .button { + margin-left: 0.75rem; + + &:first-child { + margin-left: 0; + } + + @media @tui-mobile { + margin-top: 0.5rem; + margin-left: 0; + } + } + } +} diff --git a/projects/demo/src/modules/markup/form/examples/1/index.ts b/projects/demo/src/modules/components/form/examples/2/index.ts similarity index 93% rename from projects/demo/src/modules/markup/form/examples/1/index.ts rename to projects/demo/src/modules/components/form/examples/2/index.ts index 28b5867ac28b..e77bbf869053 100644 --- a/projects/demo/src/modules/markup/form/examples/1/index.ts +++ b/projects/demo/src/modules/components/form/examples/2/index.ts @@ -4,7 +4,15 @@ import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/ import {changeDetection} from '@demo/emulate/change-detection'; import {TuiAmountPipe, TuiCurrency, TuiCurrencyPipe} from '@taiga-ui/addon-commerce'; import {TuiDay, TuiTime} from '@taiga-ui/cdk'; -import {TuiButton, TuiError, TuiGroup, TuiLabel} from '@taiga-ui/core'; +import { + TuiAppearance, + TuiButton, + TuiError, + TuiGroup, + TuiLabel, + TuiTextfield, + TuiTitle, +} from '@taiga-ui/core'; import { TuiBlock, TuiCheckbox, @@ -13,6 +21,7 @@ import { TuiRadio, TuiStepper, } from '@taiga-ui/kit'; +import {TuiForm, TuiHeader} from '@taiga-ui/layout'; import { TuiInputDateModule, TuiInputModule, @@ -52,6 +61,7 @@ class Account { AsyncPipe, ReactiveFormsModule, TuiAmountPipe, + TuiAppearance, TuiBlock, TuiButton, TuiCheckbox, @@ -59,7 +69,9 @@ class Account { TuiDataListWrapper, TuiError, TuiFieldErrorPipe, + TuiForm, TuiGroup, + TuiHeader, TuiInputDateModule, TuiInputModule, TuiInputNumberModule, @@ -71,7 +83,9 @@ class Account { TuiRadio, TuiSelectModule, TuiStepper, + TuiTextfield, TuiTextfieldControllerModule, + TuiTitle, ], templateUrl: './index.html', styleUrls: ['./index.less'], diff --git a/projects/demo/src/modules/components/form/index.ts b/projects/demo/src/modules/components/form/index.ts index 8d7fbeb20e2c..ef62ae263633 100644 --- a/projects/demo/src/modules/components/form/index.ts +++ b/projects/demo/src/modules/components/form/index.ts @@ -10,5 +10,5 @@ import {TuiDemo} from '@demo/utils'; changeDetection, }) export default class Page { - protected readonly examples = ['Basic']; + protected readonly examples = ['Basic', 'Custom Layout']; } diff --git a/projects/demo/src/modules/components/multi-select/examples/9/index.html b/projects/demo/src/modules/components/multi-select/examples/9/index.html index d92dc87f5abd..04bb4eae9b24 100644 --- a/projects/demo/src/modules/components/multi-select/examples/9/index.html +++ b/projects/demo/src/modules/components/multi-select/examples/9/index.html @@ -34,7 +34,7 @@ let-data="data" >
-
+
diff --git a/projects/demo/src/modules/markup/form/examples/1/index.less b/projects/demo/src/modules/markup/form/examples/1/index.less deleted file mode 100644 index 8f118fadcd6e..000000000000 --- a/projects/demo/src/modules/markup/form/examples/1/index.less +++ /dev/null @@ -1,26 +0,0 @@ -@import '@taiga-ui/core/styles/taiga-ui-local'; - -:host { - display: block; -} - -.stepper { - margin-bottom: 2rem; -} - -.uppercase-name { - text-transform: uppercase; -} - -.account { - display: flex; - flex: 1; - justify-content: space-between; -} - -.ticks-labels { - .tui-slider-ticks-labels(); - - color: var(--tui-text-secondary); - margin-top: 0.25rem; -} diff --git a/projects/demo/src/modules/markup/form/index.html b/projects/demo/src/modules/markup/form/index.html deleted file mode 100644 index bd97a4416d7c..000000000000 --- a/projects/demo/src/modules/markup/form/index.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - -
- Use global - .tui-form - class and its modifications: -
-
    -
  • - .tui-form__header - : form header. Margins: 32px top and 20px bottom. -
      -
    • - .tui-form__header_margin-top_none - : nullifies - margin-top -
    • -
    • - .tui-form__header_margin-bottom_none - : nullifies - margin-bottom -
    • -
    • - .tui-form__header_margin-bottom_small - : reduced margin bottom (16px) - margin-bottom -
    • -
    -
  • -
  • - .tui-form__row - : form row. Margin between rows is 20px. -
      -
    • - .tui-form__row_multi-fields - : row with several inputs with 20px margin between them -
    • -
    • - .tui-form__row_half-width - : a half width row -
    • -
    • - .tui-form__row_checkboxes - : a row with two columns for checkboxes -
    • -
    -
  • -
  • - .tui-form__multi-field - : field in a row - tui-form__row_multi-fields - . fields with 20px margin between -
  • -
  • - .tui-form__checkbox - : checkbox with a label for two column case -
  • -
  • - .tui-form__field-note - : a secondary text under field -
  • -
  • - .tui-form__field-checkbox - : checkbox under a field -
  • -
  • - .tui-form__buttons - : a block with buttons and margin top 32px -
      -
    • - .tui-form__buttons_align_end - : align buttons right -
    • -
    • - .tui-form__buttons_align_center - : align buttons center -
    • -
    -
  • -
  • - .tui-form__button - : a button of buttons block -
  • -
- - -
-
diff --git a/projects/demo/src/modules/markup/form/index.ts b/projects/demo/src/modules/markup/form/index.ts deleted file mode 100644 index 4690d6b397aa..000000000000 --- a/projects/demo/src/modules/markup/form/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {Component} from '@angular/core'; -import {changeDetection} from '@demo/emulate/change-detection'; -import {TuiDemo} from '@demo/utils'; - -import {StylesInfo} from '../../app/styles-info'; - -@Component({ - standalone: true, - imports: [StylesInfo, TuiDemo], - templateUrl: './index.html', - changeDetection, -}) -export default class Page {} diff --git a/projects/demo/src/modules/pipes/field-error/examples/5/index.html b/projects/demo/src/modules/pipes/field-error/examples/5/index.html index 0c49cff8ef39..98e9dc3a6e71 100644 --- a/projects/demo/src/modules/pipes/field-error/examples/5/index.html +++ b/projects/demo/src/modules/pipes/field-error/examples/5/index.html @@ -1,15 +1,16 @@ -
-
- - Enter some text - + + + Enter some text + - -
+ diff --git a/projects/demo/src/modules/pipes/field-error/examples/5/index.ts b/projects/demo/src/modules/pipes/field-error/examples/5/index.ts index 9154a9c7318c..7a62bb6cbb49 100644 --- a/projects/demo/src/modules/pipes/field-error/examples/5/index.ts +++ b/projects/demo/src/modules/pipes/field-error/examples/5/index.ts @@ -7,6 +7,7 @@ import {encapsulation} from '@demo/emulate/encapsulation'; import {TUI_IS_E2E, TuiValidationError} from '@taiga-ui/cdk'; import {TuiError} from '@taiga-ui/core'; import {TuiFieldErrorPipe} from '@taiga-ui/kit'; +import {TuiForm} from '@taiga-ui/layout'; import {TuiInputModule} from '@taiga-ui/legacy'; import {delay, of} from 'rxjs'; @@ -28,6 +29,7 @@ function asyncValidatorFn(isE2E: boolean): AsyncValidatorFn { ReactiveFormsModule, TuiError, TuiFieldErrorPipe, + TuiForm, TuiInputModule, ], templateUrl: './index.html', diff --git a/projects/layout/components/form/form.styles.less b/projects/layout/components/form/form.styles.less index ad50c74cee7e..f47db42fed95 100644 --- a/projects/layout/components/form/form.styles.less +++ b/projects/layout/components/form/form.styles.less @@ -9,7 +9,7 @@ gap: 0.75rem; font: var(--tui-font-text-s); - tui-error { + tui-error:not(.tui-space-top-none) { margin-top: -0.75rem; } @@ -26,7 +26,7 @@ gap: 1rem; font: var(--tui-font-text-s); - tui-error { + tui-error:not(.tui-space-top-none) { margin-top: -1rem; } } @@ -35,7 +35,7 @@ gap: 1.25rem; font: var(--tui-font-text-m); - tui-error { + tui-error:not(.tui-space-top-none) { margin-top: -1.25rem; } }