Skip to content

Commit

Permalink
feat(action-menu,control): allow specifying leading and trailing icons (
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd authored Jan 14, 2025
1 parent d0fa8c7 commit 25613ae
Show file tree
Hide file tree
Showing 11 changed files with 1,481 additions and 1,278 deletions.
4 changes: 2 additions & 2 deletions docs/components/control.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ interface Props {
tag?: string
type?: Type
mode?: Mode
icon?: any
icon?: Component
iconMode?: Mode
label?: string
labelMode?: Mode
Expand Down Expand Up @@ -204,7 +204,7 @@ import SButton, {

interface Props {
as?: string
icon?: any
icon?: Component
href?: string
disabled?: boolean
tooltip?: string | Tooltip
Expand Down
4 changes: 2 additions & 2 deletions docs/components/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export interface TableCellText {
align?: 'left' | 'center' | 'right'

// Icon to display in front of the value.
icon?: any
icon?: Component

// The value for the cell. If omitted, it will use the value
// from the record.
Expand Down Expand Up @@ -432,7 +432,7 @@ export interface TableCellNumber {
align?: 'left' | 'center' | 'right'

// Icon to display in front of the value.
icon?: any
icon?: Component

// The value for the cell. If omitted, it will use the value
// from the record.
Expand Down
8 changes: 6 additions & 2 deletions lib/components/SActionMenu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref } from 'vue'
import { type Component, ref } from 'vue'
import { type DropdownSection, useManualDropdownPosition } from '../composables/Dropdown'
import { useFlyout } from '../composables/Flyout'
import SButton, { type Mode, type Size, type Tooltip, type Type } from './SButton.vue'
Expand All @@ -12,7 +12,9 @@ const props = defineProps<{
size?: Size
type?: Type
mode?: Mode
icon?: any
icon?: Component
leadIcon?: Component
trailIcon?: Component
iconMode?: Mode
label?: string
labelMode?: Mode
Expand Down Expand Up @@ -46,6 +48,8 @@ async function onOpen() {
:type="type"
:mode="mode"
:icon="icon"
:lead-icon="leadIcon"
:trail-icon="trailIcon"
:icon-mode="iconMode"
:label="label"
:label-mode="labelMode"
Expand Down
4 changes: 1 addition & 3 deletions lib/components/SButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ function handleClick(): void {
<span v-if="_leadIcon" class="icon" :class="iconMode">
<component :is="_leadIcon" class="icon-svg" />
</span>
<span v-if="label" class="label" :class="labelMode">
{{ label }}
</span>
<span v-if="label" class="label" :class="labelMode" v-html="label" />
<span v-if="trailIcon" class="icon" :class="iconMode">
<component :is="trailIcon" class="icon-svg" />
</span>
Expand Down
3 changes: 2 additions & 1 deletion lib/components/SControlActionBarButton.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<script setup lang="ts">
import { type Component } from 'vue'
import { useControlSize } from '../composables/Control'
import SButton, { type Tooltip } from './SButton.vue'
defineProps<{
as?: string
icon?: any
icon?: Component
href?: string
disabled?: boolean
tooltip?: string | Tooltip
Expand Down
7 changes: 6 additions & 1 deletion lib/components/SControlActionMenu.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { type Component } from 'vue'
import { useControlSize } from '../composables/Control'
import { type DropdownSection } from '../composables/Dropdown'
import SActionMenu, { type Mode, type Tooltip, type Type } from './SActionMenu.vue'
Expand All @@ -7,7 +8,9 @@ defineProps<{
tag?: string
type?: Type
mode?: Mode
icon?: any
icon?: Component
leadIcon?: Component
trailIcon?: Component
iconMode?: Mode
label?: string
labelMode?: Mode
Expand All @@ -29,6 +32,8 @@ const size = useControlSize()
:type="type"
:mode="mode"
:icon="icon"
:lead-icon="leadIcon"
:trail-icon="trailIcon"
:icon-mode="iconMode"
:label="label"
:label-mode="labelMode"
Expand Down
7 changes: 6 additions & 1 deletion lib/components/SControlButton.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<script setup lang="ts">
import { type Component } from 'vue'
import { useControlSize } from '../composables/Control'
import SButton, { type Mode, type Tooltip, type Type } from './SButton.vue'
defineProps<{
tag?: string
type?: Type
mode?: Mode
icon?: any
icon?: Component
leadIcon?: Component
trailIcon?: Component
iconMode?: Mode
label?: string
labelMode?: Mode
Expand All @@ -31,6 +34,8 @@ const size = useControlSize()
:type="type"
:mode="mode"
:icon="icon"
:lead-icon="leadIcon"
:trail-icon="trailIcon"
:icon-mode="iconMode"
:label="label"
:label-mode="labelMode"
Expand Down
6 changes: 2 additions & 4 deletions lib/components/SFragment.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<script lang="ts">
export default { inheritAttrs: false }
</script>

<script setup lang="ts">
defineProps<{ is?: any }>()
defineSlots()
defineOptions({ inheritAttrs: false })
</script>

<template>
Expand Down
6 changes: 3 additions & 3 deletions lib/composables/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface TableCellBase {
export interface TableCellText<V = any, R = any> extends TableCellBase {
type: 'text'
align?: 'left' | 'center' | 'right'
icon?: any
icon?: Component
value?: string | null
link?: string | null
color?: TableCellValueColor
Expand All @@ -107,7 +107,7 @@ export interface TableCellText<V = any, R = any> extends TableCellBase {
export interface TableCellNumber<V = any, R = any> extends TableCellBase {
type: 'number'
align?: 'left' | 'center' | 'right'
icon?: any
icon?: Component
value?: number | null
separator?: boolean
link?: string | null
Expand Down Expand Up @@ -194,7 +194,7 @@ export interface TableCellActions<R = any> extends TableCellBase {

export interface TableCellAction<R = any> {
mode?: Mode
icon?: any
icon?: Component
iconMode?: Mode
label?: string
labelMode?: Mode
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@globalbrain/sefirot",
"type": "module",
"version": "4.7.1",
"packageManager": "pnpm@9.14.4",
"packageManager": "pnpm@9.15.3",
"description": "Vue Components for Global Brain Design System.",
"author": "Kia Ishii <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -43,58 +43,58 @@
"release": "release-it"
},
"peerDependencies": {
"@iconify-json/ph": "^1.2.1",
"@iconify-json/ri": "^1.2.3",
"@iconify-json/ph": "^1.2.2",
"@iconify-json/ri": "^1.2.5",
"@types/body-scroll-lock": "^3.1.2",
"@types/lodash-es": "^4.17.12",
"@types/markdown-it": "^14.1.2",
"@vue/reactivity": "^3.5.13",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^12.0.0",
"@vueuse/core": "^12.4.0",
"body-scroll-lock": "4.0.0-beta.0",
"dayjs": "^1.11.13",
"fuse.js": "^7.0.0",
"lodash-es": "^4.17.21",
"markdown-it": "^14.1.0",
"normalize.css": "^8.0.1",
"pinia": "^2.2.8",
"pinia": "^2.3.0",
"postcss": "^8.4.49",
"postcss-nested": "^7.0.2",
"v-calendar": "3.0.1",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
},
"dependencies": {
"@sentry/browser": "^8.41.0",
"@sentry/browser": "^8.48.0",
"@tanstack/vue-virtual": "3.0.0-beta.62",
"@tinyhttp/content-disposition": "^2.2.2",
"@tinyhttp/cookie": "^2.1.1",
"@types/file-saver": "^2.0.7",
"@types/qs": "^6.9.17",
"file-saver": "^2.0.5",
"magic-string": "^0.30.14",
"magic-string": "^0.30.17",
"ofetch": "^1.4.1",
"qs": "^6.13.1",
"unplugin-icons": "^0.20.2"
"unplugin-icons": "^22.0.0"
},
"devDependencies": {
"@globalbrain/eslint-config": "^1.7.1",
"@histoire/plugin-vue": "0.16.5",
"@iconify-json/ph": "^1.2.1",
"@iconify-json/ri": "^1.2.3",
"@release-it/conventional-changelog": "^9.0.3",
"@iconify-json/ph": "^1.2.2",
"@iconify-json/ri": "^1.2.5",
"@release-it/conventional-changelog": "^10.0.0",
"@types/body-scroll-lock": "^3.1.2",
"@types/lodash-es": "^4.17.12",
"@types/markdown-it": "^14.1.2",
"@types/node": "^22.10.1",
"@types/node": "^22.10.5",
"@vitejs/plugin-vue": "^5.2.1",
"@vitest/coverage-v8": "^2.1.6",
"@vitest/coverage-v8": ">=3.0.0-beta.0",
"@vue/reactivity": "^3.5.13",
"@vue/test-utils": "^2.4.6",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^12.0.0",
"@vueuse/core": "^12.4.0",
"body-scroll-lock": "4.0.0-beta.0",
"dayjs": "^1.11.13",
"eslint": "8.57.0",
Expand All @@ -104,18 +104,18 @@
"lodash-es": "^4.17.21",
"markdown-it": "^14.1.0",
"normalize.css": "^8.0.1",
"pinia": "^2.2.8",
"pinia": "^2.3.0",
"postcss": "^8.4.49",
"postcss-nested": "^7.0.2",
"punycode": "^2.3.1",
"release-it": "^17.10.0",
"release-it": "^18.1.1",
"typescript": "~5.6.3",
"v-calendar": "3.0.1",
"vite": "^6.0.1",
"vite": "^6.0.7",
"vitepress": "^1.5.0",
"vitest": "^2.1.6",
"vitest": ">=3.0.0-beta.0",
"vue": "^3.5.13",
"vue-router": "^4.5.0",
"vue-tsc": "^2.1.10"
"vue-tsc": "^2.2.0"
}
}
Loading

0 comments on commit 25613ae

Please sign in to comment.