Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: define option, state, hierharchy and style (#264)
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
pylapp committed Jan 29, 2025
1 parent ea3ab14 commit 7209377
Showing 2 changed files with 102 additions and 0 deletions.
101 changes: 101 additions & 0 deletions OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift
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

GitHub Actions / ui-test

type 'OUDSCheckbox' does not conform to protocol 'View'

Check failure on line 32 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift

GitHub Actions / build

type 'OUDSCheckbox' does not conform to protocol 'View'

Check failure on line 32 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift

GitHub Actions / unit-test

type 'OUDSCheckbox' does not conform to protocol 'View'

// MARK: - Layout

/// The type of layouts or, in the end, checkbox component to use
public enum Layout {

Check failure on line 38 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift

GitHub Actions / SwiftLint

Trailing Whitespace (trailing_whitespace)

Lines should not have trailing whitespace
/// A checkbox with a box to fill and a label
case `default`

/// Only a checkbox, without text
case selectorOnly

Check failure on line 44 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift

GitHub Actions / SwiftLint

Trailing Whitespace (trailing_whitespace)

Lines should not have trailing whitespace
/// 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

Check failure on line 83 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift

GitHub Actions / SwiftLint

Trailing Whitespace (trailing_whitespace)

Lines should not have trailing whitespace
/// Add an helper text below the label
case withHelperText

Check failure on line 86 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift

GitHub Actions / SwiftLint

Trailing Whitespace (trailing_whitespace)

Lines should not have trailing whitespace
/// Add a diviser bellow the layout of the component
case withDivider
}

Check failure on line 90 in OUDS/Core/Components/Sources/Checkbox/OUDSCheckbox.swift

GitHub Actions / SwiftLint

Trailing Whitespace (trailing_whitespace)

Lines should not have trailing whitespace
// 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
}
}
Original file line number Diff line number Diff line change
@@ -102,3 +102,4 @@ The helper is available through `View`, and tokens through the provider of the t
### Group

- ``OUDSButton``
- ``OUDSCheckbox``

0 comments on commit 7209377

Please sign in to comment.