@wordpress/ui 0.4.1-next.76cff8c98.0 → 0.5.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/CHANGELOG.md +6 -1
- package/build/badge/badge.cjs.map +2 -2
- package/build/badge/types.cjs.map +1 -1
- package/build/button/button.cjs +401 -0
- package/build/button/button.cjs.map +7 -0
- package/build/button/icon.cjs +47 -0
- package/build/button/icon.cjs.map +7 -0
- package/build/button/index.cjs +39 -0
- package/build/button/index.cjs.map +7 -0
- package/build/button/types.cjs +19 -0
- package/build/button/types.cjs.map +7 -0
- package/build/form/primitives/field/root.cjs.map +2 -2
- package/build/form/primitives/fieldset/context.cjs +40 -0
- package/build/form/primitives/fieldset/context.cjs.map +7 -0
- package/build/form/primitives/fieldset/description.cjs +101 -0
- package/build/form/primitives/fieldset/description.cjs.map +7 -0
- package/build/form/primitives/fieldset/details.cjs +103 -0
- package/build/form/primitives/fieldset/details.cjs.map +7 -0
- package/build/form/primitives/fieldset/index.cjs +40 -0
- package/build/form/primitives/fieldset/index.cjs.map +7 -0
- package/build/form/primitives/fieldset/legend.cjs +94 -0
- package/build/form/primitives/fieldset/legend.cjs.map +7 -0
- package/build/form/primitives/fieldset/root.cjs +86 -0
- package/build/form/primitives/fieldset/root.cjs.map +7 -0
- package/build/form/primitives/fieldset/types.cjs +19 -0
- package/build/form/primitives/fieldset/types.cjs.map +7 -0
- package/build/form/primitives/index.cjs +11 -2
- package/build/form/primitives/index.cjs.map +2 -2
- package/build/form/primitives/input/index.cjs +31 -0
- package/build/form/primitives/input/index.cjs.map +7 -0
- package/build/form/primitives/input/input.cjs +148 -0
- package/build/form/primitives/input/input.cjs.map +7 -0
- package/build/form/primitives/input/types.cjs +19 -0
- package/build/form/primitives/input/types.cjs.map +7 -0
- package/build/form/primitives/input-layout/context.cjs +49 -0
- package/build/form/primitives/input-layout/context.cjs.map +7 -0
- package/build/form/primitives/input-layout/index.cjs +35 -0
- package/build/form/primitives/input-layout/index.cjs.map +7 -0
- package/build/form/primitives/input-layout/input-layout.cjs +196 -0
- package/build/form/primitives/input-layout/input-layout.cjs.map +7 -0
- package/build/form/primitives/input-layout/slot.cjs +165 -0
- package/build/form/primitives/input-layout/slot.cjs.map +7 -0
- package/build/form/primitives/input-layout/types.cjs +19 -0
- package/build/form/primitives/input-layout/types.cjs.map +7 -0
- package/build/icon/icon.cjs +46 -0
- package/build/icon/icon.cjs.map +7 -0
- package/build/icon/index.cjs +31 -0
- package/build/icon/index.cjs.map +7 -0
- package/build/icon/types.cjs +19 -0
- package/build/icon/types.cjs.map +7 -0
- package/build/index.cjs +4 -0
- package/build/index.cjs.map +2 -2
- package/build-module/badge/badge.mjs.map +2 -2
- package/build-module/button/button.mjs +366 -0
- package/build-module/button/button.mjs.map +7 -0
- package/build-module/button/icon.mjs +22 -0
- package/build-module/button/icon.mjs.map +7 -0
- package/build-module/button/index.mjs +14 -0
- package/build-module/button/index.mjs.map +7 -0
- package/build-module/button/types.mjs +1 -0
- package/build-module/button/types.mjs.map +7 -0
- package/build-module/form/primitives/field/root.mjs.map +2 -2
- package/build-module/form/primitives/fieldset/context.mjs +14 -0
- package/build-module/form/primitives/fieldset/context.mjs.map +7 -0
- package/build-module/form/primitives/fieldset/description.mjs +66 -0
- package/build-module/form/primitives/fieldset/description.mjs.map +7 -0
- package/build-module/form/primitives/fieldset/details.mjs +68 -0
- package/build-module/form/primitives/fieldset/details.mjs.map +7 -0
- package/build-module/form/primitives/fieldset/index.mjs +12 -0
- package/build-module/form/primitives/fieldset/index.mjs.map +7 -0
- package/build-module/form/primitives/fieldset/legend.mjs +59 -0
- package/build-module/form/primitives/fieldset/legend.mjs.map +7 -0
- package/build-module/form/primitives/fieldset/root.mjs +51 -0
- package/build-module/form/primitives/fieldset/root.mjs.map +7 -0
- package/build-module/form/primitives/fieldset/types.mjs +1 -0
- package/build-module/form/primitives/fieldset/types.mjs.map +7 -0
- package/build-module/form/primitives/index.mjs +7 -1
- package/build-module/form/primitives/index.mjs.map +2 -2
- package/build-module/form/primitives/input/index.mjs +6 -0
- package/build-module/form/primitives/input/index.mjs.map +7 -0
- package/build-module/form/primitives/input/input.mjs +113 -0
- package/build-module/form/primitives/input/input.mjs.map +7 -0
- package/build-module/form/primitives/input/types.mjs +1 -0
- package/build-module/form/primitives/input/types.mjs.map +7 -0
- package/build-module/form/primitives/input-layout/context.mjs +22 -0
- package/build-module/form/primitives/input-layout/context.mjs.map +7 -0
- package/build-module/form/primitives/input-layout/index.mjs +10 -0
- package/build-module/form/primitives/input-layout/index.mjs.map +7 -0
- package/build-module/form/primitives/input-layout/input-layout.mjs +161 -0
- package/build-module/form/primitives/input-layout/input-layout.mjs.map +7 -0
- package/build-module/form/primitives/input-layout/slot.mjs +130 -0
- package/build-module/form/primitives/input-layout/slot.mjs.map +7 -0
- package/build-module/form/primitives/input-layout/types.mjs +1 -0
- package/build-module/form/primitives/input-layout/types.mjs.map +7 -0
- package/build-module/icon/icon.mjs +21 -0
- package/build-module/icon/icon.mjs.map +7 -0
- package/build-module/icon/index.mjs +6 -0
- package/build-module/icon/index.mjs.map +7 -0
- package/build-module/icon/types.mjs +1 -0
- package/build-module/icon/types.mjs.map +7 -0
- package/build-module/index.mjs +2 -0
- package/build-module/index.mjs.map +2 -2
- package/build-types/badge/badge.d.ts.map +1 -1
- package/build-types/badge/stories/index.story.d.ts +1 -7
- package/build-types/badge/stories/index.story.d.ts.map +1 -1
- package/build-types/badge/types.d.ts +0 -3
- package/build-types/badge/types.d.ts.map +1 -1
- package/build-types/box/stories/index.story.d.ts +1 -1
- package/build-types/box/stories/index.story.d.ts.map +1 -1
- package/build-types/button/button.d.ts +3 -0
- package/build-types/button/button.d.ts.map +1 -0
- package/build-types/button/icon.d.ts +10 -0
- package/build-types/button/icon.d.ts.map +1 -0
- package/build-types/button/index.d.ts +10 -0
- package/build-types/button/index.d.ts.map +1 -0
- package/build-types/button/stories/index.story.d.ts +23 -0
- package/build-types/button/stories/index.story.d.ts.map +1 -0
- package/build-types/button/test/button.test.d.ts +2 -0
- package/build-types/button/test/button.test.d.ts.map +1 -0
- package/build-types/button/test/icon.test.d.ts +2 -0
- package/build-types/button/test/icon.test.d.ts.map +1 -0
- package/build-types/button/types.d.ts +63 -0
- package/build-types/button/types.d.ts.map +1 -0
- package/build-types/form/primitives/field/control.d.ts +1 -1
- package/build-types/form/primitives/field/description.d.ts +1 -1
- package/build-types/form/primitives/field/label.d.ts +1 -1
- package/build-types/form/primitives/field/root.d.ts +3 -1
- package/build-types/form/primitives/field/root.d.ts.map +1 -1
- package/build-types/form/primitives/field/stories/index.story.d.ts +1 -1
- package/build-types/form/primitives/field/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/context.d.ts +8 -0
- package/build-types/form/primitives/fieldset/context.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/description.d.ts +9 -0
- package/build-types/form/primitives/fieldset/description.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/details.d.ts +21 -0
- package/build-types/form/primitives/fieldset/details.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/index.d.ts +6 -0
- package/build-types/form/primitives/fieldset/index.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/legend.d.ts +9 -0
- package/build-types/form/primitives/fieldset/legend.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/root.d.ts +15 -0
- package/build-types/form/primitives/fieldset/root.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/stories/index.story.d.ts +18 -0
- package/build-types/form/primitives/fieldset/stories/index.story.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/test/index.test.d.ts +2 -0
- package/build-types/form/primitives/fieldset/test/index.test.d.ts.map +1 -0
- package/build-types/form/primitives/fieldset/types.d.ts +32 -0
- package/build-types/form/primitives/fieldset/types.d.ts.map +1 -0
- package/build-types/form/primitives/index.d.ts +3 -0
- package/build-types/form/primitives/index.d.ts.map +1 -1
- package/build-types/form/primitives/input/index.d.ts +2 -0
- package/build-types/form/primitives/input/index.d.ts.map +1 -0
- package/build-types/form/primitives/input/input.d.ts +10 -0
- package/build-types/form/primitives/input/input.d.ts.map +1 -0
- package/build-types/form/primitives/input/stories/index.story.d.ts +13 -0
- package/build-types/form/primitives/input/stories/index.story.d.ts.map +1 -0
- package/build-types/form/primitives/input/test/index.test.d.ts +2 -0
- package/build-types/form/primitives/input/test/index.test.d.ts.map +1 -0
- package/build-types/form/primitives/input/types.d.ts +27 -0
- package/build-types/form/primitives/input/types.d.ts.map +1 -0
- package/build-types/form/primitives/input-layout/context.d.ts +17 -0
- package/build-types/form/primitives/input-layout/context.d.ts.map +1 -0
- package/build-types/form/primitives/input-layout/index.d.ts +4 -0
- package/build-types/form/primitives/input-layout/index.d.ts.map +1 -0
- package/build-types/form/primitives/input-layout/input-layout.d.ts +7 -0
- package/build-types/form/primitives/input-layout/input-layout.d.ts.map +1 -0
- package/build-types/form/primitives/input-layout/slot.d.ts +6 -0
- package/build-types/form/primitives/input-layout/slot.d.ts.map +1 -0
- package/build-types/form/primitives/input-layout/stories/index.story.d.ts +24 -0
- package/build-types/form/primitives/input-layout/stories/index.story.d.ts.map +1 -0
- package/build-types/form/primitives/input-layout/test/index.test.d.ts +2 -0
- package/build-types/form/primitives/input-layout/test/index.test.d.ts.map +1 -0
- package/build-types/form/primitives/input-layout/types.d.ts +41 -0
- package/build-types/form/primitives/input-layout/types.d.ts.map +1 -0
- package/build-types/icon/icon.d.ts +14 -0
- package/build-types/icon/icon.d.ts.map +1 -0
- package/build-types/icon/index.d.ts +2 -0
- package/build-types/icon/index.d.ts.map +1 -0
- package/build-types/icon/stories/index.story.d.ts +11 -0
- package/build-types/icon/stories/index.story.d.ts.map +1 -0
- package/build-types/icon/test/icon.test.d.ts +2 -0
- package/build-types/icon/test/icon.test.d.ts.map +1 -0
- package/build-types/icon/types.d.ts +15 -0
- package/build-types/icon/types.d.ts.map +1 -0
- package/build-types/index.d.ts +2 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/stack/stories/index.story.d.ts +1 -1
- package/build-types/stack/stories/index.story.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
- package/package.json +14 -5
- package/src/badge/badge.tsx +0 -7
- package/src/badge/stories/index.story.tsx +1 -14
- package/src/badge/types.ts +0 -3
- package/src/box/stories/index.story.tsx +1 -2
- package/src/button/button.tsx +57 -0
- package/src/button/icon.tsx +24 -0
- package/src/button/index.ts +16 -0
- package/src/button/stories/index.story.tsx +192 -0
- package/src/button/style.module.css +232 -0
- package/src/button/test/button.test.tsx +89 -0
- package/src/button/test/icon.test.tsx +13 -0
- package/src/button/types.ts +72 -0
- package/src/form/primitives/field/root.tsx +2 -0
- package/src/form/primitives/field/stories/index.story.tsx +1 -1
- package/src/form/primitives/fieldset/context.tsx +13 -0
- package/src/form/primitives/fieldset/description.tsx +36 -0
- package/src/form/primitives/fieldset/details.tsx +46 -0
- package/src/form/primitives/fieldset/index.ts +6 -0
- package/src/form/primitives/fieldset/legend.tsx +17 -0
- package/src/form/primitives/fieldset/root.tsx +42 -0
- package/src/form/primitives/fieldset/stories/index.story.tsx +67 -0
- package/src/form/primitives/fieldset/style.module.css +12 -0
- package/src/form/primitives/fieldset/test/index.test.tsx +135 -0
- package/src/form/primitives/fieldset/types.ts +35 -0
- package/src/form/primitives/index.ts +3 -0
- package/src/form/primitives/input/index.ts +1 -0
- package/src/form/primitives/input/input.tsx +28 -0
- package/src/form/primitives/input/stories/index.story.tsx +40 -0
- package/src/form/primitives/input/style.module.css +34 -0
- package/src/form/primitives/input/test/index.test.tsx +13 -0
- package/src/form/primitives/input/types.ts +31 -0
- package/src/form/primitives/input-layout/context.tsx +36 -0
- package/src/form/primitives/input-layout/index.ts +6 -0
- package/src/form/primitives/input-layout/input-layout.tsx +49 -0
- package/src/form/primitives/input-layout/slot.tsx +39 -0
- package/src/form/primitives/input-layout/stories/index.story.tsx +67 -0
- package/src/form/primitives/input-layout/style.module.css +82 -0
- package/src/form/primitives/input-layout/test/index.test.tsx +23 -0
- package/src/form/primitives/input-layout/types.ts +44 -0
- package/src/icon/icon.tsx +30 -0
- package/src/icon/index.ts +1 -0
- package/src/icon/stories/index.story.tsx +47 -0
- package/src/icon/test/icon.test.tsx +13 -0
- package/src/icon/types.ts +14 -0
- package/src/index.ts +2 -0
- package/src/stack/stories/index.story.tsx +1 -2
- package/src/stories/introduction.mdx +6 -0
- package/src/utils/css/focus.module.css +31 -0
- package/src/visually-hidden/stories/index.story.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
## 0.
|
|
5
|
+
## 0.5.0 (2026-01-16)
|
|
6
6
|
|
|
7
7
|
### Breaking Changes
|
|
8
8
|
|
|
@@ -13,3 +13,8 @@
|
|
|
13
13
|
- Add `Stack` component ([#73928](https://github.com/WordPress/gutenberg/pull/73928)).
|
|
14
14
|
- Add `VisuallyHidden` component ([#74189](https://github.com/WordPress/gutenberg/pull/74189)).
|
|
15
15
|
- Add `Field` primitives ([#74190](https://github.com/WordPress/gutenberg/pull/74190)).
|
|
16
|
+
- Add `Fieldset` primitives ([#74296](https://github.com/WordPress/gutenberg/pull/74296)).
|
|
17
|
+
- Add `Icon` component ([#74311](https://github.com/WordPress/gutenberg/pull/74311)).
|
|
18
|
+
- Add `Button` component ([#74415](https://github.com/WordPress/gutenberg/pull/74415), [#74416](https://github.com/WordPress/gutenberg/pull/74416), [#74470](https://github.com/WordPress/gutenberg/pull/74470)).
|
|
19
|
+
- Add `InputLayout` primitive ([#74313](https://github.com/WordPress/gutenberg/pull/74313)).
|
|
20
|
+
- Add `Input` primitive ([#74615](https://github.com/WordPress/gutenberg/pull/74615)).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/badge/badge.tsx"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { forwardRef } from '@wordpress/element';\nimport { Box } from '../box';\nimport { type BoxProps } from '../box/types';\nimport { type BadgeProps } from './types';\n\n/**\n * Default render function that renders a span element with the given props.\n */\nconst DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'span' > ) => (\n\t<span { ...props } />\n);\n\n/**\n * Maps intent values to Box backgroundColor and color props.\n * Uses strong emphasis styles (as emphasis prop has been removed).\n */\nconst getIntentStyles = (\n\tintent: BadgeProps[ 'intent' ]\n): Partial< BoxProps > => {\n\tswitch ( intent ) {\n\t\tcase 'high':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'error',\n\t\t\t\tcolor: 'error',\n\t\t\t};\n\t\tcase 'medium':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'warning',\n\t\t\t\tcolor: 'warning',\n\t\t\t};\n\t\tcase 'low':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'caution',\n\t\t\t\tcolor: 'caution',\n\t\t\t};\n\t\tcase 'stable':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'success',\n\t\t\t\tcolor: 'success',\n\t\t\t};\n\t\tcase 'informational':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'info',\n\t\t\t\tcolor: 'info',\n\t\t\t};\n\t\tcase 'draft':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'neutral-weak',\n\t\t\t\tcolor: 'neutral',\n\t\t\t};\n\t\tcase 'none':\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'neutral',\n\t\t\t\tcolor: 'neutral-weak',\n\t\t\t};\n\t}\n};\n\n/**\n * A badge component for displaying labels with semantic intent.\n * Built on the Box primitive for consistent theming and accessibility.\n */\nexport const Badge = forwardRef< HTMLDivElement, BadgeProps >( function Badge(\n\t{ children, intent = 'none', render = DEFAULT_RENDER, ...props },\n\tref\n) {\n\tconst intentStyles = getIntentStyles( intent );\n\n\treturn (\n\t\t<Box\n\t\t\t{ ...intentStyles }\n\t\t\tpadding={ { inline: 'xs', block: '2xs' } }\n\t\t\tborderRadius=\"lg\"\n\t\t\trender={ render }\n\t\t\tstyle={ {\n\t\t\t\tfontFamily: 'var(--wpds-font-family-body)',\n\t\t\t\tfontSize: 'var(--wpds-font-size-sm)',\n\t\t\t\tfontWeight: 'var(--wpds-font-weight-regular)',\n\t\t\t\tlineHeight: 'var(--wpds-font-line-height-xs)',\n\t\t\t\t...props.style,\n\t\t\t} }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ children }\n\t\t</Box>\n\t);\n} );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2B;AAC3B,iBAAoB;AAQnB;AADD,IAAM,iBAAiB,CAAE,UACxB,4CAAC,UAAO,GAAG,OAAQ;AAOpB,IAAM,kBAAkB,CACvB,WACyB;AACzB,UAAS,QAAS;AAAA,IACjB,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AAAA,IACL;AACC,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,EACF;AACD;AAMO,IAAM,YAAQ,2BAA0C,SAASA,OACvE,EAAE,UAAU,SAAS,QAAQ,SAAS,gBAAgB,GAAG,MAAM,GAC/D,KACC;AACD,QAAM,eAAe,gBAAiB,MAAO;AAE7C,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACL,SAAU,EAAE,QAAQ,MAAM,OAAO,MAAM;AAAA,MACvC,cAAa;AAAA,MACb;AAAA,MACA,OAAQ;AAAA,QACP,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,GAAG,MAAM;AAAA,MACV;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF,CAAE;",
|
|
6
6
|
"names": ["Badge"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/badge/types.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["import { type ComponentProps } from '../utils/types';\n\nexport interface BadgeProps extends ComponentProps< 'span' > {\n\t/**\n\t * The text to display in the badge.\n\t */\n\tchildren: string;\n\n\t/**\n\t * The semantic intent of the badge, communicating its meaning through color.\n\t *\n\t * @default \"none\"\n\t */\n\tintent?:\n\t\t| 'high'\n\t\t| 'medium'\n\t\t| 'low'\n\t\t| 'stable'\n\t\t| 'informational'\n\t\t| 'draft'\n\t\t| 'none';\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/ui/src/button/button.tsx
|
|
31
|
+
var button_exports = {};
|
|
32
|
+
__export(button_exports, {
|
|
33
|
+
Button: () => Button
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(button_exports);
|
|
36
|
+
var import_button = require("@base-ui/react/button");
|
|
37
|
+
var import_clsx = __toESM(require("clsx"));
|
|
38
|
+
var import_a11y = require("@wordpress/a11y");
|
|
39
|
+
var import_element = require("@wordpress/element");
|
|
40
|
+
var import_i18n = require("@wordpress/i18n");
|
|
41
|
+
|
|
42
|
+
// packages/ui/src/button/style.module.css
|
|
43
|
+
var css = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
|
|
44
|
+
|
|
45
|
+
@layer wp-ui-components {
|
|
46
|
+
.style-module__button__l7D8M,
|
|
47
|
+
.style-module__is-unstyled__q7snL {
|
|
48
|
+
appearance: none;
|
|
49
|
+
padding: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.style-module__button__l7D8M {
|
|
53
|
+
/* Internal variables */
|
|
54
|
+
--wp-ui-button-font-weight: 499;
|
|
55
|
+
|
|
56
|
+
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-brand-strong);
|
|
57
|
+
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-brand-strong-active);
|
|
58
|
+
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-strong-disabled);
|
|
59
|
+
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-brand-strong);
|
|
60
|
+
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-brand-strong-active);
|
|
61
|
+
--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-strong-disabled);
|
|
62
|
+
--wp-ui-button-padding-inline: calc(3 * var(--wpds-dimension-base)); /* TODO: Create new interactive padding tokens */
|
|
63
|
+
--wp-ui-button-height: 40px;
|
|
64
|
+
--wp-ui-button-aspect-ratio: auto; /* Useful for overrides such as icon buttons */
|
|
65
|
+
--wp-ui-button-font-size: var(--wpds-font-size-md);
|
|
66
|
+
|
|
67
|
+
/* by default, borders have the same color as the background */
|
|
68
|
+
--wp-ui-button-border-color: var(--wp-ui-button-background-color);
|
|
69
|
+
--wp-ui-button-border-color-active: var(--wp-ui-button-background-color-active);
|
|
70
|
+
--wp-ui-button-border-color-disabled: var(--wp-ui-button-background-color-disabled);
|
|
71
|
+
|
|
72
|
+
/* Styles */
|
|
73
|
+
position: relative;
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: calc(2 * var(--wpds-dimension-base)); /* TODO: Consider new interactive/control gap tokens */
|
|
78
|
+
aspect-ratio: var(--wp-ui-button-aspect-ratio);
|
|
79
|
+
height: var(--wp-ui-button-height);
|
|
80
|
+
padding-inline: var(--wp-ui-button-padding-inline);
|
|
81
|
+
border-style: solid;
|
|
82
|
+
border-width: 1px;
|
|
83
|
+
border-color: var(--wp-ui-button-border-color);
|
|
84
|
+
border-radius: var(--wpds-border-radius-surface-sm);
|
|
85
|
+
background-color: var(--wp-ui-button-background-color);
|
|
86
|
+
background-clip: padding-box;
|
|
87
|
+
font-family: var(--wpds-font-family-body);
|
|
88
|
+
font-size: var(--wp-ui-button-font-size);
|
|
89
|
+
font-weight: var(--wp-ui-button-font-weight);
|
|
90
|
+
line-height: var(--wpds-font-line-height-sm);
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
color: var(--wp-ui-button-foreground-color);
|
|
93
|
+
|
|
94
|
+
@media not ( prefers-reduced-motion ) {
|
|
95
|
+
transition: color 0.1s ease-out;
|
|
96
|
+
|
|
97
|
+
* {
|
|
98
|
+
transition: opacity 0.1s ease-out;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Use pointer cursor for buttons that are links */
|
|
103
|
+
&[href] {
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Make sure that links rendered as children of \`Button\` use button styles */
|
|
108
|
+
*[href] {
|
|
109
|
+
color: inherit;
|
|
110
|
+
text-decoration: inherit;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* States */
|
|
114
|
+
&:not([aria-disabled="true"]):is(:hover, :active, :focus) {
|
|
115
|
+
/* hover/active/focus states apply when the button is not disabled. A non
|
|
116
|
+
disabled, loading button will have hover/active/focus styles */
|
|
117
|
+
--wp-ui-button-background-color: var(--wp-ui-button-background-color-active);
|
|
118
|
+
--wp-ui-button-foreground-color: var(--wp-ui-button-foreground-color-active);
|
|
119
|
+
--wp-ui-button-border-color: var(--wp-ui-button-border-color-active);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&[aria-disabled="true"]:not(.style-module__is-loading__kUtC8) {
|
|
123
|
+
/* A loading button, even when disabled, won't "look" disabled */
|
|
124
|
+
--wp-ui-button-background-color: var(--wp-ui-button-background-color-disabled);
|
|
125
|
+
--wp-ui-button-foreground-color: var(--wp-ui-button-foreground-color-disabled);
|
|
126
|
+
--wp-ui-button-border-color: var(--wp-ui-button-border-color-disabled);
|
|
127
|
+
|
|
128
|
+
@media ( forced-colors: active ) {
|
|
129
|
+
border-color: GrayText;
|
|
130
|
+
color: GrayText;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Loading spinner \u2014 not animated and hidden unless in loading state */
|
|
135
|
+
&::before {
|
|
136
|
+
content: "";
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 50%;
|
|
139
|
+
inset-inline-start: 50%;
|
|
140
|
+
transform: translate(-50%, -50%);
|
|
141
|
+
|
|
142
|
+
display: block;
|
|
143
|
+
box-sizing: border-box;
|
|
144
|
+
height: var(--wp-ui-button-font-size);
|
|
145
|
+
aspect-ratio: 1;
|
|
146
|
+
|
|
147
|
+
border: var(--wpds-border-width-interactive-focus) solid;
|
|
148
|
+
border-block-start-color: var(--wp-ui-button-foreground-color);
|
|
149
|
+
border-inline-end-color: var(--wp-ui-button-foreground-color);
|
|
150
|
+
border-block-end-color: transparent;
|
|
151
|
+
border-inline-start-color: transparent;
|
|
152
|
+
border-radius: 50%;
|
|
153
|
+
|
|
154
|
+
pointer-events: none;
|
|
155
|
+
opacity: 0;
|
|
156
|
+
|
|
157
|
+
@media not ( prefers-reduced-motion ) {
|
|
158
|
+
transition: opacity 0.1s ease-out;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.style-module__is-small__kIIFR {
|
|
164
|
+
--wp-ui-button-padding-inline: calc(2 * var(--wpds-dimension-base)); /* TODO: Create new interactive padding tokens */
|
|
165
|
+
--wp-ui-button-height: 24px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Variants (\`tone\` + \`variant\`) overrides compared to default styles */
|
|
169
|
+
|
|
170
|
+
/* All outline buttons have a border */
|
|
171
|
+
.style-module__is-brand__3UYMl {
|
|
172
|
+
/* no need to redefine variables for .is-brand.is-solid as it's the default variant */
|
|
173
|
+
|
|
174
|
+
/* Outline and minimal buttons use the same foreground color */
|
|
175
|
+
&.style-module__is-outline__YtWne,
|
|
176
|
+
&.style-module__is-minimal__rQYZo {
|
|
177
|
+
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-brand);
|
|
178
|
+
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-brand-active);
|
|
179
|
+
--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-disabled);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&.style-module__is-outline__YtWne {
|
|
183
|
+
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-brand-weak);
|
|
184
|
+
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-brand-weak-active);
|
|
185
|
+
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);
|
|
186
|
+
--wp-ui-button-border-color: var(--wpds-color-stroke-interactive-brand);
|
|
187
|
+
--wp-ui-button-border-color-active: var(--wpds-color-stroke-interactive-brand-active);
|
|
188
|
+
--wp-ui-button-border-color-disabled: var(--wpds-color-stroke-interactive-neutral-disabled);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&.style-module__is-minimal__rQYZo {
|
|
192
|
+
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-brand-weak);
|
|
193
|
+
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-brand-weak-active);
|
|
194
|
+
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.style-module__is-neutral__5yKo- {
|
|
199
|
+
&.style-module__is-solid__tQszW {
|
|
200
|
+
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-strong);
|
|
201
|
+
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-strong-active);
|
|
202
|
+
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-strong-disabled);
|
|
203
|
+
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral-strong);
|
|
204
|
+
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-strong-active);
|
|
205
|
+
--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-strong-disabled);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Outline and minimal buttons use the same foreground color */
|
|
209
|
+
&.style-module__is-outline__YtWne,
|
|
210
|
+
&.style-module__is-minimal__rQYZo {
|
|
211
|
+
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral);
|
|
212
|
+
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-active);
|
|
213
|
+
--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-disabled);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
&.style-module__is-outline__YtWne {
|
|
217
|
+
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-weak);
|
|
218
|
+
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-weak-active);
|
|
219
|
+
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);
|
|
220
|
+
--wp-ui-button-border-color: var(--wpds-color-stroke-interactive-neutral);
|
|
221
|
+
--wp-ui-button-border-color-active: var(--wpds-color-stroke-interactive-neutral-active);
|
|
222
|
+
--wp-ui-button-border-color-disabled: var(--wpds-color-stroke-interactive-neutral-disabled);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
&.style-module__is-minimal__rQYZo {
|
|
226
|
+
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-weak);
|
|
227
|
+
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-weak-active);
|
|
228
|
+
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.style-module__is-unstyled__q7snL {
|
|
233
|
+
border: none;
|
|
234
|
+
background: none;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.style-module__is-compact__z1nPG {
|
|
238
|
+
--wp-ui-button-height: 32px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.style-module__is-loading__kUtC8 {
|
|
242
|
+
color: transparent;
|
|
243
|
+
|
|
244
|
+
* {
|
|
245
|
+
opacity: 0;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&::before {
|
|
249
|
+
transition-delay: 0.05s;
|
|
250
|
+
opacity: 1;
|
|
251
|
+
|
|
252
|
+
@media not ( prefers-reduced-motion ) {
|
|
253
|
+
animation: style-module__loading-animation__Wh1T2 1s linear infinite;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
[aria-pressed="true"].style-module__is-minimal__rQYZo.style-module__is-neutral__5yKo- {
|
|
259
|
+
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-strong);
|
|
260
|
+
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-strong);
|
|
261
|
+
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral-strong);
|
|
262
|
+
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-strong);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@keyframes style-module__loading-animation__Wh1T2 {
|
|
267
|
+
0% {
|
|
268
|
+
transform: translate(-50%, -50%) rotate(0deg);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
100% {
|
|
272
|
+
transform: translate(-50%, -50%) rotate(360deg);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
276
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css));
|
|
277
|
+
var style_default = {
|
|
278
|
+
"button": "style-module__button__l7D8M",
|
|
279
|
+
"is-unstyled": "style-module__is-unstyled__q7snL",
|
|
280
|
+
"is-loading": "style-module__is-loading__kUtC8",
|
|
281
|
+
"is-small": "style-module__is-small__kIIFR",
|
|
282
|
+
"is-brand": "style-module__is-brand__3UYMl",
|
|
283
|
+
"is-outline": "style-module__is-outline__YtWne",
|
|
284
|
+
"is-minimal": "style-module__is-minimal__rQYZo",
|
|
285
|
+
"is-neutral": "style-module__is-neutral__5yKo-",
|
|
286
|
+
"is-solid": "style-module__is-solid__tQszW",
|
|
287
|
+
"is-compact": "style-module__is-compact__z1nPG",
|
|
288
|
+
"loading-animation": "style-module__loading-animation__Wh1T2"
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// packages/ui/src/utils/css/resets.module.css
|
|
292
|
+
var css2 = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
|
|
293
|
+
|
|
294
|
+
@layer wp-ui-utilities {
|
|
295
|
+
.resets-module__box-sizing__M2zT5 {
|
|
296
|
+
box-sizing: border-box;
|
|
297
|
+
|
|
298
|
+
*,
|
|
299
|
+
*::before,
|
|
300
|
+
*::after {
|
|
301
|
+
box-sizing: inherit;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
`;
|
|
306
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css2));
|
|
307
|
+
var resets_default = {
|
|
308
|
+
"box-sizing": "resets-module__box-sizing__M2zT5"
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// packages/ui/src/utils/css/focus.module.css
|
|
312
|
+
var css3 = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
|
|
313
|
+
|
|
314
|
+
@layer wp-ui-utilities {
|
|
315
|
+
.focus-module__outset-ring--focus__COii5,
|
|
316
|
+
.focus-module__outset-ring--focus-except-active__4lsr3,
|
|
317
|
+
.focus-module__outset-ring--focus-visible__0FQby,
|
|
318
|
+
.focus-module__outset-ring--focus-within__zYPfw,
|
|
319
|
+
.focus-module__outset-ring--focus-within-except-active__lw0E3,
|
|
320
|
+
.focus-module__outset-ring--focus-within-visible__xcs-5 {
|
|
321
|
+
@media not ( prefers-reduced-motion ) {
|
|
322
|
+
transition: outline 0.1s ease-out;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* Outline width must be kept at 0 even with a transparent color,
|
|
326
|
+
or else the outline will be visible in forced-colors mode. */
|
|
327
|
+
outline-width: 0;
|
|
328
|
+
outline-style: solid;
|
|
329
|
+
outline-color: transparent;
|
|
330
|
+
outline-offset: 1px;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.focus-module__outset-ring--focus__COii5:focus,
|
|
334
|
+
.focus-module__outset-ring--focus-except-active__4lsr3:focus:not(:active),
|
|
335
|
+
.focus-module__outset-ring--focus-visible__0FQby:focus-visible,
|
|
336
|
+
.focus-module__outset-ring--focus-within__zYPfw:focus-within,
|
|
337
|
+
.focus-module__outset-ring--focus-within-except-active__lw0E3:focus-within:not(:has(:active)),
|
|
338
|
+
.focus-module__outset-ring--focus-within-visible__xcs-5:focus-within:has(:focus-visible) {
|
|
339
|
+
outline-width: var(--wpds-border-width-interactive-focus);
|
|
340
|
+
outline-color: var(--wpds-color-stroke-focus-brand);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
`;
|
|
344
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css3));
|
|
345
|
+
var focus_default = {
|
|
346
|
+
"outset-ring--focus": "focus-module__outset-ring--focus__COii5",
|
|
347
|
+
"outset-ring--focus-except-active": "focus-module__outset-ring--focus-except-active__4lsr3",
|
|
348
|
+
"outset-ring--focus-visible": "focus-module__outset-ring--focus-visible__0FQby",
|
|
349
|
+
"outset-ring--focus-within": "focus-module__outset-ring--focus-within__zYPfw",
|
|
350
|
+
"outset-ring--focus-within-except-active": "focus-module__outset-ring--focus-within-except-active__lw0E3",
|
|
351
|
+
"outset-ring--focus-within-visible": "focus-module__outset-ring--focus-within-visible__xcs-5"
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
// packages/ui/src/button/button.tsx
|
|
355
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
356
|
+
var Button = (0, import_element.forwardRef)(
|
|
357
|
+
function Button2({
|
|
358
|
+
tone = "brand",
|
|
359
|
+
variant = "solid",
|
|
360
|
+
size = "default",
|
|
361
|
+
className,
|
|
362
|
+
focusableWhenDisabled = true,
|
|
363
|
+
disabled,
|
|
364
|
+
loading,
|
|
365
|
+
loadingAnnouncement = (0, import_i18n.__)("Loading"),
|
|
366
|
+
children,
|
|
367
|
+
...props
|
|
368
|
+
}, ref) {
|
|
369
|
+
const mergedClassName = (0, import_clsx.default)(
|
|
370
|
+
resets_default["box-sizing"],
|
|
371
|
+
focus_default["outset-ring--focus-except-active"],
|
|
372
|
+
variant !== "unstyled" && style_default.button,
|
|
373
|
+
style_default[`is-${tone}`],
|
|
374
|
+
style_default[`is-${variant}`],
|
|
375
|
+
style_default[`is-${size}`],
|
|
376
|
+
loading && style_default["is-loading"],
|
|
377
|
+
className
|
|
378
|
+
);
|
|
379
|
+
(0, import_element.useEffect)(() => {
|
|
380
|
+
if (loading && loadingAnnouncement) {
|
|
381
|
+
(0, import_a11y.speak)(loadingAnnouncement);
|
|
382
|
+
}
|
|
383
|
+
}, [loading, loadingAnnouncement]);
|
|
384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
385
|
+
import_button.Button,
|
|
386
|
+
{
|
|
387
|
+
ref,
|
|
388
|
+
className: mergedClassName,
|
|
389
|
+
focusableWhenDisabled,
|
|
390
|
+
disabled: disabled ?? loading,
|
|
391
|
+
...props,
|
|
392
|
+
children
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
398
|
+
0 && (module.exports = {
|
|
399
|
+
Button
|
|
400
|
+
});
|
|
401
|
+
//# sourceMappingURL=button.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/button/button.tsx", "../../src/button/style.module.css", "../../src/utils/css/resets.module.css", "../../src/utils/css/focus.module.css"],
|
|
4
|
+
"sourcesContent": ["import { Button as _Button } from '@base-ui/react/button';\nimport clsx from 'clsx';\nimport { speak } from '@wordpress/a11y';\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { type ButtonProps } from './types';\nimport styles from './style.module.css';\nimport resetStyles from '../utils/css/resets.module.css';\nimport focusStyles from '../utils/css/focus.module.css';\n\nexport const Button = forwardRef< HTMLButtonElement, ButtonProps >(\n\tfunction Button(\n\t\t{\n\t\t\ttone = 'brand',\n\t\t\tvariant = 'solid',\n\t\t\tsize = 'default',\n\t\t\tclassName,\n\t\t\tfocusableWhenDisabled = true,\n\t\t\tdisabled,\n\t\t\tloading,\n\t\t\tloadingAnnouncement = __( 'Loading' ),\n\t\t\tchildren,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) {\n\t\tconst mergedClassName = clsx(\n\t\t\tresetStyles[ 'box-sizing' ],\n\t\t\tfocusStyles[ 'outset-ring--focus-except-active' ],\n\t\t\tvariant !== 'unstyled' && styles.button,\n\t\t\tstyles[ `is-${ tone }` ],\n\t\t\tstyles[ `is-${ variant }` ],\n\t\t\tstyles[ `is-${ size }` ],\n\t\t\tloading && styles[ 'is-loading' ],\n\t\t\tclassName\n\t\t);\n\n\t\t// Announce loading state to assistive technology\n\t\tuseEffect( () => {\n\t\t\tif ( loading && loadingAnnouncement ) {\n\t\t\t\tspeak( loadingAnnouncement );\n\t\t\t}\n\t\t}, [ loading, loadingAnnouncement ] );\n\n\t\treturn (\n\t\t\t<_Button\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ mergedClassName }\n\t\t\t\tfocusableWhenDisabled={ focusableWhenDisabled }\n\t\t\t\tdisabled={ disabled ?? loading }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</_Button>\n\t\t);\n\t}\n);\n", "const css = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;\n\n@layer wp-ui-components {\n\t.style-module__button__l7D8M,\n\t.style-module__is-unstyled__q7snL {\n\t\tappearance: none;\n\t\tpadding: 0;\n\t}\n\n\t.style-module__button__l7D8M {\n\t\t/* Internal variables */\n\t\t--wp-ui-button-font-weight: 499;\n\n\t\t--wp-ui-button-background-color: var(--wpds-color-bg-interactive-brand-strong);\n\t\t--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-brand-strong-active);\n\t\t--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-strong-disabled);\n\t\t--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-brand-strong);\n\t\t--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-brand-strong-active);\n\t\t--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-strong-disabled);\n\t\t--wp-ui-button-padding-inline: calc(3 * var(--wpds-dimension-base)); /* TODO: Create new interactive padding tokens */\n\t\t--wp-ui-button-height: 40px;\n\t\t--wp-ui-button-aspect-ratio: auto; /* Useful for overrides such as icon buttons */\n\t\t--wp-ui-button-font-size: var(--wpds-font-size-md);\n\n\t\t/* by default, borders have the same color as the background */\n\t\t--wp-ui-button-border-color: var(--wp-ui-button-background-color);\n\t\t--wp-ui-button-border-color-active: var(--wp-ui-button-background-color-active);\n\t\t--wp-ui-button-border-color-disabled: var(--wp-ui-button-background-color-disabled);\n\n\t\t/* Styles */\n\t\tposition: relative;\n\t\tdisplay: inline-flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tgap: calc(2 * var(--wpds-dimension-base)); /* TODO: Consider new interactive/control gap tokens */\n\t\taspect-ratio: var(--wp-ui-button-aspect-ratio);\n\t\theight: var(--wp-ui-button-height);\n\t\tpadding-inline: var(--wp-ui-button-padding-inline);\n\t\tborder-style: solid;\n\t\tborder-width: 1px;\n\t\tborder-color: var(--wp-ui-button-border-color);\n\t\tborder-radius: var(--wpds-border-radius-surface-sm);\n\t\tbackground-color: var(--wp-ui-button-background-color);\n\t\tbackground-clip: padding-box;\n\t\tfont-family: var(--wpds-font-family-body);\n\t\tfont-size: var(--wp-ui-button-font-size);\n\t\tfont-weight: var(--wp-ui-button-font-weight);\n\t\tline-height: var(--wpds-font-line-height-sm);\n\t\ttext-decoration: none;\n\t\tcolor: var(--wp-ui-button-foreground-color);\n\n\t\t@media not ( prefers-reduced-motion ) {\n\t\t\ttransition: color 0.1s ease-out;\n\n\t\t\t* {\n\t\t\t\ttransition: opacity 0.1s ease-out;\n\t\t\t}\n\t\t}\n\n\t\t/* Use pointer cursor for buttons that are links */\n\t\t&[href] {\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t/* Make sure that links rendered as children of \\`Button\\` use button styles */\n\t\t*[href] {\n\t\t\tcolor: inherit;\n\t\t\ttext-decoration: inherit;\n\t\t}\n\n\t\t/* States */\n\t\t&:not([aria-disabled=\"true\"]):is(:hover, :active, :focus) {\n\t\t\t/* hover/active/focus states apply when the button is not disabled. A non\n\t\t\tdisabled, loading button will have hover/active/focus styles */\n\t\t\t--wp-ui-button-background-color: var(--wp-ui-button-background-color-active);\n\t\t\t--wp-ui-button-foreground-color: var(--wp-ui-button-foreground-color-active);\n\t\t\t--wp-ui-button-border-color: var(--wp-ui-button-border-color-active);\n\t\t}\n\n\t\t&[aria-disabled=\"true\"]:not(.style-module__is-loading__kUtC8) {\n\t\t\t/* A loading button, even when disabled, won't \"look\" disabled */\n\t\t\t--wp-ui-button-background-color: var(--wp-ui-button-background-color-disabled);\n\t\t\t--wp-ui-button-foreground-color: var(--wp-ui-button-foreground-color-disabled);\n\t\t\t--wp-ui-button-border-color: var(--wp-ui-button-border-color-disabled);\n\n\t\t\t@media ( forced-colors: active ) {\n\t\t\t\tborder-color: GrayText;\n\t\t\t\tcolor: GrayText;\n\t\t\t}\n\t\t}\n\n\t\t/* Loading spinner \u2014 not animated and hidden unless in loading state */\n\t\t&::before {\n\t\t\tcontent: \"\";\n\t\t\tposition: absolute;\n\t\t\ttop: 50%;\n\t\t\tinset-inline-start: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\n\t\t\tdisplay: block;\n\t\t\tbox-sizing: border-box;\n\t\t\theight: var(--wp-ui-button-font-size);\n\t\t\taspect-ratio: 1;\n\n\t\t\tborder: var(--wpds-border-width-interactive-focus) solid;\n\t\t\tborder-block-start-color: var(--wp-ui-button-foreground-color);\n\t\t\tborder-inline-end-color: var(--wp-ui-button-foreground-color);\n\t\t\tborder-block-end-color: transparent;\n\t\t\tborder-inline-start-color: transparent;\n\t\t\tborder-radius: 50%;\n\n\t\t\tpointer-events: none;\n\t\t\topacity: 0;\n\n\t\t\t@media not ( prefers-reduced-motion ) {\n\t\t\t\ttransition: opacity 0.1s ease-out;\n\t\t\t}\n\t\t}\n\t}\n\n\t.style-module__is-small__kIIFR {\n\t\t--wp-ui-button-padding-inline: calc(2 * var(--wpds-dimension-base)); /* TODO: Create new interactive padding tokens */\n\t\t--wp-ui-button-height: 24px;\n\t}\n\n\t/* Variants (\\`tone\\` + \\`variant\\`) overrides compared to default styles */\n\n\t/* All outline buttons have a border */\n\t.style-module__is-brand__3UYMl {\n\t\t/* no need to redefine variables for .is-brand.is-solid as it's the default variant */\n\n\t\t/* Outline and minimal buttons use the same foreground color */\n\t\t&.style-module__is-outline__YtWne,\n\t\t&.style-module__is-minimal__rQYZo {\n\t\t\t--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-brand);\n\t\t\t--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-brand-active);\n\t\t\t--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-disabled);\n\t\t}\n\n\t\t&.style-module__is-outline__YtWne {\n\t\t\t--wp-ui-button-background-color: var(--wpds-color-bg-interactive-brand-weak);\n\t\t\t--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-brand-weak-active);\n\t\t\t--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);\n\t\t\t--wp-ui-button-border-color: var(--wpds-color-stroke-interactive-brand);\n\t\t\t--wp-ui-button-border-color-active: var(--wpds-color-stroke-interactive-brand-active);\n\t\t\t--wp-ui-button-border-color-disabled: var(--wpds-color-stroke-interactive-neutral-disabled);\n\t\t}\n\n\t\t&.style-module__is-minimal__rQYZo {\n\t\t\t--wp-ui-button-background-color: var(--wpds-color-bg-interactive-brand-weak);\n\t\t\t--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-brand-weak-active);\n\t\t\t--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);\n\t\t}\n\t}\n\n\t.style-module__is-neutral__5yKo- {\n\t\t&.style-module__is-solid__tQszW {\n\t\t\t--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-strong);\n\t\t\t--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-strong-active);\n\t\t\t--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-strong-disabled);\n\t\t\t--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral-strong);\n\t\t\t--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-strong-active);\n\t\t\t--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-strong-disabled);\n\t\t}\n\n\t\t/* Outline and minimal buttons use the same foreground color */\n\t\t&.style-module__is-outline__YtWne,\n\t\t&.style-module__is-minimal__rQYZo {\n\t\t\t--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral);\n\t\t\t--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-active);\n\t\t\t--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-disabled);\n\t\t}\n\n\t\t&.style-module__is-outline__YtWne {\n\t\t\t--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-weak);\n\t\t\t--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-weak-active);\n\t\t\t--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);\n\t\t\t--wp-ui-button-border-color: var(--wpds-color-stroke-interactive-neutral);\n\t\t\t--wp-ui-button-border-color-active: var(--wpds-color-stroke-interactive-neutral-active);\n\t\t\t--wp-ui-button-border-color-disabled: var(--wpds-color-stroke-interactive-neutral-disabled);\n\t\t}\n\n\t\t&.style-module__is-minimal__rQYZo {\n\t\t\t--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-weak);\n\t\t\t--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-weak-active);\n\t\t\t--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);\n\t\t}\n\t}\n\n\t.style-module__is-unstyled__q7snL {\n\t\tborder: none;\n\t\tbackground: none;\n\t}\n\n\t.style-module__is-compact__z1nPG {\n\t\t--wp-ui-button-height: 32px;\n\t}\n\n\t.style-module__is-loading__kUtC8 {\n\t\tcolor: transparent;\n\n\t\t* {\n\t\t\topacity: 0;\n\t\t}\n\n\t\t&::before {\n\t\t\ttransition-delay: 0.05s;\n\t\t\topacity: 1;\n\n\t\t\t@media not ( prefers-reduced-motion ) {\n\t\t\t\tanimation: style-module__loading-animation__Wh1T2 1s linear infinite;\n\t\t\t}\n\t\t}\n\t}\n\n\t[aria-pressed=\"true\"].style-module__is-minimal__rQYZo.style-module__is-neutral__5yKo- {\n\t\t--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-strong);\n\t\t--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-strong);\n\t\t--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral-strong);\n\t\t--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-strong);\n\t}\n}\n\n@keyframes style-module__loading-animation__Wh1T2 {\n\t0% {\n\t\ttransform: translate(-50%, -50%) rotate(0deg);\n\t}\n\n\t100% {\n\t\ttransform: translate(-50%, -50%) rotate(360deg);\n\t}\n}\n`;\ndocument.head\n .appendChild(document.createElement(\"style\"))\n .appendChild(document.createTextNode(css));\nexport {css};\nexport default {\n \"button\": \"style-module__button__l7D8M\",\n \"is-unstyled\": \"style-module__is-unstyled__q7snL\",\n \"is-loading\": \"style-module__is-loading__kUtC8\",\n \"is-small\": \"style-module__is-small__kIIFR\",\n \"is-brand\": \"style-module__is-brand__3UYMl\",\n \"is-outline\": \"style-module__is-outline__YtWne\",\n \"is-minimal\": \"style-module__is-minimal__rQYZo\",\n \"is-neutral\": \"style-module__is-neutral__5yKo-\",\n \"is-solid\": \"style-module__is-solid__tQszW\",\n \"is-compact\": \"style-module__is-compact__z1nPG\",\n \"loading-animation\": \"style-module__loading-animation__Wh1T2\"\n};", "const css = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;\n\n@layer wp-ui-utilities {\n\t.resets-module__box-sizing__M2zT5 {\n\t\tbox-sizing: border-box;\n\n\t\t*,\n\t\t*::before,\n\t\t*::after {\n\t\t\tbox-sizing: inherit;\n\t\t}\n\t}\n}\n`;\ndocument.head\n .appendChild(document.createElement(\"style\"))\n .appendChild(document.createTextNode(css));\nexport {css};\nexport default {\n \"box-sizing\": \"resets-module__box-sizing__M2zT5\"\n};", "const css = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;\n\n@layer wp-ui-utilities {\n\t.focus-module__outset-ring--focus__COii5,\n\t.focus-module__outset-ring--focus-except-active__4lsr3,\n\t.focus-module__outset-ring--focus-visible__0FQby,\n\t.focus-module__outset-ring--focus-within__zYPfw,\n\t.focus-module__outset-ring--focus-within-except-active__lw0E3,\n\t.focus-module__outset-ring--focus-within-visible__xcs-5 {\n\t\t@media not ( prefers-reduced-motion ) {\n\t\t\ttransition: outline 0.1s ease-out;\n\t\t}\n\n\t\t/* Outline width must be kept at 0 even with a transparent color,\n\t\tor else the outline will be visible in forced-colors mode. */\n\t\toutline-width: 0;\n\t\toutline-style: solid;\n\t\toutline-color: transparent;\n\t\toutline-offset: 1px;\n\t}\n\n\t.focus-module__outset-ring--focus__COii5:focus,\n\t.focus-module__outset-ring--focus-except-active__4lsr3:focus:not(:active),\n\t.focus-module__outset-ring--focus-visible__0FQby:focus-visible,\n\t.focus-module__outset-ring--focus-within__zYPfw:focus-within,\n\t.focus-module__outset-ring--focus-within-except-active__lw0E3:focus-within:not(:has(:active)),\n\t.focus-module__outset-ring--focus-within-visible__xcs-5:focus-within:has(:focus-visible) {\n\t\toutline-width: var(--wpds-border-width-interactive-focus);\n\t\toutline-color: var(--wpds-color-stroke-focus-brand);\n\t}\n}\n`;\ndocument.head\n .appendChild(document.createElement(\"style\"))\n .appendChild(document.createTextNode(css));\nexport {css};\nexport default {\n \"outset-ring--focus\": \"focus-module__outset-ring--focus__COii5\",\n \"outset-ring--focus-except-active\": \"focus-module__outset-ring--focus-except-active__4lsr3\",\n \"outset-ring--focus-visible\": \"focus-module__outset-ring--focus-visible__0FQby\",\n \"outset-ring--focus-within\": \"focus-module__outset-ring--focus-within__zYPfw\",\n \"outset-ring--focus-within-except-active\": \"focus-module__outset-ring--focus-within-except-active__lw0E3\",\n \"outset-ring--focus-within-visible\": \"focus-module__outset-ring--focus-within-visible__xcs-5\"\n};"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["css", "css", "Button", "clsx", "_Button"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/ui/src/button/icon.tsx
|
|
21
|
+
var icon_exports = {};
|
|
22
|
+
__export(icon_exports, {
|
|
23
|
+
ButtonIcon: () => ButtonIcon
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(icon_exports);
|
|
26
|
+
var import_element = require("@wordpress/element");
|
|
27
|
+
var import_icon = require("../icon/index.cjs");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var ButtonIcon = (0, import_element.forwardRef)(
|
|
30
|
+
function ButtonIcon2({ icon, ...props }, ref) {
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
+
import_icon.Icon,
|
|
33
|
+
{
|
|
34
|
+
ref,
|
|
35
|
+
icon,
|
|
36
|
+
viewBox: "4 4 16 16",
|
|
37
|
+
size: 16,
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
ButtonIcon
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=icon.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/button/icon.tsx"],
|
|
4
|
+
"sourcesContent": ["import { forwardRef } from '@wordpress/element';\nimport { type IconProps } from '../icon/types';\nimport { Icon } from '../icon';\n\ninterface ButtonIconProps extends IconProps {\n\t/**\n\t * The icon to display, from the `@wordpress/icons` package.\n\t */\n\ticon: IconProps[ 'icon' ];\n}\n\nexport const ButtonIcon = forwardRef< SVGSVGElement, ButtonIconProps >(\n\tfunction ButtonIcon( { icon, ...props }, ref ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tref={ ref }\n\t\t\t\ticon={ icon }\n\t\t\t\tviewBox=\"4 4 16 16\"\n\t\t\t\tsize={ 16 }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2B;AAE3B,kBAAqB;AAYlB;AAHI,IAAM,iBAAa;AAAA,EACzB,SAASA,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,KAAM;AAC9C,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAQ;AAAA,QACR,MAAO;AAAA,QACL,GAAG;AAAA;AAAA,IACN;AAAA,EAEF;AACD;",
|
|
6
|
+
"names": ["ButtonIcon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/ui/src/button/index.ts
|
|
21
|
+
var button_exports = {};
|
|
22
|
+
__export(button_exports, {
|
|
23
|
+
Button: () => Button
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(button_exports);
|
|
26
|
+
var import_button = require("./button.cjs");
|
|
27
|
+
var import_icon = require("./icon.cjs");
|
|
28
|
+
var Button = Object.assign(import_button.Button, {
|
|
29
|
+
/**
|
|
30
|
+
* An icon component specifically designed to work well when rendered inside
|
|
31
|
+
* a `Button` component.
|
|
32
|
+
*/
|
|
33
|
+
Icon: import_icon.ButtonIcon
|
|
34
|
+
});
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
Button
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/button/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Button as ButtonButton } from './button';\nimport { ButtonIcon } from './icon';\n\n/**\n * A versatile button component with multiple variants, tones, and sizes.\n * Built on design tokens for consistent theming and accessibility.\n */\nexport const Button = Object.assign( ButtonButton, {\n\t/**\n\t * An icon component specifically designed to work well when rendered inside\n\t * a `Button` component.\n\t */\n\tIcon: ButtonIcon,\n} ) as typeof ButtonButton & {\n\tIcon: typeof ButtonIcon;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuC;AACvC,kBAA2B;AAMpB,IAAM,SAAS,OAAO,OAAQ,cAAAA,QAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlD,MAAM;AACP,CAAE;",
|
|
6
|
+
"names": ["ButtonButton"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// packages/ui/src/button/types.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
19
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/button/types.ts"],
|
|
4
|
+
"sourcesContent": ["import { type ReactNode, type HTMLAttributes } from 'react';\nimport type { Button as _Button } from '@base-ui/react/button';\nimport type { ComponentProps } from '../utils/types';\n\ntype _ButtonProps = ComponentProps< typeof _Button >;\n\nexport interface ButtonProps\n\textends Omit< _ButtonProps, 'disabled' | 'aria-pressed' > {\n\t/**\n\t * The variant of the button. Variants describe the visual style treatment\n\t * of the button.\n\t *\n\t * @default \"solid\"\n\t */\n\tvariant?: 'solid' | 'outline' | 'minimal' | 'unstyled';\n\n\t/**\n\t * The tone of the button, describing a semantic color intent:\n\t *\n\t * - `'brand': for the most prominent actions, using the brand colors.\n\t * - `'neutral'` for less prominent actions.\n\t *\n\t * @default \"brand\"\n\t */\n\ttone?: 'brand' | 'neutral';\n\n\t/**\n\t * The size of the button.\n\t *\n\t * - `'default'`: For normal text-label buttons, unless it is a toggle button.\n\t * - `'compact'`: For toggle buttons, icon buttons, and buttons when used in context of either.\n\t * - `'small'`: For icon buttons associated with more advanced or auxiliary features.\n\t *\n\t * @default \"default\"\n\t */\n\tsize?: 'default' | 'compact' | 'small';\n\n\t/**\n\t * Whether the button is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the element should be focusable even when it is disabled.\n\t *\n\t * @default true\n\t */\n\tfocusableWhenDisabled?: _ButtonProps[ 'focusableWhenDisabled' ];\n\n\t/**\n\t * Indicates the current \"pressed\" state of toggle buttons. This should only\n\t * be used with neutral minimal buttons.\n\t */\n\t'aria-pressed'?: HTMLAttributes< HTMLButtonElement >[ 'aria-pressed' ];\n\n\t/**\n\t * The content of the button.\n\t */\n\tchildren?: ReactNode;\n\n\t/**\n\t * Whether the button is in a loading state, such as when an action is being\n\t * performed.\n\t * @default false\n\t */\n\tloading?: boolean;\n\n\t/**\n\t * The text used for assistive technology to indicate the loading state.\n\t */\n\tloadingAnnouncement?: string;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|