-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/labeled-field
- Loading branch information
Showing
144 changed files
with
1,237 additions
and
4,374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"commit": true, | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
|
@@ -10,4 +10,4 @@ | |
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { | ||
"updateInternalDependents": "always" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as React from "react"; | ||
import {Meta, Story, Canvas} from "@storybook/blocks"; | ||
import * as IdStories from "./id.stories"; | ||
|
||
<Meta of={IdStories} /> | ||
|
||
# Id | ||
|
||
`Id` is a component that provides an identifier to its children. | ||
|
||
It is useful for situations where the `useId` hook cannot be easily used, | ||
such as in class-based components. | ||
|
||
If an `id` prop is provided, that is passed through to the children; | ||
otherwise, a unique identifier is generated. | ||
|
||
## Usage | ||
|
||
```tsx | ||
import {Id} from "@khanacademy/wonder-blocks-core"; | ||
|
||
<Id id={maybeId}>{(id) => <div id={id}>Hello, world!</div>}</Id>; | ||
``` | ||
|
||
## Examples | ||
|
||
### 1. Generating an id | ||
|
||
An identifier will always be generated if an `id` prop is not provided, or the | ||
provided `id` property is falsy. | ||
|
||
<Canvas withSource="open" of={IdStories.GeneratedIdExample} /> | ||
|
||
### 2. Passthrough an id | ||
|
||
If an `id` prop is provided and it is truthy, that value will be passed through | ||
to the children. | ||
|
||
<Canvas sourceState="shown" of={IdStories.PassedThroughIdExample} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as React from "react"; | ||
|
||
import {Meta} from "@storybook/react"; | ||
import {View, Id} from "@khanacademy/wonder-blocks-core"; | ||
import {Body, BodyMonospace} from "@khanacademy/wonder-blocks-typography"; | ||
import {Strut} from "@khanacademy/wonder-blocks-layout"; | ||
import {spacing} from "@khanacademy/wonder-blocks-tokens"; | ||
|
||
export default { | ||
title: "Packages / Core / Id", | ||
|
||
parameters: { | ||
chromatic: { | ||
// We don't need a snapshot for this. | ||
disableSnapshot: true, | ||
}, | ||
}, | ||
} as Meta; | ||
|
||
export const GeneratedIdExample = () => ( | ||
<View> | ||
<Id> | ||
{(id) => ( | ||
<View style={{flexDirection: "row"}}> | ||
<Body>Generated identifier: </Body> | ||
<Strut size={spacing.xSmall_8} /> | ||
<BodyMonospace>{id}</BodyMonospace> | ||
</View> | ||
)} | ||
</Id> | ||
</View> | ||
); | ||
|
||
export const PassedThroughIdExample = () => ( | ||
<View> | ||
<Id id="my-identifier"> | ||
{(id) => ( | ||
<View style={{flexDirection: "row"}}> | ||
<Body>Passed through identifier: </Body> | ||
<Strut size={spacing.xSmall_8} /> | ||
<BodyMonospace>{id}</BodyMonospace> | ||
</View> | ||
)} | ||
</Id> | ||
</View> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 0 additions & 140 deletions
140
__docs__/wonder-blocks-i18n/i18n-inline-markup.stories.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.