|
1 | 1 | @use "../../themes/ionic/ionic.globals.scss" as globals;
|
| 2 | +@use "./chip.common"; |
2 | 3 |
|
3 | 4 | // Ionic Chip
|
4 | 5 | // --------------------------------------------------
|
5 | 6 |
|
6 | 7 | :host {
|
7 |
| - --background: #{globals.$ion-primitives-neutral-100}; |
8 |
| - --color: #{globals.$ion-primitives-neutral-900}; |
| 8 | + /** |
| 9 | + * @prop --focus-ring-color: Color of the focus ring |
| 10 | + * @prop --focus-ring-width: Width of the focus ring |
| 11 | + */ |
9 | 12 | --focus-ring-color: #{globals.$ion-border-focus-default};
|
10 | 13 | --focus-ring-width: #{globals.$ion-border-size-050};
|
11 | 14 |
|
12 |
| - @include globals.font-smoothing; |
13 | 15 | @include globals.padding(globals.$ion-space-150, globals.$ion-space-200);
|
14 | 16 | @include globals.border-radius(var(--border-radius));
|
15 | 17 |
|
16 |
| - display: inline-flex; |
17 |
| - |
18 |
| - position: relative; |
19 |
| - |
20 |
| - align-items: center; |
21 |
| - justify-content: center; |
22 |
| - |
23 | 18 | gap: globals.$ion-space-100;
|
24 | 19 |
|
25 |
| - background: var(--background); |
26 |
| - color: var(--color); |
27 |
| - |
28 | 20 | font-family: globals.$ion-font-family;
|
29 | 21 | font-weight: globals.$ion-font-weight-medium;
|
30 | 22 |
|
31 | 23 | line-height: globals.$ion-font-line-height-full;
|
32 |
| - |
33 |
| - cursor: pointer; |
34 |
| - |
35 |
| - overflow: hidden; |
36 |
| - |
37 |
| - box-sizing: border-box; |
38 |
| - |
39 |
| - vertical-align: middle; |
40 | 24 | }
|
41 | 25 |
|
42 | 26 | // Outline Chip
|
|
45 | 29 | :host(.chip-outline) {
|
46 | 30 | border-width: globals.$ion-border-size-025;
|
47 | 31 | border-style: globals.$ion-border-style-solid;
|
48 |
| - border-color: globals.$ion-primitives-neutral-100; |
49 |
| - |
50 |
| - background: transparent; |
51 |
| -} |
52 |
| - |
53 |
| -:host(.chip-outline.ion-color) { |
54 |
| - border-color: globals.current-color(base, 0.32); |
55 | 32 | }
|
56 | 33 |
|
57 | 34 | // Chip: Focus
|
|
66 | 43 | // ---------------------------------------------
|
67 | 44 |
|
68 | 45 | @media (any-hover: hover) {
|
69 |
| - :host(:hover) { |
| 46 | + :host(.chip-subtle:hover) { |
70 | 47 | --background: #{globals.$ion-primitives-neutral-200};
|
71 | 48 | }
|
72 | 49 |
|
73 |
| - :host(.ion-color:hover) { |
74 |
| - background: globals.current-color(base, 0.12); |
| 50 | + :host(.chip-bold:hover) { |
| 51 | + --background: #{globals.$ion-primitives-neutral-1100}; |
| 52 | + } |
| 53 | + |
| 54 | + :host(.chip-subtle.ion-color:hover) { |
| 55 | + background: globals.current-color(tint, $subtle: true); |
| 56 | + } |
| 57 | + |
| 58 | + :host(.chip-bold.ion-color:hover) { |
| 59 | + background: globals.current-color(shade); |
75 | 60 | }
|
76 | 61 | }
|
77 | 62 |
|
|
80 | 65 |
|
81 | 66 | :host(.chip-disabled) {
|
82 | 67 | opacity: 0.6;
|
83 |
| - pointer-events: none; |
84 | 68 | }
|
85 | 69 |
|
86 | 70 | // Chip Shapes
|
|
110 | 94 | :host(.chip-small) {
|
111 | 95 | min-height: globals.$ion-scale-600;
|
112 | 96 |
|
113 |
| - font-size: #{globals.$ion-font-size-300}; |
| 97 | + font-size: globals.$ion-font-size-300; |
114 | 98 | }
|
115 | 99 |
|
116 | 100 | :host(.chip-large) {
|
|
119 | 103 | font-size: globals.$ion-font-size-350;
|
120 | 104 | }
|
121 | 105 |
|
| 106 | +// Subtle Chip |
| 107 | +// --------------------------------------------- |
| 108 | + |
| 109 | +:host(.chip-subtle) { |
| 110 | + --background: #{globals.$ion-primitives-neutral-100}; |
| 111 | + --color: #{globals.$ion-primitives-neutral-800}; |
| 112 | +} |
| 113 | + |
| 114 | +:host(.chip-outline.chip-subtle) { |
| 115 | + border-color: globals.$ion-primitives-neutral-300; |
| 116 | +} |
| 117 | + |
| 118 | +// Bold Chip |
| 119 | +// --------------------------------------------- |
| 120 | + |
| 121 | +:host(.chip-bold) { |
| 122 | + --background: #{globals.$ion-bg-neutral-bold-default}; |
| 123 | + --color: #{globals.$ion-primitives-base-white}; |
| 124 | +} |
| 125 | + |
| 126 | +:host(.chip-outline.chip-bold) { |
| 127 | + // TODO(FW-6450): this is a made up design choice based on a |
| 128 | + // darker shade of the background color |
| 129 | + border-color: globals.$ion-primitives-neutral-1200; |
| 130 | +} |
| 131 | + |
122 | 132 | // Chip Colors
|
123 | 133 | // ---------------------------------------------
|
124 | 134 |
|
125 |
| -:host(.ion-color) { |
126 |
| - background: globals.current-color(base, 0.08); |
127 |
| - color: globals.current-color(shade); |
| 135 | +// Subtle |
| 136 | +:host(.chip-subtle.ion-color) { |
| 137 | + background: globals.current-color(base, $subtle: true); |
| 138 | + color: globals.current-color(contrast, $subtle: true); |
| 139 | +} |
| 140 | + |
| 141 | +:host(.chip-subtle.chip-outline.ion-color) { |
| 142 | + border-color: globals.current-color(shade, $subtle: true); |
128 | 143 | }
|
129 | 144 |
|
130 |
| -:host(.ion-color:focus) { |
131 |
| - background: globals.current-color(base, 0.12); |
| 145 | +// Bold |
| 146 | +:host(.chip-bold.ion-color) { |
| 147 | + background: globals.current-color(base); |
| 148 | + color: globals.current-color(contrast); |
132 | 149 | }
|
133 | 150 |
|
134 |
| -:host(.ion-color.ion-activated) { |
135 |
| - background: globals.current-color(base, 0.16); |
| 151 | +:host(.chip-bold.chip-outline.ion-color) { |
| 152 | + border-color: globals.current-color(shade); |
136 | 153 | }
|
0 commit comments