tandd-ui 0.2.0 → 0.2.2

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 (2026-11-12)
4
+
5
+ ### Changed
6
+
7
+ - **README:** rewritten for people installing the package (install, set up, configure, components, accessibility). Repository development notes moved to `CONTRIBUTING.md`, which is not published.
8
+
9
+ ## 0.2.1 (2026-11-11)
10
+
11
+ ### Added
12
+
13
+ - **DTSelect and DTTreeSelect `variant`:** `soft` (default), `outlined`, `filled`, `underlined`, `plain`, matching DTInput. Set it app-wide with the same option as the text fields: `createTanDDUI({ global: { defaults: { DTInput: { variant: "outlined" } } } })` changes inputs and selects together; a `variant` prop on one select still wins. Outlined, underlined, and plain float the label onto the field exactly where DTInput puts it.
14
+
15
+ ### Changed
16
+
17
+ - **DTSelect and DTTreeSelect default look:** the trigger now uses the `soft` fill, like DTInput's default, instead of the plain surface. Set `variant="outlined"` (or the app-wide default) for a white field with a border.
18
+
3
19
  ## 0.2.0 (2026-11-11): component rebuild (0.x, breaking)
4
20
 
5
21
  First release on npm (`npm install tandd-ui`), under the MIT license.
package/README.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # TanDD UI
2
2
 
3
- Vue 3 component library built from the TanDD-UI HTML design reference: layout and typography primitives and more than 60 components, in light and dark themes, with localization (`en` and `vi` packs) and right-to-left support. Icons come from the `tandd-icon` package (SVG).
3
+ Vue 3 component library: more than 60 accessible components with light and dark themes, localization (English and Vietnamese packs), and right-to-left support.
4
+
5
+ ## Install
4
6
 
5
7
  ```sh
6
8
  npm install tandd-ui
7
9
  ```
8
10
 
9
- Requires Vue 3.5 or later. For the Sass source instead of the built CSS, use Sass's package importer: `@use "pkg:tandd-ui/styles.scss";` (Dart Sass 1.71+, `--pkg-importer=node` or the `NodePackageImporter`).
11
+ Requires Vue 3.5 or later. Icons come from [`tandd-icon`](https://www.npmjs.com/package/tandd-icon), installed with it.
12
+
13
+ ## Set up
14
+
15
+ Register the plugin once and import the stylesheet:
10
16
 
11
17
  ```ts
12
18
  import { createApp } from "vue";
@@ -17,81 +23,89 @@ import App from "./App.vue";
17
23
  createApp(App).use(createTanDDUI()).mount("#app");
18
24
  ```
19
25
 
20
- | Group | Components |
21
- |---|---|
22
- | Layout | DTContainer, DTRow, DTCol, DTGrid, DTGridItem, DTStack, DTInline, DTAppBar, DTLayout, DTMain, DTSurface, DTDivider |
23
- | Actions | DTButton, DTButtonGroup, DTMenu (+ DTMenuItem, DTMenuLabel, DTMenuSeparator), DTChip, DTChipGroup |
24
- | Forms | DTInput, DTNumberInput, DTOtpInput, DTTextarea, DTSelect, DTTreeSelect, DTAutocomplete, DTCombobox, DTMention, DTCheckbox, DTRadio, DTRadioGroup, DTSwitch, DTSlider, DTFileInput, DTFileUpload, DTDatePicker, DTDateInput, DTTimePicker, DTTimeInput, DTDateTimePicker, DTDateTimeInput, DTColorInput, DTColorPicker, DTRating |
25
- | Display | DTIcon, DTBadge, DTAvatar, DTAvatarGroup, DTCard (+ parts), DTList (+ DTListItem, DTListSubheader), DTTable, DTDataTable, DTAccordion, DTAccordionItem, DTCarousel (+ DTCarouselItem), DTTimeline (+ DTTimelineItem), DTBorderBeam, DTEmptyState, DTStatistic (+ DTCountdown), DTInfiniteScroll, DTPullRefresh, DTWatermark |
26
- | Feedback | DTAlert, DTToastRegion + `useToast()`, DTModal, DTSheet, DTPopover, DTTooltip, DTTour (+ DTTourStep), DTProgress, DTSpinner, DTSkeleton |
27
- | Navigation | DTNavigationDrawer, DTTabs, DTTab, DTStepper (+ DTStep), DTTreeview, DTBreadcrumb, DTPagination, DTAnchor (+ DTAnchorLink), DTSkipLink |
28
- | Foundations | DTText, DTHeading, DTLink, DTCode, DTKbd (one Typography page), DTField |
29
-
30
- See [CHANGELOG.md](CHANGELOG.md) for breaking changes from the earlier components.
26
+ Then import the components you use:
31
27
 
32
- ## Governance pack
28
+ ```vue
29
+ <script setup lang="ts">
30
+ import { ref } from "vue";
31
+ import { DTButton, DTInput, DTSelect } from "tandd-ui";
33
32
 
34
- This pack separates reusable product standards from the current rebuild contract and from AI execution instructions.
33
+ const name = ref("");
34
+ const plan = ref("pro");
35
+ </script>
35
36
 
36
- ## Target repository layout
37
+ <template>
38
+ <DTInput v-model="name" label="Project name" />
39
+ <DTSelect v-model="plan" label="Plan" :items="['free', 'pro', 'team']" />
40
+ <DTButton variant="primary">Create</DTButton>
41
+ </template>
42
+ ```
37
43
 
38
- Copy these files into the TanDD-UI repository using the paths below:
44
+ Toasts from `useToast()` need one `<DTToastRegion />` in your app, usually in the root component.
39
45
 
40
- - `docs/standards/COMPONENT-DOCUMENTATION-AND-DEMO-STANDARDS.md`
41
- - `docs/standards/COMPONENT-ENGINEERING-STANDARDS.md`
42
- - `docs/migration/COMPONENT-REBUILD-CONTRACT.md`
43
- - `docs/migration/COMPONENT-REBUILD-EXECUTION-PLAN.md`
44
- - `docs/ai/AI-PIPELINE-OPERATING-RULES.md`
45
- - `CLAUDE.md`
46
+ ## Configure
46
47
 
47
- ## Responsibility boundaries
48
+ Everything app-wide is set in `createTanDDUI()`:
48
49
 
49
- - **Standards** apply to every component and future change, not just migration.
50
- - **Rebuild contract** defines the scope and acceptance conditions for this rebuild.
51
- - **Execution plan** defines the approved order of work and gates.
52
- - **AI Pipeline operating rules** define how pipeline runs are requested, executed, recorded, and reviewed.
53
- - **CLAUDE.md** is the Claude Code entry point. It routes work to the standards and governance documents; it does not authorize bypassing the pipeline.
50
+ ```ts
51
+ import { vi } from "tandd-ui/locale/vi";
52
+
53
+ createTanDDUI({
54
+ theme: {
55
+ defaultTheme: "light",
56
+ themes: {
57
+ light: { dark: false, colors: { /* primary, surface, foreground, … */ } },
58
+ dark: { extends: "light", dark: true, colors: { /* … */ } }
59
+ }
60
+ },
61
+ global: {
62
+ locale: "vi-VN", // dates and numbers
63
+ messages: vi, // built-in text in Vietnamese
64
+ ripple: true,
65
+ defaults: {
66
+ DTButton: { size: "sm" },
67
+ DTInput: { variant: "outlined", size: "sm" } // inputs, selects, date and time fields
68
+ }
69
+ }
70
+ });
71
+ ```
54
72
 
55
- ## Important installation notes
73
+ - **Theme:** switch at runtime with `useTheme().setTheme("dark")`. Without a `theme` option you get one light theme.
74
+ - **Language:** switch at runtime with `useLocale().setLocale("en-US", en)`. A component's own text prop always wins.
75
+ - **Defaults:** a prop set on one component always wins over `defaults`.
56
76
 
57
- 1. This is a proposed governance pack, not a claim that files have already been installed in the local repository.
58
- 2. Merge the content of `CLAUDE.md` with any existing project-level Claude instructions instead of blindly overwriting existing instructions.
59
- 3. Preserve existing unrelated working-tree changes. Do not reset, restore, clean, commit, or push as part of installing these documents.
60
- 4. The 86 staged deletions previously identified as intentional cleanup remain intentional; do not restore them merely to make the worktree clean.
61
- 5. Do not start component implementation or a pipeline run until the owner approves the baseline contract and execution plan.
62
- 6. Before any destructive cleanup, inspect the actual repository and the HTML reference repository. Retain useful infrastructure and remove/rebuild old public components, old demo code, and old Playground content according to the approved contract.
77
+ ### Sass
63
78
 
64
- ## Development
79
+ To build from the Sass source instead of `styles.css`, use Sass's package importer (Dart Sass 1.71+):
65
80
 
66
- The library, documentation site, and Playground are separate apps that consume the built package in `dist/`.
81
+ ```scss
82
+ @use "pkg:tandd-ui/styles.scss";
83
+ ```
67
84
 
68
- ```sh
69
- npm install
70
- npm run build # library + stylesheet into dist/
85
+ ## Components
71
86
 
72
- npm run dev # watch library and styles
73
- npm run docs:dev # documentation site → http://127.0.0.1:5175
74
- npm run playground:dev # Playground → http://127.0.0.1:5174
75
- ```
87
+ | Group | Components |
88
+ |---|---|
89
+ | Layout | DTContainer, DTRow, DTCol, DTGrid, DTGridItem, DTStack, DTInline, DTAppBar, DTLayout, DTMain, DTSurface, DTDivider |
90
+ | Actions | DTButton, DTButtonGroup, DTMenu (+ DTMenuItem, DTMenuLabel, DTMenuSeparator), DTChip, DTChipGroup |
91
+ | Forms | DTInput, DTNumberInput, DTOtpInput, DTTextarea, DTSelect, DTTreeSelect, DTAutocomplete, DTCombobox, DTMention, DTCheckbox, DTRadio, DTRadioGroup, DTSwitch, DTSlider, DTFileInput, DTFileUpload, DTDatePicker, DTDateInput, DTTimePicker, DTTimeInput, DTDateTimePicker, DTDateTimeInput, DTColorInput, DTColorPicker, DTRating |
92
+ | Display | DTIcon, DTBadge, DTAvatar, DTAvatarGroup, DTCard (+ parts), DTList (+ DTListItem, DTListSubheader), DTTable, DTDataTable, DTAccordion, DTAccordionItem, DTCarousel (+ DTCarouselItem), DTTimeline (+ DTTimelineItem), DTBorderBeam, DTEmptyState, DTStatistic (+ DTCountdown), DTInfiniteScroll, DTPullRefresh, DTWatermark |
93
+ | Feedback | DTAlert, DTToastRegion + `useToast()`, DTModal, DTSheet, DTPopover, DTTooltip, DTTour (+ DTTourStep), DTProgress, DTSpinner, DTSkeleton |
94
+ | Navigation | DTNavigationDrawer, DTTabs, DTTab, DTStepper (+ DTStep), DTTreeview, DTBreadcrumb, DTPagination, DTAnchor (+ DTAnchorLink), DTSkipLink |
95
+ | Typography | DTText, DTHeading, DTLink, DTCode, DTKbd, DTField |
76
96
 
77
- Build and preview each site independently:
97
+ ## Accessibility
78
98
 
79
- ```sh
80
- npm run docs:build && npm run docs:preview # dist-docs/ → :4175
81
- npm run playground:build && npm run playground:preview # dist-playground/ → :4174
82
- ```
99
+ Components follow the WAI-ARIA Authoring Practices: keyboard support, focus management, screen-reader names, reduced motion, forced colors (Windows High Contrast), right-to-left layouts, and 24 × 24 px touch targets. Every built-in string is a prop, so it can be translated.
83
100
 
84
- `npm run check` runs typecheck, library build, tests, Playground build, and Docs build.
101
+ ## TypeScript
85
102
 
86
- ### Docs and Playground links
103
+ Types ship with the package. Props, events, slots, theme options, and message packs (`TanDDMessages`) are typed.
87
104
 
88
- Every Playground link on the docs site (the nav, the home page, and each demo's "Edit in TanDD Playground") opens in a new tab at the URL in `VITE_TANDD_PLAYGROUND_URL`:
105
+ ## Changelog
89
106
 
90
- | File | Value | Used by |
91
- |---|---|---|
92
- | `.env.development` | `http://127.0.0.1:5174/` | `docs:dev`; run `playground:dev` beside it |
93
- | `.env.production` | `/playground/` | `docs:build`, which copies `dist-playground/` into `dist-docs/playground/` (build the Playground first; `check` does) |
107
+ See [CHANGELOG.md](CHANGELOG.md).
94
108
 
95
- A site served under a sub-path, or a Playground on another host, sets the full URL in `.env.production.local` (not committed).
109
+ ## License
96
110
 
97
- A demo link is `<url>?component=<starter-key>&project=<demo files>[&theme=dark]`: the Playground opens the demo's own files, in the docs' current theme. Starter keys are `playgroundStarterKeys` in `examples/playground-contract.ts`, one folder each in `playground/starters/`; an unknown key opens the default starter. `npm run test:playground-links` opens every demo's link and checks the Playground renders what the docs render.
111
+ [MIT](LICENSE)
@@ -1,6 +1,8 @@
1
1
  import { HTMLAttributes } from 'vue';
2
2
  export type DTSelectItem = string | number | Record<string, unknown>;
3
3
  export type DTSelectSize = "sm" | "md" | "lg";
4
+ /** The field look, as DTInput: soft (default), outlined, filled, underlined, plain. */
5
+ export type DTSelectVariant = "soft" | "outlined" | "filled" | "underlined" | "plain";
4
6
  /** Panel options (`menu-props`). */
5
7
  export interface DTSelectMenuProps {
6
8
  /** Largest panel height: a px number or a CSS length. Default 360 px (or the viewport, whichever is smaller). */
@@ -34,6 +36,8 @@ type __VLS_Props = {
34
36
  clearable?: boolean;
35
37
  /** Trigger height 32, 40, or 48 px, matching DTInput. Default: `global.defaults.DTInput.size`, else md. */
36
38
  size?: DTSelectSize;
39
+ /** Field look, matching DTInput. Default: `global.defaults.DTInput.variant`, else soft. */
40
+ variant?: DTSelectVariant;
37
41
  /** Shows the value but cannot be opened, cleared, or changed. Stays focusable. */
38
42
  readonly?: boolean;
39
43
  /** Attributes for the listbox element (class, style, aria-*, data-*). The listbox role, id, and selection state stay DTSelect's. */
@@ -106,6 +110,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {},
106
110
  "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
107
111
  }>, {
108
112
  error: boolean | string;
113
+ variant: DTSelectVariant;
109
114
  size: DTSelectSize;
110
115
  label: string;
111
116
  clearLabel: string;
@@ -1,5 +1,5 @@
1
1
  import { DTTreeviewItem } from '../treeview/DTTreeview.vue';
2
- import { DTSelectSize } from '../select/DTSelect.vue';
2
+ import { DTSelectSize, DTSelectVariant } from '../select/DTSelect.vue';
3
3
  export type DTTreeSelectItem = DTTreeviewItem;
4
4
  type __VLS_Props = {
5
5
  /** The chosen value, or an array of values with `multiple`. */
@@ -30,6 +30,8 @@ type __VLS_Props = {
30
30
  readonly?: boolean;
31
31
  /** Trigger height, as DTSelect. Default: `global.defaults.DTInput.size`, else md. */
32
32
  size?: DTSelectSize;
33
+ /** Field look, as DTSelect. Default: `global.defaults.DTInput.variant`, else soft. */
34
+ variant?: DTSelectVariant;
33
35
  id?: string;
34
36
  /** Opens every branch when the panel first opens. */
35
37
  openAll?: boolean;
@@ -55,6 +57,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
55
57
  "onUpdate:menu"?: ((open: boolean) => any) | undefined;
56
58
  }>, {
57
59
  error: boolean | string;
60
+ variant: DTSelectVariant;
58
61
  size: DTSelectSize;
59
62
  label: string;
60
63
  clearLabel: string;
package/dist/index.d.ts CHANGED
@@ -63,7 +63,7 @@ export type { DTMenuItemType } from './components/menu/DTMenuItem.vue';
63
63
  export { default as DTMenuLabel } from './components/menu/DTMenuLabel.vue';
64
64
  export { default as DTMenuSeparator } from './components/menu/DTMenuSeparator.vue';
65
65
  export { default as DTSelect } from './components/select/DTSelect.vue';
66
- export type { DTSelectAttrs, DTSelectItem, DTSelectMenuProps } from './components/select/DTSelect.vue';
66
+ export type { DTSelectAttrs, DTSelectItem, DTSelectMenuProps, DTSelectSize, DTSelectVariant } from './components/select/DTSelect.vue';
67
67
  export { default as DTModal } from './components/modal/DTModal.vue';
68
68
  export type { DTModalFullscreen, DTModalSize } from './components/modal/DTModal.vue';
69
69
  export { default as DTToastRegion } from './components/toast/DTToastRegion.vue';
package/dist/tandd-ui.css CHANGED
@@ -4988,6 +4988,81 @@ select {
4988
4988
  white-space: nowrap;
4989
4989
  }
4990
4990
 
4991
+ .dt-select--soft .dt-select__trigger {
4992
+ background: var(--dt-color-surface-muted);
4993
+ }
4994
+
4995
+ .dt-select--soft .dt-select__trigger:focus-visible,
4996
+ .dt-select--soft.is-open .dt-select__trigger {
4997
+ background: var(--dt-color-surface);
4998
+ }
4999
+
5000
+ .dt-select--outlined .dt-select__trigger {
5001
+ border-radius: var(--dt-radius-md);
5002
+ background: var(--dt-color-surface);
5003
+ }
5004
+
5005
+ .dt-select--outlined .dt-select__trigger:focus-visible,
5006
+ .dt-select--outlined.is-open .dt-select__trigger {
5007
+ box-shadow: inset 0 0 0 1px var(--dt-color-primary);
5008
+ }
5009
+
5010
+ .dt-select--filled .dt-select__trigger {
5011
+ border-width: 0 0 2px;
5012
+ border-radius: var(--dt-radius-sm) var(--dt-radius-sm) 0 0;
5013
+ background: var(--dt-color-surface-muted);
5014
+ }
5015
+
5016
+ .dt-select--underlined .dt-select__trigger,
5017
+ .dt-select--plain .dt-select__trigger {
5018
+ padding-inline: 0;
5019
+ border-radius: 0;
5020
+ background: transparent;
5021
+ }
5022
+
5023
+ .dt-select--underlined .dt-select__trigger {
5024
+ border-width: 0 0 1px;
5025
+ }
5026
+
5027
+ .dt-select--underlined .dt-select__trigger:focus-visible,
5028
+ .dt-select--underlined.is-open .dt-select__trigger {
5029
+ box-shadow: inset 0 -1px 0 var(--dt-color-primary);
5030
+ }
5031
+
5032
+ .dt-select--plain .dt-select__trigger {
5033
+ border-width: 0;
5034
+ }
5035
+
5036
+ .dt-select--plain .dt-select__trigger:focus-visible,
5037
+ .dt-select--plain.is-open .dt-select__trigger {
5038
+ box-shadow: inset 0 -2px 0 var(--dt-color-primary);
5039
+ }
5040
+
5041
+ .dt-select--plain.is-invalid .dt-select__trigger {
5042
+ box-shadow: inset 0 -2px 0 var(--dt-color-danger);
5043
+ }
5044
+
5045
+ .dt-select .dt-select__trigger:disabled {
5046
+ background: var(--dt-color-surface-muted);
5047
+ }
5048
+
5049
+ .dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger:hover:not(:disabled) {
5050
+ background: transparent;
5051
+ }
5052
+
5053
+ .dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__chips {
5054
+ padding-inline-start: 0;
5055
+ }
5056
+
5057
+ .dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__clear {
5058
+ inset-inline-end: 22px;
5059
+ }
5060
+
5061
+ .dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger:disabled,
5062
+ .dt-select.is-readonly:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger {
5063
+ background: transparent;
5064
+ }
5065
+
4991
5066
  .dt-select--sm .dt-select__trigger {
4992
5067
  height: 32px;
4993
5068
  padding: 0 10px;
@@ -5023,6 +5098,62 @@ select {
5023
5098
  height: 100%;
5024
5099
  }
5025
5100
 
5101
+ .dt-select--floating {
5102
+ position: relative;
5103
+ gap: 0;
5104
+ }
5105
+
5106
+ .dt-select--floating .dt-select__label {
5107
+ position: absolute;
5108
+ z-index: 2;
5109
+ left: 0;
5110
+ max-width: calc(100% - 24px);
5111
+ overflow: hidden;
5112
+ font-size: 11px;
5113
+ line-height: 1.2;
5114
+ white-space: nowrap;
5115
+ text-overflow: ellipsis;
5116
+ pointer-events: none;
5117
+ transform: translateY(-50%);
5118
+ }
5119
+
5120
+ .dt-select--floating.dt-select--outlined {
5121
+ padding-top: 7px;
5122
+ }
5123
+
5124
+ .dt-select--floating.dt-select--outlined .dt-select__label {
5125
+ top: 7px;
5126
+ left: 9px;
5127
+ padding: 0 4px;
5128
+ background: var(--dt-color-surface);
5129
+ }
5130
+
5131
+ .dt-select--floating:is(.dt-select--underlined, .dt-select--plain) {
5132
+ padding-top: 10px;
5133
+ }
5134
+
5135
+ .dt-select--floating:is(.dt-select--underlined, .dt-select--plain) .dt-select__label {
5136
+ top: 8px;
5137
+ font-size: 12px;
5138
+ }
5139
+
5140
+ .dt-select--floating:has(.dt-select__trigger:focus-visible) .dt-select__label,
5141
+ .dt-select--floating.is-open .dt-select__label {
5142
+ color: var(--dt-color-primary);
5143
+ }
5144
+
5145
+ .dt-select--floating.is-invalid .dt-select__label {
5146
+ color: var(--dt-color-danger);
5147
+ }
5148
+
5149
+ .dt-select--floating.is-disabled .dt-select__label {
5150
+ color: var(--dt-color-text-disabled);
5151
+ }
5152
+
5153
+ .dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger {
5154
+ padding-inline: 0;
5155
+ }
5156
+
5026
5157
  .dt-select.is-readonly .dt-select__trigger {
5027
5158
  background: var(--dt-color-surface-muted);
5028
5159
  cursor: default;