@wordpress/ui 0.6.1-next.v.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +9 -0
- package/CHANGELOG.md +32 -1
- package/CLAUDE.md +1 -0
- package/README.md +13 -12
- package/build/badge/badge.cjs +37 -62
- package/build/badge/badge.cjs.map +4 -4
- package/build/button/button.cjs +3 -3
- package/build/button/button.cjs.map +2 -2
- package/build/dialog/action.cjs +46 -0
- package/build/dialog/action.cjs.map +7 -0
- package/build/dialog/close-icon.cjs +57 -0
- package/build/dialog/close-icon.cjs.map +7 -0
- package/build/dialog/context.cjs +76 -0
- package/build/dialog/context.cjs.map +7 -0
- package/build/dialog/footer.cjs +64 -0
- package/build/dialog/footer.cjs.map +7 -0
- package/build/dialog/header.cjs +64 -0
- package/build/dialog/header.cjs.map +7 -0
- package/build/dialog/index.cjs +52 -0
- package/build/dialog/index.cjs.map +7 -0
- package/build/dialog/popup.cjs +77 -0
- package/build/dialog/popup.cjs.map +7 -0
- package/build/dialog/root.cjs +35 -0
- package/build/dialog/root.cjs.map +7 -0
- package/build/dialog/title.cjs +76 -0
- package/build/dialog/title.cjs.map +7 -0
- package/build/dialog/trigger.cjs +38 -0
- package/build/dialog/trigger.cjs.map +7 -0
- package/build/dialog/types.cjs +19 -0
- package/build/dialog/types.cjs.map +7 -0
- package/build/form/primitives/field/root.cjs +1 -1
- package/build/form/primitives/field/root.cjs.map +1 -1
- package/build/form/primitives/fieldset/root.cjs +3 -3
- package/build/form/primitives/fieldset/root.cjs.map +2 -2
- package/build/form/primitives/index.cjs +5 -2
- package/build/form/primitives/index.cjs.map +2 -2
- package/build/form/primitives/input-layout/input-layout.cjs +3 -3
- package/build/form/primitives/input-layout/input-layout.cjs.map +2 -2
- package/build/form/primitives/input-layout/slot.cjs +3 -3
- package/build/form/primitives/input-layout/slot.cjs.map +2 -2
- package/build/form/primitives/select/item.cjs +3 -3
- package/build/form/primitives/select/item.cjs.map +2 -2
- package/build/form/primitives/select/popup.cjs +3 -3
- package/build/form/primitives/select/popup.cjs.map +2 -2
- package/build/form/primitives/select/trigger.cjs +3 -3
- package/build/form/primitives/select/trigger.cjs.map +2 -2
- package/build/{box → form/primitives/textarea}/index.cjs +7 -7
- package/build/form/primitives/textarea/index.cjs.map +7 -0
- package/build/form/primitives/textarea/textarea.cjs +90 -0
- package/build/form/primitives/textarea/textarea.cjs.map +7 -0
- package/build/form/primitives/textarea/types.cjs +19 -0
- package/build/form/primitives/textarea/types.cjs.map +7 -0
- package/build/icon-button/icon-button.cjs +104 -0
- package/build/icon-button/icon-button.cjs.map +7 -0
- package/build/icon-button/index.cjs +31 -0
- package/build/icon-button/index.cjs.map +7 -0
- package/build/icon-button/types.cjs +19 -0
- package/build/icon-button/types.cjs.map +7 -0
- package/build/index.cjs +8 -2
- package/build/index.cjs.map +2 -2
- package/build/tabs/index.cjs +40 -0
- package/build/tabs/index.cjs.map +7 -0
- package/build/tabs/list.cjs +145 -0
- package/build/tabs/list.cjs.map +7 -0
- package/build/tabs/panel.cjs +67 -0
- package/build/tabs/panel.cjs.map +7 -0
- package/build/tabs/root.cjs +38 -0
- package/build/tabs/root.cjs.map +7 -0
- package/build/tabs/tab.cjs +71 -0
- package/build/tabs/tab.cjs.map +7 -0
- package/build/{box → tabs}/types.cjs +1 -1
- package/build/tabs/types.cjs.map +7 -0
- package/build/tooltip/popup.cjs +3 -3
- package/build/tooltip/popup.cjs.map +2 -2
- package/build-module/badge/badge.mjs +27 -62
- package/build-module/badge/badge.mjs.map +3 -3
- package/build-module/button/button.mjs +3 -3
- package/build-module/button/button.mjs.map +2 -2
- package/build-module/dialog/action.mjs +21 -0
- package/build-module/dialog/action.mjs.map +7 -0
- package/build-module/dialog/close-icon.mjs +32 -0
- package/build-module/dialog/close-icon.mjs.map +7 -0
- package/build-module/dialog/context.mjs +57 -0
- package/build-module/dialog/context.mjs.map +7 -0
- package/build-module/dialog/footer.mjs +29 -0
- package/build-module/dialog/footer.mjs.map +7 -0
- package/build-module/dialog/header.mjs +29 -0
- package/build-module/dialog/header.mjs.map +7 -0
- package/build-module/dialog/index.mjs +20 -0
- package/build-module/dialog/index.mjs.map +7 -0
- package/build-module/dialog/popup.mjs +44 -0
- package/build-module/dialog/popup.mjs.map +7 -0
- package/build-module/dialog/root.mjs +10 -0
- package/build-module/dialog/root.mjs.map +7 -0
- package/build-module/dialog/title.mjs +41 -0
- package/build-module/dialog/title.mjs.map +7 -0
- package/build-module/dialog/trigger.mjs +13 -0
- package/build-module/dialog/trigger.mjs.map +7 -0
- package/build-module/form/primitives/field/root.mjs +1 -1
- package/build-module/form/primitives/field/root.mjs.map +1 -1
- package/build-module/form/primitives/fieldset/root.mjs +3 -3
- package/build-module/form/primitives/fieldset/root.mjs.map +2 -2
- package/build-module/form/primitives/index.mjs +3 -1
- package/build-module/form/primitives/index.mjs.map +2 -2
- package/build-module/form/primitives/input-layout/input-layout.mjs +3 -3
- package/build-module/form/primitives/input-layout/input-layout.mjs.map +2 -2
- package/build-module/form/primitives/input-layout/slot.mjs +3 -3
- package/build-module/form/primitives/input-layout/slot.mjs.map +2 -2
- package/build-module/form/primitives/select/item.mjs +3 -3
- package/build-module/form/primitives/select/item.mjs.map +2 -2
- package/build-module/form/primitives/select/popup.mjs +3 -3
- package/build-module/form/primitives/select/popup.mjs.map +2 -2
- package/build-module/form/primitives/select/trigger.mjs +3 -3
- package/build-module/form/primitives/select/trigger.mjs.map +2 -2
- package/build-module/form/primitives/textarea/index.mjs +6 -0
- package/build-module/form/primitives/textarea/index.mjs.map +7 -0
- package/build-module/form/primitives/textarea/textarea.mjs +55 -0
- package/build-module/form/primitives/textarea/textarea.mjs.map +7 -0
- package/build-module/form/primitives/textarea/types.mjs +1 -0
- package/build-module/form/primitives/textarea/types.mjs.map +7 -0
- package/build-module/icon-button/icon-button.mjs +69 -0
- package/build-module/icon-button/icon-button.mjs.map +7 -0
- package/build-module/icon-button/index.mjs +6 -0
- package/build-module/icon-button/index.mjs.map +7 -0
- package/build-module/icon-button/types.mjs +1 -0
- package/build-module/icon-button/types.mjs.map +7 -0
- package/build-module/index.mjs +5 -1
- package/build-module/index.mjs.map +2 -2
- package/build-module/tabs/index.mjs +12 -0
- package/build-module/tabs/index.mjs.map +7 -0
- package/build-module/tabs/list.mjs +110 -0
- package/build-module/tabs/list.mjs.map +7 -0
- package/build-module/tabs/panel.mjs +32 -0
- package/build-module/tabs/panel.mjs.map +7 -0
- package/build-module/tabs/root.mjs +13 -0
- package/build-module/tabs/root.mjs.map +7 -0
- package/build-module/tabs/tab.mjs +36 -0
- package/build-module/tabs/tab.mjs.map +7 -0
- package/build-module/tabs/types.mjs +1 -0
- package/build-module/tabs/types.mjs.map +7 -0
- package/build-module/tooltip/popup.mjs +3 -3
- package/build-module/tooltip/popup.mjs.map +2 -2
- package/build-types/badge/badge.d.ts +1 -2
- package/build-types/badge/badge.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +1 -2
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/dialog/action.d.ts +8 -0
- package/build-types/dialog/action.d.ts.map +1 -0
- package/build-types/dialog/close-icon.d.ts +8 -0
- package/build-types/dialog/close-icon.d.ts.map +1 -0
- package/build-types/dialog/context.d.ts +25 -0
- package/build-types/dialog/context.d.ts.map +1 -0
- package/build-types/dialog/footer.d.ts +8 -0
- package/build-types/dialog/footer.d.ts.map +1 -0
- package/build-types/dialog/header.d.ts +8 -0
- package/build-types/dialog/header.d.ts.map +1 -0
- package/build-types/dialog/index.d.ts +10 -0
- package/build-types/dialog/index.d.ts.map +1 -0
- package/build-types/dialog/popup.d.ts +8 -0
- package/build-types/dialog/popup.d.ts.map +1 -0
- package/build-types/dialog/root.d.ts +10 -0
- package/build-types/dialog/root.d.ts.map +1 -0
- package/build-types/dialog/stories/index.story.d.ts +18 -0
- package/build-types/dialog/stories/index.story.d.ts.map +1 -0
- package/build-types/dialog/test/index.test.d.ts +2 -0
- package/build-types/dialog/test/index.test.d.ts.map +1 -0
- package/build-types/dialog/title.d.ts +12 -0
- package/build-types/dialog/title.d.ts.map +1 -0
- package/build-types/dialog/trigger.d.ts +7 -0
- package/build-types/dialog/trigger.d.ts.map +1 -0
- package/build-types/dialog/types.d.ts +77 -0
- package/build-types/dialog/types.d.ts.map +1 -0
- package/build-types/form/primitives/field/stories/index.story.d.ts +0 -1
- package/build-types/form/primitives/field/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/index.d.ts +1 -0
- package/build-types/form/primitives/index.d.ts.map +1 -1
- package/build-types/form/primitives/input/input.d.ts +1 -1
- package/build-types/form/primitives/select/stories/index.story.d.ts +0 -1
- package/build-types/form/primitives/select/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/textarea/index.d.ts +2 -0
- package/build-types/form/primitives/textarea/index.d.ts.map +1 -0
- package/build-types/form/primitives/textarea/stories/index.story.d.ts +13 -0
- package/build-types/form/primitives/textarea/stories/index.story.d.ts.map +1 -0
- package/build-types/form/primitives/textarea/test/index.test.d.ts +2 -0
- package/build-types/form/primitives/textarea/test/index.test.d.ts.map +1 -0
- package/build-types/form/primitives/textarea/textarea.d.ts +4 -0
- package/build-types/form/primitives/textarea/textarea.d.ts.map +1 -0
- package/build-types/form/primitives/textarea/types.d.ts +11 -0
- package/build-types/form/primitives/textarea/types.d.ts.map +1 -0
- package/build-types/icon-button/icon-button.d.ts +13 -0
- package/build-types/icon-button/icon-button.d.ts.map +1 -0
- package/build-types/icon-button/index.d.ts +2 -0
- package/build-types/icon-button/index.d.ts.map +1 -0
- package/build-types/icon-button/stories/index.story.d.ts +19 -0
- package/build-types/icon-button/stories/index.story.d.ts.map +1 -0
- package/build-types/icon-button/test/index.test.d.ts +2 -0
- package/build-types/icon-button/test/index.test.d.ts.map +1 -0
- package/build-types/icon-button/types.d.ts +36 -0
- package/build-types/icon-button/types.d.ts.map +1 -0
- package/build-types/index.d.ts +3 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/stack/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +6 -0
- package/build-types/tabs/index.d.ts.map +1 -0
- package/build-types/tabs/list.d.ts +16 -0
- package/build-types/tabs/list.d.ts.map +1 -0
- package/build-types/tabs/panel.d.ts +15 -0
- package/build-types/tabs/panel.d.ts.map +1 -0
- package/build-types/tabs/root.d.ts +15 -0
- package/build-types/tabs/root.d.ts.map +1 -0
- package/build-types/tabs/stories/index.story.d.ts +13 -0
- package/build-types/tabs/stories/index.story.d.ts.map +1 -0
- package/build-types/tabs/tab.d.ts +15 -0
- package/build-types/tabs/tab.d.ts.map +1 -0
- package/build-types/tabs/test/index.test.d.ts +2 -0
- package/build-types/tabs/test/index.test.d.ts.map +1 -0
- package/build-types/tabs/types.d.ts +33 -0
- package/build-types/tabs/types.d.ts.map +1 -0
- package/package.json +12 -10
- package/src/badge/badge.tsx +19 -78
- package/src/badge/stories/choosing-intent.story.tsx +1 -1
- package/src/badge/style.module.css +48 -0
- package/src/button/stories/index.story.tsx +3 -16
- package/src/button/style.module.css +23 -12
- package/src/dialog/action.tsx +22 -0
- package/src/dialog/close-icon.tsx +32 -0
- package/src/dialog/context.tsx +113 -0
- package/src/dialog/footer.tsx +26 -0
- package/src/dialog/header.tsx +26 -0
- package/src/dialog/index.ts +10 -0
- package/src/dialog/popup.tsx +46 -0
- package/src/dialog/root.tsx +14 -0
- package/src/dialog/stories/index.story.tsx +177 -0
- package/src/dialog/style.module.css +114 -0
- package/src/dialog/test/index.test.tsx +309 -0
- package/src/dialog/title.tsx +39 -0
- package/src/dialog/trigger.tsx +14 -0
- package/src/dialog/types.ts +93 -0
- package/src/form/primitives/field/root.tsx +1 -1
- package/src/form/primitives/field/stories/index.story.tsx +0 -1
- package/src/form/primitives/fieldset/style.module.css +1 -1
- package/src/form/primitives/index.ts +1 -0
- package/src/form/primitives/input-layout/style.module.css +5 -8
- package/src/form/primitives/select/stories/index.story.tsx +0 -1
- package/src/form/primitives/select/test/index.test.tsx +0 -2
- package/src/form/primitives/textarea/index.ts +1 -0
- package/src/form/primitives/textarea/stories/index.story.tsx +40 -0
- package/src/form/primitives/textarea/style.module.css +22 -0
- package/src/form/primitives/textarea/test/index.test.tsx +143 -0
- package/src/form/primitives/textarea/textarea.tsx +51 -0
- package/src/form/primitives/textarea/types.ts +18 -0
- package/src/icon-button/icon-button.tsx +65 -0
- package/src/icon-button/index.ts +1 -0
- package/src/icon-button/stories/index.story.tsx +128 -0
- package/src/icon-button/style.module.css +16 -0
- package/src/icon-button/test/index.test.tsx +86 -0
- package/src/icon-button/types.ts +38 -0
- package/src/index.ts +3 -1
- package/src/stack/stories/index.story.tsx +4 -5
- package/src/tabs/index.ts +6 -0
- package/src/tabs/list.tsx +130 -0
- package/src/tabs/panel.tsx +23 -0
- package/src/tabs/root.tsx +15 -0
- package/src/tabs/stories/best-practices.mdx +85 -0
- package/src/tabs/stories/index.story.tsx +363 -0
- package/src/tabs/style.module.css +269 -0
- package/src/tabs/tab.tsx +29 -0
- package/src/tabs/test/index.test.tsx +2260 -0
- package/src/tabs/types.ts +36 -0
- package/src/tooltip/style.module.css +3 -3
- package/src/utils/css/item-popup.module.css +2 -2
- package/src/utils/css/select-trigger.module.css +1 -1
- package/build/box/box.cjs +0 -88
- package/build/box/box.cjs.map +0 -7
- package/build/box/index.cjs.map +0 -7
- package/build/box/types.cjs.map +0 -7
- package/build-module/box/box.mjs +0 -63
- package/build-module/box/box.mjs.map +0 -7
- package/build-module/box/index.mjs +0 -6
- package/build-module/box/index.mjs.map +0 -7
- package/build-types/box/box.d.ts +0 -7
- package/build-types/box/box.d.ts.map +0 -1
- package/build-types/box/index.d.ts +0 -2
- package/build-types/box/index.d.ts.map +0 -1
- package/build-types/box/stories/index.story.d.ts +0 -8
- package/build-types/box/stories/index.story.d.ts.map +0 -1
- package/build-types/box/test/box.test.d.ts +0 -2
- package/build-types/box/test/box.test.d.ts.map +0 -1
- package/build-types/box/types.d.ts +0 -46
- package/build-types/box/types.d.ts.map +0 -1
- package/src/box/box.tsx +0 -118
- package/src/box/index.ts +0 -1
- package/src/box/stories/index.story.tsx +0 -41
- package/src/box/test/box.test.tsx +0 -29
- package/src/box/types.ts +0 -61
- /package/build-module/{box → dialog}/types.mjs +0 -0
- /package/build-module/{box → dialog}/types.mjs.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../../src/form/primitives/select/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../../src/form/primitives/select/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,MAAM,CAAC,IAAI,CAQnC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,MAAM,CAAC,IAAI,CAAE,CAAC;AAE5C,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAkBrB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,KAkBrB,CAAC;AAcF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAsBlC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,KAatB,CAAC;AAKF,eAAO,MAAM,YAAY,EAAE,KAa1B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KActB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAa9B,CAAC;AAaF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAwCtC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAc9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/primitives/textarea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Textarea } from '../index';
|
|
3
|
+
declare const meta: Meta<typeof Textarea>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Textarea>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Disabled: Story;
|
|
8
|
+
export declare const WithOverflow: Story;
|
|
9
|
+
/**
|
|
10
|
+
* When `rows` is set to `1`, the textarea will have the same footprint as a default `Input`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const WithOneRow: Story;
|
|
13
|
+
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../../src/form/primitives/textarea/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAGhC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,QAAQ,CAAE,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAKxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../../src/form/primitives/textarea/test/index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<import("../../../utils/types").ComponentProps<"textarea">, "defaultValue" | "disabled" | "value" | "rows"> & Pick<import("../input/types").InputProps, "defaultValue" | "disabled" | "value" | "onValueChange"> & {
|
|
2
|
+
rows?: React.ComponentProps<"textarea">["rows"];
|
|
3
|
+
} & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
4
|
+
//# sourceMappingURL=textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../../src/form/primitives/textarea/textarea.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,QAAQ;;uDA8BpB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InputProps } from '../input/types';
|
|
2
|
+
import type { ComponentProps } from '../../../utils/types';
|
|
3
|
+
export type TextareaProps = Omit<ComponentProps<'textarea'>, 'disabled' | 'rows' | 'value' | 'defaultValue'> & Pick<InputProps, 'value' | 'defaultValue' | 'onValueChange' | 'disabled'> & {
|
|
4
|
+
/**
|
|
5
|
+
* The number of rows the textarea should contain.
|
|
6
|
+
*
|
|
7
|
+
* @default 4
|
|
8
|
+
*/
|
|
9
|
+
rows?: React.ComponentProps<'textarea'>['rows'];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/primitives/textarea/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,IAAI,CAC/B,cAAc,CAAE,UAAU,CAAE,EAC5B,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,CAC9C,GACA,IAAI,CACH,UAAU,EACV,OAAO,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,CACvD,GAAG;IACH;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAE,UAAU,CAAE,CAAE,MAAM,CAAE,CAAC;CACpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An icon-only button with automatic tooltip and optimized styling.
|
|
3
|
+
* Inherits all Button props while providing icon-specific enhancements.
|
|
4
|
+
*/
|
|
5
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<Omit<import("../button/types").ButtonProps, "children"> & {
|
|
6
|
+
label: string;
|
|
7
|
+
icon: import("../icon/types").IconProps["icon"];
|
|
8
|
+
shortcut?: {
|
|
9
|
+
displayShortcut: string;
|
|
10
|
+
ariaKeyShortcut: string;
|
|
11
|
+
};
|
|
12
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
//# sourceMappingURL=icon-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/icon-button/icon-button.tsx"],"names":[],"mappings":"AAQA;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;qDAoDtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icon-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { IconButton } from '../index';
|
|
3
|
+
declare const meta: Meta<typeof IconButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof IconButton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Outline: Story;
|
|
8
|
+
export declare const Minimal: Story;
|
|
9
|
+
export declare const Neutral: Story;
|
|
10
|
+
export declare const NeutralOutline: Story;
|
|
11
|
+
export declare const Disabled: Story;
|
|
12
|
+
export declare const WithDifferentIcons: Story;
|
|
13
|
+
/**
|
|
14
|
+
* The pressed state is only available for buttons with `tone="neutral"` and
|
|
15
|
+
* `variant="minimal"` and can be toggled via the `aria-pressed` HTML attribute.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Pressed: Story;
|
|
18
|
+
export declare const WithShortcut: Story;
|
|
19
|
+
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/icon-button/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAY5D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,UAAU,CAQlC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,UAAU,CAAE,CAAC;AAE3C,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAQ5B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAmBhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAOF,eAAO,MAAM,YAAY,EAAE,KAQ1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/icon-button/test/index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ButtonProps } from '../button/types';
|
|
2
|
+
import { type IconProps } from '../icon/types';
|
|
3
|
+
export type IconButtonProps = Omit<ButtonProps, 'children'> & {
|
|
4
|
+
/**
|
|
5
|
+
* A label describing the button's action, shown as a tooltip and to
|
|
6
|
+
* assistive technology.
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* The icon to display in the button.
|
|
11
|
+
*/
|
|
12
|
+
icon: IconProps['icon'];
|
|
13
|
+
/**
|
|
14
|
+
* The keyboard shortcut associated with this button. When provided, the
|
|
15
|
+
* shortcut is displayed in the tooltip and announced to assistive technology.
|
|
16
|
+
*
|
|
17
|
+
* **Note**: This prop is for display and accessibility purposes only — the
|
|
18
|
+
* consumer is responsible for implementing the actual keyboard event handler.
|
|
19
|
+
*/
|
|
20
|
+
shortcut?: {
|
|
21
|
+
/**
|
|
22
|
+
* The human-readable representation of the shortcut, displayed in the
|
|
23
|
+
* tooltip. Use platform-appropriate symbols (e.g., "⌘S" on macOS,
|
|
24
|
+
* "Ctrl+S" on Windows).
|
|
25
|
+
*/
|
|
26
|
+
displayShortcut: string;
|
|
27
|
+
/**
|
|
28
|
+
* The shortcut in a format compatible with the
|
|
29
|
+
* [aria-keyshortcuts](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-keyshortcuts)
|
|
30
|
+
* attribute. Use "+" to separate keys and standard key names
|
|
31
|
+
* (e.g., "Meta+S", "Control+Shift+P").
|
|
32
|
+
*/
|
|
33
|
+
ariaKeyShortcut: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/icon-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG,IAAI,CAAE,WAAW,EAAE,UAAU,CAAE,GAAG;IAC/D;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,SAAS,CAAE,MAAM,CAAE,CAAC;IAE1B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE;QACV;;;;WAIG;QACH,eAAe,EAAE,MAAM,CAAC;QACxB;;;;;WAKG;QACH,eAAe,EAAE,MAAM,CAAC;KACxB,CAAC;CACF,CAAC"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './badge';
|
|
2
|
-
export * from './box';
|
|
3
2
|
export * from './button';
|
|
3
|
+
export * as Dialog from './dialog';
|
|
4
4
|
export * from './form/primitives';
|
|
5
5
|
export * from './icon';
|
|
6
|
+
export * from './icon-button';
|
|
6
7
|
export * from './stack';
|
|
8
|
+
export * as Tabs from './tabs';
|
|
7
9
|
export * as Tooltip from './tooltip';
|
|
8
10
|
export * from './visually-hidden';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/stack/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/stack/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,KAAK,CAG7B,CAAC;AACF,eAAe,IAAI,CAAC;AAYpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,KAAK,CAAE,CAAC;AAEtC,eAAO,MAAM,OAAO,EAAE,KA4DrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAsBpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Groups the individual tab buttons.
|
|
3
|
+
*
|
|
4
|
+
* `Tabs` is a collection of React components that combine to render
|
|
5
|
+
* an [ARIA-compliant tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
|
|
6
|
+
*/
|
|
7
|
+
export declare const List: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsListProps & import("react").RefAttributes<HTMLDivElement>, "ref">, "className" | "children" | "render"> & {
|
|
8
|
+
className?: string;
|
|
9
|
+
render?: ((props: import("react").HTMLAttributes<any> & {
|
|
10
|
+
ref?: import("react").Ref<any> | undefined;
|
|
11
|
+
}) => React.ReactElement<unknown>) | React.ReactElement<Record<string, unknown>>;
|
|
12
|
+
} & {
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
variant?: "minimal" | "default";
|
|
15
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/tabs/list.tsx"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,eAAO,MAAM,IAAI;;;;;;;;kDAiHhB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A panel displayed when the corresponding tab is active.
|
|
3
|
+
*
|
|
4
|
+
* `Tabs` is a collection of React components that combine to render
|
|
5
|
+
* an [ARIA-compliant tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
|
|
6
|
+
*/
|
|
7
|
+
export declare const Panel: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsPanelProps & import("react").RefAttributes<HTMLDivElement>, "ref">, "className" | "children" | "render"> & {
|
|
8
|
+
className?: string;
|
|
9
|
+
render?: ((props: import("react").HTMLAttributes<any> & {
|
|
10
|
+
ref?: import("react").Ref<any> | undefined;
|
|
11
|
+
}) => React.ReactElement<unknown>) | React.ReactElement<Record<string, unknown>>;
|
|
12
|
+
} & {
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/tabs/panel.tsx"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;;;;kDAUjB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Groups the tabs and the corresponding panels.
|
|
3
|
+
*
|
|
4
|
+
* `Tabs` is a collection of React components that combine to render
|
|
5
|
+
* an [ARIA-compliant tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
|
|
6
|
+
*/
|
|
7
|
+
export declare const Root: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsRootProps & import("react").RefAttributes<HTMLDivElement>, "ref">, "className" | "children" | "render"> & {
|
|
8
|
+
className?: string;
|
|
9
|
+
render?: ((props: import("react").HTMLAttributes<any> & {
|
|
10
|
+
ref?: import("react").Ref<any> | undefined;
|
|
11
|
+
}) => React.ReactElement<unknown>) | React.ReactElement<Record<string, unknown>>;
|
|
12
|
+
} & {
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/tabs/root.tsx"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,IAAI;;;;;;;kDAIhB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Tabs } from '../..';
|
|
3
|
+
declare const meta: Meta<typeof Tabs.Root>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: StoryObj<typeof Tabs.Root>;
|
|
6
|
+
export declare const Minimal: StoryObj<typeof Tabs.Root>;
|
|
7
|
+
export declare const SizeAndOverflowPlayground: StoryObj<typeof Tabs.Root>;
|
|
8
|
+
export declare const Vertical: StoryObj<typeof Tabs.Root>;
|
|
9
|
+
export declare const WithDisabledTab: StoryObj<typeof Tabs.Root>;
|
|
10
|
+
export declare const WithTabIconsAndTooltips: StoryObj<typeof Tabs.Root>;
|
|
11
|
+
export declare const WithPanelsAlwaysMounted: StoryObj<typeof Tabs.Root>;
|
|
12
|
+
export declare const WithNonFocusablePanels: StoryObj<typeof Tabs.Root>;
|
|
13
|
+
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tabs/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,IAAI,EAAW,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAAC,IAAI,CAQjC,CAAC;AACF,eAAe,IAAI,CAAC;AAUpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAsB/C,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAsB/C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAqHjE,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAWhD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAyBvD,CAAC;AAgCF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAsC/D,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAsB/D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAE,OAAO,IAAI,CAAC,IAAI,CAqC9D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An individual interactive tab button that toggles the corresponding panel.
|
|
3
|
+
*
|
|
4
|
+
* `Tabs` is a collection of React components that combine to render
|
|
5
|
+
* an [ARIA-compliant tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).
|
|
6
|
+
*/
|
|
7
|
+
export declare const Tab: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsTabProps & import("react").RefAttributes<Element>, "ref">, "className" | "children" | "render"> & {
|
|
8
|
+
className?: string;
|
|
9
|
+
render?: ((props: import("react").HTMLAttributes<any> & {
|
|
10
|
+
ref?: import("react").Ref<any> | undefined;
|
|
11
|
+
}) => React.ReactElement<unknown>) | React.ReactElement<Record<string, unknown>>;
|
|
12
|
+
} & {
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
//# sourceMappingURL=tab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/tabs/tab.tsx"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;qDAcb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/tabs/test/index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Tabs as _Tabs } from '@base-ui/react/tabs';
|
|
3
|
+
import type { ComponentProps } from '../utils/types';
|
|
4
|
+
export type TabRootProps = ComponentProps<typeof _Tabs.Root> & {
|
|
5
|
+
/**
|
|
6
|
+
* The content to be rendered inside the component.
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export type TabListProps = ComponentProps<typeof _Tabs.List> & {
|
|
11
|
+
/**
|
|
12
|
+
* The content to be rendered inside the component.
|
|
13
|
+
*/
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The visual variant of the tab list.
|
|
17
|
+
* @default "default"
|
|
18
|
+
*/
|
|
19
|
+
variant?: 'minimal' | 'default';
|
|
20
|
+
};
|
|
21
|
+
export type TabProps = ComponentProps<typeof _Tabs.Tab> & {
|
|
22
|
+
/**
|
|
23
|
+
* The content to be rendered inside the component.
|
|
24
|
+
*/
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export type TabPanelProps = ComponentProps<typeof _Tabs.Panel> & {
|
|
28
|
+
/**
|
|
29
|
+
* The content to be rendered inside the component.
|
|
30
|
+
*/
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,cAAc,CAAE,OAAO,KAAK,CAAC,IAAI,CAAE,GAAG;IAChE;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,cAAc,CAAE,OAAO,KAAK,CAAC,IAAI,CAAE,GAAG;IAChE;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,cAAc,CAAE,OAAO,KAAK,CAAC,GAAG,CAAE,GAAG;IAC3D;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,cAAc,CAAE,OAAO,KAAK,CAAC,KAAK,CAAE,GAAG;IAClE;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Themeable React UI components for the WordPress Design System.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,19 +44,21 @@
|
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@base-ui/react": "^1.0.0",
|
|
47
|
-
"@wordpress/a11y": "^4.
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
47
|
+
"@wordpress/a11y": "^4.40.0",
|
|
48
|
+
"@wordpress/compose": "^7.40.0",
|
|
49
|
+
"@wordpress/element": "^6.40.0",
|
|
50
|
+
"@wordpress/i18n": "^6.13.0",
|
|
51
|
+
"@wordpress/icons": "^11.7.0",
|
|
52
|
+
"@wordpress/keycodes": "^4.40.0",
|
|
53
|
+
"@wordpress/primitives": "^4.40.0",
|
|
54
|
+
"@wordpress/private-apis": "^1.40.0",
|
|
55
|
+
"@wordpress/theme": "^0.7.0",
|
|
54
56
|
"clsx": "^2.1.1"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
59
|
"@storybook/addon-docs": "^10.1.11",
|
|
58
60
|
"@storybook/react-vite": "^10.1.11",
|
|
59
|
-
"@testing-library/jest-dom": "^6.
|
|
61
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
60
62
|
"@types/jest": "^29.5.14",
|
|
61
63
|
"@types/node": "^20.17.10",
|
|
62
64
|
"storybook": "^10.1.11"
|
|
@@ -68,5 +70,5 @@
|
|
|
68
70
|
"publishConfig": {
|
|
69
71
|
"access": "public"
|
|
70
72
|
},
|
|
71
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "376124aa10dbc2cc0c81c964ec00b99fcfee5382"
|
|
72
74
|
}
|
package/src/badge/badge.tsx
CHANGED
|
@@ -1,88 +1,29 @@
|
|
|
1
|
+
import { useRender, mergeProps } from '@base-ui/react';
|
|
2
|
+
import clsx from 'clsx';
|
|
1
3
|
import { forwardRef } from '@wordpress/element';
|
|
2
|
-
import { Box } from '../box';
|
|
3
|
-
import { type BoxProps } from '../box/types';
|
|
4
4
|
import { type BadgeProps } from './types';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Default render function that renders a span element with the given props.
|
|
8
|
-
*/
|
|
9
|
-
const DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'span' > ) => (
|
|
10
|
-
<span { ...props } />
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Maps intent values to Box backgroundColor and color props.
|
|
15
|
-
* Uses strong emphasis styles (as emphasis prop has been removed).
|
|
16
|
-
*/
|
|
17
|
-
const getIntentStyles = (
|
|
18
|
-
intent: BadgeProps[ 'intent' ]
|
|
19
|
-
): Partial< BoxProps > => {
|
|
20
|
-
switch ( intent ) {
|
|
21
|
-
case 'high':
|
|
22
|
-
return {
|
|
23
|
-
backgroundColor: 'error',
|
|
24
|
-
color: 'error',
|
|
25
|
-
};
|
|
26
|
-
case 'medium':
|
|
27
|
-
return {
|
|
28
|
-
backgroundColor: 'warning',
|
|
29
|
-
color: 'warning',
|
|
30
|
-
};
|
|
31
|
-
case 'low':
|
|
32
|
-
return {
|
|
33
|
-
backgroundColor: 'caution',
|
|
34
|
-
color: 'caution',
|
|
35
|
-
};
|
|
36
|
-
case 'stable':
|
|
37
|
-
return {
|
|
38
|
-
backgroundColor: 'success',
|
|
39
|
-
color: 'success',
|
|
40
|
-
};
|
|
41
|
-
case 'informational':
|
|
42
|
-
return {
|
|
43
|
-
backgroundColor: 'info',
|
|
44
|
-
color: 'info',
|
|
45
|
-
};
|
|
46
|
-
case 'draft':
|
|
47
|
-
return {
|
|
48
|
-
backgroundColor: 'neutral-weak',
|
|
49
|
-
color: 'neutral',
|
|
50
|
-
};
|
|
51
|
-
case 'none':
|
|
52
|
-
default:
|
|
53
|
-
return {
|
|
54
|
-
backgroundColor: 'neutral',
|
|
55
|
-
color: 'neutral-weak',
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
5
|
+
import styles from './style.module.css';
|
|
59
6
|
|
|
60
7
|
/**
|
|
61
8
|
* A badge component for displaying labels with semantic intent.
|
|
62
|
-
* Built on the Box primitive for consistent theming and accessibility.
|
|
63
9
|
*/
|
|
64
|
-
export const Badge = forwardRef<
|
|
65
|
-
{ children, intent = 'none', render
|
|
10
|
+
export const Badge = forwardRef< HTMLSpanElement, BadgeProps >( function Badge(
|
|
11
|
+
{ children, intent = 'none', render, className, ...props },
|
|
66
12
|
ref
|
|
67
13
|
) {
|
|
68
|
-
const
|
|
14
|
+
const element = useRender( {
|
|
15
|
+
render,
|
|
16
|
+
defaultTagName: 'span',
|
|
17
|
+
ref,
|
|
18
|
+
props: mergeProps< 'span' >( props, {
|
|
19
|
+
className: clsx(
|
|
20
|
+
styles.badge,
|
|
21
|
+
styles[ `is-${ intent }-intent` ],
|
|
22
|
+
className
|
|
23
|
+
),
|
|
24
|
+
children,
|
|
25
|
+
} ),
|
|
26
|
+
} );
|
|
69
27
|
|
|
70
|
-
return
|
|
71
|
-
<Box
|
|
72
|
-
{ ...intentStyles }
|
|
73
|
-
padding={ { inline: 'xs', block: '2xs' } }
|
|
74
|
-
borderRadius="lg"
|
|
75
|
-
render={ render }
|
|
76
|
-
style={ {
|
|
77
|
-
fontFamily: 'var(--wpds-font-family-body)',
|
|
78
|
-
fontSize: 'var(--wpds-font-size-sm)',
|
|
79
|
-
fontWeight: 'var(--wpds-font-weight-regular)',
|
|
80
|
-
lineHeight: 'var(--wpds-font-line-height-xs)',
|
|
81
|
-
...props.style,
|
|
82
|
-
} }
|
|
83
|
-
ref={ ref }
|
|
84
|
-
>
|
|
85
|
-
{ children }
|
|
86
|
-
</Box>
|
|
87
|
-
);
|
|
28
|
+
return element;
|
|
88
29
|
} );
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
|
|
2
|
+
|
|
3
|
+
@layer wp-ui-components {
|
|
4
|
+
.badge {
|
|
5
|
+
padding-inline: var(--wpds-dimension-padding-sm);
|
|
6
|
+
padding-block: var(--wpds-dimension-padding-xs);
|
|
7
|
+
border-radius: var(--wpds-border-radius-lg);
|
|
8
|
+
font-family: var(--wpds-font-family-body);
|
|
9
|
+
font-size: var(--wpds-font-size-sm);
|
|
10
|
+
font-weight: var(--wpds-font-weight-regular);
|
|
11
|
+
line-height: var(--wpds-font-line-height-xs);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.is-high-intent {
|
|
15
|
+
background-color: var(--wpds-color-bg-surface-error);
|
|
16
|
+
color: var(--wpds-color-fg-content-error);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.is-medium-intent {
|
|
20
|
+
background-color: var(--wpds-color-bg-surface-warning);
|
|
21
|
+
color: var(--wpds-color-fg-content-warning);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.is-low-intent {
|
|
25
|
+
background-color: var(--wpds-color-bg-surface-caution);
|
|
26
|
+
color: var(--wpds-color-fg-content-caution);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.is-stable-intent {
|
|
30
|
+
background-color: var(--wpds-color-bg-surface-success);
|
|
31
|
+
color: var(--wpds-color-fg-content-success);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.is-informational-intent {
|
|
35
|
+
background-color: var(--wpds-color-bg-surface-info);
|
|
36
|
+
color: var(--wpds-color-fg-content-info);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.is-draft-intent {
|
|
40
|
+
background-color: var(--wpds-color-bg-surface-neutral-weak);
|
|
41
|
+
color: var(--wpds-color-fg-content-neutral);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.is-none-intent {
|
|
45
|
+
background-color: var(--wpds-color-bg-surface-neutral);
|
|
46
|
+
color: var(--wpds-color-fg-content-neutral-weak);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment
|
|
1
|
+
import { Fragment } from '@wordpress/element';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
import { cog } from '@wordpress/icons';
|
|
4
4
|
import { Button } from '../index';
|
|
@@ -166,8 +166,7 @@ export const Loading: Story = {
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* The pressed state is only available for buttons with `tone="neutral"` and
|
|
169
|
-
* `variant="minimal"
|
|
170
|
-
* active/pressed state.
|
|
169
|
+
* `variant="minimal"` and can be toggled via the `aria-pressed` HTML attribute.
|
|
171
170
|
*/
|
|
172
171
|
export const Pressed: Story = {
|
|
173
172
|
...Default,
|
|
@@ -175,18 +174,6 @@ export const Pressed: Story = {
|
|
|
175
174
|
...Default.args,
|
|
176
175
|
tone: 'neutral',
|
|
177
176
|
variant: 'minimal',
|
|
178
|
-
|
|
179
|
-
render: ( args ) => {
|
|
180
|
-
const [ isPressed, setIsPressed ] = useState( true );
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<Button
|
|
184
|
-
{ ...args }
|
|
185
|
-
aria-pressed={ isPressed }
|
|
186
|
-
onClick={ () => setIsPressed( ! isPressed ) }
|
|
187
|
-
>
|
|
188
|
-
Button
|
|
189
|
-
</Button>
|
|
190
|
-
);
|
|
177
|
+
'aria-pressed': true,
|
|
191
178
|
},
|
|
192
179
|
};
|