@ukic/web-components 2.35.0 → 2.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/ic-badge.cjs.entry.js +23 -0
- package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-button.cjs.entry.js +2 -2
- package/dist/cjs/ic-navigation-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +2 -2
- package/dist/cjs/ic-toast.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ic-accordion/ic-accordion.stories.js +635 -0
- package/dist/collection/components/ic-alert/ic-alert.stories.js +257 -0
- package/dist/collection/components/ic-back-to-top/ic-back-to-top.stories.js +162 -0
- package/dist/collection/components/ic-badge/ic-badge.js +39 -1
- package/dist/collection/components/ic-badge/ic-badge.js.map +1 -1
- package/dist/collection/components/ic-badge/ic-badge.stories.js +1082 -0
- package/dist/collection/components/ic-badge/test/basic/ic-badge.spec.js +194 -0
- package/dist/collection/components/ic-badge/test/basic/ic-badge.spec.js.map +1 -1
- package/dist/collection/components/ic-breadcrumb-group/ic-breadcrumb-group.stories.js +502 -0
- package/dist/collection/components/ic-button/ic-button.stories.js +2218 -0
- package/dist/collection/components/ic-card/ic-card.stories.js +1034 -0
- package/dist/collection/components/ic-checkbox-group/ic-checkbox-group.stories.js +687 -0
- package/dist/collection/components/ic-chip/ic-chip.stories.js +670 -0
- package/dist/collection/components/ic-classification-banner/ic-classification-banner.stories.js +131 -0
- package/dist/collection/components/ic-data-entity/ic-data-entity.stories.js +487 -0
- package/dist/collection/components/ic-dialog/ic-dialog.stories.js +1256 -0
- package/dist/collection/components/ic-empty-state/ic-empty-state.stories.js +397 -0
- package/dist/collection/components/ic-footer/ic-footer.stories.js +383 -0
- package/dist/collection/components/ic-hero/ic-hero.stories.js +489 -0
- package/dist/collection/components/ic-link/ic-link.stories.js +114 -0
- package/dist/collection/components/ic-loading-indicator/ic-loading-indicator.stories.js +416 -0
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.css +4 -0
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.js +1 -1
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.js.map +1 -1
- package/dist/collection/components/ic-navigation-item/ic-navigation-item.css +7 -35
- package/dist/collection/components/ic-page-header/ic-page-header.stories.js +557 -0
- package/dist/collection/components/ic-pagination/ic-pagination.stories.js +125 -0
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.stories.js +486 -0
- package/dist/collection/components/ic-radio-group/ic-radio-group.stories.js +450 -0
- package/dist/collection/components/ic-search-bar/ic-search-bar.stories.js +591 -0
- package/dist/collection/components/ic-section-container/ic-section-container.stories.js +62 -0
- package/dist/collection/components/ic-select/ic-select-searchable.stories.js +953 -0
- package/dist/collection/components/ic-select/ic-select-single.stories.js +780 -0
- package/dist/collection/components/ic-side-navigation/ic-side-navigation.stories.js +2526 -0
- package/dist/collection/components/ic-skeleton/ic-skeleton.stories.js +141 -0
- package/dist/collection/components/ic-status-tag/ic-status-tag.stories.js +161 -0
- package/dist/collection/components/ic-stepper/ic-stepper.stories.js +327 -0
- package/dist/collection/components/ic-switch/ic-switch.stories.js +171 -0
- package/dist/collection/components/ic-tab-context/ic-tabs.stories.js +388 -0
- package/dist/collection/components/ic-text-field/ic-text-field.stories.js +1083 -0
- package/dist/collection/components/ic-theme/ic-theme.stories.js +171 -0
- package/dist/collection/components/ic-toast/ic-toast.js +2 -2
- package/dist/collection/components/ic-toast/ic-toast.js.map +1 -1
- package/dist/collection/components/ic-toast/ic-toast.stories.js +413 -0
- package/dist/collection/components/ic-toast/test/basic/ic-toast.spec.js +3 -3
- package/dist/collection/components/ic-toast/test/basic/ic-toast.spec.js.map +1 -1
- package/dist/collection/components/ic-toggle-button/ic-toggle-button.stories.js +537 -0
- package/dist/collection/components/ic-toggle-button-group/ic-toggle-button-group.stories.js +610 -0
- package/dist/collection/components/ic-tooltip/ic-tooltip.js +2 -5
- package/dist/collection/components/ic-tooltip/ic-tooltip.js.map +1 -1
- package/dist/collection/components/ic-tooltip/ic-tooltip.stories.js +356 -0
- package/dist/collection/components/ic-top-navigation/ic-top-navigation.stories.js +1083 -0
- package/dist/collection/components/ic-typography/ic-typography.stories.js +437 -0
- package/dist/collection/patterns/top-nav-content-footer.stories.js +109 -0
- package/dist/collection/patterns/z-index.stories.js +474 -0
- package/dist/components/ic-badge.js +25 -2
- package/dist/components/ic-badge.js.map +1 -1
- package/dist/components/ic-navigation-button.js +2 -2
- package/dist/components/ic-navigation-button.js.map +1 -1
- package/dist/components/ic-navigation-item.js +1 -1
- package/dist/components/ic-navigation-item.js.map +1 -1
- package/dist/components/ic-toast.js +2 -2
- package/dist/components/ic-toast.js.map +1 -1
- package/dist/components/ic-tooltip2.js.map +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/p-3e8023ff.entry.js +2 -0
- package/dist/core/p-3e8023ff.entry.js.map +1 -0
- package/dist/core/p-ba06cc95.entry.js.map +1 -1
- package/dist/core/{p-7e8a4abd.entry.js → p-bfaa257c.entry.js} +2 -2
- package/dist/core/{p-7e8a4abd.entry.js.map → p-bfaa257c.entry.js.map} +1 -1
- package/dist/core/p-c05474f3.entry.js +2 -0
- package/dist/core/p-c05474f3.entry.js.map +1 -0
- package/dist/core/{p-5d3c6ea1.entry.js → p-d0299926.entry.js} +2 -2
- package/dist/core/p-d0299926.entry.js.map +1 -0
- package/dist/esm/core.js +1 -1
- package/dist/esm/ic-badge.entry.js +23 -0
- package/dist/esm/ic-badge.entry.js.map +1 -1
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-navigation-button.entry.js +2 -2
- package/dist/esm/ic-navigation-button.entry.js.map +1 -1
- package/dist/esm/ic-navigation-item.entry.js +1 -1
- package/dist/esm/ic-navigation-item.entry.js.map +1 -1
- package/dist/esm/ic-toast.entry.js +2 -2
- package/dist/esm/ic-toast.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-badge/ic-badge.d.ts +5 -0
- package/dist/types/components/ic-tooltip/ic-tooltip.d.ts +1 -1
- package/dist/types/components.d.ts +7 -0
- package/hydrate/index.js +30 -7
- package/package.json +17 -12
- package/vscode-data.json +4 -0
- package/dist/core/p-405d89bb.entry.js +0 -2
- package/dist/core/p-405d89bb.entry.js.map +0 -1
- package/dist/core/p-5d3c6ea1.entry.js.map +0 -1
- package/dist/core/p-dfb3e76e.entry.js +0 -2
- package/dist/core/p-dfb3e76e.entry.js.map +0 -1
@@ -0,0 +1,474 @@
|
|
1
|
+
import { html } from "lit-html";
|
2
|
+
|
3
|
+
export default {
|
4
|
+
title: "Patterns/Component z-index",
|
5
|
+
};
|
6
|
+
|
7
|
+
export const ComponentZIndex = {
|
8
|
+
render: () => html`
|
9
|
+
<style>
|
10
|
+
ic-toast {
|
11
|
+
--bottom-position: 50px;
|
12
|
+
}
|
13
|
+
</style>
|
14
|
+
<div style="display:flex;">
|
15
|
+
<ic-side-navigation
|
16
|
+
app-title="Application Name"
|
17
|
+
version="v0.0.7"
|
18
|
+
status="BETA"
|
19
|
+
>
|
20
|
+
<svg
|
21
|
+
slot="app-icon"
|
22
|
+
xmlns="http://www.w3.org/2000/svg"
|
23
|
+
height="24px"
|
24
|
+
viewBox="0 0 24 24"
|
25
|
+
width="24px"
|
26
|
+
fill="#000000"
|
27
|
+
>
|
28
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
29
|
+
<path
|
30
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z"
|
31
|
+
/>
|
32
|
+
</svg>
|
33
|
+
<ic-navigation-item slot="primary-navigation" href="/" label="Home">
|
34
|
+
<svg
|
35
|
+
slot="icon"
|
36
|
+
width="24"
|
37
|
+
height="24"
|
38
|
+
viewBox="0 0 24 24"
|
39
|
+
fill="none"
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
41
|
+
>
|
42
|
+
<path
|
43
|
+
d="M12 6.19L17 10.69V18.5H15V12.5H9V18.5H7V10.69L12 6.19ZM12 3.5L2 12.5H5V20.5H11V14.5H13V20.5H19V12.5H22L12 3.5Z"
|
44
|
+
fill="currentColor"
|
45
|
+
/>
|
46
|
+
</svg>
|
47
|
+
</ic-navigation-item>
|
48
|
+
<ic-navigation-item
|
49
|
+
slot="primary-navigation"
|
50
|
+
href="/"
|
51
|
+
label="Search"
|
52
|
+
selected="true"
|
53
|
+
>
|
54
|
+
<svg
|
55
|
+
slot="icon"
|
56
|
+
width="24"
|
57
|
+
height="24"
|
58
|
+
viewBox="0 0 24 24"
|
59
|
+
fill="none"
|
60
|
+
xmlns="http://www.w3.org/2000/svg"
|
61
|
+
>
|
62
|
+
<path
|
63
|
+
d="M12 6.19L17 10.69V18.5H15V12.5H9V18.5H7V10.69L12 6.19ZM12 3.5L2 12.5H5V20.5H11V14.5H13V20.5H19V12.5H22L12 3.5Z"
|
64
|
+
fill="currentColor"
|
65
|
+
/>
|
66
|
+
</svg>
|
67
|
+
</ic-navigation-item>
|
68
|
+
<ic-divider slot="primary-navigation"></ic-divider>
|
69
|
+
<ic-navigation-item slot="primary-navigation" href="/" label="Trends">
|
70
|
+
<svg
|
71
|
+
slot="icon"
|
72
|
+
width="24"
|
73
|
+
height="24"
|
74
|
+
viewBox="0 0 24 24"
|
75
|
+
fill="none"
|
76
|
+
xmlns="http://www.w3.org/2000/svg"
|
77
|
+
>
|
78
|
+
<path
|
79
|
+
d="M12 6.19L17 10.69V18.5H15V12.5H9V18.5H7V10.69L12 6.19ZM12 3.5L2 12.5H5V20.5H11V14.5H13V20.5H19V12.5H22L12 3.5Z"
|
80
|
+
fill="currentColor"
|
81
|
+
/>
|
82
|
+
</svg>
|
83
|
+
</ic-navigation-item>
|
84
|
+
<ic-navigation-group
|
85
|
+
slot="primary-navigation"
|
86
|
+
label="Second navigation group"
|
87
|
+
expandable="true"
|
88
|
+
>
|
89
|
+
<ic-navigation-item label="Different navigation" href="/">
|
90
|
+
<svg
|
91
|
+
slot="icon"
|
92
|
+
width="24"
|
93
|
+
height="24"
|
94
|
+
viewBox="0 0 24 24"
|
95
|
+
fill="none"
|
96
|
+
xmlns="http://www.w3.org/2000/svg"
|
97
|
+
>
|
98
|
+
<path
|
99
|
+
d="M23 8C23 9.1 22.1 10 21 10C20.82 10 20.65 9.98 20.49 9.93L16.93 13.48C16.98 13.64 17 13.82 17 14C17 15.1 16.1 16 15 16C13.9 16 13 15.1 13 14C13 13.82 13.02 13.64 13.07 13.48L10.52 10.93C10.36 10.98 10.18 11 10 11C9.82 11 9.64 10.98 9.48 10.93L4.93 15.49C4.98 15.65 5 15.82 5 16C5 17.1 4.1 18 3 18C1.9 18 1 17.1 1 16C1 14.9 1.9 14 3 14C3.18 14 3.35 14.02 3.51 14.07L8.07 9.52C8.02 9.36 8 9.18 8 9C8 7.9 8.9 7 10 7C11.1 7 12 7.9 12 9C12 9.18 11.98 9.36 11.93 9.52L14.48 12.07C14.64 12.02 14.82 12 15 12C15.18 12 15.36 12.02 15.52 12.07L19.07 8.51C19.02 8.35 19 8.18 19 8C19 6.9 19.9 6 21 6C22.1 6 23 6.9 23 8Z"
|
100
|
+
fill="currentColor"
|
101
|
+
/>
|
102
|
+
</svg>
|
103
|
+
</ic-navigation-item>
|
104
|
+
<ic-navigation-item label="Navigation" href="/">
|
105
|
+
<svg
|
106
|
+
slot="icon"
|
107
|
+
width="24"
|
108
|
+
height="24"
|
109
|
+
viewBox="0 0 24 24"
|
110
|
+
fill="none"
|
111
|
+
xmlns="http://www.w3.org/2000/svg"
|
112
|
+
>
|
113
|
+
<path
|
114
|
+
d="M23 8C23 9.1 22.1 10 21 10C20.82 10 20.65 9.98 20.49 9.93L16.93 13.48C16.98 13.64 17 13.82 17 14C17 15.1 16.1 16 15 16C13.9 16 13 15.1 13 14C13 13.82 13.02 13.64 13.07 13.48L10.52 10.93C10.36 10.98 10.18 11 10 11C9.82 11 9.64 10.98 9.48 10.93L4.93 15.49C4.98 15.65 5 15.82 5 16C5 17.1 4.1 18 3 18C1.9 18 1 17.1 1 16C1 14.9 1.9 14 3 14C3.18 14 3.35 14.02 3.51 14.07L8.07 9.52C8.02 9.36 8 9.18 8 9C8 7.9 8.9 7 10 7C11.1 7 12 7.9 12 9C12 9.18 11.98 9.36 11.93 9.52L14.48 12.07C14.64 12.02 14.82 12 15 12C15.18 12 15.36 12.02 15.52 12.07L19.07 8.51C19.02 8.35 19 8.18 19 8C19 6.9 19.9 6 21 6C22.1 6 23 6.9 23 8Z"
|
115
|
+
fill="currentColor"
|
116
|
+
/>
|
117
|
+
</svg>
|
118
|
+
</ic-navigation-item>
|
119
|
+
</ic-navigation-group>
|
120
|
+
<ic-navigation-item
|
121
|
+
slot="primary-navigation"
|
122
|
+
href="/"
|
123
|
+
label="This is a very very very long label for the navigation item"
|
124
|
+
>
|
125
|
+
<svg
|
126
|
+
slot="icon"
|
127
|
+
width="24"
|
128
|
+
height="24"
|
129
|
+
viewBox="0 0 24 24"
|
130
|
+
fill="none"
|
131
|
+
xmlns="http://www.w3.org/2000/svg"
|
132
|
+
>
|
133
|
+
<path
|
134
|
+
d="M12 6.19L17 10.69V18.5H15V12.5H9V18.5H7V10.69L12 6.19ZM12 3.5L2 12.5H5V20.5H11V14.5H13V20.5H19V12.5H22L12 3.5Z"
|
135
|
+
fill="currentColor"
|
136
|
+
/>
|
137
|
+
</svg>
|
138
|
+
</ic-navigation-item>
|
139
|
+
<ic-navigation-item
|
140
|
+
slot="secondary-navigation"
|
141
|
+
href="/"
|
142
|
+
label="Settings"
|
143
|
+
>
|
144
|
+
<svg
|
145
|
+
slot="icon"
|
146
|
+
width="24"
|
147
|
+
height="24"
|
148
|
+
viewBox="0 0 24 24"
|
149
|
+
fill="none"
|
150
|
+
xmlns="http://www.w3.org/2000/svg"
|
151
|
+
>
|
152
|
+
<path
|
153
|
+
d="M12 6.19L17 10.69V18.5H15V12.5H9V18.5H7V10.69L12 6.19ZM12 3.5L2 12.5H5V20.5H11V14.5H13V20.5H19V12.5H22L12 3.5Z"
|
154
|
+
fill="currentColor"
|
155
|
+
/>
|
156
|
+
</svg>
|
157
|
+
</ic-navigation-item>
|
158
|
+
</ic-side-navigation>
|
159
|
+
<div
|
160
|
+
class="content-wrapper"
|
161
|
+
style="display:flex; flex-direction: column; flex-grow: 1;"
|
162
|
+
>
|
163
|
+
<main>
|
164
|
+
<ic-top-navigation
|
165
|
+
app-title="Application Name"
|
166
|
+
status="beta"
|
167
|
+
version="v0.0.7"
|
168
|
+
>
|
169
|
+
<svg
|
170
|
+
slot="app-icon"
|
171
|
+
xmlns="http://www.w3.org/2000/svg"
|
172
|
+
height="24px"
|
173
|
+
viewBox="0 0 24 24"
|
174
|
+
width="24px"
|
175
|
+
fill="#000000"
|
176
|
+
>
|
177
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
178
|
+
<path
|
179
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z"
|
180
|
+
/>
|
181
|
+
</svg>
|
182
|
+
<ic-search-bar
|
183
|
+
slot="search"
|
184
|
+
placeholder="Search"
|
185
|
+
label="Search"
|
186
|
+
id="top-nav-search-bar"
|
187
|
+
></ic-search-bar>
|
188
|
+
<ic-navigation-button
|
189
|
+
label="button1"
|
190
|
+
slot="buttons"
|
191
|
+
onclick="alert('test')"
|
192
|
+
>
|
193
|
+
<svg
|
194
|
+
slot="icon"
|
195
|
+
xmlns="http://www.w3.org/2000/svg"
|
196
|
+
height="24px"
|
197
|
+
viewBox="0 0 24 24"
|
198
|
+
width="24px"
|
199
|
+
fill="#000000"
|
200
|
+
>
|
201
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
202
|
+
<path
|
203
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5.5-2.5l7.51-3.49L17.5 6.5 9.99 9.99 6.5 17.5zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1z"
|
204
|
+
/>
|
205
|
+
</svg>
|
206
|
+
</ic-navigation-button>
|
207
|
+
<ic-navigation-group
|
208
|
+
slot="navigation"
|
209
|
+
label="Navigation group"
|
210
|
+
expandable="true"
|
211
|
+
>
|
212
|
+
<ic-navigation-item
|
213
|
+
label="Navigation"
|
214
|
+
href="/"
|
215
|
+
></ic-navigation-item>
|
216
|
+
<ic-navigation-item
|
217
|
+
label="Navigation"
|
218
|
+
href="/"
|
219
|
+
></ic-navigation-item>
|
220
|
+
<ic-navigation-item
|
221
|
+
label="Navigation"
|
222
|
+
href="/"
|
223
|
+
></ic-navigation-item>
|
224
|
+
<ic-navigation-item
|
225
|
+
label="Navigation"
|
226
|
+
href="/"
|
227
|
+
></ic-navigation-item>
|
228
|
+
<ic-navigation-item
|
229
|
+
label="Navigation"
|
230
|
+
href="/"
|
231
|
+
selected="true"
|
232
|
+
></ic-navigation-item>
|
233
|
+
<ic-navigation-item
|
234
|
+
label="Navigation"
|
235
|
+
href="/"
|
236
|
+
></ic-navigation-item>
|
237
|
+
<ic-navigation-item
|
238
|
+
label="Navigation"
|
239
|
+
href="/"
|
240
|
+
></ic-navigation-item>
|
241
|
+
<ic-navigation-item
|
242
|
+
label="Navigation"
|
243
|
+
href="/"
|
244
|
+
></ic-navigation-item>
|
245
|
+
<ic-navigation-item
|
246
|
+
label="Navigation"
|
247
|
+
href="/"
|
248
|
+
></ic-navigation-item>
|
249
|
+
<ic-navigation-item
|
250
|
+
label="Navigation"
|
251
|
+
href="/"
|
252
|
+
></ic-navigation-item>
|
253
|
+
</ic-navigation-group>
|
254
|
+
<ic-navigation-group
|
255
|
+
slot="navigation"
|
256
|
+
label="Second navigation group"
|
257
|
+
expandable="true"
|
258
|
+
>
|
259
|
+
<ic-navigation-item
|
260
|
+
label="Different navigation"
|
261
|
+
href="/"
|
262
|
+
></ic-navigation-item>
|
263
|
+
<ic-navigation-item
|
264
|
+
label="Navigation"
|
265
|
+
href="/"
|
266
|
+
></ic-navigation-item>
|
267
|
+
<ic-navigation-item
|
268
|
+
label="Navigation"
|
269
|
+
href="/"
|
270
|
+
></ic-navigation-item>
|
271
|
+
<ic-navigation-item
|
272
|
+
label="Navigation"
|
273
|
+
href="/"
|
274
|
+
></ic-navigation-item>
|
275
|
+
<ic-navigation-item
|
276
|
+
label="Navigation"
|
277
|
+
href="/"
|
278
|
+
></ic-navigation-item>
|
279
|
+
<ic-navigation-item
|
280
|
+
label="Navigation"
|
281
|
+
href="/"
|
282
|
+
></ic-navigation-item>
|
283
|
+
<ic-navigation-item
|
284
|
+
label="Navigation"
|
285
|
+
href="/"
|
286
|
+
></ic-navigation-item>
|
287
|
+
<ic-navigation-item
|
288
|
+
label="Navigation"
|
289
|
+
href="/"
|
290
|
+
></ic-navigation-item>
|
291
|
+
<ic-navigation-item
|
292
|
+
label="Navigation"
|
293
|
+
href="/"
|
294
|
+
></ic-navigation-item>
|
295
|
+
<ic-navigation-item
|
296
|
+
label="Navigation"
|
297
|
+
href="/"
|
298
|
+
></ic-navigation-item>
|
299
|
+
</ic-navigation-group>
|
300
|
+
</ic-top-navigation>
|
301
|
+
<span id="main"></span>
|
302
|
+
<ic-page-header
|
303
|
+
heading="Page header"
|
304
|
+
subheading="This is a page header component with additional functionality and this is the text."
|
305
|
+
aligned="full-width"
|
306
|
+
sticky
|
307
|
+
>
|
308
|
+
<ic-status-tag
|
309
|
+
slot="heading-adornment"
|
310
|
+
label="Beta"
|
311
|
+
></ic-status-tag>
|
312
|
+
<ic-search-bar
|
313
|
+
id="page-header-search-bar"
|
314
|
+
characters-until-suggestion="1"
|
315
|
+
slot="input"
|
316
|
+
label="What is your favourite coffee?"
|
317
|
+
></ic-search-bar>
|
318
|
+
</ic-page-header>
|
319
|
+
<ic-section-container id="top-target">
|
320
|
+
<ic-typography
|
321
|
+
>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed
|
322
|
+
vestibulum venenatis facilisis. Nam tortor felis, auctor vel ante
|
323
|
+
quis, tempor interdum libero. In dictum sodales velit, eu egestas
|
324
|
+
arcu dignissim ac. Aliquam facilisis eros dolor, id laoreet orci
|
325
|
+
sagittis ut. Sed tempus, lacus in pretium molestie, lectus magna
|
326
|
+
interdum risus, vel fringilla libero ex eu dui. Suspendisse
|
327
|
+
ullamcorper vehicula lacinia. Phasellus congue velit nisl, vitae
|
328
|
+
congue ligula rutrum id.</ic-typography
|
329
|
+
>
|
330
|
+
<ic-button onclick="showToast()">Display toast</ic-button>
|
331
|
+
<ic-typography
|
332
|
+
>Etiam in suscipit metus. Duis semper, sapien a molestie semper,
|
333
|
+
ex nibh porttitor tellus, vel molestie justo odio vel purus.
|
334
|
+
Curabitur porttitor, tortor sed semper sollicitudin, odio odio
|
335
|
+
congue tortor, eget pulvinar tellus nisl ac lacus. In ultricies
|
336
|
+
commodo lorem, a laoreet diam. Ut a mauris at tellus tincidunt
|
337
|
+
ullamcorper sit amet in metus. Aenean facilisis placerat dictum.
|
338
|
+
Phasellus mattis ante sollicitudin luctus iaculis. Nam porttitor
|
339
|
+
lobortis rhoncus. Nam nec malesuada purus, at pulvinar mauris. Nam
|
340
|
+
non lorem ante.</ic-typography
|
341
|
+
>
|
342
|
+
<ic-typography
|
343
|
+
>Donec aliquam eget mauris condimentum cursus. Nullam tempus a
|
344
|
+
urna in commodo. Proin mauris augue, viverra id finibus id,
|
345
|
+
vulputate in ante. Aliquam volutpat hendrerit tellus vitae
|
346
|
+
tristique. Donec pellentesque enim arcu, at feugiat mauris
|
347
|
+
venenatis vitae. Sed iaculis ut elit et ultrices. Donec diam eros,
|
348
|
+
iaculis ac est nec, tempus feugiat nisl. Suspendisse eget interdum
|
349
|
+
lorem. Phasellus pretium urna id elit pharetra
|
350
|
+
hendrerit.</ic-typography
|
351
|
+
>
|
352
|
+
<ic-typography
|
353
|
+
>Mauris blandit, mi ut posuere dapibus, est ante porttitor sem,
|
354
|
+
quis pretium velit ante nec felis. Vivamus efficitur scelerisque
|
355
|
+
dapibus. Nunc lacinia finibus laoreet. Praesent commodo augue
|
356
|
+
orci, congue rutrum velit malesuada gravida. Nunc magna mauris,
|
357
|
+
ornare nec nisl vel, faucibus euismod orci. Proin in augue vitae
|
358
|
+
nunc gravida consectetur. Pellentesque id malesuada ex, sit amet
|
359
|
+
imperdiet est. Duis erat nibh, lacinia vitae faucibus non, aliquam
|
360
|
+
in dolor. Nam interdum felis vitae feugiat posuere. Cras volutpat
|
361
|
+
molestie ipsum, sed auctor quam volutpat vitae. Vivamus lobortis
|
362
|
+
scelerisque libero vel scelerisque.</ic-typography
|
363
|
+
>
|
364
|
+
<ic-typography
|
365
|
+
>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent
|
366
|
+
eget orci condimentum, tempus tortor posuere, lacinia ex.
|
367
|
+
Curabitur bibendum suscipit turpis vitae mollis. Ut laoreet orci a
|
368
|
+
risus facilisis porta. Orci varius natoque penatibus et magnis dis
|
369
|
+
parturient montes, nascetur ridiculus mus. Curabitur a porttitor
|
370
|
+
neque, ac dignissim velit. Morbi quis malesuada massa, vitae
|
371
|
+
sodales tellus. Aenean laoreet mattis lobortis. In mauris erat,
|
372
|
+
tincidunt in placerat sed, pretium ac tortor. Morbi blandit lacus
|
373
|
+
a leo vehicula aliquet.</ic-typography
|
374
|
+
>
|
375
|
+
<ic-typography
|
376
|
+
>Pellentesque aliquam risus vel eros maximus, at pellentesque mi
|
377
|
+
pretium. Etiam nec velit at orci varius porttitor. Aliquam
|
378
|
+
facilisis, elit non cursus fringilla, metus metus malesuada lacus,
|
379
|
+
at blandit nibh augue aliquet orci. Duis aliquam, est eget sodales
|
380
|
+
ullamcorper, eros turpis euismod nulla, sed sollicitudin diam
|
381
|
+
massa semper purus. Vivamus vel turpis ipsum. Interdum et
|
382
|
+
malesuada fames ac ante ipsum primis in faucibus. Morbi euismod
|
383
|
+
turpis dapibus quam fermentum condimentum. Mauris ex orci,
|
384
|
+
consequat quis tempor eu, finibus vitae eros. Ut eu erat eu ipsum
|
385
|
+
pulvinar cursus vel at dui. Etiam tincidunt quam porta nulla
|
386
|
+
suscipit vestibulum. Sed iaculis enim leo, et aliquam justo
|
387
|
+
feugiat in. Vivamus in ornare nulla, at tempor massa. Sed et
|
388
|
+
aliquam nisi.</ic-typography
|
389
|
+
>
|
390
|
+
<ic-typography
|
391
|
+
>Mauris tempus accumsan libero non tincidunt. Curabitur et leo
|
392
|
+
orci. Suspendisse molestie posuere leo vitae posuere. Cras lacinia
|
393
|
+
urna non erat gravida sagittis. Quisque dapibus arcu nec sem
|
394
|
+
pharetra convallis. Nullam sed arcu mollis, posuere elit at,
|
395
|
+
condimentum ligula. Nullam maximus nulla quam, ut euismod est
|
396
|
+
feugiat at. Quisque ut venenatis ex, in facilisis sapien.
|
397
|
+
Pellentesque in orci vitae metus iaculis venenatis. Nunc porttitor
|
398
|
+
tellus arcu, in posuere quam vulputate nec. Aenean in venenatis
|
399
|
+
ligula, non mollis quam. Suspendisse nec enim vel massa finibus
|
400
|
+
pretium et a urna. Etiam suscipit semper est, id efficitur diam
|
401
|
+
sollicitudin nec. Nullam nibh sapien, condimentum ut laoreet et,
|
402
|
+
euismod ac mi. Vestibulum tristique odio non risus ullamcorper, et
|
403
|
+
aliquam turpis varius. Nunc metus ex, tempus a augue sit amet,
|
404
|
+
interdum vulputate libero.</ic-typography
|
405
|
+
>
|
406
|
+
<ic-typography
|
407
|
+
>Aenean convallis libero id magna congue pellentesque. Nulla
|
408
|
+
iaculis interdum porta. Aenean laoreet scelerisque nulla vel
|
409
|
+
molestie. Class aptent taciti sociosqu ad litora torquent per
|
410
|
+
conubia nostra, per inceptos himenaeos. Integer sollicitudin in
|
411
|
+
felis vitae rhoncus. Sed eu elementum massa. Cras ut accumsan
|
412
|
+
risus. Donec nec augue justo. Aenean sagittis luctus leo egestas
|
413
|
+
consectetur. Sed sit amet nisl quis felis volutpat facilisis ac
|
414
|
+
vitae tellus. Curabitur pharetra commodo consequat. Aliquam
|
415
|
+
consequat ipsum lacus, sed faucibus sapien mollis
|
416
|
+
vel.</ic-typography
|
417
|
+
>
|
418
|
+
<ic-toast-region>
|
419
|
+
<ic-toast id="toast1" heading="Your coffee is ready"></ic-toast>
|
420
|
+
</ic-toast-region>
|
421
|
+
</ic-section-container>
|
422
|
+
</main>
|
423
|
+
<ic-back-to-top target="main"></ic-back-to-top>
|
424
|
+
<ic-footer
|
425
|
+
description="The ICDS is maintained by the Design Practice Team. If you've got a question or want to feedback,
|
426
|
+
please get in touch."
|
427
|
+
caption="All content is available under the Open Government Licence v3.0, except source code and code examples which are available under the MIT Licence."
|
428
|
+
>
|
429
|
+
<ic-footer-link slot="link" href="/">Get Started</ic-footer-link>
|
430
|
+
<ic-footer-link slot="link" href="/">Accessibility</ic-footer-link>
|
431
|
+
<ic-footer-link slot="link" href="/">Styles</ic-footer-link>
|
432
|
+
<ic-footer-link slot="link" href="/">Components</ic-footer-link>
|
433
|
+
<ic-footer-link slot="link" href="/">Patterns</ic-footer-link>
|
434
|
+
<ic-footer-link slot="link" href="/">Design toolkit</ic-footer-link>
|
435
|
+
<div
|
436
|
+
slot="logo"
|
437
|
+
style="width:100px;height:100px;display:flex;align-items:center;justify-content:center;
|
438
|
+
background-color:var(--ic-theme-primary);color:var(--ic-theme-text);"
|
439
|
+
>
|
440
|
+
Logo
|
441
|
+
</div>
|
442
|
+
</ic-footer>
|
443
|
+
</div>
|
444
|
+
</div>
|
445
|
+
<ic-classification-banner
|
446
|
+
classification="official"
|
447
|
+
></ic-classification-banner>
|
448
|
+
<script>
|
449
|
+
const options = [
|
450
|
+
{ label: "Espresso", value: "espresso" },
|
451
|
+
{ label: "Double Espresso", value: "doubleespresso" },
|
452
|
+
{ label: "Flat White", value: "flatwhite" },
|
453
|
+
{ label: "Cappuccino", value: "cappuccino" },
|
454
|
+
{ label: "Americano", value: "americano" },
|
455
|
+
{ label: "Ameno", value: "ameno" },
|
456
|
+
{ label: "Aicano", value: "acano" },
|
457
|
+
{ label: "Mocha", value: "mocha" },
|
458
|
+
];
|
459
|
+
document.querySelector("#page-header-search-bar").options = options;
|
460
|
+
document.querySelector("#top-nav-search-bar").options = options;
|
461
|
+
var toastRegion = document.querySelector("ic-toast-region");
|
462
|
+
function showToast() {
|
463
|
+
var x = document.getElementById("toast1");
|
464
|
+
toastRegion.setVisible(x);
|
465
|
+
}
|
466
|
+
</script>
|
467
|
+
`,
|
468
|
+
|
469
|
+
name: "Component z-index",
|
470
|
+
|
471
|
+
parameters: {
|
472
|
+
layout: "fullscreen",
|
473
|
+
},
|
474
|
+
};
|
@@ -4,6 +4,8 @@ import { d as defineCustomElement$2 } from './ic-typography2.js';
|
|
4
4
|
|
5
5
|
const icBadgeCss = "@media (prefers-reduced-motion: no-preference){:host(.show){animation:expand var(--ic-transition-duration-slow)}:host(.hide){animation:shrink var(--ic-transition-duration-slow)}}:host{display:flex;height:var(--ic-space-md);min-width:var(--ic-space-md);width:-moz-fit-content;width:fit-content;border-radius:calc(2 * var(--ic-space-xxl));position:absolute}:host(.neutral){background-color:var(--ic-architectural-500)}:host(.light){background-color:var(--ic-architectural-40)}:host(.info){background-color:var(--ic-status-info)}:host(.warning){background-color:var(--ic-status-warning-mid)}:host(.error){background-color:var(--ic-status-error)}:host(.success){background-color:var(--ic-status-success)}:host(.small){height:var(--ic-space-sm);min-width:var(--ic-space-sm)}:host(.large){height:calc(var(--ic-space-md) + var(--ic-space-xxs));min-width:calc(var(--ic-space-md) + var(--ic-space-xxs))}:host(.dot.default){height:var(--ic-space-xs);width:var(--ic-space-xs);min-width:var(--ic-space-xs)}:host(.dot.small){height:calc(var(--ic-space-xxs) + var(--ic-space-xxxs));width:calc(var(--ic-space-xxs) + var(--ic-space-xxxs));min-width:calc(var(--ic-space-xxs) + var(--ic-space-xxxs))}:host(.dot.large){height:var(--ic-space-sm);width:var(--ic-space-sm);min-width:var(--ic-space-sm)}:host(.foreground-dark) ::slotted(*){fill:var(--ic-color-primary-text)}:host(.foreground-light) ::slotted(*){fill:white}:host(.foreground-dark) ic-typography{color:var(--ic-color-primary-text)}:host(.foreground-light) ic-typography{color:white}:host(.text) ic-typography{align-self:center;padding:0 calc((var(--ic-space-xs) + var(--ic-space-1px)) / 2)\n var(--ic-space-1px)}:host(.text.small) ic-typography{padding:0 0.2132rem}:host(.text.large) ic-typography{padding:0 calc((var(--ic-space-sm) + var(--ic-space-1px)) / 2)\n var(--ic-space-1px)}:host(.icon) ::slotted(svg){width:var(--ic-space-sm);height:var(--ic-space-sm);padding:var(--ic-space-xxxs)}:host(.icon.small) ::slotted(svg){width:var(--ic-space-xs);height:var(--ic-space-xs)}:host(.icon.large) ::slotted(svg){width:calc(var(--ic-space-sm) + var(--ic-space-xxxs));height:calc(var(--ic-space-sm) + var(--ic-space-xxxs));padding:calc(var(--ic-space-xxxs) + var(--ic-space-1px))}:host(.far){top:calc(-1 * var(--ic-space-xs));right:calc(-1 * var(--ic-space-xs))}:host(.far.small),:host(.dot.far.large){top:calc(-1 * var(--ic-space-xxs));right:calc(-1 * var(--ic-space-xxs))}:host(.dot.far),:host(.dot.far.small){top:calc(-1 * var(--ic-space-xxxs));right:calc(-1 * var(--ic-space-xxxs))}:host(.near){top:calc(-1 * calc(var(--ic-space-xxs) + var(--ic-space-1px)));right:calc(-1 * calc(var(--ic-space-xxs) + var(--ic-space-1px)))}:host(.dot.near){top:calc(-1 * var(--ic-space-1px));right:calc(-1 * var(--ic-space-1px))}:host(.inline){position:static}:host(.hide){visibility:hidden !important;transition:visibility var(--ic-transition-duration-slow)}.sr-only{position:absolute;left:-9999px}@keyframes expand{from{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}@keyframes shrink{from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(0)}}";
|
6
6
|
|
7
|
+
const NAVIGATION_BUTTON = "IC-NAVIGATION-BUTTON";
|
8
|
+
const TOP_NAVIGATION = "IC-TOP-NAVIGATION";
|
7
9
|
const Badge = /*@__PURE__*/ proxyCustomElement(class Badge extends HTMLElement {
|
8
10
|
constructor() {
|
9
11
|
super();
|
@@ -63,6 +65,18 @@ const Badge = /*@__PURE__*/ proxyCustomElement(class Badge extends HTMLElement {
|
|
63
65
|
}
|
64
66
|
}
|
65
67
|
};
|
68
|
+
this.setPositionInTopNavigation = () => {
|
69
|
+
const parentTopNavEl = this.el.parentElement.parentElement;
|
70
|
+
parentTopNavEl.classList.contains("mobile-mode")
|
71
|
+
? (this.position = "inline")
|
72
|
+
: (this.position = "near");
|
73
|
+
};
|
74
|
+
this.isInTopNav = () => {
|
75
|
+
const parentEl = this.el.parentElement;
|
76
|
+
const grandparentEl = parentEl.parentElement;
|
77
|
+
return (parentEl.tagName === NAVIGATION_BUTTON &&
|
78
|
+
grandparentEl.tagName === TOP_NAVIGATION);
|
79
|
+
};
|
66
80
|
this.isAccessibleLabelDefined = () => isPropDefined(this.accessibleLabel) && this.accessibleLabel !== null;
|
67
81
|
this.accessibleLabel = undefined;
|
68
82
|
this.customColor = null;
|
@@ -99,6 +113,15 @@ const Badge = /*@__PURE__*/ proxyCustomElement(class Badge extends HTMLElement {
|
|
99
113
|
this.type === "text" &&
|
100
114
|
onComponentRequiredPropUndefined([{ prop: this.textLabel, propName: "text-label" }], "Badge");
|
101
115
|
}
|
116
|
+
componentWillRender() {
|
117
|
+
this.isInTopNav() && this.setPositionInTopNavigation();
|
118
|
+
}
|
119
|
+
navBarMenuOpenHandler() {
|
120
|
+
this.isInTopNav() && (this.position = "inline");
|
121
|
+
}
|
122
|
+
navBarMenuCloseHandler() {
|
123
|
+
this.isInTopNav() && (this.position = "near");
|
124
|
+
}
|
102
125
|
/**
|
103
126
|
* @deprecated This method should not be used anymore. Use visible prop to set badge visibility.
|
104
127
|
*/
|
@@ -135,7 +158,7 @@ const Badge = /*@__PURE__*/ proxyCustomElement(class Badge extends HTMLElement {
|
|
135
158
|
"accessibleLabel": [1, "accessible-label"],
|
136
159
|
"customColor": [1, "custom-color"],
|
137
160
|
"maxNumber": [2, "max-number"],
|
138
|
-
"position": [
|
161
|
+
"position": [1025],
|
139
162
|
"size": [1],
|
140
163
|
"textLabel": [1, "text-label"],
|
141
164
|
"type": [1],
|
@@ -143,7 +166,7 @@ const Badge = /*@__PURE__*/ proxyCustomElement(class Badge extends HTMLElement {
|
|
143
166
|
"visible": [1028],
|
144
167
|
"showBadge": [64],
|
145
168
|
"hideBadge": [64]
|
146
|
-
},
|
169
|
+
}, [[4, "icNavigationMenuOpened", "navBarMenuOpenHandler"], [4, "icNavigationMenuClosed", "navBarMenuCloseHandler"]], {
|
147
170
|
"accessibleLabel": ["accessibleLabelHandler"],
|
148
171
|
"customColor": ["customColorHandler"],
|
149
172
|
"variant": ["variantHandler"],
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"ic-badge.js","mappings":";;;;AAAA,MAAM,UAAU,GAAG,8hGAA8hG;;MCwCpiG,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I,gBACL,SAAS,EACrB,IAAI,EAAC,QAAQ,IAEZ,IAAI,KAAK,MAAM,IAAI,YAAM,IAAI,EAAC,YAAY,GAAQ,EAClD,IAAI,KAAK,MAAM,IAAI,SAAS,KAC3B,qBAAe,OAAO,EAAE,IAAI,KAAK,OAAO,GAAG,aAAa,GAAG,OAAO,IAC/D,YAAY,EAAE,CACD,CACjB,EACA,IAAI,KAAK,KAAK,IAAI,YAAM,KAAK,EAAC,SAAS,YAAa,CAChD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/ic-badge/ic-badge.css?tag=ic-badge&encapsulation=shadow","src/components/ic-badge/ic-badge.tsx"],"sourcesContent":["@media (prefers-reduced-motion: no-preference) {\n :host(.show) {\n animation: expand var(--ic-transition-duration-slow);\n }\n\n :host(.hide) {\n animation: shrink var(--ic-transition-duration-slow);\n }\n}\n\n:host {\n display: flex;\n height: var(--ic-space-md);\n min-width: var(--ic-space-md);\n width: fit-content;\n border-radius: calc(2 * var(--ic-space-xxl));\n position: absolute;\n}\n\n:host(.neutral) {\n background-color: var(--ic-architectural-500);\n}\n\n:host(.light) {\n background-color: var(--ic-architectural-40);\n}\n\n:host(.info) {\n background-color: var(--ic-status-info);\n}\n\n:host(.warning) {\n background-color: var(--ic-status-warning-mid);\n}\n\n:host(.error) {\n background-color: var(--ic-status-error);\n}\n\n:host(.success) {\n background-color: var(--ic-status-success);\n}\n\n:host(.small) {\n height: var(--ic-space-sm);\n min-width: var(--ic-space-sm);\n}\n\n:host(.large) {\n height: calc(var(--ic-space-md) + var(--ic-space-xxs));\n min-width: calc(var(--ic-space-md) + var(--ic-space-xxs));\n}\n\n:host(.dot.default) {\n height: var(--ic-space-xs);\n width: var(--ic-space-xs);\n min-width: var(--ic-space-xs);\n}\n\n:host(.dot.small) {\n height: calc(var(--ic-space-xxs) + var(--ic-space-xxxs));\n width: calc(var(--ic-space-xxs) + var(--ic-space-xxxs));\n min-width: calc(var(--ic-space-xxs) + var(--ic-space-xxxs));\n}\n\n:host(.dot.large) {\n height: var(--ic-space-sm);\n width: var(--ic-space-sm);\n min-width: var(--ic-space-sm);\n}\n\n:host(.foreground-dark) ::slotted(*) {\n fill: var(--ic-color-primary-text);\n}\n\n:host(.foreground-light) ::slotted(*) {\n fill: white;\n}\n\n:host(.foreground-dark) ic-typography {\n color: var(--ic-color-primary-text);\n}\n\n:host(.foreground-light) ic-typography {\n color: white;\n}\n\n:host(.text) ic-typography {\n align-self: center;\n padding: 0 calc((var(--ic-space-xs) + var(--ic-space-1px)) / 2)\n var(--ic-space-1px);\n}\n\n:host(.text.small) ic-typography {\n padding: 0 0.2132rem;\n}\n\n:host(.text.large) ic-typography {\n padding: 0 calc((var(--ic-space-sm) + var(--ic-space-1px)) / 2)\n var(--ic-space-1px);\n}\n\n:host(.icon) ::slotted(svg) {\n width: var(--ic-space-sm);\n height: var(--ic-space-sm);\n padding: var(--ic-space-xxxs);\n}\n\n:host(.icon.small) ::slotted(svg) {\n width: var(--ic-space-xs);\n height: var(--ic-space-xs);\n}\n\n:host(.icon.large) ::slotted(svg) {\n width: calc(var(--ic-space-sm) + var(--ic-space-xxxs));\n height: calc(var(--ic-space-sm) + var(--ic-space-xxxs));\n padding: calc(var(--ic-space-xxxs) + var(--ic-space-1px));\n}\n\n:host(.far) {\n top: calc(-1 * var(--ic-space-xs));\n right: calc(-1 * var(--ic-space-xs));\n}\n\n:host(.far.small),\n:host(.dot.far.large) {\n top: calc(-1 * var(--ic-space-xxs));\n right: calc(-1 * var(--ic-space-xxs));\n}\n\n:host(.dot.far),\n:host(.dot.far.small) {\n top: calc(-1 * var(--ic-space-xxxs));\n right: calc(-1 * var(--ic-space-xxxs));\n}\n\n:host(.near) {\n top: calc(-1 * calc(var(--ic-space-xxs) + var(--ic-space-1px)));\n right: calc(-1 * calc(var(--ic-space-xxs) + var(--ic-space-1px)));\n}\n\n:host(.dot.near) {\n top: calc(-1 * var(--ic-space-1px));\n right: calc(-1 * var(--ic-space-1px));\n}\n\n:host(.inline) {\n position: static;\n}\n\n:host(.hide) {\n visibility: hidden !important;\n transition: visibility var(--ic-transition-duration-slow);\n}\n\n.sr-only {\n position: absolute;\n left: -9999px;\n}\n\n@keyframes expand {\n from {\n opacity: 0;\n transform: scale(0);\n }\n\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes shrink {\n from {\n opacity: 1;\n transform: scale(1);\n }\n\n to {\n opacity: 0;\n transform: scale(0);\n }\n}\n","import {\n Component,\n Element,\n Host,\n Method,\n Prop,\n Watch,\n h,\n} from \"@stencil/core\";\nimport {\n IcBadgePositions,\n IcBadgeTypes,\n IcBadgeVariants,\n} from \"./ic-badge.types\";\nimport {\n IcColorRGBA,\n IcSizes,\n IcThemeForeground,\n IcColor,\n} from \"../../utils/types\";\nimport {\n convertToRGBA,\n getCssProperty,\n getThemeForegroundColor,\n hexToRgba,\n isPropDefined,\n onComponentRequiredPropUndefined,\n rgbaStrToObj,\n} from \"../../utils/helpers\";\n\n/**\n * @slot badge-icon - Icon will be rendered inside the badge if type is set to icon.\n */\n@Component({\n tag: \"ic-badge\",\n styleUrl: \"ic-badge.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class Badge {\n private ariaLabel: string = null;\n private customColorRGBA: IcColorRGBA;\n private foregroundColour: IcThemeForeground;\n private parentAriaLabel: string;\n\n @Element() el: HTMLIcBadgeElement;\n\n /**\n * The accessible label of the badge component to provide context for screen reader users.\n */\n @Prop() accessibleLabel?: string;\n\n @Watch(\"accessibleLabel\")\n accessibleLabelHandler(): void {\n this.setAccessibleLabel();\n }\n\n /**\n * The custom badge colour. This will only style the badge component if variant=\"custom\".\n * Can be a hex value e.g. \"#ff0000\", RGB e.g. \"rgb(255, 0, 0)\", or RGBA e.g. \"rgba(255, 0, 0, 1)\".\n */\n @Prop() customColor?: IcColor = null;\n\n @Watch(\"customColor\")\n customColorHandler(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n }\n\n /**\n * The maximum number shown on the badge appended with a +.\n * This will only be displayed if type=\"text\" and textLabel is not empty.\n */\n @Prop() maxNumber?: number;\n\n /**\n * The positioning of the badge in reference to the parent element.\n */\n @Prop() position?: IcBadgePositions = \"far\";\n\n /**\n * The size of the badge to be displayed.\n */\n @Prop() size?: IcSizes = \"default\";\n\n /**\n * The text displayed in the badge. This will only be displayed if type=\"text\".\n */\n @Prop() textLabel?: string;\n\n /**\n * The type of badge to be displayed.\n */\n @Prop() type?: IcBadgeTypes = \"text\";\n\n /**\n * The variant of the badge to be displayed.\n */\n @Prop() variant?: IcBadgeVariants = \"neutral\";\n\n @Watch(\"variant\")\n variantHandler(): void {\n this.getBadgeForeground();\n }\n\n /**\n * If `true`, the badge will be displayed.\n */\n @Prop({ mutable: true }) visible: boolean = true;\n\n @Watch(\"visible\")\n visibleHandler(): void {\n this.setAccessibleLabel();\n }\n\n componentWillLoad(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n\n this.getBadgeForeground();\n\n const ariaLabel = this.el.parentElement?.ariaLabel;\n if (ariaLabel) this.parentAriaLabel = ariaLabel;\n this.setAccessibleLabel();\n }\n\n componentDidLoad(): void {\n this.type === \"text\" &&\n onComponentRequiredPropUndefined(\n [{ prop: this.textLabel, propName: \"text-label\" }],\n \"Badge\"\n );\n }\n\n /**\n * @deprecated This method should not be used anymore. Use visible prop to set badge visibility.\n */\n @Method()\n async showBadge(): Promise<void> {\n this.visible = true;\n }\n\n /**\n * @deprecated This method should not be used anymore. Use visible prop to set badge visibility.\n */\n @Method()\n async hideBadge(): Promise<void> {\n this.visible = false;\n }\n\n private setBadgeColour = () => {\n const colorRGBA = convertToRGBA(this.customColor);\n\n if (colorRGBA) {\n this.customColorRGBA = colorRGBA;\n const { r, g, b, a } = colorRGBA;\n this.el.style.backgroundColor = `rgba(${r}, ${g}, ${b}, ${a})`;\n }\n };\n\n private getBadgeRGB = () => {\n switch (this.variant) {\n case \"custom\":\n return this.customColorRGBA;\n case \"error\":\n case \"success\":\n case \"warning\":\n case \"info\": {\n return rgbaStrToObj(getCssProperty(`--ic-status-${this.variant}`));\n }\n case \"neutral\":\n case \"light\":\n return hexToRgba(\n getCssProperty(\n `--ic-architectural-${this.variant === \"neutral\" ? 500 : 40}`\n )\n );\n }\n };\n\n private getBadgeForeground = () => {\n const { r, g, b } = this.getBadgeRGB();\n this.foregroundColour = getThemeForegroundColor(\n (r * 299 + g * 587 + b * 114) / 1000\n );\n };\n\n private getTextLabel = () =>\n this.maxNumber && Number(this.textLabel) > this.maxNumber\n ? `${this.maxNumber}+`\n : this.textLabel;\n\n // Set aria-label on badge and / or parent element\n // Aria-describedby seems to not work, probably due to shadow DOM\n private setAccessibleLabel = () => {\n const parentEl = this.el.parentElement;\n const defaultAriaLabel = this.isAccessibleLabelDefined()\n ? this.accessibleLabel\n : this.textLabel || \"with badge being displayed\";\n\n if (parentEl) {\n const { tagName } = parentEl;\n if (\n tagName !== \"IC-CARD\" &&\n (tagName !== \"IC-TAB\" || (tagName === \"IC-TAB\" && this.parentAriaLabel))\n ) {\n const ariaLabelPrefix = this.parentAriaLabel\n ? `${this.parentAriaLabel} ,`\n : \"\";\n parentEl.ariaLabel = this.visible\n ? `${ariaLabelPrefix} ${defaultAriaLabel}`\n : undefined;\n } else {\n this.ariaLabel = `, ${defaultAriaLabel}`;\n }\n }\n };\n\n private isAccessibleLabelDefined = () =>\n isPropDefined(this.accessibleLabel) && this.accessibleLabel !== null;\n\n render() {\n const {\n ariaLabel,\n el,\n foregroundColour,\n getTextLabel,\n position,\n size,\n textLabel,\n type,\n variant,\n visible,\n } = this;\n\n return (\n <Host\n class={{\n [`${position}`]: true,\n [`${size}`]: true,\n [`${variant}`]: true,\n [`${type}`]: true,\n [`foreground-${foregroundColour}`]: foregroundColour !== null,\n [`${visible ? \"show\" : \"hide\"}`]: true,\n }}\n id={el.id || null}\n aria-label={ariaLabel}\n role=\"status\"\n >\n {type === \"icon\" && <slot name=\"badge-icon\"></slot>}\n {type === \"text\" && textLabel && (\n <ic-typography variant={size === \"small\" ? \"badge-small\" : \"badge\"}>\n {getTextLabel()}\n </ic-typography>\n )}\n {type === \"dot\" && <span class=\"sr-only\">badge</span>}\n </Host>\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"ic-badge.js","mappings":";;;;AAAA,MAAM,UAAU,GAAG,8hGAA8hG;;AC+BjjG,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACjD,MAAM,cAAc,GAAG,mBAAmB,CAAC;MAY9B,KAAK;;;;;QACR,cAAS,GAAW,IAAI,CAAC;QA0HzB,mBAAc,GAAG;YACvB,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAElD,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;gBACjC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC;gBACjC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;aAChE;SACF,CAAC;QAEM,gBAAW,GAAG;YACpB,QAAQ,IAAI,CAAC,OAAO;gBAClB,KAAK,QAAQ;oBACX,OAAO,IAAI,CAAC,eAAe,CAAC;gBAC9B,KAAK,OAAO,CAAC;gBACb,KAAK,SAAS,CAAC;gBACf,KAAK,SAAS,CAAC;gBACf,KAAK,MAAM,EAAE;oBACX,OAAO,YAAY,CAAC,cAAc,CAAC,eAAe,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;iBACpE;gBACD,KAAK,SAAS,CAAC;gBACf,KAAK,OAAO;oBACV,OAAO,SAAS,CACd,cAAc,CACZ,sBAAsB,IAAI,CAAC,OAAO,KAAK,SAAS,GAAG,GAAG,GAAG,EAAE,EAAE,CAC9D,CACF,CAAC;aACL;SACF,CAAC;QAEM,uBAAkB,G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I,SAAS,KAC3B,qBAAe,OAAO,EAAE,IAAI,KAAK,OAAO,GAAG,aAAa,GAAG,OAAO,IAC/D,YAAY,EAAE,CACD,CACjB,EACA,IAAI,KAAK,KAAK,IAAI,YAAM,KAAK,EAAC,SAAS,YAAa,CAChD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/ic-badge/ic-badge.css?tag=ic-badge&encapsulation=shadow","src/components/ic-badge/ic-badge.tsx"],"sourcesContent":["@media (prefers-reduced-motion: no-preference) {\n :host(.show) {\n animation: expand var(--ic-transition-duration-slow);\n }\n\n :host(.hide) {\n animation: shrink var(--ic-transition-duration-slow);\n }\n}\n\n:host {\n display: flex;\n height: var(--ic-space-md);\n min-width: var(--ic-space-md);\n width: fit-content;\n border-radius: calc(2 * var(--ic-space-xxl));\n position: absolute;\n}\n\n:host(.neutral) {\n background-color: var(--ic-architectural-500);\n}\n\n:host(.light) {\n background-color: var(--ic-architectural-40);\n}\n\n:host(.info) {\n background-color: var(--ic-status-info);\n}\n\n:host(.warning) {\n background-color: var(--ic-status-warning-mid);\n}\n\n:host(.error) {\n background-color: var(--ic-status-error);\n}\n\n:host(.success) {\n background-color: var(--ic-status-success);\n}\n\n:host(.small) {\n height: var(--ic-space-sm);\n min-width: var(--ic-space-sm);\n}\n\n:host(.large) {\n height: calc(var(--ic-space-md) + var(--ic-space-xxs));\n min-width: calc(var(--ic-space-md) + var(--ic-space-xxs));\n}\n\n:host(.dot.default) {\n height: var(--ic-space-xs);\n width: var(--ic-space-xs);\n min-width: var(--ic-space-xs);\n}\n\n:host(.dot.small) {\n height: calc(var(--ic-space-xxs) + var(--ic-space-xxxs));\n width: calc(var(--ic-space-xxs) + var(--ic-space-xxxs));\n min-width: calc(var(--ic-space-xxs) + var(--ic-space-xxxs));\n}\n\n:host(.dot.large) {\n height: var(--ic-space-sm);\n width: var(--ic-space-sm);\n min-width: var(--ic-space-sm);\n}\n\n:host(.foreground-dark) ::slotted(*) {\n fill: var(--ic-color-primary-text);\n}\n\n:host(.foreground-light) ::slotted(*) {\n fill: white;\n}\n\n:host(.foreground-dark) ic-typography {\n color: var(--ic-color-primary-text);\n}\n\n:host(.foreground-light) ic-typography {\n color: white;\n}\n\n:host(.text) ic-typography {\n align-self: center;\n padding: 0 calc((var(--ic-space-xs) + var(--ic-space-1px)) / 2)\n var(--ic-space-1px);\n}\n\n:host(.text.small) ic-typography {\n padding: 0 0.2132rem;\n}\n\n:host(.text.large) ic-typography {\n padding: 0 calc((var(--ic-space-sm) + var(--ic-space-1px)) / 2)\n var(--ic-space-1px);\n}\n\n:host(.icon) ::slotted(svg) {\n width: var(--ic-space-sm);\n height: var(--ic-space-sm);\n padding: var(--ic-space-xxxs);\n}\n\n:host(.icon.small) ::slotted(svg) {\n width: var(--ic-space-xs);\n height: var(--ic-space-xs);\n}\n\n:host(.icon.large) ::slotted(svg) {\n width: calc(var(--ic-space-sm) + var(--ic-space-xxxs));\n height: calc(var(--ic-space-sm) + var(--ic-space-xxxs));\n padding: calc(var(--ic-space-xxxs) + var(--ic-space-1px));\n}\n\n:host(.far) {\n top: calc(-1 * var(--ic-space-xs));\n right: calc(-1 * var(--ic-space-xs));\n}\n\n:host(.far.small),\n:host(.dot.far.large) {\n top: calc(-1 * var(--ic-space-xxs));\n right: calc(-1 * var(--ic-space-xxs));\n}\n\n:host(.dot.far),\n:host(.dot.far.small) {\n top: calc(-1 * var(--ic-space-xxxs));\n right: calc(-1 * var(--ic-space-xxxs));\n}\n\n:host(.near) {\n top: calc(-1 * calc(var(--ic-space-xxs) + var(--ic-space-1px)));\n right: calc(-1 * calc(var(--ic-space-xxs) + var(--ic-space-1px)));\n}\n\n:host(.dot.near) {\n top: calc(-1 * var(--ic-space-1px));\n right: calc(-1 * var(--ic-space-1px));\n}\n\n:host(.inline) {\n position: static;\n}\n\n:host(.hide) {\n visibility: hidden !important;\n transition: visibility var(--ic-transition-duration-slow);\n}\n\n.sr-only {\n position: absolute;\n left: -9999px;\n}\n\n@keyframes expand {\n from {\n opacity: 0;\n transform: scale(0);\n }\n\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes shrink {\n from {\n opacity: 1;\n transform: scale(1);\n }\n\n to {\n opacity: 0;\n transform: scale(0);\n }\n}\n","import {\n Component,\n Element,\n Host,\n Method,\n Prop,\n Watch,\n h,\n Listen,\n} from \"@stencil/core\";\nimport {\n IcBadgePositions,\n IcBadgeTypes,\n IcBadgeVariants,\n} from \"./ic-badge.types\";\nimport {\n IcColorRGBA,\n IcSizes,\n IcThemeForeground,\n IcColor,\n} from \"../../utils/types\";\nimport {\n convertToRGBA,\n getCssProperty,\n getThemeForegroundColor,\n hexToRgba,\n isPropDefined,\n onComponentRequiredPropUndefined,\n rgbaStrToObj,\n} from \"../../utils/helpers\";\n\nconst NAVIGATION_BUTTON = \"IC-NAVIGATION-BUTTON\";\nconst TOP_NAVIGATION = \"IC-TOP-NAVIGATION\";\n\n/**\n * @slot badge-icon - Icon will be rendered inside the badge if type is set to icon.\n */\n@Component({\n tag: \"ic-badge\",\n styleUrl: \"ic-badge.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class Badge {\n private ariaLabel: string = null;\n private customColorRGBA: IcColorRGBA;\n private foregroundColour: IcThemeForeground;\n private parentAriaLabel: string;\n\n @Element() el: HTMLIcBadgeElement;\n\n /**\n * The accessible label of the badge component to provide context for screen reader users.\n */\n @Prop() accessibleLabel?: string;\n\n @Watch(\"accessibleLabel\")\n accessibleLabelHandler(): void {\n this.setAccessibleLabel();\n }\n\n /**\n * The custom badge colour. This will only style the badge component if variant=\"custom\".\n * Can be a hex value e.g. \"#ff0000\", RGB e.g. \"rgb(255, 0, 0)\", or RGBA e.g. \"rgba(255, 0, 0, 1)\".\n */\n @Prop() customColor?: IcColor = null;\n\n @Watch(\"customColor\")\n customColorHandler(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n }\n\n /**\n * The maximum number shown on the badge appended with a +.\n * This will only be displayed if type=\"text\" and textLabel is not empty.\n */\n @Prop() maxNumber?: number;\n\n /**\n * The positioning of the badge in reference to the parent element.\n */\n @Prop({ mutable: true }) position?: IcBadgePositions = \"far\";\n\n /**\n * The size of the badge to be displayed.\n */\n @Prop() size?: IcSizes = \"default\";\n\n /**\n * The text displayed in the badge. This will only be displayed if type=\"text\".\n */\n @Prop() textLabel?: string;\n\n /**\n * The type of badge to be displayed.\n */\n @Prop() type?: IcBadgeTypes = \"text\";\n\n /**\n * The variant of the badge to be displayed.\n */\n @Prop() variant?: IcBadgeVariants = \"neutral\";\n\n @Watch(\"variant\")\n variantHandler(): void {\n this.getBadgeForeground();\n }\n\n /**\n * If `true`, the badge will be displayed.\n */\n @Prop({ mutable: true }) visible: boolean = true;\n\n @Watch(\"visible\")\n visibleHandler(): void {\n this.setAccessibleLabel();\n }\n\n componentWillLoad(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n\n this.getBadgeForeground();\n\n const ariaLabel = this.el.parentElement?.ariaLabel;\n if (ariaLabel) this.parentAriaLabel = ariaLabel;\n this.setAccessibleLabel();\n }\n\n componentDidLoad(): void {\n this.type === \"text\" &&\n onComponentRequiredPropUndefined(\n [{ prop: this.textLabel, propName: \"text-label\" }],\n \"Badge\"\n );\n }\n\n componentWillRender(): void {\n this.isInTopNav() && this.setPositionInTopNavigation();\n }\n\n @Listen(\"icNavigationMenuOpened\", { target: \"document\" })\n navBarMenuOpenHandler(): void {\n this.isInTopNav() && (this.position = \"inline\");\n }\n\n @Listen(\"icNavigationMenuClosed\", { target: \"document\" })\n navBarMenuCloseHandler(): void {\n this.isInTopNav() && (this.position = \"near\");\n }\n\n /**\n * @deprecated This method should not be used anymore. Use visible prop to set badge visibility.\n */\n @Method()\n async showBadge(): Promise<void> {\n this.visible = true;\n }\n\n /**\n * @deprecated This method should not be used anymore. Use visible prop to set badge visibility.\n */\n @Method()\n async hideBadge(): Promise<void> {\n this.visible = false;\n }\n\n private setBadgeColour = () => {\n const colorRGBA = convertToRGBA(this.customColor);\n\n if (colorRGBA) {\n this.customColorRGBA = colorRGBA;\n const { r, g, b, a } = colorRGBA;\n this.el.style.backgroundColor = `rgba(${r}, ${g}, ${b}, ${a})`;\n }\n };\n\n private getBadgeRGB = () => {\n switch (this.variant) {\n case \"custom\":\n return this.customColorRGBA;\n case \"error\":\n case \"success\":\n case \"warning\":\n case \"info\": {\n return rgbaStrToObj(getCssProperty(`--ic-status-${this.variant}`));\n }\n case \"neutral\":\n case \"light\":\n return hexToRgba(\n getCssProperty(\n `--ic-architectural-${this.variant === \"neutral\" ? 500 : 40}`\n )\n );\n }\n };\n\n private getBadgeForeground = () => {\n const { r, g, b } = this.getBadgeRGB();\n this.foregroundColour = getThemeForegroundColor(\n (r * 299 + g * 587 + b * 114) / 1000\n );\n };\n\n private getTextLabel = () =>\n this.maxNumber && Number(this.textLabel) > this.maxNumber\n ? `${this.maxNumber}+`\n : this.textLabel;\n\n // Set aria-label on badge and / or parent element\n // Aria-describedby seems to not work, probably due to shadow DOM\n private setAccessibleLabel = () => {\n const parentEl = this.el.parentElement;\n const defaultAriaLabel = this.isAccessibleLabelDefined()\n ? this.accessibleLabel\n : this.textLabel || \"with badge being displayed\";\n\n if (parentEl) {\n const { tagName } = parentEl;\n if (\n tagName !== \"IC-CARD\" &&\n (tagName !== \"IC-TAB\" || (tagName === \"IC-TAB\" && this.parentAriaLabel))\n ) {\n const ariaLabelPrefix = this.parentAriaLabel\n ? `${this.parentAriaLabel} ,`\n : \"\";\n parentEl.ariaLabel = this.visible\n ? `${ariaLabelPrefix} ${defaultAriaLabel}`\n : undefined;\n } else {\n this.ariaLabel = `, ${defaultAriaLabel}`;\n }\n }\n };\n\n private setPositionInTopNavigation = () => {\n const parentTopNavEl = this.el.parentElement.parentElement;\n parentTopNavEl.classList.contains(\"mobile-mode\")\n ? (this.position = \"inline\")\n : (this.position = \"near\");\n };\n\n private isInTopNav = (): boolean => {\n const parentEl = this.el.parentElement;\n const grandparentEl = parentEl.parentElement;\n return (\n parentEl.tagName === NAVIGATION_BUTTON &&\n grandparentEl.tagName === TOP_NAVIGATION\n );\n };\n\n private isAccessibleLabelDefined = () =>\n isPropDefined(this.accessibleLabel) && this.accessibleLabel !== null;\n\n render() {\n const {\n ariaLabel,\n el,\n foregroundColour,\n getTextLabel,\n position,\n size,\n textLabel,\n type,\n variant,\n visible,\n } = this;\n\n return (\n <Host\n class={{\n [`${position}`]: true,\n [`${size}`]: true,\n [`${variant}`]: true,\n [`${type}`]: true,\n [`foreground-${foregroundColour}`]: foregroundColour !== null,\n [`${visible ? \"show\" : \"hide\"}`]: true,\n }}\n id={el.id || null}\n aria-label={ariaLabel}\n role=\"status\"\n >\n {type === \"icon\" && <slot name=\"badge-icon\"></slot>}\n {type === \"text\" && textLabel && (\n <ic-typography variant={size === \"small\" ? \"badge-small\" : \"badge\"}>\n {getTextLabel()}\n </ic-typography>\n )}\n {type === \"dot\" && <span class=\"sr-only\">badge</span>}\n </Host>\n );\n }\n}\n"],"version":3}
|
@@ -6,7 +6,7 @@ import { d as defineCustomElement$4 } from './ic-loading-indicator2.js';
|
|
6
6
|
import { d as defineCustomElement$3 } from './ic-tooltip2.js';
|
7
7
|
import { d as defineCustomElement$2 } from './ic-typography2.js';
|
8
8
|
|
9
|
-
const icNavigationButtonCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=\"button\"],[type=\"reset\"],[type=\"submit\"]{-webkit-appearance:button}button::-moz-focus-inner,[type=\"button\"]::-moz-focus-inner,[type=\"reset\"]::-moz-focus-inner,[type=\"submit\"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=\"button\"]:-moz-focusring,[type=\"reset\"]:-moz-focusring,[type=\"submit\"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=\"checkbox\"],[type=\"radio\"]{box-sizing:border-box;padding:0;}[type=\"number\"]::-webkit-inner-spin-button,[type=\"number\"]::-webkit-outer-spin-button{height:auto}[type=\"search\"]{-webkit-appearance:textfield;outline-offset:-2px;}[type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}:host{display:block;margin-right:var(--ic-space-xs);list-style:none}:host(.in-side-menu){margin-right:0}:host::part(button){height:100%;min-height:2.5rem}";
|
9
|
+
const icNavigationButtonCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=\"button\"],[type=\"reset\"],[type=\"submit\"]{-webkit-appearance:button}button::-moz-focus-inner,[type=\"button\"]::-moz-focus-inner,[type=\"reset\"]::-moz-focus-inner,[type=\"submit\"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=\"button\"]:-moz-focusring,[type=\"reset\"]:-moz-focusring,[type=\"submit\"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=\"checkbox\"],[type=\"radio\"]{box-sizing:border-box;padding:0;}[type=\"number\"]::-webkit-inner-spin-button,[type=\"number\"]::-webkit-outer-spin-button{height:auto}[type=\"search\"]{-webkit-appearance:textfield;outline-offset:-2px;}[type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}:host{display:block;margin-right:var(--ic-space-xs);list-style:none}:host(.in-side-menu){margin-right:0}:host::part(button){height:100%;min-height:2.5rem}:host(.in-side-menu) ::slotted(ic-badge){margin-left:var(--ic-space-xs)}";
|
10
10
|
|
11
11
|
const MUTABLE_ATTRIBUTES = [...IC_INHERITED_ARIA, "title"];
|
12
12
|
const NavigationButton = /*@__PURE__*/ proxyCustomElement(class NavigationButton extends HTMLElement {
|
@@ -106,7 +106,7 @@ const NavigationButton = /*@__PURE__*/ proxyCustomElement(class NavigationButton
|
|
106
106
|
fullWidth,
|
107
107
|
disableTooltip,
|
108
108
|
};
|
109
|
-
return (h(Host, { class: { ["in-side-menu"]: this.mode === "menu" } }, h("ic-button", Object.assign({ class: className, "aria-label": variant == "icon" ? this.label : null, ref: (el) => (this.buttonEl = el) }, buttonProps, this.inheritedAttributes), label, h("slot", { slot: "left-icon", name: "icon" }), isSlotUsed(this.el, "badge") &&
|
109
|
+
return (h(Host, { class: { ["in-side-menu"]: this.mode === "menu" } }, h("ic-button", Object.assign({ class: className, "aria-label": variant == "icon" ? this.label : null, ref: (el) => (this.buttonEl = el) }, buttonProps, this.inheritedAttributes), label, h("slot", { slot: "left-icon", name: "icon" }), isSlotUsed(this.el, "badge") && h("slot", { name: "badge" }))));
|
110
110
|
}
|
111
111
|
static get delegatesFocus() { return true; }
|
112
112
|
get el() { return this; }
|