Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7bc6ea4
Scrollbar implementation (#258)
stefashkaa Jul 21, 2021
e993ecf
fix storybook build scss (#260)
Nikita-Polyakov Jul 21, 2021
fc99cbd
Add an item in the installation instructions with the addition of ele…
Sociopacific Jul 21, 2021
78fa8fe
Merge pull request #262 from soramitsu/feature/add-element-ui-types-i…
Sociopacific Jul 21, 2021
055b7c4
Fix select arrow icon
Sociopacific Jul 22, 2021
2ee27db
Merge pull request #263 from soramitsu/fix/fix-select-arrow-icon
Sociopacific Jul 22, 2021
ca4dcaa
Improve build config (#264)
stefashkaa Jul 22, 2021
7825b3f
Fix customization page (#266)
stefashkaa Jul 22, 2021
269e3f7
Improve build config (#268)
stefashkaa Jul 26, 2021
263b952
Fix UI issues part 1 (#269)
stefashkaa Jul 27, 2021
48e4b4b
add style fixes for input button tabs (#270)
Nikita-Polyakov Jul 27, 2021
0f22278
Fix readme (#271)
stefashkaa Jul 28, 2021
c294da7
PW-239: Bridge Design Update (#273)
alexnatalia Jul 28, 2021
44b620f
Add dark theme (#275)
stefashkaa Aug 2, 2021
3505bfc
Fix theming issues (#276)
stefashkaa Aug 2, 2021
a76834d
Border Radiuses and Sizes Fixing (#272)
alexnatalia Aug 2, 2021
b8e7f20
Neumorphic switch in storybook (#278)
stefashkaa Aug 3, 2021
bef0ae8
update components styles (#280)
Nikita-Polyakov Aug 3, 2021
dcbe95f
Fixed button storybook typograhy behaviour. (#282)
alexnatalia Aug 4, 2021
1941c2f
Add switch theme function (#283)
stefashkaa Aug 4, 2021
28d81ab
fix action button (#285)
Nikita-Polyakov Aug 4, 2021
6ea8e2a
Fixed icons colors. (#287)
alexnatalia Aug 4, 2021
b395663
fix action button style (#289)
Nikita-Polyakov Aug 5, 2021
ddd273c
fix box-shadow (#292)
Nikita-Polyakov Aug 5, 2021
3f6afeb
Added tertiary SDivider type. (#291)
alexnatalia Aug 5, 2021
4615eca
Update UI Lib version. (#293)
alexnatalia Aug 5, 2021
8889d5e
Fix message box and dialog styles (#296)
stefashkaa Aug 5, 2021
ddf5bd4
add table empty-text color (#295)
Nikita-Polyakov Aug 6, 2021
9c54b55
Improve theme switch for storybook layouts (#298)
stefashkaa Aug 9, 2021
af52c27
tooltip close delay & hide after props (#300)
Nikita-Polyakov Aug 9, 2021
c1a8a0c
Fix dialog close state (#301)
stefashkaa Aug 10, 2021
dd0c0b6
Float input improvemens (#303)
Nikita-Polyakov Aug 10, 2021
e5526cc
Fix/buttons shadows (#305)
Nikita-Polyakov Aug 12, 2021
68f5c22
change styles for cart tabs & form item error input (#308)
Nikita-Polyakov Aug 12, 2021
cd1932b
PW-15: Image Lazy Loading (#306)
alexnatalia Aug 13, 2021
a764d63
Merge branch 'develop' into release/1.0.17
Aug 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@soramitsu/soramitsu-js-ui",
"version": "1.0.16",
"version": "1.0.17",
"private": false,
"publishConfig": {
"registry": "https://nexus.iroha.tech/repository/npm-soramitsu/"
Expand Down Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"core-js": "^3.6.4",
"element-resize-detector": "^1.2.1",
"element-ui": "^2.13.2",
"element-ui": "^2.15.5",
"lodash": "^4.17.15",
"throttle-debounce": "^1.0.1",
"v-jsoneditor": "^1.4.1",
Expand Down
75 changes: 75 additions & 0 deletions src/components/Image/SImage/SImage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<el-image
ref="image"
class="s-image"
:src="src"
:fit="fit"
:alt="alt"
:lazy="lazy"
:scroll-container="scrollContainer"
:z-ndex="zIndex"
>
<s-skeleton v-if="hasSkeleton" slot="placeholder" :animated="animated">
<template #template>
<s-skeleton-item :element="SkeletonItemElement.IMAGE" />
</template>
</s-skeleton>
</el-image>
</template>

<script lang="ts">
import { Vue, Component, Prop, Ref } from 'vue-property-decorator'
import ElImage from 'element-ui/lib/image'

import { SSkeleton, SSkeletonItem, SkeletonItemElement } from '../../Skeleton'
import { ImageFit } from '../consts'

@Component({
components: {
ElImage,
SSkeleton,
SSkeletonItem
}
})
export default class SImage extends Vue {
/**
* Image source, same as native, this is required property
*/
@Prop({ type: String, required: true }) readonly src!: string
/**
* Indicate how the image should be resized to fit its container, same as object-fit.
* Possible values are: `fill` / `contain` / `cover` / `none` / `scale-down`.
* Default value is ImageFit.NONE.
*/
@Prop({ default: ImageFit.NONE, type: String }) readonly fit!: string
/**
* Native alt
*/
@Prop({ default: '', type: String }) readonly alt!: string
/**
* Whether to use lazy load
*/
@Prop({ default: false, type: Boolean }) readonly lazy!: boolean
/**
* The container to add scroll listener when using lazy load.
* Posssible value is the nearest parent container whose overflow property is auto or scroll
*/
@Prop({ type: [String, HTMLElement] }) readonly scrollContainer!: string | HTMLElement
/**
* Set image preview z-index
*/
@Prop({ default: 0, type: Number }) readonly zIndex!: number
/**
* Whether image has skeleton
*/
@Prop({ default: true, type: Boolean }) readonly hasSkeleton!: boolean
/**
* Whether skeleton has animation
*/
@Prop({ default: true, type: Boolean }) readonly animated!: boolean

readonly SkeletonItemElement = SkeletonItemElement

@Ref('image') elImage!: any
}
</script>
11 changes: 11 additions & 0 deletions src/components/Image/SImage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Components, SFCWithInstall } from '../../../types/components'
import install from '../../../utils/install'

import _SImage from './SImage.vue'

const SImage = _SImage as SFCWithInstall<typeof _SImage>

SImage.install = install(Components.SImage, SImage)

export { SImage }
export default SImage
7 changes: 7 additions & 0 deletions src/components/Image/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export enum ImageFit {
FILL = 'fill',
CONTAIN = 'contain',
COVER = 'cover',
NONE = 'none',
SCALE_DOWN = 'scale-down'
}
2 changes: 2 additions & 0 deletions src/components/Image/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { SImage } from './SImage'
export { ImageFit } from './consts'
47 changes: 47 additions & 0 deletions src/components/Skeleton/SSkeleton/SSkeleton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<el-skeleton
class="s-skeleton"
:animated="animated"
:count="count"
:loading="loading"
:rows="rows"
:throttle="throttle"
>
<slot slot="template" name="template" />
<slot />
</el-skeleton>
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'
import ElSkeleton from 'element-ui/lib/skeleton'
import ElSkeletonItem from 'element-ui/lib/skeleton-item'

@Component({
components: { ElSkeleton, ElSkeletonItem }
})
export default class SSkeleton extends Vue {
/**
* Whether showing the animation, default value is false.
*/
@Prop({ default: false, type: Boolean }) readonly animated!: boolean
/**
* How many fake items to render in the DOM, should have integer value.
* Default value is 1.
*/
@Prop({ default: 1, type: Number }) readonly count!: number
/**
* Whether showing the skeleton
*/
@Prop({ default: true, type: Boolean }) readonly loading!: boolean
/**
* Numbers of the row, only useful when no template slot were given, should have integer value.
* Default value is 1.
*/
@Prop({ default: 4, type: Number }) readonly rows!: number
/**
* Rendering delay in millseconds, should have integer value. Default value is zero.
*/
@Prop({ default: 0, type: Number }) readonly throttle!: number
}
</script>
11 changes: 11 additions & 0 deletions src/components/Skeleton/SSkeleton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Components, SFCWithInstall } from '../../../types/components'
import install from '../../../utils/install'

import _SSkeleton from './SSkeleton.vue'

const SSkeleton = _SSkeleton as SFCWithInstall<typeof _SSkeleton>

SSkeleton.install = install(Components.SSkeleton, SSkeleton)

export { SSkeleton }
export default SSkeleton
22 changes: 22 additions & 0 deletions src/components/Skeleton/SSkeletonItem/SSkeletonItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<el-skeleton-item :variant="element" />
</template>

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'
import ElSkeletonItem from 'element-ui/lib/skeleton-item'

import { SkeletonItemElement } from '../consts'

@Component({
components: { ElSkeletonItem }
})
export default class SSkeletonItem extends Vue {
/**
* The current rendering skeleton type.
* Possible values are: `p` / `text` / `h1` / `h2` / `h3` / `text` / `caption` / `button` / `image` / `circle` / `rect`.
* Default value is SkeletonItemElement.TEXT.
*/
@Prop({ default: SkeletonItemElement.TEXT, type: String }) readonly element!: string
}
</script>
11 changes: 11 additions & 0 deletions src/components/Skeleton/SSkeletonItem/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Components, SFCWithInstall } from '../../../types/components'
import install from '../../../utils/install'

import _SSkeletonItem from './SSkeletonItem.vue'

const SSkeletonItem = _SSkeletonItem as SFCWithInstall<typeof _SSkeletonItem>

SSkeletonItem.install = install(Components.SSkeleton, SSkeletonItem)

export { SSkeletonItem }
export default SSkeletonItem
12 changes: 12 additions & 0 deletions src/components/Skeleton/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export enum SkeletonItemElement {
P = 'p',
TEXT = 'text',
H1 = 'h1',
H2 = 'h2',
H3 = 'h3',
CAPTION = 'caption',
BUTTON = 'button',
IMAGE = 'image',
CIRCLE = 'circle',
RECT = 'rect'
}
3 changes: 3 additions & 0 deletions src/components/Skeleton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { SSkeleton } from './SSkeleton'
export { SSkeletonItem } from './SSkeletonItem'
export { SkeletonItemElement } from './consts'
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export { SFooter } from './Layout/Footer'
export { SForm, SFormItem } from './Form'
export { SHeader } from './Layout/Header'
export { SIcon } from './Icon'
export { SImage } from './Image'
export { SInput, SFloatInput, SJsonInput } from './Input'
export { SMain } from './Layout/Main'
export { SMenu, SMenuItem, SMenuItemGroup, SSubmenu } from './Menu'
Expand All @@ -27,6 +28,7 @@ export { SRow } from './Layout/Row'
export { SScrollbar } from './Scrollbar'
export { SScrollSectionItem, SScrollSections } from './ScrollSections'
export { SSelect, SOption, SOptionGroup } from './Select'
export { SSkeleton, SSkeletonItem } from './Skeleton'
export { STab, STabs } from './Tab'
export { STable, SHierarchicalTable, STableColumn } from './Table'
export { STooltip } from './Tooltip'
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
SFormItem,
SHeader,
SIcon,
SImage,
SInput,
SFloatInput,
SJsonInput,
Expand All @@ -41,6 +42,8 @@ import {
SScrollSectionItem,
SScrollSections,
SSelect,
SSkeleton,
SSkeletonItem,
SSlider,
SSubmenu,
SSwitch,
Expand Down Expand Up @@ -92,6 +95,7 @@ const SoramitsuElements = {
vue.use(SFormItem)
vue.use(SHeader)
vue.use(SIcon)
vue.use(SImage)
vue.use(SInput)
vue.use(SFloatInput)
vue.use(SJsonInput)
Expand All @@ -109,6 +113,8 @@ const SoramitsuElements = {
vue.use(SScrollSectionItem)
vue.use(SScrollSections)
vue.use(SSelect)
vue.use(SSkeleton)
vue.use(SSkeletonItem)
vue.use(SSlider)
vue.use(SSubmenu)
vue.use(SSwitch)
Expand Down Expand Up @@ -162,6 +168,7 @@ export {
SFormItem,
SHeader,
SIcon,
SImage,
SInput,
SFloatInput,
SJsonInput,
Expand All @@ -179,6 +186,8 @@ export {
SScrollSectionItem,
SScrollSections,
SSelect,
SSkeleton,
SSkeletonItem,
SSlider,
SSubmenu,
SSwitch,
Expand Down
2 changes: 1 addition & 1 deletion src/stories/SButton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const loading = () => ({
:type="item.type"
:tooltip="item.tooltip"
:icon="item.icon"
:loading="true"
loading
>
{{ item.label }}
</s-button>
Expand Down
75 changes: 75 additions & 0 deletions src/stories/SImage.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { text, boolean, number, select, withKnobs } from '@storybook/addon-knobs'

import { SImage, ImageFit } from '../components/Image'

export default {
component: SImage,
title: 'Design System/Components/Image',
decorators: [withKnobs]
}

export const configurable = () => ({
components: { SImage },
template: `<s-image
:src="src"
:fit="fit"
:alt="alt"
:lazy="lazy"
:z-index="zIndex"
:has-skeleton="hasSkeleton"
:animated="animated"
style="height: 300px;"
/>`,
props: {
src: {
default: text('Src', 'https://picsum.photos/1024')
},
fit: {
default: select('Fit', Object.values(ImageFit), ImageFit.NONE)
},
lazy: {
default: boolean('Lazy', true)
},
alt: {
default: text('Alt', '')
},
zIndex: {
default: number('Z-index', 0)
},
hasSkeleton: {
default: boolean('Has Skeleton', true)
},
animated: {
default: boolean('Skeleton has Animation', true)
}
}
})

export const LazyImages = () => ({
components: { SImage },
template: `<div style="width: 100%; overflow-y: auto; height: 300px;">
<s-image :src="imageSrc + '?random=1'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=2'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=3'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=4'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=5'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=6'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=7'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=8'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=9'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=10'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=11'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=12'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=13'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=14'" lazy style="height: inherit;" />
<s-image :src="imageSrc + '?random=15'" lazy style="height: inherit;" />
</div>`,
data: () => ({
imageSrc: 'https://picsum.photos/1024/300'
})
})

export const FailedImage = () => ({
components: { SImage },
template: '<s-image src="\'\'" lazy style="height: 300px;" />'
})
Loading