From 2892764ca86798ef6f67863d9ba9885f8be99185 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Thu, 19 Nov 2026 16:35:06 -0800 Subject: [PATCH 1/7] feat(divider): add recipe and tokens --- core/api.txt | 32 +++++---- core/src/components.d.ts | 14 ++-- .../src/components/divider/_divider.docs.scss | 20 ++++++ .../components/divider/divider.common.scss | 31 --------- .../components/divider/divider.interface.ts | 31 +++++++++ core/src/components/divider/divider.scss | 46 +++++++++++++ core/src/components/divider/divider.tsx | 41 ++++++----- .../components/divider/test/divider.spec.ts | 41 +++++++++++ .../divider/test/spacing/divider.e2e.ts | 4 +- core/src/themes/ionic/default.tokens.ts | 68 +++++++++++++++++++ core/src/themes/ios/default.tokens.ts | 68 +++++++++++++++++++ core/src/themes/md/default.tokens.ts | 68 +++++++++++++++++++ core/src/themes/themes.interfaces.ts | 3 + 13 files changed, 398 insertions(+), 69 deletions(-) create mode 100644 core/src/components/divider/_divider.docs.scss delete mode 100644 core/src/components/divider/divider.common.scss create mode 100644 core/src/components/divider/divider.interface.ts create mode 100644 core/src/components/divider/divider.scss create mode 100644 core/src/components/divider/test/divider.spec.ts diff --git a/core/api.txt b/core/api.txt index f7da14c8764..561aaa63575 100644 --- a/core/api.txt +++ b/core/api.txt @@ -1292,19 +1292,25 @@ ion-datetime-button,part,native ion-divider,shadow ion-divider,prop,inset,boolean,false,false,false -ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,'medium',false,true -ion-divider,css-prop,--margin-bottom,ionic -ion-divider,css-prop,--margin-bottom,ios -ion-divider,css-prop,--margin-bottom,md -ion-divider,css-prop,--margin-top,ionic -ion-divider,css-prop,--margin-top,ios -ion-divider,css-prop,--margin-top,md -ion-divider,css-prop,--padding-end,ionic -ion-divider,css-prop,--padding-end,ios -ion-divider,css-prop,--padding-end,md -ion-divider,css-prop,--padding-start,ionic -ion-divider,css-prop,--padding-start,ios -ion-divider,css-prop,--padding-start,md +ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,undefined,false,true +ion-divider,css-prop,--ion-divider-color +ion-divider,css-prop,--ion-divider-inset-padding-end +ion-divider,css-prop,--ion-divider-inset-padding-start +ion-divider,css-prop,--ion-divider-spacing-large-margin-bottom +ion-divider,css-prop,--ion-divider-spacing-large-margin-top +ion-divider,css-prop,--ion-divider-spacing-medium-margin-bottom +ion-divider,css-prop,--ion-divider-spacing-medium-margin-top +ion-divider,css-prop,--ion-divider-spacing-small-margin-bottom +ion-divider,css-prop,--ion-divider-spacing-small-margin-top +ion-divider,css-prop,--ion-divider-spacing-xlarge-margin-bottom +ion-divider,css-prop,--ion-divider-spacing-xlarge-margin-top +ion-divider,css-prop,--ion-divider-spacing-xsmall-margin-bottom +ion-divider,css-prop,--ion-divider-spacing-xsmall-margin-top +ion-divider,css-prop,--ion-divider-spacing-xxlarge-margin-bottom +ion-divider,css-prop,--ion-divider-spacing-xxlarge-margin-top +ion-divider,css-prop,--ion-divider-spacing-xxsmall-margin-bottom +ion-divider,css-prop,--ion-divider-spacing-xxsmall-margin-top +ion-divider,css-prop,--ion-divider-thickness ion-fab,shadow ion-fab,prop,activated,boolean,false,false,false diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 913b4e79ee1..d03a2653447 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -21,6 +21,7 @@ import { IonChipFill, IonChipShape, IonChipSize } from "./components/chip/chip.i import { IonColValue } from "./components/col/col.interface"; import { ScrollBaseDetail, ScrollDetail } from "./components/content/content.interface"; import { DatetimeChangeEventDetail, DatetimeHighlight, DatetimeHighlightCallback, DatetimeHourCycle, DatetimeParts, DatetimePresentation, FormatOptions, TitleSelectedDatesFormatter } from "./components/datetime/datetime-interface"; +import { IonDividerSpacing } from "./components/divider/divider.interface"; import { FooterScrollEffect } from "./components/footer/footer-interface"; import { IonGalleryColumns, IonGalleryGap } from "./components/gallery/gallery.interface"; import { HeaderScrollEffect } from "./components/header/header-interface"; @@ -70,6 +71,7 @@ export { IonChipFill, IonChipShape, IonChipSize } from "./components/chip/chip.i export { IonColValue } from "./components/col/col.interface"; export { ScrollBaseDetail, ScrollDetail } from "./components/content/content.interface"; export { DatetimeChangeEventDetail, DatetimeHighlight, DatetimeHighlightCallback, DatetimeHourCycle, DatetimeParts, DatetimePresentation, FormatOptions, TitleSelectedDatesFormatter } from "./components/datetime/datetime-interface"; +export { IonDividerSpacing } from "./components/divider/divider.interface"; export { FooterScrollEffect } from "./components/footer/footer-interface"; export { IonGalleryColumns, IonGalleryGap } from "./components/gallery/gallery.interface"; export { HeaderScrollEffect } from "./components/header/header-interface"; @@ -1355,10 +1357,9 @@ export namespace Components { */ "inset": boolean; /** - * Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"medium"`. - * @default 'medium' + * Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. */ - "spacing"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'; + "spacing"?: IonDividerSpacing; } interface IonFab { /** @@ -7233,10 +7234,9 @@ declare namespace LocalJSX { */ "inset"?: boolean; /** - * Set to `"xxsmall"` for the smallest spacing. Set to "xsmall" for very small spacing. Set to `"small"` for small spacing. Set to "medium" for medium spacing. Set to "large" for large spacing. Set to `"xlarge"` for the largest spacing. Defaults to `"medium"`. - * @default 'medium' + * Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. */ - "spacing"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'; + "spacing"?: IonDividerSpacing; } interface IonFab { /** @@ -10664,7 +10664,7 @@ declare namespace LocalJSX { "datetime": string; } interface IonDividerAttributes { - "spacing": 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'; + "spacing": IonDividerSpacing; "inset": boolean; } interface IonFabAttributes { diff --git a/core/src/components/divider/_divider.docs.scss b/core/src/components/divider/_divider.docs.scss new file mode 100644 index 00000000000..6cecc90f199 --- /dev/null +++ b/core/src/components/divider/_divider.docs.scss @@ -0,0 +1,20 @@ +/** + * @prop --ion-divider-color: Color of the divider line + * @prop --ion-divider-inset-padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of an inset divider + * @prop --ion-divider-inset-padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of an inset divider + * @prop --ion-divider-spacing-xxsmall-margin-top: Top margin of the `xxsmall` divider spacing + * @prop --ion-divider-spacing-xxsmall-margin-bottom: Bottom margin of the `xxsmall` divider spacing + * @prop --ion-divider-spacing-xsmall-margin-top: Top margin of the `xsmall` divider spacing + * @prop --ion-divider-spacing-xsmall-margin-bottom: Bottom margin of the `xsmall` divider spacing + * @prop --ion-divider-spacing-small-margin-top: Top margin of the `small` divider spacing + * @prop --ion-divider-spacing-small-margin-bottom: Bottom margin of the `small` divider spacing + * @prop --ion-divider-spacing-medium-margin-top: Top margin of the `medium` divider spacing + * @prop --ion-divider-spacing-medium-margin-bottom: Bottom margin of the `medium` divider spacing + * @prop --ion-divider-spacing-large-margin-top: Top margin of the `large` divider spacing + * @prop --ion-divider-spacing-large-margin-bottom: Bottom margin of the `large` divider spacing + * @prop --ion-divider-spacing-xlarge-margin-top: Top margin of the `xlarge` divider spacing + * @prop --ion-divider-spacing-xlarge-margin-bottom: Bottom margin of the `xlarge` divider spacing + * @prop --ion-divider-spacing-xxlarge-margin-top: Top margin of the `xxlarge` divider spacing + * @prop --ion-divider-spacing-xxlarge-margin-bottom: Bottom margin of the `xxlarge` divider spacing + * @prop --ion-divider-thickness: Thickness of the divider line + */ diff --git a/core/src/components/divider/divider.common.scss b/core/src/components/divider/divider.common.scss deleted file mode 100644 index e87befe01b8..00000000000 --- a/core/src/components/divider/divider.common.scss +++ /dev/null @@ -1,31 +0,0 @@ -@import "../../themes/mixins"; - -:host { - /** - * @prop --margin-top: Top margin of the divider - * @prop --margin-bottom: Bottom margin of the divider - * @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the divider - * @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the divider - */ - --margin-top: 0px; - --margin-bottom: 0px; - --padding-start: 0px; - --padding-end: 0px; - - @include padding-horizontal(var(--padding-start), var(--padding-end)); - - display: block; - - width: 100%; -} - -:host hr { - display: block; - - width: 100%; - - margin-top: var(--margin-top); - margin-bottom: var(--margin-bottom); - - border: none; -} diff --git a/core/src/components/divider/divider.interface.ts b/core/src/components/divider/divider.interface.ts new file mode 100644 index 00000000000..1a0d7961e39 --- /dev/null +++ b/core/src/components/divider/divider.interface.ts @@ -0,0 +1,31 @@ +import type { IonMargin, IonPadding } from '../../themes/themes.interfaces'; + +export type IonDividerRecipe = { + /** Color of the divider line. */ + color?: string; + + /** Applies when the `inset` property is `true`. */ + inset?: { + /** Indent of the line from the start and end edges of the divider. */ + padding?: Pick; + }; + + /** Applies for each value of the `spacing` property. */ + spacing?: { + [K in IonDividerSpacing]?: { + /** Space above and below the line. Collapses with the margins of adjacent elements. */ + margin?: Pick; + }; + }; + + /** Thickness of the divider line. */ + thickness?: string; +}; + +export type IonDividerConfig = { + /** Spacing used when the `spacing` property is not set. */ + spacing?: IonDividerSpacing; +}; + +export const ION_DIVIDER_SPACINGS = ['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge'] as const; +export type IonDividerSpacing = (typeof ION_DIVIDER_SPACINGS)[number]; diff --git a/core/src/components/divider/divider.scss b/core/src/components/divider/divider.scss new file mode 100644 index 00000000000..b82e142385e --- /dev/null +++ b/core/src/components/divider/divider.scss @@ -0,0 +1,46 @@ +@use "../../themes/mixins" as mixins; +@use "./divider.docs"; + +// Divider +// -------------------------------------------------- + +$spacings: xxsmall, xsmall, small, medium, large, xlarge, xxlarge; + +:host { + @include mixins.padding-horizontal(var(--padding-start, 0px), var(--padding-end, 0px)); + + display: block; + + width: 100%; +} + +:host hr { + display: block; + + width: 100%; + + border: none; + border-top-width: var(--ion-divider-thickness); + border-top-style: solid; + border-top-color: var(--ion-divider-color); +} + +// Divider Inset +// -------------------------------------------------- + +:host(.divider-inset) { + @include mixins.padding-horizontal( + var(--padding-start, var(--ion-divider-inset-padding-start)), + var(--padding-end, var(--ion-divider-inset-padding-end)) + ); +} + +// Divider Spacing +// -------------------------------------------------- + +@each $spacing in $spacings { + :host(.divider-spacing-#{$spacing}) hr { + margin-top: var(--margin-top, var(--ion-divider-spacing-#{$spacing}-margin-top)); + margin-bottom: var(--margin-bottom, var(--ion-divider-spacing-#{$spacing}-margin-bottom)); + } +} diff --git a/core/src/components/divider/divider.tsx b/core/src/components/divider/divider.tsx index 5ed105c333e..8780b63a18a 100644 --- a/core/src/components/divider/divider.tsx +++ b/core/src/components/divider/divider.tsx @@ -1,29 +1,28 @@ -import { getIonTheme } from '@global/ionic-global'; import type { ComponentInterface } from '@stencil/core'; import { Component, Prop, Host, h } from '@stencil/core'; +import { config } from '../../global/config'; + +import type { IonDividerSpacing } from './divider.interface'; + @Component({ tag: 'ion-divider', - styleUrls: { - ios: 'divider.ios.scss', - md: 'divider.md.scss', - ionic: 'divider.ionic.scss', - }, + styleUrl: 'divider.scss', shadow: true, }) export class Divider implements ComponentInterface { /** * Set to `"xxsmall"` for the smallest spacing. - * Set to "xsmall" for very small spacing. + * Set to `"xsmall"` for very small spacing. * Set to `"small"` for small spacing. - * Set to "medium" for medium spacing. - * Set to "large" for large spacing. - * Set to `"xlarge"` for the largest spacing. + * Set to `"medium"` for medium spacing. + * Set to `"large"` for large spacing. + * Set to `"xlarge"` for very large spacing. + * Set to `"xxlarge"` for the largest spacing. * - * Defaults to `"medium"`. + * Defaults to `"medium"` if both the spacing property and theme config are unset. */ - @Prop({ reflect: true }) spacing?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' = - 'medium'; + @Prop({ reflect: true }) spacing?: IonDividerSpacing; /** * If `true`, the divider will have horizontal margins @@ -31,15 +30,23 @@ export class Divider implements ComponentInterface { */ @Prop() inset: boolean = false; + /** + * Gets the divider spacing. Uses the `spacing` property if set, otherwise + * checks the theme config. Defaults to `medium` if neither is set. + */ + get spacingValue(): IonDividerSpacing { + const spacingConfig = config.getObjectValue('IonDivider.spacing', 'medium') as IonDividerSpacing; + + return this.spacing ?? spacingConfig; + } + render() { - const { inset, spacing } = this; - const theme = getIonTheme(this); + const { inset, spacingValue } = this; return ( diff --git a/core/src/components/divider/test/divider.spec.ts b/core/src/components/divider/test/divider.spec.ts new file mode 100644 index 00000000000..e6b7907befd --- /dev/null +++ b/core/src/components/divider/test/divider.spec.ts @@ -0,0 +1,41 @@ +import { newSpecPage } from '@stencil/core/testing'; + +import { config } from '../../../global/config'; +import { Divider } from '../divider'; + +describe('divider: spacing', () => { + afterEach(() => { + config.reset({}); + }); + + it('should default to medium when the theme config has no spacing', async () => { + const page = await newSpecPage({ + components: [Divider], + html: ``, + }); + + expect(page.root!.classList.contains('divider-spacing-medium')).toBe(true); + }); + + it('should use the spacing from the theme config', async () => { + config.reset({ customTheme: { config: { components: { IonDivider: { spacing: 'large' } } } } }); + + const page = await newSpecPage({ + components: [Divider], + html: ``, + }); + + expect(page.root!.classList.contains('divider-spacing-large')).toBe(true); + }); + + it('should use the spacing when it is set', async () => { + config.reset({ customTheme: { config: { components: { IonDivider: { spacing: 'large' } } } } }); + + const page = await newSpecPage({ + components: [Divider], + html: ``, + }); + + expect(page.root!.classList.contains('divider-spacing-xsmall')).toBe(true); + }); +}); diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts b/core/src/components/divider/test/spacing/divider.e2e.ts index 38f723e7b36..232c7be5adb 100644 --- a/core/src/components/divider/test/spacing/divider.e2e.ts +++ b/core/src/components/divider/test/spacing/divider.e2e.ts @@ -1,12 +1,14 @@ import { expect } from '@playwright/test'; import { configs, test } from '@utils/test/playwright'; +import { ION_DIVIDER_SPACINGS } from '../../divider.interface'; + /** * This behavior does not vary across directions. */ configs({ directions: ['ltr'], modes: ['ios', 'md', 'ionic-md'] }).forEach(({ config, screenshot, title }) => { test.describe(title('divider: spacing'), () => { - ['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge'].forEach((spacing) => { + ION_DIVIDER_SPACINGS.forEach((spacing) => { test(`should render divider with ${spacing} spacing`, async ({ page }) => { await page.setContent( ` diff --git a/core/src/themes/ionic/default.tokens.ts b/core/src/themes/ionic/default.tokens.ts index f1a0a7d4cb5..9717f8739c1 100644 --- a/core/src/themes/ionic/default.tokens.ts +++ b/core/src/themes/ionic/default.tokens.ts @@ -42,6 +42,10 @@ export const defaultTheme: DefaultTheme = { size: 'large', }, + IonDivider: { + spacing: 'medium', + }, + IonNote: { hue: 'bold', }, @@ -1565,6 +1569,70 @@ export const defaultTheme: DefaultTheme = { }, }, + IonDivider: { + color: '#d0d7df', + + inset: { + padding: { + end: 'var(--ion-spacing-lg)', + start: 'var(--ion-spacing-lg)', + }, + }, + + spacing: { + xxsmall: { + margin: { + bottom: 'var(--ion-spacing-0)', + top: 'var(--ion-spacing-0)', + }, + }, + + xsmall: { + margin: { + bottom: 'var(--ion-spacing-sm)', + top: 'var(--ion-spacing-sm)', + }, + }, + + small: { + margin: { + bottom: 'var(--ion-spacing-md)', + top: 'var(--ion-spacing-md)', + }, + }, + + medium: { + margin: { + bottom: 'var(--ion-spacing-lg)', + top: 'var(--ion-spacing-lg)', + }, + }, + + large: { + margin: { + bottom: 'var(--ion-spacing-xxl)', + top: 'var(--ion-spacing-xxl)', + }, + }, + + xlarge: { + margin: { + bottom: 'var(--ion-spacing-xxxxl)', + top: 'var(--ion-spacing-xxxxl)', + }, + }, + + xxlarge: { + margin: { + bottom: 'var(--ion-spacing-1000)', + top: 'var(--ion-spacing-1000)', + }, + }, + }, + + thickness: 'var(--ion-border-width-xxxs)', + }, + IonGallery: { gap: 'var(--ion-spacing-lg)', }, diff --git a/core/src/themes/ios/default.tokens.ts b/core/src/themes/ios/default.tokens.ts index 05cf3c9104f..deb37303bb9 100644 --- a/core/src/themes/ios/default.tokens.ts +++ b/core/src/themes/ios/default.tokens.ts @@ -54,6 +54,10 @@ export const defaultTheme: DefaultTheme = { size: 'large', }, + IonDivider: { + spacing: 'medium', + }, + IonNote: { hue: 'bold', }, @@ -1979,6 +1983,70 @@ export const defaultTheme: DefaultTheme = { }, }, + IonDivider: { + color: '#e0e0e0', + + inset: { + padding: { + end: 'var(--ion-spacing-lg)', + start: 'var(--ion-spacing-lg)', + }, + }, + + spacing: { + xxsmall: { + margin: { + bottom: 'var(--ion-spacing-0)', + top: 'var(--ion-spacing-0)', + }, + }, + + xsmall: { + margin: { + bottom: 'var(--ion-spacing-sm)', + top: 'var(--ion-spacing-sm)', + }, + }, + + small: { + margin: { + bottom: 'var(--ion-spacing-md)', + top: 'var(--ion-spacing-md)', + }, + }, + + medium: { + margin: { + bottom: 'var(--ion-spacing-lg)', + top: 'var(--ion-spacing-lg)', + }, + }, + + large: { + margin: { + bottom: 'var(--ion-spacing-xxl)', + top: 'var(--ion-spacing-xxl)', + }, + }, + + xlarge: { + margin: { + bottom: 'var(--ion-spacing-xxxxl)', + top: 'var(--ion-spacing-xxxxl)', + }, + }, + + xxlarge: { + margin: { + bottom: 'var(--ion-spacing-1000)', + top: 'var(--ion-spacing-1000)', + }, + }, + }, + + thickness: 'var(--ion-border-width-xxs)', + }, + IonGallery: { gap: 'var(--ion-spacing-lg)', }, diff --git a/core/src/themes/md/default.tokens.ts b/core/src/themes/md/default.tokens.ts index 2d4329c2f0d..87015aebdb3 100644 --- a/core/src/themes/md/default.tokens.ts +++ b/core/src/themes/md/default.tokens.ts @@ -46,6 +46,10 @@ export const defaultTheme: DefaultTheme = { size: 'large', }, + IonDivider: { + spacing: 'medium', + }, + IonNote: { hue: 'bold', }, @@ -2132,6 +2136,70 @@ export const defaultTheme: DefaultTheme = { }, }, + IonDivider: { + color: '#e0e0e0', + + inset: { + padding: { + end: 'var(--ion-spacing-lg)', + start: 'var(--ion-spacing-lg)', + }, + }, + + spacing: { + xxsmall: { + margin: { + bottom: 'var(--ion-spacing-0)', + top: 'var(--ion-spacing-0)', + }, + }, + + xsmall: { + margin: { + bottom: 'var(--ion-spacing-sm)', + top: 'var(--ion-spacing-sm)', + }, + }, + + small: { + margin: { + bottom: 'var(--ion-spacing-md)', + top: 'var(--ion-spacing-md)', + }, + }, + + medium: { + margin: { + bottom: 'var(--ion-spacing-lg)', + top: 'var(--ion-spacing-lg)', + }, + }, + + large: { + margin: { + bottom: 'var(--ion-spacing-xxl)', + top: 'var(--ion-spacing-xxl)', + }, + }, + + xlarge: { + margin: { + bottom: 'var(--ion-spacing-xxxxl)', + top: 'var(--ion-spacing-xxxxl)', + }, + }, + + xxlarge: { + margin: { + bottom: 'var(--ion-spacing-1000)', + top: 'var(--ion-spacing-1000)', + }, + }, + }, + + thickness: 'var(--ion-border-width-xxxs)', + }, + IonGallery: { gap: 'var(--ion-spacing-lg)', }, diff --git a/core/src/themes/themes.interfaces.ts b/core/src/themes/themes.interfaces.ts index 5b251d6f106..60e9fad187d 100644 --- a/core/src/themes/themes.interfaces.ts +++ b/core/src/themes/themes.interfaces.ts @@ -4,6 +4,7 @@ import type { IonButtonConfig, IonButtonRecipe } from '../components/button/butt import type { IonChipConfig, IonChipRecipe } from '../components/chip/chip.interface'; import type { IonColRecipe } from '../components/col/col.interface'; import type { IonContentRecipe } from '../components/content/content.interface'; +import type { IonDividerConfig, IonDividerRecipe } from '../components/divider/divider.interface'; import type { IonGalleryRecipe } from '../components/gallery/gallery.interface'; import type { IonGridRecipe } from '../components/grid/grid.interface'; import type { IonItemDividerRecipe } from '../components/item-divider/item-divider.interface'; @@ -261,6 +262,7 @@ export type IonicConfig = IonicGlobalConfig & { IonBadge?: IonBadgeConfig; IonButton?: IonButtonConfig; IonChip?: IonChipConfig; + IonDivider?: IonDividerConfig; IonNote?: IonNoteConfig; IonProgressBar?: IonProgressBarConfig; IonRouterLink?: IonRouterLinkConfig; @@ -310,6 +312,7 @@ type Components = { IonChip?: IonChipRecipe; IonCol?: IonColRecipe; IonContent?: IonContentRecipe; + IonDivider?: IonDividerRecipe; IonGallery?: IonGalleryRecipe; IonGrid?: IonGridRecipe; IonItemDivider?: IonItemDividerRecipe; From 16293df72cd908736f16ca5b264d058062c447a6 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Thu, 19 Nov 2026 16:35:06 -0800 Subject: [PATCH 2/7] refactor(divider): remove inset property --- core/api.txt | 3 --- core/src/components.d.ts | 15 ++----------- .../src/components/divider/_divider.docs.scss | 2 -- .../components/divider/divider.interface.ts | 8 +------ core/src/components/divider/divider.scss | 10 --------- core/src/components/divider/divider.tsx | 11 +++------- .../divider/test/basic/divider.e2e.ts | 8 +++---- ...onic-md-ltr-light-Mobile-Chrome-linux.png} | Bin ...nic-md-ltr-light-Mobile-Firefox-linux.png} | Bin ...onic-md-ltr-light-Mobile-Safari-linux.png} | Bin ...c-padding-ios-ltr-Mobile-Chrome-linux.png} | Bin ...-padding-ios-ltr-Mobile-Firefox-linux.png} | Bin ...c-padding-ios-ltr-Mobile-Safari-linux.png} | Bin ...ic-padding-md-ltr-Mobile-Chrome-linux.png} | Bin ...c-padding-md-ltr-Mobile-Firefox-linux.png} | Bin ...ic-padding-md-ltr-Mobile-Safari-linux.png} | Bin .../components/divider/test/basic/index.html | 4 ++-- .../divider/test/spacing/index.html | 20 +----------------- core/src/themes/ionic/default.tokens.ts | 7 ------ core/src/themes/ios/default.tokens.ts | 7 ------ core/src/themes/md/default.tokens.ts | 7 ------ .../angular/src/lazy/directives/proxies.ts | 4 ++-- .../src/standalone/directives/ion-divider.ts | 5 ++--- packages/vue/src/proxies.ts | 3 +-- 24 files changed, 18 insertions(+), 96 deletions(-) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-ionic-md-ltr-light-Mobile-Chrome-linux.png => divider-basic-padding-ionic-md-ltr-light-Mobile-Chrome-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-ionic-md-ltr-light-Mobile-Firefox-linux.png => divider-basic-padding-ionic-md-ltr-light-Mobile-Firefox-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-ionic-md-ltr-light-Mobile-Safari-linux.png => divider-basic-padding-ionic-md-ltr-light-Mobile-Safari-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-ios-ltr-Mobile-Chrome-linux.png => divider-basic-padding-ios-ltr-Mobile-Chrome-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-ios-ltr-Mobile-Firefox-linux.png => divider-basic-padding-ios-ltr-Mobile-Firefox-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-ios-ltr-Mobile-Safari-linux.png => divider-basic-padding-ios-ltr-Mobile-Safari-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-md-ltr-Mobile-Chrome-linux.png => divider-basic-padding-md-ltr-Mobile-Chrome-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-md-ltr-Mobile-Firefox-linux.png => divider-basic-padding-md-ltr-Mobile-Firefox-linux.png} (100%) rename core/src/components/divider/test/basic/divider.e2e.ts-snapshots/{divider-basic-inset-md-ltr-Mobile-Safari-linux.png => divider-basic-padding-md-ltr-Mobile-Safari-linux.png} (100%) diff --git a/core/api.txt b/core/api.txt index 561aaa63575..be448c644e3 100644 --- a/core/api.txt +++ b/core/api.txt @@ -1291,11 +1291,8 @@ ion-datetime-button,prop,theme,"ios" | "md" | "ionic",undefined,false,false ion-datetime-button,part,native ion-divider,shadow -ion-divider,prop,inset,boolean,false,false,false ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,undefined,false,true ion-divider,css-prop,--ion-divider-color -ion-divider,css-prop,--ion-divider-inset-padding-end -ion-divider,css-prop,--ion-divider-inset-padding-start ion-divider,css-prop,--ion-divider-spacing-large-margin-bottom ion-divider,css-prop,--ion-divider-spacing-large-margin-top ion-divider,css-prop,--ion-divider-spacing-medium-margin-bottom diff --git a/core/src/components.d.ts b/core/src/components.d.ts index d03a2653447..4df26e9a056 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -1352,12 +1352,7 @@ export namespace Components { } interface IonDivider { /** - * If `true`, the divider will have horizontal margins By default, it's `false` - * @default false - */ - "inset": boolean; - /** - * Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. + * Controls the space above and below the line. Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. */ "spacing"?: IonDividerSpacing; } @@ -7229,12 +7224,7 @@ declare namespace LocalJSX { } interface IonDivider { /** - * If `true`, the divider will have horizontal margins By default, it's `false` - * @default false - */ - "inset"?: boolean; - /** - * Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. + * Controls the space above and below the line. Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. */ "spacing"?: IonDividerSpacing; } @@ -10665,7 +10655,6 @@ declare namespace LocalJSX { } interface IonDividerAttributes { "spacing": IonDividerSpacing; - "inset": boolean; } interface IonFabAttributes { "horizontal": 'start' | 'end' | 'center'; diff --git a/core/src/components/divider/_divider.docs.scss b/core/src/components/divider/_divider.docs.scss index 6cecc90f199..88b50f0a0ec 100644 --- a/core/src/components/divider/_divider.docs.scss +++ b/core/src/components/divider/_divider.docs.scss @@ -1,7 +1,5 @@ /** * @prop --ion-divider-color: Color of the divider line - * @prop --ion-divider-inset-padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of an inset divider - * @prop --ion-divider-inset-padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of an inset divider * @prop --ion-divider-spacing-xxsmall-margin-top: Top margin of the `xxsmall` divider spacing * @prop --ion-divider-spacing-xxsmall-margin-bottom: Bottom margin of the `xxsmall` divider spacing * @prop --ion-divider-spacing-xsmall-margin-top: Top margin of the `xsmall` divider spacing diff --git a/core/src/components/divider/divider.interface.ts b/core/src/components/divider/divider.interface.ts index 1a0d7961e39..d1eb4a625ef 100644 --- a/core/src/components/divider/divider.interface.ts +++ b/core/src/components/divider/divider.interface.ts @@ -1,15 +1,9 @@ -import type { IonMargin, IonPadding } from '../../themes/themes.interfaces'; +import type { IonMargin } from '../../themes/themes.interfaces'; export type IonDividerRecipe = { /** Color of the divider line. */ color?: string; - /** Applies when the `inset` property is `true`. */ - inset?: { - /** Indent of the line from the start and end edges of the divider. */ - padding?: Pick; - }; - /** Applies for each value of the `spacing` property. */ spacing?: { [K in IonDividerSpacing]?: { diff --git a/core/src/components/divider/divider.scss b/core/src/components/divider/divider.scss index b82e142385e..4cb0fb60560 100644 --- a/core/src/components/divider/divider.scss +++ b/core/src/components/divider/divider.scss @@ -25,16 +25,6 @@ $spacings: xxsmall, xsmall, small, medium, large, xlarge, xxlarge; border-top-color: var(--ion-divider-color); } -// Divider Inset -// -------------------------------------------------- - -:host(.divider-inset) { - @include mixins.padding-horizontal( - var(--padding-start, var(--ion-divider-inset-padding-start)), - var(--padding-end, var(--ion-divider-inset-padding-end)) - ); -} - // Divider Spacing // -------------------------------------------------- diff --git a/core/src/components/divider/divider.tsx b/core/src/components/divider/divider.tsx index 8780b63a18a..20e295ccf71 100644 --- a/core/src/components/divider/divider.tsx +++ b/core/src/components/divider/divider.tsx @@ -12,6 +12,8 @@ import type { IonDividerSpacing } from './divider.interface'; }) export class Divider implements ComponentInterface { /** + * Controls the space above and below the line. + * * Set to `"xxsmall"` for the smallest spacing. * Set to `"xsmall"` for very small spacing. * Set to `"small"` for small spacing. @@ -24,12 +26,6 @@ export class Divider implements ComponentInterface { */ @Prop({ reflect: true }) spacing?: IonDividerSpacing; - /** - * If `true`, the divider will have horizontal margins - * By default, it's `false` - */ - @Prop() inset: boolean = false; - /** * Gets the divider spacing. Uses the `spacing` property if set, otherwise * checks the theme config. Defaults to `medium` if neither is set. @@ -41,13 +37,12 @@ export class Divider implements ComponentInterface { } render() { - const { inset, spacingValue } = this; + const { spacingValue } = this; return (
diff --git a/core/src/components/divider/test/basic/divider.e2e.ts b/core/src/components/divider/test/basic/divider.e2e.ts index 7f2b02beb6b..0763693b4f8 100644 --- a/core/src/components/divider/test/basic/divider.e2e.ts +++ b/core/src/components/divider/test/basic/divider.e2e.ts @@ -24,13 +24,13 @@ configs({ directions: ['ltr'], modes: ['ios', 'md', 'ionic-md'] }).forEach(({ co }); }); - test.describe(title('divider: inset'), () => { - test('should not have visual regressions when inset is enabled', async ({ page }) => { + test.describe(title('divider: padding'), () => { + test('should indent the line with horizontal padding', async ({ page }) => { await page.setContent( `
top - + bottom
`, @@ -39,7 +39,7 @@ configs({ directions: ['ltr'], modes: ['ios', 'md', 'ionic-md'] }).forEach(({ co const container = page.locator('#container'); - await expect(container).toHaveScreenshot(screenshot(`divider-basic-inset`)); + await expect(container).toHaveScreenshot(screenshot(`divider-basic-padding`)); }); }); }); diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ionic-md-ltr-light-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ionic-md-ltr-light-Mobile-Chrome-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ionic-md-ltr-light-Mobile-Chrome-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ionic-md-ltr-light-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ionic-md-ltr-light-Mobile-Firefox-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ionic-md-ltr-light-Mobile-Firefox-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ionic-md-ltr-light-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ionic-md-ltr-light-Mobile-Safari-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ionic-md-ltr-light-Mobile-Safari-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ios-ltr-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ios-ltr-Mobile-Chrome-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ios-ltr-Mobile-Chrome-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ios-ltr-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ios-ltr-Mobile-Firefox-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ios-ltr-Mobile-Firefox-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ios-ltr-Mobile-Safari-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ios-ltr-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-ios-ltr-Mobile-Safari-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-ios-ltr-Mobile-Safari-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-md-ltr-Mobile-Chrome-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-md-ltr-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-md-ltr-Mobile-Chrome-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-md-ltr-Mobile-Chrome-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-md-ltr-Mobile-Firefox-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-md-ltr-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-md-ltr-Mobile-Firefox-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-md-ltr-Mobile-Firefox-linux.png diff --git a/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-md-ltr-Mobile-Safari-linux.png b/core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-md-ltr-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-inset-md-ltr-Mobile-Safari-linux.png rename to core/src/components/divider/test/basic/divider.e2e.ts-snapshots/divider-basic-padding-md-ltr-Mobile-Safari-linux.png diff --git a/core/src/components/divider/test/basic/index.html b/core/src/components/divider/test/basic/index.html index 8b92fed9e29..6cf66e28761 100644 --- a/core/src/components/divider/test/basic/index.html +++ b/core/src/components/divider/test/basic/index.html @@ -30,9 +30,9 @@

Default

Bottom
-

Inset

+

Horizontal Padding

Top - + Bottom
diff --git a/core/src/components/divider/test/spacing/index.html b/core/src/components/divider/test/spacing/index.html index 82562b2e2c1..f9e025d9afb 100644 --- a/core/src/components/divider/test/spacing/index.html +++ b/core/src/components/divider/test/spacing/index.html @@ -31,12 +31,7 @@ - -

No Inset

-
- -

With Inset

-
+
@@ -45,10 +40,8 @@

With Inset

function onLoad() { const spacings = ['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge']; const spacingContainer = document.getElementById('col-spacing'); - const insetContainer = document.getElementById('col-inset'); let spacingHtmlContent = ''; - let insetHtmlContent = ''; spacings.forEach((spacing) => { spacingHtmlContent += ` @@ -60,19 +53,8 @@

${spacing}

`; - insetHtmlContent += ` - - -

${spacing}

- top - - bottom -
-
- `; }); spacingContainer.innerHTML += spacingHtmlContent; - insetContainer.innerHTML += insetHtmlContent; } diff --git a/core/src/themes/ionic/default.tokens.ts b/core/src/themes/ionic/default.tokens.ts index 9717f8739c1..a59fca4903b 100644 --- a/core/src/themes/ionic/default.tokens.ts +++ b/core/src/themes/ionic/default.tokens.ts @@ -1572,13 +1572,6 @@ export const defaultTheme: DefaultTheme = { IonDivider: { color: '#d0d7df', - inset: { - padding: { - end: 'var(--ion-spacing-lg)', - start: 'var(--ion-spacing-lg)', - }, - }, - spacing: { xxsmall: { margin: { diff --git a/core/src/themes/ios/default.tokens.ts b/core/src/themes/ios/default.tokens.ts index deb37303bb9..08448b1e066 100644 --- a/core/src/themes/ios/default.tokens.ts +++ b/core/src/themes/ios/default.tokens.ts @@ -1986,13 +1986,6 @@ export const defaultTheme: DefaultTheme = { IonDivider: { color: '#e0e0e0', - inset: { - padding: { - end: 'var(--ion-spacing-lg)', - start: 'var(--ion-spacing-lg)', - }, - }, - spacing: { xxsmall: { margin: { diff --git a/core/src/themes/md/default.tokens.ts b/core/src/themes/md/default.tokens.ts index 87015aebdb3..bcebc0b7156 100644 --- a/core/src/themes/md/default.tokens.ts +++ b/core/src/themes/md/default.tokens.ts @@ -2139,13 +2139,6 @@ export const defaultTheme: DefaultTheme = { IonDivider: { color: '#e0e0e0', - inset: { - padding: { - end: 'var(--ion-spacing-lg)', - start: 'var(--ion-spacing-lg)', - }, - }, - spacing: { xxsmall: { margin: { diff --git a/packages/angular/src/lazy/directives/proxies.ts b/packages/angular/src/lazy/directives/proxies.ts index e3333f46cc7..8804f1f7460 100644 --- a/packages/angular/src/lazy/directives/proxies.ts +++ b/packages/angular/src/lazy/directives/proxies.ts @@ -774,14 +774,14 @@ export declare interface IonDatetimeButton extends Components.IonDatetimeButton @ProxyCmp({ - inputs: ['inset', 'spacing'] + inputs: ['spacing'] }) @Component({ selector: 'ion-divider', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: [{ name: 'inset', transform: nullableBooleanAttribute }, 'spacing'], + inputs: ['spacing'], standalone: false }) export class IonDivider { diff --git a/packages/angular/src/standalone/directives/ion-divider.ts b/packages/angular/src/standalone/directives/ion-divider.ts index 6234d0aca28..0b9a4766858 100644 --- a/packages/angular/src/standalone/directives/ion-divider.ts +++ b/packages/angular/src/standalone/directives/ion-divider.ts @@ -3,7 +3,6 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, NgZone } from '@angular/core'; import { ProxyCmp } from './angular-component-lib/utils'; -import { nullableBooleanAttribute } from './angular-component-lib/boolean-attribute'; import type { Components } from '@ionic/core/components'; @@ -11,14 +10,14 @@ import { defineCustomElement as defineIonDivider } from '@ionic/core/components/ @ProxyCmp({ defineCustomElementFn: defineIonDivider, - inputs: ['inset', 'spacing'] + inputs: ['spacing'] }) @Component({ selector: 'ion-divider', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: [{ name: 'inset', transform: nullableBooleanAttribute }, 'spacing'], + inputs: ['spacing'], }) export class IonDivider { protected el: HTMLIonDividerElement; diff --git a/packages/vue/src/proxies.ts b/packages/vue/src/proxies.ts index b1f9eff515b..9771f4ea728 100644 --- a/packages/vue/src/proxies.ts +++ b/packages/vue/src/proxies.ts @@ -392,8 +392,7 @@ export const IonDatetimeButton: StencilVueComponent = /*@ export const IonDivider: StencilVueComponent = /*@__PURE__*/ defineContainer('ion-divider', defineIonDivider, [ - 'spacing', - 'inset' + 'spacing' ]); From a3de31d27dfd07f21ca202d72c6fe76eb2a143c3 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Thu, 19 Nov 2026 16:35:07 -0800 Subject: [PATCH 3/7] refactor(divider): rename xxsmall spacing to none --- core/api.txt | 4 +--- core/src/components.d.ts | 4 ++-- core/src/components/divider/_divider.docs.scss | 2 -- core/src/components/divider/divider.interface.ts | 6 +++--- core/src/components/divider/divider.scss | 8 +++++++- core/src/components/divider/divider.tsx | 2 +- ...none-ionic-md-ltr-light-Mobile-Chrome-linux.png} | Bin ...one-ionic-md-ltr-light-Mobile-Firefox-linux.png} | Bin ...none-ionic-md-ltr-light-Mobile-Safari-linux.png} | Bin ...er-spacing-none-ios-ltr-Mobile-Chrome-linux.png} | Bin ...r-spacing-none-ios-ltr-Mobile-Firefox-linux.png} | Bin ...er-spacing-none-ios-ltr-Mobile-Safari-linux.png} | Bin ...der-spacing-none-md-ltr-Mobile-Chrome-linux.png} | Bin ...er-spacing-none-md-ltr-Mobile-Firefox-linux.png} | Bin ...der-spacing-none-md-ltr-Mobile-Safari-linux.png} | Bin core/src/components/divider/test/spacing/index.html | 2 +- core/src/themes/ionic/default.tokens.ts | 7 ------- core/src/themes/ios/default.tokens.ts | 7 ------- core/src/themes/md/default.tokens.ts | 7 ------- 19 files changed, 15 insertions(+), 34 deletions(-) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Chrome-linux.png => divider-spacing-none-ionic-md-ltr-light-Mobile-Chrome-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Firefox-linux.png => divider-spacing-none-ionic-md-ltr-light-Mobile-Firefox-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Safari-linux.png => divider-spacing-none-ionic-md-ltr-light-Mobile-Safari-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-ios-ltr-Mobile-Chrome-linux.png => divider-spacing-none-ios-ltr-Mobile-Chrome-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-ios-ltr-Mobile-Firefox-linux.png => divider-spacing-none-ios-ltr-Mobile-Firefox-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-ios-ltr-Mobile-Safari-linux.png => divider-spacing-none-ios-ltr-Mobile-Safari-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-md-ltr-Mobile-Chrome-linux.png => divider-spacing-none-md-ltr-Mobile-Chrome-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-md-ltr-Mobile-Firefox-linux.png => divider-spacing-none-md-ltr-Mobile-Firefox-linux.png} (100%) rename core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/{divider-spacing-xxsmall-md-ltr-Mobile-Safari-linux.png => divider-spacing-none-md-ltr-Mobile-Safari-linux.png} (100%) diff --git a/core/api.txt b/core/api.txt index be448c644e3..16cac6e27b8 100644 --- a/core/api.txt +++ b/core/api.txt @@ -1291,7 +1291,7 @@ ion-datetime-button,prop,theme,"ios" | "md" | "ionic",undefined,false,false ion-datetime-button,part,native ion-divider,shadow -ion-divider,prop,spacing,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxlarge" | "xxsmall" | undefined,undefined,false,true +ion-divider,prop,spacing,"large" | "medium" | "none" | "small" | "xlarge" | "xsmall" | "xxlarge" | undefined,undefined,false,true ion-divider,css-prop,--ion-divider-color ion-divider,css-prop,--ion-divider-spacing-large-margin-bottom ion-divider,css-prop,--ion-divider-spacing-large-margin-top @@ -1305,8 +1305,6 @@ ion-divider,css-prop,--ion-divider-spacing-xsmall-margin-bottom ion-divider,css-prop,--ion-divider-spacing-xsmall-margin-top ion-divider,css-prop,--ion-divider-spacing-xxlarge-margin-bottom ion-divider,css-prop,--ion-divider-spacing-xxlarge-margin-top -ion-divider,css-prop,--ion-divider-spacing-xxsmall-margin-bottom -ion-divider,css-prop,--ion-divider-spacing-xxsmall-margin-top ion-divider,css-prop,--ion-divider-thickness ion-fab,shadow diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 4df26e9a056..52ca46acdb0 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -1352,7 +1352,7 @@ export namespace Components { } interface IonDivider { /** - * Controls the space above and below the line. Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. + * Controls the space above and below the line. Set to `"none"` for no spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. */ "spacing"?: IonDividerSpacing; } @@ -7224,7 +7224,7 @@ declare namespace LocalJSX { } interface IonDivider { /** - * Controls the space above and below the line. Set to `"xxsmall"` for the smallest spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. + * Controls the space above and below the line. Set to `"none"` for no spacing. Set to `"xsmall"` for very small spacing. Set to `"small"` for small spacing. Set to `"medium"` for medium spacing. Set to `"large"` for large spacing. Set to `"xlarge"` for very large spacing. Set to `"xxlarge"` for the largest spacing. Defaults to `"medium"` if both the spacing property and theme config are unset. */ "spacing"?: IonDividerSpacing; } diff --git a/core/src/components/divider/_divider.docs.scss b/core/src/components/divider/_divider.docs.scss index 88b50f0a0ec..de1a85c80a8 100644 --- a/core/src/components/divider/_divider.docs.scss +++ b/core/src/components/divider/_divider.docs.scss @@ -1,7 +1,5 @@ /** * @prop --ion-divider-color: Color of the divider line - * @prop --ion-divider-spacing-xxsmall-margin-top: Top margin of the `xxsmall` divider spacing - * @prop --ion-divider-spacing-xxsmall-margin-bottom: Bottom margin of the `xxsmall` divider spacing * @prop --ion-divider-spacing-xsmall-margin-top: Top margin of the `xsmall` divider spacing * @prop --ion-divider-spacing-xsmall-margin-bottom: Bottom margin of the `xsmall` divider spacing * @prop --ion-divider-spacing-small-margin-top: Top margin of the `small` divider spacing diff --git a/core/src/components/divider/divider.interface.ts b/core/src/components/divider/divider.interface.ts index d1eb4a625ef..dd987ee0b70 100644 --- a/core/src/components/divider/divider.interface.ts +++ b/core/src/components/divider/divider.interface.ts @@ -4,9 +4,9 @@ export type IonDividerRecipe = { /** Color of the divider line. */ color?: string; - /** Applies for each value of the `spacing` property. */ + /** Applies for each value of the `spacing` property, except `"none"`, which is always 0. */ spacing?: { - [K in IonDividerSpacing]?: { + [K in Exclude]?: { /** Space above and below the line. Collapses with the margins of adjacent elements. */ margin?: Pick; }; @@ -21,5 +21,5 @@ export type IonDividerConfig = { spacing?: IonDividerSpacing; }; -export const ION_DIVIDER_SPACINGS = ['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge'] as const; +export const ION_DIVIDER_SPACINGS = ['none', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge'] as const; export type IonDividerSpacing = (typeof ION_DIVIDER_SPACINGS)[number]; diff --git a/core/src/components/divider/divider.scss b/core/src/components/divider/divider.scss index 4cb0fb60560..fdc26e39dba 100644 --- a/core/src/components/divider/divider.scss +++ b/core/src/components/divider/divider.scss @@ -4,7 +4,7 @@ // Divider // -------------------------------------------------- -$spacings: xxsmall, xsmall, small, medium, large, xlarge, xxlarge; +$spacings: xsmall, small, medium, large, xlarge, xxlarge; :host { @include mixins.padding-horizontal(var(--padding-start, 0px), var(--padding-end, 0px)); @@ -28,6 +28,12 @@ $spacings: xxsmall, xsmall, small, medium, large, xlarge, xxlarge; // Divider Spacing // -------------------------------------------------- +// No theme token: `none` is always 0. The app's `--margin-*` still applies. +:host(.divider-spacing-none) hr { + margin-top: var(--margin-top, 0); + margin-bottom: var(--margin-bottom, 0); +} + @each $spacing in $spacings { :host(.divider-spacing-#{$spacing}) hr { margin-top: var(--margin-top, var(--ion-divider-spacing-#{$spacing}-margin-top)); diff --git a/core/src/components/divider/divider.tsx b/core/src/components/divider/divider.tsx index 20e295ccf71..fe8e07a9f40 100644 --- a/core/src/components/divider/divider.tsx +++ b/core/src/components/divider/divider.tsx @@ -14,7 +14,7 @@ export class Divider implements ComponentInterface { /** * Controls the space above and below the line. * - * Set to `"xxsmall"` for the smallest spacing. + * Set to `"none"` for no spacing. * Set to `"xsmall"` for very small spacing. * Set to `"small"` for small spacing. * Set to `"medium"` for medium spacing. diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ionic-md-ltr-light-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Chrome-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ionic-md-ltr-light-Mobile-Chrome-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ionic-md-ltr-light-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Firefox-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ionic-md-ltr-light-Mobile-Firefox-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ionic-md-ltr-light-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ionic-md-ltr-light-Mobile-Safari-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ionic-md-ltr-light-Mobile-Safari-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ios-ltr-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ios-ltr-Mobile-Chrome-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ios-ltr-Mobile-Chrome-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ios-ltr-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ios-ltr-Mobile-Firefox-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ios-ltr-Mobile-Firefox-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ios-ltr-Mobile-Safari-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ios-ltr-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-ios-ltr-Mobile-Safari-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-ios-ltr-Mobile-Safari-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-md-ltr-Mobile-Chrome-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-md-ltr-Mobile-Chrome-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-md-ltr-Mobile-Chrome-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-md-ltr-Mobile-Chrome-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-md-ltr-Mobile-Firefox-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-md-ltr-Mobile-Firefox-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-md-ltr-Mobile-Firefox-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-md-ltr-Mobile-Firefox-linux.png diff --git a/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-md-ltr-Mobile-Safari-linux.png b/core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-md-ltr-Mobile-Safari-linux.png similarity index 100% rename from core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-xxsmall-md-ltr-Mobile-Safari-linux.png rename to core/src/components/divider/test/spacing/divider.e2e.ts-snapshots/divider-spacing-none-md-ltr-Mobile-Safari-linux.png diff --git a/core/src/components/divider/test/spacing/index.html b/core/src/components/divider/test/spacing/index.html index f9e025d9afb..4f3325af16a 100644 --- a/core/src/components/divider/test/spacing/index.html +++ b/core/src/components/divider/test/spacing/index.html @@ -38,7 +38,7 @@