@3fn/core 13.0.0 → 14.1.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/.kiro/agents/ada-prompt.md +80 -132
- package/.kiro/agents/ada-prompt.md.attribution.json +45 -0
- package/.kiro/agents/ada.json +44 -59
- package/.kiro/agents/ada.json.attribution.json +13 -0
- package/.kiro/agents/data-prompt.md +83 -74
- package/.kiro/agents/data-prompt.md.attribution.json +53 -0
- package/.kiro/agents/data.json +31 -38
- package/.kiro/agents/data.json.attribution.json +13 -0
- package/.kiro/agents/kenya-prompt.md +83 -72
- package/.kiro/agents/kenya-prompt.md.attribution.json +53 -0
- package/.kiro/agents/kenya.json +27 -35
- package/.kiro/agents/kenya.json.attribution.json +13 -0
- package/.kiro/agents/leonardo-prompt.md +176 -234
- package/.kiro/agents/leonardo-prompt.md.attribution.json +45 -0
- package/.kiro/agents/leonardo.json +28 -36
- package/.kiro/agents/leonardo.json.attribution.json +13 -0
- package/.kiro/agents/lina-prompt.md +110 -151
- package/.kiro/agents/lina-prompt.md.attribution.json +53 -0
- package/.kiro/agents/lina.json +46 -59
- package/.kiro/agents/lina.json.attribution.json +13 -0
- package/.kiro/agents/sparky-prompt.md +89 -72
- package/.kiro/agents/sparky-prompt.md.attribution.json +53 -0
- package/.kiro/agents/sparky.json +37 -37
- package/.kiro/agents/sparky.json.attribution.json +13 -0
- package/.kiro/agents/stacy-prompt.md +74 -48
- package/.kiro/agents/stacy-prompt.md.attribution.json +45 -0
- package/.kiro/agents/stacy.json +28 -30
- package/.kiro/agents/stacy.json.attribution.json +13 -0
- package/.kiro/agents/thurgood-prompt.md +94 -138
- package/.kiro/agents/thurgood-prompt.md.attribution.json +45 -0
- package/.kiro/agents/thurgood.json +31 -35
- package/.kiro/agents/thurgood.json.attribution.json +13 -0
- package/.kiro/steering/AI-Collaboration-Principles.md +3 -3
- package/.kiro/steering/Civitas-System-Overview.md +7 -16
- package/.kiro/steering/DesignerPunk-Systems-Overview.md +6 -6
- package/.kiro/steering/Spec-Feedback-Protocol.md +2 -11
- package/.kiro/steering/Task-Completion-Protocol.md +98 -17
- package/.kiro/steering/core-goals.md +3 -3
- package/.kiro/steering/personal-note.md +1 -1
- package/.kiro/steering/start-up-tasks.md +17 -6
- package/application-mcp-server/src/index.ts +26 -0
- package/dist/ComponentTokens.android.kt +12 -12
- package/dist/ComponentTokens.ios.swift +12 -12
- package/dist/ComponentTokens.web.css +3 -3
- package/dist/DesignTokens.android.kt +1 -1
- package/dist/DesignTokens.dtcg.json +8 -5
- package/dist/DesignTokens.figma.json +2 -2
- package/dist/DesignTokens.ios.swift +1 -1
- package/dist/DesignTokens.web.css +1 -1
- package/dist/android/DesignTokens.android.kt +1 -1
- package/dist/blend/OklchBlendCalculator.js +1 -0
- package/dist/blend/ThemeAwareBlendUtilities.web.d.ts +13 -2
- package/dist/blend/ThemeAwareBlendUtilities.web.js +6 -1
- package/dist/browser/designerpunk.esm.js +36 -90
- package/dist/browser/designerpunk.esm.min.js +33 -36
- package/dist/browser/designerpunk.umd.js +36 -90
- package/dist/browser/designerpunk.umd.min.js +47 -50
- package/dist/browser/tokens.css +3 -3
- package/dist/build/tokens/defineComponentTokens.d.ts +10 -0
- package/dist/build/tokens/defineComponentTokens.js +26 -0
- package/dist/components/core/Avatar-Base/avatar.tokens.d.ts +21 -26
- package/dist/components/core/Avatar-Base/avatar.tokens.js +31 -34
- package/dist/components/core/Avatar-Base/index.d.ts +1 -1
- package/dist/components/core/Avatar-Base/index.js +2 -2
- package/dist/components/core/Avatar-Base/platforms/web/Avatar.web.js +24 -5
- package/dist/components/core/Button-CTA/examples/BasicUsage.d.ts +16 -28
- package/dist/components/core/Button-CTA/examples/BasicUsage.js +18 -43
- package/dist/components/core/Button-CTA/platforms/web/ButtonCTA.web.d.ts +3 -15
- package/dist/components/core/Button-CTA/platforms/web/ButtonCTA.web.js +9 -58
- package/dist/components/core/Button-CTA/types.d.ts +0 -24
- package/dist/components/core/Button-CTA/types.js +6 -0
- package/dist/components/core/Button-Icon/buttonIcon.tokens.d.ts +28 -14
- package/dist/components/core/Button-Icon/buttonIcon.tokens.js +35 -20
- package/dist/components/core/Input-Text-Base/types.d.ts +13 -1
- package/dist/components/core/Input-Text-Password/platforms/web/InputTextPassword.web.js +11 -2
- package/dist/generators/DTCGFormatGenerator.js +8 -0
- package/dist/generators/TokenFileGenerator.js +7 -2
- package/dist/integration/BuildErrorHandler.js +2 -2
- package/dist/ios/DesignTokens.ios.swift +1 -1
- package/dist/mcp/application-mcp.js +24 -0
- package/dist/mcp/docs-mcp.js +130 -15
- package/dist/mcp/product-mcp.js +25 -0
- package/dist/tokens/OpacityTokens.js +1 -1
- package/dist/tokens/component/progress.d.ts +65 -5
- package/dist/tokens/component/progress.js +79 -18
- package/dist/tokens/semantic/BlendTokens.d.ts +10 -3
- package/dist/tokens/semantic/BlendTokens.js +17 -5
- package/dist/tokens/semantic/OpacityTokens.d.ts +4 -4
- package/dist/tokens/semantic/OpacityTokens.js +4 -4
- package/dist/types/ComponentTypes.d.ts +1 -1
- package/dist/types/generated/TokenTypes.d.ts +1 -1
- package/dist/types/generated/TokenTypes.js +1 -1
- package/dist/validators/StemmaTokenUsageValidator.js +3 -2
- package/dist/web/DesignTokens.web.css +1 -1
- package/governance/BUILD-SYSTEM-SETUP.md +1 -2
- package/governance/Component-Development-Guide.md +23 -13
- package/governance/Component-Development-Standards.md +21 -20
- package/governance/Component-Family-Avatar.md +6 -7
- package/governance/Component-Family-Badge.md +19 -20
- package/governance/Component-Family-Button.md +30 -43
- package/governance/Component-Family-Chip.md +14 -15
- package/governance/Component-Family-Container.md +12 -13
- package/governance/Component-Family-Data-Display.md +1 -2
- package/governance/Component-Family-Divider.md +1 -2
- package/governance/Component-Family-Form-Inputs.md +65 -65
- package/governance/Component-Family-Icon.md +9 -10
- package/governance/Component-Family-Loading.md +1 -2
- package/governance/Component-Family-Modal.md +1 -2
- package/governance/Component-Family-Navigation.md +1 -2
- package/governance/Component-Family-Progress.md +0 -1
- package/governance/Component-Inheritance-Structures.md +219 -99
- package/governance/Component-MCP-Document-Template.md +6 -5
- package/governance/Component-Primitive-vs-Semantic-Philosophy.md +1 -1
- package/governance/Component-Quick-Reference.md +33 -33
- package/governance/Component-Readiness-Status.md +59 -44
- package/governance/Component-Templates.md +57 -61
- package/governance/Contract-System-Reference.md +7 -7
- package/governance/MCP-Integration-Guide.md +1 -1
- package/governance/Process-Cross-Reference-Standards.md +31 -13
- package/governance/Process-Development-Workflow.md +49 -59
- package/governance/Process-File-Organization.md +25 -28
- package/governance/Process-Hook-Operations.md +22 -11
- package/governance/Process-Orchestration-Model-Selection.md +92 -0
- package/governance/Process-Spec-Planning.md +98 -52
- package/governance/Process-Task-Type-Definitions.md +80 -4
- package/governance/Product-Handoff-Protocol.md +2 -0
- package/governance/Rosetta-System-Architecture.md +13 -11
- package/governance/Test-Behavioral-Contract-Validation.md +38 -31
- package/governance/Test-Failure-Audit-Methodology.md +1 -1
- package/governance/Token-Family-Accessibility.md +1 -2
- package/governance/Token-Family-Blend.md +18 -16
- package/governance/Token-Family-Blur.md +0 -1
- package/governance/Token-Family-Border.md +1 -2
- package/governance/Token-Family-Color.md +0 -1
- package/governance/Token-Family-Glow.md +1 -2
- package/governance/Token-Family-Layering.md +0 -1
- package/governance/Token-Family-Motion.md +1 -2
- package/governance/Token-Family-Opacity.md +0 -1
- package/governance/Token-Family-Radius.md +1 -2
- package/governance/Token-Family-Responsive.md +1 -2
- package/governance/Token-Family-Shadow.md +1 -2
- package/governance/Token-Family-Sizing.md +0 -1
- package/governance/Token-Family-Spacing.md +1 -2
- package/governance/Token-Family-Typography.md +1 -2
- package/governance/Token-Governance.md +8 -8
- package/governance/Token-Quick-Reference.md +47 -34
- package/governance/Token-Resolution-Patterns.md +1 -1
- package/governance/Token-Semantic-Structure.md +1 -1
- package/governance/Web-Authoring-Standards.md +5 -5
- package/governance/browser-distribution-guide.md +1 -4
- package/governance/classification-map.md +474 -0
- package/governance/completion-documentation-guide.md +23 -37
- package/governance/component-meta-authoring-guide.md +1 -1
- package/governance/cross-platform-vs-platform-specific-decision-framework.md +1 -1
- package/governance/platform-implementation-guidelines.md +2 -3
- package/governance/release-management-system.md +28 -63
- package/governance/rosetta-system-principles.md +8 -6
- package/governance/stemma-system-principles.md +18 -17
- package/mcp-server/src/index.ts +24 -6
- package/mcp-server/src/indexer/DocumentIndexer.ts +119 -9
- package/mcp-server/src/indexer/__tests__/bare-id-crossrefs.test.ts +250 -0
- package/mcp-server/src/indexer/cross-ref-parser.ts +29 -1
- package/mcp-server/src/indexer/index-health.ts +27 -2
- package/mcp-server/src/query/__tests__/find-docs-calibration.test.ts +11 -26
- package/mcp-server/src/relocation-integrity-gate/__tests__/relocation-integrity-gate.test.ts +72 -5
- package/mcp-server/src/relocation-integrity-gate/relocation-integrity-gate.ts +81 -24
- package/mcp-server/src/tools/list-cross-references.ts +2 -2
- package/package.json +24 -26
- package/src/__tests__/browser-distribution/css-bundling.test.ts +6 -4
- package/src/__tests__/console-allowlist.json +14 -0
- package/src/__tests__/console-fail-setup.ts +169 -0
- package/src/__tests__/integration/Spec107-DesignLanguageContext.test.ts +16 -0
- package/src/__tests__/stemma-system/behavioral-contract-validation.test.ts +70 -17
- package/src/__tests__/stemma-system/contract-catalog-name-validation.test.ts +28 -0
- package/src/__tests__/stemma-system/form-inputs-contracts.test.ts +223 -16
- package/src/__tests__/stemma-system/input-text-native-base-call-alignment.test.ts +298 -0
- package/src/blend/OklchBlendCalculator.ts +3 -0
- package/src/blend/ThemeAwareBlendUtilities.android.kt +3 -0
- package/src/blend/ThemeAwareBlendUtilities.ios.swift +3 -0
- package/src/blend/ThemeAwareBlendUtilities.web.ts +9 -1
- package/src/blend/__tests__/InteractionStateAudit.test.ts +12 -9
- package/src/build/errors/__tests__/ErrorHandler.integration.test.ts +8 -0
- package/src/build/errors/__tests__/ErrorHandler.test.ts +5 -0
- package/src/build/tokens/__tests__/defineComponentTokens.test.ts +113 -0
- package/src/build/tokens/defineComponentTokens.ts +43 -1
- package/src/build/workflow/__tests__/CICDIntegration.test.ts +12 -1
- package/src/cli/__tests__/init.test.ts +45 -11
- package/src/components/core/Avatar-Base/Avatar-Base.schema.yaml +1 -1
- package/src/components/core/Avatar-Base/__tests__/Avatar.accessibility.test.ts +121 -7
- package/src/components/core/Avatar-Base/__tests__/Avatar.image.test.ts +3 -0
- package/src/components/core/Avatar-Base/__tests__/Avatar.test.ts +15 -6
- package/src/components/core/Avatar-Base/avatar.tokens.ts +31 -34
- package/src/components/core/Avatar-Base/contracts.yaml +11 -1
- package/src/components/core/Avatar-Base/index.ts +1 -1
- package/src/components/core/Avatar-Base/platforms/web/Avatar.web.ts +24 -5
- package/src/components/core/Badge-Count-Base/contracts.yaml +1 -1
- package/src/components/core/Badge-Label-Base/contracts.yaml +1 -1
- package/src/components/core/Button-CTA/Button-CTA.schema.yaml +2 -12
- package/src/components/core/Button-CTA/README.md +3 -6
- package/src/components/core/Button-CTA/__tests__/ButtonCTA.test.ts +35 -89
- package/src/components/core/Button-CTA/__tests__/setup.test.ts +0 -2
- package/src/components/core/Button-CTA/__tests__/test-utils.ts +0 -2
- package/src/components/core/Button-CTA/contracts.yaml +6 -29
- package/src/components/core/Button-CTA/examples/BasicUsage.html +2 -14
- package/src/components/core/Button-CTA/examples/BasicUsage.tsx +17 -44
- package/src/components/core/Button-CTA/platforms/android/ButtonCTA.android.kt +12 -20
- package/src/components/core/Button-CTA/platforms/ios/ButtonCTA.ios.swift +12 -51
- package/src/components/core/Button-CTA/platforms/web/ButtonCTA.web.css +2 -26
- package/src/components/core/Button-CTA/platforms/web/ButtonCTA.web.ts +18 -71
- package/src/components/core/Button-CTA/types.ts +10 -28
- package/src/components/core/Button-Icon/buttonIcon.tokens.ts +43 -27
- package/src/components/core/Chip-Base/__tests__/ChipBase.test.ts +13 -0
- package/src/components/core/Chip-Filter/__tests__/ChipFilter.test.ts +13 -0
- package/src/components/core/Chip-Input/__tests__/ChipInput.test.ts +13 -0
- package/src/components/core/Input-Text-Base/Input-Text-Base.schema.yaml +30 -2
- package/src/components/core/Input-Text-Base/README.md +25 -2
- package/src/components/core/Input-Text-Base/__tests__/focusIndicators.test.ts +16 -15
- package/src/components/core/Input-Text-Base/contracts.yaml +90 -0
- package/src/components/core/Input-Text-Base/platforms/android/InputTextBase.android.kt +26 -12
- package/src/components/core/Input-Text-Base/platforms/ios/InputTextBase.ios.swift +195 -59
- package/src/components/core/Input-Text-Base/types.ts +13 -1
- package/src/components/core/Input-Text-Email/Input-Text-Email.schema.yaml +5 -1
- package/src/components/core/Input-Text-Email/README.md +8 -7
- package/src/components/core/Input-Text-Email/platforms/android/InputTextEmail.android.kt +1 -4
- package/src/components/core/Input-Text-Email/platforms/ios/InputTextEmail.ios.swift +2 -16
- package/src/components/core/Input-Text-Password/Input-Text-Password.schema.yaml +10 -3
- package/src/components/core/Input-Text-Password/README.md +9 -8
- package/src/components/core/Input-Text-Password/contracts.yaml +5 -0
- package/src/components/core/Input-Text-Password/platforms/android/InputTextPassword.android.kt +17 -7
- package/src/components/core/Input-Text-Password/platforms/ios/InputTextPassword.ios.swift +22 -20
- package/src/components/core/Input-Text-Password/platforms/web/InputTextPassword.web.ts +11 -2
- package/src/components/core/Input-Text-PhoneNumber/Input-Text-PhoneNumber.schema.yaml +5 -1
- package/src/components/core/Input-Text-PhoneNumber/README.md +9 -8
- package/src/components/core/Input-Text-PhoneNumber/platforms/android/InputTextPhoneNumber.android.kt +2 -5
- package/src/components/core/Input-Text-PhoneNumber/platforms/ios/InputTextPhoneNumber.ios.swift +3 -17
- package/src/components/core/Nav-Header-App/contracts.yaml +1 -1
- package/src/components/core/Nav-SegmentedChoice-Base/contracts.yaml +1 -1
- package/src/components/core/Progress-Indicator-Connector-Base/contracts.yaml +1 -1
- package/src/components/core/Progress-Indicator-Label-Base/contracts.yaml +1 -1
- package/src/components/core/Progress-Indicator-Node-Base/contracts.yaml +1 -1
- package/src/components/core/Progress-Stepper-Base/__tests__/StepperBase.test.ts +5 -2
- package/src/components/core/Progress-Stepper-Detailed/__tests__/StepperDetailed.test.ts +5 -2
- package/src/generators/DTCGFormatGenerator.ts +6 -0
- package/src/generators/TokenFileGenerator.ts +7 -2
- package/src/generators/__tests__/DTCGConfigOptions.test.ts +14 -5
- package/src/integration/BuildErrorHandler.ts +2 -2
- package/src/tokens/OpacityTokens.ts +1 -1
- package/src/tokens/__tests__/OpacityTokens.test.ts +3 -1
- package/src/tokens/__tests__/ProgressTokenCompliance.test.ts +5 -3
- package/src/tokens/__tests__/ProgressTokenFormulas.test.ts +11 -11
- package/src/tokens/__tests__/ProgressTokenTranslation.test.ts +22 -20
- package/src/tokens/component/progress.ts +83 -21
- package/src/tokens/semantic/BlendTokens.ts +26 -5
- package/src/tokens/semantic/OpacityTokens.ts +4 -4
- package/src/types/ComponentTypes.ts +1 -1
- package/src/types/generated/TokenTypes.ts +1 -1
- package/src/validators/StemmaTokenUsageValidator.ts +3 -2
- package/token-index/components.yaml +8 -8
- package/token-index/semantics.yaml +1 -2
- package/src/tools/release/__tests__/ChangeClassifier.test.ts +0 -133
- package/src/tools/release/__tests__/ChangeExtractor.test.ts +0 -222
- package/src/tools/release/__tests__/GitHubPublisher.test.ts +0 -240
- package/src/tools/release/__tests__/NotesRenderer.test.ts +0 -142
- package/src/tools/release/__tests__/NpmPublisher.test.ts +0 -289
- package/src/tools/release/__tests__/PipelineIntegration.test.ts +0 -188
- package/src/tools/release/__tests__/ReleasePipeline.test.ts +0 -192
- package/src/tools/release/__tests__/SemanticVersionValidator.test.ts +0 -49
- package/src/tools/release/__tests__/SummaryScanner.test.ts +0 -141
- package/src/tools/release/__tests__/TagResolver.test.ts +0 -91
- package/src/tools/release/__tests__/VersionCalculator.test.ts +0 -270
- package/src/tools/release/__tests__/helpers/NpmMockHelper.ts +0 -80
- package/src/tools/release/cli/ReleasePipeline.ts +0 -165
- package/src/tools/release/cli/release-tool.ts +0 -107
- package/src/tools/release/pipeline/ChangeClassifier.ts +0 -61
- package/src/tools/release/pipeline/ChangeExtractor.ts +0 -87
- package/src/tools/release/pipeline/NotesRenderer.ts +0 -66
- package/src/tools/release/pipeline/SummaryScanner.ts +0 -70
- package/src/tools/release/pipeline/TagResolver.ts +0 -40
- package/src/tools/release/pipeline/VersionCalculator.ts +0 -375
- package/src/tools/release/publishers/GitHubPublisher.ts +0 -228
- package/src/tools/release/publishers/NpmPublisher.ts +0 -196
- package/src/tools/release/release-config.json +0 -5
- package/src/tools/release/types/index.ts +0 -282
- package/src/tools/release/validators/SemanticVersionValidator.ts +0 -67
package/dist/browser/tokens.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DesignerPunk Design System - Web Tokens
|
|
3
|
-
* Generated: 2026-
|
|
3
|
+
* Generated: 2026-08-26T14:15:24.233Z
|
|
4
4
|
* Version: 1.0.0
|
|
5
5
|
* Platform: Web (CSS Custom Properties)
|
|
6
6
|
*
|
|
@@ -998,6 +998,8 @@
|
|
|
998
998
|
--inputradio-box-lg: var(--size-500);
|
|
999
999
|
|
|
1000
1000
|
/* Progress Component Tokens */
|
|
1001
|
+
/* Connector line thickness (1px). References borderDefault primitive for consistent border treatment across the design system. */
|
|
1002
|
+
--progress-connector-thickness: var(--border-width-100);
|
|
1001
1003
|
/* Small node base size (12px). Inactive dots in compact mobile contexts. */
|
|
1002
1004
|
--progress-node-size-sm: var(--size-150);
|
|
1003
1005
|
/* Medium node base size (16px). Default inactive dot size. */
|
|
@@ -1016,8 +1018,6 @@
|
|
|
1016
1018
|
--progress-node-gap-md: var(--space-100);
|
|
1017
1019
|
/* Large gap between nodes (12px = 1.5× base). Generous spacing for detailed steppers with labels in desktop contexts. */
|
|
1018
1020
|
--progress-node-gap-lg: var(--space-150);
|
|
1019
|
-
/* Connector line thickness (1px). References borderDefault primitive for consistent border treatment across the design system. */
|
|
1020
|
-
--progress-connector-thickness: var(--border-width-100);
|
|
1021
1021
|
|
|
1022
1022
|
/* VerticalListItem Component Tokens */
|
|
1023
1023
|
/* Block padding at rest state (1px border). 11px padding + 1px border = 12px per side, achieving 48px total with 24px content. Uses TokenWithValue pattern as no primitive token exists for 11px. */
|
|
@@ -60,6 +60,16 @@ export interface PrimitiveTokenReference {
|
|
|
60
60
|
name: string;
|
|
61
61
|
/** Unitless base value from the primitive token */
|
|
62
62
|
baseValue: number;
|
|
63
|
+
/**
|
|
64
|
+
* Primitive token family (the `category` field of a `PrimitiveToken`, e.g. 'spacing',
|
|
65
|
+
* 'sizing', 'radius'). OPTIONAL for backward compatibility: minimal `{ name, baseValue }`
|
|
66
|
+
* reference literals remain valid.
|
|
67
|
+
*
|
|
68
|
+
* When present, it is cross-checked against the call's declared `family` by the
|
|
69
|
+
* family-mismatch guard in {@link defineComponentTokens}. Real primitives from
|
|
70
|
+
* src/tokens/** always carry it, so the guard is active for all production authoring.
|
|
71
|
+
*/
|
|
72
|
+
category?: string;
|
|
63
73
|
}
|
|
64
74
|
/**
|
|
65
75
|
* Token definition with primitive reference
|
|
@@ -125,6 +125,32 @@ function defineComponentTokens(config) {
|
|
|
125
125
|
if (isTokenWithReference(definition)) {
|
|
126
126
|
// Token with primitive reference
|
|
127
127
|
const primitiveToken = definition.reference;
|
|
128
|
+
// FAMILY-MISMATCH GUARD.
|
|
129
|
+
// The call's `family` is stamped onto every token it registers, and the generator
|
|
130
|
+
// derives platform output from it — notably the primitive class name used for
|
|
131
|
+
// reference-path tokens (getFamilyClassName) and the Android `.dp` suffix. A call
|
|
132
|
+
// that declares one family but references another family's primitive therefore emits
|
|
133
|
+
// a member that does not exist on the target platform. That is exactly the Button-Icon
|
|
134
|
+
// defect: a `family: 'spacing'` call referencing `sizingTokens.size600` generated
|
|
135
|
+
// `SpacingTokens.size600`, a non-existent member (PR #126).
|
|
136
|
+
//
|
|
137
|
+
// Only enforced when the reference carries a `category` — minimal `{ name, baseValue }`
|
|
138
|
+
// literals (used widely in tests) are intentionally exempt rather than rejected.
|
|
139
|
+
//
|
|
140
|
+
// Escape hatch: a token that legitimately needs another family's VALUE should use the
|
|
141
|
+
// value path (`value:`), which asserts no cross-family token-chain claim.
|
|
142
|
+
if (typeof primitiveToken.category === 'string' &&
|
|
143
|
+
primitiveToken.category !== family) {
|
|
144
|
+
throw new Error(`Token family mismatch in defineComponentTokens() for component '${component}': ` +
|
|
145
|
+
`token '${key}' is declared in a '${family}' family call but references primitive ` +
|
|
146
|
+
`'${primitiveToken.name}' from the '${primitiveToken.category}' family. ` +
|
|
147
|
+
`Every token in a call is stamped with that call's family, which drives platform ` +
|
|
148
|
+
`output (e.g. the generated '${family.charAt(0).toUpperCase() + family.slice(1)}Tokens' ` +
|
|
149
|
+
`class reference), so this would emit a non-existent platform member. ` +
|
|
150
|
+
`Fix: move '${key}' into a separate defineComponentTokens() call with ` +
|
|
151
|
+
`family: '${primitiveToken.category}', or use the value path if no token-chain ` +
|
|
152
|
+
`relationship is intended.`);
|
|
153
|
+
}
|
|
128
154
|
const value = primitiveToken.baseValue;
|
|
129
155
|
values[key] = value;
|
|
130
156
|
registeredTokens.push({
|
|
@@ -34,6 +34,15 @@
|
|
|
34
34
|
* - xs: calc(icon.size050 × 0.75) = 12px
|
|
35
35
|
* - xxl: calc(icon.size050 × 4) = 64px
|
|
36
36
|
*
|
|
37
|
+
* TOKEN FAMILY: all dimensional Avatar tokens (container `size.*` AND icon
|
|
38
|
+
* `icon.size.*` gap fillers) are registered by the single sizing-family call
|
|
39
|
+
* `AvatarSizingTokens` below. The `icon.size.*` pair previously lived in a
|
|
40
|
+
* separate `AvatarTokens` call stamped `family: 'spacing'` — a mislabel, since
|
|
41
|
+
* both are dimensional sizing values. `AvatarTokens` is removed; consumers use
|
|
42
|
+
* `AvatarSizingTokens` or the `getAvatarIconSize()` / `getAvatarSize()` accessors.
|
|
43
|
+
* Generated platform output is unaffected: both calls declare `component: 'Avatar'`,
|
|
44
|
+
* so all tokens still land in one `AvatarTokens` Swift enum / Kotlin object.
|
|
45
|
+
*
|
|
37
46
|
* COLOR TOKENS (Spec 058):
|
|
38
47
|
* Avatar color tokens are defined in this file following the Rosetta System architecture
|
|
39
48
|
* which mandates component tokens live at src/components/[ComponentName]/tokens.ts.
|
|
@@ -52,13 +61,24 @@
|
|
|
52
61
|
* @see .kiro/specs/058-component-token-architecture-cleanup for color token migration
|
|
53
62
|
*/
|
|
54
63
|
/**
|
|
55
|
-
* Avatar sizing tokens — container dimensions for each size variant.
|
|
64
|
+
* Avatar sizing tokens — container dimensions and icon dimensions for each size variant.
|
|
56
65
|
*
|
|
57
66
|
* Previously in a separate file (avatar-sizing.tokens.ts). Inlined to prevent
|
|
58
67
|
* architectural anomaly (no other component splits tokens across files) and
|
|
59
68
|
* simplify the package surface for sync.
|
|
60
69
|
*
|
|
70
|
+
* ONE CALL PER FAMILY. Every token registered by a single defineComponentTokens()
|
|
71
|
+
* call is stamped with that call's `family`, and the family drives platform output
|
|
72
|
+
* (Swift type, Kotlin `.dp` suffix, primitive class name). The `icon.size.*` gap
|
|
73
|
+
* fillers below are dimensional sizing values, so they live in this sizing-family
|
|
74
|
+
* call — they were previously mis-stamped `family: 'spacing'` in a separate
|
|
75
|
+
* `AvatarTokens` call, the same latent mislabel class fixed for Button-Icon.
|
|
76
|
+
* Do NOT spread/merge this result with another call's result — the rich metadata
|
|
77
|
+
* rides on a non-enumerable brand (see src/build/tokens/defineComponentTokens.ts,
|
|
78
|
+
* TOKEN_CONTRACT_BRAND) that a spread would silently drop.
|
|
79
|
+
*
|
|
61
80
|
* @see .kiro/specs/092-sizing-token-family/design.md
|
|
81
|
+
* @see src/components/core/Button-Icon/buttonIcon.tokens.ts for the two-call pattern
|
|
62
82
|
*/
|
|
63
83
|
export declare const AvatarSizingTokens: import("../../../build/tokens").ComponentTokenValues<{
|
|
64
84
|
'size.xs': {
|
|
@@ -85,31 +105,6 @@ export declare const AvatarSizingTokens: import("../../../build/tokens").Compone
|
|
|
85
105
|
reference: import("../../../types").PrimitiveToken;
|
|
86
106
|
reasoning: string;
|
|
87
107
|
};
|
|
88
|
-
}>;
|
|
89
|
-
/**
|
|
90
|
-
* Avatar component tokens defined using the hybrid authoring API.
|
|
91
|
-
*
|
|
92
|
-
* Each token either references a primitive spacing token or uses a family-conformant
|
|
93
|
-
* derivation, and includes reasoning explaining why the token exists.
|
|
94
|
-
*
|
|
95
|
-
* NOTE: Web platform uses CSS calc() with icon tokens for sizing (see Avatar.styles.css).
|
|
96
|
-
* These component tokens are primarily used for iOS/Android platforms and documentation.
|
|
97
|
-
*
|
|
98
|
-
* Size token values:
|
|
99
|
-
* - size.xs: 24px (3 × base, references size300)
|
|
100
|
-
* - size.sm: 32px (4 × base, references size400)
|
|
101
|
-
* - size.md: 40px (5 × base, references size500)
|
|
102
|
-
* - size.lg: 48px (6 × base, references size600)
|
|
103
|
-
* - size.xl: 80px (10 × base, derivation)
|
|
104
|
-
* - size.xxl: 128px (16 × base, derivation)
|
|
105
|
-
*
|
|
106
|
-
* Icon size token values (gap fillers - web uses calc() instead):
|
|
107
|
-
* - icon.size.xs: 12px (1.5 × base, derivation) - web uses calc(icon.size050 × 0.75)
|
|
108
|
-
* - icon.size.xxl: 64px (8 × base, derivation) - web uses calc(icon.size050 × 4)
|
|
109
|
-
*
|
|
110
|
-
* @see Requirements 2.1-2.6, 3.1, 3.6 in .kiro/specs/042-avatar-component/requirements.md
|
|
111
|
-
*/
|
|
112
|
-
export declare const AvatarTokens: import("../../../build/tokens").ComponentTokenValues<{
|
|
113
108
|
'icon.size.xs': {
|
|
114
109
|
value: number;
|
|
115
110
|
reasoning: string;
|
|
@@ -35,6 +35,15 @@
|
|
|
35
35
|
* - xs: calc(icon.size050 × 0.75) = 12px
|
|
36
36
|
* - xxl: calc(icon.size050 × 4) = 64px
|
|
37
37
|
*
|
|
38
|
+
* TOKEN FAMILY: all dimensional Avatar tokens (container `size.*` AND icon
|
|
39
|
+
* `icon.size.*` gap fillers) are registered by the single sizing-family call
|
|
40
|
+
* `AvatarSizingTokens` below. The `icon.size.*` pair previously lived in a
|
|
41
|
+
* separate `AvatarTokens` call stamped `family: 'spacing'` — a mislabel, since
|
|
42
|
+
* both are dimensional sizing values. `AvatarTokens` is removed; consumers use
|
|
43
|
+
* `AvatarSizingTokens` or the `getAvatarIconSize()` / `getAvatarSize()` accessors.
|
|
44
|
+
* Generated platform output is unaffected: both calls declare `component: 'Avatar'`,
|
|
45
|
+
* so all tokens still land in one `AvatarTokens` Swift enum / Kotlin object.
|
|
46
|
+
*
|
|
38
47
|
* COLOR TOKENS (Spec 058):
|
|
39
48
|
* Avatar color tokens are defined in this file following the Rosetta System architecture
|
|
40
49
|
* which mandates component tokens live at src/components/[ComponentName]/tokens.ts.
|
|
@@ -53,7 +62,7 @@
|
|
|
53
62
|
* @see .kiro/specs/058-component-token-architecture-cleanup for color token migration
|
|
54
63
|
*/
|
|
55
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
-
exports.AvatarIconSizeTokenReferences = exports.AvatarSizeTokenReferences = exports.AvatarColorTokens = exports.
|
|
65
|
+
exports.AvatarIconSizeTokenReferences = exports.AvatarSizeTokenReferences = exports.AvatarColorTokens = exports.AvatarSizingTokens = void 0;
|
|
57
66
|
exports.getAvatarColorToken = getAvatarColorToken;
|
|
58
67
|
exports.getAvatarSize = getAvatarSize;
|
|
59
68
|
exports.getAvatarIconSize = getAvatarIconSize;
|
|
@@ -62,13 +71,24 @@ exports.getAvatarIconSizeTokenReference = getAvatarIconSizeTokenReference;
|
|
|
62
71
|
const tokens_1 = require("../../../build/tokens");
|
|
63
72
|
const SizingTokens_1 = require("../../../tokens/SizingTokens");
|
|
64
73
|
/**
|
|
65
|
-
* Avatar sizing tokens — container dimensions for each size variant.
|
|
74
|
+
* Avatar sizing tokens — container dimensions and icon dimensions for each size variant.
|
|
66
75
|
*
|
|
67
76
|
* Previously in a separate file (avatar-sizing.tokens.ts). Inlined to prevent
|
|
68
77
|
* architectural anomaly (no other component splits tokens across files) and
|
|
69
78
|
* simplify the package surface for sync.
|
|
70
79
|
*
|
|
80
|
+
* ONE CALL PER FAMILY. Every token registered by a single defineComponentTokens()
|
|
81
|
+
* call is stamped with that call's `family`, and the family drives platform output
|
|
82
|
+
* (Swift type, Kotlin `.dp` suffix, primitive class name). The `icon.size.*` gap
|
|
83
|
+
* fillers below are dimensional sizing values, so they live in this sizing-family
|
|
84
|
+
* call — they were previously mis-stamped `family: 'spacing'` in a separate
|
|
85
|
+
* `AvatarTokens` call, the same latent mislabel class fixed for Button-Icon.
|
|
86
|
+
* Do NOT spread/merge this result with another call's result — the rich metadata
|
|
87
|
+
* rides on a non-enumerable brand (see src/build/tokens/defineComponentTokens.ts,
|
|
88
|
+
* TOKEN_CONTRACT_BRAND) that a spread would silently drop.
|
|
89
|
+
*
|
|
71
90
|
* @see .kiro/specs/092-sizing-token-family/design.md
|
|
91
|
+
* @see src/components/core/Button-Icon/buttonIcon.tokens.ts for the two-call pattern
|
|
72
92
|
*/
|
|
73
93
|
exports.AvatarSizingTokens = (0, tokens_1.defineComponentTokens)({
|
|
74
94
|
component: 'Avatar',
|
|
@@ -98,37 +118,14 @@ exports.AvatarSizingTokens = (0, tokens_1.defineComponentTokens)({
|
|
|
98
118
|
reference: SizingTokens_1.sizingTokens.size1600,
|
|
99
119
|
reasoning: 'Extra extra large avatar (128px). Full profile view, onboarding.',
|
|
100
120
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
* NOTE: Web platform uses CSS calc() with icon tokens for sizing (see Avatar.styles.css).
|
|
110
|
-
* These component tokens are primarily used for iOS/Android platforms and documentation.
|
|
111
|
-
*
|
|
112
|
-
* Size token values:
|
|
113
|
-
* - size.xs: 24px (3 × base, references size300)
|
|
114
|
-
* - size.sm: 32px (4 × base, references size400)
|
|
115
|
-
* - size.md: 40px (5 × base, references size500)
|
|
116
|
-
* - size.lg: 48px (6 × base, references size600)
|
|
117
|
-
* - size.xl: 80px (10 × base, derivation)
|
|
118
|
-
* - size.xxl: 128px (16 × base, derivation)
|
|
119
|
-
*
|
|
120
|
-
* Icon size token values (gap fillers - web uses calc() instead):
|
|
121
|
-
* - icon.size.xs: 12px (1.5 × base, derivation) - web uses calc(icon.size050 × 0.75)
|
|
122
|
-
* - icon.size.xxl: 64px (8 × base, derivation) - web uses calc(icon.size050 × 4)
|
|
123
|
-
*
|
|
124
|
-
* @see Requirements 2.1-2.6, 3.1, 3.6 in .kiro/specs/042-avatar-component/requirements.md
|
|
125
|
-
*/
|
|
126
|
-
exports.AvatarTokens = (0, tokens_1.defineComponentTokens)({
|
|
127
|
-
component: 'Avatar',
|
|
128
|
-
family: 'spacing',
|
|
129
|
-
tokens: {
|
|
130
|
-
// Icon size tokens (gap fillers for sizes without existing icon tokens)
|
|
131
|
-
// These fill gaps where no standard icon token exists at the required 50% ratio
|
|
121
|
+
// Icon size tokens (gap fillers for sizes without an existing icon token).
|
|
122
|
+
// Kept on the VALUE path deliberately: sizing primitives exist at both values
|
|
123
|
+
// (size150 = 12, size800 = 64), but the reference path currently emits a
|
|
124
|
+
// fabricated `SizingTokens.<name>` class on iOS/Android that no generated or
|
|
125
|
+
// hand-written platform file defines. Switching these to `reference:` would
|
|
126
|
+
// trade compiling output (`12.dp`) for non-compiling output and break
|
|
127
|
+
// Avatar.android.kt's `val iconSizeXs: Dp = GeneratedAvatarTokens.iconSizeXs`.
|
|
128
|
+
// Revisit once TokenFileGenerator.getFamilyClassName emits a real platform type.
|
|
132
129
|
'icon.size.xs': {
|
|
133
130
|
value: SizingTokens_1.SIZING_BASE_VALUE * 1.5,
|
|
134
131
|
reasoning: 'Icon size for xs avatar (12px = 1.5× base) maintains 50% ratio (12/24). No existing icon token at this size, so component token fills the gap.',
|
|
@@ -254,7 +251,7 @@ function getAvatarSize(variant) {
|
|
|
254
251
|
* @see Requirements 3.1, 3.6 in .kiro/specs/042-avatar-component/requirements.md
|
|
255
252
|
*/
|
|
256
253
|
function getAvatarIconSize(variant) {
|
|
257
|
-
return exports.
|
|
254
|
+
return exports.AvatarSizingTokens[`icon.size.${variant}`];
|
|
258
255
|
}
|
|
259
256
|
/**
|
|
260
257
|
* Semantic token references for Avatar size values
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type { AvatarProps, AvatarType, AvatarSize } from './types';
|
|
8
8
|
export { AVATAR_DEFAULTS } from './types';
|
|
9
|
-
export {
|
|
9
|
+
export { AvatarSizingTokens, getAvatarSize, getAvatarIconSize, getAvatarSizeTokenReference, getAvatarIconSizeTokenReference, AvatarSizeTokenReferences, AvatarIconSizeTokenReferences, } from './avatar.tokens';
|
|
10
10
|
export type { AvatarSizeVariant, AvatarIconSizeVariant } from './avatar.tokens';
|
|
11
11
|
export { AvatarBaseElement } from './platforms/web/Avatar.web';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* @see .kiro/specs/042-avatar-component/requirements.md for requirements
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.AvatarBaseElement = exports.AvatarIconSizeTokenReferences = exports.AvatarSizeTokenReferences = exports.getAvatarIconSizeTokenReference = exports.getAvatarSizeTokenReference = exports.getAvatarIconSize = exports.getAvatarSize = exports.
|
|
9
|
+
exports.AvatarBaseElement = exports.AvatarIconSizeTokenReferences = exports.AvatarSizeTokenReferences = exports.getAvatarIconSizeTokenReference = exports.getAvatarSizeTokenReference = exports.getAvatarIconSize = exports.getAvatarSize = exports.AvatarSizingTokens = exports.AVATAR_DEFAULTS = void 0;
|
|
10
10
|
var types_1 = require("./types");
|
|
11
11
|
Object.defineProperty(exports, "AVATAR_DEFAULTS", { enumerable: true, get: function () { return types_1.AVATAR_DEFAULTS; } });
|
|
12
12
|
// Token exports
|
|
13
13
|
var avatar_tokens_1 = require("./avatar.tokens");
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "AvatarSizingTokens", { enumerable: true, get: function () { return avatar_tokens_1.AvatarSizingTokens; } });
|
|
15
15
|
Object.defineProperty(exports, "getAvatarSize", { enumerable: true, get: function () { return avatar_tokens_1.getAvatarSize; } });
|
|
16
16
|
Object.defineProperty(exports, "getAvatarIconSize", { enumerable: true, get: function () { return avatar_tokens_1.getAvatarIconSize; } });
|
|
17
17
|
Object.defineProperty(exports, "getAvatarSizeTokenReference", { enumerable: true, get: function () { return avatar_tokens_1.getAvatarSizeTokenReference; } });
|
|
@@ -643,11 +643,30 @@ class AvatarBaseElement extends HTMLElement {
|
|
|
643
643
|
// Generate aria-hidden attribute for decorative avatars
|
|
644
644
|
// @see Requirements: 9.2 - Apply aria-hidden="true" when decorative prop is true
|
|
645
645
|
const ariaHiddenAttr = decorative ? ' aria-hidden="true"' : '';
|
|
646
|
-
// Warn in development if
|
|
647
|
-
// @see Requirements: 5.4 -
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
646
|
+
// Warn in development if a human-type avatar is missing alt text for its image.
|
|
647
|
+
// @see Requirements: 5.4 - Human type + src SHALL require alt for accessibility
|
|
648
|
+
// @see Requirements: 5 AC 5 - Agent type SHALL ignore src entirely (src not
|
|
649
|
+
// rendered as an image), so agent-type avatars never warn regardless of alt.
|
|
650
|
+
//
|
|
651
|
+
// Settled edge semantics (Spec 126, O2, ratified 2026-07-09):
|
|
652
|
+
// - Scope is human-type only — Req 5.4 is human-type-scoped, and Req 5 AC 5
|
|
653
|
+
// affirmatively establishes that agent-type SHALL ignore src, so a src+no-alt
|
|
654
|
+
// agent avatar is not a violation of anything.
|
|
655
|
+
// - `alt == null` (loose equality — also excludes `undefined`), not `!alt`, is the
|
|
656
|
+
// test. The `alt` attribute getter returns `getAttribute('alt')`. Raw
|
|
657
|
+
// `setAttribute('alt', '')` yields `alt === ''`, which is the HTML-idiomatic
|
|
658
|
+
// explicit-empty-alt signal and must NOT warn. The `alt` *property setter*
|
|
659
|
+
// (see below) treats a falsy value as "remove the attribute," so
|
|
660
|
+
// `avatar.alt = ''` collapses to `alt === null` — indistinguishable from
|
|
661
|
+
// omitting alt entirely, and DOES warn under this condition.
|
|
662
|
+
// - `!decorative` is the operative fix for the confirmed false positive: a
|
|
663
|
+
// `decorative` avatar is the component's official signal that the image is
|
|
664
|
+
// non-informative (Req 9.2 applies `aria-hidden="true"`), so it must never warn
|
|
665
|
+
// regardless of alt.
|
|
666
|
+
if (type === 'human' && src && alt == null && !decorative && typeof console !== 'undefined') {
|
|
667
|
+
console.warn('AvatarBaseElement: "alt" is required when "src" is provided. ' +
|
|
668
|
+
'Add an alt description of the image; or, if this avatar is purely decorative ' +
|
|
669
|
+
'(non-informative), set the "decorative" prop to hide it from screen readers.');
|
|
651
670
|
}
|
|
652
671
|
// Render different structures based on type
|
|
653
672
|
// Agent type uses SVG-based hexagon with Bézier curves for true rounded corners
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
* - size: 'medium' (48px height)
|
|
20
20
|
* - variant: 'primary' (filled background with primary color)
|
|
21
21
|
* - noWrap: false (text wraps if needed)
|
|
22
|
-
* - disabled: false (interactive)
|
|
23
22
|
*
|
|
24
23
|
* @example
|
|
25
24
|
* ```html
|
|
@@ -54,7 +53,6 @@ export declare function customLabelButton(): void;
|
|
|
54
53
|
*
|
|
55
54
|
* The 'press' event:
|
|
56
55
|
* - Bubbles up through the DOM
|
|
57
|
-
* - Is not called when button is disabled
|
|
58
56
|
* - Works with click, tap, Enter key, and Space key
|
|
59
57
|
* - Provides originalEvent in event.detail for advanced use cases
|
|
60
58
|
*
|
|
@@ -67,39 +65,29 @@ export declare function customLabelButton(): void;
|
|
|
67
65
|
*/
|
|
68
66
|
export declare function buttonWithHandler(): void;
|
|
69
67
|
/**
|
|
70
|
-
* Example 4:
|
|
68
|
+
* Example 4: Unavailable Actions (no disabled state)
|
|
71
69
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
* DesignerPunk does not support disabled states for usability and
|
|
71
|
+
* accessibility reasons. If an action is unavailable, the component
|
|
72
|
+
* should not be rendered.
|
|
75
73
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* - Screen readers announce disabled state
|
|
81
|
-
* - onPress handler is not called
|
|
82
|
-
*
|
|
83
|
-
* Common use cases:
|
|
84
|
-
* - Form submission in progress
|
|
85
|
-
* - Required fields not filled
|
|
86
|
-
* - User lacks permissions
|
|
87
|
-
* - Action temporarily unavailable
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```html
|
|
91
|
-
* <button-cta label="Submit" disabled></button-cta>
|
|
92
|
-
* ```
|
|
74
|
+
* For in-flight async operations (e.g. form submission), use the loading
|
|
75
|
+
* state instead of disabling the button. For actions the user cannot take
|
|
76
|
+
* yet, keep the button interactive and validate on press, or do not render
|
|
77
|
+
* the button at all.
|
|
93
78
|
*
|
|
94
79
|
* @example
|
|
95
80
|
* ```typescript
|
|
96
|
-
* //
|
|
97
|
-
*
|
|
98
|
-
* button
|
|
99
|
-
*
|
|
81
|
+
* // Conditionally render instead of disabling
|
|
82
|
+
* if (userCanSubmit) {
|
|
83
|
+
* const button = document.createElement('button-cta') as ButtonCTA;
|
|
84
|
+
* button.label = 'Submit';
|
|
85
|
+
* button.addEventListener('press', handleSubmit);
|
|
86
|
+
* document.body.appendChild(button);
|
|
87
|
+
* }
|
|
100
88
|
* ```
|
|
101
89
|
*/
|
|
102
|
-
export declare function
|
|
90
|
+
export declare function conditionallyRenderedButton(): void;
|
|
103
91
|
/**
|
|
104
92
|
* Example 5: All Examples Together
|
|
105
93
|
*
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.defaultButton = defaultButton;
|
|
15
15
|
exports.customLabelButton = customLabelButton;
|
|
16
16
|
exports.buttonWithHandler = buttonWithHandler;
|
|
17
|
-
exports.
|
|
17
|
+
exports.conditionallyRenderedButton = conditionallyRenderedButton;
|
|
18
18
|
exports.renderAllBasicExamples = renderAllBasicExamples;
|
|
19
19
|
/**
|
|
20
20
|
* Example 1: Default Button (Medium, Primary)
|
|
@@ -26,7 +26,6 @@ exports.renderAllBasicExamples = renderAllBasicExamples;
|
|
|
26
26
|
* - size: 'medium' (48px height)
|
|
27
27
|
* - variant: 'primary' (filled background with primary color)
|
|
28
28
|
* - noWrap: false (text wraps if needed)
|
|
29
|
-
* - disabled: false (interactive)
|
|
30
29
|
*
|
|
31
30
|
* @example
|
|
32
31
|
* ```html
|
|
@@ -77,7 +76,6 @@ function customLabelButton() {
|
|
|
77
76
|
*
|
|
78
77
|
* The 'press' event:
|
|
79
78
|
* - Bubbles up through the DOM
|
|
80
|
-
* - Is not called when button is disabled
|
|
81
79
|
* - Works with click, tap, Enter key, and Space key
|
|
82
80
|
* - Provides originalEvent in event.detail for advanced use cases
|
|
83
81
|
*
|
|
@@ -105,52 +103,35 @@ function buttonWithHandler() {
|
|
|
105
103
|
document.body.appendChild(button);
|
|
106
104
|
}
|
|
107
105
|
/**
|
|
108
|
-
* Example 4:
|
|
106
|
+
* Example 4: Unavailable Actions (no disabled state)
|
|
109
107
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
108
|
+
* DesignerPunk does not support disabled states for usability and
|
|
109
|
+
* accessibility reasons. If an action is unavailable, the component
|
|
110
|
+
* should not be rendered.
|
|
113
111
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* - Screen readers announce disabled state
|
|
119
|
-
* - onPress handler is not called
|
|
120
|
-
*
|
|
121
|
-
* Common use cases:
|
|
122
|
-
* - Form submission in progress
|
|
123
|
-
* - Required fields not filled
|
|
124
|
-
* - User lacks permissions
|
|
125
|
-
* - Action temporarily unavailable
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```html
|
|
129
|
-
* <button-cta label="Submit" disabled></button-cta>
|
|
130
|
-
* ```
|
|
112
|
+
* For in-flight async operations (e.g. form submission), use the loading
|
|
113
|
+
* state instead of disabling the button. For actions the user cannot take
|
|
114
|
+
* yet, keep the button interactive and validate on press, or do not render
|
|
115
|
+
* the button at all.
|
|
131
116
|
*
|
|
132
117
|
* @example
|
|
133
118
|
* ```typescript
|
|
134
|
-
* //
|
|
135
|
-
*
|
|
136
|
-
* button
|
|
137
|
-
*
|
|
119
|
+
* // Conditionally render instead of disabling
|
|
120
|
+
* if (userCanSubmit) {
|
|
121
|
+
* const button = document.createElement('button-cta') as ButtonCTA;
|
|
122
|
+
* button.label = 'Submit';
|
|
123
|
+
* button.addEventListener('press', handleSubmit);
|
|
124
|
+
* document.body.appendChild(button);
|
|
125
|
+
* }
|
|
138
126
|
* ```
|
|
139
127
|
*/
|
|
140
|
-
function
|
|
128
|
+
function conditionallyRenderedButton() {
|
|
141
129
|
const button = document.createElement('button-cta');
|
|
142
130
|
button.label = 'Submit';
|
|
143
|
-
button.disabled = true; // Button is non-interactive
|
|
144
|
-
// This handler will NOT be called when button is disabled
|
|
145
131
|
button.addEventListener('press', () => {
|
|
146
|
-
console.log('
|
|
132
|
+
console.log('Submitted');
|
|
147
133
|
});
|
|
148
134
|
document.body.appendChild(button);
|
|
149
|
-
// Example: Enable button after 3 seconds (simulating async operation)
|
|
150
|
-
setTimeout(() => {
|
|
151
|
-
button.disabled = false;
|
|
152
|
-
console.log('Button is now enabled');
|
|
153
|
-
}, 3000);
|
|
154
135
|
}
|
|
155
136
|
/**
|
|
156
137
|
* Example 5: All Examples Together
|
|
@@ -188,12 +169,6 @@ function renderAllBasicExamples() {
|
|
|
188
169
|
alert('Form submitted successfully!');
|
|
189
170
|
});
|
|
190
171
|
container.appendChild(handlerBtn);
|
|
191
|
-
// Example 4: Disabled
|
|
192
|
-
const disabledBtn = document.createElement('button-cta');
|
|
193
|
-
disabledBtn.label = 'Disabled Button';
|
|
194
|
-
disabledBtn.disabled = true;
|
|
195
|
-
disabledBtn.addEventListener('press', () => console.log('This will not log'));
|
|
196
|
-
container.appendChild(disabledBtn);
|
|
197
172
|
// Add container to document
|
|
198
173
|
document.body.appendChild(container);
|
|
199
174
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* composition pattern as iOS and Android platforms. This ensures cross-platform
|
|
13
13
|
* consistency and single source of truth for icon rendering.
|
|
14
14
|
*
|
|
15
|
-
* Uses theme-aware blend utilities for state colors (hover, pressed,
|
|
15
|
+
* Uses theme-aware blend utilities for state colors (hover, pressed, icon)
|
|
16
16
|
* instead of opacity or filter workarounds. This ensures cross-platform consistency
|
|
17
17
|
* with iOS and Android implementations.
|
|
18
18
|
*
|
|
@@ -32,13 +32,12 @@ import '../../../Icon-Base/platforms/web/IconBase.web';
|
|
|
32
32
|
* - Semantic `<button>` element with proper accessibility
|
|
33
33
|
* - Token-based styling via CSS custom properties
|
|
34
34
|
* - Supports text wrapping by default (accessibility-first)
|
|
35
|
-
* - Uses blend utilities for state colors (hover, pressed,
|
|
35
|
+
* - Uses blend utilities for state colors (hover, pressed, icon)
|
|
36
36
|
* - WCAG 2.1 AA compliant:
|
|
37
37
|
* - Keyboard navigation (Tab, Enter, Space)
|
|
38
38
|
* - Focus indicators with 3:1 contrast ratio
|
|
39
39
|
* - Color contrast 4.5:1 for all styles
|
|
40
40
|
* - Screen reader support with ARIA attributes
|
|
41
|
-
* - Proper disabled state handling
|
|
42
41
|
*
|
|
43
42
|
* @example
|
|
44
43
|
* ```html
|
|
@@ -52,7 +51,6 @@ import '../../../Icon-Base/platforms/web/IconBase.web';
|
|
|
52
51
|
* variant="primary"
|
|
53
52
|
* icon="arrow-right"
|
|
54
53
|
* no-wrap="false"
|
|
55
|
-
* disabled="false"
|
|
56
54
|
* test-id="submit-button"
|
|
57
55
|
* ></button-cta>
|
|
58
56
|
* ```
|
|
@@ -77,7 +75,6 @@ export declare class ButtonCTA extends HTMLElement {
|
|
|
77
75
|
private _blendUtils;
|
|
78
76
|
private _hoverColor;
|
|
79
77
|
private _pressedColor;
|
|
80
|
-
private _disabledColor;
|
|
81
78
|
private _iconColor;
|
|
82
79
|
private _iconOpticalBalanceColor;
|
|
83
80
|
/**
|
|
@@ -108,7 +105,7 @@ export declare class ButtonCTA extends HTMLElement {
|
|
|
108
105
|
* Calculate blend colors from CSS custom properties.
|
|
109
106
|
*
|
|
110
107
|
* Reads base colors from CSS custom properties and applies theme-aware blend
|
|
111
|
-
* utilities to generate state colors (hover, pressed,
|
|
108
|
+
* utilities to generate state colors (hover, pressed, icon).
|
|
112
109
|
*
|
|
113
110
|
* Uses getBlendUtilities() factory functions instead of direct blend calculations
|
|
114
111
|
* for cross-platform consistency with iOS and Android implementations.
|
|
@@ -116,7 +113,6 @@ export declare class ButtonCTA extends HTMLElement {
|
|
|
116
113
|
* State color mappings:
|
|
117
114
|
* - Hover: darkerBlend(color.action.primary, blend.hoverDarker) - 8% darker
|
|
118
115
|
* - Pressed: darkerBlend(color.action.primary, blend.pressedDarker) - 12% darker
|
|
119
|
-
* - Disabled: desaturate(color.action.primary, blend.disabledDesaturate) - 12% less saturated
|
|
120
116
|
* - Icon: lighterBlend(color.contrast.onAction, blend.iconLighter) - 8% lighter
|
|
121
117
|
*
|
|
122
118
|
* @see Requirements: 7.1, 7.2, 7.3, 7.4 - Button-CTA state colors
|
|
@@ -180,14 +176,6 @@ export declare class ButtonCTA extends HTMLElement {
|
|
|
180
176
|
* Set the no-wrap state.
|
|
181
177
|
*/
|
|
182
178
|
set noWrap(value: boolean);
|
|
183
|
-
/**
|
|
184
|
-
* Get the disabled state.
|
|
185
|
-
*/
|
|
186
|
-
get disabled(): boolean;
|
|
187
|
-
/**
|
|
188
|
-
* Set the disabled state.
|
|
189
|
-
*/
|
|
190
|
-
set disabled(value: boolean);
|
|
191
179
|
/**
|
|
192
180
|
* Get the test ID.
|
|
193
181
|
*/
|