UNPKG

@commercelayer/react-components

Version:
2 lines 1.03 kB
"use client"; "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodName=ShippingMethodName;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent"));function ShippingMethodName(props){var _a;const{shippingMethod,deliveryLeadTimeForShipment,shipmentId}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),htmlFor=`shipment-${shipmentId??""}-${(_a=shippingMethod?.id)!==null&&_a!==void 0?_a:""}`||"",labelName=shippingMethod?.name,parentProps=Object.assign({shippingMethod,deliveryLeadTimeForShipment,label:labelName,htmlFor},props);return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children:props.children})):(0,jsx_runtime_1.jsx)("label",Object.assign({htmlFor},props,{children:labelName}))}exports.default=ShippingMethodName;