@primer-io/primer-js 0.3.11 → 0.4.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 +16 -0
- package/dist/custom-elements.json +2943 -1337
- package/dist/jsx/index.d.ts +141 -20
- package/dist/primer-loader.d.ts +334 -46
- package/dist/primer-loader.js +21 -33
- package/dist/vscode.html-custom-data.json +92 -21
- package/dist/web-types.json +269 -51
- package/package.json +5 -2
package/dist/jsx/index.d.ts
CHANGED
|
@@ -244,6 +244,31 @@ export type PortalComponentProps = {
|
|
|
244
244
|
oneventName?: (e: CustomEvent<CustomEvent>) => void;
|
|
245
245
|
};
|
|
246
246
|
|
|
247
|
+
export type SelectComponentProps = {
|
|
248
|
+
/** The name attribute for the select element */
|
|
249
|
+
name?: string;
|
|
250
|
+
/** The id attribute for the select element */
|
|
251
|
+
id?: string;
|
|
252
|
+
/** The current value of the select */
|
|
253
|
+
value?: string;
|
|
254
|
+
/** Whether the select is disabled */
|
|
255
|
+
disabled?: boolean;
|
|
256
|
+
/** Whether the select is in an error state */
|
|
257
|
+
"has-error"?: boolean;
|
|
258
|
+
/** Placeholder text for the select */
|
|
259
|
+
placeholder?: string;
|
|
260
|
+
/** Array of options for the select */
|
|
261
|
+
options?: SelectOption[];
|
|
262
|
+
/** Fired when selection changes */
|
|
263
|
+
onchange?: (e: CustomEvent<CustomEvent>) => void;
|
|
264
|
+
/** Fired when input value changes */
|
|
265
|
+
oninput?: (e: CustomEvent<CustomEvent>) => void;
|
|
266
|
+
/** Fired when select receives focus */
|
|
267
|
+
onfocus?: (e: CustomEvent<CustomEvent>) => void;
|
|
268
|
+
/** Fired when select loses focus */
|
|
269
|
+
onblur?: (e: CustomEvent<CustomEvent>) => void;
|
|
270
|
+
};
|
|
271
|
+
|
|
247
272
|
export type SpinnerComponentProps = {
|
|
248
273
|
/** Color of the spinner
|
|
249
274
|
Defaults to the design system loader color */
|
|
@@ -277,6 +302,17 @@ export type AchPaymentComponentProps = {
|
|
|
277
302
|
"onprimer-ach-mandate-declined"?: (e: CustomEvent<CustomEvent>) => void;
|
|
278
303
|
};
|
|
279
304
|
|
|
305
|
+
export type BillingAddressComponentProps = {
|
|
306
|
+
/** Configuration from SDK Core containing checkoutModules configuration */
|
|
307
|
+
configuration?: ConfigurationContextType;
|
|
308
|
+
/** Headless SDK utilities for API methods like setBillingAddress */
|
|
309
|
+
headlessUtils?: HeadlessUtilsContextType;
|
|
310
|
+
/** Fired when form data changes */
|
|
311
|
+
"onprimer-billing-address-change"?: (e: CustomEvent<CustomEvent>) => void;
|
|
312
|
+
/** Fired when form is submitted */
|
|
313
|
+
"onprimer-billing-address-submit"?: (e: CustomEvent<CustomEvent>) => void;
|
|
314
|
+
};
|
|
315
|
+
|
|
280
316
|
export type CardFormComponentProps = {
|
|
281
317
|
/** */
|
|
282
318
|
"hide-labels"?: boolean;
|
|
@@ -333,17 +369,6 @@ export type PrimerKlarnaComponentProps = {
|
|
|
333
369
|
toggleExpand?: string;
|
|
334
370
|
};
|
|
335
371
|
|
|
336
|
-
export type NativePaymentComponentProps = {
|
|
337
|
-
/** */
|
|
338
|
-
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
339
|
-
/** */
|
|
340
|
-
paymentManagers?: InitializedManagersMap;
|
|
341
|
-
/** */
|
|
342
|
-
computedStyles?: CSSStyleDeclaration | null;
|
|
343
|
-
/** */
|
|
344
|
-
disabled?: boolean;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
372
|
export type PaymentMethodComponentProps = {
|
|
348
373
|
/** */
|
|
349
374
|
type?: PaymentMethodType | undefined;
|
|
@@ -445,7 +470,7 @@ export type CardFormSubmitComponentProps = {
|
|
|
445
470
|
Falls back to localized default if not explicitly set. */
|
|
446
471
|
buttonText?: string;
|
|
447
472
|
/** */
|
|
448
|
-
|
|
473
|
+
headlessUtils?: HeadlessUtilsContextType;
|
|
449
474
|
/** */
|
|
450
475
|
clientOptions?: ClientOptionsContextType;
|
|
451
476
|
/** */
|
|
@@ -539,6 +564,33 @@ Falls back to localized default if not explicitly set. */
|
|
|
539
564
|
cardFormContext?: CardFormContext | null;
|
|
540
565
|
};
|
|
541
566
|
|
|
567
|
+
export type ApplePayComponentProps = {
|
|
568
|
+
/** */
|
|
569
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
570
|
+
/** */
|
|
571
|
+
paymentManagers?: InitializedManagersMap;
|
|
572
|
+
/** */
|
|
573
|
+
disabled?: boolean;
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
export type GooglePayComponentProps = {
|
|
577
|
+
/** */
|
|
578
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
579
|
+
/** */
|
|
580
|
+
paymentManagers?: InitializedManagersMap;
|
|
581
|
+
/** */
|
|
582
|
+
disabled?: boolean;
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
export type PayPalComponentProps = {
|
|
586
|
+
/** */
|
|
587
|
+
paymentMethod?: InitializedPaymentMethod | undefined;
|
|
588
|
+
/** */
|
|
589
|
+
paymentManagers?: InitializedManagersMap;
|
|
590
|
+
/** */
|
|
591
|
+
disabled?: boolean;
|
|
592
|
+
};
|
|
593
|
+
|
|
542
594
|
export type PaymentMethodContentComponentProps = {
|
|
543
595
|
/** The asset configuration containing icon and display data */
|
|
544
596
|
assetConfig?: AssetConfig | null;
|
|
@@ -815,6 +867,19 @@ export type CustomElements = {
|
|
|
815
867
|
*/
|
|
816
868
|
"primer-portal": Partial<PortalComponentProps & BaseProps & BaseEvents>;
|
|
817
869
|
|
|
870
|
+
/**
|
|
871
|
+
* A native select dropdown component
|
|
872
|
+
* ---
|
|
873
|
+
*
|
|
874
|
+
*
|
|
875
|
+
* ### **Events:**
|
|
876
|
+
* - **change** - Fired when selection changes
|
|
877
|
+
* - **input** - Fired when input value changes
|
|
878
|
+
* - **focus** - Fired when select receives focus
|
|
879
|
+
* - **blur** - Fired when select loses focus
|
|
880
|
+
*/
|
|
881
|
+
"primer-select": Partial<SelectComponentProps & BaseProps & BaseEvents>;
|
|
882
|
+
|
|
818
883
|
/**
|
|
819
884
|
* Spinner component with configurable size and color
|
|
820
885
|
* Adapted to work both standalone and within input components
|
|
@@ -836,6 +901,31 @@ export type CustomElements = {
|
|
|
836
901
|
*/
|
|
837
902
|
"primer-ach-payment": Partial<AchPaymentComponentProps & BaseProps & BaseEvents>;
|
|
838
903
|
|
|
904
|
+
/**
|
|
905
|
+
* BillingAddressComponent provides a form for collecting billing address information.
|
|
906
|
+
*
|
|
907
|
+
* Configuration is exclusively server-side via SDK Core's checkoutModules. Field visibility
|
|
908
|
+
* is determined by the BILLING_ADDRESS module in the client session configuration.
|
|
909
|
+
* ---
|
|
910
|
+
*
|
|
911
|
+
*
|
|
912
|
+
* ### **Events:**
|
|
913
|
+
* - **primer-billing-address-change** - Fired when form data changes
|
|
914
|
+
* - **primer-billing-address-submit** - Fired when form is submitted
|
|
915
|
+
*
|
|
916
|
+
* ### **Methods:**
|
|
917
|
+
* - **validateForSubmission(): _Promise<boolean>_** - Public method to validate billing address fields
|
|
918
|
+
* Called by the parent form (card-form) when submitting
|
|
919
|
+
* Returns true if billing address is valid
|
|
920
|
+
* Note: Does NOT call setBillingAddress API - that happens after card validation
|
|
921
|
+
* - **submitToSDK(): _Promise<boolean>_** - Public method to submit billing address to SDK Core
|
|
922
|
+
* Called by parent form ONLY after both card and billing address validation pass
|
|
923
|
+
*
|
|
924
|
+
* Note: headlessUtils is guaranteed to be available when this method is called,
|
|
925
|
+
* as the component only renders (and becomes interactive) after initialization task completes.
|
|
926
|
+
*/
|
|
927
|
+
"primer-billing-address": Partial<BillingAddressComponentProps & BaseProps & BaseEvents>;
|
|
928
|
+
|
|
839
929
|
/**
|
|
840
930
|
* CardFormComponent serves as a container for card input components.
|
|
841
931
|
* It handles form submission, validation, and provides context to child components.
|
|
@@ -876,14 +966,6 @@ export type CustomElements = {
|
|
|
876
966
|
*/
|
|
877
967
|
"primer-klarna": Partial<PrimerKlarnaComponentProps & BaseProps & BaseEvents>;
|
|
878
968
|
|
|
879
|
-
/**
|
|
880
|
-
* Component for rendering native payment buttons (Apple Pay, Google Pay, PayPal)
|
|
881
|
-
* with proper height calculations based on design system variables.
|
|
882
|
-
* ---
|
|
883
|
-
*
|
|
884
|
-
*/
|
|
885
|
-
"primer-native-payment": Partial<NativePaymentComponentProps & BaseProps & BaseEvents>;
|
|
886
|
-
|
|
887
969
|
/**
|
|
888
970
|
*
|
|
889
971
|
* ---
|
|
@@ -1035,6 +1117,45 @@ export type CustomElements = {
|
|
|
1035
1117
|
*/
|
|
1036
1118
|
"primer-input-cvv": Partial<InputCvvComponentProps & BaseProps & BaseEvents>;
|
|
1037
1119
|
|
|
1120
|
+
/**
|
|
1121
|
+
* Apple Pay component with standard button container rendering.
|
|
1122
|
+
*
|
|
1123
|
+
* Apple Pay uses the standard button container approach:
|
|
1124
|
+
* - Renders to a button container div (not shadow root)
|
|
1125
|
+
* - Passes buttonHeight in render options
|
|
1126
|
+
* - Uses updateOverlayForContainer for disabled state
|
|
1127
|
+
* - Simpler than Google Pay's shadow root approach
|
|
1128
|
+
* ---
|
|
1129
|
+
*
|
|
1130
|
+
*/
|
|
1131
|
+
"primer-apple-pay": Partial<ApplePayComponentProps & BaseProps & BaseEvents>;
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Google Pay component with shadow root rendering for full-width button support.
|
|
1135
|
+
*
|
|
1136
|
+
* Google Pay requires special rendering logic:
|
|
1137
|
+
* - Renders directly to shadow root (not button container)
|
|
1138
|
+
* - Does NOT render .native-button-container div
|
|
1139
|
+
* - Passes shadowRoot: true in render options
|
|
1140
|
+
* - Requires retry logic for async button rendering
|
|
1141
|
+
* ---
|
|
1142
|
+
*
|
|
1143
|
+
*/
|
|
1144
|
+
"primer-google-pay": Partial<GooglePayComponentProps & BaseProps & BaseEvents>;
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* PayPal component with standard button container rendering.
|
|
1148
|
+
*
|
|
1149
|
+
* PayPal uses the standard button container approach:
|
|
1150
|
+
* - Renders to a button container div (not shadow root)
|
|
1151
|
+
* - Passes buttonHeight in render options with PayPal SDK constraints (25-55px)
|
|
1152
|
+
* - Uses updateOverlayForContainer for disabled state
|
|
1153
|
+
* - Warns if height exceeds maximum allowed by PayPal SDK
|
|
1154
|
+
* ---
|
|
1155
|
+
*
|
|
1156
|
+
*/
|
|
1157
|
+
"primer-paypal": Partial<PayPalComponentProps & BaseProps & BaseEvents>;
|
|
1158
|
+
|
|
1038
1159
|
/**
|
|
1039
1160
|
* PaymentMethodContentComponent - renders payment method information with icon and details
|
|
1040
1161
|
* This component encapsulates the display logic and styles for payment method content
|