@aotearoan/neon 9.0.2-beta-1 → 9.0.3-beta-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.
@@ -1 +1 @@
1
- {"version":3,"file":"NeonSelect.ts_vue_type_script_src_37fb08e4_lang.cjs.js","sources":["../../../../src/components/user-input/select/NeonSelect.ts?vue&type=script&src=37fb08e4&lang.ts"],"sourcesContent":["import { computed, defineComponent, onMounted, onUnmounted, ref, useAttrs, watch } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport type { NeonSelectGroup } from '@/common/models/NeonSelectGroup';\nimport type { NeonSelectOption } from '@/common/models/NeonSelectOption';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport NeonSwitch from '@/components/user-input/switch/NeonSwitch.vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonScrollUtils } from '@/common/utils/NeonScrollUtils';\n\n/**\n * <p>The <strong>NeonSelect</strong> is the equivalent of an HTML &lt;select&gt; form control. On touch devices\n * NeonSelect will use the native select for input. <strong>NeonSelect</strong> supports grouping and multiselect.</p>\n * <p><strong>Note:</strong> As well as the options described below, pass through attributes supported by\n * <a href=\"/presentation/dropdown\">NeonDropdown</a> to change the style of the dropdown button.</p>\n */\nexport default defineComponent({\n name: 'NeonSelect',\n components: {\n NeonDropdown,\n NeonIcon,\n NeonSwitch,\n },\n props: {\n /**\n * Id for the dropdown button\n */\n id: { type: String },\n /**\n * Placeholder to display as button label when there is no option selected.\n */\n placeholder: { type: String, required: true },\n /**\n * Display the placeholder as the first option in the select, this is useful as an alternative to a label.\n */\n placeholderAsOption: { type: Boolean, default: false },\n /**\n * Optional placeholder icon.\n */\n placeholderIcon: { type: String, required: false },\n /**\n * A list of options to render in the select.\n */\n options: { type: Array as () => Array<NeonSelectOption>, required: false },\n /**\n * A list of grouped options to render in the select.\n */\n groupedOptions: { type: Array as () => Array<NeonSelectGroup>, required: false },\n /**\n * Either a single string, indicating the key of the selected option or an array of selected keys in the case\n * multiple = true.\n */\n modelValue: { type: [String, Array as () => Array<string>], required: true },\n /**\n * Allow multi-select.\n */\n multiple: { type: Boolean, default: false },\n /**\n * Placeholder when multiple values are selected.\n */\n multiselectPlaceholder: { type: String, required: false },\n /**\n * Disable the select\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the select.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n },\n emits: [\n /**\n * emitted when the user changes the selection.\n * @type {string | string[]} either the selected option's key (single select) or an array of the selected keys\n * (multi-select).\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n\n const dropdown = ref<HTMLElement | null>(null);\n\n const open = ref(false);\n const dropdownPlacement = ref<NeonDropdownPlacement | null>(null);\n const highlightedKey = ref<string | null>(null);\n const highlightedIndex = ref(-1);\n\n const flattenedOptions = computed((): NeonSelectOption[] => {\n return props.options || props.groupedOptions?.flatMap((group) => group.options) || [];\n });\n\n const isReverse = () => {\n if (!props.groupedOptions) {\n switch (dropdownPlacement.value) {\n case NeonDropdownPlacement.TopLeft:\n case NeonDropdownPlacement.TopRight:\n case NeonDropdownPlacement.LeftBottom:\n case NeonDropdownPlacement.RightBottom:\n return true;\n }\n }\n\n return false;\n };\n\n const scrollOnNavigate = () => {\n const element = dropdown.value?.querySelector('.neon-select__option--highlighted') as HTMLElement;\n\n if (element) {\n NeonScrollUtils.scrollIntoView(element);\n }\n };\n\n const navigateBy = (offset: number, $event: KeyboardEvent) => {\n const newIndex = highlightedIndex.value + offset;\n if (newIndex >= 0 && newIndex <= flattenedOptions.value.length - 1) {\n highlightedIndex.value = newIndex;\n highlightedKey.value = flattenedOptions.value[highlightedIndex.value].key;\n $event.preventDefault();\n setTimeout(scrollOnNavigate);\n }\n };\n\n const emitInputEvent = (value: string | string[]) => {\n emit('update:modelValue', value);\n };\n\n const clickOption = (option: NeonSelectOption) => {\n if (props.multiple) {\n const values = [...props.modelValue];\n const index = values.findIndex((v) => v === option.key);\n if (index >= 0) {\n values.splice(index, 1);\n } else {\n values.push(option.key);\n }\n emitInputEvent(values);\n } else if (props.modelValue !== option.key) {\n open.value = false;\n emitInputEvent(option.key);\n }\n };\n\n const keyboardHandler = ($event: KeyboardEvent) => {\n if (open.value) {\n switch ($event.code) {\n case 'ArrowUp':\n case 'ArrowDown': {\n const reverseOffset = isReverse() ? -1 : 1;\n if ($event.code === 'ArrowUp') {\n navigateBy(-1 * reverseOffset, $event);\n } else {\n navigateBy(1 * reverseOffset, $event);\n }\n }\n break;\n case 'Enter':\n case 'Space':\n if (!flattenedOptions.value[highlightedIndex.value].disabled) {\n clickOption(flattenedOptions.value[highlightedIndex.value]);\n $event.preventDefault();\n }\n break;\n case 'Tab':\n if (!$event.ctrlKey && !$event.metaKey && !$event.altKey) {\n open.value = false;\n }\n break;\n }\n }\n };\n\n const computedOptions = computed((): Array<NeonSelectGroup> => {\n return (\n props.groupedOptions || [\n {\n group: '',\n options: props.options || [],\n },\n ]\n );\n });\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { ...sanitized } = attrs;\n return sanitized;\n });\n\n const computedLabel = computed(() => {\n if (props.multiple && props.modelValue.length > 0) {\n if (props.multiselectPlaceholder) {\n return props.multiselectPlaceholder;\n } else if (props.modelValue.length > 1) {\n return `${props.modelValue.length} items selected`;\n } else {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue[0]);\n return selected?.label || '';\n }\n } else if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.label;\n }\n }\n\n return props.placeholder;\n });\n\n const computedIcon = computed(() => {\n if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.icon;\n }\n }\n\n return props.placeholderIcon;\n });\n\n const nativeSelectChange = (event: Event) => {\n const selectedKeys = Array.from((event.target as HTMLSelectElement).options)\n .filter((opt) => opt.selected)\n .map((opt) => opt.value);\n const selectedOptions = flattenedOptions.value.filter((v) => selectedKeys.indexOf(v.key) >= 0);\n const value = props.multiple ? selectedOptions.map((value) => value.key) : selectedOptions[0].key;\n emitInputEvent(value);\n };\n\n const changeHighlighted = (key: string) => {\n highlightedKey.value = key;\n highlightedIndex.value = flattenedOptions.value.findIndex((opt) => opt.key === key);\n };\n\n const onPlacement = (placement: NeonDropdownPlacement) => {\n dropdownPlacement.value = placement;\n };\n\n onMounted(() => {\n document.addEventListener('keydown', keyboardHandler);\n });\n\n onUnmounted(() => {\n document.removeEventListener('keydown', keyboardHandler);\n });\n\n watch(\n () => open.value,\n (open: boolean) => {\n if (open) {\n highlightedKey.value = flattenedOptions.value[0].key;\n highlightedIndex.value = 0;\n }\n },\n );\n\n return {\n dropdown,\n open,\n highlightedKey,\n highlightedIndex,\n flattenedOptions,\n computedLabel,\n sanitizedAttributes,\n computedOptions,\n computedIcon,\n clickOption,\n nativeSelectChange,\n changeHighlighted,\n onPlacement,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonDropdown","NeonIcon","NeonSwitch","NeonSize","NeonFunctionalColor","props","emit","attrs","useAttrs","dropdown","ref","open","dropdownPlacement","highlightedKey","highlightedIndex","flattenedOptions","computed","_a","group","isReverse","NeonDropdownPlacement","scrollOnNavigate","element","NeonScrollUtils","navigateBy","offset","$event","newIndex","emitInputEvent","value","clickOption","option","values","index","v","keyboardHandler","reverseOffset","computedOptions","sanitizedAttributes","sanitized","computedLabel","selected","computedIcon","nativeSelectChange","event","selectedKeys","opt","selectedOptions","changeHighlighted","key","onPlacement","placement","onMounted","onUnmounted","watch"],"mappings":"waAiBAA,EAAeC,kBAAgB,CAC7B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EAAe,MAAQoC,EACNnC,EAAA,MAAQC,EAAiB,MAAM,UAAW+B,GAAQA,EAAI,MAAQG,CAAG,CAAA,EAG9EC,EAAeC,GAAqC,CACxDvC,EAAkB,MAAQuC,CAAA,EAG5BC,OAAAA,EAAAA,UAAU,IAAM,CACL,SAAA,iBAAiB,UAAWjB,CAAe,CAAA,CACrD,EAEDkB,EAAAA,YAAY,IAAM,CACP,SAAA,oBAAoB,UAAWlB,CAAe,CAAA,CACxD,EAEDmB,EAAA,MACE,IAAM3C,EAAK,MACVA,GAAkB,CACbA,IACaE,EAAA,MAAQE,EAAiB,MAAM,GAAG,IACjDD,EAAiB,MAAQ,EAE7B,CAAA,EAGK,CACL,SAAAL,EACA,KAAAE,EACA,eAAAE,EACA,iBAAAC,EACA,iBAAAC,EACA,cAAAyB,EACA,oBAAAF,EACA,gBAAAD,EACA,aAAAK,EACA,YAAAZ,EACA,mBAAAa,EACA,kBAAAK,EACA,YAAAE,CAAA,CAEJ,CACF,CAAC"}
1
+ {"version":3,"file":"NeonSelect.ts_vue_type_script_src_37fb08e4_lang.cjs.js","sources":["../../../../src/components/user-input/select/NeonSelect.ts?vue&type=script&src=37fb08e4&lang.ts"],"sourcesContent":["import { computed, defineComponent, onMounted, onUnmounted, ref, useAttrs, watch } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport type { NeonSelectGroup } from '@/common/models/NeonSelectGroup';\nimport type { NeonSelectOption } from '@/common/models/NeonSelectOption';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport NeonSwitch from '@/components/user-input/switch/NeonSwitch.vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonScrollUtils } from '@/common/utils/NeonScrollUtils';\n\n/**\n * <p>The <strong>NeonSelect</strong> is the equivalent of an HTML &lt;select&gt; form control. On touch devices\n * NeonSelect will use the native select for input. <strong>NeonSelect</strong> supports grouping and multiselect.</p>\n * <p><strong>Note:</strong> As well as the options described below, pass through attributes supported by\n * <a href=\"/presentation/dropdown\">NeonDropdown</a> to change the style of the dropdown button.</p>\n */\nexport default defineComponent({\n name: 'NeonSelect',\n components: {\n NeonDropdown,\n NeonIcon,\n NeonSwitch,\n },\n props: {\n /**\n * Id for the dropdown button\n */\n id: { type: String },\n /**\n * Placeholder to display as button label when there is no option selected.\n */\n placeholder: { type: String, required: true },\n /**\n * Display the placeholder as the first option in the select, this is useful as an alternative to a label.\n */\n placeholderAsOption: { type: Boolean, default: false },\n /**\n * Optional placeholder icon.\n */\n placeholderIcon: { type: String, required: false },\n /**\n * A list of options to render in the select.\n */\n options: { type: Array as () => Array<NeonSelectOption>, required: false },\n /**\n * A list of grouped options to render in the select.\n */\n groupedOptions: { type: Array as () => Array<NeonSelectGroup>, required: false },\n /**\n * Either a single string, indicating the key of the selected option or an array of selected keys in the case\n * multiple = true.\n */\n modelValue: { type: [String, Array as () => Array<string>], required: true },\n /**\n * Allow multi-select.\n */\n multiple: { type: Boolean, default: false },\n /**\n * Placeholder when multiple values are selected.\n */\n multiselectPlaceholder: { type: String, required: false },\n /**\n * Disable the select\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the select.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n },\n emits: [\n /**\n * emitted when the user changes the selection.\n * @type {string | string[]} either the selected option's key (single select) or an array of the selected keys\n * (multi-select).\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n\n const dropdown = ref<HTMLElement | null>(null);\n\n const open = ref(false);\n const dropdownPlacement = ref<NeonDropdownPlacement | null>(null);\n const highlightedKey = ref<string | null>(null);\n const highlightedIndex = ref(-1);\n\n const flattenedOptions = computed((): NeonSelectOption[] => {\n return props.options || props.groupedOptions?.flatMap((group) => group.options) || [];\n });\n\n const isReverse = () => {\n if (!props.groupedOptions) {\n switch (dropdownPlacement.value) {\n case NeonDropdownPlacement.TopLeft:\n case NeonDropdownPlacement.TopRight:\n case NeonDropdownPlacement.LeftBottom:\n case NeonDropdownPlacement.RightBottom:\n return true;\n }\n }\n\n return false;\n };\n\n const scrollOnNavigate = () => {\n const element = dropdown.value?.querySelector('.neon-select__option--highlighted') as HTMLElement;\n\n if (element) {\n NeonScrollUtils.scrollIntoView(element);\n }\n };\n\n const navigateBy = (offset: number, $event: KeyboardEvent) => {\n const newIndex = highlightedIndex.value + offset;\n if (newIndex >= 0 && newIndex <= flattenedOptions.value.length - 1) {\n highlightedIndex.value = newIndex;\n highlightedKey.value = flattenedOptions.value[highlightedIndex.value].key;\n $event.preventDefault();\n setTimeout(scrollOnNavigate);\n }\n };\n\n const emitInputEvent = (value: string | string[]) => {\n emit('update:modelValue', value);\n };\n\n const clickOption = (option: NeonSelectOption) => {\n if (props.multiple) {\n const values = [...props.modelValue];\n const index = values.findIndex((v) => v === option.key);\n if (index >= 0) {\n values.splice(index, 1);\n } else {\n values.push(option.key);\n }\n emitInputEvent(values);\n } else if (props.modelValue !== option.key) {\n open.value = false;\n emitInputEvent(option.key);\n }\n };\n\n const keyboardHandler = ($event: KeyboardEvent) => {\n if (open.value) {\n switch ($event.code) {\n case 'ArrowUp':\n case 'ArrowDown':\n {\n const reverseOffset = isReverse() ? -1 : 1;\n if ($event.code === 'ArrowUp') {\n navigateBy(-1 * reverseOffset, $event);\n } else {\n navigateBy(1 * reverseOffset, $event);\n }\n }\n break;\n case 'Enter':\n case 'Space':\n if (!flattenedOptions.value[highlightedIndex.value].disabled) {\n clickOption(flattenedOptions.value[highlightedIndex.value]);\n $event.preventDefault();\n }\n break;\n case 'Tab':\n if (!$event.ctrlKey && !$event.metaKey && !$event.altKey) {\n open.value = false;\n }\n break;\n }\n }\n };\n\n const computedOptions = computed((): Array<NeonSelectGroup> => {\n return (\n props.groupedOptions || [\n {\n group: '',\n options: props.options || [],\n },\n ]\n );\n });\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { ...sanitized } = attrs;\n return sanitized;\n });\n\n const computedLabel = computed(() => {\n if (props.multiple && props.modelValue.length > 0) {\n if (props.multiselectPlaceholder) {\n return props.multiselectPlaceholder;\n } else if (props.modelValue.length > 1) {\n return `${props.modelValue.length} items selected`;\n } else {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue[0]);\n return selected?.label || '';\n }\n } else if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.label;\n }\n }\n\n return props.placeholder;\n });\n\n const computedIcon = computed(() => {\n if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.icon;\n }\n }\n\n return props.placeholderIcon;\n });\n\n const nativeSelectChange = (event: Event) => {\n const selectedKeys = Array.from((event.target as HTMLSelectElement).options)\n .filter((opt) => opt.selected)\n .map((opt) => opt.value);\n const selectedOptions = flattenedOptions.value.filter((v) => selectedKeys.indexOf(v.key) >= 0);\n const value = props.multiple ? selectedOptions.map((value) => value.key) : selectedOptions[0].key;\n emitInputEvent(value);\n };\n\n const changeHighlighted = (key: string) => {\n highlightedKey.value = key;\n highlightedIndex.value = flattenedOptions.value.findIndex((opt) => opt.key === key);\n };\n\n const onPlacement = (placement: NeonDropdownPlacement) => {\n dropdownPlacement.value = placement;\n };\n\n onMounted(() => {\n document.addEventListener('keydown', keyboardHandler);\n });\n\n onUnmounted(() => {\n document.removeEventListener('keydown', keyboardHandler);\n });\n\n watch(\n () => open.value,\n (open: boolean) => {\n if (open) {\n highlightedKey.value = flattenedOptions.value[0].key;\n highlightedIndex.value = 0;\n }\n },\n );\n\n return {\n dropdown,\n open,\n highlightedKey,\n highlightedIndex,\n flattenedOptions,\n computedLabel,\n sanitizedAttributes,\n computedOptions,\n computedIcon,\n clickOption,\n nativeSelectChange,\n changeHighlighted,\n onPlacement,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonDropdown","NeonIcon","NeonSwitch","NeonSize","NeonFunctionalColor","props","emit","attrs","useAttrs","dropdown","ref","open","dropdownPlacement","highlightedKey","highlightedIndex","flattenedOptions","computed","_a","group","isReverse","NeonDropdownPlacement","scrollOnNavigate","element","NeonScrollUtils","navigateBy","offset","$event","newIndex","emitInputEvent","value","clickOption","option","values","index","v","keyboardHandler","reverseOffset","computedOptions","sanitizedAttributes","sanitized","computedLabel","selected","computedIcon","nativeSelectChange","event","selectedKeys","opt","selectedOptions","changeHighlighted","key","onPlacement","placement","onMounted","onUnmounted","watch"],"mappings":"waAiBAA,EAAeC,kBAAgB,CAC7B,KAAM,aACN,WAAY,CACV,aAAAC,EACA,SAAAC,EACA,WAAAC,CACF,EACA,MAAO,CAIL,GAAI,CAAE,KAAM,MAAO,EAInB,YAAa,CAAE,KAAM,OAAQ,SAAU,EAAK,EAI5C,oBAAqB,CAAE,KAAM,QAAS,QAAS,EAAM,EAIrD,gBAAiB,CAAE,KAAM,OAAQ,SAAU,EAAM,EAIjD,QAAS,CAAE,KAAM,MAAwC,SAAU,EAAM,EAIzE,eAAgB,CAAE,KAAM,MAAuC,SAAU,EAAM,EAK/E,WAAY,CAAE,KAAM,CAAC,OAAQ,KAA4B,EAAG,SAAU,EAAK,EAI3E,SAAU,CAAE,KAAM,QAAS,QAAS,EAAM,EAI1C,uBAAwB,CAAE,KAAM,OAAQ,SAAU,EAAM,EAIxD,SAAU,CAAE,KAAM,QAAS,QAAS,EAAM,EAI1C,KAAM,CAAE,KAAM,OAA0B,QAASC,EAAAA,SAAS,MAAO,EAIjE,MAAO,CAAE,KAAM,OAAqC,QAASC,EAAAA,oBAAoB,WAAY,CAC/F,EACA,MAAO,CAML,mBACF,EACA,MAAMC,EAAO,CAAE,KAAAC,GAAQ,CACrB,MAAMC,EAAQC,EAAAA,WAERC,EAA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gB,GAAWA,EAAO,MAAQ1B,EAAM,UAAU,EAExF,GAAIoC,EACF,OAAOA,EAAS,IAEpB,CAEA,OAAOpC,EAAM,eAAA,CACd,EAEKsC,EAAsBC,GAAiB,CAC3C,MAAMC,EAAe,MAAM,KAAMD,EAAM,OAA6B,OAAO,EACxE,OAAQE,GAAQA,EAAI,QAAQ,EAC5B,IAAKA,GAAQA,EAAI,KAAK,EACnBC,EAAkBhC,EAAiB,MAAM,OAAQmB,GAAMW,EAAa,QAAQX,EAAE,GAAG,GAAK,CAAC,EACvFL,EAAQxB,EAAM,SAAW0C,EAAgB,IAAKlB,GAAUA,EAAM,GAAG,EAAIkB,EAAgB,GAAG,IAC9FnB,EAAeC,CAAK,CAAA,EAGhBmB,EAAqBC,GAAgB,CACzCpC,EAAe,MAAQoC,EACNnC,EAAA,MAAQC,EAAiB,MAAM,UAAW+B,GAAQA,EAAI,MAAQG,CAAG,CAAA,EAG9EC,EAAeC,GAAqC,CACxDvC,EAAkB,MAAQuC,CAAA,EAG5BC,OAAAA,EAAAA,UAAU,IAAM,CACL,SAAA,iBAAiB,UAAWjB,CAAe,CAAA,CACrD,EAEDkB,EAAAA,YAAY,IAAM,CACP,SAAA,oBAAoB,UAAWlB,CAAe,CAAA,CACxD,EAEDmB,EAAA,MACE,IAAM3C,EAAK,MACVA,GAAkB,CACbA,IACaE,EAAA,MAAQE,EAAiB,MAAM,GAAG,IACjDD,EAAiB,MAAQ,EAE7B,CAAA,EAGK,CACL,SAAAL,EACA,KAAAE,EACA,eAAAE,EACA,iBAAAC,EACA,iBAAAC,EACA,cAAAyB,EACA,oBAAAF,EACA,gBAAAD,EACA,aAAAK,EACA,YAAAZ,EACA,mBAAAa,EACA,kBAAAK,EACA,YAAAE,CAAA,CAEJ,CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NeonSelect.ts_vue_type_script_src_37fb08e4_lang.es.js","sources":["../../../../src/components/user-input/select/NeonSelect.ts?vue&type=script&src=37fb08e4&lang.ts"],"sourcesContent":["import { computed, defineComponent, onMounted, onUnmounted, ref, useAttrs, watch } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport type { NeonSelectGroup } from '@/common/models/NeonSelectGroup';\nimport type { NeonSelectOption } from '@/common/models/NeonSelectOption';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport NeonSwitch from '@/components/user-input/switch/NeonSwitch.vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonScrollUtils } from '@/common/utils/NeonScrollUtils';\n\n/**\n * <p>The <strong>NeonSelect</strong> is the equivalent of an HTML &lt;select&gt; form control. On touch devices\n * NeonSelect will use the native select for input. <strong>NeonSelect</strong> supports grouping and multiselect.</p>\n * <p><strong>Note:</strong> As well as the options described below, pass through attributes supported by\n * <a href=\"/presentation/dropdown\">NeonDropdown</a> to change the style of the dropdown button.</p>\n */\nexport default defineComponent({\n name: 'NeonSelect',\n components: {\n NeonDropdown,\n NeonIcon,\n NeonSwitch,\n },\n props: {\n /**\n * Id for the dropdown button\n */\n id: { type: String },\n /**\n * Placeholder to display as button label when there is no option selected.\n */\n placeholder: { type: String, required: true },\n /**\n * Display the placeholder as the first option in the select, this is useful as an alternative to a label.\n */\n placeholderAsOption: { type: Boolean, default: false },\n /**\n * Optional placeholder icon.\n */\n placeholderIcon: { type: String, required: false },\n /**\n * A list of options to render in the select.\n */\n options: { type: Array as () => Array<NeonSelectOption>, required: false },\n /**\n * A list of grouped options to render in the select.\n */\n groupedOptions: { type: Array as () => Array<NeonSelectGroup>, required: false },\n /**\n * Either a single string, indicating the key of the selected option or an array of selected keys in the case\n * multiple = true.\n */\n modelValue: { type: [String, Array as () => Array<string>], required: true },\n /**\n * Allow multi-select.\n */\n multiple: { type: Boolean, default: false },\n /**\n * Placeholder when multiple values are selected.\n */\n multiselectPlaceholder: { type: String, required: false },\n /**\n * Disable the select\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the select.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n },\n emits: [\n /**\n * emitted when the user changes the selection.\n * @type {string | string[]} either the selected option's key (single select) or an array of the selected keys\n * (multi-select).\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n\n const dropdown = ref<HTMLElement | null>(null);\n\n const open = ref(false);\n const dropdownPlacement = ref<NeonDropdownPlacement | null>(null);\n const highlightedKey = ref<string | null>(null);\n const highlightedIndex = ref(-1);\n\n const flattenedOptions = computed((): NeonSelectOption[] => {\n return props.options || props.groupedOptions?.flatMap((group) => group.options) || [];\n });\n\n const isReverse = () => {\n if (!props.groupedOptions) {\n switch (dropdownPlacement.value) {\n case NeonDropdownPlacement.TopLeft:\n case NeonDropdownPlacement.TopRight:\n case NeonDropdownPlacement.LeftBottom:\n case NeonDropdownPlacement.RightBottom:\n return true;\n }\n }\n\n return false;\n };\n\n const scrollOnNavigate = () => {\n const element = dropdown.value?.querySelector('.neon-select__option--highlighted') as HTMLElement;\n\n if (element) {\n NeonScrollUtils.scrollIntoView(element);\n }\n };\n\n const navigateBy = (offset: number, $event: KeyboardEvent) => {\n const newIndex = highlightedIndex.value + offset;\n if (newIndex >= 0 && newIndex <= flattenedOptions.value.length - 1) {\n highlightedIndex.value = newIndex;\n highlightedKey.value = flattenedOptions.value[highlightedIndex.value].key;\n $event.preventDefault();\n setTimeout(scrollOnNavigate);\n }\n };\n\n const emitInputEvent = (value: string | string[]) => {\n emit('update:modelValue', value);\n };\n\n const clickOption = (option: NeonSelectOption) => {\n if (props.multiple) {\n const values = [...props.modelValue];\n const index = values.findIndex((v) => v === option.key);\n if (index >= 0) {\n values.splice(index, 1);\n } else {\n values.push(option.key);\n }\n emitInputEvent(values);\n } else if (props.modelValue !== option.key) {\n open.value = false;\n emitInputEvent(option.key);\n }\n };\n\n const keyboardHandler = ($event: KeyboardEvent) => {\n if (open.value) {\n switch ($event.code) {\n case 'ArrowUp':\n case 'ArrowDown': {\n const reverseOffset = isReverse() ? -1 : 1;\n if ($event.code === 'ArrowUp') {\n navigateBy(-1 * reverseOffset, $event);\n } else {\n navigateBy(1 * reverseOffset, $event);\n }\n }\n break;\n case 'Enter':\n case 'Space':\n if (!flattenedOptions.value[highlightedIndex.value].disabled) {\n clickOption(flattenedOptions.value[highlightedIndex.value]);\n $event.preventDefault();\n }\n break;\n case 'Tab':\n if (!$event.ctrlKey && !$event.metaKey && !$event.altKey) {\n open.value = false;\n }\n break;\n }\n }\n };\n\n const computedOptions = computed((): Array<NeonSelectGroup> => {\n return (\n props.groupedOptions || [\n {\n group: '',\n options: props.options || [],\n },\n ]\n );\n });\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { ...sanitized } = attrs;\n return sanitized;\n });\n\n const computedLabel = computed(() => {\n if (props.multiple && props.modelValue.length > 0) {\n if (props.multiselectPlaceholder) {\n return props.multiselectPlaceholder;\n } else if (props.modelValue.length > 1) {\n return `${props.modelValue.length} items selected`;\n } else {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue[0]);\n return selected?.label || '';\n }\n } else if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.label;\n }\n }\n\n return props.placeholder;\n });\n\n const computedIcon = computed(() => {\n if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.icon;\n }\n }\n\n return props.placeholderIcon;\n });\n\n const nativeSelectChange = (event: Event) => {\n const selectedKeys = Array.from((event.target as HTMLSelectElement).options)\n .filter((opt) => opt.selected)\n .map((opt) => opt.value);\n const selectedOptions = flattenedOptions.value.filter((v) => selectedKeys.indexOf(v.key) >= 0);\n const value = props.multiple ? selectedOptions.map((value) => value.key) : selectedOptions[0].key;\n emitInputEvent(value);\n };\n\n const changeHighlighted = (key: string) => {\n highlightedKey.value = key;\n highlightedIndex.value = flattenedOptions.value.findIndex((opt) => opt.key === key);\n };\n\n const onPlacement = (placement: NeonDropdownPlacement) => {\n dropdownPlacement.value = placement;\n };\n\n onMounted(() => {\n document.addEventListener('keydown', keyboardHandler);\n });\n\n onUnmounted(() => {\n document.removeEventListener('keydown', keyboardHandler);\n });\n\n watch(\n () => open.value,\n (open: boolean) => {\n if (open) {\n highlightedKey.value = flattenedOptions.value[0].key;\n highlightedIndex.value = 0;\n }\n },\n );\n\n return {\n dropdown,\n open,\n highlightedKey,\n highlightedIndex,\n flattenedOptions,\n computedLabel,\n sanitizedAttributes,\n computedOptions,\n computedIcon,\n clickOption,\n nativeSelectChange,\n changeHighlighted,\n onPlacement,\n };\n },\n});\n"],"names":["value","open"],"mappings":";;;;;;;;AAiBA,IAAA,YAAe,gBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IAIL,IAAI,EAAE,MAAM,OAAO;AAAA,IAInB,aAAa,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA,IAI5C,qBAAqB,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,IAIrD,iBAAiB,EAAE,MAAM,QAAQ,UAAU,MAAM;AAAA,IAIjD,SAAS,EAAE,MAAM,OAAwC,UAAU,MAAM;AAAA,IAIzE,gBAAgB,EAAE,MAAM,OAAuC,UAAU,MAAM;AAAA,IAK/E,YAAY,EAAE,MAAM,CAAC,QAAQ,KAA4B,GAAG,UAAU,KAAK;AAAA,IAI3E,UAAU,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,IAI1C,wBAAwB,EAAE,MAAM,QAAQ,UAAU,MAAM;AAAA,IAIxD,UAAU,EAAE,MAAM,SAAS,SAAS,MAAM;AA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AAI,QAAQ,GAAG;AAAA,IAAA;AAG9E,UAAA,cAAc,CAAC,cAAqC;AACxD,wBAAkB,QAAQ;AAAA,IAAA;AAG5B,cAAU,MAAM;AACL,eAAA,iBAAiB,WAAW,eAAe;AAAA,IAAA,CACrD;AAED,gBAAY,MAAM;AACP,eAAA,oBAAoB,WAAW,eAAe;AAAA,IAAA,CACxD;AAED;AAAA,MACE,MAAM,KAAK;AAAA,MACX,CAACC,UAAkB;AACjB,YAAIA,OAAM;AACO,yBAAA,QAAQ,iBAAiB,MAAM,GAAG;AACjD,2BAAiB,QAAQ;AAAA,QAC3B;AAAA,MACF;AAAA,IAAA;AAGK,WAAA;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;;"}
1
+ {"version":3,"file":"NeonSelect.ts_vue_type_script_src_37fb08e4_lang.es.js","sources":["../../../../src/components/user-input/select/NeonSelect.ts?vue&type=script&src=37fb08e4&lang.ts"],"sourcesContent":["import { computed, defineComponent, onMounted, onUnmounted, ref, useAttrs, watch } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport type { NeonSelectGroup } from '@/common/models/NeonSelectGroup';\nimport type { NeonSelectOption } from '@/common/models/NeonSelectOption';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport NeonSwitch from '@/components/user-input/switch/NeonSwitch.vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonScrollUtils } from '@/common/utils/NeonScrollUtils';\n\n/**\n * <p>The <strong>NeonSelect</strong> is the equivalent of an HTML &lt;select&gt; form control. On touch devices\n * NeonSelect will use the native select for input. <strong>NeonSelect</strong> supports grouping and multiselect.</p>\n * <p><strong>Note:</strong> As well as the options described below, pass through attributes supported by\n * <a href=\"/presentation/dropdown\">NeonDropdown</a> to change the style of the dropdown button.</p>\n */\nexport default defineComponent({\n name: 'NeonSelect',\n components: {\n NeonDropdown,\n NeonIcon,\n NeonSwitch,\n },\n props: {\n /**\n * Id for the dropdown button\n */\n id: { type: String },\n /**\n * Placeholder to display as button label when there is no option selected.\n */\n placeholder: { type: String, required: true },\n /**\n * Display the placeholder as the first option in the select, this is useful as an alternative to a label.\n */\n placeholderAsOption: { type: Boolean, default: false },\n /**\n * Optional placeholder icon.\n */\n placeholderIcon: { type: String, required: false },\n /**\n * A list of options to render in the select.\n */\n options: { type: Array as () => Array<NeonSelectOption>, required: false },\n /**\n * A list of grouped options to render in the select.\n */\n groupedOptions: { type: Array as () => Array<NeonSelectGroup>, required: false },\n /**\n * Either a single string, indicating the key of the selected option or an array of selected keys in the case\n * multiple = true.\n */\n modelValue: { type: [String, Array as () => Array<string>], required: true },\n /**\n * Allow multi-select.\n */\n multiple: { type: Boolean, default: false },\n /**\n * Placeholder when multiple values are selected.\n */\n multiselectPlaceholder: { type: String, required: false },\n /**\n * Disable the select\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the select.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n },\n emits: [\n /**\n * emitted when the user changes the selection.\n * @type {string | string[]} either the selected option's key (single select) or an array of the selected keys\n * (multi-select).\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n\n const dropdown = ref<HTMLElement | null>(null);\n\n const open = ref(false);\n const dropdownPlacement = ref<NeonDropdownPlacement | null>(null);\n const highlightedKey = ref<string | null>(null);\n const highlightedIndex = ref(-1);\n\n const flattenedOptions = computed((): NeonSelectOption[] => {\n return props.options || props.groupedOptions?.flatMap((group) => group.options) || [];\n });\n\n const isReverse = () => {\n if (!props.groupedOptions) {\n switch (dropdownPlacement.value) {\n case NeonDropdownPlacement.TopLeft:\n case NeonDropdownPlacement.TopRight:\n case NeonDropdownPlacement.LeftBottom:\n case NeonDropdownPlacement.RightBottom:\n return true;\n }\n }\n\n return false;\n };\n\n const scrollOnNavigate = () => {\n const element = dropdown.value?.querySelector('.neon-select__option--highlighted') as HTMLElement;\n\n if (element) {\n NeonScrollUtils.scrollIntoView(element);\n }\n };\n\n const navigateBy = (offset: number, $event: KeyboardEvent) => {\n const newIndex = highlightedIndex.value + offset;\n if (newIndex >= 0 && newIndex <= flattenedOptions.value.length - 1) {\n highlightedIndex.value = newIndex;\n highlightedKey.value = flattenedOptions.value[highlightedIndex.value].key;\n $event.preventDefault();\n setTimeout(scrollOnNavigate);\n }\n };\n\n const emitInputEvent = (value: string | string[]) => {\n emit('update:modelValue', value);\n };\n\n const clickOption = (option: NeonSelectOption) => {\n if (props.multiple) {\n const values = [...props.modelValue];\n const index = values.findIndex((v) => v === option.key);\n if (index >= 0) {\n values.splice(index, 1);\n } else {\n values.push(option.key);\n }\n emitInputEvent(values);\n } else if (props.modelValue !== option.key) {\n open.value = false;\n emitInputEvent(option.key);\n }\n };\n\n const keyboardHandler = ($event: KeyboardEvent) => {\n if (open.value) {\n switch ($event.code) {\n case 'ArrowUp':\n case 'ArrowDown':\n {\n const reverseOffset = isReverse() ? -1 : 1;\n if ($event.code === 'ArrowUp') {\n navigateBy(-1 * reverseOffset, $event);\n } else {\n navigateBy(1 * reverseOffset, $event);\n }\n }\n break;\n case 'Enter':\n case 'Space':\n if (!flattenedOptions.value[highlightedIndex.value].disabled) {\n clickOption(flattenedOptions.value[highlightedIndex.value]);\n $event.preventDefault();\n }\n break;\n case 'Tab':\n if (!$event.ctrlKey && !$event.metaKey && !$event.altKey) {\n open.value = false;\n }\n break;\n }\n }\n };\n\n const computedOptions = computed((): Array<NeonSelectGroup> => {\n return (\n props.groupedOptions || [\n {\n group: '',\n options: props.options || [],\n },\n ]\n );\n });\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { ...sanitized } = attrs;\n return sanitized;\n });\n\n const computedLabel = computed(() => {\n if (props.multiple && props.modelValue.length > 0) {\n if (props.multiselectPlaceholder) {\n return props.multiselectPlaceholder;\n } else if (props.modelValue.length > 1) {\n return `${props.modelValue.length} items selected`;\n } else {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue[0]);\n return selected?.label || '';\n }\n } else if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.label;\n }\n }\n\n return props.placeholder;\n });\n\n const computedIcon = computed(() => {\n if (props.modelValue) {\n const selected = flattenedOptions.value.find((option) => option.key === props.modelValue);\n\n if (selected) {\n return selected.icon;\n }\n }\n\n return props.placeholderIcon;\n });\n\n const nativeSelectChange = (event: Event) => {\n const selectedKeys = Array.from((event.target as HTMLSelectElement).options)\n .filter((opt) => opt.selected)\n .map((opt) => opt.value);\n const selectedOptions = flattenedOptions.value.filter((v) => selectedKeys.indexOf(v.key) >= 0);\n const value = props.multiple ? selectedOptions.map((value) => value.key) : selectedOptions[0].key;\n emitInputEvent(value);\n };\n\n const changeHighlighted = (key: string) => {\n highlightedKey.value = key;\n highlightedIndex.value = flattenedOptions.value.findIndex((opt) => opt.key === key);\n };\n\n const onPlacement = (placement: NeonDropdownPlacement) => {\n dropdownPlacement.value = placement;\n };\n\n onMounted(() => {\n document.addEventListener('keydown', keyboardHandler);\n });\n\n onUnmounted(() => {\n document.removeEventListener('keydown', keyboardHandler);\n });\n\n watch(\n () => open.value,\n (open: boolean) => {\n if (open) {\n highlightedKey.value = flattenedOptions.value[0].key;\n highlightedIndex.value = 0;\n }\n },\n );\n\n return {\n dropdown,\n open,\n highlightedKey,\n highlightedIndex,\n flattenedOptions,\n computedLabel,\n sanitizedAttributes,\n computedOptions,\n computedIcon,\n clickOption,\n nativeSelect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AA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aotearoan/neon",
3
3
  "description": "Neon is a lightweight design library of Vue 3 components with minimal dependencies.",
4
- "version": "9.0.2-beta-1",
4
+ "version": "9.0.3-beta-1",
5
5
  "main": "./dist/neoon.cjs.js",
6
6
  "module": "dist/neon.es.js",
7
7
  "types": "dist/neon.d.ts",
@@ -49,6 +49,10 @@
49
49
  }
50
50
 
51
51
  @mixin switch {
52
+ label.neon-field + label.neon-switch {
53
+ margin-top: calc(var(--neon-font-size-xs) + 4 * var(--neon-base-space));
54
+ }
55
+
52
56
  .neon-switch {
53
57
  display: flex;
54
58
  flex-direction: row;