mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
Align v10.37 (#697)
* chore(deps-dev): upgrade carbon-components to v10.27.1 * fix(toolbar-search): omit size prop * feat(progress-bar): add ProgressBar * refactor(text-input): use class directive * chore(deps-dev): rebuild yarn.lock * fix(notification): omit iconDescription from NotificationIcon #672 Fixes #672
This commit is contained in:
parent
2f5d01d0c0
commit
fb5c7553ac
19 changed files with 294 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
|||
# Component Index
|
||||
|
||||
> 167 components exported from carbon-components-svelte@0.36.0.
|
||||
> 168 components exported from carbon-components-svelte@0.36.0.
|
||||
|
||||
## Components
|
||||
|
||||
|
@ -99,6 +99,7 @@
|
|||
- [`PaginationSkeleton`](#paginationskeleton)
|
||||
- [`PasswordInput`](#passwordinput)
|
||||
- [`Popover`](#popover)
|
||||
- [`ProgressBar`](#progressbar)
|
||||
- [`ProgressIndicator`](#progressindicator)
|
||||
- [`ProgressIndicatorSkeleton`](#progressindicatorskeleton)
|
||||
- [`ProgressStep`](#progressstep)
|
||||
|
@ -2816,6 +2817,28 @@ None.
|
|||
| :------------ | :--------- | :----- |
|
||||
| click:outside | dispatched | -- |
|
||||
|
||||
## `ProgressBar`
|
||||
|
||||
### Props
|
||||
|
||||
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||
| :--------- | :--------------- | :------- | :------------------- | ------------------ | --------------------------------------------- |
|
||||
| value | <code>let</code> | No | <code>number</code> | -- | Specify the current value |
|
||||
| max | <code>let</code> | No | <code>number</code> | <code>100</code> | Specify the maximum value |
|
||||
| labelText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the label text |
|
||||
| hideLabel | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to visually hide the label text |
|
||||
| helperText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the helper text |
|
||||
|
||||
### Slots
|
||||
|
||||
| Slot name | Default | Props | Fallback |
|
||||
| :-------- | :------ | :---- | :----------------------- |
|
||||
| labelText | No | -- | <code>{labelText}</code> |
|
||||
|
||||
### Events
|
||||
|
||||
None.
|
||||
|
||||
## `ProgressIndicator`
|
||||
|
||||
### Props
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"devDependencies": {
|
||||
"@sveltech/routify": "^1.9.9",
|
||||
"autoprefixer": "^10.2.3",
|
||||
"carbon-components": "10.36.0",
|
||||
"carbon-components": "10.37.0",
|
||||
"carbon-components-svelte": "../",
|
||||
"mdsvex": "^0.8.8",
|
||||
"npm-run-all": "^4.1.5",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"total": 167,
|
||||
"total": 168,
|
||||
"components": [
|
||||
{
|
||||
"moduleName": "Accordion",
|
||||
|
@ -7302,6 +7302,72 @@
|
|||
"typedefs": [],
|
||||
"rest_props": { "type": "Element", "name": "div" }
|
||||
},
|
||||
{
|
||||
"moduleName": "ProgressBar",
|
||||
"filePath": "src/ProgressBar/ProgressBar.svelte",
|
||||
"props": [
|
||||
{
|
||||
"name": "value",
|
||||
"kind": "let",
|
||||
"description": "Specify the current value",
|
||||
"type": "number",
|
||||
"isFunction": false,
|
||||
"constant": false,
|
||||
"reactive": false
|
||||
},
|
||||
{
|
||||
"name": "max",
|
||||
"kind": "let",
|
||||
"description": "Specify the maximum value",
|
||||
"type": "number",
|
||||
"value": "100",
|
||||
"isFunction": false,
|
||||
"constant": false,
|
||||
"reactive": false
|
||||
},
|
||||
{
|
||||
"name": "labelText",
|
||||
"kind": "let",
|
||||
"description": "Specify the label text",
|
||||
"type": "string",
|
||||
"value": "\"\"",
|
||||
"isFunction": false,
|
||||
"constant": false,
|
||||
"reactive": false
|
||||
},
|
||||
{
|
||||
"name": "hideLabel",
|
||||
"kind": "let",
|
||||
"description": "Set to `true` to visually hide the label text",
|
||||
"type": "boolean",
|
||||
"value": "false",
|
||||
"isFunction": false,
|
||||
"constant": false,
|
||||
"reactive": false
|
||||
},
|
||||
{
|
||||
"name": "helperText",
|
||||
"kind": "let",
|
||||
"description": "Specify the helper text",
|
||||
"type": "string",
|
||||
"value": "\"\"",
|
||||
"isFunction": false,
|
||||
"constant": false,
|
||||
"reactive": false
|
||||
}
|
||||
],
|
||||
"slots": [
|
||||
{
|
||||
"name": "labelText",
|
||||
"default": false,
|
||||
"fallback": "{labelText}",
|
||||
"slot_props": "{}"
|
||||
}
|
||||
],
|
||||
"events": [],
|
||||
"typedefs": [],
|
||||
"rest_props": { "type": "Element", "name": "div" }
|
||||
},
|
||||
{
|
||||
"moduleName": "ProgressIndicator",
|
||||
"filePath": "src/ProgressIndicator/ProgressIndicator.svelte",
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import Footer from "../components/Footer.svelte";
|
||||
|
||||
const deprecated = ["ToggleSmall", "Icon"];
|
||||
const new_components = ["Popover", "ContextMenu"];
|
||||
const new_components = ["ProgressBar"];
|
||||
|
||||
let isOpen = false;
|
||||
let isSideNavOpen = true;
|
||||
|
|
24
docs/src/pages/components/ProgressBar.svx
Normal file
24
docs/src/pages/components/ProgressBar.svx
Normal file
|
@ -0,0 +1,24 @@
|
|||
<script>
|
||||
import { ProgressBar } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
||||
### Default
|
||||
|
||||
Without a specified `value` prop, the progress bar is indeterminate.
|
||||
|
||||
<ProgressBar helperText="Loading..." />
|
||||
|
||||
### Percentage
|
||||
|
||||
<ProgressBar value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
||||
|
||||
### Custom max value
|
||||
|
||||
The default `max` value is `100`.
|
||||
|
||||
<ProgressBar value={40} max={200} labelText="Upload status" helperText="40 MB of 200 MB" />
|
||||
|
||||
### Hidden label
|
||||
|
||||
<ProgressBar hideLabel value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
|
36
docs/src/pages/framed/ProgressBar/ProgressBarUx.svelte
Normal file
36
docs/src/pages/framed/ProgressBar/ProgressBarUx.svelte
Normal file
|
@ -0,0 +1,36 @@
|
|||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { ProgressBar } from "carbon-components-svelte";
|
||||
|
||||
let max = 328;
|
||||
let value = 0;
|
||||
let timer = undefined;
|
||||
|
||||
onMount(() => {
|
||||
timer = setTimeout(() => {
|
||||
const interval = setInterval(() => {
|
||||
const delta = Math.random() * 10;
|
||||
|
||||
if (value + delta < max) {
|
||||
value += delta;
|
||||
} else {
|
||||
value = max;
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 20);
|
||||
}, 2000);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
});
|
||||
|
||||
$: helperText =
|
||||
value > 0 ? `${value.toFixed(0)}MB of ${max}MB` : "Preparing upload...";
|
||||
$: if (value === max) helperText = "Done";
|
||||
</script>
|
||||
|
||||
<ProgressBar
|
||||
labelText="Upload status"
|
||||
value="{value}"
|
||||
max="{max}"
|
||||
helperText="{helperText}"
|
||||
/>
|
|
@ -837,16 +837,16 @@ caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001178:
|
|||
integrity sha512-n8JVqXuZMVSPKiPiypjFtDTXc4jWIdjxull0f92WLo7e1MSi3uJ3NvveakSh/aCl1QKFAvIz3vIj0v+0K+FrXw==
|
||||
|
||||
carbon-components-svelte@../:
|
||||
version "0.35.0"
|
||||
version "0.36.0"
|
||||
dependencies:
|
||||
carbon-icons-svelte "^10.27.0"
|
||||
clipboard-copy "3.2.0"
|
||||
flatpickr "4.6.9"
|
||||
|
||||
carbon-components@10.36.0:
|
||||
version "10.36.0"
|
||||
resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.36.0.tgz#ce523b19df3a404e379113dafbbe0219bb22b17f"
|
||||
integrity sha512-k+UR+Whz/qXbev2RT9JjV+QbkSKcHrLNF25bEpr3KZHmpCGhwGz5mVyv0ohZ4B6rKkpuvlgYfLsANL0yQX77zA==
|
||||
carbon-components@10.37.0:
|
||||
version "10.37.0"
|
||||
resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.37.0.tgz#bc53138151ea58e79f5b249b1ec5be8ae2c0a7e4"
|
||||
integrity sha512-LHReeqzzieP/q/xAHfKJNWLdWhOkr7+DIVZkrQGPf6kZYj5H8tb1KYKOIhasvCNRxJ2es8QJXuH7XW0JoLDfdQ==
|
||||
dependencies:
|
||||
"@carbon/telemetry" "0.0.0-alpha.6"
|
||||
flatpickr "4.6.1"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"@rollup/plugin-node-resolve": "^11.1.1",
|
||||
"@tsconfig/svelte": "^1.0.10",
|
||||
"autoprefixer": "^10.2.4",
|
||||
"carbon-components": "10.36.0",
|
||||
"carbon-components": "10.37.0",
|
||||
"gh-pages": "^3.1.0",
|
||||
"husky": "^4.3.8",
|
||||
"lint-staged": "^10.5.3",
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
</script>
|
||||
|
||||
<Search
|
||||
size="sm"
|
||||
tabindex="{tabindex}"
|
||||
disabled="{disabled}"
|
||||
{...$$restProps}
|
||||
|
|
|
@ -76,11 +76,7 @@
|
|||
on:mouseleave
|
||||
>
|
||||
<div class:bx--inline-notification__details="{true}">
|
||||
<NotificationIcon
|
||||
notificationType="inline"
|
||||
kind="{kind}"
|
||||
iconDescription="{iconDescription}"
|
||||
/>
|
||||
<NotificationIcon notificationType="inline" kind="{kind}" />
|
||||
<NotificationTextDetails
|
||||
title="{title}"
|
||||
subtitle="{subtitle}"
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
on:mouseenter
|
||||
on:mouseleave
|
||||
>
|
||||
<NotificationIcon kind="{kind}" iconDescription="{iconDescription}" />
|
||||
<NotificationIcon kind="{kind}" />
|
||||
<NotificationTextDetails
|
||||
title="{title}"
|
||||
subtitle="{subtitle}"
|
||||
|
|
60
src/ProgressBar/ProgressBar.svelte
Normal file
60
src/ProgressBar/ProgressBar.svelte
Normal file
|
@ -0,0 +1,60 @@
|
|||
<script>
|
||||
/**
|
||||
* Specify the current value
|
||||
* @type {number}
|
||||
*/
|
||||
export let value = undefined;
|
||||
|
||||
/** Specify the maximum value */
|
||||
export let max = 100;
|
||||
|
||||
/** Specify the label text */
|
||||
export let labelText = "";
|
||||
|
||||
/** Set to `true` to visually hide the label text */
|
||||
export let hideLabel = false;
|
||||
|
||||
/** Specify the helper text */
|
||||
export let helperText = "";
|
||||
|
||||
let id = "ccs-" + Math.random().toString(36);
|
||||
let helperId = "ccs-" + Math.random().toString(36);
|
||||
|
||||
$: indeterminate = value === undefined;
|
||||
$: capped = value > max ? max : value < 0 ? 0 : value;
|
||||
</script>
|
||||
|
||||
<div
|
||||
class:bx--progress-bar="{true}"
|
||||
class:bx--progress-bar--indeterminate="{indeterminate}"
|
||||
{...$$restProps}
|
||||
>
|
||||
<label
|
||||
for="{id}"
|
||||
class:bx--progress-bar__label="{true}"
|
||||
class:bx--visually-hidden="{hideLabel}"
|
||||
>
|
||||
<slot name="labelText">
|
||||
{labelText}
|
||||
</slot>
|
||||
</label>
|
||||
<div
|
||||
role="progressbar"
|
||||
id="{id}"
|
||||
class:bx--progress-bar__track="{true}"
|
||||
aria-valuemin="{indeterminate ? undefined : 0}"
|
||||
aria-valuemax="{indeterminate ? undefined : max}"
|
||||
aria-valuenow="{indeterminate ? undefined : capped}"
|
||||
aria-describedby="{helperText ? helperId : null}"
|
||||
>
|
||||
<div
|
||||
class:bx--progress-bar__bar="{true}"
|
||||
style="transform: scaleX({capped / max})"
|
||||
></div>
|
||||
</div>
|
||||
{#if helperText}
|
||||
<div id="{helperId}" class:bx--progress-bar__helper-text="{true}">
|
||||
{helperText}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
1
src/ProgressBar/index.js
Normal file
1
src/ProgressBar/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export { default as ProgressBar } from "./ProgressBar.svelte";
|
|
@ -83,7 +83,7 @@
|
|||
on:mouseleave
|
||||
>
|
||||
{#if inline}
|
||||
<div class="bx--text-input__label-helper-wrapper">
|
||||
<div class:bx--text-input__label-helper-wrapper="{true}">
|
||||
{#if labelText}
|
||||
<label
|
||||
for="{id}"
|
||||
|
|
|
@ -85,6 +85,7 @@ export { OverflowMenu, OverflowMenuItem } from "./OverflowMenu";
|
|||
export { Pagination, PaginationSkeleton } from "./Pagination";
|
||||
export { PaginationNav } from "./PaginationNav";
|
||||
export { Popover } from "./Popover";
|
||||
export { ProgressBar } from "./ProgressBar";
|
||||
export {
|
||||
ProgressIndicator,
|
||||
ProgressIndicatorSkeleton,
|
||||
|
|
25
tests/ProgressBar.test.svelte
Normal file
25
tests/ProgressBar.test.svelte
Normal file
|
@ -0,0 +1,25 @@
|
|||
<script>
|
||||
import { ProgressBar } from "../types";
|
||||
</script>
|
||||
|
||||
<ProgressBar helperText="Loading..." />
|
||||
|
||||
<ProgressBar
|
||||
value="{40}"
|
||||
labelText="Upload status"
|
||||
helperText="40 MB of 100 MB"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
value="{40}"
|
||||
max="{200}"
|
||||
labelText="Upload status"
|
||||
helperText="40 MB of 100 MB"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
hideLabel
|
||||
value="{40}"
|
||||
labelText="Upload status"
|
||||
helperText="40 MB of 100 MB"
|
||||
/>
|
40
types/ProgressBar/ProgressBar.d.ts
vendored
Normal file
40
types/ProgressBar/ProgressBar.d.ts
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
/// <reference types="svelte" />
|
||||
import { SvelteComponentTyped } from "svelte";
|
||||
|
||||
export interface ProgressBarProps
|
||||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
||||
/**
|
||||
* Specify the current value
|
||||
*/
|
||||
value?: number;
|
||||
|
||||
/**
|
||||
* Specify the maximum value
|
||||
* @default 100
|
||||
*/
|
||||
max?: number;
|
||||
|
||||
/**
|
||||
* Specify the label text
|
||||
* @default ""
|
||||
*/
|
||||
labelText?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to visually hide the label text
|
||||
* @default false
|
||||
*/
|
||||
hideLabel?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the helper text
|
||||
* @default ""
|
||||
*/
|
||||
helperText?: string;
|
||||
}
|
||||
|
||||
export default class ProgressBar extends SvelteComponentTyped<
|
||||
ProgressBarProps,
|
||||
{},
|
||||
{ labelText: {} }
|
||||
> {}
|
1
types/index.d.ts
vendored
1
types/index.d.ts
vendored
|
@ -92,6 +92,7 @@ export { default as Pagination } from "./Pagination/Pagination";
|
|||
export { default as PaginationSkeleton } from "./Pagination/PaginationSkeleton";
|
||||
export { default as PaginationNav } from "./PaginationNav/PaginationNav";
|
||||
export { default as Popover } from "./Popover/Popover";
|
||||
export { default as ProgressBar } from "./ProgressBar/ProgressBar";
|
||||
export { default as ProgressIndicator } from "./ProgressIndicator/ProgressIndicator";
|
||||
export { default as ProgressIndicatorSkeleton } from "./ProgressIndicator/ProgressIndicatorSkeleton";
|
||||
export { default as ProgressStep } from "./ProgressIndicator/ProgressStep";
|
||||
|
|
|
@ -453,10 +453,10 @@ caniuse-lite@^1.0.30001181:
|
|||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001183.tgz#7a57ba9d6584119bb5f2bc76d3cc47ba9356b3e2"
|
||||
integrity sha512-7JkwTEE1hlRKETbCFd8HDZeLiQIUcl8rC6JgNjvHCNaxOeNmQ9V4LvQXRUsKIV2CC73qKxljwVhToaA3kLRqTw==
|
||||
|
||||
carbon-components@10.36.0:
|
||||
version "10.36.0"
|
||||
resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.36.0.tgz#ce523b19df3a404e379113dafbbe0219bb22b17f"
|
||||
integrity sha512-k+UR+Whz/qXbev2RT9JjV+QbkSKcHrLNF25bEpr3KZHmpCGhwGz5mVyv0ohZ4B6rKkpuvlgYfLsANL0yQX77zA==
|
||||
carbon-components@10.37.0:
|
||||
version "10.37.0"
|
||||
resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.37.0.tgz#bc53138151ea58e79f5b249b1ec5be8ae2c0a7e4"
|
||||
integrity sha512-LHReeqzzieP/q/xAHfKJNWLdWhOkr7+DIVZkrQGPf6kZYj5H8tb1KYKOIhasvCNRxJ2es8QJXuH7XW0JoLDfdQ==
|
||||
dependencies:
|
||||
"@carbon/telemetry" "0.0.0-alpha.6"
|
||||
flatpickr "4.6.1"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue