Skip to content

Commit 930ef55

Browse files
authored
Merge pull request #27 from silinternational/develop
Release 1.1.0
2 parents 886c497 + 052764f commit 930ef55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+26272
-2398
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [1.1.0](https://github.com/silinternational/ui-components/releases/tag/v1.1.0) - 2021-05-26
8+
### Changed
9+
- package.json version to 1.1.0
10+
11+
### Added
12+
- actions, isAboveMobile, isAboveTablet, setNotice to index.js so they can be imported directly
13+
- $$props.class to Fab, TextArea, Select, Checkbox, Datatable, Dialog.Simple, Dialog.Alert, Tooltip, Snackbar, TabBar and List so they can accept global classes
14+
- barColorProvided to Progress.Linear to allow bypass of bar-color class when no color is provided
15+
- bgColorIsVariant to TopAppBar to allow bypass of bg-color-variant if no color is provided
16+
- README: Theming, Drawer example, CSS utility classes and Storybook url.
17+
- Storybook for showcasing components at https://silinternational.github.io/ui-components/
18+
19+
### Fixed
20+
- README: import from '@silintl/ui-components' not 'ui-components'
21+
22+
## [1.0.1](https://github.com/silinternational/ui-components/releases/tag/v1.0.1) - 2021-05-18
23+
### Changed
24+
- updated package-lock.json
25+
- installation instructions in README. Now install with npm: `npm i @silintl/ui-components`
26+
27+
## [1.0.0](https://github.com/silinternational/ui-components/releases/tag/v1.0.0) - 2021-05-18
28+
### Added
29+
- package.json and package-lock.json
30+
- ./random/index.js to generate random IDs for some components
31+
- components - for use in svelte projects based on material design
32+
- index.js to expose components
33+
- README to provide basic installation, configuration, examples and usage instructions
34+
- global.css for styling components and using as utilities in the dependent
35+
- peerDependencies: @roxi/routify, material-components-web, svelte

README.md

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = {
4141
// ...
4242
```
4343

44-
### Components
44+
### components
4545
A list of all components (subcomponents and js files for interfacing in []) followed by their properties in ():
4646

4747
Button (disabled, outlined, raised, prependIcon, appendIcon, url)
@@ -69,7 +69,7 @@ List (twoLine, avatar) [
6969
]
7070

7171
Progress [
72-
Progress.Circular, Progress.Linear (indeterminate, value)
72+
Progress.Circular, Progress.Linear (indeterminate, value, barColorProvided)
7373
]
7474

7575
Select (options, width, disabled, selectedID)
@@ -90,7 +90,7 @@ Tooltip (tooltipID, positionX, positionY) [
9090
Tooltip.Wrapper (ariaDescribedBy)
9191
]
9292

93-
TopAppBar (dense, fixed, navIconBreakpointClass) [
93+
TopAppBar (dense, fixed, navIconBreakpointClass, bgColorIsVariant) [
9494
actions.js, title.js
9595
]
9696

@@ -110,29 +110,79 @@ StaticChip
110110

111111
Tour (steps, data)
112112

113-
### Importing Components
113+
### importing components
114114
After installation and bundler configuration all of the components are ready to be imported.
115115

116-
Here is an example of importing Button and Card:
116+
Just include `import { Button } from '@silintl/ui-components'` in your script section to import Button and any other components you want to use.
117117

118+
### examples
119+
Here is a demo app with examples of how to use components.
120+
https://github.com/hobbitronics/svelte-ui-components-app
121+
122+
It was buit from https://github.com/sveltejs/template
123+
124+
If you are building a single page app with routify then it is recommended to use this template https://github.com/roxiness/routify-starter
125+
126+
An example of using Button and Card:
118127
```
119128
<script>
120-
import { Button, Card } from 'ui-components'
129+
import { Button, Card } from '@silintl/ui-components'
130+
131+
// ...
121132
</script>
122133
123134
<Card class="mb-1">
124135
<p>This is a card.</p>
125136
126137
<span slot="actions">
127-
<Button on:click={doSomething} >Click here!</Button>
138+
<Button raised prependIcon="done" on:click={doSomething} >Click here!</Button>
128139
</span>
129140
</Card>
130141
```
131-
### Theming
132-
If you are using an MDC theme https://material.io/develop/web/docs/theming and typography https://material.io/develop/web/components/typography then import your _index.scss file to the App.svelte file so they get applied to the ui-components.
133142

134-
### Example template
135-
Here is a template with more examples of how to use components.
136-
https://github.com/hobbitronics/svelte-ui-components-app
143+
An example of using Drawer:
144+
```
145+
<script>
146+
import { actions, Drawer } from '@silintl/ui-components'
147+
// ...
148+
$: menuItems = [
149+
// ...
150+
{},
151+
{
152+
label: '--break--',
153+
},
154+
{},
155+
{
156+
url: 'https://silinternational.github.io/ui-components/index.html?path=/story/atoms-button--primary',
157+
label: 'see our components in storybook'
158+
}
159+
]
160+
161+
onMount(() => {
162+
//actions are for TopAppBar which Drawer uses as a child.
163+
$actions = [
164+
{
165+
icon: 'info_outline',
166+
label: 'action demo',
167+
onClick: () => alert('you clicked an action'),
168+
},
169+
]
170+
})
171+
</script>
172+
173+
<Drawer {menuItems} title={appName}>
174+
<span class="pointer" on:click={() => $goto('./someUrl')} slot="header">
175+
<img class="w-100" src="" alt="logo">
176+
</span>
177+
<slot />
178+
</Drawer>
179+
```
180+
181+
### storybook
182+
Try out our components at https://silinternational.github.io/ui-components/
183+
184+
### CSS utility classes
185+
Classes from [global.css](https://github.com/silinternational/ui-components/blob/develop/components/global.css) can be applied to all components and even components and elements from your app.
137186

138-
It was buit from https://github.com/sveltejs/template
187+
### theming
188+
If you are using an [MDC theme](https://material.io/develop/web/docs/theming) and [typography](https://material.io/develop/web/components/typography) then import your _index.scss file to the App.svelte file so they get applied to the ui-components.

components/mdc/Checkbox/Checkbox.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ onMount(() => {
3030
const handleChange = () => dispatch(checkbox.checked ? 'checked' : 'unchecked')
3131
</script>
3232

33-
<div class="mdc-form-field" bind:this={formFieldElement}>
33+
<div class="mdc-form-field {$$props.class}" bind:this={formFieldElement}>
3434
<div class="mdc-checkbox" bind:this={checkboxElement}>
3535
<input type="checkbox" {disabled} on:change={handleChange} class="mdc-checkbox__native-control" id={inputID} />
3636
<div class="mdc-checkbox__background">

components/mdc/Datatable/Datatable.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ onMount(() => {
2222
})
2323
</script>
2424

25-
<div class="mdc-data-table w-100" bind:this={element}>
25+
<div class="mdc-data-table w-100 {$$props.class}" bind:this={element}>
2626
<div class="mdc-data-table__table-container">
2727
<table class="mdc-data-table__table" aria-label={label}>
2828
<slot />

components/mdc/Dialog/Alert.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ onMount(() => {
4545

4646
<div class="mdc-dialog" bind:this={element}>
4747
<div class="mdc-dialog__container">
48-
<div class="mdc-dialog__surface"
48+
<div class="mdc-dialog__surface {$$props.class}"
4949
role="alertdialog"
5050
aria-modal="true"
5151
aria-labelledby="title"

components/mdc/Dialog/Simple.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const fromAction = s => JSON.parse(s)
3737

3838
<div class="mdc-dialog" bind:this={element}>
3939
<div class="mdc-dialog__container">
40-
<div class="mdc-dialog__surface" role="alertdialog" aria-modal="true" aria-labelledby="dialog-title" aria-describedby="dialog-content">
40+
<div class="mdc-dialog__surface {$$props.class}" role="alertdialog" aria-modal="true" aria-labelledby="dialog-title" aria-describedby="dialog-content">
4141
<!--(notes from docs) Title cannot contain leading whitespace due to mdc-typography-baseline-top() -->
4242
<h2 class="mdc-dialog__title" id="dialog-title">{title}</h2>
4343

components/mdc/Fab/Fab.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ onMount(() => {
2424
}
2525
</style>
2626

27-
<a class="mdc-fab" aria-label={label} bind:this={element} href={url}>
27+
<a class="mdc-fab {$$props.class}" aria-label={label} bind:this={element} href={url}>
2828
<div class="mdc-fab__ripple"></div>
2929
<span class="mdc-fab__icon material-icons">{icon}</span>
3030
</a>

components/mdc/List/List.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ul {
1919
}
2020
</style>
2121

22-
<ul class="mdc-list" class:mdc-list--two-line={twoLine}
22+
<ul class="mdc-list {$$props.class}" class:mdc-list--two-line={twoLine}
2323
class:mdc-list--avatar-list={avatar} bind:this={element}>
2424
<slot />
2525
</ul>

components/mdc/Progress/Linear.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { onMount } from 'svelte'
55
66
export let indeterminate = false
77
export let value = 0
8+
export let barColorProvided = true
89
910
let element = {}
1011
let mdcProgress
@@ -24,7 +25,7 @@ onMount(() => {
2425
<div class="mdc-linear-progress__buffer-bar"></div>
2526
<div class="mdc-linear-progress__buffer-dots"></div>
2627
</div>
27-
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar bar-color">
28+
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar" class:bar-color={barColorProvided}>
2829
<span class="mdc-linear-progress__bar-inner"></span>
2930
</div>
3031
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar">

components/mdc/Progress/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
@include linear-progress.core-styles;
55

66
.bar-color {
7-
@include linear-progress.bar-color(var(--sil-primary-blue));
7+
@include linear-progress.bar-color(var(--sil-primary-blue)); //TODO change variable name to something more generic, fallback to primary theme color?
88
}

0 commit comments

Comments
 (0)