UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

1 lines 3.47 kB
{"version":3,"file":"stack.cjs","sources":["../../../components/stack/stack.vue"],"sourcesContent":["<template>\n <component\n :is=\"as\"\n :class=\"[\n 'd-stack',\n defaultDirection,\n defaultGap,\n stackResponsive,\n ]\"\n >\n <!-- @slot Slot for main content -->\n <slot />\n </component>\n</template>\n\n<script>\nimport { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS } from './stack_constants';\nimport { directionValidator, gapValidator } from './validators';\nimport { getDefaultDirectionClass, getResponsiveClasses, getDefaultGapClass } from './utils';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtStack',\n\n props: {\n /**\n * Set this prop to the direction to stack the items.\n * You can override the default direction with 'default' key.\n * All the undefined breakpoints will have 'default' value.\n * By default, for the column direction it will have `justify-content: flex-start`\n * and for the row direction `align-items: center`. This can be overriden\n * by utility classes.\n */\n direction: {\n type: [String, Object],\n default: 'column',\n validator: (direction) => directionValidator(direction),\n },\n\n /**\n * Set this prop to render stack as a specific HTML element.\n */\n as: {\n type: String,\n default: 'div',\n },\n\n /**\n * The gap property controls the spacing between items in the stack.\n * The gap can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default gap with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are '0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'.\n */\n gap: {\n type: [String, Object],\n default: '0',\n validator: (gap) => gapValidator(gap),\n },\n },\n\n data () {\n return {\n DT_STACK_DIRECTION,\n DT_STACK_GAP,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n };\n },\n\n computed: {\n defaultGap () {\n return getDefaultGapClass(this.gap);\n },\n\n defaultDirection () {\n return getDefaultDirectionClass(this.direction);\n },\n\n stackResponsive () {\n return getResponsiveClasses(this.direction, this.gap);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","direction","directionValidator","gap","gapValidator","DT_STACK_DIRECTION","DT_STACK_GAP","DT_STACK_RESPONSIVE_BREAKPOINTS","getDefaultGapClass","getDefaultDirectionClass","getResponsiveClasses","_createBlock","_resolveDynamicComponent","$props","_normalizeClass","$options","_withCtx","_renderSlot","_ctx"],"mappings":"uRAoBKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,UAEN,MAAO,CASL,UAAW,CACT,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,SACT,UAAYC,GAAcC,EAAAA,mBAAmBD,CAAS,GAMxD,GAAI,CACF,KAAM,OACN,QAAS,OAWX,IAAK,CACH,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,IACT,UAAYE,GAAQC,EAAAA,aAAaD,CAAG,IAIxC,MAAQ,CACN,MAAO,CACL,mBAAAE,EAAAA,gCACAC,EAAAA,aACA,gCAAAC,EAAAA,gCAEJ,EAEA,SAAU,CACR,YAAc,CACZ,OAAOC,EAAAA,mBAAmB,KAAK,GAAG,CACpC,EAEA,kBAAoB,CAClB,OAAOC,EAAAA,yBAAyB,KAAK,SAAS,CAChD,EAEA,iBAAmB,CACjB,OAAOC,EAAAA,qBAAqB,KAAK,UAAW,KAAK,GAAG,CACtD,EAEJ,+CAlFEC,EAAAA,YADFC,EAAAA,wBAESC,EAAA,EAAE,EAAA,CACN,MAHLC,EAAAA,eAAA,WAGqCC,EAAA,iBAAwBA,EAAA,WAAkBA,EAAA,oBAH/E,QAAAC,EAAAA,QAWI,IAAQ,CAARC,aAAQC,EAAA,OAAA,SAAA,IAXZ,EAAA"}