carbon-components-svelte/CONTRIBUTING.md
Eric Liu f2a3f8d2e1
Alignment with Carbon version 10.27 (#495)
* chore(deps-dev): bump devDependencies

* docs: update number of available carbon icons

* feat(notification): distinguish dispatched close event between click/timeout

* fix(notification): prevent class from being overriden by $$restProps

* docs(notification): improve example body copy

* fix(notification): remove notificationType prop

* refactor(notification): resolve svelte file in imports

* fix(notification): prevent class from being overridden by $$restProps

* feat(notification): update TS signature for dispatched close event

* docs: update contributing

* fix(loading): adjust spinner styles

* feat(tag): support custom icon variant

* feat(tile): add optional expand/collapse icon labels to ExpandableTile

* feat(code-snippet): support disabled state for single and multi-line types

* fix(code-snippet): remove impossible class directive

* fix(code-snippet): showMoreLess button size should be "field", not "small"

* fix(password-input): disable visibility button

- set default values for tooltipAlignment, tooltipPosition

* fix(text-input): add missing warning field wrapper class

* feat(button): infer hasIconOnly using $$slots API

- requires Svelte version >=3.25

* docs(button): add danger tertiary, icon-only example

* feat(button): set default values for tooltip alignment, position

* docs: document dynamic theming

* fix(modal): correctly set class props #482

* fix(form): forward submit event in FluidForm #487

* feat(dropdown): support warning state

* feat(multi-select): support warning state

* fix(multi-select): prevent dropdown from opening if disabled

* feat(number-input): support warning state

* chore(deps-dev): upgrade devDependencies

* docs:  bump @carbon/themes, carbon-components

* refactor(data-table): co-locate DataTableSkeleton with DataTable

* docs: update number of pictograms

* fix(password-input): add missing "bx--btn" class to visibility toggle

* docs: increase z-index for component preview
2021-01-27 13:29:20 -08:00

3.5 KiB

Contributing

Before submitting a pull request (PR), consider filing an issue to gain clarity and direction.

Prerequisites

Project set-up

Fork the repo and clone your fork:

git clone <YOUR_FORK>
cd carbon-components-svelte

Set the original repository as the upstream:

git remote add upstream git@github.com:IBM/carbon-components-svelte.git
# verify that the upstream is added
git remote -v

Install

Install the project dependencies:

# carbon-components-svelte/
yarn install

Documentation set-up

Component documentation is located in the docs folder. The website is built using svite, routify, and MDsveX. You will need to create a symbolic project link in order to see live changes reflected when developing locally.

First, create a symbolic link at the root of the project folder:

# carbon-components-svelte/
yarn link

Go into the docs folder:

cd docs

Link "carbon-components-svelte":

yarn link "carbon-components-svelte"
yarn install

If linked correctly, any change to a component in the src folder should be reflected in the docs site.


Development workflow

Create a topic branch from master. Keep your PR focused and branch up-to-date with upstream master.

git checkout -b new-feature

Preview changes to components from the src folder in the documentation website located in docs/.

In the docs folder, run:

yarn dev

The site should be served at http://localhost:3000/ (or the next available port).

Component Format

Each component should adopt the following structure:

src/Component

└───Component.svelte // main component
└───ComponentSkeleton.svelte // Skeleton component (if applicable)
└───index.js // export components

Editing a component

If adding or editing an exported component prop, be sure to annotate its value using JSDoc conventions.

/**
 * Specify the size of the component
 * @type {"sm" | "default" | "lg"}
 */
export let size = "default";

Creating a component

First, submit an issue.

If creating a new component, don't forget it from src/index.js:

export { CopyButton } from "./CopyButton";
export { ComboBox } from "./ComboBox";
+ export { FixedComboBox } from "./FixedComboBox";
export {
  ComposedModal,
  ModalHeader,
  ModalBody,
  ModalFooter,
} from "./ComposedModal";

Build

Verify that you can build the library by running the following command at the project root:

# carbon-components-svelte/
yarn prepack

This does several things:

  • uses node-sass to pre-compile CSS StyleSheets in the css folder
  • uses Rollup to bundle the Svelte components in src in ESM/UMD formats; emitted to lib
  • uses a Rollup plugin to:
    • generate component documentation in Markdown format (COMPONENT_INDEX.md)
    • generate TypeScript definitions (types/index.d.ts)

Submit a Pull Request

Sync Your Fork

Before submitting a pull request, make sure your fork is up to date with the latest upstream changes.

git fetch upstream
git checkout master
git merge upstream/master

Submit a PR

After you've pushed your changes to remote, submit your PR. Make sure you are comparing <YOUR_USER_ID>/feature to origin/master.