Skip to content

Commit

Permalink
docs(): merge feature-8.4 docs (#3877)
Browse files Browse the repository at this point in the history
* docs(select): add `modal` interface to `ion-select` docs (#3872)

* docs(select): update select docs for modal interface

* fix(select): point playground to correct demo

* feat(segment): add playground & docs for segment view (#3875)

* feat(segment): add playground & docs for segment view

* fix(segment-view): api import version

* fix(segment-content): usage & common API sections

* Force CI run
  • Loading branch information
tanner-reits authored Nov 4, 2024
1 parent d1f0b7c commit 9a40ae3
Show file tree
Hide file tree
Showing 25 changed files with 573 additions and 11 deletions.
52 changes: 52 additions & 0 deletions docs/api/segment-content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: "ion-segment-content"
---

import Props from '@ionic-internal/component-api/v8/segment-content/props.md';
import Events from '@ionic-internal/component-api/v8/segment-content/events.md';
import Methods from '@ionic-internal/component-api/v8/segment-content/methods.md';
import Parts from '@ionic-internal/component-api/v8/segment-content/parts.md';
import CustomProps from '@ionic-internal/component-api/v8/segment-content/custom-props.mdx';
import Slots from '@ionic-internal/component-api/v8/segment-content/slots.md';

<head>
<title>ion-segment-content: Display control element for swipeable segments</title>
<meta name="description" content="ion-segment-contents are wrapper elements used to control the display of child elements when using swipeable segments." />
</head>

import EncapsulationPill from '@components/page/api/EncapsulationPill';

<EncapsulationPill type="shadow" />

Segment content is a wrapper element used to control the display of child elements when using swipeable segments. Segment content elements are children of a single
[segment view](./segment-view.md) instance that is linked to a [segment](./segment.md). See our [swipeable segments](./segment.md#swipeable-segments) documentation
for more information on how to use segment contents.

## Usage

Each `ion-segment-content` needs a unique `id` attribute. This will be used to link the segment content to a segment button via the button's
[contentId property](./segment-button.md#properties).

<!-- Reuse swipeable segments playground -->

import Swipeable from '@site/static/usage/v8/segment/swipeable/index.md';

<Swipeable />

## Properties
<Props />

## Events
<Events />

## Methods
<Methods />

## CSS Shadow Parts
<Parts />

## CSS Custom Properties
<CustomProps />

## Slots
<Slots />
40 changes: 40 additions & 0 deletions docs/api/segment-view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: "ion-segment-view"
---

import Props from '@ionic-internal/component-api/v8/segment-view/props.md';
import Events from '@ionic-internal/component-api/v8/segment-view/events.md';
import Methods from '@ionic-internal/component-api/v8/segment-view/methods.md';
import Parts from '@ionic-internal/component-api/v8/segment-view/parts.md';
import CustomProps from '@ionic-internal/component-api/v8/segment-view/custom-props.mdx';
import Slots from '@ionic-internal/component-api/v8/segment-view/slots.md';

<head>
<title>ion-segment-view: Controller element for swipeable segments</title>
<meta name="description" content="ion-segment-views are wrapper elements that link a group of segment contents to a segment" />
</head>

import EncapsulationPill from '@components/page/api/EncapsulationPill';

<EncapsulationPill type="shadow" />

Segment view is a wrapper element that links a group of [segment contents](./segment-content.md) to a [segment](./segment.md) when using swipeable segments.
See our [swipeable segments](./segment.md#swipeable-segments) documentation for more information on how to use segment views.

## Properties
<Props />

## Events
<Events />

## Methods
<Methods />

## CSS Shadow Parts
<Parts />

## CSS Custom Properties
<CustomProps />

## Slots
<Slots />
16 changes: 16 additions & 0 deletions docs/api/segment.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ import Toolbar from '@site/static/usage/v8/toolbar/segments/index.md';
<Toolbar />


## Swipeable Segments

Each [segment button](./segment-button.md) can be associated with a [segment content](./segment-content.md) element that will be displayed
when the segment is active. With this approach, each segment's content can be swiped or scrolled between and the segment will be updated
to reflect the currently visible content.

:::warning
If no initial `value` is assigned to the `ion-segment` when using swipeable segments, the segment will default to the value of the first segment button.

Segment buttons cannot be disabled when used with swipeable segments.
:::

import Swipeable from '@site/static/usage/v8/segment/swipeable/index.md';

<Swipeable />

## Theming

### Colors
Expand Down
32 changes: 22 additions & 10 deletions docs/api/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import SingleSelectionExample from '@site/static/usage/v8/select/basic/single-se

## Multiple Selection

By adding the `multiple` attribute to select, users are able to select multiple options. When multiple options can be selected, the alert or popover overlay presents users with a checkbox styled list of options. The select component's value receives an array of all of the selected option values.
By adding the `multiple` attribute to select, users are able to select multiple options. When multiple options can be selected, the alert, popover, or modal overlay presents users with a checkbox styled list of options. The select component's value receives an array of all of the selected option values.

:::note

Expand All @@ -86,7 +86,7 @@ import MultipleSelectionExample from '@site/static/usage/v8/select/basic/multipl

## Interfaces

By default, select uses [ion-alert](alert.md) to open up the overlay of options in an alert. The interface can be changed to use [ion-action-sheet](action-sheet.md) or [ion-popover](popover.md) by passing `action-sheet` or `popover`, respectively, to the `interface` property. Read on to the other sections for the limitations of the different interfaces.
By default, select uses [ion-alert](alert.md) to open up the overlay of options in an alert. The interface can be changed to use [ion-action-sheet](action-sheet.md), [ion-popover](popover.md), or [ion-modal](modal.md) by passing `action-sheet`, `popover`, or `modal`, respectively, to the `interface` property. Read on to the other sections for the limitations of the different interfaces.

### Alert

Expand All @@ -107,6 +107,12 @@ import PopoverExample from '@site/static/usage/v8/select/interfaces/popover/inde

<PopoverExample />

### Modal

import ModalExample from '@site/static/usage/v8/select/interfaces/modal/index.md';

<ModalExample />

## Responding to Interaction

The main ways of handling user interaction with the select are the `ionChange`, `ionDismiss`, and `ionCancel` events. See [Events](#events) for more details on these and other events that select fires.
Expand Down Expand Up @@ -161,15 +167,19 @@ The alert supports two buttons: `Cancel` and `OK`. Each button's text can be cus

The `action-sheet` and `popover` interfaces do not have an `OK` button, clicking on any of the options will automatically close the overlay and select that value. The `popover` interface does not have a `Cancel` button, clicking on the backdrop will close the overlay.

The `modal` interface has a single `Close` button in the header. This button is only responsible for dismissing the modal. Any selections made will persist
after clicking this button or if the modal is dismissed using an alternative method.

import ButtonTextExample from '@site/static/usage/v8/select/customization/button-text/index.md';

<ButtonTextExample />

## Interface Options

Since select uses the alert, action sheet and popover interfaces, options can be passed to these components through the `interfaceOptions` property. This can be used to pass a custom header, subheader, css class, and more.
Since select uses the alert, action sheet, popover, and modal interfaces, options can be passed to these components through the `interfaceOptions` property. This can be used to pass a custom header, subheader, css class, and more.

See the [ion-alert docs](alert.md), [ion-action-sheet docs](action-sheet.md), and [ion-popover docs](popover.md) for the properties that each interface accepts.
See the [ion-alert docs](alert.md), [ion-action-sheet docs](action-sheet.md), [ion-popover docs](popover.md), and [ion-modal docs](modal.md)
for the properties that each interface accepts.

Note: `interfaceOptions` will not override `inputs` or `buttons` with the `alert` interface.

Expand Down Expand Up @@ -207,11 +217,13 @@ import StylingSelectExample from '@site/static/usage/v8/select/customization/sty

### Styling Select Interface

Customizing the interface dialog should be done by following the Customization section in that interface's documentation:
Customizing the interface dialog should be done by following the styling sections (CSS shadow parts, CSS custom properties, and slots) in
that interface's documentation:

- [Alert Customization](alert.md#customization)
- [Action Sheet Customization](action-sheet.md#customization)
- [Popover Customization](popover.md#customization)
- [Alert](alert.md#css-shadow-parts)
- [Action Sheet](action-sheet.md#css-shadow-parts)
- [Popover](popover.md#css-shadow-parts)
- [Modal](modal.md#css-shadow-parts)

However, the Select Option does set a class for easier styling and allows for the ability to pass a class to the overlay option, see the [Select Options documentation](select-option.md) for usage examples of customizing options.

Expand Down Expand Up @@ -304,7 +316,7 @@ These keyboard interactions apply to all `ion-select` elements when the followin

Single selection keyboard interaction follows the [ARIA implementation patterns of a radio](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).

These keyboard interactions apply to `ion-action-sheet`, `ion-alert`, and `ion-popover` elements when the overlay is presented and focused.
These keyboard interactions apply to `ion-action-sheet`, `ion-alert`, `ion-popover`, and `ion-modal` elements when the overlay is presented and focused.

| Key | Description |
| --------------------- | ------------------------------------------------------------ |
Expand All @@ -321,7 +333,7 @@ These keyboard interactions apply to `ion-action-sheet`, `ion-alert`, and `ion-p

Multiple selection keyboard interaction follows the [ARIA implementation patterns of a checkbox](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).

These keyboard interactions apply to `ion-alert` and `ion-popover` elements when the overlay is presented and multiple selection is enabled.
These keyboard interactions apply to `ion-alert`, `ion-popover`, and `ion-modal` elements when the overlay is presented and multiple selection is enabled.

| Key | Description |
| ------------------ | ------------------------------------------------------------ |
Expand Down
2 changes: 1 addition & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ module.exports = {
type: 'category',
label: 'Segment',
collapsed: false,
items: ['api/segment', 'api/segment-button'],
items: ['api/segment', 'api/segment-button', 'api/segment-content', 'api/segment-view'],
},
{
type: 'category',
Expand Down
20 changes: 20 additions & 0 deletions static/usage/v8/segment/swipeable/angular/angular_css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```css
ion-segment-view {
height: 150px;
}

ion-segment-content {
display: flex;
align-items: center;
justify-content: center;
}
ion-segment-content:nth-of-type(1) {
background: lightpink;
}
ion-segment-content:nth-of-type(2) {
background: lightblue;
}
ion-segment-content:nth-of-type(3) {
background: lightgreen;
}
```
18 changes: 18 additions & 0 deletions static/usage/v8/segment/swipeable/angular/angular_html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```html
<ion-segment>
<ion-segment-button value="first" content-id="first">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="second" content-id="second">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="third" content-id="third">
<ion-label>Third</ion-label>
</ion-segment-button>
</ion-segment>
<ion-segment-view>
<ion-segment-content id="first">First</ion-segment-content>
<ion-segment-content id="second">Second</ion-segment-content>
<ion-segment-content id="third">Third</ion-segment-content>
</ion-segment-view>
```
56 changes: 56 additions & 0 deletions static/usage/v8/segment/swipeable/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Segment - Swipeable</title>
<link rel="stylesheet" href="../../common.css" />
<script src="../../common.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@8/dist/ionic/ionic.esm.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@8/css/ionic.bundle.css" />

<style>
ion-segment-view {
height: 168px;
}

ion-segment-content {
display: flex;
align-items: center;
justify-content: center;
}
ion-segment-content:nth-of-type(1) {
background: lightpink;
}
ion-segment-content:nth-of-type(2) {
background: lightblue;
}
ion-segment-content:nth-of-type(3) {
background: lightgreen;
}
</style>
</head>

<body>
<ion-app>
<ion-content>
<ion-segment>
<ion-segment-button value="first" content-id="first">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="second" content-id="second">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="third" content-id="third">
<ion-label>Third</ion-label>
</ion-segment-button>
</ion-segment>
<ion-segment-view>
<ion-segment-content id="first">First</ion-segment-content>
<ion-segment-content id="second">Second</ion-segment-content>
<ion-segment-content id="third">Third</ion-segment-content>
</ion-segment-view>
</ion-content>
</ion-app>
</body>
</html>
29 changes: 29 additions & 0 deletions static/usage/v8/segment/swipeable/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Playground from '@site/src/components/global/Playground';

import javascript from './javascript.md';
import react_main_tsx from './react/react_tsx.md';
import react_main_css from './react/react_css.md';
import vue from './vue.md';
import angular_html from './angular/angular_html.md';
import angular_css from './angular/angular_css.md';

<Playground
version="8"
code={{
javascript,
react: {
files: {
'src/main.tsx': react_main_tsx,
'src/main.css': react_main_css,
},
},
vue,
angular: {
files: {
'src/app/example.component.html': angular_html,
'src/app/example.component.css': angular_css,
},
},
}}
src="usage/v8/segment/swipeable/demo.html"
/>
39 changes: 39 additions & 0 deletions static/usage/v8/segment/swipeable/javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
```html
<ion-segment>
<ion-segment-button value="first" content-id="first">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="second" content-id="second">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="third" content-id="third">
<ion-label>Third</ion-label>
</ion-segment-button>
</ion-segment>
<ion-segment-view>
<ion-segment-content id="first">First</ion-segment-content>
<ion-segment-content id="second">Second</ion-segment-content>
<ion-segment-content id="third">Third</ion-segment-content>
</ion-segment-view>

<style>
ion-segment-view {
height: 150px;
}
ion-segment-content {
display: flex;
align-items: center;
justify-content: center;
}
ion-segment-content:nth-of-type(1) {
background: lightpink;
}
ion-segment-content:nth-of-type(2) {
background: lightblue;
}
ion-segment-content:nth-of-type(3) {
background: lightgreen;
}
</style>
```
Loading

0 comments on commit 9a40ae3

Please sign in to comment.