@croquiscom/pds 0.0.1
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 +7 -0
- package/LEGACY_CHANGELOG.md +358 -0
- package/README.md +133 -0
- package/assets/icons/Account_24.svg +3 -0
- package/assets/icons/AlertFill_20.svg +5 -0
- package/assets/icons/Alert_20.svg +5 -0
- package/assets/icons/Alert_24.svg +5 -0
- package/assets/icons/Alert_50.svg +5 -0
- package/assets/icons/ArrowBottom_16.svg +4 -0
- package/assets/icons/ArrowBottom_18.svg +3 -0
- package/assets/icons/ArrowDecrease_10.svg +3 -0
- package/assets/icons/ArrowIncrease_10.svg +3 -0
- package/assets/icons/ArrowLeft_16.svg +4 -0
- package/assets/icons/ArrowLeft_18.svg +3 -0
- package/assets/icons/ArrowLineRight_20.svg +3 -0
- package/assets/icons/ArrowRight_16.svg +4 -0
- package/assets/icons/ArrowRight_18.svg +3 -0
- package/assets/icons/ArrowStick_10.svg +3 -0
- package/assets/icons/ArrowTop_16.svg +4 -0
- package/assets/icons/ArrowTop_18.svg +3 -0
- package/assets/icons/AutoCharge_20.svg +9 -0
- package/assets/icons/BarChart_18.svg +5 -0
- package/assets/icons/Beauty_72.svg +8 -0
- package/assets/icons/Below_10.svg +3 -0
- package/assets/icons/Below_16.svg +4 -0
- package/assets/icons/Best_16.svg +18 -0
- package/assets/icons/Bookmark_18.svg +3 -0
- package/assets/icons/Boost_24.svg +3 -0
- package/assets/icons/Brand_72.svg +9 -0
- package/assets/icons/CVR_18.svg +9 -0
- package/assets/icons/Calendar_16.svg +12 -0
- package/assets/icons/Camera_20.svg +3 -0
- package/assets/icons/Cart_18.svg +5 -0
- package/assets/icons/Cart_24.svg +5 -0
- package/assets/icons/ChargeCoupon_20.svg +10 -0
- package/assets/icons/Charge_20.svg +5 -0
- package/assets/icons/Check_14.svg +3 -0
- package/assets/icons/Check_24.svg +3 -0
- package/assets/icons/CircleCard_24.svg +4 -0
- package/assets/icons/CircleCheckFill_16.svg +4 -0
- package/assets/icons/CircleCheckLine_16.svg +4 -0
- package/assets/icons/CirclePlus_14.svg +5 -0
- package/assets/icons/CircleWon_18.svg +5 -0
- package/assets/icons/CircleWon_24.svg +4 -0
- package/assets/icons/Click_18.svg +8 -0
- package/assets/icons/Clock_16.svg +5 -0
- package/assets/icons/CloseMedium_24.svg +4 -0
- package/assets/icons/CloseSmall_16.svg +4 -0
- package/assets/icons/Copy_14.svg +4 -0
- package/assets/icons/Coupon_18.svg +6 -0
- package/assets/icons/Coupon_24.svg +8 -0
- package/assets/icons/Cs_24.svg +8 -0
- package/assets/icons/Dashboard_24.svg +5 -0
- package/assets/icons/DeleteCircleFill_20.svg +5 -0
- package/assets/icons/Delivery_24.svg +3 -0
- package/assets/icons/DocComfirm_50.svg +3 -0
- package/assets/icons/Doc_14.svg +6 -0
- package/assets/icons/Done_20.svg +4 -0
- package/assets/icons/Donut_30.svg +25 -0
- package/assets/icons/Dots_30.svg +21 -0
- package/assets/icons/Edit_16.svg +4 -0
- package/assets/icons/Email_18.svg +9 -0
- package/assets/icons/EmptyNoti_50.svg +5 -0
- package/assets/icons/Eng_16.svg +9 -0
- package/assets/icons/Excel_16.svg +4 -0
- package/assets/icons/Exchange_24.svg +25 -0
- package/assets/icons/Exhibition_24.svg +5 -0
- package/assets/icons/Fbk_16.svg +10 -0
- package/assets/icons/Grade_18.svg +6 -0
- package/assets/icons/GraphBar_16.svg +3 -0
- package/assets/icons/GraphLine_16.svg +3 -0
- package/assets/icons/Graph_24.svg +5 -0
- package/assets/icons/Heart_18.svg +3 -0
- package/assets/icons/Help_14.svg +5 -0
- package/assets/icons/Help_16.svg +4 -0
- package/assets/icons/Home_16.svg +11 -0
- package/assets/icons/IdeaFill_24.svg +14 -0
- package/assets/icons/IdeaLine_24.svg +13 -0
- package/assets/icons/IndentArrow_14.svg +6 -0
- package/assets/icons/Info_14.svg +4 -0
- package/assets/icons/Info_16.svg +4 -0
- package/assets/icons/Info_24.svg +5 -0
- package/assets/icons/Interest_16.svg +18 -0
- package/assets/icons/Jpn_16.svg +9 -0
- package/assets/icons/KakaostyleOri_115.svg +12 -0
- package/assets/icons/Kor_16.svg +9 -0
- package/assets/icons/Life_72.svg +18 -0
- package/assets/icons/Link_16.svg +3 -0
- package/assets/icons/Loading_24.svg +5 -0
- package/assets/icons/Lock_18.svg +12 -0
- package/assets/icons/Marketing_24.svg +3 -0
- package/assets/icons/Megaphone_14.svg +3 -0
- package/assets/icons/MemoAttention_20.svg +7 -0
- package/assets/icons/MemoDefault_20.svg +4 -0
- package/assets/icons/Move_10.svg +6 -0
- package/assets/icons/New_10.svg +3 -0
- package/assets/icons/NotExposed_16.svg +18 -0
- package/assets/icons/Notice_24.svg +3 -0
- package/assets/icons/One_18.svg +3 -0
- package/assets/icons/OrderAmount_18.svg +5 -0
- package/assets/icons/Order_24.svg +3 -0
- package/assets/icons/Ordering_16.svg +4 -0
- package/assets/icons/Orders_18.svg +7 -0
- package/assets/icons/OutlinkOne_14.svg +10 -0
- package/assets/icons/OutlinkTwo_14.svg +9 -0
- package/assets/icons/PartnerCenter_224.svg +26 -0
- package/assets/icons/PartnerLounge_224.svg +27 -0
- package/assets/icons/PenaltyBad_20.svg +6 -0
- package/assets/icons/PenaltyGood_20.svg +6 -0
- package/assets/icons/PenaltyNotsobad_20.svg +6 -0
- package/assets/icons/Pin_16.svg +4 -0
- package/assets/icons/Pin_24.svg +7 -0
- package/assets/icons/Play_20.svg +3 -0
- package/assets/icons/Plus_16.svg +4 -0
- package/assets/icons/Plus_20.svg +3 -0
- package/assets/icons/PostyOri_73.svg +7 -0
- package/assets/icons/Posty_16.svg +4 -0
- package/assets/icons/Powerup_24.svg +4 -0
- package/assets/icons/Product_24.svg +3 -0
- package/assets/icons/Promotion_24.svg +3 -0
- package/assets/icons/Question_24.svg +6 -0
- package/assets/icons/Ranking_18.svg +3 -0
- package/assets/icons/Refresh_14.svg +3 -0
- package/assets/icons/Refund_24.svg +16 -0
- package/assets/icons/Search_14.svg +3 -0
- package/assets/icons/SelectArrow_16.svg +3 -0
- package/assets/icons/Shop_72.svg +12 -0
- package/assets/icons/SluggishSales_16.svg +18 -0
- package/assets/icons/Spoid_20.svg +3 -0
- package/assets/icons/Star_10.svg +10 -0
- package/assets/icons/StatusNo_16.svg +4 -0
- package/assets/icons/StatusYes_16.svg +3 -0
- package/assets/icons/Status_10.svg +3 -0
- package/assets/icons/SteadySeller_16.svg +18 -0
- package/assets/icons/Store_50.svg +7 -0
- package/assets/icons/TableMove_16.svg +5 -0
- package/assets/icons/Thumbup_14.svg +3 -0
- package/assets/icons/Tip_18.svg +5 -0
- package/assets/icons/TrendDecreasing_18.svg +4 -0
- package/assets/icons/TrendIncreasing_18.svg +4 -0
- package/assets/icons/Trend_18.svg +4 -0
- package/assets/icons/Two_18.svg +4 -0
- package/assets/icons/Upload_50.svg +3 -0
- package/assets/icons/User_18.svg +5 -0
- package/assets/icons/Video_16.svg +4 -0
- package/assets/icons/Warning_24.svg +5 -0
- package/assets/icons/Won_16.svg +4 -0
- package/assets/icons/ZdeliveryOne_59.svg +6 -0
- package/assets/icons/ZdeliveryTwo_78.svg +14 -0
- package/assets/icons/Zexpress_35.svg +13 -0
- package/assets/icons/ZigzagBi_130.svg +15 -0
- package/assets/icons/ZigzagCan_16.svg +13 -0
- package/assets/icons/ZigzagEng_16.svg +55 -0
- package/assets/icons/ZigzagGlobal_16.svg +5 -0
- package/assets/icons/ZigzagJpn_16.svg +5 -0
- package/assets/icons/ZigzagKor_16.svg +32 -0
- package/assets/icons/ZigzagWeb_16.svg +5 -0
- package/assets/icons/Zigzag_16.svg +4 -0
- package/assets/icons/Zpay_52.svg +3 -0
- package/dist/button/Button.d.ts +12 -0
- package/dist/button/Button.stories.d.ts +17 -0
- package/dist/button/index.d.ts +1 -0
- package/dist/button/styles.d.ts +4 -0
- package/dist/button/types.d.ts +2 -0
- package/dist/foundation/colors.d.ts +92 -0
- package/dist/foundation/index.d.ts +3 -0
- package/dist/foundation/semantic_colors.d.ts +43 -0
- package/dist/foundation/typography.d.ts +5 -0
- package/dist/global_style/GlobalStyle.d.ts +3 -0
- package/dist/global_style/index.d.ts +1 -0
- package/dist/hooks/useControlled.d.ts +5 -0
- package/dist/icons/Icon.stories.d.ts +33 -0
- package/dist/icons/generated/Account24.d.ts +4 -0
- package/dist/icons/generated/Alert20.d.ts +4 -0
- package/dist/icons/generated/Alert24.d.ts +4 -0
- package/dist/icons/generated/Alert50.d.ts +4 -0
- package/dist/icons/generated/AlertFill20.d.ts +4 -0
- package/dist/icons/generated/ArrowBottom16.d.ts +4 -0
- package/dist/icons/generated/ArrowBottom18.d.ts +4 -0
- package/dist/icons/generated/ArrowDecrease10.d.ts +4 -0
- package/dist/icons/generated/ArrowIncrease10.d.ts +4 -0
- package/dist/icons/generated/ArrowLeft16.d.ts +4 -0
- package/dist/icons/generated/ArrowLeft18.d.ts +4 -0
- package/dist/icons/generated/ArrowLineRight20.d.ts +4 -0
- package/dist/icons/generated/ArrowRight16.d.ts +4 -0
- package/dist/icons/generated/ArrowRight18.d.ts +4 -0
- package/dist/icons/generated/ArrowStick10.d.ts +4 -0
- package/dist/icons/generated/ArrowTop16.d.ts +4 -0
- package/dist/icons/generated/ArrowTop18.d.ts +4 -0
- package/dist/icons/generated/AutoCharge20.d.ts +4 -0
- package/dist/icons/generated/BarChart18.d.ts +4 -0
- package/dist/icons/generated/Beauty72.d.ts +4 -0
- package/dist/icons/generated/Below10.d.ts +4 -0
- package/dist/icons/generated/Below16.d.ts +4 -0
- package/dist/icons/generated/Best16.d.ts +4 -0
- package/dist/icons/generated/Bookmark18.d.ts +4 -0
- package/dist/icons/generated/Boost24.d.ts +4 -0
- package/dist/icons/generated/Brand72.d.ts +4 -0
- package/dist/icons/generated/Calendar16.d.ts +4 -0
- package/dist/icons/generated/Camera20.d.ts +4 -0
- package/dist/icons/generated/Cart18.d.ts +4 -0
- package/dist/icons/generated/Cart24.d.ts +4 -0
- package/dist/icons/generated/Charge20.d.ts +4 -0
- package/dist/icons/generated/ChargeCoupon20.d.ts +4 -0
- package/dist/icons/generated/Check14.d.ts +4 -0
- package/dist/icons/generated/Check24.d.ts +4 -0
- package/dist/icons/generated/CircleCard24.d.ts +4 -0
- package/dist/icons/generated/CircleCheckFill16.d.ts +4 -0
- package/dist/icons/generated/CircleCheckLine16.d.ts +4 -0
- package/dist/icons/generated/CirclePlus14.d.ts +4 -0
- package/dist/icons/generated/CircleWon18.d.ts +4 -0
- package/dist/icons/generated/CircleWon24.d.ts +4 -0
- package/dist/icons/generated/Click18.d.ts +4 -0
- package/dist/icons/generated/Clock16.d.ts +4 -0
- package/dist/icons/generated/CloseMedium24.d.ts +4 -0
- package/dist/icons/generated/CloseSmall16.d.ts +4 -0
- package/dist/icons/generated/Copy14.d.ts +4 -0
- package/dist/icons/generated/CostPerOrder18.d.ts +4 -0
- package/dist/icons/generated/Coupon18.d.ts +4 -0
- package/dist/icons/generated/Coupon24.d.ts +4 -0
- package/dist/icons/generated/Cs24.d.ts +4 -0
- package/dist/icons/generated/Cvr18.d.ts +4 -0
- package/dist/icons/generated/Dashboard24.d.ts +4 -0
- package/dist/icons/generated/DeleteCircleFill20.d.ts +4 -0
- package/dist/icons/generated/Delivery24.d.ts +4 -0
- package/dist/icons/generated/Doc14.d.ts +4 -0
- package/dist/icons/generated/DocComfirm50.d.ts +4 -0
- package/dist/icons/generated/Done20.d.ts +4 -0
- package/dist/icons/generated/Donut30.d.ts +4 -0
- package/dist/icons/generated/Dots30.d.ts +4 -0
- package/dist/icons/generated/Edit16.d.ts +4 -0
- package/dist/icons/generated/Email18.d.ts +4 -0
- package/dist/icons/generated/EmptyNoti50.d.ts +4 -0
- package/dist/icons/generated/Eng16.d.ts +4 -0
- package/dist/icons/generated/Excel16.d.ts +4 -0
- package/dist/icons/generated/Exchange24.d.ts +4 -0
- package/dist/icons/generated/Exhibition24.d.ts +4 -0
- package/dist/icons/generated/Fbk16.d.ts +4 -0
- package/dist/icons/generated/Grade18.d.ts +4 -0
- package/dist/icons/generated/Graph24.d.ts +4 -0
- package/dist/icons/generated/GraphBar16.d.ts +4 -0
- package/dist/icons/generated/GraphLine16.d.ts +4 -0
- package/dist/icons/generated/Heart18.d.ts +4 -0
- package/dist/icons/generated/Help14.d.ts +4 -0
- package/dist/icons/generated/Help16.d.ts +4 -0
- package/dist/icons/generated/Home16.d.ts +4 -0
- package/dist/icons/generated/IdeaFill24.d.ts +4 -0
- package/dist/icons/generated/IdeaLine24.d.ts +4 -0
- package/dist/icons/generated/IndentArrow14.d.ts +4 -0
- package/dist/icons/generated/Info14.d.ts +4 -0
- package/dist/icons/generated/Info16.d.ts +4 -0
- package/dist/icons/generated/Info24.d.ts +4 -0
- package/dist/icons/generated/Interest16.d.ts +4 -0
- package/dist/icons/generated/Jpn16.d.ts +4 -0
- package/dist/icons/generated/KakaostyleOri115.d.ts +4 -0
- package/dist/icons/generated/Kor16.d.ts +4 -0
- package/dist/icons/generated/Life72.d.ts +4 -0
- package/dist/icons/generated/Link16.d.ts +4 -0
- package/dist/icons/generated/Loading24.d.ts +4 -0
- package/dist/icons/generated/Lock18.d.ts +4 -0
- package/dist/icons/generated/Marketing24.d.ts +4 -0
- package/dist/icons/generated/Megaphone14.d.ts +4 -0
- package/dist/icons/generated/MemoAttention20.d.ts +4 -0
- package/dist/icons/generated/MemoDefault20.d.ts +4 -0
- package/dist/icons/generated/Move10.d.ts +4 -0
- package/dist/icons/generated/New10.d.ts +4 -0
- package/dist/icons/generated/NotExposed16.d.ts +4 -0
- package/dist/icons/generated/Notice24.d.ts +4 -0
- package/dist/icons/generated/One18.d.ts +4 -0
- package/dist/icons/generated/Order24.d.ts +4 -0
- package/dist/icons/generated/OrderAmount18.d.ts +4 -0
- package/dist/icons/generated/Ordering16.d.ts +4 -0
- package/dist/icons/generated/Orders18.d.ts +4 -0
- package/dist/icons/generated/OutlinkOne14.d.ts +4 -0
- package/dist/icons/generated/OutlinkTwo14.d.ts +4 -0
- package/dist/icons/generated/PartnerCenter224.d.ts +4 -0
- package/dist/icons/generated/PartnerLounge224.d.ts +4 -0
- package/dist/icons/generated/PenaltyBad20.d.ts +4 -0
- package/dist/icons/generated/PenaltyGood20.d.ts +4 -0
- package/dist/icons/generated/PenaltyNotsobad20.d.ts +4 -0
- package/dist/icons/generated/Pin16.d.ts +4 -0
- package/dist/icons/generated/Pin24.d.ts +4 -0
- package/dist/icons/generated/Play20.d.ts +4 -0
- package/dist/icons/generated/Plus16.d.ts +4 -0
- package/dist/icons/generated/Plus20.d.ts +4 -0
- package/dist/icons/generated/Posty16.d.ts +4 -0
- package/dist/icons/generated/PostyOri73.d.ts +4 -0
- package/dist/icons/generated/Powerup24.d.ts +4 -0
- package/dist/icons/generated/Product24.d.ts +4 -0
- package/dist/icons/generated/Promotion24.d.ts +4 -0
- package/dist/icons/generated/Question24.d.ts +4 -0
- package/dist/icons/generated/Ranking18.d.ts +4 -0
- package/dist/icons/generated/Refresh14.d.ts +4 -0
- package/dist/icons/generated/Refund24.d.ts +4 -0
- package/dist/icons/generated/Search14.d.ts +4 -0
- package/dist/icons/generated/SelectArrow16.d.ts +4 -0
- package/dist/icons/generated/Shop72.d.ts +4 -0
- package/dist/icons/generated/SluggishSales16.d.ts +4 -0
- package/dist/icons/generated/Spoid20.d.ts +4 -0
- package/dist/icons/generated/Star10.d.ts +4 -0
- package/dist/icons/generated/Status10.d.ts +4 -0
- package/dist/icons/generated/StatusNo16.d.ts +4 -0
- package/dist/icons/generated/StatusYes16.d.ts +4 -0
- package/dist/icons/generated/SteadySeller16.d.ts +4 -0
- package/dist/icons/generated/Store50.d.ts +4 -0
- package/dist/icons/generated/TableMove16.d.ts +4 -0
- package/dist/icons/generated/Thumbup14.d.ts +4 -0
- package/dist/icons/generated/Tip18.d.ts +4 -0
- package/dist/icons/generated/Trend18.d.ts +4 -0
- package/dist/icons/generated/TrendDecreasing18.d.ts +4 -0
- package/dist/icons/generated/TrendIncreasing18.d.ts +4 -0
- package/dist/icons/generated/Two18.d.ts +4 -0
- package/dist/icons/generated/Upload50.d.ts +4 -0
- package/dist/icons/generated/User18.d.ts +4 -0
- package/dist/icons/generated/Video16.d.ts +4 -0
- package/dist/icons/generated/Warning24.d.ts +4 -0
- package/dist/icons/generated/Won16.d.ts +4 -0
- package/dist/icons/generated/ZdeliveryOne59.d.ts +4 -0
- package/dist/icons/generated/ZdeliveryTwo78.d.ts +4 -0
- package/dist/icons/generated/Zexpress35.d.ts +4 -0
- package/dist/icons/generated/Zigzag16.d.ts +4 -0
- package/dist/icons/generated/ZigzagBi130.d.ts +4 -0
- package/dist/icons/generated/ZigzagCan16.d.ts +4 -0
- package/dist/icons/generated/ZigzagEng16.d.ts +4 -0
- package/dist/icons/generated/ZigzagGlobal16.d.ts +4 -0
- package/dist/icons/generated/ZigzagJpn16.d.ts +4 -0
- package/dist/icons/generated/ZigzagKor16.d.ts +4 -0
- package/dist/icons/generated/ZigzagWeb16.d.ts +4 -0
- package/dist/icons/generated/Zpay52.d.ts +4 -0
- package/dist/icons/generated/index.d.ts +162 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.es.js +7 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/input/Input.d.ts +9 -0
- package/dist/input/Input.stories.d.ts +12 -0
- package/dist/input/InputAddon.d.ts +10 -0
- package/dist/input/NumericInput.d.ts +20 -0
- package/dist/input/NumericInput.stories.d.ts +23 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/styles.d.ts +16 -0
- package/dist/radio/Radio.d.ts +9 -0
- package/dist/radio/Radio.stories.d.ts +10 -0
- package/dist/radio/RadioGroup.d.ts +26 -0
- package/dist/radio/RadioGroup.stories.d.ts +13 -0
- package/dist/radio/index.d.ts +2 -0
- package/dist/stack/HStack.d.ts +11 -0
- package/dist/stack/HStack.stories.d.ts +11 -0
- package/dist/stack/VStack.d.ts +11 -0
- package/dist/stack/VStack.stories.d.ts +11 -0
- package/dist/stack/index.d.ts +2 -0
- package/dist/stack/types.d.ts +9 -0
- package/dist/stories/Box.d.ts +7 -0
- package/dist/stories/Colors.d.ts +3 -0
- package/dist/stories/Icon.d.ts +2 -0
- package/dist/stories/SemanticColors.d.ts +2 -0
- package/dist/stories/Typography.d.ts +2 -0
- package/dist/styles/buildCSSWithLength.d.ts +2 -0
- package/dist/styles/common.d.ts +2 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/size.d.ts +6 -0
- package/dist/styles/space.d.ts +14 -0
- package/dist/text/BaseText.d.ts +19 -0
- package/dist/text/BaseText.stories.d.ts +10 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/textarea/Textarea.d.ts +6 -0
- package/dist/textarea/Textarea.stories.d.ts +11 -0
- package/dist/textarea/index.d.ts +1 -0
- package/dist/toggle-switch/ToggleSwitch.d.ts +22 -0
- package/dist/toggle-switch/ToggleSwitch.stories.d.ts +8 -0
- package/dist/toggle-switch/index.d.ts +1 -0
- package/dist/toggle-switch/styles.d.ts +4 -0
- package/package.json +73 -0
- package/svgo.config.js +21 -0
- package/tools/svgr-component-template.js +39 -0
- package/tools/svgr-index-template.js +20 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { CSSValueWithLength } from '../styles/buildCSSWithLength';
|
|
3
|
+
export declare type InputAlignment = 'left' | 'center' | 'right';
|
|
4
|
+
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
+
alignment?: InputAlignment;
|
|
6
|
+
error?: boolean;
|
|
7
|
+
width?: CSSValueWithLength;
|
|
8
|
+
}
|
|
9
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputProps } from './Input';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Base: any;
|
|
9
|
+
export declare const Error: any;
|
|
10
|
+
export declare const Disabled: any;
|
|
11
|
+
export declare const EnteredDisabled: any;
|
|
12
|
+
export declare const RightAlignment: any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { AllHTMLAttributes } from 'react';
|
|
2
|
+
export interface InputProps extends AllHTMLAttributes<HTMLDivElement> {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
error?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* @default left
|
|
7
|
+
*/
|
|
8
|
+
position: 'left' | 'right';
|
|
9
|
+
}
|
|
10
|
+
export declare const InputAddon: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { CSSValueWithLength } from '../styles/buildCSSWithLength';
|
|
3
|
+
import { InputAlignment } from './Input';
|
|
4
|
+
export interface NumericInputBaseType {
|
|
5
|
+
value?: number | string | null;
|
|
6
|
+
defaultValue?: number | string;
|
|
7
|
+
alignment?: InputAlignment;
|
|
8
|
+
error?: boolean;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
suffix?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
allowNegative?: boolean;
|
|
15
|
+
decimalScale?: number;
|
|
16
|
+
width?: CSSValueWithLength;
|
|
17
|
+
onChange?: (value: number, event: ChangeEvent<HTMLInputElement>) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare type NumericInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'width'> & NumericInputBaseType;
|
|
20
|
+
export declare const NumericInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "width" | "onChange"> & NumericInputBaseType & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NumericInputProps } from './NumericInput';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "width" | "onChange"> & import("./NumericInput").NumericInputBaseType & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Base: any;
|
|
9
|
+
export declare const Addon: any;
|
|
10
|
+
export declare const Error: any;
|
|
11
|
+
export declare const Disabled: any;
|
|
12
|
+
export declare const WhetherNegativeNumbersAreAllowed: any;
|
|
13
|
+
export declare const DecimalScale: any;
|
|
14
|
+
export declare const EnteredDisabled: any;
|
|
15
|
+
export declare const RightAlignment: any;
|
|
16
|
+
export declare const SetValueWithName: {
|
|
17
|
+
(args: NumericInputProps): JSX.Element;
|
|
18
|
+
args: {
|
|
19
|
+
prefix: string;
|
|
20
|
+
suffix: string;
|
|
21
|
+
placeholder: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const input_base_css: import("@emotion/utils").SerializedStyles;
|
|
2
|
+
export declare const input_default_style: {
|
|
3
|
+
backgroundColor: string;
|
|
4
|
+
border: string;
|
|
5
|
+
color: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const input_error_style: {
|
|
8
|
+
border: string;
|
|
9
|
+
'&:focus': {
|
|
10
|
+
border: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const input_disabled_style: {
|
|
14
|
+
backgroundColor: string;
|
|
15
|
+
color: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface RadioProps extends Exclude<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
3
|
+
/**
|
|
4
|
+
* @default false
|
|
5
|
+
*/
|
|
6
|
+
fill?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./Radio").RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const Base: any;
|
|
8
|
+
export declare const Checked: any;
|
|
9
|
+
export declare const Disabled: any;
|
|
10
|
+
export declare const CheckedDisabled: any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type AlignType = 'horizontal' | 'vertical';
|
|
3
|
+
interface RadioItem<RadioValue> {
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
value: RadioValue;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface RadioGroupProps<RadioValue> {
|
|
9
|
+
className?: string;
|
|
10
|
+
defaultValue?: RadioValue;
|
|
11
|
+
value?: RadioValue;
|
|
12
|
+
name?: string;
|
|
13
|
+
items: RadioItem<RadioValue>[];
|
|
14
|
+
spacing?: number;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
align?: AlignType;
|
|
17
|
+
onChange?: (value: RadioValue) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface RadioGroupInstance<RadioValue> {
|
|
20
|
+
value?: RadioValue;
|
|
21
|
+
focus: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const RadioGroup: <RadioValue>(props: RadioGroupProps<RadioValue> & {
|
|
24
|
+
ref?: React.Ref<RadioGroupInstance<RadioValue>>;
|
|
25
|
+
}) => React.ReactElement;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: <RadioValue>(props: import("./RadioGroup").RadioGroupProps<RadioValue> & {
|
|
5
|
+
ref?: React.Ref<import("./RadioGroup").RadioGroupInstance<RadioValue>>;
|
|
6
|
+
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export declare const Base: any;
|
|
10
|
+
export declare const Spacing: any;
|
|
11
|
+
export declare const Disabled: any;
|
|
12
|
+
export declare const VerticalAlign: any;
|
|
13
|
+
export declare const Controlled: () => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StackProps } from './types';
|
|
3
|
+
declare type VerticalAlignment = 'stretch' | 'top' | 'bottom' | 'center';
|
|
4
|
+
export interface HStackProps extends StackProps {
|
|
5
|
+
alignment?: VerticalAlignment;
|
|
6
|
+
}
|
|
7
|
+
export declare const HStack: import("@emotion/styled").StyledComponent<{
|
|
8
|
+
theme?: import("@emotion/react").Theme;
|
|
9
|
+
as?: import("react").ElementType<any>;
|
|
10
|
+
} & HStackProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
theme?: import("@emotion/react").Theme;
|
|
6
|
+
as?: React.ElementType<any>;
|
|
7
|
+
} & import("./HStack").HStackProps, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
export declare const Base: any;
|
|
11
|
+
export declare const Spacing: any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StackProps } from './types';
|
|
3
|
+
declare type HorizontalAlignment = 'stretch' | 'leading' | 'trailing' | 'center';
|
|
4
|
+
export interface VStackProps extends StackProps {
|
|
5
|
+
alignment?: HorizontalAlignment;
|
|
6
|
+
}
|
|
7
|
+
export declare const VStack: import("@emotion/styled").StyledComponent<{
|
|
8
|
+
theme?: import("@emotion/react").Theme;
|
|
9
|
+
as?: import("react").ElementType<any>;
|
|
10
|
+
} & VStackProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
theme?: import("@emotion/react").Theme;
|
|
6
|
+
as?: React.ElementType<any>;
|
|
7
|
+
} & import("./VStack").VStackProps, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
export declare const Base: any;
|
|
11
|
+
export declare const Spacing: any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SizeProps, SpaceProps } from '../styles';
|
|
3
|
+
import { CSSValueWithLength } from '../styles/buildCSSWithLength';
|
|
4
|
+
export declare type StackAlignment = 'stretch' | 'flex-start' | 'center' | 'flex-end';
|
|
5
|
+
export interface StackProps extends SizeProps, SpaceProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
spacing?: CSSValueWithLength;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Box: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: import("react").ElementType<any>;
|
|
5
|
+
} & {
|
|
6
|
+
background?: string;
|
|
7
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSValueWithLength } from './buildCSSWithLength';
|
|
2
|
+
export interface SpaceProps {
|
|
3
|
+
m?: CSSValueWithLength;
|
|
4
|
+
mt?: CSSValueWithLength;
|
|
5
|
+
ml?: CSSValueWithLength;
|
|
6
|
+
mr?: CSSValueWithLength;
|
|
7
|
+
mb?: CSSValueWithLength;
|
|
8
|
+
p?: CSSValueWithLength;
|
|
9
|
+
pt?: CSSValueWithLength;
|
|
10
|
+
pl?: CSSValueWithLength;
|
|
11
|
+
pr?: CSSValueWithLength;
|
|
12
|
+
pb?: CSSValueWithLength;
|
|
13
|
+
}
|
|
14
|
+
export declare function space({ m, mt, ml, mr, mb, p, pt, pl, pr, pb }: SpaceProps): import("@emotion/utils").SerializedStyles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="@emotion/react/types/css-prop" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Typography } from '../foundation';
|
|
4
|
+
declare type Alignment = 'center' | 'leading' | 'trailing';
|
|
5
|
+
declare type TextElement = keyof Pick<JSX.IntrinsicElements, 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'div' | 'span' | 'li'>;
|
|
6
|
+
export interface BaseTextProps extends React.Attributes {
|
|
7
|
+
alignment?: Alignment;
|
|
8
|
+
/**
|
|
9
|
+
* @default span
|
|
10
|
+
*/
|
|
11
|
+
as?: TextElement;
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @default Body_13_Regular
|
|
15
|
+
*/
|
|
16
|
+
variant?: Typography;
|
|
17
|
+
}
|
|
18
|
+
export declare const BaseText: React.FC<BaseTextProps & JSX.IntrinsicElements[BaseTextProps['as']]>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseTextProps } from './BaseText';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<BaseTextProps & (React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> | React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> | React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> | React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement> | React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>)>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Base: any;
|
|
9
|
+
export declare const Alignment: any;
|
|
10
|
+
export declare const Variant: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BaseText';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { SizeProps } from '../styles';
|
|
3
|
+
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement>, SizeProps {
|
|
4
|
+
error?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextareaProps } from './Textarea';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Base: any;
|
|
9
|
+
export declare const Error: any;
|
|
10
|
+
export declare const Disabled: any;
|
|
11
|
+
export declare const EnteredDisabled: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Textarea';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export declare type ToggleSwitchSize = 'small' | 'large';
|
|
3
|
+
export interface ToggleSwitchProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/**
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
isOn?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @default small
|
|
10
|
+
*/
|
|
11
|
+
size?: ToggleSwitchSize;
|
|
12
|
+
/**
|
|
13
|
+
* @default ON
|
|
14
|
+
*/
|
|
15
|
+
onText?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @default OFF
|
|
18
|
+
*/
|
|
19
|
+
offText?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const ToggleSwitch: React.ForwardRefExoticComponent<ToggleSwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export default ToggleSwitch;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToggleSwitchProps } from './ToggleSwitch';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<ToggleSwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Base: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToggleSwitch';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ToggleSwitchSize } from './ToggleSwitch';
|
|
2
|
+
export declare const toggle_switch_base_css: import("@emotion/utils").SerializedStyles;
|
|
3
|
+
export declare const getStylesByActive: (isOn: boolean) => import("@emotion/utils").SerializedStyles;
|
|
4
|
+
export declare const getStyleByProps: (size: ToggleSwitchSize, isOn: boolean) => import("@emotion/utils").SerializedStyles;
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@croquiscom/pds",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Design system for Zigzag's Partner Center",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.es.js",
|
|
7
|
+
"repository": "https://github.com/croquiscom/pds",
|
|
8
|
+
"author": "@croquiscom/frontend",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"registry": "https://registry.npmjs.org"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"storybook": "start-storybook -p 6006",
|
|
16
|
+
"build-storybook": "build-storybook",
|
|
17
|
+
"build-rollup": "rollup -c",
|
|
18
|
+
"build-types": "tsc",
|
|
19
|
+
"build": "npm run build-rollup && npm run build-types",
|
|
20
|
+
"lint": "eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
|
|
21
|
+
"changeset": "changeset",
|
|
22
|
+
"svgr": "svgr -- assets/icons",
|
|
23
|
+
"release": "yarn build && changeset publish"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@emotion/react": "^11.4.0",
|
|
27
|
+
"@emotion/styled": "^11.3.0",
|
|
28
|
+
"react": "^16.13.1 || ^17 || ^18",
|
|
29
|
+
"react-dom": "^16.13.1 || ^17 || ^18"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@babel/preset-env": "^7.14.7",
|
|
33
|
+
"@babel/preset-react": "^7.14.5",
|
|
34
|
+
"@babel/preset-typescript": "^7.14.5",
|
|
35
|
+
"@changesets/cli": "^2.16.0",
|
|
36
|
+
"@emotion/babel-preset-css-prop": "^11.2.0",
|
|
37
|
+
"@emotion/react": "^11.4.0",
|
|
38
|
+
"@emotion/styled": "^11.3.0",
|
|
39
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
40
|
+
"@rollup/plugin-commonjs": "^19.0.0",
|
|
41
|
+
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
42
|
+
"@rollup/plugin-url": "^6.0.0",
|
|
43
|
+
"@storybook/addon-actions": "^6.5.9",
|
|
44
|
+
"@storybook/addon-docs": "^6.5.9",
|
|
45
|
+
"@storybook/addon-essentials": "^6.5.9",
|
|
46
|
+
"@storybook/addon-links": "^6.5.9",
|
|
47
|
+
"@storybook/react": "^6.5.9",
|
|
48
|
+
"@svgr/cli": "^6.1.2",
|
|
49
|
+
"@svgr/rollup": "^6.1.2",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
|
51
|
+
"@typescript-eslint/parser": "^4.28.2",
|
|
52
|
+
"chromatic": "^6.5.3",
|
|
53
|
+
"eslint": "^7.30.0",
|
|
54
|
+
"eslint-config-prettier": "^7.2.0",
|
|
55
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
56
|
+
"eslint-plugin-react": "^7.24.0",
|
|
57
|
+
"prettier": "^2.3.2",
|
|
58
|
+
"react": "^16.13.1",
|
|
59
|
+
"react-dom": "^16.13.1",
|
|
60
|
+
"react-number-format": "^4.6.4",
|
|
61
|
+
"rollup": "^2.52.7",
|
|
62
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
63
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
64
|
+
"rollup-plugin-typescript2": "^0.30.0",
|
|
65
|
+
"storybook-dark-mode": "^1.1.0",
|
|
66
|
+
"typescript": "^4.3.5"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"classnames": "^2.3.1",
|
|
70
|
+
"lodash-es": "^4.17.21",
|
|
71
|
+
"polished": "^4.2.2"
|
|
72
|
+
}
|
|
73
|
+
}
|
package/svgo.config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: [
|
|
3
|
+
{
|
|
4
|
+
name: 'preset-default',
|
|
5
|
+
params: {
|
|
6
|
+
overrides: {
|
|
7
|
+
removeViewBox: false,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
'removeXMLNS',
|
|
12
|
+
'prefixIds',
|
|
13
|
+
{
|
|
14
|
+
name: 'removeAttrs',
|
|
15
|
+
params: {
|
|
16
|
+
attrs: 'version',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
'sortAttrs',
|
|
20
|
+
],
|
|
21
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const getAttributeValue = (jsx, name) => {
|
|
2
|
+
return jsx.find((e) => e.name.name === name);
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
function svgrComponentTemplate(variables, { tpl }) {
|
|
6
|
+
const { exports, jsx, componentName } = variables;
|
|
7
|
+
const matched_size = componentName.match(/\d{2,3}$/);
|
|
8
|
+
|
|
9
|
+
const widthAttr = getAttributeValue(jsx.openingElement.attributes, 'width');
|
|
10
|
+
const heightAttr = getAttributeValue(jsx.openingElement.attributes, 'height');
|
|
11
|
+
|
|
12
|
+
const width = widthAttr.value.expression.value;
|
|
13
|
+
const height = heightAttr.value.expression.value;
|
|
14
|
+
const aspectRatio = width / height;
|
|
15
|
+
|
|
16
|
+
const heightExpr = aspectRatio === 1
|
|
17
|
+
? tpl(`size`)
|
|
18
|
+
: tpl(`size && Math.floor(size / ${aspectRatio}) || ${height}`);
|
|
19
|
+
|
|
20
|
+
heightAttr.value.expression = heightExpr.expression;
|
|
21
|
+
|
|
22
|
+
return tpl`
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { IconProps } from '.'
|
|
25
|
+
|
|
26
|
+
const ${componentName} = ({
|
|
27
|
+
size = ${matched_size ? matched_size[0] : '16'},
|
|
28
|
+
color= '#363644',
|
|
29
|
+
secondaryColor= '#D5D5DC',
|
|
30
|
+
...props
|
|
31
|
+
}: IconProps): JSX.Element => {
|
|
32
|
+
return ${jsx};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
${exports}
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = svgrComponentTemplate;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const prepend_code = `
|
|
4
|
+
export interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
secondaryColor?: string;
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
function svgrIndexTemplate(filePaths) {
|
|
12
|
+
const exportEntries = filePaths.map((filePath) => {
|
|
13
|
+
const basename = path.basename(filePath, path.extname(filePath));
|
|
14
|
+
const exportName = `Icon${basename}`;
|
|
15
|
+
return `export { default as ${exportName} } from './${basename}'`;
|
|
16
|
+
});
|
|
17
|
+
return [prepend_code, ...exportEntries].join('\n');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = svgrIndexTemplate;
|