-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
chore: define option, state, hierharchy and style (#264)
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// | ||
// Software Name: OUDS iOS | ||
// SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This software is distributed under the MIT license, | ||
// the text of which is available at https://opensource.org/license/MIT/ | ||
// or see the "LICENSE" file for more details. | ||
// | ||
// Authors: See CONTRIBUTORS.txt | ||
// Software description: A SwiftUI components library with code examples for Orange Unified Design System | ||
// | ||
|
||
import OUDSFoundations | ||
import SwiftUI | ||
|
||
// MARK: - OUDS Checbkox | ||
|
||
/// The ``OUDSChebckbox`` proposes... | ||
/// | ||
/// ## Hierarchies | ||
/// | ||
/// ## Code samples | ||
/// | ||
/// ## Styles | ||
/// | ||
/// ## Colored Surface | ||
/// | ||
/// ## Design documentation | ||
/// | ||
/// - Since: 0.11.0 | ||
public struct OUDSCheckbox: View { | ||
Check failure on line 32 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift
|
||
|
||
// MARK: - Layout | ||
|
||
/// The type of layouts or, in the end, checkbox component to use | ||
public enum Layout { | ||
|
||
/// A checkbox with a box to fill and a label | ||
case `default` | ||
|
||
/// Only a checkbox, without text | ||
case selectorOnly | ||
|
||
/// A checkbox with a box to fill and a label, but inverse, i.e. with a trailing checkbox | ||
case inverseDefault | ||
|
||
/// Only a checkbox, without text, but inverse, i.e. with a trailing checkbox | ||
case inverseSelectorOnly | ||
} | ||
|
||
// MARK: - Status | ||
|
||
/// Represents the status of a checkbox i.e. a kind of type or status | ||
public enum Status { | ||
/// The checkbox is selected | ||
case selected | ||
|
||
/// The checkbox is not selected | ||
case unselected | ||
|
||
/// The checkbox is in an undeterminate state, i.e. preselected for example | ||
case undeterminate | ||
|
||
/// The checkbox is selected but is related to an error situation | ||
case errorSelected | ||
|
||
/// The checkbox is not selectedbut is related to an error situation | ||
case errorUnselected | ||
|
||
/// The checbkox is in an undeterminate state, i.e. preselected for example, but is related to an error situation | ||
case errorUndeterminate | ||
} | ||
|
||
// MARK: - Options | ||
|
||
public enum Option { | ||
|
||
/// Add an icon in the opposite of the checkbox. | ||
/// If checkbox is in leading position, icon is in trailing position. | ||
/// If checkbox is in trailng position, icon is in leading position. | ||
case withIcon | ||
|
||
/// Add an helper text below the label | ||
case withHelperText | ||
|
||
/// Add a diviser bellow the layout of the component | ||
case withDivider | ||
} | ||
|
||
// MARK: - State | ||
|
||
/// Defines the state of the checkbox, e.g. loading or not, for the style | ||
public enum State { | ||
/// The default style, the checkbox could be in states: enabled, disabled, hover, pressed, focused, read only, skeleton | ||
case `default` | ||
|
||
/// The loading style means a loading action is in progress, sometimes just after user tapped on chekcbix | ||
case loading | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters