summaryrefslogtreecommitdiffstats
path: root/src/objects/_badge.vars.scss
blob: ff07148166edf7104a9195ab34e6a2b86ae44d3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
@use 'sass:map';
@use 'sass:string';
@use 'iro-sass/src/props';
@use '../core.vars' as core;

$pad-b:       props.def(--o-badge--pad-b, props.get(core.$size--50)) !default;
$pad-i:       props.def(--o-badge--pad-i, props.get(core.$size--100)) !default;
$pad-i-pill:  props.def(--o-badge--pad-i-pill, props.get(core.$size--150)) !default;
$pad-i-label: props.def(--o-badge--pad-i-label, props.get(core.$size--50)) !default;
$rounding:    props.def(--o-badge--rounding, props.get(core.$rounding)) !default;
$font-size:   props.def(--o-badge--font-size, props.get(core.$font-size--75)) !default;

$pad-b--sm:       props.def(--o-badge--sm--pad-b, props.get(core.$size--25)) !default;
$pad-i--sm:       props.def(--o-badge--sm--pad-i, props.get(core.$size--75)) !default;
$pad-i-pill--sm:  props.def(--o-badge--sm--pad-i-pill, props.get(core.$size--125)) !default;
$pad-i-label--sm: props.def(--o-badge--sm--pad-i-label, props.get(core.$size--25)) !default;
$font-size--sm:   props.def(--o-badge--sm--font-size, props.get(core.$font-size--50)) !default;

$pad-b--lg:       props.def(--o-badge--lg--pad-b, props.get(core.$size--75)) !default;
$pad-i--lg:       props.def(--o-badge--lg--pad-i, props.get(core.$size--125)) !default;
$pad-i-pill--lg:  props.def(--o-badge--lg--pad-i-pill, props.get(core.$size--175)) !default;
$pad-i-label--lg: props.def(--o-badge--lg--pad-i-label, props.get(core.$size--50)) !default;
$font-size--lg:   props.def(--o-badge--lg--font-size, props.get(core.$font-size--100)) !default;

$pad-b--xl:       props.def(--o-badge--xl--pad-b, props.get(core.$size--100)) !default;
$pad-i--xl:       props.def(--o-badge--xl--pad-i, props.get(core.$size--150)) !default;
$pad-i-pill--xl:  props.def(--o-badge--xl--pad-i-pill, props.get(core.$size--225)) !default;
$pad-i-label--xl: props.def(--o-badge--xl--pad-i-label, props.get(core.$size--75)) !default;
$font-size--xl:   props.def(--o-badge--xl--font-size, props.get(core.$font-size--150)) !default;

$key-focus--border-width:  props.def(--o-badge--key-focus--border-width, props.get(core.$key-focus--border-width)) !default;
$key-focus--border-offset: props.def(--o-badge--key-focus--border-offset, props.get(core.$key-focus--border-offset)) !default;
$key-focus--outline-width: props.def(--o-badge--key-focus--outline-width, props.get(core.$key-focus--outline-width)) !default;

$sizes: (
    'sm' $pad-b--sm $pad-i--sm $pad-i-pill--sm $pad-i-label--sm $font-size--sm,
    'lg' $pad-b--lg $pad-i--lg $pad-i-pill--lg $pad-i-label--lg $font-size--lg,
    'xl' $pad-b--xl $pad-i--xl $pad-i-pill--xl $pad-i-label--xl $font-size--xl,
) !default;

$default-theme-override: () !default;
$default-theme: props.def(--o-badge, (
    --bg:    props.get(core.$theme, --heading),
    --label: props.get(core.$theme, --bg-l2),
    
    --hover: (
        --bg:    props.get(core.$theme, --text),
        --label: props.get(core.$theme, --bg-l2),
    ),

    --active: (
        --bg:    props.get(core.$theme, --text-mute),
        --label: props.get(core.$theme, --bg-l2),
    ),

    --key-focus: (
        --label:   props.get(core.$theme, --focus, --text),
        --border:  props.get(core.$theme, --focus, --border),
        --outline: props.get(core.$theme, --focus, --outline),
    ),

    --quiet: (
        --bg:    props.get(core.$theme, --border-mute),
        --label: props.get(core.$theme, --heading),

        --hover: (
            --bg:    props.get(core.$theme, --border),
            --label: props.get(core.$theme, --heading),
        ),

        --active: (
            --bg:     props.get(core.$theme, --border-strong),
            --label: props.get(core.$theme, --heading),
        ),
    )
), 'color') !default;
$default-theme: props.merge($default-theme, $default-theme-override);

$static-themes: props.def(--o-badge, (), 'color');

@each $theme in map.keys(props.get(core.$transparent-colors)) {
    $badge-theme: --static-#{string.slice($theme, 3)};

    $static-themes: props.merge($static-themes, (
        $badge-theme: (
            --bg:    props.get(core.$transparent-colors, $theme, --800),
            --label: props.get(core.$transparent-colors, $theme, --text),

            --hover: (
                --bg:    props.get(core.$transparent-colors, $theme, --900),
                --label: props.get(core.$transparent-colors, $theme, --text),
            ),

            --active: (
                --bg:    props.get(core.$transparent-colors, $theme, --900),
                --label: props.get(core.$transparent-colors, $theme, --text),
            ),

            --key-focus: (
                --bg:      props.get(core.$transparent-colors, $theme, --100),
                --label:   props.get(core.$transparent-colors, $theme, --900),
                --border:  props.get(core.$transparent-colors, $theme, --900),
                --outline: props.get(core.$transparent-colors, $theme, --300),
            ),

            --quiet: (
                --bg:    props.get(core.$transparent-colors, $theme, --200),
                --label: props.get(core.$transparent-colors, $theme, --900),
                --hover: (
                    --bg:    props.get(core.$transparent-colors, $theme, --300),
                    --label: props.get(core.$transparent-colors, $theme, --900),
                ),
                --active: (
                    --bg:    props.get(core.$transparent-colors, $theme, --400),
                    --label: props.get(core.$transparent-colors, $theme, --900),
                ),
            )
        )
    ));
}

$themes-config: (
    accent:   --accent,
    positive: --positive,
    negative: --negative,
    warning:  --warning,
) !default;

$themes: props.def(--o-badge, (), 'color');

@each $theme, $key in $themes-config {
    $themes: props.merge($themes, (
        --#{$theme}: (
            --bg:    props.get(core.$theme, #{$key}-static, --900),
            --label: props.get(core.$theme, #{$key}-static, --900-text),
            
            --hover: (
                --bg:    props.get(core.$theme, #{$key}-static, --1000),
                --label: props.get(core.$theme, #{$key}-static, --1000-text),
            ),

            --active: (
                --bg:    props.get(core.$theme, #{$key}-static, --1100),
                --label: props.get(core.$theme, #{$key}-static, --1000-text),
            ),

            --quiet: (
                --bg:    props.get(core.$theme, $key, --200),
                --label: props.get(core.$theme, $key, --1100),
                --hover: (
                    --bg:    props.get(core.$theme, $key, --300),
                    --label: props.get(core.$theme, $key, --1200),
                ),
                --active: (
                    --bg:    props.get(core.$theme, $key, --400),
                    --label: props.get(core.$theme, $key, --1300),
                ),
            )
        )
    ));
}