@eccenca/gui-elements 24.0.0-rc.0 → 24.0.0-rc.1

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/CHANGELOG.md CHANGED
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
10
10
 
11
11
  - `<MultiSuggestField />`
12
12
  - An optional custom search function property has been added, it defines how to filter elements.
13
+ - basic Storybook example for `<Application* />` components
13
14
 
14
15
  ### Changed
15
16
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eccenca/gui-elements",
3
3
  "description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
4
- "version": "24.0.0-rc.0",
4
+ "version": "24.0.0-rc.1",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/eccenca/gui-elements",
7
7
  "bugs": "https://github.com/eccenca/gui-elements/issues",
@@ -55,15 +55,23 @@ $shell-header-link: $blue-60 !default;
55
55
  // load library sub component
56
56
  @import "~@carbon/react/scss/components/ui-shell/header/index";
57
57
 
58
- // tweack original layout
58
+ // tweak original layout
59
59
 
60
60
  .#{$prefix}--header {
61
61
  height: mini-units(8);
62
62
  }
63
63
 
64
- .#{$prefix}--header__action {
64
+ .#{$prefix}--header__action,
65
+ .#{$prefix}--header__action.#{$prefix}--btn--icon-only {
65
66
  width: mini-units(8);
66
67
  height: mini-units(8);
68
+ padding-block-start: 0;
69
+ background-color: transparent;
70
+
71
+ // $shell-header-icon-02
72
+ & > svg {
73
+ fill: $eccgui-color-applicationheader-text;
74
+ }
67
75
  }
68
76
 
69
77
  .#{$prefix}--header__menu-trigger {
@@ -141,6 +149,7 @@ a.#{$prefix}--header__menu-item:hover {
141
149
 
142
150
  // $shell-header-bg-03
143
151
  .#{$prefix}--header__action:active,
152
+ .#{$prefix}--header__action.#{$prefix}--btn--icon-only:active,
144
153
  .#{$prefix}--header__menu-title[aria-expanded="true"] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:active,
145
154
  a.#{$prefix}--header__menu-item:active {
146
155
  background-color: $shell-header-bg-03;
@@ -148,12 +157,14 @@ a.#{$prefix}--header__menu-item:active {
148
157
 
149
158
  // $shell-header-bg-04
150
159
  .#{$prefix}--header__action:hover,
160
+ .#{$prefix}--header__action.#{$prefix}--btn--icon-only:hover,
151
161
  .#{$prefix}--header__menu-title[aria-expanded="true"] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover {
152
162
  background-color: $shell-header-bg-04;
153
163
  }
154
164
 
155
165
  // $shell-header-bg-05
156
- .#{$prefix}--header__action--active {
166
+ .#{$prefix}--header__action--active,
167
+ .#{$prefix}--header__action--active.#{$prefix}--btn--icon-only {
157
168
  background-color: $shell-header-bg-05;
158
169
  border-right-color: transparent;
159
170
  border-bottom-color: $shell-header-bg-05;
@@ -168,7 +179,8 @@ a.#{$prefix}--header__menu-item:active {
168
179
 
169
180
  // $shell-header-border-01
170
181
  .#{$prefix}--header,
171
- .#{$prefix}--header__action {
182
+ .#{$prefix}--header__action,
183
+ .#{$prefix}--header__action.#{$prefix}--btn--icon-only {
172
184
  border-bottom: none;
173
185
  }
174
186
  .#{$prefix}--header__nav {
@@ -179,9 +191,14 @@ a.#{$prefix}--header__menu-item:active {
179
191
 
180
192
  // $shell-header-focus
181
193
  .#{$prefix}--header__action:focus,
194
+ .#{$prefix}--header__action.#{$prefix}--btn--icon-only:focus,
195
+ .#{$prefix}--header__action.#{$prefix}--btn--primary:focus,
182
196
  a.#{$prefix}--header__name:focus,
183
197
  a.#{$prefix}--header__menu-item:focus {
184
- border-color: color.adjust($eccgui-color-applicationheader-text, $lightness: 39%);
198
+ border: none;
199
+ outline: 1px dotted color.adjust($eccgui-color-applicationheader-text, $lightness: 39%);
200
+ outline-offset: -1px;
201
+ box-shadow: none;
185
202
  }
186
203
  .#{$prefix}--header__menu-title[aria-expanded="true"] {
187
204
  color: color.adjust($eccgui-color-applicationheader-text, $lightness: 39%);
@@ -192,6 +209,7 @@ a.#{$prefix}--header__name,
192
209
  a.#{$prefix}--header__name:hover,
193
210
  a.#{$prefix}--header__menu-item:hover,
194
211
  .#{$prefix}--header__action:active,
212
+ .#{$prefix}--header__action.#{$prefix}--btn--icon-only:active,
195
213
  a.#{$prefix}--header__menu-item:active,
196
214
  a.#{$prefix}--header__menu-item:focus,
197
215
  .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover,
@@ -210,6 +228,10 @@ a.#{$prefix}--header__menu-item {
210
228
  .#{$prefix}--header__action:active,
211
229
  .#{$prefix}--header__action:focus {
212
230
  color: $eccgui-color-applicationheader-text;
231
+
232
+ &.#{$prefix}--btn--icon-only {
233
+ color: $eccgui-color-applicationheader-text;
234
+ }
213
235
  }
214
236
  .#{$prefix}--header__menu-trigger > svg,
215
237
  a.#{$prefix}--header__menu-item:hover > svg,
@@ -218,11 +240,6 @@ a.#{$prefix}--header__menu-item:focus > svg {
218
240
  fill: $eccgui-color-applicationheader-text;
219
241
  }
220
242
 
221
- // $shell-header-icon-02
222
- .#{$prefix}--header__action > svg {
223
- fill: $eccgui-color-applicationheader-text;
224
- }
225
-
226
243
  // $shell-header-icon-03
227
244
  .#{$prefix}--header__menu-arrow {
228
245
  fill: $eccgui-color-applicationheader-text;
@@ -0,0 +1,139 @@
1
+ import React, { CSSProperties } from "react";
2
+ import { LoremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import {
6
+ ApplicationContainer,
7
+ ApplicationContent,
8
+ ApplicationHeader,
9
+ ApplicationSidebarNavigation,
10
+ ApplicationSidebarToggler,
11
+ ApplicationTitle,
12
+ ApplicationToolbar,
13
+ ApplicationToolbarAction,
14
+ ApplicationToolbarPanel,
15
+ ApplicationToolbarSection,
16
+ Badge,
17
+ Button,
18
+ Depiction,
19
+ Icon,
20
+ WorkspaceHeader,
21
+ } from "../../../index";
22
+
23
+ interface ApplicationBasicExampleProps {
24
+ openMainNavigation: boolean;
25
+ openUserMenu: boolean;
26
+ countNotifications: number;
27
+ colorBackgroundHeader?: string;
28
+ }
29
+
30
+ function ApplicationBasicExample(args: ApplicationBasicExampleProps) {
31
+ return <></>;
32
+ }
33
+
34
+ export default {
35
+ title: "Components/Application",
36
+ component: ApplicationBasicExample,
37
+ subcomponents: {
38
+ ApplicationContainer,
39
+ ApplicationContent,
40
+ ApplicationHeader,
41
+ ApplicationTitle,
42
+ ApplicationSidebarToggler,
43
+ ApplicationSidebarNavigation,
44
+ ApplicationToolbar,
45
+ ApplicationToolbarSection,
46
+ ApplicationToolbarAction,
47
+ },
48
+ argTypes: {
49
+ colorBackgroundHeader: {
50
+ control: { type: "color" },
51
+ },
52
+ },
53
+ } as Meta<typeof ApplicationBasicExample>;
54
+
55
+ const TemplateBasicExample: StoryFn<typeof ApplicationBasicExample> = (args) => (
56
+ <ApplicationContainer>
57
+ <ApplicationHeader
58
+ aria-label={"Application"}
59
+ style={
60
+ args.colorBackgroundHeader
61
+ ? ({ "--eccgui-appheader-color-background": args.colorBackgroundHeader } as CSSProperties)
62
+ : undefined
63
+ }
64
+ >
65
+ <ApplicationTitle
66
+ isNotDisplayed={!args.openMainNavigation}
67
+ isApplicationSidebarExpanded={args.openMainNavigation}
68
+ >
69
+ ApplicationName
70
+ </ApplicationTitle>
71
+ <ApplicationSidebarToggler
72
+ aria-label={args.openMainNavigation ? "Close navigation" : "Open navigation"}
73
+ isActive={args.openMainNavigation}
74
+ />
75
+ <ApplicationSidebarNavigation isRail={!args.openMainNavigation} expanded={args.openMainNavigation}>
76
+ <code>Menu</code> with <code>MenuItem</code>s.
77
+ </ApplicationSidebarNavigation>
78
+
79
+ <WorkspaceHeader id={"ApplicationBasicExample"} />
80
+
81
+ <ApplicationToolbar>
82
+ <ApplicationToolbarSection>
83
+ <Button>Action</Button>
84
+ </ApplicationToolbarSection>
85
+ {args.countNotifications && (
86
+ <ApplicationToolbarAction aria-label="Open notifications menu" isActive={false}>
87
+ <Depiction
88
+ padding="medium"
89
+ size="small"
90
+ ratio="1:1"
91
+ resizing="contain"
92
+ image={<Icon name="application-notification" title="Notification menu icon" large />}
93
+ badge={
94
+ <Badge
95
+ position={"top-right"}
96
+ intent="warning"
97
+ maxLength={2}
98
+ children={args.countNotifications}
99
+ />
100
+ }
101
+ />
102
+ </ApplicationToolbarAction>
103
+ )}
104
+ {args.openUserMenu ? (
105
+ <>
106
+ <ApplicationToolbarAction aria-label={"Close user menu"} tooltipAlignment="end" isActive={true}>
107
+ <Icon name="navigation-close" title="Close icon" large />
108
+ </ApplicationToolbarAction>
109
+ <ApplicationToolbarPanel aria-label="User menu" expanded={true}>
110
+ <code>Menu</code> with <code>MenuItem</code>s.
111
+ </ApplicationToolbarPanel>
112
+ </>
113
+ ) : (
114
+ <ApplicationToolbarAction
115
+ id={"headerUserMenu"}
116
+ aria-label={"Open user menu"}
117
+ tooltipAlignment="end"
118
+ isActive={false}
119
+ >
120
+ <Icon name="application-useraccount" title="User menu icon" large />
121
+ </ApplicationToolbarAction>
122
+ )}
123
+ </ApplicationToolbar>
124
+ </ApplicationHeader>
125
+ <ApplicationContent
126
+ isApplicationSidebarExpanded={args.openMainNavigation}
127
+ isApplicationSidebarRail={!args.openMainNavigation}
128
+ >
129
+ <LoremIpsum p={2} avgSentencesPerParagraph={4} random={false} />
130
+ </ApplicationContent>
131
+ </ApplicationContainer>
132
+ );
133
+
134
+ export const BasicExample = TemplateBasicExample.bind({});
135
+ BasicExample.args = {
136
+ openMainNavigation: false,
137
+ openUserMenu: false,
138
+ countNotifications: 234,
139
+ };