File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/index.tsx.tar
packages/woocommerce-blocks/packages/checkout/components/order-local-pickup-packages/index.tsx 0000644 00000002510 15156027145 0045175 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/woocommerce /**
* External dependencies
*/
import classnames from 'classnames';
import {
Cart,
CartShippingPackageShippingRate,
} from '@woocommerce/type-defs/cart';
import { Component } from '@wordpress/element';
import { RadioControlOption } from '@woocommerce/base-components/radio-control/types';
/**
* Internal dependencies
*/
import { createSlotFill } from '../../slot';
const slotName = '__experimentalOrderLocalPickupPackages';
const {
Fill: ExperimentalOrderLocalPickupPackages,
Slot: OrderLocalPickupPackagesSlot,
// eslint-disable-next-line @typescript-eslint/naming-convention
} = createSlotFill( slotName );
interface ExperimentalOrderLocalPickupPackagesProps {
extensions: Record< string, unknown >;
cart: Cart;
components: Record< string, Component >;
renderPickupLocation: (
option: CartShippingPackageShippingRate,
packageCount: number
) => RadioControlOption;
}
const Slot = ( {
extensions,
cart,
components,
renderPickupLocation,
}: ExperimentalOrderLocalPickupPackagesProps ) => {
return (
<OrderLocalPickupPackagesSlot
className={ classnames(
'wc-block-components-local-pickup-rates-control'
) }
fillProps={ {
extensions,
cart,
components,
renderPickupLocation,
} }
/>
);
};
ExperimentalOrderLocalPickupPackages.Slot = Slot;
export default ExperimentalOrderLocalPickupPackages;
woocommerce/packages/woocommerce-blocks/packages/checkout/components/checkbox-control/index.tsx 0000644 00000003237 15156027152 0043176 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins /**
* External dependencies
*/
import classNames from 'classnames';
import { useInstanceId } from '@wordpress/compose';
/**
* Internal dependencies
*/
import './style.scss';
export type CheckboxControlProps = {
className?: string;
label?: string | React.ReactNode;
id?: string;
onChange: ( value: boolean ) => void;
children?: React.ReactChildren;
hasError?: boolean;
checked?: boolean;
disabled?: boolean;
};
/**
* Component used to show a checkbox control with styles.
*/
export const CheckboxControl = ( {
className,
label,
id,
onChange,
children,
hasError = false,
checked = false,
disabled = false,
...rest
}: CheckboxControlProps ): JSX.Element => {
const instanceId = useInstanceId( CheckboxControl );
const checkboxId = id || `checkbox-control-${ instanceId }`;
return (
<div
className={ classNames(
'wc-block-components-checkbox',
{
'has-error': hasError,
},
className
) }
>
<label htmlFor={ checkboxId }>
<input
id={ checkboxId }
className="wc-block-components-checkbox__input"
type="checkbox"
onChange={ ( event ) => onChange( event.target.checked ) }
aria-invalid={ hasError === true }
checked={ checked }
disabled={ disabled }
{ ...rest }
/>
<svg
className="wc-block-components-checkbox__mark"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 20"
>
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
</svg>
{ label && (
<span className="wc-block-components-checkbox__label">
{ label }
</span>
) }
{ children }
</label>
</div>
);
};
export default CheckboxControl;
packages/woocommerce-blocks/packages/checkout/components/validation-input-error/index.tsx 0000644 00000002144 15156043125 0044342 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/woocommerce /**
* External dependencies
*/
import { useSelect } from '@wordpress/data';
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';
/**
* Internal dependencies
*/
import './style.scss';
interface ValidationInputErrorProps {
errorMessage?: string;
propertyName?: string;
elementId?: string;
}
export const ValidationInputError = ( {
errorMessage = '',
propertyName = '',
elementId = '',
}: ValidationInputErrorProps ): JSX.Element | null => {
const { validationError, validationErrorId } = useSelect( ( select ) => {
const store = select( VALIDATION_STORE_KEY );
return {
validationError: store.getValidationError( propertyName ),
validationErrorId: store.getValidationErrorId( elementId ),
};
} );
if ( ! errorMessage || typeof errorMessage !== 'string' ) {
if ( validationError?.message && ! validationError?.hidden ) {
errorMessage = validationError.message;
} else {
return null;
}
}
return (
<div className="wc-block-components-validation-error" role="alert">
<p id={ validationErrorId }>{ errorMessage }</p>
</div>
);
};
export default ValidationInputError;
plugins/woocommerce/packages/woocommerce-blocks/packages/checkout/components/panel/index.tsx 0000644 00000002452 15156073310 0041024 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content /**
* External dependencies
*/
import { useState } from '@wordpress/element';
import classNames from 'classnames';
import { Icon, chevronUp, chevronDown } from '@wordpress/icons';
import type { ReactNode, ReactElement } from 'react';
/**
* Internal dependencies
*/
import './style.scss';
interface PanelProps {
children?: ReactNode;
className?: string;
initialOpen?: boolean;
hasBorder?: boolean;
title?: ReactNode;
titleTag?: keyof JSX.IntrinsicElements;
}
const Panel = ( {
children,
className,
initialOpen = false,
hasBorder = false,
title,
titleTag: TitleTag = 'div',
}: PanelProps ): ReactElement => {
const [ isOpen, setIsOpen ] = useState< boolean >( initialOpen );
return (
<div
className={ classNames( className, 'wc-block-components-panel', {
'has-border': hasBorder,
} ) }
>
<TitleTag>
<button
aria-expanded={ isOpen }
className="wc-block-components-panel__button"
onClick={ () => setIsOpen( ! isOpen ) }
>
<Icon
aria-hidden="true"
className="wc-block-components-panel__button-icon"
icon={ isOpen ? chevronUp : chevronDown }
/>
{ title }
</button>
</TitleTag>
{ isOpen && (
<div className="wc-block-components-panel__content">
{ children }
</div>
) }
</div>
);
};
export default Panel;
packages/woocommerce-blocks/packages/checkout/components/store-notices-container/index.tsx 0000644 00000005757 15156132113 0044513 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/woocommerce /**
* External dependencies
*/
import { useSelect, useDispatch } from '@wordpress/data';
import {
PAYMENT_STORE_KEY,
STORE_NOTICES_STORE_KEY,
} from '@woocommerce/block-data';
import { getNoticeContexts } from '@woocommerce/base-utils';
import type { Notice } from '@wordpress/notices';
import { useMemo, useEffect } from '@wordpress/element';
import type { NoticeType } from '@woocommerce/types';
/**
* Internal dependencies
*/
import './style.scss';
import StoreNotices from './store-notices';
import SnackbarNotices from './snackbar-notices';
import type { StoreNoticesContainerProps } from './types';
const formatNotices = ( notices: Notice[], context: string ): NoticeType[] => {
return notices.map( ( notice ) => ( {
...notice,
context,
} ) ) as NoticeType[];
};
const StoreNoticesContainer = ( {
className = '',
context = '',
additionalNotices = [],
}: StoreNoticesContainerProps ): JSX.Element | null => {
const { registerContainer, unregisterContainer } = useDispatch(
STORE_NOTICES_STORE_KEY
);
const { suppressNotices, registeredContainers } = useSelect(
( select ) => ( {
suppressNotices:
select( PAYMENT_STORE_KEY ).isExpressPaymentMethodActive(),
registeredContainers: select(
STORE_NOTICES_STORE_KEY
).getRegisteredContainers(),
} )
);
const contexts = useMemo< string[] >(
() => ( Array.isArray( context ) ? context : [ context ] ),
[ context ]
);
// Find sub-contexts that have not been registered. We will show notices from those contexts here too.
const allContexts = getNoticeContexts();
const unregisteredSubContexts = allContexts.filter(
( subContext: string ) =>
contexts.some( ( _context: string ) =>
subContext.includes( _context + '/' )
) && ! registeredContainers.includes( subContext )
);
// Get notices from the current context and any sub-contexts and append the name of the context to the notice
// objects for later reference.
const notices = useSelect< NoticeType[] >( ( select ) => {
const { getNotices } = select( 'core/notices' );
return [
...unregisteredSubContexts.flatMap( ( subContext: string ) =>
formatNotices( getNotices( subContext ), subContext )
),
...contexts.flatMap( ( subContext: string ) =>
formatNotices(
getNotices( subContext ).concat( additionalNotices ),
subContext
)
),
].filter( Boolean ) as NoticeType[];
} );
// Register the container context with the parent.
useEffect( () => {
contexts.map( ( _context ) => registerContainer( _context ) );
return () => {
contexts.map( ( _context ) => unregisterContainer( _context ) );
};
}, [ contexts, registerContainer, unregisterContainer ] );
if ( suppressNotices ) {
return null;
}
return (
<>
<StoreNotices
className={ className }
notices={ notices.filter(
( notice ) => notice.type === 'default'
) }
/>
<SnackbarNotices
className={ className }
notices={ notices.filter(
( notice ) => notice.type === 'snackbar'
) }
/>
</>
);
};
export default StoreNoticesContainer;
plugins/woocommerce/packages/woocommerce-blocks/packages/checkout/utils/validation/test/index.tsx 0000644 00000003205 15156153140 0042006 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content /**
* External dependencies
*/
import { act, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
/**
* Internal dependencies
*/
import { getValidityMessageForInput } from '../index';
describe( 'getValidityMessageForInput', () => {
it( 'Returns nothing if the input is valid', async () => {
render( <input type="text" data-testid="custom-input" /> );
const textInputElement = ( await screen.getByTestId(
'custom-input'
) ) as HTMLInputElement;
const validityMessage = getValidityMessageForInput(
'Test',
textInputElement
);
expect( validityMessage ).toBe( '' );
} );
it( 'Returns error message if a required input is empty', async () => {
render( <input type="text" required data-testid="custom-input" /> );
const textInputElement = ( await screen.getByTestId(
'custom-input'
) ) as HTMLInputElement;
const validityMessage = getValidityMessageForInput(
'Test',
textInputElement
);
expect( validityMessage ).toBe( 'Please enter a valid test' );
} );
it( 'Returns a custom error if set, rather than a new message', async () => {
render(
<input
type="text"
required
onChange={ ( event ) => {
event.target.setCustomValidity( 'Custom error' );
} }
data-testid="custom-input"
/>
);
const textInputElement = ( await screen.getByTestId(
'custom-input'
) ) as HTMLInputElement;
await act( async () => {
await userEvent.type( textInputElement, 'Invalid Value' );
} );
const validityMessage = getValidityMessageForInput(
'Test',
textInputElement
);
expect( validityMessage ).toBe( 'Custom error' );
} );
} );
plugins/woocommerce/packages/woocommerce-blocks/packages/checkout/components/store-notice/index.tsx 0000644 00000000777 15156205207 0042352 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content /**
* External dependencies
*/
import classnames from 'classnames';
import NoticeBanner, {
NoticeBannerProps,
} from '@woocommerce/base-components/notice-banner';
/**
* Wrapper for NoticeBanner component.
*/
const StoreNotice = ( {
className,
children,
status,
...props
}: NoticeBannerProps ) => {
return (
<NoticeBanner
className={ classnames( 'wc-block-store-notice', className ) }
status={ status }
{ ...props }
>
{ children }
</NoticeBanner>
);
};
export default StoreNotice;
plugins/woocommerce/packages/woocommerce-blocks/packages/checkout/components/totals/fees/index.tsx 0000644 00000002655 15156273447 0042177 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content /**
* External dependencies
*/
import classnames from 'classnames';
import { __ } from '@wordpress/i18n';
import { getSetting } from '@woocommerce/settings';
import type { Currency } from '@woocommerce/price-format';
import type { CartFeeItem } from '@woocommerce/types';
import type { ReactElement } from 'react';
/**
* Internal dependencies
*/
import TotalsItem from '../item';
export interface TotalsFeesProps {
/**
* Currency
*/
currency: Currency;
/**
* Cart fees
*/
cartFees: CartFeeItem[];
/**
* Component wrapper classname
*
* @default 'wc-block-components-totals-fees'
*/
className?: string;
}
const TotalsFees = ( {
currency,
cartFees,
className,
}: TotalsFeesProps ): ReactElement | null => {
return (
<>
{ cartFees.map( ( { id, name, totals }, index ) => {
const feesValue = parseInt( totals.total, 10 );
if ( ! feesValue ) {
return null;
}
const feesTaxValue = parseInt( totals.total_tax, 10 );
return (
<TotalsItem
key={ id || `${ index }-${ name }` }
className={ classnames(
'wc-block-components-totals-fees',
className
) }
currency={ currency }
label={
name || __( 'Fee', 'woo-gutenberg-products-block' )
}
value={
getSetting( 'displayCartPricesIncludingTax', false )
? feesValue + feesTaxValue
: feesValue
}
/>
);
} ) }
</>
);
};
export default TotalsFees;
packages/woocommerce-blocks/packages/checkout/components/store-notices-container/test/index.tsx 0000644 00000013340 15156341011 0045454 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/woocommerce /**
* External dependencies
*/
import { store as noticesStore } from '@wordpress/notices';
import { dispatch, select } from '@wordpress/data';
import { act, render, screen, waitFor } from '@testing-library/react';
/**
* Internal dependencies
*/
import StoreNoticesContainer from '../index';
describe( 'StoreNoticesContainer', () => {
it( 'Shows notices from the correct context', async () => {
dispatch( noticesStore ).createErrorNotice( 'Custom test error', {
id: 'custom-test-error',
context: 'test-context',
} );
render( <StoreNoticesContainer context="test-context" /> );
expect( screen.getAllByText( /Custom test error/i ) ).toHaveLength( 2 );
// Clean up notices.
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-test-error',
'test-context'
)
);
await waitFor( () => {
return (
select( noticesStore ).getNotices( 'test-context' ).length === 0
);
} );
} );
it( 'Does not show notices from other contexts', async () => {
dispatch( noticesStore ).createErrorNotice( 'Custom test error 2', {
id: 'custom-test-error-2',
context: 'test-context',
} );
render( <StoreNoticesContainer context="other-context" /> );
expect( screen.queryAllByText( /Custom test error 2/i ) ).toHaveLength(
0
);
// Clean up notices.
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-test-error-2',
'test-context'
)
);
await waitFor( () => {
return (
select( noticesStore ).getNotices( 'test-context' ).length === 0
);
} );
} );
it( 'Does not show snackbar notices', async () => {
dispatch( noticesStore ).createErrorNotice( 'Custom test error 2', {
id: 'custom-test-error-2',
context: 'test-context',
type: 'snackbar',
} );
render( <StoreNoticesContainer context="other-context" /> );
expect( screen.queryAllByText( /Custom test error 2/i ) ).toHaveLength(
0
);
// Clean up notices.
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-test-error-2',
'test-context'
)
);
await waitFor( () => {
return (
select( noticesStore ).getNotices( 'test-context' ).length === 0
);
} );
} );
it( 'Shows additional notices', () => {
render(
<StoreNoticesContainer
additionalNotices={ [
{
id: 'additional-test-error',
status: 'error',
spokenMessage: 'Additional test error',
isDismissible: false,
content: 'Additional test error',
actions: [],
speak: false,
__unstableHTML: '',
type: 'default',
},
] }
/>
);
// Also counts the spokenMessage.
expect( screen.getAllByText( /Additional test error/i ) ).toHaveLength(
2
);
} );
it( 'Shows notices from unregistered sub-contexts', async () => {
dispatch( noticesStore ).createErrorNotice(
'Custom first sub-context error',
{
id: 'custom-subcontext-test-error',
context: 'wc/checkout/shipping-address',
}
);
dispatch( noticesStore ).createErrorNotice(
'Custom second sub-context error',
{
id: 'custom-subcontext-test-error',
context: 'wc/checkout/billing-address',
}
);
render( <StoreNoticesContainer context="wc/checkout" /> );
// This should match against 2 messages, one for each sub-context.
expect(
screen.getAllByText( /Custom first sub-context error/i )
).toHaveLength( 2 );
expect(
screen.getAllByText( /Custom second sub-context error/i )
).toHaveLength( 2 );
// Clean up notices.
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-subcontext-test-error',
'wc/checkout/shipping-address'
)
);
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-subcontext-test-error',
'wc/checkout/billing-address'
)
);
} );
it( 'Shows notices from several contexts', async () => {
dispatch( noticesStore ).createErrorNotice( 'Custom shipping error', {
id: 'custom-subcontext-test-error',
context: 'wc/checkout/shipping-address',
} );
dispatch( noticesStore ).createErrorNotice( 'Custom billing error', {
id: 'custom-subcontext-test-error',
context: 'wc/checkout/billing-address',
} );
render(
<StoreNoticesContainer
context={ [
'wc/checkout/billing-address',
'wc/checkout/shipping-address',
] }
/>
);
// This should match against 4 elements; A written and spoken message for each error.
expect( screen.getAllByText( /Custom shipping error/i ) ).toHaveLength(
2
);
expect( screen.getAllByText( /Custom billing error/i ) ).toHaveLength(
2
);
// Clean up notices.
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-subcontext-test-error',
'wc/checkout/shipping-address'
)
);
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-subcontext-test-error',
'wc/checkout/billing-address'
)
);
} );
it( 'Combine same notices from several contexts', async () => {
dispatch( noticesStore ).createErrorNotice( 'Custom generic error', {
id: 'custom-subcontext-test-error',
context: 'wc/checkout/shipping-address',
} );
dispatch( noticesStore ).createErrorNotice( 'Custom generic error', {
id: 'custom-subcontext-test-error',
context: 'wc/checkout/billing-address',
} );
render(
<StoreNoticesContainer
context={ [
'wc/checkout/billing-address',
'wc/checkout/shipping-address',
] }
/>
);
// This should match against 2 elements; A written and spoken message.
expect( screen.getAllByText( /Custom generic error/i ) ).toHaveLength(
2
);
// Clean up notices.
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-subcontext-test-error',
'wc/checkout/shipping-address'
)
);
await act( () =>
dispatch( noticesStore ).removeNotice(
'custom-subcontext-test-error',
'wc/checkout/billing-address'
)
);
} );
} );
plugins/woocommerce/packages/woocommerce-blocks/packages/checkout/components/totals/taxes/index.tsx 0000644 00000003620 15156376107 0042367 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content /**
* External dependencies
*/
import classnames from 'classnames';
import { __ } from '@wordpress/i18n';
import { getSetting } from '@woocommerce/settings';
import type { Currency } from '@woocommerce/price-format';
import type { CartTotalsTaxLineItem } from '@woocommerce/types';
import type { ReactElement } from 'react';
/**
* Internal dependencies
*/
import TotalsItem from '../item';
interface Values {
tax_lines: CartTotalsTaxLineItem[];
total_tax: string;
}
export interface TotalsTaxesProps {
className?: string;
currency: Currency;
showRateAfterTaxName: boolean;
values: Values | Record< string, never >;
}
const TotalsTaxes = ( {
currency,
values,
className,
showRateAfterTaxName,
}: TotalsTaxesProps ): ReactElement | null => {
const { total_tax: totalTax, tax_lines: taxLines } = values;
if (
! getSetting( 'taxesEnabled', true ) &&
parseInt( totalTax, 10 ) <= 0
) {
return null;
}
const showItemisedTaxes = getSetting(
'displayItemizedTaxes',
false
) as boolean;
const itemisedTaxItems: ReactElement | null =
showItemisedTaxes && taxLines.length > 0 ? (
<>
{ taxLines.map( ( { name, rate, price }, i ) => {
const label = `${ name }${
showRateAfterTaxName ? ` ${ rate }` : ''
}`;
return (
<TotalsItem
key={ `tax-line-${ i }` }
className={ classnames(
'wc-block-components-totals-taxes',
className
) }
currency={ currency }
label={ label }
value={ parseInt( price, 10 ) }
/>
);
} ) }{ ' ' }
</>
) : null;
return showItemisedTaxes ? (
itemisedTaxItems
) : (
<>
<TotalsItem
className={ classnames(
'wc-block-components-totals-taxes',
className
) }
currency={ currency }
label={ __( 'Taxes', 'woo-gutenberg-products-block' ) }
value={ parseInt( totalTax, 10 ) }
description={ null }
/>
</>
);
};
export default TotalsTaxes;
woocommerce/packages/woocommerce-blocks/packages/checkout/components/totals/subtotal/index.tsx 0000644 00000002041 15156411042 0043060 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins /**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { getSetting } from '@woocommerce/settings';
import type { Currency } from '@woocommerce/price-format';
import type { ReactElement } from 'react';
/**
* Internal dependencies
*/
import TotalsItem from '../item';
interface Values {
total_items: string;
total_items_tax: string;
}
export interface SubtotalProps {
className?: string;
currency: Currency;
values: Values | Record< string, never >;
}
const Subtotal = ( {
currency,
values,
className,
}: SubtotalProps ): ReactElement => {
const { total_items: totalItems, total_items_tax: totalItemsTax } = values;
const itemsValue = parseInt( totalItems, 10 );
const itemsTaxValue = parseInt( totalItemsTax, 10 );
return (
<TotalsItem
className={ className }
currency={ currency }
label={ __( 'Subtotal', 'woo-gutenberg-products-block' ) }
value={
getSetting( 'displayCartPricesIncludingTax', false )
? itemsValue + itemsTaxValue
: itemsValue
}
/>
);
};
export default Subtotal;
plugins/woocommerce/packages/woocommerce-blocks/packages/checkout/components/totals/item/index.tsx 0000644 00000003053 15156663270 0042201 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content /**
* External dependencies
*/
import classnames from 'classnames';
import { isValidElement } from '@wordpress/element';
import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount';
import type { ReactElement, ReactNode } from 'react';
import type { Currency } from '@woocommerce/price-format';
/**
* Internal dependencies
*/
import './style.scss';
export interface TotalsItemProps {
className?: string;
currency: Currency;
label: string;
// Value may be a number, or react node. Numbers are passed to FormattedMonetaryAmount.
value: number | ReactNode;
description?: ReactNode;
}
const TotalsItemValue = ( {
value,
currency,
}: Partial< TotalsItemProps > ): ReactElement | null => {
if ( isValidElement( value ) ) {
return (
<div className="wc-block-components-totals-item__value">
{ value }
</div>
);
}
return Number.isFinite( value ) ? (
<FormattedMonetaryAmount
className="wc-block-components-totals-item__value"
currency={ currency || {} }
value={ value as number }
/>
) : null;
};
const TotalsItem = ( {
className,
currency,
label,
value,
description,
}: TotalsItemProps ): ReactElement => {
return (
<div
className={ classnames(
'wc-block-components-totals-item',
className
) }
>
<span className="wc-block-components-totals-item__label">
{ label }
</span>
<TotalsItemValue value={ value } currency={ currency } />
<div className="wc-block-components-totals-item__description">
{ description }
</div>
</div>
);
};
export default TotalsItem;
packages/woocommerce-blocks/packages/checkout/components/checkbox-control/stories/index.tsx 0000644 00000001055 15157032375 0044666 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/woocommerce /**
* External dependencies
*/
import type { Story, Meta } from '@storybook/react';
/**
* Internal dependencies
*/
import CheckboxControl, { CheckboxControlProps } from '..';
export default {
title: 'WooCommerce Blocks/Checkout Blocks/CheckboxControl',
component: CheckboxControl,
args: {
instanceId: 'my-checkbox-id',
label: 'Check me out',
},
} as Meta< CheckboxControlProps >;
const Template: Story< CheckboxControlProps > = ( args ) => (
<CheckboxControl { ...args } />
);
export const Default = Template.bind( {} );
Default.args = {};
woocommerce/packages/woocommerce-blocks/packages/checkout/components/totals/taxes/stories/index.tsx 0000644 00000001447 15157243223 0044055 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins /**
* External dependencies
*/
import type { Story, Meta } from '@storybook/react';
import { currencies, currencyControl } from '@woocommerce/storybook-controls';
/**
* Internal dependencies
*/
import Taxes, { TotalsTaxesProps } from '..';
export default {
title: 'WooCommerce Blocks/Checkout Blocks/totals/Taxes',
component: Taxes,
argTypes: {
currency: currencyControl,
showRateAfterTaxName: {
table: { disable: true },
},
},
args: {
values: {
tax_lines: [
{
name: 'Expensive tax fee',
price: '1000',
rate: '500',
},
],
total_tax: '2000',
},
},
} as Meta< TotalsTaxesProps >;
const Template: Story< TotalsTaxesProps > = ( args ) => <Taxes { ...args } />;
export const Default = Template.bind( {} );
Default.args = {
currency: currencies.USD,
};
woocommerce/packages/woocommerce-blocks/packages/checkout/components/totals/fees/stories/index.tsx 0000644 00000002261 15157260306 0043647 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins /**
* External dependencies
*/
import type { Story, Meta } from '@storybook/react';
import {
currenciesAPIShape,
currencies,
currencyControl,
} from '@woocommerce/storybook-controls';
/**
* Internal dependencies
*/
import Fees, { TotalsFeesProps } from '..';
export default {
title: 'WooCommerce Blocks/Checkout Blocks/totals/Fees',
component: Fees,
argTypes: {
currency: currencyControl,
},
args: {
total: '',
cartFees: [
{
id: 'my-id',
name: 'Storybook fee',
totals: {
...currenciesAPIShape.USD,
total: '1000',
total_tax: '200',
},
},
],
},
} as Meta< TotalsFeesProps >;
type StorybookTotalFeesProps = TotalsFeesProps & { total: string };
const Template: Story< StorybookTotalFeesProps > = ( args ) => {
return (
<Fees
{ ...args }
cartFees={ [
{
...args.cartFees[ 0 ],
totals: {
...args.cartFees[ 0 ].totals,
total: args.total,
},
},
] }
/>
);
};
export const Default = Template.bind( {} );
Default.args = {
currency: currencies.USD,
total: '1000',
};
export const AlternativeCurrency = Template.bind( {} );
AlternativeCurrency.args = {
currency: currencies.EUR,
total: '1000',
};
packages/woocommerce-blocks/packages/checkout/components/totals/subtotal/stories/index.tsx 0000644 00000001722 15157350026 0044562 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/woocommerce /**
* External dependencies
*/
import type { Story, Meta } from '@storybook/react';
import { currencies, currencyControl } from '@woocommerce/storybook-controls';
/**
* Internal dependencies
*/
import Subtotal, { SubtotalProps } from '..';
export default {
title: 'WooCommerce Blocks/Checkout Blocks/totals/Subtotal',
component: Subtotal,
argTypes: {
currency: currencyControl,
},
args: {
values: {
total_items: '1000',
total_items_tax: '200',
},
},
} as Meta< SubtotalProps >;
type StorybookSubtotalProps = SubtotalProps & { total_items: string };
const Template: Story< StorybookSubtotalProps > = ( args ) => {
const totalItems = args.total_items;
const values = {
total_items: totalItems,
total_items_tax: args.values.total_items_tax,
};
return (
<Subtotal { ...args } currency={ args.currency } values={ values } />
);
};
export const Default = Template.bind( {} );
Default.args = {
currency: currencies.USD,
total_items: '1000',
};
woocommerce/packages/woocommerce-blocks/packages/checkout/components/totals/item/stories/index.tsx 0000644 00000001411 15157710155 0043661 0 ustar 00 var/www/vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins /**
* External dependencies
*/
import type { Story, Meta } from '@storybook/react';
import { currencies, currencyControl } from '@woocommerce/storybook-controls';
/**
* Internal dependencies
*/
import Item, { TotalsItemProps } from '..';
export default {
title: 'WooCommerce Blocks/Checkout Blocks/totals/Item',
component: Item,
argTypes: {
currency: currencyControl,
description: { control: { type: 'text' } },
},
args: {
description: 'This item is so interesting',
label: 'Interesting item',
value: 2000,
},
} as Meta< TotalsItemProps >;
const Template: Story< TotalsItemProps > = ( args ) => <Item { ...args } />;
export const Default = Template.bind( {} );
Default.args = {
currency: currencies.USD,
description: 'This item is so interesting',
};